diff --git a/Android.bp b/Android.bp
deleted file mode 100644
index 0b4a925..0000000
--- a/Android.bp
+++ /dev/null
@@ -1,4 +0,0 @@
-filegroup {
-    name: "android_filesystem_config_header",
-    srcs: ["include/private/android_filesystem_config.h"],
-}
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index c8dbf77..dcf92be 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -3,3 +3,6 @@
 
 [Builtin Hooks Options]
 clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
+
+[Hook Scripts]
+aosp_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "."
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 0ec505d..52cff94 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -7,22 +7,28 @@
       "name": "adb_crypto_test"
     },
     {
+      "name": "adb_pairing_auth_test"
+    },
+    {
+      "name": "adb_pairing_connection_test"
+    },
+    {
       "name": "adb_tls_connection_test"
     },
     {
+      "name": "CtsFsMgrTestCases"
+    },
+    {
       "name": "CtsInitTestCases"
     },
     {
       "name": "debuggerd_test"
     },
     {
-      "name": "CtsFsMgrTestCases"
-    },
-    {
       "name": "fs_mgr_vendor_overlay_test"
     },
     {
-      "name": "libbase_test"
+      "name": "init_kill_services_test"
     },
     {
       "name": "libpackagelistparser_test"
@@ -54,9 +60,11 @@
     },
     {
       "name": "propertyinfoserializer_tests"
-    },
+    }
+  ],
+  "imports": [
     {
-      "name": "ziparchive-tests"
+      "path": "frameworks/base/tests/StagedInstallTest"
     }
   ]
 }
diff --git a/adb/.clang-format b/adb/.clang-format
deleted file mode 120000
index 1af4f51..0000000
--- a/adb/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-4
\ No newline at end of file
diff --git a/adb/Android.bp b/adb/Android.bp
deleted file mode 100644
index dee48bf..0000000
--- a/adb/Android.bp
+++ /dev/null
@@ -1,821 +0,0 @@
-// Copyright (C) 2017 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.
-
-cc_defaults {
-    name: "adb_defaults",
-
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-Wexit-time-destructors",
-        "-Wno-unused-parameter",
-        "-Wno-missing-field-initializers",
-        "-Wthread-safety",
-        "-Wvla",
-        "-DADB_HOST=1",         // overridden by adbd_defaults
-        "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
-    ],
-    cpp_std: "experimental",
-
-    use_version_lib: true,
-    compile_multilib: "first",
-
-    target: {
-        darwin: {
-            host_ldlibs: [
-                "-lpthread",
-                "-framework CoreFoundation",
-                "-framework IOKit",
-                "-lobjc",
-            ],
-        },
-
-        windows: {
-            cflags: [
-                // Define windows.h and tchar.h Unicode preprocessor symbols so that
-                // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
-                // build if you accidentally pass char*. Fix by calling like:
-                //   std::wstring path_wide;
-                //   if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
-                //   CreateFileW(path_wide.c_str());
-                "-DUNICODE=1",
-                "-D_UNICODE=1",
-
-                // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
-                "-D_GNU_SOURCE",
-
-                // MinGW hides some things behind _POSIX_SOURCE.
-                "-D_POSIX_SOURCE",
-
-                // libusb uses __stdcall on a variadic function, which gets ignored.
-                "-Wno-ignored-attributes",
-
-                // Not supported yet.
-                "-Wno-thread-safety",
-            ],
-
-            host_ldlibs: [
-                "-lws2_32",
-                "-lgdi32",
-                "-luserenv",
-            ],
-        },
-    },
-}
-
-cc_defaults {
-    name: "adbd_defaults",
-    defaults: ["adb_defaults"],
-
-    cflags: ["-UADB_HOST", "-DADB_HOST=0"],
-}
-
-cc_defaults {
-    name: "host_adbd_supported",
-
-    host_supported: true,
-    target: {
-        linux: {
-            enabled: true,
-            host_ldlibs: [
-                "-lresolv", // b64_pton
-                "-lutil", // forkpty
-            ],
-        },
-        darwin: {
-            enabled: false,
-        },
-        windows: {
-            enabled: false,
-        },
-    },
-}
-
-cc_defaults {
-    name: "libadbd_binary_dependencies",
-    static_libs: [
-        "libadb_crypto",
-        "libadb_pairing_connection",
-        "libadb_tls_connection",
-        "libadbd",
-        "libadbd_core",
-        "libadbconnection_server",
-        "libasyncio",
-        "libbrotli",
-        "libcutils_sockets",
-        "libdiagnose_usb",
-        "libmdnssd",
-        "libbase",
-
-        "libadb_protos",
-    ],
-
-    shared_libs: [
-        "libadbd_auth",
-        "libadbd_fs",
-        "libcrypto",
-        "libcrypto_utils",
-        "liblog",
-        "libselinux",
-    ],
-
-    target: {
-        recovery: {
-            exclude_static_libs: [
-                "libadb_pairing_auth",
-                "libadb_pairing_connection",
-            ],
-        },
-    },
-}
-
-// libadb
-// =========================================================
-// These files are compiled for both the host and the device.
-libadb_srcs = [
-    "adb.cpp",
-    "adb_io.cpp",
-    "adb_listeners.cpp",
-    "adb_trace.cpp",
-    "adb_unique_fd.cpp",
-    "adb_utils.cpp",
-    "fdevent/fdevent.cpp",
-    "fdevent/fdevent_poll.cpp",
-    "services.cpp",
-    "sockets.cpp",
-    "socket_spec.cpp",
-    "sysdeps/errno.cpp",
-    "transport.cpp",
-    "transport_fd.cpp",
-    "transport_local.cpp",
-    "types.cpp",
-]
-
-libadb_posix_srcs = [
-    "sysdeps_unix.cpp",
-    "sysdeps/posix/network.cpp",
-]
-
-libadb_linux_srcs = [
-    "fdevent/fdevent_epoll.cpp",
-]
-
-libadb_test_srcs = [
-    "adb_io_test.cpp",
-    "adb_listeners_test.cpp",
-    "adb_utils_test.cpp",
-    "fdevent/fdevent_test.cpp",
-    "socket_spec_test.cpp",
-    "socket_test.cpp",
-    "sysdeps_test.cpp",
-    "sysdeps/stat_test.cpp",
-    "transport_test.cpp",
-    "types_test.cpp",
-]
-
-cc_library_host_static {
-    name: "libadb_host",
-    defaults: ["adb_defaults"],
-
-    srcs: libadb_srcs + [
-        "client/auth.cpp",
-        "client/adb_wifi.cpp",
-        "client/usb_libusb.cpp",
-        "client/usb_dispatch.cpp",
-        "client/transport_mdns.cpp",
-        "client/transport_usb.cpp",
-        "client/pairing/pairing_client.cpp",
-    ],
-
-    generated_headers: ["platform_tools_version"],
-
-    target: {
-        linux: {
-            srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
-        },
-        darwin: {
-            srcs: ["client/usb_osx.cpp"],
-        },
-        not_windows: {
-            srcs: libadb_posix_srcs,
-        },
-        windows: {
-            enabled: true,
-            srcs: [
-                "client/usb_windows.cpp",
-                "sysdeps_win32.cpp",
-                "sysdeps/win32/errno.cpp",
-                "sysdeps/win32/stat.cpp",
-            ],
-            shared_libs: ["AdbWinApi"],
-        },
-    },
-
-    static_libs: [
-        "libadb_crypto",
-        "libadb_protos",
-        "libadb_pairing_connection",
-        "libadb_tls_connection",
-        "libbase",
-        "libcrypto_utils",
-        "libcrypto",
-        "libdiagnose_usb",
-        "libmdnssd",
-        "libusb",
-        "libutils",
-        "liblog",
-        "libcutils",
-        "libprotobuf-cpp-lite",
-    ],
-}
-
-cc_test_host {
-    name: "adb_test",
-    defaults: ["adb_defaults"],
-    srcs: libadb_test_srcs,
-    static_libs: [
-        "libadb_crypto_static",
-        "libadb_host",
-        "libadb_pairing_auth_static",
-        "libadb_pairing_connection_static",
-        "libadb_protos_static",
-        "libadb_tls_connection_static",
-        "libbase",
-        "libcutils",
-        "libcrypto_utils",
-        "libcrypto",
-        "liblog",
-        "libmdnssd",
-        "libdiagnose_usb",
-        "libprotobuf-cpp-lite",
-        "libssl",
-        "libusb",
-    ],
-
-    target: {
-        windows: {
-            enabled: true,
-            ldflags: ["-municode"],
-            shared_libs: ["AdbWinApi"],
-        },
-    },
-}
-
-cc_binary_host {
-    name: "adb",
-
-    stl: "libc++_static",
-    defaults: ["adb_defaults"],
-
-    srcs: [
-        "client/adb_client.cpp",
-        "client/bugreport.cpp",
-        "client/commandline.cpp",
-        "client/file_sync_client.cpp",
-        "client/main.cpp",
-        "client/console.cpp",
-        "client/adb_install.cpp",
-        "client/line_printer.cpp",
-        "client/fastdeploy.cpp",
-        "client/fastdeploycallbacks.cpp",
-        "client/incremental.cpp",
-        "client/incremental_server.cpp",
-        "client/incremental_utils.cpp",
-        "shell_service_protocol.cpp",
-    ],
-
-    generated_headers: [
-        "bin2c_fastdeployagent",
-        "bin2c_fastdeployagentscript"
-    ],
-
-    static_libs: [
-        "libadb_crypto",
-        "libadb_host",
-	"libadb_pairing_auth",
-	"libadb_pairing_connection",
-        "libadb_protos",
-        "libadb_tls_connection",
-        "libandroidfw",
-        "libbase",
-        "libbrotli",
-        "libcutils",
-        "libcrypto_utils",
-        "libcrypto",
-        "libfastdeploy_host",
-        "libdiagnose_usb",
-        "liblog",
-        "liblz4",
-        "libmdnssd",
-        "libprotobuf-cpp-lite",
-        "libssl",
-        "libusb",
-        "libutils",
-        "liblog",
-        "libziparchive",
-        "libz",
-    ],
-
-    // Don't add anything here, we don't want additional shared dependencies
-    // on the host adb tool, and shared libraries that link against libc++
-    // will violate ODR
-    shared_libs: [],
-
-    // Archive adb, adb.exe.
-    dist: {
-        targets: [
-            "dist_files",
-            "sdk",
-            "win_sdk",
-        ],
-    },
-
-    target: {
-        darwin: {
-            cflags: [
-                "-Wno-sizeof-pointer-memaccess",
-            ],
-        },
-        windows: {
-            enabled: true,
-            ldflags: ["-municode"],
-            shared_libs: ["AdbWinApi"],
-            required: [
-                "AdbWinUsbApi",
-            ],
-        },
-    },
-}
-
-// libadbd_core contains the common sources to build libadbd and libadbd_services.
-cc_library_static {
-    name: "libadbd_core",
-    defaults: ["adbd_defaults", "host_adbd_supported"],
-    recovery_available: true,
-
-    // libminadbd wants both, as it's used to build native tests.
-    compile_multilib: "both",
-
-    srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
-        "daemon/auth.cpp",
-        "daemon/jdwp_service.cpp",
-        "daemon/logging.cpp",
-        "daemon/adb_wifi.cpp",
-    ],
-
-    generated_headers: ["platform_tools_version"],
-
-    static_libs: [
-        "libadbconnection_server",
-        "libdiagnose_usb",
-    ],
-
-    shared_libs: [
-        "libadb_crypto",
-        "libadb_pairing_connection",
-        "libadb_protos",
-        "libadb_tls_connection",
-        "libadbd_auth",
-        "libasyncio",
-        "libbase",
-        "libcrypto",
-        "libcrypto_utils",
-        "libcutils_sockets",
-        "liblog",
-    ],
-
-    target: {
-        android: {
-            whole_static_libs: [
-                "libqemu_pipe",
-            ],
-            srcs: [
-                "daemon/transport_qemu.cpp",
-                "daemon/usb.cpp",
-                "daemon/usb_ffs.cpp",
-            ]
-        },
-        recovery: {
-            exclude_shared_libs: [
-                "libadb_pairing_auth",
-                "libadb_pairing_connection",
-            ],
-        }
-    },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.adbd",
-    ],
-    visibility: [
-        "//bootable/recovery/minadbd",
-        "//system/core/adb",
-    ],
-}
-
-cc_library {
-    name: "libadbd_services",
-    defaults: ["adbd_defaults", "host_adbd_supported"],
-    recovery_available: true,
-    compile_multilib: "both",
-
-    srcs: [
-        "daemon/file_sync_service.cpp",
-        "daemon/services.cpp",
-        "daemon/shell_service.cpp",
-        "shell_service_protocol.cpp",
-    ],
-
-    cflags: [
-        "-D_GNU_SOURCE",
-        "-Wno-deprecated-declarations",
-    ],
-
-    static_libs: [
-        "libadbconnection_server",
-        "libadbd_core",
-        "libbrotli",
-        "libdiagnose_usb",
-    ],
-
-    shared_libs: [
-        "libadb_crypto",
-        "libadb_pairing_connection",
-        "libadb_protos",
-        "libadb_tls_connection",
-        "libasyncio",
-        "libbase",
-        "libcrypto_utils",
-        "libcutils_sockets",
-
-        // APEX dependencies.
-        "libadbd_auth",
-        "libadbd_fs",
-        "libcrypto",
-        "liblog",
-    ],
-
-    target: {
-        android: {
-            srcs: [
-                "daemon/abb_service.cpp",
-                "daemon/framebuffer_service.cpp",
-                "daemon/mdns.cpp",
-                "daemon/restart_service.cpp",
-            ],
-            shared_libs: [
-                "libmdnssd",
-                "libselinux",
-            ],
-        },
-        recovery: {
-            exclude_srcs: [
-                "daemon/abb_service.cpp",
-            ],
-            exclude_shared_libs: [
-                "libadb_pairing_auth",
-                "libadb_pairing_connection",
-            ],
-        },
-    },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.adbd",
-    ],
-    visibility: [
-        "//system/core/adb",
-    ],
-
-}
-
-cc_library {
-    name: "libadbd",
-    defaults: ["adbd_defaults", "host_adbd_supported"],
-    recovery_available: true,
-    apex_available: ["com.android.adbd"],
-
-    // avoid getting duplicate symbol of android::build::getbuildnumber().
-    use_version_lib: false,
-
-    // libminadbd wants both, as it's used to build native tests.
-    compile_multilib: "both",
-
-    shared_libs: [
-        "libadb_crypto",
-        "libadb_pairing_connection",
-        "libadb_tls_connection",
-        "libasyncio",
-        "libbase",
-        "libcrypto",
-        "libcrypto_utils",
-        "liblog",
-        "libselinux",
-
-        // APEX dependencies on the system image.
-        "libadbd_auth",
-        "libadbd_fs",
-        "libadbd_services",
-    ],
-
-    target: {
-        recovery: {
-            exclude_shared_libs: [
-                "libadb_pairing_auth",
-                "libadb_pairing_connection",
-            ],
-        }
-    },
-
-    static_libs: [
-        "libadbd_core",
-        "libbrotli",
-        "libcutils_sockets",
-        "libdiagnose_usb",
-        "libmdnssd",
-    ],
-
-    visibility: [
-        "//bootable/recovery/minadbd",
-        "//system/core/adb",
-    ],
-}
-
-cc_binary {
-    name: "adbd",
-    defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
-    recovery_available: true,
-    apex_available: ["com.android.adbd"],
-
-    srcs: [
-        "daemon/main.cpp",
-    ],
-
-    cflags: [
-        "-D_GNU_SOURCE",
-        "-Wno-deprecated-declarations",
-    ],
-
-    strip: {
-        keep_symbols: true,
-    },
-
-    static_libs: [
-        "libadbd",
-        "libadbd_services",
-        "libasyncio",
-        "libcap",
-        "libminijail",
-        "libssl",
-    ],
-
-    shared_libs: [
-        "libadb_protos",
-        "libadbd_auth",
-    ],
-
-    target: {
-        recovery: {
-            exclude_shared_libs: [
-                "libadb_pairing_auth",
-                "libadb_pairing_connection",
-            ],
-        }
-    },
-}
-
-phony {
-    // Interface between adbd in a module and the system.
-    name: "adbd_system_api",
-    required: [
-        "libadbd_auth",
-        "libadbd_fs",
-        "abb",
-        "reboot",
-        "set-verity-state",
-    ]
-}
-
-phony {
-    name: "adbd_system_api_recovery",
-    required: [
-        "libadbd_auth",
-        "libadbd_fs",
-        "reboot.recovery",
-    ],
-}
-
-cc_binary {
-    name: "abb",
-
-    defaults: ["adbd_defaults"],
-    stl: "libc++",
-    recovery_available: false,
-
-    srcs: [
-        "daemon/abb.cpp",
-    ],
-
-    cflags: [
-        "-D_GNU_SOURCE",
-        "-Wno-deprecated-declarations",
-    ],
-
-    strip: {
-        keep_symbols: true,
-    },
-
-    static_libs: [
-        "libadbd_core",
-        "libadbd_services",
-        "libcmd",
-    ],
-
-    shared_libs: [
-        "libbase",
-        "libbinder",
-        "liblog",
-        "libutils",
-        "libselinux",
-    ],
-}
-
-cc_test {
-    name: "adbd_test",
-
-    defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
-
-    recovery_available: false,
-    srcs: libadb_test_srcs + [
-        "daemon/services.cpp",
-        "daemon/shell_service.cpp",
-        "daemon/shell_service_test.cpp",
-        "shell_service_protocol.cpp",
-        "shell_service_protocol_test.cpp",
-        "mdns_test.cpp",
-    ],
-
-    test_config: "adb_test.xml",
-
-    shared_libs: [
-        "liblog",
-    ],
-
-    static_libs: [
-        "libadbd",
-        "libadbd_auth",
-        "libbase",
-        "libcrypto_utils",
-        "libusb",
-    ],
-    test_suites: ["device-tests", "mts"],
-    require_root: true,
-}
-
-python_test_host {
-    name: "adb_integration_test_adb",
-    main: "test_adb.py",
-    srcs: [
-        "test_adb.py",
-    ],
-    test_config: "adb_integration_test_adb.xml",
-    test_suites: ["general-tests"],
-    version: {
-        py2: {
-            enabled: false,
-        },
-        py3: {
-            enabled: true,
-        },
-    },
-}
-
-python_test_host {
-    name: "adb_integration_test_device",
-    main: "test_device.py",
-    srcs: [
-        "test_device.py",
-    ],
-    libs: [
-        "adb_py",
-    ],
-    test_config: "adb_integration_test_device.xml",
-    test_suites: ["general-tests"],
-    version: {
-        py2: {
-            enabled: false,
-        },
-        py3: {
-            enabled: true,
-        },
-    },
-}
-
-// Note: using pipe for xxd to control the variable name generated
-// the default name used by xxd is the path to the input file.
-java_genrule {
-    name: "bin2c_fastdeployagent",
-    out: ["deployagent.inc"],
-    srcs: [":deployagent"],
-    cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
-}
-
-genrule {
-    name: "bin2c_fastdeployagentscript",
-    out: ["deployagentscript.inc"],
-    srcs: ["fastdeploy/deployagent/deployagent.sh"],
-    cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
-}
-
-cc_library_host_static {
-    name: "libfastdeploy_host",
-    defaults: ["adb_defaults"],
-    srcs: [
-        "fastdeploy/deploypatchgenerator/apk_archive.cpp",
-        "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
-        "fastdeploy/deploypatchgenerator/patch_utils.cpp",
-        "fastdeploy/proto/ApkEntry.proto",
-    ],
-    static_libs: [
-        "libadb_host",
-        "libandroidfw",
-        "libbase",
-        "libcutils",
-        "libcrypto_utils",
-        "libcrypto",
-        "libdiagnose_usb",
-        "liblog",
-        "libmdnssd",
-        "libusb",
-        "libutils",
-        "libziparchive",
-        "libz",
-    ],
-    proto: {
-        type: "lite",
-        export_proto_headers: true,
-    },
-    target: {
-        windows: {
-            enabled: true,
-            shared_libs: ["AdbWinApi"],
-        },
-    },
-}
-
-cc_test_host {
-    name: "fastdeploy_test",
-    defaults: ["adb_defaults"],
-    srcs: [
-        "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
-        "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
-        "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
-    ],
-    static_libs: [
-        "libadb_crypto_static",
-        "libadb_host",
-        "libadb_pairing_auth_static",
-        "libadb_pairing_connection_static",
-        "libadb_protos_static",
-        "libadb_tls_connection_static",
-        "libandroidfw",
-        "libbase",
-        "libcutils",
-        "libcrypto_utils",
-        "libcrypto",
-        "libdiagnose_usb",
-        "libfastdeploy_host",
-        "liblog",
-        "libmdnssd",
-        "libprotobuf-cpp-lite",
-        "libssl",
-        "libusb",
-        "libutils",
-        "libziparchive",
-        "libz",
-    ],
-    target: {
-        windows: {
-            enabled: true,
-            shared_libs: ["AdbWinApi"],
-        },
-    },
-    data: [
-        "fastdeploy/testdata/rotating_cube-metadata-release.data",
-        "fastdeploy/testdata/rotating_cube-release.apk",
-        "fastdeploy/testdata/sample.apk",
-        "fastdeploy/testdata/sample.cd",
-    ],
-}
diff --git a/adb/NOTICE b/adb/NOTICE
deleted file mode 100644
index 9ffcc08..0000000
--- a/adb/NOTICE
+++ /dev/null
@@ -1,191 +0,0 @@
-
-   Copyright (c) 2006-2009, The Android Open Source Project
-   Copyright 2006, Brian Swetland <swetland@frotz.net>
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
diff --git a/adb/OVERVIEW.TXT b/adb/OVERVIEW.TXT
deleted file mode 100644
index f0b184c..0000000
--- a/adb/OVERVIEW.TXT
+++ /dev/null
@@ -1,135 +0,0 @@
-Implementation notes regarding ADB.
-
-I. General Overview:
-
-The Android Debug Bridge (ADB) is used to:
-
-- keep track of all Android devices and emulators instances
-  connected to or running on a given host developer machine
-
-- implement various control commands (e.g. "adb shell", "adb pull", etc.)
-  for the benefit of clients (command-line users, or helper programs like
-  DDMS). These commands are called 'services' in ADB.
-
-As a whole, everything works through the following components:
-
-  1. The ADB server
-
-    This is a background process that runs on the host machine. Its purpose
-    is to sense the USB ports to know when devices are attached/removed,
-    as well as when emulator instances start/stop.
-
-    It thus maintains a list of "connected devices" and assigns a 'state'
-    to each one of them: OFFLINE, BOOTLOADER, RECOVERY or ONLINE (more on
-    this below).
-
-    The ADB server is really one giant multiplexing loop whose purpose is
-    to orchestrate the exchange of data (packets, really) between clients,
-    services and devices.
-
-
-  2. The ADB daemon (adbd)
-
-    The 'adbd' program runs as a background process within an Android device
-    or emulated system. Its purpose is to connect to the ADB server
-    (through USB for devices, through TCP for emulators) and provide a
-    few services for clients that run on the host.
-
-    The ADB server considers that a device is ONLINE when it has successfully
-    connected to the adbd program within it. Otherwise, the device is OFFLINE,
-    meaning that the ADB server detected a new device/emulator, but could not
-    connect to the adbd daemon.
-
-    The BOOTLOADER and RECOVERY states correspond to alternate states of
-    devices when they are in the bootloader or recovery mode.
-
-  3. The ADB command-line client
-
-    The 'adb' command-line program is used to run adb commands from a shell
-    or a script. It first tries to locate the ADB server on the host machine,
-    and will start one automatically if none is found.
-
-    Then, the client sends its service requests to the ADB server.
-
-    Currently, a single 'adb' binary is used for both the server and client.
-    this makes distribution and starting the server easier.
-
-
-  4. Services
-
-    There are essentially two kinds of services that a client can talk to.
-
-    Host Services:
-      These services run within the ADB Server and thus do not need to
-      communicate with a device at all. A typical example is "adb devices"
-      which is used to return the list of currently known devices and their
-      states. They are a few other services though.
-
-    Local Services:
-      These services either run within the adbd daemon, or are started by
-      it on the device. The ADB server is used to multiplex streams
-      between the client and the service running in adbd. In this case
-      its role is to initiate the connection, then of being a pass-through
-      for the data.
-
-
-II. Protocol details:
-
-  1. Client <-> Server protocol:
-
-    This details the protocol used between ADB clients and the ADB
-    server itself. The ADB server listens on TCP:localhost:5037.
-
-    A client sends a request using the following format:
-
-        1. A 4-byte hexadecimal string giving the length of the payload
-        2. Followed by the payload itself.
-
-    For example, to query the ADB server for its internal version number,
-    the client will do the following:
-
-        1. Connect to tcp:localhost:5037
-        2. Send the string "000Chost:version" to the corresponding socket
-
-    The 'host:' prefix is used to indicate that the request is addressed
-    to the server itself (we will talk about other kinds of requests later).
-    The content length is encoded in ASCII for easier debugging.
-
-    The server should answer a request with one of the following:
-
-        1. For success, the 4-byte "OKAY" string
-
-        2. For failure, the 4-byte "FAIL" string, followed by a
-           4-byte hex length, followed by a string giving the reason
-           for failure.
-
-    Note that the connection is still alive after an OKAY, which allows the
-    client to make other requests. But in certain cases, an OKAY will even
-    change the state of the connection.
-
-    For example, the case of the 'host:transport:<serialnumber>' request,
-    where '<serialnumber>' is used to identify a given device/emulator; after
-    the "OKAY" answer, all further requests made by the client will go
-    directly to the corresponding adbd daemon.
-
-    The file SERVICES.TXT lists all services currently implemented by ADB.
-
-
-  2. Transports:
-
-    An ADB transport models a connection between the ADB server and one device
-    or emulator. There are currently two kinds of transports:
-
-       - USB transports, for physical devices through USB
-
-       - Local transports, for emulators running on the host, connected to
-         the server through TCP
-
-    In theory, it should be possible to write a local transport that proxies
-    a connection between an ADB server and a device/emulator connected to/
-    running on another machine. This hasn't been done yet though.
-
-    Each transport can carry one or more multiplexed streams between clients
-    and the device/emulator they point to. The ADB server must handle
-    unexpected transport disconnections (e.g. when a device is physically
-    unplugged) properly.
diff --git a/adb/OWNERS b/adb/OWNERS
deleted file mode 100644
index 643b448..0000000
--- a/adb/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-jmgao@google.com
-yabinc@google.com
diff --git a/adb/SERVICES.TXT b/adb/SERVICES.TXT
deleted file mode 100644
index 3e18a54..0000000
--- a/adb/SERVICES.TXT
+++ /dev/null
@@ -1,255 +0,0 @@
-This file tries to document all requests a client can make
-to the ADB server of an adbd daemon. See the OVERVIEW.TXT document
-to understand what's going on here.
-
-HOST SERVICES:
-
-host:version
-    Ask the ADB server for its internal version number.
-
-host:kill
-    Ask the ADB server to quit immediately. This is used when the
-    ADB client detects that an obsolete server is running after an
-    upgrade.
-
-host:devices
-host:devices-l
-    Ask to return the list of available Android devices and their
-    state. devices-l includes the device paths in the state.
-    After the OKAY, this is followed by a 4-byte hex len,
-    and a string that will be dumped as-is by the client, then
-    the connection is closed
-
-host:track-devices
-    This is a variant of host:devices which doesn't close the
-    connection. Instead, a new device list description is sent
-    each time a device is added/removed or the state of a given
-    device changes (hex4 + content). This allows tools like DDMS
-    to track the state of connected devices in real-time without
-    polling the server repeatedly.
-
-host:emulator:<port>
-    This is a special query that is sent to the ADB server when a
-    new emulator starts up. <port> is a decimal number corresponding
-    to the emulator's ADB control port, i.e. the TCP port that the
-    emulator will forward automatically to the adbd daemon running
-    in the emulator system.
-
-    This mechanism allows the ADB server to know when new emulator
-    instances start.
-
-host:transport:<serial-number>
-    Ask to switch the connection to the device/emulator identified by
-    <serial-number>. After the OKAY response, every client request will
-    be sent directly to the adbd daemon running on the device.
-    (Used to implement the -s option)
-
-host:transport-usb
-    Ask to switch the connection to one device connected through USB
-    to the host machine. This will fail if there are more than one such
-    devices. (Used to implement the -d convenience option)
-
-host:transport-local
-    Ask to switch the connection to one emulator connected through TCP.
-    This will fail if there is more than one such emulator instance
-    running. (Used to implement the -e convenience option)
-
-host:transport-any
-    Another host:transport variant. Ask to switch the connection to
-    either the device or emulator connect to/running on the host.
-    Will fail if there is more than one such device/emulator available.
-    (Used when neither -s, -d or -e are provided)
-
-host-serial:<serial-number>:<request>
-    This is a special form of query, where the 'host-serial:<serial-number>:'
-    prefix can be used to indicate that the client is asking the ADB server
-    for information related to a specific device. <request> can be in one
-    of the format described below.
-
-host-usb:<request>
-    A variant of host-serial used to target the single USB device connected
-    to the host. This will fail if there is none or more than one.
-
-host-local:<request>
-    A variant of host-serial used to target the single emulator instance
-    running on the host. This will fail if there is none or more than one.
-
-host:<request>
-    When asking for information related to a device, 'host:' can also be
-    interpreted as 'any single device or emulator connected to/running on
-    the host'.
-
-<host-prefix>:get-product
-    XXX
-
-<host-prefix>:get-serialno
-    Returns the serial number of the corresponding device/emulator.
-    Note that emulator serial numbers are of the form "emulator-5554"
-
-<host-prefix>:get-devpath
-    Returns the device path of the corresponding device/emulator.
-
-<host-prefix>:get-state
-    Returns the state of a given device as a string.
-
-<host-prefix>:forward:<local>;<remote>
-    Asks the ADB server to forward local connections from <local>
-    to the <remote> address on a given device.
-
-    There, <host-prefix> can be one of the
-    host-serial/host-usb/host-local/host prefixes as described previously
-    and indicates which device/emulator to target.
-
-    the format of <local> is one of:
-
-        tcp:<port>      -> TCP connection on localhost:<port>
-        local:<path>    -> Unix local domain socket on <path>
-
-    the format of <remote> is one of:
-
-        tcp:<port>      -> TCP localhost:<port> on device
-        local:<path>    -> Unix local domain socket on device
-        jdwp:<pid>      -> JDWP thread on VM process <pid>
-
-    or even any one of the local services described below.
-
-<host-prefix>:forward:norebind:<local>;<remote>
-    Same as <host-prefix>:forward:<local>;<remote> except that it will
-    fail it there is already a forward connection from <local>.
-
-    Used to implement 'adb forward --no-rebind <local> <remote>'
-
-<host-prefix>:killforward:<local>
-    Remove any existing forward local connection from <local>.
-    This is used to implement 'adb forward --remove <local>'
-
-<host-prefix>:killforward-all
-    Remove all forward network connections.
-    This is used to implement 'adb forward --remove-all'.
-
-<host-prefix>:list-forward
-    List all existing forward connections from this server.
-    This returns something that looks like the following:
-
-       <hex4>: The length of the payload, as 4 hexadecimal chars.
-       <payload>: A series of lines of the following format:
-
-         <serial> " " <local> " " <remote> "\n"
-
-    Where <serial> is a device serial number.
-          <local>  is the host-specific endpoint (e.g. tcp:9000).
-          <remote> is the device-specific endpoint.
-
-    Used to implement 'adb forward --list'.
-
-LOCAL SERVICES:
-
-All the queries below assumed that you already switched the transport
-to a real device, or that you have used a query prefix as described
-above.
-
-shell:command arg1 arg2 ...
-    Run 'command arg1 arg2 ...' in a shell on the device, and return
-    its output and error streams. Note that arguments must be separated
-    by spaces. If an argument contains a space, it must be quoted with
-    double-quotes. Arguments cannot contain double quotes or things
-    will go very wrong.
-
-    Note that this is the non-interactive version of "adb shell"
-
-shell:
-    Start an interactive shell session on the device. Redirect
-    stdin/stdout/stderr as appropriate. Note that the ADB server uses
-    this to implement "adb shell", but will also cook the input before
-    sending it to the device (see interactive_shell() in commandline.c)
-
-remount:
-    Ask adbd to remount the device's filesystem in read-write mode,
-    instead of read-only. This is usually necessary before performing
-    an "adb sync" or "adb push" request.
-
-    This request may not succeed on certain builds which do not allow
-    that.
-
-dev:<path>
-    Opens a device file and connects the client directly to it for
-    read/write purposes. Useful for debugging, but may require special
-    privileges and thus may not run on all devices. <path> is a full
-    path from the root of the filesystem.
-
-tcp:<port>
-    Tries to connect to tcp port <port> on localhost.
-
-tcp:<port>:<server-name>
-    Tries to connect to tcp port <port> on machine <server-name> from
-    the device. This can be useful to debug some networking/proxy
-    issues that can only be revealed on the device itself.
-
-local:<path>
-    Tries to connect to a Unix domain socket <path> on the device
-
-localreserved:<path>
-localabstract:<path>
-localfilesystem:<path>
-    Variants of local:<path> that are used to access other Android
-    socket namespaces.
-
-framebuffer:
-    This service is used to send snapshots of the framebuffer to a client.
-    It requires sufficient privileges but works as follow:
-
-      After the OKAY, the service sends 16-byte binary structure
-      containing the following fields (little-endian format):
-
-            depth:   uint32_t:    framebuffer depth
-            size:    uint32_t:    framebuffer size in bytes
-            width:   uint32_t:    framebuffer width in pixels
-            height:  uint32_t:    framebuffer height in pixels
-
-      With the current implementation, depth is always 16, and
-      size is always width*height*2
-
-      Then, each time the client wants a snapshot, it should send
-      one byte through the channel, which will trigger the service
-      to send it 'size' bytes of framebuffer data.
-
-      If the adbd daemon doesn't have sufficient privileges to open
-      the framebuffer device, the connection is simply closed immediately.
-
-jdwp:<pid>
-    Connects to the JDWP thread running in the VM of process <pid>.
-
-track-jdwp
-    This is used to send the list of JDWP pids periodically to the client.
-    The format of the returned data is the following:
-
-        <hex4>:    the length of all content as a 4-char hexadecimal string
-        <content>: a series of ASCII lines of the following format:
-                        <pid> "\n"
-
-    This service is used by DDMS to know which debuggable processes are running
-    on the device/emulator.
-
-    Note that there is no single-shot service to retrieve the list only once.
-
-sync:
-    This starts the file synchronization service, used to implement "adb push"
-    and "adb pull". Since this service is pretty complex, it will be detailed
-    in a companion document named SYNC.TXT
-
-reverse:<forward-command>
-    This implements the 'adb reverse' feature, i.e. the ability to reverse
-    socket connections from a device to the host. <forward-command> is one
-    of the forwarding commands that are described above, as in:
-
-      list-forward
-      forward:<local>;<remote>
-      forward:norebind:<local>;<remote>
-      killforward-all
-      killforward:<local>
-
-    Note that in this case, <local> corresponds to the socket on the device
-    and <remote> corresponds to the socket on the host.
-
-    The output of reverse:list-forward is the same as host:list-forward
-    except that <serial> will be just 'host'.
diff --git a/adb/SOCKET-ACTIVATION.txt b/adb/SOCKET-ACTIVATION.txt
deleted file mode 100644
index 4ef62ac..0000000
--- a/adb/SOCKET-ACTIVATION.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-adb can be configured to work with systemd-style socket activation,
-allowing the daemon to start automatically when the adb control port
-is forwarded across a network. You need two files, placed in the usual
-systemd service directories (e.g., ~/.config/systemd/user for a user
-service).
-
-adb.service:
-
---- START adb.service CUT HERE ---
-[Unit]
-Description=adb
-After=adb.socket
-Requires=adb.socket
-[Service]
-Type=simple
-# FD 3 is part of the systemd interface
-ExecStart=/path/to/adb server nodaemon -L acceptfd:3
---- END adb.service CUT HERE ---
-
---- START adb.socket CUT HERE ---
-[Unit]
-Description=adb
-PartOf=adb.service
-[Socket]
-ListenStream=127.0.0.1:5037
-Accept=no
-[Install]
-WantedBy=sockets.target
---- END adb.socket CUT HERE ---
-
-After installing the adb service, the adb server will be started
-automatically on any connection to 127.0.0.1:5037 (the default adb
-control port), even after adb kill-server kills the server.
-
-Other "superserver" launcher systems (like macOS launchd) can be
-configured analogously. The important part is that adb be started with
-"server" and "nodaemon" command line arguments and that the listen
-address (passed to -L) name a file descriptor that's ready to
-accept(2) connections and that's already bound to the desired address
-and listening. inetd-style pre-accepted sockets do _not_ work in this
-configuration: the file descriptor passed to acceptfd must be the
-serve socket, not the accepted connection socket.
diff --git a/adb/SYNC.TXT b/adb/SYNC.TXT
deleted file mode 100644
index 4445a76..0000000
--- a/adb/SYNC.TXT
+++ /dev/null
@@ -1,80 +0,0 @@
-This file tries to document file-related requests a client can make
-to the ADB server of an adbd daemon. See the OVERVIEW.TXT document
-to understand what's going on here. See the SERVICES.TXT to learn more
-about the other requests that are possible.
-
-SYNC SERVICES:
-
-
-Requesting the sync service ("sync:") using the protocol as described in
-SERVICES.TXT sets the connection in sync mode. This mode is a binary mode that
-differs from the regular adb protocol. The connection stays in sync mode until
-explicitly terminated (see below).
-
-After the initial "sync:" command is sent the server must respond with either
-"OKAY" or "FAIL" as per usual.
-
-In sync mode both the server and the client will frequently use eight-byte
-packets to communicate. In this document these are called sync requests and sync
-responses. The first four bytes are an id that specifies the sync request. It is
-represented by four utf-8 characters. The last four bytes are a Little-Endian
-integer, with various uses. This number will be called "length" below. In fact
-all binary integers are Little-Endian in the sync mode. Sync mode is
-implicitly exited after each sync request, and normal adb communication
-follows as described in SERVICES.TXT.
-
-The following sync requests are accepted:
-LIST - List the files in a folder
-RECV - Retrieve a file from device
-SEND - Send a file to device
-STAT - Stat a file
-
-All of the sync requests above must be followed by "length": the number of
-bytes containing a utf-8 string with a remote filename.
-
-LIST:
-Lists files in the directory specified by the remote filename. The server will
-respond with zero or more directory entries or "dents".
-
-The directory entries will be returned in the following form
-1. A four-byte sync response id "DENT"
-2. A four-byte integer representing file mode.
-3. A four-byte integer representing file size.
-4. A four-byte integer representing last modified time.
-5. A four-byte integer representing file name length.
-6. length number of bytes containing an utf-8 string representing the file
-   name.
-
-When a sync response "DONE" is received the listing is done.
-
-SEND:
-The remote file name is split into two parts separated by the last
-comma (","). The first part is the actual path, while the second is a decimal
-encoded file mode containing the permissions of the file on device.
-
-Note that some file types will be deleted before the copying starts, and if
-the transfer fails. Some file types will not be deleted, which allows
-  adb push disk_image /some_block_device
-to work.
-
-After this the actual file is sent in chunks. Each chunk has the following
-format.
-A sync request with id "DATA" and length equal to the chunk size. After
-follows chunk size number of bytes. This is repeated until the file is
-transferred. Each chunk must not be larger than 64k.
-
-When the file is transferred a sync request "DONE" is sent, where length is set
-to the last modified time for the file. The server responds to this last
-request (but not to chunk requests) with an "OKAY" sync response (length can
-be ignored).
-
-
-RECV:
-Retrieves a file from device to a local file. The remote path is the path to
-the file that will be returned. Just as for the SEND sync request the file
-received is split up into chunks. The sync response id is "DATA" and length is
-the chunk size. After follows chunk size number of bytes. This is repeated
-until the file is transferred. Each chunk will not be larger than 64k.
-
-When the file is transferred a sync response "DONE" is retrieved where the
-length can be ignored.
diff --git a/adb/adb.bash b/adb/adb.bash
deleted file mode 100644
index b1b3957..0000000
--- a/adb/adb.bash
+++ /dev/null
@@ -1,499 +0,0 @@
-# /* vim: set ai ts=4 ft=sh: */
-#
-# Copyright 2011, 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.
-#
-
-_adb() {
-    if ! check_type "$1" >/dev/null; then
-        return
-    fi
-
-    if check_type _init_completion >/dev/null; then
-        _init_completion || return
-    fi
-
-    local where i cur serial
-    COMPREPLY=()
-
-    serial="${ANDROID_SERIAL:-none}"
-    where=OPTIONS
-    for ((i=1; i <= COMP_CWORD; i++)); do
-        cur="${COMP_WORDS[i]}"
-        case "${cur}" in
-            -s)
-                where=OPT_SERIAL
-                ;;
-            -p)
-                where=OPT_PATH
-                ;;
-            -*)
-                where=OPTIONS
-                ;;
-            *)
-                if [[ $where == OPT_SERIAL ]]; then
-                    where=OPT_SERIAL_ARG
-                    serial=${cur}
-                else
-                    where=COMMAND
-                    break
-                fi
-                ;;
-        esac
-    done
-
-    if [[ $where == COMMAND && $i -ge $COMP_CWORD ]]; then
-        where=OPTIONS
-    fi
-
-    OPTIONS="-d -e -s -p"
-    COMMAND="devices connect disconnect push pull sync shell emu logcat lolcat forward jdwp install uninstall bugreport help version start-server kill-server get-state get-serialno status-window remount reboot reboot-bootloader root usb tcpip disable-verity"
-
-    case $where in
-        OPTIONS|OPT_SERIAL|OPT_PATH)
-            COMPREPLY=( $(compgen -W "$OPTIONS $COMMAND" -- "$cur") )
-            ;;
-        OPT_SERIAL_ARG)
-            local devices=$(command adb devices 2> /dev/null | grep -v "List of devices" | awk '{ print $1 }')
-            COMPREPLY=( $(compgen -W "${devices}" -- ${cur}) )
-            ;;
-        COMMAND)
-            if [[ $i -eq $COMP_CWORD ]]; then
-                COMPREPLY=( $(compgen -W "$COMMAND" -- "$cur") )
-            else
-                i=$((i+1))
-                case "${cur}" in
-                    install)
-                        _adb_cmd_install "$serial" $i
-                        ;;
-                    sideload)
-                        _adb_cmd_sideload "$serial" $i
-                        ;;
-                    pull)
-                        _adb_cmd_pull "$serial" $i
-                        ;;
-                    push)
-                        _adb_cmd_push "$serial" $i
-                        ;;
-                    reboot)
-                        if [[ $COMP_CWORD == $i ]]; then
-                            args="bootloader recovery"
-                            COMPREPLY=( $(compgen -W "${args}" -- "${COMP_WORDS[i]}") )
-                        fi
-                        ;;
-                    shell)
-                        _adb_cmd_shell "$serial" $i
-                        ;;
-                    uninstall)
-                        _adb_cmd_uninstall "$serial" $i
-                        ;;
-                esac
-            fi
-            ;;
-    esac
-
-    return 0
-}
-
-_adb_cmd_install() {
-    local serial i cur where
-
-    serial=$1
-    i=$2
-
-    where=OPTIONS
-    for ((; i <= COMP_CWORD; i++)); do
-        cur="${COMP_WORDS[i]}"
-        case "${cur}" in
-            -*)
-                where=OPTIONS
-                ;;
-            *)
-                where=FILE
-                break
-                ;;
-        esac
-    done
-
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    if [[ $where == OPTIONS ]]; then
-        COMPREPLY=( $(compgen -W "-d -l -r -s" -- "${cur}") )
-        return
-    fi
-
-    _adb_util_complete_local_file "${cur}" '!*.apk'
-}
-
-_adb_cmd_sideload() {
-    local serial i cur
-
-    serial=$1
-    i=$2
-
-    cur="${COMP_WORDS[COMP_CWORD]}"
-
-    _adb_util_complete_local_file "${cur}" '!*.zip'
-}
-
-_adb_cmd_push() {
-    local serial IFS=$'\n' i cur
-
-    serial=$1
-    i=$2
-
-    cur="${COMP_WORDS[COMP_CWORD]}"
-
-    if [[ $COMP_CWORD == $i ]]; then
-        _adb_util_complete_local_file "${cur}"
-    elif [[ $COMP_CWORD == $(($i+1)) ]]; then
-        if [ "${cur}" == "" ]; then
-            cur="/"
-        fi
-        _adb_util_list_files $serial "${cur}"
-    fi
-}
-
-_adb_cmd_pull() {
-    local serial IFS=$'\n' i cur
-
-    serial=$1
-    i=$2
-
-    cur="${COMP_WORDS[COMP_CWORD]}"
-
-    if [[ $COMP_CWORD == $i ]]; then
-        if [ "${cur}" == "" ]; then
-            cur="/"
-        fi
-        _adb_util_list_files $serial "${cur}"
-    elif [[ $COMP_CWORD == $(($i+1)) ]]; then
-        _adb_util_complete_local_file "${cur}"
-    fi
-}
-
-_adb_cmd_shell() {
-    local serial IFS=$'\n' i cur
-    local -a args
-
-    serial=$1
-    i=$2
-
-    cur="${COMP_WORDS[i]}"
-    if [ "$serial" != "none" ]; then
-        args=(-s $serial)
-    fi
-
-    if [[ $i -eq $COMP_CWORD && ${cur:0:1} != "/" ]]; then
-        paths=$(command adb ${args[@]} shell echo '$'PATH 2> /dev/null | tr -d '\r' | tr : '\n')
-        COMMAND=$(command adb ${args[@]} shell ls $paths '2>' /dev/null | tr -d '\r' | {
-            while read -r tmp; do
-                command=${tmp##*/}
-                printf '%s\n' "$command"
-            done
-        })
-        COMPREPLY=( $(compgen -W "$COMMAND" -- "$cur") )
-        return 0
-    fi
-
-    i=$((i+1))
-    case "$cur" in
-        ls)
-            _adb_shell_file_command $serial $i "--color -A -C -F -H -L -R -S -Z -a -c -d -f -h -i -k -l -m -n -p -q -r -s -t -u -x -1"
-            ;;
-        cat)
-            _adb_shell_file_command $serial $i "-h -e -t -u -v"
-            ;;
-        dumpsys)
-            _adb_cmd_shell_dumpsys "$serial" $i
-            ;;
-        am)
-            _adb_cmd_shell_am "$serial" $i
-            ;;
-        pm)
-            _adb_cmd_shell_pm "$serial" $i
-            ;;
-        /*)
-            _adb_util_list_files $serial "$cur"
-            ;;
-        *)
-            COMPREPLY=( )
-            ;;
-    esac
-
-    return 0
-}
-
-_adb_cmd_shell_dumpsys() {
-    local serial i cur
-    local -a args
-    local candidates
-
-    unset IFS
-
-    serial=$1
-    i=$2
-
-    if [ "$serial" != "none" ]; then
-        args=(-s $serial)
-    fi
-
-    if (( $i == $COMP_CWORD )) ; then
-        cur="${COMP_WORDS[COMP_CWORD]}"
-        # First line is a header, so need "1d".
-        candidates=$(command adb ${args[@]} shell dumpsys -l 2> /dev/null | sed -e '1d;s/^  *//' | tr -d '\r')
-        candidates="-l $candidates"
-        COMPREPLY=( $(compgen -W "$candidates" -- "$cur") )
-        return 0
-    fi
-
-    COMPREPLY=( )
-    return 0
-}
-
-_adb_cmd_shell_am() {
-    local serial i cur
-    local candidates
-
-    unset IFS
-
-    serial=$1
-    i=$2
-
-    if (( $i == $COMP_CWORD )) ; then
-        cur="${COMP_WORDS[COMP_CWORD]}"
-        candidates="broadcast clear-debug-app clear-watch-heap dumpheap force-stop get-config get-inactive hang idle-maintenance instrument kill kill-all monitor package-importance profile restart screen-compat send-trim-memory set-debug-app set-inactive set-watch-heap stack start startservice start-user stopservice stop-user suppress-resize-config-changes switch-user task to-app-uri to-intent-uri to-uri"
-        COMPREPLY=( $(compgen -W "$candidates" -- "$cur") )
-        return 0
-    fi
-
-    COMPREPLY=( )
-    return 0
-}
-
-
-_adb_cmd_shell_pm() {
-    local serial i cur
-    local candidates
-
-    unset IFS
-
-    serial=$1
-    i=$2
-
-    if (( $i == $COMP_CWORD )) ; then
-        cur="${COMP_WORDS[COMP_CWORD]}"
-        candidates="-l -lf -p clear create-user default-state disable"
-        candidates+=" disable-until-used disable-user dump enable"
-        candidates+=" get-app-link get-install-location get-max-users"
-        candidates+=" get-max-running-users grant hide install"
-        candidates+=" install-abandon install-commit install-create"
-        candidates+=" install-write list move-package"
-        candidates+=" move-primary-storage path remove-user"
-        candidates+=" reset-permissions revoke set-app-link"
-        candidates+=" set-installer set-install-location"
-        candidates+=" set-permission-enforced trim-caches unhide"
-        candidates+=" uninstall"
-        COMPREPLY=( $(compgen -W "$candidates" -- "$cur") )
-        return 0
-    fi
-
-    if (( $i + 1 == $COMP_CWORD )) && [[ "${COMP_WORDS[COMP_CWORD -1]}" == "list" ]]  ; then
-        cur="${COMP_WORDS[COMP_CWORD]}"
-        candidates="packages permission-groups permissions instrumentation features libraries users"
-        COMPREPLY=( $(compgen -W "$candidates" -- "$cur") )
-        return 0
-    fi
-
-    COMPREPLY=( )
-    return 0
-}
-
-_adb_cmd_uninstall() {
-    local serial i where cur packages
-
-    serial=$1
-    i=$2
-    if [ "$serial" != "none" ]; then
-        args=(-s $serial)
-    fi
-
-    where=OPTIONS
-    for ((; i <= COMP_CWORD; i++)); do
-        cur="${COMP_WORDS[i]}"
-        case "${cur}" in
-            -*)
-                where=OPTIONS
-                ;;
-            *)
-                where=FILE
-                break
-                ;;
-        esac
-    done
-
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    if [[ $where == OPTIONS ]]; then
-        COMPREPLY=( $(compgen -W "-k" -- "${cur}") )
-    fi
-
-    packages="$(
-        command adb ${args[@]} shell pm list packages '2>' /dev/null 2> /dev/null | tr -d '\r' | {
-            while read -r tmp; do
-                local package=${tmp#package:}
-                echo -n "${package} "
-            done
-        }
-    )"
-
-    COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${packages}" -- "${cur}") )
-}
-
-_adb_shell_file_command() {
-    local serial i cur file options
-    local -a args
-
-    serial=$1
-    i=$2
-    if [ "$serial" != "none" ]; then
-        args=(-s $serial)
-    fi
-    options=$3
-
-    where=OPTIONS
-    for ((; i <= COMP_CWORD; i++)); do
-        cur="${COMP_WORDS[i]}"
-        case "${cur}" in
-            -*)
-                where=OPTIONS
-                ;;
-            *)
-                where=FILE
-                break
-                ;;
-        esac
-    done
-
-    file="${COMP_WORDS[COMP_CWORD]}"
-    if [[ ${file} == "" ]]; then
-        file="/"
-    fi
-
-    case $where in
-        OPTIONS)
-            unset IFS
-            COMPREPLY=( $(compgen -W "$options" -- "$cur") )
-            ;;
-        FILE)
-            _adb_util_list_files $serial "$file"
-            ;;
-    esac
-
-    return 0
-}
-
-_adb_util_list_files() {
-    local serial dir IFS=$'\n'
-    local -a toks
-    local -a args
-
-    serial="$1"
-    file="$2"
-
-    if [ "$serial" != "none" ]; then
-        args=(-s $serial)
-    fi
-
-    if [[ $( command adb ${args[@]} shell ls -dF / '2>/dev/null' | tr -d '\r' ) == "d /" ]] ; then
-        toks=( ${toks[@]-} $(
-            command adb ${args[@]} shell ls -dF ${file}"*" '2>' /dev/null 2> /dev/null | tr -d '\r' | {
-                while read -r tmp; do
-                    filetype=${tmp%% *}
-                    filename=${tmp:${#filetype}+1}
-                    if [[ ${filetype:${#filetype}-1:1} == d ]]; then
-                        printf '%s/\n' "$filename"
-                    else
-                        printf '%s\n' "$filename"
-                    fi
-                done
-            }
-        ))
-    else
-        toks=( ${toks[@]-} $(
-            command adb ${args[@]} shell ls -dp ${file}"*" '2>/dev/null' 2> /dev/null | tr -d '\r'
-        ))
-    fi
-
-    # Since we're probably doing file completion here, don't add a space after.
-    if [[ $(check_type compopt) == "builtin" ]]; then
-        compopt -o nospace
-    fi
-
-    COMPREPLY=( ${COMPREPLY[@]:-} "${toks[@]}" )
-}
-
-_adb_util_complete_local_file()
-{
-    local file xspec i j IFS=$'\n'
-    local -a dirs files
-
-    file=$1
-    xspec=$2
-
-    # Since we're probably doing file completion here, don't add a space after.
-    if [[ $(check_type compopt) == "builtin" ]]; then
-        compopt -o plusdirs
-        if [[ "${xspec}" == "" ]]; then
-            COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -f -- "${cur}") )
-        else
-            compopt +o filenames
-            COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -f -X "${xspec}" -- "${cur}") )
-        fi
-    else
-        # Work-around for shells with no compopt
-
-        dirs=( $(compgen -d -- "${cur}" ) )
-
-        if [[ "${xspec}" == "" ]]; then
-            files=( ${COMPREPLY[@]:-} $(compgen -f -- "${cur}") )
-        else
-            files=( ${COMPREPLY[@]:-} $(compgen -f -X "${xspec}" -- "${cur}") )
-        fi
-
-        COMPREPLY=( $(
-            for i in "${files[@]}"; do
-                local skip=
-                for j in "${dirs[@]}"; do
-                    if [[ $i == $j ]]; then
-                        skip=1
-                        break
-                    fi
-                done
-                [[ -n $skip ]] || printf "%s\n" "$i"
-            done
-        ))
-
-        COMPREPLY=( ${COMPREPLY[@]:-} $(
-            for i in "${dirs[@]}"; do
-                printf "%s/\n" "$i"
-            done
-        ))
-    fi
-}
-
-
-if [[ $(check_type compopt) == "builtin" ]]; then
-    complete -F _adb adb
-else
-    complete -o nospace -F _adb adb
-fi
diff --git a/adb/adb.cpp b/adb/adb.cpp
deleted file mode 100644
index c3e9731..0000000
--- a/adb/adb.cpp
+++ /dev/null
@@ -1,1359 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "sysdeps.h"
-#include "adb.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
-
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
-#include <string>
-#include <string_view>
-#include <thread>
-#include <vector>
-
-#include <android-base/errors.h>
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/macros.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <build/version.h>
-#include <platform_tools_version.h>
-
-#include "adb_auth.h"
-#include "adb_io.h"
-#include "adb_listeners.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "adb_wifi.h"
-#include "sysdeps/chrono.h"
-#include "transport.h"
-
-#if !ADB_HOST
-#include <sys/capability.h>
-#include <sys/mount.h>
-#include <android-base/properties.h>
-using namespace std::chrono_literals;
-
-#include "daemon/logging.h"
-#endif
-
-#if ADB_HOST
-#include "client/usb.h"
-#endif
-
-std::string adb_version() {
-    // Don't change the format of this --- it's parsed by ddmlib.
-    return android::base::StringPrintf(
-        "Android Debug Bridge version %d.%d.%d\n"
-        "Version %s-%s\n"
-        "Installed as %s\n",
-        ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
-        PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(),
-        android::base::GetExecutablePath().c_str());
-}
-
-uint32_t calculate_apacket_checksum(const apacket* p) {
-    uint32_t sum = 0;
-    for (size_t i = 0; i < p->msg.data_length; ++i) {
-        sum += static_cast<uint8_t>(p->payload[i]);
-    }
-    return sum;
-}
-
-apacket* get_apacket(void)
-{
-    apacket* p = new apacket();
-    if (p == nullptr) {
-        LOG(FATAL) << "failed to allocate an apacket";
-    }
-
-    memset(&p->msg, 0, sizeof(p->msg));
-    return p;
-}
-
-void put_apacket(apacket *p)
-{
-    delete p;
-}
-
-void handle_online(atransport *t)
-{
-    D("adb: online");
-    t->online = 1;
-    t->SetConnectionEstablished(true);
-}
-
-void handle_offline(atransport *t)
-{
-    if (t->GetConnectionState() == kCsOffline) {
-        LOG(INFO) << t->serial_name() << ": already offline";
-        return;
-    }
-
-    LOG(INFO) << t->serial_name() << ": offline";
-
-    t->SetConnectionState(kCsOffline);
-
-    // Close the associated usb
-    t->online = 0;
-
-    // This is necessary to avoid a race condition that occurred when a transport closes
-    // while a client socket is still active.
-    close_all_sockets(t);
-
-    t->RunDisconnects();
-}
-
-#if DEBUG_PACKETS
-#define DUMPMAX 32
-void print_packet(const char *label, apacket *p)
-{
-    const char* tag;
-    unsigned count;
-
-    switch(p->msg.command){
-    case A_SYNC: tag = "SYNC"; break;
-    case A_CNXN: tag = "CNXN" ; break;
-    case A_OPEN: tag = "OPEN"; break;
-    case A_OKAY: tag = "OKAY"; break;
-    case A_CLSE: tag = "CLSE"; break;
-    case A_WRTE: tag = "WRTE"; break;
-    case A_AUTH: tag = "AUTH"; break;
-    case A_STLS:
-        tag = "STLS";
-        break;
-    default: tag = "????"; break;
-    }
-
-    fprintf(stderr, "%s: %s %08x %08x %04x \"",
-            label, tag, p->msg.arg0, p->msg.arg1, p->msg.data_length);
-    count = p->msg.data_length;
-    const char* x = p->payload.data();
-    if (count > DUMPMAX) {
-        count = DUMPMAX;
-        tag = "\n";
-    } else {
-        tag = "\"\n";
-    }
-    while (count-- > 0) {
-        if ((*x >= ' ') && (*x < 127)) {
-            fputc(*x, stderr);
-        } else {
-            fputc('.', stderr);
-        }
-        x++;
-    }
-    fputs(tag, stderr);
-}
-#endif
-
-static void send_ready(unsigned local, unsigned remote, atransport *t)
-{
-    D("Calling send_ready");
-    apacket *p = get_apacket();
-    p->msg.command = A_OKAY;
-    p->msg.arg0 = local;
-    p->msg.arg1 = remote;
-    send_packet(p, t);
-}
-
-static void send_close(unsigned local, unsigned remote, atransport *t)
-{
-    D("Calling send_close");
-    apacket *p = get_apacket();
-    p->msg.command = A_CLSE;
-    p->msg.arg0 = local;
-    p->msg.arg1 = remote;
-    send_packet(p, t);
-}
-
-std::string get_connection_string() {
-    std::vector<std::string> connection_properties;
-
-#if !ADB_HOST
-    static const char* cnxn_props[] = {
-        "ro.product.name",
-        "ro.product.model",
-        "ro.product.device",
-    };
-
-    for (const auto& prop : cnxn_props) {
-        std::string value = std::string(prop) + "=" + android::base::GetProperty(prop, "");
-        connection_properties.push_back(value);
-    }
-#endif
-
-    connection_properties.push_back(android::base::StringPrintf(
-        "features=%s", FeatureSetToString(supported_features()).c_str()));
-
-    return android::base::StringPrintf(
-        "%s::%s", adb_device_banner,
-        android::base::Join(connection_properties, ';').c_str());
-}
-
-void send_tls_request(atransport* t) {
-    D("Calling send_tls_request");
-    apacket* p = get_apacket();
-    p->msg.command = A_STLS;
-    p->msg.arg0 = A_STLS_VERSION;
-    p->msg.data_length = 0;
-    send_packet(p, t);
-}
-
-void send_connect(atransport* t) {
-    D("Calling send_connect");
-    apacket* cp = get_apacket();
-    cp->msg.command = A_CNXN;
-    // Send the max supported version, but because the transport is
-    // initialized to A_VERSION_MIN, this will be compatible with every
-    // device.
-    cp->msg.arg0 = A_VERSION;
-    cp->msg.arg1 = t->get_max_payload();
-
-    std::string connection_str = get_connection_string();
-    // Connect and auth packets are limited to MAX_PAYLOAD_V1 because we don't
-    // yet know how much data the other size is willing to accept.
-    if (connection_str.length() > MAX_PAYLOAD_V1) {
-        LOG(FATAL) << "Connection banner is too long (length = "
-                   << connection_str.length() << ")";
-    }
-
-    cp->payload.assign(connection_str.begin(), connection_str.end());
-    cp->msg.data_length = cp->payload.size();
-
-    send_packet(cp, t);
-}
-
-void parse_banner(const std::string& banner, atransport* t) {
-    D("parse_banner: %s", banner.c_str());
-
-    // The format is something like:
-    // "device::ro.product.name=x;ro.product.model=y;ro.product.device=z;".
-    std::vector<std::string> pieces = android::base::Split(banner, ":");
-
-    // Reset the features list or else if the server sends no features we may
-    // keep the existing feature set (http://b/24405971).
-    t->SetFeatures("");
-
-    if (pieces.size() > 2) {
-        const std::string& props = pieces[2];
-        for (const auto& prop : android::base::Split(props, ";")) {
-            // The list of properties was traditionally ;-terminated rather than ;-separated.
-            if (prop.empty()) continue;
-
-            std::vector<std::string> key_value = android::base::Split(prop, "=");
-            if (key_value.size() != 2) continue;
-
-            const std::string& key = key_value[0];
-            const std::string& value = key_value[1];
-            if (key == "ro.product.name") {
-                t->product = value;
-            } else if (key == "ro.product.model") {
-                t->model = value;
-            } else if (key == "ro.product.device") {
-                t->device = value;
-            } else if (key == "features") {
-                t->SetFeatures(value);
-            }
-        }
-    }
-
-    const std::string& type = pieces[0];
-    if (type == "bootloader") {
-        D("setting connection_state to kCsBootloader");
-        t->SetConnectionState(kCsBootloader);
-    } else if (type == "device") {
-        D("setting connection_state to kCsDevice");
-        t->SetConnectionState(kCsDevice);
-    } else if (type == "recovery") {
-        D("setting connection_state to kCsRecovery");
-        t->SetConnectionState(kCsRecovery);
-    } else if (type == "sideload") {
-        D("setting connection_state to kCsSideload");
-        t->SetConnectionState(kCsSideload);
-    } else if (type == "rescue") {
-        D("setting connection_state to kCsRescue");
-        t->SetConnectionState(kCsRescue);
-    } else {
-        D("setting connection_state to kCsHost");
-        t->SetConnectionState(kCsHost);
-    }
-}
-
-static void handle_new_connection(atransport* t, apacket* p) {
-    handle_offline(t);
-
-    t->update_version(p->msg.arg0, p->msg.arg1);
-    std::string banner(p->payload.begin(), p->payload.end());
-    parse_banner(banner, t);
-
-#if ADB_HOST
-    handle_online(t);
-#else
-    ADB_LOG(Connection) << "received CNXN: version=" << p->msg.arg0 << ", maxdata = " << p->msg.arg1
-                        << ", banner = '" << banner << "'";
-
-    if (t->use_tls) {
-        // We still handshake in TLS mode. If auth_required is disabled,
-        // we'll just not verify the client's certificate. This should be the
-        // first packet the client receives to indicate the new protocol.
-        send_tls_request(t);
-    } else if (!auth_required) {
-        LOG(INFO) << "authentication not required";
-        handle_online(t);
-        send_connect(t);
-    } else {
-        send_auth_request(t);
-    }
-#endif
-
-    update_transports();
-}
-
-void handle_packet(apacket *p, atransport *t)
-{
-    D("handle_packet() %c%c%c%c", ((char*) (&(p->msg.command)))[0],
-            ((char*) (&(p->msg.command)))[1],
-            ((char*) (&(p->msg.command)))[2],
-            ((char*) (&(p->msg.command)))[3]);
-    print_packet("recv", p);
-    CHECK_EQ(p->payload.size(), p->msg.data_length);
-
-    switch(p->msg.command){
-    case A_CNXN:  // CONNECT(version, maxdata, "system-id-string")
-        handle_new_connection(t, p);
-        break;
-    case A_STLS:  // TLS(version, "")
-        t->use_tls = true;
-#if ADB_HOST
-        send_tls_request(t);
-        adb_auth_tls_handshake(t);
-#else
-        adbd_auth_tls_handshake(t);
-#endif
-        break;
-
-    case A_AUTH:
-        // All AUTH commands are ignored in TLS mode
-        if (t->use_tls) {
-            break;
-        }
-        switch (p->msg.arg0) {
-#if ADB_HOST
-            case ADB_AUTH_TOKEN:
-                if (t->GetConnectionState() != kCsAuthorizing) {
-                    t->SetConnectionState(kCsAuthorizing);
-                }
-                send_auth_response(p->payload.data(), p->msg.data_length, t);
-                break;
-#else
-            case ADB_AUTH_SIGNATURE: {
-                // TODO: Switch to string_view.
-                std::string signature(p->payload.begin(), p->payload.end());
-                std::string auth_key;
-                if (adbd_auth_verify(t->token, sizeof(t->token), signature, &auth_key)) {
-                    adbd_auth_verified(t);
-                    t->failed_auth_attempts = 0;
-                    t->auth_key = auth_key;
-                    adbd_notify_framework_connected_key(t);
-                } else {
-                    if (t->failed_auth_attempts++ > 256) std::this_thread::sleep_for(1s);
-                    send_auth_request(t);
-                }
-                break;
-            }
-
-            case ADB_AUTH_RSAPUBLICKEY:
-                t->auth_key = std::string(p->payload.data());
-                adbd_auth_confirm_key(t);
-                break;
-#endif
-            default:
-                t->SetConnectionState(kCsOffline);
-                handle_offline(t);
-                break;
-        }
-        break;
-
-    case A_OPEN: /* OPEN(local-id, 0, "destination") */
-        if (t->online && p->msg.arg0 != 0 && p->msg.arg1 == 0) {
-            std::string_view address(p->payload.begin(), p->payload.size());
-
-            // Historically, we received service names as a char*, and stopped at the first NUL
-            // byte. The client sent strings with null termination, which post-string_view, start
-            // being interpreted as part of the string, unless we explicitly strip them.
-            address = StripTrailingNulls(address);
-
-            asocket* s = create_local_service_socket(address, t);
-            if (s == nullptr) {
-                send_close(0, p->msg.arg0, t);
-            } else {
-                s->peer = create_remote_socket(p->msg.arg0, t);
-                s->peer->peer = s;
-                send_ready(s->id, s->peer->id, t);
-                s->ready(s);
-            }
-        }
-        break;
-
-    case A_OKAY: /* READY(local-id, remote-id, "") */
-        if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) {
-            asocket* s = find_local_socket(p->msg.arg1, 0);
-            if (s) {
-                if(s->peer == nullptr) {
-                    /* On first READY message, create the connection. */
-                    s->peer = create_remote_socket(p->msg.arg0, t);
-                    s->peer->peer = s;
-                    s->ready(s);
-                } else if (s->peer->id == p->msg.arg0) {
-                    /* Other READY messages must use the same local-id */
-                    s->ready(s);
-                } else {
-                    D("Invalid A_OKAY(%d,%d), expected A_OKAY(%d,%d) on transport %s", p->msg.arg0,
-                      p->msg.arg1, s->peer->id, p->msg.arg1, t->serial.c_str());
-                }
-            } else {
-                // When receiving A_OKAY from device for A_OPEN request, the host server may
-                // have closed the local socket because of client disconnection. Then we need
-                // to send A_CLSE back to device to close the service on device.
-                send_close(p->msg.arg1, p->msg.arg0, t);
-            }
-        }
-        break;
-
-    case A_CLSE: /* CLOSE(local-id, remote-id, "") or CLOSE(0, remote-id, "") */
-        if (t->online && p->msg.arg1 != 0) {
-            asocket* s = find_local_socket(p->msg.arg1, p->msg.arg0);
-            if (s) {
-                /* According to protocol.txt, p->msg.arg0 might be 0 to indicate
-                 * a failed OPEN only. However, due to a bug in previous ADB
-                 * versions, CLOSE(0, remote-id, "") was also used for normal
-                 * CLOSE() operations.
-                 *
-                 * This is bad because it means a compromised adbd could
-                 * send packets to close connections between the host and
-                 * other devices. To avoid this, only allow this if the local
-                 * socket has a peer on the same transport.
-                 */
-                if (p->msg.arg0 == 0 && s->peer && s->peer->transport != t) {
-                    D("Invalid A_CLSE(0, %u) from transport %s, expected transport %s", p->msg.arg1,
-                      t->serial.c_str(), s->peer->transport->serial.c_str());
-                } else {
-                    s->close(s);
-                }
-            }
-        }
-        break;
-
-    case A_WRTE: /* WRITE(local-id, remote-id, <data>) */
-        if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) {
-            asocket* s = find_local_socket(p->msg.arg1, p->msg.arg0);
-            if (s) {
-                unsigned rid = p->msg.arg0;
-                if (s->enqueue(s, std::move(p->payload)) == 0) {
-                    D("Enqueue the socket");
-                    send_ready(s->id, rid, t);
-                }
-            }
-        }
-        break;
-
-    default:
-        printf("handle_packet: what is %08x?!\n", p->msg.command);
-    }
-
-    put_apacket(p);
-}
-
-#if ADB_HOST
-
-#ifdef _WIN32
-
-// Try to make a handle non-inheritable and if there is an error, don't output
-// any error info, but leave GetLastError() for the caller to read. This is
-// convenient if the caller is expecting that this may fail and they'd like to
-// ignore such a failure.
-static bool _try_make_handle_noninheritable(HANDLE h) {
-    if (h != INVALID_HANDLE_VALUE && h != NULL) {
-        return SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0) ? true : false;
-    }
-
-    return true;
-}
-
-// Try to make a handle non-inheritable with the expectation that this should
-// succeed, so if this fails, output error info.
-static bool _make_handle_noninheritable(HANDLE h) {
-    if (!_try_make_handle_noninheritable(h)) {
-        // Show the handle value to give us a clue in case we have problems
-        // with pseudo-handle values.
-        fprintf(stderr, "adb: cannot make handle 0x%p non-inheritable: %s\n", h,
-                android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return false;
-    }
-
-    return true;
-}
-
-// Create anonymous pipe, preventing inheritance of the read pipe and setting
-// security of the write pipe to sa.
-static bool _create_anonymous_pipe(unique_handle* pipe_read_out,
-                                   unique_handle* pipe_write_out,
-                                   SECURITY_ATTRIBUTES* sa) {
-    HANDLE pipe_read_raw = NULL;
-    HANDLE pipe_write_raw = NULL;
-    if (!CreatePipe(&pipe_read_raw, &pipe_write_raw, sa, 0)) {
-        fprintf(stderr, "adb: CreatePipe failed: %s\n",
-                android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return false;
-    }
-
-    unique_handle pipe_read(pipe_read_raw);
-    pipe_read_raw = NULL;
-    unique_handle pipe_write(pipe_write_raw);
-    pipe_write_raw = NULL;
-
-    if (!_make_handle_noninheritable(pipe_read.get())) {
-        return false;
-    }
-
-    *pipe_read_out = std::move(pipe_read);
-    *pipe_write_out = std::move(pipe_write);
-
-    return true;
-}
-
-// Read from a pipe (that we take ownership of) and write the result to stdout/stderr. Return on
-// error or when the pipe is closed. Internally makes inheritable handles, so this should not be
-// called if subprocesses may be started concurrently.
-static unsigned _redirect_pipe_thread(HANDLE h, DWORD nStdHandle) {
-    // Take ownership of the HANDLE and close when we're done.
-    unique_handle   read_pipe(h);
-    const char*     output_name = nStdHandle == STD_OUTPUT_HANDLE ? "stdout" : "stderr";
-    const int       original_fd = fileno(nStdHandle == STD_OUTPUT_HANDLE ? stdout : stderr);
-    std::unique_ptr<FILE, decltype(&fclose)> stream(nullptr, fclose);
-
-    if (original_fd == -1) {
-        fprintf(stderr, "adb: failed to get file descriptor for %s: %s\n", output_name,
-                strerror(errno));
-        return EXIT_FAILURE;
-    }
-
-    // If fileno() is -2, stdout/stderr is not associated with an output stream, so we should read,
-    // but don't write. Otherwise, make a FILE* identical to stdout/stderr except that it is in
-    // binary mode with no CR/LR translation since we're reading raw.
-    if (original_fd >= 0) {
-        // This internally makes a duplicate file handle that is inheritable, so callers should not
-        // call this function if subprocesses may be started concurrently.
-        const int fd = dup(original_fd);
-        if (fd == -1) {
-            fprintf(stderr, "adb: failed to duplicate file descriptor for %s: %s\n", output_name,
-                    strerror(errno));
-            return EXIT_FAILURE;
-        }
-
-        // Note that although we call fdopen() below with a binary flag, it may not adhere to that
-        // flag, so we have to set the mode manually.
-        if (_setmode(fd, _O_BINARY) == -1) {
-            fprintf(stderr, "adb: failed to set binary mode for duplicate of %s: %s\n", output_name,
-                    strerror(errno));
-            unix_close(fd);
-            return EXIT_FAILURE;
-        }
-
-        stream.reset(fdopen(fd, "wb"));
-        if (stream.get() == nullptr) {
-            fprintf(stderr, "adb: failed to open duplicate stream for %s: %s\n", output_name,
-                    strerror(errno));
-            unix_close(fd);
-            return EXIT_FAILURE;
-        }
-
-        // Unbuffer the stream because it will be buffered by default and we want subprocess output
-        // to be shown immediately.
-        if (setvbuf(stream.get(), NULL, _IONBF, 0) == -1) {
-            fprintf(stderr, "adb: failed to unbuffer %s: %s\n", output_name, strerror(errno));
-            return EXIT_FAILURE;
-        }
-
-        // fd will be closed when stream is closed.
-    }
-
-    while (true) {
-        char    buf[64 * 1024];
-        DWORD   bytes_read = 0;
-        if (!ReadFile(read_pipe.get(), buf, sizeof(buf), &bytes_read, NULL)) {
-            const DWORD err = GetLastError();
-            // ERROR_BROKEN_PIPE is expected when the subprocess closes
-            // the other end of the pipe.
-            if (err == ERROR_BROKEN_PIPE) {
-                return EXIT_SUCCESS;
-            } else {
-                fprintf(stderr, "adb: failed to read from %s: %s\n", output_name,
-                        android::base::SystemErrorCodeToString(err).c_str());
-                return EXIT_FAILURE;
-            }
-        }
-
-        // Don't try to write if our stdout/stderr was not setup by the parent process.
-        if (stream) {
-            // fwrite() actually calls adb_fwrite() which can write UTF-8 to the console.
-            const size_t bytes_written = fwrite(buf, 1, bytes_read, stream.get());
-            if (bytes_written != bytes_read) {
-                fprintf(stderr, "adb: error: only wrote %zu of %lu bytes to %s\n", bytes_written,
-                        bytes_read, output_name);
-                return EXIT_FAILURE;
-            }
-        }
-    }
-}
-
-static unsigned __stdcall _redirect_stdout_thread(HANDLE h) {
-    adb_thread_setname("stdout redirect");
-    return _redirect_pipe_thread(h, STD_OUTPUT_HANDLE);
-}
-
-static unsigned __stdcall _redirect_stderr_thread(HANDLE h) {
-    adb_thread_setname("stderr redirect");
-    return _redirect_pipe_thread(h, STD_ERROR_HANDLE);
-}
-
-#endif
-
-static void ReportServerStartupFailure(pid_t pid) {
-    fprintf(stderr, "ADB server didn't ACK\n");
-    fprintf(stderr, "Full server startup log: %s\n", GetLogFilePath().c_str());
-    fprintf(stderr, "Server had pid: %d\n", pid);
-
-    android::base::unique_fd fd(unix_open(GetLogFilePath(), O_RDONLY));
-    if (fd == -1) return;
-
-    // Let's not show more than 128KiB of log...
-    unix_lseek(fd, -128 * 1024, SEEK_END);
-    std::string content;
-    if (!android::base::ReadFdToString(fd, &content)) return;
-
-    std::string header = android::base::StringPrintf("--- adb starting (pid %d) ---", pid);
-    std::vector<std::string> lines = android::base::Split(content, "\n");
-    int i = lines.size() - 1;
-    while (i >= 0 && lines[i] != header) --i;
-    while (static_cast<size_t>(i) < lines.size()) fprintf(stderr, "%s\n", lines[i++].c_str());
-}
-
-int launch_server(const std::string& socket_spec) {
-#if defined(_WIN32)
-    /* we need to start the server in the background                    */
-    /* we create a PIPE that will be used to wait for the server's "OK" */
-    /* message since the pipe handles must be inheritable, we use a     */
-    /* security attribute                                               */
-    SECURITY_ATTRIBUTES   sa;
-    sa.nLength = sizeof(sa);
-    sa.lpSecurityDescriptor = NULL;
-    sa.bInheritHandle = TRUE;
-
-    // Redirect stdin to Windows /dev/null. If we instead pass an original
-    // stdin/stdout/stderr handle and it is a console handle, when the adb
-    // server starts up, the C Runtime will see a console handle for a process
-    // that isn't connected to a console and it will configure
-    // stdin/stdout/stderr to be closed. At that point, freopen() could be used
-    // to reopen stderr/out, but it would take more massaging to fixup the file
-    // descriptor number that freopen() uses. It's simplest to avoid all of this
-    // complexity by just redirecting stdin to `nul' and then the C Runtime acts
-    // as expected.
-    unique_handle   nul_read(CreateFileW(L"nul", GENERIC_READ,
-            FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, OPEN_EXISTING,
-            FILE_ATTRIBUTE_NORMAL, NULL));
-    if (nul_read.get() == INVALID_HANDLE_VALUE) {
-        fprintf(stderr, "adb: CreateFileW 'nul' failed: %s\n",
-                android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return -1;
-    }
-
-    // Create pipes with non-inheritable read handle, inheritable write handle. We need to connect
-    // the subprocess to pipes instead of just letting the subprocess inherit our existing
-    // stdout/stderr handles because a DETACHED_PROCESS cannot write to a console that it is not
-    // attached to.
-    unique_handle   ack_read, ack_write;
-    if (!_create_anonymous_pipe(&ack_read, &ack_write, &sa)) {
-        return -1;
-    }
-    unique_handle   stdout_read, stdout_write;
-    if (!_create_anonymous_pipe(&stdout_read, &stdout_write, &sa)) {
-        return -1;
-    }
-    unique_handle   stderr_read, stderr_write;
-    if (!_create_anonymous_pipe(&stderr_read, &stderr_write, &sa)) {
-        return -1;
-    }
-
-    /* Some programs want to launch an adb command and collect its output by
-     * calling CreateProcess with inheritable stdout/stderr handles, then
-     * using read() to get its output. When this happens, the stdout/stderr
-     * handles passed to the adb client process will also be inheritable.
-     * When starting the adb server here, care must be taken to reset them
-     * to non-inheritable.
-     * Otherwise, something bad happens: even if the adb command completes,
-     * the calling process is stuck while read()-ing from the stdout/stderr
-     * descriptors, because they're connected to corresponding handles in the
-     * adb server process (even if the latter never uses/writes to them).
-     * Note that even if we don't pass these handles in the STARTUPINFO struct,
-     * if they're marked inheritable, they're still inherited, requiring us to
-     * deal with this.
-     *
-     * If we're still having problems with inheriting random handles in the
-     * future, consider using PROC_THREAD_ATTRIBUTE_HANDLE_LIST to explicitly
-     * specify which handles should be inherited: http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx
-     *
-     * Older versions of Windows return console pseudo-handles that cannot be
-     * made non-inheritable, so ignore those failures.
-     */
-    _try_make_handle_noninheritable(GetStdHandle(STD_INPUT_HANDLE));
-    _try_make_handle_noninheritable(GetStdHandle(STD_OUTPUT_HANDLE));
-    _try_make_handle_noninheritable(GetStdHandle(STD_ERROR_HANDLE));
-
-    STARTUPINFOW    startup;
-    ZeroMemory( &startup, sizeof(startup) );
-    startup.cb = sizeof(startup);
-    startup.hStdInput  = nul_read.get();
-    startup.hStdOutput = stdout_write.get();
-    startup.hStdError  = stderr_write.get();
-    startup.dwFlags    = STARTF_USESTDHANDLES;
-
-    // Verify that the pipe_write handle value can be passed on the command line
-    // as %d and that the rest of adb code can pass it around in an int.
-    const int ack_write_as_int = cast_handle_to_int(ack_write.get());
-    if (cast_int_to_handle(ack_write_as_int) != ack_write.get()) {
-        // If this fires, either handle values are larger than 32-bits or else
-        // there is a bug in our casting.
-        // https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203%28v=vs.85%29.aspx
-        fprintf(stderr, "adb: cannot fit pipe handle value into 32-bits: 0x%p\n", ack_write.get());
-        return -1;
-    }
-
-    // get path of current program
-    WCHAR       program_path[MAX_PATH];
-    const DWORD module_result = GetModuleFileNameW(NULL, program_path,
-                                                   arraysize(program_path));
-    if ((module_result >= arraysize(program_path)) || (module_result == 0)) {
-        // String truncation or some other error.
-        fprintf(stderr, "adb: cannot get executable path: %s\n",
-                android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return -1;
-    }
-
-    WCHAR   args[64];
-    snwprintf(args, arraysize(args), L"adb -L %s fork-server server --reply-fd %d",
-              socket_spec.c_str(), ack_write_as_int);
-
-    PROCESS_INFORMATION   pinfo;
-    ZeroMemory(&pinfo, sizeof(pinfo));
-
-    if (!CreateProcessW(
-            program_path,                              /* program path  */
-            args,
-                                    /* the fork-server argument will set the
-                                       debug = 2 in the child           */
-            NULL,                   /* process handle is not inheritable */
-            NULL,                    /* thread handle is not inheritable */
-            TRUE,                          /* yes, inherit some handles */
-            DETACHED_PROCESS, /* the new process doesn't have a console */
-            NULL,                     /* use parent's environment block */
-            NULL,                    /* use parent's starting directory */
-            &startup,                 /* startup info, i.e. std handles */
-            &pinfo )) {
-        fprintf(stderr, "adb: CreateProcessW failed: %s\n",
-                android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return -1;
-    }
-
-    unique_handle   process_handle(pinfo.hProcess);
-    pinfo.hProcess = NULL;
-
-    // Close handles that we no longer need to complete the rest.
-    CloseHandle(pinfo.hThread);
-    pinfo.hThread = NULL;
-
-    nul_read.reset();
-    ack_write.reset();
-    stdout_write.reset();
-    stderr_write.reset();
-
-    // Start threads to read from subprocess stdout/stderr and write to ours to make subprocess
-    // errors easier to diagnose. Note that the threads internally create inheritable handles, but
-    // that is ok because we've already spawned the subprocess.
-
-    // In the past, reading from a pipe before the child process's C Runtime
-    // started up and called GetFileType() caused a hang: http://blogs.msdn.com/b/oldnewthing/archive/2011/12/02/10243553.aspx#10244216
-    // This is reportedly fixed in Windows Vista: https://support.microsoft.com/en-us/kb/2009703
-    // I was unable to reproduce the problem on Windows XP. It sounds like a
-    // Windows Update may have fixed this: https://www.duckware.com/tech/peeknamedpipe.html
-    unique_handle   stdout_thread(reinterpret_cast<HANDLE>(
-            _beginthreadex(NULL, 0, _redirect_stdout_thread, stdout_read.get(),
-                           0, NULL)));
-    if (stdout_thread.get() == nullptr) {
-        fprintf(stderr, "adb: cannot create thread: %s\n", strerror(errno));
-        return -1;
-    }
-    stdout_read.release();  // Transfer ownership to new thread
-
-    unique_handle   stderr_thread(reinterpret_cast<HANDLE>(
-            _beginthreadex(NULL, 0, _redirect_stderr_thread, stderr_read.get(),
-                           0, NULL)));
-    if (stderr_thread.get() == nullptr) {
-        fprintf(stderr, "adb: cannot create thread: %s\n", strerror(errno));
-        return -1;
-    }
-    stderr_read.release();  // Transfer ownership to new thread
-
-    bool    got_ack = false;
-
-    // Wait for the "OK\n" message, for the pipe to be closed, or other error.
-    {
-        char    temp[3];
-        DWORD   count = 0;
-
-        if (ReadFile(ack_read.get(), temp, sizeof(temp), &count, NULL)) {
-            const CHAR  expected[] = "OK\n";
-            const DWORD expected_length = arraysize(expected) - 1;
-            if (count == expected_length &&
-                memcmp(temp, expected, expected_length) == 0) {
-                got_ack = true;
-            } else {
-                ReportServerStartupFailure(pinfo.dwProcessId);
-                return -1;
-            }
-        } else {
-            const DWORD err = GetLastError();
-            // If the ACK was not written and the process exited, GetLastError()
-            // is probably ERROR_BROKEN_PIPE, in which case that info is not
-            // useful to the user.
-            fprintf(stderr, "could not read ok from ADB Server%s\n",
-                    err == ERROR_BROKEN_PIPE ? "" :
-                    android::base::StringPrintf(": %s",
-                            android::base::SystemErrorCodeToString(err).c_str()).c_str());
-        }
-    }
-
-    // Always try to wait a bit for threads reading stdout/stderr to finish.
-    // If the process started ok, it should close the pipes causing the threads
-    // to finish. If the process had an error, it should exit, also causing
-    // the pipes to be closed. In that case we want to read all of the output
-    // and write it out so that the user can diagnose failures.
-    const DWORD     thread_timeout_ms = 15 * 1000;
-    const HANDLE    threads[] = { stdout_thread.get(), stderr_thread.get() };
-    const DWORD     wait_result = WaitForMultipleObjects(arraysize(threads),
-            threads, TRUE, thread_timeout_ms);
-    if (wait_result == WAIT_TIMEOUT) {
-        // Threads did not finish after waiting a little while. Perhaps the
-        // server didn't close pipes, or it is hung.
-        fprintf(stderr, "adb: timed out waiting for threads to finish reading from ADB server\n");
-        // Process handles are signaled when the process exits, so if we wait
-        // on the handle for 0 seconds and it returns 'timeout', that means that
-        // the process is still running.
-        if (WaitForSingleObject(process_handle.get(), 0) == WAIT_TIMEOUT) {
-            // We could TerminateProcess(), but that seems somewhat presumptive.
-            fprintf(stderr, "adb: server is running with process id %lu\n", pinfo.dwProcessId);
-        }
-        return -1;
-    }
-
-    if (wait_result != WAIT_OBJECT_0) {
-        fprintf(stderr, "adb: unexpected result waiting for threads: %lu: %s\n", wait_result,
-                android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return -1;
-    }
-
-    // For now ignore the thread exit codes and assume they worked properly.
-
-    if (!got_ack) {
-        return -1;
-    }
-#else /* !defined(_WIN32) */
-    // set up a pipe so the child can tell us when it is ready.
-    unique_fd pipe_read, pipe_write;
-    if (!Pipe(&pipe_read, &pipe_write)) {
-        fprintf(stderr, "pipe failed in launch_server, errno: %d\n", errno);
-        return -1;
-    }
-
-    std::string path = android::base::GetExecutablePath();
-
-    pid_t pid = fork();
-    if (pid < 0) return -1;
-
-    if (pid == 0) {
-        // child side of the fork
-        pipe_read.reset();
-
-        // android::base::Pipe unconditionally opens the pipe with O_CLOEXEC.
-        // Undo this manually.
-        fcntl(pipe_write.get(), F_SETFD, 0);
-
-        char reply_fd[30];
-        snprintf(reply_fd, sizeof(reply_fd), "%d", pipe_write.get());
-        // child process
-        int result = execl(path.c_str(), "adb", "-L", socket_spec.c_str(), "fork-server", "server",
-                           "--reply-fd", reply_fd, NULL);
-        // this should not return
-        fprintf(stderr, "adb: execl returned %d: %s\n", result, strerror(errno));
-    } else {
-        // parent side of the fork
-        char temp[3] = {};
-        // wait for the "OK\n" message
-        pipe_write.reset();
-        int ret = adb_read(pipe_read.get(), temp, 3);
-        int saved_errno = errno;
-        pipe_read.reset();
-        if (ret < 0) {
-            fprintf(stderr, "could not read ok from ADB Server, errno = %d\n", saved_errno);
-            return -1;
-        }
-        if (ret != 3 || temp[0] != 'O' || temp[1] != 'K' || temp[2] != '\n') {
-            ReportServerStartupFailure(pid);
-            return -1;
-        }
-    }
-#endif /* !defined(_WIN32) */
-    return 0;
-}
-#endif /* ADB_HOST */
-
-bool handle_forward_request(const char* service, atransport* transport, int reply_fd) {
-    return handle_forward_request(service, [transport](std::string*) { return transport; },
-                                  reply_fd);
-}
-
-// Try to handle a network forwarding request.
-bool handle_forward_request(const char* service,
-                            std::function<atransport*(std::string* error)> transport_acquirer,
-                            int reply_fd) {
-    if (!strcmp(service, "list-forward")) {
-        // Create the list of forward redirections.
-        std::string listeners = format_listeners();
-#if ADB_HOST
-        SendOkay(reply_fd);
-#endif
-        SendProtocolString(reply_fd, listeners);
-        return true;
-    }
-
-    if (!strcmp(service, "killforward-all")) {
-        remove_all_listeners();
-#if ADB_HOST
-        /* On the host: 1st OKAY is connect, 2nd OKAY is status */
-        SendOkay(reply_fd);
-#endif
-        SendOkay(reply_fd);
-        return true;
-    }
-
-    if (!strncmp(service, "forward:", 8) || !strncmp(service, "killforward:", 12)) {
-        // killforward:local
-        // forward:(norebind:)?local;remote
-        std::string error;
-        atransport* transport = transport_acquirer(&error);
-        if (!transport) {
-            SendFail(reply_fd, error);
-            return true;
-        }
-
-        bool kill_forward = false;
-        bool no_rebind = false;
-        if (android::base::StartsWith(service, "killforward:")) {
-            kill_forward = true;
-            service += 12;
-        } else {
-            service += 8;   // skip past "forward:"
-            if (android::base::StartsWith(service, "norebind:")) {
-                no_rebind = true;
-                service += 9;
-            }
-        }
-
-        std::vector<std::string> pieces = android::base::Split(service, ";");
-
-        if (kill_forward) {
-            // Check killforward: parameter format: '<local>'
-            if (pieces.size() != 1 || pieces[0].empty()) {
-                SendFail(reply_fd, android::base::StringPrintf("bad killforward: %s", service));
-                return true;
-            }
-        } else {
-            // Check forward: parameter format: '<local>;<remote>'
-            if (pieces.size() != 2 || pieces[0].empty() || pieces[1].empty() || pieces[1][0] == '*') {
-                SendFail(reply_fd, android::base::StringPrintf("bad forward: %s", service));
-                return true;
-            }
-        }
-
-        InstallStatus r;
-        int resolved_tcp_port = 0;
-        if (kill_forward) {
-            r = remove_listener(pieces[0].c_str(), transport);
-        } else {
-            r = install_listener(pieces[0], pieces[1].c_str(), transport, no_rebind,
-                                 &resolved_tcp_port, &error);
-        }
-        if (r == INSTALL_STATUS_OK) {
-#if ADB_HOST
-            // On the host: 1st OKAY is connect, 2nd OKAY is status.
-            SendOkay(reply_fd);
-#endif
-            SendOkay(reply_fd);
-
-            // If a TCP port was resolved, send the actual port number back.
-            if (resolved_tcp_port != 0) {
-                SendProtocolString(reply_fd, android::base::StringPrintf("%d", resolved_tcp_port));
-            }
-
-            return true;
-        }
-
-        std::string message;
-        switch (r) {
-          case INSTALL_STATUS_OK: message = "success (!)"; break;
-          case INSTALL_STATUS_INTERNAL_ERROR: message = "internal error"; break;
-          case INSTALL_STATUS_CANNOT_BIND:
-            message = android::base::StringPrintf("cannot bind listener: %s",
-                                                  error.c_str());
-            break;
-          case INSTALL_STATUS_CANNOT_REBIND:
-            message = android::base::StringPrintf("cannot rebind existing socket");
-            break;
-          case INSTALL_STATUS_LISTENER_NOT_FOUND:
-            message = android::base::StringPrintf("listener '%s' not found", service);
-            break;
-        }
-        SendFail(reply_fd, message);
-        return true;
-    }
-
-    return false;
-}
-
-#if ADB_HOST
-static int SendOkay(int fd, const std::string& s) {
-    SendOkay(fd);
-    SendProtocolString(fd, s);
-    return 0;
-}
-
-HostRequestResult handle_host_request(std::string_view service, TransportType type,
-                                      const char* serial, TransportId transport_id, int reply_fd,
-                                      asocket* s) {
-    if (service == "kill") {
-        fprintf(stderr, "adb server killed by remote request\n");
-        fflush(stdout);
-
-        // Send a reply even though we don't read it anymore, so that old versions
-        // of adb that do read it don't spew error messages.
-        SendOkay(reply_fd);
-
-        // Rely on process exit to close the socket for us.
-        exit(0);
-    }
-
-    LOG(DEBUG) << "handle_host_request(" << service << ")";
-
-    // Transport selection:
-    if (service.starts_with("transport") || service.starts_with("tport:")) {
-        TransportType type = kTransportAny;
-
-        std::string serial_storage;
-        bool legacy = true;
-
-        // New transport selection protocol:
-        // This is essentially identical to the previous version, except it returns the selected
-        // transport id to the caller as well.
-        if (android::base::ConsumePrefix(&service, "tport:")) {
-            legacy = false;
-            if (android::base::ConsumePrefix(&service, "serial:")) {
-                serial_storage = service;
-                serial = serial_storage.c_str();
-            } else if (service == "usb") {
-                type = kTransportUsb;
-            } else if (service == "local") {
-                type = kTransportLocal;
-            } else if (service == "any") {
-                type = kTransportAny;
-            }
-
-            // Selection by id is unimplemented, since you obviously already know the transport id
-            // you're connecting to.
-        } else {
-            if (android::base::ConsumePrefix(&service, "transport-id:")) {
-                if (!ParseUint(&transport_id, service)) {
-                    SendFail(reply_fd, "invalid transport id");
-                    return HostRequestResult::Handled;
-                }
-            } else if (service == "transport-usb") {
-                type = kTransportUsb;
-            } else if (service == "transport-local") {
-                type = kTransportLocal;
-            } else if (service == "transport-any") {
-                type = kTransportAny;
-            } else if (android::base::ConsumePrefix(&service, "transport:")) {
-                serial_storage = service;
-                serial = serial_storage.c_str();
-            }
-        }
-
-        std::string error;
-        atransport* t = acquire_one_transport(type, serial, transport_id, nullptr, &error);
-        if (t != nullptr) {
-            s->transport = t;
-            SendOkay(reply_fd);
-
-            if (!legacy) {
-                // Nothing we can do if this fails.
-                WriteFdExactly(reply_fd, &t->id, sizeof(t->id));
-            }
-
-            return HostRequestResult::SwitchedTransport;
-        } else {
-            SendFail(reply_fd, error);
-            return HostRequestResult::Handled;
-        }
-    }
-
-    // return a list of all connected devices
-    if (service == "devices" || service == "devices-l") {
-        bool long_listing = service == "devices-l";
-        D("Getting device list...");
-        std::string device_list = list_transports(long_listing);
-        D("Sending device list...");
-        SendOkay(reply_fd, device_list);
-        return HostRequestResult::Handled;
-    }
-
-    if (service == "reconnect-offline") {
-        std::string response;
-        close_usb_devices([&response](const atransport* transport) {
-            if (!ConnectionStateIsOnline(transport->GetConnectionState())) {
-                response += "reconnecting " + transport->serial_name() + "\n";
-                return true;
-            }
-            return false;
-        }, true);
-        if (!response.empty()) {
-            response.resize(response.size() - 1);
-        }
-        SendOkay(reply_fd, response);
-        return HostRequestResult::Handled;
-    }
-
-    if (service == "features") {
-        std::string error;
-        atransport* t =
-                s->transport ? s->transport
-                             : acquire_one_transport(type, serial, transport_id, nullptr, &error);
-        if (t != nullptr) {
-            SendOkay(reply_fd, FeatureSetToString(t->features()));
-        } else {
-            SendFail(reply_fd, error);
-        }
-        return HostRequestResult::Handled;
-    }
-
-    if (service == "host-features") {
-        FeatureSet features = supported_features();
-        // Abuse features to report libusb status.
-        if (should_use_libusb()) {
-            features.insert(kFeatureLibusb);
-        }
-        features.insert(kFeaturePushSync);
-        SendOkay(reply_fd, FeatureSetToString(features));
-        return HostRequestResult::Handled;
-    }
-
-    // remove TCP transport
-    if (service.starts_with("disconnect:")) {
-        std::string address(service.substr(11));
-        if (address.empty()) {
-            kick_all_tcp_devices();
-            SendOkay(reply_fd, "disconnected everything");
-            return HostRequestResult::Handled;
-        }
-
-        std::string serial;
-        std::string host;
-        int port = DEFAULT_ADB_LOCAL_TRANSPORT_PORT;
-        std::string error;
-        if (address.starts_with("vsock:") || address.starts_with("localfilesystem:")) {
-            serial = address;
-        } else if (!android::base::ParseNetAddress(address, &host, &port, &serial, &error)) {
-            SendFail(reply_fd, android::base::StringPrintf("couldn't parse '%s': %s",
-                                                           address.c_str(), error.c_str()));
-            return HostRequestResult::Handled;
-        }
-        atransport* t = find_transport(serial.c_str());
-        if (t == nullptr) {
-            SendFail(reply_fd, android::base::StringPrintf("no such device '%s'", serial.c_str()));
-            return HostRequestResult::Handled;
-        }
-        kick_transport(t);
-        SendOkay(reply_fd, android::base::StringPrintf("disconnected %s", address.c_str()));
-        return HostRequestResult::Handled;
-    }
-
-    // Returns our value for ADB_SERVER_VERSION.
-    if (service == "version") {
-        SendOkay(reply_fd, android::base::StringPrintf("%04x", ADB_SERVER_VERSION));
-        return HostRequestResult::Handled;
-    }
-
-    // These always report "unknown" rather than the actual error, for scripts.
-    if (service == "get-serialno") {
-        std::string error;
-        atransport* t =
-                s->transport ? s->transport
-                             : acquire_one_transport(type, serial, transport_id, nullptr, &error);
-        if (t) {
-            SendOkay(reply_fd, !t->serial.empty() ? t->serial : "unknown");
-        } else {
-            SendFail(reply_fd, error);
-        }
-        return HostRequestResult::Handled;
-    }
-    if (service == "get-devpath") {
-        std::string error;
-        atransport* t =
-                s->transport ? s->transport
-                             : acquire_one_transport(type, serial, transport_id, nullptr, &error);
-        if (t) {
-            SendOkay(reply_fd, !t->devpath.empty() ? t->devpath : "unknown");
-        } else {
-            SendFail(reply_fd, error);
-        }
-        return HostRequestResult::Handled;
-    }
-    if (service == "get-state") {
-        std::string error;
-        atransport* t =
-                s->transport ? s->transport
-                             : acquire_one_transport(type, serial, transport_id, nullptr, &error);
-        if (t) {
-            SendOkay(reply_fd, t->connection_state_name());
-        } else {
-            SendFail(reply_fd, error);
-        }
-        return HostRequestResult::Handled;
-    }
-
-    // Indicates a new emulator instance has started.
-    if (android::base::ConsumePrefix(&service, "emulator:")) {
-        unsigned int port;
-        if (!ParseUint(&port, service)) {
-          LOG(ERROR) << "received invalid port for emulator: " << service;
-        } else {
-          local_connect(port);
-        }
-
-        /* we don't even need to send a reply */
-        return HostRequestResult::Handled;
-    }
-
-    if (service == "reconnect") {
-        std::string response;
-        atransport* t = s->transport ? s->transport
-                                     : acquire_one_transport(type, serial, transport_id, nullptr,
-                                                             &response, true);
-        if (t != nullptr) {
-            kick_transport(t, true);
-            response =
-                    "reconnecting " + t->serial_name() + " [" + t->connection_state_name() + "]\n";
-        }
-        SendOkay(reply_fd, response);
-        return HostRequestResult::Handled;
-    }
-
-    // TODO: Switch handle_forward_request to string_view.
-    std::string service_str(service);
-    auto transport_acquirer = [=](std::string* error) {
-        if (s->transport) {
-            return s->transport;
-        } else {
-            std::string error;
-            return acquire_one_transport(type, serial, transport_id, nullptr, &error);
-        }
-    };
-    if (handle_forward_request(service_str.c_str(), transport_acquirer, reply_fd)) {
-        return HostRequestResult::Handled;
-    }
-
-    return HostRequestResult::Unhandled;
-}
-
-static auto& init_mutex = *new std::mutex();
-static auto& init_cv = *new std::condition_variable();
-static bool device_scan_complete = false;
-static bool transports_ready = false;
-
-void update_transport_status() {
-    bool result = iterate_transports([](const atransport* t) {
-        if (t->type == kTransportUsb && t->online != 1) {
-            return false;
-        }
-        return true;
-    });
-
-    bool ready;
-    {
-        std::lock_guard<std::mutex> lock(init_mutex);
-        transports_ready = result;
-        ready = transports_ready && device_scan_complete;
-    }
-
-    if (ready) {
-        init_cv.notify_all();
-    }
-}
-
-void adb_notify_device_scan_complete() {
-    {
-        std::lock_guard<std::mutex> lock(init_mutex);
-        if (device_scan_complete) {
-            return;
-        }
-
-        device_scan_complete = true;
-    }
-
-    update_transport_status();
-}
-
-void adb_wait_for_device_initialization() {
-    std::unique_lock<std::mutex> lock(init_mutex);
-    init_cv.wait_for(lock, 3s, []() { return device_scan_complete && transports_ready; });
-}
-
-#endif  // ADB_HOST
diff --git a/adb/adb.h b/adb/adb.h
deleted file mode 100644
index ce12a55..0000000
--- a/adb/adb.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef __ADB_H
-#define __ADB_H
-
-#include <limits.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <string>
-
-#include <android-base/macros.h>
-
-#include "adb_trace.h"
-#include "fdevent/fdevent.h"
-#include "socket.h"
-#include "types.h"
-
-constexpr size_t MAX_PAYLOAD_V1 = 4 * 1024;
-constexpr size_t MAX_PAYLOAD = 1024 * 1024;
-constexpr size_t MAX_FRAMEWORK_PAYLOAD = 64 * 1024;
-
-constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304;
-
-#define A_SYNC 0x434e5953
-#define A_CNXN 0x4e584e43
-#define A_OPEN 0x4e45504f
-#define A_OKAY 0x59414b4f
-#define A_CLSE 0x45534c43
-#define A_WRTE 0x45545257
-#define A_AUTH 0x48545541
-#define A_STLS 0x534C5453
-
-// ADB protocol version.
-// Version revision:
-// 0x01000000: original
-// 0x01000001: skip checksum (Dec 2017)
-#define A_VERSION_MIN 0x01000000
-#define A_VERSION_SKIP_CHECKSUM 0x01000001
-#define A_VERSION 0x01000001
-
-// Stream-based TLS protocol version
-#define A_STLS_VERSION_MIN 0x01000000
-#define A_STLS_VERSION 0x01000000
-
-// Used for help/version information.
-#define ADB_VERSION_MAJOR 1
-#define ADB_VERSION_MINOR 0
-
-std::string adb_version();
-
-// Increment this when we want to force users to start a new adb server.
-#define ADB_SERVER_VERSION 41
-
-using TransportId = uint64_t;
-class atransport;
-
-uint32_t calculate_apacket_checksum(const apacket* packet);
-
-/* the adisconnect structure is used to record a callback that
-** will be called whenever a transport is disconnected (e.g. by the user)
-** this should be used to cleanup objects that depend on the
-** transport (e.g. remote sockets, listeners, etc...)
-*/
-struct adisconnect {
-    void (*func)(void* opaque, atransport* t);
-    void* opaque;
-};
-
-// A transport object models the connection to a remote device or emulator there
-// is one transport per connected device/emulator. A "local transport" connects
-// through TCP (for the emulator), while a "usb transport" through USB (for real
-// devices).
-//
-// Note that kTransportHost doesn't really correspond to a real transport
-// object, it's a special value used to indicate that a client wants to connect
-// to a service implemented within the ADB server itself.
-enum TransportType {
-    kTransportUsb,
-    kTransportLocal,
-    kTransportAny,
-    kTransportHost,
-};
-
-#define TOKEN_SIZE 20
-
-enum ConnectionState {
-    kCsAny = -1,
-
-    kCsConnecting = 0,  // Haven't received a response from the device yet.
-    kCsAuthorizing,     // Authorizing with keys from ADB_VENDOR_KEYS.
-    kCsUnauthorized,    // ADB_VENDOR_KEYS exhausted, fell back to user prompt.
-    kCsNoPerm,          // Insufficient permissions to communicate with the device.
-    kCsOffline,
-
-    kCsBootloader,
-    kCsDevice,
-    kCsHost,
-    kCsRecovery,
-    kCsSideload,
-    kCsRescue,
-};
-
-inline bool ConnectionStateIsOnline(ConnectionState state) {
-    switch (state) {
-        case kCsBootloader:
-        case kCsDevice:
-        case kCsHost:
-        case kCsRecovery:
-        case kCsSideload:
-        case kCsRescue:
-            return true;
-        default:
-            return false;
-    }
-}
-
-void print_packet(const char* label, apacket* p);
-
-void handle_packet(apacket* p, atransport* t);
-
-int launch_server(const std::string& socket_spec);
-int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply_fd);
-
-/* initialize a transport object's func pointers and state */
-int init_socket_transport(atransport* t, unique_fd s, int port, int local);
-
-std::string getEmulatorSerialString(int console_port);
-#if ADB_HOST
-atransport* find_emulator_transport_by_adb_port(int adb_port);
-atransport* find_emulator_transport_by_console_port(int console_port);
-#endif
-
-unique_fd service_to_fd(std::string_view name, atransport* transport);
-#if !ADB_HOST
-unique_fd daemon_service_to_fd(std::string_view name, atransport* transport);
-#endif
-
-#if ADB_HOST
-asocket* host_service_to_socket(std::string_view name, std::string_view serial,
-                                TransportId transport_id);
-#endif
-
-#if !ADB_HOST
-asocket* daemon_service_to_socket(std::string_view name);
-#endif
-
-#if !ADB_HOST
-unique_fd execute_abb_command(std::string_view command);
-#endif
-
-#if !ADB_HOST
-int init_jdwp(void);
-asocket* create_jdwp_service_socket();
-asocket* create_jdwp_tracker_service_socket();
-unique_fd create_jdwp_connection_fd(int jdwp_pid);
-#endif
-
-bool handle_forward_request(const char* service, atransport* transport, int reply_fd);
-bool handle_forward_request(const char* service,
-                            std::function<atransport*(std::string* error)> transport_acquirer,
-                            int reply_fd);
-
-/* packet allocator */
-apacket* get_apacket(void);
-void put_apacket(apacket* p);
-
-// Define it if you want to dump packets.
-#define DEBUG_PACKETS 0
-
-#if !DEBUG_PACKETS
-#define print_packet(tag, p) \
-    do {                     \
-    } while (0)
-#endif
-
-#define DEFAULT_ADB_PORT 5037
-
-#define DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555
-
-#define ADB_CLASS 0xff
-#define ADB_SUBCLASS 0x42
-#define ADB_PROTOCOL 0x1
-
-void local_init(const std::string& addr);
-bool local_connect(int port);
-int local_connect_arbitrary_ports(int console_port, int adb_port, std::string* error);
-
-ConnectionState connection_state(atransport* t);
-
-extern const char* adb_device_banner;
-
-#define CHUNK_SIZE (64 * 1024)
-
-// Argument delimeter for adb abb command.
-#define ABB_ARG_DELIMETER ('\0')
-
-#if !ADB_HOST
-#define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/"
-#define USB_FFS_ADB_EP(x) USB_FFS_ADB_PATH #x
-
-#define USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0)
-#define USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1)
-#define USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2)
-#endif
-
-enum class HostRequestResult {
-    Handled,
-    SwitchedTransport,
-    Unhandled,
-};
-
-HostRequestResult handle_host_request(std::string_view service, TransportType type,
-                                      const char* serial, TransportId transport_id, int reply_fd,
-                                      asocket* s);
-
-void handle_online(atransport* t);
-void handle_offline(atransport* t);
-
-void send_connect(atransport* t);
-void send_tls_request(atransport* t);
-
-void parse_banner(const std::string&, atransport* t);
-
-// On startup, the adb server needs to wait until all of the connected devices are ready.
-// To do this, we need to know when the scan has identified all of the potential new transports, and
-// when each transport becomes ready.
-// TODO: Do this for mDNS as well, instead of just USB?
-
-// We've found all of the transports we potentially care about.
-void adb_notify_device_scan_complete();
-
-// One or more transports have changed status, check to see if we're ready.
-void update_transport_status();
-
-// Wait until device scan has completed and every transport is ready, or a timeout elapses.
-void adb_wait_for_device_initialization();
-
-void usb_init();
-#endif
diff --git a/adb/adb_auth.h b/adb/adb_auth.h
deleted file mode 100644
index 7e858dc..0000000
--- a/adb/adb_auth.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#ifndef __ADB_AUTH_H
-#define __ADB_AUTH_H
-
-#include "adb.h"
-
-#include <deque>
-#include <memory>
-
-#include <openssl/rsa.h>
-
-/* AUTH packets first argument */
-/* Request */
-#define ADB_AUTH_TOKEN         1
-/* Response */
-#define ADB_AUTH_SIGNATURE     2
-#define ADB_AUTH_RSAPUBLICKEY  3
-
-#if ADB_HOST
-
-void adb_auth_init();
-
-int adb_auth_keygen(const char* filename);
-int adb_auth_pubkey(const char* filename);
-std::string adb_auth_get_userkey();
-bssl::UniquePtr<EVP_PKEY> adb_auth_get_user_privkey();
-std::deque<std::shared_ptr<RSA>> adb_auth_get_private_keys();
-
-void send_auth_response(const char* token, size_t token_size, atransport* t);
-
-int adb_tls_set_certificate(SSL* ssl);
-void adb_auth_tls_handshake(atransport* t);
-
-#else // !ADB_HOST
-
-extern bool auth_required;
-
-void adbd_auth_init(void);
-void adbd_auth_verified(atransport *t);
-
-void adbd_cloexec_auth_socket();
-bool adbd_auth_verify(const char* token, size_t token_size, const std::string& sig,
-                      std::string* auth_key);
-void adbd_auth_confirm_key(atransport* t);
-void adbd_notify_framework_connected_key(atransport* t);
-
-void send_auth_request(atransport *t);
-
-void adbd_auth_tls_handshake(atransport* t);
-int adbd_tls_verify_cert(X509_STORE_CTX* ctx, std::string* auth_key);
-bssl::UniquePtr<STACK_OF(X509_NAME)> adbd_tls_client_ca_list();
-
-#endif // ADB_HOST
-
-#endif // __ADB_AUTH_H
diff --git a/adb/adb_integration_test_adb.xml b/adb/adb_integration_test_adb.xml
deleted file mode 100644
index e722956..0000000
--- a/adb/adb_integration_test_adb.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<configuration description="Config to run adb integration tests">
-    <option name="test-suite-tag" value="adb_tests" />
-    <option name="test-suite-tag" value="adb_integration" />
-    <target_preparer class="com.android.tradefed.targetprep.SemaphoreTokenTargetPreparer">
-        <option name="disable" value="false" />
-    </target_preparer>
-
-    <target_preparer class="com.android.tradefed.targetprep.adb.AdbStopServerPreparer" />
-    <test class="com.android.tradefed.testtype.python.PythonBinaryHostTest" >
-        <option name="par-file-name" value="adb_integration_test_adb" />
-        <option name="inject-android-serial" value="true" />
-        <option name="test-timeout" value="2m" />
-    </test>
-</configuration>
diff --git a/adb/adb_integration_test_device.xml b/adb/adb_integration_test_device.xml
deleted file mode 100644
index b892377..0000000
--- a/adb/adb_integration_test_device.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<configuration description="Config to run adb integration tests for device">
-    <option name="test-suite-tag" value="adb_tests" />
-    <option name="test-suite-tag" value="adb_integration_device" />
-    <target_preparer class="com.android.tradefed.targetprep.SemaphoreTokenTargetPreparer">
-        <option name="disable" value="false" />
-    </target_preparer>
-
-    <target_preparer class="com.android.tradefed.targetprep.adb.AdbStopServerPreparer" />
-    <test class="com.android.tradefed.testtype.python.PythonBinaryHostTest" >
-        <option name="par-file-name" value="adb_integration_test_device" />
-        <option name="inject-android-serial" value="true" />
-        <option name="test-timeout" value="2m" />
-    </test>
-</configuration>
diff --git a/adb/adb_io.cpp b/adb/adb_io.cpp
deleted file mode 100644
index bdb8efa..0000000
--- a/adb/adb_io.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define TRACE_TAG RWX
-
-#include "adb_io.h"
-
-#include <unistd.h>
-
-#if !ADB_HOST
-#include <sys/socket.h>
-#include <sys/un.h>
-#endif
-
-#include <thread>
-
-#include <android-base/stringprintf.h>
-
-#include "adb.h"
-#include "adb_trace.h"
-#include "adb_utils.h"
-#include "sysdeps.h"
-
-bool SendProtocolString(borrowed_fd fd, std::string_view s) {
-    unsigned int length = s.size();
-    if (length > MAX_PAYLOAD - 4) {
-        errno = EMSGSIZE;
-        return false;
-    }
-
-    // The cost of sending two strings outweighs the cost of formatting.
-    // "adb sync" performance is affected by this.
-    auto str = android::base::StringPrintf("%04x", length).append(s);
-    return WriteFdExactly(fd, str);
-}
-
-bool ReadProtocolString(borrowed_fd fd, std::string* s, std::string* error) {
-    char buf[5];
-    if (!ReadFdExactly(fd, buf, 4)) {
-        *error = perror_str("protocol fault (couldn't read status length)");
-        return false;
-    }
-    buf[4] = 0;
-
-    unsigned long len = strtoul(buf, nullptr, 16);
-    s->resize(len, '\0');
-    if (!ReadFdExactly(fd, &(*s)[0], len)) {
-        *error = perror_str("protocol fault (couldn't read status message)");
-        return false;
-    }
-
-    return true;
-}
-
-bool SendOkay(borrowed_fd fd) {
-    return WriteFdExactly(fd, "OKAY", 4);
-}
-
-bool SendFail(borrowed_fd fd, std::string_view reason) {
-    return WriteFdExactly(fd, "FAIL", 4) && SendProtocolString(fd, reason);
-}
-
-bool ReadFdExactly(borrowed_fd fd, void* buf, size_t len) {
-    char* p = reinterpret_cast<char*>(buf);
-
-    size_t len0 = len;
-
-    D("readx: fd=%d wanted=%zu", fd.get(), len);
-    while (len > 0) {
-        int r = adb_read(fd, p, len);
-        if (r > 0) {
-            len -= r;
-            p += r;
-        } else if (r == -1) {
-            D("readx: fd=%d error %d: %s", fd.get(), errno, strerror(errno));
-            return false;
-        } else {
-            D("readx: fd=%d disconnected", fd.get());
-            errno = 0;
-            return false;
-        }
-    }
-
-    VLOG(RWX) << "readx: fd=" << fd.get() << " wanted=" << len0 << " got=" << (len0 - len) << " "
-              << dump_hex(reinterpret_cast<const unsigned char*>(buf), len0);
-
-    return true;
-}
-
-bool WriteFdExactly(borrowed_fd fd, const void* buf, size_t len) {
-    const char* p = reinterpret_cast<const char*>(buf);
-    int r;
-
-    VLOG(RWX) << "writex: fd=" << fd.get() << " len=" << len << " "
-              << dump_hex(reinterpret_cast<const unsigned char*>(buf), len);
-
-    while (len > 0) {
-        r = adb_write(fd, p, len);
-        if (r == -1) {
-            D("writex: fd=%d error %d: %s", fd.get(), errno, strerror(errno));
-            if (errno == EAGAIN) {
-                std::this_thread::yield();
-                continue;
-            } else if (errno == EPIPE) {
-                D("writex: fd=%d disconnected", fd.get());
-                errno = 0;
-                return false;
-            } else {
-                return false;
-            }
-        } else {
-            len -= r;
-            p += r;
-        }
-    }
-    return true;
-}
-
-bool WriteFdExactly(borrowed_fd fd, const char* str) {
-    return WriteFdExactly(fd, str, strlen(str));
-}
-
-bool WriteFdExactly(borrowed_fd fd, const std::string& str) {
-    return WriteFdExactly(fd, str.c_str(), str.size());
-}
-
-bool WriteFdFmt(borrowed_fd fd, const char* fmt, ...) {
-    std::string str;
-
-    va_list ap;
-    va_start(ap, fmt);
-    android::base::StringAppendV(&str, fmt, ap);
-    va_end(ap);
-
-    return WriteFdExactly(fd, str);
-}
-
-bool ReadOrderlyShutdown(borrowed_fd fd) {
-    char buf[16];
-
-    // Only call this function if you're sure that the peer does
-    // orderly/graceful shutdown of the socket, closing the socket so that
-    // adb_read() will return 0. If the peer keeps the socket open, adb_read()
-    // will never return.
-    int result = adb_read(fd, buf, sizeof(buf));
-    if (result == -1) {
-        // If errno is EAGAIN, that means this function was called on a
-        // nonblocking socket and it would have blocked (which would be bad
-        // because we'd probably block the main thread where nonblocking IO is
-        // done). Don't do that. If you have a nonblocking socket, use the
-        // fdevent APIs to get called on FDE_READ, and then call this function
-        // if you really need to, but it shouldn't be needed for server sockets.
-        CHECK_NE(errno, EAGAIN);
-
-        // Note that on Windows, orderly shutdown sometimes causes
-        // recv() == SOCKET_ERROR && WSAGetLastError() == WSAECONNRESET. That
-        // can be ignored.
-        return false;
-    } else if (result == 0) {
-        // Peer has performed an orderly/graceful shutdown.
-        return true;
-    } else {
-        // Unexpectedly received data. This is essentially a protocol error
-        // because you should not call this function unless you expect no more
-        // data. We don't repeatedly call adb_read() until we get zero because
-        // we don't know how long that would take, but we do know that the
-        // caller wants to close the socket soon.
-        VLOG(RWX) << "ReadOrderlyShutdown(" << fd.get() << ") unexpectedly read "
-                  << dump_hex(buf, result);
-        // Shutdown the socket to prevent the caller from reading or writing to
-        // it which doesn't make sense if we just read and discarded some data.
-        adb_shutdown(fd);
-        errno = EINVAL;
-        return false;
-    }
-}
diff --git a/adb/adb_io.h b/adb/adb_io.h
deleted file mode 100644
index 9628946..0000000
--- a/adb/adb_io.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef ADB_IO_H
-#define ADB_IO_H
-
-#include <sys/types.h>
-
-#include <string>
-#include <string_view>
-
-#include "adb_unique_fd.h"
-
-// Sends the protocol "OKAY" message.
-bool SendOkay(borrowed_fd fd);
-
-// Sends the protocol "FAIL" message, with the given failure reason.
-bool SendFail(borrowed_fd fd, std::string_view reason);
-
-// Writes a protocol-format string; a four hex digit length followed by the string data.
-bool SendProtocolString(borrowed_fd fd, std::string_view s);
-
-// Reads a protocol-format string; a four hex digit length followed by the string data.
-bool ReadProtocolString(borrowed_fd fd, std::string* s, std::string* error);
-
-// Reads exactly len bytes from fd into buf.
-//
-// Returns false if there is an error or if EOF was reached before len bytes
-// were read. If EOF was found, errno will be set to 0.
-//
-// If this function fails, the contents of buf are undefined.
-bool ReadFdExactly(borrowed_fd fd, void* buf, size_t len);
-
-// Given a client socket, wait for orderly/graceful shutdown. Call this:
-//
-// * Before closing a client socket.
-// * Only when no more data is expected to come in.
-// * Only when the server is not waiting for data from the client (because then
-//   the client and server will deadlock waiting for each other).
-// * Only when the server is expected to close its socket right now.
-// * Don't call shutdown(SHUT_WR) before calling this because that will shutdown
-//   the client socket early, defeating the purpose of calling this.
-//
-// Waiting for orderly/graceful shutdown of the server socket will cause the
-// server socket to close before the client socket. That prevents the client
-// socket from staying in TIME_WAIT which eventually causes subsequent
-// connect()s from the client to fail with WSAEADDRINUSE on Windows.
-// Returns true if it is sure that orderly/graceful shutdown has occurred with
-// no additional data read from the server.
-bool ReadOrderlyShutdown(borrowed_fd fd);
-
-// Writes exactly len bytes from buf to fd.
-//
-// Returns false if there is an error or if the fd was closed before the write
-// completed. If the other end of the fd (such as in a socket, pipe, or fifo),
-// is closed, errno will be set to 0.
-bool WriteFdExactly(borrowed_fd fd, const void* buf, size_t len);
-
-// Same as above, but for strings.
-bool WriteFdExactly(borrowed_fd fd, const char* s);
-bool WriteFdExactly(borrowed_fd fd, const std::string& s);
-
-// Same as above, but formats the string to send.
-bool WriteFdFmt(borrowed_fd fd, const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3)));
-#endif /* ADB_IO_H */
diff --git a/adb/adb_io_test.cpp b/adb/adb_io_test.cpp
deleted file mode 100644
index 91b73a9..0000000
--- a/adb/adb_io_test.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "adb_io.h"
-
-#include <gtest/gtest.h>
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-
-// All of these tests fail on Windows because they use the C Runtime open(),
-// but the adb_io APIs expect file descriptors from adb_open(). This could
-// theoretically be fixed by making adb_read()/adb_write() fallback to using
-// read()/write() if an unrecognized fd is used, and by making adb_open() return
-// fds far from the range that open() returns. But all of that might defeat the
-// purpose of the tests.
-
-#if defined(_WIN32)
-#define POSIX_TEST(x,y) TEST(DISABLED_ ## x,y)
-#else
-#define POSIX_TEST TEST
-#endif
-
-POSIX_TEST(io, ReadFdExactly_whole) {
-  const char expected[] = "Foobar";
-  TemporaryFile tf;
-  ASSERT_NE(-1, tf.fd);
-
-  ASSERT_TRUE(android::base::WriteStringToFd(expected, tf.fd)) << strerror(errno);
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-  // Test reading the whole file.
-  char buf[sizeof(expected)] = {};
-  ASSERT_TRUE(ReadFdExactly(tf.fd, buf, sizeof(buf) - 1)) << strerror(errno);
-  EXPECT_STREQ(expected, buf);
-}
-
-POSIX_TEST(io, ReadFdExactly_eof) {
-  const char expected[] = "Foobar";
-  TemporaryFile tf;
-  ASSERT_NE(-1, tf.fd);
-
-  ASSERT_TRUE(android::base::WriteStringToFd(expected, tf.fd)) << strerror(errno);
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-  // Test that not having enough data will fail.
-  char buf[sizeof(expected) + 1] = {};
-  ASSERT_FALSE(ReadFdExactly(tf.fd, buf, sizeof(buf)));
-  EXPECT_EQ(0, errno) << strerror(errno);
-}
-
-POSIX_TEST(io, ReadFdExactly_partial) {
-  const char input[] = "Foobar";
-  TemporaryFile tf;
-  ASSERT_NE(-1, tf.fd);
-
-  ASSERT_TRUE(android::base::WriteStringToFd(input, tf.fd)) << strerror(errno);
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-  // Test reading a partial file.
-  char buf[sizeof(input) - 1] = {};
-  ASSERT_TRUE(ReadFdExactly(tf.fd, buf, sizeof(buf) - 1));
-
-  std::string expected(input);
-  expected.pop_back();
-  EXPECT_STREQ(expected.c_str(), buf);
-}
-
-POSIX_TEST(io, WriteFdExactly_whole) {
-  const char expected[] = "Foobar";
-  TemporaryFile tf;
-  ASSERT_NE(-1, tf.fd);
-
-  // Test writing the whole string to the file.
-  ASSERT_TRUE(WriteFdExactly(tf.fd, expected, sizeof(expected)))
-    << strerror(errno);
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-  std::string s;
-  ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
-  EXPECT_STREQ(expected, s.c_str());
-}
-
-POSIX_TEST(io, WriteFdExactly_partial) {
-  const char buf[] = "Foobar";
-  TemporaryFile tf;
-  ASSERT_NE(-1, tf.fd);
-
-  // Test writing a partial string to the file.
-  ASSERT_TRUE(WriteFdExactly(tf.fd, buf, sizeof(buf) - 2)) << strerror(errno);
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-  std::string expected(buf);
-  expected.pop_back();
-
-  std::string s;
-  ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
-  EXPECT_EQ(expected, s);
-}
-
-POSIX_TEST(io, WriteFdExactly_ENOSPC) {
-    int fd = open("/dev/full", O_WRONLY);
-    ASSERT_NE(-1, fd);
-
-    char buf[] = "foo";
-    ASSERT_FALSE(WriteFdExactly(fd, buf, sizeof(buf)));
-    ASSERT_EQ(ENOSPC, errno);
-}
-
-POSIX_TEST(io, WriteFdExactly_string) {
-  const char str[] = "Foobar";
-  TemporaryFile tf;
-  ASSERT_NE(-1, tf.fd);
-
-  // Test writing a partial string to the file.
-  ASSERT_TRUE(WriteFdExactly(tf.fd, str)) << strerror(errno);
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-  std::string s;
-  ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
-  EXPECT_STREQ(str, s.c_str());
-}
-
-POSIX_TEST(io, WriteFdFmt) {
-    TemporaryFile tf;
-    ASSERT_NE(-1, tf.fd);
-
-    // Test writing a partial string to the file.
-    ASSERT_TRUE(WriteFdFmt(tf.fd, "Foo%s%d", "bar", 123)) << strerror(errno);
-    ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-
-    std::string s;
-    ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
-    EXPECT_STREQ("Foobar123", s.c_str());
-}
diff --git a/adb/adb_listeners.cpp b/adb/adb_listeners.cpp
deleted file mode 100644
index 29909a5..0000000
--- a/adb/adb_listeners.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "adb_listeners.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <algorithm>
-#include <list>
-#include <memory>
-
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <android-base/thread_annotations.h>
-#include <cutils/sockets.h>
-
-#include "socket_spec.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-// A listener is an entity which binds to a local port and, upon receiving a connection on that
-// port, creates an asocket to connect the new local connection to a specific remote service.
-//
-// TODO: some listeners read from the new connection to determine what exact service to connect to
-// on the far side.
-class alistener {
-  public:
-    alistener(const std::string& _local_name, const std::string& _connect_to);
-    ~alistener();
-
-    fdevent* fde = nullptr;
-    int fd = -1;
-
-    std::string local_name;
-    std::string connect_to;
-    atransport* transport = nullptr;
-    adisconnect disconnect;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(alistener);
-};
-
-alistener::alistener(const std::string& _local_name, const std::string& _connect_to)
-    : local_name(_local_name), connect_to(_connect_to) {
-}
-
-alistener::~alistener() {
-    // Closes the corresponding fd.
-    fdevent_destroy(fde);
-
-    if (transport) {
-        transport->RemoveDisconnect(&disconnect);
-    }
-}
-
-// listener_list retains ownership of all created alistener objects. Removing an alistener from
-// this list will cause it to be deleted.
-static auto& listener_list_mutex = *new std::mutex();
-typedef std::list<std::unique_ptr<alistener>> ListenerList;
-static ListenerList& listener_list GUARDED_BY(listener_list_mutex) = *new ListenerList();
-
-static void ss_listener_event_func(int _fd, unsigned ev, void *_l) {
-    if (ev & FDE_READ) {
-        unique_fd fd(adb_socket_accept(_fd, nullptr, nullptr));
-        if (fd < 0) return;
-
-        int rcv_buf_size = CHUNK_SIZE;
-        adb_setsockopt(fd.get(), SOL_SOCKET, SO_RCVBUF, &rcv_buf_size, sizeof(rcv_buf_size));
-
-        asocket* s = create_local_socket(std::move(fd));
-        if (s) {
-            connect_to_smartsocket(s);
-            return;
-        }
-    }
-}
-
-static void listener_event_func(int _fd, unsigned ev, void* _l)
-{
-    alistener* listener = reinterpret_cast<alistener*>(_l);
-
-    if (ev & FDE_READ) {
-        unique_fd fd(adb_socket_accept(_fd, nullptr, nullptr));
-        if (fd < 0) {
-            return;
-        }
-
-        asocket* s = create_local_socket(std::move(fd));
-        if (s) {
-            s->transport = listener->transport;
-            connect_to_remote(s, listener->connect_to);
-            return;
-        }
-    }
-}
-
-// Called as a transport disconnect function. |arg| is the raw alistener*.
-static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_mutex) {
-    std::lock_guard<std::mutex> lock(listener_list_mutex);
-    for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) {
-        if (iter->get() == arg) {
-            (*iter)->transport = nullptr;
-            listener_list.erase(iter);
-            return;
-        }
-    }
-}
-
-// Write the list of current listeners (network redirections) into a string.
-std::string format_listeners() EXCLUDES(listener_list_mutex) {
-    std::lock_guard<std::mutex> lock(listener_list_mutex);
-    std::string result;
-    for (auto& l : listener_list) {
-        // Ignore special listeners like those for *smartsocket*
-        if (l->connect_to[0] == '*') {
-            continue;
-        }
-        //  <device-serial> " " <local-name> " " <remote-name> "\n"
-        // Entries from "adb reverse" have no serial.
-        android::base::StringAppendF(
-                &result, "%s %s %s\n",
-                !l->transport->serial.empty() ? l->transport->serial.c_str() : "(reverse)",
-                l->local_name.c_str(), l->connect_to.c_str());
-    }
-    return result;
-}
-
-InstallStatus remove_listener(const char* local_name, atransport* transport)
-    EXCLUDES(listener_list_mutex) {
-    std::lock_guard<std::mutex> lock(listener_list_mutex);
-    for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) {
-        if (local_name == (*iter)->local_name) {
-            listener_list.erase(iter);
-            return INSTALL_STATUS_OK;
-        }
-    }
-    return INSTALL_STATUS_LISTENER_NOT_FOUND;
-}
-
-void remove_all_listeners() EXCLUDES(listener_list_mutex) {
-    std::lock_guard<std::mutex> lock(listener_list_mutex);
-    auto iter = listener_list.begin();
-    while (iter != listener_list.end()) {
-        // Never remove smart sockets.
-        if ((*iter)->connect_to[0] == '*') {
-            ++iter;
-        } else {
-            iter = listener_list.erase(iter);
-        }
-    }
-}
-
-void close_smartsockets() EXCLUDES(listener_list_mutex) {
-    std::lock_guard<std::mutex> lock(listener_list_mutex);
-    auto pred = [](const std::unique_ptr<alistener>& listener) {
-        return listener->local_name == "*smartsocket*";
-    };
-    listener_list.remove_if(pred);
-}
-
-InstallStatus install_listener(const std::string& local_name, const char* connect_to,
-                               atransport* transport, int no_rebind, int* resolved_tcp_port,
-                               std::string* error) EXCLUDES(listener_list_mutex) {
-    std::lock_guard<std::mutex> lock(listener_list_mutex);
-    for (auto& l : listener_list) {
-        if (local_name == l->local_name) {
-            // Can't repurpose a smartsocket.
-            if(l->connect_to[0] == '*') {
-                *error = "cannot repurpose smartsocket";
-                return INSTALL_STATUS_INTERNAL_ERROR;
-            }
-
-            // Can't repurpose a listener if 'no_rebind' is true.
-            if (no_rebind) {
-                *error = "cannot rebind";
-                return INSTALL_STATUS_CANNOT_REBIND;
-            }
-
-            l->connect_to = connect_to;
-            if (l->transport != transport) {
-                l->transport->RemoveDisconnect(&l->disconnect);
-                l->transport = transport;
-                l->transport->AddDisconnect(&l->disconnect);
-            }
-            return INSTALL_STATUS_OK;
-        }
-    }
-
-    auto listener = std::make_unique<alistener>(local_name, connect_to);
-
-    int resolved = 0;
-    listener->fd = socket_spec_listen(listener->local_name, error, &resolved);
-    if (listener->fd < 0) {
-        return INSTALL_STATUS_CANNOT_BIND;
-    }
-
-    // If the caller requested port 0, update the listener name with the resolved port.
-    if (resolved != 0) {
-        listener->local_name = android::base::StringPrintf("tcp:%d", resolved);
-        if (resolved_tcp_port) {
-            *resolved_tcp_port = resolved;
-        }
-    }
-
-    close_on_exec(listener->fd);
-    if (listener->connect_to == "*smartsocket*") {
-        listener->fde = fdevent_create(listener->fd, ss_listener_event_func, listener.get());
-    } else {
-        listener->fde = fdevent_create(listener->fd, listener_event_func, listener.get());
-    }
-    fdevent_set(listener->fde, FDE_READ);
-
-    listener->transport = transport;
-
-    if (transport) {
-        listener->disconnect.opaque = listener.get();
-        listener->disconnect.func = listener_disconnect;
-        transport->AddDisconnect(&listener->disconnect);
-    }
-
-    listener_list.push_back(std::move(listener));
-    return INSTALL_STATUS_OK;
-}
diff --git a/adb/adb_listeners.h b/adb/adb_listeners.h
deleted file mode 100644
index 70a2ee1..0000000
--- a/adb/adb_listeners.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef __ADB_LISTENERS_H
-#define __ADB_LISTENERS_H
-
-#include "adb.h"
-
-#include <string>
-
-#include <android-base/macros.h>
-
-// error/status codes for install_listener.
-enum InstallStatus {
-  INSTALL_STATUS_OK = 0,
-  INSTALL_STATUS_INTERNAL_ERROR = -1,
-  INSTALL_STATUS_CANNOT_BIND = -2,
-  INSTALL_STATUS_CANNOT_REBIND = -3,
-  INSTALL_STATUS_LISTENER_NOT_FOUND = -4,
-};
-
-InstallStatus install_listener(const std::string& local_name, const char* connect_to,
-                               atransport* transport, int no_rebind, int* resolved_tcp_port,
-                               std::string* error);
-
-std::string format_listeners();
-
-InstallStatus remove_listener(const char* local_name, atransport* transport);
-void remove_all_listeners(void);
-
-void close_smartsockets();
-
-#endif /* __ADB_LISTENERS_H */
diff --git a/adb/adb_listeners_test.cpp b/adb/adb_listeners_test.cpp
deleted file mode 100644
index a7e2dea..0000000
--- a/adb/adb_listeners_test.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "adb_listeners.h"
-
-#include <gtest/gtest.h>
-
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include "fdevent/fdevent.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-// Returns true if the given listener is present in format_listeners(). Empty parameters will
-// be ignored.
-static bool listener_is_installed(const std::string& serial, const std::string& source,
-                                  const std::string& dest) {
-    // format_listeners() gives lines of "<serial> <source> <dest>\n".
-    for (const std::string& line : android::base::Split(format_listeners(), "\n")) {
-        std::vector<std::string> info = android::base::Split(line, " ");
-        if (info.size() == 3 &&
-                (serial.empty() || info[0] == serial) &&
-                (source.empty() || info[1] == source) &&
-                (dest.empty() || info[2] == dest)) {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-class AdbListenersTest : public ::testing::Test {
-  public:
-    void SetUp() override {
-        // We don't need an fdevent loop, but adding/removing listeners must be done from the
-        // fdevent thread if one exists. Since previously run tests may have created an fdevent
-        // thread, we need to reset to prevent the thread check.
-        fdevent_reset();
-    }
-
-    void TearDown() override {
-        // Clean up any listeners that may have been installed.
-        remove_all_listeners();
-
-        // Make sure we didn't leave any dangling events.
-        ASSERT_EQ(0u, fdevent_installed_count());
-    }
-
-  protected:
-    atransport transport_;
-};
-
-TEST_F(AdbListenersTest, test_install_listener) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_TRUE(listener_is_installed("", "tcp:9000", "tcp:9000"));
-}
-
-TEST_F(AdbListenersTest, test_install_listener_rebind) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9001", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_TRUE(listener_is_installed("", "tcp:9000", "tcp:9001"));
-}
-
-TEST_F(AdbListenersTest, test_install_listener_no_rebind) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, true, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_EQ(INSTALL_STATUS_CANNOT_REBIND,
-              install_listener("tcp:9000", "tcp:9001", &transport_, true, nullptr, &error));
-    ASSERT_FALSE(error.empty());
-
-    ASSERT_TRUE(listener_is_installed("", "tcp:9000", "tcp:9000"));
-}
-
-TEST_F(AdbListenersTest, test_install_listener_tcp_port_0) {
-    int port = 0;
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:0", "tcp:9000", &transport_, true, &port, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_TRUE(listener_is_installed("", android::base::StringPrintf("tcp:%d", port), "tcp:9000"));
-}
-
-TEST_F(AdbListenersTest, test_remove_listener) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_EQ(INSTALL_STATUS_OK, remove_listener("tcp:9000", &transport_));
-    ASSERT_TRUE(format_listeners().empty());
-}
-
-TEST_F(AdbListenersTest, test_remove_nonexistent_listener) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_EQ(INSTALL_STATUS_LISTENER_NOT_FOUND, remove_listener("tcp:1", &transport_));
-    ASSERT_TRUE(listener_is_installed("", "tcp:9000", "tcp:9000"));
-}
-
-TEST_F(AdbListenersTest, test_remove_all_listeners) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9001", "tcp:9001", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    remove_all_listeners();
-    ASSERT_TRUE(format_listeners().empty());
-}
-
-TEST_F(AdbListenersTest, test_transport_disconnect) {
-    std::string error;
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9000", "tcp:9000", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    ASSERT_EQ(INSTALL_STATUS_OK,
-              install_listener("tcp:9001", "tcp:9001", &transport_, false, nullptr, &error));
-    ASSERT_TRUE(error.empty());
-
-    transport_.RunDisconnects();
-    ASSERT_TRUE(format_listeners().empty());
-}
diff --git a/adb/adb_mdns.h b/adb/adb_mdns.h
deleted file mode 100644
index 3111248..0000000
--- a/adb/adb_mdns.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _ADB_MDNS_H_
-#define _ADB_MDNS_H_
-
-#include <android-base/macros.h>
-
-// The rules for Service Names [RFC6335] state that they may be no more
-// than fifteen characters long (not counting the mandatory underscore),
-// consisting of only letters, digits, and hyphens, must begin and end
-// with a letter or digit, must not contain consecutive hyphens, and
-// must contain at least one letter.
-#define ADB_MDNS_SERVICE_TYPE "adb"
-#define ADB_MDNS_TLS_PAIRING_TYPE "adb-tls-pairing"
-#define ADB_MDNS_TLS_CONNECT_TYPE "adb-tls-connect"
-
-const int kADBTransportServiceRefIndex = 0;
-const int kADBSecurePairingServiceRefIndex = 1;
-const int kADBSecureConnectServiceRefIndex = 2;
-
-// Each ADB Secure service advertises with a TXT record indicating the version
-// using a key/value pair per RFC 6763 (https://tools.ietf.org/html/rfc6763).
-//
-// The first key/value pair is always the version of the protocol.
-// There may be more key/value pairs added after.
-//
-// The version is purposely represented as the single letter "v" due to the
-// need to minimize DNS traffic. The version starts at 1.  With each breaking
-// protocol change, the version is incremented by 1.
-//
-// Newer adb clients/daemons need to recognize and either reject
-// or be backward-compatible with older verseions if there is a mismatch.
-//
-// Relevant sections:
-//
-// """
-// 6.4.  Rules for Keys in DNS-SD Key/Value Pairs
-//
-// The key MUST be at least one character.  DNS-SD TXT record strings
-// beginning with an '=' character (i.e., the key is missing) MUST be
-// silently ignored.
-//
-// ...
-//
-// 6.5.  Rules for Values in DNS-SD Key/Value Pairs
-//
-// If there is an '=' in a DNS-SD TXT record string, then everything
-// after the first '=' to the end of the string is the value.  The value
-// can contain any eight-bit values including '='.
-// """
-
-#define ADB_SECURE_SERVICE_VERSION_TXT_RECORD(ver) ("v=" #ver)
-
-// Client/service versions are initially defined to be matching,
-// but may go out of sync as different clients and services
-// try to talk to each other.
-#define ADB_SECURE_SERVICE_VERSION 1
-#define ADB_SECURE_CLIENT_VERSION ADB_SECURE_SERVICE_VERSION
-
-const char* kADBSecurePairingServiceTxtRecord =
-        ADB_SECURE_SERVICE_VERSION_TXT_RECORD(ADB_SECURE_SERVICE_VERSION);
-const char* kADBSecureConnectServiceTxtRecord =
-        ADB_SECURE_SERVICE_VERSION_TXT_RECORD(ADB_SECURE_SERVICE_VERSION);
-
-#define ADB_FULL_MDNS_SERVICE_TYPE(atype) ("_" atype "._tcp")
-const char* kADBDNSServices[] = {ADB_FULL_MDNS_SERVICE_TYPE(ADB_MDNS_SERVICE_TYPE),
-                                 ADB_FULL_MDNS_SERVICE_TYPE(ADB_MDNS_TLS_PAIRING_TYPE),
-                                 ADB_FULL_MDNS_SERVICE_TYPE(ADB_MDNS_TLS_CONNECT_TYPE)};
-
-const char* kADBDNSServiceTxtRecords[] = {
-        nullptr,
-        kADBSecurePairingServiceTxtRecord,
-        kADBSecureConnectServiceTxtRecord,
-};
-
-const int kNumADBDNSServices = arraysize(kADBDNSServices);
-
-#endif
diff --git a/adb/adb_test.xml b/adb/adb_test.xml
deleted file mode 100644
index cc3302d..0000000
--- a/adb/adb_test.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-<!-- This test config file is auto-generated. -->
-<configuration description="Runs adbd_test.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-native" />
-
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
-    </target_preparer>
-
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-        <option name="cleanup" value="true" />
-        <option name="push" value="adbd_test->/data/local/tmp/adbd_test" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="adbd_test" />
-    </test>
-
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-      <option name="mainline-module-package-name" value="com.google.android.adbd" />
-    </object>
-</configuration>
diff --git a/adb/adb_trace.cpp b/adb/adb_trace.cpp
deleted file mode 100644
index cea24fe..0000000
--- a/adb/adb_trace.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "sysdeps.h"
-#include "adb_trace.h"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-
-#include "adb.h"
-
-#if !ADB_HOST
-#include <android-base/properties.h>
-#endif
-
-#if !ADB_HOST
-const char* adb_device_banner = "device";
-#if defined(__ANDROID__)
-static android::base::LogdLogger gLogdLogger;
-#endif
-#else
-const char* adb_device_banner = "host";
-#endif
-
-void AdbLogger(android::base::LogId id, android::base::LogSeverity severity,
-               const char* tag, const char* file, unsigned int line,
-               const char* message) {
-    android::base::StderrLogger(id, severity, tag, file, line, message);
-#if defined(_WIN32)
-    // stderr can be buffered on Windows (and setvbuf doesn't seem to work), so explicitly flush.
-    fflush(stderr);
-#endif
-
-#if !ADB_HOST && defined(__ANDROID__)
-    // Only print logs of INFO or higher to logcat, so that `adb logcat` with adbd tracing on
-    // doesn't result in exponential logging.
-    if (severity >= android::base::INFO) {
-        gLogdLogger(id, severity, tag, file, line, message);
-    }
-#endif
-}
-
-
-#if !ADB_HOST
-static std::string get_log_file_name() {
-    struct tm now;
-    time_t t;
-    tzset();
-    time(&t);
-    localtime_r(&t, &now);
-
-    char timestamp[PATH_MAX];
-    strftime(timestamp, sizeof(timestamp), "%Y-%m-%d-%H-%M-%S", &now);
-
-    return android::base::StringPrintf("/data/adb/adb-%s-%d", timestamp,
-                                       getpid());
-}
-
-void start_device_log(void) {
-    int fd = unix_open(get_log_file_name(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640);
-    if (fd == -1) {
-        return;
-    }
-
-    // Redirect stdout and stderr to the log file.
-    dup2(fd, STDOUT_FILENO);
-    dup2(fd, STDERR_FILENO);
-    fprintf(stderr, "--- adb starting (pid %d) ---\n", getpid());
-    unix_close(fd);
-}
-#endif
-
-int adb_trace_mask;
-
-std::string get_trace_setting_from_env() {
-    const char* setting = getenv("ADB_TRACE");
-    if (setting == nullptr) {
-        setting = "";
-    }
-
-    return std::string(setting);
-}
-
-std::string get_trace_setting() {
-#if ADB_HOST
-    return get_trace_setting_from_env();
-#else
-    return android::base::GetProperty("persist.adb.trace_mask", "");
-#endif
-}
-
-// Split the space separated list of tags from the trace setting and build the
-// trace mask from it. note that '1' and 'all' are special cases to enable all
-// tracing.
-//
-// adb's trace setting comes from the ADB_TRACE environment variable, whereas
-// adbd's comes from the system property persist.adb.trace_mask.
-static void setup_trace_mask() {
-    const std::string trace_setting = get_trace_setting();
-    if (trace_setting.empty()) {
-        return;
-    }
-
-    std::unordered_map<std::string, int> trace_flags = {{"1", -1},
-                                                        {"all", -1},
-                                                        {"adb", ADB},
-                                                        {"sockets", SOCKETS},
-                                                        {"packets", PACKETS},
-                                                        {"rwx", RWX},
-                                                        {"usb", USB},
-                                                        {"sync", SYNC},
-                                                        {"sysdeps", SYSDEPS},
-                                                        {"transport", TRANSPORT},
-                                                        {"jdwp", JDWP},
-                                                        {"services", SERVICES},
-                                                        {"auth", AUTH},
-                                                        {"fdevent", FDEVENT},
-                                                        {"shell", SHELL},
-                                                        {"incremental", INCREMENTAL}};
-
-    std::vector<std::string> elements = android::base::Split(trace_setting, " ");
-    for (const auto& elem : elements) {
-        const auto& flag = trace_flags.find(elem);
-        if (flag == trace_flags.end()) {
-            LOG(ERROR) << "Unknown trace flag: " << elem;
-            continue;
-        }
-
-        if (flag->second == -1) {
-            // -1 is used for the special values "1" and "all" that enable all
-            // tracing.
-            adb_trace_mask = ~0;
-            break;
-        } else {
-            adb_trace_mask |= 1 << flag->second;
-        }
-    }
-
-    if (adb_trace_mask != 0) {
-        android::base::SetMinimumLogSeverity(android::base::VERBOSE);
-    }
-}
-
-void adb_trace_init(char** argv) {
-#if !ADB_HOST
-    // Don't open log file if no tracing, since this will block
-    // the crypto unmount of /data
-    if (!get_trace_setting().empty()) {
-        if (unix_isatty(STDOUT_FILENO) == 0) {
-            start_device_log();
-        }
-    }
-#endif
-
-#if ADB_HOST && !defined(_WIN32)
-    // adb historically ignored $ANDROID_LOG_TAGS but passed it through to logcat.
-    // If set, move it out of the way so that libbase logging doesn't try to parse it.
-    std::string log_tags;
-    char* ANDROID_LOG_TAGS = getenv("ANDROID_LOG_TAGS");
-    if (ANDROID_LOG_TAGS) {
-        log_tags = ANDROID_LOG_TAGS;
-        unsetenv("ANDROID_LOG_TAGS");
-    }
-#endif
-
-    android::base::InitLogging(argv, &AdbLogger);
-
-#if ADB_HOST && !defined(_WIN32)
-    // Put $ANDROID_LOG_TAGS back so we can pass it to logcat.
-    if (!log_tags.empty()) setenv("ANDROID_LOG_TAGS", log_tags.c_str(), 1);
-#endif
-
-    setup_trace_mask();
-
-    VLOG(ADB) << adb_version();
-}
-
-void adb_trace_enable(AdbTrace trace_tag) {
-    adb_trace_mask |= (1 << trace_tag);
-}
diff --git a/adb/adb_trace.h b/adb/adb_trace.h
deleted file mode 100644
index 3421a02..0000000
--- a/adb/adb_trace.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef __ADB_TRACE_H
-#define __ADB_TRACE_H
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-
-/* IMPORTANT: if you change the following list, don't
- * forget to update the corresponding 'tags' table in
- * the adb_trace_init() function implemented in adb_trace.cpp.
- */
-enum AdbTrace {
-    ADB = 0, /* 0x001 */
-    SOCKETS,
-    PACKETS,
-    TRANSPORT,
-    RWX, /* 0x010 */
-    USB,
-    SYNC,
-    SYSDEPS,
-    JDWP, /* 0x100 */
-    SERVICES,
-    AUTH,
-    FDEVENT,
-    SHELL,
-    INCREMENTAL,
-};
-
-#define VLOG_IS_ON(TAG) \
-    ((adb_trace_mask & (1 << (TAG))) != 0)
-
-#define VLOG(TAG)                 \
-    if (LIKELY(!VLOG_IS_ON(TAG))) \
-        ;                         \
-    else                          \
-        LOG(DEBUG)
-
-// You must define TRACE_TAG before using this macro.
-#define D(...) \
-    VLOG(TRACE_TAG) << android::base::StringPrintf(__VA_ARGS__)
-
-
-extern int adb_trace_mask;
-void adb_trace_init(char**);
-void adb_trace_enable(AdbTrace trace_tag);
-
-#endif /* __ADB_TRACE_H */
diff --git a/adb/adb_unique_fd.cpp b/adb/adb_unique_fd.cpp
deleted file mode 100644
index dec73bc..0000000
--- a/adb/adb_unique_fd.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "adb_unique_fd.h"
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "sysdeps.h"
-
-#if defined(_WIN32)
-void AdbCloser::Close(int fd) {
-    adb_close(fd);
-}
-#endif
diff --git a/adb/adb_unique_fd.h b/adb/adb_unique_fd.h
deleted file mode 100644
index b6c910a..0000000
--- a/adb/adb_unique_fd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <android-base/unique_fd.h>
-
-#if defined(_WIN32)
-// Helper to automatically close an FD when it goes out of scope.
-struct AdbCloser {
-    static void Close(int fd);
-};
-
-using unique_fd = android::base::unique_fd_impl<AdbCloser>;
-#else
-using unique_fd = android::base::unique_fd;
-#endif
-
-using android::base::borrowed_fd;
-
-template <typename T>
-int adb_close(const android::base::unique_fd_impl<T>&)
-        __attribute__((__unavailable__("adb_close called on unique_fd")));
diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp
deleted file mode 100644
index d1910f1..0000000
--- a/adb/adb_utils.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "adb_utils.h"
-#include "adb_unique_fd.h"
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/parseint.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include "adb.h"
-#include "adb_trace.h"
-#include "sysdeps.h"
-
-#ifdef _WIN32
-#  ifndef WIN32_LEAN_AND_MEAN
-#    define WIN32_LEAN_AND_MEAN
-#  endif
-#  include "windows.h"
-#  include "shlobj.h"
-#else
-#include <pwd.h>
-#endif
-
-
-#if defined(_WIN32)
-static constexpr char kNullFileName[] = "NUL";
-#else
-static constexpr char kNullFileName[] = "/dev/null";
-#endif
-
-void close_stdin() {
-    int fd = unix_open(kNullFileName, O_RDONLY);
-    if (fd == -1) {
-        PLOG(FATAL) << "failed to open " << kNullFileName;
-    }
-
-    if (TEMP_FAILURE_RETRY(dup2(fd, STDIN_FILENO)) == -1) {
-        PLOG(FATAL) << "failed to redirect stdin to " << kNullFileName;
-    }
-    unix_close(fd);
-}
-
-bool getcwd(std::string* s) {
-  char* cwd = getcwd(nullptr, 0);
-  if (cwd != nullptr) *s = cwd;
-  free(cwd);
-  return (cwd != nullptr);
-}
-
-bool directory_exists(const std::string& path) {
-  struct stat sb;
-  return stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode);
-}
-
-std::string escape_arg(const std::string& s) {
-  // Escape any ' in the string (before we single-quote the whole thing).
-  // The correct way to do this for the shell is to replace ' with '\'' --- that is,
-  // close the existing single-quoted string, escape a single single-quote, and start
-  // a new single-quoted string. Like the C preprocessor, the shell will concatenate
-  // these pieces into one string.
-
-  std::string result;
-  result.push_back('\'');
-
-  size_t base = 0;
-  while (true) {
-    size_t found = s.find('\'', base);
-    result.append(s, base, found - base);
-    if (found == s.npos) break;
-    result.append("'\\''");
-    base = found + 1;
-  }
-
-  result.push_back('\'');
-  return result;
-}
-
-// Given a relative or absolute filepath, create the directory hierarchy
-// as needed. Returns true if the hierarchy is/was setup.
-bool mkdirs(const std::string& path) {
-  // TODO: all the callers do unlink && mkdirs && adb_creat ---
-  // that's probably the operation we should expose.
-
-  // Implementation Notes:
-  //
-  // Pros:
-  // - Uses dirname, so does not need to deal with OS_PATH_SEPARATOR.
-  // - On Windows, uses mingw dirname which accepts '/' and '\\', drive letters
-  //   (C:\foo), UNC paths (\\server\share\dir\dir\file), and Unicode (when
-  //   combined with our adb_mkdir() which takes UTF-8).
-  // - Is optimistic wrt thinking that a deep directory hierarchy will exist.
-  //   So it does as few stat()s as possible before doing mkdir()s.
-  // Cons:
-  // - Recursive, so it uses stack space relative to number of directory
-  //   components.
-
-  // If path points to a symlink to a directory, that's fine.
-  struct stat sb;
-  if (stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode)) {
-    return true;
-  }
-
-  const std::string parent(android::base::Dirname(path));
-
-  // If dirname returned the same path as what we passed in, don't go recursive.
-  // This can happen on Windows when walking up the directory hierarchy and not
-  // finding anything that already exists (unlike POSIX that will eventually
-  // find . or /).
-  if (parent == path) {
-    errno = ENOENT;
-    return false;
-  }
-
-  // Recursively make parent directories of 'path'.
-  if (!mkdirs(parent)) {
-    return false;
-  }
-
-  // Now that the parent directory hierarchy of 'path' has been ensured,
-  // create path itself.
-  if (adb_mkdir(path, 0775) == -1) {
-    const int saved_errno = errno;
-    // If someone else created the directory, that is ok.
-    if (directory_exists(path)) {
-      return true;
-    }
-    // There might be a pre-existing file at 'path', or there might have been some other error.
-    errno = saved_errno;
-    return false;
-  }
-
-  return true;
-}
-
-std::string dump_hex(const void* data, size_t byte_count) {
-    size_t truncate_len = 16;
-    bool truncated = false;
-    if (byte_count > truncate_len) {
-        byte_count = truncate_len;
-        truncated = true;
-    }
-
-    const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
-
-    std::string line;
-    for (size_t i = 0; i < byte_count; ++i) {
-        android::base::StringAppendF(&line, "%02x", p[i]);
-    }
-    line.push_back(' ');
-
-    for (size_t i = 0; i < byte_count; ++i) {
-        int ch = p[i];
-        line.push_back(isprint(ch) ? ch : '.');
-    }
-
-    if (truncated) {
-        line += " [truncated]";
-    }
-
-    return line;
-}
-
-std::string dump_header(const amessage* msg) {
-    unsigned command = msg->command;
-    int len = msg->data_length;
-    char cmd[9];
-    char arg0[12], arg1[12];
-    int n;
-
-    for (n = 0; n < 4; n++) {
-        int b = (command >> (n * 8)) & 255;
-        if (b < 32 || b >= 127) break;
-        cmd[n] = (char)b;
-    }
-    if (n == 4) {
-        cmd[4] = 0;
-    } else {
-        // There is some non-ASCII name in the command, so dump the hexadecimal value instead
-        snprintf(cmd, sizeof cmd, "%08x", command);
-    }
-
-    if (msg->arg0 < 256U)
-        snprintf(arg0, sizeof arg0, "%d", msg->arg0);
-    else
-        snprintf(arg0, sizeof arg0, "0x%x", msg->arg0);
-
-    if (msg->arg1 < 256U)
-        snprintf(arg1, sizeof arg1, "%d", msg->arg1);
-    else
-        snprintf(arg1, sizeof arg1, "0x%x", msg->arg1);
-
-    return android::base::StringPrintf("[%s] arg0=%s arg1=%s (len=%d) ", cmd, arg0, arg1, len);
-}
-
-std::string dump_packet(const char* name, const char* func, const apacket* p) {
-    std::string result = name;
-    result += ": ";
-    result += func;
-    result += ": ";
-    result += dump_header(&p->msg);
-    result += dump_hex(p->payload.data(), p->payload.size());
-    return result;
-}
-
-std::string perror_str(const char* msg) {
-    return android::base::StringPrintf("%s: %s", msg, strerror(errno));
-}
-
-#if !defined(_WIN32)
-// Windows version provided in sysdeps_win32.cpp
-bool set_file_block_mode(borrowed_fd fd, bool block) {
-    int flags = fcntl(fd.get(), F_GETFL, 0);
-    if (flags == -1) {
-        PLOG(ERROR) << "failed to fcntl(F_GETFL) for fd " << fd.get();
-        return false;
-    }
-    flags = block ? (flags & ~O_NONBLOCK) : (flags | O_NONBLOCK);
-    if (fcntl(fd.get(), F_SETFL, flags) != 0) {
-        PLOG(ERROR) << "failed to fcntl(F_SETFL) for fd " << fd.get() << ", flags " << flags;
-        return false;
-    }
-    return true;
-}
-#endif
-
-bool forward_targets_are_valid(const std::string& source, const std::string& dest,
-                               std::string* error) {
-    if (android::base::StartsWith(source, "tcp:")) {
-        // The source port may be 0 to allow the system to select an open port.
-        int port;
-        if (!android::base::ParseInt(&source[4], &port) || port < 0) {
-            *error = android::base::StringPrintf("Invalid source port: '%s'", &source[4]);
-            return false;
-        }
-    }
-
-    if (android::base::StartsWith(dest, "tcp:")) {
-        // The destination port must be > 0.
-        int port;
-        if (!android::base::ParseInt(&dest[4], &port) || port <= 0) {
-            *error = android::base::StringPrintf("Invalid destination port: '%s'", &dest[4]);
-            return false;
-        }
-    }
-
-    return true;
-}
-
-std::string adb_get_homedir_path() {
-#ifdef _WIN32
-    WCHAR path[MAX_PATH];
-    const HRESULT hr = SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path);
-    if (FAILED(hr)) {
-        D("SHGetFolderPathW failed: %s", android::base::SystemErrorCodeToString(hr).c_str());
-        return {};
-    }
-    std::string home_str;
-    if (!android::base::WideToUTF8(path, &home_str)) {
-        return {};
-    }
-    return home_str;
-#else
-    if (const char* const home = getenv("HOME")) {
-        return home;
-    }
-
-    struct passwd pwent;
-    struct passwd* result;
-    int pwent_max = sysconf(_SC_GETPW_R_SIZE_MAX);
-    if (pwent_max == -1) {
-        pwent_max = 16384;
-    }
-    std::vector<char> buf(pwent_max);
-    int rc = getpwuid_r(getuid(), &pwent, buf.data(), buf.size(), &result);
-    if (rc == 0 && result) {
-        return result->pw_dir;
-    }
-
-    LOG(FATAL) << "failed to get user home directory";
-    return {};
-#endif
-}
-
-std::string adb_get_android_dir_path() {
-    std::string user_dir = adb_get_homedir_path();
-    std::string android_dir = user_dir + OS_PATH_SEPARATOR + ".android";
-    struct stat buf;
-    if (stat(android_dir.c_str(), &buf) == -1) {
-        if (adb_mkdir(android_dir, 0750) == -1) {
-            PLOG(FATAL) << "Cannot mkdir '" << android_dir << "'";
-        }
-    }
-    return android_dir;
-}
-
-std::string GetLogFilePath() {
-    // https://issuetracker.google.com/112588493
-    const char* path = getenv("ANDROID_ADB_LOG_PATH");
-    if (path) return path;
-
-#if defined(_WIN32)
-    const char log_name[] = "adb.log";
-    WCHAR temp_path[MAX_PATH];
-
-    // https://msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx
-    DWORD nchars = GetTempPathW(arraysize(temp_path), temp_path);
-    if (nchars >= arraysize(temp_path) || nchars == 0) {
-        // If string truncation or some other error.
-        LOG(FATAL) << "cannot retrieve temporary file path: "
-                   << android::base::SystemErrorCodeToString(GetLastError());
-    }
-
-    std::string temp_path_utf8;
-    if (!android::base::WideToUTF8(temp_path, &temp_path_utf8)) {
-        PLOG(FATAL) << "cannot convert temporary file path from UTF-16 to UTF-8";
-    }
-
-    return temp_path_utf8 + log_name;
-#else
-    const char* tmp_dir = getenv("TMPDIR");
-    if (tmp_dir == nullptr) tmp_dir = "/tmp";
-    return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid());
-#endif
-}
-
-[[noreturn]] static void error_exit_va(int error, const char* fmt, va_list va) {
-    fflush(stdout);
-    fprintf(stderr, "%s: ", android::base::Basename(android::base::GetExecutablePath()).c_str());
-
-    vfprintf(stderr, fmt, va);
-
-    if (error != 0) {
-        fprintf(stderr, ": %s", strerror(error));
-    }
-
-    putc('\n', stderr);
-    fflush(stderr);
-
-    exit(EXIT_FAILURE);
-}
-
-void error_exit(const char* fmt, ...) {
-    va_list va;
-    va_start(va, fmt);
-    error_exit_va(0, fmt, va);
-    va_end(va);
-}
-
-void perror_exit(const char* fmt, ...) {
-    va_list va;
-    va_start(va, fmt);
-    error_exit_va(errno, fmt, va);
-    va_end(va);
-}
diff --git a/adb/adb_utils.h b/adb/adb_utils.h
deleted file mode 100644
index 66cba12..0000000
--- a/adb/adb_utils.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <charconv>
-#include <condition_variable>
-#include <mutex>
-#include <string>
-#include <string_view>
-#include <type_traits>
-#include <vector>
-
-#include <android-base/macros.h>
-
-#include "adb.h"
-#include "adb_unique_fd.h"
-
-void close_stdin();
-
-bool getcwd(std::string* cwd);
-bool directory_exists(const std::string& path);
-
-// Return the user's home directory.
-std::string adb_get_homedir_path();
-
-// Return the adb user directory.
-std::string adb_get_android_dir_path();
-
-bool mkdirs(const std::string& path);
-
-std::string escape_arg(const std::string& s);
-
-std::string dump_hex(const void* ptr, size_t byte_count);
-std::string dump_header(const amessage* msg);
-std::string dump_packet(const char* name, const char* func, const apacket* p);
-
-std::string perror_str(const char* msg);
-
-[[noreturn]] void error_exit(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
-[[noreturn]] void perror_exit(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
-
-bool set_file_block_mode(borrowed_fd fd, bool block);
-
-// Given forward/reverse targets, returns true if they look sane. If an error is found, fills
-// |error| and returns false.
-// Currently this only checks "tcp:" targets. Additional checking could be added for other targets
-// if needed.
-bool forward_targets_are_valid(const std::string& source, const std::string& dest,
-                               std::string* error);
-
-// A thread-safe blocking queue.
-template <typename T>
-class BlockingQueue {
-    std::mutex mutex;
-    std::condition_variable cv;
-    std::vector<T> queue;
-
-  public:
-    void Push(const T& t) {
-        {
-            std::unique_lock<std::mutex> lock(mutex);
-            queue.push_back(t);
-        }
-        cv.notify_one();
-    }
-
-    template <typename Fn>
-    void PopAll(Fn fn) {
-        std::vector<T> popped;
-
-        {
-            std::unique_lock<std::mutex> lock(mutex);
-            cv.wait(lock, [this]() { return !queue.empty(); });
-            popped = std::move(queue);
-            queue.clear();
-        }
-
-        for (const T& t : popped) {
-            fn(t);
-        }
-    }
-};
-
-std::string GetLogFilePath();
-
-inline std::string_view StripTrailingNulls(std::string_view str) {
-    size_t n = 0;
-    for (auto it = str.rbegin(); it != str.rend(); ++it) {
-        if (*it != '\0') {
-            break;
-        }
-        ++n;
-    }
-
-    str.remove_suffix(n);
-    return str;
-}
-
-// Base-10 stroll on a string_view.
-template <typename T>
-inline bool ParseUint(T* result, std::string_view str, std::string_view* remaining = nullptr) {
-    T value;
-    const auto res = std::from_chars(str.begin(), str.end(), value);
-    if (res.ec != std::errc{}) {
-        return false;
-    }
-    if (res.ptr != str.end() && !remaining) {
-        return false;
-    }
-    if (remaining) {
-        *remaining = std::string_view(res.ptr, str.end() - res.ptr);
-    }
-    *result = value;
-    return true;
-}
diff --git a/adb/adb_utils_test.cpp b/adb/adb_utils_test.cpp
deleted file mode 100644
index cdca3aa..0000000
--- a/adb/adb_utils_test.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "adb_utils.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#include <userenv.h>
-#endif
-
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "sysdeps.h"
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-
-#ifdef _WIN32
-static std::string subdir(const char* parent, const char* child) {
-  std::string str(parent);
-  str += OS_PATH_SEPARATOR;
-  str += child;
-  return str;
-}
-#endif
-
-TEST(adb_utils, directory_exists) {
-#ifdef _WIN32
-  char profiles_dir[MAX_PATH];
-  DWORD cch = arraysize(profiles_dir);
-
-  // On typical Windows 7, returns C:\Users
-  ASSERT_TRUE(GetProfilesDirectoryA(profiles_dir, &cch));
-
-  ASSERT_TRUE(directory_exists(profiles_dir));
-
-  ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist")));
-#else
-  ASSERT_TRUE(directory_exists("/proc"));
-  ASSERT_FALSE(directory_exists("/proc/does-not-exist"));
-#endif
-}
-
-#if defined(_WIN32)
-TEST(adb_utils, directory_exists_win32_symlink_junction) {
-  char profiles_dir[MAX_PATH];
-  DWORD cch = arraysize(profiles_dir);
-
-  // On typical Windows 7, returns C:\Users
-  ASSERT_TRUE(GetProfilesDirectoryA(profiles_dir, &cch));
-
-  // On modern (English?) Windows, this is a directory symbolic link to
-  // C:\ProgramData. Symbolic links are rare on Windows and the user requires
-  // a special permission (by default granted to Administrative users) to
-  // create symbolic links.
-  EXPECT_FALSE(directory_exists(subdir(profiles_dir, "All Users")));
-
-  // On modern (English?) Windows, this is a directory junction to
-  // C:\Users\Default. Junctions are used throughout user profile directories
-  // for backwards compatibility and they don't require any special permissions
-  // to create.
-  EXPECT_FALSE(directory_exists(subdir(profiles_dir, "Default User")));
-}
-#endif
-
-TEST(adb_utils, escape_arg) {
-  EXPECT_EQ(R"('')", escape_arg(""));
-
-  EXPECT_EQ(R"('abc')", escape_arg("abc"));
-
-  auto wrap = [](const std::string& x) { return '\'' + x + '\''; };
-  const std::string q = R"('\'')";
-  EXPECT_EQ(wrap(q), escape_arg("'"));
-  EXPECT_EQ(wrap(q + q), escape_arg("''"));
-  EXPECT_EQ(wrap(q + "abc" + q), escape_arg("'abc'"));
-  EXPECT_EQ(wrap(q + "abc"), escape_arg("'abc"));
-  EXPECT_EQ(wrap("abc" + q), escape_arg("abc'"));
-  EXPECT_EQ(wrap("abc" + q + "def"), escape_arg("abc'def"));
-  EXPECT_EQ(wrap("a" + q + "b" + q + "c"), escape_arg("a'b'c"));
-  EXPECT_EQ(wrap("a" + q + "bcde" + q + "f"), escape_arg("a'bcde'f"));
-
-  EXPECT_EQ(R"(' abc')", escape_arg(" abc"));
-  EXPECT_EQ(R"('"abc')", escape_arg("\"abc"));
-  EXPECT_EQ(R"('\abc')", escape_arg("\\abc"));
-  EXPECT_EQ(R"('(abc')", escape_arg("(abc"));
-  EXPECT_EQ(R"(')abc')", escape_arg(")abc"));
-
-  EXPECT_EQ(R"('abc abc')", escape_arg("abc abc"));
-  EXPECT_EQ(R"('abc"abc')", escape_arg("abc\"abc"));
-  EXPECT_EQ(R"('abc\abc')", escape_arg("abc\\abc"));
-  EXPECT_EQ(R"('abc(abc')", escape_arg("abc(abc"));
-  EXPECT_EQ(R"('abc)abc')", escape_arg("abc)abc"));
-
-  EXPECT_EQ(R"('abc ')", escape_arg("abc "));
-  EXPECT_EQ(R"('abc"')", escape_arg("abc\""));
-  EXPECT_EQ(R"('abc\')", escape_arg("abc\\"));
-  EXPECT_EQ(R"('abc(')", escape_arg("abc("));
-  EXPECT_EQ(R"('abc)')", escape_arg("abc)"));
-}
-
-void test_mkdirs(const std::string& basepath) {
-  // Test creating a directory hierarchy.
-  ASSERT_TRUE(mkdirs(basepath));
-  // Test finding an existing directory hierarchy.
-  ASSERT_TRUE(mkdirs(basepath));
-  // Test mkdirs on an existing hierarchy with a trailing slash.
-  ASSERT_TRUE(mkdirs(basepath + '/'));
-#if defined(_WIN32)
-  ASSERT_TRUE(mkdirs(basepath + '\\'));
-#endif
-
-  const std::string filepath = basepath + "/file";
-  // Verify that the hierarchy was created by trying to create a file in it.
-  ASSERT_NE(-1, adb_creat(filepath.c_str(), 0600));
-  // If a file exists where we want a directory, the operation should fail.
-  ASSERT_FALSE(mkdirs(filepath));
-}
-
-TEST(adb_utils, mkdirs) {
-  TemporaryDir td;
-
-  // Absolute paths.
-  test_mkdirs(std::string(td.path) + "/dir/subdir");
-
-  // Relative paths.
-  ASSERT_EQ(0, chdir(td.path)) << strerror(errno);
-  test_mkdirs(std::string("relative/subrel"));
-}
-
-#if !defined(_WIN32)
-TEST(adb_utils, set_file_block_mode) {
-    unique_fd fd(adb_open("/dev/null", O_RDWR | O_APPEND));
-    ASSERT_GE(fd, 0);
-    int flags = fcntl(fd.get(), F_GETFL, 0);
-    ASSERT_EQ(O_RDWR | O_APPEND, (flags & (O_RDWR | O_APPEND)));
-    ASSERT_TRUE(set_file_block_mode(fd, false));
-    int new_flags = fcntl(fd.get(), F_GETFL, 0);
-    ASSERT_EQ(flags | O_NONBLOCK, new_flags);
-    ASSERT_TRUE(set_file_block_mode(fd, true));
-    new_flags = fcntl(fd.get(), F_GETFL, 0);
-    ASSERT_EQ(flags, new_flags);
-}
-#endif
-
-TEST(adb_utils, test_forward_targets_are_valid) {
-    std::string error;
-
-    // Source port can be >= 0.
-    EXPECT_FALSE(forward_targets_are_valid("tcp:-1", "tcp:9000", &error));
-    EXPECT_TRUE(forward_targets_are_valid("tcp:0", "tcp:9000", &error));
-    EXPECT_TRUE(forward_targets_are_valid("tcp:8000", "tcp:9000", &error));
-
-    // Destination port must be >0.
-    EXPECT_FALSE(forward_targets_are_valid("tcp:8000", "tcp:-1", &error));
-    EXPECT_FALSE(forward_targets_are_valid("tcp:8000", "tcp:0", &error));
-
-    // Port must be a number.
-    EXPECT_FALSE(forward_targets_are_valid("tcp:", "tcp:9000", &error));
-    EXPECT_FALSE(forward_targets_are_valid("tcp:a", "tcp:9000", &error));
-    EXPECT_FALSE(forward_targets_are_valid("tcp:22x", "tcp:9000", &error));
-    EXPECT_FALSE(forward_targets_are_valid("tcp:8000", "tcp:", &error));
-    EXPECT_FALSE(forward_targets_are_valid("tcp:8000", "tcp:a", &error));
-    EXPECT_FALSE(forward_targets_are_valid("tcp:8000", "tcp:22x", &error));
-}
-
-void TestParseUint(std::string_view string, bool expected_success, uint32_t expected_value = 0) {
-    // Standalone.
-    {
-        uint32_t value;
-        std::string_view remaining;
-        bool success = ParseUint(&value, string, &remaining);
-        EXPECT_EQ(success, expected_success);
-        if (expected_success) {
-            EXPECT_EQ(value, expected_value);
-        }
-        EXPECT_TRUE(remaining.empty());
-    }
-
-    // With trailing text.
-    {
-        std::string text = std::string(string) + "foo";
-        uint32_t value;
-        std::string_view remaining;
-        bool success = ParseUint(&value, text, &remaining);
-        EXPECT_EQ(success, expected_success);
-        if (expected_success) {
-            EXPECT_EQ(value, expected_value);
-            EXPECT_EQ(remaining, "foo");
-        }
-    }
-
-    // With trailing text, without remaining.
-    {
-        std::string text = std::string(string) + "foo";
-        uint32_t value;
-        bool success = ParseUint(&value, text, nullptr);
-        EXPECT_EQ(success, false);
-    }
-}
-
-TEST(adb_utils, ParseUint) {
-    TestParseUint("", false);
-    TestParseUint("foo", false);
-    TestParseUint("foo123", false);
-    TestParseUint("-1", false);
-
-    TestParseUint("123", true, 123);
-    TestParseUint("9999999999999999999999999", false);
-    TestParseUint(std::to_string(UINT32_MAX), true, UINT32_MAX);
-    TestParseUint("0" + std::to_string(UINT32_MAX), true, UINT32_MAX);
-    TestParseUint(std::to_string(static_cast<uint64_t>(UINT32_MAX) + 1), false);
-    TestParseUint("0" + std::to_string(static_cast<uint64_t>(UINT32_MAX) + 1), false);
-
-    std::string x = std::to_string(UINT32_MAX) + "123";
-    std::string_view substr = std::string_view(x).substr(0, std::to_string(UINT32_MAX).size());
-    TestParseUint(substr, true, UINT32_MAX);
-}
diff --git a/adb/adb_wifi.h b/adb/adb_wifi.h
deleted file mode 100644
index 585748c..0000000
--- a/adb/adb_wifi.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <string>
-
-#include "adb.h"
-
-#if ADB_HOST
-
-void adb_wifi_init(void);
-void adb_wifi_pair_device(const std::string& host, const std::string& password,
-                          std::string& response);
-bool adb_wifi_is_known_host(const std::string& host);
-
-#else  // !ADB_HOST
-
-struct AdbdAuthContext;
-
-void adbd_wifi_init(AdbdAuthContext* ctx);
-void adbd_wifi_secure_connect(atransport* t);
-
-#endif
diff --git a/adb/apex/Android.bp b/adb/apex/Android.bp
deleted file mode 100644
index ddb17da..0000000
--- a/adb/apex/Android.bp
+++ /dev/null
@@ -1,55 +0,0 @@
-apex_defaults {
-    name: "com.android.adbd-defaults",
-    updatable: true,
-    min_sdk_version: "R",
-
-    binaries: ["adbd"],
-    compile_multilib: "both",
-    multilib: {
-        both: {
-            native_shared_libs: [
-                "libadb_pairing_auth",
-                "libadb_pairing_connection",
-                "libadb_pairing_server",
-                "libadbconnection_client",
-            ],
-        },
-    },
-    prebuilts: ["com.android.adbd.init.rc"],
-
-    key: "com.android.adbd.key",
-    certificate: ":com.android.adbd.certificate",
-}
-
-apex {
-    name: "com.android.adbd",
-    defaults: ["com.android.adbd-defaults"],
-    manifest: "apex_manifest.json",
-}
-
-// adbd apex with INT_MAX version code, to allow for upgrade/rollback testing.
-apex_test {
-    name: "test_com.android.adbd",
-    defaults: ["com.android.adbd-defaults"],
-    manifest: "test_apex_manifest.json",
-    file_contexts: ":com.android.adbd-file_contexts",
-    installable: false,
-}
-
-prebuilt_etc {
-    name: "com.android.adbd.init.rc",
-    src: "adbd.rc",
-    filename: "init.rc",
-    installable: false,
-}
-
-apex_key {
-    name: "com.android.adbd.key",
-    public_key: "com.android.adbd.avbpubkey",
-    private_key: "com.android.adbd.pem",
-}
-
-android_app_certificate {
-    name: "com.android.adbd.certificate",
-    certificate: "com.android.adbd",
-}
diff --git a/adb/apex/adbd.rc b/adb/apex/adbd.rc
deleted file mode 100644
index 9cb072b..0000000
--- a/adb/apex/adbd.rc
+++ /dev/null
@@ -1,6 +0,0 @@
-service adbd /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0
-    class core
-    socket adbd seqpacket 660 system system
-    disabled
-    override
-    seclabel u:r:adbd:s0
diff --git a/adb/apex/apex_manifest.json b/adb/apex/apex_manifest.json
deleted file mode 100644
index 0444409..0000000
--- a/adb/apex/apex_manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "name": "com.android.adbd",
-  "version": 300000000
-}
diff --git a/adb/apex/com.android.adbd.avbpubkey b/adb/apex/com.android.adbd.avbpubkey
deleted file mode 100644
index 06235bd..0000000
--- a/adb/apex/com.android.adbd.avbpubkey
+++ /dev/null
Binary files differ
diff --git a/adb/apex/com.android.adbd.pem b/adb/apex/com.android.adbd.pem
deleted file mode 100644
index 2c9a860..0000000
--- a/adb/apex/com.android.adbd.pem
+++ /dev/null
@@ -1,51 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIJKQIBAAKCAgEAwUmO4l/ZdLhmBcBtpwDjih6z6bC7iZDPAVgnFVnYuYDRlVDA
-9OCDwv02Wwc/YCNzON7vt7JBk3o9wyJZpqY9HR1PUjk2DJa/wHtxbskmLcqsvcoh
-wZxmMkgx1mFyni/vQ0tCjjxYmDcnpoVmSntoPG4LBTZRwbgE2roYSuEi7q88Z9+t
-cFiQ5x7MqVTzUFsi1E+rpsxRaTt6Ly9DO71yR1gMTqONsSgmFm8f2HhUCiQzRh7H
-qLwk8eN5ZLPLVc1JBqo8swuH5pR9whR8HaYyQtK1VANRR9oVj3JpRXmyFUk8QjEn
-91I3sFV1lErdP1uh6xi6ewMBp+mQ+ccNFiNJs8PHVprzbEgX2ah45Tnge95ZwnkR
-V/5G/EwGBsggk/BcZjQyj0PExG6LmygR7lq8q4m9ODJj3cmNLZsZu8ukMBxf4Fim
-4/Y7lyaelW0FL+x3CR27wlIxLyIf/JfUNv/cFO/O2MHrDHYdHtCbvg8vpq1MZtDN
-+gJIkYQNUfBEtGS4SkH3WWfNet3bcL5yFx5IVdwCY+n635jPA1fvr1vcIiKnyGUm
-zNE+jMOZkgk6lPPuDwllAX0D8nYTm1eBMCTAWCePO0QlcFHCT9j1/xKbFbjt/xYI
-0pXuOc8/1n61F5ybzH/91cS66gqmYUAekUiP0osTIZ7idVFJMoqpc9m7+rECAwEA
-AQKCAgEAkjg9WU89SCk/NNavnQj1GUXEwOKr3JOppdC0MFi5tQuYgSaH8jfuNZIs
-joxbCzWGMt2j5wl4xkJRes7/lyxnSyEjIoaZNsjL4qb/1tlggn+yUhkZlEfmn98x
-pIYvmS+WBwhmHwfT1cLTwgtkqK/W2PA+cgD3tF6rfXQOcIcEUCBMyB/UKws1A0Kv
-fOIA9ycaoBZtOk+SvtL5ybwtVoIoc4ROOydLR1uiBJKoOrA8kzdzenZKgIFkSYDW
-ErJY/l3AAsTCCoiMlIh84ldw1VUm7JpOBnJECOEYMl5Q+PfpGmU+qqxZGaYe7syX
-mElSOl3tjdY1LF3H4Oi2fd5xLfAgDgQjXcawKRYpImEgbqNfEUHW4BE/uVp0hHn+
-W0tCq9hvWoizhjxVq7oEfpdCXJBH0bTg9h3Ho2nuJMHTrUVbSWPTqNJn1xOi4Oxl
-vWsD5qjOOVw1e0P1dtxQ+6a8+rCL8LDvIthQC9Wpt0yXduEi/vUWiMFx2VbcSpNn
-5PB9HK7vvCpR/k0IocaTKt80D3m2svJCnfrekRx/7n//x8imrvtvaYNpoToTSN0q
-hPOpTNc77R4aARJNXm4sVHzGs6HUXsJfODJdjFtTuaDHjLvRoXZi2wFUVWBvIaFg
-/4+PHXjsfMkY15KULKn3f7Xs7K6rmINAb853zti3Qkllv1EeYoECggEBAP9t1Jxe
-hLKnVrJ5jJ0zCT0/ez6qM5cQG8YvXbVICmoAOQ+/NV6qjPABg5j8FuNhpyr45OuJ
-m1oISLgZPVCbIvYx3oZS4ekWUp9Z7jlDGzsWiBCkEUFLRzDLQRUl4bQMI2SWM+vD
-RL9AAM+NHJQ8LJN7ASNdSQw9ZinNCSByCZ52QjPCfRON0OPY4l1FJKHHymzBNXpe
-R5e9a1o9KEIhd7j+3YX9y8SOVrbUe6U8me5LZ6RY+pLB+cA/UHcSQK23hYAkMcvL
-MQny6B57P6rquzFZDG/OUOZWzWub2FSYTTmiYSHPAuB15FyWShs7h7+wK8y2xrSM
-Lq3FWHxzR1OK2HkCggEBAMG4KsAU/lp9rQhNpdw2NQXqbDLgHy09BFMOOWhyp2/Z
-2lbDo9aP746Q56HAfRRgx5oAAtr3SxeN/R/uEJLYzzDU+SrG4TQO/TZ3DPZOAVYM
-oESWG/HXLN4Hw6j4iWt2NvqpnSVJrvYr6zar/QxRHOMwnUoUV3ugmzUkqFC/Nwmm
-nMGJbTQbEha8OyatfwejmhrCkbQMBiCk0AQmgLybUxs2ckGs5jibau7VqXVxly0f
-WkAsWE/qfybQl4oyBhGCFNObr3Co/PHTaD4ACFQQvaEEF4bTuh6wP+MIgJKxL8IB
-SkrKWO5PFbJWY5lacnNMe7ITrWy60HukLlJe5or5lfkCggEBAP3Rwghw1CRDrR9F
-Mbm0UWYPgwTOVN20ICVcRB40LEURW6KOOxaLG+oTVxXay1PAYkGNes2jvEBHIxvt
-2MQUpTVIcPvBuMPKbufykYtNZ+3bgfInVw4vI9sU3uOI9TPZLAJ0T7vkGpiBnUyh
-yNh0w0b6YDMoK8KB8Ndw67TWHUDd+wM8LNYVgpInnylX4ALzae+QPvgOX84laFwP
-kcXFRBcNDExt2uLDHuAnXYbhJYVqYN8rnDPhlbC4OdlYxfTZ/UtMrD769wwP2SER
-ED9jagirmHQx7Ko3b4GTJ/FINtUiyqqx7wXloLtwjMtq6IZPJfcTWXloI6qCBGAG
-ncYinuECggEAfZeiF8BEm3RpTz3QL3HxdHFkTqOhctnhSNuq+n2C8nBCLwhN21ic
-DkkB84txTFnmboBdWYsEYzQKDL5yflIUGeup00L3VKH3Jm2OuM0f7qLm8TCE04kW
-rKhKAO2JYmNVB7QZjsgzp6QXre1ZdLfNy7mD8Dg584vPtGecvCUMULR1YsBvTV3T
-n2vPyaan+dLmoTzN6/XzrwxLVLWFt0HYYoctEkk/RSn17PwXDm5jfbya7YoSg1Vb
-tFV+Oflul8FHMV35I0hcHYhbR/8LZz0nRBH8EsyIGUdZVB76BKDdfqEJgm2ntHEP
-dvytPAo4s2m9tFkvkZOYgOCTq5GdVDK2OQKCAQAsz+y9rDcqFciCESu4IHzmtckT
-0kwP2W5ds5hzUjbY0Y2AKTx2oHNOFak6WW5vxN0+OIn37SNK3RBStPWJiigut4R4
-rGrZM4pijm53s3cWzd0h8XyLGisl2zORu8gD2IQLkQf79F3lEZHGA+J0mkSHB85N
-IuqReFzL6cfOToNd+8WYjMgJcXmVuKiCV1FRK3jrqNpXO2cLtnhFvQMxRUAYU4j+
-2MIdBFVeMq5ftMMOBS21hM9cNLlOzoSN2HmK+ZkmrlTCK0G9lmF427/lqXTmWLed
-sspOUbOLfBOwxdCCc9JUxz5KggKWcDcTqX25M0mv09rpuCxIEg8lez1Ax0if
------END RSA PRIVATE KEY-----
diff --git a/adb/apex/com.android.adbd.pk8 b/adb/apex/com.android.adbd.pk8
deleted file mode 100644
index cdddc3f..0000000
--- a/adb/apex/com.android.adbd.pk8
+++ /dev/null
Binary files differ
diff --git a/adb/apex/com.android.adbd.x509.pem b/adb/apex/com.android.adbd.x509.pem
deleted file mode 100644
index bb85c1d..0000000
--- a/adb/apex/com.android.adbd.x509.pem
+++ /dev/null
@@ -1,35 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIGHzCCBAegAwIBAgIUW8npFHXBP+wsEAesGMBxaV7TScAwDQYJKoZIhvcNAQEL
-BQAwgZ0xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQH
-DA1Nb3VudGFpbiBWaWV3MRAwDgYDVQQKDAdBbmRyb2lkMRAwDgYDVQQLDAdBbmRy
-b2lkMRkwFwYDVQQDDBBjb20uYW5kcm9pZC5hZGJkMSIwIAYJKoZIhvcNAQkBFhNh
-bmRyb2lkQGFuZHJvaWQuY29tMCAXDTE5MDgxNTE5MzkxM1oYDzQ3NTcwNzExMTkz
-OTEzWjCBnTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNV
-BAcMDU1vdW50YWluIFZpZXcxEDAOBgNVBAoMB0FuZHJvaWQxEDAOBgNVBAsMB0Fu
-ZHJvaWQxGTAXBgNVBAMMEGNvbS5hbmRyb2lkLmFkYmQxIjAgBgkqhkiG9w0BCQEW
-E2FuZHJvaWRAYW5kcm9pZC5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK
-AoICAQC6zbUeWi5vNA6vCC4FBrJQ9re4UexP6TabsDYvWpFBoCluvMkT2ZRmpXMF
-W7EzQ5VmuUvZgLYVHuJmnvHIV3uaRc2VE1SV+spjWTRt+6DtsAN7irR5K66POWMp
-+tr5hASdQBVOJdebimsepy0pH6sXREvanrrFzkSM/2Ho0unlwWJ5Y4jcnvdkVHI5
-Ks0vifLmX4y5mYgv1dcXYWzyYx39f8HyePv0cjRhYXiIEYZ49KWU4MjryvQe/mAu
-MQuMp901BLps2W1+oKyPPA4DV69KUXgF66RFfsjjkJJ/CSeQGzTuez+UWzFk3Duc
-6MmbiL1LTki3vyyVtjW1rYFO2s+M6Pa5NZWHgA55uUxiJ987WPyK9lWnMsY6YeKa
-FDBfS1JUzXGPzVncgM7LLvzAEibLdhjII88NsJvzPoHK0SluSn+E7t7iGO1fTjkD
-Js94iUJAp8OQ4GwkcTVgtEAR+NXzownNjHJ6qpiq6tXRqXdBqSat/glf01AgNDtz
-9AGeW7Mz6FqTdOzg3U4lu77+CGd3SZTuQk8C8PUDNhqhQX5H2qhr90bakGaXuYfE
-rWFzIjrVdJIznV1BimOCay5HyyHab4FWlVhAvslEQb2BpHRyi2lhe0laupOpmN44
-LzfjFM18bi2GashIi2OQuYDyAeT5mGtR2g8mC7g44H6dH+wTfQIDAQABo1MwUTAd
-BgNVHQ4EFgQU7lyyxPO5SOOh9a5O0l4+RjckcgcwHwYDVR0jBBgwFoAU7lyyxPO5
-SOOh9a5O0l4+RjckcgcwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
-AgEAStsOy8bkbZg/Ygx47bPkLSz0cJIvATxTChUGOabkz+brLis88ABVWVP0IXps
-tlLlZR5cjXBJguE7GJXzKPWzQZuB8+YwcGHG6QDFpfdMeGrxPDhwNfGy236ArVnx
-K0v1IIxoZRZ0P7aubk3xwUAPgsmT5ayZCKu+dqlEy5B6ioKEsr7Y2RRT/8ifERNm
-cjS9AhcyWrp4R3cjy2iA/RpdsPFwE5ac3I+GtUB4D2up5aDMsy85i9t2/1kuTUaA
-9UHwGXCpcqP8f8BqeLzuxDzYkAvkntlNxbXn1cbn+dTRIOCBoDbtSeqtxhWooOUH
-RQROeRsB7iicdYJJRge0+WyR+216AKUSQPE6/rT0Ifr06ZRwi22/YyySpwuO3SNA
-+yWffh+f4h31Dz+p6pu8wjbMDkq4LnCWyjLwfF/yhvWhwwm5+KPAEhvJABeHQc+3
-cslOC9dlXJm9sPoUC7ghmUiFsCmN2hIzQrr2QoK0Obh0AGexOvOAw9cqtOdZQncB
-bqC8c4sVYScVxwDWkg0lNfRMC5boPjBsl7+M2CC1ukgVpXTyDOEjMWILrBXfYCDX
-unBH3kbKQOfL5RT0nE1Lkt1rn5qAWMJg4mvS4QuIurbRtEoj3QYQadF9md4qJXs0
-TvqvY8iEC4xrWU2SQn1K3PutXgaLP9/b6Cy1SBrhBX+AC5s=
------END CERTIFICATE-----
diff --git a/adb/apex/test_apex_manifest.json b/adb/apex/test_apex_manifest.json
deleted file mode 100644
index 7131977..0000000
--- a/adb/apex/test_apex_manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "name": "com.android.adbd",
-  "version": 2147483647
-}
diff --git a/adb/benchmark_device.py b/adb/benchmark_device.py
deleted file mode 100755
index 4d0cf49..0000000
--- a/adb/benchmark_device.py
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2018 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.
-#
-
-import os
-import statistics
-import subprocess
-import tempfile
-import time
-
-import adb
-
-def lock_min(device):
-    device.shell_nocheck(["""
-        for x in /sys/devices/system/cpu/cpu?/cpufreq; do
-            echo userspace > $x/scaling_governor
-            cat $x/scaling_min_freq > $x/scaling_setspeed
-        done
-    """])
-
-def lock_max(device):
-    device.shell_nocheck(["""
-        for x in /sys/devices/system/cpu/cpu?/cpufreq; do
-            echo userspace > $x/scaling_governor
-            cat $x/scaling_max_freq > $x/scaling_setspeed
-        done
-    """])
-
-def unlock(device):
-    device.shell_nocheck(["""
-        for x in /sys/devices/system/cpu/cpu?/cpufreq; do
-            echo ondemand > $x/scaling_governor
-            echo sched > $x/scaling_governor
-            echo schedutil > $x/scaling_governor
-        done
-    """])
-
-def harmonic_mean(xs):
-    return 1.0 / statistics.mean([1.0 / x for x in xs])
-
-def analyze(name, speeds):
-    median = statistics.median(speeds)
-    mean = harmonic_mean(speeds)
-    stddev = statistics.stdev(speeds)
-    msg = "%s: %d runs: median %.2f MiB/s, mean %.2f MiB/s, stddev: %.2f MiB/s"
-    print(msg % (name, len(speeds), median, mean, stddev))
-
-def benchmark_sink(device=None, size_mb=100):
-    if device == None:
-        device = adb.get_device()
-
-    speeds = list()
-    cmd = device.adb_cmd + ["raw", "sink:%d" % (size_mb * 1024 * 1024)]
-
-    with tempfile.TemporaryFile() as tmpfile:
-        tmpfile.truncate(size_mb * 1024 * 1024)
-
-        for _ in range(0, 10):
-            tmpfile.seek(0)
-            begin = time.time()
-            subprocess.check_call(cmd, stdin=tmpfile)
-            end = time.time()
-            speeds.append(size_mb / float(end - begin))
-
-    analyze("sink %dMiB" % size_mb, speeds)
-
-def benchmark_source(device=None, size_mb=100):
-    if device == None:
-        device = adb.get_device()
-
-    speeds = list()
-    cmd = device.adb_cmd + ["raw", "source:%d" % (size_mb * 1024 * 1024)]
-
-    with open(os.devnull, 'w') as devnull:
-        for _ in range(0, 10):
-            begin = time.time()
-            subprocess.check_call(cmd, stdout=devnull)
-            end = time.time()
-            speeds.append(size_mb / float(end - begin))
-
-    analyze("source %dMiB" % size_mb, speeds)
-
-def benchmark_push(device=None, file_size_mb=100):
-    if device == None:
-        device = adb.get_device()
-
-    remote_path = "/dev/null"
-    local_path = "/tmp/adb_benchmark_temp"
-
-    with open(local_path, "wb") as f:
-        f.truncate(file_size_mb * 1024 * 1024)
-
-    speeds = list()
-    for _ in range(0, 10):
-        begin = time.time()
-        device.push(local=local_path, remote=remote_path)
-        end = time.time()
-        speeds.append(file_size_mb / float(end - begin))
-
-    analyze("push %dMiB" % file_size_mb, speeds)
-
-def benchmark_pull(device=None, file_size_mb=100):
-    if device == None:
-        device = adb.get_device()
-
-    remote_path = "/data/local/tmp/adb_benchmark_temp"
-    local_path = "/tmp/adb_benchmark_temp"
-
-    device.shell(["dd", "if=/dev/zero", "of=" + remote_path, "bs=1m",
-                  "count=" + str(file_size_mb)])
-    speeds = list()
-    for _ in range(0, 10):
-        begin = time.time()
-        device.pull(remote=remote_path, local=local_path)
-        end = time.time()
-        speeds.append(file_size_mb / float(end - begin))
-
-    analyze("pull %dMiB" % file_size_mb, speeds)
-
-def benchmark_shell(device=None, file_size_mb=100):
-    if device == None:
-        device = adb.get_device()
-
-    speeds = list()
-    for _ in range(0, 10):
-        begin = time.time()
-        device.shell(["dd", "if=/dev/zero", "bs=1m",
-                      "count=" + str(file_size_mb)])
-        end = time.time()
-        speeds.append(file_size_mb / float(end - begin))
-
-    analyze("shell %dMiB" % file_size_mb, speeds)
-
-def main():
-    device = adb.get_device()
-    unlock(device)
-    benchmark_sink(device)
-    benchmark_source(device)
-    benchmark_push(device)
-    benchmark_pull(device)
-
-if __name__ == "__main__":
-    main()
diff --git a/adb/brotli_utils.h b/adb/brotli_utils.h
deleted file mode 100644
index c5be73d..0000000
--- a/adb/brotli_utils.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <span>
-
-#include <brotli/decode.h>
-#include <brotli/encode.h>
-
-#include "types.h"
-
-enum class BrotliDecodeResult {
-    Error,
-    Done,
-    NeedInput,
-    MoreOutput,
-};
-
-struct BrotliDecoder {
-    explicit BrotliDecoder(std::span<char> output_buffer)
-        : output_buffer_(output_buffer),
-          decoder_(BrotliDecoderCreateInstance(nullptr, nullptr, nullptr),
-                   BrotliDecoderDestroyInstance) {}
-
-    void Append(Block&& block) { input_buffer_.append(std::move(block)); }
-
-    BrotliDecodeResult Decode(std::span<char>* output) {
-        size_t available_in = input_buffer_.front_size();
-        const uint8_t* next_in = reinterpret_cast<const uint8_t*>(input_buffer_.front_data());
-
-        size_t available_out = output_buffer_.size();
-        uint8_t* next_out = reinterpret_cast<uint8_t*>(output_buffer_.data());
-
-        BrotliDecoderResult r = BrotliDecoderDecompressStream(
-                decoder_.get(), &available_in, &next_in, &available_out, &next_out, nullptr);
-
-        size_t bytes_consumed = input_buffer_.front_size() - available_in;
-        input_buffer_.drop_front(bytes_consumed);
-
-        size_t bytes_emitted = output_buffer_.size() - available_out;
-        *output = std::span<char>(output_buffer_.data(), bytes_emitted);
-
-        switch (r) {
-            case BROTLI_DECODER_RESULT_SUCCESS:
-                return BrotliDecodeResult::Done;
-            case BROTLI_DECODER_RESULT_ERROR:
-                return BrotliDecodeResult::Error;
-            case BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:
-                // Brotli guarantees as one of its invariants that if it returns NEEDS_MORE_INPUT,
-                // it will consume the entire input buffer passed in, so we don't have to worry
-                // about bytes left over in the front block with more input remaining.
-                return BrotliDecodeResult::NeedInput;
-            case BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:
-                return BrotliDecodeResult::MoreOutput;
-        }
-    }
-
-  private:
-    IOVector input_buffer_;
-    std::span<char> output_buffer_;
-    std::unique_ptr<BrotliDecoderState, void (*)(BrotliDecoderState*)> decoder_;
-};
-
-enum class BrotliEncodeResult {
-    Error,
-    Done,
-    NeedInput,
-    MoreOutput,
-};
-
-template <size_t OutputBlockSize>
-struct BrotliEncoder {
-    explicit BrotliEncoder()
-        : output_block_(OutputBlockSize),
-          output_bytes_left_(OutputBlockSize),
-          encoder_(BrotliEncoderCreateInstance(nullptr, nullptr, nullptr),
-                   BrotliEncoderDestroyInstance) {
-        BrotliEncoderSetParameter(encoder_.get(), BROTLI_PARAM_QUALITY, 1);
-    }
-
-    void Append(Block input) { input_buffer_.append(std::move(input)); }
-    void Finish() { finished_ = true; }
-
-    BrotliEncodeResult Encode(Block* output) {
-        output->clear();
-        while (true) {
-            size_t available_in = input_buffer_.front_size();
-            const uint8_t* next_in = reinterpret_cast<const uint8_t*>(input_buffer_.front_data());
-
-            size_t available_out = output_bytes_left_;
-            uint8_t* next_out = reinterpret_cast<uint8_t*>(output_block_.data() +
-                                                           (OutputBlockSize - output_bytes_left_));
-
-            BrotliEncoderOperation op = BROTLI_OPERATION_PROCESS;
-            if (finished_) {
-                op = BROTLI_OPERATION_FINISH;
-            }
-
-            if (!BrotliEncoderCompressStream(encoder_.get(), op, &available_in, &next_in,
-                                             &available_out, &next_out, nullptr)) {
-                return BrotliEncodeResult::Error;
-            }
-
-            size_t bytes_consumed = input_buffer_.front_size() - available_in;
-            input_buffer_.drop_front(bytes_consumed);
-
-            output_bytes_left_ = available_out;
-
-            if (BrotliEncoderIsFinished(encoder_.get())) {
-                output_block_.resize(OutputBlockSize - output_bytes_left_);
-                *output = std::move(output_block_);
-                return BrotliEncodeResult::Done;
-            } else if (output_bytes_left_ == 0) {
-                *output = std::move(output_block_);
-                output_block_.resize(OutputBlockSize);
-                output_bytes_left_ = OutputBlockSize;
-                return BrotliEncodeResult::MoreOutput;
-            } else if (input_buffer_.empty()) {
-                return BrotliEncodeResult::NeedInput;
-            }
-        }
-    }
-
-  private:
-    bool finished_ = false;
-    IOVector input_buffer_;
-    Block output_block_;
-    size_t output_bytes_left_;
-    std::unique_ptr<BrotliEncoderState, void (*)(BrotliEncoderState*)> encoder_;
-};
diff --git a/adb/bugreport_test.cpp b/adb/bugreport_test.cpp
deleted file mode 100644
index a6be203..0000000
--- a/adb/bugreport_test.cpp
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "bugreport.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <android-base/strings.h>
-#include <android-base/test_utils.h>
-
-#include "sysdeps.h"
-#include "adb_utils.h"
-
-using ::testing::_;
-using ::testing::Action;
-using ::testing::ActionInterface;
-using ::testing::DoAll;
-using ::testing::ElementsAre;
-using ::testing::HasSubstr;
-using ::testing::MakeAction;
-using ::testing::Return;
-using ::testing::StrEq;
-using ::testing::WithArg;
-using ::testing::internal::CaptureStderr;
-using ::testing::internal::CaptureStdout;
-using ::testing::internal::GetCapturedStderr;
-using ::testing::internal::GetCapturedStdout;
-
-// Empty function so tests don't need to be linked against file_sync_service.cpp, which requires
-// SELinux and its transitive dependencies...
-bool do_sync_pull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
-                  const char* name) {
-    ADD_FAILURE() << "do_sync_pull() should have been mocked";
-    return false;
-}
-
-// Empty functions so tests don't need to be linked against commandline.cpp
-DefaultStandardStreamsCallback DEFAULT_STANDARD_STREAMS_CALLBACK(nullptr, nullptr);
-
-int send_shell_command(const std::string& command, bool disable_shell_protocol,
-                       StandardStreamsCallbackInterface* callback) {
-    ADD_FAILURE() << "send_shell_command() should have been mocked";
-    return -42;
-}
-
-enum StreamType {
-    kStreamStdout,
-    kStreamStderr,
-};
-
-// gmock black magic to provide a WithArg<2>(WriteOnStdout(output)) matcher
-typedef void OnStandardStreamsCallbackFunction(StandardStreamsCallbackInterface*);
-
-class OnStandardStreamsCallbackAction : public ActionInterface<OnStandardStreamsCallbackFunction> {
-  public:
-    explicit OnStandardStreamsCallbackAction(StreamType type, const std::string& output)
-        : type_(type), output_(output) {
-    }
-    virtual Result Perform(const ArgumentTuple& args) {
-        if (type_ == kStreamStdout) {
-            ::std::tr1::get<0>(args)->OnStdout(output_.c_str(), output_.size());
-        }
-        if (type_ == kStreamStderr) {
-            ::std::tr1::get<0>(args)->OnStderr(output_.c_str(), output_.size());
-        }
-    }
-
-  private:
-    StreamType type_;
-    std::string output_;
-};
-
-// Matcher used to emulated StandardStreamsCallbackInterface.OnStdout(buffer,
-// length)
-Action<OnStandardStreamsCallbackFunction> WriteOnStdout(const std::string& output) {
-    return MakeAction(new OnStandardStreamsCallbackAction(kStreamStdout, output));
-}
-
-// Matcher used to emulated StandardStreamsCallbackInterface.OnStderr(buffer,
-// length)
-Action<OnStandardStreamsCallbackFunction> WriteOnStderr(const std::string& output) {
-    return MakeAction(new OnStandardStreamsCallbackAction(kStreamStderr, output));
-}
-
-typedef int CallbackDoneFunction(StandardStreamsCallbackInterface*);
-
-class CallbackDoneAction : public ActionInterface<CallbackDoneFunction> {
-  public:
-    explicit CallbackDoneAction(int status) : status_(status) {
-    }
-    virtual Result Perform(const ArgumentTuple& args) {
-        int status = ::std::tr1::get<0>(args)->Done(status_);
-        return status;
-    }
-
-  private:
-    int status_;
-};
-
-// Matcher used to emulated StandardStreamsCallbackInterface.Done(status)
-Action<CallbackDoneFunction> ReturnCallbackDone(int status = -1337) {
-    return MakeAction(new CallbackDoneAction(status));
-}
-
-class BugreportMock : public Bugreport {
-  public:
-    MOCK_METHOD3(SendShellCommand, int(const std::string& command, bool disable_shell_protocol,
-                                       StandardStreamsCallbackInterface* callback));
-    MOCK_METHOD4(DoSyncPull, bool(const std::vector<const char*>& srcs, const char* dst,
-                                  bool copy_attrs, const char* name));
-    MOCK_METHOD2(UpdateProgress, void(const std::string&, int));
-};
-
-class BugreportTest : public ::testing::Test {
-  public:
-    void SetUp() {
-        if (!getcwd(&cwd_)) {
-            ADD_FAILURE() << "getcwd failed: " << strerror(errno);
-            return;
-        }
-    }
-
-    void ExpectBugreportzVersion(const std::string& version) {
-        EXPECT_CALL(br_, SendShellCommand("bugreportz -v", false, _))
-            .WillOnce(DoAll(WithArg<2>(WriteOnStderr(version)),
-                            WithArg<2>(ReturnCallbackDone(0))));
-    }
-
-    void ExpectProgress(int progress_percentage, const std::string& file = "file.zip") {
-        EXPECT_CALL(br_, UpdateProgress(StrEq("generating " + file), progress_percentage));
-    }
-
-    BugreportMock br_;
-    std::string cwd_;  // TODO: make it static
-};
-
-// Tests when called with invalid number of arguments
-TEST_F(BugreportTest, InvalidNumberArgs) {
-    const char* args[] = {"bugreport", "to", "principal"};
-    ASSERT_EQ(1, br_.DoIt(3, args));
-}
-
-// Tests the 'adb bugreport' option when the device does not support 'bugreportz' - it falls back
-// to the flat-file format ('bugreport' binary on device)
-TEST_F(BugreportTest, NoArgumentsPreNDevice) {
-    // clang-format off
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -v", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStderr("")),
-                        // Write some bogus output on stdout to make sure it's ignored
-                        WithArg<2>(WriteOnStdout("Dude, where is my bugreportz?")),
-                        WithArg<2>(ReturnCallbackDone(0))));
-    // clang-format on
-    std::string bugreport = "Reported the bug was.";
-    CaptureStdout();
-    EXPECT_CALL(br_, SendShellCommand("bugreport", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout(bugreport)), Return(0)));
-
-    const char* args[] = {"bugreport"};
-    ASSERT_EQ(0, br_.DoIt(1, args));
-    ASSERT_THAT(GetCapturedStdout(), StrEq(bugreport));
-}
-
-// Tests the 'adb bugreport' option when the device supports 'bugreportz' version 1.0 - it will
-// save the bugreport in the current directory with the name provided by the device.
-TEST_F(BugreportTest, NoArgumentsNDevice) {
-    ExpectBugreportzVersion("1.0");
-
-    std::string dest_file =
-        android::base::StringPrintf("%s%cda_bugreport.zip", cwd_.c_str(), OS_PATH_SEPARATOR);
-    EXPECT_CALL(br_, SendShellCommand("bugreportz", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("OK:/device/da_bugreport.zip")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file),
-                                false, StrEq("pulling da_bugreport.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport"};
-    ASSERT_EQ(0, br_.DoIt(1, args));
-}
-
-// Tests the 'adb bugreport' option when the device supports 'bugreportz' version 1.1 - it will
-// save the bugreport in the current directory with the name provided by the device.
-TEST_F(BugreportTest, NoArgumentsPostNDevice) {
-    ExpectBugreportzVersion("1.1");
-    std::string dest_file =
-        android::base::StringPrintf("%s%cda_bugreport.zip", cwd_.c_str(), OS_PATH_SEPARATOR);
-    ExpectProgress(50, "da_bugreport.zip");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("BEGIN:/device/da_bugreport.zip\n")),
-                        WithArg<2>(WriteOnStdout("PROGRESS:50/100\n")),
-                        WithArg<2>(WriteOnStdout("OK:/device/da_bugreport.zip\n")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file),
-                                false, StrEq("pulling da_bugreport.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport"};
-    ASSERT_EQ(0, br_.DoIt(1, args));
-}
-
-// Tests 'adb bugreport file.zip' when it succeeds and device does not support progress.
-TEST_F(BugreportTest, OkNDevice) {
-    ExpectBugreportzVersion("1.0");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("OK:/device/bugreport.zip")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, StrEq("pulling file.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when it succeeds but response was sent in
-// multiple buffer writers and without progress updates.
-TEST_F(BugreportTest, OkNDeviceSplitBuffer) {
-    ExpectBugreportzVersion("1.0");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("OK:/device")),
-                        WithArg<2>(WriteOnStdout("/bugreport.zip")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, StrEq("pulling file.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when it succeeds and displays progress.
-TEST_F(BugreportTest, OkProgress) {
-    ExpectBugreportzVersion("1.1");
-    ExpectProgress(1);
-    ExpectProgress(10);
-    ExpectProgress(50);
-    ExpectProgress(99);
-    // clang-format off
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        // NOTE: DoAll accepts at most 10 arguments, and we're almost reached that limit...
-        .WillOnce(DoAll(
-            // Name might change on OK, so make sure the right one is picked.
-            WithArg<2>(WriteOnStdout("BEGIN:/device/bugreport___NOT.zip\n")),
-            // Progress line in one write
-            WithArg<2>(WriteOnStdout("PROGRESS:1/100\n")),
-            // Add some bogus lines
-            WithArg<2>(WriteOnStdout("\nDUDE:SWEET\n\nBLA\n\nBLA\nBLA\n\n")),
-            // Multiple progress lines in one write
-            WithArg<2>(WriteOnStdout("PROGRESS:10/100\nPROGRESS:50/100\n")),
-            // Progress line in multiple writes
-            WithArg<2>(WriteOnStdout("PROG")),
-            WithArg<2>(WriteOnStdout("RESS:99")),
-            WithArg<2>(WriteOnStdout("/100\n")),
-            // Split last message as well, just in case
-            WithArg<2>(WriteOnStdout("OK:/device/bugreport")),
-            WithArg<2>(WriteOnStdout(".zip")),
-            WithArg<2>(ReturnCallbackDone())));
-    // clang-format on
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, StrEq("pulling file.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when it succeeds and displays progress, even if progress recedes.
-TEST_F(BugreportTest, OkProgressAlwaysForward) {
-    ExpectBugreportzVersion("1.1");
-    ExpectProgress(1);
-    ExpectProgress(50);
-    ExpectProgress(75);
-    // clang-format off
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        // NOTE: DoAll accepts at most 10 arguments, and we're almost reached that limit...
-        .WillOnce(DoAll(
-            WithArg<2>(WriteOnStdout("BEGIN:/device/bugreport.zip\n")),
-            WithArg<2>(WriteOnStdout("PROGRESS:1/100\n")), // 1%
-            WithArg<2>(WriteOnStdout("PROGRESS:50/100\n")), // 50%
-            // 25% should be ignored becaused it receded.
-            WithArg<2>(WriteOnStdout("PROGRESS:25/100\n")), // 25%
-            WithArg<2>(WriteOnStdout("PROGRESS:75/100\n")), // 75%
-            // 75% should be ignored becaused it didn't change.
-            WithArg<2>(WriteOnStdout("PROGRESS:75/100\n")), // 75%
-            // Try a receeding percentage with a different max progress
-            WithArg<2>(WriteOnStdout("PROGRESS:700/1000\n")), // 70%
-            WithArg<2>(WriteOnStdout("OK:/device/bugreport.zip")),
-            WithArg<2>(ReturnCallbackDone())));
-    // clang-format on
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, StrEq("pulling file.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when it succeeds and displays the initial progress of 0%
-TEST_F(BugreportTest, OkProgressZeroPercentIsNotIgnored) {
-    ExpectBugreportzVersion("1.1");
-    ExpectProgress(0);
-    ExpectProgress(1);
-    // clang-format off
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        // NOTE: DoAll accepts at most 10 arguments, and we're almost reached that limit...
-        .WillOnce(DoAll(
-            WithArg<2>(WriteOnStdout("BEGIN:/device/bugreport.zip\n")),
-            WithArg<2>(WriteOnStdout("PROGRESS:1/100000\n")),
-            WithArg<2>(WriteOnStdout("PROGRESS:1/100\n")), // 1%
-            WithArg<2>(WriteOnStdout("OK:/device/bugreport.zip")),
-            WithArg<2>(ReturnCallbackDone())));
-    // clang-format on
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, StrEq("pulling file.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport dir' when it succeeds and destination is a directory.
-TEST_F(BugreportTest, OkDirectory) {
-    ExpectBugreportzVersion("1.1");
-    TemporaryDir td;
-    std::string dest_file =
-        android::base::StringPrintf("%s%cda_bugreport.zip", td.path, OS_PATH_SEPARATOR);
-
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("BEGIN:/device/da_bugreport.zip\n")),
-                        WithArg<2>(WriteOnStdout("OK:/device/da_bugreport.zip")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file),
-                                false, StrEq("pulling da_bugreport.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", td.path};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file' when it succeeds
-TEST_F(BugreportTest, OkNoExtension) {
-    ExpectBugreportzVersion("1.1");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("OK:/device/bugreport.zip\n")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, StrEq("pulling file.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", "file"};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport dir' when it succeeds and destination is a directory and device runs N.
-TEST_F(BugreportTest, OkNDeviceDirectory) {
-    ExpectBugreportzVersion("1.0");
-    TemporaryDir td;
-    std::string dest_file =
-        android::base::StringPrintf("%s%cda_bugreport.zip", td.path, OS_PATH_SEPARATOR);
-
-    EXPECT_CALL(br_, SendShellCommand("bugreportz", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("BEGIN:/device/da_bugreport.zip\n")),
-                        WithArg<2>(WriteOnStdout("OK:/device/da_bugreport.zip")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file),
-                                false, StrEq("pulling da_bugreport.zip")))
-        .WillOnce(Return(true));
-
-    const char* args[] = {"bugreport", td.path};
-    ASSERT_EQ(0, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when the bugreport itself failed
-TEST_F(BugreportTest, BugreportzReturnedFail) {
-    ExpectBugreportzVersion("1.1");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(
-            DoAll(WithArg<2>(WriteOnStdout("FAIL:D'OH!\n")), WithArg<2>(ReturnCallbackDone())));
-
-    CaptureStderr();
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(-1, br_.DoIt(2, args));
-    ASSERT_THAT(GetCapturedStderr(), HasSubstr("D'OH!"));
-}
-
-// Tests 'adb bugreport file.zip' when the bugreport itself failed but response
-// was sent in
-// multiple buffer writes
-TEST_F(BugreportTest, BugreportzReturnedFailSplitBuffer) {
-    ExpectBugreportzVersion("1.1");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("FAIL")), WithArg<2>(WriteOnStdout(":D'OH!\n")),
-                        WithArg<2>(ReturnCallbackDone())));
-
-    CaptureStderr();
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(-1, br_.DoIt(2, args));
-    ASSERT_THAT(GetCapturedStderr(), HasSubstr("D'OH!"));
-}
-
-// Tests 'adb bugreport file.zip' when the bugreportz returned an unsupported
-// response.
-TEST_F(BugreportTest, BugreportzReturnedUnsupported) {
-    ExpectBugreportzVersion("1.1");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("bugreportz? What am I, a zombie?")),
-                        WithArg<2>(ReturnCallbackDone())));
-
-    CaptureStderr();
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(-1, br_.DoIt(2, args));
-    ASSERT_THAT(GetCapturedStderr(), HasSubstr("bugreportz? What am I, a zombie?"));
-}
-
-// Tests 'adb bugreport file.zip' when the bugreportz -v command failed
-TEST_F(BugreportTest, BugreportzVersionFailed) {
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -v", false, _)).WillOnce(Return(666));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(666, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when the bugreportz -v returns status 0 but with no output.
-TEST_F(BugreportTest, BugreportzVersionEmpty) {
-    ExpectBugreportzVersion("");
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(-1, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when the main bugreportz command failed
-TEST_F(BugreportTest, BugreportzFailed) {
-    ExpectBugreportzVersion("1.1");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _)).WillOnce(Return(666));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(666, br_.DoIt(2, args));
-}
-
-// Tests 'adb bugreport file.zip' when the bugreport could not be pulled
-TEST_F(BugreportTest, PullFails) {
-    ExpectBugreportzVersion("1.1");
-    EXPECT_CALL(br_, SendShellCommand("bugreportz -p", false, _))
-        .WillOnce(DoAll(WithArg<2>(WriteOnStdout("OK:/device/bugreport.zip")),
-                        WithArg<2>(ReturnCallbackDone())));
-    EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"),
-                                false, HasSubstr("file.zip")))
-        .WillOnce(Return(false));
-
-    const char* args[] = {"bugreport", "file.zip"};
-    ASSERT_EQ(1, br_.DoIt(2, args));
-}
diff --git a/adb/client/adb_client.cpp b/adb/client/adb_client.cpp
deleted file mode 100644
index f724cb5..0000000
--- a/adb/client/adb_client.cpp
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "sysdeps.h"
-#include "adb_client.h"
-
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <condition_variable>
-#include <mutex>
-#include <optional>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <android-base/thread_annotations.h>
-#include <cutils/sockets.h>
-
-#include "adb_io.h"
-#include "adb_utils.h"
-#include "socket_spec.h"
-#include "sysdeps/chrono.h"
-
-static TransportType __adb_transport = kTransportAny;
-static const char* __adb_serial = nullptr;
-static TransportId __adb_transport_id = 0;
-
-static const char* __adb_server_socket_spec;
-
-void adb_set_transport(TransportType type, const char* serial, TransportId transport_id) {
-    __adb_transport = type;
-    __adb_serial = serial;
-    __adb_transport_id = transport_id;
-}
-
-void adb_get_transport(TransportType* type, const char** serial, TransportId* transport_id) {
-    if (type) *type = __adb_transport;
-    if (serial) *serial = __adb_serial;
-    if (transport_id) *transport_id = __adb_transport_id;
-}
-
-void adb_set_socket_spec(const char* socket_spec) {
-    if (__adb_server_socket_spec) {
-        LOG(FATAL) << "attempted to reinitialize adb_server_socket_spec " << socket_spec << " (was " << __adb_server_socket_spec << ")";
-    }
-    __adb_server_socket_spec = socket_spec;
-}
-
-static std::optional<TransportId> switch_socket_transport(int fd, std::string* error) {
-    TransportId result;
-    bool read_transport = true;
-
-    std::string service;
-    if (__adb_transport_id) {
-        read_transport = false;
-        service += "host:transport-id:";
-        service += std::to_string(__adb_transport_id);
-        result = __adb_transport_id;
-    } else if (__adb_serial) {
-        service += "host:tport:serial:";
-        service += __adb_serial;
-    } else {
-        const char* transport_type = "???";
-        switch (__adb_transport) {
-          case kTransportUsb:
-              transport_type = "usb";
-              break;
-          case kTransportLocal:
-              transport_type = "local";
-              break;
-          case kTransportAny:
-              transport_type = "any";
-              break;
-          case kTransportHost:
-            // no switch necessary
-            return 0;
-        }
-        service += "host:tport:";
-        service += transport_type;
-    }
-
-    if (!SendProtocolString(fd, service)) {
-        *error = perror_str("write failure during connection");
-        return std::nullopt;
-    }
-
-    LOG(DEBUG) << "Switch transport in progress: " << service;
-
-    if (!adb_status(fd, error)) {
-        D("Switch transport failed: %s", error->c_str());
-        return std::nullopt;
-    }
-
-    if (read_transport) {
-        if (!ReadFdExactly(fd, &result, sizeof(result))) {
-            *error = "failed to read transport id from server";
-            return std::nullopt;
-        }
-    }
-
-    D("Switch transport success");
-    return result;
-}
-
-bool adb_status(borrowed_fd fd, std::string* error) {
-    char buf[5];
-    if (!ReadFdExactly(fd, buf, 4)) {
-        *error = perror_str("protocol fault (couldn't read status)");
-        return false;
-    }
-
-    if (!memcmp(buf, "OKAY", 4)) {
-        return true;
-    }
-
-    if (memcmp(buf, "FAIL", 4)) {
-        *error = android::base::StringPrintf("protocol fault (status %02x %02x %02x %02x?!)",
-                                             buf[0], buf[1], buf[2], buf[3]);
-        return false;
-    }
-
-    ReadProtocolString(fd, error, error);
-    return false;
-}
-
-static int _adb_connect(std::string_view service, TransportId* transport, std::string* error,
-                        bool force_switch = false) {
-    LOG(DEBUG) << "_adb_connect: " << service;
-    if (service.empty() || service.size() > MAX_PAYLOAD) {
-        *error = android::base::StringPrintf("bad service name length (%zd)", service.size());
-        return -1;
-    }
-
-    std::string reason;
-    unique_fd fd;
-    if (!socket_spec_connect(&fd, __adb_server_socket_spec, nullptr, nullptr, &reason)) {
-        *error = android::base::StringPrintf("cannot connect to daemon at %s: %s",
-                                             __adb_server_socket_spec, reason.c_str());
-        return -2;
-    }
-
-    if (!service.starts_with("host") || force_switch) {
-        std::optional<TransportId> transport_result = switch_socket_transport(fd.get(), error);
-        if (!transport_result) {
-            return -1;
-        }
-
-        if (transport) {
-            *transport = *transport_result;
-        }
-    }
-
-    if (!SendProtocolString(fd.get(), service)) {
-        *error = perror_str("write failure during connection");
-        return -1;
-    }
-
-    if (!adb_status(fd.get(), error)) {
-        return -1;
-    }
-
-    D("_adb_connect: return fd %d", fd.get());
-    return fd.release();
-}
-
-bool adb_kill_server() {
-    D("adb_kill_server");
-    std::string reason;
-    unique_fd fd;
-    if (!socket_spec_connect(&fd, __adb_server_socket_spec, nullptr, nullptr, &reason)) {
-        fprintf(stderr, "cannot connect to daemon at %s: %s\n", __adb_server_socket_spec,
-                reason.c_str());
-        return true;
-    }
-
-    if (!SendProtocolString(fd.get(), "host:kill")) {
-        fprintf(stderr, "error: write failure during connection: %s\n", strerror(errno));
-        return false;
-    }
-
-    // The server might send OKAY, so consume that.
-    char buf[4];
-    ReadFdExactly(fd.get(), buf, 4);
-    // Now that no more data is expected, wait for socket orderly shutdown or error, indicating
-    // server death.
-    ReadOrderlyShutdown(fd.get());
-    return true;
-}
-
-int adb_connect(std::string_view service, std::string* error) {
-    return adb_connect(nullptr, service, error);
-}
-
-#if defined(__linux__)
-std::optional<std::string> adb_get_server_executable_path() {
-    int port;
-    std::string error;
-    if (!parse_tcp_socket_spec(__adb_server_socket_spec, nullptr, &port, nullptr, &error)) {
-        return {};
-    }
-
-    return adb_get_android_dir_path() + OS_PATH_SEPARATOR + "adb." + std::to_string(port);
-}
-#endif
-
-static bool __adb_check_server_version(std::string* error) {
-    unique_fd fd(_adb_connect("host:version", nullptr, error));
-
-    bool local = is_local_socket_spec(__adb_server_socket_spec);
-    if (fd == -2 && !local) {
-        fprintf(stderr, "* cannot start server on remote host\n");
-        // error is the original network connection error
-        return false;
-    } else if (fd == -2) {
-        fprintf(stderr, "* daemon not running; starting now at %s\n", __adb_server_socket_spec);
-    start_server:
-        if (launch_server(__adb_server_socket_spec)) {
-            fprintf(stderr, "* failed to start daemon\n");
-            // launch_server() has already printed detailed error info, so just
-            // return a generic error string about the overall adb_connect()
-            // that the caller requested.
-            *error = "cannot connect to daemon";
-            return false;
-        } else {
-            fprintf(stderr, "* daemon started successfully\n");
-        }
-        // The server will wait until it detects all of its connected devices before acking.
-        // Fall through to _adb_connect.
-    } else {
-        // If a server is already running, check its version matches.
-        int version = 0;
-
-        // If we have a file descriptor, then parse version result.
-        if (fd >= 0) {
-            std::string version_string;
-            if (!ReadProtocolString(fd, &version_string, error)) {
-                return false;
-            }
-
-            ReadOrderlyShutdown(fd);
-
-            if (sscanf(&version_string[0], "%04x", &version) != 1) {
-                *error = android::base::StringPrintf("cannot parse version string: %s",
-                                                     version_string.c_str());
-                return false;
-            }
-        } else {
-            // If fd is -1 check for "unknown host service" which would
-            // indicate a version of adb that does not support the
-            // version command, in which case we should fall-through to kill it.
-            if (*error != "unknown host service") {
-                return false;
-            }
-        }
-
-        if (version != ADB_SERVER_VERSION) {
-#if defined(__linux__)
-            if (version > ADB_SERVER_VERSION && local) {
-                // Try to re-exec the existing adb server's binary.
-                constexpr const char* adb_reexeced = "adb (re-execed)";
-                if (strcmp(adb_reexeced, *__adb_argv) != 0) {
-                    __adb_argv[0] = adb_reexeced;
-                    std::optional<std::string> server_path_path = adb_get_server_executable_path();
-                    std::string server_path;
-                    if (server_path_path &&
-                        android::base::ReadFileToString(*server_path_path, &server_path)) {
-                        if (execve(server_path.c_str(), const_cast<char**>(__adb_argv),
-                                   const_cast<char**>(__adb_envp)) == -1) {
-                            LOG(ERROR) << "failed to exec newer version at " << server_path;
-                        }
-
-                        // Fall-through to restarting the server.
-                    }
-                }
-            }
-#endif
-
-            fprintf(stderr, "adb server version (%d) doesn't match this client (%d); killing...\n",
-                    version, ADB_SERVER_VERSION);
-            adb_kill_server();
-            goto start_server;
-        }
-    }
-
-    return true;
-}
-
-bool adb_check_server_version(std::string* error) {
-    // Only check the version once per process, since this isn't atomic anyway.
-    static std::once_flag once;
-    static bool result;
-    static std::string* err;
-    std::call_once(once, []() {
-        err = new std::string();
-        result = __adb_check_server_version(err);
-    });
-    *error = *err;
-    return result;
-}
-
-int adb_connect(TransportId* transport, std::string_view service, std::string* error,
-                bool force_switch_device) {
-    LOG(DEBUG) << "adb_connect: service: " << service;
-
-    // Query the adb server's version.
-    if (!adb_check_server_version(error)) {
-        return -1;
-    }
-
-    // if the command is start-server, we are done.
-    if (service == "host:start-server") {
-        return 0;
-    }
-
-    unique_fd fd(_adb_connect(service, transport, error, force_switch_device));
-    if (fd == -1) {
-        D("_adb_connect error: %s", error->c_str());
-    } else if(fd == -2) {
-        fprintf(stderr, "* daemon still not running\n");
-    }
-    D("adb_connect: return fd %d", fd.get());
-
-    return fd.release();
-}
-
-bool adb_command(const std::string& service) {
-    std::string error;
-    unique_fd fd(adb_connect(service, &error));
-    if (fd < 0) {
-        fprintf(stderr, "error: %s\n", error.c_str());
-        return false;
-    }
-
-    if (!adb_status(fd.get(), &error)) {
-        fprintf(stderr, "error: %s\n", error.c_str());
-        return false;
-    }
-
-    ReadOrderlyShutdown(fd.get());
-    return true;
-}
-
-bool adb_query(const std::string& service, std::string* result, std::string* error) {
-    D("adb_query: %s", service.c_str());
-    unique_fd fd(adb_connect(service, error));
-    if (fd < 0) {
-        return false;
-    }
-
-    result->clear();
-    if (!ReadProtocolString(fd.get(), result, error)) {
-        return false;
-    }
-
-    ReadOrderlyShutdown(fd.get());
-    return true;
-}
-
-std::string format_host_command(const char* command) {
-    if (__adb_transport_id) {
-        return android::base::StringPrintf("host-transport-id:%" PRIu64 ":%s", __adb_transport_id,
-                                           command);
-    } else if (__adb_serial) {
-        return android::base::StringPrintf("host-serial:%s:%s", __adb_serial, command);
-    }
-
-    const char* prefix = "host";
-    if (__adb_transport == kTransportUsb) {
-        prefix = "host-usb";
-    } else if (__adb_transport == kTransportLocal) {
-        prefix = "host-local";
-    }
-    return android::base::StringPrintf("%s:%s", prefix, command);
-}
-
-bool adb_get_feature_set(FeatureSet* feature_set, std::string* error) {
-    static FeatureSet* features = nullptr;
-    if (!features) {
-        std::string result;
-        if (adb_query(format_host_command("features"), &result, error)) {
-            features = new FeatureSet(StringToFeatureSet(result));
-        }
-    }
-    if (features) {
-        *feature_set = *features;
-        return true;
-    }
-    feature_set->clear();
-    return false;
-}
diff --git a/adb/client/adb_client.h b/adb/client/adb_client.h
deleted file mode 100644
index 1c6cde7..0000000
--- a/adb/client/adb_client.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <functional>
-#include <optional>
-#include <string>
-
-#include "adb.h"
-#include "adb_unique_fd.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-// Explicitly check the adb server version.
-// All of the commands below do this implicitly.
-// Only the first invocation of this function will check the server version.
-bool adb_check_server_version(std::string* _Nonnull error);
-
-// Connect to adb, connect to the named service, and return a valid fd for
-// interacting with that service upon success or a negative number on failure.
-int adb_connect(std::string_view service, std::string* _Nonnull error);
-
-// Same as above, except returning the TransportId for the service that we've connected to.
-// force_switch_device forces the function to attempt to select a device, even if the service
-// string appears to be a host: service (for use with host services that are device specific, like
-// forward).
-int adb_connect(TransportId* _Nullable id, std::string_view service, std::string* _Nonnull error,
-                bool force_switch_device = false);
-
-// Kill the currently running adb server, if it exists.
-bool adb_kill_server();
-
-// Connect to adb, connect to the named service, returns true if the connection
-// succeeded AND the service returned OKAY. Outputs any returned error otherwise.
-bool adb_command(const std::string& service);
-
-// Connects to the named adb service and fills 'result' with the response.
-// Returns true on success; returns false and fills 'error' on failure.
-bool adb_query(const std::string& service, std::string* _Nonnull result,
-               std::string* _Nonnull error);
-
-// Set the preferred transport to connect to.
-void adb_set_transport(TransportType type, const char* _Nullable serial, TransportId transport_id);
-void adb_get_transport(TransportType* _Nullable type, const char* _Nullable* _Nullable serial,
-                       TransportId* _Nullable transport_id);
-
-// Set the socket specification for the adb server.
-// This function can only be called once, and the argument must live to the end of the process.
-void adb_set_socket_spec(const char* _Nonnull socket_spec);
-
-// Send commands to the current emulator instance. Will fail if there is not
-// exactly one emulator connected (or if you use -s <serial> with a <serial>
-// that does not designate an emulator).
-int adb_send_emulator_command(int argc, const char* _Nonnull* _Nonnull argv,
-                              const char* _Nullable serial);
-
-// Reads a standard adb status response (OKAY|FAIL) and returns true in the
-// event of OKAY, false in the event of FAIL or protocol error.
-bool adb_status(borrowed_fd fd, std::string* _Nonnull error);
-
-// Create a host command corresponding to selected transport type/serial.
-std::string format_host_command(const char* _Nonnull command);
-
-// Get the feature set of the current preferred transport.
-bool adb_get_feature_set(FeatureSet* _Nonnull feature_set, std::string* _Nonnull error);
-
-#if defined(__linux__)
-// Get the path of a file containing the path to the server executable, if the socket spec set via
-// adb_set_socket_spec is a local one.
-std::optional<std::string> adb_get_server_executable_path();
-#endif
-
-// Globally acccesible argv/envp, for the purpose of re-execing adb.
-extern const char* _Nullable * _Nullable __adb_argv;
-extern const char* _Nullable * _Nullable __adb_envp;
-
-// ADB Secure DNS service interface. Used to query what ADB Secure DNS services have been
-// resolved, and to run some kind of callback for each one.
-using adb_secure_foreach_service_callback = std::function<void(
-        const char* _Nonnull service_name, const char* _Nonnull ip_address, uint16_t port)>;
-
-// Queries pairing/connect services that have been discovered and resolved.
-// If |host_name| is not null, run |cb| only for services
-// matching |host_name|. Otherwise, run for all services.
-void adb_secure_foreach_pairing_service(const char* _Nullable service_name,
-                                        adb_secure_foreach_service_callback cb);
-void adb_secure_foreach_connect_service(const char* _Nullable service_name,
-                                        adb_secure_foreach_service_callback cb);
-// Tries to connect to a |service_name| if found. Returns true if found and
-// connected, false otherwise.
-bool adb_secure_connect_by_service_name(const char* _Nonnull service_name);
diff --git a/adb/client/adb_install.cpp b/adb/client/adb_install.cpp
deleted file mode 100644
index f2de0d2..0000000
--- a/adb/client/adb_install.cpp
+++ /dev/null
@@ -1,995 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "adb_install.h"
-
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <algorithm>
-#include <string>
-#include <string_view>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/parsebool.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include "adb.h"
-#include "adb_client.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "client/file_sync_client.h"
-#include "commandline.h"
-#include "fastdeploy.h"
-#include "incremental.h"
-
-using namespace std::literals;
-
-static constexpr int kFastDeployMinApi = 24;
-
-namespace {
-
-enum InstallMode {
-    INSTALL_DEFAULT,
-    INSTALL_PUSH,
-    INSTALL_STREAM,
-    INSTALL_INCREMENTAL,
-};
-
-enum class CmdlineOption { None, Enable, Disable };
-}
-
-static bool can_use_feature(const char* feature) {
-    FeatureSet features;
-    std::string error;
-    if (!adb_get_feature_set(&features, &error)) {
-        fprintf(stderr, "error: %s\n", error.c_str());
-        return false;
-    }
-    return CanUseFeature(features, feature);
-}
-
-static InstallMode best_install_mode() {
-    if (can_use_feature(kFeatureCmd)) {
-        return INSTALL_STREAM;
-    }
-    return INSTALL_PUSH;
-}
-
-static bool is_apex_supported() {
-    return can_use_feature(kFeatureApex);
-}
-
-static bool is_abb_exec_supported() {
-    return can_use_feature(kFeatureAbbExec);
-}
-
-static int pm_command(int argc, const char** argv) {
-    std::string cmd = "pm";
-
-    while (argc-- > 0) {
-        cmd += " " + escape_arg(*argv++);
-    }
-
-    return send_shell_command(cmd);
-}
-
-static int uninstall_app_streamed(int argc, const char** argv) {
-    // 'adb uninstall' takes the same arguments as 'cmd package uninstall' on device
-    std::string cmd = "cmd package";
-    while (argc-- > 0) {
-        // deny the '-k' option until the remaining data/cache can be removed with adb/UI
-        if (strcmp(*argv, "-k") == 0) {
-            printf("The -k option uninstalls the application while retaining the "
-                   "data/cache.\n"
-                   "At the moment, there is no way to remove the remaining data.\n"
-                   "You will have to reinstall the application with the same "
-                   "signature, and fully "
-                   "uninstall it.\n"
-                   "If you truly wish to continue, execute 'adb shell cmd package "
-                   "uninstall -k'.\n");
-            return EXIT_FAILURE;
-        }
-        cmd += " " + escape_arg(*argv++);
-    }
-
-    return send_shell_command(cmd);
-}
-
-static int uninstall_app_legacy(int argc, const char** argv) {
-    /* if the user choose the -k option, we refuse to do it until devices are
-       out with the option to uninstall the remaining data somehow (adb/ui) */
-    for (int i = 1; i < argc; i++) {
-        if (!strcmp(argv[i], "-k")) {
-            printf("The -k option uninstalls the application while retaining the "
-                   "data/cache.\n"
-                   "At the moment, there is no way to remove the remaining data.\n"
-                   "You will have to reinstall the application with the same "
-                   "signature, and fully "
-                   "uninstall it.\n"
-                   "If you truly wish to continue, execute 'adb shell pm uninstall "
-                   "-k'\n.");
-            return EXIT_FAILURE;
-        }
-    }
-
-    /* 'adb uninstall' takes the same arguments as 'pm uninstall' on device */
-    return pm_command(argc, argv);
-}
-
-int uninstall_app(int argc, const char** argv) {
-    if (best_install_mode() == INSTALL_PUSH) {
-        return uninstall_app_legacy(argc, argv);
-    }
-    return uninstall_app_streamed(argc, argv);
-}
-
-static void read_status_line(int fd, char* buf, size_t count) {
-    count--;
-    while (count > 0) {
-        int len = adb_read(fd, buf, count);
-        if (len <= 0) {
-            break;
-        }
-
-        buf += len;
-        count -= len;
-    }
-    *buf = '\0';
-}
-
-static unique_fd send_command(const std::vector<std::string>& cmd_args, std::string* error) {
-    if (is_abb_exec_supported()) {
-        return send_abb_exec_command(cmd_args, error);
-    } else {
-        return unique_fd(adb_connect(android::base::Join(cmd_args, " "), error));
-    }
-}
-
-static int install_app_streamed(int argc, const char** argv, bool use_fastdeploy) {
-    printf("Performing Streamed Install\n");
-
-    // The last argument must be the APK file
-    const char* file = argv[argc - 1];
-    if (!android::base::EndsWithIgnoreCase(file, ".apk") &&
-        !android::base::EndsWithIgnoreCase(file, ".apex")) {
-        error_exit("filename doesn't end .apk or .apex: %s", file);
-    }
-
-    bool is_apex = false;
-    if (android::base::EndsWithIgnoreCase(file, ".apex")) {
-        is_apex = true;
-    }
-    if (is_apex && !is_apex_supported()) {
-        error_exit(".apex is not supported on the target device");
-    }
-
-    if (is_apex && use_fastdeploy) {
-        error_exit("--fastdeploy doesn't support .apex files");
-    }
-
-    if (use_fastdeploy) {
-        auto metadata = extract_metadata(file);
-        if (metadata.has_value()) {
-            // pass all but 1st (command) and last (apk path) parameters through to pm for
-            // session creation
-            std::vector<const char*> pm_args{argv + 1, argv + argc - 1};
-            auto patchFd = install_patch(pm_args.size(), pm_args.data());
-            return stream_patch(file, std::move(metadata.value()), std::move(patchFd));
-        }
-    }
-
-    struct stat sb;
-    if (stat(file, &sb) == -1) {
-        fprintf(stderr, "adb: failed to stat %s: %s\n", file, strerror(errno));
-        return 1;
-    }
-
-    unique_fd local_fd(adb_open(file, O_RDONLY | O_CLOEXEC));
-    if (local_fd < 0) {
-        fprintf(stderr, "adb: failed to open %s: %s\n", file, strerror(errno));
-        return 1;
-    }
-
-#ifdef __linux__
-    posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
-#endif
-
-    const bool use_abb_exec = is_abb_exec_supported();
-    std::string error;
-    std::vector<std::string> cmd_args = {use_abb_exec ? "package" : "exec:cmd package"};
-    cmd_args.reserve(argc + 3);
-
-    // don't copy the APK name, but, copy the rest of the arguments as-is
-    while (argc-- > 1) {
-        if (use_abb_exec) {
-            cmd_args.push_back(*argv++);
-        } else {
-            cmd_args.push_back(escape_arg(*argv++));
-        }
-    }
-
-    // add size parameter [required for streaming installs]
-    // do last to override any user specified value
-    cmd_args.push_back("-S");
-    cmd_args.push_back(android::base::StringPrintf("%" PRIu64, static_cast<uint64_t>(sb.st_size)));
-
-    if (is_apex) {
-        cmd_args.push_back("--apex");
-    }
-
-    unique_fd remote_fd = send_command(cmd_args, &error);
-    if (remote_fd < 0) {
-        fprintf(stderr, "adb: connect error for write: %s\n", error.c_str());
-        return 1;
-    }
-
-    if (!copy_to_file(local_fd.get(), remote_fd.get())) {
-        fprintf(stderr, "adb: failed to install: copy_to_file: %s: %s", file, strerror(errno));
-        return 1;
-    }
-
-    char buf[BUFSIZ];
-    read_status_line(remote_fd.get(), buf, sizeof(buf));
-    if (strncmp("Success", buf, 7) != 0) {
-        fprintf(stderr, "adb: failed to install %s: %s", file, buf);
-        return 1;
-    }
-
-    fputs(buf, stdout);
-    return 0;
-}
-
-static int install_app_legacy(int argc, const char** argv, bool use_fastdeploy) {
-    printf("Performing Push Install\n");
-
-    // Find last APK argument.
-    // All other arguments passed through verbatim.
-    int last_apk = -1;
-    for (int i = argc - 1; i >= 0; i--) {
-        if (android::base::EndsWithIgnoreCase(argv[i], ".apex")) {
-            error_exit("APEX packages are only compatible with Streamed Install");
-        }
-        if (android::base::EndsWithIgnoreCase(argv[i], ".apk")) {
-            last_apk = i;
-            break;
-        }
-    }
-
-    if (last_apk == -1) error_exit("need APK file on command line");
-
-    int result = -1;
-    std::vector<const char*> apk_file = {argv[last_apk]};
-    std::string apk_dest = "/data/local/tmp/" + android::base::Basename(argv[last_apk]);
-    argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */
-
-    if (use_fastdeploy) {
-        auto metadata = extract_metadata(apk_file[0]);
-        if (metadata.has_value()) {
-            auto patchFd = apply_patch_on_device(apk_dest.c_str());
-            int status = stream_patch(apk_file[0], std::move(metadata.value()), std::move(patchFd));
-
-            result = pm_command(argc, argv);
-            delete_device_file(apk_dest);
-
-            return status;
-        }
-    }
-
-    if (do_sync_push(apk_file, apk_dest.c_str(), false, true)) {
-        result = pm_command(argc, argv);
-        delete_device_file(apk_dest);
-    }
-
-    return result;
-}
-
-template <class TimePoint>
-static int ms_between(TimePoint start, TimePoint end) {
-    return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
-}
-
-static int install_app_incremental(int argc, const char** argv, bool wait, bool silent) {
-    using clock = std::chrono::high_resolution_clock;
-    const auto start = clock::now();
-    int first_apk = -1;
-    int last_apk = -1;
-    incremental::Args passthrough_args = {};
-    for (int i = 0; i < argc; ++i) {
-        const auto arg = std::string_view(argv[i]);
-        if (android::base::EndsWithIgnoreCase(arg, ".apk"sv)) {
-            last_apk = i;
-            if (first_apk == -1) {
-                first_apk = i;
-            }
-        } else if (arg.starts_with("install"sv)) {
-            // incremental installation command on the device is the same for all its variations in
-            // the adb, e.g. install-multiple or install-multi-package
-        } else {
-            passthrough_args.push_back(arg);
-        }
-    }
-
-    if (first_apk == -1) {
-        if (!silent) {
-            fprintf(stderr, "error: need at least one APK file on command line\n");
-        }
-        return -1;
-    }
-
-    auto files = incremental::Files{argv + first_apk, argv + last_apk + 1};
-    if (silent) {
-        // For a silent installation we want to do the lightweight check first and bail early and
-        // quietly if it fails.
-        if (!incremental::can_install(files)) {
-            return -1;
-        }
-    }
-
-    printf("Performing Incremental Install\n");
-    auto server_process = incremental::install(files, passthrough_args, silent);
-    if (!server_process) {
-        return -1;
-    }
-
-    const auto end = clock::now();
-    printf("Install command complete in %d ms\n", ms_between(start, end));
-
-    if (wait) {
-        (*server_process).wait();
-    }
-
-    return 0;
-}
-
-static std::pair<InstallMode, std::optional<InstallMode>> calculate_install_mode(
-        InstallMode modeFromArgs, bool fastdeploy, CmdlineOption incremental_request) {
-    if (incremental_request == CmdlineOption::Enable) {
-        if (fastdeploy) {
-            error_exit(
-                    "--incremental and --fast-deploy options are incompatible. "
-                    "Please choose one");
-        }
-    }
-
-    if (modeFromArgs != INSTALL_DEFAULT) {
-        if (incremental_request == CmdlineOption::Enable) {
-            error_exit("--incremental is not compatible with other installation modes");
-        }
-        return {modeFromArgs, std::nullopt};
-    }
-
-    if (incremental_request != CmdlineOption::Disable && !is_abb_exec_supported()) {
-        if (incremental_request == CmdlineOption::None) {
-            incremental_request = CmdlineOption::Disable;
-        } else {
-            error_exit("Device doesn't support incremental installations");
-        }
-    }
-    if (incremental_request == CmdlineOption::None) {
-        // check if the host is ok with incremental by default
-        if (const char* incrementalFromEnv = getenv("ADB_INSTALL_DEFAULT_INCREMENTAL")) {
-            using namespace android::base;
-            auto val = ParseBool(incrementalFromEnv);
-            if (val == ParseBoolResult::kFalse) {
-                incremental_request = CmdlineOption::Disable;
-            }
-        }
-    }
-    if (incremental_request == CmdlineOption::None) {
-        // still ok: let's see if the device allows using incremental by default
-        // it starts feeling like we're looking for an excuse to not to use incremental...
-        std::string error;
-        std::vector<std::string> args = {"settings", "get",
-                                         "enable_adb_incremental_install_default"};
-        auto fd = send_abb_exec_command(args, &error);
-        if (!fd.ok()) {
-            fprintf(stderr, "adb: retrieving the default device installation mode failed: %s",
-                    error.c_str());
-        } else {
-            char buf[BUFSIZ] = {};
-            read_status_line(fd.get(), buf, sizeof(buf));
-            using namespace android::base;
-            auto val = ParseBool(buf);
-            if (val == ParseBoolResult::kFalse) {
-                incremental_request = CmdlineOption::Disable;
-            }
-        }
-    }
-
-    if (incremental_request == CmdlineOption::Enable) {
-        // explicitly requested - no fallback
-        return {INSTALL_INCREMENTAL, std::nullopt};
-    }
-    const auto bestMode = best_install_mode();
-    if (incremental_request == CmdlineOption::None) {
-        // no opinion - use incremental, fallback to regular on a failure.
-        return {INSTALL_INCREMENTAL, bestMode};
-    }
-    // incremental turned off - use the regular best mode without a fallback.
-    return {bestMode, std::nullopt};
-}
-
-static std::vector<const char*> parse_install_mode(std::vector<const char*> argv,
-                                                   InstallMode* install_mode,
-                                                   CmdlineOption* incremental_request,
-                                                   bool* incremental_wait) {
-    *install_mode = INSTALL_DEFAULT;
-    *incremental_request = CmdlineOption::None;
-    *incremental_wait = false;
-
-    std::vector<const char*> passthrough;
-    for (auto&& arg : argv) {
-        if (arg == "--streaming"sv) {
-            *install_mode = INSTALL_STREAM;
-        } else if (arg == "--no-streaming"sv) {
-            *install_mode = INSTALL_PUSH;
-        } else if (strlen(arg) >= "--incr"sv.size() && "--incremental"sv.starts_with(arg)) {
-            *incremental_request = CmdlineOption::Enable;
-        } else if (strlen(arg) >= "--no-incr"sv.size() && "--no-incremental"sv.starts_with(arg)) {
-            *incremental_request = CmdlineOption::Disable;
-        } else if (arg == "--wait"sv) {
-            *incremental_wait = true;
-        } else {
-            passthrough.push_back(arg);
-        }
-    }
-    return passthrough;
-}
-
-static std::vector<const char*> parse_fast_deploy_mode(
-        std::vector<const char*> argv, bool* use_fastdeploy,
-        FastDeploy_AgentUpdateStrategy* agent_update_strategy) {
-    *use_fastdeploy = false;
-    *agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
-
-    std::vector<const char*> passthrough;
-    for (auto&& arg : argv) {
-        if (arg == "--fastdeploy"sv) {
-            *use_fastdeploy = true;
-        } else if (arg == "--no-fastdeploy"sv) {
-            *use_fastdeploy = false;
-        } else if (arg == "--force-agent"sv) {
-            *agent_update_strategy = FastDeploy_AgentUpdateAlways;
-        } else if (arg == "--date-check-agent"sv) {
-            *agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp;
-        } else if (arg == "--version-check-agent"sv) {
-            *agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
-        } else {
-            passthrough.push_back(arg);
-        }
-    }
-    return passthrough;
-}
-
-int install_app(int argc, const char** argv) {
-    InstallMode install_mode = INSTALL_DEFAULT;
-    auto incremental_request = CmdlineOption::None;
-    bool incremental_wait = false;
-
-    bool use_fastdeploy = false;
-    FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
-
-    auto unused_argv = parse_install_mode({argv, argv + argc}, &install_mode, &incremental_request,
-                                          &incremental_wait);
-    auto passthrough_argv =
-            parse_fast_deploy_mode(std::move(unused_argv), &use_fastdeploy, &agent_update_strategy);
-
-    auto [primary_mode, fallback_mode] =
-            calculate_install_mode(install_mode, use_fastdeploy, incremental_request);
-    if ((primary_mode == INSTALL_STREAM ||
-         fallback_mode.value_or(INSTALL_PUSH) == INSTALL_STREAM) &&
-        best_install_mode() == INSTALL_PUSH) {
-        error_exit("Attempting to use streaming install on unsupported device");
-    }
-
-    if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) {
-        fprintf(stderr,
-                "Fast Deploy is only compatible with devices of API version %d or higher, "
-                "ignoring.\n",
-                kFastDeployMinApi);
-        use_fastdeploy = false;
-    }
-    fastdeploy_set_agent_update_strategy(agent_update_strategy);
-
-    if (passthrough_argv.size() < 2) {
-        error_exit("install requires an apk argument");
-    }
-
-    auto run_install_mode = [&](InstallMode install_mode, bool silent) {
-        switch (install_mode) {
-            case INSTALL_PUSH:
-                return install_app_legacy(passthrough_argv.size(), passthrough_argv.data(),
-                                          use_fastdeploy);
-            case INSTALL_STREAM:
-                return install_app_streamed(passthrough_argv.size(), passthrough_argv.data(),
-                                            use_fastdeploy);
-            case INSTALL_INCREMENTAL:
-                return install_app_incremental(passthrough_argv.size(), passthrough_argv.data(),
-                                               incremental_wait, silent);
-            case INSTALL_DEFAULT:
-            default:
-                error_exit("invalid install mode");
-        }
-    };
-    auto res = run_install_mode(primary_mode, fallback_mode.has_value());
-    if (res && fallback_mode.value_or(primary_mode) != primary_mode) {
-        res = run_install_mode(*fallback_mode, false);
-    }
-    return res;
-}
-
-static int install_multiple_app_streamed(int argc, const char** argv) {
-    // Find all APK arguments starting at end.
-    // All other arguments passed through verbatim.
-    int first_apk = -1;
-    uint64_t total_size = 0;
-    for (int i = argc - 1; i >= 0; i--) {
-        const char* file = argv[i];
-        if (android::base::EndsWithIgnoreCase(argv[i], ".apex")) {
-            error_exit("APEX packages are not compatible with install-multiple");
-        }
-
-        if (android::base::EndsWithIgnoreCase(file, ".apk") ||
-            android::base::EndsWithIgnoreCase(file, ".dm") ||
-            android::base::EndsWithIgnoreCase(file, ".fsv_sig")) {
-            struct stat sb;
-            if (stat(file, &sb) == -1) perror_exit("failed to stat \"%s\"", file);
-            total_size += sb.st_size;
-            first_apk = i;
-        } else {
-            break;
-        }
-    }
-
-    if (first_apk == -1) error_exit("need APK file on command line");
-
-    const bool use_abb_exec = is_abb_exec_supported();
-    const std::string install_cmd =
-            use_abb_exec ? "package"
-                         : best_install_mode() == INSTALL_PUSH ? "exec:pm" : "exec:cmd package";
-
-    std::vector<std::string> cmd_args = {install_cmd, "install-create", "-S",
-                                         std::to_string(total_size)};
-    cmd_args.reserve(first_apk + 4);
-    for (int i = 1; i < first_apk; i++) {
-        if (use_abb_exec) {
-            cmd_args.push_back(argv[i]);
-        } else {
-            cmd_args.push_back(escape_arg(argv[i]));
-        }
-    }
-
-    // Create install session
-    std::string error;
-    char buf[BUFSIZ];
-    {
-        unique_fd fd = send_command(cmd_args, &error);
-        if (fd < 0) {
-            fprintf(stderr, "adb: connect error for create: %s\n", error.c_str());
-            return EXIT_FAILURE;
-        }
-        read_status_line(fd.get(), buf, sizeof(buf));
-    }
-
-    int session_id = -1;
-    if (!strncmp("Success", buf, 7)) {
-        char* start = strrchr(buf, '[');
-        char* end = strrchr(buf, ']');
-        if (start && end) {
-            *end = '\0';
-            session_id = strtol(start + 1, nullptr, 10);
-        }
-    }
-    if (session_id < 0) {
-        fprintf(stderr, "adb: failed to create session\n");
-        fputs(buf, stderr);
-        return EXIT_FAILURE;
-    }
-    const auto session_id_str = std::to_string(session_id);
-
-    // Valid session, now stream the APKs
-    bool success = true;
-    for (int i = first_apk; i < argc; i++) {
-        const char* file = argv[i];
-        struct stat sb;
-        if (stat(file, &sb) == -1) {
-            fprintf(stderr, "adb: failed to stat \"%s\": %s\n", file, strerror(errno));
-            success = false;
-            goto finalize_session;
-        }
-
-        std::vector<std::string> cmd_args = {
-                install_cmd,
-                "install-write",
-                "-S",
-                std::to_string(sb.st_size),
-                session_id_str,
-                android::base::Basename(file),
-                "-",
-        };
-
-        unique_fd local_fd(adb_open(file, O_RDONLY | O_CLOEXEC));
-        if (local_fd < 0) {
-            fprintf(stderr, "adb: failed to open \"%s\": %s\n", file, strerror(errno));
-            success = false;
-            goto finalize_session;
-        }
-
-        std::string error;
-        unique_fd remote_fd = send_command(cmd_args, &error);
-        if (remote_fd < 0) {
-            fprintf(stderr, "adb: connect error for write: %s\n", error.c_str());
-            success = false;
-            goto finalize_session;
-        }
-
-        if (!copy_to_file(local_fd.get(), remote_fd.get())) {
-            fprintf(stderr, "adb: failed to write \"%s\": %s\n", file, strerror(errno));
-            success = false;
-            goto finalize_session;
-        }
-
-        read_status_line(remote_fd.get(), buf, sizeof(buf));
-
-        if (strncmp("Success", buf, 7)) {
-            fprintf(stderr, "adb: failed to write \"%s\"\n", file);
-            fputs(buf, stderr);
-            success = false;
-            goto finalize_session;
-        }
-    }
-
-finalize_session:
-    // Commit session if we streamed everything okay; otherwise abandon.
-    std::vector<std::string> service_args = {
-            install_cmd,
-            success ? "install-commit" : "install-abandon",
-            session_id_str,
-    };
-    {
-        unique_fd fd = send_command(service_args, &error);
-        if (fd < 0) {
-            fprintf(stderr, "adb: connect error for finalize: %s\n", error.c_str());
-            return EXIT_FAILURE;
-        }
-        read_status_line(fd.get(), buf, sizeof(buf));
-    }
-    if (!success) return EXIT_FAILURE;
-
-    if (strncmp("Success", buf, 7)) {
-        fprintf(stderr, "adb: failed to finalize session\n");
-        fputs(buf, stderr);
-        return EXIT_FAILURE;
-    }
-
-    fputs(buf, stdout);
-    return EXIT_SUCCESS;
-}
-
-int install_multiple_app(int argc, const char** argv) {
-    InstallMode install_mode = INSTALL_DEFAULT;
-    auto incremental_request = CmdlineOption::None;
-    bool incremental_wait = false;
-    bool use_fastdeploy = false;
-
-    auto passthrough_argv = parse_install_mode({argv + 1, argv + argc}, &install_mode,
-                                               &incremental_request, &incremental_wait);
-
-    auto [primary_mode, fallback_mode] =
-            calculate_install_mode(install_mode, use_fastdeploy, incremental_request);
-    if ((primary_mode == INSTALL_STREAM ||
-         fallback_mode.value_or(INSTALL_PUSH) == INSTALL_STREAM) &&
-        best_install_mode() == INSTALL_PUSH) {
-        error_exit("Attempting to use streaming install on unsupported device");
-    }
-
-    auto run_install_mode = [&](InstallMode install_mode, bool silent) {
-        switch (install_mode) {
-            case INSTALL_PUSH:
-            case INSTALL_STREAM:
-                return install_multiple_app_streamed(passthrough_argv.size(),
-                                                     passthrough_argv.data());
-            case INSTALL_INCREMENTAL:
-                return install_app_incremental(passthrough_argv.size(), passthrough_argv.data(),
-                                               incremental_wait, silent);
-            case INSTALL_DEFAULT:
-            default:
-                error_exit("invalid install mode");
-        }
-    };
-    auto res = run_install_mode(primary_mode, fallback_mode.has_value());
-    if (res && fallback_mode.value_or(primary_mode) != primary_mode) {
-        res = run_install_mode(*fallback_mode, false);
-    }
-    return res;
-}
-
-int install_multi_package(int argc, const char** argv) {
-    // Find all APK arguments starting at end.
-    // All other arguments passed through verbatim.
-    bool apex_found = false;
-    int first_package = -1;
-    for (int i = argc - 1; i >= 0; i--) {
-        const char* file = argv[i];
-        if (android::base::EndsWithIgnoreCase(file, ".apk") ||
-            android::base::EndsWithIgnoreCase(file, ".apex")) {
-            first_package = i;
-            if (android::base::EndsWithIgnoreCase(file, ".apex")) {
-                apex_found = true;
-            }
-        } else {
-            break;
-        }
-    }
-
-    if (first_package == -1) error_exit("need APK or APEX files on command line");
-
-    if (best_install_mode() == INSTALL_PUSH) {
-        fprintf(stderr, "adb: multi-package install is not supported on this device\n");
-        return EXIT_FAILURE;
-    }
-
-    const bool use_abb_exec = is_abb_exec_supported();
-    const std::string install_cmd = use_abb_exec ? "package" : "exec:cmd package";
-
-    std::vector<std::string> multi_package_cmd_args = {install_cmd, "install-create",
-                                                       "--multi-package"};
-
-    multi_package_cmd_args.reserve(first_package + 4);
-    for (int i = 1; i < first_package; i++) {
-        if (use_abb_exec) {
-            multi_package_cmd_args.push_back(argv[i]);
-        } else {
-            multi_package_cmd_args.push_back(escape_arg(argv[i]));
-        }
-    }
-
-    if (apex_found) {
-        multi_package_cmd_args.emplace_back("--staged");
-    }
-
-    // Create multi-package install session
-    std::string error;
-    char buf[BUFSIZ];
-    {
-        unique_fd fd = send_command(multi_package_cmd_args, &error);
-        if (fd < 0) {
-            fprintf(stderr, "adb: connect error for create multi-package: %s\n", error.c_str());
-            return EXIT_FAILURE;
-        }
-        read_status_line(fd.get(), buf, sizeof(buf));
-    }
-
-    int parent_session_id = -1;
-    if (!strncmp("Success", buf, 7)) {
-        char* start = strrchr(buf, '[');
-        char* end = strrchr(buf, ']');
-        if (start && end) {
-            *end = '\0';
-            parent_session_id = strtol(start + 1, nullptr, 10);
-        }
-    }
-    if (parent_session_id < 0) {
-        fprintf(stderr, "adb: failed to create multi-package session\n");
-        fputs(buf, stderr);
-        return EXIT_FAILURE;
-    }
-    const auto parent_session_id_str = std::to_string(parent_session_id);
-
-    fprintf(stdout, "Created parent session ID %d.\n", parent_session_id);
-
-    std::vector<int> session_ids;
-
-    // Valid session, now create the individual sessions and stream the APKs
-    int success = EXIT_FAILURE;
-    std::vector<std::string> individual_cmd_args = {install_cmd, "install-create"};
-    for (int i = 1; i < first_package; i++) {
-        if (use_abb_exec) {
-            individual_cmd_args.push_back(argv[i]);
-        } else {
-            individual_cmd_args.push_back(escape_arg(argv[i]));
-        }
-    }
-    if (apex_found) {
-        individual_cmd_args.emplace_back("--staged");
-    }
-
-    std::vector<std::string> individual_apex_cmd_args;
-    if (apex_found) {
-        individual_apex_cmd_args = individual_cmd_args;
-        individual_apex_cmd_args.emplace_back("--apex");
-    }
-
-    std::vector<std::string> add_session_cmd_args = {
-            install_cmd,
-            "install-add-session",
-            parent_session_id_str,
-    };
-
-    for (int i = first_package; i < argc; i++) {
-        const char* file = argv[i];
-        char buf[BUFSIZ];
-        {
-            unique_fd fd;
-            // Create individual install session
-            if (android::base::EndsWithIgnoreCase(file, ".apex")) {
-                fd = send_command(individual_apex_cmd_args, &error);
-            } else {
-                fd = send_command(individual_cmd_args, &error);
-            }
-            if (fd < 0) {
-                fprintf(stderr, "adb: connect error for create: %s\n", error.c_str());
-                goto finalize_multi_package_session;
-            }
-            read_status_line(fd.get(), buf, sizeof(buf));
-        }
-
-        int session_id = -1;
-        if (!strncmp("Success", buf, 7)) {
-            char* start = strrchr(buf, '[');
-            char* end = strrchr(buf, ']');
-            if (start && end) {
-                *end = '\0';
-                session_id = strtol(start + 1, nullptr, 10);
-            }
-        }
-        if (session_id < 0) {
-            fprintf(stderr, "adb: failed to create multi-package session\n");
-            fputs(buf, stderr);
-            goto finalize_multi_package_session;
-        }
-        const auto session_id_str = std::to_string(session_id);
-
-        fprintf(stdout, "Created child session ID %d.\n", session_id);
-        session_ids.push_back(session_id);
-
-        // Support splitAPKs by allowing the notation split1.apk:split2.apk:split3.apk as argument.
-        std::vector<std::string> splits = android::base::Split(file, ":");
-
-        for (const std::string& split : splits) {
-            struct stat sb;
-            if (stat(split.c_str(), &sb) == -1) {
-                fprintf(stderr, "adb: failed to stat %s: %s\n", split.c_str(), strerror(errno));
-                goto finalize_multi_package_session;
-            }
-
-            std::vector<std::string> cmd_args = {
-                    install_cmd,
-                    "install-write",
-                    "-S",
-                    std::to_string(sb.st_size),
-                    session_id_str,
-                    android::base::StringPrintf("%d_%s", i, android::base::Basename(file).c_str()),
-                    "-",
-            };
-
-            unique_fd local_fd(adb_open(split.c_str(), O_RDONLY | O_CLOEXEC));
-            if (local_fd < 0) {
-                fprintf(stderr, "adb: failed to open %s: %s\n", split.c_str(), strerror(errno));
-                goto finalize_multi_package_session;
-            }
-
-            std::string error;
-            unique_fd remote_fd = send_command(cmd_args, &error);
-            if (remote_fd < 0) {
-                fprintf(stderr, "adb: connect error for write: %s\n", error.c_str());
-                goto finalize_multi_package_session;
-            }
-
-            if (!copy_to_file(local_fd.get(), remote_fd.get())) {
-                fprintf(stderr, "adb: failed to write %s: %s\n", split.c_str(), strerror(errno));
-                goto finalize_multi_package_session;
-            }
-
-            read_status_line(remote_fd.get(), buf, sizeof(buf));
-
-            if (strncmp("Success", buf, 7)) {
-                fprintf(stderr, "adb: failed to write %s\n", split.c_str());
-                fputs(buf, stderr);
-                goto finalize_multi_package_session;
-            }
-        }
-        add_session_cmd_args.push_back(std::to_string(session_id));
-    }
-
-    {
-        unique_fd fd = send_command(add_session_cmd_args, &error);
-        if (fd < 0) {
-            fprintf(stderr, "adb: connect error for install-add-session: %s\n", error.c_str());
-            goto finalize_multi_package_session;
-        }
-        read_status_line(fd.get(), buf, sizeof(buf));
-    }
-
-    if (strncmp("Success", buf, 7)) {
-        fprintf(stderr, "adb: failed to link sessions (%s)\n",
-                android::base::Join(add_session_cmd_args, " ").c_str());
-        fputs(buf, stderr);
-        goto finalize_multi_package_session;
-    }
-
-    // no failures means we can proceed with the assumption of success
-    success = 0;
-
-finalize_multi_package_session:
-    // Commit session if we streamed everything okay; otherwise abandon
-    std::vector<std::string> service_args = {
-            install_cmd,
-            success == 0 ? "install-commit" : "install-abandon",
-            parent_session_id_str,
-    };
-
-    {
-        unique_fd fd = send_command(service_args, &error);
-        if (fd < 0) {
-            fprintf(stderr, "adb: connect error for finalize: %s\n", error.c_str());
-            return EXIT_FAILURE;
-        }
-        read_status_line(fd.get(), buf, sizeof(buf));
-    }
-
-    if (!strncmp("Success", buf, 7)) {
-        fputs(buf, stdout);
-        if (success == 0) {
-            return 0;
-        }
-    } else {
-        fprintf(stderr, "adb: failed to finalize session\n");
-        fputs(buf, stderr);
-    }
-
-    session_ids.push_back(parent_session_id);
-    // try to abandon all remaining sessions
-    for (std::size_t i = 0; i < session_ids.size(); i++) {
-        std::vector<std::string> service_args = {
-                install_cmd,
-                "install-abandon",
-                std::to_string(session_ids[i]),
-        };
-        fprintf(stderr, "Attempting to abandon session ID %d\n", session_ids[i]);
-        unique_fd fd = send_command(service_args, &error);
-        if (fd < 0) {
-            fprintf(stderr, "adb: connect error for finalize: %s\n", error.c_str());
-            continue;
-        }
-        read_status_line(fd.get(), buf, sizeof(buf));
-    }
-    return EXIT_FAILURE;
-}
-
-int delete_device_file(const std::string& filename) {
-    // http://b/17339227 "Sideloading a Readonly File Results in a Prompt to
-    // Delete" caused us to add `-f` here, to avoid the equivalent of the `-i`
-    // prompt that you get from BSD rm (used in Android 5) if you have a
-    // non-writable file and stdin is a tty (which is true for old versions of
-    // adbd).
-    //
-    // Unfortunately, `rm -f` requires Android 4.3, so that workaround broke
-    // earlier Android releases. This was reported as http://b/37704384 "adb
-    // install -r passes invalid argument to rm on Android 4.1" and
-    // http://b/37035817 "ADB Fails: rm failed for -f, No such file or
-    // directory".
-    //
-    // Testing on a variety of devices and emulators shows that redirecting
-    // stdin is sufficient to avoid the pseudo-`-i`, and works on toolbox,
-    // BSD, and toybox versions of rm.
-    return send_shell_command("rm " + escape_arg(filename) + " </dev/null");
-}
diff --git a/adb/client/adb_install.h b/adb/client/adb_install.h
deleted file mode 100644
index 9946604..0000000
--- a/adb/client/adb_install.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <string>
-
-int install_app(int argc, const char** argv);
-int install_multiple_app(int argc, const char** argv);
-int install_multi_package(int argc, const char** argv);
-int uninstall_app(int argc, const char** argv);
-
-int delete_device_file(const std::string& filename);
-int delete_host_file(const std::string& filename);
-
diff --git a/adb/client/adb_wifi.cpp b/adb/client/adb_wifi.cpp
deleted file mode 100644
index fa71028..0000000
--- a/adb/client/adb_wifi.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adb_wifi.h"
-
-#include <fstream>
-#include <random>
-#include <thread>
-
-#include <adb/crypto/key.h>
-#include <adb/crypto/x509_generator.h>
-#include <android-base/file.h>
-#include <android-base/parsenetaddress.h>
-#include "client/pairing/pairing_client.h"
-
-#include "adb_auth.h"
-#include "adb_known_hosts.pb.h"
-#include "adb_utils.h"
-#include "client/adb_client.h"
-#include "sysdeps.h"
-
-using adbwifi::pairing::PairingClient;
-using namespace adb::crypto;
-
-struct PairingResultWaiter {
-    std::mutex mutex_;
-    std::condition_variable cv_;
-    std::optional<bool> is_valid_;
-    PeerInfo peer_info_;
-
-    static void OnResult(const PeerInfo* peer_info, void* opaque) {
-        CHECK(opaque);
-        auto* p = reinterpret_cast<PairingResultWaiter*>(opaque);
-        {
-            std::lock_guard<std::mutex> lock(p->mutex_);
-            if (peer_info) {
-                memcpy(&(p->peer_info_), peer_info, sizeof(PeerInfo));
-            }
-            p->is_valid_ = (peer_info != nullptr);
-        }
-        p->cv_.notify_one();
-    }
-};  // PairingResultWaiter
-
-void adb_wifi_init() {}
-
-static std::vector<uint8_t> stringToUint8(const std::string& str) {
-    auto* p8 = reinterpret_cast<const uint8_t*>(str.data());
-    return std::vector<uint8_t>(p8, p8 + str.length());
-}
-
-// Tries to replace the |old_file| with |new_file|.
-// On success, then |old_file| has been removed and replaced with the
-// contents of |new_file|, |new_file| will be removed, and only |old_file| will
-// remain.
-// On failure, both files will be unchanged.
-// |new_file| must exist, but |old_file| does not need to exist.
-bool SafeReplaceFile(std::string_view old_file, std::string_view new_file) {
-    std::string to_be_deleted(old_file);
-    to_be_deleted += ".tbd";
-
-    bool old_renamed = true;
-    if (adb_rename(old_file.data(), to_be_deleted.c_str()) != 0) {
-        // Don't exit here. This is not necessarily an error, because |old_file|
-        // may not exist.
-        PLOG(INFO) << "Failed to rename " << old_file;
-        old_renamed = false;
-    }
-
-    if (adb_rename(new_file.data(), old_file.data()) != 0) {
-        PLOG(ERROR) << "Unable to rename file (" << new_file << " => " << old_file << ")";
-        if (old_renamed) {
-            // Rename the .tbd file back to it's original name
-            adb_rename(to_be_deleted.c_str(), old_file.data());
-        }
-        return false;
-    }
-
-    adb_unlink(to_be_deleted.c_str());
-    return true;
-}
-
-static std::string get_user_known_hosts_path() {
-    return adb_get_android_dir_path() + OS_PATH_SEPARATOR + "adb_known_hosts.pb";
-}
-
-bool load_known_hosts_from_file(const std::string& path, adb::proto::AdbKnownHosts& known_hosts) {
-    // Check for file existence.
-    struct stat buf;
-    if (stat(path.c_str(), &buf) == -1) {
-        LOG(INFO) << "Known hosts file [" << path << "] does not exist...";
-        return false;
-    }
-
-    std::ifstream file(path, std::ios::binary);
-    if (!file) {
-        PLOG(ERROR) << "Unable to open [" << path << "].";
-        return false;
-    }
-
-    if (!known_hosts.ParseFromIstream(&file)) {
-        PLOG(ERROR) << "Failed to parse [" << path << "]. Deleting it as it may be corrupted.";
-        adb_unlink(path.c_str());
-        return false;
-    }
-
-    return true;
-}
-
-static bool write_known_host_to_file(std::string& known_host) {
-    std::string path = get_user_known_hosts_path();
-    if (path.empty()) {
-        PLOG(ERROR) << "Error getting user known hosts filename";
-        return false;
-    }
-
-    adb::proto::AdbKnownHosts known_hosts;
-    load_known_hosts_from_file(path, known_hosts);
-    auto* host_info = known_hosts.add_host_infos();
-    host_info->set_guid(known_host);
-
-    std::unique_ptr<TemporaryFile> temp_file(new TemporaryFile(adb_get_android_dir_path()));
-    if (temp_file->fd == -1) {
-        PLOG(ERROR) << "Failed to open [" << temp_file->path << "] for writing";
-        return false;
-    }
-
-    if (!known_hosts.SerializeToFileDescriptor(temp_file->fd)) {
-        LOG(ERROR) << "Unable to write out adb_knowns_hosts";
-        return false;
-    }
-    temp_file->DoNotRemove();
-    std::string temp_file_name(temp_file->path);
-    temp_file.reset();
-
-    // Replace the existing adb_known_hosts with the new one
-    if (!SafeReplaceFile(path, temp_file_name.c_str())) {
-        LOG(ERROR) << "Failed to replace old adb_known_hosts";
-        adb_unlink(temp_file_name.c_str());
-        return false;
-    }
-    chmod(path.c_str(), S_IRUSR | S_IWUSR | S_IRGRP);
-
-    return true;
-}
-
-bool adb_wifi_is_known_host(const std::string& host) {
-    std::string path = get_user_known_hosts_path();
-    if (path.empty()) {
-        PLOG(ERROR) << "Error getting user known hosts filename";
-        return false;
-    }
-
-    adb::proto::AdbKnownHosts known_hosts;
-    if (!load_known_hosts_from_file(path, known_hosts)) {
-        return false;
-    }
-
-    for (const auto& host_info : known_hosts.host_infos()) {
-        if (host == host_info.guid()) {
-            return true;
-        }
-    }
-    return false;
-}
-
-void adb_wifi_pair_device(const std::string& host, const std::string& password,
-                          std::string& response) {
-    // Check the address for a valid address and port.
-    std::string parsed_host;
-    std::string err;
-    int port = -1;
-    if (!android::base::ParseNetAddress(host, &parsed_host, &port, nullptr, &err)) {
-        response = "Failed to parse address for pairing: " + err;
-        return;
-    }
-    if (port <= 0 || port > 65535) {
-        response = "Invalid port while parsing address [" + host + "]";
-        return;
-    }
-
-    auto priv_key = adb_auth_get_user_privkey();
-    auto x509_cert = GenerateX509Certificate(priv_key.get());
-    if (!x509_cert) {
-        LOG(ERROR) << "Unable to create X509 certificate for pairing";
-        return;
-    }
-    auto cert_str = X509ToPEMString(x509_cert.get());
-    auto priv_str = Key::ToPEMString(priv_key.get());
-
-    // Send our public key on pairing success
-    PeerInfo system_info = {};
-    system_info.type = ADB_RSA_PUB_KEY;
-    std::string public_key = adb_auth_get_userkey();
-    CHECK_LE(public_key.size(), sizeof(system_info.data) - 1);  // -1 for null byte
-    memcpy(system_info.data, public_key.data(), public_key.size());
-
-    auto pswd8 = stringToUint8(password);
-    auto cert8 = stringToUint8(cert_str);
-    auto priv8 = stringToUint8(priv_str);
-
-    auto client = PairingClient::Create(pswd8, system_info, cert8, priv8);
-    if (client == nullptr) {
-        response = "Failed: unable to create pairing client.";
-        return;
-    }
-
-    PairingResultWaiter waiter;
-    std::unique_lock<std::mutex> lock(waiter.mutex_);
-    if (!client->Start(host, waiter.OnResult, &waiter)) {
-        response = "Failed: Unable to start pairing client.";
-        return;
-    }
-    waiter.cv_.wait(lock, [&]() { return waiter.is_valid_.has_value(); });
-    if (!*(waiter.is_valid_)) {
-        response = "Failed: Wrong password or connection was dropped.";
-        return;
-    }
-
-    if (waiter.peer_info_.type != ADB_DEVICE_GUID) {
-        response = "Failed: Successfully paired but server returned unknown response=";
-        response += waiter.peer_info_.type;
-        return;
-    }
-
-    std::string device_guid = reinterpret_cast<const char*>(waiter.peer_info_.data);
-    response = "Successfully paired to " + host + " [guid=" + device_guid + "]";
-
-    // Write to adb_known_hosts
-    write_known_host_to_file(device_guid);
-    // Try to auto-connect.
-    adb_secure_connect_by_service_name(device_guid.c_str());
-}
diff --git a/adb/client/auth.cpp b/adb/client/auth.cpp
deleted file mode 100644
index 35264c7..0000000
--- a/adb/client/auth.cpp
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#define TRACE_TAG AUTH
-
-#include <dirent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if defined(__linux__)
-#include <sys/inotify.h>
-#endif
-
-#include <map>
-#include <mutex>
-#include <set>
-#include <string>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <adb/crypto/x509_generator.h>
-#include <adb/tls/adb_ca_list.h>
-#include <adb/tls/tls_connection.h>
-#include <android-base/errors.h>
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <crypto_utils/android_pubkey.h>
-#include <openssl/base64.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/pem.h>
-#include <openssl/rsa.h>
-#include <openssl/sha.h>
-
-#include "adb.h"
-#include "adb_auth.h"
-#include "adb_io.h"
-#include "adb_utils.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-static std::mutex& g_keys_mutex = *new std::mutex;
-static std::map<std::string, std::shared_ptr<RSA>>& g_keys =
-    *new std::map<std::string, std::shared_ptr<RSA>>;
-static std::map<int, std::string>& g_monitored_paths = *new std::map<int, std::string>;
-
-using namespace adb::crypto;
-using namespace adb::tls;
-
-static bool generate_key(const std::string& file) {
-    LOG(INFO) << "generate_key(" << file << ")...";
-
-    auto rsa_2048 = CreateRSA2048Key();
-    if (!rsa_2048) {
-        LOG(ERROR) << "Unable to create key";
-        return false;
-    }
-    std::string pubkey;
-
-    RSA* rsa = EVP_PKEY_get0_RSA(rsa_2048->GetEvpPkey());
-    CHECK(rsa);
-
-    if (!CalculatePublicKey(&pubkey, rsa)) {
-        LOG(ERROR) << "failed to calculate public key";
-        return false;
-    }
-
-    mode_t old_mask = umask(077);
-
-    std::unique_ptr<FILE, decltype(&fclose)> f(nullptr, &fclose);
-    f.reset(fopen(file.c_str(), "w"));
-    if (!f) {
-        PLOG(ERROR) << "Failed to open " << file;
-        umask(old_mask);
-        return false;
-    }
-
-    umask(old_mask);
-
-    if (!PEM_write_PrivateKey(f.get(), rsa_2048->GetEvpPkey(), nullptr, nullptr, 0, nullptr,
-                              nullptr)) {
-        LOG(ERROR) << "Failed to write key";
-        return false;
-    }
-
-    if (!android::base::WriteStringToFile(pubkey, file + ".pub")) {
-        PLOG(ERROR) << "failed to write public key";
-        return false;
-    }
-
-    return true;
-}
-
-static std::string hash_key(RSA* key) {
-    unsigned char* pubkey = nullptr;
-    int len = i2d_RSA_PUBKEY(key, &pubkey);
-    if (len < 0) {
-        LOG(ERROR) << "failed to encode RSA public key";
-        return std::string();
-    }
-
-    std::string result;
-    result.resize(SHA256_DIGEST_LENGTH);
-    SHA256(pubkey, len, reinterpret_cast<unsigned char*>(&result[0]));
-    OPENSSL_free(pubkey);
-    return result;
-}
-
-static std::shared_ptr<RSA> read_key_file(const std::string& file) {
-    std::unique_ptr<FILE, decltype(&fclose)> fp(fopen(file.c_str(), "r"), fclose);
-    if (!fp) {
-        PLOG(ERROR) << "Failed to open '" << file << "'";
-        return nullptr;
-    }
-
-    RSA* key = RSA_new();
-    if (!PEM_read_RSAPrivateKey(fp.get(), &key, nullptr, nullptr)) {
-        LOG(ERROR) << "Failed to read key from '" << file << "'";
-        ERR_print_errors_fp(stderr);
-        RSA_free(key);
-        return nullptr;
-    }
-
-    return std::shared_ptr<RSA>(key, RSA_free);
-}
-
-static bool load_key(const std::string& file) {
-    std::shared_ptr<RSA> key = read_key_file(file);
-    if (!key) {
-        return false;
-    }
-
-    std::lock_guard<std::mutex> lock(g_keys_mutex);
-    std::string fingerprint = hash_key(key.get());
-    if (g_keys.find(fingerprint) != g_keys.end()) {
-        LOG(INFO) << "ignoring already-loaded key: " << file;
-    } else {
-        LOG(INFO) << "Loaded fingerprint=[" << SHA256BitsToHexString(fingerprint) << "]";
-        g_keys[fingerprint] = std::move(key);
-    }
-    return true;
-}
-
-static bool load_keys(const std::string& path, bool allow_dir = true) {
-    LOG(INFO) << "load_keys '" << path << "'...";
-
-    struct stat st;
-    if (stat(path.c_str(), &st) != 0) {
-        PLOG(ERROR) << "failed to stat '" << path << "'";
-        return false;
-    }
-
-    if (S_ISREG(st.st_mode)) {
-        return load_key(path);
-    } else if (S_ISDIR(st.st_mode)) {
-        if (!allow_dir) {
-            // inotify isn't recursive. It would break expectations to load keys in nested
-            // directories but not monitor them for new keys.
-            LOG(WARNING) << "refusing to recurse into directory '" << path << "'";
-            return false;
-        }
-
-        std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir);
-        if (!dir) {
-            PLOG(ERROR) << "failed to open directory '" << path << "'";
-            return false;
-        }
-
-        bool result = false;
-        while (struct dirent* dent = readdir(dir.get())) {
-            std::string name = dent->d_name;
-
-            // We can't use dent->d_type here because it's not available on Windows.
-            if (name == "." || name == "..") {
-                continue;
-            }
-
-            if (!android::base::EndsWith(name, ".adb_key")) {
-                LOG(INFO) << "skipping non-adb_key '" << path << "/" << name << "'";
-                continue;
-            }
-
-            result |= load_key((path + OS_PATH_SEPARATOR + name));
-        }
-        return result;
-    }
-
-    LOG(ERROR) << "unexpected type for '" << path << "': 0x" << std::hex << st.st_mode;
-    return false;
-}
-
-static std::string get_user_key_path() {
-    return adb_get_android_dir_path() + OS_PATH_SEPARATOR + "adbkey";
-}
-
-static bool load_userkey() {
-    std::string path = get_user_key_path();
-    if (path.empty()) {
-        PLOG(ERROR) << "Error getting user key filename";
-        return false;
-    }
-
-    struct stat buf;
-    if (stat(path.c_str(), &buf) == -1) {
-        LOG(INFO) << "User key '" << path << "' does not exist...";
-        if (!generate_key(path)) {
-            LOG(ERROR) << "Failed to generate new key";
-            return false;
-        }
-    }
-
-    return load_key(path);
-}
-
-static std::set<std::string> get_vendor_keys() {
-    const char* adb_keys_path = getenv("ADB_VENDOR_KEYS");
-    if (adb_keys_path == nullptr) {
-        return std::set<std::string>();
-    }
-
-    std::set<std::string> result;
-    for (const auto& path : android::base::Split(adb_keys_path, ENV_PATH_SEPARATOR_STR)) {
-        result.emplace(path);
-    }
-    return result;
-}
-
-std::deque<std::shared_ptr<RSA>> adb_auth_get_private_keys() {
-    std::deque<std::shared_ptr<RSA>> result;
-
-    // Copy all the currently known keys.
-    std::lock_guard<std::mutex> lock(g_keys_mutex);
-    for (const auto& it : g_keys) {
-        result.push_back(it.second);
-    }
-
-    // Add a sentinel to the list. Our caller uses this to mean "out of private keys,
-    // but try using the public key" (the empty deque could otherwise mean this _or_
-    // that this function hasn't been called yet to request the keys).
-    result.push_back(nullptr);
-
-    return result;
-}
-
-static std::string adb_auth_sign(RSA* key, const char* token, size_t token_size) {
-    if (token_size != TOKEN_SIZE) {
-        D("Unexpected token size %zd", token_size);
-        return nullptr;
-    }
-
-    std::string result;
-    result.resize(MAX_PAYLOAD);
-
-    unsigned int len;
-    if (!RSA_sign(NID_sha1, reinterpret_cast<const uint8_t*>(token), token_size,
-                  reinterpret_cast<uint8_t*>(&result[0]), &len, key)) {
-        return std::string();
-    }
-
-    result.resize(len);
-
-    D("adb_auth_sign len=%d", len);
-    return result;
-}
-
-static bool pubkey_from_privkey(std::string* out, const std::string& path) {
-    std::shared_ptr<RSA> privkey = read_key_file(path);
-    if (!privkey) {
-        return false;
-    }
-    return CalculatePublicKey(out, privkey.get());
-}
-
-bssl::UniquePtr<EVP_PKEY> adb_auth_get_user_privkey() {
-    std::string path = get_user_key_path();
-    if (path.empty()) {
-        PLOG(ERROR) << "Error getting user key filename";
-        return nullptr;
-    }
-
-    std::shared_ptr<RSA> rsa_privkey = read_key_file(path);
-    if (!rsa_privkey) {
-        return nullptr;
-    }
-
-    bssl::UniquePtr<EVP_PKEY> pkey(EVP_PKEY_new());
-    if (!pkey) {
-        LOG(ERROR) << "Failed to allocate key";
-        return nullptr;
-    }
-
-    EVP_PKEY_set1_RSA(pkey.get(), rsa_privkey.get());
-    return pkey;
-}
-
-std::string adb_auth_get_userkey() {
-    std::string path = get_user_key_path();
-    if (path.empty()) {
-        PLOG(ERROR) << "Error getting user key filename";
-        return "";
-    }
-
-    std::string result;
-    if (!pubkey_from_privkey(&result, path)) {
-        return "";
-    }
-    return result;
-}
-
-int adb_auth_keygen(const char* filename) {
-    return !generate_key(filename);
-}
-
-int adb_auth_pubkey(const char* filename) {
-    std::string pubkey;
-    if (!pubkey_from_privkey(&pubkey, filename)) {
-        return 1;
-    }
-    pubkey.push_back('\n');
-
-    return WriteFdExactly(STDOUT_FILENO, pubkey.data(), pubkey.size()) ? 0 : 1;
-}
-
-#if defined(__linux__)
-static void adb_auth_inotify_update(int fd, unsigned fd_event, void*) {
-    LOG(INFO) << "adb_auth_inotify_update called";
-    if (!(fd_event & FDE_READ)) {
-        return;
-    }
-
-    char buf[sizeof(struct inotify_event) + NAME_MAX + 1];
-    while (true) {
-        ssize_t rc = TEMP_FAILURE_RETRY(unix_read(fd, buf, sizeof(buf)));
-        if (rc == -1) {
-            if (errno == EAGAIN) {
-                LOG(INFO) << "done reading inotify fd";
-                break;
-            }
-            PLOG(FATAL) << "read of inotify event failed";
-        }
-
-        // The read potentially returned multiple events.
-        char* start = buf;
-        char* end = buf + rc;
-
-        while (start < end) {
-            inotify_event* event = reinterpret_cast<inotify_event*>(start);
-            auto root_it = g_monitored_paths.find(event->wd);
-            if (root_it == g_monitored_paths.end()) {
-                LOG(FATAL) << "observed inotify event for unmonitored path, wd = " << event->wd;
-            }
-
-            std::string path = root_it->second;
-            if (event->len > 0) {
-                path += '/';
-                path += event->name;
-            }
-
-            if (event->mask & (IN_CREATE | IN_MOVED_TO)) {
-                if (event->mask & IN_ISDIR) {
-                    LOG(INFO) << "ignoring new directory at '" << path << "'";
-                } else {
-                    LOG(INFO) << "observed new file at '" << path << "'";
-                    load_keys(path, false);
-                }
-            } else {
-                LOG(WARNING) << "unmonitored event for " << path << ": 0x" << std::hex
-                             << event->mask;
-            }
-
-            start += sizeof(struct inotify_event) + event->len;
-        }
-    }
-}
-
-static void adb_auth_inotify_init(const std::set<std::string>& paths) {
-    LOG(INFO) << "adb_auth_inotify_init...";
-
-    int infd = inotify_init1(IN_CLOEXEC | IN_NONBLOCK);
-    if (infd < 0) {
-        PLOG(ERROR) << "failed to create inotify fd";
-        return;
-    }
-
-    for (const std::string& path : paths) {
-        int wd = inotify_add_watch(infd, path.c_str(), IN_CREATE | IN_MOVED_TO);
-        if (wd < 0) {
-            PLOG(ERROR) << "failed to inotify_add_watch on path '" << path;
-            continue;
-        }
-
-        g_monitored_paths[wd] = path;
-        LOG(INFO) << "watch descriptor " << wd << " registered for " << path;
-    }
-
-    fdevent* event = fdevent_create(infd, adb_auth_inotify_update, nullptr);
-    fdevent_add(event, FDE_READ);
-}
-#endif
-
-void adb_auth_init() {
-    LOG(INFO) << "adb_auth_init...";
-
-    if (!load_userkey()) {
-        LOG(ERROR) << "Failed to load (or generate) user key";
-        return;
-    }
-
-    const auto& key_paths = get_vendor_keys();
-
-#if defined(__linux__)
-    adb_auth_inotify_init(key_paths);
-#endif
-
-    for (const std::string& path : key_paths) {
-        load_keys(path);
-    }
-}
-
-static void send_auth_publickey(atransport* t) {
-    LOG(INFO) << "Calling send_auth_publickey";
-
-    std::string key = adb_auth_get_userkey();
-    if (key.empty()) {
-        D("Failed to get user public key");
-        return;
-    }
-
-    if (key.size() >= MAX_PAYLOAD_V1) {
-        D("User public key too large (%zu B)", key.size());
-        return;
-    }
-
-    apacket* p = get_apacket();
-    p->msg.command = A_AUTH;
-    p->msg.arg0 = ADB_AUTH_RSAPUBLICKEY;
-
-    // adbd expects a null-terminated string.
-    p->payload.assign(key.data(), key.data() + key.size() + 1);
-    p->msg.data_length = p->payload.size();
-    send_packet(p, t);
-}
-
-void send_auth_response(const char* token, size_t token_size, atransport* t) {
-    std::shared_ptr<RSA> key = t->NextKey();
-    if (key == nullptr) {
-        // No more private keys to try, send the public key.
-        t->SetConnectionState(kCsUnauthorized);
-        t->SetConnectionEstablished(true);
-        send_auth_publickey(t);
-        return;
-    }
-
-    LOG(INFO) << "Calling send_auth_response";
-    apacket* p = get_apacket();
-
-    std::string result = adb_auth_sign(key.get(), token, token_size);
-    if (result.empty()) {
-        D("Error signing the token");
-        put_apacket(p);
-        return;
-    }
-
-    p->msg.command = A_AUTH;
-    p->msg.arg0 = ADB_AUTH_SIGNATURE;
-    p->payload.assign(result.begin(), result.end());
-    p->msg.data_length = p->payload.size();
-    send_packet(p, t);
-}
-
-void adb_auth_tls_handshake(atransport* t) {
-    std::thread([t]() {
-        std::shared_ptr<RSA> key = t->Key();
-        if (key == nullptr) {
-            // Can happen if !auth_required
-            LOG(INFO) << "t->auth_key not set before handshake";
-            key = t->NextKey();
-            CHECK(key);
-        }
-
-        LOG(INFO) << "Attempting to TLS handshake";
-        bool success = t->connection()->DoTlsHandshake(key.get());
-        if (success) {
-            LOG(INFO) << "Handshake succeeded. Waiting for CNXN packet...";
-        } else {
-            LOG(INFO) << "Handshake failed. Kicking transport";
-            t->Kick();
-        }
-    }).detach();
-}
-
-// Callback given to SSL_set_cert_cb to select a certificate when server requests
-// for a certificate. This is where the server will give us a CA-issuer list, and
-// figure out if the server knows any of our public keys. We currently always return
-// 1 here to indicate success, since we always try a key here (in the case of no auth).
-// See https://commondatastorage.googleapis.com/chromium-boringssl-docs/ssl.h.html#SSL_set_cert_cb
-// for more details.
-int adb_tls_set_certificate(SSL* ssl) {
-    LOG(INFO) << __func__;
-
-    const STACK_OF(X509_NAME)* ca_list = SSL_get_client_CA_list(ssl);
-    if (ca_list == nullptr) {
-        // Either the device doesn't know any keys, or !auth_required.
-        // So let's just try with the default certificate and see what happens.
-        LOG(INFO) << "No client CA list. Trying with default certificate.";
-        return 1;
-    }
-
-    const size_t num_cas = sk_X509_NAME_num(ca_list);
-    for (size_t i = 0; i < num_cas; ++i) {
-        auto* x509_name = sk_X509_NAME_value(ca_list, i);
-        auto adbFingerprint = ParseEncodedKeyFromCAIssuer(x509_name);
-        if (!adbFingerprint.has_value()) {
-            // This could be a real CA issuer. Unfortunately, we don't support
-            // it ATM.
-            continue;
-        }
-
-        LOG(INFO) << "Checking for fingerprint match [" << *adbFingerprint << "]";
-        auto encoded_key = SHA256HexStringToBits(*adbFingerprint);
-        if (!encoded_key.has_value()) {
-            continue;
-        }
-        // Check against our list of encoded keys for a match
-        std::lock_guard<std::mutex> lock(g_keys_mutex);
-        auto rsa_priv_key = g_keys.find(*encoded_key);
-        if (rsa_priv_key != g_keys.end()) {
-            LOG(INFO) << "Got SHA256 match on a key";
-            bssl::UniquePtr<EVP_PKEY> evp_pkey(EVP_PKEY_new());
-            CHECK(EVP_PKEY_set1_RSA(evp_pkey.get(), rsa_priv_key->second.get()));
-            auto x509 = GenerateX509Certificate(evp_pkey.get());
-            auto x509_str = X509ToPEMString(x509.get());
-            auto evp_str = Key::ToPEMString(evp_pkey.get());
-            TlsConnection::SetCertAndKey(ssl, x509_str, evp_str);
-            return 1;
-        } else {
-            LOG(INFO) << "No match for [" << *adbFingerprint << "]";
-        }
-    }
-
-    // Let's just try with the default certificate anyways, because daemon might
-    // not require auth, even though it has a list of keys.
-    return 1;
-}
diff --git a/adb/client/bugreport.cpp b/adb/client/bugreport.cpp
deleted file mode 100644
index 8ca44e8..0000000
--- a/adb/client/bugreport.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "sysdeps.h"
-
-#include "bugreport.h"
-
-#include <string>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/strings.h>
-
-#include "adb_utils.h"
-#include "client/file_sync_client.h"
-
-static constexpr char BUGZ_BEGIN_PREFIX[] = "BEGIN:";
-static constexpr char BUGZ_PROGRESS_PREFIX[] = "PROGRESS:";
-static constexpr char BUGZ_PROGRESS_SEPARATOR[] = "/";
-static constexpr char BUGZ_OK_PREFIX[] = "OK:";
-static constexpr char BUGZ_FAIL_PREFIX[] = "FAIL:";
-
-// Custom callback used to handle the output of zipped bugreports.
-class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface {
-  public:
-    BugreportStandardStreamsCallback(const std::string& dest_dir, const std::string& dest_file,
-                                     bool show_progress, Bugreport* br)
-        : br_(br),
-          src_file_(),
-          dest_dir_(dest_dir),
-          dest_file_(dest_file),
-          line_message_(),
-          invalid_lines_(),
-          show_progress_(show_progress),
-          status_(0),
-          line_(),
-          last_progress_percentage_(0) {
-        SetLineMessage("generating");
-    }
-
-    void OnStdout(const char* buffer, int length) {
-        for (int i = 0; i < length; i++) {
-            char c = buffer[i];
-            if (c == '\n') {
-                ProcessLine(line_);
-                line_.clear();
-            } else {
-                line_.append(1, c);
-            }
-        }
-    }
-
-    void OnStderr(const char* buffer, int length) {
-        OnStream(nullptr, stderr, buffer, length);
-    }
-
-    int Done(int unused_) {
-        // Process remaining line, if any.
-        ProcessLine(line_);
-
-        // Warn about invalid lines, if any.
-        if (!invalid_lines_.empty()) {
-            fprintf(stderr,
-                    "WARNING: bugreportz generated %zu line(s) with unknown commands, "
-                    "device might not support zipped bugreports:\n",
-                    invalid_lines_.size());
-            for (const auto& line : invalid_lines_) {
-                fprintf(stderr, "\t%s\n", line.c_str());
-            }
-            fprintf(stderr,
-                    "If the zipped bugreport was not generated, try 'adb bugreport' instead.\n");
-        }
-
-        // Pull the generated bug report.
-        if (status_ == 0) {
-            if (src_file_.empty()) {
-                fprintf(stderr, "bugreportz did not return a '%s' or '%s' line\n", BUGZ_OK_PREFIX,
-                        BUGZ_FAIL_PREFIX);
-                return -1;
-            }
-            std::string destination;
-            if (dest_dir_.empty()) {
-                destination = dest_file_;
-            } else {
-                destination = android::base::StringPrintf("%s%c%s", dest_dir_.c_str(),
-                                                          OS_PATH_SEPARATOR, dest_file_.c_str());
-            }
-            std::vector<const char*> srcs{src_file_.c_str()};
-            SetLineMessage("pulling");
-            status_ =
-                br_->DoSyncPull(srcs, destination.c_str(), false, line_message_.c_str()) ? 0 : 1;
-            if (status_ != 0) {
-                fprintf(stderr,
-                        "Bug report finished but could not be copied to '%s'.\n"
-                        "Try to run 'adb pull %s <directory>'\n"
-                        "to copy it to a directory that can be written.\n",
-                        destination.c_str(), src_file_.c_str());
-            }
-        }
-        return status_;
-    }
-
-  private:
-    void SetLineMessage(const std::string& action) {
-        line_message_ = action + " " + android::base::Basename(dest_file_);
-    }
-
-    void SetSrcFile(const std::string path) {
-        src_file_ = path;
-        if (!dest_dir_.empty()) {
-            // Only uses device-provided name when user passed a directory.
-            dest_file_ = android::base::Basename(path);
-            SetLineMessage("generating");
-        }
-    }
-
-    void ProcessLine(const std::string& line) {
-        if (line.empty()) return;
-
-        if (android::base::StartsWith(line, BUGZ_BEGIN_PREFIX)) {
-            SetSrcFile(&line[strlen(BUGZ_BEGIN_PREFIX)]);
-        } else if (android::base::StartsWith(line, BUGZ_OK_PREFIX)) {
-            SetSrcFile(&line[strlen(BUGZ_OK_PREFIX)]);
-        } else if (android::base::StartsWith(line, BUGZ_FAIL_PREFIX)) {
-            const char* error_message = &line[strlen(BUGZ_FAIL_PREFIX)];
-            fprintf(stderr, "adb: device failed to take a zipped bugreport: %s\n", error_message);
-            status_ = -1;
-        } else if (show_progress_ && android::base::StartsWith(line, BUGZ_PROGRESS_PREFIX)) {
-            // progress_line should have the following format:
-            //
-            // BUGZ_PROGRESS_PREFIX:PROGRESS/TOTAL
-            //
-            size_t idx1 = line.rfind(BUGZ_PROGRESS_PREFIX) + strlen(BUGZ_PROGRESS_PREFIX);
-            size_t idx2 = line.rfind(BUGZ_PROGRESS_SEPARATOR);
-            int progress = std::stoi(line.substr(idx1, (idx2 - idx1)));
-            int total = std::stoi(line.substr(idx2 + 1));
-            int progress_percentage = (progress * 100 / total);
-            if (progress_percentage != 0 && progress_percentage <= last_progress_percentage_) {
-                // Ignore.
-                return;
-            }
-            last_progress_percentage_ = progress_percentage;
-            br_->UpdateProgress(line_message_, progress_percentage);
-        } else {
-            invalid_lines_.push_back(line);
-        }
-    }
-
-    Bugreport* br_;
-
-    // Path of bugreport on device.
-    std::string src_file_;
-
-    // Bugreport destination on host, depending on argument passed on constructor:
-    // - if argument is a directory, dest_dir_ is set with it and dest_file_ will be the name
-    //   of the bugreport reported by the device.
-    // - if argument is empty, dest_dir is set as the current directory and dest_file_ will be the
-    //   name of the bugreport reported by the device.
-    // - otherwise, dest_dir_ is not set and dest_file_ is set with the value passed on constructor.
-    std::string dest_dir_, dest_file_;
-
-    // Message displayed on LinePrinter, it's updated every time the destination above change.
-    std::string line_message_;
-
-    // Lines sent by bugreportz that contain invalid commands; will be displayed at the end.
-    std::vector<std::string> invalid_lines_;
-
-    // Whether PROGRESS_LINES should be interpreted as progress.
-    bool show_progress_;
-
-    // Overall process of the operation, as returned by Done().
-    int status_;
-
-    // Temporary buffer containing the characters read since the last newline (\n).
-    std::string line_;
-
-    // Last displayed progress.
-    // Since dumpstate progress can recede, only forward progress should be displayed
-    int last_progress_percentage_;
-
-    DISALLOW_COPY_AND_ASSIGN(BugreportStandardStreamsCallback);
-};
-
-int Bugreport::DoIt(int argc, const char** argv) {
-    if (argc > 2) error_exit("usage: adb bugreport [PATH]");
-
-    // Gets bugreportz version.
-    std::string bugz_stdout, bugz_stderr;
-    DefaultStandardStreamsCallback version_callback(&bugz_stdout, &bugz_stderr);
-    int status = SendShellCommand("bugreportz -v", false, &version_callback);
-    std::string bugz_version = android::base::Trim(bugz_stderr);
-    std::string bugz_output = android::base::Trim(bugz_stdout);
-
-    if (status != 0 || bugz_version.empty()) {
-        D("'bugreportz' -v results: status=%d, stdout='%s', stderr='%s'", status,
-          bugz_output.c_str(), bugz_version.c_str());
-        if (argc == 1) {
-            // Device does not support bugreportz: if called as 'adb bugreport', just falls out to
-            // the flat-file version.
-            fprintf(stderr,
-                    "Failed to get bugreportz version, which is only available on devices "
-                    "running Android 7.0 or later.\nTrying a plain-text bug report instead.\n");
-            return SendShellCommand("bugreport", false);
-        }
-
-        // But if user explicitly asked for a zipped bug report, fails instead (otherwise calling
-        // 'bugreport' would generate a lot of output the user might not be prepared to handle).
-        fprintf(stderr,
-                "Failed to get bugreportz version: 'bugreportz -v' returned '%s' (code %d).\n"
-                "If the device does not run Android 7.0 or above, try 'adb bugreport' instead.\n",
-                bugz_output.c_str(), status);
-        return status != 0 ? status : -1;
-    }
-
-    std::string dest_file, dest_dir;
-
-    if (argc == 1) {
-        // No args - use current directory
-        if (!getcwd(&dest_dir)) {
-            perror("adb: getcwd failed");
-            return 1;
-        }
-    } else {
-        // Check whether argument is a directory or file
-        if (directory_exists(argv[1])) {
-            dest_dir = argv[1];
-        } else {
-            dest_file = argv[1];
-        }
-    }
-
-    if (dest_file.empty()) {
-        // Uses a default value until device provides the proper name
-        dest_file = "bugreport.zip";
-    } else {
-        if (!android::base::EndsWithIgnoreCase(dest_file, ".zip")) {
-            dest_file += ".zip";
-        }
-    }
-
-    bool show_progress = true;
-    std::string bugz_command = "bugreportz -p";
-    if (bugz_version == "1.0") {
-        // 1.0 does not support progress notifications, so print a disclaimer
-        // message instead.
-        fprintf(stderr,
-                "Bugreport is in progress and it could take minutes to complete.\n"
-                "Please be patient and do not cancel or disconnect your device "
-                "until it completes.\n");
-        show_progress = false;
-        bugz_command = "bugreportz";
-    }
-    BugreportStandardStreamsCallback bugz_callback(dest_dir, dest_file, show_progress, this);
-    return SendShellCommand(bugz_command, false, &bugz_callback);
-}
-
-void Bugreport::UpdateProgress(const std::string& message, int progress_percentage) {
-    line_printer_.Print(
-        android::base::StringPrintf("[%3d%%] %s", progress_percentage, message.c_str()),
-        LinePrinter::INFO);
-}
-
-int Bugreport::SendShellCommand(const std::string& command, bool disable_shell_protocol,
-                                StandardStreamsCallbackInterface* callback) {
-    return send_shell_command(command, disable_shell_protocol, callback);
-}
-
-bool Bugreport::DoSyncPull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
-                           const char* name) {
-    return do_sync_pull(srcs, dst, copy_attrs, name);
-}
diff --git a/adb/client/bugreport.h b/adb/client/bugreport.h
deleted file mode 100644
index 413439b..0000000
--- a/adb/client/bugreport.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef BUGREPORT_H
-#define BUGREPORT_H
-
-#include <vector>
-
-#include "adb.h"
-#include "commandline.h"
-#include "line_printer.h"
-
-class Bugreport {
-    friend class BugreportStandardStreamsCallback;
-
-  public:
-    Bugreport() : line_printer_() {
-    }
-    int DoIt(int argc, const char** argv);
-
-  protected:
-    // Functions below are abstractions of external functions so they can be
-    // mocked on tests.
-    virtual int SendShellCommand(
-        const std::string& command, bool disable_shell_protocol,
-        StandardStreamsCallbackInterface* callback = &DEFAULT_STANDARD_STREAMS_CALLBACK);
-
-    virtual bool DoSyncPull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
-                            const char* name);
-
-  private:
-    virtual void UpdateProgress(const std::string& file_name, int progress_percentage);
-    LinePrinter line_printer_;
-    DISALLOW_COPY_AND_ASSIGN(Bugreport);
-};
-
-#endif  // BUGREPORT_H
diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp
deleted file mode 100644
index ad4e21c..0000000
--- a/adb/client/commandline.cpp
+++ /dev/null
@@ -1,2066 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "sysdeps.h"
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <iostream>
-
-#include <memory>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/parseint.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#if !defined(_WIN32)
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-#include <unistd.h>
-#endif
-
-#include "adb.h"
-#include "adb_auth.h"
-#include "adb_client.h"
-#include "adb_install.h"
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "bugreport.h"
-#include "client/file_sync_client.h"
-#include "commandline.h"
-#include "fastdeploy.h"
-#include "incremental_server.h"
-#include "services.h"
-#include "shell_protocol.h"
-#include "sysdeps/chrono.h"
-
-extern int gListenAll;
-
-DefaultStandardStreamsCallback DEFAULT_STANDARD_STREAMS_CALLBACK(nullptr, nullptr);
-
-static std::string product_file(const std::string& file) {
-    const char* ANDROID_PRODUCT_OUT = getenv("ANDROID_PRODUCT_OUT");
-    if (ANDROID_PRODUCT_OUT == nullptr) {
-        error_exit("product directory not specified; set $ANDROID_PRODUCT_OUT");
-    }
-    return std::string{ANDROID_PRODUCT_OUT} + OS_PATH_SEPARATOR_STR + file;
-}
-
-static void help() {
-    fprintf(stdout, "%s\n", adb_version().c_str());
-    // clang-format off
-    fprintf(stdout,
-        "global options:\n"
-        " -a         listen on all network interfaces, not just localhost\n"
-        " -d         use USB device (error if multiple devices connected)\n"
-        " -e         use TCP/IP device (error if multiple TCP/IP devices available)\n"
-        " -s SERIAL  use device with given serial (overrides $ANDROID_SERIAL)\n"
-        " -t ID      use device with given transport id\n"
-        " -H         name of adb server host [default=localhost]\n"
-        " -P         port of adb server [default=5037]\n"
-        " -L SOCKET  listen on given socket for adb server [default=tcp:localhost:5037]\n"
-        "\n"
-        "general commands:\n"
-        " devices [-l]             list connected devices (-l for long output)\n"
-        " help                     show this help message\n"
-        " version                  show version num\n"
-        "\n"
-        "networking:\n"
-        " connect HOST[:PORT]      connect to a device via TCP/IP [default port=5555]\n"
-        " disconnect [HOST[:PORT]]\n"
-        "     disconnect from given TCP/IP device [default port=5555], or all\n"
-        " pair HOST[:PORT]         pair with a device for secure TCP/IP communication\n"
-        " forward --list           list all forward socket connections\n"
-        " forward [--no-rebind] LOCAL REMOTE\n"
-        "     forward socket connection using:\n"
-        "       tcp:<port> (<local> may be \"tcp:0\" to pick any open port)\n"
-        "       localabstract:<unix domain socket name>\n"
-        "       localreserved:<unix domain socket name>\n"
-        "       localfilesystem:<unix domain socket name>\n"
-        "       dev:<character device name>\n"
-        "       jdwp:<process pid> (remote only)\n"
-        "       acceptfd:<fd> (listen only)\n"
-        " forward --remove LOCAL   remove specific forward socket connection\n"
-        " forward --remove-all     remove all forward socket connections\n"
-        " ppp TTY [PARAMETER...]   run PPP over USB\n"
-        " reverse --list           list all reverse socket connections from device\n"
-        " reverse [--no-rebind] REMOTE LOCAL\n"
-        "     reverse socket connection using:\n"
-        "       tcp:<port> (<remote> may be \"tcp:0\" to pick any open port)\n"
-        "       localabstract:<unix domain socket name>\n"
-        "       localreserved:<unix domain socket name>\n"
-        "       localfilesystem:<unix domain socket name>\n"
-        " reverse --remove REMOTE  remove specific reverse socket connection\n"
-        " reverse --remove-all     remove all reverse socket connections from device\n"
-        "\n"
-        "file transfer:\n"
-        " push [--sync] [-zZ] LOCAL... REMOTE\n"
-        "     copy local files/directories to device\n"
-        "     --sync: only push files that are newer on the host than the device\n"
-        "     -z: enable compression\n"
-        "     -Z: disable compression\n"
-        " pull [-azZ] REMOTE... LOCAL\n"
-        "     copy files/dirs from device\n"
-        "     -a: preserve file timestamp and mode\n"
-        "     -z: enable compression\n"
-        "     -Z: disable compression\n"
-        " sync [-lzZ] [all|data|odm|oem|product|system|system_ext|vendor]\n"
-        "     sync a local build from $ANDROID_PRODUCT_OUT to the device (default all)\n"
-        "     -l: list files that would be copied, but don't copy them\n"
-        "     -z: enable compression\n"
-        "     -Z: disable compression\n"
-        "\n"
-        "shell:\n"
-        " shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]\n"
-        "     run remote shell command (interactive shell if no command given)\n"
-        "     -e: choose escape character, or \"none\"; default '~'\n"
-        "     -n: don't read from stdin\n"
-        "     -T: disable pty allocation\n"
-        "     -t: allocate a pty if on a tty (-tt: force pty allocation)\n"
-        "     -x: disable remote exit codes and stdout/stderr separation\n"
-        " emu COMMAND              run emulator console command\n"
-        "\n"
-        "app installation (see also `adb shell cmd package help`):\n"
-        " install [-lrtsdg] [--instant] PACKAGE\n"
-        "     push a single package to the device and install it\n"
-        " install-multiple [-lrtsdpg] [--instant] PACKAGE...\n"
-        "     push multiple APKs to the device for a single package and install them\n"
-        " install-multi-package [-lrtsdpg] [--instant] PACKAGE...\n"
-        "     push one or more packages to the device and install them atomically\n"
-        "     -r: replace existing application\n"
-        "     -t: allow test packages\n"
-        "     -d: allow version code downgrade (debuggable packages only)\n"
-        "     -p: partial application install (install-multiple only)\n"
-        "     -g: grant all runtime permissions\n"
-        "     --abi ABI: override platform's default ABI\n"
-        "     --instant: cause the app to be installed as an ephemeral install app\n"
-        "     --no-streaming: always push APK to device and invoke Package Manager as separate steps\n"
-        "     --streaming: force streaming APK directly into Package Manager\n"
-        "     --fastdeploy: use fast deploy\n"
-        "     --no-fastdeploy: prevent use of fast deploy\n"
-        "     --force-agent: force update of deployment agent when using fast deploy\n"
-        "     --date-check-agent: update deployment agent when local version is newer and using fast deploy\n"
-        "     --version-check-agent: update deployment agent when local version has different version code and using fast deploy\n"
-#ifndef _WIN32
-        "     --local-agent: locate agent files from local source build (instead of SDK location)\n"
-#endif
-        "     (See also `adb shell pm help` for more options.)\n"
-        //TODO--installlog <filename>
-        " uninstall [-k] PACKAGE\n"
-        "     remove this app package from the device\n"
-        "     '-k': keep the data and cache directories\n"
-        "\n"
-        "debugging:\n"
-        " bugreport [PATH]\n"
-        "     write bugreport to given PATH [default=bugreport.zip];\n"
-        "     if PATH is a directory, the bug report is saved in that directory.\n"
-        "     devices that don't support zipped bug reports output to stdout.\n"
-        " jdwp                     list pids of processes hosting a JDWP transport\n"
-        " logcat                   show device log (logcat --help for more)\n"
-        "\n"
-        "security:\n"
-        " disable-verity           disable dm-verity checking on userdebug builds\n"
-        " enable-verity            re-enable dm-verity checking on userdebug builds\n"
-        " keygen FILE\n"
-        "     generate adb public/private key; private key stored in FILE,\n"
-        "\n"
-        "scripting:\n"
-        " wait-for[-TRANSPORT]-STATE\n"
-        "     wait for device to be in the given state\n"
-        "     STATE: device, recovery, rescue, sideload, bootloader, or disconnect\n"
-        "     TRANSPORT: usb, local, or any [default=any]\n"
-        " get-state                print offline | bootloader | device\n"
-        " get-serialno             print <serial-number>\n"
-        " get-devpath              print <device-path>\n"
-        " remount [-R]\n"
-        "      remount partitions read-write. if a reboot is required, -R will\n"
-        "      will automatically reboot the device.\n"
-        " reboot [bootloader|recovery|sideload|sideload-auto-reboot]\n"
-        "     reboot the device; defaults to booting system image but\n"
-        "     supports bootloader and recovery too. sideload reboots\n"
-        "     into recovery and automatically starts sideload mode,\n"
-        "     sideload-auto-reboot is the same but reboots after sideloading.\n"
-        " sideload OTAPACKAGE      sideload the given full OTA package\n"
-        " root                     restart adbd with root permissions\n"
-        " unroot                   restart adbd without root permissions\n"
-        " usb                      restart adbd listening on USB\n"
-        " tcpip PORT               restart adbd listening on TCP on PORT\n"
-        "\n"
-        "internal debugging:\n"
-        " start-server             ensure that there is a server running\n"
-        " kill-server              kill the server if it is running\n"
-        " reconnect                kick connection from host side to force reconnect\n"
-        " reconnect device         kick connection from device side to force reconnect\n"
-        " reconnect offline        reset offline/unauthorized devices to force reconnect\n"
-        "\n"
-        "environment variables:\n"
-        " $ADB_TRACE\n"
-        "     comma-separated list of debug info to log:\n"
-        "     all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp\n"
-        " $ADB_VENDOR_KEYS         colon-separated list of keys (files or directories)\n"
-        " $ANDROID_SERIAL          serial number to connect to (see -s)\n"
-        " $ANDROID_LOG_TAGS        tags to be used by logcat (see logcat --help)\n"
-        " $ADB_LOCAL_TRANSPORT_MAX_PORT max emulator scan port (default 5585, 16 emus)\n"
-    );
-    // clang-format on
-}
-
-#if defined(_WIN32)
-
-// Implemented in sysdeps_win32.cpp.
-void stdin_raw_init();
-void stdin_raw_restore();
-
-#else
-static termios g_saved_terminal_state;
-
-static void stdin_raw_init() {
-    if (tcgetattr(STDIN_FILENO, &g_saved_terminal_state)) return;
-
-    termios tio;
-    if (tcgetattr(STDIN_FILENO, &tio)) return;
-
-    cfmakeraw(&tio);
-
-    // No timeout but request at least one character per read.
-    tio.c_cc[VTIME] = 0;
-    tio.c_cc[VMIN] = 1;
-
-    tcsetattr(STDIN_FILENO, TCSAFLUSH, &tio);
-}
-
-static void stdin_raw_restore() {
-    tcsetattr(STDIN_FILENO, TCSAFLUSH, &g_saved_terminal_state);
-}
-#endif
-
-int read_and_dump(borrowed_fd fd, bool use_shell_protocol,
-                  StandardStreamsCallbackInterface* callback) {
-    int exit_code = 0;
-    if (fd < 0) return exit_code;
-
-    std::unique_ptr<ShellProtocol> protocol;
-    int length = 0;
-
-    char raw_buffer[BUFSIZ];
-    char* buffer_ptr = raw_buffer;
-    if (use_shell_protocol) {
-        protocol = std::make_unique<ShellProtocol>(fd);
-        if (!protocol) {
-            LOG(ERROR) << "failed to allocate memory for ShellProtocol object";
-            return 1;
-        }
-        buffer_ptr = protocol->data();
-    }
-
-    while (true) {
-        if (use_shell_protocol) {
-            if (!protocol->Read()) {
-                break;
-            }
-            length = protocol->data_length();
-            switch (protocol->id()) {
-                case ShellProtocol::kIdStdout:
-                    callback->OnStdout(buffer_ptr, length);
-                    break;
-                case ShellProtocol::kIdStderr:
-                    callback->OnStderr(buffer_ptr, length);
-                    break;
-                case ShellProtocol::kIdExit:
-                    // data() returns a char* which doesn't have defined signedness.
-                    // Cast to uint8_t to prevent 255 from being sign extended to INT_MIN,
-                    // which doesn't get truncated on Windows.
-                    exit_code = static_cast<uint8_t>(protocol->data()[0]);
-                    continue;
-                default:
-                    continue;
-            }
-            length = protocol->data_length();
-        } else {
-            D("read_and_dump(): pre adb_read(fd=%d)", fd.get());
-            length = adb_read(fd, raw_buffer, sizeof(raw_buffer));
-            D("read_and_dump(): post adb_read(fd=%d): length=%d", fd.get(), length);
-            if (length <= 0) {
-                break;
-            }
-            callback->OnStdout(buffer_ptr, length);
-        }
-    }
-
-    return callback->Done(exit_code);
-}
-
-static void stdinout_raw_prologue(int inFd, int outFd, int& old_stdin_mode, int& old_stdout_mode) {
-    if (inFd == STDIN_FILENO) {
-        stdin_raw_init();
-#ifdef _WIN32
-        old_stdin_mode = _setmode(STDIN_FILENO, _O_BINARY);
-        if (old_stdin_mode == -1) {
-            PLOG(FATAL) << "could not set stdin to binary";
-        }
-#endif
-    }
-
-#ifdef _WIN32
-    if (outFd == STDOUT_FILENO) {
-        old_stdout_mode = _setmode(STDOUT_FILENO, _O_BINARY);
-        if (old_stdout_mode == -1) {
-            PLOG(FATAL) << "could not set stdout to binary";
-        }
-    }
-#endif
-}
-
-static void stdinout_raw_epilogue(int inFd, int outFd, int old_stdin_mode, int old_stdout_mode) {
-    if (inFd == STDIN_FILENO) {
-        stdin_raw_restore();
-#ifdef _WIN32
-        if (_setmode(STDIN_FILENO, old_stdin_mode) == -1) {
-            PLOG(FATAL) << "could not restore stdin mode";
-        }
-#endif
-    }
-
-#ifdef _WIN32
-    if (outFd == STDOUT_FILENO) {
-        if (_setmode(STDOUT_FILENO, old_stdout_mode) == -1) {
-            PLOG(FATAL) << "could not restore stdout mode";
-        }
-    }
-#endif
-}
-
-bool copy_to_file(int inFd, int outFd) {
-    bool result = true;
-    std::vector<char> buf(64 * 1024);
-    int len;
-    long total = 0;
-    int old_stdin_mode = -1;
-    int old_stdout_mode = -1;
-
-    D("copy_to_file(%d -> %d)", inFd, outFd);
-
-    stdinout_raw_prologue(inFd, outFd, old_stdin_mode, old_stdout_mode);
-
-    while (true) {
-        if (inFd == STDIN_FILENO) {
-            len = unix_read(inFd, buf.data(), buf.size());
-        } else {
-            len = adb_read(inFd, buf.data(), buf.size());
-        }
-        if (len == 0) {
-            D("copy_to_file() : read 0 bytes; exiting");
-            break;
-        }
-        if (len < 0) {
-            D("copy_to_file(): read failed: %s", strerror(errno));
-            result = false;
-            break;
-        }
-        if (outFd == STDOUT_FILENO) {
-            fwrite(buf.data(), 1, len, stdout);
-            fflush(stdout);
-        } else {
-            adb_write(outFd, buf.data(), len);
-        }
-        total += len;
-    }
-
-    stdinout_raw_epilogue(inFd, outFd, old_stdin_mode, old_stdout_mode);
-
-    D("copy_to_file() finished with %s after %lu bytes", result ? "success" : "failure", total);
-    return result;
-}
-
-static void send_window_size_change(int fd, std::unique_ptr<ShellProtocol>& shell) {
-    // Old devices can't handle window size changes.
-    if (shell == nullptr) return;
-
-#if defined(_WIN32)
-    struct winsize {
-        unsigned short ws_row;
-        unsigned short ws_col;
-        unsigned short ws_xpixel;
-        unsigned short ws_ypixel;
-    };
-#endif
-
-    winsize ws;
-
-#if defined(_WIN32)
-    // If stdout is redirected to a non-console, we won't be able to get the
-    // console size, but that makes sense.
-    const intptr_t intptr_handle = _get_osfhandle(STDOUT_FILENO);
-    if (intptr_handle == -1) return;
-
-    const HANDLE handle = reinterpret_cast<const HANDLE>(intptr_handle);
-
-    CONSOLE_SCREEN_BUFFER_INFO info;
-    memset(&info, 0, sizeof(info));
-    if (!GetConsoleScreenBufferInfo(handle, &info)) return;
-
-    memset(&ws, 0, sizeof(ws));
-    // The number of visible rows, excluding offscreen scroll-back rows which are in info.dwSize.Y.
-    ws.ws_row = info.srWindow.Bottom - info.srWindow.Top + 1;
-    // If the user has disabled "Wrap text output on resize", they can make the screen buffer wider
-    // than the window, in which case we should use the width of the buffer.
-    ws.ws_col = info.dwSize.X;
-#else
-    if (ioctl(fd, TIOCGWINSZ, &ws) == -1) return;
-#endif
-
-    // Send the new window size as human-readable ASCII for debugging convenience.
-    size_t l = snprintf(shell->data(), shell->data_capacity(), "%dx%d,%dx%d",
-                        ws.ws_row, ws.ws_col, ws.ws_xpixel, ws.ws_ypixel);
-    shell->Write(ShellProtocol::kIdWindowSizeChange, l + 1);
-}
-
-// Used to pass multiple values to the stdin read thread.
-struct StdinReadArgs {
-    int stdin_fd, write_fd;
-    bool raw_stdin;
-    std::unique_ptr<ShellProtocol> protocol;
-    char escape_char;
-};
-
-// Loops to read from stdin and push the data to the given FD.
-// The argument should be a pointer to a StdinReadArgs object. This function
-// will take ownership of the object and delete it when finished.
-static void stdin_read_thread_loop(void* x) {
-    std::unique_ptr<StdinReadArgs> args(reinterpret_cast<StdinReadArgs*>(x));
-
-#if !defined(_WIN32)
-    // Mask SIGTTIN in case we're in a backgrounded process.
-    sigset_t sigset;
-    sigemptyset(&sigset);
-    sigaddset(&sigset, SIGTTIN);
-    pthread_sigmask(SIG_BLOCK, &sigset, nullptr);
-#endif
-
-#if defined(_WIN32)
-    // _get_interesting_input_record_uncached() causes unix_read_interruptible()
-    // to return -1 with errno == EINTR if the window size changes.
-#else
-    // Unblock SIGWINCH for this thread, so our read(2) below will be
-    // interrupted if the window size changes.
-    sigset_t mask;
-    sigemptyset(&mask);
-    sigaddset(&mask, SIGWINCH);
-    pthread_sigmask(SIG_UNBLOCK, &mask, nullptr);
-#endif
-
-    // Set up the initial window size.
-    send_window_size_change(args->stdin_fd, args->protocol);
-
-    char raw_buffer[BUFSIZ];
-    char* buffer_ptr = raw_buffer;
-    size_t buffer_size = sizeof(raw_buffer);
-    if (args->protocol != nullptr) {
-        buffer_ptr = args->protocol->data();
-        buffer_size = args->protocol->data_capacity();
-    }
-
-    // If we need to parse escape sequences, make life easy.
-    if (args->raw_stdin && args->escape_char != '\0') {
-        buffer_size = 1;
-    }
-
-    enum EscapeState { kMidFlow, kStartOfLine, kInEscape };
-    EscapeState state = kStartOfLine;
-
-    while (true) {
-        // Use unix_read_interruptible() rather than adb_read() for stdin.
-        D("stdin_read_thread_loop(): pre unix_read_interruptible(fdi=%d,...)", args->stdin_fd);
-        int r = unix_read_interruptible(args->stdin_fd, buffer_ptr,
-                                        buffer_size);
-        if (r == -1 && errno == EINTR) {
-            send_window_size_change(args->stdin_fd, args->protocol);
-            continue;
-        }
-        D("stdin_read_thread_loop(): post unix_read_interruptible(fdi=%d,...)", args->stdin_fd);
-        if (r <= 0) {
-            // Only devices using the shell protocol know to close subprocess
-            // stdin. For older devices we want to just leave the connection
-            // open, otherwise an unpredictable amount of return data could
-            // be lost due to the FD closing before all data has been received.
-            if (args->protocol) {
-                args->protocol->Write(ShellProtocol::kIdCloseStdin, 0);
-            }
-            break;
-        }
-        // If we made stdin raw, check input for escape sequences. In
-        // this situation signals like Ctrl+C are sent remotely rather than
-        // interpreted locally so this provides an emergency out if the remote
-        // process starts ignoring the signal. SSH also does this, see the
-        // "escape characters" section on the ssh man page for more info.
-        if (args->raw_stdin && args->escape_char != '\0') {
-            char ch = buffer_ptr[0];
-            if (ch == args->escape_char) {
-                if (state == kStartOfLine) {
-                    state = kInEscape;
-                    // Swallow the escape character.
-                    continue;
-                } else {
-                    state = kMidFlow;
-                }
-            } else {
-                if (state == kInEscape) {
-                    if (ch == '.') {
-                        fprintf(stderr,"\r\n[ disconnected ]\r\n");
-                        stdin_raw_restore();
-                        exit(0);
-                    } else {
-                        // We swallowed an escape character that wasn't part of
-                        // a valid escape sequence; time to cough it up.
-                        buffer_ptr[0] = args->escape_char;
-                        buffer_ptr[1] = ch;
-                        ++r;
-                    }
-                }
-                state = (ch == '\n' || ch == '\r') ? kStartOfLine : kMidFlow;
-            }
-        }
-        if (args->protocol) {
-            if (!args->protocol->Write(ShellProtocol::kIdStdin, r)) {
-                break;
-            }
-        } else {
-            if (!WriteFdExactly(args->write_fd, buffer_ptr, r)) {
-                break;
-            }
-        }
-    }
-}
-
-// Returns a shell service string with the indicated arguments and command.
-static std::string ShellServiceString(bool use_shell_protocol,
-                                      const std::string& type_arg,
-                                      const std::string& command) {
-    std::vector<std::string> args;
-    if (use_shell_protocol) {
-        args.push_back(kShellServiceArgShellProtocol);
-
-        const char* terminal_type = getenv("TERM");
-        if (terminal_type != nullptr) {
-            args.push_back(std::string("TERM=") + terminal_type);
-        }
-    }
-    if (!type_arg.empty()) {
-        args.push_back(type_arg);
-    }
-
-    // Shell service string can look like: shell[,arg1,arg2,...]:[command].
-    return android::base::StringPrintf("shell%s%s:%s",
-                                       args.empty() ? "" : ",",
-                                       android::base::Join(args, ',').c_str(),
-                                       command.c_str());
-}
-
-// Connects to a shell on the device and read/writes data.
-//
-// Note: currently this function doesn't properly clean up resources; the
-// FD connected to the adb server is never closed and the stdin read thread
-// may never exit.
-//
-// On success returns the remote exit code if |use_shell_protocol| is true,
-// 0 otherwise. On failure returns 1.
-static int RemoteShell(bool use_shell_protocol, const std::string& type_arg, char escape_char,
-                       bool empty_command, const std::string& service_string) {
-    // Old devices can't handle a service string that's longer than MAX_PAYLOAD_V1.
-    // Use |use_shell_protocol| to determine whether to allow a command longer than that.
-    if (service_string.size() > MAX_PAYLOAD_V1 && !use_shell_protocol) {
-        fprintf(stderr, "error: shell command too long\n");
-        return 1;
-    }
-
-    // Make local stdin raw if the device allocates a PTY, which happens if:
-    //   1. We are explicitly asking for a PTY shell, or
-    //   2. We don't specify shell type and are starting an interactive session.
-    bool raw_stdin = (type_arg == kShellServiceArgPty || (type_arg.empty() && empty_command));
-
-    std::string error;
-    int fd = adb_connect(service_string, &error);
-    if (fd < 0) {
-        fprintf(stderr,"error: %s\n", error.c_str());
-        return 1;
-    }
-
-    StdinReadArgs* args = new StdinReadArgs;
-    if (!args) {
-        LOG(ERROR) << "couldn't allocate StdinReadArgs object";
-        return 1;
-    }
-    args->stdin_fd = STDIN_FILENO;
-    args->write_fd = fd;
-    args->raw_stdin = raw_stdin;
-    args->escape_char = escape_char;
-    if (use_shell_protocol) {
-        args->protocol = std::make_unique<ShellProtocol>(args->write_fd);
-    }
-
-    if (raw_stdin) stdin_raw_init();
-
-#if !defined(_WIN32)
-    // Ensure our process is notified if the local window size changes.
-    // We use sigaction(2) to ensure that the SA_RESTART flag is not set,
-    // because the whole reason we're sending signals is to unblock the read(2)!
-    // That also means we don't need to do anything in the signal handler:
-    // the side effect of delivering the signal is all we need.
-    struct sigaction sa;
-    memset(&sa, 0, sizeof(sa));
-    sa.sa_handler = [](int) {};
-    sa.sa_flags = 0;
-    sigaction(SIGWINCH, &sa, nullptr);
-
-    // Now block SIGWINCH in this thread (the main thread) and all threads spawned
-    // from it. The stdin read thread will unblock this signal to ensure that it's
-    // the thread that receives the signal.
-    sigset_t mask;
-    sigemptyset(&mask);
-    sigaddset(&mask, SIGWINCH);
-    pthread_sigmask(SIG_BLOCK, &mask, nullptr);
-#endif
-
-    // TODO: combine read_and_dump with stdin_read_thread to make life simpler?
-    std::thread(stdin_read_thread_loop, args).detach();
-    int exit_code = read_and_dump(fd, use_shell_protocol);
-
-    // TODO: properly exit stdin_read_thread_loop and close |fd|.
-
-    // TODO: we should probably install signal handlers for this.
-    // TODO: can we use atexit? even on Windows?
-    if (raw_stdin) stdin_raw_restore();
-
-    return exit_code;
-}
-
-static int adb_shell(int argc, const char** argv) {
-    FeatureSet features;
-    std::string error_message;
-    if (!adb_get_feature_set(&features, &error_message)) {
-        fprintf(stderr, "error: %s\n", error_message.c_str());
-        return 1;
-    }
-
-    enum PtyAllocationMode { kPtyAuto, kPtyNo, kPtyYes, kPtyDefinitely };
-
-    // Defaults.
-    char escape_char = '~'; // -e
-    bool use_shell_protocol = CanUseFeature(features, kFeatureShell2); // -x
-    PtyAllocationMode tty = use_shell_protocol ? kPtyAuto : kPtyDefinitely; // -t/-T
-
-    // Parse shell-specific command-line options.
-    argv[0] = "adb shell"; // So getopt(3) error messages start "adb shell".
-#ifdef _WIN32
-    // fixes "adb shell -l" crash on Windows, b/37284906
-    __argv = const_cast<char**>(argv);
-#endif
-    optind = 1; // argv[0] is always "shell", so set `optind` appropriately.
-    int opt;
-    while ((opt = getopt(argc, const_cast<char**>(argv), "+e:ntTx")) != -1) {
-        switch (opt) {
-            case 'e':
-                if (!(strlen(optarg) == 1 || strcmp(optarg, "none") == 0)) {
-                    error_exit("-e requires a single-character argument or 'none'");
-                }
-                escape_char = (strcmp(optarg, "none") == 0) ? 0 : optarg[0];
-                break;
-            case 'n':
-                close_stdin();
-                break;
-            case 'x':
-                // This option basically asks for historical behavior, so set options that
-                // correspond to the historical defaults. This is slightly weird in that -Tx
-                // is fine (because we'll undo the -T) but -xT isn't, but that does seem to
-                // be our least worst choice...
-                use_shell_protocol = false;
-                tty = kPtyDefinitely;
-                escape_char = '~';
-                break;
-            case 't':
-                // Like ssh, -t arguments are cumulative so that multiple -t's
-                // are needed to force a PTY.
-                tty = (tty >= kPtyYes) ? kPtyDefinitely : kPtyYes;
-                break;
-            case 'T':
-                tty = kPtyNo;
-                break;
-            default:
-                // getopt(3) already printed an error message for us.
-                return 1;
-        }
-    }
-
-    bool is_interactive = (optind == argc);
-
-    std::string shell_type_arg = kShellServiceArgPty;
-    if (tty == kPtyNo) {
-        shell_type_arg = kShellServiceArgRaw;
-    } else if (tty == kPtyAuto) {
-        // If stdin isn't a TTY, default to a raw shell; this lets
-        // things like `adb shell < my_script.sh` work as expected.
-        // Non-interactive shells should also not have a pty.
-        if (!unix_isatty(STDIN_FILENO) || !is_interactive) {
-            shell_type_arg = kShellServiceArgRaw;
-        }
-    } else if (tty == kPtyYes) {
-        // A single -t arg isn't enough to override implicit -T.
-        if (!unix_isatty(STDIN_FILENO)) {
-            fprintf(stderr,
-                    "Remote PTY will not be allocated because stdin is not a terminal.\n"
-                    "Use multiple -t options to force remote PTY allocation.\n");
-            shell_type_arg = kShellServiceArgRaw;
-        }
-    }
-
-    D("shell -e 0x%x t=%d use_shell_protocol=%s shell_type_arg=%s\n",
-      escape_char, tty,
-      use_shell_protocol ? "true" : "false",
-      (shell_type_arg == kShellServiceArgPty) ? "pty" : "raw");
-
-    // Raw mode is only supported when talking to a new device *and* using the shell protocol.
-    if (!use_shell_protocol) {
-        if (shell_type_arg != kShellServiceArgPty) {
-            fprintf(stderr, "error: %s only supports allocating a pty\n",
-                    !CanUseFeature(features, kFeatureShell2) ? "device" : "-x");
-            return 1;
-        } else {
-            // If we're not using the shell protocol, the type argument must be empty.
-            shell_type_arg = "";
-        }
-    }
-
-    std::string command;
-    if (optind < argc) {
-        // We don't escape here, just like ssh(1). http://b/20564385.
-        command = android::base::Join(std::vector<const char*>(argv + optind, argv + argc), ' ');
-    }
-
-    std::string service_string = ShellServiceString(use_shell_protocol, shell_type_arg, command);
-    return RemoteShell(use_shell_protocol, shell_type_arg, escape_char, command.empty(),
-                       service_string);
-}
-
-static int adb_abb(int argc, const char** argv) {
-    FeatureSet features;
-    std::string error_message;
-    if (!adb_get_feature_set(&features, &error_message)) {
-        fprintf(stderr, "error: %s\n", error_message.c_str());
-        return 1;
-    }
-
-    if (!CanUseFeature(features, kFeatureAbb)) {
-        error_exit("abb is not supported by the device");
-    }
-
-    optind = 1;  // argv[0] is always "abb", so set `optind` appropriately.
-
-    // Defaults.
-    constexpr char escape_char = '~';  // -e
-    constexpr bool use_shell_protocol = true;
-    constexpr auto shell_type_arg = kShellServiceArgRaw;
-    constexpr bool empty_command = false;
-
-    std::vector<const char*> args(argv + optind, argv + argc);
-    std::string service_string = "abb:" + android::base::Join(args, ABB_ARG_DELIMETER);
-
-    D("abb -e 0x%x [%*.s]\n", escape_char, static_cast<int>(service_string.size()),
-      service_string.data());
-
-    return RemoteShell(use_shell_protocol, shell_type_arg, escape_char, empty_command,
-                       service_string);
-}
-
-static int adb_shell_noinput(int argc, const char** argv) {
-#if !defined(_WIN32)
-    unique_fd fd(adb_open("/dev/null", O_RDONLY));
-    CHECK_NE(STDIN_FILENO, fd.get());
-    dup2(fd.get(), STDIN_FILENO);
-#endif
-    return adb_shell(argc, argv);
-}
-
-static int adb_sideload_legacy(const char* filename, int in_fd, int size) {
-    std::string error;
-    unique_fd out_fd(adb_connect(android::base::StringPrintf("sideload:%d", size), &error));
-    if (out_fd < 0) {
-        fprintf(stderr, "adb: pre-KitKat sideload connection failed: %s\n", error.c_str());
-        return -1;
-    }
-
-    int opt = CHUNK_SIZE;
-    opt = adb_setsockopt(out_fd, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt));
-
-    char buf[CHUNK_SIZE];
-    int total = size;
-    while (size > 0) {
-        unsigned xfer = (size > CHUNK_SIZE) ? CHUNK_SIZE : size;
-        if (!ReadFdExactly(in_fd, buf, xfer)) {
-            fprintf(stderr, "adb: failed to read data from %s: %s\n", filename, strerror(errno));
-            return -1;
-        }
-        if (!WriteFdExactly(out_fd, buf, xfer)) {
-            std::string error;
-            adb_status(out_fd, &error);
-            fprintf(stderr, "adb: failed to write data: %s\n", error.c_str());
-            return -1;
-        }
-        size -= xfer;
-        printf("sending: '%s' %4d%%    \r", filename, (int)(100LL - ((100LL * size) / (total))));
-        fflush(stdout);
-    }
-    printf("\n");
-
-    if (!adb_status(out_fd, &error)) {
-        fprintf(stderr, "adb: error response: %s\n", error.c_str());
-        return -1;
-    }
-
-    return 0;
-}
-
-#define SIDELOAD_HOST_BLOCK_SIZE (CHUNK_SIZE)
-
-// Connects to the sideload / rescue service on the device (served by minadbd) and sends over the
-// data in an OTA package.
-//
-// It uses a simple protocol as follows.
-//
-// - The connect message includes the total number of bytes in the file and a block size chosen by
-//   us.
-//
-// - The other side sends the desired block number as eight decimal digits (e.g. "00000023" for
-//   block 23). Blocks are numbered from zero.
-//
-// - We send back the data of the requested block. The last block is likely to be partial; when the
-//   last block is requested we only send the part of the block that exists, it's not padded up to
-//   the block size.
-//
-// - When the other side sends "DONEDONE" or "FAILFAIL" instead of a block number, we have done all
-//   the data transfer.
-//
-static int adb_sideload_install(const char* filename, bool rescue_mode) {
-    // TODO: use a LinePrinter instead...
-    struct stat sb;
-    if (stat(filename, &sb) == -1) {
-        fprintf(stderr, "adb: failed to stat file %s: %s\n", filename, strerror(errno));
-        return -1;
-    }
-    unique_fd package_fd(adb_open(filename, O_RDONLY));
-    if (package_fd == -1) {
-        fprintf(stderr, "adb: failed to open file %s: %s\n", filename, strerror(errno));
-        return -1;
-    }
-
-    std::string service = android::base::StringPrintf(
-            "%s:%" PRId64 ":%d", rescue_mode ? "rescue-install" : "sideload-host",
-            static_cast<int64_t>(sb.st_size), SIDELOAD_HOST_BLOCK_SIZE);
-    std::string error;
-    unique_fd device_fd(adb_connect(service, &error));
-    if (device_fd < 0) {
-        fprintf(stderr, "adb: sideload connection failed: %s\n", error.c_str());
-
-        if (rescue_mode) {
-            return -1;
-        }
-
-        // If this is a small enough package, maybe this is an older device that doesn't
-        // support sideload-host. Try falling back to the older (<= K) sideload method.
-        if (sb.st_size > INT_MAX) {
-            return -1;
-        }
-        fprintf(stderr, "adb: trying pre-KitKat sideload method...\n");
-        return adb_sideload_legacy(filename, package_fd.get(), static_cast<int>(sb.st_size));
-    }
-
-    int opt = SIDELOAD_HOST_BLOCK_SIZE;
-    adb_setsockopt(device_fd, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt));
-
-    char buf[SIDELOAD_HOST_BLOCK_SIZE];
-
-    int64_t xfer = 0;
-    int last_percent = -1;
-    while (true) {
-        if (!ReadFdExactly(device_fd, buf, 8)) {
-            fprintf(stderr, "adb: failed to read command: %s\n", strerror(errno));
-            return -1;
-        }
-        buf[8] = '\0';
-
-        if (strcmp(kMinadbdServicesExitSuccess, buf) == 0 ||
-            strcmp(kMinadbdServicesExitFailure, buf) == 0) {
-            printf("\rTotal xfer: %.2fx%*s\n",
-                   static_cast<double>(xfer) / (sb.st_size ? sb.st_size : 1),
-                   static_cast<int>(strlen(filename) + 10), "");
-            if (strcmp(kMinadbdServicesExitFailure, buf) == 0) {
-                return 1;
-            }
-            return 0;
-        }
-
-        int64_t block = strtoll(buf, nullptr, 10);
-        int64_t offset = block * SIDELOAD_HOST_BLOCK_SIZE;
-        if (offset >= static_cast<int64_t>(sb.st_size)) {
-            fprintf(stderr,
-                    "adb: failed to read block %" PRId64 " at offset %" PRId64 ", past end %" PRId64
-                    "\n",
-                    block, offset, static_cast<int64_t>(sb.st_size));
-            return -1;
-        }
-
-        size_t to_write = SIDELOAD_HOST_BLOCK_SIZE;
-        if ((offset + SIDELOAD_HOST_BLOCK_SIZE) > static_cast<int64_t>(sb.st_size)) {
-            to_write = sb.st_size - offset;
-        }
-
-        if (adb_lseek(package_fd, offset, SEEK_SET) != offset) {
-            fprintf(stderr, "adb: failed to seek to package block: %s\n", strerror(errno));
-            return -1;
-        }
-        if (!ReadFdExactly(package_fd, buf, to_write)) {
-            fprintf(stderr, "adb: failed to read package block: %s\n", strerror(errno));
-            return -1;
-        }
-
-        if (!WriteFdExactly(device_fd, buf, to_write)) {
-            adb_status(device_fd, &error);
-            fprintf(stderr, "adb: failed to write data '%s' *\n", error.c_str());
-            return -1;
-        }
-        xfer += to_write;
-
-        // For normal OTA packages, we expect to transfer every byte
-        // twice, plus a bit of overhead (one read during
-        // verification, one read of each byte for installation, plus
-        // extra access to things like the zip central directory).
-        // This estimate of the completion becomes 100% when we've
-        // transferred ~2.13 (=100/47) times the package size.
-        int percent = static_cast<int>(xfer * 47LL / (sb.st_size ? sb.st_size : 1));
-        if (percent != last_percent) {
-            printf("\rserving: '%s'  (~%d%%)    ", filename, percent);
-            fflush(stdout);
-            last_percent = percent;
-        }
-    }
-}
-
-static int adb_wipe_devices() {
-    auto wipe_devices_message_size = strlen(kMinadbdServicesExitSuccess);
-    std::string error;
-    unique_fd fd(adb_connect(
-            android::base::StringPrintf("rescue-wipe:userdata:%zu", wipe_devices_message_size),
-            &error));
-    if (fd < 0) {
-        fprintf(stderr, "adb: wipe device connection failed: %s\n", error.c_str());
-        return 1;
-    }
-
-    std::string message(wipe_devices_message_size, '\0');
-    if (!ReadFdExactly(fd, message.data(), wipe_devices_message_size)) {
-        fprintf(stderr, "adb: failed to read wipe result: %s\n", strerror(errno));
-        return 1;
-    }
-
-    if (message == kMinadbdServicesExitSuccess) {
-        return 0;
-    }
-
-    if (message != kMinadbdServicesExitFailure) {
-        fprintf(stderr, "adb: got unexpected message from rescue wipe %s\n", message.c_str());
-    }
-    return 1;
-}
-
-/**
- * Run ppp in "notty" mode against a resource listed as the first parameter
- * eg:
- *
- * ppp dev:/dev/omap_csmi_tty0 <ppp options>
- *
- */
-static int ppp(int argc, const char** argv) {
-#if defined(_WIN32)
-    error_exit("adb %s not implemented on Win32", argv[0]);
-    __builtin_unreachable();
-#else
-    if (argc < 2) error_exit("usage: adb %s <adb service name> [ppp opts]", argv[0]);
-
-    const char* adb_service_name = argv[1];
-    std::string error_message;
-    int fd = adb_connect(adb_service_name, &error_message);
-    if (fd < 0) {
-        error_exit("could not open adb service %s: %s", adb_service_name, error_message.c_str());
-    }
-
-    pid_t pid = fork();
-    if (pid == -1) {
-        perror_exit("fork failed");
-    }
-
-    if (pid == 0) {
-        // child side
-        int i;
-
-        // copy args
-        const char** ppp_args = (const char**)alloca(sizeof(char*) * argc + 1);
-        ppp_args[0] = "pppd";
-        for (i = 2 ; i < argc ; i++) {
-            //argv[2] and beyond become ppp_args[1] and beyond
-            ppp_args[i - 1] = argv[i];
-        }
-        ppp_args[i-1] = nullptr;
-
-        dup2(fd, STDIN_FILENO);
-        dup2(fd, STDOUT_FILENO);
-        adb_close(STDERR_FILENO);
-        adb_close(fd);
-
-        execvp("pppd", (char* const*)ppp_args);
-        perror_exit("exec pppd failed");
-    }
-
-    // parent side
-    adb_close(fd);
-    return 0;
-#endif /* !defined(_WIN32) */
-}
-
-static bool wait_for_device(const char* service,
-                            std::optional<std::chrono::milliseconds> timeout = std::nullopt) {
-    std::vector<std::string> components = android::base::Split(service, "-");
-    if (components.size() < 3 || components.size() > 4) {
-        fprintf(stderr, "adb: couldn't parse 'wait-for' command: %s\n", service);
-        return false;
-    }
-
-    TransportType t;
-    adb_get_transport(&t, nullptr, nullptr);
-
-    // Was the caller vague about what they'd like us to wait for?
-    // If so, check they weren't more specific in their choice of transport type.
-    if (components.size() == 3) {
-        auto it = components.begin() + 2;
-        if (t == kTransportUsb) {
-            components.insert(it, "usb");
-        } else if (t == kTransportLocal) {
-            components.insert(it, "local");
-        } else {
-            components.insert(it, "any");
-        }
-    } else if (components[2] != "any" && components[2] != "local" && components[2] != "usb") {
-        fprintf(stderr, "adb: unknown type %s; expected 'any', 'local', or 'usb'\n",
-                components[2].c_str());
-        return false;
-    }
-
-    if (components[3] != "any" && components[3] != "bootloader" && components[3] != "device" &&
-        components[3] != "recovery" && components[3] != "rescue" && components[3] != "sideload" &&
-        components[3] != "disconnect") {
-        fprintf(stderr,
-                "adb: unknown state %s; "
-                "expected 'any', 'bootloader', 'device', 'recovery', 'rescue', 'sideload', or "
-                "'disconnect'\n",
-                components[3].c_str());
-        return false;
-    }
-
-    std::string cmd = format_host_command(android::base::Join(components, "-").c_str());
-    if (timeout) {
-        std::thread([timeout]() {
-            std::this_thread::sleep_for(*timeout);
-            fprintf(stderr, "timeout expired while waiting for device\n");
-            _exit(1);
-        }).detach();
-    }
-    return adb_command(cmd);
-}
-
-static bool adb_root(const char* command) {
-    std::string error;
-
-    TransportId transport_id;
-    unique_fd fd(adb_connect(&transport_id, android::base::StringPrintf("%s:", command), &error));
-    if (fd < 0) {
-        fprintf(stderr, "adb: unable to connect for %s: %s\n", command, error.c_str());
-        return false;
-    }
-
-    // Figure out whether we actually did anything.
-    char buf[256];
-    char* cur = buf;
-    ssize_t bytes_left = sizeof(buf);
-    while (bytes_left > 0) {
-        ssize_t bytes_read = adb_read(fd, cur, bytes_left);
-        if (bytes_read == 0) {
-            break;
-        } else if (bytes_read < 0) {
-            fprintf(stderr, "adb: error while reading for %s: %s\n", command, strerror(errno));
-            return false;
-        }
-        cur += bytes_read;
-        bytes_left -= bytes_read;
-    }
-
-    if (bytes_left == 0) {
-        fprintf(stderr, "adb: unexpected output length for %s\n", command);
-        return false;
-    }
-
-    fwrite(buf, 1, sizeof(buf) - bytes_left, stdout);
-    fflush(stdout);
-    if (cur != buf && strstr(buf, "restarting") == nullptr) {
-        return true;
-    }
-
-    // Wait for the device to go away.
-    TransportType previous_type;
-    const char* previous_serial;
-    TransportId previous_id;
-    adb_get_transport(&previous_type, &previous_serial, &previous_id);
-
-    adb_set_transport(kTransportAny, nullptr, transport_id);
-    wait_for_device("wait-for-disconnect");
-
-    // Wait for the device to come back.
-    // If we were using a specific transport ID, there's nothing we can wait for.
-    if (previous_id == 0) {
-        adb_set_transport(previous_type, previous_serial, 0);
-        wait_for_device("wait-for-device", 6000ms);
-    }
-
-    return true;
-}
-
-int send_shell_command(const std::string& command, bool disable_shell_protocol,
-                       StandardStreamsCallbackInterface* callback) {
-    unique_fd fd;
-    bool use_shell_protocol = false;
-
-    while (true) {
-        bool attempt_connection = true;
-
-        // Use shell protocol if it's supported and the caller doesn't explicitly
-        // disable it.
-        if (!disable_shell_protocol) {
-            FeatureSet features;
-            std::string error;
-            if (adb_get_feature_set(&features, &error)) {
-                use_shell_protocol = CanUseFeature(features, kFeatureShell2);
-            } else {
-                // Device was unreachable.
-                attempt_connection = false;
-            }
-        }
-
-        if (attempt_connection) {
-            std::string error;
-            std::string service_string = ShellServiceString(use_shell_protocol, "", command);
-
-            fd.reset(adb_connect(service_string, &error));
-            if (fd >= 0) {
-                break;
-            }
-        }
-
-        fprintf(stderr, "- waiting for device -\n");
-        if (!wait_for_device("wait-for-device")) {
-            return 1;
-        }
-    }
-
-    return read_and_dump(fd.get(), use_shell_protocol, callback);
-}
-
-static int logcat(int argc, const char** argv) {
-    char* log_tags = getenv("ANDROID_LOG_TAGS");
-    std::string quoted = escape_arg(log_tags == nullptr ? "" : log_tags);
-
-    std::string cmd = "export ANDROID_LOG_TAGS=\"" + quoted + "\"; exec logcat";
-
-    if (!strcmp(argv[0], "longcat")) {
-        cmd += " -v long";
-    }
-
-    --argc;
-    ++argv;
-    while (argc-- > 0) {
-        cmd += " " + escape_arg(*argv++);
-    }
-
-    return send_shell_command(cmd);
-}
-
-static void write_zeros(int bytes, borrowed_fd fd) {
-    int old_stdin_mode = -1;
-    int old_stdout_mode = -1;
-    std::vector<char> buf(bytes);
-
-    D("write_zeros(%d) -> %d", bytes, fd.get());
-
-    stdinout_raw_prologue(-1, fd.get(), old_stdin_mode, old_stdout_mode);
-
-    if (fd == STDOUT_FILENO) {
-        fwrite(buf.data(), 1, bytes, stdout);
-        fflush(stdout);
-    } else {
-        adb_write(fd, buf.data(), bytes);
-    }
-
-    stdinout_raw_prologue(-1, fd.get(), old_stdin_mode, old_stdout_mode);
-
-    D("write_zeros() finished");
-}
-
-static int backup(int argc, const char** argv) {
-    fprintf(stdout, "WARNING: adb backup is deprecated and may be removed in a future release\n");
-
-    const char* filename = "backup.ab";
-
-    /* find, extract, and use any -f argument */
-    for (int i = 1; i < argc; i++) {
-        if (!strcmp("-f", argv[i])) {
-            if (i == argc - 1) error_exit("backup -f passed with no filename");
-            filename = argv[i+1];
-            for (int j = i+2; j <= argc; ) {
-                argv[i++] = argv[j++];
-            }
-            argc -= 2;
-            argv[argc] = nullptr;
-        }
-    }
-
-    // Bare "adb backup" or "adb backup -f filename" are not valid invocations ---
-    // a list of packages is required.
-    if (argc < 2) error_exit("backup either needs a list of packages or -all/-shared");
-
-    adb_unlink(filename);
-    unique_fd outFd(adb_creat(filename, 0640));
-    if (outFd < 0) {
-        fprintf(stderr, "adb: backup unable to create file '%s': %s\n", filename, strerror(errno));
-        return EXIT_FAILURE;
-    }
-
-    std::string cmd = "backup:";
-    --argc;
-    ++argv;
-    while (argc-- > 0) {
-        cmd += " " + escape_arg(*argv++);
-    }
-
-    D("backup. filename=%s cmd=%s", filename, cmd.c_str());
-    std::string error;
-    unique_fd fd(adb_connect(cmd, &error));
-    if (fd < 0) {
-        fprintf(stderr, "adb: unable to connect for backup: %s\n", error.c_str());
-        return EXIT_FAILURE;
-    }
-
-    fprintf(stdout, "Now unlock your device and confirm the backup operation...\n");
-    fflush(stdout);
-
-    copy_to_file(fd.get(), outFd.get());
-    return EXIT_SUCCESS;
-}
-
-static int restore(int argc, const char** argv) {
-    fprintf(stdout, "WARNING: adb restore is deprecated and may be removed in a future release\n");
-
-    if (argc != 2) error_exit("restore requires an argument");
-
-    const char* filename = argv[1];
-    unique_fd tarFd(adb_open(filename, O_RDONLY));
-    if (tarFd < 0) {
-        fprintf(stderr, "adb: unable to open file %s: %s\n", filename, strerror(errno));
-        return -1;
-    }
-
-    std::string error;
-    unique_fd fd(adb_connect("restore:", &error));
-    if (fd < 0) {
-        fprintf(stderr, "adb: unable to connect for restore: %s\n", error.c_str());
-        return -1;
-    }
-
-    fprintf(stdout, "Now unlock your device and confirm the restore operation.\n");
-    fflush(stdout);
-
-    copy_to_file(tarFd.get(), fd.get());
-
-    // Provide an in-band EOD marker in case the archive file is malformed
-    write_zeros(512 * 2, fd);
-
-    // Wait until the other side finishes, or it'll get sent SIGHUP.
-    copy_to_file(fd.get(), STDOUT_FILENO);
-    return 0;
-}
-
-static void parse_push_pull_args(const char** arg, int narg, std::vector<const char*>* srcs,
-                                 const char** dst, bool* copy_attrs, bool* sync, bool* compressed) {
-    *copy_attrs = false;
-    const char* adb_compression = getenv("ADB_COMPRESSION");
-    if (adb_compression && strcmp(adb_compression, "0") == 0) {
-        *compressed = false;
-    }
-
-    srcs->clear();
-    bool ignore_flags = false;
-    while (narg > 0) {
-        if (ignore_flags || *arg[0] != '-') {
-            srcs->push_back(*arg);
-        } else {
-            if (!strcmp(*arg, "-p")) {
-                // Silently ignore for backwards compatibility.
-            } else if (!strcmp(*arg, "-a")) {
-                *copy_attrs = true;
-            } else if (!strcmp(*arg, "-z")) {
-                if (compressed != nullptr) {
-                    *compressed = true;
-                }
-            } else if (!strcmp(*arg, "-Z")) {
-                if (compressed != nullptr) {
-                    *compressed = false;
-                }
-            } else if (!strcmp(*arg, "--sync")) {
-                if (sync != nullptr) {
-                    *sync = true;
-                }
-            } else if (!strcmp(*arg, "--")) {
-                ignore_flags = true;
-            } else {
-                error_exit("unrecognized option '%s'", *arg);
-            }
-        }
-        ++arg;
-        --narg;
-    }
-
-    if (srcs->size() > 1) {
-        *dst = srcs->back();
-        srcs->pop_back();
-    }
-}
-
-static int adb_connect_command(const std::string& command, TransportId* transport = nullptr) {
-    std::string error;
-    unique_fd fd(adb_connect(transport, command, &error));
-    if (fd < 0) {
-        fprintf(stderr, "error: %s\n", error.c_str());
-        return 1;
-    }
-    read_and_dump(fd);
-    return 0;
-}
-
-static int adb_connect_command_bidirectional(const std::string& command) {
-    std::string error;
-    unique_fd fd(adb_connect(command, &error));
-    if (fd < 0) {
-        fprintf(stderr, "error: %s\n", error.c_str());
-        return 1;
-    }
-
-    static constexpr auto forward = [](int src, int sink, bool exit_on_end) {
-        char buf[4096];
-        while (true) {
-            int rc = adb_read(src, buf, sizeof(buf));
-            if (rc == 0) {
-                if (exit_on_end) {
-                    exit(0);
-                } else {
-                    adb_shutdown(sink, SHUT_WR);
-                }
-                return;
-            } else if (rc < 0) {
-                perror_exit("read failed");
-            }
-            if (!WriteFdExactly(sink, buf, rc)) {
-                perror_exit("write failed");
-            }
-        }
-    };
-
-    std::thread read(forward, fd.get(), STDOUT_FILENO, true);
-    std::thread write(forward, STDIN_FILENO, fd.get(), false);
-    read.join();
-    write.join();
-    return 0;
-}
-
-static int adb_query_command(const std::string& command) {
-    std::string result;
-    std::string error;
-    if (!adb_query(command, &result, &error)) {
-        fprintf(stderr, "error: %s\n", error.c_str());
-        return 1;
-    }
-    printf("%s\n", result.c_str());
-    return 0;
-}
-
-// Disallow stdin, stdout, and stderr.
-static bool _is_valid_ack_reply_fd(const int ack_reply_fd) {
-#ifdef _WIN32
-    const HANDLE ack_reply_handle = cast_int_to_handle(ack_reply_fd);
-    return (GetStdHandle(STD_INPUT_HANDLE) != ack_reply_handle) &&
-           (GetStdHandle(STD_OUTPUT_HANDLE) != ack_reply_handle) &&
-           (GetStdHandle(STD_ERROR_HANDLE) != ack_reply_handle);
-#else
-    return ack_reply_fd > 2;
-#endif
-}
-
-static bool _is_valid_os_fd(int fd) {
-    // Disallow invalid FDs and stdin/out/err as well.
-    if (fd < 3) {
-        return false;
-    }
-#ifdef _WIN32
-    auto handle = (HANDLE)fd;
-    DWORD info = 0;
-    if (GetHandleInformation(handle, &info) == 0) {
-        return false;
-    }
-#else
-    int flags = fcntl(fd, F_GETFD);
-    if (flags == -1) {
-        return false;
-    }
-#endif
-    return true;
-}
-
-int adb_commandline(int argc, const char** argv) {
-    bool no_daemon = false;
-    bool is_daemon = false;
-    bool is_server = false;
-    int r;
-    TransportType transport_type = kTransportAny;
-    int ack_reply_fd = -1;
-
-#if !defined(_WIN32)
-    // We'd rather have EPIPE than SIGPIPE.
-    signal(SIGPIPE, SIG_IGN);
-#endif
-
-    const char* server_host_str = nullptr;
-    const char* server_port_str = nullptr;
-    const char* server_socket_str = nullptr;
-
-    // We need to check for -d and -e before we look at $ANDROID_SERIAL.
-    const char* serial = nullptr;
-    TransportId transport_id = 0;
-
-    while (argc > 0) {
-        if (!strcmp(argv[0], "server")) {
-            is_server = true;
-        } else if (!strcmp(argv[0], "nodaemon")) {
-            no_daemon = true;
-        } else if (!strcmp(argv[0], "fork-server")) {
-            /* this is a special flag used only when the ADB client launches the ADB Server */
-            is_daemon = true;
-        } else if (!strcmp(argv[0], "--reply-fd")) {
-            if (argc < 2) error_exit("--reply-fd requires an argument");
-            const char* reply_fd_str = argv[1];
-            argc--;
-            argv++;
-            ack_reply_fd = strtol(reply_fd_str, nullptr, 10);
-            if (!_is_valid_ack_reply_fd(ack_reply_fd)) {
-                fprintf(stderr, "adb: invalid reply fd \"%s\"\n", reply_fd_str);
-                return 1;
-            }
-        } else if (!strncmp(argv[0], "-s", 2)) {
-            if (isdigit(argv[0][2])) {
-                serial = argv[0] + 2;
-            } else {
-                if (argc < 2 || argv[0][2] != '\0') error_exit("-s requires an argument");
-                serial = argv[1];
-                argc--;
-                argv++;
-            }
-        } else if (!strncmp(argv[0], "-t", 2)) {
-            const char* id;
-            if (isdigit(argv[0][2])) {
-                id = argv[0] + 2;
-            } else {
-                id = argv[1];
-                argc--;
-                argv++;
-            }
-            transport_id = strtoll(id, const_cast<char**>(&id), 10);
-            if (*id != '\0') {
-                error_exit("invalid transport id");
-            }
-        } else if (!strcmp(argv[0], "-d")) {
-            transport_type = kTransportUsb;
-        } else if (!strcmp(argv[0], "-e")) {
-            transport_type = kTransportLocal;
-        } else if (!strcmp(argv[0], "-a")) {
-            gListenAll = 1;
-        } else if (!strncmp(argv[0], "-H", 2)) {
-            if (argv[0][2] == '\0') {
-                if (argc < 2) error_exit("-H requires an argument");
-                server_host_str = argv[1];
-                argc--;
-                argv++;
-            } else {
-                server_host_str = argv[0] + 2;
-            }
-        } else if (!strncmp(argv[0], "-P", 2)) {
-            if (argv[0][2] == '\0') {
-                if (argc < 2) error_exit("-P requires an argument");
-                server_port_str = argv[1];
-                argc--;
-                argv++;
-            } else {
-                server_port_str = argv[0] + 2;
-            }
-        } else if (!strcmp(argv[0], "-L")) {
-            if (argc < 2) error_exit("-L requires an argument");
-            server_socket_str = argv[1];
-            argc--;
-            argv++;
-        } else {
-            /* out of recognized modifiers and flags */
-            break;
-        }
-        argc--;
-        argv++;
-    }
-
-    if ((server_host_str || server_port_str) && server_socket_str) {
-        error_exit("-L is incompatible with -H or -P");
-    }
-
-    // If -L, -H, or -P are specified, ignore environment variables.
-    // Otherwise, prefer ADB_SERVER_SOCKET over ANDROID_ADB_SERVER_ADDRESS/PORT.
-    if (!server_host_str && !server_port_str && !server_socket_str) {
-        server_socket_str = getenv("ADB_SERVER_SOCKET");
-    }
-
-    if (!server_socket_str) {
-        // tcp:1234 and tcp:localhost:1234 are different with -a, so don't default to localhost
-        server_host_str = server_host_str ? server_host_str : getenv("ANDROID_ADB_SERVER_ADDRESS");
-
-        int server_port = DEFAULT_ADB_PORT;
-        server_port_str = server_port_str ? server_port_str : getenv("ANDROID_ADB_SERVER_PORT");
-        if (server_port_str && strlen(server_port_str) > 0) {
-            if (!android::base::ParseInt(server_port_str, &server_port, 1, 65535)) {
-                error_exit(
-                        "$ANDROID_ADB_SERVER_PORT must be a positive number less than 65535: "
-                        "got \"%s\"",
-                        server_port_str);
-            }
-        }
-
-        int rc;
-        char* temp;
-        if (server_host_str) {
-            rc = asprintf(&temp, "tcp:%s:%d", server_host_str, server_port);
-        } else {
-            rc = asprintf(&temp, "tcp:%d", server_port);
-        }
-        if (rc < 0) {
-            LOG(FATAL) << "failed to allocate server socket specification";
-        }
-        server_socket_str = temp;
-    }
-
-    adb_set_socket_spec(server_socket_str);
-
-    // If none of -d, -e, or -s were specified, try $ANDROID_SERIAL.
-    if (transport_type == kTransportAny && serial == nullptr) {
-        serial = getenv("ANDROID_SERIAL");
-    }
-
-    adb_set_transport(transport_type, serial, transport_id);
-
-    if (is_server) {
-        if (no_daemon || is_daemon) {
-            if (is_daemon && (ack_reply_fd == -1)) {
-                fprintf(stderr, "reply fd for adb server to client communication not specified.\n");
-                return 1;
-            }
-            r = adb_server_main(is_daemon, server_socket_str, ack_reply_fd);
-        } else {
-            r = launch_server(server_socket_str);
-        }
-        if (r) {
-            fprintf(stderr,"* could not start server *\n");
-        }
-        return r;
-    }
-
-    if (argc == 0) {
-        help();
-        return 1;
-    }
-
-    /* handle wait-for-* prefix */
-    if (!strncmp(argv[0], "wait-for-", strlen("wait-for-"))) {
-        const char* service = argv[0];
-
-        if (!wait_for_device(service)) {
-            return 1;
-        }
-
-        // Allow a command to be run after wait-for-device,
-        // e.g. 'adb wait-for-device shell'.
-        if (argc == 1) {
-            return 0;
-        }
-
-        /* Fall through */
-        argc--;
-        argv++;
-    }
-
-    /* adb_connect() commands */
-    if (!strcmp(argv[0], "devices")) {
-        const char *listopt;
-        if (argc < 2) {
-            listopt = "";
-        } else if (argc == 2 && !strcmp(argv[1], "-l")) {
-            listopt = argv[1];
-        } else {
-            error_exit("adb devices [-l]");
-        }
-
-        std::string query = android::base::StringPrintf("host:%s%s", argv[0], listopt);
-        std::string error;
-        if (!adb_check_server_version(&error)) {
-            error_exit("failed to check server version: %s", error.c_str());
-        }
-        printf("List of devices attached\n");
-        return adb_query_command(query);
-    }
-    else if (!strcmp(argv[0], "connect")) {
-        if (argc != 2) error_exit("usage: adb connect HOST[:PORT]");
-
-        std::string query = android::base::StringPrintf("host:connect:%s", argv[1]);
-        return adb_query_command(query);
-    }
-    else if (!strcmp(argv[0], "disconnect")) {
-        if (argc > 2) error_exit("usage: adb disconnect [HOST[:PORT]]");
-
-        std::string query = android::base::StringPrintf("host:disconnect:%s",
-                                                        (argc == 2) ? argv[1] : "");
-        return adb_query_command(query);
-    } else if (!strcmp(argv[0], "abb")) {
-        return adb_abb(argc, argv);
-    } else if (!strcmp(argv[0], "pair")) {
-        if (argc != 2) error_exit("usage: adb pair <host>[:<port>]");
-
-        std::string password;
-        printf("Enter pairing code: ");
-        fflush(stdout);
-        if (!std::getline(std::cin, password) || password.empty()) {
-            error_exit("No pairing code provided");
-        }
-        std::string query =
-                android::base::StringPrintf("host:pair:%s:%s", password.c_str(), argv[1]);
-
-        return adb_query_command(query);
-    } else if (!strcmp(argv[0], "emu")) {
-        return adb_send_emulator_command(argc, argv, serial);
-    } else if (!strcmp(argv[0], "shell")) {
-        return adb_shell(argc, argv);
-    } else if (!strcmp(argv[0], "exec-in") || !strcmp(argv[0], "exec-out")) {
-        int exec_in = !strcmp(argv[0], "exec-in");
-
-        if (argc < 2) error_exit("usage: adb %s command", argv[0]);
-
-        std::string cmd = "exec:";
-        cmd += argv[1];
-        argc -= 2;
-        argv += 2;
-        while (argc-- > 0) {
-            cmd += " " + escape_arg(*argv++);
-        }
-
-        std::string error;
-        unique_fd fd(adb_connect(cmd, &error));
-        if (fd < 0) {
-            fprintf(stderr, "error: %s\n", error.c_str());
-            return -1;
-        }
-
-        if (exec_in) {
-            copy_to_file(STDIN_FILENO, fd.get());
-        } else {
-            copy_to_file(fd.get(), STDOUT_FILENO);
-        }
-        return 0;
-    } else if (!strcmp(argv[0], "kill-server")) {
-        return adb_kill_server() ? 0 : 1;
-    } else if (!strcmp(argv[0], "sideload")) {
-        if (argc != 2) error_exit("sideload requires an argument");
-        if (adb_sideload_install(argv[1], false /* rescue_mode */)) {
-            return 1;
-        } else {
-            return 0;
-        }
-    } else if (!strcmp(argv[0], "rescue")) {
-        // adb rescue getprop
-        // adb rescue getprop <prop>
-        // adb rescue install <filename>
-        // adb rescue wipe userdata
-        if (argc < 2) error_exit("rescue requires at least one argument");
-        if (!strcmp(argv[1], "getprop")) {
-            if (argc == 2) {
-                return adb_connect_command("rescue-getprop:");
-            }
-            if (argc == 3) {
-                return adb_connect_command(
-                        android::base::StringPrintf("rescue-getprop:%s", argv[2]));
-            }
-            error_exit("invalid rescue getprop arguments");
-        } else if (!strcmp(argv[1], "install")) {
-            if (argc != 3) error_exit("rescue install requires two arguments");
-            if (adb_sideload_install(argv[2], true /* rescue_mode */) != 0) {
-                return 1;
-            }
-        } else if (!strcmp(argv[1], "wipe")) {
-            if (argc != 3 || strcmp(argv[2], "userdata") != 0) {
-                error_exit("invalid rescue wipe arguments");
-            }
-            return adb_wipe_devices();
-        } else {
-            error_exit("invalid rescue argument");
-        }
-        return 0;
-    } else if (!strcmp(argv[0], "tcpip")) {
-        if (argc != 2) error_exit("tcpip requires an argument");
-        int port;
-        if (!android::base::ParseInt(argv[1], &port, 1, 65535)) {
-            error_exit("tcpip: invalid port: %s", argv[1]);
-        }
-        return adb_connect_command(android::base::StringPrintf("tcpip:%d", port));
-    } else if (!strcmp(argv[0], "remount")) {
-        FeatureSet features;
-        std::string error;
-        if (!adb_get_feature_set(&features, &error)) {
-            fprintf(stderr, "error: %s\n", error.c_str());
-            return 1;
-        }
-
-        if (CanUseFeature(features, kFeatureRemountShell)) {
-            std::vector<const char*> args = {"shell"};
-            args.insert(args.cend(), argv, argv + argc);
-            return adb_shell_noinput(args.size(), args.data());
-        } else if (argc > 1) {
-            auto command = android::base::StringPrintf("%s:%s", argv[0], argv[1]);
-            return adb_connect_command(command);
-        } else {
-            return adb_connect_command("remount:");
-        }
-    }
-    // clang-format off
-    else if (!strcmp(argv[0], "reboot") ||
-             !strcmp(argv[0], "reboot-bootloader") ||
-             !strcmp(argv[0], "reboot-fastboot") ||
-             !strcmp(argv[0], "usb") ||
-             !strcmp(argv[0], "disable-verity") ||
-             !strcmp(argv[0], "enable-verity")) {
-        // clang-format on
-        std::string command;
-        if (!strcmp(argv[0], "reboot-bootloader")) {
-            command = "reboot:bootloader";
-        } else if (!strcmp(argv[0], "reboot-fastboot")) {
-            command = "reboot:fastboot";
-        } else if (argc > 1) {
-            command = android::base::StringPrintf("%s:%s", argv[0], argv[1]);
-        } else {
-            command = android::base::StringPrintf("%s:", argv[0]);
-        }
-        return adb_connect_command(command);
-    } else if (!strcmp(argv[0], "root") || !strcmp(argv[0], "unroot")) {
-        return adb_root(argv[0]) ? 0 : 1;
-    } else if (!strcmp(argv[0], "bugreport")) {
-        Bugreport bugreport;
-        return bugreport.DoIt(argc, argv);
-    } else if (!strcmp(argv[0], "forward") || !strcmp(argv[0], "reverse")) {
-        bool reverse = !strcmp(argv[0], "reverse");
-        --argc;
-        if (argc < 1) error_exit("%s requires an argument", argv[0]);
-        ++argv;
-
-        // Determine the <host-prefix> for this command.
-        std::string host_prefix;
-        if (reverse) {
-            host_prefix = "reverse:";
-        } else {
-            host_prefix = "host:";
-        }
-
-        std::string cmd, error_message;
-        if (strcmp(argv[0], "--list") == 0) {
-            if (argc != 1) error_exit("--list doesn't take any arguments");
-            return adb_query_command(host_prefix + "list-forward");
-        } else if (strcmp(argv[0], "--remove-all") == 0) {
-            if (argc != 1) error_exit("--remove-all doesn't take any arguments");
-            cmd = "killforward-all";
-        } else if (strcmp(argv[0], "--remove") == 0) {
-            // forward --remove <local>
-            if (argc != 2) error_exit("--remove requires an argument");
-            cmd = std::string("killforward:") + argv[1];
-        } else if (strcmp(argv[0], "--no-rebind") == 0) {
-            // forward --no-rebind <local> <remote>
-            if (argc != 3) error_exit("--no-rebind takes two arguments");
-            if (forward_targets_are_valid(argv[1], argv[2], &error_message)) {
-                cmd = std::string("forward:norebind:") + argv[1] + ";" + argv[2];
-            }
-        } else {
-            // forward <local> <remote>
-            if (argc != 2) error_exit("forward takes two arguments");
-            if (forward_targets_are_valid(argv[0], argv[1], &error_message)) {
-                cmd = std::string("forward:") + argv[0] + ";" + argv[1];
-            }
-        }
-
-        if (!error_message.empty()) {
-            error_exit("error: %s", error_message.c_str());
-        }
-
-        unique_fd fd(adb_connect(nullptr, host_prefix + cmd, &error_message, true));
-        if (fd < 0 || !adb_status(fd.get(), &error_message)) {
-            error_exit("error: %s", error_message.c_str());
-        }
-
-        // Server or device may optionally return a resolved TCP port number.
-        std::string resolved_port;
-        if (ReadProtocolString(fd, &resolved_port, &error_message) && !resolved_port.empty()) {
-            printf("%s\n", resolved_port.c_str());
-        }
-
-        ReadOrderlyShutdown(fd);
-        return 0;
-    }
-    /* do_sync_*() commands */
-    else if (!strcmp(argv[0], "ls")) {
-        if (argc != 2) error_exit("ls requires an argument");
-        return do_sync_ls(argv[1]) ? 0 : 1;
-    } else if (!strcmp(argv[0], "push")) {
-        bool copy_attrs = false;
-        bool sync = false;
-        bool compressed = true;
-        std::vector<const char*> srcs;
-        const char* dst = nullptr;
-
-        parse_push_pull_args(&argv[1], argc - 1, &srcs, &dst, &copy_attrs, &sync, &compressed);
-        if (srcs.empty() || !dst) error_exit("push requires an argument");
-        return do_sync_push(srcs, dst, sync, compressed) ? 0 : 1;
-    } else if (!strcmp(argv[0], "pull")) {
-        bool copy_attrs = false;
-        bool compressed = true;
-        std::vector<const char*> srcs;
-        const char* dst = ".";
-
-        parse_push_pull_args(&argv[1], argc - 1, &srcs, &dst, &copy_attrs, nullptr, &compressed);
-        if (srcs.empty()) error_exit("pull requires an argument");
-        return do_sync_pull(srcs, dst, copy_attrs, compressed) ? 0 : 1;
-    } else if (!strcmp(argv[0], "install")) {
-        if (argc < 2) error_exit("install requires an argument");
-        return install_app(argc, argv);
-    } else if (!strcmp(argv[0], "install-multiple")) {
-        if (argc < 2) error_exit("install-multiple requires an argument");
-        return install_multiple_app(argc, argv);
-    } else if (!strcmp(argv[0], "install-multi-package")) {
-        if (argc < 2) error_exit("install-multi-package requires an argument");
-        return install_multi_package(argc, argv);
-    } else if (!strcmp(argv[0], "uninstall")) {
-        if (argc < 2) error_exit("uninstall requires an argument");
-        return uninstall_app(argc, argv);
-    } else if (!strcmp(argv[0], "sync")) {
-        std::string src;
-        bool list_only = false;
-        bool compressed = true;
-
-        const char* adb_compression = getenv("ADB_COMPRESSION");
-        if (adb_compression && strcmp(adb_compression, "0") == 0) {
-            compressed = false;
-        }
-
-        int opt;
-        while ((opt = getopt(argc, const_cast<char**>(argv), "lzZ")) != -1) {
-            switch (opt) {
-                case 'l':
-                    list_only = true;
-                    break;
-                case 'z':
-                    compressed = true;
-                    break;
-                case 'Z':
-                    compressed = false;
-                    break;
-                default:
-                    error_exit("usage: adb sync [-lzZ] [PARTITION]");
-            }
-        }
-
-        if (optind == argc) {
-            src = "all";
-        } else if (optind + 1 == argc) {
-            src = argv[optind];
-        } else {
-            error_exit("usage: adb sync [-lzZ] [PARTITION]");
-        }
-
-        std::vector<std::string> partitions{"data",   "odm",        "oem",   "product",
-                                            "system", "system_ext", "vendor"};
-        bool found = false;
-        for (const auto& partition : partitions) {
-            if (src == "all" || src == partition) {
-                std::string src_dir{product_file(partition)};
-                if (!directory_exists(src_dir)) continue;
-                found = true;
-                if (!do_sync_sync(src_dir, "/" + partition, list_only, compressed)) return 1;
-            }
-        }
-        if (!found) error_exit("don't know how to sync %s partition", src.c_str());
-        return 0;
-    }
-    /* passthrough commands */
-    else if (!strcmp(argv[0], "get-state") || !strcmp(argv[0], "get-serialno") ||
-             !strcmp(argv[0], "get-devpath")) {
-        return adb_query_command(format_host_command(argv[0]));
-    }
-    /* other commands */
-    else if (!strcmp(argv[0], "logcat") || !strcmp(argv[0], "lolcat") ||
-             !strcmp(argv[0], "longcat")) {
-        return logcat(argc, argv);
-    } else if (!strcmp(argv[0], "ppp")) {
-        return ppp(argc, argv);
-    } else if (!strcmp(argv[0], "start-server")) {
-        std::string error;
-        const int result = adb_connect("host:start-server", &error);
-        if (result < 0) {
-            fprintf(stderr, "error: %s\n", error.c_str());
-        }
-        return result;
-    } else if (!strcmp(argv[0], "backup")) {
-        return backup(argc, argv);
-    } else if (!strcmp(argv[0], "restore")) {
-        return restore(argc, argv);
-    } else if (!strcmp(argv[0], "keygen")) {
-        if (argc != 2) error_exit("keygen requires an argument");
-        // Always print key generation information for keygen command.
-        adb_trace_enable(AUTH);
-        return adb_auth_keygen(argv[1]);
-    } else if (!strcmp(argv[0], "pubkey")) {
-        if (argc != 2) error_exit("pubkey requires an argument");
-        return adb_auth_pubkey(argv[1]);
-    } else if (!strcmp(argv[0], "jdwp")) {
-        return adb_connect_command("jdwp");
-    } else if (!strcmp(argv[0], "track-jdwp")) {
-        return adb_connect_command("track-jdwp");
-    } else if (!strcmp(argv[0], "track-devices")) {
-        if (argc > 2 || (argc == 2 && strcmp(argv[1], "-l"))) {
-            error_exit("usage: adb track-devices [-l]");
-        }
-        return adb_connect_command(argc == 2 ? "host:track-devices-l" : "host:track-devices");
-    } else if (!strcmp(argv[0], "raw")) {
-        if (argc != 2) {
-            error_exit("usage: adb raw SERVICE");
-        }
-        return adb_connect_command_bidirectional(argv[1]);
-    }
-
-    /* "adb /?" is a common idiom under Windows */
-    else if (!strcmp(argv[0], "--help") || !strcmp(argv[0], "help") || !strcmp(argv[0], "/?")) {
-        help();
-        return 0;
-    } else if (!strcmp(argv[0], "--version") || !strcmp(argv[0], "version")) {
-        fprintf(stdout, "%s", adb_version().c_str());
-        return 0;
-    } else if (!strcmp(argv[0], "features")) {
-        // Only list the features common to both the adb client and the device.
-        FeatureSet features;
-        std::string error;
-        if (!adb_get_feature_set(&features, &error)) {
-            fprintf(stderr, "error: %s\n", error.c_str());
-            return 1;
-        }
-
-        for (const std::string& name : features) {
-            if (CanUseFeature(features, name)) {
-                printf("%s\n", name.c_str());
-            }
-        }
-        return 0;
-    } else if (!strcmp(argv[0], "host-features")) {
-        return adb_query_command("host:host-features");
-    } else if (!strcmp(argv[0], "reconnect")) {
-        if (argc == 1) {
-            return adb_query_command(format_host_command(argv[0]));
-        } else if (argc == 2) {
-            if (!strcmp(argv[1], "device")) {
-                std::string err;
-                adb_connect("reconnect", &err);
-                return 0;
-            } else if (!strcmp(argv[1], "offline")) {
-                std::string err;
-                return adb_query_command("host:reconnect-offline");
-            } else {
-                error_exit("usage: adb reconnect [device|offline]");
-            }
-        }
-    } else if (!strcmp(argv[0], "inc-server")) {
-        if (argc < 4) {
-#ifdef _WIN32
-            error_exit("usage: adb inc-server CONNECTION_HANDLE OUTPUT_HANDLE FILE1 FILE2 ...");
-#else
-            error_exit("usage: adb inc-server CONNECTION_FD OUTPUT_FD FILE1 FILE2 ...");
-#endif
-        }
-        int connection_fd = atoi(argv[1]);
-        if (!_is_valid_os_fd(connection_fd)) {
-            error_exit("Invalid connection_fd number given: %d", connection_fd);
-        }
-
-        connection_fd = adb_register_socket(connection_fd);
-        close_on_exec(connection_fd);
-
-        int output_fd = atoi(argv[2]);
-        if (!_is_valid_os_fd(output_fd)) {
-            error_exit("Invalid output_fd number given: %d", output_fd);
-        }
-        output_fd = adb_register_socket(output_fd);
-        close_on_exec(output_fd);
-        return incremental::serve(connection_fd, output_fd, argc - 3, argv + 3);
-    }
-
-    error_exit("unknown command %s", argv[0]);
-    __builtin_unreachable();
-}
diff --git a/adb/client/commandline.h b/adb/client/commandline.h
deleted file mode 100644
index b9dee56..0000000
--- a/adb/client/commandline.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef COMMANDLINE_H
-#define COMMANDLINE_H
-
-#include <android-base/strings.h>
-
-#include "adb.h"
-#include "adb_client.h"
-#include "adb_unique_fd.h"
-
-// Callback used to handle the standard streams (stdout and stderr) sent by the
-// device's upon receiving a command.
-//
-class StandardStreamsCallbackInterface {
-  public:
-    StandardStreamsCallbackInterface() {
-    }
-    // Handles the stdout output from devices supporting the Shell protocol.
-    virtual void OnStdout(const char* buffer, int length) = 0;
-
-    // Handles the stderr output from devices supporting the Shell protocol.
-    virtual void OnStderr(const char* buffer, int length) = 0;
-
-    // Indicates the communication is finished and returns the appropriate error
-    // code.
-    //
-    // |status| has the status code returning by the underlying communication
-    // channels
-    virtual int Done(int status) = 0;
-
-  protected:
-    static void OnStream(std::string* string, FILE* stream, const char* buffer, int length) {
-        if (string != nullptr) {
-            string->append(buffer, length);
-        } else {
-            fwrite(buffer, 1, length, stream);
-            fflush(stream);
-        }
-    }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(StandardStreamsCallbackInterface);
-};
-
-// Default implementation that redirects the streams to the equilavent host
-// stream or to a string
-// passed to the constructor.
-class DefaultStandardStreamsCallback : public StandardStreamsCallbackInterface {
-  public:
-    // If |stdout_str| is non-null, OnStdout will append to it.
-    // If |stderr_str| is non-null, OnStderr will append to it.
-    DefaultStandardStreamsCallback(std::string* stdout_str, std::string* stderr_str)
-        : stdout_str_(stdout_str), stderr_str_(stderr_str) {
-    }
-
-    void OnStdout(const char* buffer, int length) {
-        OnStream(stdout_str_, stdout, buffer, length);
-    }
-
-    void OnStderr(const char* buffer, int length) {
-        OnStream(stderr_str_, stderr, buffer, length);
-    }
-
-    int Done(int status) {
-        return status;
-    }
-
-  private:
-    std::string* stdout_str_;
-    std::string* stderr_str_;
-
-    DISALLOW_COPY_AND_ASSIGN(DefaultStandardStreamsCallback);
-};
-
-class SilentStandardStreamsCallbackInterface : public StandardStreamsCallbackInterface {
-  public:
-    SilentStandardStreamsCallbackInterface() = default;
-    void OnStdout(const char*, int) override final {}
-    void OnStderr(const char*, int) override final {}
-    int Done(int status) override final { return status; }
-};
-
-// Singleton.
-extern DefaultStandardStreamsCallback DEFAULT_STANDARD_STREAMS_CALLBACK;
-
-int adb_commandline(int argc, const char** argv);
-
-bool copy_to_file(int inFd, int outFd);
-
-// Connects to the device "shell" service with |command| and prints the
-// resulting output.
-// if |callback| is non-null, stdout/stderr output will be handled by it.
-int send_shell_command(
-        const std::string& command, bool disable_shell_protocol = false,
-        StandardStreamsCallbackInterface* callback = &DEFAULT_STANDARD_STREAMS_CALLBACK);
-
-// Reads from |fd| and prints received data. If |use_shell_protocol| is true
-// this expects that incoming data will use the shell protocol, in which case
-// stdout/stderr are routed independently and the remote exit code will be
-// returned.
-// if |callback| is non-null, stdout/stderr output will be handled by it.
-int read_and_dump(borrowed_fd fd, bool use_shell_protocol = false,
-                  StandardStreamsCallbackInterface* callback = &DEFAULT_STANDARD_STREAMS_CALLBACK);
-
-// Connects to the device "abb" service with |command| and returns the fd.
-template <typename ContainerT>
-unique_fd send_abb_exec_command(const ContainerT& command_args, std::string* error) {
-    std::string service_string = "abb_exec:" + android::base::Join(command_args, ABB_ARG_DELIMETER);
-
-    unique_fd fd(adb_connect(service_string, error));
-    if (fd < 0) {
-        fprintf(stderr, "adb: failed to run abb_exec. Error: %s\n", error->c_str());
-        return unique_fd{};
-    }
-    return fd;
-}
-
-#endif  // COMMANDLINE_H
diff --git a/adb/client/console.cpp b/adb/client/console.cpp
deleted file mode 100644
index d10f4de..0000000
--- a/adb/client/console.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "sysdeps.h"
-
-#include <stdio.h>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <cutils/sockets.h>
-
-#include "adb.h"
-#include "adb_client.h"
-#include "adb_io.h"
-#include "adb_utils.h"
-
-// Return the console authentication command for the emulator, if needed
-static std::string adb_construct_auth_command() {
-    static const char auth_token_filename[] = ".emulator_console_auth_token";
-
-    std::string auth_token_path = adb_get_homedir_path();
-    auth_token_path += OS_PATH_SEPARATOR;
-    auth_token_path += auth_token_filename;
-
-    // read the token
-    std::string token;
-    if (!android::base::ReadFileToString(auth_token_path, &token)
-        || token.empty()) {
-        // we either can't read the file, or it doesn't exist, or it's empty -
-        // either way we won't add any authentication command.
-        return {};
-    }
-
-    // now construct and return the actual command: "auth <token>\n"
-    std::string command = "auth ";
-    command += token;
-    command += '\n';
-    return command;
-}
-
-// Return the console port of the currently connected emulator (if any) or -1 if
-// there is no emulator, and -2 if there is more than one.
-static int adb_get_emulator_console_port(const char* serial) {
-    if (serial) {
-        // The user specified a serial number; is it an emulator?
-        int port;
-        return (sscanf(serial, "emulator-%d", &port) == 1) ? port : -1;
-    }
-
-    // No specific device was given, so get the list of connected devices and
-    // search for emulators. If there's one, we'll take it. If there are more
-    // than one, that's an error.
-    std::string devices;
-    std::string error;
-    if (!adb_query("host:devices", &devices, &error)) {
-        fprintf(stderr, "error: no emulator connected: %s\n", error.c_str());
-        return -1;
-    }
-
-    int port = -1;
-    size_t emulator_count = 0;
-    for (const auto& device : android::base::Split(devices, "\n")) {
-        if (sscanf(device.c_str(), "emulator-%d", &port) == 1) {
-            if (++emulator_count > 1) {
-                fprintf(
-                    stderr, "error: more than one emulator detected; use -s\n");
-                return -1;
-            }
-        }
-    }
-
-    if (emulator_count == 0) {
-        fprintf(stderr, "error: no emulator detected\n");
-        return -1;
-    }
-
-    return port;
-}
-
-static int connect_to_console(const char* serial) {
-    int port = adb_get_emulator_console_port(serial);
-    if (port == -1) {
-        return -1;
-    }
-
-    std::string error;
-    int fd = network_loopback_client(port, SOCK_STREAM, &error);
-    if (fd == -1) {
-        fprintf(stderr, "error: could not connect to TCP port %d: %s\n", port,
-                error.c_str());
-        return -1;
-    }
-    return fd;
-}
-
-int adb_send_emulator_command(int argc, const char** argv, const char* serial) {
-    unique_fd fd(connect_to_console(serial));
-    if (fd == -1) {
-        return 1;
-    }
-
-    std::string commands = adb_construct_auth_command();
-
-    for (int i = 1; i < argc; i++) {
-        commands.append(argv[i]);
-        commands.push_back(i == argc - 1 ? '\n' : ' ');
-    }
-
-    commands.append("quit\n");
-
-    if (!WriteFdExactly(fd, commands)) {
-        fprintf(stderr, "error: cannot write to emulator: %s\n",
-                strerror(errno));
-        return 1;
-    }
-
-    // Drain output that the emulator console has sent us to prevent a problem
-    // on Windows where if adb closes the socket without reading all the data,
-    // the emulator's next call to recv() will have an ECONNABORTED error,
-    // preventing the emulator from reading the command that adb has sent.
-    // https://code.google.com/p/android/issues/detail?id=21021
-    int result;
-    std::string emulator_output;
-    do {
-        char buf[BUFSIZ];
-        result = adb_read(fd, buf, sizeof(buf));
-        // Keep reading until zero bytes (orderly/graceful shutdown) or an
-        // error. If 'adb emu kill' is executed, the emulator calls exit() with
-        // the socket open (and shutdown(SD_SEND) was not called), which causes
-        // Windows to send a TCP RST segment which causes adb to get ECONNRESET.
-        // Any other emu command is followed by the quit command that we
-        // appended above, and that causes the emulator to close the socket
-        // which should cause zero bytes (orderly/graceful shutdown) to be
-        // returned.
-        if (result > 0) emulator_output.append(buf, result);
-    } while (result > 0);
-
-    // Note: the following messages are expected to be quite stable from emulator.
-    //
-    // Emulator console will send the following message upon connection:
-    //
-    // Android Console: Authentication required
-    // Android Console: type 'auth <auth_token>' to authenticate
-    // Android Console: you can find your <auth_token> in
-    // '/<path-to-home>/.emulator_console_auth_token'
-    // OK\r\n
-    //
-    // and the following after authentication:
-    // Android Console: type 'help' for a list of commands
-    // OK\r\n
-    //
-    // So try search and skip first two "OK\r\n", print the rest.
-    //
-    const std::string delims = "OK\r\n";
-    size_t found = 0;
-    for (int i = 0; i < 2; ++i) {
-        const size_t result = emulator_output.find(delims, found);
-        if (result == std::string::npos) {
-            break;
-        } else {
-            found = result + delims.size();
-        }
-    }
-
-    printf("%s", emulator_output.c_str() + found);
-    return 0;
-}
diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp
deleted file mode 100644
index de82e14..0000000
--- a/adb/client/fastdeploy.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "fastdeploy.h"
-
-#include <string.h>
-#include <algorithm>
-#include <array>
-#include <memory>
-
-#include "android-base/file.h"
-#include "android-base/strings.h"
-#include "androidfw/ResourceTypes.h"
-#include "androidfw/ZipFileRO.h"
-#include "client/file_sync_client.h"
-#include "commandline.h"
-#include "deployagent.inc"        // Generated include via build rule.
-#include "deployagentscript.inc"  // Generated include via build rule.
-#include "fastdeploy/deploypatchgenerator/deploy_patch_generator.h"
-#include "fastdeploy/deploypatchgenerator/patch_utils.h"
-#include "fastdeploy/proto/ApkEntry.pb.h"
-#include "fastdeploycallbacks.h"
-#include "sysdeps.h"
-
-#include "adb_utils.h"
-
-static constexpr long kRequiredAgentVersion = 0x00000003;
-
-static constexpr int kPackageMissing = 3;
-static constexpr int kInvalidAgentVersion = 4;
-
-static constexpr const char* kDeviceAgentFile = "/data/local/tmp/deployagent.jar";
-static constexpr const char* kDeviceAgentScript = "/data/local/tmp/deployagent";
-
-static constexpr bool g_verbose_timings = false;
-static FastDeploy_AgentUpdateStrategy g_agent_update_strategy =
-        FastDeploy_AgentUpdateDifferentVersion;
-
-using APKMetaData = com::android::fastdeploy::APKMetaData;
-
-namespace {
-
-struct TimeReporter {
-    TimeReporter(const char* label) : label_(label) {}
-    ~TimeReporter() {
-        if (g_verbose_timings) {
-            auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(
-                    std::chrono::steady_clock::now() - start_);
-            fprintf(stderr, "%s finished in %lldms\n", label_,
-                    static_cast<long long>(duration.count()));
-        }
-    }
-
-  private:
-    const char* label_;
-    std::chrono::steady_clock::time_point start_ = std::chrono::steady_clock::now();
-};
-#define REPORT_FUNC_TIME() TimeReporter reporter(__func__)
-
-struct FileDeleter {
-    FileDeleter(const char* path) : path_(path) {}
-    ~FileDeleter() { adb_unlink(path_); }
-
-  private:
-    const char* const path_;
-};
-
-}  // namespace
-
-int get_device_api_level() {
-    static const int api_level = [] {
-        REPORT_FUNC_TIME();
-        std::vector<char> sdk_version_output_buffer;
-        std::vector<char> sdk_version_error_buffer;
-        int api_level = -1;
-
-        int status_code =
-                capture_shell_command("getprop ro.build.version.sdk", &sdk_version_output_buffer,
-                                      &sdk_version_error_buffer);
-        if (status_code == 0 && sdk_version_output_buffer.size() > 0) {
-            api_level = strtol((char*)sdk_version_output_buffer.data(), nullptr, 10);
-        }
-
-        return api_level;
-    }();
-    return api_level;
-}
-
-void fastdeploy_set_agent_update_strategy(FastDeploy_AgentUpdateStrategy agent_update_strategy) {
-    g_agent_update_strategy = agent_update_strategy;
-}
-
-static void push_to_device(const void* data, size_t byte_count, const char* dst, bool sync) {
-    std::vector<const char*> srcs;
-    TemporaryFile tf;
-    android::base::WriteFully(tf.fd, data, byte_count);
-    srcs.push_back(tf.path);
-    // On Windows, the file needs to be flushed before pushing to device,
-    // but can't be removed until after the push.
-    unix_close(tf.release());
-
-    if (!do_sync_push(srcs, dst, sync, true)) {
-        error_exit("Failed to push fastdeploy agent to device.");
-    }
-}
-
-static bool deploy_agent(bool check_time_stamps) {
-    REPORT_FUNC_TIME();
-
-    push_to_device(kDeployAgent, sizeof(kDeployAgent), kDeviceAgentFile, check_time_stamps);
-    push_to_device(kDeployAgentScript, sizeof(kDeployAgentScript), kDeviceAgentScript,
-                   check_time_stamps);
-
-    // on windows the shell script might have lost execute permission
-    // so need to set this explicitly
-    const char* kChmodCommandPattern = "chmod 777 %s";
-    std::string chmod_command =
-            android::base::StringPrintf(kChmodCommandPattern, kDeviceAgentScript);
-    int ret = send_shell_command(chmod_command);
-    if (ret != 0) {
-        error_exit("Error executing %s returncode: %d", chmod_command.c_str(), ret);
-    }
-
-    return true;
-}
-
-static std::string get_string_from_utf16(const char16_t* input, int input_len) {
-    ssize_t utf8_length = utf16_to_utf8_length(input, input_len);
-    if (utf8_length <= 0) {
-        return {};
-    }
-    std::string utf8;
-    utf8.resize(utf8_length);
-    utf16_to_utf8(input, input_len, &*utf8.begin(), utf8_length + 1);
-    return utf8;
-}
-
-static std::string get_package_name_from_apk(const char* apk_path) {
-#undef open
-    std::unique_ptr<android::ZipFileRO> zip_file((android::ZipFileRO::open)(apk_path));
-#define open ___xxx_unix_open
-    if (zip_file == nullptr) {
-        perror_exit("Could not open %s", apk_path);
-    }
-    android::ZipEntryRO entry = zip_file->findEntryByName("AndroidManifest.xml");
-    if (entry == nullptr) {
-        error_exit("Could not find AndroidManifest.xml inside %s", apk_path);
-    }
-    uint32_t manifest_len = 0;
-    if (!zip_file->getEntryInfo(entry, NULL, &manifest_len, NULL, NULL, NULL, NULL)) {
-        error_exit("Could not read AndroidManifest.xml inside %s", apk_path);
-    }
-    std::vector<char> manifest_data(manifest_len);
-    if (!zip_file->uncompressEntry(entry, manifest_data.data(), manifest_len)) {
-        error_exit("Could not uncompress AndroidManifest.xml inside %s", apk_path);
-    }
-    android::ResXMLTree tree;
-    android::status_t setto_status = tree.setTo(manifest_data.data(), manifest_len, true);
-    if (setto_status != android::OK) {
-        error_exit("Could not parse AndroidManifest.xml inside %s", apk_path);
-    }
-    android::ResXMLParser::event_code_t code;
-    while ((code = tree.next()) != android::ResXMLParser::BAD_DOCUMENT &&
-           code != android::ResXMLParser::END_DOCUMENT) {
-        switch (code) {
-            case android::ResXMLParser::START_TAG: {
-                size_t element_name_length;
-                const char16_t* element_name = tree.getElementName(&element_name_length);
-                if (element_name == nullptr) {
-                    continue;
-                }
-                std::u16string element_name_string(element_name, element_name_length);
-                if (element_name_string == u"manifest") {
-                    for (size_t i = 0; i < tree.getAttributeCount(); i++) {
-                        size_t attribute_name_length;
-                        const char16_t* attribute_name_text =
-                                tree.getAttributeName(i, &attribute_name_length);
-                        if (attribute_name_text == nullptr) {
-                            continue;
-                        }
-                        std::u16string attribute_name_string(attribute_name_text,
-                                                             attribute_name_length);
-                        if (attribute_name_string == u"package") {
-                            size_t attribute_value_length;
-                            const char16_t* attribute_value_text =
-                                    tree.getAttributeStringValue(i, &attribute_value_length);
-                            if (attribute_value_text == nullptr) {
-                                continue;
-                            }
-                            return get_string_from_utf16(attribute_value_text,
-                                                         attribute_value_length);
-                        }
-                    }
-                }
-                break;
-            }
-            default:
-                break;
-        }
-    }
-    error_exit("Could not find package name tag in AndroidManifest.xml inside %s", apk_path);
-}
-
-static long parse_agent_version(const std::vector<char>& version_buffer) {
-    long version = -1;
-    if (!version_buffer.empty()) {
-        version = strtol((char*)version_buffer.data(), NULL, 16);
-    }
-    return version;
-}
-
-static void update_agent_if_necessary() {
-    switch (g_agent_update_strategy) {
-        case FastDeploy_AgentUpdateAlways:
-            deploy_agent(/*check_time_stamps=*/false);
-            break;
-        case FastDeploy_AgentUpdateNewerTimeStamp:
-            deploy_agent(/*check_time_stamps=*/true);
-            break;
-        default:
-            break;
-    }
-}
-
-std::optional<APKMetaData> extract_metadata(const char* apk_path) {
-    // Update agent if there is a command line argument forcing to do so.
-    update_agent_if_necessary();
-
-    REPORT_FUNC_TIME();
-
-    std::string package_name = get_package_name_from_apk(apk_path);
-
-    // Dump apk command checks the required vs current agent version and if they match then returns
-    // the APK dump for package. Doing this in a single call saves round-trip and agent launch time.
-    constexpr const char* kAgentDumpCommandPattern = "/data/local/tmp/deployagent dump %ld %s";
-    std::string dump_command = android::base::StringPrintf(
-            kAgentDumpCommandPattern, kRequiredAgentVersion, package_name.c_str());
-
-    std::vector<char> dump_out_buffer;
-    std::vector<char> dump_error_buffer;
-    int returnCode =
-            capture_shell_command(dump_command.c_str(), &dump_out_buffer, &dump_error_buffer);
-    if (returnCode >= kInvalidAgentVersion) {
-        // Agent has wrong version or missing.
-        long agent_version = parse_agent_version(dump_out_buffer);
-        if (agent_version < 0) {
-            printf("Could not detect agent on device, deploying\n");
-        } else {
-            printf("Device agent version is (%ld), (%ld) is required, re-deploying\n",
-                   agent_version, kRequiredAgentVersion);
-        }
-        deploy_agent(/*check_time_stamps=*/false);
-
-        // Retry with new agent.
-        dump_out_buffer.clear();
-        dump_error_buffer.clear();
-        returnCode =
-                capture_shell_command(dump_command.c_str(), &dump_out_buffer, &dump_error_buffer);
-    }
-    if (returnCode != 0) {
-        if (returnCode == kInvalidAgentVersion) {
-            long agent_version = parse_agent_version(dump_out_buffer);
-            error_exit(
-                    "After update agent version remains incorrect! Expected %ld but version is %ld",
-                    kRequiredAgentVersion, agent_version);
-        }
-        if (returnCode == kPackageMissing) {
-            fprintf(stderr, "Package %s not found, falling back to install\n",
-                    package_name.c_str());
-            return {};
-        }
-        fprintf(stderr, "Executing %s returned %d\n", dump_command.c_str(), returnCode);
-        fprintf(stderr, "%*s\n", int(dump_error_buffer.size()), dump_error_buffer.data());
-        error_exit("Aborting");
-    }
-
-    com::android::fastdeploy::APKDump dump;
-    if (!dump.ParseFromArray(dump_out_buffer.data(), dump_out_buffer.size())) {
-        fprintf(stderr, "Can't parse output of %s\n", dump_command.c_str());
-        error_exit("Aborting");
-    }
-
-    return PatchUtils::GetDeviceAPKMetaData(dump);
-}
-
-unique_fd install_patch(int argc, const char** argv) {
-    REPORT_FUNC_TIME();
-    constexpr char kAgentApplyServicePattern[] = "shell:/data/local/tmp/deployagent apply - -pm %s";
-
-    std::vector<unsigned char> apply_output_buffer;
-    std::vector<unsigned char> apply_error_buffer;
-    std::string argsString;
-
-    bool rSwitchPresent = false;
-    for (int i = 0; i < argc; i++) {
-        argsString.append(argv[i]);
-        argsString.append(" ");
-        if (!strcmp(argv[i], "-r")) {
-            rSwitchPresent = true;
-        }
-    }
-    if (!rSwitchPresent) {
-        argsString.append("-r");
-    }
-
-    std::string error;
-    std::string apply_patch_service_string =
-            android::base::StringPrintf(kAgentApplyServicePattern, argsString.c_str());
-    unique_fd fd{adb_connect(apply_patch_service_string, &error)};
-    if (fd < 0) {
-        error_exit("Executing %s returned %s", apply_patch_service_string.c_str(), error.c_str());
-    }
-    return fd;
-}
-
-unique_fd apply_patch_on_device(const char* output_path) {
-    REPORT_FUNC_TIME();
-    constexpr char kAgentApplyServicePattern[] = "shell:/data/local/tmp/deployagent apply - -o %s";
-
-    std::string error;
-    std::string apply_patch_service_string =
-            android::base::StringPrintf(kAgentApplyServicePattern, output_path);
-    unique_fd fd{adb_connect(apply_patch_service_string, &error)};
-    if (fd < 0) {
-        error_exit("Executing %s returned %s", apply_patch_service_string.c_str(), error.c_str());
-    }
-    return fd;
-}
-
-static void create_patch(const char* apk_path, APKMetaData metadata, borrowed_fd patch_fd) {
-    REPORT_FUNC_TIME();
-    DeployPatchGenerator generator(/*is_verbose=*/false);
-    bool success = generator.CreatePatch(apk_path, std::move(metadata), patch_fd);
-    if (!success) {
-        error_exit("Failed to create patch for %s", apk_path);
-    }
-}
-
-int stream_patch(const char* apk_path, APKMetaData metadata, unique_fd patch_fd) {
-    create_patch(apk_path, std::move(metadata), patch_fd);
-
-    REPORT_FUNC_TIME();
-    return read_and_dump(patch_fd.get());
-}
diff --git a/adb/client/fastdeploy.h b/adb/client/fastdeploy.h
deleted file mode 100644
index 830aeb2..0000000
--- a/adb/client/fastdeploy.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-
-#include "fastdeploy/proto/ApkEntry.pb.h"
-
-#include <optional>
-#include <string>
-
-enum FastDeploy_AgentUpdateStrategy {
-    FastDeploy_AgentUpdateAlways,
-    FastDeploy_AgentUpdateNewerTimeStamp,
-    FastDeploy_AgentUpdateDifferentVersion
-};
-
-void fastdeploy_set_agent_update_strategy(FastDeploy_AgentUpdateStrategy agent_update_strategy);
-int get_device_api_level();
-
-std::optional<com::android::fastdeploy::APKMetaData> extract_metadata(const char* apk_path);
-unique_fd install_patch(int argc, const char** argv);
-unique_fd apply_patch_on_device(const char* output_path);
-int stream_patch(const char* apk_path, com::android::fastdeploy::APKMetaData metadata,
-                 unique_fd patch_fd);
diff --git a/adb/client/fastdeploycallbacks.cpp b/adb/client/fastdeploycallbacks.cpp
deleted file mode 100644
index 86ceaa1..0000000
--- a/adb/client/fastdeploycallbacks.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#define TRACE_TAG ADB
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "client/file_sync_client.h"
-#include "commandline.h"
-#include "sysdeps.h"
-
-#include "fastdeploycallbacks.h"
-
-static void appendBuffer(std::vector<char>* buffer, const char* input, int length) {
-    if (buffer != NULL) {
-        buffer->insert(buffer->end(), input, input + length);
-    }
-}
-
-class DeployAgentBufferCallback : public StandardStreamsCallbackInterface {
-  public:
-    DeployAgentBufferCallback(std::vector<char>* outBuffer, std::vector<char>* errBuffer);
-
-    virtual void OnStdout(const char* buffer, int length);
-    virtual void OnStderr(const char* buffer, int length);
-    virtual int Done(int status);
-
-  private:
-    std::vector<char>* mpOutBuffer;
-    std::vector<char>* mpErrBuffer;
-};
-
-int capture_shell_command(const char* command, std::vector<char>* outBuffer,
-                          std::vector<char>* errBuffer) {
-    DeployAgentBufferCallback cb(outBuffer, errBuffer);
-    return send_shell_command(command, /*disable_shell_protocol=*/false, &cb);
-}
-
-DeployAgentBufferCallback::DeployAgentBufferCallback(std::vector<char>* outBuffer,
-                                                     std::vector<char>* errBuffer) {
-    mpOutBuffer = outBuffer;
-    mpErrBuffer = errBuffer;
-}
-
-void DeployAgentBufferCallback::OnStdout(const char* buffer, int length) {
-    appendBuffer(mpOutBuffer, buffer, length);
-}
-
-void DeployAgentBufferCallback::OnStderr(const char* buffer, int length) {
-    appendBuffer(mpErrBuffer, buffer, length);
-}
-
-int DeployAgentBufferCallback::Done(int status) {
-    return status;
-}
diff --git a/adb/client/fastdeploycallbacks.h b/adb/client/fastdeploycallbacks.h
deleted file mode 100644
index 4a6fb99..0000000
--- a/adb/client/fastdeploycallbacks.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <vector>
-
-int capture_shell_command(const char* command, std::vector<char>* outBuffer,
-                          std::vector<char>* errBuffer);
diff --git a/adb/client/file_sync_client.cpp b/adb/client/file_sync_client.cpp
deleted file mode 100644
index e686973..0000000
--- a/adb/client/file_sync_client.cpp
+++ /dev/null
@@ -1,1650 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#include "client/file_sync_client.h"
-
-#include <dirent.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-#include <utime.h>
-
-#include <chrono>
-#include <deque>
-#include <functional>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "sysdeps.h"
-
-#include "adb.h"
-#include "adb_client.h"
-#include "adb_io.h"
-#include "adb_utils.h"
-#include "brotli_utils.h"
-#include "file_sync_protocol.h"
-#include "line_printer.h"
-#include "sysdeps/errno.h"
-#include "sysdeps/stat.h"
-
-#include "client/commandline.h"
-
-#include <android-base/file.h>
-#include <android-base/strings.h>
-#include <android-base/stringprintf.h>
-
-using namespace std::literals;
-
-typedef void(sync_ls_cb)(unsigned mode, uint64_t size, uint64_t time, const char* name);
-
-struct syncsendbuf {
-    unsigned id;
-    unsigned size;
-    char data[SYNC_DATA_MAX];
-};
-
-static void ensure_trailing_separators(std::string& local_path, std::string& remote_path) {
-    if (!adb_is_separator(local_path.back())) {
-        local_path.push_back(OS_PATH_SEPARATOR);
-    }
-    if (remote_path.back() != '/') {
-        remote_path.push_back('/');
-    }
-}
-
-static bool should_pull_file(mode_t mode) {
-    return S_ISREG(mode) || S_ISBLK(mode) || S_ISCHR(mode);
-}
-
-static bool should_push_file(mode_t mode) {
-    return S_ISREG(mode) || S_ISLNK(mode);
-}
-
-struct copyinfo {
-    std::string lpath;
-    std::string rpath;
-    int64_t time = 0;
-    uint32_t mode;
-    uint64_t size = 0;
-    bool skip = false;
-
-    copyinfo(const std::string& local_path,
-             const std::string& remote_path,
-             const std::string& name,
-             unsigned int mode)
-            : lpath(local_path), rpath(remote_path), mode(mode) {
-        ensure_trailing_separators(lpath, rpath);
-        lpath.append(name);
-        rpath.append(name);
-        if (S_ISDIR(mode)) {
-            ensure_trailing_separators(lpath, rpath);
-        }
-    }
-};
-
-enum class TransferDirection {
-    push,
-    pull,
-};
-
-struct TransferLedger {
-    std::chrono::steady_clock::time_point start_time;
-    uint64_t files_transferred;
-    uint64_t files_skipped;
-    uint64_t bytes_transferred;
-    uint64_t bytes_expected;
-    bool expect_multiple_files;
-
-  private:
-    std::string last_progress_str;
-    std::chrono::steady_clock::time_point last_progress_time;
-
-  public:
-    TransferLedger() {
-        Reset();
-    }
-
-    bool operator==(const TransferLedger& other) const {
-        return files_transferred == other.files_transferred &&
-               files_skipped == other.files_skipped && bytes_transferred == other.bytes_transferred;
-    }
-
-    bool operator!=(const TransferLedger& other) const {
-        return !(*this == other);
-    }
-
-    void Reset() {
-        start_time = std::chrono::steady_clock::now();
-        files_transferred = 0;
-        files_skipped = 0;
-        bytes_transferred = 0;
-        bytes_expected = 0;
-        last_progress_str.clear();
-        last_progress_time = {};
-    }
-
-    std::string TransferRate() {
-        if (bytes_transferred == 0) return "";
-
-        std::chrono::duration<double> duration;
-        duration = std::chrono::steady_clock::now() - start_time;
-
-        double s = duration.count();
-        if (s == 0) {
-            return "";
-        }
-        double rate = (static_cast<double>(bytes_transferred) / s) / (1024 * 1024);
-        return android::base::StringPrintf(" %.1f MB/s (%" PRIu64 " bytes in %.3fs)", rate,
-                                           bytes_transferred, s);
-    }
-
-    void ReportProgress(LinePrinter& lp, const std::string& file, uint64_t file_copied_bytes,
-                        uint64_t file_total_bytes) {
-        static constexpr auto kProgressReportInterval = 100ms;
-
-        auto now = std::chrono::steady_clock::now();
-        if (now < last_progress_time + kProgressReportInterval) {
-            return;
-        }
-        char overall_percentage_str[5] = "?";
-        if (bytes_expected != 0 && bytes_transferred <= bytes_expected) {
-            int overall_percentage = static_cast<int>(bytes_transferred * 100 / bytes_expected);
-            // If we're pulling symbolic links, we'll pull the target of the link rather than
-            // just create a local link, and that will cause us to go over 100%.
-            if (overall_percentage <= 100) {
-                snprintf(overall_percentage_str, sizeof(overall_percentage_str), "%d%%",
-                         overall_percentage);
-            }
-        }
-
-        std::string output;
-        if (file_copied_bytes > file_total_bytes || file_total_bytes == 0) {
-            // This case can happen if we're racing against something that wrote to the file
-            // between our stat and our read, or if we're reading a magic file that lies about
-            // its size. Just show how much we've copied.
-            output = android::base::StringPrintf("[%4s] %s: %" PRId64 "/?", overall_percentage_str,
-                                                 file.c_str(), file_copied_bytes);
-        } else {
-            // If we're transferring multiple files, we want to know how far through the current
-            // file we are, as well as the overall percentage.
-            if (expect_multiple_files) {
-                int file_percentage = static_cast<int>(file_copied_bytes * 100 / file_total_bytes);
-                output = android::base::StringPrintf("[%4s] %s: %d%%", overall_percentage_str,
-                                                     file.c_str(), file_percentage);
-            } else {
-                output =
-                    android::base::StringPrintf("[%4s] %s", overall_percentage_str, file.c_str());
-            }
-        }
-        if (output != last_progress_str) {
-            lp.Print(output, LinePrinter::LineType::INFO);
-            last_progress_str = std::move(output);
-            last_progress_time = now;
-        }
-    }
-
-    void ReportTransferRate(LinePrinter& lp, const std::string& name, TransferDirection direction) {
-        const char* direction_str = (direction == TransferDirection::push) ? "pushed" : "pulled";
-        std::stringstream ss;
-        if (!name.empty()) {
-            std::string_view display_name(name);
-            char* out = getenv("ANDROID_PRODUCT_OUT");
-            if (out) android::base::ConsumePrefix(&display_name, out);
-            ss << display_name << ": ";
-        }
-        ss << files_transferred << " file" << ((files_transferred == 1) ? "" : "s") << " "
-           << direction_str << ", " << files_skipped << " skipped.";
-        ss << TransferRate();
-
-        lp.Print(ss.str(), LinePrinter::LineType::INFO);
-        lp.KeepInfoLine();
-    }
-};
-
-class SyncConnection {
-  public:
-    SyncConnection() : acknowledgement_buffer_(sizeof(sync_status) + SYNC_DATA_MAX) {
-        acknowledgement_buffer_.resize(0);
-        max = SYNC_DATA_MAX; // TODO: decide at runtime.
-
-        std::string error;
-        if (!adb_get_feature_set(&features_, &error)) {
-            Error("failed to get feature set: %s", error.c_str());
-        } else {
-            have_stat_v2_ = CanUseFeature(features_, kFeatureStat2);
-            have_ls_v2_ = CanUseFeature(features_, kFeatureLs2);
-            have_sendrecv_v2_ = CanUseFeature(features_, kFeatureSendRecv2);
-            have_sendrecv_v2_brotli_ = CanUseFeature(features_, kFeatureSendRecv2Brotli);
-            fd.reset(adb_connect("sync:", &error));
-            if (fd < 0) {
-                Error("connect failed: %s", error.c_str());
-            }
-        }
-    }
-
-    ~SyncConnection() {
-        if (!IsValid()) return;
-
-        if (SendQuit()) {
-            // We sent a quit command, so the server should be doing orderly
-            // shutdown soon. But if we encountered an error while we were using
-            // the connection, the server might still be sending data (before
-            // doing orderly shutdown), in which case we won't wait for all of
-            // the data nor the coming orderly shutdown. In the common success
-            // case, this will wait for the server to do orderly shutdown.
-            ReadOrderlyShutdown(fd);
-        }
-
-        line_printer_.KeepInfoLine();
-    }
-
-    bool HaveSendRecv2() const { return have_sendrecv_v2_; }
-    bool HaveSendRecv2Brotli() const { return have_sendrecv_v2_brotli_; }
-
-    const FeatureSet& Features() const { return features_; }
-
-    bool IsValid() { return fd >= 0; }
-
-    void NewTransfer() {
-        current_ledger_.Reset();
-    }
-
-    void RecordBytesTransferred(size_t bytes) {
-        current_ledger_.bytes_transferred += bytes;
-        global_ledger_.bytes_transferred += bytes;
-    }
-
-    void RecordFileSent(std::string from, std::string to) {
-        RecordFilesTransferred(1);
-        deferred_acknowledgements_.emplace_back(std::move(from), std::move(to));
-    }
-
-    void RecordFilesTransferred(size_t files) {
-        current_ledger_.files_transferred += files;
-        global_ledger_.files_transferred += files;
-    }
-
-    void RecordFilesSkipped(size_t files) {
-        current_ledger_.files_skipped += files;
-        global_ledger_.files_skipped += files;
-    }
-
-    void ReportProgress(const std::string& file, uint64_t file_copied_bytes,
-                        uint64_t file_total_bytes) {
-        current_ledger_.ReportProgress(line_printer_, file, file_copied_bytes, file_total_bytes);
-    }
-
-    void ReportTransferRate(const std::string& file, TransferDirection direction) {
-        current_ledger_.ReportTransferRate(line_printer_, file, direction);
-    }
-
-    void ReportOverallTransferRate(TransferDirection direction) {
-        if (current_ledger_ != global_ledger_) {
-            global_ledger_.ReportTransferRate(line_printer_, "", direction);
-        }
-    }
-
-    bool SendRequest(int id, const std::string& path) {
-        if (path.length() > 1024) {
-            Error("SendRequest failed: path too long: %zu", path.length());
-            errno = ENAMETOOLONG;
-            return false;
-        }
-
-        // Sending header and payload in a single write makes a noticeable
-        // difference to "adb sync" performance.
-        std::vector<char> buf(sizeof(SyncRequest) + path.length());
-        SyncRequest* req = reinterpret_cast<SyncRequest*>(&buf[0]);
-        req->id = id;
-        req->path_length = path.length();
-        char* data = reinterpret_cast<char*>(req + 1);
-        memcpy(data, path.data(), path.length());
-        return WriteFdExactly(fd, buf.data(), buf.size());
-    }
-
-    bool SendSend2(std::string_view path, mode_t mode, bool compressed) {
-        if (path.length() > 1024) {
-            Error("SendRequest failed: path too long: %zu", path.length());
-            errno = ENAMETOOLONG;
-            return false;
-        }
-
-        Block buf;
-
-        SyncRequest req;
-        req.id = ID_SEND_V2;
-        req.path_length = path.length();
-
-        syncmsg msg;
-        msg.send_v2_setup.id = ID_SEND_V2;
-        msg.send_v2_setup.mode = mode;
-        msg.send_v2_setup.flags = compressed ? kSyncFlagBrotli : kSyncFlagNone;
-
-        buf.resize(sizeof(SyncRequest) + path.length() + sizeof(msg.send_v2_setup));
-
-        void* p = buf.data();
-
-        p = mempcpy(p, &req, sizeof(SyncRequest));
-        p = mempcpy(p, path.data(), path.length());
-        p = mempcpy(p, &msg.send_v2_setup, sizeof(msg.send_v2_setup));
-
-        return WriteFdExactly(fd, buf.data(), buf.size());
-    }
-
-    bool SendRecv2(const std::string& path) {
-        if (path.length() > 1024) {
-            Error("SendRequest failed: path too long: %zu", path.length());
-            errno = ENAMETOOLONG;
-            return false;
-        }
-
-        Block buf;
-
-        SyncRequest req;
-        req.id = ID_RECV_V2;
-        req.path_length = path.length();
-
-        syncmsg msg;
-        msg.recv_v2_setup.id = ID_RECV_V2;
-        msg.recv_v2_setup.flags = kSyncFlagBrotli;
-
-        buf.resize(sizeof(SyncRequest) + path.length() + sizeof(msg.recv_v2_setup));
-
-        void* p = buf.data();
-
-        p = mempcpy(p, &req, sizeof(SyncRequest));
-        p = mempcpy(p, path.data(), path.length());
-        p = mempcpy(p, &msg.recv_v2_setup, sizeof(msg.recv_v2_setup));
-
-        return WriteFdExactly(fd, buf.data(), buf.size());
-    }
-
-    bool SendStat(const std::string& path) {
-        if (!have_stat_v2_) {
-            errno = ENOTSUP;
-            return false;
-        }
-        return SendRequest(ID_STAT_V2, path);
-    }
-
-    bool SendLstat(const std::string& path) {
-        if (have_stat_v2_) {
-            return SendRequest(ID_LSTAT_V2, path);
-        } else {
-            return SendRequest(ID_LSTAT_V1, path);
-        }
-    }
-
-    bool FinishStat(struct stat* st) {
-        syncmsg msg;
-
-        memset(st, 0, sizeof(*st));
-        if (have_stat_v2_) {
-            if (!ReadFdExactly(fd.get(), &msg.stat_v2, sizeof(msg.stat_v2))) {
-                PLOG(FATAL) << "protocol fault: failed to read stat response";
-            }
-
-            if (msg.stat_v2.id != ID_LSTAT_V2 && msg.stat_v2.id != ID_STAT_V2) {
-                PLOG(FATAL) << "protocol fault: stat response has wrong message id: "
-                            << msg.stat_v2.id;
-            }
-
-            if (msg.stat_v2.error != 0) {
-                errno = errno_from_wire(msg.stat_v2.error);
-                return false;
-            }
-
-            st->st_dev = msg.stat_v2.dev;
-            st->st_ino = msg.stat_v2.ino;
-            st->st_mode = msg.stat_v2.mode;
-            st->st_nlink = msg.stat_v2.nlink;
-            st->st_uid = msg.stat_v2.uid;
-            st->st_gid = msg.stat_v2.gid;
-            st->st_size = msg.stat_v2.size;
-            st->st_atime = msg.stat_v2.atime;
-            st->st_mtime = msg.stat_v2.mtime;
-            st->st_ctime = msg.stat_v2.ctime;
-            return true;
-        } else {
-            if (!ReadFdExactly(fd.get(), &msg.stat_v1, sizeof(msg.stat_v1))) {
-                PLOG(FATAL) << "protocol fault: failed to read stat response";
-            }
-
-            if (msg.stat_v1.id != ID_LSTAT_V1) {
-                LOG(FATAL) << "protocol fault: stat response has wrong message id: "
-                           << msg.stat_v1.id;
-            }
-
-            if (msg.stat_v1.mode == 0 && msg.stat_v1.size == 0 && msg.stat_v1.mtime == 0) {
-                // There's no way for us to know what the error was.
-                errno = ENOPROTOOPT;
-                return false;
-            }
-
-            st->st_mode = msg.stat_v1.mode;
-            st->st_size = msg.stat_v1.size;
-            st->st_ctime = msg.stat_v1.mtime;
-            st->st_mtime = msg.stat_v1.mtime;
-        }
-
-        return true;
-    }
-
-    bool SendLs(const std::string& path) {
-        return SendRequest(have_ls_v2_ ? ID_LIST_V2 : ID_LIST_V1, path);
-    }
-
-  private:
-    template <bool v2>
-    static bool FinishLsImpl(borrowed_fd fd, const std::function<sync_ls_cb>& callback) {
-        using dent_type =
-                std::conditional_t<v2, decltype(syncmsg::dent_v2), decltype(syncmsg::dent_v1)>;
-
-        while (true) {
-            dent_type dent;
-            if (!ReadFdExactly(fd, &dent, sizeof(dent))) return false;
-
-            uint32_t expected_id = v2 ? ID_DENT_V2 : ID_DENT_V1;
-            if (dent.id == ID_DONE) return true;
-            if (dent.id != expected_id) return false;
-
-            // Maximum length of a file name excluding null terminator (NAME_MAX) on Linux is 255.
-            char buf[256];
-            size_t len = dent.namelen;
-            if (len > 255) return false;
-
-            if (!ReadFdExactly(fd, buf, len)) return false;
-            buf[len] = 0;
-
-            callback(dent.mode, dent.size, dent.mtime, buf);
-        }
-    }
-
-  public:
-    bool FinishLs(const std::function<sync_ls_cb>& callback) {
-        if (have_ls_v2_) {
-            return FinishLsImpl<true>(this->fd, callback);
-        } else {
-            return FinishLsImpl<false>(this->fd, callback);
-        }
-    }
-
-    // Sending header, payload, and footer in a single write makes a huge
-    // difference to "adb sync" performance.
-    bool SendSmallFile(const std::string& path, mode_t mode, const std::string& lpath,
-                       const std::string& rpath, unsigned mtime, const char* data,
-                       size_t data_length) {
-        std::string path_and_mode = android::base::StringPrintf("%s,%d", path.c_str(), mode);
-        if (path_and_mode.length() > 1024) {
-            Error("SendSmallFile failed: path too long: %zu", path_and_mode.length());
-            errno = ENAMETOOLONG;
-            return false;
-        }
-
-        std::vector<char> buf(sizeof(SyncRequest) + path_and_mode.length() + sizeof(SyncRequest) +
-                              data_length + sizeof(SyncRequest));
-        char* p = &buf[0];
-
-        SyncRequest* req_send = reinterpret_cast<SyncRequest*>(p);
-        req_send->id = ID_SEND_V1;
-        req_send->path_length = path_and_mode.length();
-        p += sizeof(SyncRequest);
-        memcpy(p, path_and_mode.data(), path_and_mode.size());
-        p += path_and_mode.length();
-
-        SyncRequest* req_data = reinterpret_cast<SyncRequest*>(p);
-        req_data->id = ID_DATA;
-        req_data->path_length = data_length;
-        p += sizeof(SyncRequest);
-        memcpy(p, data, data_length);
-        p += data_length;
-
-        SyncRequest* req_done = reinterpret_cast<SyncRequest*>(p);
-        req_done->id = ID_DONE;
-        req_done->path_length = mtime;
-        p += sizeof(SyncRequest);
-
-        WriteOrDie(lpath, rpath, &buf[0], (p - &buf[0]));
-
-        RecordFileSent(lpath, rpath);
-        RecordBytesTransferred(data_length);
-        ReportProgress(rpath, data_length, data_length);
-        return true;
-    }
-
-    bool SendLargeFileCompressed(const std::string& path, mode_t mode, const std::string& lpath,
-                                 const std::string& rpath, unsigned mtime) {
-        if (!SendSend2(path, mode, true)) {
-            Error("failed to send ID_SEND_V2 message '%s': %s", path.c_str(), strerror(errno));
-            return false;
-        }
-
-        struct stat st;
-        if (stat(lpath.c_str(), &st) == -1) {
-            Error("cannot stat '%s': %s", lpath.c_str(), strerror(errno));
-            return false;
-        }
-
-        uint64_t total_size = st.st_size;
-        uint64_t bytes_copied = 0;
-
-        unique_fd lfd(adb_open(lpath.c_str(), O_RDONLY | O_CLOEXEC));
-        if (lfd < 0) {
-            Error("opening '%s' locally failed: %s", lpath.c_str(), strerror(errno));
-            return false;
-        }
-
-        syncsendbuf sbuf;
-        sbuf.id = ID_DATA;
-
-        BrotliEncoder<SYNC_DATA_MAX> encoder;
-        bool sending = true;
-        while (sending) {
-            Block input(SYNC_DATA_MAX);
-            int r = adb_read(lfd.get(), input.data(), input.size());
-            if (r < 0) {
-                Error("reading '%s' locally failed: %s", lpath.c_str(), strerror(errno));
-                return false;
-            }
-
-            if (r == 0) {
-                encoder.Finish();
-            } else {
-                input.resize(r);
-                encoder.Append(std::move(input));
-                RecordBytesTransferred(r);
-                bytes_copied += r;
-                ReportProgress(rpath, bytes_copied, total_size);
-            }
-
-            while (true) {
-                Block output;
-                BrotliEncodeResult result = encoder.Encode(&output);
-                if (result == BrotliEncodeResult::Error) {
-                    Error("compressing '%s' locally failed", lpath.c_str());
-                    return false;
-                }
-
-                if (!output.empty()) {
-                    sbuf.size = output.size();
-                    memcpy(sbuf.data, output.data(), output.size());
-                    WriteOrDie(lpath, rpath, &sbuf, sizeof(SyncRequest) + output.size());
-                }
-
-                if (result == BrotliEncodeResult::Done) {
-                    sending = false;
-                    break;
-                } else if (result == BrotliEncodeResult::NeedInput) {
-                    break;
-                } else if (result == BrotliEncodeResult::MoreOutput) {
-                    continue;
-                }
-            }
-        }
-
-        syncmsg msg;
-        msg.data.id = ID_DONE;
-        msg.data.size = mtime;
-        RecordFileSent(lpath, rpath);
-        return WriteOrDie(lpath, rpath, &msg.data, sizeof(msg.data));
-    }
-
-    bool SendLargeFile(const std::string& path, mode_t mode, const std::string& lpath,
-                       const std::string& rpath, unsigned mtime, bool compressed) {
-        if (compressed && HaveSendRecv2Brotli()) {
-            return SendLargeFileCompressed(path, mode, lpath, rpath, mtime);
-        }
-
-        std::string path_and_mode = android::base::StringPrintf("%s,%d", path.c_str(), mode);
-        if (!SendRequest(ID_SEND_V1, path_and_mode)) {
-            Error("failed to send ID_SEND_V1 message '%s': %s", path_and_mode.c_str(),
-                  strerror(errno));
-            return false;
-        }
-
-        struct stat st;
-        if (stat(lpath.c_str(), &st) == -1) {
-            Error("cannot stat '%s': %s", lpath.c_str(), strerror(errno));
-            return false;
-        }
-
-        uint64_t total_size = st.st_size;
-        uint64_t bytes_copied = 0;
-
-        unique_fd lfd(adb_open(lpath.c_str(), O_RDONLY | O_CLOEXEC));
-        if (lfd < 0) {
-            Error("opening '%s' locally failed: %s", lpath.c_str(), strerror(errno));
-            return false;
-        }
-
-        syncsendbuf sbuf;
-        sbuf.id = ID_DATA;
-
-        while (true) {
-            int bytes_read = adb_read(lfd, sbuf.data, max);
-            if (bytes_read == -1) {
-                Error("reading '%s' locally failed: %s", lpath.c_str(), strerror(errno));
-                return false;
-            } else if (bytes_read == 0) {
-                break;
-            }
-
-            sbuf.size = bytes_read;
-            WriteOrDie(lpath, rpath, &sbuf, sizeof(SyncRequest) + bytes_read);
-
-            RecordBytesTransferred(bytes_read);
-            bytes_copied += bytes_read;
-            ReportProgress(rpath, bytes_copied, total_size);
-        }
-
-        syncmsg msg;
-        msg.data.id = ID_DONE;
-        msg.data.size = mtime;
-        RecordFileSent(lpath, rpath);
-        return WriteOrDie(lpath, rpath, &msg.data, sizeof(msg.data));
-    }
-
-    bool ReportCopyFailure(const std::string& from, const std::string& to, const syncmsg& msg) {
-        std::vector<char> buf(msg.status.msglen + 1);
-        if (!ReadFdExactly(fd, &buf[0], msg.status.msglen)) {
-            Error("failed to copy '%s' to '%s'; failed to read reason (!): %s", from.c_str(),
-                  to.c_str(), strerror(errno));
-            return false;
-        }
-        buf[msg.status.msglen] = 0;
-        Error("failed to copy '%s' to '%s': remote %s", from.c_str(), to.c_str(), &buf[0]);
-        return false;
-    }
-
-    void CopyDone() { deferred_acknowledgements_.pop_front(); }
-
-    void ReportDeferredCopyFailure(const std::string& msg) {
-        auto& [from, to] = deferred_acknowledgements_.front();
-        Error("failed to copy '%s' to '%s': remote %s", from.c_str(), to.c_str(), msg.c_str());
-        deferred_acknowledgements_.pop_front();
-    }
-
-    bool ReadAcknowledgements(bool read_all = false) {
-        // We need to read enough such that adbd's intermediate socket's write buffer can't be
-        // full. The default buffer on Linux is 212992 bytes, but there's 576 bytes of bookkeeping
-        // overhead per write. The worst case scenario is a continuous string of failures, since
-        // each logical packet is divided into two writes. If our packet size if conservatively 512
-        // bytes long, this leaves us with space for 128 responses.
-        constexpr size_t max_deferred_acks = 128;
-        auto& buf = acknowledgement_buffer_;
-        adb_pollfd pfd = {.fd = fd.get(), .events = POLLIN};
-        while (!deferred_acknowledgements_.empty()) {
-            bool should_block = read_all || deferred_acknowledgements_.size() >= max_deferred_acks;
-
-            ssize_t rc = adb_poll(&pfd, 1, should_block ? -1 : 0);
-            if (rc == 0) {
-                CHECK(!should_block);
-                return true;
-            }
-
-            if (acknowledgement_buffer_.size() < sizeof(sync_status)) {
-                const ssize_t header_bytes_left = sizeof(sync_status) - buf.size();
-                ssize_t rc = adb_read(fd, buf.end(), header_bytes_left);
-                if (rc <= 0) {
-                    Error("failed to read copy response");
-                    return false;
-                }
-
-                buf.resize(buf.size() + rc);
-                if (rc != header_bytes_left) {
-                    // Early exit if we run out of data in the socket.
-                    return true;
-                }
-
-                if (!should_block) {
-                    // We don't want to read again yet, because the socket might be empty.
-                    continue;
-                }
-            }
-
-            auto* hdr = reinterpret_cast<sync_status*>(buf.data());
-            if (hdr->id == ID_OKAY) {
-                buf.resize(0);
-                if (hdr->msglen != 0) {
-                    Error("received ID_OKAY with msg_len (%" PRIu32 " != 0", hdr->msglen);
-                    return false;
-                }
-                CopyDone();
-                continue;
-            } else if (hdr->id != ID_FAIL) {
-                Error("unexpected response from daemon: id = %#" PRIx32, hdr->id);
-                return false;
-            } else if (hdr->msglen > SYNC_DATA_MAX) {
-                Error("too-long message length from daemon: msglen = %" PRIu32, hdr->msglen);
-                return false;
-            }
-
-            const ssize_t msg_bytes_left = hdr->msglen + sizeof(sync_status) - buf.size();
-            CHECK_GE(msg_bytes_left, 0);
-            if (msg_bytes_left > 0) {
-                ssize_t rc = adb_read(fd, buf.end(), msg_bytes_left);
-                if (rc <= 0) {
-                    Error("failed to read copy failure message");
-                    return false;
-                }
-
-                buf.resize(buf.size() + rc);
-                if (rc != msg_bytes_left) {
-                    if (should_block) {
-                        continue;
-                    } else {
-                        return true;
-                    }
-                }
-
-                std::string msg(buf.begin() + sizeof(sync_status), buf.end());
-                ReportDeferredCopyFailure(msg);
-                buf.resize(0);
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    void Printf(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) {
-        std::string s;
-
-        va_list ap;
-        va_start(ap, fmt);
-        android::base::StringAppendV(&s, fmt, ap);
-        va_end(ap);
-
-        line_printer_.Print(s, LinePrinter::INFO);
-    }
-
-    void Println(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) {
-        std::string s;
-
-        va_list ap;
-        va_start(ap, fmt);
-        android::base::StringAppendV(&s, fmt, ap);
-        va_end(ap);
-
-        line_printer_.Print(s, LinePrinter::INFO);
-        line_printer_.KeepInfoLine();
-    }
-
-    void Error(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) {
-        std::string s = "adb: error: ";
-
-        va_list ap;
-        va_start(ap, fmt);
-        android::base::StringAppendV(&s, fmt, ap);
-        va_end(ap);
-
-        line_printer_.Print(s, LinePrinter::ERROR);
-    }
-
-    void Warning(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) {
-        std::string s = "adb: warning: ";
-
-        va_list ap;
-        va_start(ap, fmt);
-        android::base::StringAppendV(&s, fmt, ap);
-        va_end(ap);
-
-        line_printer_.Print(s, LinePrinter::WARNING);
-    }
-
-    void ComputeExpectedTotalBytes(const std::vector<copyinfo>& file_list) {
-        current_ledger_.bytes_expected = 0;
-        for (const copyinfo& ci : file_list) {
-            // Unfortunately, this doesn't work for symbolic links, because we'll copy the
-            // target of the link rather than just creating a link. (But ci.size is the link size.)
-            if (!ci.skip) current_ledger_.bytes_expected += ci.size;
-        }
-        current_ledger_.expect_multiple_files = true;
-    }
-
-    void SetExpectedTotalBytes(uint64_t expected_total_bytes) {
-        current_ledger_.bytes_expected = expected_total_bytes;
-        current_ledger_.expect_multiple_files = false;
-    }
-
-    // TODO: add a char[max] buffer here, to replace syncsendbuf...
-    unique_fd fd;
-    size_t max;
-
-  private:
-    std::deque<std::pair<std::string, std::string>> deferred_acknowledgements_;
-    Block acknowledgement_buffer_;
-    FeatureSet features_;
-    bool have_stat_v2_;
-    bool have_ls_v2_;
-    bool have_sendrecv_v2_;
-    bool have_sendrecv_v2_brotli_;
-
-    TransferLedger global_ledger_;
-    TransferLedger current_ledger_;
-    LinePrinter line_printer_;
-
-    bool SendQuit() {
-        return SendRequest(ID_QUIT, ""); // TODO: add a SendResponse?
-    }
-
-    bool WriteOrDie(const std::string& from, const std::string& to, const void* data,
-                    size_t data_length) {
-        if (!WriteFdExactly(fd, data, data_length)) {
-            if (errno == ECONNRESET) {
-                // Assume adbd told us why it was closing the connection, and
-                // try to read failure reason from adbd.
-                syncmsg msg;
-                if (!ReadFdExactly(fd, &msg.status, sizeof(msg.status))) {
-                    Error("failed to copy '%s' to '%s': no response: %s", from.c_str(), to.c_str(),
-                          strerror(errno));
-                } else if (msg.status.id != ID_FAIL) {
-                    Error("failed to copy '%s' to '%s': not ID_FAIL: %d", from.c_str(), to.c_str(),
-                          msg.status.id);
-                } else {
-                    ReportCopyFailure(from, to, msg);
-                }
-            } else {
-                Error("%zu-byte write failed: %s", data_length, strerror(errno));
-            }
-            _exit(1);
-        }
-        return true;
-    }
-};
-
-static bool sync_ls(SyncConnection& sc, const std::string& path,
-                    const std::function<sync_ls_cb>& func) {
-    return sc.SendLs(path) && sc.FinishLs(func);
-}
-
-static bool sync_stat(SyncConnection& sc, const std::string& path, struct stat* st) {
-    return sc.SendStat(path) && sc.FinishStat(st);
-}
-
-static bool sync_lstat(SyncConnection& sc, const std::string& path, struct stat* st) {
-    return sc.SendLstat(path) && sc.FinishStat(st);
-}
-
-static bool sync_stat_fallback(SyncConnection& sc, const std::string& path, struct stat* st) {
-    if (sync_stat(sc, path, st)) {
-        return true;
-    }
-
-    if (errno != ENOTSUP) {
-        return false;
-    }
-
-    // Try to emulate the parts we can when talking to older adbds.
-    bool lstat_result = sync_lstat(sc, path, st);
-    if (!lstat_result) {
-        return false;
-    }
-
-    if (S_ISLNK(st->st_mode)) {
-        // If the target is a symlink, figure out whether it's a file or a directory.
-        // Also, zero out the st_size field, since no one actually cares what the path length is.
-        st->st_size = 0;
-        std::string dir_path = path;
-        dir_path.push_back('/');
-        struct stat tmp_st;
-
-        st->st_mode &= ~S_IFMT;
-        if (sync_lstat(sc, dir_path, &tmp_st)) {
-            st->st_mode |= S_IFDIR;
-        } else {
-            st->st_mode |= S_IFREG;
-        }
-    }
-    return true;
-}
-
-static bool sync_send(SyncConnection& sc, const std::string& lpath, const std::string& rpath,
-                      unsigned mtime, mode_t mode, bool sync, bool compressed) {
-    if (sync) {
-        struct stat st;
-        if (sync_lstat(sc, rpath, &st)) {
-            if (st.st_mtime == static_cast<time_t>(mtime)) {
-                sc.RecordFilesSkipped(1);
-                return true;
-            }
-        }
-    }
-
-    if (S_ISLNK(mode)) {
-#if !defined(_WIN32)
-        char buf[PATH_MAX];
-        ssize_t data_length = readlink(lpath.c_str(), buf, PATH_MAX - 1);
-        if (data_length == -1) {
-            sc.Error("readlink '%s' failed: %s", lpath.c_str(), strerror(errno));
-            return false;
-        }
-        buf[data_length++] = '\0';
-
-        if (!sc.SendSmallFile(rpath, mode, lpath, rpath, mtime, buf, data_length)) {
-            return false;
-        }
-        return sc.ReadAcknowledgements();
-#endif
-    }
-
-    struct stat st;
-    if (stat(lpath.c_str(), &st) == -1) {
-        sc.Error("failed to stat local file '%s': %s", lpath.c_str(), strerror(errno));
-        return false;
-    }
-    if (st.st_size < SYNC_DATA_MAX) {
-        std::string data;
-        if (!android::base::ReadFileToString(lpath, &data, true)) {
-            sc.Error("failed to read all of '%s': %s", lpath.c_str(), strerror(errno));
-            return false;
-        }
-        if (!sc.SendSmallFile(rpath, mode, lpath, rpath, mtime, data.data(), data.size())) {
-            return false;
-        }
-    } else {
-        if (!sc.SendLargeFile(rpath, mode, lpath, rpath, mtime, compressed)) {
-            return false;
-        }
-    }
-    return sc.ReadAcknowledgements();
-}
-
-static bool sync_recv_v1(SyncConnection& sc, const char* rpath, const char* lpath, const char* name,
-                         uint64_t expected_size) {
-    if (!sc.SendRequest(ID_RECV_V1, rpath)) return false;
-
-    adb_unlink(lpath);
-    unique_fd lfd(adb_creat(lpath, 0644));
-    if (lfd < 0) {
-        sc.Error("cannot create '%s': %s", lpath, strerror(errno));
-        return false;
-    }
-
-    uint64_t bytes_copied = 0;
-    while (true) {
-        syncmsg msg;
-        if (!ReadFdExactly(sc.fd, &msg.data, sizeof(msg.data))) {
-            adb_unlink(lpath);
-            return false;
-        }
-
-        if (msg.data.id == ID_DONE) break;
-
-        if (msg.data.id != ID_DATA) {
-            adb_unlink(lpath);
-            sc.ReportCopyFailure(rpath, lpath, msg);
-            return false;
-        }
-
-        if (msg.data.size > sc.max) {
-            sc.Error("msg.data.size too large: %u (max %zu)", msg.data.size, sc.max);
-            adb_unlink(lpath);
-            return false;
-        }
-
-        char buffer[SYNC_DATA_MAX];
-        if (!ReadFdExactly(sc.fd, buffer, msg.data.size)) {
-            adb_unlink(lpath);
-            return false;
-        }
-
-        if (!WriteFdExactly(lfd, buffer, msg.data.size)) {
-            sc.Error("cannot write '%s': %s", lpath, strerror(errno));
-            adb_unlink(lpath);
-            return false;
-        }
-
-        bytes_copied += msg.data.size;
-
-        sc.RecordBytesTransferred(msg.data.size);
-        sc.ReportProgress(name != nullptr ? name : rpath, bytes_copied, expected_size);
-    }
-
-    sc.RecordFilesTransferred(1);
-    return true;
-}
-
-static bool sync_recv_v2(SyncConnection& sc, const char* rpath, const char* lpath, const char* name,
-                         uint64_t expected_size) {
-    if (!sc.SendRecv2(rpath)) return false;
-
-    adb_unlink(lpath);
-    unique_fd lfd(adb_creat(lpath, 0644));
-    if (lfd < 0) {
-        sc.Error("cannot create '%s': %s", lpath, strerror(errno));
-        return false;
-    }
-
-    uint64_t bytes_copied = 0;
-
-    Block buffer(SYNC_DATA_MAX);
-    BrotliDecoder decoder(std::span(buffer.data(), buffer.size()));
-    bool reading = true;
-    while (reading) {
-        syncmsg msg;
-        if (!ReadFdExactly(sc.fd, &msg.data, sizeof(msg.data))) {
-            adb_unlink(lpath);
-            return false;
-        }
-
-        if (msg.data.id == ID_DONE) {
-            adb_unlink(lpath);
-            sc.Error("unexpected ID_DONE");
-            return false;
-        }
-
-        if (msg.data.id != ID_DATA) {
-            adb_unlink(lpath);
-            sc.ReportCopyFailure(rpath, lpath, msg);
-            return false;
-        }
-
-        if (msg.data.size > sc.max) {
-            sc.Error("msg.data.size too large: %u (max %zu)", msg.data.size, sc.max);
-            adb_unlink(lpath);
-            return false;
-        }
-
-        Block block(msg.data.size);
-        if (!ReadFdExactly(sc.fd, block.data(), msg.data.size)) {
-            adb_unlink(lpath);
-            return false;
-        }
-        decoder.Append(std::move(block));
-
-        while (true) {
-            std::span<char> output;
-            BrotliDecodeResult result = decoder.Decode(&output);
-
-            if (result == BrotliDecodeResult::Error) {
-                sc.Error("decompress failed");
-                adb_unlink(lpath);
-                return false;
-            }
-
-            if (!output.empty()) {
-                if (!WriteFdExactly(lfd, output.data(), output.size())) {
-                    sc.Error("cannot write '%s': %s", lpath, strerror(errno));
-                    adb_unlink(lpath);
-                    return false;
-                }
-            }
-
-            bytes_copied += output.size();
-
-            sc.RecordBytesTransferred(msg.data.size);
-            sc.ReportProgress(name != nullptr ? name : rpath, bytes_copied, expected_size);
-
-            if (result == BrotliDecodeResult::NeedInput) {
-                break;
-            } else if (result == BrotliDecodeResult::MoreOutput) {
-                continue;
-            } else if (result == BrotliDecodeResult::Done) {
-                reading = false;
-                break;
-            } else {
-                LOG(FATAL) << "invalid BrotliDecodeResult: " << static_cast<int>(result);
-            }
-        }
-    }
-
-    syncmsg msg;
-    if (!ReadFdExactly(sc.fd, &msg.data, sizeof(msg.data))) {
-        sc.Error("failed to read ID_DONE");
-        return false;
-    }
-
-    if (msg.data.id != ID_DONE) {
-        sc.Error("unexpected message after transfer: id = %d (expected ID_DONE)", msg.data.id);
-        return false;
-    }
-
-    sc.RecordFilesTransferred(1);
-    return true;
-}
-
-static bool sync_recv(SyncConnection& sc, const char* rpath, const char* lpath, const char* name,
-                      uint64_t expected_size, bool compressed) {
-    if (sc.HaveSendRecv2() && compressed) {
-        return sync_recv_v2(sc, rpath, lpath, name, expected_size);
-    } else {
-        return sync_recv_v1(sc, rpath, lpath, name, expected_size);
-    }
-}
-
-bool do_sync_ls(const char* path) {
-    SyncConnection sc;
-    if (!sc.IsValid()) return false;
-
-    return sync_ls(sc, path, [](unsigned mode, uint64_t size, uint64_t time, const char* name) {
-        printf("%08x %08" PRIx64 " %08" PRIx64 " %s\n", mode, size, time, name);
-    });
-}
-
-static bool IsDotOrDotDot(const char* name) {
-    return name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'));
-}
-
-static bool local_build_list(SyncConnection& sc, std::vector<copyinfo>* file_list,
-                             std::vector<std::string>* directory_list, const std::string& lpath,
-                             const std::string& rpath) {
-    std::vector<copyinfo> dirlist;
-    std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir(lpath.c_str()), closedir);
-    if (!dir) {
-        sc.Error("cannot open '%s': %s", lpath.c_str(), strerror(errno));
-        return false;
-    }
-
-    bool empty_dir = true;
-    dirent* de;
-    while ((de = readdir(dir.get()))) {
-        if (IsDotOrDotDot(de->d_name)) {
-            continue;
-        }
-
-        empty_dir = false;
-        std::string stat_path = lpath + de->d_name;
-
-        struct stat st;
-        if (lstat(stat_path.c_str(), &st) == -1) {
-            sc.Error("cannot lstat '%s': %s", stat_path.c_str(),
-                     strerror(errno));
-            continue;
-        }
-
-        copyinfo ci(lpath, rpath, de->d_name, st.st_mode);
-        if (S_ISDIR(st.st_mode)) {
-            dirlist.push_back(ci);
-        } else {
-            if (!should_push_file(st.st_mode)) {
-                sc.Warning("skipping special file '%s' (mode = 0o%o)", lpath.c_str(), st.st_mode);
-                ci.skip = true;
-            }
-            ci.time = st.st_mtime;
-            ci.size = st.st_size;
-            file_list->push_back(ci);
-        }
-    }
-
-    // Close this directory and recurse.
-    dir.reset();
-
-    for (const copyinfo& ci : dirlist) {
-        directory_list->push_back(ci.rpath);
-        local_build_list(sc, file_list, directory_list, ci.lpath, ci.rpath);
-    }
-
-    return true;
-}
-
-// dirname("//foo") returns "//", so we can't do the obvious `path == "/"`.
-static bool is_root_dir(std::string_view path) {
-    for (char c : path) {
-        if (c != '/') {
-            return false;
-        }
-    }
-    return true;
-}
-
-static bool copy_local_dir_remote(SyncConnection& sc, std::string lpath, std::string rpath,
-                                  bool check_timestamps, bool list_only, bool compressed) {
-    sc.NewTransfer();
-
-    // Make sure that both directory paths end in a slash.
-    // Both paths are known to be nonempty, so we don't need to check.
-    ensure_trailing_separators(lpath, rpath);
-
-    // Recursively build the list of files to copy.
-    std::vector<copyinfo> file_list;
-    std::vector<std::string> directory_list;
-
-    for (std::string path = rpath; !is_root_dir(path); path = android::base::Dirname(path)) {
-        directory_list.push_back(path);
-    }
-    std::reverse(directory_list.begin(), directory_list.end());
-
-    int skipped = 0;
-    if (!local_build_list(sc, &file_list, &directory_list, lpath, rpath)) {
-        return false;
-    }
-
-    // b/110953234:
-    // P shipped with a bug that causes directory creation as a side-effect of a push to fail.
-    // Work around this by explicitly doing a mkdir via shell.
-    //
-    // Devices that don't support shell_v2 are unhappy if we try to send a too-long packet to them,
-    // but they're not affected by this bug, so only apply the workaround if we have shell_v2.
-    //
-    // TODO(b/25457350): We don't preserve permissions on directories.
-    // TODO: Find all of the leaves and `mkdir -p` them instead?
-    if (!CanUseFeature(sc.Features(), kFeatureFixedPushMkdir) &&
-        CanUseFeature(sc.Features(), kFeatureShell2)) {
-        SilentStandardStreamsCallbackInterface cb;
-        std::string cmd = "mkdir";
-        for (const auto& dir : directory_list) {
-            std::string escaped_path = escape_arg(dir);
-            if (escaped_path.size() > 16384) {
-                // Somewhat arbitrarily limit that probably won't ever happen.
-                sc.Error("path too long: %s", escaped_path.c_str());
-                return false;
-            }
-
-            // The maximum should be 64kiB, but that's not including other stuff that gets tacked
-            // onto the command line, so let's be a bit conservative.
-            if (cmd.size() + escaped_path.size() > 32768) {
-                // Dispatch the command, ignoring failure (since the directory might already exist).
-                send_shell_command(cmd, false, &cb);
-                cmd = "mkdir";
-            }
-            cmd += " ";
-            cmd += escaped_path;
-        }
-
-        if (cmd != "mkdir") {
-            send_shell_command(cmd, false, &cb);
-        }
-    }
-
-    if (check_timestamps) {
-        for (const copyinfo& ci : file_list) {
-            if (!sc.SendLstat(ci.rpath)) {
-                sc.Error("failed to send lstat");
-                return false;
-            }
-        }
-        for (copyinfo& ci : file_list) {
-            struct stat st;
-            if (sc.FinishStat(&st)) {
-                if (st.st_size == static_cast<off_t>(ci.size) && st.st_mtime == ci.time) {
-                    ci.skip = true;
-                }
-            }
-        }
-    }
-
-    sc.ComputeExpectedTotalBytes(file_list);
-
-    for (const copyinfo& ci : file_list) {
-        if (!ci.skip) {
-            if (list_only) {
-                sc.Println("would push: %s -> %s", ci.lpath.c_str(), ci.rpath.c_str());
-            } else {
-                if (!sync_send(sc, ci.lpath, ci.rpath, ci.time, ci.mode, false, compressed)) {
-                    return false;
-                }
-            }
-        } else {
-            skipped++;
-        }
-    }
-
-    sc.RecordFilesSkipped(skipped);
-    bool success = sc.ReadAcknowledgements(true);
-    sc.ReportTransferRate(lpath, TransferDirection::push);
-    return success;
-}
-
-bool do_sync_push(const std::vector<const char*>& srcs, const char* dst, bool sync,
-                  bool compressed) {
-    SyncConnection sc;
-    if (!sc.IsValid()) return false;
-
-    bool success = true;
-    bool dst_exists;
-    bool dst_isdir;
-
-    struct stat st;
-    if (sync_stat_fallback(sc, dst, &st)) {
-        dst_exists = true;
-        dst_isdir = S_ISDIR(st.st_mode);
-    } else {
-        if (errno == ENOENT || errno == ENOPROTOOPT) {
-            dst_exists = false;
-            dst_isdir = false;
-        } else {
-            sc.Error("stat failed when trying to push to %s: %s", dst, strerror(errno));
-            return false;
-        }
-    }
-
-    if (!dst_isdir) {
-        if (srcs.size() > 1) {
-            sc.Error("target '%s' is not a directory", dst);
-            return false;
-        } else {
-            size_t dst_len = strlen(dst);
-
-            // A path that ends with a slash doesn't have to be a directory if
-            // it doesn't exist yet.
-            if (dst[dst_len - 1] == '/' && dst_exists) {
-                sc.Error("failed to access '%s': Not a directory", dst);
-                return false;
-            }
-        }
-    }
-
-    for (const char* src_path : srcs) {
-        const char* dst_path = dst;
-        struct stat st;
-        if (stat(src_path, &st) == -1) {
-            sc.Error("cannot stat '%s': %s", src_path, strerror(errno));
-            success = false;
-            continue;
-        }
-
-        if (S_ISDIR(st.st_mode)) {
-            std::string dst_dir = dst;
-
-            // If the destination path existed originally, the source directory
-            // should be copied as a child of the destination.
-            if (dst_exists) {
-                if (!dst_isdir) {
-                    sc.Error("target '%s' is not a directory", dst);
-                    return false;
-                }
-                // dst is a POSIX path, so we don't want to use the sysdeps
-                // helpers here.
-                if (dst_dir.back() != '/') {
-                    dst_dir.push_back('/');
-                }
-                dst_dir.append(android::base::Basename(src_path));
-            }
-
-            success &= copy_local_dir_remote(sc, src_path, dst_dir, sync, false, compressed);
-            continue;
-        } else if (!should_push_file(st.st_mode)) {
-            sc.Warning("skipping special file '%s' (mode = 0o%o)", src_path, st.st_mode);
-            continue;
-        }
-
-        std::string path_holder;
-        if (dst_isdir) {
-            // If we're copying a local file to a remote directory,
-            // we really want to copy to remote_dir + "/" + local_filename.
-            path_holder = dst_path;
-            if (path_holder.back() != '/') {
-                path_holder.push_back('/');
-            }
-            path_holder += android::base::Basename(src_path);
-            dst_path = path_holder.c_str();
-        }
-
-        sc.NewTransfer();
-        sc.SetExpectedTotalBytes(st.st_size);
-        success &= sync_send(sc, src_path, dst_path, st.st_mtime, st.st_mode, sync, compressed);
-        sc.ReportTransferRate(src_path, TransferDirection::push);
-    }
-
-    success &= sc.ReadAcknowledgements(true);
-    sc.ReportOverallTransferRate(TransferDirection::push);
-    return success;
-}
-
-static bool remote_build_list(SyncConnection& sc, std::vector<copyinfo>* file_list,
-                              const std::string& rpath, const std::string& lpath) {
-    std::vector<copyinfo> dirlist;
-    std::vector<copyinfo> linklist;
-
-    // Add an entry for the current directory to ensure it gets created before pulling its contents.
-    copyinfo ci(android::base::Dirname(lpath), android::base::Dirname(rpath),
-                android::base::Basename(lpath), S_IFDIR);
-    file_list->push_back(ci);
-
-    // Put the files/dirs in rpath on the lists.
-    auto callback = [&](unsigned mode, uint64_t size, uint64_t time, const char* name) {
-        if (IsDotOrDotDot(name)) {
-            return;
-        }
-
-        copyinfo ci(lpath, rpath, name, mode);
-        if (S_ISDIR(mode)) {
-            dirlist.push_back(ci);
-        } else if (S_ISLNK(mode)) {
-            linklist.push_back(ci);
-        } else {
-            if (!should_pull_file(ci.mode)) {
-                sc.Warning("skipping special file '%s' (mode = 0o%o)", ci.rpath.c_str(), ci.mode);
-                ci.skip = true;
-            }
-            ci.time = time;
-            ci.size = size;
-            file_list->push_back(ci);
-        }
-    };
-
-    if (!sync_ls(sc, rpath.c_str(), callback)) {
-        return false;
-    }
-
-    // Check each symlink we found to see whether it's a file or directory.
-    for (copyinfo& link_ci : linklist) {
-        struct stat st;
-        if (!sync_stat_fallback(sc, link_ci.rpath.c_str(), &st)) {
-            sc.Warning("stat failed for path %s: %s", link_ci.rpath.c_str(), strerror(errno));
-            continue;
-        }
-
-        if (S_ISDIR(st.st_mode)) {
-            dirlist.emplace_back(std::move(link_ci));
-        } else {
-            file_list->emplace_back(std::move(link_ci));
-        }
-    }
-
-    // Recurse into each directory we found.
-    while (!dirlist.empty()) {
-        copyinfo current = dirlist.back();
-        dirlist.pop_back();
-        if (!remote_build_list(sc, file_list, current.rpath, current.lpath)) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-static int set_time_and_mode(const std::string& lpath, time_t time,
-                             unsigned int mode) {
-    struct utimbuf times = { time, time };
-    int r1 = utime(lpath.c_str(), &times);
-
-    /* use umask for permissions */
-    mode_t mask = umask(0000);
-    umask(mask);
-    int r2 = chmod(lpath.c_str(), mode & ~mask);
-
-    return r1 ? r1 : r2;
-}
-
-static bool copy_remote_dir_local(SyncConnection& sc, std::string rpath, std::string lpath,
-                                  bool copy_attrs, bool compressed) {
-    sc.NewTransfer();
-
-    // Make sure that both directory paths end in a slash.
-    // Both paths are known to be nonempty, so we don't need to check.
-    ensure_trailing_separators(lpath, rpath);
-
-    // Recursively build the list of files to copy.
-    sc.Printf("pull: building file list...");
-    std::vector<copyinfo> file_list;
-    if (!remote_build_list(sc, &file_list, rpath, lpath)) {
-        return false;
-    }
-
-    sc.ComputeExpectedTotalBytes(file_list);
-
-    int skipped = 0;
-    for (const copyinfo &ci : file_list) {
-        if (!ci.skip) {
-            if (S_ISDIR(ci.mode)) {
-                // Entry is for an empty directory, create it and continue.
-                // TODO(b/25457350): We don't preserve permissions on directories.
-                if (!mkdirs(ci.lpath))  {
-                    sc.Error("failed to create directory '%s': %s",
-                             ci.lpath.c_str(), strerror(errno));
-                    return false;
-                }
-                continue;
-            }
-
-            if (!sync_recv(sc, ci.rpath.c_str(), ci.lpath.c_str(), nullptr, ci.size, compressed)) {
-                return false;
-            }
-
-            if (copy_attrs && set_time_and_mode(ci.lpath, ci.time, ci.mode)) {
-                return false;
-            }
-        } else {
-            skipped++;
-        }
-    }
-
-    sc.RecordFilesSkipped(skipped);
-    sc.ReportTransferRate(rpath, TransferDirection::pull);
-    return true;
-}
-
-bool do_sync_pull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
-                  bool compressed, const char* name) {
-    SyncConnection sc;
-    if (!sc.IsValid()) return false;
-
-    bool success = true;
-    struct stat st;
-    bool dst_exists = true;
-
-    if (stat(dst, &st) == -1) {
-        dst_exists = false;
-
-        // If we're only pulling one path, the destination path might point to
-        // a path that doesn't exist yet.
-        if (srcs.size() == 1 && errno == ENOENT) {
-            // However, its parent must exist.
-            struct stat parent_st;
-            if (stat(android::base::Dirname(dst).c_str(), &parent_st) == -1) {
-                sc.Error("cannot create file/directory '%s': %s", dst, strerror(errno));
-                return false;
-            }
-        } else {
-            sc.Error("failed to access '%s': %s", dst, strerror(errno));
-            return false;
-        }
-    }
-
-    bool dst_isdir = dst_exists && S_ISDIR(st.st_mode);
-    if (!dst_isdir) {
-        if (srcs.size() > 1) {
-            sc.Error("target '%s' is not a directory", dst);
-            return false;
-        } else {
-            size_t dst_len = strlen(dst);
-
-            // A path that ends with a slash doesn't have to be a directory if
-            // it doesn't exist yet.
-            if (adb_is_separator(dst[dst_len - 1]) && dst_exists) {
-                sc.Error("failed to access '%s': Not a directory", dst);
-                return false;
-            }
-        }
-    }
-
-    for (const char* src_path : srcs) {
-        const char* dst_path = dst;
-        struct stat src_st;
-        if (!sync_stat_fallback(sc, src_path, &src_st)) {
-            if (errno == ENOPROTOOPT) {
-                sc.Error("remote object '%s' does not exist", src_path);
-            } else {
-                sc.Error("failed to stat remote object '%s': %s", src_path, strerror(errno));
-            }
-
-            success = false;
-            continue;
-        }
-
-        bool src_isdir = S_ISDIR(src_st.st_mode);
-        if (src_isdir) {
-            std::string dst_dir = dst;
-
-            // If the destination path existed originally, the source directory
-            // should be copied as a child of the destination.
-            if (dst_exists) {
-                if (!dst_isdir) {
-                    sc.Error("target '%s' is not a directory", dst);
-                    return false;
-                }
-                if (!adb_is_separator(dst_dir.back())) {
-                    dst_dir.push_back(OS_PATH_SEPARATOR);
-                }
-                dst_dir.append(android::base::Basename(src_path));
-            }
-
-            success &= copy_remote_dir_local(sc, src_path, dst_dir, copy_attrs, compressed);
-            continue;
-        } else if (!should_pull_file(src_st.st_mode)) {
-            sc.Warning("skipping special file '%s' (mode = 0o%o)", src_path, src_st.st_mode);
-            continue;
-        }
-
-        std::string path_holder;
-        if (dst_isdir) {
-            // If we're copying a remote file to a local directory, we
-            // really want to copy to local_dir + OS_PATH_SEPARATOR +
-            // basename(remote).
-            path_holder = android::base::StringPrintf("%s%c%s", dst_path, OS_PATH_SEPARATOR,
-                                                      android::base::Basename(src_path).c_str());
-            dst_path = path_holder.c_str();
-        }
-
-        sc.NewTransfer();
-        sc.SetExpectedTotalBytes(src_st.st_size);
-        if (!sync_recv(sc, src_path, dst_path, name, src_st.st_size, compressed)) {
-            success = false;
-            continue;
-        }
-
-        if (copy_attrs && set_time_and_mode(dst_path, src_st.st_mtime, src_st.st_mode) != 0) {
-            success = false;
-            continue;
-        }
-        sc.ReportTransferRate(src_path, TransferDirection::pull);
-    }
-
-    sc.ReportOverallTransferRate(TransferDirection::pull);
-    return success;
-}
-
-bool do_sync_sync(const std::string& lpath, const std::string& rpath, bool list_only,
-                  bool compressed) {
-    SyncConnection sc;
-    if (!sc.IsValid()) return false;
-
-    bool success = copy_local_dir_remote(sc, lpath, rpath, true, list_only, compressed);
-    if (!list_only) {
-        sc.ReportOverallTransferRate(TransferDirection::push);
-    }
-    return success;
-}
diff --git a/adb/client/file_sync_client.h b/adb/client/file_sync_client.h
deleted file mode 100644
index de3f192..0000000
--- a/adb/client/file_sync_client.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <string>
-#include <vector>
-
-bool do_sync_ls(const char* path);
-bool do_sync_push(const std::vector<const char*>& srcs, const char* dst, bool sync,
-                  bool compressed);
-bool do_sync_pull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
-                  bool compressed, const char* name = nullptr);
-
-bool do_sync_sync(const std::string& lpath, const std::string& rpath, bool list_only,
-                  bool compressed);
diff --git a/adb/client/incremental.cpp b/adb/client/incremental.cpp
deleted file mode 100644
index c8f69c3..0000000
--- a/adb/client/incremental.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "incremental.h"
-
-#include "incremental_utils.h"
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <openssl/base64.h>
-
-#include "adb_client.h"
-#include "adb_utils.h"
-#include "commandline.h"
-#include "sysdeps.h"
-
-using namespace std::literals;
-
-namespace incremental {
-
-using android::base::StringPrintf;
-
-// Read, verify and return the signature bytes. Keeping fd at the position of start of verity tree.
-static std::pair<unique_fd, std::vector<char>> read_signature(Size file_size,
-                                                              std::string signature_file,
-                                                              bool silent) {
-    signature_file += IDSIG;
-
-    struct stat st;
-    if (stat(signature_file.c_str(), &st)) {
-        if (!silent) {
-            fprintf(stderr, "Failed to stat signature file %s. Abort.\n", signature_file.c_str());
-        }
-        return {};
-    }
-
-    unique_fd fd(adb_open(signature_file.c_str(), O_RDONLY));
-    if (fd < 0) {
-        if (!silent) {
-            fprintf(stderr, "Failed to open signature file: %s. Abort.\n", signature_file.c_str());
-        }
-        return {};
-    }
-
-    auto [signature, tree_size] = read_id_sig_headers(fd);
-    if (auto expected = verity_tree_size_for_file(file_size); tree_size != expected) {
-        if (!silent) {
-            fprintf(stderr,
-                    "Verity tree size mismatch in signature file: %s [was %lld, expected %lld].\n",
-                    signature_file.c_str(), (long long)tree_size, (long long)expected);
-        }
-        return {};
-    }
-
-    return {std::move(fd), std::move(signature)};
-}
-
-// Base64-encode signature bytes. Keeping fd at the position of start of verity tree.
-static std::pair<unique_fd, std::string> read_and_encode_signature(Size file_size,
-                                                                   std::string signature_file,
-                                                                   bool silent) {
-    auto [fd, signature] = read_signature(file_size, std::move(signature_file), silent);
-    if (!fd.ok()) {
-        return {};
-    }
-
-    size_t base64_len = 0;
-    if (!EVP_EncodedLength(&base64_len, signature.size())) {
-        if (!silent) {
-            fprintf(stderr, "Fail to estimate base64 encoded length. Abort.\n");
-        }
-        return {};
-    }
-    std::string encoded_signature(base64_len, '\0');
-    encoded_signature.resize(EVP_EncodeBlock((uint8_t*)encoded_signature.data(),
-                                             (const uint8_t*)signature.data(), signature.size()));
-
-    return {std::move(fd), std::move(encoded_signature)};
-}
-
-// Send install-incremental to the device along with properly configured file descriptors in
-// streaming format. Once connection established, send all fs-verity tree bytes.
-static unique_fd start_install(const Files& files, const Args& passthrough_args, bool silent) {
-    std::vector<std::string> command_args{"package", "install-incremental"};
-    command_args.insert(command_args.end(), passthrough_args.begin(), passthrough_args.end());
-
-    for (int i = 0, size = files.size(); i < size; ++i) {
-        const auto& file = files[i];
-
-        struct stat st;
-        if (stat(file.c_str(), &st)) {
-            if (!silent) {
-                fprintf(stderr, "Failed to stat input file %s. Abort.\n", file.c_str());
-            }
-            return {};
-        }
-
-        auto [signature_fd, signature] = read_and_encode_signature(st.st_size, file, silent);
-        if (!signature_fd.ok()) {
-            return {};
-        }
-
-        auto file_desc = StringPrintf("%s:%lld:%d:%s:1", android::base::Basename(file).c_str(),
-                                      (long long)st.st_size, i, signature.c_str());
-        command_args.push_back(std::move(file_desc));
-    }
-
-    std::string error;
-    auto connection_fd = unique_fd(send_abb_exec_command(command_args, &error));
-    if (connection_fd < 0) {
-        if (!silent) {
-            fprintf(stderr, "Failed to run: %s, error: %s\n",
-                    android::base::Join(command_args, " ").c_str(), error.c_str());
-        }
-        return {};
-    }
-
-    return connection_fd;
-}
-
-bool can_install(const Files& files) {
-    for (const auto& file : files) {
-        struct stat st;
-        if (stat(file.c_str(), &st)) {
-            return false;
-        }
-
-        auto [fd, _] = read_signature(st.st_size, file, true);
-        if (!fd.ok()) {
-            return false;
-        }
-    }
-    return true;
-}
-
-std::optional<Process> install(const Files& files, const Args& passthrough_args, bool silent) {
-    auto connection_fd = start_install(files, passthrough_args, silent);
-    if (connection_fd < 0) {
-        if (!silent) {
-            fprintf(stderr, "adb: failed to initiate installation on device.\n");
-        }
-        return {};
-    }
-
-    std::string adb_path = android::base::GetExecutablePath();
-
-    auto osh = adb_get_os_handle(connection_fd.get());
-#ifdef _WIN32
-    auto fd_param = std::to_string(reinterpret_cast<intptr_t>(osh));
-#else /* !_WIN32 a.k.a. Unix */
-    auto fd_param = std::to_string(osh);
-#endif
-
-    // pipe for child process to write output
-    int print_fds[2];
-    if (adb_socketpair(print_fds) != 0) {
-        if (!silent) {
-            fprintf(stderr, "Failed to create socket pair for child to print to parent\n");
-        }
-        return {};
-    }
-    auto [pipe_read_fd, pipe_write_fd] = print_fds;
-    auto pipe_write_fd_param = std::to_string(intptr_t(adb_get_os_handle(pipe_write_fd)));
-    close_on_exec(pipe_read_fd);
-
-    std::vector<std::string> args(std::move(files));
-    args.insert(args.begin(), {"inc-server", fd_param, pipe_write_fd_param});
-    auto child =
-            adb_launch_process(adb_path, std::move(args), {connection_fd.get(), pipe_write_fd});
-    if (!child) {
-        if (!silent) {
-            fprintf(stderr, "adb: failed to fork: %s\n", strerror(errno));
-        }
-        return {};
-    }
-
-    adb_close(pipe_write_fd);
-
-    auto killOnExit = [](Process* p) { p->kill(); };
-    std::unique_ptr<Process, decltype(killOnExit)> serverKiller(&child, killOnExit);
-
-    Result result = wait_for_installation(pipe_read_fd);
-    adb_close(pipe_read_fd);
-
-    if (result == Result::Success) {
-        // adb client exits now but inc-server can continue
-        serverKiller.release();
-    }
-    return child;
-}
-
-Result wait_for_installation(int read_fd) {
-    static constexpr int maxMessageSize = 256;
-    std::vector<char> child_stdout(CHUNK_SIZE);
-    int bytes_read;
-    int buf_size = 0;
-    // TODO(b/150865433): optimize child's output parsing
-    while ((bytes_read = adb_read(read_fd, child_stdout.data() + buf_size,
-                                  child_stdout.size() - buf_size)) > 0) {
-        // print to parent's stdout
-        fprintf(stdout, "%.*s", bytes_read, child_stdout.data() + buf_size);
-
-        buf_size += bytes_read;
-        const std::string_view stdout_str(child_stdout.data(), buf_size);
-        // wait till installation either succeeds or fails
-        if (stdout_str.find("Success") != std::string::npos) {
-            return Result::Success;
-        }
-        // on failure, wait for full message
-        static constexpr auto failure_msg_head = "Failure ["sv;
-        if (const auto begin_itr = stdout_str.find(failure_msg_head);
-            begin_itr != std::string::npos) {
-            if (buf_size >= maxMessageSize) {
-                return Result::Failure;
-            }
-            const auto end_itr = stdout_str.rfind("]");
-            if (end_itr != std::string::npos && end_itr >= begin_itr + failure_msg_head.size()) {
-                return Result::Failure;
-            }
-        }
-        child_stdout.resize(buf_size + CHUNK_SIZE);
-    }
-    return Result::None;
-}
-
-}  // namespace incremental
diff --git a/adb/client/incremental.h b/adb/client/incremental.h
deleted file mode 100644
index 40e928a..0000000
--- a/adb/client/incremental.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-
-#include <optional>
-#include <string>
-
-#include "sysdeps.h"
-
-namespace incremental {
-
-using Files = std::vector<std::string>;
-using Args = std::vector<std::string_view>;
-
-bool can_install(const Files& files);
-std::optional<Process> install(const Files& files, const Args& passthrough_args, bool silent);
-
-enum class Result { Success, Failure, None };
-Result wait_for_installation(int read_fd);
-
-}  // namespace incremental
diff --git a/adb/client/incremental_server.cpp b/adb/client/incremental_server.cpp
deleted file mode 100644
index bfe18c0..0000000
--- a/adb/client/incremental_server.cpp
+++ /dev/null
@@ -1,716 +0,0 @@
-﻿/*
- * Copyright (C) 2020 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.
- */
-
-#define TRACE_TAG INCREMENTAL
-
-#include "incremental_server.h"
-
-#include <android-base/endian.h>
-#include <android-base/strings.h>
-#include <inttypes.h>
-#include <lz4.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <array>
-#include <deque>
-#include <fstream>
-#include <thread>
-#include <type_traits>
-#include <unordered_set>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "incremental_utils.h"
-#include "sysdeps.h"
-
-namespace incremental {
-
-static constexpr int kHashesPerBlock = kBlockSize / kDigestSize;
-static constexpr int kCompressedSizeMax = kBlockSize * 0.95;
-static constexpr int8_t kTypeData = 0;
-static constexpr int8_t kTypeHash = 1;
-static constexpr int8_t kCompressionNone = 0;
-static constexpr int8_t kCompressionLZ4 = 1;
-static constexpr int kCompressBound = std::max(kBlockSize, LZ4_COMPRESSBOUND(kBlockSize));
-static constexpr auto kReadBufferSize = 128 * 1024;
-static constexpr int kPollTimeoutMillis = 300000;  // 5 minutes
-
-using BlockSize = int16_t;
-using FileId = int16_t;
-using BlockIdx = int32_t;
-using NumBlocks = int32_t;
-using BlockType = int8_t;
-using CompressionType = int8_t;
-using RequestType = int16_t;
-using ChunkHeader = int32_t;
-using MagicType = uint32_t;
-
-static constexpr MagicType INCR = 0x494e4352;  // LE INCR
-
-static constexpr RequestType SERVING_COMPLETE = 0;
-static constexpr RequestType BLOCK_MISSING = 1;
-static constexpr RequestType PREFETCH = 2;
-static constexpr RequestType DESTROY = 3;
-
-static constexpr inline int64_t roundDownToBlockOffset(int64_t val) {
-    return val & ~(kBlockSize - 1);
-}
-
-static constexpr inline int64_t roundUpToBlockOffset(int64_t val) {
-    return roundDownToBlockOffset(val + kBlockSize - 1);
-}
-
-static constexpr inline NumBlocks numBytesToNumBlocks(int64_t bytes) {
-    return roundUpToBlockOffset(bytes) / kBlockSize;
-}
-
-static constexpr inline off64_t blockIndexToOffset(BlockIdx blockIdx) {
-    return static_cast<off64_t>(blockIdx) * kBlockSize;
-}
-
-template <typename T>
-static inline constexpr T toBigEndian(T t) {
-    using unsigned_type = std::make_unsigned_t<T>;
-    if constexpr (std::is_same_v<T, int16_t>) {
-        return htobe16(static_cast<unsigned_type>(t));
-    } else if constexpr (std::is_same_v<T, int32_t>) {
-        return htobe32(static_cast<unsigned_type>(t));
-    } else if constexpr (std::is_same_v<T, int64_t>) {
-        return htobe64(static_cast<unsigned_type>(t));
-    } else {
-        return t;
-    }
-}
-
-template <typename T>
-static inline constexpr T readBigEndian(void* data) {
-    using unsigned_type = std::make_unsigned_t<T>;
-    if constexpr (std::is_same_v<T, int16_t>) {
-        return static_cast<T>(be16toh(*reinterpret_cast<unsigned_type*>(data)));
-    } else if constexpr (std::is_same_v<T, int32_t>) {
-        return static_cast<T>(be32toh(*reinterpret_cast<unsigned_type*>(data)));
-    } else if constexpr (std::is_same_v<T, int64_t>) {
-        return static_cast<T>(be64toh(*reinterpret_cast<unsigned_type*>(data)));
-    } else {
-        return T();
-    }
-}
-
-// Received from device
-// !Does not include magic!
-struct RequestCommand {
-    RequestType request_type;  // 2 bytes
-    FileId file_id;            // 2 bytes
-    union {
-        BlockIdx block_idx;
-        NumBlocks num_blocks;
-    };  // 4 bytes
-} __attribute__((packed));
-
-// Placed before actual data bytes of each block
-struct ResponseHeader {
-    FileId file_id;                    // 2 bytes
-    BlockType block_type;              // 1 byte
-    CompressionType compression_type;  // 1 byte
-    BlockIdx block_idx;                // 4 bytes
-    BlockSize block_size;              // 2 bytes
-
-    static constexpr size_t responseSizeFor(size_t dataSize) {
-        return dataSize + sizeof(ResponseHeader);
-    }
-} __attribute__((packed));
-
-template <size_t Size = kBlockSize>
-struct BlockBuffer {
-    ResponseHeader header;
-    char data[Size];
-} __attribute__((packed));
-
-// Holds streaming state for a file
-class File {
-  public:
-    // Plain file
-    File(const char* filepath, FileId id, int64_t size, unique_fd fd, int64_t tree_offset,
-         unique_fd tree_fd)
-        : File(filepath, id, size, tree_offset) {
-        this->fd_ = std::move(fd);
-        this->tree_fd_ = std::move(tree_fd);
-        priority_blocks_ = PriorityBlocksForFile(filepath, fd_.get(), size);
-    }
-    int64_t ReadDataBlock(BlockIdx block_idx, void* buf, bool* is_zip_compressed) const {
-        int64_t bytes_read = -1;
-        const off64_t offsetStart = blockIndexToOffset(block_idx);
-        bytes_read = adb_pread(fd_, buf, kBlockSize, offsetStart);
-        return bytes_read;
-    }
-    int64_t ReadTreeBlock(BlockIdx block_idx, void* buf) const {
-        int64_t bytes_read = -1;
-        const off64_t offsetStart = tree_offset_ + blockIndexToOffset(block_idx);
-        bytes_read = adb_pread(tree_fd_, buf, kBlockSize, offsetStart);
-        return bytes_read;
-    }
-
-    const std::vector<BlockIdx>& PriorityBlocks() const { return priority_blocks_; }
-
-    std::vector<bool> sentBlocks;
-    NumBlocks sentBlocksCount = 0;
-
-    std::vector<bool> sentTreeBlocks;
-
-    const char* const filepath;
-    const FileId id;
-    const int64_t size;
-
-  private:
-    File(const char* filepath, FileId id, int64_t size, int64_t tree_offset)
-        : filepath(filepath), id(id), size(size), tree_offset_(tree_offset) {
-        sentBlocks.resize(numBytesToNumBlocks(size));
-        sentTreeBlocks.resize(verity_tree_blocks_for_file(size));
-    }
-    unique_fd fd_;
-    std::vector<BlockIdx> priority_blocks_;
-
-    unique_fd tree_fd_;
-    const int64_t tree_offset_;
-};
-
-class IncrementalServer {
-  public:
-    IncrementalServer(unique_fd adb_fd, unique_fd output_fd, std::vector<File> files)
-        : adb_fd_(std::move(adb_fd)), output_fd_(std::move(output_fd)), files_(std::move(files)) {
-        buffer_.reserve(kReadBufferSize);
-        pendingBlocksBuffer_.resize(kChunkFlushSize + 2 * kBlockSize);
-        pendingBlocks_ = pendingBlocksBuffer_.data() + sizeof(ChunkHeader);
-    }
-
-    bool Serve();
-
-  private:
-    struct PrefetchState {
-        const File* file;
-        BlockIdx overallIndex = 0;
-        BlockIdx overallEnd = 0;
-        BlockIdx priorityIndex = 0;
-
-        explicit PrefetchState(const File& f, BlockIdx start, int count)
-            : file(&f),
-              overallIndex(start),
-              overallEnd(std::min<BlockIdx>(start + count, f.sentBlocks.size())) {}
-
-        explicit PrefetchState(const File& f)
-            : PrefetchState(f, 0, (BlockIdx)f.sentBlocks.size()) {}
-
-        bool done() const {
-            const bool overallSent = (overallIndex >= overallEnd);
-            if (file->PriorityBlocks().empty()) {
-                return overallSent;
-            }
-            return overallSent && (priorityIndex >= (BlockIdx)file->PriorityBlocks().size());
-        }
-    };
-
-    bool SkipToRequest(void* buffer, size_t* size, bool blocking);
-    std::optional<RequestCommand> ReadRequest(bool blocking);
-
-    void erase_buffer_head(int count) { buffer_.erase(buffer_.begin(), buffer_.begin() + count); }
-
-    enum class SendResult { Sent, Skipped, Error };
-    SendResult SendDataBlock(FileId fileId, BlockIdx blockIdx, bool flush = false);
-
-    bool SendTreeBlock(FileId fileId, int32_t fileBlockIdx, BlockIdx blockIdx);
-    bool SendTreeBlocksForDataBlock(FileId fileId, BlockIdx blockIdx);
-
-    bool SendDone();
-    void RunPrefetching();
-
-    void Send(const void* data, size_t size, bool flush);
-    void Flush();
-    using TimePoint = decltype(std::chrono::high_resolution_clock::now());
-    bool ServingComplete(std::optional<TimePoint> startTime, int missesCount, int missesSent);
-
-    unique_fd const adb_fd_;
-    unique_fd const output_fd_;
-    std::vector<File> files_;
-
-    // Incoming data buffer.
-    std::vector<char> buffer_;
-
-    std::deque<PrefetchState> prefetches_;
-    int compressed_ = 0, uncompressed_ = 0;
-    long long sentSize_ = 0;
-
-    static constexpr auto kChunkFlushSize = 31 * kBlockSize;
-
-    std::vector<char> pendingBlocksBuffer_;
-    char* pendingBlocks_ = nullptr;
-
-    // True when client notifies that all the data has been received
-    bool servingComplete_ = false;
-};
-
-bool IncrementalServer::SkipToRequest(void* buffer, size_t* size, bool blocking) {
-    while (true) {
-        // Looking for INCR magic.
-        bool magic_found = false;
-        int bcur = 0;
-        int bsize = buffer_.size();
-        for (bcur = 0; bcur + 4 < bsize; ++bcur) {
-            uint32_t magic = be32toh(*(uint32_t*)(buffer_.data() + bcur));
-            if (magic == INCR) {
-                magic_found = true;
-                break;
-            }
-        }
-
-        if (bcur > 0) {
-            // output the rest.
-            (void)WriteFdExactly(output_fd_, buffer_.data(), bcur);
-            erase_buffer_head(bcur);
-        }
-
-        if (magic_found && buffer_.size() >= *size + sizeof(INCR)) {
-            // fine, return
-            memcpy(buffer, buffer_.data() + sizeof(INCR), *size);
-            erase_buffer_head(*size + sizeof(INCR));
-            return true;
-        }
-
-        adb_pollfd pfd = {adb_fd_.get(), POLLIN, 0};
-        auto res = adb_poll(&pfd, 1, blocking ? kPollTimeoutMillis : 0);
-
-        if (res != 1) {
-            auto err = errno;
-            (void)WriteFdExactly(output_fd_, buffer_.data(), buffer_.size());
-            if (res < 0) {
-                D("Failed to poll: %s", strerror(err));
-                return false;
-            }
-            if (blocking) {
-                fprintf(stderr, "Timed out waiting for data from device.\n");
-            }
-            if (blocking && servingComplete_) {
-                // timeout waiting from client. Serving is complete, so quit.
-                return false;
-            }
-            *size = 0;
-            return true;
-        }
-
-        bsize = buffer_.size();
-        buffer_.resize(kReadBufferSize);
-        int r = adb_read(adb_fd_, buffer_.data() + bsize, kReadBufferSize - bsize);
-        if (r > 0) {
-            buffer_.resize(bsize + r);
-            continue;
-        }
-
-        D("Failed to read from fd %d: %d. Exit", adb_fd_.get(), errno);
-        break;
-    }
-    // socket is closed. print remaining messages
-    WriteFdExactly(output_fd_, buffer_.data(), buffer_.size());
-    return false;
-}
-
-std::optional<RequestCommand> IncrementalServer::ReadRequest(bool blocking) {
-    uint8_t commandBuf[sizeof(RequestCommand)];
-    auto size = sizeof(commandBuf);
-    if (!SkipToRequest(&commandBuf, &size, blocking)) {
-        return {{DESTROY}};
-    }
-    if (size < sizeof(RequestCommand)) {
-        return {};
-    }
-    RequestCommand request;
-    request.request_type = readBigEndian<RequestType>(&commandBuf[0]);
-    request.file_id = readBigEndian<FileId>(&commandBuf[2]);
-    request.block_idx = readBigEndian<BlockIdx>(&commandBuf[4]);
-    return request;
-}
-
-bool IncrementalServer::SendTreeBlocksForDataBlock(const FileId fileId, const BlockIdx blockIdx) {
-    auto& file = files_[fileId];
-    const int32_t data_block_count = numBytesToNumBlocks(file.size);
-
-    const int32_t total_nodes_count(file.sentTreeBlocks.size());
-    const int32_t leaf_nodes_count = (data_block_count + kHashesPerBlock - 1) / kHashesPerBlock;
-
-    const int32_t leaf_nodes_offset = total_nodes_count - leaf_nodes_count;
-
-    // Leaf level, sending only 1 block.
-    const int32_t leaf_idx = leaf_nodes_offset + blockIdx / kHashesPerBlock;
-    if (file.sentTreeBlocks[leaf_idx]) {
-        return true;
-    }
-    if (!SendTreeBlock(fileId, blockIdx, leaf_idx)) {
-        return false;
-    }
-    file.sentTreeBlocks[leaf_idx] = true;
-
-    // Non-leaf, sending EVERYTHING. This should be done only once.
-    if (leaf_nodes_offset == 0 || file.sentTreeBlocks[0]) {
-        return true;
-    }
-
-    for (int32_t i = 0; i < leaf_nodes_offset; ++i) {
-        if (!SendTreeBlock(fileId, blockIdx, i)) {
-            return false;
-        }
-        file.sentTreeBlocks[i] = true;
-    }
-    return true;
-}
-
-bool IncrementalServer::SendTreeBlock(FileId fileId, int32_t fileBlockIdx, BlockIdx blockIdx) {
-    const auto& file = files_[fileId];
-
-    BlockBuffer buffer;
-    const int64_t bytesRead = file.ReadTreeBlock(blockIdx, buffer.data);
-    if (bytesRead <= 0) {
-        fprintf(stderr, "Failed to get data for %s.idsig at blockIdx=%d.\n", file.filepath,
-                blockIdx);
-        return false;
-    }
-
-    buffer.header.compression_type = kCompressionNone;
-    buffer.header.block_type = kTypeHash;
-    buffer.header.file_id = toBigEndian(fileId);
-    buffer.header.block_size = toBigEndian(int16_t(bytesRead));
-    buffer.header.block_idx = toBigEndian(blockIdx);
-
-    Send(&buffer, ResponseHeader::responseSizeFor(bytesRead), /*flush=*/false);
-
-    return true;
-}
-
-auto IncrementalServer::SendDataBlock(FileId fileId, BlockIdx blockIdx, bool flush) -> SendResult {
-    auto& file = files_[fileId];
-    if (blockIdx >= static_cast<long>(file.sentBlocks.size())) {
-        // may happen as we schedule some extra blocks for reported page misses
-        D("Skipped reading file %s at block %" PRId32 " (past end).", file.filepath, blockIdx);
-        return SendResult::Skipped;
-    }
-    if (file.sentBlocks[blockIdx]) {
-        return SendResult::Skipped;
-    }
-
-    if (!SendTreeBlocksForDataBlock(fileId, blockIdx)) {
-        return SendResult::Error;
-    }
-
-    BlockBuffer raw;
-    bool isZipCompressed = false;
-    const int64_t bytesRead = file.ReadDataBlock(blockIdx, raw.data, &isZipCompressed);
-    if (bytesRead < 0) {
-        fprintf(stderr, "Failed to get data for %s at blockIdx=%d (%d).\n", file.filepath, blockIdx,
-                errno);
-        return SendResult::Error;
-    }
-
-    BlockBuffer<kCompressBound> compressed;
-    int16_t compressedSize = 0;
-    if (!isZipCompressed) {
-        compressedSize = LZ4_compress_default(raw.data, compressed.data, bytesRead, kCompressBound);
-    }
-    int16_t blockSize;
-    ResponseHeader* header;
-    if (compressedSize > 0 && compressedSize < kCompressedSizeMax) {
-        ++compressed_;
-        blockSize = compressedSize;
-        header = &compressed.header;
-        header->compression_type = kCompressionLZ4;
-    } else {
-        ++uncompressed_;
-        blockSize = bytesRead;
-        header = &raw.header;
-        header->compression_type = kCompressionNone;
-    }
-
-    header->block_type = kTypeData;
-    header->file_id = toBigEndian(fileId);
-    header->block_size = toBigEndian(blockSize);
-    header->block_idx = toBigEndian(blockIdx);
-
-    file.sentBlocks[blockIdx] = true;
-    file.sentBlocksCount += 1;
-    Send(header, ResponseHeader::responseSizeFor(blockSize), flush);
-
-    return SendResult::Sent;
-}
-
-bool IncrementalServer::SendDone() {
-    ResponseHeader header;
-    header.file_id = -1;
-    header.block_type = 0;
-    header.compression_type = 0;
-    header.block_idx = 0;
-    header.block_size = 0;
-    Send(&header, sizeof(header), true);
-    return true;
-}
-
-void IncrementalServer::RunPrefetching() {
-    constexpr auto kPrefetchBlocksPerIteration = 128;
-
-    int blocksToSend = kPrefetchBlocksPerIteration;
-    while (!prefetches_.empty() && blocksToSend > 0) {
-        auto& prefetch = prefetches_.front();
-        const auto& file = *prefetch.file;
-        const auto& priority_blocks = file.PriorityBlocks();
-        if (!priority_blocks.empty()) {
-            for (auto& i = prefetch.priorityIndex;
-                 blocksToSend > 0 && i < (BlockIdx)priority_blocks.size(); ++i) {
-                if (auto res = SendDataBlock(file.id, priority_blocks[i]);
-                    res == SendResult::Sent) {
-                    --blocksToSend;
-                } else if (res == SendResult::Error) {
-                    fprintf(stderr, "Failed to send priority block %" PRId32 "\n", i);
-                }
-            }
-        }
-        for (auto& i = prefetch.overallIndex; blocksToSend > 0 && i < prefetch.overallEnd; ++i) {
-            if (auto res = SendDataBlock(file.id, i); res == SendResult::Sent) {
-                --blocksToSend;
-            } else if (res == SendResult::Error) {
-                fprintf(stderr, "Failed to send block %" PRId32 "\n", i);
-            }
-        }
-        if (prefetch.done()) {
-            prefetches_.pop_front();
-        }
-    }
-}
-
-void IncrementalServer::Send(const void* data, size_t size, bool flush) {
-    pendingBlocks_ = std::copy_n(static_cast<const char*>(data), size, pendingBlocks_);
-    if (flush || pendingBlocks_ - pendingBlocksBuffer_.data() > kChunkFlushSize) {
-        Flush();
-    }
-}
-
-void IncrementalServer::Flush() {
-    auto dataBytes = pendingBlocks_ - (pendingBlocksBuffer_.data() + sizeof(ChunkHeader));
-    if (dataBytes == 0) {
-        return;
-    }
-
-    *(ChunkHeader*)pendingBlocksBuffer_.data() = toBigEndian<int32_t>(dataBytes);
-    auto totalBytes = sizeof(ChunkHeader) + dataBytes;
-    if (!WriteFdExactly(adb_fd_, pendingBlocksBuffer_.data(), totalBytes)) {
-        fprintf(stderr, "Failed to write %d bytes\n", int(totalBytes));
-    }
-    sentSize_ += totalBytes;
-    pendingBlocks_ = pendingBlocksBuffer_.data() + sizeof(ChunkHeader);
-}
-
-bool IncrementalServer::ServingComplete(std::optional<TimePoint> startTime, int missesCount,
-                                        int missesSent) {
-    servingComplete_ = true;
-    using namespace std::chrono;
-    auto endTime = high_resolution_clock::now();
-    D("Streaming completed.\n"
-      "Misses: %d, of those unique: %d; sent compressed: %d, uncompressed: "
-      "%d, mb: %.3f\n"
-      "Total time taken: %.3fms",
-      missesCount, missesSent, compressed_, uncompressed_, sentSize_ / 1024.0 / 1024.0,
-      duration_cast<microseconds>(endTime - (startTime ? *startTime : endTime)).count() / 1000.0);
-    return true;
-}
-
-bool IncrementalServer::Serve() {
-    // Initial handshake to verify connection is still alive
-    if (!SendOkay(adb_fd_)) {
-        fprintf(stderr, "Connection is dead. Abort.\n");
-        return false;
-    }
-
-    std::unordered_set<FileId> prefetchedFiles;
-    bool doneSent = false;
-    int missesCount = 0;
-    int missesSent = 0;
-
-    using namespace std::chrono;
-    std::optional<TimePoint> startTime;
-
-    while (true) {
-        if (!doneSent && prefetches_.empty() &&
-            std::all_of(files_.begin(), files_.end(), [](const File& f) {
-                return f.sentBlocksCount == NumBlocks(f.sentBlocks.size());
-            })) {
-            fprintf(stderr, "All files should be loaded. Notifying the device.\n");
-            SendDone();
-            doneSent = true;
-        }
-
-        const bool blocking = prefetches_.empty();
-        if (blocking) {
-            // We've no idea how long the blocking call is, so let's flush whatever is still unsent.
-            Flush();
-        }
-        auto request = ReadRequest(blocking);
-
-        if (!startTime) {
-            startTime = high_resolution_clock::now();
-        }
-
-        if (request) {
-            FileId fileId = request->file_id;
-            BlockIdx blockIdx = request->block_idx;
-
-            switch (request->request_type) {
-                case DESTROY: {
-                    // Stop everything.
-                    return true;
-                }
-                case SERVING_COMPLETE: {
-                    // Not stopping the server here.
-                    ServingComplete(startTime, missesCount, missesSent);
-                    break;
-                }
-                case BLOCK_MISSING: {
-                    ++missesCount;
-                    // Sends one single block ASAP.
-                    if (fileId < 0 || fileId >= (FileId)files_.size() || blockIdx < 0 ||
-                        blockIdx >= (BlockIdx)files_[fileId].sentBlocks.size()) {
-                        fprintf(stderr,
-                                "Received invalid data request for file_id %" PRId16
-                                " block_idx %" PRId32 ".\n",
-                                fileId, blockIdx);
-                        break;
-                    }
-
-                    if (VLOG_IS_ON(INCREMENTAL)) {
-                        auto& file = files_[fileId];
-                        auto posP = std::find(file.PriorityBlocks().begin(),
-                                              file.PriorityBlocks().end(), blockIdx);
-                        D("\tMISSING BLOCK: reading file %d block %04d (in priority: %d of %d)",
-                          (int)fileId, (int)blockIdx,
-                          posP == file.PriorityBlocks().end()
-                                  ? -1
-                                  : int(posP - file.PriorityBlocks().begin()),
-                          int(file.PriorityBlocks().size()));
-                    }
-
-                    if (auto res = SendDataBlock(fileId, blockIdx, true);
-                        res == SendResult::Error) {
-                        fprintf(stderr, "Failed to send block %" PRId32 ".\n", blockIdx);
-                    } else if (res == SendResult::Sent) {
-                        ++missesSent;
-                        // Make sure we send more pages from this place onward, in case if the OS is
-                        // reading a bigger block.
-                        prefetches_.emplace_front(files_[fileId], blockIdx + 1, 7);
-                    }
-                    break;
-                }
-                case PREFETCH: {
-                    // Start prefetching for a file
-                    if (fileId < 0) {
-                        fprintf(stderr,
-                                "Received invalid prefetch request for file_id %" PRId16 "\n",
-                                fileId);
-                        break;
-                    }
-                    if (!prefetchedFiles.insert(fileId).second) {
-                        fprintf(stderr,
-                                "Received duplicate prefetch request for file_id %" PRId16 "\n",
-                                fileId);
-                        break;
-                    }
-                    D("Received prefetch request for file_id %" PRId16 ".", fileId);
-                    prefetches_.emplace_back(files_[fileId]);
-                    break;
-                }
-                default:
-                    fprintf(stderr, "Invalid request %" PRId16 ",%" PRId16 ",%" PRId32 ".\n",
-                            request->request_type, fileId, blockIdx);
-                    break;
-            }
-        }
-
-        RunPrefetching();
-    }
-}
-
-static std::pair<unique_fd, int64_t> open_fd(const char* filepath) {
-    struct stat st;
-    if (stat(filepath, &st)) {
-        error_exit("inc-server: failed to stat input file '%s'.", filepath);
-    }
-
-    unique_fd fd(adb_open(filepath, O_RDONLY));
-    if (fd < 0) {
-        error_exit("inc-server: failed to open file '%s'.", filepath);
-    }
-
-    return {std::move(fd), st.st_size};
-}
-
-static std::pair<unique_fd, int64_t> open_signature(int64_t file_size, const char* filepath) {
-    std::string signature_file(filepath);
-    signature_file += IDSIG;
-
-    unique_fd fd(adb_open(signature_file.c_str(), O_RDONLY));
-    if (fd < 0) {
-        error_exit("inc-server: failed to open file '%s'.", signature_file.c_str());
-    }
-
-    auto [tree_offset, tree_size] = skip_id_sig_headers(fd);
-    if (auto expected = verity_tree_size_for_file(file_size); tree_size != expected) {
-        error_exit("Verity tree size mismatch in signature file: %s [was %lld, expected %lld].\n",
-                   signature_file.c_str(), (long long)tree_size, (long long)expected);
-    }
-
-    int32_t data_block_count = numBytesToNumBlocks(file_size);
-    int32_t leaf_nodes_count = (data_block_count + kHashesPerBlock - 1) / kHashesPerBlock;
-    D("Verity tree loaded: %s, tree size: %d (%d blocks, %d leafs)", signature_file.c_str(),
-      int(tree_size), int(numBytesToNumBlocks(tree_size)), int(leaf_nodes_count));
-
-    return {std::move(fd), tree_offset};
-}
-
-bool serve(int connection_fd, int output_fd, int argc, const char** argv) {
-    auto connection_ufd = unique_fd(connection_fd);
-    auto output_ufd = unique_fd(output_fd);
-    if (argc <= 0) {
-        error_exit("inc-server: must specify at least one file.");
-    }
-
-    std::vector<File> files;
-    files.reserve(argc);
-    for (int i = 0; i < argc; ++i) {
-        auto filepath = argv[i];
-
-        auto [file_fd, file_size] = open_fd(filepath);
-        auto [sign_fd, sign_offset] = open_signature(file_size, filepath);
-
-        files.emplace_back(filepath, i, file_size, std::move(file_fd), sign_offset,
-                           std::move(sign_fd));
-    }
-
-    IncrementalServer server(std::move(connection_ufd), std::move(output_ufd), std::move(files));
-    printf("Serving...\n");
-    fclose(stdin);
-    fclose(stdout);
-    return server.Serve();
-}
-
-}  // namespace incremental
diff --git a/adb/client/incremental_server.h b/adb/client/incremental_server.h
deleted file mode 100644
index 55b8215..0000000
--- a/adb/client/incremental_server.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-namespace incremental {
-
-// Expecting arguments like:
-// {FILE1 FILE2 ...}
-// Where FILE* are files to serve.
-bool serve(int connection_fd, int output_fd, int argc, const char** argv);
-
-}  // namespace incremental
diff --git a/adb/client/incremental_utils.cpp b/adb/client/incremental_utils.cpp
deleted file mode 100644
index 076b766..0000000
--- a/adb/client/incremental_utils.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#define TRACE_TAG INCREMENTAL
-
-#include "incremental_utils.h"
-
-#include <android-base/endian.h>
-#include <android-base/mapped_file.h>
-#include <android-base/strings.h>
-#include <ziparchive/zip_archive.h>
-#include <ziparchive/zip_writer.h>
-
-#include <cinttypes>
-#include <numeric>
-#include <unordered_set>
-
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "sysdeps.h"
-
-namespace incremental {
-
-static constexpr inline int32_t offsetToBlockIndex(int64_t offset) {
-    return (offset & ~(kBlockSize - 1)) >> 12;
-}
-
-Size verity_tree_blocks_for_file(Size fileSize) {
-    if (fileSize == 0) {
-        return 0;
-    }
-
-    constexpr int hash_per_block = kBlockSize / kDigestSize;
-
-    Size total_tree_block_count = 0;
-
-    auto block_count = 1 + (fileSize - 1) / kBlockSize;
-    auto hash_block_count = block_count;
-    for (auto i = 0; hash_block_count > 1; i++) {
-        hash_block_count = (hash_block_count + hash_per_block - 1) / hash_per_block;
-        total_tree_block_count += hash_block_count;
-    }
-    return total_tree_block_count;
-}
-
-Size verity_tree_size_for_file(Size fileSize) {
-    return verity_tree_blocks_for_file(fileSize) * kBlockSize;
-}
-
-static inline int32_t read_int32(borrowed_fd fd) {
-    int32_t result;
-    return ReadFdExactly(fd, &result, sizeof(result)) ? result : -1;
-}
-
-static inline int32_t skip_int(borrowed_fd fd) {
-    return adb_lseek(fd, 4, SEEK_CUR);
-}
-
-static inline void append_int(borrowed_fd fd, std::vector<char>* bytes) {
-    int32_t le_val = read_int32(fd);
-    auto old_size = bytes->size();
-    bytes->resize(old_size + sizeof(le_val));
-    memcpy(bytes->data() + old_size, &le_val, sizeof(le_val));
-}
-
-static inline void append_bytes_with_size(borrowed_fd fd, std::vector<char>* bytes) {
-    int32_t le_size = read_int32(fd);
-    if (le_size < 0) {
-        return;
-    }
-    int32_t size = int32_t(le32toh(le_size));
-    auto old_size = bytes->size();
-    bytes->resize(old_size + sizeof(le_size) + size);
-    memcpy(bytes->data() + old_size, &le_size, sizeof(le_size));
-    ReadFdExactly(fd, bytes->data() + old_size + sizeof(le_size), size);
-}
-
-static inline int32_t skip_bytes_with_size(borrowed_fd fd) {
-    int32_t le_size = read_int32(fd);
-    if (le_size < 0) {
-        return -1;
-    }
-    int32_t size = int32_t(le32toh(le_size));
-    return (int32_t)adb_lseek(fd, size, SEEK_CUR);
-}
-
-std::pair<std::vector<char>, int32_t> read_id_sig_headers(borrowed_fd fd) {
-    std::vector<char> result;
-    append_int(fd, &result);              // version
-    append_bytes_with_size(fd, &result);  // hashingInfo
-    append_bytes_with_size(fd, &result);  // signingInfo
-    auto le_tree_size = read_int32(fd);
-    auto tree_size = int32_t(le32toh(le_tree_size));  // size of the verity tree
-    return {std::move(result), tree_size};
-}
-
-std::pair<off64_t, ssize_t> skip_id_sig_headers(borrowed_fd fd) {
-    skip_int(fd);                            // version
-    skip_bytes_with_size(fd);                // hashingInfo
-    auto offset = skip_bytes_with_size(fd);  // signingInfo
-    auto le_tree_size = read_int32(fd);
-    auto tree_size = int32_t(le32toh(le_tree_size));  // size of the verity tree
-    return {offset + sizeof(le_tree_size), tree_size};
-}
-
-template <class T>
-static T valueAt(borrowed_fd fd, off64_t offset) {
-    T t;
-    memset(&t, 0, sizeof(T));
-    if (adb_pread(fd, &t, sizeof(T), offset) != sizeof(T)) {
-        memset(&t, -1, sizeof(T));
-    }
-
-    return t;
-}
-
-static void appendBlocks(int32_t start, int count, std::vector<int32_t>* blocks) {
-    if (count == 1) {
-        blocks->push_back(start);
-    } else {
-        auto oldSize = blocks->size();
-        blocks->resize(oldSize + count);
-        std::iota(blocks->begin() + oldSize, blocks->end(), start);
-    }
-}
-
-template <class T>
-static void unduplicate(std::vector<T>& v) {
-    std::unordered_set<T> uniques(v.size());
-    v.erase(std::remove_if(v.begin(), v.end(),
-                           [&uniques](T t) { return !uniques.insert(t).second; }),
-            v.end());
-}
-
-static off64_t CentralDirOffset(borrowed_fd fd, Size fileSize) {
-    static constexpr int kZipEocdRecMinSize = 22;
-    static constexpr int32_t kZipEocdRecSig = 0x06054b50;
-    static constexpr int kZipEocdCentralDirSizeFieldOffset = 12;
-    static constexpr int kZipEocdCommentLengthFieldOffset = 20;
-
-    int32_t sigBuf = 0;
-    off64_t eocdOffset = -1;
-    off64_t maxEocdOffset = fileSize - kZipEocdRecMinSize;
-    int16_t commentLenBuf = 0;
-
-    // Search from the end of zip, backward to find beginning of EOCD
-    for (int16_t commentLen = 0; commentLen < fileSize; ++commentLen) {
-        sigBuf = valueAt<int32_t>(fd, maxEocdOffset - commentLen);
-        if (sigBuf == kZipEocdRecSig) {
-            commentLenBuf = valueAt<int16_t>(
-                    fd, maxEocdOffset - commentLen + kZipEocdCommentLengthFieldOffset);
-            if (commentLenBuf == commentLen) {
-                eocdOffset = maxEocdOffset - commentLen;
-                break;
-            }
-        }
-    }
-
-    if (eocdOffset < 0) {
-        return -1;
-    }
-
-    off64_t cdLen = static_cast<int64_t>(
-            valueAt<int32_t>(fd, eocdOffset + kZipEocdCentralDirSizeFieldOffset));
-
-    return eocdOffset - cdLen;
-}
-
-// Does not support APKs larger than 4GB
-static off64_t SignerBlockOffset(borrowed_fd fd, Size fileSize) {
-    static constexpr int kApkSigBlockMinSize = 32;
-    static constexpr int kApkSigBlockFooterSize = 24;
-    static constexpr int64_t APK_SIG_BLOCK_MAGIC_HI = 0x3234206b636f6c42l;
-    static constexpr int64_t APK_SIG_BLOCK_MAGIC_LO = 0x20676953204b5041l;
-
-    off64_t cdOffset = CentralDirOffset(fd, fileSize);
-    if (cdOffset < 0) {
-        return -1;
-    }
-    // CD offset is where original signer block ends. Search backwards for magic and footer.
-    if (cdOffset < kApkSigBlockMinSize ||
-        valueAt<int64_t>(fd, cdOffset - 2 * sizeof(int64_t)) != APK_SIG_BLOCK_MAGIC_LO ||
-        valueAt<int64_t>(fd, cdOffset - sizeof(int64_t)) != APK_SIG_BLOCK_MAGIC_HI) {
-        return -1;
-    }
-    int32_t signerSizeInFooter = valueAt<int32_t>(fd, cdOffset - kApkSigBlockFooterSize);
-    off64_t signerBlockOffset = cdOffset - signerSizeInFooter - sizeof(int64_t);
-    if (signerBlockOffset < 0) {
-        return -1;
-    }
-    int32_t signerSizeInHeader = valueAt<int32_t>(fd, signerBlockOffset);
-    if (signerSizeInFooter != signerSizeInHeader) {
-        return -1;
-    }
-
-    return signerBlockOffset;
-}
-
-static std::vector<int32_t> ZipPriorityBlocks(off64_t signerBlockOffset, Size fileSize) {
-    int32_t signerBlockIndex = offsetToBlockIndex(signerBlockOffset);
-    int32_t lastBlockIndex = offsetToBlockIndex(fileSize);
-    const auto numPriorityBlocks = lastBlockIndex - signerBlockIndex + 1;
-
-    std::vector<int32_t> zipPriorityBlocks;
-
-    // Some magic here: most of zip libraries perform a scan for EOCD record starting at the offset
-    // of a maximum comment size from the end of the file. This means the last 65-ish KBs will be
-    // accessed first, followed by the rest of the central directory blocks. Make sure we
-    // send the data in the proper order, as central directory can be quite big by itself.
-    static constexpr auto kMaxZipCommentSize = 64 * 1024;
-    static constexpr auto kNumBlocksInEocdSearch = kMaxZipCommentSize / kBlockSize + 1;
-    if (numPriorityBlocks > kNumBlocksInEocdSearch) {
-        appendBlocks(lastBlockIndex - kNumBlocksInEocdSearch + 1, kNumBlocksInEocdSearch,
-                     &zipPriorityBlocks);
-        appendBlocks(signerBlockIndex, numPriorityBlocks - kNumBlocksInEocdSearch,
-                     &zipPriorityBlocks);
-    } else {
-        appendBlocks(signerBlockIndex, numPriorityBlocks, &zipPriorityBlocks);
-    }
-
-    // Somehow someone keeps accessing the start of the archive, even if there's nothing really
-    // interesting there...
-    appendBlocks(0, 1, &zipPriorityBlocks);
-    return zipPriorityBlocks;
-}
-
-[[maybe_unused]] static ZipArchiveHandle openZipArchiveFd(borrowed_fd fd) {
-    bool transferFdOwnership = false;
-#ifdef _WIN32
-    //
-    // Need to create a special CRT FD here as the current one is not compatible with
-    // normal read()/write() calls that libziparchive uses.
-    // To make this work we have to create a copy of the file handle, as CRT doesn't care
-    // and closes it together with the new descriptor.
-    //
-    // Note: don't move this into a helper function, it's better to be hard to reuse because
-    //       the code is ugly and won't work unless it's a last resort.
-    //
-    auto handle = adb_get_os_handle(fd);
-    HANDLE dupedHandle;
-    if (!::DuplicateHandle(::GetCurrentProcess(), handle, ::GetCurrentProcess(), &dupedHandle, 0,
-                           false, DUPLICATE_SAME_ACCESS)) {
-        D("%s failed at DuplicateHandle: %d", __func__, (int)::GetLastError());
-        return {};
-    }
-    int osfd = _open_osfhandle((intptr_t)dupedHandle, _O_RDONLY | _O_BINARY);
-    if (osfd < 0) {
-        D("%s failed at _open_osfhandle: %d", __func__, errno);
-        ::CloseHandle(handle);
-        return {};
-    }
-    transferFdOwnership = true;
-#else
-    int osfd = fd.get();
-#endif
-    ZipArchiveHandle zip;
-    if (OpenArchiveFd(osfd, "apk_fd", &zip, transferFdOwnership) != 0) {
-        D("%s failed at OpenArchiveFd: %d", __func__, errno);
-#ifdef _WIN32
-        // "_close()" is a secret WinCRT name for the regular close() function.
-        _close(osfd);
-#endif
-        return {};
-    }
-    return zip;
-}
-
-static std::pair<ZipArchiveHandle, std::unique_ptr<android::base::MappedFile>> openZipArchive(
-        borrowed_fd fd, Size fileSize) {
-#ifndef __LP64__
-    if (fileSize >= INT_MAX) {
-        return {openZipArchiveFd(fd), nullptr};
-    }
-#endif
-    auto mapping =
-            android::base::MappedFile::FromOsHandle(adb_get_os_handle(fd), 0, fileSize, PROT_READ);
-    if (!mapping) {
-        D("%s failed at FromOsHandle: %d", __func__, errno);
-        return {};
-    }
-    ZipArchiveHandle zip;
-    if (OpenArchiveFromMemory(mapping->data(), mapping->size(), "apk_mapping", &zip) != 0) {
-        D("%s failed at OpenArchiveFromMemory: %d", __func__, errno);
-        return {};
-    }
-    return {zip, std::move(mapping)};
-}
-
-// TODO(b/151676293): avoid using libziparchive as it reads local file headers
-// which causes additional performance cost. Instead, only read from central directory.
-static std::vector<int32_t> InstallationPriorityBlocks(borrowed_fd fd, Size fileSize) {
-    auto [zip, _] = openZipArchive(fd, fileSize);
-    if (!zip) {
-        return {};
-    }
-
-    void* cookie = nullptr;
-    if (StartIteration(zip, &cookie) != 0) {
-        D("%s failed at StartIteration: %d", __func__, errno);
-        return {};
-    }
-
-    std::vector<int32_t> installationPriorityBlocks;
-    ZipEntry entry;
-    std::string_view entryName;
-    while (Next(cookie, &entry, &entryName) == 0) {
-        if (entryName == "resources.arsc" || entryName == "AndroidManifest.xml" ||
-            entryName.starts_with("lib/")) {
-            // Full entries are needed for installation
-            off64_t entryStartOffset = entry.offset;
-            off64_t entryEndOffset =
-                    entryStartOffset +
-                    (entry.method == kCompressStored ? entry.uncompressed_length
-                                                     : entry.compressed_length) +
-                    (entry.has_data_descriptor ? 16 /* sizeof(DataDescriptor) */ : 0);
-            int32_t startBlockIndex = offsetToBlockIndex(entryStartOffset);
-            int32_t endBlockIndex = offsetToBlockIndex(entryEndOffset);
-            int32_t numNewBlocks = endBlockIndex - startBlockIndex + 1;
-            appendBlocks(startBlockIndex, numNewBlocks, &installationPriorityBlocks);
-            D("\tadding to priority blocks: '%.*s'", (int)entryName.size(), entryName.data());
-        } else if (entryName == "classes.dex") {
-            // Only the head is needed for installation
-            int32_t startBlockIndex = offsetToBlockIndex(entry.offset);
-            appendBlocks(startBlockIndex, 2, &installationPriorityBlocks);
-            D("\tadding to priority blocks: '%.*s'", (int)entryName.size(), entryName.data());
-        }
-    }
-
-    EndIteration(cookie);
-    CloseArchive(zip);
-    return installationPriorityBlocks;
-}
-
-std::vector<int32_t> PriorityBlocksForFile(const std::string& filepath, borrowed_fd fd,
-                                           Size fileSize) {
-    if (!android::base::EndsWithIgnoreCase(filepath, ".apk")) {
-        return {};
-    }
-    off64_t signerOffset = SignerBlockOffset(fd, fileSize);
-    if (signerOffset < 0) {
-        // No signer block? not a valid APK
-        return {};
-    }
-    std::vector<int32_t> priorityBlocks = ZipPriorityBlocks(signerOffset, fileSize);
-    std::vector<int32_t> installationPriorityBlocks = InstallationPriorityBlocks(fd, fileSize);
-
-    priorityBlocks.insert(priorityBlocks.end(), installationPriorityBlocks.begin(),
-                          installationPriorityBlocks.end());
-    unduplicate(priorityBlocks);
-    return priorityBlocks;
-}
-
-}  // namespace incremental
diff --git a/adb/client/incremental_utils.h b/adb/client/incremental_utils.h
deleted file mode 100644
index fe2914d..0000000
--- a/adb/client/incremental_utils.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-
-#include <string>
-#include <string_view>
-#include <utility>
-#include <vector>
-
-#include <stdint.h>
-
-#include <android-base/off64_t.h>
-
-namespace incremental {
-
-using Size = int64_t;
-constexpr int kBlockSize = 4096;
-constexpr int kSha256DigestSize = 32;
-constexpr int kDigestSize = kSha256DigestSize;
-
-constexpr std::string_view IDSIG = ".idsig";
-
-std::vector<int32_t> PriorityBlocksForFile(const std::string& filepath, borrowed_fd fd,
-                                           Size fileSize);
-
-Size verity_tree_blocks_for_file(Size fileSize);
-Size verity_tree_size_for_file(Size fileSize);
-
-std::pair<std::vector<char>, int32_t> read_id_sig_headers(borrowed_fd fd);
-std::pair<off64_t, ssize_t> skip_id_sig_headers(borrowed_fd fd);
-
-}  // namespace incremental
diff --git a/adb/client/line_printer.cpp b/adb/client/line_printer.cpp
deleted file mode 100644
index 50c03e8..0000000
--- a/adb/client/line_printer.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// 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.
-
-#include "line_printer.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-#include <sys/time.h>
-#endif
-
-// Make sure printf is really adb_printf which works for UTF-8 on Windows.
-#include <sysdeps.h>
-
-// Stuff from ninja's util.h that's needed below.
-#include <vector>
-using namespace std;
-// This does not account for multiple UTF-8 bytes corresponding to a single Unicode code point, or
-// multiple code points corresponding to a single grapheme cluster (user-perceived character).
-string ElideMiddle(const string& str, size_t width) {
-  const int kMargin = 3;  // Space for "...".
-  string result = str;
-  if (result.size() + kMargin > width) {
-    size_t elide_size = (width - kMargin) / 2;
-    result = result.substr(0, elide_size)
-      + "..."
-      + result.substr(result.size() - elide_size, elide_size);
-  }
-  return result;
-}
-
-LinePrinter::LinePrinter() : have_blank_line_(true) {
-#ifndef _WIN32
-  const char* term = getenv("TERM");
-  smart_terminal_ = unix_isatty(1) && term && string(term) != "dumb";
-#else
-  // Disable output buffer.  It'd be nice to use line buffering but
-  // MSDN says: "For some systems, [_IOLBF] provides line
-  // buffering. However, for Win32, the behavior is the same as _IOFBF
-  // - Full Buffering."
-  setvbuf(stdout, nullptr, _IONBF, 0);
-  console_ = GetStdHandle(STD_OUTPUT_HANDLE);
-  CONSOLE_SCREEN_BUFFER_INFO csbi;
-  smart_terminal_ = GetConsoleScreenBufferInfo(console_, &csbi);
-#endif
-}
-
-static void Out(const std::string& s) {
-  // Avoid printf and C strings, since the actual output might contain null
-  // bytes like UTF-16 does (yuck).
-  fwrite(s.data(), 1, s.size(), stdout);
-}
-
-void LinePrinter::Print(string to_print, LineType type) {
-  if (!smart_terminal_) {
-    if (type == LineType::INFO) {
-        info_line_ = to_print + "\n";
-    } else {
-        Out(to_print + "\n");
-    }
-    return;
-  }
-
-  // Print over previous line, if any.
-  // On Windows, calling a C library function writing to stdout also handles
-  // pausing the executable when the "Pause" key or Ctrl-S is pressed.
-  printf("\r");
-
-  if (type == INFO) {
-#ifdef _WIN32
-    CONSOLE_SCREEN_BUFFER_INFO csbi;
-    GetConsoleScreenBufferInfo(console_, &csbi);
-
-    to_print = ElideMiddle(to_print, static_cast<size_t>(csbi.dwSize.X));
-    std::wstring to_print_wide;
-    // ElideMiddle may create invalid UTF-8, so ignore conversion errors.
-    (void)android::base::UTF8ToWide(to_print, &to_print_wide);
-    // We don't want to have the cursor spamming back and forth, so instead of
-    // printf use WriteConsoleOutput which updates the contents of the buffer,
-    // but doesn't move the cursor position.
-    COORD buf_size = { csbi.dwSize.X, 1 };
-    COORD zero_zero = { 0, 0 };
-    SMALL_RECT target = {
-      csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y,
-      static_cast<SHORT>(csbi.dwCursorPosition.X + csbi.dwSize.X - 1),
-      csbi.dwCursorPosition.Y
-    };
-    vector<CHAR_INFO> char_data(csbi.dwSize.X);
-    for (size_t i = 0; i < static_cast<size_t>(csbi.dwSize.X); ++i) {
-        char_data[i].Char.UnicodeChar = i < to_print_wide.size() ? to_print_wide[i] : L' ';
-        char_data[i].Attributes = csbi.wAttributes;
-    }
-    WriteConsoleOutputW(console_, &char_data[0], buf_size, zero_zero, &target);
-#else
-    // Limit output to width of the terminal if provided so we don't cause
-    // line-wrapping.
-    winsize size;
-    if ((ioctl(0, TIOCGWINSZ, &size) == 0) && size.ws_col) {
-      to_print = ElideMiddle(to_print, size.ws_col);
-    }
-    Out(to_print);
-    printf("\x1B[K");  // Clear to end of line.
-    fflush(stdout);
-#endif
-
-    have_blank_line_ = false;
-  } else {
-    Out(to_print);
-    Out("\n");
-    have_blank_line_ = true;
-  }
-}
-
-void LinePrinter::KeepInfoLine() {
-  if (smart_terminal_) {
-      if (!have_blank_line_) Out("\n");
-      have_blank_line_ = true;
-  } else {
-      Out(info_line_);
-      info_line_.clear();
-  }
-}
diff --git a/adb/client/line_printer.h b/adb/client/line_printer.h
deleted file mode 100644
index 4c4c7c6..0000000
--- a/adb/client/line_printer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// 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.
-
-#ifndef NINJA_LINE_PRINTER_H_
-#define NINJA_LINE_PRINTER_H_
-
-#include <stddef.h>
-#include <string>
-
-/// Prints lines of text, possibly overprinting previously printed lines
-/// if the terminal supports it.
-struct LinePrinter {
-  LinePrinter();
-
-  bool is_smart_terminal() const { return smart_terminal_; }
-  void set_smart_terminal(bool smart) { smart_terminal_ = smart; }
-
-  enum LineType { INFO, WARNING, ERROR };
-
-  /// Outputs the given line. INFO output will be overwritten.
-  /// WARNING and ERROR appear on a line to themselves.
-  void Print(std::string to_print, LineType type);
-
-  /// If there's an INFO line, keep it. If not, do nothing.
-  void KeepInfoLine();
-
- private:
-  /// Whether we can do fancy terminal control codes.
-  bool smart_terminal_;
-
-  /// Whether the caret is at the beginning of a blank line.
-  bool have_blank_line_;
-
-  /// The last printed info line when printing to a dumb terminal.
-  std::string info_line_;
-
-#ifdef _WIN32
-  void* console_;
-#endif
-};
-
-#endif  // NINJA_LINE_PRINTER_H_
diff --git a/adb/client/main.cpp b/adb/client/main.cpp
deleted file mode 100644
index 78f7b8f..0000000
--- a/adb/client/main.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "sysdeps.h"
-
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <thread>
-
-#include <android-base/errors.h>
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-
-#include "adb.h"
-#include "adb_auth.h"
-#include "adb_client.h"
-#include "adb_listeners.h"
-#include "adb_utils.h"
-#include "adb_wifi.h"
-#include "client/usb.h"
-#include "commandline.h"
-#include "sysdeps/chrono.h"
-#include "transport.h"
-
-const char** __adb_argv;
-const char** __adb_envp;
-
-static void setup_daemon_logging() {
-    const std::string log_file_path(GetLogFilePath());
-    int fd = unix_open(log_file_path, O_WRONLY | O_CREAT | O_APPEND, 0640);
-    if (fd == -1) {
-        PLOG(FATAL) << "cannot open " << log_file_path;
-    }
-    if (dup2(fd, STDOUT_FILENO) == -1) {
-        PLOG(FATAL) << "cannot redirect stdout";
-    }
-    if (dup2(fd, STDERR_FILENO) == -1) {
-        PLOG(FATAL) << "cannot redirect stderr";
-    }
-    unix_close(fd);
-
-    fprintf(stderr, "--- adb starting (pid %d) ---\n", getpid());
-    LOG(INFO) << adb_version();
-}
-
-void adb_server_cleanup() {
-    // Upon exit, we want to clean up in the following order:
-    //   1. close_smartsockets, so that we don't get any new clients
-    //   2. kick_all_transports, to avoid writing only part of a packet to a transport.
-    //   3. usb_cleanup, to tear down the USB stack.
-    close_smartsockets();
-    kick_all_transports();
-    usb_cleanup();
-}
-
-static void intentionally_leak() {
-    void* p = ::operator new(1);
-    // The analyzer is upset about this leaking. NOLINTNEXTLINE
-    LOG(INFO) << "leaking pointer " << p;
-}
-
-int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply_fd) {
-#if defined(_WIN32)
-    // adb start-server starts us up with stdout and stderr hooked up to
-    // anonymous pipes. When the C Runtime sees this, it makes stderr and
-    // stdout buffered, but to improve the chance that error output is seen,
-    // unbuffer stdout and stderr just like if we were run at the console.
-    // This also keeps stderr unbuffered when it is redirected to adb.log.
-    if (is_daemon) {
-        if (setvbuf(stdout, nullptr, _IONBF, 0) == -1) {
-            PLOG(FATAL) << "cannot make stdout unbuffered";
-        }
-        if (setvbuf(stderr, nullptr, _IONBF, 0) == -1) {
-            PLOG(FATAL) << "cannot make stderr unbuffered";
-        }
-    }
-
-    // TODO: On Ctrl-C, consider trying to kill a starting up adb server (if we're in
-    // launch_server) by calling GenerateConsoleCtrlEvent().
-
-    // On Windows, SIGBREAK is when Ctrl-Break is pressed or the console window is closed. It should
-    // act like Ctrl-C.
-    signal(SIGBREAK, [](int) { raise(SIGINT); });
-#endif
-    signal(SIGINT, [](int) {
-        fdevent_run_on_main_thread([]() { exit(0); });
-    });
-
-    char* leak = getenv("ADB_LEAK");
-    if (leak && strcmp(leak, "1") == 0) {
-        intentionally_leak();
-    }
-
-    if (is_daemon) {
-        close_stdin();
-        setup_daemon_logging();
-    }
-
-    atexit(adb_server_cleanup);
-
-    init_transport_registration();
-    init_reconnect_handler();
-
-    adb_wifi_init();
-    if (!getenv("ADB_MDNS") || strcmp(getenv("ADB_MDNS"), "0") != 0) {
-        init_mdns_transport_discovery();
-    }
-
-    if (!getenv("ADB_USB") || strcmp(getenv("ADB_USB"), "0") != 0) {
-        usb_init();
-    } else {
-        adb_notify_device_scan_complete();
-    }
-
-    if (!getenv("ADB_EMU") || strcmp(getenv("ADB_EMU"), "0") != 0) {
-        local_init(android::base::StringPrintf("tcp:%d", DEFAULT_ADB_LOCAL_TRANSPORT_PORT));
-    }
-
-    std::string error;
-
-    auto start = std::chrono::steady_clock::now();
-
-    // If we told a previous adb server to quit because of version mismatch, we can get to this
-    // point before it's finished exiting. Retry for a while to give it some time.
-    while (install_listener(socket_spec, "*smartsocket*", nullptr, 0, nullptr, &error) !=
-           INSTALL_STATUS_OK) {
-        if (std::chrono::steady_clock::now() - start > 0.5s) {
-            LOG(FATAL) << "could not install *smartsocket* listener: " << error;
-        }
-
-        std::this_thread::sleep_for(100ms);
-    }
-
-    adb_auth_init();
-
-    if (is_daemon) {
-#if !defined(_WIN32)
-        // Start a new session for the daemon. Do this here instead of after the fork so
-        // that a ctrl-c between the "starting server" and "done starting server" messages
-        // gets a chance to terminate the server.
-        // setsid will fail with EPERM if it's already been a lead process of new session.
-        // Ignore such error.
-        if (setsid() == -1 && errno != EPERM) {
-            PLOG(FATAL) << "setsid() failed";
-        }
-#endif
-
-        // Wait for the USB scan to complete before notifying the parent that we're up.
-        // We need to perform this in a thread, because we would otherwise block the event loop.
-        std::thread notify_thread([ack_reply_fd]() {
-            adb_wait_for_device_initialization();
-
-            // Any error output written to stderr now goes to adb.log. We could
-            // keep around a copy of the stderr fd and use that to write any errors
-            // encountered by the following code, but that is probably overkill.
-#if defined(_WIN32)
-            const HANDLE ack_reply_handle = cast_int_to_handle(ack_reply_fd);
-            const CHAR ack[] = "OK\n";
-            const DWORD bytes_to_write = arraysize(ack) - 1;
-            DWORD written = 0;
-            if (!WriteFile(ack_reply_handle, ack, bytes_to_write, &written, NULL)) {
-                LOG(FATAL) << "cannot write ACK to handle " << ack_reply_handle
-                           << android::base::SystemErrorCodeToString(GetLastError());
-            }
-            if (written != bytes_to_write) {
-                LOG(FATAL) << "cannot write " << bytes_to_write << " bytes of ACK: only wrote "
-                           << written << " bytes";
-            }
-            CloseHandle(ack_reply_handle);
-#else
-            // TODO(danalbert): Can't use SendOkay because we're sending "OK\n", not
-            // "OKAY".
-            if (!android::base::WriteStringToFd("OK\n", ack_reply_fd)) {
-                PLOG(FATAL) << "error writing ACK to fd " << ack_reply_fd;
-            }
-            unix_close(ack_reply_fd);
-#endif
-        });
-        notify_thread.detach();
-    }
-
-#if defined(__linux__)
-    // Write our location to .android/adb.$PORT, so that older clients can exec us.
-    std::string path;
-    if (!android::base::Readlink("/proc/self/exe", &path)) {
-        PLOG(ERROR) << "failed to readlink /proc/self/exe";
-    }
-
-    std::optional<std::string> server_executable_path = adb_get_server_executable_path();
-    if (server_executable_path) {
-      if (!android::base::WriteStringToFile(path, *server_executable_path)) {
-          PLOG(ERROR) << "failed to write server path to " << path;
-      }
-    }
-#endif
-
-    D("Event loop starting");
-    fdevent_loop();
-    return 0;
-}
-
-int main(int argc, char* argv[], char* envp[]) {
-    __adb_argv = const_cast<const char**>(argv);
-    __adb_envp = const_cast<const char**>(envp);
-    adb_trace_init(argv);
-    return adb_commandline(argc - 1, const_cast<const char**>(argv + 1));
-}
diff --git a/adb/client/pairing/pairing_client.cpp b/adb/client/pairing/pairing_client.cpp
deleted file mode 100644
index 04bbceb..0000000
--- a/adb/client/pairing/pairing_client.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "client/pairing/pairing_client.h"
-
-#include <atomic>
-#include <iomanip>
-#include <mutex>
-#include <sstream>
-#include <thread>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/stringprintf.h>
-#include <android-base/thread_annotations.h>
-#include <android-base/unique_fd.h>
-#include <cutils/sockets.h>
-#include "sysdeps.h"
-
-namespace adbwifi {
-namespace pairing {
-
-using android::base::unique_fd;
-
-namespace {
-
-struct ConnectionDeleter {
-    void operator()(PairingConnectionCtx* p) { pairing_connection_destroy(p); }
-};  // ConnectionDeleter
-using ConnectionPtr = std::unique_ptr<PairingConnectionCtx, ConnectionDeleter>;
-
-class PairingClientImpl : public PairingClient {
-  public:
-    virtual ~PairingClientImpl();
-
-    explicit PairingClientImpl(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                               const Data& priv_key);
-
-    // Starts the pairing client. This call is non-blocking. Upon pairing
-    // completion, |cb| will be called with the PeerInfo on success,
-    // or an empty value on failure.
-    //
-    // Returns true if PairingClient was successfully started. Otherwise,
-    // return false.
-    virtual bool Start(std::string_view ip_addr, pairing_client_result_cb cb,
-                       void* opaque) override;
-
-    static void OnPairingResult(const PeerInfo* peer_info, int fd, void* opaque);
-
-  private:
-    // Setup and start the PairingConnection
-    bool StartConnection();
-
-    enum class State {
-        Ready,
-        Running,
-        Stopped,
-    };
-
-    State state_ = State::Ready;
-    Data pswd_;
-    PeerInfo peer_info_;
-    Data cert_;
-    Data priv_key_;
-    std::string host_;
-    int port_;
-
-    ConnectionPtr connection_;
-    pairing_client_result_cb cb_;
-    void* opaque_ = nullptr;
-};  // PairingClientImpl
-
-PairingClientImpl::PairingClientImpl(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                                     const Data& priv_key)
-    : pswd_(pswd), peer_info_(peer_info), cert_(cert), priv_key_(priv_key) {
-    CHECK(!pswd_.empty() && !cert_.empty() && !priv_key_.empty());
-
-    state_ = State::Ready;
-}
-
-PairingClientImpl::~PairingClientImpl() {
-    // Make sure to kill the PairingConnection before terminating the fdevent
-    // looper.
-    if (connection_ != nullptr) {
-        connection_.reset();
-    }
-}
-
-bool PairingClientImpl::Start(std::string_view ip_addr, pairing_client_result_cb cb, void* opaque) {
-    CHECK(!ip_addr.empty());
-    cb_ = cb;
-    opaque_ = opaque;
-
-    if (state_ != State::Ready) {
-        LOG(ERROR) << "PairingClient already running or finished";
-        return false;
-    }
-
-    // Try to parse the host address
-    std::string err;
-    CHECK(android::base::ParseNetAddress(std::string(ip_addr), &host_, &port_, nullptr, &err));
-    CHECK(port_ > 0 && port_ <= 65535);
-
-    if (!StartConnection()) {
-        LOG(ERROR) << "Unable to start PairingClient connection";
-        state_ = State::Stopped;
-        return false;
-    }
-
-    state_ = State::Running;
-    return true;
-}
-
-bool PairingClientImpl::StartConnection() {
-    std::string err;
-    const int timeout = 10;  // seconds
-    unique_fd fd(network_connect(host_, port_, SOCK_STREAM, timeout, &err));
-    if (fd.get() == -1) {
-        LOG(ERROR) << "Failed to start pairing connection client [" << err << "]";
-        return false;
-    }
-    int off = 1;
-    adb_setsockopt(fd.get(), IPPROTO_TCP, TCP_NODELAY, &off, sizeof(off));
-
-    connection_ = ConnectionPtr(
-            pairing_connection_client_new(pswd_.data(), pswd_.size(), &peer_info_, cert_.data(),
-                                          cert_.size(), priv_key_.data(), priv_key_.size()));
-    CHECK(connection_);
-
-#ifdef _WIN32
-    int osh = cast_handle_to_int(adb_get_os_handle(fd.release()));
-#else
-    int osh = adb_get_os_handle(fd.release());
-#endif
-    if (!pairing_connection_start(connection_.get(), osh, OnPairingResult, this)) {
-        LOG(ERROR) << "PairingClient failed to start the PairingConnection";
-        state_ = State::Stopped;
-        return false;
-    }
-
-    return true;
-}
-
-// static
-void PairingClientImpl::OnPairingResult(const PeerInfo* peer_info, int /* fd */, void* opaque) {
-    auto* p = reinterpret_cast<PairingClientImpl*>(opaque);
-    p->cb_(peer_info, p->opaque_);
-}
-
-}  // namespace
-
-// static
-std::unique_ptr<PairingClient> PairingClient::Create(const Data& pswd, const PeerInfo& peer_info,
-                                                     const Data& cert, const Data& priv_key) {
-    CHECK(!pswd.empty());
-    CHECK(!cert.empty());
-    CHECK(!priv_key.empty());
-
-    return std::unique_ptr<PairingClient>(new PairingClientImpl(pswd, peer_info, cert, priv_key));
-}
-
-}  // namespace pairing
-}  // namespace adbwifi
diff --git a/adb/client/pairing/pairing_client.h b/adb/client/pairing/pairing_client.h
deleted file mode 100644
index dbd72a5..0000000
--- a/adb/client/pairing/pairing_client.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <functional>
-#include <memory>
-#include <string_view>
-#include <vector>
-
-#include "adb/pairing/pairing_connection.h"
-
-namespace adbwifi {
-namespace pairing {
-
-typedef void (*pairing_client_result_cb)(const PeerInfo*, void*);
-
-// PairingClient is the client side of the PairingConnection protocol. It will
-// attempt to connect to a PairingServer specified at |host| and |port|, and
-// allocate a new PairingConnection for processing.
-//
-// See pairing_connection_test.cpp for example usage.
-//
-class PairingClient {
-  public:
-    using Data = std::vector<uint8_t>;
-
-    virtual ~PairingClient() = default;
-
-    // Starts the pairing client. This call is non-blocking. Upon completion,
-    // if the pairing was successful, then |cb| will be called with the PeerInfo
-    // containing the info of the trusted peer. Otherwise, |cb| will be
-    // called with an empty value. Start can only be called once in the lifetime
-    // of this object.
-    //
-    // Returns true if PairingClient was successfully started. Otherwise,
-    // returns false.
-    virtual bool Start(std::string_view ip_addr, pairing_client_result_cb cb, void* opaque) = 0;
-
-    // Creates a new PairingClient instance. May return null if unable
-    // to create an instance. |pswd|, |certificate|, |priv_key| and
-    // |ip_addr| cannot be empty. |peer_info| must contain non-empty strings for
-    // the guid and name fields.
-    static std::unique_ptr<PairingClient> Create(const Data& pswd, const PeerInfo& peer_info,
-                                                 const Data& certificate, const Data& priv_key);
-
-  protected:
-    PairingClient() = default;
-};  // class PairingClient
-
-}  // namespace pairing
-}  // namespace adbwifi
diff --git a/adb/client/pairing/tests/pairing_connection_test.cpp b/adb/client/pairing/tests/pairing_connection_test.cpp
deleted file mode 100644
index c69c1c2..0000000
--- a/adb/client/pairing/tests/pairing_connection_test.cpp
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-#define LOG_TAG "AdbWifiPairingConnectionTest"
-
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-#include <adbwifi/pairing/pairing_server.h>
-#include <android-base/logging.h>
-#include <gtest/gtest.h>
-
-#include "adb/client/pairing/tests/pairing_client.h"
-
-namespace adbwifi {
-namespace pairing {
-
-static const std::string kTestServerCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIBljCCAT2gAwIBAgIBATAKBggqhkjOPQQDAjAzMQswCQYDVQQGEwJVUzEQMA4G\n"
-        "A1UECgwHQW5kcm9pZDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTE5MTEwNzAyMDkx\n"
-        "NVoXDTI5MTEwNDAyMDkxNVowMzELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJv\n"
-        "aWQxEjAQBgNVBAMMCWxvY2FsaG9zdDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\n"
-        "BCXRovy3RhtK0Khle48vUmkcuI0OF7K8o9sVPE4oVnp24l+cCYr3BtrgifoHPgj4\n"
-        "vq7n105qzK7ngBHH+LBmYIijQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/\n"
-        "BAQDAgGGMB0GA1UdDgQWBBQi4eskzqVG3SCX2CwJF/aTZqUcuTAKBggqhkjOPQQD\n"
-        "AgNHADBEAiBPYvLOCIvPDtq3vMF7A2z7t7JfcCmbC7g8ftEVJucJBwIgepf+XjTb\n"
-        "L7RCE16p7iVkpHUrWAOl7zDxqD+jaji5MkQ=\n"
-        "-----END CERTIFICATE-----\n";
-
-static const std::string kTestServerPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgSCaskWPtutIgh8uQ\n"
-        "UBH6ZIea5Kxm7m6kkGNkd8FYPSOhRANCAAQl0aL8t0YbStCoZXuPL1JpHLiNDhey\n"
-        "vKPbFTxOKFZ6duJfnAmK9wba4In6Bz4I+L6u59dOasyu54ARx/iwZmCI\n"
-        "-----END PRIVATE KEY-----\n";
-
-static const std::string kTestClientCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIBlzCCAT2gAwIBAgIBATAKBggqhkjOPQQDAjAzMQswCQYDVQQGEwJVUzEQMA4G\n"
-        "A1UECgwHQW5kcm9pZDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTE5MTEwOTAxNTAy\n"
-        "OFoXDTI5MTEwNjAxNTAyOFowMzELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJv\n"
-        "aWQxEjAQBgNVBAMMCWxvY2FsaG9zdDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\n"
-        "BGW+RuoEIzbt42zAuZzbXaC0bvh8n4OLFDnqkkW6kWA43GYg/mUMVc9vg/nuxyuM\n"
-        "aT0KqbTaLhm+NjCXVRnxBrajQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/\n"
-        "BAQDAgGGMB0GA1UdDgQWBBTjCaC8/NXgdBz9WlMVCNwhx7jn0jAKBggqhkjOPQQD\n"
-        "AgNIADBFAiB/xp2boj7b1KK2saS6BL59deo/TvfgZ+u8HPq4k4VP3gIhAMXswp9W\n"
-        "XdlziccQdj+0KpbUojDKeHOr4fIj/+LxsWPa\n"
-        "-----END CERTIFICATE-----\n";
-
-static const std::string kTestClientPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgFw/CWY1f6TSB70AF\n"
-        "yVe8n6QdYFu8HW5t/tij2SrXx42hRANCAARlvkbqBCM27eNswLmc212gtG74fJ+D\n"
-        "ixQ56pJFupFgONxmIP5lDFXPb4P57scrjGk9Cqm02i4ZvjYwl1UZ8Qa2\n"
-        "-----END PRIVATE KEY-----\n";
-
-class AdbWifiPairingConnectionTest : public testing::Test {
-  protected:
-    virtual void SetUp() override {}
-
-    virtual void TearDown() override {}
-
-    void initPairing(const std::vector<uint8_t> server_pswd,
-                     const std::vector<uint8_t> client_pswd) {
-        std::vector<uint8_t> cert;
-        std::vector<uint8_t> key;
-        // Include the null-byte as well.
-        cert.assign(reinterpret_cast<const uint8_t*>(kTestServerCert.data()),
-                    reinterpret_cast<const uint8_t*>(kTestServerCert.data()) +
-                            kTestServerCert.size() + 1);
-        key.assign(reinterpret_cast<const uint8_t*>(kTestServerPrivKey.data()),
-                   reinterpret_cast<const uint8_t*>(kTestServerPrivKey.data()) +
-                           kTestServerPrivKey.size() + 1);
-        server_ = PairingServer::create(server_pswd, server_info_, cert, key, kDefaultPairingPort);
-        cert.assign(reinterpret_cast<const uint8_t*>(kTestClientCert.data()),
-                    reinterpret_cast<const uint8_t*>(kTestClientCert.data()) +
-                            kTestClientCert.size() + 1);
-        key.assign(reinterpret_cast<const uint8_t*>(kTestClientPrivKey.data()),
-                   reinterpret_cast<const uint8_t*>(kTestClientPrivKey.data()) +
-                           kTestClientPrivKey.size() + 1);
-        client_ = PairingClient::create(client_pswd, client_info_, cert, key, "127.0.0.1");
-    }
-
-    std::unique_ptr<PairingServer> createServer(const std::vector<uint8_t> pswd) {
-        std::vector<uint8_t> cert;
-        std::vector<uint8_t> key;
-        // Include the null-byte as well.
-        cert.assign(reinterpret_cast<const uint8_t*>(kTestServerCert.data()),
-                    reinterpret_cast<const uint8_t*>(kTestServerCert.data()) +
-                            kTestServerCert.size() + 1);
-        key.assign(reinterpret_cast<const uint8_t*>(kTestServerPrivKey.data()),
-                   reinterpret_cast<const uint8_t*>(kTestServerPrivKey.data()) +
-                           kTestServerPrivKey.size() + 1);
-        return PairingServer::create(pswd, server_info_, cert, key, kDefaultPairingPort);
-    }
-
-    std::unique_ptr<PairingClient> createClient(const std::vector<uint8_t> pswd) {
-        std::vector<uint8_t> cert;
-        std::vector<uint8_t> key;
-        // Include the null-byte as well.
-        cert.assign(reinterpret_cast<const uint8_t*>(kTestClientCert.data()),
-                    reinterpret_cast<const uint8_t*>(kTestClientCert.data()) +
-                            kTestClientCert.size() + 1);
-        key.assign(reinterpret_cast<const uint8_t*>(kTestClientPrivKey.data()),
-                   reinterpret_cast<const uint8_t*>(kTestClientPrivKey.data()) +
-                           kTestClientPrivKey.size() + 1);
-        return PairingClient::create(pswd, client_info_, cert, key, "127.0.0.1");
-    }
-
-    std::unique_ptr<PairingServer> server_;
-    const PeerInfo server_info_ = {
-            .name = "my_server_name",
-            .guid = "my_server_guid",
-    };
-    std::unique_ptr<PairingClient> client_;
-    const PeerInfo client_info_ = {
-            .name = "my_client_name",
-            .guid = "my_client_guid",
-    };
-};
-
-TEST_F(AdbWifiPairingConnectionTest, ServerCreation) {
-    // All parameters bad
-    auto server = PairingServer::create({}, {}, {}, {}, -1);
-    EXPECT_EQ(nullptr, server);
-    // Bad password
-    server = PairingServer::create({}, server_info_, {0x01}, {0x01}, -1);
-    EXPECT_EQ(nullptr, server);
-    // Bad peer_info
-    server = PairingServer::create({0x01}, {}, {0x01}, {0x01}, -1);
-    EXPECT_EQ(nullptr, server);
-    // Bad certificate
-    server = PairingServer::create({0x01}, server_info_, {}, {0x01}, -1);
-    EXPECT_EQ(nullptr, server);
-    // Bad private key
-    server = PairingServer::create({0x01}, server_info_, {0x01}, {}, -1);
-    EXPECT_EQ(nullptr, server);
-    // Bad port
-    server = PairingServer::create({0x01}, server_info_, {0x01}, {0x01}, -1);
-    EXPECT_EQ(nullptr, server);
-    // Valid params
-    server = PairingServer::create({0x01}, server_info_, {0x01}, {0x01}, 7776);
-    EXPECT_NE(nullptr, server);
-}
-
-TEST_F(AdbWifiPairingConnectionTest, ClientCreation) {
-    // All parameters bad
-    auto client = PairingClient::create({}, client_info_, {}, {}, "");
-    EXPECT_EQ(nullptr, client);
-    // Bad password
-    client = PairingClient::create({}, client_info_, {0x01}, {0x01}, "127.0.0.1");
-    EXPECT_EQ(nullptr, client);
-    // Bad peer_info
-    client = PairingClient::create({0x01}, {}, {0x01}, {0x01}, "127.0.0.1");
-    EXPECT_EQ(nullptr, client);
-    // Bad certificate
-    client = PairingClient::create({0x01}, client_info_, {}, {0x01}, "127.0.0.1");
-    EXPECT_EQ(nullptr, client);
-    // Bad private key
-    client = PairingClient::create({0x01}, client_info_, {0x01}, {}, "127.0.0.1");
-    EXPECT_EQ(nullptr, client);
-    // Bad ip address
-    client = PairingClient::create({0x01}, client_info_, {0x01}, {0x01}, "");
-    EXPECT_EQ(nullptr, client);
-    // Valid params
-    client = PairingClient::create({0x01}, client_info_, {0x01}, {0x01}, "127.0.0.1");
-    EXPECT_NE(nullptr, client);
-}
-
-TEST_F(AdbWifiPairingConnectionTest, SmokeValidPairing) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    initPairing(pswd, pswd);
-
-    // Start the server first, to open the port for connections
-    std::mutex server_mutex;
-    std::condition_variable server_cv;
-    std::unique_lock<std::mutex> server_lock(server_mutex);
-
-    auto server_callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                               void* opaque) {
-        ASSERT_NE(nullptr, peer_info);
-        ASSERT_NE(nullptr, cert);
-        EXPECT_FALSE(cert->empty());
-        EXPECT_EQ(nullptr, opaque);
-
-        // Verify the peer_info and cert
-        ASSERT_EQ(strlen(peer_info->name), strlen(client_info_.name));
-        EXPECT_EQ(::memcmp(peer_info->name, client_info_.name, strlen(client_info_.name)), 0);
-        ASSERT_EQ(strlen(peer_info->guid), strlen(client_info_.guid));
-        EXPECT_EQ(::memcmp(peer_info->guid, client_info_.guid, strlen(client_info_.guid)), 0);
-        ASSERT_EQ(cert->size(), kTestClientCert.size() + 1);
-        EXPECT_EQ(::memcmp(cert->data(), kTestClientCert.data(), kTestClientCert.size() + 1), 0);
-
-        std::lock_guard<std::mutex> lock(server_mutex);
-        server_cv.notify_one();
-    };
-    ASSERT_TRUE(server_->start(server_callback, nullptr));
-
-    // Start the client
-    bool got_valid_pairing = false;
-    std::mutex client_mutex;
-    std::condition_variable client_cv;
-    std::unique_lock<std::mutex> client_lock(client_mutex);
-    auto client_callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                               void* opaque) {
-        ASSERT_NE(nullptr, peer_info);
-        ASSERT_NE(nullptr, cert);
-        EXPECT_FALSE(cert->empty());
-        EXPECT_EQ(nullptr, opaque);
-
-        // Verify the peer_info and cert
-        ASSERT_EQ(strlen(peer_info->name), strlen(server_info_.name));
-        EXPECT_EQ(::memcmp(peer_info->name, server_info_.name, strlen(server_info_.name)), 0);
-        ASSERT_EQ(strlen(peer_info->guid), strlen(server_info_.guid));
-        EXPECT_EQ(::memcmp(peer_info->guid, server_info_.guid, strlen(server_info_.guid)), 0);
-        ASSERT_EQ(cert->size(), kTestServerCert.size() + 1);
-        EXPECT_EQ(::memcmp(cert->data(), kTestServerCert.data(), kTestServerCert.size() + 1), 0);
-
-        got_valid_pairing = (peer_info != nullptr && cert != nullptr && !cert->empty());
-        std::lock_guard<std::mutex> lock(client_mutex);
-        client_cv.notify_one();
-    };
-    ASSERT_TRUE(client_->start(client_callback, nullptr));
-    client_cv.wait(client_lock);
-
-    // Kill server if the pairing failed, since server only shuts down when
-    // it gets a valid pairing.
-    if (!got_valid_pairing) {
-        server_lock.unlock();
-        server_.reset();
-    } else {
-        server_cv.wait(server_lock);
-    }
-}
-
-TEST_F(AdbWifiPairingConnectionTest, CancelPairing) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    std::vector<uint8_t> pswd2{0x01, 0x03, 0x05, 0x06};
-    initPairing(pswd, pswd2);
-
-    // Start the server first, to open the port for connections
-    std::mutex server_mutex;
-    std::condition_variable server_cv;
-    std::unique_lock<std::mutex> server_lock(server_mutex);
-
-    bool server_got_valid_pairing = true;
-    auto server_callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                               void* opaque) {
-        // Pairing will be cancelled, which should initiate this callback with
-        // empty values.
-        ASSERT_EQ(nullptr, peer_info);
-        ASSERT_EQ(nullptr, cert);
-        EXPECT_EQ(nullptr, opaque);
-        std::lock_guard<std::mutex> lock(server_mutex);
-        server_cv.notify_one();
-        server_got_valid_pairing = false;
-    };
-    ASSERT_TRUE(server_->start(server_callback, nullptr));
-
-    // Start the client (should fail because of different passwords).
-    bool got_valid_pairing = false;
-    std::mutex client_mutex;
-    std::condition_variable client_cv;
-    std::unique_lock<std::mutex> client_lock(client_mutex);
-    auto client_callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                               void* opaque) {
-        ASSERT_EQ(nullptr, peer_info);
-        ASSERT_EQ(nullptr, cert);
-        EXPECT_EQ(nullptr, opaque);
-
-        got_valid_pairing = (peer_info != nullptr && cert != nullptr && !cert->empty());
-        std::lock_guard<std::mutex> lock(client_mutex);
-        client_cv.notify_one();
-    };
-    ASSERT_TRUE(client_->start(client_callback, nullptr));
-    client_cv.wait(client_lock);
-
-    server_lock.unlock();
-    // This should trigger the callback to be on the same thread.
-    server_.reset();
-    EXPECT_FALSE(server_got_valid_pairing);
-}
-
-TEST_F(AdbWifiPairingConnectionTest, MultipleClientsAllFail) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    std::vector<uint8_t> pswd2{0x01, 0x03, 0x05, 0x06};
-
-    auto server = createServer(pswd);
-    ASSERT_NE(nullptr, server);
-    // Start the server first, to open the port for connections
-    std::mutex server_mutex;
-    std::condition_variable server_cv;
-    std::unique_lock<std::mutex> server_lock(server_mutex);
-
-    bool server_got_valid_pairing = true;
-    auto server_callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                               void* opaque) {
-        // Pairing will be cancelled, which should initiate this callback with
-        // empty values.
-        ASSERT_EQ(nullptr, peer_info);
-        ASSERT_EQ(nullptr, cert);
-        EXPECT_EQ(nullptr, opaque);
-        std::lock_guard<std::mutex> lock(server_mutex);
-        server_cv.notify_one();
-        server_got_valid_pairing = false;
-    };
-    ASSERT_TRUE(server->start(server_callback, nullptr));
-
-    // Start multiple clients, all with bad passwords
-    std::vector<std::unique_ptr<PairingClient>> clients;
-    int num_clients_done = 0;
-    int test_num_clients = 5;
-    std::mutex client_mutex;
-    std::condition_variable client_cv;
-    std::unique_lock<std::mutex> client_lock(client_mutex);
-    while (clients.size() < test_num_clients) {
-        auto client = createClient(pswd2);
-        ASSERT_NE(nullptr, client);
-        auto callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                            void* opaque) {
-            ASSERT_EQ(nullptr, peer_info);
-            ASSERT_EQ(nullptr, cert);
-            EXPECT_EQ(nullptr, opaque);
-
-            {
-                std::lock_guard<std::mutex> lock(client_mutex);
-                num_clients_done++;
-            }
-            client_cv.notify_one();
-        };
-        ASSERT_TRUE(client->start(callback, nullptr));
-        clients.push_back(std::move(client));
-    }
-
-    client_cv.wait(client_lock, [&]() { return (num_clients_done == test_num_clients); });
-    EXPECT_EQ(num_clients_done, test_num_clients);
-
-    server_lock.unlock();
-    // This should trigger the callback to be on the same thread.
-    server.reset();
-    EXPECT_FALSE(server_got_valid_pairing);
-}
-
-TEST_F(AdbWifiPairingConnectionTest, MultipleClientsOnePass) {
-    // Send multiple clients with bad passwords, but send the last one with the
-    // correct password.
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    std::vector<uint8_t> pswd2{0x01, 0x03, 0x05, 0x06};
-
-    auto server = createServer(pswd);
-    ASSERT_NE(nullptr, server);
-    // Start the server first, to open the port for connections
-    std::mutex server_mutex;
-    std::condition_variable server_cv;
-    std::unique_lock<std::mutex> server_lock(server_mutex);
-
-    bool server_got_valid_pairing = false;
-    auto server_callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                               void* opaque) {
-        // Pairing will be cancelled, which should initiate this callback with
-        // empty values.
-
-        ASSERT_NE(nullptr, peer_info);
-        ASSERT_NE(nullptr, cert);
-        EXPECT_FALSE(cert->empty());
-        EXPECT_EQ(nullptr, opaque);
-
-        // Verify the peer_info and cert
-        ASSERT_EQ(strlen(peer_info->name), strlen(client_info_.name));
-        EXPECT_EQ(::memcmp(peer_info->name, client_info_.name, strlen(client_info_.name)), 0);
-        ASSERT_EQ(strlen(peer_info->guid), strlen(client_info_.guid));
-        EXPECT_EQ(::memcmp(peer_info->guid, client_info_.guid, strlen(client_info_.guid)), 0);
-        ASSERT_EQ(cert->size(), kTestClientCert.size() + 1);
-        EXPECT_EQ(::memcmp(cert->data(), kTestClientCert.data(), kTestClientCert.size() + 1), 0);
-
-        std::lock_guard<std::mutex> lock(server_mutex);
-        server_got_valid_pairing = true;
-        server_cv.notify_one();
-    };
-    ASSERT_TRUE(server->start(server_callback, nullptr));
-
-    // Start multiple clients, all with bad passwords (except for the last one)
-    std::vector<std::unique_ptr<PairingClient>> clients;
-    int num_clients_done = 0;
-    int test_num_clients = 5;
-    std::mutex client_mutex;
-    std::condition_variable client_cv;
-    std::unique_lock<std::mutex> client_lock(client_mutex);
-    bool got_valid_pairing = false;
-    while (clients.size() < test_num_clients) {
-        std::unique_ptr<PairingClient> client;
-        if (clients.size() == test_num_clients - 1) {
-            // Make this one have the valid password
-            client = createClient(pswd);
-            ASSERT_NE(nullptr, client);
-            auto callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                                void* opaque) {
-                ASSERT_NE(nullptr, peer_info);
-                ASSERT_NE(nullptr, cert);
-                EXPECT_FALSE(cert->empty());
-                EXPECT_EQ(nullptr, opaque);
-
-                // Verify the peer_info and cert
-                ASSERT_EQ(strlen(peer_info->name), strlen(server_info_.name));
-                EXPECT_EQ(::memcmp(peer_info->name, server_info_.name, strlen(server_info_.name)),
-                          0);
-                ASSERT_EQ(strlen(peer_info->guid), strlen(server_info_.guid));
-                EXPECT_EQ(::memcmp(peer_info->guid, server_info_.guid, strlen(server_info_.guid)),
-                          0);
-                ASSERT_EQ(cert->size(), kTestServerCert.size() + 1);
-                EXPECT_EQ(
-                        ::memcmp(cert->data(), kTestServerCert.data(), kTestServerCert.size() + 1),
-                        0);
-                got_valid_pairing = (peer_info != nullptr && cert != nullptr && !cert->empty());
-
-                {
-                    std::lock_guard<std::mutex> lock(client_mutex);
-                    num_clients_done++;
-                }
-                client_cv.notify_one();
-            };
-            ASSERT_TRUE(client->start(callback, nullptr));
-        } else {
-            client = createClient(pswd2);
-            ASSERT_NE(nullptr, client);
-            auto callback = [&](const PeerInfo* peer_info, const std::vector<uint8_t>* cert,
-                                void* opaque) {
-                ASSERT_EQ(nullptr, peer_info);
-                ASSERT_EQ(nullptr, cert);
-                EXPECT_EQ(nullptr, opaque);
-
-                {
-                    std::lock_guard<std::mutex> lock(client_mutex);
-                    num_clients_done++;
-                }
-                client_cv.notify_one();
-            };
-            ASSERT_TRUE(client->start(callback, nullptr));
-        }
-        clients.push_back(std::move(client));
-    }
-
-    client_cv.wait(client_lock, [&]() { return (num_clients_done == test_num_clients); });
-    EXPECT_EQ(num_clients_done, test_num_clients);
-
-    // Kill server if the pairing failed, since server only shuts down when
-    // it gets a valid pairing.
-    if (!got_valid_pairing) {
-        server_lock.unlock();
-        server_.reset();
-    } else {
-        server_cv.wait(server_lock);
-    }
-    EXPECT_TRUE(server_got_valid_pairing);
-}
-
-}  // namespace pairing
-}  // namespace adbwifi
diff --git a/adb/client/pairing/tests/pairing_server.cpp b/adb/client/pairing/tests/pairing_server.cpp
deleted file mode 100644
index 9201e7a..0000000
--- a/adb/client/pairing/tests/pairing_server.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adbwifi/pairing/pairing_server.h"
-
-#include <sys/epoll.h>
-#include <sys/eventfd.h>
-
-#include <atomic>
-#include <deque>
-#include <iomanip>
-#include <mutex>
-#include <sstream>
-#include <thread>
-#include <tuple>
-#include <unordered_map>
-#include <variant>
-#include <vector>
-
-#include <adbwifi/pairing/pairing_connection.h>
-#include <android-base/logging.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/thread_annotations.h>
-#include <android-base/unique_fd.h>
-#include <cutils/sockets.h>
-
-namespace adbwifi {
-namespace pairing {
-
-using android::base::ScopedLockAssertion;
-using android::base::unique_fd;
-
-namespace {
-
-// The implimentation has two background threads running: one to handle and
-// accept any new pairing connection requests (socket accept), and the other to
-// handle connection events (connection started, connection finished).
-class PairingServerImpl : public PairingServer {
-  public:
-    virtual ~PairingServerImpl();
-
-    // All parameters must be non-empty.
-    explicit PairingServerImpl(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                               const Data& priv_key, int port);
-
-    // Starts the pairing server. This call is non-blocking. Upon completion,
-    // if the pairing was successful, then |cb| will be called with the PublicKeyHeader
-    // containing the info of the trusted peer. Otherwise, |cb| will be
-    // called with an empty value. Start can only be called once in the lifetime
-    // of this object.
-    //
-    // Returns true if PairingServer was successfully started. Otherwise,
-    // returns false.
-    virtual bool start(PairingConnection::ResultCallback cb, void* opaque) override;
-
-  private:
-    // Setup the server socket to accept incoming connections
-    bool setupServer();
-    // Force stop the server thread.
-    void stopServer();
-
-    // handles a new pairing client connection
-    bool handleNewClientConnection(int fd) EXCLUDES(conn_mutex_);
-
-    // ======== connection events thread =============
-    std::mutex conn_mutex_;
-    std::condition_variable conn_cv_;
-
-    using FdVal = int;
-    using ConnectionPtr = std::unique_ptr<PairingConnection>;
-    using NewConnectionEvent = std::tuple<unique_fd, ConnectionPtr>;
-    // <fd, PeerInfo.name, PeerInfo.guid, certificate>
-    using ConnectionFinishedEvent = std::tuple<FdVal, std::optional<std::string>,
-                                               std::optional<std::string>, std::optional<Data>>;
-    using ConnectionEvent = std::variant<NewConnectionEvent, ConnectionFinishedEvent>;
-    // Queue for connections to write into. We have a separate queue to read
-    // from, in order to minimize the time the server thread is blocked.
-    std::deque<ConnectionEvent> conn_write_queue_ GUARDED_BY(conn_mutex_);
-    std::deque<ConnectionEvent> conn_read_queue_;
-    // Map of fds to their PairingConnections currently running.
-    std::unordered_map<FdVal, ConnectionPtr> connections_;
-
-    // Two threads launched when starting the pairing server:
-    // 1) A server thread that waits for incoming client connections, and
-    // 2) A connection events thread that synchonizes events from all of the
-    //    clients, since each PairingConnection is running in it's own thread.
-    void startConnectionEventsThread();
-    void startServerThread();
-
-    std::thread conn_events_thread_;
-    void connectionEventsWorker();
-    std::thread server_thread_;
-    void serverWorker();
-    bool is_terminate_ GUARDED_BY(conn_mutex_) = false;
-
-    enum class State {
-        Ready,
-        Running,
-        Stopped,
-    };
-    State state_ = State::Ready;
-    Data pswd_;
-    PeerInfo peer_info_;
-    Data cert_;
-    Data priv_key_;
-    int port_ = -1;
-
-    PairingConnection::ResultCallback cb_;
-    void* opaque_ = nullptr;
-    bool got_valid_pairing_ = false;
-
-    static const int kEpollConstSocket = 0;
-    // Used to break the server thread from epoll_wait
-    static const int kEpollConstEventFd = 1;
-    unique_fd epoll_fd_;
-    unique_fd server_fd_;
-    unique_fd event_fd_;
-};  // PairingServerImpl
-
-PairingServerImpl::PairingServerImpl(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                                     const Data& priv_key, int port)
-    : pswd_(pswd), peer_info_(peer_info), cert_(cert), priv_key_(priv_key), port_(port) {
-    CHECK(!pswd_.empty() && !cert_.empty() && !priv_key_.empty() && port_ > 0);
-    CHECK('\0' == peer_info.name[kPeerNameLength - 1] &&
-          '\0' == peer_info.guid[kPeerGuidLength - 1] && strlen(peer_info.name) > 0 &&
-          strlen(peer_info.guid) > 0);
-}
-
-PairingServerImpl::~PairingServerImpl() {
-    // Since these connections have references to us, let's make sure they
-    // destruct before us.
-    if (server_thread_.joinable()) {
-        stopServer();
-        server_thread_.join();
-    }
-
-    {
-        std::lock_guard<std::mutex> lock(conn_mutex_);
-        is_terminate_ = true;
-    }
-    conn_cv_.notify_one();
-    if (conn_events_thread_.joinable()) {
-        conn_events_thread_.join();
-    }
-
-    // Notify the cb_ if it hasn't already.
-    if (!got_valid_pairing_ && cb_ != nullptr) {
-        cb_(nullptr, nullptr, opaque_);
-    }
-}
-
-bool PairingServerImpl::start(PairingConnection::ResultCallback cb, void* opaque) {
-    cb_ = cb;
-    opaque_ = opaque;
-
-    if (state_ != State::Ready) {
-        LOG(ERROR) << "PairingServer already running or stopped";
-        return false;
-    }
-
-    if (!setupServer()) {
-        LOG(ERROR) << "Unable to start PairingServer";
-        state_ = State::Stopped;
-        return false;
-    }
-
-    state_ = State::Running;
-    return true;
-}
-
-void PairingServerImpl::stopServer() {
-    if (event_fd_.get() == -1) {
-        return;
-    }
-    uint64_t value = 1;
-    ssize_t rc = write(event_fd_.get(), &value, sizeof(value));
-    if (rc == -1) {
-        // This can happen if the server didn't start.
-        PLOG(ERROR) << "write to eventfd failed";
-    } else if (rc != sizeof(value)) {
-        LOG(FATAL) << "write to event returned short (" << rc << ")";
-    }
-}
-
-bool PairingServerImpl::setupServer() {
-    epoll_fd_.reset(epoll_create1(EPOLL_CLOEXEC));
-    if (epoll_fd_ == -1) {
-        PLOG(ERROR) << "failed to create epoll fd";
-        return false;
-    }
-
-    event_fd_.reset(eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK));
-    if (event_fd_ == -1) {
-        PLOG(ERROR) << "failed to create eventfd";
-        return false;
-    }
-
-    server_fd_.reset(socket_inaddr_any_server(port_, SOCK_STREAM));
-    if (server_fd_.get() == -1) {
-        PLOG(ERROR) << "Failed to start pairing connection server";
-        return false;
-    } else if (fcntl(server_fd_.get(), F_SETFD, FD_CLOEXEC) != 0) {
-        PLOG(ERROR) << "Failed to make server socket cloexec";
-        return false;
-    } else if (fcntl(server_fd_.get(), F_SETFD, O_NONBLOCK) != 0) {
-        PLOG(ERROR) << "Failed to make server socket nonblocking";
-        return false;
-    }
-
-    startConnectionEventsThread();
-    startServerThread();
-    return true;
-}
-
-void PairingServerImpl::startServerThread() {
-    server_thread_ = std::thread([this]() { serverWorker(); });
-}
-
-void PairingServerImpl::startConnectionEventsThread() {
-    conn_events_thread_ = std::thread([this]() { connectionEventsWorker(); });
-}
-
-void PairingServerImpl::serverWorker() {
-    {
-        struct epoll_event event;
-        event.events = EPOLLIN;
-        event.data.u64 = kEpollConstSocket;
-        CHECK_EQ(0, epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, server_fd_.get(), &event));
-    }
-
-    {
-        struct epoll_event event;
-        event.events = EPOLLIN;
-        event.data.u64 = kEpollConstEventFd;
-        CHECK_EQ(0, epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, event_fd_.get(), &event));
-    }
-
-    while (true) {
-        struct epoll_event events[2];
-        int rc = TEMP_FAILURE_RETRY(epoll_wait(epoll_fd_.get(), events, 2, -1));
-        if (rc == -1) {
-            PLOG(ERROR) << "epoll_wait failed";
-            return;
-        } else if (rc == 0) {
-            LOG(ERROR) << "epoll_wait returned 0";
-            return;
-        }
-
-        for (int i = 0; i < rc; ++i) {
-            struct epoll_event& event = events[i];
-            switch (event.data.u64) {
-                case kEpollConstSocket:
-                    handleNewClientConnection(server_fd_.get());
-                    break;
-                case kEpollConstEventFd:
-                    uint64_t dummy;
-                    int rc = TEMP_FAILURE_RETRY(read(event_fd_.get(), &dummy, sizeof(dummy)));
-                    if (rc != sizeof(dummy)) {
-                        PLOG(FATAL) << "failed to read from eventfd (rc=" << rc << ")";
-                    }
-                    return;
-            }
-        }
-    }
-}
-
-void PairingServerImpl::connectionEventsWorker() {
-    for (;;) {
-        // Transfer the write queue to the read queue.
-        {
-            std::unique_lock<std::mutex> lock(conn_mutex_);
-            ScopedLockAssertion assume_locked(conn_mutex_);
-
-            if (is_terminate_) {
-                // We check |is_terminate_| twice because condition_variable's
-                // notify() only wakes up a thread if it is in the wait state
-                // prior to notify(). Furthermore, we aren't holding the mutex
-                // when processing the events in |conn_read_queue_|.
-                return;
-            }
-            if (conn_write_queue_.empty()) {
-                // We need to wait for new events, or the termination signal.
-                conn_cv_.wait(lock, [this]() REQUIRES(conn_mutex_) {
-                    return (is_terminate_ || !conn_write_queue_.empty());
-                });
-            }
-            if (is_terminate_) {
-                // We're done.
-                return;
-            }
-            // Move all events into the read queue.
-            conn_read_queue_ = std::move(conn_write_queue_);
-            conn_write_queue_.clear();
-        }
-
-        // Process all events in the read queue.
-        while (conn_read_queue_.size() > 0) {
-            auto& event = conn_read_queue_.front();
-            if (auto* p = std::get_if<NewConnectionEvent>(&event)) {
-                // Ignore if we are already at the max number of connections
-                if (connections_.size() >= internal::kMaxConnections) {
-                    conn_read_queue_.pop_front();
-                    continue;
-                }
-                auto [ufd, connection] = std::move(*p);
-                int fd = ufd.release();
-                bool started = connection->start(
-                        fd,
-                        [fd](const PeerInfo* peer_info, const Data* cert, void* opaque) {
-                            auto* p = reinterpret_cast<PairingServerImpl*>(opaque);
-
-                            ConnectionFinishedEvent event;
-                            if (peer_info != nullptr && cert != nullptr) {
-                                event = std::make_tuple(fd, std::string(peer_info->name),
-                                                        std::string(peer_info->guid), Data(*cert));
-                            } else {
-                                event = std::make_tuple(fd, std::nullopt, std::nullopt,
-                                                        std::nullopt);
-                            }
-                            {
-                                std::lock_guard<std::mutex> lock(p->conn_mutex_);
-                                p->conn_write_queue_.push_back(std::move(event));
-                            }
-                            p->conn_cv_.notify_one();
-                        },
-                        this);
-                if (!started) {
-                    LOG(ERROR) << "PairingServer unable to start a PairingConnection fd=" << fd;
-                    ufd.reset(fd);
-                } else {
-                    connections_[fd] = std::move(connection);
-                }
-            } else if (auto* p = std::get_if<ConnectionFinishedEvent>(&event)) {
-                auto [fd, name, guid, cert] = std::move(*p);
-                if (name.has_value() && guid.has_value() && cert.has_value() && !name->empty() &&
-                    !guid->empty() && !cert->empty()) {
-                    // Valid pairing. Let's shutdown the server and close any
-                    // pairing connections in progress.
-                    stopServer();
-                    connections_.clear();
-
-                    CHECK_LE(name->size(), kPeerNameLength);
-                    CHECK_LE(guid->size(), kPeerGuidLength);
-                    PeerInfo info = {};
-                    strncpy(info.name, name->data(), name->size());
-                    strncpy(info.guid, guid->data(), guid->size());
-
-                    cb_(&info, &*cert, opaque_);
-
-                    got_valid_pairing_ = true;
-                    return;
-                }
-                // Invalid pairing. Close the invalid connection.
-                if (connections_.find(fd) != connections_.end()) {
-                    connections_.erase(fd);
-                }
-            }
-            conn_read_queue_.pop_front();
-        }
-    }
-}
-
-bool PairingServerImpl::handleNewClientConnection(int fd) {
-    unique_fd ufd(TEMP_FAILURE_RETRY(accept4(fd, nullptr, nullptr, SOCK_CLOEXEC)));
-    if (ufd == -1) {
-        PLOG(WARNING) << "adb_socket_accept failed fd=" << fd;
-        return false;
-    }
-    auto connection = PairingConnection::create(PairingConnection::Role::Server, pswd_, peer_info_,
-                                                cert_, priv_key_);
-    if (connection == nullptr) {
-        LOG(ERROR) << "PairingServer unable to create a PairingConnection fd=" << fd;
-        return false;
-    }
-    // send the new connection to the connection thread for further processing
-    NewConnectionEvent event = std::make_tuple(std::move(ufd), std::move(connection));
-    {
-        std::lock_guard<std::mutex> lock(conn_mutex_);
-        conn_write_queue_.push_back(std::move(event));
-    }
-    conn_cv_.notify_one();
-
-    return true;
-}
-
-}  // namespace
-
-// static
-std::unique_ptr<PairingServer> PairingServer::create(const Data& pswd, const PeerInfo& peer_info,
-                                                     const Data& cert, const Data& priv_key,
-                                                     int port) {
-    if (pswd.empty() || cert.empty() || priv_key.empty() || port <= 0) {
-        return nullptr;
-    }
-    // Make sure peer_info has a non-empty, null-terminated string for guid and
-    // name.
-    if ('\0' != peer_info.name[kPeerNameLength - 1] ||
-        '\0' != peer_info.guid[kPeerGuidLength - 1] || strlen(peer_info.name) == 0 ||
-        strlen(peer_info.guid) == 0) {
-        LOG(ERROR) << "The GUID/short name fields are empty or not null-terminated";
-        return nullptr;
-    }
-
-    if (port != kDefaultPairingPort) {
-        LOG(WARNING) << "Starting server with non-default pairing port=" << port;
-    }
-
-    return std::unique_ptr<PairingServer>(
-            new PairingServerImpl(pswd, peer_info, cert, priv_key, port));
-}
-
-}  // namespace pairing
-}  // namespace adbwifi
diff --git a/adb/client/pairing/tests/pairing_server.h b/adb/client/pairing/tests/pairing_server.h
deleted file mode 100644
index 6fb51cc..0000000
--- a/adb/client/pairing/tests/pairing_server.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <functional>
-#include <memory>
-#include <string_view>
-#include <vector>
-
-#include <adbwifi/pairing/pairing_connection.h>
-
-namespace adbwifi {
-namespace pairing {
-
-// PairingServer is the server side of the PairingConnection protocol. It will
-// listen for incoming PairingClient connections, and allocate a new
-// PairingConnection per client for processing. PairingServer can handle multiple
-// connections, but the first one to establish the pairing will be the only one
-// to succeed. All others will be disconnected.
-//
-// See pairing_connection_test.cpp for example usage.
-//
-class PairingServer {
-  public:
-    using Data = std::vector<uint8_t>;
-
-    virtual ~PairingServer() = default;
-
-    // Starts the pairing server. This call is non-blocking. Upon completion,
-    // if the pairing was successful, then |cb| will be called with the PeerInfo
-    // containing the info of the trusted peer. Otherwise, |cb| will be
-    // called with an empty value. Start can only be called once in the lifetime
-    // of this object.
-    //
-    // Returns true if PairingServer was successfully started. Otherwise,
-    // returns false.
-    virtual bool start(PairingConnection::ResultCallback cb, void* opaque) = 0;
-
-    // Creates a new PairingServer instance. May return null if unable
-    // to create an instance. |pswd|, |certificate| and |priv_key| cannot
-    // be empty. |port| is the port PairingServer will listen to PairingClient
-    // connections on. |peer_info| must contain non-empty strings for the guid
-    // and name fields.
-    static std::unique_ptr<PairingServer> create(const Data& pswd, const PeerInfo& peer_info,
-                                                 const Data& certificate, const Data& priv_key,
-                                                 int port);
-
-  protected:
-    PairingServer() = default;
-};  // class PairingServer
-
-}  // namespace pairing
-}  // namespace adbwifi
diff --git a/adb/client/transport_mdns.cpp b/adb/client/transport_mdns.cpp
deleted file mode 100644
index 22b9b18..0000000
--- a/adb/client/transport_mdns.cpp
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#define TRACE_TAG TRANSPORT
-
-#include "transport.h"
-
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <arpa/inet.h>
-#endif
-
-#include <memory>
-#include <thread>
-#include <vector>
-
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <dns_sd.h>
-
-#include "adb_client.h"
-#include "adb_mdns.h"
-#include "adb_trace.h"
-#include "adb_utils.h"
-#include "adb_wifi.h"
-#include "fdevent/fdevent.h"
-#include "sysdeps.h"
-
-static DNSServiceRef service_refs[kNumADBDNSServices];
-static fdevent* service_ref_fdes[kNumADBDNSServices];
-
-static int adb_DNSServiceIndexByName(const char* regType) {
-    for (int i = 0; i < kNumADBDNSServices; ++i) {
-        if (!strncmp(regType, kADBDNSServices[i], strlen(kADBDNSServices[i]))) {
-            return i;
-        }
-    }
-    return -1;
-}
-
-static bool adb_DNSServiceShouldConnect(const char* regType, const char* serviceName) {
-    int index = adb_DNSServiceIndexByName(regType);
-    if (index == kADBTransportServiceRefIndex) {
-        // Ignore adb-EMULATOR* service names, as it interferes with the
-        // emulator ports that are already connected.
-        if (android::base::StartsWith(serviceName, "adb-EMULATOR")) {
-            LOG(INFO) << "Ignoring emulator transport service [" << serviceName << "]";
-            return false;
-        }
-    }
-    return (index == kADBTransportServiceRefIndex || index == kADBSecureConnectServiceRefIndex);
-}
-
-// Use adb_DNSServiceRefSockFD() instead of calling DNSServiceRefSockFD()
-// directly so that the socket is put through the appropriate compatibility
-// layers to work with the rest of ADB's internal APIs.
-static inline int adb_DNSServiceRefSockFD(DNSServiceRef ref) {
-    return adb_register_socket(DNSServiceRefSockFD(ref));
-}
-#define DNSServiceRefSockFD ___xxx_DNSServiceRefSockFD
-
-static void DNSSD_API register_service_ip(DNSServiceRef sdRef,
-                                          DNSServiceFlags flags,
-                                          uint32_t interfaceIndex,
-                                          DNSServiceErrorType errorCode,
-                                          const char* hostname,
-                                          const sockaddr* address,
-                                          uint32_t ttl,
-                                          void* context);
-
-static void pump_service_ref(int /*fd*/, unsigned ev, void* data) {
-    DNSServiceRef* ref = reinterpret_cast<DNSServiceRef*>(data);
-
-    if (ev & FDE_READ)
-        DNSServiceProcessResult(*ref);
-}
-
-class AsyncServiceRef {
-  public:
-    bool Initialized() {
-        return initialized_;
-    }
-
-    virtual ~AsyncServiceRef() {
-        if (!initialized_) {
-            return;
-        }
-
-        // Order matters here! Must destroy the fdevent first since it has a
-        // reference to |sdRef_|.
-        fdevent_destroy(fde_);
-        DNSServiceRefDeallocate(sdRef_);
-    }
-
-  protected:
-    DNSServiceRef sdRef_;
-
-    void Initialize() {
-        fde_ = fdevent_create(adb_DNSServiceRefSockFD(sdRef_), pump_service_ref, &sdRef_);
-        if (fde_ == nullptr) {
-            D("Unable to create fdevent");
-            return;
-        }
-        fdevent_set(fde_, FDE_READ);
-        initialized_ = true;
-    }
-
-  private:
-    bool initialized_ = false;
-    fdevent* fde_;
-};
-
-class ResolvedService : public AsyncServiceRef {
-  public:
-    virtual ~ResolvedService() = default;
-
-    ResolvedService(std::string serviceName, std::string regType, uint32_t interfaceIndex,
-                    const char* hosttarget, uint16_t port, int version)
-        : serviceName_(serviceName),
-          regType_(regType),
-          hosttarget_(hosttarget),
-          port_(port),
-          sa_family_(0),
-          ip_addr_data_(NULL),
-          serviceVersion_(version) {
-        memset(ip_addr_, 0, sizeof(ip_addr_));
-
-        /* TODO: We should be able to get IPv6 support by adding
-         * kDNSServiceProtocol_IPv6 to the flags below. However, when we do
-         * this, we get served link-local addresses that are usually useless to
-         * connect to. What's more, we seem to /only/ get those and nothing else.
-         * If we want IPv6 in the future we'll have to figure out why.
-         */
-        DNSServiceErrorType ret =
-            DNSServiceGetAddrInfo(
-                &sdRef_, 0, interfaceIndex,
-                kDNSServiceProtocol_IPv4, hosttarget,
-                register_service_ip, reinterpret_cast<void*>(this));
-
-        if (ret != kDNSServiceErr_NoError) {
-            D("Got %d from DNSServiceGetAddrInfo.", ret);
-        } else {
-            Initialize();
-        }
-
-        D("Client version: %d Service version: %d\n", clientVersion_, serviceVersion_);
-    }
-
-    bool ConnectSecureWifiDevice() {
-        if (!adb_wifi_is_known_host(serviceName_)) {
-            LOG(INFO) << "serviceName=" << serviceName_ << " not in keystore";
-            return false;
-        }
-
-        std::string response;
-        connect_device(android::base::StringPrintf(addr_format_.c_str(), ip_addr_, port_),
-                       &response);
-        D("Secure connect to %s regtype %s (%s:%hu) : %s", serviceName_.c_str(), regType_.c_str(),
-          ip_addr_, port_, response.c_str());
-        return true;
-    }
-
-    void Connect(const sockaddr* address) {
-        sa_family_ = address->sa_family;
-
-        if (sa_family_ == AF_INET) {
-            ip_addr_data_ = &reinterpret_cast<const sockaddr_in*>(address)->sin_addr;
-            addr_format_ = "%s:%hu";
-        } else if (sa_family_ == AF_INET6) {
-            ip_addr_data_ = &reinterpret_cast<const sockaddr_in6*>(address)->sin6_addr;
-            addr_format_ = "[%s]:%hu";
-        } else {  // Should be impossible
-            D("mDNS resolved non-IP address.");
-            return;
-        }
-
-        // Winsock version requires the const cast Because Microsoft.
-        if (!inet_ntop(sa_family_, const_cast<void*>(ip_addr_data_), ip_addr_, sizeof(ip_addr_))) {
-            D("Could not convert IP address to string.");
-            return;
-        }
-
-        // adb secure service needs to do something different from just
-        // connecting here.
-        if (adb_DNSServiceShouldConnect(regType_.c_str(), serviceName_.c_str())) {
-            std::string response;
-            D("Attempting to serviceName=[%s], regtype=[%s] ipaddr=(%s:%hu)", serviceName_.c_str(),
-              regType_.c_str(), ip_addr_, port_);
-            int index = adb_DNSServiceIndexByName(regType_.c_str());
-            if (index == kADBSecureConnectServiceRefIndex) {
-                ConnectSecureWifiDevice();
-            } else {
-                connect_device(android::base::StringPrintf(addr_format_.c_str(), ip_addr_, port_),
-                               &response);
-                D("Connect to %s regtype %s (%s:%hu) : %s", serviceName_.c_str(), regType_.c_str(),
-                  ip_addr_, port_, response.c_str());
-            }
-        } else {
-            D("Not immediately connecting to serviceName=[%s], regtype=[%s] ipaddr=(%s:%hu)",
-              serviceName_.c_str(), regType_.c_str(), ip_addr_, port_);
-        }
-
-        int adbSecureServiceType = serviceIndex();
-        switch (adbSecureServiceType) {
-            case kADBSecurePairingServiceRefIndex:
-                sAdbSecurePairingServices->push_back(this);
-                break;
-            case kADBSecureConnectServiceRefIndex:
-                sAdbSecureConnectServices->push_back(this);
-                break;
-            default:
-                break;
-        }
-    }
-
-    int serviceIndex() const { return adb_DNSServiceIndexByName(regType_.c_str()); }
-
-    std::string hostTarget() const { return hosttarget_; }
-
-    std::string serviceName() const { return serviceName_; }
-
-    std::string ipAddress() const { return ip_addr_; }
-
-    uint16_t port() const { return port_; }
-
-    using ServiceRegistry = std::vector<ResolvedService*>;
-
-    static ServiceRegistry* sAdbSecurePairingServices;
-    static ServiceRegistry* sAdbSecureConnectServices;
-
-    static void initAdbSecure();
-
-    static void forEachService(const ServiceRegistry& services, const std::string& hostname,
-                               adb_secure_foreach_service_callback cb);
-
-    static bool connectByServiceName(const ServiceRegistry& services,
-                                     const std::string& service_name);
-
-  private:
-    int clientVersion_ = ADB_SECURE_CLIENT_VERSION;
-    std::string addr_format_;
-    std::string serviceName_;
-    std::string regType_;
-    std::string hosttarget_;
-    const uint16_t port_;
-    int sa_family_;
-    const void* ip_addr_data_;
-    char ip_addr_[INET6_ADDRSTRLEN];
-    int serviceVersion_;
-};
-
-// static
-std::vector<ResolvedService*>* ResolvedService::sAdbSecurePairingServices = NULL;
-
-// static
-std::vector<ResolvedService*>* ResolvedService::sAdbSecureConnectServices = NULL;
-
-// static
-void ResolvedService::initAdbSecure() {
-    if (!sAdbSecurePairingServices) {
-        sAdbSecurePairingServices = new ServiceRegistry;
-    }
-    if (!sAdbSecureConnectServices) {
-        sAdbSecureConnectServices = new ServiceRegistry;
-    }
-}
-
-// static
-void ResolvedService::forEachService(const ServiceRegistry& services,
-                                     const std::string& wanted_service_name,
-                                     adb_secure_foreach_service_callback cb) {
-    initAdbSecure();
-
-    for (auto service : services) {
-        auto service_name = service->serviceName();
-        auto ip = service->ipAddress();
-        auto port = service->port();
-
-        if (wanted_service_name == "") {
-            cb(service_name.c_str(), ip.c_str(), port);
-        } else if (service_name == wanted_service_name) {
-            cb(service_name.c_str(), ip.c_str(), port);
-        }
-    }
-}
-
-// static
-bool ResolvedService::connectByServiceName(const ServiceRegistry& services,
-                                           const std::string& service_name) {
-    initAdbSecure();
-    for (auto service : services) {
-        if (service_name == service->serviceName()) {
-            D("Got service_name match [%s]", service->serviceName().c_str());
-            return service->ConnectSecureWifiDevice();
-        }
-    }
-    D("No registered serviceNames matched [%s]", service_name.c_str());
-    return false;
-}
-
-void adb_secure_foreach_pairing_service(const char* service_name,
-                                        adb_secure_foreach_service_callback cb) {
-    ResolvedService::forEachService(*ResolvedService::sAdbSecurePairingServices,
-                                    service_name ? service_name : "", cb);
-}
-
-void adb_secure_foreach_connect_service(const char* service_name,
-                                        adb_secure_foreach_service_callback cb) {
-    ResolvedService::forEachService(*ResolvedService::sAdbSecureConnectServices,
-                                    service_name ? service_name : "", cb);
-}
-
-bool adb_secure_connect_by_service_name(const char* service_name) {
-    return ResolvedService::connectByServiceName(*ResolvedService::sAdbSecureConnectServices,
-                                                 service_name);
-}
-
-static void DNSSD_API register_service_ip(DNSServiceRef /*sdRef*/,
-                                          DNSServiceFlags /*flags*/,
-                                          uint32_t /*interfaceIndex*/,
-                                          DNSServiceErrorType /*errorCode*/,
-                                          const char* /*hostname*/,
-                                          const sockaddr* address,
-                                          uint32_t /*ttl*/,
-                                          void* context) {
-    D("Got IP for service.");
-    std::unique_ptr<ResolvedService> data(
-        reinterpret_cast<ResolvedService*>(context));
-    data->Connect(address);
-
-    // For ADB Secure services, keep those ResolvedService's around
-    // for later processing with secure connection establishment.
-    if (data->serviceIndex() != kADBTransportServiceRefIndex) {
-        data.release();
-    }
-}
-
-static void DNSSD_API register_resolved_mdns_service(DNSServiceRef sdRef,
-                                                     DNSServiceFlags flags,
-                                                     uint32_t interfaceIndex,
-                                                     DNSServiceErrorType errorCode,
-                                                     const char* fullname,
-                                                     const char* hosttarget,
-                                                     uint16_t port,
-                                                     uint16_t txtLen,
-                                                     const unsigned char* txtRecord,
-                                                     void* context);
-
-class DiscoveredService : public AsyncServiceRef {
-  public:
-    DiscoveredService(uint32_t interfaceIndex, const char* serviceName, const char* regtype,
-                      const char* domain)
-        : serviceName_(serviceName), regType_(regtype) {
-        DNSServiceErrorType ret =
-            DNSServiceResolve(&sdRef_, 0, interfaceIndex, serviceName, regtype,
-                              domain, register_resolved_mdns_service,
-                              reinterpret_cast<void*>(this));
-
-        D("DNSServiceResolve for "
-          "interfaceIndex %u "
-          "serviceName %s "
-          "regtype %s "
-          "domain %s "
-          ": %d",
-          interfaceIndex, serviceName, regtype, domain, ret);
-
-        if (ret == kDNSServiceErr_NoError) {
-            Initialize();
-        }
-    }
-
-    const char* ServiceName() {
-        return serviceName_.c_str();
-    }
-
-    const char* RegType() { return regType_.c_str(); }
-
-  private:
-    std::string serviceName_;
-    std::string regType_;
-};
-
-static void adb_RemoveDNSService(const char* regType, const char* serviceName) {
-    int index = adb_DNSServiceIndexByName(regType);
-    ResolvedService::ServiceRegistry* services;
-    switch (index) {
-        case kADBSecurePairingServiceRefIndex:
-            services = ResolvedService::sAdbSecurePairingServices;
-            break;
-        case kADBSecureConnectServiceRefIndex:
-            services = ResolvedService::sAdbSecureConnectServices;
-            break;
-        default:
-            return;
-    }
-
-    std::string sName(serviceName);
-    services->erase(std::remove_if(
-            services->begin(), services->end(),
-            [&sName](ResolvedService* service) { return (sName == service->serviceName()); }));
-}
-
-// Returns the version the device wanted to advertise,
-// or -1 if parsing fails.
-static int parse_version_from_txt_record(uint16_t txtLen, const unsigned char* txtRecord) {
-    if (!txtLen) return -1;
-    if (!txtRecord) return -1;
-
-    // https://tools.ietf.org/html/rfc6763
-    // """
-    // 6.1.  General Format Rules for DNS TXT Records
-    //
-    // A DNS TXT record can be up to 65535 (0xFFFF) bytes long.  The total
-    // length is indicated by the length given in the resource record header
-    // in the DNS message.  There is no way to tell directly from the data
-    // alone how long it is (e.g., there is no length count at the start, or
-    // terminating NULL byte at the end).
-    // """
-
-    // Let's trust the TXT record's length byte
-    // Worst case, it wastes 255 bytes
-    std::vector<char> recordAsString(txtLen + 1, '\0');
-    char* str = recordAsString.data();
-
-    memcpy(str, txtRecord + 1 /* skip the length byte */, txtLen);
-
-    // Check if it's the version key
-    static const char* versionKey = "v=";
-    size_t versionKeyLen = strlen(versionKey);
-
-    if (strncmp(versionKey, str, versionKeyLen)) return -1;
-
-    auto valueStart = str + versionKeyLen;
-
-    long parsedNumber = strtol(valueStart, 0, 10);
-
-    // No valid conversion. Also, 0
-    // is not a valid version.
-    if (!parsedNumber) return -1;
-
-    // Outside bounds of long.
-    if (parsedNumber == LONG_MIN || parsedNumber == LONG_MAX) return -1;
-
-    // Possibly valid version
-    return static_cast<int>(parsedNumber);
-}
-
-static void DNSSD_API register_resolved_mdns_service(
-        DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex,
-        DNSServiceErrorType errorCode, const char* fullname, const char* hosttarget, uint16_t port,
-        uint16_t txtLen, const unsigned char* txtRecord, void* context) {
-    D("Resolved a service.");
-    std::unique_ptr<DiscoveredService> discovered(
-        reinterpret_cast<DiscoveredService*>(context));
-
-    if (errorCode != kDNSServiceErr_NoError) {
-        D("Got error %d resolving service.", errorCode);
-        return;
-    }
-
-    // TODO: Reject certain combinations of invalid or mismatched client and
-    // service versions here before creating anything.
-    // At the moment, there is nothing to reject, so accept everything
-    // as an optimistic default.
-    auto serviceVersion = parse_version_from_txt_record(txtLen, txtRecord);
-
-    auto resolved = new ResolvedService(discovered->ServiceName(), discovered->RegType(),
-                                        interfaceIndex, hosttarget, ntohs(port), serviceVersion);
-
-    if (! resolved->Initialized()) {
-        D("Unable to init resolved service");
-        delete resolved;
-    }
-
-    if (flags) { /* Only ever equals MoreComing or 0 */
-        D("releasing discovered service");
-        discovered.release();
-    }
-}
-
-static void DNSSD_API on_service_browsed(DNSServiceRef sdRef, DNSServiceFlags flags,
-                                         uint32_t interfaceIndex, DNSServiceErrorType errorCode,
-                                         const char* serviceName, const char* regtype,
-                                         const char* domain, void* /*context*/) {
-    if (errorCode != kDNSServiceErr_NoError) {
-        D("Got error %d during mDNS browse.", errorCode);
-        DNSServiceRefDeallocate(sdRef);
-        int serviceIndex = adb_DNSServiceIndexByName(regtype);
-        if (serviceIndex != -1) {
-            fdevent_destroy(service_ref_fdes[serviceIndex]);
-        }
-        return;
-    }
-
-    if (flags & kDNSServiceFlagsAdd) {
-        D("%s: Discover found new serviceName=[%s] regtype=[%s] domain=[%s]", __func__, serviceName,
-          regtype, domain);
-        auto discovered = new DiscoveredService(interfaceIndex, serviceName, regtype, domain);
-        if (!discovered->Initialized()) {
-            delete discovered;
-        }
-    } else {
-        D("%s: Discover lost serviceName=[%s] regtype=[%s] domain=[%s]", __func__, serviceName,
-          regtype, domain);
-        adb_RemoveDNSService(regtype, serviceName);
-    }
-}
-
-void init_mdns_transport_discovery_thread(void) {
-    int errorCodes[kNumADBDNSServices];
-
-    for (int i = 0; i < kNumADBDNSServices; ++i) {
-        errorCodes[i] = DNSServiceBrowse(&service_refs[i], 0, 0, kADBDNSServices[i], nullptr,
-                                         on_service_browsed, nullptr);
-
-        if (errorCodes[i] != kDNSServiceErr_NoError) {
-            D("Got %d browsing for mDNS service %s.", errorCodes[i], kADBDNSServices[i]);
-        }
-
-        if (errorCodes[i] == kDNSServiceErr_NoError) {
-            fdevent_run_on_main_thread([i]() {
-                service_ref_fdes[i] = fdevent_create(adb_DNSServiceRefSockFD(service_refs[i]),
-                                                     pump_service_ref, &service_refs[i]);
-                fdevent_set(service_ref_fdes[i], FDE_READ);
-            });
-        }
-    }
-}
-
-void init_mdns_transport_discovery(void) {
-    ResolvedService::initAdbSecure();
-    std::thread(init_mdns_transport_discovery_thread).detach();
-}
diff --git a/adb/client/transport_usb.cpp b/adb/client/transport_usb.cpp
deleted file mode 100644
index 777edde..0000000
--- a/adb/client/transport_usb.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG TRANSPORT
-
-#include "sysdeps.h"
-
-#include "client/usb.h"
-
-#include <memory>
-
-#include "sysdeps.h"
-#include "transport.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "adb.h"
-
-#if ADB_HOST
-
-#if defined(__APPLE__)
-#define CHECK_PACKET_OVERFLOW 0
-#else
-#define CHECK_PACKET_OVERFLOW 1
-#endif
-
-// Call usb_read using a buffer having a multiple of usb_get_max_packet_size() bytes
-// to avoid overflow. See http://libusb.sourceforge.net/api-1.0/packetoverflow.html.
-static int UsbReadMessage(usb_handle* h, amessage* msg) {
-    D("UsbReadMessage");
-
-#if CHECK_PACKET_OVERFLOW
-    size_t usb_packet_size = usb_get_max_packet_size(h);
-    CHECK_GE(usb_packet_size, sizeof(*msg));
-    CHECK_LT(usb_packet_size, 4096ULL);
-
-    char buffer[4096];
-    int n = usb_read(h, buffer, usb_packet_size);
-    if (n != sizeof(*msg)) {
-        D("usb_read returned unexpected length %d (expected %zu)", n, sizeof(*msg));
-        return -1;
-    }
-    memcpy(msg, buffer, sizeof(*msg));
-    return n;
-#else
-    return usb_read(h, msg, sizeof(*msg));
-#endif
-}
-
-// Call usb_read using a buffer having a multiple of usb_get_max_packet_size() bytes
-// to avoid overflow. See http://libusb.sourceforge.net/api-1.0/packetoverflow.html.
-static int UsbReadPayload(usb_handle* h, apacket* p) {
-    D("UsbReadPayload(%d)", p->msg.data_length);
-
-    if (p->msg.data_length > MAX_PAYLOAD) {
-        return -1;
-    }
-
-#if CHECK_PACKET_OVERFLOW
-    size_t usb_packet_size = usb_get_max_packet_size(h);
-
-    // Round the data length up to the nearest packet size boundary.
-    // The device won't send a zero packet for packet size aligned payloads,
-    // so don't read any more packets than needed.
-    size_t len = p->msg.data_length;
-    size_t rem_size = len % usb_packet_size;
-    if (rem_size) {
-        len += usb_packet_size - rem_size;
-    }
-
-    p->payload.resize(len);
-    int rc = usb_read(h, &p->payload[0], p->payload.size());
-    if (rc != static_cast<int>(p->msg.data_length)) {
-        return -1;
-    }
-
-    p->payload.resize(rc);
-    return rc;
-#else
-    p->payload.resize(p->msg.data_length);
-    return usb_read(h, &p->payload[0], p->payload.size());
-#endif
-}
-
-static int remote_read(apacket* p, usb_handle* usb) {
-    int n = UsbReadMessage(usb, &p->msg);
-    if (n < 0) {
-        D("remote usb: read terminated (message)");
-        return -1;
-    }
-    if (static_cast<size_t>(n) != sizeof(p->msg)) {
-        D("remote usb: read received unexpected header length %d", n);
-        return -1;
-    }
-    if (p->msg.data_length) {
-        n = UsbReadPayload(usb, p);
-        if (n < 0) {
-            D("remote usb: terminated (data)");
-            return -1;
-        }
-        if (static_cast<uint32_t>(n) != p->msg.data_length) {
-            D("remote usb: read payload failed (need %u bytes, give %d bytes), skip it",
-              p->msg.data_length, n);
-            return -1;
-        }
-    }
-    return 0;
-}
-
-#else
-
-// On Android devices, we rely on the kernel to provide buffered read.
-// So we can recover automatically from EOVERFLOW.
-static int remote_read(apacket* p, usb_handle* usb) {
-    if (usb_read(usb, &p->msg, sizeof(amessage)) != sizeof(amessage)) {
-        PLOG(ERROR) << "remote usb: read terminated (message)";
-        return -1;
-    }
-
-    if (p->msg.data_length) {
-        if (p->msg.data_length > MAX_PAYLOAD) {
-            PLOG(ERROR) << "remote usb: read overflow (data length = " << p->msg.data_length << ")";
-            return -1;
-        }
-
-        p->payload.resize(p->msg.data_length);
-        if (usb_read(usb, &p->payload[0], p->payload.size()) !=
-            static_cast<int>(p->payload.size())) {
-            PLOG(ERROR) << "remote usb: terminated (data)";
-            return -1;
-        }
-    }
-
-    return 0;
-}
-#endif
-
-UsbConnection::~UsbConnection() {
-    usb_close(handle_);
-}
-
-bool UsbConnection::Read(apacket* packet) {
-    int rc = remote_read(packet, handle_);
-    return rc == 0;
-}
-
-bool UsbConnection::Write(apacket* packet) {
-    int size = packet->msg.data_length;
-
-    if (usb_write(handle_, &packet->msg, sizeof(packet->msg)) != sizeof(packet->msg)) {
-        PLOG(ERROR) << "remote usb: 1 - write terminated";
-        return false;
-    }
-
-    if (packet->msg.data_length != 0 && usb_write(handle_, packet->payload.data(), size) != size) {
-        PLOG(ERROR) << "remote usb: 2 - write terminated";
-        return false;
-    }
-
-    return true;
-}
-
-bool UsbConnection::DoTlsHandshake(RSA* key, std::string* auth_key) {
-    // TODO: support TLS for usb connections
-    LOG(FATAL) << "Not supported yet.";
-    return false;
-}
-
-void UsbConnection::Reset() {
-    usb_reset(handle_);
-    usb_kick(handle_);
-}
-
-void UsbConnection::Close() {
-    usb_kick(handle_);
-}
-
-void init_usb_transport(atransport* t, usb_handle* h) {
-    D("transport: usb");
-    auto connection = std::make_unique<UsbConnection>(h);
-    t->SetConnection(std::make_unique<BlockingConnectionAdapter>(std::move(connection)));
-    t->type = kTransportUsb;
-    t->SetUsbHandle(h);
-}
-
-int is_adb_interface(int usb_class, int usb_subclass, int usb_protocol) {
-    return (usb_class == ADB_CLASS && usb_subclass == ADB_SUBCLASS && usb_protocol == ADB_PROTOCOL);
-}
-
-bool should_use_libusb() {
-#if !ADB_HOST
-    return false;
-#else
-    static bool enable = getenv("ADB_LIBUSB") && strcmp(getenv("ADB_LIBUSB"), "1") == 0;
-    return enable;
-#endif
-}
diff --git a/adb/client/usb.h b/adb/client/usb.h
deleted file mode 100644
index b371788..0000000
--- a/adb/client/usb.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <sys/types.h>
-
-#include "adb.h"
-#include "transport.h"
-
-// USB host/client interface.
-
-#define ADB_USB_INTERFACE(handle_ref_type)                       \
-    void usb_init();                                             \
-    void usb_cleanup();                                          \
-    int usb_write(handle_ref_type h, const void* data, int len); \
-    int usb_read(handle_ref_type h, void* data, int len);        \
-    int usb_close(handle_ref_type h);                            \
-    void usb_reset(handle_ref_type h);                           \
-    void usb_kick(handle_ref_type h);                            \
-    size_t usb_get_max_packet_size(handle_ref_type)
-
-// Linux and Darwin clients have native and libusb implementations.
-
-namespace libusb {
-struct usb_handle;
-ADB_USB_INTERFACE(libusb::usb_handle*);
-}  // namespace libusb
-
-namespace native {
-struct usb_handle;
-ADB_USB_INTERFACE(native::usb_handle*);
-}  // namespace native
-
-// Empty base that both implementations' opaque handles inherit from.
-struct usb_handle {};
-
-ADB_USB_INTERFACE(::usb_handle*);
-
-// USB device detection.
-int is_adb_interface(int usb_class, int usb_subclass, int usb_protocol);
-
-bool should_use_libusb();
-
-struct UsbConnection : public BlockingConnection {
-    explicit UsbConnection(usb_handle* handle) : handle_(handle) {}
-    ~UsbConnection();
-
-    bool Read(apacket* packet) override final;
-    bool Write(apacket* packet) override final;
-    bool DoTlsHandshake(RSA* key, std::string* auth_key) override final;
-
-    void Close() override final;
-    virtual void Reset() override final;
-
-    usb_handle* handle_;
-};
diff --git a/adb/client/usb_dispatch.cpp b/adb/client/usb_dispatch.cpp
deleted file mode 100644
index 7b97117..0000000
--- a/adb/client/usb_dispatch.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <android-base/logging.h>
-
-#include "client/usb.h"
-
-void usb_init() {
-    if (should_use_libusb()) {
-        LOG(DEBUG) << "using libusb backend";
-        libusb::usb_init();
-    } else {
-        LOG(DEBUG) << "using native backend";
-        native::usb_init();
-    }
-}
-
-void usb_cleanup() {
-    if (should_use_libusb()) {
-        libusb::usb_cleanup();
-    } else {
-        native::usb_cleanup();
-    }
-}
-
-int usb_write(usb_handle* h, const void* data, int len) {
-    return should_use_libusb()
-               ? libusb::usb_write(reinterpret_cast<libusb::usb_handle*>(h), data, len)
-               : native::usb_write(reinterpret_cast<native::usb_handle*>(h), data, len);
-}
-
-int usb_read(usb_handle* h, void* data, int len) {
-    return should_use_libusb()
-               ? libusb::usb_read(reinterpret_cast<libusb::usb_handle*>(h), data, len)
-               : native::usb_read(reinterpret_cast<native::usb_handle*>(h), data, len);
-}
-
-int usb_close(usb_handle* h) {
-    return should_use_libusb() ? libusb::usb_close(reinterpret_cast<libusb::usb_handle*>(h))
-                               : native::usb_close(reinterpret_cast<native::usb_handle*>(h));
-}
-
-void usb_reset(usb_handle* h) {
-    should_use_libusb() ? libusb::usb_reset(reinterpret_cast<libusb::usb_handle*>(h))
-                        : native::usb_reset(reinterpret_cast<native::usb_handle*>(h));
-}
-
-void usb_kick(usb_handle* h) {
-    should_use_libusb() ? libusb::usb_kick(reinterpret_cast<libusb::usb_handle*>(h))
-                        : native::usb_kick(reinterpret_cast<native::usb_handle*>(h));
-}
-
-size_t usb_get_max_packet_size(usb_handle* h) {
-    return should_use_libusb()
-               ? libusb::usb_get_max_packet_size(reinterpret_cast<libusb::usb_handle*>(h))
-               : native::usb_get_max_packet_size(reinterpret_cast<native::usb_handle*>(h));
-}
diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
deleted file mode 100644
index 07cbc94..0000000
--- a/adb/client/usb_libusb.cpp
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "sysdeps.h"
-
-#include "client/usb.h"
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <atomic>
-#include <chrono>
-#include <condition_variable>
-#include <memory>
-#include <mutex>
-#include <string>
-#include <thread>
-#include <unordered_map>
-
-#include <libusb/libusb.h>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include "adb.h"
-#include "adb_utils.h"
-#include "transport.h"
-
-using android::base::StringPrintf;
-
-// RAII wrappers for libusb.
-struct ConfigDescriptorDeleter {
-    void operator()(libusb_config_descriptor* desc) {
-        libusb_free_config_descriptor(desc);
-    }
-};
-
-using unique_config_descriptor = std::unique_ptr<libusb_config_descriptor, ConfigDescriptorDeleter>;
-
-struct DeviceHandleDeleter {
-    void operator()(libusb_device_handle* h) {
-        libusb_close(h);
-    }
-};
-
-using unique_device_handle = std::unique_ptr<libusb_device_handle, DeviceHandleDeleter>;
-
-struct transfer_info {
-    transfer_info(const char* name, uint16_t zero_mask, bool is_bulk_out)
-        : name(name),
-          transfer(libusb_alloc_transfer(0)),
-          is_bulk_out(is_bulk_out),
-          zero_mask(zero_mask) {}
-
-    ~transfer_info() {
-        libusb_free_transfer(transfer);
-    }
-
-    const char* name;
-    libusb_transfer* transfer;
-    bool is_bulk_out;
-    bool transfer_complete;
-    std::condition_variable cv;
-    std::mutex mutex;
-    uint16_t zero_mask;
-
-    void Notify() {
-        LOG(DEBUG) << "notifying " << name << " transfer complete";
-        transfer_complete = true;
-        cv.notify_one();
-    }
-};
-
-namespace libusb {
-struct usb_handle : public ::usb_handle {
-    usb_handle(const std::string& device_address, const std::string& serial,
-               unique_device_handle&& device_handle, uint8_t interface, uint8_t bulk_in,
-               uint8_t bulk_out, size_t zero_mask, size_t max_packet_size)
-        : device_address(device_address),
-          serial(serial),
-          closing(false),
-          device_handle(device_handle.release()),
-          read("read", zero_mask, false),
-          write("write", zero_mask, true),
-          interface(interface),
-          bulk_in(bulk_in),
-          bulk_out(bulk_out),
-          max_packet_size(max_packet_size) {}
-
-    ~usb_handle() {
-        Close();
-    }
-
-    void Close() {
-        std::unique_lock<std::mutex> lock(device_handle_mutex);
-        // Cancelling transfers will trigger more Closes, so make sure this only happens once.
-        if (closing) {
-            return;
-        }
-        closing = true;
-
-        // Make sure that no new transfers come in.
-        libusb_device_handle* handle = device_handle;
-        if (!handle) {
-            return;
-        }
-
-        device_handle = nullptr;
-
-        // Cancel already dispatched transfers.
-        libusb_cancel_transfer(read.transfer);
-        libusb_cancel_transfer(write.transfer);
-
-        libusb_release_interface(handle, interface);
-        libusb_close(handle);
-    }
-
-    std::string device_address;
-    std::string serial;
-
-    std::atomic<bool> closing;
-    std::mutex device_handle_mutex;
-    libusb_device_handle* device_handle;
-
-    transfer_info read;
-    transfer_info write;
-
-    uint8_t interface;
-    uint8_t bulk_in;
-    uint8_t bulk_out;
-
-    size_t max_packet_size;
-};
-
-static auto& usb_handles = *new std::unordered_map<std::string, std::unique_ptr<usb_handle>>();
-static auto& usb_handles_mutex = *new std::mutex();
-
-static libusb_hotplug_callback_handle hotplug_handle;
-
-static std::string get_device_address(libusb_device* device) {
-    return StringPrintf("usb:%d:%d", libusb_get_bus_number(device),
-                        libusb_get_device_address(device));
-}
-
-#if defined(__linux__)
-static std::string get_device_serial_path(libusb_device* device) {
-    uint8_t ports[7];
-    int port_count = libusb_get_port_numbers(device, ports, 7);
-    if (port_count < 0) return "";
-
-    std::string path =
-        StringPrintf("/sys/bus/usb/devices/%d-%d", libusb_get_bus_number(device), ports[0]);
-    for (int port = 1; port < port_count; ++port) {
-        path += StringPrintf(".%d", ports[port]);
-    }
-    path += "/serial";
-    return path;
-}
-
-static std::string get_device_dev_path(libusb_device* device) {
-    uint8_t ports[7];
-    int port_count = libusb_get_port_numbers(device, ports, 7);
-    if (port_count < 0) return "";
-    return StringPrintf("/dev/bus/usb/%03u/%03u", libusb_get_bus_number(device), ports[0]);
-}
-#endif
-
-static bool endpoint_is_output(uint8_t endpoint) {
-    return (endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_OUT;
-}
-
-static bool should_perform_zero_transfer(uint8_t endpoint, size_t write_length, uint16_t zero_mask) {
-    return endpoint_is_output(endpoint) && write_length != 0 && zero_mask != 0 &&
-           (write_length & zero_mask) == 0;
-}
-
-static void process_device(libusb_device* device) {
-    std::string device_address = get_device_address(device);
-    std::string device_serial;
-
-    // Figure out if we want to open the device.
-    libusb_device_descriptor device_desc;
-    int rc = libusb_get_device_descriptor(device, &device_desc);
-    if (rc != 0) {
-        LOG(WARNING) << "failed to get device descriptor for device at " << device_address << ": "
-                     << libusb_error_name(rc);
-        return;
-    }
-
-    if (device_desc.bDeviceClass != LIBUSB_CLASS_PER_INTERFACE) {
-        // Assume that all Android devices have the device class set to per interface.
-        // TODO: Is this assumption valid?
-        LOG(VERBOSE) << "skipping device with incorrect class at " << device_address;
-        return;
-    }
-
-    libusb_config_descriptor* config_raw;
-    rc = libusb_get_active_config_descriptor(device, &config_raw);
-    if (rc != 0) {
-        LOG(WARNING) << "failed to get active config descriptor for device at " << device_address
-                     << ": " << libusb_error_name(rc);
-        return;
-    }
-    const unique_config_descriptor config(config_raw);
-
-    // Use size_t for interface_num so <iostream>s don't mangle it.
-    size_t interface_num;
-    uint16_t zero_mask = 0;
-    uint8_t bulk_in = 0, bulk_out = 0;
-    size_t packet_size = 0;
-    bool found_adb = false;
-
-    for (interface_num = 0; interface_num < config->bNumInterfaces; ++interface_num) {
-        const libusb_interface& interface = config->interface[interface_num];
-        if (interface.num_altsetting != 1) {
-            // Assume that interfaces with alternate settings aren't adb interfaces.
-            // TODO: Is this assumption valid?
-            LOG(VERBOSE) << "skipping interface with incorrect num_altsetting at " << device_address
-                         << " (interface " << interface_num << ")";
-            continue;
-        }
-
-        const libusb_interface_descriptor& interface_desc = interface.altsetting[0];
-        if (!is_adb_interface(interface_desc.bInterfaceClass, interface_desc.bInterfaceSubClass,
-                              interface_desc.bInterfaceProtocol)) {
-            LOG(VERBOSE) << "skipping non-adb interface at " << device_address << " (interface "
-                         << interface_num << ")";
-            continue;
-        }
-
-        LOG(VERBOSE) << "found potential adb interface at " << device_address << " (interface "
-                     << interface_num << ")";
-
-        bool found_in = false;
-        bool found_out = false;
-        for (size_t endpoint_num = 0; endpoint_num < interface_desc.bNumEndpoints; ++endpoint_num) {
-            const auto& endpoint_desc = interface_desc.endpoint[endpoint_num];
-            const uint8_t endpoint_addr = endpoint_desc.bEndpointAddress;
-            const uint8_t endpoint_attr = endpoint_desc.bmAttributes;
-
-            const uint8_t transfer_type = endpoint_attr & LIBUSB_TRANSFER_TYPE_MASK;
-
-            if (transfer_type != LIBUSB_TRANSFER_TYPE_BULK) {
-                continue;
-            }
-
-            if (endpoint_is_output(endpoint_addr) && !found_out) {
-                found_out = true;
-                bulk_out = endpoint_addr;
-                zero_mask = endpoint_desc.wMaxPacketSize - 1;
-            } else if (!endpoint_is_output(endpoint_addr) && !found_in) {
-                found_in = true;
-                bulk_in = endpoint_addr;
-            }
-
-            size_t endpoint_packet_size = endpoint_desc.wMaxPacketSize;
-            CHECK(endpoint_packet_size != 0);
-            if (packet_size == 0) {
-                packet_size = endpoint_packet_size;
-            } else {
-                CHECK(packet_size == endpoint_packet_size);
-            }
-        }
-
-        if (found_in && found_out) {
-            found_adb = true;
-            break;
-        } else {
-            LOG(VERBOSE) << "rejecting potential adb interface at " << device_address
-                         << "(interface " << interface_num << "): missing bulk endpoints "
-                         << "(found_in = " << found_in << ", found_out = " << found_out << ")";
-        }
-    }
-
-    if (!found_adb) {
-        LOG(VERBOSE) << "skipping device with no adb interfaces at " << device_address;
-        return;
-    }
-
-    {
-        std::unique_lock<std::mutex> lock(usb_handles_mutex);
-        if (usb_handles.find(device_address) != usb_handles.end()) {
-            LOG(VERBOSE) << "device at " << device_address
-                         << " has already been registered, skipping";
-            return;
-        }
-    }
-
-    bool writable = true;
-    libusb_device_handle* handle_raw = nullptr;
-    rc = libusb_open(device, &handle_raw);
-    unique_device_handle handle(handle_raw);
-    if (rc == 0) {
-        LOG(DEBUG) << "successfully opened adb device at " << device_address << ", "
-                   << StringPrintf("bulk_in = %#x, bulk_out = %#x", bulk_in, bulk_out);
-
-        device_serial.resize(255);
-        rc = libusb_get_string_descriptor_ascii(handle_raw, device_desc.iSerialNumber,
-                                                reinterpret_cast<unsigned char*>(&device_serial[0]),
-                                                device_serial.length());
-        if (rc == 0) {
-            LOG(WARNING) << "received empty serial from device at " << device_address;
-            return;
-        } else if (rc < 0) {
-            LOG(WARNING) << "failed to get serial from device at " << device_address
-                         << libusb_error_name(rc);
-            return;
-        }
-        device_serial.resize(rc);
-
-        // WARNING: this isn't released via RAII.
-        rc = libusb_claim_interface(handle.get(), interface_num);
-        if (rc != 0) {
-            LOG(WARNING) << "failed to claim adb interface for device '" << device_serial << "'"
-                         << libusb_error_name(rc);
-            return;
-        }
-
-        for (uint8_t endpoint : {bulk_in, bulk_out}) {
-            rc = libusb_clear_halt(handle.get(), endpoint);
-            if (rc != 0) {
-                LOG(WARNING) << "failed to clear halt on device '" << device_serial
-                             << "' endpoint 0x" << std::hex << endpoint << ": "
-                             << libusb_error_name(rc);
-                libusb_release_interface(handle.get(), interface_num);
-                return;
-            }
-        }
-    } else {
-        LOG(WARNING) << "failed to open usb device at " << device_address << ": "
-                     << libusb_error_name(rc);
-        writable = false;
-
-#if defined(__linux__)
-        // libusb doesn't think we should be messing around with devices we don't have
-        // write access to, but Linux at least lets us get the serial number anyway.
-        if (!android::base::ReadFileToString(get_device_serial_path(device), &device_serial)) {
-            // We don't actually want to treat an unknown serial as an error because
-            // devices aren't able to communicate a serial number in early bringup.
-            // http://b/20883914
-            device_serial = "unknown";
-        }
-        device_serial = android::base::Trim(device_serial);
-#else
-        // On Mac OS and Windows, we're screwed. But I don't think this situation actually
-        // happens on those OSes.
-        return;
-#endif
-    }
-
-    std::unique_ptr<usb_handle> result(new usb_handle(device_address, device_serial,
-                                                      std::move(handle), interface_num, bulk_in,
-                                                      bulk_out, zero_mask, packet_size));
-    usb_handle* usb_handle_raw = result.get();
-
-    {
-        std::unique_lock<std::mutex> lock(usb_handles_mutex);
-        usb_handles[device_address] = std::move(result);
-
-        register_usb_transport(usb_handle_raw, device_serial.c_str(), device_address.c_str(),
-                               writable);
-    }
-    LOG(INFO) << "registered new usb device '" << device_serial << "'";
-}
-
-static std::atomic<int> connecting_devices(0);
-
-static void device_connected(libusb_device* device) {
-#if defined(__linux__)
-    // Android's host linux libusb uses netlink instead of udev for device hotplug notification,
-    // which means we can get hotplug notifications before udev has updated ownership/perms on the
-    // device. Since we're not going to be able to link against the system's libudev any time soon,
-    // hack around this by inserting a sleep.
-    auto thread = std::thread([device]() {
-        std::string device_path = get_device_dev_path(device);
-        std::this_thread::sleep_for(std::chrono::seconds(1));
-
-        process_device(device);
-        if (--connecting_devices == 0) {
-            adb_notify_device_scan_complete();
-        }
-    });
-    thread.detach();
-#else
-    process_device(device);
-#endif
-}
-
-static void device_disconnected(libusb_device* device) {
-    std::string device_address = get_device_address(device);
-
-    LOG(INFO) << "device disconnected: " << device_address;
-    std::unique_lock<std::mutex> lock(usb_handles_mutex);
-    auto it = usb_handles.find(device_address);
-    if (it != usb_handles.end()) {
-        if (!it->second->device_handle) {
-            // If the handle is null, we were never able to open the device.
-
-            // Temporarily release the usb handles mutex to avoid deadlock.
-            std::unique_ptr<usb_handle> handle = std::move(it->second);
-            usb_handles.erase(it);
-            lock.unlock();
-            unregister_usb_transport(handle.get());
-            lock.lock();
-        } else {
-            // Closure of the transport will erase the usb_handle.
-        }
-    }
-}
-
-static auto& hotplug_queue = *new BlockingQueue<std::pair<libusb_hotplug_event, libusb_device*>>();
-static void hotplug_thread() {
-    adb_thread_setname("libusb hotplug");
-    while (true) {
-        hotplug_queue.PopAll([](std::pair<libusb_hotplug_event, libusb_device*> pair) {
-            libusb_hotplug_event event = pair.first;
-            libusb_device* device = pair.second;
-            if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
-                device_connected(device);
-            } else if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) {
-                device_disconnected(device);
-            }
-        });
-    }
-}
-
-static LIBUSB_CALL int hotplug_callback(libusb_context*, libusb_device* device,
-                                        libusb_hotplug_event event, void*) {
-    // We're called with the libusb lock taken. Call these on a separate thread outside of this
-    // function so that the usb_handle mutex is always taken before the libusb mutex.
-    static std::once_flag once;
-    std::call_once(once, []() { std::thread(hotplug_thread).detach(); });
-
-    if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
-        ++connecting_devices;
-    }
-    hotplug_queue.Push({event, device});
-    return 0;
-}
-
-void usb_init() {
-    LOG(DEBUG) << "initializing libusb...";
-    int rc = libusb_init(nullptr);
-    if (rc != 0) {
-        LOG(FATAL) << "failed to initialize libusb: " << libusb_error_name(rc);
-    }
-
-    // Register the hotplug callback.
-    rc = libusb_hotplug_register_callback(
-        nullptr, static_cast<libusb_hotplug_event>(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
-                                                   LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
-        LIBUSB_HOTPLUG_ENUMERATE, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY,
-        LIBUSB_CLASS_PER_INTERFACE, hotplug_callback, nullptr, &hotplug_handle);
-
-    if (rc != LIBUSB_SUCCESS) {
-        LOG(FATAL) << "failed to register libusb hotplug callback";
-    }
-
-    // Spawn a thread for libusb_handle_events.
-    std::thread([]() {
-        adb_thread_setname("libusb");
-        while (true) {
-            libusb_handle_events(nullptr);
-        }
-    }).detach();
-}
-
-void usb_cleanup() {
-    libusb_hotplug_deregister_callback(nullptr, hotplug_handle);
-}
-
-static LIBUSB_CALL void transfer_callback(libusb_transfer* transfer) {
-    transfer_info* info = static_cast<transfer_info*>(transfer->user_data);
-
-    LOG(DEBUG) << info->name << " transfer callback entered";
-
-    // Make sure that the original submitter has made it to the condition_variable wait.
-    std::unique_lock<std::mutex> lock(info->mutex);
-
-    LOG(DEBUG) << info->name << " callback successfully acquired lock";
-
-    if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
-        LOG(WARNING) << info->name << " transfer failed: " << libusb_error_name(transfer->status);
-        info->Notify();
-        return;
-    }
-
-    // usb_read() can return when receiving some data.
-    if (info->is_bulk_out && transfer->actual_length != transfer->length) {
-        LOG(DEBUG) << info->name << " transfer incomplete, resubmitting";
-        transfer->length -= transfer->actual_length;
-        transfer->buffer += transfer->actual_length;
-        int rc = libusb_submit_transfer(transfer);
-        if (rc != 0) {
-            LOG(WARNING) << "failed to submit " << info->name
-                         << " transfer: " << libusb_error_name(rc);
-            transfer->status = LIBUSB_TRANSFER_ERROR;
-            info->Notify();
-        }
-        return;
-    }
-
-    if (should_perform_zero_transfer(transfer->endpoint, transfer->length, info->zero_mask)) {
-        LOG(DEBUG) << "submitting zero-length write";
-        transfer->length = 0;
-        int rc = libusb_submit_transfer(transfer);
-        if (rc != 0) {
-            LOG(WARNING) << "failed to submit zero-length write: " << libusb_error_name(rc);
-            transfer->status = LIBUSB_TRANSFER_ERROR;
-            info->Notify();
-        }
-        return;
-    }
-
-    LOG(VERBOSE) << info->name << "transfer fully complete";
-    info->Notify();
-}
-
-// Dispatch a libusb transfer, unlock |device_lock|, and then wait for the result.
-static int perform_usb_transfer(usb_handle* h, transfer_info* info,
-                                std::unique_lock<std::mutex> device_lock) {
-    libusb_transfer* transfer = info->transfer;
-
-    transfer->user_data = info;
-    transfer->callback = transfer_callback;
-
-    LOG(DEBUG) << "locking " << info->name << " transfer_info mutex";
-    std::unique_lock<std::mutex> lock(info->mutex);
-    info->transfer_complete = false;
-    LOG(DEBUG) << "submitting " << info->name << " transfer";
-    int rc = libusb_submit_transfer(transfer);
-    if (rc != 0) {
-        LOG(WARNING) << "failed to submit " << info->name << " transfer: " << libusb_error_name(rc);
-        errno = EIO;
-        return -1;
-    }
-
-    LOG(DEBUG) << info->name << " transfer successfully submitted";
-    device_lock.unlock();
-    info->cv.wait(lock, [info]() { return info->transfer_complete; });
-    if (transfer->status != 0) {
-        errno = EIO;
-        return -1;
-    }
-
-    return 0;
-}
-
-int usb_write(usb_handle* h, const void* d, int len) {
-    LOG(DEBUG) << "usb_write of length " << len;
-
-    std::unique_lock<std::mutex> lock(h->device_handle_mutex);
-    if (!h->device_handle) {
-        errno = EIO;
-        return -1;
-    }
-
-    transfer_info* info = &h->write;
-    info->transfer->dev_handle = h->device_handle;
-    info->transfer->flags = 0;
-    info->transfer->endpoint = h->bulk_out;
-    info->transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
-    info->transfer->length = len;
-    info->transfer->buffer = reinterpret_cast<unsigned char*>(const_cast<void*>(d));
-    info->transfer->num_iso_packets = 0;
-
-    int rc = perform_usb_transfer(h, info, std::move(lock));
-    LOG(DEBUG) << "usb_write(" << len << ") = " << rc;
-    return info->transfer->actual_length;
-}
-
-int usb_read(usb_handle* h, void* d, int len) {
-    LOG(DEBUG) << "usb_read of length " << len;
-
-    std::unique_lock<std::mutex> lock(h->device_handle_mutex);
-    if (!h->device_handle) {
-        errno = EIO;
-        return -1;
-    }
-
-    transfer_info* info = &h->read;
-    info->transfer->dev_handle = h->device_handle;
-    info->transfer->flags = 0;
-    info->transfer->endpoint = h->bulk_in;
-    info->transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
-    info->transfer->length = len;
-    info->transfer->buffer = reinterpret_cast<unsigned char*>(d);
-    info->transfer->num_iso_packets = 0;
-
-    int rc = perform_usb_transfer(h, info, std::move(lock));
-    LOG(DEBUG) << "usb_read(" << len << ") = " << rc << ", actual_length "
-               << info->transfer->actual_length;
-    if (rc < 0) {
-        return rc;
-    }
-    return info->transfer->actual_length;
-}
-
-int usb_close(usb_handle* h) {
-    std::unique_lock<std::mutex> lock(usb_handles_mutex);
-    auto it = usb_handles.find(h->device_address);
-    if (it == usb_handles.end()) {
-        LOG(FATAL) << "attempted to close unregistered usb_handle for '" << h->serial << "'";
-    }
-    usb_handles.erase(h->device_address);
-    return 0;
-}
-
-void usb_reset(usb_handle* h) {
-    libusb_reset_device(h->device_handle);
-    usb_kick(h);
-}
-
-void usb_kick(usb_handle* h) {
-    h->Close();
-}
-
-size_t usb_get_max_packet_size(usb_handle* h) {
-    CHECK(h->max_packet_size != 0);
-    return h->max_packet_size;
-}
-
-} // namespace libusb
diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp
deleted file mode 100644
index 95b1817..0000000
--- a/adb/client/usb_linux.cpp
+++ /dev/null
@@ -1,632 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG USB
-
-#include "sysdeps.h"
-
-#include "client/usb.h"
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/usb/ch9.h>
-#include <linux/usbdevice_fs.h>
-#include <linux/version.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/sysmacros.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <condition_variable>
-#include <list>
-#include <mutex>
-#include <string>
-#include <string_view>
-#include <thread>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include "adb.h"
-#include "transport.h"
-
-using namespace std::chrono_literals;
-using namespace std::literals;
-
-/* usb scan debugging is waaaay too verbose */
-#define DBGX(x...)
-
-namespace native {
-struct usb_handle : public ::usb_handle {
-    ~usb_handle() {
-      if (fd != -1) unix_close(fd);
-    }
-
-    std::string path;
-    int fd = -1;
-    unsigned char ep_in;
-    unsigned char ep_out;
-
-    size_t max_packet_size;
-    unsigned zero_mask;
-    unsigned writeable = 1;
-
-    usbdevfs_urb urb_in;
-    usbdevfs_urb urb_out;
-
-    bool urb_in_busy = false;
-    bool urb_out_busy = false;
-    bool dead = false;
-
-    std::condition_variable cv;
-    std::mutex mutex;
-
-    // for garbage collecting disconnected devices
-    bool mark;
-
-    // ID of thread currently in REAPURB
-    pthread_t reaper_thread = 0;
-};
-
-static auto& g_usb_handles_mutex = *new std::mutex();
-static auto& g_usb_handles = *new std::list<usb_handle*>();
-
-static int is_known_device(std::string_view dev_name) {
-    std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-    for (usb_handle* usb : g_usb_handles) {
-        if (usb->path == dev_name) {
-            // set mark flag to indicate this device is still alive
-            usb->mark = true;
-            return 1;
-        }
-    }
-    return 0;
-}
-
-static void kick_disconnected_devices() {
-    std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-    // kick any devices in the device list that were not found in the device scan
-    for (usb_handle* usb : g_usb_handles) {
-        if (!usb->mark) {
-            usb_kick(usb);
-        } else {
-            usb->mark = false;
-        }
-    }
-}
-
-static inline bool contains_non_digit(const char* name) {
-    while (*name) {
-        if (!isdigit(*name++)) return true;
-    }
-    return false;
-}
-
-static void find_usb_device(const std::string& base,
-                            void (*register_device_callback)(const char*, const char*,
-                                                             unsigned char, unsigned char, int, int,
-                                                             unsigned, size_t)) {
-    std::unique_ptr<DIR, int(*)(DIR*)> bus_dir(opendir(base.c_str()), closedir);
-    if (!bus_dir) return;
-
-    dirent* de;
-    while ((de = readdir(bus_dir.get())) != nullptr) {
-        if (contains_non_digit(de->d_name)) continue;
-
-        std::string bus_name = base + "/" + de->d_name;
-
-        std::unique_ptr<DIR, int(*)(DIR*)> dev_dir(opendir(bus_name.c_str()), closedir);
-        if (!dev_dir) continue;
-
-        while ((de = readdir(dev_dir.get()))) {
-            unsigned char devdesc[4096];
-            unsigned char* bufptr = devdesc;
-            unsigned char* bufend;
-            struct usb_device_descriptor* device;
-            struct usb_config_descriptor* config;
-            struct usb_interface_descriptor* interface;
-            struct usb_endpoint_descriptor *ep1, *ep2;
-            unsigned zero_mask = 0;
-            size_t max_packet_size = 0;
-            unsigned vid, pid;
-
-            if (contains_non_digit(de->d_name)) continue;
-
-            std::string dev_name = bus_name + "/" + de->d_name;
-            if (is_known_device(dev_name)) {
-                continue;
-            }
-
-            int fd = unix_open(dev_name, O_RDONLY | O_CLOEXEC);
-            if (fd == -1) {
-                continue;
-            }
-
-            size_t desclength = unix_read(fd, devdesc, sizeof(devdesc));
-            bufend = bufptr + desclength;
-
-                // should have device and configuration descriptors, and atleast two endpoints
-            if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) {
-                D("desclength %zu is too small", desclength);
-                unix_close(fd);
-                continue;
-            }
-
-            device = (struct usb_device_descriptor*)bufptr;
-            bufptr += USB_DT_DEVICE_SIZE;
-
-            if((device->bLength != USB_DT_DEVICE_SIZE) || (device->bDescriptorType != USB_DT_DEVICE)) {
-                unix_close(fd);
-                continue;
-            }
-
-            vid = device->idVendor;
-            pid = device->idProduct;
-            DBGX("[ %s is V:%04x P:%04x ]\n", dev_name.c_str(), vid, pid);
-
-                // should have config descriptor next
-            config = (struct usb_config_descriptor *)bufptr;
-            bufptr += USB_DT_CONFIG_SIZE;
-            if (config->bLength != USB_DT_CONFIG_SIZE || config->bDescriptorType != USB_DT_CONFIG) {
-                D("usb_config_descriptor not found");
-                unix_close(fd);
-                continue;
-            }
-
-                // loop through all the descriptors and look for the ADB interface
-            while (bufptr < bufend) {
-                unsigned char length = bufptr[0];
-                unsigned char type = bufptr[1];
-
-                if (type == USB_DT_INTERFACE) {
-                    interface = (struct usb_interface_descriptor *)bufptr;
-                    bufptr += length;
-
-                    if (length != USB_DT_INTERFACE_SIZE) {
-                        D("interface descriptor has wrong size");
-                        break;
-                    }
-
-                    DBGX("bInterfaceClass: %d,  bInterfaceSubClass: %d,"
-                         "bInterfaceProtocol: %d, bNumEndpoints: %d\n",
-                         interface->bInterfaceClass, interface->bInterfaceSubClass,
-                         interface->bInterfaceProtocol, interface->bNumEndpoints);
-
-                    if (interface->bNumEndpoints == 2 &&
-                        is_adb_interface(interface->bInterfaceClass, interface->bInterfaceSubClass,
-                                         interface->bInterfaceProtocol)) {
-                        struct stat st;
-                        char pathbuf[128];
-                        char link[256];
-                        char *devpath = nullptr;
-
-                        DBGX("looking for bulk endpoints\n");
-                            // looks like ADB...
-                        ep1 = (struct usb_endpoint_descriptor *)bufptr;
-                        bufptr += USB_DT_ENDPOINT_SIZE;
-                            // For USB 3.0 SuperSpeed devices, skip potential
-                            // USB 3.0 SuperSpeed Endpoint Companion descriptor
-                        if (bufptr+2 <= devdesc + desclength &&
-                            bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
-                            bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
-                            bufptr += USB_DT_SS_EP_COMP_SIZE;
-                        }
-                        ep2 = (struct usb_endpoint_descriptor *)bufptr;
-                        bufptr += USB_DT_ENDPOINT_SIZE;
-                        if (bufptr+2 <= devdesc + desclength &&
-                            bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
-                            bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
-                            bufptr += USB_DT_SS_EP_COMP_SIZE;
-                        }
-
-                        if (bufptr > devdesc + desclength ||
-                            ep1->bLength != USB_DT_ENDPOINT_SIZE ||
-                            ep1->bDescriptorType != USB_DT_ENDPOINT ||
-                            ep2->bLength != USB_DT_ENDPOINT_SIZE ||
-                            ep2->bDescriptorType != USB_DT_ENDPOINT) {
-                            D("endpoints not found");
-                            break;
-                        }
-
-                            // both endpoints should be bulk
-                        if (ep1->bmAttributes != USB_ENDPOINT_XFER_BULK ||
-                            ep2->bmAttributes != USB_ENDPOINT_XFER_BULK) {
-                            D("bulk endpoints not found");
-                            continue;
-                        }
-                            /* aproto 01 needs 0 termination */
-                        if (interface->bInterfaceProtocol == ADB_PROTOCOL) {
-                            max_packet_size = ep1->wMaxPacketSize;
-                            zero_mask = ep1->wMaxPacketSize - 1;
-                        }
-
-                            // we have a match.  now we just need to figure out which is in and which is out.
-                        unsigned char local_ep_in, local_ep_out;
-                        if (ep1->bEndpointAddress & USB_ENDPOINT_DIR_MASK) {
-                            local_ep_in = ep1->bEndpointAddress;
-                            local_ep_out = ep2->bEndpointAddress;
-                        } else {
-                            local_ep_in = ep2->bEndpointAddress;
-                            local_ep_out = ep1->bEndpointAddress;
-                        }
-
-                            // Determine the device path
-                        if (!fstat(fd, &st) && S_ISCHR(st.st_mode)) {
-                            snprintf(pathbuf, sizeof(pathbuf), "/sys/dev/char/%d:%d",
-                                     major(st.st_rdev), minor(st.st_rdev));
-                            ssize_t link_len = readlink(pathbuf, link, sizeof(link) - 1);
-                            if (link_len > 0) {
-                                link[link_len] = '\0';
-                                const char* slash = strrchr(link, '/');
-                                if (slash) {
-                                    snprintf(pathbuf, sizeof(pathbuf),
-                                             "usb:%s", slash + 1);
-                                    devpath = pathbuf;
-                                }
-                            }
-                        }
-
-                        register_device_callback(dev_name.c_str(), devpath, local_ep_in,
-                                                 local_ep_out, interface->bInterfaceNumber,
-                                                 device->iSerialNumber, zero_mask, max_packet_size);
-                        break;
-                    }
-                } else {
-                    bufptr += length;
-                }
-            } // end of while
-
-            unix_close(fd);
-        }
-    }
-}
-
-static int usb_bulk_write(usb_handle* h, const void* data, int len) {
-    std::unique_lock<std::mutex> lock(h->mutex);
-    D("++ usb_bulk_write ++");
-
-    usbdevfs_urb* urb = &h->urb_out;
-    memset(urb, 0, sizeof(*urb));
-    urb->type = USBDEVFS_URB_TYPE_BULK;
-    urb->endpoint = h->ep_out;
-    urb->status = -1;
-    urb->buffer = const_cast<void*>(data);
-    urb->buffer_length = len;
-
-    if (h->dead) {
-        errno = EINVAL;
-        return -1;
-    }
-
-    if (TEMP_FAILURE_RETRY(ioctl(h->fd, USBDEVFS_SUBMITURB, urb)) == -1) {
-        return -1;
-    }
-
-    h->urb_out_busy = true;
-    while (true) {
-        auto now = std::chrono::steady_clock::now();
-        if (h->cv.wait_until(lock, now + 5s) == std::cv_status::timeout || h->dead) {
-            // TODO: call USBDEVFS_DISCARDURB?
-            errno = ETIMEDOUT;
-            return -1;
-        }
-        if (!h->urb_out_busy) {
-            if (urb->status != 0) {
-                errno = -urb->status;
-                return -1;
-            }
-            return urb->actual_length;
-        }
-    }
-}
-
-static int usb_bulk_read(usb_handle* h, void* data, int len) {
-    std::unique_lock<std::mutex> lock(h->mutex);
-    D("++ usb_bulk_read ++");
-
-    usbdevfs_urb* urb = &h->urb_in;
-    memset(urb, 0, sizeof(*urb));
-    urb->type = USBDEVFS_URB_TYPE_BULK;
-    urb->endpoint = h->ep_in;
-    urb->status = -1;
-    urb->buffer = data;
-    urb->buffer_length = len;
-
-    if (h->dead) {
-        errno = EINVAL;
-        return -1;
-    }
-
-    if (TEMP_FAILURE_RETRY(ioctl(h->fd, USBDEVFS_SUBMITURB, urb)) == -1) {
-        return -1;
-    }
-
-    h->urb_in_busy = true;
-    while (true) {
-        D("[ reap urb - wait ]");
-        h->reaper_thread = pthread_self();
-        int fd = h->fd;
-        lock.unlock();
-
-        // This ioctl must not have TEMP_FAILURE_RETRY because we send SIGALRM to break out.
-        usbdevfs_urb* out = nullptr;
-        int res = ioctl(fd, USBDEVFS_REAPURB, &out);
-        int saved_errno = errno;
-
-        lock.lock();
-        h->reaper_thread = 0;
-        if (h->dead) {
-            errno = EINVAL;
-            return -1;
-        }
-        if (res < 0) {
-            if (saved_errno == EINTR) {
-                continue;
-            }
-            D("[ reap urb - error ]");
-            errno = saved_errno;
-            return -1;
-        }
-        D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length);
-
-        if (out == &h->urb_in) {
-            D("[ reap urb - IN complete ]");
-            h->urb_in_busy = false;
-            if (urb->status != 0) {
-                errno = -urb->status;
-                return -1;
-            }
-            return urb->actual_length;
-        }
-        if (out == &h->urb_out) {
-            D("[ reap urb - OUT compelete ]");
-            h->urb_out_busy = false;
-            h->cv.notify_all();
-        }
-    }
-}
-
-static int usb_write_split(usb_handle* h, unsigned char* data, int len) {
-    for (int i = 0; i < len; i += 16384) {
-        int chunk_size = (i + 16384 > len) ? len - i : 16384;
-        int n = usb_bulk_write(h, data + i, chunk_size);
-        if (n != chunk_size) {
-            D("ERROR: n = %d, errno = %d (%s)", n, errno, strerror(errno));
-            return -1;
-        }
-    }
-
-    return len;
-}
-
-int usb_write(usb_handle* h, const void* _data, int len) {
-    D("++ usb_write ++");
-
-    unsigned char* data = (unsigned char*)_data;
-
-    // The kernel will attempt to allocate a contiguous buffer for each write we submit.
-    // This might fail due to heap fragmentation, so attempt a contiguous write once, and if that
-    // fails, retry after having split the data into 16kB chunks to avoid allocation failure.
-    int n = usb_bulk_write(h, data, len);
-    if (n == -1 && errno == ENOMEM) {
-        n = usb_write_split(h, data, len);
-    }
-
-    if (n == -1) {
-        return -1;
-    }
-
-    if (h->zero_mask && !(len & h->zero_mask)) {
-        // If we need 0-markers and our transfer is an even multiple of the packet size,
-        // then send a zero marker.
-        return usb_bulk_write(h, _data, 0) == 0 ? len : -1;
-    }
-
-    D("-- usb_write --");
-    return len;
-}
-
-int usb_read(usb_handle *h, void *_data, int len)
-{
-    unsigned char *data = (unsigned char*) _data;
-    int n;
-
-    D("++ usb_read ++");
-    int orig_len = len;
-    while (len == orig_len) {
-        int xfer = len;
-
-        D("[ usb read %d fd = %d], path=%s", xfer, h->fd, h->path.c_str());
-        n = usb_bulk_read(h, data, xfer);
-        D("[ usb read %d ] = %d, path=%s", xfer, n, h->path.c_str());
-        if (n <= 0) {
-            if((errno == ETIMEDOUT) && (h->fd != -1)) {
-                D("[ timeout ]");
-                continue;
-            }
-            D("ERROR: n = %d, errno = %d (%s)",
-                n, errno, strerror(errno));
-            return -1;
-        }
-
-        len -= n;
-        data += n;
-    }
-
-    D("-- usb_read --");
-    return orig_len - len;
-}
-
-void usb_reset(usb_handle* h) {
-    ioctl(h->fd, USBDEVFS_RESET);
-    usb_kick(h);
-}
-
-void usb_kick(usb_handle* h) {
-    std::lock_guard<std::mutex> lock(h->mutex);
-    D("[ kicking %p (fd = %d) ]", h, h->fd);
-    if (!h->dead) {
-        h->dead = true;
-
-        if (h->writeable) {
-            /* HACK ALERT!
-            ** Sometimes we get stuck in ioctl(USBDEVFS_REAPURB).
-            ** This is a workaround for that problem.
-            */
-            if (h->reaper_thread) {
-                pthread_kill(h->reaper_thread, SIGALRM);
-            }
-
-            /* cancel any pending transactions
-            ** these will quietly fail if the txns are not active,
-            ** but this ensures that a reader blocked on REAPURB
-            ** will get unblocked
-            */
-            ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in);
-            ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out);
-            h->urb_in.status = -ENODEV;
-            h->urb_out.status = -ENODEV;
-            h->urb_in_busy = false;
-            h->urb_out_busy = false;
-            h->cv.notify_all();
-        } else {
-            unregister_usb_transport(h);
-        }
-    }
-}
-
-int usb_close(usb_handle* h) {
-    std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-    g_usb_handles.remove(h);
-
-    D("-- usb close %p (fd = %d) --", h, h->fd);
-
-    delete h;
-
-    return 0;
-}
-
-size_t usb_get_max_packet_size(usb_handle* h) {
-    return h->max_packet_size;
-}
-
-static void register_device(const char* dev_name, const char* dev_path, unsigned char ep_in,
-                            unsigned char ep_out, int interface, int serial_index,
-                            unsigned zero_mask, size_t max_packet_size) {
-    // Since Linux will not reassign the device ID (and dev_name) as long as the
-    // device is open, we can add to the list here once we open it and remove
-    // from the list when we're finally closed and everything will work out
-    // fine.
-    //
-    // If we have a usb_handle on the list of handles with a matching name, we
-    // have no further work to do.
-    {
-        std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-        for (usb_handle* usb: g_usb_handles) {
-            if (usb->path == dev_name) {
-                return;
-            }
-        }
-    }
-
-    D("[ usb located new device %s (%d/%d/%d) ]", dev_name, ep_in, ep_out, interface);
-    std::unique_ptr<usb_handle> usb(new usb_handle);
-    usb->path = dev_name;
-    usb->ep_in = ep_in;
-    usb->ep_out = ep_out;
-    usb->zero_mask = zero_mask;
-    usb->max_packet_size = max_packet_size;
-
-    // Initialize mark so we don't get garbage collected after the device scan.
-    usb->mark = true;
-
-    usb->fd = unix_open(usb->path, O_RDWR | O_CLOEXEC);
-    if (usb->fd == -1) {
-        // Opening RW failed, so see if we have RO access.
-        usb->fd = unix_open(usb->path, O_RDONLY | O_CLOEXEC);
-        if (usb->fd == -1) {
-            D("[ usb open %s failed: %s]", usb->path.c_str(), strerror(errno));
-            return;
-        }
-        usb->writeable = 0;
-    }
-
-    D("[ usb opened %s%s, fd=%d]",
-      usb->path.c_str(), (usb->writeable ? "" : " (read-only)"), usb->fd);
-
-    if (usb->writeable) {
-        if (ioctl(usb->fd, USBDEVFS_CLAIMINTERFACE, &interface) != 0) {
-            D("[ usb ioctl(%d, USBDEVFS_CLAIMINTERFACE) failed: %s]", usb->fd, strerror(errno));
-            return;
-        }
-    }
-
-    // Read the device's serial number.
-    std::string serial_path = android::base::StringPrintf(
-        "/sys/bus/usb/devices/%s/serial", dev_path + 4);
-    std::string serial;
-    if (!android::base::ReadFileToString(serial_path, &serial)) {
-        D("[ usb read %s failed: %s ]", serial_path.c_str(), strerror(errno));
-        // We don't actually want to treat an unknown serial as an error because
-        // devices aren't able to communicate a serial number in early bringup.
-        // http://b/20883914
-        serial = "";
-    }
-    serial = android::base::Trim(serial);
-
-    // Add to the end of the active handles.
-    usb_handle* done_usb = usb.release();
-    {
-        std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-        g_usb_handles.push_back(done_usb);
-    }
-    register_usb_transport(done_usb, serial.c_str(), dev_path, done_usb->writeable);
-}
-
-static void device_poll_thread() {
-    adb_thread_setname("device poll");
-    D("Created device thread");
-    while (true) {
-        // TODO: Use inotify.
-        find_usb_device("/dev/bus/usb", register_device);
-        adb_notify_device_scan_complete();
-        kick_disconnected_devices();
-        std::this_thread::sleep_for(1s);
-    }
-}
-
-void usb_init() {
-    struct sigaction actions;
-    memset(&actions, 0, sizeof(actions));
-    sigemptyset(&actions.sa_mask);
-    actions.sa_flags = 0;
-    actions.sa_handler = [](int) {};
-    sigaction(SIGALRM, &actions, nullptr);
-
-    std::thread(device_poll_thread).detach();
-}
-
-void usb_cleanup() {}
-
-} // namespace native
diff --git a/adb/client/usb_osx.cpp b/adb/client/usb_osx.cpp
deleted file mode 100644
index a93fa3a..0000000
--- a/adb/client/usb_osx.cpp
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG USB
-
-#include "sysdeps.h"
-
-#include "client/usb.h"
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#include <IOKit/IOKitLib.h>
-#include <IOKit/IOCFPlugIn.h>
-#include <IOKit/usb/IOUSBLib.h>
-#include <IOKit/IOMessage.h>
-#include <mach/mach_port.h>
-
-#include <inttypes.h>
-#include <stdio.h>
-
-#include <atomic>
-#include <chrono>
-#include <memory>
-#include <mutex>
-#include <thread>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <android-base/thread_annotations.h>
-
-#include "adb.h"
-#include "transport.h"
-
-using namespace std::chrono_literals;
-
-namespace native {
-struct usb_handle
-{
-    UInt8 bulkIn;
-    UInt8 bulkOut;
-    IOUSBInterfaceInterface550** interface;
-    unsigned int zero_mask;
-    size_t max_packet_size;
-
-    // For garbage collecting disconnected devices.
-    bool mark;
-    std::string devpath;
-    std::atomic<bool> dead;
-
-    usb_handle()
-        : bulkIn(0),
-          bulkOut(0),
-          interface(nullptr),
-          zero_mask(0),
-          max_packet_size(0),
-          mark(false),
-          dead(false) {}
-};
-
-static std::atomic<bool> usb_inited_flag;
-
-static auto& g_usb_handles_mutex = *new std::mutex();
-static auto& g_usb_handles = *new std::vector<std::unique_ptr<usb_handle>>();
-
-static bool IsKnownDevice(const std::string& devpath) {
-    std::lock_guard<std::mutex> lock_guard(g_usb_handles_mutex);
-    for (auto& usb : g_usb_handles) {
-        if (usb->devpath == devpath) {
-            // Set mark flag to indicate this device is still alive.
-            usb->mark = true;
-            return true;
-        }
-    }
-    return false;
-}
-
-static void usb_kick_locked(usb_handle* handle);
-
-static void KickDisconnectedDevices() {
-    std::lock_guard<std::mutex> lock_guard(g_usb_handles_mutex);
-    for (auto& usb : g_usb_handles) {
-        if (!usb->mark) {
-            usb_kick_locked(usb.get());
-        } else {
-            usb->mark = false;
-        }
-    }
-}
-
-static void AddDevice(std::unique_ptr<usb_handle> handle) {
-    handle->mark = true;
-    std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-    g_usb_handles.push_back(std::move(handle));
-}
-
-static void AndroidInterfaceAdded(io_iterator_t iterator);
-static std::unique_ptr<usb_handle> CheckInterface(IOUSBInterfaceInterface550** iface, UInt16 vendor,
-                                                  UInt16 product);
-
-static bool FindUSBDevices() {
-    // Create the matching dictionary to find the Android device's adb interface.
-    CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOUSBInterfaceClassName);
-    if (!matchingDict) {
-        LOG(ERROR) << "couldn't create USB matching dictionary";
-        return false;
-    }
-    // Create an iterator for all I/O Registry objects that match the dictionary.
-    io_iterator_t iter = 0;
-    kern_return_t kr = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter);
-    if (kr != KERN_SUCCESS) {
-        LOG(ERROR) << "failed to get matching services";
-        return false;
-    }
-    // Iterate over all matching objects.
-    AndroidInterfaceAdded(iter);
-    IOObjectRelease(iter);
-    return true;
-}
-
-static void
-AndroidInterfaceAdded(io_iterator_t iterator)
-{
-    kern_return_t            kr;
-    io_service_t             usbDevice;
-    io_service_t             usbInterface;
-    IOCFPlugInInterface      **plugInInterface = NULL;
-    IOUSBInterfaceInterface500  **iface = NULL;
-    IOUSBDeviceInterface500  **dev = NULL;
-    HRESULT                  result;
-    SInt32                   score;
-    uint32_t                 locationId;
-    UInt8                    if_class, subclass, protocol;
-    UInt16                   vendor;
-    UInt16                   product;
-    UInt8                    serialIndex;
-    char                     serial[256];
-    std::string devpath;
-
-    while ((usbInterface = IOIteratorNext(iterator))) {
-        //* Create an intermediate interface plugin
-        kr = IOCreatePlugInInterfaceForService(usbInterface,
-                                               kIOUSBInterfaceUserClientTypeID,
-                                               kIOCFPlugInInterfaceID,
-                                               &plugInInterface, &score);
-        IOObjectRelease(usbInterface);
-        if ((kIOReturnSuccess != kr) || (!plugInInterface)) {
-            LOG(ERROR) << "Unable to create an interface plug-in (" << std::hex << kr << ")";
-            continue;
-        }
-
-        //* This gets us the interface object
-        result = (*plugInInterface)->QueryInterface(
-            plugInInterface,
-            CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID500), (LPVOID*)&iface);
-        //* We only needed the plugin to get the interface, so discard it
-        (*plugInInterface)->Release(plugInInterface);
-        if (result || !iface) {
-            LOG(ERROR) << "Couldn't query the interface (" << std::hex << result << ")";
-            continue;
-        }
-
-        kr = (*iface)->GetInterfaceClass(iface, &if_class);
-        kr = (*iface)->GetInterfaceSubClass(iface, &subclass);
-        kr = (*iface)->GetInterfaceProtocol(iface, &protocol);
-        if (!is_adb_interface(if_class, subclass, protocol)) {
-            // Ignore non-ADB devices.
-            LOG(DEBUG) << "Ignoring interface with incorrect class/subclass/protocol - " << if_class
-                       << ", " << subclass << ", " << protocol;
-            (*iface)->Release(iface);
-            continue;
-        }
-
-        //* this gets us an ioservice, with which we will find the actual
-        //* device; after getting a plugin, and querying the interface, of
-        //* course.
-        //* Gotta love OS X
-        kr = (*iface)->GetDevice(iface, &usbDevice);
-        if (kIOReturnSuccess != kr || !usbDevice) {
-            LOG(ERROR) << "Couldn't grab device from interface (" << std::hex << kr << ")";
-            (*iface)->Release(iface);
-            continue;
-        }
-
-        plugInInterface = NULL;
-        score = 0;
-        //* create an intermediate device plugin
-        kr = IOCreatePlugInInterfaceForService(usbDevice,
-                                               kIOUSBDeviceUserClientTypeID,
-                                               kIOCFPlugInInterfaceID,
-                                               &plugInInterface, &score);
-        //* only needed this to find the plugin
-        (void)IOObjectRelease(usbDevice);
-        if ((kIOReturnSuccess != kr) || (!plugInInterface)) {
-            LOG(ERROR) << "Unable to create a device plug-in (" << std::hex << kr << ")";
-            (*iface)->Release(iface);
-            continue;
-        }
-
-        result = (*plugInInterface)->QueryInterface(plugInInterface,
-            CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID500), (LPVOID*)&dev);
-        //* only needed this to query the plugin
-        (*plugInInterface)->Release(plugInInterface);
-        if (result || !dev) {
-            LOG(ERROR) << "Couldn't create a device interface (" << std::hex << result << ")";
-            (*iface)->Release(iface);
-            continue;
-        }
-
-        //* Now after all that, we actually have a ref to the device and
-        //* the interface that matched our criteria
-        kr = (*dev)->GetDeviceVendor(dev, &vendor);
-        kr = (*dev)->GetDeviceProduct(dev, &product);
-        kr = (*dev)->GetLocationID(dev, &locationId);
-        if (kr == KERN_SUCCESS) {
-            devpath = android::base::StringPrintf("usb:%" PRIu32 "X", locationId);
-            if (IsKnownDevice(devpath)) {
-                (*dev)->Release(dev);
-                (*iface)->Release(iface);
-                continue;
-            }
-        }
-        kr = (*dev)->USBGetSerialNumberStringIndex(dev, &serialIndex);
-
-        if (serialIndex > 0) {
-            IOUSBDevRequest req;
-            UInt16          buffer[256];
-            UInt16          languages[128];
-
-            memset(languages, 0, sizeof(languages));
-
-            req.bmRequestType =
-                    USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
-            req.bRequest = kUSBRqGetDescriptor;
-            req.wValue = (kUSBStringDesc << 8) | 0;
-            req.wIndex = 0;
-            req.pData = languages;
-            req.wLength = sizeof(languages);
-            kr = (*dev)->DeviceRequest(dev, &req);
-
-            if (kr == kIOReturnSuccess && req.wLenDone > 0) {
-
-                int langCount = (req.wLenDone - 2) / 2, lang;
-
-                for (lang = 1; lang <= langCount; lang++) {
-
-                    memset(buffer, 0, sizeof(buffer));
-                    memset(&req, 0, sizeof(req));
-
-                    req.bmRequestType =
-                            USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
-                    req.bRequest = kUSBRqGetDescriptor;
-                    req.wValue = (kUSBStringDesc << 8) | serialIndex;
-                    req.wIndex = languages[lang];
-                    req.pData = buffer;
-                    req.wLength = sizeof(buffer);
-                    kr = (*dev)->DeviceRequest(dev, &req);
-
-                    if (kr == kIOReturnSuccess && req.wLenDone > 0) {
-                        int i, count;
-
-                        // skip first word, and copy the rest to the serial string,
-                        // changing shorts to bytes.
-                        count = (req.wLenDone - 1) / 2;
-                        for (i = 0; i < count; i++)
-                                serial[i] = buffer[i + 1];
-                        serial[i] = 0;
-                        break;
-                    }
-                }
-            }
-        }
-
-        (*dev)->Release(dev);
-
-        VLOG(USB) << android::base::StringPrintf("Found vid=%04x pid=%04x serial=%s\n",
-                        vendor, product, serial);
-        if (devpath.empty()) {
-            devpath = serial;
-        }
-        if (IsKnownDevice(devpath)) {
-            (*iface)->USBInterfaceClose(iface);
-            (*iface)->Release(iface);
-            continue;
-        }
-
-        std::unique_ptr<usb_handle> handle =
-            CheckInterface((IOUSBInterfaceInterface550**)iface, vendor, product);
-        if (handle == nullptr) {
-            LOG(ERROR) << "Could not find device interface";
-            (*iface)->Release(iface);
-            continue;
-        }
-        handle->devpath = devpath;
-        usb_handle* handle_p = handle.get();
-        VLOG(USB) << "Add usb device " << serial;
-        LOG(INFO) << "reported max packet size for " << serial << " is " << handle->max_packet_size;
-        AddDevice(std::move(handle));
-        register_usb_transport(reinterpret_cast<::usb_handle*>(handle_p), serial, devpath.c_str(),
-                               1);
-    }
-}
-
-// Used to clear both the endpoints before starting.
-// When adb quits, we might clear the host endpoint but not the device.
-// So we make sure both sides are clear before starting up.
-static bool ClearPipeStallBothEnds(IOUSBInterfaceInterface550** interface, UInt8 bulkEp) {
-    IOReturn rc = (*interface)->ClearPipeStallBothEnds(interface, bulkEp);
-    if (rc != kIOReturnSuccess) {
-        LOG(ERROR) << "Could not clear pipe stall both ends: " << std::hex << rc;
-        return false;
-    }
-    return true;
-}
-
-//* TODO: simplify this further since we only register to get ADB interface
-//* subclass+protocol events
-static std::unique_ptr<usb_handle> CheckInterface(IOUSBInterfaceInterface550** interface,
-                                                  UInt16 vendor, UInt16 product) {
-    std::unique_ptr<usb_handle> handle;
-    IOReturn kr;
-    UInt8 interfaceNumEndpoints, interfaceClass, interfaceSubClass, interfaceProtocol;
-    UInt8 endpoint;
-
-    //* Now open the interface.  This will cause the pipes associated with
-    //* the endpoints in the interface descriptor to be instantiated
-    kr = (*interface)->USBInterfaceOpen(interface);
-    if (kr != kIOReturnSuccess) {
-        LOG(ERROR) << "Could not open interface: " << std::hex << kr;
-        return NULL;
-    }
-
-    //* Get the number of endpoints associated with this interface
-    kr = (*interface)->GetNumEndpoints(interface, &interfaceNumEndpoints);
-    if (kr != kIOReturnSuccess) {
-        LOG(ERROR) << "Unable to get number of endpoints: " << std::hex << kr;
-        goto err_get_num_ep;
-    }
-
-    //* Get interface class, subclass and protocol
-    if ((*interface)->GetInterfaceClass(interface, &interfaceClass) != kIOReturnSuccess ||
-            (*interface)->GetInterfaceSubClass(interface, &interfaceSubClass) != kIOReturnSuccess ||
-            (*interface)->GetInterfaceProtocol(interface, &interfaceProtocol) != kIOReturnSuccess) {
-            LOG(ERROR) << "Unable to get interface class, subclass and protocol";
-            goto err_get_interface_class;
-    }
-
-    //* check to make sure interface class, subclass and protocol match ADB
-    //* avoid opening mass storage endpoints
-    if (!is_adb_interface(interfaceClass, interfaceSubClass, interfaceProtocol)) {
-        goto err_bad_adb_interface;
-    }
-
-    handle.reset(new usb_handle);
-    if (handle == nullptr) {
-        goto err_bad_adb_interface;
-    }
-
-    //* Iterate over the endpoints for this interface and find the first
-    //* bulk in/out pipes available.  These will be our read/write pipes.
-    for (endpoint = 1; endpoint <= interfaceNumEndpoints; endpoint++) {
-        UInt8   transferType;
-        UInt16  maxPacketSize;
-        UInt8   interval;
-        UInt8   number;
-        UInt8   direction;
-        UInt8 maxBurst;
-        UInt8 mult;
-        UInt16 bytesPerInterval;
-
-        kr = (*interface)
-                 ->GetPipePropertiesV2(interface, endpoint, &direction, &number, &transferType,
-                                       &maxPacketSize, &interval, &maxBurst, &mult,
-                                       &bytesPerInterval);
-        if (kr != kIOReturnSuccess) {
-            LOG(ERROR) << "FindDeviceInterface - could not get pipe properties: "
-                       << std::hex << kr;
-            goto err_get_pipe_props;
-        }
-
-        if (kUSBBulk != transferType) continue;
-
-        if (kUSBIn == direction) {
-            handle->bulkIn = endpoint;
-            if (!ClearPipeStallBothEnds(interface, handle->bulkIn)) goto err_get_pipe_props;
-        }
-
-        if (kUSBOut == direction) {
-            handle->bulkOut = endpoint;
-            if (!ClearPipeStallBothEnds(interface, handle->bulkOut)) goto err_get_pipe_props;
-        }
-
-        if (maxBurst != 0)
-            // bMaxBurst is the number of additional packets in the burst.
-            maxPacketSize /= (maxBurst + 1);
-
-        // mult is only relevant for isochronous endpoints.
-        CHECK_EQ(0, mult);
-
-        handle->zero_mask = maxPacketSize - 1;
-        handle->max_packet_size = maxPacketSize;
-    }
-
-    handle->interface = interface;
-    return handle;
-
-err_get_pipe_props:
-err_bad_adb_interface:
-err_get_interface_class:
-err_get_num_ep:
-    (*interface)->USBInterfaceClose(interface);
-    return nullptr;
-}
-
-std::mutex& operate_device_lock = *new std::mutex();
-
-static void RunLoopThread() {
-    adb_thread_setname("RunLoop");
-
-    VLOG(USB) << "RunLoopThread started";
-    while (true) {
-        {
-            std::lock_guard<std::mutex> lock_guard(operate_device_lock);
-            FindUSBDevices();
-            KickDisconnectedDevices();
-        }
-        // Signal the parent that we are running
-        usb_inited_flag = true;
-        std::this_thread::sleep_for(1s);
-    }
-    VLOG(USB) << "RunLoopThread done";
-}
-
-void usb_cleanup() NO_THREAD_SAFETY_ANALYSIS {
-    VLOG(USB) << "usb_cleanup";
-    // Wait until usb operations in RunLoopThread finish, and prevent further operations.
-    operate_device_lock.lock();
-    close_usb_devices();
-}
-
-void usb_init() {
-    static bool initialized = false;
-    if (!initialized) {
-        usb_inited_flag = false;
-
-        std::thread(RunLoopThread).detach();
-
-        // Wait for initialization to finish
-        while (!usb_inited_flag) {
-            std::this_thread::sleep_for(100ms);
-        }
-
-        adb_notify_device_scan_complete();
-        initialized = true;
-    }
-}
-
-int usb_write(usb_handle *handle, const void *buf, int len)
-{
-    IOReturn    result;
-
-    if (!len)
-        return 0;
-
-    if (!handle || handle->dead)
-        return -1;
-
-    if (NULL == handle->interface) {
-        LOG(ERROR) << "usb_write interface was null";
-        return -1;
-    }
-
-    if (0 == handle->bulkOut) {
-        LOG(ERROR) << "bulkOut endpoint not assigned";
-        return -1;
-    }
-
-    result =
-        (*handle->interface)->WritePipe(handle->interface, handle->bulkOut, (void *)buf, len);
-
-    if ((result == 0) && (handle->zero_mask)) {
-        /* we need 0-markers and our transfer */
-        if(!(len & handle->zero_mask)) {
-            result =
-                (*handle->interface)->WritePipe(
-                        handle->interface, handle->bulkOut, (void *)buf, 0);
-        }
-    }
-
-    if (!result)
-        return len;
-
-    LOG(ERROR) << "usb_write failed with status: " << std::hex << result;
-    return -1;
-}
-
-int usb_read(usb_handle *handle, void *buf, int len)
-{
-    IOReturn result;
-    UInt32  numBytes = len;
-
-    if (!len) {
-        return 0;
-    }
-
-    if (!handle || handle->dead) {
-        return -1;
-    }
-
-    if (NULL == handle->interface) {
-        LOG(ERROR) << "usb_read interface was null";
-        return -1;
-    }
-
-    if (0 == handle->bulkIn) {
-        LOG(ERROR) << "bulkIn endpoint not assigned";
-        return -1;
-    }
-
-    result = (*handle->interface)->ReadPipe(handle->interface, handle->bulkIn, buf, &numBytes);
-
-    if (kIOUSBPipeStalled == result) {
-        LOG(ERROR) << "Pipe stalled, clearing stall.\n";
-        (*handle->interface)->ClearPipeStall(handle->interface, handle->bulkIn);
-        result = (*handle->interface)->ReadPipe(handle->interface, handle->bulkIn, buf, &numBytes);
-    }
-
-    if (kIOReturnSuccess == result)
-        return numBytes;
-    else {
-        LOG(ERROR) << "usb_read failed with status: " << std::hex << result;
-    }
-
-    return -1;
-}
-
-int usb_close(usb_handle *handle)
-{
-    std::lock_guard<std::mutex> lock(g_usb_handles_mutex);
-    for (auto it = g_usb_handles.begin(); it != g_usb_handles.end(); ++it) {
-        if ((*it).get() == handle) {
-            g_usb_handles.erase(it);
-            break;
-        }
-    }
-    return 0;
-}
-
-void usb_reset(usb_handle* handle) {
-    // Unimplemented on OS X.
-    usb_kick(handle);
-}
-
-static void usb_kick_locked(usb_handle *handle)
-{
-    LOG(INFO) << "Kicking handle";
-    /* release the interface */
-    if (!handle)
-        return;
-
-    if (!handle->dead)
-    {
-        handle->dead = true;
-        (*handle->interface)->USBInterfaceClose(handle->interface);
-        (*handle->interface)->Release(handle->interface);
-    }
-}
-
-void usb_kick(usb_handle *handle) {
-    // Use the lock to avoid multiple thread kicking the device at the same time.
-    std::lock_guard<std::mutex> lock_guard(g_usb_handles_mutex);
-    usb_kick_locked(handle);
-}
-
-size_t usb_get_max_packet_size(usb_handle* handle) {
-    return handle->max_packet_size;
-}
-
-} // namespace native
diff --git a/adb/client/usb_windows.cpp b/adb/client/usb_windows.cpp
deleted file mode 100644
index e209230..0000000
--- a/adb/client/usb_windows.cpp
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG USB
-
-#include "sysdeps.h"
-
-#include "client/usb.h"
-
-// clang-format off
-#include <winsock2.h>  // winsock.h *must* be included before windows.h.
-#include <windows.h>
-// clang-format on
-#include <usb100.h>
-#include <winerror.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <algorithm>
-#include <mutex>
-#include <thread>
-
-#include <adb_api.h>
-
-#include <android-base/errors.h>
-
-#include "adb.h"
-#include "sysdeps/chrono.h"
-#include "transport.h"
-
-namespace native {
-
-/** Structure usb_handle describes our connection to the usb device via
-  AdbWinApi.dll. This structure is returned from usb_open() routine and
-  is expected in each subsequent call that is accessing the device.
-
-  Most members are protected by usb_lock, except for adb_{read,write}_pipe which
-  rely on AdbWinApi.dll's handle validation and AdbCloseHandle(endpoint)'s
-  ability to break a thread out of pipe IO.
-*/
-struct usb_handle : public ::usb_handle {
-    /// Handle to USB interface
-    ADBAPIHANDLE adb_interface;
-
-    /// Handle to USB read pipe (endpoint)
-    ADBAPIHANDLE adb_read_pipe;
-
-    /// Handle to USB write pipe (endpoint)
-    ADBAPIHANDLE adb_write_pipe;
-
-    /// Interface name
-    wchar_t* interface_name;
-
-    /// Maximum packet size.
-    unsigned max_packet_size;
-
-    /// Mask for determining when to use zero length packets
-    unsigned zero_mask;
-};
-
-/// Class ID assigned to the device by androidusb.sys
-static const GUID usb_class_id = ANDROID_USB_CLASS_ID;
-
-/// List of opened usb handles
-static std::vector<usb_handle*>& handle_list = *new std::vector<usb_handle*>();
-
-/// Locker for the list of opened usb handles
-static std::mutex& usb_lock = *new std::mutex();
-
-/// Checks if there is opened usb handle in handle_list for this device.
-int known_device(const wchar_t* dev_name);
-
-/// Checks if there is opened usb handle in handle_list for this device.
-/// usb_lock mutex must be held before calling this routine.
-int known_device_locked(const wchar_t* dev_name);
-
-/// Registers opened usb handle (adds it to handle_list).
-int register_new_device(usb_handle* handle);
-
-/// Checks if interface (device) matches certain criteria
-int recognized_device(usb_handle* handle);
-
-/// Enumerates present and available interfaces (devices), opens new ones and
-/// registers usb transport for them.
-void find_devices();
-
-/// Kicks all USB devices
-static void kick_devices();
-
-/// Entry point for thread that polls (every second) for new usb interfaces.
-/// This routine calls find_devices in infinite loop.
-static void device_poll_thread();
-
-/// Initializes this module
-void usb_init();
-
-/// Opens usb interface (device) by interface (device) name.
-usb_handle* do_usb_open(const wchar_t* interface_name);
-
-/// Writes data to the opened usb handle
-int usb_write(usb_handle* handle, const void* data, int len);
-
-/// Reads data using the opened usb handle
-int usb_read(usb_handle* handle, void* data, int len);
-
-/// Cleans up opened usb handle
-void usb_cleanup_handle(usb_handle* handle);
-
-/// Cleans up (but don't close) opened usb handle
-void usb_kick(usb_handle* handle);
-
-/// Closes opened usb handle
-int usb_close(usb_handle* handle);
-
-int known_device_locked(const wchar_t* dev_name) {
-    if (nullptr != dev_name) {
-        // Iterate through the list looking for the name match.
-        for (usb_handle* usb : handle_list) {
-            // In Windows names are not case sensetive!
-            if ((nullptr != usb->interface_name) && (0 == wcsicmp(usb->interface_name, dev_name))) {
-                return 1;
-            }
-        }
-    }
-
-    return 0;
-}
-
-int known_device(const wchar_t* dev_name) {
-    int ret = 0;
-
-    if (nullptr != dev_name) {
-        std::lock_guard<std::mutex> lock(usb_lock);
-        ret = known_device_locked(dev_name);
-    }
-
-    return ret;
-}
-
-int register_new_device(usb_handle* handle) {
-    if (nullptr == handle) return 0;
-
-    std::lock_guard<std::mutex> lock(usb_lock);
-
-    // Check if device is already in the list
-    if (known_device_locked(handle->interface_name)) {
-        return 0;
-    }
-
-    // Not in the list. Add this handle to the list.
-    handle_list.push_back(handle);
-
-    return 1;
-}
-
-void device_poll_thread() {
-    adb_thread_setname("Device Poll");
-    D("Created device thread");
-
-    while (true) {
-        find_devices();
-        adb_notify_device_scan_complete();
-        std::this_thread::sleep_for(1s);
-    }
-}
-
-static LRESULT CALLBACK _power_window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
-    switch (uMsg) {
-        case WM_POWERBROADCAST:
-            switch (wParam) {
-                case PBT_APMRESUMEAUTOMATIC:
-                    // Resuming from sleep or hibernation, so kick all existing USB devices
-                    // and then allow the device_poll_thread to redetect USB devices from
-                    // scratch. If we don't do this, existing USB devices will never respond
-                    // to us because they'll be waiting for the connect/auth handshake.
-                    D("Received (WM_POWERBROADCAST, PBT_APMRESUMEAUTOMATIC) notification, "
-                      "so kicking all USB devices\n");
-                    kick_devices();
-                    return TRUE;
-            }
-    }
-    return DefWindowProcW(hwnd, uMsg, wParam, lParam);
-}
-
-static void _power_notification_thread() {
-    // This uses a thread with its own window message pump to get power
-    // notifications. If adb runs from a non-interactive service account, this
-    // might not work (not sure). If that happens to not work, we could use
-    // heavyweight WMI APIs to get power notifications. But for the common case
-    // of a developer's interactive session, a window message pump is more
-    // appropriate.
-    D("Created power notification thread");
-    adb_thread_setname("Power Notifier");
-
-    // Window class names are process specific.
-    static const WCHAR kPowerNotificationWindowClassName[] = L"PowerNotificationWindow";
-
-    // Get the HINSTANCE corresponding to the module that _power_window_proc
-    // is in (the main module).
-    const HINSTANCE instance = GetModuleHandleW(nullptr);
-    if (!instance) {
-        // This is such a common API call that this should never fail.
-        LOG(FATAL) << "GetModuleHandleW failed: "
-                   << android::base::SystemErrorCodeToString(GetLastError());
-    }
-
-    WNDCLASSEXW wndclass;
-    memset(&wndclass, 0, sizeof(wndclass));
-    wndclass.cbSize = sizeof(wndclass);
-    wndclass.lpfnWndProc = _power_window_proc;
-    wndclass.hInstance = instance;
-    wndclass.lpszClassName = kPowerNotificationWindowClassName;
-    if (!RegisterClassExW(&wndclass)) {
-        LOG(FATAL) << "RegisterClassExW failed: "
-                   << android::base::SystemErrorCodeToString(GetLastError());
-    }
-
-    if (!CreateWindowExW(WS_EX_NOACTIVATE, kPowerNotificationWindowClassName,
-                         L"ADB Power Notification Window", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr,
-                         instance, nullptr)) {
-        LOG(FATAL) << "CreateWindowExW failed: "
-                   << android::base::SystemErrorCodeToString(GetLastError());
-    }
-
-    MSG msg;
-    while (GetMessageW(&msg, nullptr, 0, 0)) {
-        TranslateMessage(&msg);
-        DispatchMessageW(&msg);
-    }
-
-    // GetMessageW() will return false if a quit message is posted. We don't
-    // do that, but it might be possible for that to occur when logging off or
-    // shutting down. Not a big deal since the whole process will be going away
-    // soon anyway.
-    D("Power notification thread exiting");
-}
-
-void usb_init() {
-    std::thread(device_poll_thread).detach();
-    std::thread(_power_notification_thread).detach();
-}
-
-void usb_cleanup() {}
-
-usb_handle* do_usb_open(const wchar_t* interface_name) {
-    unsigned long name_len = 0;
-
-    // Allocate our handle
-    usb_handle* ret = (usb_handle*)calloc(1, sizeof(usb_handle));
-    if (nullptr == ret) {
-        D("Could not allocate %u bytes for usb_handle: %s", sizeof(usb_handle), strerror(errno));
-        goto fail;
-    }
-
-    // Create interface.
-    ret->adb_interface = AdbCreateInterfaceByName(interface_name);
-    if (nullptr == ret->adb_interface) {
-        D("AdbCreateInterfaceByName failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        goto fail;
-    }
-
-    // Open read pipe (endpoint)
-    ret->adb_read_pipe = AdbOpenDefaultBulkReadEndpoint(
-        ret->adb_interface, AdbOpenAccessTypeReadWrite, AdbOpenSharingModeReadWrite);
-    if (nullptr == ret->adb_read_pipe) {
-        D("AdbOpenDefaultBulkReadEndpoint failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        goto fail;
-    }
-
-    // Open write pipe (endpoint)
-    ret->adb_write_pipe = AdbOpenDefaultBulkWriteEndpoint(
-        ret->adb_interface, AdbOpenAccessTypeReadWrite, AdbOpenSharingModeReadWrite);
-    if (nullptr == ret->adb_write_pipe) {
-        D("AdbOpenDefaultBulkWriteEndpoint failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        goto fail;
-    }
-
-    // Save interface name
-    // First get expected name length
-    AdbGetInterfaceName(ret->adb_interface, nullptr, &name_len, false);
-    if (0 == name_len) {
-        D("AdbGetInterfaceName returned name length of zero: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        goto fail;
-    }
-
-    ret->interface_name = (wchar_t*)malloc(name_len * sizeof(ret->interface_name[0]));
-    if (nullptr == ret->interface_name) {
-        D("Could not allocate %lu characters for interface_name: %s", name_len, strerror(errno));
-        goto fail;
-    }
-
-    // Now save the name
-    if (!AdbGetInterfaceName(ret->adb_interface, ret->interface_name, &name_len, false)) {
-        D("AdbGetInterfaceName failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        goto fail;
-    }
-
-    // We're done at this point
-    return ret;
-
-fail:
-    if (nullptr != ret) {
-        usb_cleanup_handle(ret);
-        free(ret);
-    }
-
-    return nullptr;
-}
-
-int usb_write(usb_handle* handle, const void* data, int len) {
-    unsigned long time_out = 5000;
-    unsigned long written = 0;
-    int err = 0;
-
-    D("usb_write %d", len);
-    if (nullptr == handle) {
-        D("usb_write was passed NULL handle");
-        err = EINVAL;
-        goto fail;
-    }
-
-    // Perform write
-    if (!AdbWriteEndpointSync(handle->adb_write_pipe, (void*)data, (unsigned long)len, &written,
-                              time_out)) {
-        D("AdbWriteEndpointSync failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        err = EIO;
-        goto fail;
-    }
-
-    // Make sure that we've written what we were asked to write
-    D("usb_write got: %ld, expected: %d", written, len);
-    if (written != (unsigned long)len) {
-        // If this occurs, this code should be changed to repeatedly call
-        // AdbWriteEndpointSync() until all bytes are written.
-        D("AdbWriteEndpointSync was supposed to write %d, but only wrote %ld", len, written);
-        err = EIO;
-        goto fail;
-    }
-
-    if (handle->zero_mask && (len & handle->zero_mask) == 0) {
-        // Send a zero length packet
-        unsigned long dummy;
-        if (!AdbWriteEndpointSync(handle->adb_write_pipe, (void*)data, 0, &dummy, time_out)) {
-            D("AdbWriteEndpointSync of zero length packet failed: %s",
-              android::base::SystemErrorCodeToString(GetLastError()).c_str());
-            err = EIO;
-            goto fail;
-        }
-    }
-
-    return written;
-
-fail:
-    // Any failure should cause us to kick the device instead of leaving it a
-    // zombie state with potential to hang.
-    if (nullptr != handle) {
-        D("Kicking device due to error in usb_write");
-        usb_kick(handle);
-    }
-
-    D("usb_write failed");
-    errno = err;
-    return -1;
-}
-
-int usb_read(usb_handle* handle, void* data, int len) {
-    unsigned long time_out = 0;
-    unsigned long read = 0;
-    int err = 0;
-    int orig_len = len;
-
-    D("usb_read %d", len);
-    if (nullptr == handle) {
-        D("usb_read was passed NULL handle");
-        err = EINVAL;
-        goto fail;
-    }
-
-    while (len == orig_len) {
-        if (!AdbReadEndpointSync(handle->adb_read_pipe, data, len, &read, time_out)) {
-            D("AdbReadEndpointSync failed: %s",
-              android::base::SystemErrorCodeToString(GetLastError()).c_str());
-            err = EIO;
-            goto fail;
-        }
-        D("usb_read got: %ld, expected: %d", read, len);
-
-        data = (char*)data + read;
-        len -= read;
-    }
-
-    return orig_len - len;
-
-fail:
-    // Any failure should cause us to kick the device instead of leaving it a
-    // zombie state with potential to hang.
-    if (nullptr != handle) {
-        D("Kicking device due to error in usb_read");
-        usb_kick(handle);
-    }
-
-    D("usb_read failed");
-    errno = err;
-    return -1;
-}
-
-// Wrapper around AdbCloseHandle() that logs diagnostics.
-static void _adb_close_handle(ADBAPIHANDLE adb_handle) {
-    if (!AdbCloseHandle(adb_handle)) {
-        D("AdbCloseHandle(%p) failed: %s", adb_handle,
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-    }
-}
-
-void usb_cleanup_handle(usb_handle* handle) {
-    D("usb_cleanup_handle");
-    if (nullptr != handle) {
-        if (nullptr != handle->interface_name) free(handle->interface_name);
-        // AdbCloseHandle(pipe) will break any threads out of pending IO calls and
-        // wait until the pipe no longer uses the interface. Then we can
-        // AdbCloseHandle() the interface.
-        if (nullptr != handle->adb_write_pipe) _adb_close_handle(handle->adb_write_pipe);
-        if (nullptr != handle->adb_read_pipe) _adb_close_handle(handle->adb_read_pipe);
-        if (nullptr != handle->adb_interface) _adb_close_handle(handle->adb_interface);
-
-        handle->interface_name = nullptr;
-        handle->adb_write_pipe = nullptr;
-        handle->adb_read_pipe = nullptr;
-        handle->adb_interface = nullptr;
-    }
-}
-
-void usb_reset(usb_handle* handle) {
-    // Unimplemented on Windows.
-    usb_kick(handle);
-}
-
-static void usb_kick_locked(usb_handle* handle) {
-    // The reason the lock must be acquired before calling this function is in
-    // case multiple threads are trying to kick the same device at the same time.
-    usb_cleanup_handle(handle);
-}
-
-void usb_kick(usb_handle* handle) {
-    D("usb_kick");
-    if (nullptr != handle) {
-        std::lock_guard<std::mutex> lock(usb_lock);
-        usb_kick_locked(handle);
-    } else {
-        errno = EINVAL;
-    }
-}
-
-int usb_close(usb_handle* handle) {
-    D("usb_close");
-
-    if (nullptr != handle) {
-        // Remove handle from the list
-        {
-            std::lock_guard<std::mutex> lock(usb_lock);
-            handle_list.erase(std::remove(handle_list.begin(), handle_list.end(), handle),
-                              handle_list.end());
-        }
-
-        // Cleanup handle
-        usb_cleanup_handle(handle);
-        free(handle);
-    }
-
-    return 0;
-}
-
-size_t usb_get_max_packet_size(usb_handle* handle) {
-    return handle->max_packet_size;
-}
-
-int recognized_device(usb_handle* handle) {
-    if (nullptr == handle) return 0;
-
-    // Check vendor and product id first
-    USB_DEVICE_DESCRIPTOR device_desc;
-
-    if (!AdbGetUsbDeviceDescriptor(handle->adb_interface, &device_desc)) {
-        D("AdbGetUsbDeviceDescriptor failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return 0;
-    }
-
-    // Then check interface properties
-    USB_INTERFACE_DESCRIPTOR interf_desc;
-
-    if (!AdbGetUsbInterfaceDescriptor(handle->adb_interface, &interf_desc)) {
-        D("AdbGetUsbInterfaceDescriptor failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return 0;
-    }
-
-    // Must have two endpoints
-    if (2 != interf_desc.bNumEndpoints) {
-        return 0;
-    }
-
-    if (!is_adb_interface(interf_desc.bInterfaceClass, interf_desc.bInterfaceSubClass,
-                          interf_desc.bInterfaceProtocol)) {
-        return 0;
-    }
-
-    AdbEndpointInformation endpoint_info;
-    // assuming zero is a valid bulk endpoint ID
-    if (AdbGetEndpointInformation(handle->adb_interface, 0, &endpoint_info)) {
-        handle->max_packet_size = endpoint_info.max_packet_size;
-        handle->zero_mask = endpoint_info.max_packet_size - 1;
-        D("device zero_mask: 0x%x", handle->zero_mask);
-    } else {
-        D("AdbGetEndpointInformation failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-    }
-
-    return 1;
-}
-
-void find_devices() {
-    usb_handle* handle = nullptr;
-    char entry_buffer[2048];
-    AdbInterfaceInfo* next_interface = (AdbInterfaceInfo*)(&entry_buffer[0]);
-    unsigned long entry_buffer_size = sizeof(entry_buffer);
-
-    // Enumerate all present and active interfaces.
-    ADBAPIHANDLE enum_handle = AdbEnumInterfaces(usb_class_id, true, true, true);
-
-    if (nullptr == enum_handle) {
-        D("AdbEnumInterfaces failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        return;
-    }
-
-    while (AdbNextInterface(enum_handle, next_interface, &entry_buffer_size)) {
-        // Lets see if we already have this device in the list
-        if (!known_device(next_interface->device_name)) {
-            // This seems to be a new device. Open it!
-            handle = do_usb_open(next_interface->device_name);
-            if (nullptr != handle) {
-                // Lets see if this interface (device) belongs to us
-                if (recognized_device(handle)) {
-                    D("adding a new device %ls", next_interface->device_name);
-
-                    // We don't request a wchar_t string from AdbGetSerialNumber() because of a bug
-                    // in adb_winusb_interface.cpp:CopyMemory(buffer, ser_num->bString,
-                    // bytes_written) where the last parameter should be (str_len *
-                    // sizeof(wchar_t)). The bug reads 2 bytes past the end of a stack buffer in the
-                    // best case, and in the unlikely case of a long serial number, it will read 2
-                    // bytes past the end of a heap allocation. This doesn't affect the resulting
-                    // string, but we should avoid the bad reads in the first place.
-                    char serial_number[512];
-                    unsigned long serial_number_len = sizeof(serial_number);
-                    if (AdbGetSerialNumber(handle->adb_interface, serial_number, &serial_number_len,
-                                           true)) {
-                        // Lets make sure that we don't duplicate this device
-                        if (register_new_device(handle)) {
-                            register_usb_transport(handle, serial_number, nullptr, 1);
-                        } else {
-                            D("register_new_device failed for %ls", next_interface->device_name);
-                            usb_cleanup_handle(handle);
-                            free(handle);
-                        }
-                    } else {
-                        D("cannot get serial number: %s",
-                          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-                        usb_cleanup_handle(handle);
-                        free(handle);
-                    }
-                } else {
-                    usb_cleanup_handle(handle);
-                    free(handle);
-                }
-            }
-        }
-
-        entry_buffer_size = sizeof(entry_buffer);
-    }
-
-    if (GetLastError() != ERROR_NO_MORE_ITEMS) {
-        // Only ERROR_NO_MORE_ITEMS is expected at the end of enumeration.
-        D("AdbNextInterface failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-    }
-
-    _adb_close_handle(enum_handle);
-}
-
-static void kick_devices() {
-    // Need to acquire lock to safely walk the list which might be modified
-    // by another thread.
-    std::lock_guard<std::mutex> lock(usb_lock);
-    for (usb_handle* usb : handle_list) {
-        usb_kick_locked(usb);
-    }
-}
-
-}  // namespace native
diff --git a/adb/crypto/Android.bp b/adb/crypto/Android.bp
deleted file mode 100644
index 9d14b03..0000000
--- a/adb/crypto/Android.bp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2019 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.
-
-cc_defaults {
-    name: "libadb_crypto_defaults",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Wthread-safety",
-        "-Werror",
-    ],
-
-    compile_multilib: "both",
-
-    srcs: [
-        "key.cpp",
-        "rsa_2048_key.cpp",
-        "x509_generator.cpp",
-    ],
-
-    target: {
-        windows: {
-            compile_multilib: "first",
-            enabled: true,
-        },
-    },
-
-    export_include_dirs: ["include"],
-
-    visibility: [
-        "//system/core/adb:__subpackages__",
-        "//bootable/recovery/minadbd:__subpackages__",
-    ],
-
-    host_supported: true,
-    recovery_available: true,
-
-    shared_libs: [
-        "libadb_protos",
-        "libbase",
-        "liblog",
-        "libcrypto",
-        "libcrypto_utils",
-    ],
-}
-
-cc_library {
-    name: "libadb_crypto",
-    defaults: ["libadb_crypto_defaults"],
-
-    apex_available: [
-        "com.android.adbd",
-        "test_com.android.adbd",
-    ],
-}
-
-// For running atest (b/147158681)
-cc_library_static {
-    name: "libadb_crypto_static",
-    defaults: ["libadb_crypto_defaults"],
-
-    apex_available: [
-        "//apex_available:platform",
-    ],
-
-    static_libs: [
-        "libadb_protos_static",
-    ],
-}
diff --git a/adb/crypto/include/adb/crypto/key.h b/adb/crypto/include/adb/crypto/key.h
deleted file mode 100644
index d9ce69e..0000000
--- a/adb/crypto/include/adb/crypto/key.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <string>
-
-#include <openssl/evp.h>
-
-#include "key_type.pb.h"
-
-namespace adb {
-namespace crypto {
-
-// Class that represents a public/private key pair.
-class Key {
-  public:
-    explicit Key(bssl::UniquePtr<EVP_PKEY>&& pkey, adb::proto::KeyType type)
-        : pkey_(std::move(pkey)), key_type_(type) {}
-    Key(Key&&) = default;
-    Key& operator=(Key&&) = default;
-
-    EVP_PKEY* GetEvpPkey() const { return pkey_.get(); }
-    adb::proto::KeyType GetKeyType() const { return key_type_; }
-    static std::string ToPEMString(EVP_PKEY* pkey);
-
-  private:
-    bssl::UniquePtr<EVP_PKEY> pkey_;
-    adb::proto::KeyType key_type_;
-};  // Key
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/include/adb/crypto/rsa_2048_key.h b/adb/crypto/include/adb/crypto/rsa_2048_key.h
deleted file mode 100644
index 2983a84..0000000
--- a/adb/crypto/include/adb/crypto/rsa_2048_key.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <memory>
-#include <optional>
-
-#include "adb/crypto/key.h"
-
-namespace adb {
-namespace crypto {
-
-// Create a new RSA2048 key pair.
-std::optional<Key> CreateRSA2048Key();
-
-// Generates the public key from the RSA private key.
-bool CalculatePublicKey(std::string* out, RSA* private_key);
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/include/adb/crypto/x509_generator.h b/adb/crypto/include/adb/crypto/x509_generator.h
deleted file mode 100644
index a269243..0000000
--- a/adb/crypto/include/adb/crypto/x509_generator.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <openssl/x509v3.h>
-
-namespace adb {
-namespace crypto {
-
-// Generate a X.509 certificate based on the key |pkey|.
-bssl::UniquePtr<X509> GenerateX509Certificate(EVP_PKEY* pkey);
-
-// Convert X509* to PEM string format
-std::string X509ToPEMString(X509* x509);
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/key.cpp b/adb/crypto/key.cpp
deleted file mode 100644
index 4d87006..0000000
--- a/adb/crypto/key.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adb/crypto/key.h"
-
-#include <android-base/logging.h>
-#include <openssl/bn.h>
-#include <openssl/pem.h>
-#include <openssl/rsa.h>
-
-namespace adb {
-namespace crypto {
-
-// static
-std::string Key::ToPEMString(EVP_PKEY* pkey) {
-    bssl::UniquePtr<BIO> bio(BIO_new(BIO_s_mem()));
-    int rc = PEM_write_bio_PKCS8PrivateKey(bio.get(), pkey, nullptr, nullptr, 0, nullptr, nullptr);
-    if (rc != 1) {
-        LOG(ERROR) << "PEM_write_bio_PKCS8PrivateKey failed";
-        return "";
-    }
-
-    BUF_MEM* mem = nullptr;
-    BIO_get_mem_ptr(bio.get(), &mem);
-    if (!mem || !mem->data || !mem->length) {
-        LOG(ERROR) << "BIO_get_mem_ptr failed";
-        return "";
-    }
-
-    return std::string(mem->data, mem->length);
-}
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/rsa_2048_key.cpp b/adb/crypto/rsa_2048_key.cpp
deleted file mode 100644
index 7911af9..0000000
--- a/adb/crypto/rsa_2048_key.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adb/crypto/rsa_2048_key.h"
-
-#include <android-base/logging.h>
-#include <crypto_utils/android_pubkey.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-
-namespace adb {
-namespace crypto {
-
-namespace {
-std::string get_user_info() {
-    std::string hostname;
-    if (getenv("HOSTNAME")) hostname = getenv("HOSTNAME");
-#if !defined(_WIN32)
-    char buf[64];
-    if (hostname.empty() && gethostname(buf, sizeof(buf)) != -1) hostname = buf;
-#endif
-    if (hostname.empty()) hostname = "unknown";
-
-    std::string username;
-    if (getenv("LOGNAME")) username = getenv("LOGNAME");
-#if !defined(_WIN32)
-    if (username.empty() && getlogin()) username = getlogin();
-#endif
-    if (username.empty()) hostname = "unknown";
-
-    return " " + username + "@" + hostname;
-}
-
-}  // namespace
-
-bool CalculatePublicKey(std::string* out, RSA* private_key) {
-    uint8_t binary_key_data[ANDROID_PUBKEY_ENCODED_SIZE];
-    if (!android_pubkey_encode(private_key, binary_key_data, sizeof(binary_key_data))) {
-        LOG(ERROR) << "Failed to convert to public key";
-        return false;
-    }
-
-    size_t expected_length;
-    if (!EVP_EncodedLength(&expected_length, sizeof(binary_key_data))) {
-        LOG(ERROR) << "Public key too large to base64 encode";
-        return false;
-    }
-
-    out->resize(expected_length);
-    size_t actual_length = EVP_EncodeBlock(reinterpret_cast<uint8_t*>(out->data()), binary_key_data,
-                                           sizeof(binary_key_data));
-    out->resize(actual_length);
-    out->append(get_user_info());
-    return true;
-}
-
-std::optional<Key> CreateRSA2048Key() {
-    bssl::UniquePtr<EVP_PKEY> pkey(EVP_PKEY_new());
-    bssl::UniquePtr<BIGNUM> exponent(BN_new());
-    bssl::UniquePtr<RSA> rsa(RSA_new());
-    if (!pkey || !exponent || !rsa) {
-        LOG(ERROR) << "Failed to allocate key";
-        return std::nullopt;
-    }
-
-    BN_set_word(exponent.get(), RSA_F4);
-    RSA_generate_key_ex(rsa.get(), 2048, exponent.get(), nullptr);
-    EVP_PKEY_set1_RSA(pkey.get(), rsa.get());
-
-    return std::optional<Key>{Key(std::move(pkey), adb::proto::KeyType::RSA_2048)};
-}
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/tests/Android.bp b/adb/crypto/tests/Android.bp
deleted file mode 100644
index b32dcf7..0000000
--- a/adb/crypto/tests/Android.bp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright (C) 2019 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.
-//
-
-cc_test {
-    name: "adb_crypto_test",
-    srcs: [
-        "rsa_2048_key_test.cpp",
-        "x509_generator_test.cpp",
-    ],
-
-    compile_multilib: "first",
-
-    shared_libs: [
-        "libbase",
-        "libcrypto",
-        "libcrypto_utils",
-        "libprotobuf-cpp-lite",
-    ],
-
-    // Let's statically link them so we don't have to install it onto the
-    // system image for testing.
-    static_libs: [
-        "libadb_crypto_static",
-        "libadb_protos_static",
-    ],
-
-    test_suites: ["device-tests"],
-}
diff --git a/adb/crypto/tests/key_test.cpp b/adb/crypto/tests/key_test.cpp
deleted file mode 100644
index 1feb6e8..0000000
--- a/adb/crypto/tests/key_test.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <resolv.h>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <crypto_utils/android_pubkey.h>
-#include <openssl/err.h>
-#include <openssl/rsa.h>
-#include <openssl/sha.h>
-
-namespace adb {
-namespace crypto {
-
-TEST(RSA2048Key, Smoke) {
-    auto rsa_2048 = CreateRSA2048Key();
-    EXPECT_NE(rsa_2048, std::nullopt);
-    EXPECT_EQ(rsa_2048->GetKeyType(), adb::proto::KeyType::RSA_2048);
-    ASSERT_NE(rsa_2048->GetEvpPkey(), nullptr);
-
-    // The public key string format is expected to be: "<pub_key> <host_name>"
-    std::string pub_key_plus_name;
-    auto* rsa = EVP_PKEY_get0_RSA(rsa_2048->GetEvpPkey());
-    ASSERT_TRUE(CalculatePublicKey(&pub_key_plus_name, rsa));
-    std::vector<std::string> split = android::base::Split(std::string(pub_key_plus_name), " \t");
-    EXPECT_EQ(split.size(), 2);
-
-    LOG(INFO) << "pub_key=[" << pub_key_plus_name << "]";
-
-    // Try to sign something and decode it.
-    const char token[SHA_DIGEST_LENGTH] = "abcdefghij123456789";
-    std::vector<uint8_t> sig(RSA_size(rsa));
-    unsigned sig_len;
-    EXPECT_EQ(RSA_sign(NID_sha1, reinterpret_cast<const uint8_t*>(token), sizeof(token), sig.data(),
-                       &sig_len, rsa),
-              1);
-    sig.resize(sig_len);
-
-    {
-        uint8_t keybuf[ANDROID_PUBKEY_ENCODED_SIZE + 1];
-        const std::string& pubkey = split[0];
-        ASSERT_EQ(b64_pton(pubkey.c_str(), keybuf, sizeof(keybuf)), ANDROID_PUBKEY_ENCODED_SIZE);
-        RSA* key = nullptr;
-        ASSERT_TRUE(android_pubkey_decode(keybuf, ANDROID_PUBKEY_ENCODED_SIZE, &key));
-        EXPECT_EQ(RSA_verify(NID_sha1, reinterpret_cast<const uint8_t*>(token), sizeof(token),
-                             sig.data(), sig.size(), key),
-                  1);
-        RSA_free(key);
-    }
-}
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/tests/rsa_2048_key_test.cpp b/adb/crypto/tests/rsa_2048_key_test.cpp
deleted file mode 100644
index 1d8880e..0000000
--- a/adb/crypto/tests/rsa_2048_key_test.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <resolv.h>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <crypto_utils/android_pubkey.h>
-#include <openssl/err.h>
-#include <openssl/rsa.h>
-#include <openssl/sha.h>
-
-namespace adb {
-namespace crypto {
-
-TEST(RSA2048Key, Smoke) {
-    auto rsa_2048 = CreateRSA2048Key();
-    EXPECT_NE(rsa_2048, std::nullopt);
-    EXPECT_EQ(rsa_2048->GetKeyType(), adb::proto::KeyType::RSA_2048);
-    ASSERT_NE(rsa_2048->GetEvpPkey(), nullptr);
-
-    // The public key string format is expected to be: "<pub_key> <host_name>"
-    std::string pub_key_plus_name;
-    auto* rsa = EVP_PKEY_get0_RSA(rsa_2048->GetEvpPkey());
-    ASSERT_TRUE(CalculatePublicKey(&pub_key_plus_name, rsa));
-    std::vector<std::string> split = android::base::Split(std::string(pub_key_plus_name), " \t");
-    EXPECT_EQ(split.size(), 2);
-
-    LOG(INFO) << "pub_key=[" << pub_key_plus_name << "]";
-
-    std::string pemString = Key::ToPEMString(rsa_2048->GetEvpPkey());
-    ASSERT_FALSE(pemString.empty());
-
-    // Try to sign something and decode it.
-    const char token[SHA_DIGEST_LENGTH] = "abcdefghij123456789";
-    std::vector<uint8_t> sig(RSA_size(rsa));
-    unsigned sig_len;
-    EXPECT_EQ(RSA_sign(NID_sha1, reinterpret_cast<const uint8_t*>(token), sizeof(token), sig.data(),
-                       &sig_len, rsa),
-              1);
-    sig.resize(sig_len);
-
-    {
-        uint8_t keybuf[ANDROID_PUBKEY_ENCODED_SIZE + 1];
-        const std::string& pubkey = split[0];
-        ASSERT_EQ(b64_pton(pubkey.c_str(), keybuf, sizeof(keybuf)), ANDROID_PUBKEY_ENCODED_SIZE);
-        RSA* key = nullptr;
-        ASSERT_TRUE(android_pubkey_decode(keybuf, ANDROID_PUBKEY_ENCODED_SIZE, &key));
-        EXPECT_EQ(RSA_verify(NID_sha1, reinterpret_cast<const uint8_t*>(token), sizeof(token),
-                             sig.data(), sig.size(), key),
-                  1);
-        RSA_free(key);
-    }
-}
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/tests/x509_generator_test.cpp b/adb/crypto/tests/x509_generator_test.cpp
deleted file mode 100644
index 281776b..0000000
--- a/adb/crypto/tests/x509_generator_test.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <adb/crypto/x509_generator.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-
-namespace adb {
-namespace crypto {
-
-TEST(X509Generator, Smoke) {
-    auto rsa_2048 = CreateRSA2048Key();
-
-    std::string pub_key_plus_name;
-    auto* rsa = EVP_PKEY_get0_RSA(rsa_2048->GetEvpPkey());
-    ASSERT_TRUE(CalculatePublicKey(&pub_key_plus_name, rsa));
-    std::vector<std::string> split = android::base::Split(std::string(pub_key_plus_name), " \t");
-    EXPECT_EQ(split.size(), 2);
-
-    LOG(INFO) << "pub_key=[" << pub_key_plus_name << "]";
-    auto x509_cert = GenerateX509Certificate(rsa_2048->GetEvpPkey());
-    ASSERT_NE(x509_cert.get(), nullptr);
-
-    std::string x509_str = X509ToPEMString(x509_cert.get());
-    ASSERT_FALSE(x509_str.empty());
-}
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/crypto/x509_generator.cpp b/adb/crypto/x509_generator.cpp
deleted file mode 100644
index 43b8153..0000000
--- a/adb/crypto/x509_generator.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adb/crypto/x509_generator.h"
-
-#include <vector>
-
-#include <android-base/logging.h>
-#include <crypto_utils/android_pubkey.h>
-#include <openssl/bn.h>
-#include <openssl/pem.h>
-#include <openssl/rsa.h>
-
-namespace adb {
-namespace crypto {
-
-namespace {
-
-const char kBasicConstraints[] = "critical,CA:TRUE";
-const char kKeyUsage[] = "critical,keyCertSign,cRLSign,digitalSignature";
-const char kSubjectKeyIdentifier[] = "hash";
-constexpr int kCertLifetimeSeconds = 10 * 365 * 24 * 60 * 60;
-
-bool add_ext(X509* cert, int nid, const char* value) {
-    size_t len = strlen(value) + 1;
-    std::vector<char> mutableValue(value, value + len);
-    X509V3_CTX context;
-
-    X509V3_set_ctx_nodb(&context);
-
-    X509V3_set_ctx(&context, cert, cert, nullptr, nullptr, 0);
-    X509_EXTENSION* ex = X509V3_EXT_nconf_nid(nullptr, &context, nid, mutableValue.data());
-    if (!ex) {
-        return false;
-    }
-
-    X509_add_ext(cert, ex, -1);
-    X509_EXTENSION_free(ex);
-    return true;
-}
-
-}  // namespace
-
-bssl::UniquePtr<X509> GenerateX509Certificate(EVP_PKEY* pkey) {
-    CHECK(pkey);
-    bssl::UniquePtr<X509> x509(X509_new());
-    if (!x509) {
-        LOG(ERROR) << "Unable to allocate x509 container";
-        return nullptr;
-    }
-    X509_set_version(x509.get(), 2);
-
-    ASN1_INTEGER_set(X509_get_serialNumber(x509.get()), 1);
-    X509_gmtime_adj(X509_get_notBefore(x509.get()), 0);
-    X509_gmtime_adj(X509_get_notAfter(x509.get()), kCertLifetimeSeconds);
-
-    if (!X509_set_pubkey(x509.get(), pkey)) {
-        LOG(ERROR) << "Unable to set x509 public key";
-        return nullptr;
-    }
-
-    X509_NAME* name = X509_get_subject_name(x509.get());
-    if (!name) {
-        LOG(ERROR) << "Unable to get x509 subject name";
-        return nullptr;
-    }
-    X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC,
-                               reinterpret_cast<const unsigned char*>("US"), -1, -1, 0);
-    X509_NAME_add_entry_by_txt(name, "O", MBSTRING_ASC,
-                               reinterpret_cast<const unsigned char*>("Android"), -1, -1, 0);
-    X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC,
-                               reinterpret_cast<const unsigned char*>("Adb"), -1, -1, 0);
-    if (!X509_set_issuer_name(x509.get(), name)) {
-        LOG(ERROR) << "Unable to set x509 issuer name";
-        return nullptr;
-    }
-
-    add_ext(x509.get(), NID_basic_constraints, kBasicConstraints);
-    add_ext(x509.get(), NID_key_usage, kKeyUsage);
-    add_ext(x509.get(), NID_subject_key_identifier, kSubjectKeyIdentifier);
-
-    int bytes = X509_sign(x509.get(), pkey, EVP_sha256());
-    if (bytes <= 0) {
-        LOG(ERROR) << "Unable to sign x509 certificate";
-        return nullptr;
-    }
-
-    return x509;
-}
-
-std::string X509ToPEMString(X509* x509) {
-    bssl::UniquePtr<BIO> bio(BIO_new(BIO_s_mem()));
-    int rc = PEM_write_bio_X509(bio.get(), x509);
-    if (rc != 1) {
-        LOG(ERROR) << "PEM_write_bio_X509 failed";
-        return "";
-    }
-
-    BUF_MEM* mem = nullptr;
-    BIO_get_mem_ptr(bio.get(), &mem);
-    if (!mem || !mem->data || !mem->length) {
-        LOG(ERROR) << "BIO_get_mem_ptr failed";
-        return "";
-    }
-
-    return std::string(mem->data, mem->length);
-}
-
-}  // namespace crypto
-}  // namespace adb
diff --git a/adb/daemon/abb.cpp b/adb/daemon/abb.cpp
deleted file mode 100644
index 17c25e8..0000000
--- a/adb/daemon/abb.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <sys/wait.h>
-
-#include <android-base/cmsg.h>
-#include <android-base/strings.h>
-#include <cmd.h>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_utils.h"
-#include "shell_service.h"
-#include "sysdeps.h"
-
-namespace {
-
-class AdbFdTextOutput : public android::TextOutput {
-  public:
-    explicit AdbFdTextOutput(borrowed_fd fd) : fd_(fd) {}
-
-  private:
-    android::status_t print(const char* txt, size_t len) override {
-        return WriteFdExactly(fd_, txt, len) ? android::OK : -errno;
-    }
-    void moveIndent(int delta) override { /*not implemented*/
-    }
-
-    void pushBundle() override { /*not implemented*/
-    }
-    void popBundle() override { /*not implemented*/
-    }
-
-  private:
-    borrowed_fd fd_;
-};
-
-std::vector<std::string_view> parseCmdArgs(std::string_view args) {
-    std::vector<std::string_view> argv;
-
-    char delim = ABB_ARG_DELIMETER;
-    size_t size = args.size();
-    size_t base = 0;
-    while (base < size) {
-        size_t found;
-        for (found = base; found < size && args[found] && args[found] != delim; ++found)
-            ;
-        if (found > base) {
-            argv.emplace_back(args.substr(base, found - base));
-        }
-        base = found + 1;
-    }
-
-    return argv;
-}
-
-}  // namespace
-
-static int execCmd(std::string_view args, borrowed_fd in, borrowed_fd out, borrowed_fd err) {
-    int max_buf = LINUX_MAX_SOCKET_SIZE;
-    adb_setsockopt(in, SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
-    adb_setsockopt(out, SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
-    adb_setsockopt(err, SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
-
-    AdbFdTextOutput oin(out);
-    AdbFdTextOutput oerr(err);
-    return cmdMain(parseCmdArgs(args), oin, oerr, in.get(), out.get(), err.get(),
-                   RunMode::kLibrary);
-}
-
-int main(int argc, char* const argv[]) {
-    signal(SIGPIPE, SIG_IGN);
-
-    int fd = STDIN_FILENO;
-    std::string data;
-    while (true) {
-        std::string error;
-        if (!ReadProtocolString(fd, &data, &error)) {
-            PLOG(ERROR) << "Failed to read message: " << error;
-            break;
-        }
-
-        std::string_view name = data;
-        auto protocol = SubprocessProtocol::kShell;
-        if (android::base::ConsumePrefix(&name, "abb:")) {
-            protocol = SubprocessProtocol::kShell;
-        } else if (android::base::ConsumePrefix(&name, "abb_exec:")) {
-            protocol = SubprocessProtocol::kNone;
-        } else {
-            LOG(FATAL) << "Unknown command prefix for abb: " << data;
-        }
-
-        unique_fd result = StartCommandInProcess(std::string(name), &execCmd, protocol);
-        int max_buf = LINUX_MAX_SOCKET_SIZE;
-        adb_setsockopt(result, SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
-        if (android::base::SendFileDescriptors(fd, "", 1, result.get()) != 1) {
-            PLOG(ERROR) << "Failed to send an inprocess fd for command: " << data;
-            break;
-        }
-    }
-}
diff --git a/adb/daemon/abb_service.cpp b/adb/daemon/abb_service.cpp
deleted file mode 100644
index e1df4a5..0000000
--- a/adb/daemon/abb_service.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "shell_service.h"
-
-#include <android-base/cmsg.h>
-
-namespace {
-
-struct AbbProcess;
-static auto& abbp = *new std::unique_ptr<AbbProcess>(std::make_unique<AbbProcess>());
-
-struct AbbProcess {
-    unique_fd sendCommand(std::string_view command);
-
-  private:
-    static unique_fd startAbbProcess(unique_fd* error_fd);
-
-    static constexpr auto kRetries = 2;
-    static constexpr auto kErrorProtocol = SubprocessProtocol::kShell;
-
-    std::mutex locker_;
-    unique_fd socket_fd_;
-};
-
-unique_fd AbbProcess::sendCommand(std::string_view command) {
-    std::unique_lock lock{locker_};
-
-    for (int i = 0; i < kRetries; ++i) {
-        unique_fd error_fd;
-        if (socket_fd_ == -1) {
-            socket_fd_ = startAbbProcess(&error_fd);
-        }
-        if (socket_fd_ == -1) {
-            LOG(ERROR) << "failed to start abb process";
-            return error_fd;
-        }
-
-        if (!SendProtocolString(socket_fd_, command)) {
-            PLOG(ERROR) << "failed to send command to abb";
-            socket_fd_.reset();
-            continue;
-        }
-
-        unique_fd fd;
-        char buf;
-        if (android::base::ReceiveFileDescriptors(socket_fd_, &buf, 1, &fd) != 1) {
-            PLOG(ERROR) << "failed to receive FD from abb";
-            socket_fd_.reset();
-            continue;
-        }
-
-        return fd;
-    }
-
-    LOG(ERROR) << "abb is unavailable";
-    socket_fd_.reset();
-    return ReportError(kErrorProtocol, "abb is unavailable");
-}
-
-unique_fd AbbProcess::startAbbProcess(unique_fd* error_fd) {
-    constexpr auto abb_process_type = SubprocessType::kRaw;
-    constexpr auto abb_protocol = SubprocessProtocol::kNone;
-    constexpr auto make_pty_raw = false;
-    return StartSubprocess("abb", "dumb", abb_process_type, abb_protocol, make_pty_raw,
-                           kErrorProtocol, error_fd);
-}
-
-}  // namespace
-
-unique_fd execute_abb_command(std::string_view command) {
-    return abbp->sendCommand(command);
-}
diff --git a/adb/daemon/adb_wifi.cpp b/adb/daemon/adb_wifi.cpp
deleted file mode 100644
index 2f9e9b4..0000000
--- a/adb/daemon/adb_wifi.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#if !ADB_HOST
-
-#define TRACE_TAG ADB_WIRELESS
-
-#include "adb_wifi.h"
-
-#include <unistd.h>
-#include <optional>
-
-#include <adbd_auth.h>
-#include <android-base/properties.h>
-
-#include "adb.h"
-#include "daemon/mdns.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-using namespace android::base;
-
-namespace {
-
-static AdbdAuthContext* auth_ctx;
-
-static void adb_disconnected(void* unused, atransport* t);
-static struct adisconnect adb_disconnect = {adb_disconnected, nullptr};
-
-static void adb_disconnected(void* unused, atransport* t) {
-    LOG(INFO) << "ADB wifi device disconnected";
-    CHECK(t->auth_id.has_value());
-    adbd_auth_tls_device_disconnected(auth_ctx, kAdbTransportTypeWifi, t->auth_id.value());
-}
-
-// TODO(b/31559095): need bionic host so that we can use 'prop_info' returned
-// from WaitForProperty
-#if defined(__ANDROID__)
-
-class TlsServer {
-  public:
-    explicit TlsServer(int port);
-    virtual ~TlsServer();
-    bool Start();
-    uint16_t port() { return port_; };
-
-  private:
-    void OnFdEvent(int fd, unsigned ev);
-    static void StaticOnFdEvent(int fd, unsigned ev, void* opaque);
-
-    fdevent* fd_event_ = nullptr;
-    uint16_t port_;
-};  // TlsServer
-
-TlsServer::TlsServer(int port) : port_(port) {}
-
-TlsServer::~TlsServer() {
-    fdevent* fde = fd_event_;
-    fdevent_run_on_main_thread([fde]() {
-        if (fde != nullptr) {
-            fdevent_destroy(fde);
-        }
-    });
-}
-
-bool TlsServer::Start() {
-    std::condition_variable cv;
-    std::mutex mutex;
-    std::optional<bool> success;
-    auto callback = [&](bool result) {
-        {
-            std::lock_guard<std::mutex> lock(mutex);
-            success = result;
-        }
-        cv.notify_one();
-    };
-
-    std::string err;
-    unique_fd fd(network_inaddr_any_server(port_, SOCK_STREAM, &err));
-    if (fd.get() == -1) {
-        LOG(ERROR) << "Failed to start TLS server [" << err << "]";
-        return false;
-    }
-    close_on_exec(fd.get());
-    int port = socket_get_local_port(fd.get());
-    if (port <= 0 || port > 65535) {
-        LOG(ERROR) << "Invalid port for tls server";
-        return false;
-    }
-    port_ = static_cast<uint16_t>(port);
-    LOG(INFO) << "adbwifi started on port " << port_;
-
-    std::unique_lock<std::mutex> lock(mutex);
-    fdevent_run_on_main_thread([&]() {
-        fd_event_ = fdevent_create(fd.release(), &TlsServer::StaticOnFdEvent, this);
-        if (fd_event_ == nullptr) {
-            LOG(ERROR) << "Failed to create fd event for TlsServer.";
-            callback(false);
-            return;
-        }
-        callback(true);
-    });
-
-    cv.wait(lock, [&]() { return success.has_value(); });
-    if (!*success) {
-        LOG(INFO) << "TlsServer fdevent_create failed";
-        return false;
-    }
-    fdevent_set(fd_event_, FDE_READ);
-    LOG(INFO) << "TlsServer running on port " << port_;
-
-    return *success;
-}
-
-// static
-void TlsServer::StaticOnFdEvent(int fd, unsigned ev, void* opaque) {
-    auto server = reinterpret_cast<TlsServer*>(opaque);
-    server->OnFdEvent(fd, ev);
-}
-
-void TlsServer::OnFdEvent(int fd, unsigned ev) {
-    if ((ev & FDE_READ) == 0 || fd != fd_event_->fd.get()) {
-        LOG(INFO) << __func__ << ": No read [ev=" << ev << " fd=" << fd << "]";
-        return;
-    }
-
-    unique_fd new_fd(adb_socket_accept(fd, nullptr, nullptr));
-    if (new_fd >= 0) {
-        LOG(INFO) << "New TLS connection [fd=" << new_fd.get() << "]";
-        close_on_exec(new_fd.get());
-        disable_tcp_nagle(new_fd.get());
-        std::string serial = android::base::StringPrintf("host-%d", new_fd.get());
-        register_socket_transport(
-                std::move(new_fd), std::move(serial), port_, 1,
-                [](atransport*) { return ReconnectResult::Abort; }, true);
-    }
-}
-
-TlsServer* sTlsServer = nullptr;
-const char kWifiPortProp[] = "service.adb.tls.port";
-
-const char kWifiEnabledProp[] = "persist.adb.tls_server.enable";
-
-static void enable_wifi_debugging() {
-    start_mdnsd();
-
-    if (sTlsServer != nullptr) {
-        delete sTlsServer;
-    }
-    sTlsServer = new TlsServer(0);
-    if (!sTlsServer->Start()) {
-        LOG(ERROR) << "Failed to start TlsServer";
-        delete sTlsServer;
-        sTlsServer = nullptr;
-        return;
-    }
-
-    // Start mdns connect service for discovery
-    register_adb_secure_connect_service(sTlsServer->port());
-    LOG(INFO) << "adb wifi started on port " << sTlsServer->port();
-    SetProperty(kWifiPortProp, std::to_string(sTlsServer->port()));
-}
-
-static void disable_wifi_debugging() {
-    if (sTlsServer != nullptr) {
-        delete sTlsServer;
-        sTlsServer = nullptr;
-    }
-    if (is_adb_secure_connect_service_registered()) {
-        unregister_adb_secure_connect_service();
-    }
-    kick_all_tcp_tls_transports();
-    LOG(INFO) << "adb wifi stopped";
-    SetProperty(kWifiPortProp, "");
-}
-
-// Watches for the #kWifiEnabledProp property to toggle the TlsServer
-static void start_wifi_enabled_observer() {
-    std::thread([]() {
-        bool wifi_enabled = false;
-        while (true) {
-            std::string toggled_val = wifi_enabled ? "0" : "1";
-            LOG(INFO) << "Waiting for " << kWifiEnabledProp << "=" << toggled_val;
-            if (WaitForProperty(kWifiEnabledProp, toggled_val)) {
-                wifi_enabled = !wifi_enabled;
-                LOG(INFO) << kWifiEnabledProp << " changed to " << toggled_val;
-                if (wifi_enabled) {
-                    enable_wifi_debugging();
-                } else {
-                    disable_wifi_debugging();
-                }
-            }
-        }
-    }).detach();
-}
-#endif  //__ANDROID__
-
-}  // namespace
-
-void adbd_wifi_init(AdbdAuthContext* ctx) {
-    auth_ctx = ctx;
-#if defined(__ANDROID__)
-    start_wifi_enabled_observer();
-#endif  //__ANDROID__
-}
-
-void adbd_wifi_secure_connect(atransport* t) {
-    t->AddDisconnect(&adb_disconnect);
-    handle_online(t);
-    send_connect(t);
-    LOG(INFO) << __func__ << ": connected " << t->serial;
-    t->auth_id = adbd_auth_tls_device_connected(auth_ctx, kAdbTransportTypeWifi, t->auth_key.data(),
-                                                t->auth_key.size());
-}
-
-#endif /* !HOST */
diff --git a/adb/daemon/auth.cpp b/adb/daemon/auth.cpp
deleted file mode 100644
index 1a1e4ad..0000000
--- a/adb/daemon/auth.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#define TRACE_TAG AUTH
-
-#include "sysdeps.h"
-
-#include <resolv.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <algorithm>
-#include <chrono>
-#include <iomanip>
-#include <map>
-#include <memory>
-#include <thread>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <adb/tls/adb_ca_list.h>
-#include <adbd_auth.h>
-#include <android-base/file.h>
-#include <android-base/no_destructor.h>
-#include <android-base/strings.h>
-#include <crypto_utils/android_pubkey.h>
-#include <openssl/obj_mac.h>
-#include <openssl/rsa.h>
-#include <openssl/sha.h>
-#include <openssl/ssl.h>
-
-#include "adb.h"
-#include "adb_auth.h"
-#include "adb_io.h"
-#include "adb_wifi.h"
-#include "fdevent/fdevent.h"
-#include "transport.h"
-#include "types.h"
-
-using namespace adb::crypto;
-using namespace adb::tls;
-using namespace std::chrono_literals;
-
-static AdbdAuthContext* auth_ctx;
-
-static RSA* rsa_pkey = nullptr;
-
-static void adb_disconnected(void* unused, atransport* t);
-static struct adisconnect adb_disconnect = {adb_disconnected, nullptr};
-
-static android::base::NoDestructor<std::map<uint32_t, weak_ptr<atransport>>> transports;
-static uint32_t transport_auth_id = 0;
-
-bool auth_required = true;
-
-static void* transport_to_callback_arg(atransport* transport) {
-    uint32_t id = transport_auth_id++;
-    (*transports)[id] = transport->weak();
-    return reinterpret_cast<void*>(id);
-}
-
-static atransport* transport_from_callback_arg(void* id) {
-    uint64_t id_u64 = reinterpret_cast<uint64_t>(id);
-    if (id_u64 > std::numeric_limits<uint32_t>::max()) {
-        LOG(FATAL) << "transport_from_callback_arg called on out of range value: " << id_u64;
-    }
-
-    uint32_t id_u32 = static_cast<uint32_t>(id_u64);
-    auto it = transports->find(id_u32);
-    if (it == transports->end()) {
-        LOG(ERROR) << "transport_from_callback_arg failed to find transport for id " << id_u32;
-        return nullptr;
-    }
-
-    atransport* t = it->second.get();
-    if (!t) {
-        LOG(WARNING) << "transport_from_callback_arg found already destructed transport";
-        return nullptr;
-    }
-
-    transports->erase(it);
-    return t;
-}
-
-static void IteratePublicKeys(std::function<bool(std::string_view public_key)> f) {
-    adbd_auth_get_public_keys(
-            auth_ctx,
-            [](void* opaque, const char* public_key, size_t len) {
-                return (*static_cast<decltype(f)*>(opaque))(std::string_view(public_key, len));
-            },
-            &f);
-}
-
-bssl::UniquePtr<STACK_OF(X509_NAME)> adbd_tls_client_ca_list() {
-    if (!auth_required) {
-        return nullptr;
-    }
-
-    bssl::UniquePtr<STACK_OF(X509_NAME)> ca_list(sk_X509_NAME_new_null());
-
-    IteratePublicKeys([&](std::string_view public_key) {
-        // TODO: do we really have to support both ' ' and '\t'?
-        std::vector<std::string> split = android::base::Split(std::string(public_key), " \t");
-        uint8_t keybuf[ANDROID_PUBKEY_ENCODED_SIZE + 1];
-        const std::string& pubkey = split[0];
-        if (b64_pton(pubkey.c_str(), keybuf, sizeof(keybuf)) != ANDROID_PUBKEY_ENCODED_SIZE) {
-            LOG(ERROR) << "Invalid base64 key " << pubkey;
-            return true;
-        }
-
-        RSA* key = nullptr;
-        if (!android_pubkey_decode(keybuf, ANDROID_PUBKEY_ENCODED_SIZE, &key)) {
-            LOG(ERROR) << "Failed to parse key " << pubkey;
-            return true;
-        }
-        bssl::UniquePtr<RSA> rsa_key(key);
-
-        unsigned char* dkey = nullptr;
-        int len = i2d_RSA_PUBKEY(rsa_key.get(), &dkey);
-        if (len <= 0 || dkey == nullptr) {
-            LOG(ERROR) << "Failed to encode RSA public key";
-            return true;
-        }
-
-        uint8_t digest[SHA256_DIGEST_LENGTH];
-        // Put the encoded key in the commonName attribute of the issuer name.
-        // Note that the commonName has a max length of 64 bytes, which is less
-        // than the SHA256_DIGEST_LENGTH.
-        SHA256(dkey, len, digest);
-        OPENSSL_free(dkey);
-
-        auto digest_str = SHA256BitsToHexString(
-                std::string_view(reinterpret_cast<const char*>(&digest[0]), sizeof(digest)));
-        LOG(INFO) << "fingerprint=[" << digest_str << "]";
-        auto issuer = CreateCAIssuerFromEncodedKey(digest_str);
-        CHECK(bssl::PushToStack(ca_list.get(), std::move(issuer)));
-        return true;
-    });
-
-    return ca_list;
-}
-
-bool adbd_auth_verify(const char* token, size_t token_size, const std::string& sig,
-                      std::string* auth_key) {
-    bool authorized = false;
-    auth_key->clear();
-
-    IteratePublicKeys([&](std::string_view public_key) {
-        // TODO: do we really have to support both ' ' and '\t'?
-        std::vector<std::string> split = android::base::Split(std::string(public_key), " \t");
-        uint8_t keybuf[ANDROID_PUBKEY_ENCODED_SIZE + 1];
-        const std::string& pubkey = split[0];
-        if (b64_pton(pubkey.c_str(), keybuf, sizeof(keybuf)) != ANDROID_PUBKEY_ENCODED_SIZE) {
-            LOG(ERROR) << "Invalid base64 key " << pubkey;
-            return true;
-        }
-
-        RSA* key = nullptr;
-        if (!android_pubkey_decode(keybuf, ANDROID_PUBKEY_ENCODED_SIZE, &key)) {
-            LOG(ERROR) << "Failed to parse key " << pubkey;
-            return true;
-        }
-
-        bool verified =
-                (RSA_verify(NID_sha1, reinterpret_cast<const uint8_t*>(token), token_size,
-                            reinterpret_cast<const uint8_t*>(sig.c_str()), sig.size(), key) == 1);
-        RSA_free(key);
-        if (verified) {
-            *auth_key = public_key;
-            authorized = true;
-            return false;
-        }
-
-        return true;
-    });
-
-    return authorized;
-}
-
-static bool adbd_auth_generate_token(void* token, size_t token_size) {
-    FILE* fp = fopen("/dev/urandom", "re");
-    if (!fp) return false;
-    bool okay = (fread(token, token_size, 1, fp) == 1);
-    fclose(fp);
-    return okay;
-}
-
-void adbd_cloexec_auth_socket() {
-    int fd = android_get_control_socket("adbd");
-    if (fd == -1) {
-        PLOG(ERROR) << "Failed to get adbd socket";
-        return;
-    }
-    fcntl(fd, F_SETFD, FD_CLOEXEC);
-}
-
-static void adbd_auth_key_authorized(void* arg, uint64_t id) {
-    LOG(INFO) << "adb client " << id << " authorized";
-    fdevent_run_on_main_thread([=]() {
-        auto* transport = transport_from_callback_arg(arg);
-        if (!transport) {
-            LOG(ERROR) << "authorization received for deleted transport (" << id << "), ignoring";
-            return;
-        }
-
-        if (transport->auth_id.has_value()) {
-            if (transport->auth_id.value() != id) {
-                LOG(ERROR)
-                        << "authorization received, but auth id doesn't match, ignoring (expected "
-                        << transport->auth_id.value() << ", got " << id << ")";
-                return;
-            }
-        } else {
-            // Older versions (i.e. dogfood/beta builds) of libadbd_auth didn't pass the initial
-            // auth id to us, so we'll just have to trust it until R ships and we can retcon this.
-            transport->auth_id = id;
-        }
-
-        adbd_auth_verified(transport);
-    });
-}
-
-static void adbd_key_removed(const char* public_key, size_t len) {
-    // The framework removed the key from its keystore. We need to disconnect all
-    // devices using that key. Search by t->auth_key
-    std::string_view auth_key(public_key, len);
-    kick_all_transports_by_auth_key(auth_key);
-}
-
-void adbd_auth_init(void) {
-    AdbdAuthCallbacksV1 cb;
-    cb.version = 1;
-    cb.key_authorized = adbd_auth_key_authorized;
-    cb.key_removed = adbd_key_removed;
-    auth_ctx = adbd_auth_new(&cb);
-    adbd_wifi_init(auth_ctx);
-    std::thread([]() {
-        adb_thread_setname("adbd auth");
-        adbd_auth_run(auth_ctx);
-        LOG(FATAL) << "auth thread terminated";
-    }).detach();
-}
-
-void send_auth_request(atransport* t) {
-    LOG(INFO) << "Calling send_auth_request...";
-
-    if (!adbd_auth_generate_token(t->token, sizeof(t->token))) {
-        PLOG(ERROR) << "Error generating token";
-        return;
-    }
-
-    apacket* p = get_apacket();
-    p->msg.command = A_AUTH;
-    p->msg.arg0 = ADB_AUTH_TOKEN;
-    p->msg.data_length = sizeof(t->token);
-    p->payload.assign(t->token, t->token + sizeof(t->token));
-    send_packet(p, t);
-}
-
-void adbd_auth_verified(atransport* t) {
-    LOG(INFO) << "adb client authorized";
-    handle_online(t);
-    send_connect(t);
-}
-
-static void adb_disconnected(void* unused, atransport* t) {
-    LOG(INFO) << "ADB disconnect";
-    CHECK(t->auth_id.has_value());
-    adbd_auth_notify_disconnect(auth_ctx, t->auth_id.value());
-}
-
-void adbd_auth_confirm_key(atransport* t) {
-    LOG(INFO) << "prompting user to authorize key";
-    t->AddDisconnect(&adb_disconnect);
-    if (adbd_auth_prompt_user_with_id) {
-        t->auth_id = adbd_auth_prompt_user_with_id(auth_ctx, t->auth_key.data(), t->auth_key.size(),
-                                                   transport_to_callback_arg(t));
-    } else {
-        adbd_auth_prompt_user(auth_ctx, t->auth_key.data(), t->auth_key.size(),
-                              transport_to_callback_arg(t));
-    }
-}
-
-void adbd_notify_framework_connected_key(atransport* t) {
-    t->auth_id = adbd_auth_notify_auth(auth_ctx, t->auth_key.data(), t->auth_key.size());
-}
-
-int adbd_tls_verify_cert(X509_STORE_CTX* ctx, std::string* auth_key) {
-    if (!auth_required) {
-        // Any key will do.
-        LOG(INFO) << __func__ << ": auth not required";
-        return 1;
-    }
-
-    bool authorized = false;
-    X509* cert = X509_STORE_CTX_get0_cert(ctx);
-    if (cert == nullptr) {
-        LOG(INFO) << "got null x509 certificate";
-        return 0;
-    }
-    bssl::UniquePtr<EVP_PKEY> evp_pkey(X509_get_pubkey(cert));
-    if (evp_pkey == nullptr) {
-        LOG(INFO) << "got null evp_pkey from x509 certificate";
-        return 0;
-    }
-
-    IteratePublicKeys([&](std::string_view public_key) {
-        // TODO: do we really have to support both ' ' and '\t'?
-        std::vector<std::string> split = android::base::Split(std::string(public_key), " \t");
-        uint8_t keybuf[ANDROID_PUBKEY_ENCODED_SIZE + 1];
-        const std::string& pubkey = split[0];
-        if (b64_pton(pubkey.c_str(), keybuf, sizeof(keybuf)) != ANDROID_PUBKEY_ENCODED_SIZE) {
-            LOG(ERROR) << "Invalid base64 key " << pubkey;
-            return true;
-        }
-
-        RSA* key = nullptr;
-        if (!android_pubkey_decode(keybuf, ANDROID_PUBKEY_ENCODED_SIZE, &key)) {
-            LOG(ERROR) << "Failed to parse key " << pubkey;
-            return true;
-        }
-
-        bool verified = false;
-        bssl::UniquePtr<EVP_PKEY> known_evp(EVP_PKEY_new());
-        EVP_PKEY_set1_RSA(known_evp.get(), key);
-        if (EVP_PKEY_cmp(known_evp.get(), evp_pkey.get())) {
-            LOG(INFO) << "Matched auth_key=" << public_key;
-            verified = true;
-        } else {
-            LOG(INFO) << "auth_key doesn't match [" << public_key << "]";
-        }
-        RSA_free(key);
-        if (verified) {
-            *auth_key = public_key;
-            authorized = true;
-            return false;
-        }
-
-        return true;
-    });
-
-    return authorized ? 1 : 0;
-}
-
-void adbd_auth_tls_handshake(atransport* t) {
-    if (rsa_pkey == nullptr) {
-        // Generate a random RSA key to feed into the X509 certificate
-        auto rsa_2048 = CreateRSA2048Key();
-        CHECK(rsa_2048.has_value());
-        rsa_pkey = EVP_PKEY_get1_RSA(rsa_2048->GetEvpPkey());
-        CHECK(rsa_pkey);
-    }
-
-    std::thread([t]() {
-        std::string auth_key;
-        if (t->connection()->DoTlsHandshake(rsa_pkey, &auth_key)) {
-            LOG(INFO) << "auth_key=" << auth_key;
-            if (t->IsTcpDevice()) {
-                t->auth_key = auth_key;
-                adbd_wifi_secure_connect(t);
-            } else {
-                adbd_auth_verified(t);
-                adbd_notify_framework_connected_key(t);
-            }
-        } else {
-            // Only allow one attempt at the handshake.
-            t->Kick();
-        }
-    }).detach();
-}
diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp
deleted file mode 100644
index 07f6e65..0000000
--- a/adb/daemon/file_sync_service.cpp
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG SYNC
-
-#include "daemon/file_sync_service.h"
-
-#include "sysdeps.h"
-
-#include <dirent.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <utime.h>
-
-#include <memory>
-#include <optional>
-#include <span>
-#include <string>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include <adbd_fs.h>
-
-// Needed for __android_log_security_bswrite.
-#include <private/android_logger.h>
-
-#if defined(__ANDROID__)
-#include <linux/capability.h>
-#include <selinux/android.h>
-#include <sys/xattr.h>
-#endif
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "adb_utils.h"
-#include "brotli_utils.h"
-#include "file_sync_protocol.h"
-#include "security_log_tags.h"
-#include "sysdeps/errno.h"
-
-using android::base::borrowed_fd;
-using android::base::Dirname;
-using android::base::StringPrintf;
-
-static bool should_use_fs_config(const std::string& path) {
-#if defined(__ANDROID__)
-    // TODO: use fs_config to configure permissions on /data too.
-    return !android::base::StartsWith(path, "/data/");
-#else
-    UNUSED(path);
-    return false;
-#endif
-}
-
-static bool update_capabilities(const char* path, uint64_t capabilities) {
-#if defined(__ANDROID__)
-    if (capabilities == 0) {
-        // Ensure we clean up in case the capabilities weren't 0 in the past.
-        removexattr(path, XATTR_NAME_CAPS);
-        return true;
-    }
-
-    vfs_cap_data cap_data = {};
-    cap_data.magic_etc = VFS_CAP_REVISION_2 | VFS_CAP_FLAGS_EFFECTIVE;
-    cap_data.data[0].permitted = (capabilities & 0xffffffff);
-    cap_data.data[0].inheritable = 0;
-    cap_data.data[1].permitted = (capabilities >> 32);
-    cap_data.data[1].inheritable = 0;
-    return setxattr(path, XATTR_NAME_CAPS, &cap_data, sizeof(cap_data), 0) != -1;
-#else
-    UNUSED(path, capabilities);
-    return true;
-#endif
-}
-
-static bool secure_mkdirs(const std::string& path) {
-    if (path[0] != '/') return false;
-
-    std::vector<std::string> path_components = android::base::Split(path, "/");
-    std::string partial_path;
-    for (const auto& path_component : path_components) {
-        uid_t uid = -1;
-        gid_t gid = -1;
-        mode_t mode = 0775;
-        uint64_t capabilities = 0;
-
-        if (path_component.empty()) {
-            continue;
-        }
-
-        if (partial_path.empty() || partial_path.back() != OS_PATH_SEPARATOR) {
-            partial_path += OS_PATH_SEPARATOR;
-        }
-        partial_path += path_component;
-
-        if (should_use_fs_config(partial_path)) {
-            adbd_fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
-        }
-        if (adb_mkdir(partial_path.c_str(), mode) == -1) {
-            if (errno != EEXIST) {
-                return false;
-            }
-        } else {
-            if (chown(partial_path.c_str(), uid, gid) == -1) return false;
-
-#if defined(__ANDROID__)
-            // Not all filesystems support setting SELinux labels. http://b/23530370.
-            selinux_android_restorecon(partial_path.c_str(), 0);
-#endif
-
-            if (!update_capabilities(partial_path.c_str(), capabilities)) return false;
-        }
-    }
-    return true;
-}
-
-static bool do_lstat_v1(int s, const char* path) {
-    syncmsg msg = {};
-    msg.stat_v1.id = ID_LSTAT_V1;
-
-    struct stat st = {};
-    lstat(path, &st);
-    msg.stat_v1.mode = st.st_mode;
-    msg.stat_v1.size = st.st_size;
-    msg.stat_v1.mtime = st.st_mtime;
-    return WriteFdExactly(s, &msg.stat_v1, sizeof(msg.stat_v1));
-}
-
-static bool do_stat_v2(int s, uint32_t id, const char* path) {
-    syncmsg msg = {};
-    msg.stat_v2.id = id;
-
-    decltype(&stat) stat_fn;
-    if (id == ID_STAT_V2) {
-        stat_fn = stat;
-    } else {
-        stat_fn = lstat;
-    }
-
-    struct stat st = {};
-    int rc = stat_fn(path, &st);
-    if (rc == -1) {
-        msg.stat_v2.error = errno_to_wire(errno);
-    } else {
-        msg.stat_v2.dev = st.st_dev;
-        msg.stat_v2.ino = st.st_ino;
-        msg.stat_v2.mode = st.st_mode;
-        msg.stat_v2.nlink = st.st_nlink;
-        msg.stat_v2.uid = st.st_uid;
-        msg.stat_v2.gid = st.st_gid;
-        msg.stat_v2.size = st.st_size;
-        msg.stat_v2.atime = st.st_atime;
-        msg.stat_v2.mtime = st.st_mtime;
-        msg.stat_v2.ctime = st.st_ctime;
-    }
-
-    return WriteFdExactly(s, &msg.stat_v2, sizeof(msg.stat_v2));
-}
-
-template <bool v2>
-static bool do_list(int s, const char* path) {
-    dirent* de;
-
-    using MessageType =
-            std::conditional_t<v2, decltype(syncmsg::dent_v2), decltype(syncmsg::dent_v1)>;
-    MessageType msg;
-    uint32_t msg_id;
-    if constexpr (v2) {
-        msg_id = ID_DENT_V2;
-    } else {
-        msg_id = ID_DENT_V1;
-    }
-
-    std::unique_ptr<DIR, int(*)(DIR*)> d(opendir(path), closedir);
-    if (!d) goto done;
-
-    while ((de = readdir(d.get()))) {
-        memset(&msg, 0, sizeof(msg));
-        msg.id = msg_id;
-
-        std::string filename(StringPrintf("%s/%s", path, de->d_name));
-
-        struct stat st;
-        if (lstat(filename.c_str(), &st) == 0) {
-            msg.mode = st.st_mode;
-            msg.size = st.st_size;
-            msg.mtime = st.st_mtime;
-
-            if constexpr (v2) {
-                msg.dev = st.st_dev;
-                msg.ino = st.st_ino;
-                msg.nlink = st.st_nlink;
-                msg.uid = st.st_uid;
-                msg.gid = st.st_gid;
-                msg.atime = st.st_atime;
-                msg.ctime = st.st_ctime;
-            }
-        } else {
-            if constexpr (v2) {
-                msg.error = errno;
-            } else {
-                continue;
-            }
-        }
-
-        size_t d_name_length = strlen(de->d_name);
-        msg.namelen = d_name_length;
-
-        if (!WriteFdExactly(s, &msg, sizeof(msg)) ||
-            !WriteFdExactly(s, de->d_name, d_name_length)) {
-            return false;
-        }
-    }
-
-done:
-    memset(&msg, 0, sizeof(msg));
-    msg.id = ID_DONE;
-    return WriteFdExactly(s, &msg, sizeof(msg));
-}
-
-static bool do_list_v1(int s, const char* path) {
-    return do_list<false>(s, path);
-}
-
-static bool do_list_v2(int s, const char* path) {
-    return do_list<true>(s, path);
-}
-
-// Make sure that SendFail from adb_io.cpp isn't accidentally used in this file.
-#pragma GCC poison SendFail
-
-static bool SendSyncFail(borrowed_fd fd, const std::string& reason) {
-    D("sync: failure: %s", reason.c_str());
-
-    syncmsg msg;
-    msg.data.id = ID_FAIL;
-    msg.data.size = reason.size();
-    return WriteFdExactly(fd, &msg.data, sizeof(msg.data)) && WriteFdExactly(fd, reason);
-}
-
-static bool SendSyncFailErrno(borrowed_fd fd, const std::string& reason) {
-    return SendSyncFail(fd, StringPrintf("%s: %s", reason.c_str(), strerror(errno)));
-}
-
-static bool handle_send_file_compressed(borrowed_fd s, unique_fd fd, uint32_t* timestamp) {
-    syncmsg msg;
-    Block decode_buffer(SYNC_DATA_MAX);
-    BrotliDecoder decoder(std::span(decode_buffer.data(), decode_buffer.size()));
-    while (true) {
-        if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) return false;
-
-        if (msg.data.id != ID_DATA) {
-            if (msg.data.id == ID_DONE) {
-                *timestamp = msg.data.size;
-                return true;
-            }
-            SendSyncFail(s, "invalid data message");
-            return false;
-        }
-
-        Block block(msg.data.size);
-        if (!ReadFdExactly(s, block.data(), msg.data.size)) return false;
-        decoder.Append(std::move(block));
-
-        while (true) {
-            std::span<char> output;
-            BrotliDecodeResult result = decoder.Decode(&output);
-            if (result == BrotliDecodeResult::Error) {
-                SendSyncFailErrno(s, "decompress failed");
-                return false;
-            }
-
-            if (!WriteFdExactly(fd, output.data(), output.size())) {
-                SendSyncFailErrno(s, "write failed");
-                return false;
-            }
-
-            if (result == BrotliDecodeResult::NeedInput) {
-                break;
-            } else if (result == BrotliDecodeResult::MoreOutput) {
-                continue;
-            } else if (result == BrotliDecodeResult::Done) {
-                break;
-            } else {
-                LOG(FATAL) << "invalid BrotliDecodeResult: " << static_cast<int>(result);
-            }
-        }
-    }
-
-    __builtin_unreachable();
-}
-
-static bool handle_send_file_uncompressed(borrowed_fd s, unique_fd fd, uint32_t* timestamp,
-                                          std::vector<char>& buffer) {
-    syncmsg msg;
-
-    while (true) {
-        if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) return false;
-
-        if (msg.data.id != ID_DATA) {
-            if (msg.data.id == ID_DONE) {
-                *timestamp = msg.data.size;
-                return true;
-            }
-            SendSyncFail(s, "invalid data message");
-            return false;
-        }
-
-        if (msg.data.size > buffer.size()) {  // TODO: resize buffer?
-            SendSyncFail(s, "oversize data message");
-            return false;
-        }
-        if (!ReadFdExactly(s, &buffer[0], msg.data.size)) return false;
-        if (!WriteFdExactly(fd, &buffer[0], msg.data.size)) {
-            SendSyncFailErrno(s, "write failed");
-            return false;
-        }
-    }
-}
-
-static bool handle_send_file(borrowed_fd s, const char* path, uint32_t* timestamp, uid_t uid,
-                             gid_t gid, uint64_t capabilities, mode_t mode, bool compressed,
-                             std::vector<char>& buffer, bool do_unlink) {
-    int rc;
-    syncmsg msg;
-
-    __android_log_security_bswrite(SEC_TAG_ADB_SEND_FILE, path);
-
-    unique_fd fd(adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, mode));
-
-    if (fd < 0 && errno == ENOENT) {
-        if (!secure_mkdirs(Dirname(path))) {
-            SendSyncFailErrno(s, "secure_mkdirs failed");
-            goto fail;
-        }
-        fd.reset(adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, mode));
-    }
-    if (fd < 0 && errno == EEXIST) {
-        fd.reset(adb_open_mode(path, O_WRONLY | O_CLOEXEC, mode));
-    }
-    if (fd < 0) {
-        SendSyncFailErrno(s, "couldn't create file");
-        goto fail;
-    } else {
-        if (fchown(fd.get(), uid, gid) == -1) {
-            SendSyncFailErrno(s, "fchown failed");
-            goto fail;
-        }
-
-#if defined(__ANDROID__)
-        // Not all filesystems support setting SELinux labels. http://b/23530370.
-        selinux_android_restorecon(path, 0);
-#endif
-
-        // fchown clears the setuid bit - restore it if present.
-        // Ignore the result of calling fchmod. It's not supported
-        // by all filesystems, so we don't check for success. b/12441485
-        fchmod(fd.get(), mode);
-    }
-
-    {
-        rc = posix_fadvise(fd.get(), 0, 0,
-                           POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE | POSIX_FADV_WILLNEED);
-        if (rc != 0) {
-            D("[ Failed to fadvise: %s ]", strerror(rc));
-        }
-
-        bool result;
-        if (compressed) {
-            result = handle_send_file_compressed(s, std::move(fd), timestamp);
-        } else {
-            result = handle_send_file_uncompressed(s, std::move(fd), timestamp, buffer);
-        }
-
-        if (!result) {
-            goto fail;
-        }
-
-        if (!update_capabilities(path, capabilities)) {
-            SendSyncFailErrno(s, "update_capabilities failed");
-            goto fail;
-        }
-
-        msg.status.id = ID_OKAY;
-        msg.status.msglen = 0;
-        return WriteFdExactly(s, &msg.status, sizeof(msg.status));
-    }
-
-fail:
-    // If there's a problem on the device, we'll send an ID_FAIL message and
-    // close the socket. Unfortunately the kernel will sometimes throw that
-    // data away if the other end keeps writing without reading (which is
-    // the case with old versions of adb). To maintain compatibility, keep
-    // reading and throwing away ID_DATA packets until the other side notices
-    // that we've reported an error.
-    while (true) {
-        if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) break;
-
-        if (msg.data.id == ID_DONE) {
-            break;
-        } else if (msg.data.id != ID_DATA) {
-            char id[5];
-            memcpy(id, &msg.data.id, sizeof(msg.data.id));
-            id[4] = '\0';
-            D("handle_send_fail received unexpected id '%s' during failure", id);
-            break;
-        }
-
-        if (msg.data.size > buffer.size()) {
-            D("handle_send_fail received oversized packet of length '%u' during failure",
-              msg.data.size);
-            break;
-        }
-
-        if (!ReadFdExactly(s, &buffer[0], msg.data.size)) break;
-    }
-
-    if (do_unlink) adb_unlink(path);
-    return false;
-}
-
-#if defined(_WIN32)
-extern bool handle_send_link(int s, const std::string& path,
-                             uint32_t* timestamp, std::vector<char>& buffer)
-        __attribute__((error("no symlinks on Windows")));
-#else
-static bool handle_send_link(int s, const std::string& path, uint32_t* timestamp,
-                             std::vector<char>& buffer) {
-    syncmsg msg;
-
-    if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) return false;
-
-    if (msg.data.id != ID_DATA) {
-        SendSyncFail(s, "invalid data message: expected ID_DATA");
-        return false;
-    }
-
-    unsigned int len = msg.data.size;
-    if (len > buffer.size()) { // TODO: resize buffer?
-        SendSyncFail(s, "oversize data message");
-        return false;
-    }
-    if (!ReadFdExactly(s, &buffer[0], len)) return false;
-
-    std::string buf_link;
-    if (!android::base::Readlink(path, &buf_link) || (buf_link != &buffer[0])) {
-        adb_unlink(path.c_str());
-        auto ret = symlink(&buffer[0], path.c_str());
-        if (ret && errno == ENOENT) {
-            if (!secure_mkdirs(Dirname(path))) {
-                SendSyncFailErrno(s, "secure_mkdirs failed");
-                return false;
-            }
-            ret = symlink(&buffer[0], path.c_str());
-        }
-        if (ret) {
-            SendSyncFailErrno(s, "symlink failed");
-            return false;
-        }
-    }
-
-    if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) return false;
-
-    if (msg.data.id == ID_DONE) {
-        *timestamp = msg.data.size;
-        msg.status.id = ID_OKAY;
-        msg.status.msglen = 0;
-        if (!WriteFdExactly(s, &msg.status, sizeof(msg.status))) return false;
-    } else {
-        SendSyncFail(s, "invalid data message: expected ID_DONE");
-        return false;
-    }
-
-    return true;
-}
-#endif
-
-static bool send_impl(int s, const std::string& path, mode_t mode, bool compressed,
-                      std::vector<char>& buffer) {
-    // Don't delete files before copying if they are not "regular" or symlinks.
-    struct stat st;
-    bool do_unlink = (lstat(path.c_str(), &st) == -1) || S_ISREG(st.st_mode) ||
-                     (S_ISLNK(st.st_mode) && !S_ISLNK(mode));
-    if (do_unlink) {
-        adb_unlink(path.c_str());
-    }
-
-    bool result;
-    uint32_t timestamp;
-    if (S_ISLNK(mode)) {
-        result = handle_send_link(s, path, &timestamp, buffer);
-    } else {
-        // Copy user permission bits to "group" and "other" permissions.
-        mode &= 0777;
-        mode |= ((mode >> 3) & 0070);
-        mode |= ((mode >> 3) & 0007);
-
-        uid_t uid = -1;
-        gid_t gid = -1;
-        uint64_t capabilities = 0;
-        if (should_use_fs_config(path)) {
-            adbd_fs_config(path.c_str(), 0, nullptr, &uid, &gid, &mode, &capabilities);
-        }
-
-        result = handle_send_file(s, path.c_str(), &timestamp, uid, gid, capabilities, mode,
-                                  compressed, buffer, do_unlink);
-    }
-
-    if (!result) {
-      return false;
-    }
-
-    struct timeval tv[2];
-    tv[0].tv_sec = timestamp;
-    tv[0].tv_usec = 0;
-    tv[1].tv_sec = timestamp;
-    tv[1].tv_usec = 0;
-    lutimes(path.c_str(), tv);
-    return true;
-}
-
-static bool do_send_v1(int s, const std::string& spec, std::vector<char>& buffer) {
-    // 'spec' is of the form "/some/path,0755". Break it up.
-    size_t comma = spec.find_last_of(',');
-    if (comma == std::string::npos) {
-        SendSyncFail(s, "missing , in ID_SEND_V1");
-        return false;
-    }
-
-    std::string path = spec.substr(0, comma);
-
-    errno = 0;
-    mode_t mode = strtoul(spec.substr(comma + 1).c_str(), nullptr, 0);
-    if (errno != 0) {
-        SendSyncFail(s, "bad mode");
-        return false;
-    }
-
-    return send_impl(s, path, mode, false, buffer);
-}
-
-static bool do_send_v2(int s, const std::string& path, std::vector<char>& buffer) {
-    // Read the setup packet.
-    syncmsg msg;
-    int rc = ReadFdExactly(s, &msg.send_v2_setup, sizeof(msg.send_v2_setup));
-    if (rc == 0) {
-        LOG(ERROR) << "failed to read send_v2 setup packet: EOF";
-        return false;
-    } else if (rc < 0) {
-        PLOG(ERROR) << "failed to read send_v2 setup packet";
-    }
-
-    bool compressed = false;
-    if (msg.send_v2_setup.flags & kSyncFlagBrotli) {
-        msg.send_v2_setup.flags &= ~kSyncFlagBrotli;
-        compressed = true;
-    }
-    if (msg.send_v2_setup.flags) {
-        SendSyncFail(s, android::base::StringPrintf("unknown flags: %d", msg.send_v2_setup.flags));
-        return false;
-    }
-
-    errno = 0;
-    return send_impl(s, path, msg.send_v2_setup.mode, compressed, buffer);
-}
-
-static bool recv_uncompressed(borrowed_fd s, unique_fd fd, std::vector<char>& buffer) {
-    syncmsg msg;
-    msg.data.id = ID_DATA;
-    std::optional<BrotliEncoder<SYNC_DATA_MAX>> encoder;
-    while (true) {
-        int r = adb_read(fd.get(), &buffer[0], buffer.size() - sizeof(msg.data));
-        if (r <= 0) {
-            if (r == 0) break;
-            SendSyncFailErrno(s, "read failed");
-            return false;
-        }
-        msg.data.size = r;
-
-        if (!WriteFdExactly(s, &msg.data, sizeof(msg.data)) || !WriteFdExactly(s, &buffer[0], r)) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-static bool recv_compressed(borrowed_fd s, unique_fd fd) {
-    syncmsg msg;
-    msg.data.id = ID_DATA;
-
-    BrotliEncoder<SYNC_DATA_MAX> encoder;
-
-    bool sending = true;
-    while (sending) {
-        Block input(SYNC_DATA_MAX);
-        int r = adb_read(fd.get(), input.data(), input.size());
-        if (r < 0) {
-            SendSyncFailErrno(s, "read failed");
-            return false;
-        }
-
-        if (r == 0) {
-            encoder.Finish();
-        } else {
-            input.resize(r);
-            encoder.Append(std::move(input));
-        }
-
-        while (true) {
-            Block output;
-            BrotliEncodeResult result = encoder.Encode(&output);
-            if (result == BrotliEncodeResult::Error) {
-                SendSyncFailErrno(s, "compress failed");
-                return false;
-            }
-
-            if (!output.empty()) {
-                msg.data.size = output.size();
-                if (!WriteFdExactly(s, &msg.data, sizeof(msg.data)) ||
-                    !WriteFdExactly(s, output.data(), output.size())) {
-                    return false;
-                }
-            }
-
-            if (result == BrotliEncodeResult::Done) {
-                sending = false;
-                break;
-            } else if (result == BrotliEncodeResult::NeedInput) {
-                break;
-            } else if (result == BrotliEncodeResult::MoreOutput) {
-                continue;
-            }
-        }
-    }
-
-    return true;
-}
-
-static bool recv_impl(borrowed_fd s, const char* path, bool compressed, std::vector<char>& buffer) {
-    __android_log_security_bswrite(SEC_TAG_ADB_RECV_FILE, path);
-
-    unique_fd fd(adb_open(path, O_RDONLY | O_CLOEXEC));
-    if (fd < 0) {
-        SendSyncFailErrno(s, "open failed");
-        return false;
-    }
-
-    int rc = posix_fadvise(fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
-    if (rc != 0) {
-        D("[ Failed to fadvise: %s ]", strerror(rc));
-    }
-
-    bool result;
-    if (compressed) {
-        result = recv_compressed(s, std::move(fd));
-    } else {
-        result = recv_uncompressed(s, std::move(fd), buffer);
-    }
-
-    if (!result) {
-        return false;
-    }
-
-    syncmsg msg;
-    msg.data.id = ID_DONE;
-    msg.data.size = 0;
-    return WriteFdExactly(s, &msg.data, sizeof(msg.data));
-}
-
-static bool do_recv_v1(borrowed_fd s, const char* path, std::vector<char>& buffer) {
-    return recv_impl(s, path, false, buffer);
-}
-
-static bool do_recv_v2(borrowed_fd s, const char* path, std::vector<char>& buffer) {
-    syncmsg msg;
-    // Read the setup packet.
-    int rc = ReadFdExactly(s, &msg.recv_v2_setup, sizeof(msg.recv_v2_setup));
-    if (rc == 0) {
-        LOG(ERROR) << "failed to read recv_v2 setup packet: EOF";
-        return false;
-    } else if (rc < 0) {
-        PLOG(ERROR) << "failed to read recv_v2 setup packet";
-    }
-
-    bool compressed = false;
-    if (msg.recv_v2_setup.flags & kSyncFlagBrotli) {
-        msg.recv_v2_setup.flags &= ~kSyncFlagBrotli;
-        compressed = true;
-    }
-    if (msg.recv_v2_setup.flags) {
-        SendSyncFail(s, android::base::StringPrintf("unknown flags: %d", msg.recv_v2_setup.flags));
-        return false;
-    }
-
-    return recv_impl(s, path, compressed, buffer);
-}
-
-static const char* sync_id_to_name(uint32_t id) {
-  switch (id) {
-    case ID_LSTAT_V1:
-      return "lstat_v1";
-    case ID_LSTAT_V2:
-      return "lstat_v2";
-    case ID_STAT_V2:
-      return "stat_v2";
-    case ID_LIST_V1:
-      return "list_v1";
-    case ID_LIST_V2:
-      return "list_v2";
-    case ID_SEND_V1:
-        return "send_v1";
-    case ID_SEND_V2:
-        return "send_v2";
-    case ID_RECV_V1:
-        return "recv_v1";
-    case ID_RECV_V2:
-        return "recv_v2";
-    case ID_QUIT:
-        return "quit";
-    default:
-        return "???";
-  }
-}
-
-static bool handle_sync_command(int fd, std::vector<char>& buffer) {
-    D("sync: waiting for request");
-
-    SyncRequest request;
-    if (!ReadFdExactly(fd, &request, sizeof(request))) {
-        SendSyncFail(fd, "command read failure");
-        return false;
-    }
-    size_t path_length = request.path_length;
-    if (path_length > 1024) {
-        SendSyncFail(fd, "path too long");
-        return false;
-    }
-    char name[1025];
-    if (!ReadFdExactly(fd, name, path_length)) {
-        SendSyncFail(fd, "filename read failure");
-        return false;
-    }
-    name[path_length] = 0;
-
-    std::string id_name = sync_id_to_name(request.id);
-
-    D("sync: %s('%s')", id_name.c_str(), name);
-    switch (request.id) {
-        case ID_LSTAT_V1:
-            if (!do_lstat_v1(fd, name)) return false;
-            break;
-        case ID_LSTAT_V2:
-        case ID_STAT_V2:
-            if (!do_stat_v2(fd, request.id, name)) return false;
-            break;
-        case ID_LIST_V1:
-            if (!do_list_v1(fd, name)) return false;
-            break;
-        case ID_LIST_V2:
-            if (!do_list_v2(fd, name)) return false;
-            break;
-        case ID_SEND_V1:
-            if (!do_send_v1(fd, name, buffer)) return false;
-            break;
-        case ID_SEND_V2:
-            if (!do_send_v2(fd, name, buffer)) return false;
-            break;
-        case ID_RECV_V1:
-            if (!do_recv_v1(fd, name, buffer)) return false;
-            break;
-        case ID_RECV_V2:
-            if (!do_recv_v2(fd, name, buffer)) return false;
-            break;
-        case ID_QUIT:
-            return false;
-        default:
-            SendSyncFail(fd, StringPrintf("unknown command %08x", request.id));
-            return false;
-    }
-
-    return true;
-}
-
-void file_sync_service(unique_fd fd) {
-    std::vector<char> buffer(SYNC_DATA_MAX);
-
-    while (handle_sync_command(fd.get(), buffer)) {
-    }
-
-    D("sync: done");
-}
diff --git a/adb/daemon/file_sync_service.h b/adb/daemon/file_sync_service.h
deleted file mode 100644
index f300e7b..0000000
--- a/adb/daemon/file_sync_service.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-
-void file_sync_service(unique_fd fd);
diff --git a/adb/daemon/framebuffer_service.cpp b/adb/daemon/framebuffer_service.cpp
deleted file mode 100644
index 676f8e9..0000000
--- a/adb/daemon/framebuffer_service.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#include "framebuffer_service.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/fb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include "sysdeps.h"
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_utils.h"
-
-/* TODO:
-** - sync with vsync to avoid tearing
-*/
-/* This version number defines the format of the fbinfo struct.
-   It must match versioning in ddms where this data is consumed. */
-#define DDMS_RAWIMAGE_VERSION 2
-struct fbinfo {
-    unsigned int version;
-    unsigned int bpp;
-    unsigned int colorSpace;
-    unsigned int size;
-    unsigned int width;
-    unsigned int height;
-    unsigned int red_offset;
-    unsigned int red_length;
-    unsigned int blue_offset;
-    unsigned int blue_length;
-    unsigned int green_offset;
-    unsigned int green_length;
-    unsigned int alpha_offset;
-    unsigned int alpha_length;
-} __attribute__((packed));
-
-void framebuffer_service(unique_fd fd) {
-    struct fbinfo fbinfo;
-    unsigned int i, bsize;
-    char buf[640];
-    int fd_screencap;
-    int w, h, f, c;
-    int fds[2];
-    pid_t pid;
-
-    if (pipe2(fds, O_CLOEXEC) < 0) return;
-
-    pid = fork();
-    if (pid < 0) goto done;
-
-    if (pid == 0) {
-        dup2(fds[1], STDOUT_FILENO);
-        adb_close(fds[0]);
-        adb_close(fds[1]);
-        const char* command = "screencap";
-        const char *args[2] = {command, nullptr};
-        execvp(command, (char**)args);
-        perror_exit("exec screencap failed");
-    }
-
-    adb_close(fds[1]);
-    fd_screencap = fds[0];
-
-    /* read w, h, format & color space */
-    if(!ReadFdExactly(fd_screencap, &w, 4)) goto done;
-    if(!ReadFdExactly(fd_screencap, &h, 4)) goto done;
-    if(!ReadFdExactly(fd_screencap, &f, 4)) goto done;
-    if(!ReadFdExactly(fd_screencap, &c, 4)) goto done;
-
-    fbinfo.version = DDMS_RAWIMAGE_VERSION;
-    fbinfo.colorSpace = c;
-    /* see hardware/hardware.h */
-    switch (f) {
-        case 1: /* RGBA_8888 */
-            fbinfo.bpp = 32;
-            fbinfo.size = w * h * 4;
-            fbinfo.width = w;
-            fbinfo.height = h;
-            fbinfo.red_offset = 0;
-            fbinfo.red_length = 8;
-            fbinfo.green_offset = 8;
-            fbinfo.green_length = 8;
-            fbinfo.blue_offset = 16;
-            fbinfo.blue_length = 8;
-            fbinfo.alpha_offset = 24;
-            fbinfo.alpha_length = 8;
-            break;
-        case 2: /* RGBX_8888 */
-            fbinfo.bpp = 32;
-            fbinfo.size = w * h * 4;
-            fbinfo.width = w;
-            fbinfo.height = h;
-            fbinfo.red_offset = 0;
-            fbinfo.red_length = 8;
-            fbinfo.green_offset = 8;
-            fbinfo.green_length = 8;
-            fbinfo.blue_offset = 16;
-            fbinfo.blue_length = 8;
-            fbinfo.alpha_offset = 24;
-            fbinfo.alpha_length = 0;
-            break;
-        case 3: /* RGB_888 */
-            fbinfo.bpp = 24;
-            fbinfo.size = w * h * 3;
-            fbinfo.width = w;
-            fbinfo.height = h;
-            fbinfo.red_offset = 0;
-            fbinfo.red_length = 8;
-            fbinfo.green_offset = 8;
-            fbinfo.green_length = 8;
-            fbinfo.blue_offset = 16;
-            fbinfo.blue_length = 8;
-            fbinfo.alpha_offset = 24;
-            fbinfo.alpha_length = 0;
-            break;
-        case 4: /* RGB_565 */
-            fbinfo.bpp = 16;
-            fbinfo.size = w * h * 2;
-            fbinfo.width = w;
-            fbinfo.height = h;
-            fbinfo.red_offset = 11;
-            fbinfo.red_length = 5;
-            fbinfo.green_offset = 5;
-            fbinfo.green_length = 6;
-            fbinfo.blue_offset = 0;
-            fbinfo.blue_length = 5;
-            fbinfo.alpha_offset = 0;
-            fbinfo.alpha_length = 0;
-            break;
-        case 5: /* BGRA_8888 */
-            fbinfo.bpp = 32;
-            fbinfo.size = w * h * 4;
-            fbinfo.width = w;
-            fbinfo.height = h;
-            fbinfo.red_offset = 16;
-            fbinfo.red_length = 8;
-            fbinfo.green_offset = 8;
-            fbinfo.green_length = 8;
-            fbinfo.blue_offset = 0;
-            fbinfo.blue_length = 8;
-            fbinfo.alpha_offset = 24;
-            fbinfo.alpha_length = 8;
-           break;
-        default:
-            goto done;
-    }
-
-    /* write header */
-    if (!WriteFdExactly(fd.get(), &fbinfo, sizeof(fbinfo))) goto done;
-
-    /* write data */
-    for(i = 0; i < fbinfo.size; i += bsize) {
-      bsize = sizeof(buf);
-      if (i + bsize > fbinfo.size)
-        bsize = fbinfo.size - i;
-      if(!ReadFdExactly(fd_screencap, buf, bsize)) goto done;
-      if (!WriteFdExactly(fd.get(), buf, bsize)) goto done;
-    }
-
-done:
-    adb_close(fds[0]);
-
-    TEMP_FAILURE_RETRY(waitpid(pid, nullptr, 0));
-}
diff --git a/adb/daemon/framebuffer_service.h b/adb/daemon/framebuffer_service.h
deleted file mode 100644
index bab44be..0000000
--- a/adb/daemon/framebuffer_service.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-
-#if defined(__ANDROID__)
-void framebuffer_service(unique_fd fd);
-#endif
diff --git a/adb/daemon/jdwp_service.cpp b/adb/daemon/jdwp_service.cpp
deleted file mode 100644
index b92a7de..0000000
--- a/adb/daemon/jdwp_service.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#if !ADB_HOST
-
-#define TRACE_TAG JDWP
-
-#include "sysdeps.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#include <list>
-#include <memory>
-#include <thread>
-#include <vector>
-
-#include <adbconnection/server.h>
-#include <android-base/cmsg.h>
-#include <android-base/unique_fd.h>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-
-using android::base::borrowed_fd;
-using android::base::unique_fd;
-
-/* here's how these things work.
-
-   when adbd starts, it creates a unix server socket
-   named @jdwp-control (@ is a shortcut for "first byte is zero"
-   to use the private namespace instead of the file system)
-
-   when a new JDWP daemon thread starts in a new VM process, it creates
-   a connection to @jdwp-control to announce its availability.
-
-
-     JDWP thread                             @jdwp-control
-         |                                         |
-         |------------------------------->         |
-         | hello I'm in process <pid>              |
-         |                                         |
-         |                                         |
-
-    the connection is kept alive. it will be closed automatically if
-    the JDWP process terminates (this allows adbd to detect dead
-    processes).
-
-    adbd thus maintains a list of "active" JDWP processes. it can send
-    its content to clients through the "device:debug-ports" service,
-    or even updates through the "device:track-debug-ports" service.
-
-    when a debugger wants to connect, it simply runs the command
-    equivalent to  "adb forward tcp:<hostport> jdwp:<pid>"
-
-    "jdwp:<pid>" is a new forward destination format used to target
-    a given JDWP process on the device. when sutch a request arrives,
-    adbd does the following:
-
-      - first, it calls socketpair() to create a pair of equivalent
-        sockets.
-
-      - it attaches the first socket in the pair to a local socket
-        which is itself attached to the transport's remote socket:
-
-
-      - it sends the file descriptor of the second socket directly
-        to the JDWP process with the help of sendmsg()
-
-
-     JDWP thread                             @jdwp-control
-         |                                         |
-         |                  <----------------------|
-         |           OK, try this file descriptor  |
-         |                                         |
-         |                                         |
-
-   then, the JDWP thread uses this new socket descriptor as its
-   pass-through connection to the debugger (and receives the
-   JDWP-Handshake message, answers to it, etc...)
-
-   this gives the following graphics:
-                    ____________________________________
-                   |                                    |
-                   |          ADB Server (host)         |
-                   |                                    |
-        Debugger <---> LocalSocket <----> RemoteSocket  |
-                   |                           ^^       |
-                   |___________________________||_______|
-                                               ||
-                                     Transport ||
-           (TCP for emulator - USB for device) ||
-                                               ||
-                    ___________________________||_______
-                   |                           ||       |
-                   |          ADBD  (device)   ||       |
-                   |                           VV       |
-         JDWP <======> LocalSocket <----> RemoteSocket  |
-                   |                                    |
-                   |____________________________________|
-
-    due to the way adb works, this doesn't need a special socket
-    type or fancy handling of socket termination if either the debugger
-    or the JDWP process closes the connection.
-
-    THIS IS THE SIMPLEST IMPLEMENTATION I COULD FIND, IF YOU HAPPEN
-    TO HAVE A BETTER IDEA, LET ME KNOW - Digit
-
-**********************************************************************/
-
-/** JDWP PID List Support Code
- ** for each JDWP process, we record its pid and its connected socket
- **/
-
-static void jdwp_process_event(int socket, unsigned events, void* _proc);
-static void jdwp_process_list_updated(void);
-
-struct JdwpProcess;
-static auto& _jdwp_list = *new std::list<std::unique_ptr<JdwpProcess>>();
-
-struct JdwpProcess {
-    JdwpProcess(unique_fd socket, pid_t pid) {
-        CHECK(pid != 0);
-
-        this->socket = socket;
-        this->pid = pid;
-        this->fde = fdevent_create(socket.release(), jdwp_process_event, this);
-
-        if (!this->fde) {
-            LOG(FATAL) << "could not create fdevent for new JDWP process";
-        }
-    }
-
-    ~JdwpProcess() {
-        if (this->socket >= 0) {
-            adb_shutdown(this->socket);
-            this->socket = -1;
-        }
-
-        if (this->fde) {
-            fdevent_destroy(this->fde);
-            this->fde = nullptr;
-        }
-
-        out_fds.clear();
-    }
-
-    void RemoveFromList() {
-        auto pred = [this](const auto& proc) { return proc.get() == this; };
-        _jdwp_list.remove_if(pred);
-    }
-
-    borrowed_fd socket = -1;
-    int32_t pid = -1;
-    fdevent* fde = nullptr;
-
-    std::vector<unique_fd> out_fds;
-};
-
-static size_t jdwp_process_list(char* buffer, size_t bufferlen) {
-    std::string temp;
-
-    for (auto& proc : _jdwp_list) {
-        std::string next = std::to_string(proc->pid) + "\n";
-        if (temp.length() + next.length() > bufferlen) {
-            D("truncating JDWP process list (max len = %zu)", bufferlen);
-            break;
-        }
-        temp.append(next);
-    }
-
-    memcpy(buffer, temp.data(), temp.length());
-    return temp.length();
-}
-
-static size_t jdwp_process_list_msg(char* buffer, size_t bufferlen) {
-    // Message is length-prefixed with 4 hex digits in ASCII.
-    static constexpr size_t header_len = 4;
-    if (bufferlen < header_len) {
-        LOG(FATAL) << "invalid JDWP process list buffer size: " << bufferlen;
-    }
-
-    char head[header_len + 1];
-    size_t len = jdwp_process_list(buffer + header_len, bufferlen - header_len);
-    snprintf(head, sizeof head, "%04zx", len);
-    memcpy(buffer, head, header_len);
-    return len + header_len;
-}
-
-static void jdwp_process_event(int socket, unsigned events, void* _proc) {
-    JdwpProcess* proc = reinterpret_cast<JdwpProcess*>(_proc);
-    CHECK_EQ(socket, proc->socket.get());
-
-    if (events & FDE_READ) {
-        // We already have the PID, if we can read from the socket, we've probably hit EOF.
-        D("terminating JDWP connection %d", proc->pid);
-        goto CloseProcess;
-    }
-
-    if (events & FDE_WRITE) {
-        D("trying to send fd to JDWP process (count = %zu)", proc->out_fds.size());
-        CHECK(!proc->out_fds.empty());
-
-        int fd = proc->out_fds.back().get();
-        if (android::base::SendFileDescriptors(socket, "", 1, fd) != 1) {
-            D("sending new file descriptor to JDWP %d failed: %s", proc->pid, strerror(errno));
-            goto CloseProcess;
-        }
-
-        D("sent file descriptor %d to JDWP process %d", fd, proc->pid);
-
-        proc->out_fds.pop_back();
-        if (proc->out_fds.empty()) {
-            fdevent_del(proc->fde, FDE_WRITE);
-        }
-    }
-
-    return;
-
-CloseProcess:
-    proc->RemoveFromList();
-    jdwp_process_list_updated();
-}
-
-unique_fd create_jdwp_connection_fd(int pid) {
-    D("looking for pid %d in JDWP process list", pid);
-
-    for (auto& proc : _jdwp_list) {
-        if (proc->pid == pid) {
-            int fds[2];
-
-            if (adb_socketpair(fds) < 0) {
-                D("%s: socket pair creation failed: %s", __FUNCTION__, strerror(errno));
-                return unique_fd{};
-            }
-            D("socketpair: (%d,%d)", fds[0], fds[1]);
-
-            proc->out_fds.emplace_back(fds[1]);
-            if (proc->out_fds.size() == 1) {
-                fdevent_add(proc->fde, FDE_WRITE);
-            }
-
-            return unique_fd{fds[0]};
-        }
-    }
-    D("search failed !!");
-    return unique_fd{};
-}
-
-/** "jdwp" local service implementation
- ** this simply returns the list of known JDWP process pids
- **/
-
-struct JdwpSocket : public asocket {
-    bool pass = false;
-};
-
-static void jdwp_socket_close(asocket* s) {
-    D("LS(%d): closing jdwp socket", s->id);
-
-    if (s->peer) {
-        D("LS(%d) peer->close()ing peer->id=%d peer->fd=%d", s->id, s->peer->id, s->peer->fd);
-        s->peer->peer = nullptr;
-        s->peer->close(s->peer);
-        s->peer = nullptr;
-    }
-
-    remove_socket(s);
-    delete s;
-}
-
-static int jdwp_socket_enqueue(asocket* s, apacket::payload_type) {
-    /* you can't write to this asocket */
-    D("LS(%d): JDWP socket received data?", s->id);
-    s->peer->close(s->peer);
-    return -1;
-}
-
-static void jdwp_socket_ready(asocket* s) {
-    JdwpSocket* jdwp = (JdwpSocket*)s;
-    asocket* peer = jdwp->peer;
-
-    /* on the first call, send the list of pids,
-     * on the second one, close the connection
-     */
-    if (!jdwp->pass) {
-        apacket::payload_type data;
-        data.resize(s->get_max_payload());
-        size_t len = jdwp_process_list(&data[0], data.size());
-        data.resize(len);
-        peer->enqueue(peer, std::move(data));
-        jdwp->pass = true;
-    } else {
-        peer->close(peer);
-    }
-}
-
-asocket* create_jdwp_service_socket(void) {
-    JdwpSocket* s = new JdwpSocket();
-
-    if (!s) {
-        LOG(FATAL) << "failed to allocate JdwpSocket";
-    }
-
-    install_local_socket(s);
-
-    s->ready = jdwp_socket_ready;
-    s->enqueue = jdwp_socket_enqueue;
-    s->close = jdwp_socket_close;
-    s->pass = false;
-
-    return s;
-}
-
-/** "track-jdwp" local service implementation
- ** this periodically sends the list of known JDWP process pids
- ** to the client...
- **/
-
-struct JdwpTracker : public asocket {
-    bool need_initial;
-};
-
-static auto& _jdwp_trackers = *new std::vector<std::unique_ptr<JdwpTracker>>();
-
-static void jdwp_process_list_updated(void) {
-    std::string data;
-    data.resize(1024);
-    data.resize(jdwp_process_list_msg(&data[0], data.size()));
-
-    for (auto& t : _jdwp_trackers) {
-        if (t->peer) {
-            // The tracker might not have been connected yet.
-            apacket::payload_type payload(data.begin(), data.end());
-            t->peer->enqueue(t->peer, std::move(payload));
-        }
-    }
-}
-
-static void jdwp_tracker_close(asocket* s) {
-    D("LS(%d): destroying jdwp tracker service", s->id);
-
-    if (s->peer) {
-        D("LS(%d) peer->close()ing peer->id=%d peer->fd=%d", s->id, s->peer->id, s->peer->fd);
-        s->peer->peer = nullptr;
-        s->peer->close(s->peer);
-        s->peer = nullptr;
-    }
-
-    remove_socket(s);
-
-    auto pred = [s](const auto& tracker) { return tracker.get() == s; };
-    _jdwp_trackers.erase(std::remove_if(_jdwp_trackers.begin(), _jdwp_trackers.end(), pred),
-                         _jdwp_trackers.end());
-}
-
-static void jdwp_tracker_ready(asocket* s) {
-    JdwpTracker* t = (JdwpTracker*)s;
-
-    if (t->need_initial) {
-        apacket::payload_type data;
-        data.resize(s->get_max_payload());
-        data.resize(jdwp_process_list_msg(&data[0], data.size()));
-        t->need_initial = false;
-        s->peer->enqueue(s->peer, std::move(data));
-    }
-}
-
-static int jdwp_tracker_enqueue(asocket* s, apacket::payload_type) {
-    /* you can't write to this socket */
-    D("LS(%d): JDWP tracker received data?", s->id);
-    s->peer->close(s->peer);
-    return -1;
-}
-
-asocket* create_jdwp_tracker_service_socket(void) {
-    auto t = std::make_unique<JdwpTracker>();
-    if (!t) {
-        LOG(FATAL) << "failed to allocate JdwpTracker";
-    }
-
-    memset(t.get(), 0, sizeof(asocket));
-
-    install_local_socket(t.get());
-    D("LS(%d): created new jdwp tracker service", t->id);
-
-    t->ready = jdwp_tracker_ready;
-    t->enqueue = jdwp_tracker_enqueue;
-    t->close = jdwp_tracker_close;
-    t->need_initial = true;
-
-    asocket* result = t.get();
-
-    _jdwp_trackers.emplace_back(std::move(t));
-
-    return result;
-}
-
-int init_jdwp(void) {
-    std::thread([]() {
-        adb_thread_setname("jdwp control");
-        adbconnection_listen([](int fd, pid_t pid) {
-            LOG(INFO) << "jdwp connection from " << pid;
-            fdevent_run_on_main_thread([fd, pid] {
-                unique_fd ufd(fd);
-                auto proc = std::make_unique<JdwpProcess>(std::move(ufd), pid);
-                if (!proc) {
-                    LOG(FATAL) << "failed to allocate JdwpProcess";
-                }
-                _jdwp_list.emplace_back(std::move(proc));
-                jdwp_process_list_updated();
-            });
-        });
-    }).detach();
-    return 0;
-}
-
-#endif /* !ADB_HOST */
diff --git a/adb/daemon/logging.cpp b/adb/daemon/logging.cpp
deleted file mode 100644
index 203c6c7..0000000
--- a/adb/daemon/logging.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "daemon/logging.h"
-
-#include <mutex>
-#include <optional>
-#include <string_view>
-
-#include <android-base/no_destructor.h>
-#include <android-base/properties.h>
-#include <android-base/strings.h>
-#include <android-base/thread_annotations.h>
-
-#if defined(__ANDROID__)
-struct LogStatus {
-    bool enabled[static_cast<size_t>(adb::LogType::COUNT)];
-
-    bool& operator[](adb::LogType type) { return enabled[static_cast<size_t>(type)]; }
-};
-
-using android::base::CachedProperty;
-using android::base::NoDestructor;
-
-static NoDestructor<std::mutex> log_mutex;
-static NoDestructor<CachedProperty> log_property GUARDED_BY(log_mutex)("debug.adbd.logging");
-static std::optional<LogStatus> cached_log_status GUARDED_BY(log_mutex);
-
-static NoDestructor<CachedProperty> persist_log_property
-        GUARDED_BY(log_mutex)("persist.debug.adbd.logging");
-static std::optional<LogStatus> cached_persist_log_status GUARDED_BY(log_mutex);
-
-static LogStatus ParseLogStatus(std::string_view str) {
-    LogStatus result = {};
-    for (const auto& part : android::base::Split(std::string(str), ",")) {
-        if (part == "cnxn") {
-            result[adb::LogType::Connection] = true;
-        } else if (part == "service") {
-            result[adb::LogType::Service] = true;
-        } else if (part == "shell") {
-            result[adb::LogType::Shell] = true;
-        } else if (part == "all") {
-            result[adb::LogType::Connection] = true;
-            result[adb::LogType::Service] = true;
-            result[adb::LogType::Shell] = true;
-        }
-    }
-    return result;
-}
-
-static LogStatus GetLogStatus(android::base::CachedProperty* property,
-                              std::optional<LogStatus>* cached_status) REQUIRES(log_mutex) {
-    bool changed;
-    const char* value = property->Get(&changed);
-    if (changed || !*cached_status) {
-        **cached_status = ParseLogStatus(value);
-    }
-    return **cached_status;
-}
-
-namespace adb {
-bool is_logging_enabled(LogType type) {
-    std::lock_guard<std::mutex> lock(*log_mutex);
-    return GetLogStatus(log_property.get(), &cached_log_status)[type] ||
-           GetLogStatus(persist_log_property.get(), &cached_persist_log_status)[type];
-}
-}  // namespace adb
-
-#else
-
-namespace adb {
-bool is_logging_enabled(LogType type) {
-    return false;
-}
-}  // namespace adb
-#endif
diff --git a/adb/daemon/logging.h b/adb/daemon/logging.h
deleted file mode 100644
index 3e28bef..0000000
--- a/adb/daemon/logging.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#pragma once
-
-#include <android-base/logging.h>
-
-namespace adb {
-enum class LogType {
-    Connection,
-    Service,
-    Shell,
-    COUNT,
-};
-
-bool is_logging_enabled(LogType type);
-
-#define ADB_LOG(type) ::adb::is_logging_enabled(::adb::LogType::type) && LOG(INFO)
-
-}  // namespace adb
diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp
deleted file mode 100644
index 7a0f7ff..0000000
--- a/adb/daemon/main.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "sysdeps.h"
-
-#if defined(__BIONIC__)
-#include <android/fdsan.h>
-#endif
-
-#include <errno.h>
-#include <getopt.h>
-#include <malloc.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/capability.h>
-#include <sys/prctl.h>
-
-#include <memory>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/macros.h>
-#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#if defined(__ANDROID__)
-#include <libminijail.h>
-#include <log/log_properties.h>
-#include <scoped_minijail.h>
-
-#include <private/android_filesystem_config.h>
-#include "selinux/android.h"
-#endif
-
-#include "adb.h"
-#include "adb_auth.h"
-#include "adb_listeners.h"
-#include "adb_utils.h"
-#include "adb_wifi.h"
-#include "socket_spec.h"
-#include "transport.h"
-
-#include "mdns.h"
-
-#if defined(__ANDROID__)
-static const char* root_seclabel = nullptr;
-
-static bool should_drop_privileges() {
-    // The properties that affect `adb root` and `adb unroot` are ro.secure and
-    // ro.debuggable. In this context the names don't make the expected behavior
-    // particularly obvious.
-    //
-    // ro.debuggable:
-    //   Allowed to become root, but not necessarily the default. Set to 1 on
-    //   eng and userdebug builds.
-    //
-    // ro.secure:
-    //   Drop privileges by default. Set to 1 on userdebug and user builds.
-    bool ro_secure = android::base::GetBoolProperty("ro.secure", true);
-    bool ro_debuggable = __android_log_is_debuggable();
-
-    // Drop privileges if ro.secure is set...
-    bool drop = ro_secure;
-
-    // ... except "adb root" lets you keep privileges in a debuggable build.
-    std::string prop = android::base::GetProperty("service.adb.root", "");
-    bool adb_root = (prop == "1");
-    bool adb_unroot = (prop == "0");
-    if (ro_debuggable && adb_root) {
-        drop = false;
-    }
-    // ... and "adb unroot" lets you explicitly drop privileges.
-    if (adb_unroot) {
-        drop = true;
-    }
-
-    return drop;
-}
-
-static void drop_privileges(int server_port) {
-    ScopedMinijail jail(minijail_new());
-
-    // Add extra groups:
-    // AID_ADB to access the USB driver
-    // AID_LOG to read system logs (adb logcat)
-    // AID_INPUT to diagnose input issues (getevent)
-    // AID_INET to diagnose network issues (ping)
-    // AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)
-    // AID_SDCARD_R to allow reading from the SD card
-    // AID_SDCARD_RW to allow writing to the SD card
-    // AID_NET_BW_STATS to read out qtaguid statistics
-    // AID_READPROC for reading /proc entries across UID boundaries
-    // AID_UHID for using 'hid' command to read/write to /dev/uhid
-    // AID_EXT_DATA_RW for writing to /sdcard/Android/data (devices without sdcardfs)
-    // AID_EXT_OBB_RW for writing to /sdcard/Android/obb (devices without sdcardfs)
-    gid_t groups[] = {AID_ADB,          AID_LOG,          AID_INPUT,    AID_INET,
-                      AID_NET_BT,       AID_NET_BT_ADMIN, AID_SDCARD_R, AID_SDCARD_RW,
-                      AID_NET_BW_STATS, AID_READPROC,     AID_UHID,     AID_EXT_DATA_RW,
-                      AID_EXT_OBB_RW};
-    minijail_set_supplementary_gids(jail.get(), arraysize(groups), groups);
-
-    // Don't listen on a port (default 5037) if running in secure mode.
-    // Don't run as root if running in secure mode.
-    if (should_drop_privileges()) {
-        const bool should_drop_caps = !__android_log_is_debuggable();
-
-        if (should_drop_caps) {
-            minijail_use_caps(jail.get(), CAP_TO_MASK(CAP_SETUID) | CAP_TO_MASK(CAP_SETGID));
-        }
-
-        minijail_change_gid(jail.get(), AID_SHELL);
-        minijail_change_uid(jail.get(), AID_SHELL);
-        // minijail_enter() will abort if any priv-dropping step fails.
-        minijail_enter(jail.get());
-
-        // Whenever ambient capabilities are being used, minijail cannot
-        // simultaneously drop the bounding capability set to just
-        // CAP_SETUID|CAP_SETGID while clearing the inheritable, effective,
-        // and permitted sets. So we need to do that in two steps.
-        using ScopedCaps =
-            std::unique_ptr<std::remove_pointer<cap_t>::type, std::function<void(cap_t)>>;
-        ScopedCaps caps(cap_get_proc(), &cap_free);
-        if (cap_clear_flag(caps.get(), CAP_INHERITABLE) == -1) {
-            PLOG(FATAL) << "cap_clear_flag(INHERITABLE) failed";
-        }
-        if (cap_clear_flag(caps.get(), CAP_EFFECTIVE) == -1) {
-            PLOG(FATAL) << "cap_clear_flag(PEMITTED) failed";
-        }
-        if (cap_clear_flag(caps.get(), CAP_PERMITTED) == -1) {
-            PLOG(FATAL) << "cap_clear_flag(PEMITTED) failed";
-        }
-        if (cap_set_proc(caps.get()) != 0) {
-            PLOG(FATAL) << "cap_set_proc() failed";
-        }
-
-        D("Local port disabled");
-    } else {
-        // minijail_enter() will abort if any priv-dropping step fails.
-        minijail_enter(jail.get());
-
-        if (root_seclabel != nullptr) {
-            if (selinux_android_setcon(root_seclabel) < 0) {
-                LOG(FATAL) << "Could not set SELinux context";
-            }
-        }
-        std::string error;
-        std::string local_name =
-            android::base::StringPrintf("tcp:%d", server_port);
-        if (install_listener(local_name, "*smartsocket*", nullptr, 0, nullptr, &error)) {
-            LOG(FATAL) << "Could not install *smartsocket* listener: " << error;
-        }
-    }
-}
-#endif
-
-static void setup_adb(const std::vector<std::string>& addrs) {
-#if defined(__ANDROID__)
-    // Get the first valid port from addrs and setup mDNS.
-    int port = -1;
-    std::string error;
-    for (const auto& addr : addrs) {
-        port = get_host_socket_spec_port(addr, &error);
-        if (port != -1) {
-            break;
-        }
-    }
-    if (port == -1) {
-        port = DEFAULT_ADB_LOCAL_TRANSPORT_PORT;
-    }
-    LOG(INFO) << "Setup mdns on port= " << port;
-    setup_mdns(port);
-#endif
-    for (const auto& addr : addrs) {
-        LOG(INFO) << "adbd listening on " << addr;
-        local_init(addr);
-    }
-}
-
-int adbd_main(int server_port) {
-    umask(0);
-
-    signal(SIGPIPE, SIG_IGN);
-
-#if defined(__BIONIC__)
-    auto fdsan_level = android_fdsan_get_error_level();
-    if (fdsan_level == ANDROID_FDSAN_ERROR_LEVEL_DISABLED) {
-        android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE);
-    }
-#endif
-
-    init_transport_registration();
-
-    // We need to call this even if auth isn't enabled because the file
-    // descriptor will always be open.
-    adbd_cloexec_auth_socket();
-
-#if defined(__ANDROID__)
-    // If we're on userdebug/eng or the device is unlocked, permit no-authentication.
-    bool device_unlocked = "orange" == android::base::GetProperty("ro.boot.verifiedbootstate", "");
-    if (__android_log_is_debuggable() || device_unlocked) {
-        auth_required = android::base::GetBoolProperty("ro.adb.secure", false);
-    }
-#endif
-
-    // Our external storage path may be different than apps, since
-    // we aren't able to bind mount after dropping root.
-    const char* adb_external_storage = getenv("ADB_EXTERNAL_STORAGE");
-    if (adb_external_storage != nullptr) {
-        setenv("EXTERNAL_STORAGE", adb_external_storage, 1);
-    } else {
-        D("Warning: ADB_EXTERNAL_STORAGE is not set.  Leaving EXTERNAL_STORAGE"
-          " unchanged.\n");
-    }
-
-#if defined(__ANDROID__)
-    drop_privileges(server_port);
-#endif
-
-    // adbd_auth_init will spawn a thread, so we need to defer it until after selinux transitions.
-    adbd_auth_init();
-
-    bool is_usb = false;
-
-#if defined(__ANDROID__)
-    if (access(USB_FFS_ADB_EP0, F_OK) == 0) {
-        // Listen on USB.
-        usb_init();
-        is_usb = true;
-    }
-#endif
-
-    // If one of these properties is set, also listen on that port.
-    // If one of the properties isn't set and we couldn't listen on usb, listen
-    // on the default port.
-    std::vector<std::string> addrs;
-    std::string prop_addr = android::base::GetProperty("service.adb.listen_addrs", "");
-    if (prop_addr.empty()) {
-        std::string prop_port = android::base::GetProperty("service.adb.tcp.port", "");
-        if (prop_port.empty()) {
-            prop_port = android::base::GetProperty("persist.adb.tcp.port", "");
-        }
-
-#if !defined(__ANDROID__)
-        if (prop_port.empty() && getenv("ADBD_PORT")) {
-            prop_port = getenv("ADBD_PORT");
-        }
-#endif
-
-        int port;
-        if (sscanf(prop_port.c_str(), "%d", &port) == 1 && port > 0) {
-            D("using tcp port=%d", port);
-            // Listen on TCP and VSOCK port specified by service.adb.tcp.port property.
-            addrs.push_back(android::base::StringPrintf("tcp:%d", port));
-            addrs.push_back(android::base::StringPrintf("vsock:%d", port));
-            setup_adb(addrs);
-        } else if (!is_usb) {
-            // Listen on default port.
-            addrs.push_back(
-                    android::base::StringPrintf("tcp:%d", DEFAULT_ADB_LOCAL_TRANSPORT_PORT));
-            addrs.push_back(
-                    android::base::StringPrintf("vsock:%d", DEFAULT_ADB_LOCAL_TRANSPORT_PORT));
-            setup_adb(addrs);
-        }
-    } else {
-        addrs = android::base::Split(prop_addr, ",");
-        setup_adb(addrs);
-    }
-
-    D("adbd_main(): pre init_jdwp()");
-    init_jdwp();
-    D("adbd_main(): post init_jdwp()");
-
-    D("Event loop starting");
-    fdevent_loop();
-
-    return 0;
-}
-
-int main(int argc, char** argv) {
-#if defined(__BIONIC__)
-    // Set M_DECAY_TIME so that our allocations aren't immediately purged on free.
-    mallopt(M_DECAY_TIME, 1);
-#endif
-
-    while (true) {
-        static struct option opts[] = {
-                {"root_seclabel", required_argument, nullptr, 's'},
-                {"device_banner", required_argument, nullptr, 'b'},
-                {"version", no_argument, nullptr, 'v'},
-                {"logpostfsdata", no_argument, nullptr, 'l'},
-        };
-
-        int option_index = 0;
-        int c = getopt_long(argc, argv, "", opts, &option_index);
-        if (c == -1) {
-            break;
-        }
-
-        switch (c) {
-#if defined(__ANDROID__)
-            case 's':
-                root_seclabel = optarg;
-                break;
-#endif
-            case 'b':
-                adb_device_banner = optarg;
-                break;
-            case 'v':
-                printf("Android Debug Bridge Daemon version %d.%d.%d\n", ADB_VERSION_MAJOR,
-                       ADB_VERSION_MINOR, ADB_SERVER_VERSION);
-                return 0;
-            case 'l':
-                LOG(ERROR) << "post-fs-data triggered";
-                return 0;
-            default:
-                // getopt already prints "adbd: invalid option -- %c" for us.
-                return 1;
-        }
-    }
-
-    close_stdin();
-
-    adb_trace_init(argv);
-
-    D("Handling main()");
-    return adbd_main(DEFAULT_ADB_PORT);
-}
diff --git a/adb/daemon/mdns.cpp b/adb/daemon/mdns.cpp
deleted file mode 100644
index fa692c0..0000000
--- a/adb/daemon/mdns.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "mdns.h"
-#include "adb_mdns.h"
-#include "sysdeps.h"
-
-#include <dns_sd.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <mutex>
-#include <random>
-#include <thread>
-
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-
-using namespace std::chrono_literals;
-
-static std::mutex& mdns_lock = *new std::mutex();
-static int port;
-static DNSServiceRef mdns_refs[kNumADBDNSServices];
-static bool mdns_registered[kNumADBDNSServices];
-
-void start_mdnsd() {
-    if (android::base::GetProperty("init.svc.mdnsd", "") == "running") {
-        return;
-    }
-
-    android::base::SetProperty("ctl.start", "mdnsd");
-
-    if (! android::base::WaitForProperty("init.svc.mdnsd", "running", 5s)) {
-        LOG(ERROR) << "Could not start mdnsd.";
-    }
-}
-
-static void mdns_callback(DNSServiceRef /*ref*/,
-                          DNSServiceFlags /*flags*/,
-                          DNSServiceErrorType errorCode,
-                          const char* /*name*/,
-                          const char* /*regtype*/,
-                          const char* /*domain*/,
-                          void* /*context*/) {
-    if (errorCode != kDNSServiceErr_NoError) {
-        LOG(ERROR) << "Encountered mDNS registration error ("
-            << errorCode << ").";
-    }
-}
-
-static void register_mdns_service(int index, int port, const std::string service_name) {
-    std::lock_guard<std::mutex> lock(mdns_lock);
-
-
-    // https://tools.ietf.org/html/rfc6763
-    // """
-    // The format of the data within a DNS TXT record is one or more
-    // strings, packed together in memory without any intervening gaps or
-    // padding bytes for word alignment.
-    //
-    // The format of each constituent string within the DNS TXT record is a
-    // single length byte, followed by 0-255 bytes of text data.
-    // """
-    //
-    // Therefore:
-    // 1. Begin with the string length
-    // 2. No null termination
-
-    std::vector<char> txtRecord;
-
-    if (kADBDNSServiceTxtRecords[index]) {
-        size_t txtRecordStringLength = strlen(kADBDNSServiceTxtRecords[index]);
-
-        txtRecord.resize(1 +                    // length byte
-                         txtRecordStringLength  // string bytes
-        );
-
-        txtRecord[0] = (char)txtRecordStringLength;
-        memcpy(txtRecord.data() + 1, kADBDNSServiceTxtRecords[index], txtRecordStringLength);
-    }
-
-    auto error = DNSServiceRegister(
-            &mdns_refs[index], 0, 0, service_name.c_str(), kADBDNSServices[index], nullptr, nullptr,
-            htobe16((uint16_t)port), (uint16_t)txtRecord.size(),
-            txtRecord.empty() ? nullptr : txtRecord.data(), mdns_callback, nullptr);
-
-    if (error != kDNSServiceErr_NoError) {
-        LOG(ERROR) << "Could not register mDNS service " << kADBDNSServices[index] << ", error ("
-                   << error << ").";
-        mdns_registered[index] = false;
-    }
-
-    mdns_registered[index] = true;
-
-    LOG(INFO) << "adbd mDNS service " << kADBDNSServices[index]
-              << " registered: " << mdns_registered[index];
-}
-
-static void unregister_mdns_service(int index) {
-    std::lock_guard<std::mutex> lock(mdns_lock);
-
-    if (mdns_registered[index]) {
-        DNSServiceRefDeallocate(mdns_refs[index]);
-    }
-}
-
-static void register_base_mdns_transport() {
-    std::string hostname = "adb-";
-    hostname += android::base::GetProperty("ro.serialno", "unidentified");
-    register_mdns_service(kADBTransportServiceRefIndex, port, hostname);
-}
-
-static void setup_mdns_thread() {
-    start_mdnsd();
-
-    // We will now only set up the normal transport mDNS service
-    // instead of registering all the adb secure mDNS services
-    // in the beginning. This is to provide more privacy/security.
-    register_base_mdns_transport();
-}
-
-// This also tears down any adb secure mDNS services, if they exist.
-static void teardown_mdns() {
-    for (int i = 0; i < kNumADBDNSServices; ++i) {
-        unregister_mdns_service(i);
-    }
-}
-
-static std::string RandomAlphaNumString(size_t len) {
-    std::string ret;
-    std::random_device rd;
-    std::mt19937 mt(rd());
-    // Generate values starting with zero and then up to enough to cover numeric
-    // digits, small letters and capital letters (26 each).
-    std::uniform_int_distribution<uint8_t> dist(0, 61);
-    for (size_t i = 0; i < len; ++i) {
-        uint8_t val = dist(mt);
-        if (val < 10) {
-            ret += '0' + val;
-        } else if (val < 36) {
-            ret += 'A' + (val - 10);
-        } else {
-            ret += 'a' + (val - 36);
-        }
-    }
-    return ret;
-}
-
-static std::string GenerateDeviceGuid() {
-    // The format is adb-<serial_no>-<six-random-alphanum>
-    std::string guid = "adb-";
-
-    std::string serial = android::base::GetProperty("ro.serialno", "");
-    if (serial.empty()) {
-        // Generate 16-bytes of random alphanum string
-        serial = RandomAlphaNumString(16);
-    }
-    guid += serial + '-';
-    // Random six-char suffix
-    guid += RandomAlphaNumString(6);
-    return guid;
-}
-
-static std::string ReadDeviceGuid() {
-    std::string guid = android::base::GetProperty("persist.adb.wifi.guid", "");
-    if (guid.empty()) {
-        guid = GenerateDeviceGuid();
-        CHECK(!guid.empty());
-        android::base::SetProperty("persist.adb.wifi.guid", guid);
-    }
-    return guid;
-}
-
-// Public interface/////////////////////////////////////////////////////////////
-
-void setup_mdns(int port_in) {
-    // Make sure the adb wifi guid is generated.
-    std::string guid = ReadDeviceGuid();
-    CHECK(!guid.empty());
-    port = port_in;
-    std::thread(setup_mdns_thread).detach();
-
-    // TODO: Make this more robust against a hard kill.
-    atexit(teardown_mdns);
-}
-
-void register_adb_secure_connect_service(int port) {
-    std::thread([port]() {
-        auto service_name = ReadDeviceGuid();
-        if (service_name.empty()) {
-            return;
-        }
-        LOG(INFO) << "Registering secure_connect service (" << service_name << ")";
-        register_mdns_service(kADBSecureConnectServiceRefIndex, port, service_name);
-    }).detach();
-}
-
-void unregister_adb_secure_connect_service() {
-    std::thread([]() { unregister_mdns_service(kADBSecureConnectServiceRefIndex); }).detach();
-}
-
-bool is_adb_secure_connect_service_registered() {
-    std::lock_guard<std::mutex> lock(mdns_lock);
-    return mdns_registered[kADBSecureConnectServiceRefIndex];
-}
diff --git a/adb/daemon/mdns.h b/adb/daemon/mdns.h
deleted file mode 100644
index e7e7a62..0000000
--- a/adb/daemon/mdns.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _DAEMON_MDNS_H_
-#define _DAEMON_MDNS_H_
-
-void setup_mdns(int port);
-
-void register_adb_secure_connect_service(int port);
-void unregister_adb_secure_connect_service();
-bool is_adb_secure_connect_service_registered();
-
-void start_mdnsd();
-#endif  // _DAEMON_MDNS_H_
diff --git a/adb/daemon/restart_service.cpp b/adb/daemon/restart_service.cpp
deleted file mode 100644
index 16d2627..0000000
--- a/adb/daemon/restart_service.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#define TRACE_TAG SERVICES
-
-#include "sysdeps.h"
-
-#include <unistd.h>
-
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
-#include <log/log_properties.h>
-
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-
-void restart_root_service(unique_fd fd) {
-    if (getuid() == 0) {
-        WriteFdExactly(fd.get(), "adbd is already running as root\n");
-        return;
-    }
-    if (!__android_log_is_debuggable()) {
-        WriteFdExactly(fd.get(), "adbd cannot run as root in production builds\n");
-        return;
-    }
-
-    LOG(INFO) << "adbd restarting as root";
-    android::base::SetProperty("service.adb.root", "1");
-    WriteFdExactly(fd.get(), "restarting adbd as root\n");
-}
-
-void restart_unroot_service(unique_fd fd) {
-    if (getuid() != 0) {
-        WriteFdExactly(fd.get(), "adbd not running as root\n");
-        return;
-    }
-
-    LOG(INFO) << "adbd restarting as nonroot";
-    android::base::SetProperty("service.adb.root", "0");
-    WriteFdExactly(fd.get(), "restarting adbd as non root\n");
-}
-
-void restart_tcp_service(unique_fd fd, int port) {
-    if (port <= 0) {
-        WriteFdFmt(fd.get(), "invalid port %d\n", port);
-        return;
-    }
-
-    LOG(INFO) << "adbd restarting in TCP mode (port = " << port << ")";
-    android::base::SetProperty("service.adb.tcp.port", android::base::StringPrintf("%d", port));
-    WriteFdFmt(fd.get(), "restarting in TCP mode port: %d\n", port);
-}
-
-void restart_usb_service(unique_fd fd) {
-    LOG(INFO) << "adbd restarting in USB mode";
-    android::base::SetProperty("service.adb.tcp.port", "0");
-    WriteFdExactly(fd.get(), "restarting in USB mode\n");
-}
diff --git a/adb/daemon/restart_service.h b/adb/daemon/restart_service.h
deleted file mode 100644
index 19840bd..0000000
--- a/adb/daemon/restart_service.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-
-#if defined(__ANDROID__)
-void restart_root_service(unique_fd fd);
-void restart_unroot_service(unique_fd fd);
-void restart_tcp_service(unique_fd fd, int port);
-void restart_usb_service(unique_fd fd);
-#endif
diff --git a/adb/daemon/services.cpp b/adb/daemon/services.cpp
deleted file mode 100644
index 6bbf66e..0000000
--- a/adb/daemon/services.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#define TRACE_TAG SERVICES
-
-#include "sysdeps.h"
-
-#include <errno.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#include <thread>
-
-#include <android-base/file.h>
-#include <android-base/parseint.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <android-base/unique_fd.h>
-#include <cutils/android_reboot.h>
-#include <cutils/sockets.h>
-#include <log/log_properties.h>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "services.h"
-#include "socket_spec.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-#include "daemon/file_sync_service.h"
-#include "daemon/framebuffer_service.h"
-#include "daemon/logging.h"
-#include "daemon/restart_service.h"
-#include "daemon/shell_service.h"
-
-void reconnect_service(unique_fd fd, atransport* t) {
-    WriteFdExactly(fd.get(), "done");
-    kick_transport(t);
-}
-
-unique_fd reverse_service(std::string_view command, atransport* transport) {
-    // TODO: Switch handle_forward_request to std::string_view.
-    std::string str(command);
-
-    int s[2];
-    if (adb_socketpair(s)) {
-        PLOG(ERROR) << "cannot create service socket pair.";
-        return unique_fd{};
-    }
-    VLOG(SERVICES) << "service socketpair: " << s[0] << ", " << s[1];
-    if (!handle_forward_request(str.c_str(), transport, s[1])) {
-        SendFail(s[1], "not a reverse forwarding command");
-    }
-    adb_close(s[1]);
-    return unique_fd{s[0]};
-}
-
-// Shell service string can look like:
-//   shell[,arg1,arg2,...]:[command]
-unique_fd ShellService(std::string_view args, const atransport* transport) {
-    size_t delimiter_index = args.find(':');
-    if (delimiter_index == std::string::npos) {
-        LOG(ERROR) << "No ':' found in shell service arguments: " << args;
-        return unique_fd{};
-    }
-
-    // TODO: android::base::Split(const std::string_view&, ...)
-    std::string service_args(args.substr(0, delimiter_index));
-    std::string command(args.substr(delimiter_index + 1));
-
-    // Defaults:
-    //   PTY for interactive, raw for non-interactive.
-    //   No protocol.
-    //   $TERM set to "dumb".
-    SubprocessType type(command.empty() ? SubprocessType::kPty : SubprocessType::kRaw);
-    SubprocessProtocol protocol = SubprocessProtocol::kNone;
-    std::string terminal_type = "dumb";
-
-    for (const std::string& arg : android::base::Split(service_args, ",")) {
-        if (arg == kShellServiceArgRaw) {
-            type = SubprocessType::kRaw;
-        } else if (arg == kShellServiceArgPty) {
-            type = SubprocessType::kPty;
-        } else if (arg == kShellServiceArgShellProtocol) {
-            protocol = SubprocessProtocol::kShell;
-        } else if (arg.starts_with("TERM=")) {
-            terminal_type = arg.substr(strlen("TERM="));
-        } else if (!arg.empty()) {
-            // This is not an error to allow for future expansion.
-            LOG(WARNING) << "Ignoring unknown shell service argument: " << arg;
-        }
-    }
-
-    return StartSubprocess(command, terminal_type.c_str(), type, protocol);
-}
-
-static void spin_service(unique_fd fd) {
-    if (!__android_log_is_debuggable()) {
-        WriteFdExactly(fd.get(), "refusing to spin on non-debuggable build\n");
-        return;
-    }
-
-    // A service that creates an fdevent that's always pending, and then ignores it.
-    unique_fd pipe_read, pipe_write;
-    if (!Pipe(&pipe_read, &pipe_write)) {
-        WriteFdExactly(fd.get(), "failed to create pipe\n");
-        return;
-    }
-
-    fdevent_run_on_main_thread([fd = pipe_read.release()]() {
-        fdevent* fde = fdevent_create(
-                fd, [](int, unsigned, void*) {}, nullptr);
-        fdevent_add(fde, FDE_READ);
-    });
-
-    WriteFdExactly(fd.get(), "spinning\n");
-}
-
-[[maybe_unused]] static unique_fd reboot_device(const std::string& name) {
-#if defined(__ANDROID_RECOVERY__)
-    if (!__android_log_is_debuggable()) {
-        auto reboot_service = [name](unique_fd fd) {
-            std::string reboot_string = android::base::StringPrintf("reboot,%s", name.c_str());
-            if (!android::base::SetProperty(ANDROID_RB_PROPERTY, reboot_string)) {
-                WriteFdFmt(fd.get(), "reboot (%s) failed\n", reboot_string.c_str());
-                return;
-            }
-            while (true) pause();
-        };
-        return create_service_thread("reboot", reboot_service);
-    }
-#endif
-    // Fall through
-    std::string cmd = "/system/bin/reboot ";
-    cmd += name;
-    return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone);
-}
-
-struct ServiceSocket : public asocket {
-    ServiceSocket() {
-        install_local_socket(this);
-        this->enqueue = [](asocket* self, apacket::payload_type data) {
-            return static_cast<ServiceSocket*>(self)->Enqueue(std::move(data));
-        };
-        this->ready = [](asocket* self) { return static_cast<ServiceSocket*>(self)->Ready(); };
-        this->close = [](asocket* self) { return static_cast<ServiceSocket*>(self)->Close(); };
-    }
-    virtual ~ServiceSocket() = default;
-
-    virtual int Enqueue(apacket::payload_type data) { return -1; }
-    virtual void Ready() {}
-    virtual void Close() {
-        if (peer) {
-            peer->peer = nullptr;
-            if (peer->shutdown) {
-                peer->shutdown(peer);
-            }
-            peer->close(peer);
-        }
-
-        remove_socket(this);
-        delete this;
-    }
-};
-
-struct SinkSocket : public ServiceSocket {
-    explicit SinkSocket(size_t byte_count) {
-        LOG(INFO) << "Creating new SinkSocket with capacity " << byte_count;
-        bytes_left_ = byte_count;
-    }
-
-    virtual ~SinkSocket() { LOG(INFO) << "SinkSocket destroyed"; }
-
-    virtual int Enqueue(apacket::payload_type data) override final {
-        if (bytes_left_ <= data.size()) {
-            // Done reading.
-            Close();
-            return -1;
-        }
-
-        bytes_left_ -= data.size();
-        return 0;
-    }
-
-    size_t bytes_left_;
-};
-
-struct SourceSocket : public ServiceSocket {
-    explicit SourceSocket(size_t byte_count) {
-        LOG(INFO) << "Creating new SourceSocket with capacity " << byte_count;
-        bytes_left_ = byte_count;
-    }
-
-    virtual ~SourceSocket() { LOG(INFO) << "SourceSocket destroyed"; }
-
-    void Ready() {
-        size_t len = std::min(bytes_left_, get_max_payload());
-        if (len == 0) {
-            Close();
-            return;
-        }
-
-        Block block(len);
-        memset(block.data(), 0, block.size());
-        peer->enqueue(peer, std::move(block));
-        bytes_left_ -= len;
-    }
-
-    int Enqueue(apacket::payload_type data) { return -1; }
-
-    size_t bytes_left_;
-};
-
-asocket* daemon_service_to_socket(std::string_view name) {
-    if (name == "jdwp") {
-        return create_jdwp_service_socket();
-    } else if (name == "track-jdwp") {
-        return create_jdwp_tracker_service_socket();
-    } else if (android::base::ConsumePrefix(&name, "sink:")) {
-        uint64_t byte_count = 0;
-        if (!ParseUint(&byte_count, name)) {
-            return nullptr;
-        }
-        return new SinkSocket(byte_count);
-    } else if (android::base::ConsumePrefix(&name, "source:")) {
-        uint64_t byte_count = 0;
-        if (!ParseUint(&byte_count, name)) {
-            return nullptr;
-        }
-        return new SourceSocket(byte_count);
-    }
-
-    return nullptr;
-}
-
-unique_fd daemon_service_to_fd(std::string_view name, atransport* transport) {
-    ADB_LOG(Service) << "transport " << transport->serial_name() << " opening service " << name;
-
-#if defined(__ANDROID__) && !defined(__ANDROID_RECOVERY__)
-    if (name.starts_with("abb:") || name.starts_with("abb_exec:")) {
-        return execute_abb_command(name);
-    }
-#endif
-
-#if defined(__ANDROID__)
-    if (name.starts_with("framebuffer:")) {
-        return create_service_thread("fb", framebuffer_service);
-    } else if (android::base::ConsumePrefix(&name, "remount:")) {
-        std::string cmd = "/system/bin/remount ";
-        cmd += name;
-        return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone);
-    } else if (android::base::ConsumePrefix(&name, "reboot:")) {
-        return reboot_device(std::string(name));
-    } else if (name.starts_with("root:")) {
-        return create_service_thread("root", restart_root_service);
-    } else if (name.starts_with("unroot:")) {
-        return create_service_thread("unroot", restart_unroot_service);
-    } else if (android::base::ConsumePrefix(&name, "backup:")) {
-        std::string cmd = "/system/bin/bu backup ";
-        cmd += name;
-        return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone);
-    } else if (name.starts_with("restore:")) {
-        return StartSubprocess("/system/bin/bu restore", nullptr, SubprocessType::kRaw,
-                               SubprocessProtocol::kNone);
-    } else if (name.starts_with("disable-verity:")) {
-        return StartSubprocess("/system/bin/disable-verity", nullptr, SubprocessType::kRaw,
-                               SubprocessProtocol::kNone);
-    } else if (name.starts_with("enable-verity:")) {
-        return StartSubprocess("/system/bin/enable-verity", nullptr, SubprocessType::kRaw,
-                               SubprocessProtocol::kNone);
-    } else if (android::base::ConsumePrefix(&name, "tcpip:")) {
-        std::string str(name);
-
-        int port;
-        if (sscanf(str.c_str(), "%d", &port) != 1) {
-            return unique_fd{};
-        }
-        return create_service_thread("tcp",
-                                     std::bind(restart_tcp_service, std::placeholders::_1, port));
-    } else if (name.starts_with("usb:")) {
-        return create_service_thread("usb", restart_usb_service);
-    }
-#endif
-
-    if (android::base::ConsumePrefix(&name, "dev:")) {
-        return unique_fd{unix_open(name, O_RDWR | O_CLOEXEC)};
-    } else if (android::base::ConsumePrefix(&name, "jdwp:")) {
-        pid_t pid;
-        if (!ParseUint(&pid, name)) {
-            return unique_fd{};
-        }
-        return create_jdwp_connection_fd(pid);
-    } else if (android::base::ConsumePrefix(&name, "shell")) {
-        return ShellService(name, transport);
-    } else if (android::base::ConsumePrefix(&name, "exec:")) {
-        return StartSubprocess(std::string(name), nullptr, SubprocessType::kRaw,
-                               SubprocessProtocol::kNone);
-    } else if (name.starts_with("sync:")) {
-        return create_service_thread("sync", file_sync_service);
-    } else if (android::base::ConsumePrefix(&name, "reverse:")) {
-        return reverse_service(name, transport);
-    } else if (name == "reconnect") {
-        return create_service_thread(
-                "reconnect", std::bind(reconnect_service, std::placeholders::_1, transport));
-    } else if (name == "spin") {
-        return create_service_thread("spin", spin_service);
-    }
-
-    return unique_fd{};
-}
diff --git a/adb/daemon/shell_service.cpp b/adb/daemon/shell_service.cpp
deleted file mode 100644
index fbfae1e..0000000
--- a/adb/daemon/shell_service.cpp
+++ /dev/null
@@ -1,911 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-// Functionality for launching and managing shell subprocesses.
-//
-// There are two types of subprocesses, PTY or raw. PTY is typically used for
-// an interactive session, raw for non-interactive. There are also two methods
-// of communication with the subprocess, passing raw data or using a simple
-// protocol to wrap packets. The protocol allows separating stdout/stderr and
-// passing the exit code back, but is not backwards compatible.
-//   ----------------+--------------------------------------
-//   Type  Protocol  |   Exit code?  Separate stdout/stderr?
-//   ----------------+--------------------------------------
-//   PTY   No        |   No          No
-//   Raw   No        |   No          No
-//   PTY   Yes       |   Yes         No
-//   Raw   Yes       |   Yes         Yes
-//   ----------------+--------------------------------------
-//
-// Non-protocol subprocesses work by passing subprocess stdin/out/err through
-// a single pipe which is registered with a local socket in adbd. The local
-// socket uses the fdevent loop to pass raw data between this pipe and the
-// transport, which then passes data back to the adb client. Cleanup is done by
-// waiting in a separate thread for the subprocesses to exit and then signaling
-// a separate fdevent to close out the local socket from the main loop.
-//
-// ------------------+-------------------------+------------------------------
-//   Subprocess      |  adbd subprocess thread |   adbd main fdevent loop
-// ------------------+-------------------------+------------------------------
-//                   |                         |
-//   stdin/out/err <----------------------------->       LocalSocket
-//      |            |                         |
-//      |            |      Block on exit      |
-//      |            |           *             |
-//      v            |           *             |
-//     Exit         --->      Unblock          |
-//                   |           |             |
-//                   |           v             |
-//                   |   Notify shell exit FD --->    Close LocalSocket
-// ------------------+-------------------------+------------------------------
-//
-// The protocol requires the thread to intercept stdin/out/err in order to
-// wrap/unwrap data with shell protocol packets.
-//
-// ------------------+-------------------------+------------------------------
-//   Subprocess      |  adbd subprocess thread |   adbd main fdevent loop
-// ------------------+-------------------------+------------------------------
-//                   |                         |
-//     stdin/out   <--->      Protocol       <--->       LocalSocket
-//     stderr       --->      Protocol        --->       LocalSocket
-//       |           |                         |
-//       v           |                         |
-//      Exit        --->  Exit code protocol  --->       LocalSocket
-//                   |           |             |
-//                   |           v             |
-//                   |   Notify shell exit FD --->    Close LocalSocket
-// ------------------+-------------------------+------------------------------
-//
-// An alternate approach is to put the protocol wrapping/unwrapping in the main
-// fdevent loop, which has the advantage of being able to re-use the existing
-// select() code for handling data streams. However, implementation turned out
-// to be more complex due to partial reads and non-blocking I/O so this model
-// was chosen instead.
-
-#define TRACE_TAG SHELL
-
-#include "sysdeps.h"
-
-#include "shell_service.h"
-
-#include <errno.h>
-#include <paths.h>
-#include <pty.h>
-#include <pwd.h>
-#include <termios.h>
-
-#include <memory>
-#include <string>
-#include <thread>
-#include <unordered_map>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
-#include <private/android_logger.h>
-
-#if defined(__ANDROID__)
-#include <selinux/android.h>
-#endif
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "daemon/logging.h"
-#include "security_log_tags.h"
-#include "shell_protocol.h"
-
-namespace {
-
-// Reads from |fd| until close or failure.
-std::string ReadAll(borrowed_fd fd) {
-    char buffer[512];
-    std::string received;
-
-    while (1) {
-        int bytes = adb_read(fd, buffer, sizeof(buffer));
-        if (bytes <= 0) {
-            break;
-        }
-        received.append(buffer, bytes);
-    }
-
-    return received;
-}
-
-// Creates a socketpair and saves the endpoints to |fd1| and |fd2|.
-bool CreateSocketpair(unique_fd* fd1, unique_fd* fd2) {
-    int sockets[2];
-    if (adb_socketpair(sockets) < 0) {
-        PLOG(ERROR) << "cannot create socket pair";
-        return false;
-    }
-    fd1->reset(sockets[0]);
-    fd2->reset(sockets[1]);
-    return true;
-}
-
-struct SubprocessPollfds {
-    adb_pollfd pfds[3];
-
-    adb_pollfd* data() { return pfds; }
-    size_t size() { return 3; }
-
-    adb_pollfd* begin() { return pfds; }
-    adb_pollfd* end() { return pfds + size(); }
-
-    adb_pollfd& stdinout_pfd() { return pfds[0]; }
-    adb_pollfd& stderr_pfd() { return pfds[1]; }
-    adb_pollfd& protocol_pfd() { return pfds[2]; }
-};
-
-class Subprocess {
-  public:
-    Subprocess(std::string command, const char* terminal_type, SubprocessType type,
-               SubprocessProtocol protocol, bool make_pty_raw);
-    ~Subprocess();
-
-    const std::string& command() const { return command_; }
-
-    int ReleaseLocalSocket() { return local_socket_sfd_.release(); }
-
-    pid_t pid() const { return pid_; }
-
-    // Sets up FDs, forks a subprocess, starts the subprocess manager thread,
-    // and exec's the child. Returns false and sets error on failure.
-    bool ForkAndExec(std::string* _Nonnull error);
-
-    // Sets up FDs, starts a thread executing command and the manager thread,
-    // Returns false and sets error on failure.
-    bool ExecInProcess(Command command, std::string* _Nonnull error);
-
-    // Start the subprocess manager thread. Consumes the subprocess, regardless of success.
-    // Returns false and sets error on failure.
-    static bool StartThread(std::unique_ptr<Subprocess> subprocess,
-                            std::string* _Nonnull error);
-
-  private:
-    // Opens the file at |pts_name|.
-    int OpenPtyChildFd(const char* pts_name, unique_fd* error_sfd);
-
-    bool ConnectProtocolEndpoints(std::string* _Nonnull error);
-
-    static void ThreadHandler(void* userdata);
-    void PassDataStreams();
-    void WaitForExit();
-
-    unique_fd* PollLoop(SubprocessPollfds* pfds);
-
-    // Input/output stream handlers. Success returns nullptr, failure returns
-    // a pointer to the failed FD.
-    unique_fd* PassInput();
-    unique_fd* PassOutput(unique_fd* sfd, ShellProtocol::Id id);
-
-    const std::string command_;
-    const std::string terminal_type_;
-    SubprocessType type_;
-    SubprocessProtocol protocol_;
-    bool make_pty_raw_;
-    pid_t pid_ = -1;
-    unique_fd local_socket_sfd_;
-
-    // Shell protocol variables.
-    unique_fd stdinout_sfd_, stderr_sfd_, protocol_sfd_;
-    std::unique_ptr<ShellProtocol> input_, output_;
-    size_t input_bytes_left_ = 0;
-
-    DISALLOW_COPY_AND_ASSIGN(Subprocess);
-};
-
-Subprocess::Subprocess(std::string command, const char* terminal_type, SubprocessType type,
-                       SubprocessProtocol protocol, bool make_pty_raw)
-    : command_(std::move(command)),
-      terminal_type_(terminal_type ? terminal_type : ""),
-      type_(type),
-      protocol_(protocol),
-      make_pty_raw_(make_pty_raw) {}
-
-Subprocess::~Subprocess() {
-    WaitForExit();
-}
-
-static std::string GetHostName() {
-    char buf[HOST_NAME_MAX];
-    if (gethostname(buf, sizeof(buf)) != -1 && strcmp(buf, "localhost") != 0) return buf;
-
-    return android::base::GetProperty("ro.product.device", "android");
-}
-
-bool Subprocess::ForkAndExec(std::string* error) {
-    unique_fd child_stdinout_sfd, child_stderr_sfd;
-    unique_fd parent_error_sfd, child_error_sfd;
-    const char* pts_name = nullptr;
-
-    if (command_.empty()) {
-        __android_log_security_bswrite(SEC_TAG_ADB_SHELL_INTERACTIVE, "");
-    } else {
-        __android_log_security_bswrite(SEC_TAG_ADB_SHELL_CMD, command_.c_str());
-    }
-
-    // Create a socketpair for the fork() child to report any errors back to the parent. Since we
-    // use threads, logging directly from the child might deadlock due to locks held in another
-    // thread during the fork.
-    if (!CreateSocketpair(&parent_error_sfd, &child_error_sfd)) {
-        *error = android::base::StringPrintf(
-            "failed to create pipe for subprocess error reporting: %s", strerror(errno));
-        return false;
-    }
-
-    // Construct the environment for the child before we fork.
-    passwd* pw = getpwuid(getuid());
-    std::unordered_map<std::string, std::string> env;
-    if (environ) {
-        char** current = environ;
-        while (char* env_cstr = *current++) {
-            std::string env_string = env_cstr;
-            char* delimiter = strchr(&env_string[0], '=');
-
-            // Drop any values that don't contain '='.
-            if (delimiter) {
-                *delimiter++ = '\0';
-                env[env_string.c_str()] = delimiter;
-            }
-        }
-    }
-
-    if (pw != nullptr) {
-        env["HOME"] = pw->pw_dir;
-        env["HOSTNAME"] = GetHostName();
-        env["LOGNAME"] = pw->pw_name;
-        env["SHELL"] = pw->pw_shell;
-        env["TMPDIR"] = "/data/local/tmp";
-        env["USER"] = pw->pw_name;
-    }
-
-    if (!terminal_type_.empty()) {
-        env["TERM"] = terminal_type_;
-    }
-
-    std::vector<std::string> joined_env;
-    for (const auto& it : env) {
-        const char* key = it.first.c_str();
-        const char* value = it.second.c_str();
-        joined_env.push_back(android::base::StringPrintf("%s=%s", key, value));
-    }
-
-    std::vector<const char*> cenv;
-    for (const std::string& str : joined_env) {
-        cenv.push_back(str.c_str());
-    }
-    cenv.push_back(nullptr);
-
-    if (type_ == SubprocessType::kPty) {
-        unique_fd pty_master(posix_openpt(O_RDWR | O_NOCTTY | O_CLOEXEC));
-        if (pty_master == -1) {
-            *error =
-                    android::base::StringPrintf("failed to create pty master: %s", strerror(errno));
-            return false;
-        }
-        if (unlockpt(pty_master.get()) != 0) {
-            *error = android::base::StringPrintf("failed to unlockpt pty master: %s",
-                                                 strerror(errno));
-            return false;
-        }
-
-        pid_ = fork();
-        pts_name = ptsname(pty_master.get());
-        if (pid_ > 0) {
-            stdinout_sfd_ = std::move(pty_master);
-        }
-    } else {
-        if (!CreateSocketpair(&stdinout_sfd_, &child_stdinout_sfd)) {
-            *error = android::base::StringPrintf("failed to create socketpair for stdin/out: %s",
-                                                 strerror(errno));
-            return false;
-        }
-        // Raw subprocess + shell protocol allows for splitting stderr.
-        if (protocol_ == SubprocessProtocol::kShell &&
-                !CreateSocketpair(&stderr_sfd_, &child_stderr_sfd)) {
-            *error = android::base::StringPrintf("failed to create socketpair for stderr: %s",
-                                                 strerror(errno));
-            return false;
-        }
-        pid_ = fork();
-    }
-
-    if (pid_ == -1) {
-        *error = android::base::StringPrintf("fork failed: %s", strerror(errno));
-        return false;
-    }
-
-    if (pid_ == 0) {
-        // Subprocess child.
-        setsid();
-
-        if (type_ == SubprocessType::kPty) {
-            child_stdinout_sfd.reset(OpenPtyChildFd(pts_name, &child_error_sfd));
-        }
-
-        dup2(child_stdinout_sfd.get(), STDIN_FILENO);
-        dup2(child_stdinout_sfd.get(), STDOUT_FILENO);
-        dup2(child_stderr_sfd != -1 ? child_stderr_sfd.get() : child_stdinout_sfd.get(),
-             STDERR_FILENO);
-
-        // exec doesn't trigger destructors, close the FDs manually.
-        stdinout_sfd_.reset(-1);
-        stderr_sfd_.reset(-1);
-        child_stdinout_sfd.reset(-1);
-        child_stderr_sfd.reset(-1);
-        parent_error_sfd.reset(-1);
-        close_on_exec(child_error_sfd);
-
-        // adbd sets SIGPIPE to SIG_IGN to get EPIPE instead, and Linux propagates that to child
-        // processes, so we need to manually reset back to SIG_DFL here (http://b/35209888).
-        signal(SIGPIPE, SIG_DFL);
-
-        // Increase oom_score_adj from -1000, so that the child is visible to the OOM-killer.
-        // Don't treat failure as an error, because old Android kernels explicitly disabled this.
-        int oom_score_adj_fd = adb_open("/proc/self/oom_score_adj", O_WRONLY | O_CLOEXEC);
-        if (oom_score_adj_fd != -1) {
-            const char* oom_score_adj_value = "-950";
-            TEMP_FAILURE_RETRY(
-                adb_write(oom_score_adj_fd, oom_score_adj_value, strlen(oom_score_adj_value)));
-        }
-
-#ifdef __ANDROID_RECOVERY__
-        // Special routine for recovery. Switch to shell domain when adbd is
-        // is running with dropped privileged (i.e. not running as root) and
-        // is built for the recovery mode. This is required because recovery
-        // rootfs is not labeled and everything is labeled just as rootfs.
-        char* con = nullptr;
-        if (getcon(&con) == 0) {
-            if (!strcmp(con, "u:r:adbd:s0")) {
-                if (selinux_android_setcon("u:r:shell:s0") < 0) {
-                    LOG(FATAL) << "Could not set SELinux context for subprocess";
-                }
-            }
-            freecon(con);
-        } else {
-            LOG(FATAL) << "Failed to get SELinux context";
-        }
-#endif
-
-        if (command_.empty()) {
-            // Spawn a login shell if we don't have a command.
-            execle(_PATH_BSHELL, "-" _PATH_BSHELL, nullptr, cenv.data());
-        } else {
-            execle(_PATH_BSHELL, _PATH_BSHELL, "-c", command_.c_str(), nullptr, cenv.data());
-        }
-        WriteFdExactly(child_error_sfd, "exec '" _PATH_BSHELL "' failed: ");
-        WriteFdExactly(child_error_sfd, strerror(errno));
-        child_error_sfd.reset(-1);
-        _Exit(1);
-    }
-
-    // Subprocess parent.
-    D("subprocess parent: stdin/stdout FD = %d, stderr FD = %d",
-      stdinout_sfd_.get(), stderr_sfd_.get());
-
-    // Wait to make sure the subprocess exec'd without error.
-    child_error_sfd.reset(-1);
-    std::string error_message = ReadAll(parent_error_sfd);
-    if (!error_message.empty()) {
-        *error = error_message;
-        return false;
-    }
-
-    D("subprocess parent: exec completed");
-    if (!ConnectProtocolEndpoints(error)) {
-        kill(pid_, SIGKILL);
-        return false;
-    }
-
-    D("subprocess parent: completed");
-    return true;
-}
-
-bool Subprocess::ExecInProcess(Command command, std::string* _Nonnull error) {
-    unique_fd child_stdinout_sfd, child_stderr_sfd;
-
-    CHECK(type_ == SubprocessType::kRaw);
-
-    __android_log_security_bswrite(SEC_TAG_ADB_SHELL_CMD, command_.c_str());
-
-    if (!CreateSocketpair(&stdinout_sfd_, &child_stdinout_sfd)) {
-        *error = android::base::StringPrintf("failed to create socketpair for stdin/out: %s",
-                                             strerror(errno));
-        return false;
-    }
-    if (protocol_ == SubprocessProtocol::kShell) {
-        // Shell protocol allows for splitting stderr.
-        if (!CreateSocketpair(&stderr_sfd_, &child_stderr_sfd)) {
-            *error = android::base::StringPrintf("failed to create socketpair for stderr: %s",
-                                                 strerror(errno));
-            return false;
-        }
-    } else {
-        // Raw protocol doesn't support multiple output streams, so combine stdout and stderr.
-        child_stderr_sfd.reset(dup(child_stdinout_sfd.get()));
-    }
-
-    D("execinprocess: stdin/stdout FD = %d, stderr FD = %d", stdinout_sfd_.get(),
-      stderr_sfd_.get());
-
-    if (!ConnectProtocolEndpoints(error)) {
-        return false;
-    }
-
-    std::thread([inout_sfd = std::move(child_stdinout_sfd), err_sfd = std::move(child_stderr_sfd),
-                 command = std::move(command),
-                 args = command_]() { command(args, inout_sfd, inout_sfd, err_sfd); })
-            .detach();
-
-    D("execinprocess: completed");
-    return true;
-}
-
-bool Subprocess::ConnectProtocolEndpoints(std::string* _Nonnull error) {
-    if (protocol_ == SubprocessProtocol::kNone) {
-        // No protocol: all streams pass through the stdinout FD and hook
-        // directly into the local socket for raw data transfer.
-        local_socket_sfd_.reset(stdinout_sfd_.release());
-    } else {
-        // Required for shell protocol: create another socketpair to intercept data.
-        if (!CreateSocketpair(&protocol_sfd_, &local_socket_sfd_)) {
-            *error = android::base::StringPrintf(
-                    "failed to create socketpair to intercept data: %s", strerror(errno));
-            return false;
-        }
-        D("protocol FD = %d", protocol_sfd_.get());
-
-        input_ = std::make_unique<ShellProtocol>(protocol_sfd_);
-        output_ = std::make_unique<ShellProtocol>(protocol_sfd_);
-        if (!input_ || !output_) {
-            *error = "failed to allocate shell protocol objects";
-            return false;
-        }
-
-        // Don't let reads/writes to the subprocess block our thread. This isn't
-        // likely but could happen under unusual circumstances, such as if we
-        // write a ton of data to stdin but the subprocess never reads it and
-        // the pipe fills up.
-        for (int fd : {stdinout_sfd_.get(), stderr_sfd_.get()}) {
-            if (fd >= 0) {
-                if (!set_file_block_mode(fd, false)) {
-                    *error = android::base::StringPrintf(
-                            "failed to set non-blocking mode for fd %d", fd);
-                    return false;
-                }
-            }
-        }
-    }
-
-    return true;
-}
-
-bool Subprocess::StartThread(std::unique_ptr<Subprocess> subprocess, std::string* error) {
-    Subprocess* raw = subprocess.release();
-    std::thread(ThreadHandler, raw).detach();
-
-    return true;
-}
-
-int Subprocess::OpenPtyChildFd(const char* pts_name, unique_fd* error_sfd) {
-    int child_fd = adb_open(pts_name, O_RDWR | O_CLOEXEC);
-    if (child_fd == -1) {
-        // Don't use WriteFdFmt; since we're in the fork() child we don't want
-        // to allocate any heap memory to avoid race conditions.
-        const char* messages[] = {"child failed to open pseudo-term slave ",
-                                  pts_name, ": ", strerror(errno)};
-        for (const char* message : messages) {
-            WriteFdExactly(*error_sfd, message);
-        }
-        abort();
-    }
-
-    if (make_pty_raw_) {
-        termios tattr;
-        if (tcgetattr(child_fd, &tattr) == -1) {
-            int saved_errno = errno;
-            WriteFdExactly(*error_sfd, "tcgetattr failed: ");
-            WriteFdExactly(*error_sfd, strerror(saved_errno));
-            abort();
-        }
-
-        cfmakeraw(&tattr);
-        if (tcsetattr(child_fd, TCSADRAIN, &tattr) == -1) {
-            int saved_errno = errno;
-            WriteFdExactly(*error_sfd, "tcsetattr failed: ");
-            WriteFdExactly(*error_sfd, strerror(saved_errno));
-            abort();
-        }
-    }
-
-    return child_fd;
-}
-
-void Subprocess::ThreadHandler(void* userdata) {
-    Subprocess* subprocess = reinterpret_cast<Subprocess*>(userdata);
-
-    adb_thread_setname(android::base::StringPrintf("shell svc %d", subprocess->pid()));
-
-    D("passing data streams for PID %d", subprocess->pid());
-    subprocess->PassDataStreams();
-
-    D("deleting Subprocess for PID %d", subprocess->pid());
-    delete subprocess;
-}
-
-void Subprocess::PassDataStreams() {
-    if (protocol_sfd_ == -1) {
-        return;
-    }
-
-    // Start by trying to read from the protocol FD, stdout, and stderr.
-    SubprocessPollfds pfds;
-    pfds.stdinout_pfd() = {.fd = stdinout_sfd_.get(), .events = POLLIN};
-    pfds.stderr_pfd() = {.fd = stderr_sfd_.get(), .events = POLLIN};
-    pfds.protocol_pfd() = {.fd = protocol_sfd_.get(), .events = POLLIN};
-
-    // Pass data until the protocol FD or both the subprocess pipes die, at
-    // which point we can't pass any more data.
-    while (protocol_sfd_ != -1 && (stdinout_sfd_ != -1 || stderr_sfd_ != -1)) {
-        unique_fd* dead_sfd = PollLoop(&pfds);
-        if (dead_sfd) {
-            D("closing FD %d", dead_sfd->get());
-            auto it = std::find_if(pfds.begin(), pfds.end(), [=](const adb_pollfd& pfd) {
-                return pfd.fd == dead_sfd->get();
-            });
-            CHECK(it != pfds.end());
-            it->fd = -1;
-            it->events = 0;
-            if (dead_sfd == &protocol_sfd_) {
-                // Using SIGHUP is a decent general way to indicate that the
-                // controlling process is going away. If specific signals are
-                // needed (e.g. SIGINT), pass those through the shell protocol
-                // and only fall back on this for unexpected closures.
-                D("protocol FD died, sending SIGHUP to pid %d", pid_);
-                if (pid_ != -1) {
-                    kill(pid_, SIGHUP);
-                }
-
-                // We also need to close the pipes connected to the child process
-                // so that if it ignores SIGHUP and continues to write data it
-                // won't fill up the pipe and block.
-                stdinout_sfd_.reset();
-                stderr_sfd_.reset();
-            }
-            dead_sfd->reset();
-        }
-    }
-}
-
-unique_fd* Subprocess::PollLoop(SubprocessPollfds* pfds) {
-    unique_fd* dead_sfd = nullptr;
-    adb_pollfd& stdinout_pfd = pfds->stdinout_pfd();
-    adb_pollfd& stderr_pfd = pfds->stderr_pfd();
-    adb_pollfd& protocol_pfd = pfds->protocol_pfd();
-
-    // Keep calling poll() and passing data until an FD closes/errors.
-    while (!dead_sfd) {
-        if (adb_poll(pfds->data(), pfds->size(), -1) < 0) {
-            if (errno == EINTR) {
-                continue;
-            } else {
-                PLOG(ERROR) << "poll failed, closing subprocess pipes";
-                stdinout_sfd_.reset(-1);
-                stderr_sfd_.reset(-1);
-                return nullptr;
-            }
-        }
-
-        // Read stdout, write to protocol FD.
-        if (stdinout_pfd.fd != -1 && (stdinout_pfd.revents & POLLIN)) {
-            dead_sfd = PassOutput(&stdinout_sfd_, ShellProtocol::kIdStdout);
-        }
-
-        // Read stderr, write to protocol FD.
-        if (!dead_sfd && stderr_pfd.fd != 1 && (stderr_pfd.revents & POLLIN)) {
-            dead_sfd = PassOutput(&stderr_sfd_, ShellProtocol::kIdStderr);
-        }
-
-        // Read protocol FD, write to stdin.
-        if (!dead_sfd && protocol_pfd.fd != -1 && (protocol_pfd.revents & POLLIN)) {
-            dead_sfd = PassInput();
-            // If we didn't finish writing, block on stdin write.
-            if (input_bytes_left_) {
-                protocol_pfd.events &= ~POLLIN;
-                stdinout_pfd.events |= POLLOUT;
-            }
-        }
-
-        // Continue writing to stdin; only happens if a previous write blocked.
-        if (!dead_sfd && stdinout_pfd.fd != -1 && (stdinout_pfd.revents & POLLOUT)) {
-            dead_sfd = PassInput();
-            // If we finished writing, go back to blocking on protocol read.
-            if (!input_bytes_left_) {
-                protocol_pfd.events |= POLLIN;
-                stdinout_pfd.events &= ~POLLOUT;
-            }
-        }
-
-        // After handling all of the events we've received, check to see if any fds have died.
-        if (stdinout_pfd.revents & (POLLHUP | POLLRDHUP | POLLERR | POLLNVAL)) {
-            return &stdinout_sfd_;
-        }
-
-        if (stderr_pfd.revents & (POLLHUP | POLLRDHUP | POLLERR | POLLNVAL)) {
-            return &stderr_sfd_;
-        }
-
-        if (protocol_pfd.revents & (POLLHUP | POLLRDHUP | POLLERR | POLLNVAL)) {
-            return &protocol_sfd_;
-        }
-    }  // while (!dead_sfd)
-
-    return dead_sfd;
-}
-
-unique_fd* Subprocess::PassInput() {
-    // Only read a new packet if we've finished writing the last one.
-    if (!input_bytes_left_) {
-        if (!input_->Read()) {
-            // Read() uses ReadFdExactly() which sets errno to 0 on EOF.
-            if (errno != 0) {
-                PLOG(ERROR) << "error reading protocol FD " << protocol_sfd_.get();
-            }
-            return &protocol_sfd_;
-        }
-
-        if (stdinout_sfd_ != -1) {
-            switch (input_->id()) {
-                case ShellProtocol::kIdWindowSizeChange:
-                    int rows, cols, x_pixels, y_pixels;
-                    if (sscanf(input_->data(), "%dx%d,%dx%d",
-                               &rows, &cols, &x_pixels, &y_pixels) == 4) {
-                        winsize ws;
-                        ws.ws_row = rows;
-                        ws.ws_col = cols;
-                        ws.ws_xpixel = x_pixels;
-                        ws.ws_ypixel = y_pixels;
-                        ioctl(stdinout_sfd_.get(), TIOCSWINSZ, &ws);
-                    }
-                    break;
-                case ShellProtocol::kIdStdin:
-                    input_bytes_left_ = input_->data_length();
-                    break;
-                case ShellProtocol::kIdCloseStdin:
-                    if (type_ == SubprocessType::kRaw) {
-                        if (adb_shutdown(stdinout_sfd_, SHUT_WR) == 0) {
-                            return nullptr;
-                        }
-                        PLOG(ERROR) << "failed to shutdown writes to FD " << stdinout_sfd_.get();
-                        return &stdinout_sfd_;
-                    } else {
-                        // PTYs can't close just input, so rather than close the
-                        // FD and risk losing subprocess output, leave it open.
-                        // This only happens if the client starts a PTY shell
-                        // non-interactively which is rare and unsupported.
-                        // If necessary, the client can manually close the shell
-                        // with `exit` or by killing the adb client process.
-                        D("can't close input for PTY FD %d", stdinout_sfd_.get());
-                    }
-                    break;
-            }
-        }
-    }
-
-    if (input_bytes_left_ > 0) {
-        int index = input_->data_length() - input_bytes_left_;
-        int bytes = adb_write(stdinout_sfd_, input_->data() + index, input_bytes_left_);
-        if (bytes == 0 || (bytes < 0 && errno != EAGAIN)) {
-            if (bytes < 0) {
-                PLOG(ERROR) << "error reading stdin FD " << stdinout_sfd_.get();
-            }
-            // stdin is done, mark this packet as finished and we'll just start
-            // dumping any further data received from the protocol FD.
-            input_bytes_left_ = 0;
-            return &stdinout_sfd_;
-        } else if (bytes > 0) {
-            input_bytes_left_ -= bytes;
-        }
-    }
-
-    return nullptr;
-}
-
-unique_fd* Subprocess::PassOutput(unique_fd* sfd, ShellProtocol::Id id) {
-    int bytes = adb_read(*sfd, output_->data(), output_->data_capacity());
-    if (bytes == 0 || (bytes < 0 && errno != EAGAIN)) {
-        // read() returns EIO if a PTY closes; don't report this as an error,
-        // it just means the subprocess completed.
-        if (bytes < 0 && !(type_ == SubprocessType::kPty && errno == EIO)) {
-            PLOG(ERROR) << "error reading output FD " << sfd->get();
-        }
-        return sfd;
-    }
-
-    if (bytes > 0 && !output_->Write(id, bytes)) {
-        if (errno != 0) {
-            PLOG(ERROR) << "error reading protocol FD " << protocol_sfd_.get();
-        }
-        return &protocol_sfd_;
-    }
-
-    return nullptr;
-}
-
-void Subprocess::WaitForExit() {
-    int exit_code = 1;
-
-    D("waiting for pid %d", pid_);
-    while (pid_ != -1) {
-        int status;
-        if (pid_ == waitpid(pid_, &status, 0)) {
-            D("post waitpid (pid=%d) status=%04x", pid_, status);
-            if (WIFSIGNALED(status)) {
-                exit_code = 0x80 | WTERMSIG(status);
-                ADB_LOG(Shell) << "subprocess " << pid_ << " killed by signal " << WTERMSIG(status);
-                break;
-            } else if (!WIFEXITED(status)) {
-                D("subprocess didn't exit");
-                break;
-            } else if (WEXITSTATUS(status) >= 0) {
-                exit_code = WEXITSTATUS(status);
-                ADB_LOG(Shell) << "subprocess " << pid_ << " exited with status " << exit_code;
-                break;
-            }
-        }
-    }
-
-    // If we have an open protocol FD send an exit packet.
-    if (protocol_sfd_ != -1) {
-        output_->data()[0] = exit_code;
-        if (output_->Write(ShellProtocol::kIdExit, 1)) {
-            D("wrote the exit code packet: %d", exit_code);
-        } else {
-            PLOG(ERROR) << "failed to write the exit code packet";
-        }
-        protocol_sfd_.reset(-1);
-    }
-}
-
-}  // namespace
-
-// Create a pipe containing the error.
-unique_fd ReportError(SubprocessProtocol protocol, const std::string& message) {
-    unique_fd read, write;
-    if (!Pipe(&read, &write)) {
-        PLOG(ERROR) << "failed to create pipe to report error";
-        return unique_fd{};
-    }
-
-    std::string buf = android::base::StringPrintf("error: %s\n", message.c_str());
-    if (protocol == SubprocessProtocol::kShell) {
-        ShellProtocol::Id id = ShellProtocol::kIdStderr;
-        uint32_t length = buf.length();
-        WriteFdExactly(write.get(), &id, sizeof(id));
-        WriteFdExactly(write.get(), &length, sizeof(length));
-    }
-
-    WriteFdExactly(write.get(), buf.data(), buf.length());
-
-    if (protocol == SubprocessProtocol::kShell) {
-        ShellProtocol::Id id = ShellProtocol::kIdExit;
-        uint32_t length = 1;
-        char exit_code = 126;
-        WriteFdExactly(write.get(), &id, sizeof(id));
-        WriteFdExactly(write.get(), &length, sizeof(length));
-        WriteFdExactly(write.get(), &exit_code, sizeof(exit_code));
-    }
-
-    return read;
-}
-
-unique_fd StartSubprocess(std::string name, const char* terminal_type, SubprocessType type,
-                          SubprocessProtocol protocol) {
-    // If we aren't using the shell protocol we must allocate a PTY to properly close the
-    // subprocess. PTYs automatically send SIGHUP to the slave-side process when the master side
-    // of the PTY closes, which we rely on. If we use a raw pipe, processes that don't read/write,
-    // e.g. screenrecord, will never notice the broken pipe and terminate.
-    // The shell protocol doesn't require a PTY because it's always monitoring the local socket FD
-    // with select() and will send SIGHUP manually to the child process.
-    bool make_pty_raw = false;
-    if (protocol == SubprocessProtocol::kNone && type == SubprocessType::kRaw) {
-        // Disable PTY input/output processing since the client is expecting raw data.
-        D("Can't create raw subprocess without shell protocol, using PTY in raw mode instead");
-        type = SubprocessType::kPty;
-        make_pty_raw = true;
-    }
-
-    unique_fd error_fd;
-    unique_fd fd = StartSubprocess(std::move(name), terminal_type, type, protocol, make_pty_raw,
-                                   protocol, &error_fd);
-    if (fd == -1) {
-        return error_fd;
-    }
-    return fd;
-}
-
-unique_fd StartSubprocess(std::string name, const char* terminal_type, SubprocessType type,
-                          SubprocessProtocol protocol, bool make_pty_raw,
-                          SubprocessProtocol error_protocol, unique_fd* error_fd) {
-    D("starting %s subprocess (protocol=%s, TERM=%s): '%s'",
-      type == SubprocessType::kRaw ? "raw" : "PTY",
-      protocol == SubprocessProtocol::kNone ? "none" : "shell", terminal_type, name.c_str());
-
-    auto subprocess = std::make_unique<Subprocess>(std::move(name), terminal_type, type, protocol,
-                                                   make_pty_raw);
-    if (!subprocess) {
-        LOG(ERROR) << "failed to allocate new subprocess";
-        *error_fd = ReportError(error_protocol, "failed to allocate new subprocess");
-        return {};
-    }
-
-    std::string error;
-    if (!subprocess->ForkAndExec(&error)) {
-        LOG(ERROR) << "failed to start subprocess: " << error;
-        *error_fd = ReportError(error_protocol, error);
-        return {};
-    }
-
-    unique_fd local_socket(subprocess->ReleaseLocalSocket());
-    D("subprocess creation successful: local_socket_fd=%d, pid=%d", local_socket.get(),
-      subprocess->pid());
-
-    if (!Subprocess::StartThread(std::move(subprocess), &error)) {
-        LOG(ERROR) << "failed to start subprocess management thread: " << error;
-        *error_fd = ReportError(error_protocol, error);
-        return {};
-    }
-
-    return local_socket;
-}
-
-unique_fd StartCommandInProcess(std::string name, Command command, SubprocessProtocol protocol) {
-    LOG(INFO) << "StartCommandInProcess(" << dump_hex(name.data(), name.size()) << ")";
-
-    constexpr auto terminal_type = "";
-    constexpr auto type = SubprocessType::kRaw;
-    constexpr auto make_pty_raw = false;
-
-    auto subprocess = std::make_unique<Subprocess>(std::move(name), terminal_type, type, protocol,
-                                                   make_pty_raw);
-    if (!subprocess) {
-        LOG(ERROR) << "failed to allocate new subprocess";
-        return ReportError(protocol, "failed to allocate new subprocess");
-    }
-
-    std::string error;
-    if (!subprocess->ExecInProcess(std::move(command), &error)) {
-        LOG(ERROR) << "failed to start subprocess: " << error;
-        return ReportError(protocol, error);
-    }
-
-    unique_fd local_socket(subprocess->ReleaseLocalSocket());
-    D("inprocess creation successful: local_socket_fd=%d, pid=%d", local_socket.get(),
-      subprocess->pid());
-
-    if (!Subprocess::StartThread(std::move(subprocess), &error)) {
-        LOG(ERROR) << "failed to start inprocess management thread: " << error;
-        return ReportError(protocol, error);
-    }
-
-    return local_socket;
-}
diff --git a/adb/daemon/shell_service.h b/adb/daemon/shell_service.h
deleted file mode 100644
index 030228c..0000000
--- a/adb/daemon/shell_service.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <string>
-
-#include "adb_unique_fd.h"
-
-#include <string_view>
-
-enum class SubprocessType {
-    kPty,
-    kRaw,
-};
-
-enum class SubprocessProtocol {
-    kNone,
-    kShell,
-};
-
-// Forks and starts a new shell subprocess. If |name| is empty an interactive
-// shell is started, otherwise |name| is executed non-interactively.
-//
-// Returns an open FD connected to the subprocess or -1 on failure.
-unique_fd StartSubprocess(std::string name, const char* terminal_type, SubprocessType type,
-                          SubprocessProtocol protocol);
-
-// The same as above but with more fined grained control and custom error handling.
-unique_fd StartSubprocess(std::string name, const char* terminal_type, SubprocessType type,
-                          SubprocessProtocol protocol, bool make_pty_raw,
-                          SubprocessProtocol error_protocol, unique_fd* error_fd);
-
-// Executes |command| in a separate thread.
-// Sets up in/out and error streams to emulate shell-like behavior.
-//
-// Returns an open FD connected to the thread or -1 on failure.
-using Command = int(std::string_view args, borrowed_fd in, borrowed_fd out, borrowed_fd err);
-unique_fd StartCommandInProcess(std::string name, Command command, SubprocessProtocol protocol);
-
-// Create a pipe containing the error.
-unique_fd ReportError(SubprocessProtocol protocol, const std::string& message);
diff --git a/adb/daemon/shell_service_test.cpp b/adb/daemon/shell_service_test.cpp
deleted file mode 100644
index cdd8dbe..0000000
--- a/adb/daemon/shell_service_test.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "shell_service.h"
-
-#include <gtest/gtest.h>
-
-#include <signal.h>
-
-#include <string>
-#include <vector>
-
-#include <android-base/strings.h>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "shell_protocol.h"
-#include "sysdeps.h"
-
-class ShellServiceTest : public ::testing::Test {
-  public:
-    static void SetUpTestCase() {
-        // This is normally done in main.cpp.
-        saved_sigpipe_handler_ = signal(SIGPIPE, SIG_IGN);
-    }
-
-    static void TearDownTestCase() {
-        signal(SIGPIPE, saved_sigpipe_handler_);
-    }
-
-    // Helpers to start and cleanup a subprocess. Cleanup normally does not
-    // need to be called manually unless multiple subprocesses are run from
-    // a single test.
-    void StartTestSubprocess(const char* command, SubprocessType type,
-                             SubprocessProtocol protocol);
-    void CleanupTestSubprocess();
-
-    void StartTestCommandInProcess(std::string name, Command command, SubprocessProtocol protocol);
-
-    virtual void TearDown() override { CleanupTestSubprocess(); }
-
-    static sighandler_t saved_sigpipe_handler_;
-
-    unique_fd command_fd_;
-};
-
-sighandler_t ShellServiceTest::saved_sigpipe_handler_ = nullptr;
-
-void ShellServiceTest::StartTestSubprocess(
-        const char* command, SubprocessType type, SubprocessProtocol protocol) {
-    command_fd_ = StartSubprocess(command, nullptr, type, protocol);
-    ASSERT_TRUE(command_fd_ >= 0);
-}
-
-void ShellServiceTest::CleanupTestSubprocess() {
-}
-
-void ShellServiceTest::StartTestCommandInProcess(std::string name, Command command,
-                                                 SubprocessProtocol protocol) {
-    command_fd_ = StartCommandInProcess(std::move(name), std::move(command), protocol);
-    ASSERT_TRUE(command_fd_ >= 0);
-}
-
-namespace {
-
-// Reads raw data from |fd| until it closes or errors.
-std::string ReadRaw(borrowed_fd fd) {
-    char buffer[1024];
-    char *cur_ptr = buffer, *end_ptr = buffer + sizeof(buffer);
-
-    while (1) {
-        int bytes = adb_read(fd, cur_ptr, end_ptr - cur_ptr);
-        if (bytes <= 0) {
-            return std::string(buffer, cur_ptr);
-        }
-        cur_ptr += bytes;
-    }
-}
-
-// Reads shell protocol data from |fd| until it closes or errors. Fills
-// |stdout| and |stderr| with their respective data, and returns the exit code
-// read from the protocol or -1 if an exit code packet was not received.
-int ReadShellProtocol(borrowed_fd fd, std::string* stdout, std::string* stderr) {
-    int exit_code = -1;
-    stdout->clear();
-    stderr->clear();
-
-    auto protocol = std::make_unique<ShellProtocol>(fd.get());
-    while (protocol->Read()) {
-        switch (protocol->id()) {
-            case ShellProtocol::kIdStdout:
-                stdout->append(protocol->data(), protocol->data_length());
-                break;
-            case ShellProtocol::kIdStderr:
-                stderr->append(protocol->data(), protocol->data_length());
-                break;
-            case ShellProtocol::kIdExit:
-                EXPECT_EQ(-1, exit_code) << "Multiple exit packets received";
-                EXPECT_EQ(1u, protocol->data_length());
-                exit_code = protocol->data()[0];
-                break;
-            default:
-                ADD_FAILURE() << "Unidentified packet ID: " << protocol->id();
-        }
-    }
-
-    return exit_code;
-}
-
-// Checks if each line in |lines| exists in the same order in |output|. Blank
-// lines in |output| are ignored for simplicity.
-bool ExpectLinesEqual(const std::string& output,
-                      const std::vector<std::string>& lines) {
-    auto output_lines = android::base::Split(output, "\r\n");
-    size_t i = 0;
-
-    for (const std::string& line : lines) {
-        // Skip empty lines in output.
-        while (i < output_lines.size() && output_lines[i].empty()) {
-            ++i;
-        }
-        if (i >= output_lines.size()) {
-            ADD_FAILURE() << "Ran out of output lines";
-            return false;
-        }
-        EXPECT_EQ(line, output_lines[i]);
-        ++i;
-    }
-
-    while (i < output_lines.size() && output_lines[i].empty()) {
-        ++i;
-    }
-    EXPECT_EQ(i, output_lines.size()) << "Found unmatched output lines";
-    return true;
-}
-
-}  // namespace
-
-// Tests a raw subprocess with no protocol.
-TEST_F(ShellServiceTest, RawNoProtocolSubprocess) {
-    // [ -t 0 ] checks if stdin is connected to a terminal.
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "echo foo; echo bar >&2; [ -t 0 ]; echo $?",
-            SubprocessType::kRaw, SubprocessProtocol::kNone));
-
-    // [ -t 0 ] == 0 means we have a terminal (PTY). Even when requesting a raw subprocess, without
-    // the shell protocol we should always force a PTY to ensure proper cleanup.
-    ExpectLinesEqual(ReadRaw(command_fd_), {"foo", "bar", "0"});
-}
-
-// Tests a PTY subprocess with no protocol.
-TEST_F(ShellServiceTest, PtyNoProtocolSubprocess) {
-    // [ -t 0 ] checks if stdin is connected to a terminal.
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "echo foo; echo bar >&2; [ -t 0 ]; echo $?",
-            SubprocessType::kPty, SubprocessProtocol::kNone));
-
-    // [ -t 0 ] == 0 means we have a terminal (PTY).
-    ExpectLinesEqual(ReadRaw(command_fd_), {"foo", "bar", "0"});
-}
-
-// Tests a raw subprocess with the shell protocol.
-TEST_F(ShellServiceTest, RawShellProtocolSubprocess) {
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "echo foo; echo bar >&2; echo baz; exit 24",
-            SubprocessType::kRaw, SubprocessProtocol::kShell));
-
-    std::string stdout, stderr;
-    EXPECT_EQ(24, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    ExpectLinesEqual(stdout, {"foo", "baz"});
-    ExpectLinesEqual(stderr, {"bar"});
-}
-
-// Tests a PTY subprocess with the shell protocol.
-TEST_F(ShellServiceTest, PtyShellProtocolSubprocess) {
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "echo foo; echo bar >&2; echo baz; exit 50",
-            SubprocessType::kPty, SubprocessProtocol::kShell));
-
-    // PTY always combines stdout and stderr but the shell protocol should
-    // still give us an exit code.
-    std::string stdout, stderr;
-    EXPECT_EQ(50, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    ExpectLinesEqual(stdout, {"foo", "bar", "baz"});
-    ExpectLinesEqual(stderr, {});
-}
-
-// Tests an interactive PTY session.
-TEST_F(ShellServiceTest, InteractivePtySubprocess) {
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "", SubprocessType::kPty, SubprocessProtocol::kShell));
-
-    // Use variable substitution so echoed input is different from output.
-    const char* commands[] = {"TEST_STR=abc123",
-                              "echo --${TEST_STR}--",
-                              "exit"};
-
-    ShellProtocol* protocol = new ShellProtocol(command_fd_);
-    for (std::string command : commands) {
-        // Interactive shell requires a newline to complete each command.
-        command.push_back('\n');
-        memcpy(protocol->data(), command.data(), command.length());
-        ASSERT_TRUE(protocol->Write(ShellProtocol::kIdStdin, command.length()));
-    }
-    delete protocol;
-
-    std::string stdout, stderr;
-    EXPECT_EQ(0, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    // An unpredictable command prompt makes parsing exact output difficult but
-    // it should at least contain echoed input and the expected output.
-    for (const char* command : commands) {
-        EXPECT_FALSE(stdout.find(command) == std::string::npos);
-    }
-    EXPECT_FALSE(stdout.find("--abc123--") == std::string::npos);
-}
-
-// Tests closing raw subprocess stdin.
-TEST_F(ShellServiceTest, CloseClientStdin) {
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "cat; echo TEST_DONE",
-            SubprocessType::kRaw, SubprocessProtocol::kShell));
-
-    std::string input = "foo\nbar";
-    ShellProtocol* protocol = new ShellProtocol(command_fd_);
-    memcpy(protocol->data(), input.data(), input.length());
-    ASSERT_TRUE(protocol->Write(ShellProtocol::kIdStdin, input.length()));
-    ASSERT_TRUE(protocol->Write(ShellProtocol::kIdCloseStdin, 0));
-    delete protocol;
-
-    std::string stdout, stderr;
-    EXPECT_EQ(0, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    ExpectLinesEqual(stdout, {"foo", "barTEST_DONE"});
-    ExpectLinesEqual(stderr, {});
-}
-
-// Tests that nothing breaks when the stdin/stdout pipe closes.
-TEST_F(ShellServiceTest, CloseStdinStdoutSubprocess) {
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "exec 0<&-; exec 1>&-; echo bar >&2",
-            SubprocessType::kRaw, SubprocessProtocol::kShell));
-
-    std::string stdout, stderr;
-    EXPECT_EQ(0, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    ExpectLinesEqual(stdout, {});
-    ExpectLinesEqual(stderr, {"bar"});
-}
-
-// Tests that nothing breaks when the stderr pipe closes.
-TEST_F(ShellServiceTest, CloseStderrSubprocess) {
-    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
-            "exec 2>&-; echo foo",
-            SubprocessType::kRaw, SubprocessProtocol::kShell));
-
-    std::string stdout, stderr;
-    EXPECT_EQ(0, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    ExpectLinesEqual(stdout, {"foo"});
-    ExpectLinesEqual(stderr, {});
-}
-
-// Tests an inprocess command with no protocol.
-TEST_F(ShellServiceTest, RawNoProtocolInprocess) {
-    ASSERT_NO_FATAL_FAILURE(
-            StartTestCommandInProcess("123",
-                                      [](auto args, auto in, auto out, auto err) -> int {
-                                          EXPECT_EQ("123", args);
-                                          char input[10];
-                                          EXPECT_TRUE(ReadFdExactly(in, input, 2));
-                                          input[2] = 0;
-                                          EXPECT_STREQ("in", input);
-                                          WriteFdExactly(out, "out\n");
-                                          WriteFdExactly(err, "err\n");
-                                          return 0;
-                                      },
-                                      SubprocessProtocol::kNone));
-
-    WriteFdExactly(command_fd_, "in");
-    ExpectLinesEqual(ReadRaw(command_fd_), {"out", "err"});
-}
-
-// Tests an inprocess command with the shell protocol.
-TEST_F(ShellServiceTest, RawShellProtocolInprocess) {
-    ASSERT_NO_FATAL_FAILURE(
-            StartTestCommandInProcess("321",
-                                      [](auto args, auto in, auto out, auto err) -> int {
-                                          EXPECT_EQ("321", args);
-                                          char input[10];
-                                          EXPECT_TRUE(ReadFdExactly(in, input, 2));
-                                          input[2] = 0;
-                                          EXPECT_STREQ("in", input);
-                                          WriteFdExactly(out, "out\n");
-                                          WriteFdExactly(err, "err\n");
-                                          return 0;
-                                      },
-                                      SubprocessProtocol::kShell));
-
-    {
-        auto write_protocol = std::make_unique<ShellProtocol>(command_fd_);
-        memcpy(write_protocol->data(), "in", 2);
-        write_protocol->Write(ShellProtocol::kIdStdin, 2);
-    }
-
-    std::string stdout, stderr;
-    // For in-process commands the exit code is always the default (1).
-    EXPECT_EQ(1, ReadShellProtocol(command_fd_, &stdout, &stderr));
-    ExpectLinesEqual(stdout, {"out"});
-    ExpectLinesEqual(stderr, {"err"});
-}
diff --git a/adb/daemon/transport_qemu.cpp b/adb/daemon/transport_qemu.cpp
deleted file mode 100644
index e458cea..0000000
--- a/adb/daemon/transport_qemu.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-// Include qemu_pipe.h before sysdeps, since it has inlined references to open, read, write.
-#include <qemu_pipe.h>
-
-#define TRACE_TAG TRANSPORT
-#include "socket_spec.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-#include <android-base/properties.h>
-
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "adb_unique_fd.h"
-
-/* A worker thread that monitors host connections, and registers a transport for
- * every new host connection. This thread replaces server_socket_thread on
- * condition that adbd daemon runs inside the emulator, and emulator uses QEMUD
- * pipe to communicate with adbd daemon inside the guest. This is done in order
- * to provide more robust communication channel between ADB host and guest. The
- * main issue with server_socket_thread approach is that it runs on top of TCP,
- * and thus is sensitive to network disruptions. For instance, the
- * ConnectionManager may decide to reset all network connections, in which case
- * the connection between ADB host and guest will be lost. To make ADB traffic
- * independent from the network, we use here 'adb' QEMUD service to transfer data
- * between the host, and the guest. See external/qemu/android/adb-*.* that
- * implements the emulator's side of the protocol. Another advantage of using
- * QEMUD approach is that ADB will be up much sooner, since it doesn't depend
- * anymore on network being set up.
- * The guest side of the protocol contains the following phases:
- * - Connect with adb QEMUD service. In this phase a handle to 'adb' QEMUD service
- *   is opened, and it becomes clear whether or not emulator supports that
- *   protocol.
- * - Wait for the ADB host to create connection with the guest. This is done by
- *   sending an 'accept' request to the adb QEMUD service, and waiting on
- *   response.
- * - When new ADB host connection is accepted, the connection with adb QEMUD
- *   service is registered as the transport, and a 'start' request is sent to the
- *   adb QEMUD service, indicating that the guest is ready to receive messages.
- *   Note that the guest will ignore messages sent down from the emulator before
- *   the transport registration is completed. That's why we need to send the
- *   'start' request after the transport is registered.
- */
-void qemu_socket_thread(std::string_view addr) {
-    /* 'accept' request to the adb QEMUD service. */
-    static const char _accept_req[] = "accept";
-    /* 'start' request to the adb QEMUD service. */
-    static const char _start_req[] = "start";
-    /* 'ok' reply from the adb QEMUD service. */
-    static const char _ok_resp[] = "ok";
-
-    char tmp[256];
-    char con_name[32];
-
-    adb_thread_setname("qemu socket");
-    D("transport: qemu_socket_thread() starting");
-
-    std::string error;
-    int port = get_host_socket_spec_port(addr, &error);
-    if (port == -1) {
-        port = DEFAULT_ADB_LOCAL_TRANSPORT_PORT;
-    }
-
-    /* adb QEMUD service connection request. */
-    snprintf(con_name, sizeof(con_name), "pipe:qemud:adb:%d", port);
-
-    /* Connect to the adb QEMUD service. */
-    unique_fd fd(qemu_pipe_open(con_name));
-    if (fd < 0) {
-        /* This could be an older version of the emulator, that doesn't
-         * implement adb QEMUD service. Fall back to the old TCP way. */
-        D("adb service is not available. Falling back to TCP socket.");
-        std::thread(server_socket_thread, adb_listen, addr).detach();
-        return;
-    }
-
-    while (true) {
-        /*
-         * Wait till the host creates a new connection.
-         */
-
-        /* Send the 'accept' request. */
-        if (WriteFdExactly(fd.get(), _accept_req, strlen(_accept_req))) {
-            /* Wait for the response. In the response we expect 'ok' on success,
-             * or 'ko' on failure. */
-            if (!ReadFdExactly(fd.get(), tmp, 2) || memcmp(tmp, _ok_resp, 2)) {
-                D("Accepting ADB host connection has failed.");
-            } else {
-                /* Host is connected. Register the transport, and start the
-                 * exchange. */
-                std::string serial = android::base::StringPrintf("host-%d", fd.get());
-                WriteFdExactly(fd.get(), _start_req, strlen(_start_req));
-                register_socket_transport(
-                        std::move(fd), std::move(serial), port, 1,
-                        [](atransport*) { return ReconnectResult::Abort; }, false);
-            }
-
-            /* Prepare for accepting of the next ADB host connection. */
-            fd.reset(qemu_pipe_open(con_name));
-            if (fd < 0) {
-                D("adb service become unavailable.");
-                return;
-            }
-        } else {
-            D("Unable to send the '%s' request to ADB service.", _accept_req);
-            return;
-        }
-    }
-    D("transport: qemu_socket_thread() exiting");
-    return;
-}
-
-// If adbd is running inside the emulator, it will normally use QEMUD pipe (aka
-// goldfish) as the transport. This can either be explicitly set by the
-// service.adb.transport property, or be inferred from ro.kernel.qemu that is
-// set to "1" for ranchu/goldfish.
-bool use_qemu_goldfish() {
-    // Legacy way to detect if adbd should use the goldfish pipe is to check for
-    // ro.kernel.qemu, keep that behaviour for backward compatibility.
-    if (android::base::GetBoolProperty("ro.kernel.qemu", false)) {
-        return true;
-    }
-    // If service.adb.transport is present and is set to "goldfish", use the
-    // QEMUD pipe.
-    if (android::base::GetProperty("service.adb.transport", "") == "goldfish") {
-        return true;
-    }
-    return false;
-}
diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp
deleted file mode 100644
index 50d7364..0000000
--- a/adb/daemon/usb.cpp
+++ /dev/null
@@ -1,766 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#define TRACE_TAG USB
-
-#include "sysdeps.h"
-
-#include <errno.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <linux/usb/functionfs.h>
-#include <sys/eventfd.h>
-
-#include <algorithm>
-#include <array>
-#include <future>
-#include <memory>
-#include <mutex>
-#include <optional>
-#include <vector>
-
-#include <asyncio/AsyncIO.h>
-
-#include <android-base/logging.h>
-#include <android-base/macros.h>
-#include <android-base/properties.h>
-#include <android-base/thread_annotations.h>
-
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "daemon/usb_ffs.h"
-#include "sysdeps/chrono.h"
-#include "transport.h"
-#include "types.h"
-
-using android::base::StringPrintf;
-
-// Not all USB controllers support operations larger than 16k, so don't go above that.
-// Also, each submitted operation does an allocation in the kernel of that size, so we want to
-// minimize our queue depth while still maintaining a deep enough queue to keep the USB stack fed.
-static constexpr size_t kUsbReadQueueDepth = 8;
-static constexpr size_t kUsbReadSize = 4 * PAGE_SIZE;
-
-static constexpr size_t kUsbWriteQueueDepth = 8;
-static constexpr size_t kUsbWriteSize = 4 * PAGE_SIZE;
-
-static const char* to_string(enum usb_functionfs_event_type type) {
-    switch (type) {
-        case FUNCTIONFS_BIND:
-            return "FUNCTIONFS_BIND";
-        case FUNCTIONFS_UNBIND:
-            return "FUNCTIONFS_UNBIND";
-        case FUNCTIONFS_ENABLE:
-            return "FUNCTIONFS_ENABLE";
-        case FUNCTIONFS_DISABLE:
-            return "FUNCTIONFS_DISABLE";
-        case FUNCTIONFS_SETUP:
-            return "FUNCTIONFS_SETUP";
-        case FUNCTIONFS_SUSPEND:
-            return "FUNCTIONFS_SUSPEND";
-        case FUNCTIONFS_RESUME:
-            return "FUNCTIONFS_RESUME";
-    }
-}
-
-enum class TransferDirection : uint64_t {
-    READ = 0,
-    WRITE = 1,
-};
-
-struct TransferId {
-    TransferDirection direction : 1;
-    uint64_t id : 63;
-
-    TransferId() : TransferId(TransferDirection::READ, 0) {}
-
-  private:
-    TransferId(TransferDirection direction, uint64_t id) : direction(direction), id(id) {}
-
-  public:
-    explicit operator uint64_t() const {
-        uint64_t result;
-        static_assert(sizeof(*this) == sizeof(result));
-        memcpy(&result, this, sizeof(*this));
-        return result;
-    }
-
-    static TransferId read(uint64_t id) { return TransferId(TransferDirection::READ, id); }
-    static TransferId write(uint64_t id) { return TransferId(TransferDirection::WRITE, id); }
-
-    static TransferId from_value(uint64_t value) {
-        TransferId result;
-        memcpy(&result, &value, sizeof(value));
-        return result;
-    }
-};
-
-template <class Payload>
-struct IoBlock {
-    bool pending = false;
-    struct iocb control = {};
-    Payload payload;
-
-    TransferId id() const { return TransferId::from_value(control.aio_data); }
-};
-
-using IoReadBlock = IoBlock<Block>;
-using IoWriteBlock = IoBlock<std::shared_ptr<Block>>;
-
-struct ScopedAioContext {
-    ScopedAioContext() = default;
-    ~ScopedAioContext() { reset(); }
-
-    ScopedAioContext(ScopedAioContext&& move) { reset(move.release()); }
-    ScopedAioContext(const ScopedAioContext& copy) = delete;
-
-    ScopedAioContext& operator=(ScopedAioContext&& move) {
-        reset(move.release());
-        return *this;
-    }
-    ScopedAioContext& operator=(const ScopedAioContext& copy) = delete;
-
-    static ScopedAioContext Create(size_t max_events) {
-        aio_context_t ctx = 0;
-        if (io_setup(max_events, &ctx) != 0) {
-            PLOG(FATAL) << "failed to create aio_context_t";
-        }
-        ScopedAioContext result;
-        result.reset(ctx);
-        return result;
-    }
-
-    aio_context_t release() {
-        aio_context_t result = context_;
-        context_ = 0;
-        return result;
-    }
-
-    void reset(aio_context_t new_context = 0) {
-        if (context_ != 0) {
-            io_destroy(context_);
-        }
-
-        context_ = new_context;
-    }
-
-    aio_context_t get() { return context_; }
-
-  private:
-    aio_context_t context_ = 0;
-};
-
-struct UsbFfsConnection : public Connection {
-    UsbFfsConnection(unique_fd control, unique_fd read, unique_fd write,
-                     std::promise<void> destruction_notifier)
-        : worker_started_(false),
-          stopped_(false),
-          destruction_notifier_(std::move(destruction_notifier)),
-          control_fd_(std::move(control)),
-          read_fd_(std::move(read)),
-          write_fd_(std::move(write)) {
-        LOG(INFO) << "UsbFfsConnection constructed";
-        worker_event_fd_.reset(eventfd(0, EFD_CLOEXEC));
-        if (worker_event_fd_ == -1) {
-            PLOG(FATAL) << "failed to create eventfd";
-        }
-
-        monitor_event_fd_.reset(eventfd(0, EFD_CLOEXEC));
-        if (monitor_event_fd_ == -1) {
-            PLOG(FATAL) << "failed to create eventfd";
-        }
-
-        aio_context_ = ScopedAioContext::Create(kUsbReadQueueDepth + kUsbWriteQueueDepth);
-    }
-
-    ~UsbFfsConnection() {
-        LOG(INFO) << "UsbFfsConnection being destroyed";
-        Stop();
-        monitor_thread_.join();
-
-        // We need to explicitly close our file descriptors before we notify our destruction,
-        // because the thread listening on the future will immediately try to reopen the endpoint.
-        aio_context_.reset();
-        control_fd_.reset();
-        read_fd_.reset();
-        write_fd_.reset();
-
-        destruction_notifier_.set_value();
-    }
-
-    virtual bool Write(std::unique_ptr<apacket> packet) override final {
-        LOG(DEBUG) << "USB write: " << dump_header(&packet->msg);
-        auto header = std::make_shared<Block>(sizeof(packet->msg));
-        memcpy(header->data(), &packet->msg, sizeof(packet->msg));
-
-        std::lock_guard<std::mutex> lock(write_mutex_);
-        write_requests_.push_back(
-                CreateWriteBlock(std::move(header), 0, sizeof(packet->msg), next_write_id_++));
-        if (!packet->payload.empty()) {
-            // The kernel attempts to allocate a contiguous block of memory for each write,
-            // which can fail if the write is large and the kernel heap is fragmented.
-            // Split large writes into smaller chunks to avoid this.
-            auto payload = std::make_shared<Block>(std::move(packet->payload));
-            size_t offset = 0;
-            size_t len = payload->size();
-
-            while (len > 0) {
-                size_t write_size = std::min(kUsbWriteSize, len);
-                write_requests_.push_back(
-                        CreateWriteBlock(payload, offset, write_size, next_write_id_++));
-                len -= write_size;
-                offset += write_size;
-            }
-        }
-
-        // Wake up the worker thread to submit writes.
-        uint64_t notify = 1;
-        ssize_t rc = adb_write(worker_event_fd_.get(), &notify, sizeof(notify));
-        if (rc < 0) {
-            PLOG(FATAL) << "failed to notify worker eventfd to submit writes";
-        }
-
-        return true;
-    }
-
-    virtual void Start() override final { StartMonitor(); }
-
-    virtual void Stop() override final {
-        if (stopped_.exchange(true)) {
-            return;
-        }
-        stopped_ = true;
-        uint64_t notify = 1;
-        ssize_t rc = adb_write(worker_event_fd_.get(), &notify, sizeof(notify));
-        if (rc < 0) {
-            PLOG(FATAL) << "failed to notify worker eventfd to stop UsbFfsConnection";
-        }
-        CHECK_EQ(static_cast<size_t>(rc), sizeof(notify));
-
-        rc = adb_write(monitor_event_fd_.get(), &notify, sizeof(notify));
-        if (rc < 0) {
-            PLOG(FATAL) << "failed to notify monitor eventfd to stop UsbFfsConnection";
-        }
-
-        CHECK_EQ(static_cast<size_t>(rc), sizeof(notify));
-    }
-
-    virtual bool DoTlsHandshake(RSA* key, std::string* auth_key) override final {
-        // TODO: support TLS for usb connections.
-        LOG(FATAL) << "Not supported yet.";
-        return false;
-    }
-
-  private:
-    void StartMonitor() {
-        // This is a bit of a mess.
-        // It's possible for io_submit to end up blocking, if we call it as the endpoint
-        // becomes disabled. Work around this by having a monitor thread to listen for functionfs
-        // lifecycle events. If we notice an error condition (either we've become disabled, or we
-        // were never enabled in the first place), we send interruption signals to the worker thread
-        // until it dies, and then report failure to the transport via HandleError, which will
-        // eventually result in the transport being destroyed, which will result in UsbFfsConnection
-        // being destroyed, which unblocks the open thread and restarts this entire process.
-        static std::once_flag handler_once;
-        std::call_once(handler_once, []() { signal(kInterruptionSignal, [](int) {}); });
-
-        monitor_thread_ = std::thread([this]() {
-            adb_thread_setname("UsbFfs-monitor");
-            LOG(INFO) << "UsbFfs-monitor thread spawned";
-
-            bool bound = false;
-            bool enabled = false;
-            bool running = true;
-            while (running) {
-                adb_pollfd pfd[2] = {
-                  { .fd = control_fd_.get(), .events = POLLIN, .revents = 0 },
-                  { .fd = monitor_event_fd_.get(), .events = POLLIN, .revents = 0 },
-                };
-
-                // If we don't see our first bind within a second, try again.
-                int timeout_ms = bound ? -1 : 1000;
-
-                int rc = TEMP_FAILURE_RETRY(adb_poll(pfd, 2, timeout_ms));
-                if (rc == -1) {
-                    PLOG(FATAL) << "poll on USB control fd failed";
-                } else if (rc == 0) {
-                    LOG(WARNING) << "timed out while waiting for FUNCTIONFS_BIND, trying again";
-                    break;
-                }
-
-                if (pfd[1].revents) {
-                    // We were told to die.
-                    break;
-                }
-
-                struct usb_functionfs_event event;
-                rc = TEMP_FAILURE_RETRY(adb_read(control_fd_.get(), &event, sizeof(event)));
-                if (rc == -1) {
-                    PLOG(FATAL) << "failed to read functionfs event";
-                } else if (rc == 0) {
-                    LOG(WARNING) << "hit EOF on functionfs control fd";
-                    break;
-                } else if (rc != sizeof(event)) {
-                    LOG(FATAL) << "read functionfs event of unexpected size, expected "
-                               << sizeof(event) << ", got " << rc;
-                }
-
-                LOG(INFO) << "USB event: "
-                          << to_string(static_cast<usb_functionfs_event_type>(event.type));
-
-                switch (event.type) {
-                    case FUNCTIONFS_BIND:
-                        if (bound) {
-                            LOG(WARNING) << "received FUNCTIONFS_BIND while already bound?";
-                            running = false;
-                            break;
-                        }
-
-                        if (enabled) {
-                            LOG(WARNING) << "received FUNCTIONFS_BIND while already enabled?";
-                            running = false;
-                            break;
-                        }
-
-                        bound = true;
-                        break;
-
-                    case FUNCTIONFS_ENABLE:
-                        if (!bound) {
-                            LOG(WARNING) << "received FUNCTIONFS_ENABLE while not bound?";
-                            running = false;
-                            break;
-                        }
-
-                        if (enabled) {
-                            LOG(WARNING) << "received FUNCTIONFS_ENABLE while already enabled?";
-                            running = false;
-                            break;
-                        }
-
-                        enabled = true;
-                        StartWorker();
-                        break;
-
-                    case FUNCTIONFS_DISABLE:
-                        if (!bound) {
-                            LOG(WARNING) << "received FUNCTIONFS_DISABLE while not bound?";
-                        }
-
-                        if (!enabled) {
-                            LOG(WARNING) << "received FUNCTIONFS_DISABLE while not enabled?";
-                        }
-
-                        enabled = false;
-                        running = false;
-                        break;
-
-                    case FUNCTIONFS_UNBIND:
-                        if (enabled) {
-                            LOG(WARNING) << "received FUNCTIONFS_UNBIND while still enabled?";
-                        }
-
-                        if (!bound) {
-                            LOG(WARNING) << "received FUNCTIONFS_UNBIND when not bound?";
-                        }
-
-                        bound = false;
-                        running = false;
-                        break;
-
-                    case FUNCTIONFS_SETUP: {
-                        LOG(INFO) << "received FUNCTIONFS_SETUP control transfer: bRequestType = "
-                                  << static_cast<int>(event.u.setup.bRequestType)
-                                  << ", bRequest = " << static_cast<int>(event.u.setup.bRequest)
-                                  << ", wValue = " << static_cast<int>(event.u.setup.wValue)
-                                  << ", wIndex = " << static_cast<int>(event.u.setup.wIndex)
-                                  << ", wLength = " << static_cast<int>(event.u.setup.wLength);
-
-                        if ((event.u.setup.bRequestType & USB_DIR_IN)) {
-                            LOG(INFO) << "acking device-to-host control transfer";
-                            ssize_t rc = adb_write(control_fd_.get(), "", 0);
-                            if (rc != 0) {
-                                PLOG(ERROR) << "failed to write empty packet to host";
-                                break;
-                            }
-                        } else {
-                            std::string buf;
-                            buf.resize(event.u.setup.wLength + 1);
-
-                            ssize_t rc = adb_read(control_fd_.get(), buf.data(), buf.size());
-                            if (rc != event.u.setup.wLength) {
-                                LOG(ERROR)
-                                        << "read " << rc
-                                        << " bytes when trying to read control request, expected "
-                                        << event.u.setup.wLength;
-                            }
-
-                            LOG(INFO) << "control request contents: " << buf;
-                            break;
-                        }
-                    }
-                }
-            }
-
-            StopWorker();
-            HandleError("monitor thread finished");
-        });
-    }
-
-    void StartWorker() {
-        CHECK(!worker_started_);
-        worker_started_ = true;
-        worker_thread_ = std::thread([this]() {
-            adb_thread_setname("UsbFfs-worker");
-            LOG(INFO) << "UsbFfs-worker thread spawned";
-
-            for (size_t i = 0; i < kUsbReadQueueDepth; ++i) {
-                read_requests_[i] = CreateReadBlock(next_read_id_++);
-                if (!SubmitRead(&read_requests_[i])) {
-                    return;
-                }
-            }
-
-            while (!stopped_) {
-                uint64_t dummy;
-                ssize_t rc = adb_read(worker_event_fd_.get(), &dummy, sizeof(dummy));
-                if (rc == -1) {
-                    PLOG(FATAL) << "failed to read from eventfd";
-                } else if (rc == 0) {
-                    LOG(FATAL) << "hit EOF on eventfd";
-                }
-
-                ReadEvents();
-
-                std::lock_guard<std::mutex> lock(write_mutex_);
-                SubmitWrites();
-            }
-        });
-    }
-
-    void StopWorker() {
-        if (!worker_started_) {
-            return;
-        }
-
-        pthread_t worker_thread_handle = worker_thread_.native_handle();
-        while (true) {
-            int rc = pthread_kill(worker_thread_handle, kInterruptionSignal);
-            if (rc != 0) {
-                LOG(ERROR) << "failed to send interruption signal to worker: " << strerror(rc);
-                break;
-            }
-
-            std::this_thread::sleep_for(100ms);
-
-            rc = pthread_kill(worker_thread_handle, 0);
-            if (rc == 0) {
-                continue;
-            } else if (rc == ESRCH) {
-                break;
-            } else {
-                LOG(ERROR) << "failed to send interruption signal to worker: " << strerror(rc);
-            }
-        }
-
-        worker_thread_.join();
-    }
-
-    void PrepareReadBlock(IoReadBlock* block, uint64_t id) {
-        block->pending = false;
-        if (block->payload.capacity() >= kUsbReadSize) {
-            block->payload.resize(kUsbReadSize);
-        } else {
-            block->payload = Block(kUsbReadSize);
-        }
-        block->control.aio_data = static_cast<uint64_t>(TransferId::read(id));
-        block->control.aio_buf = reinterpret_cast<uintptr_t>(block->payload.data());
-        block->control.aio_nbytes = block->payload.size();
-    }
-
-    IoReadBlock CreateReadBlock(uint64_t id) {
-        IoReadBlock block;
-        PrepareReadBlock(&block, id);
-        block.control.aio_rw_flags = 0;
-        block.control.aio_lio_opcode = IOCB_CMD_PREAD;
-        block.control.aio_reqprio = 0;
-        block.control.aio_fildes = read_fd_.get();
-        block.control.aio_offset = 0;
-        block.control.aio_flags = IOCB_FLAG_RESFD;
-        block.control.aio_resfd = worker_event_fd_.get();
-        return block;
-    }
-
-    void ReadEvents() {
-        static constexpr size_t kMaxEvents = kUsbReadQueueDepth + kUsbWriteQueueDepth;
-        struct io_event events[kMaxEvents];
-        struct timespec timeout = {.tv_sec = 0, .tv_nsec = 0};
-        int rc = io_getevents(aio_context_.get(), 0, kMaxEvents, events, &timeout);
-        if (rc == -1) {
-            HandleError(StringPrintf("io_getevents failed while reading: %s", strerror(errno)));
-            return;
-        }
-
-        for (int event_idx = 0; event_idx < rc; ++event_idx) {
-            auto& event = events[event_idx];
-            TransferId id = TransferId::from_value(event.data);
-
-            if (event.res < 0) {
-                std::string error =
-                        StringPrintf("%s %" PRIu64 " failed with error %s",
-                                     id.direction == TransferDirection::READ ? "read" : "write",
-                                     id.id, strerror(-event.res));
-                HandleError(error);
-                return;
-            }
-
-            if (id.direction == TransferDirection::READ) {
-                if (!HandleRead(id, event.res)) {
-                    return;
-                }
-            } else {
-                HandleWrite(id);
-            }
-        }
-    }
-
-    bool HandleRead(TransferId id, int64_t size) {
-        uint64_t read_idx = id.id % kUsbReadQueueDepth;
-        IoReadBlock* block = &read_requests_[read_idx];
-        block->pending = false;
-        block->payload.resize(size);
-
-        // Notification for completed reads can be received out of order.
-        if (block->id().id != needed_read_id_) {
-            LOG(VERBOSE) << "read " << block->id().id << " completed while waiting for "
-                         << needed_read_id_;
-            return true;
-        }
-
-        for (uint64_t id = needed_read_id_;; ++id) {
-            size_t read_idx = id % kUsbReadQueueDepth;
-            IoReadBlock* current_block = &read_requests_[read_idx];
-            if (current_block->pending) {
-                break;
-            }
-            if (!ProcessRead(current_block)) {
-                return false;
-            }
-            ++needed_read_id_;
-        }
-
-        return true;
-    }
-
-    bool ProcessRead(IoReadBlock* block) {
-        if (!block->payload.empty()) {
-            if (!incoming_header_.has_value()) {
-                if (block->payload.size() != sizeof(amessage)) {
-                    HandleError("received packet of unexpected length while reading header");
-                    return false;
-                }
-                amessage& msg = incoming_header_.emplace();
-                memcpy(&msg, block->payload.data(), sizeof(msg));
-                LOG(DEBUG) << "USB read:" << dump_header(&msg);
-                incoming_header_ = msg;
-            } else {
-                size_t bytes_left = incoming_header_->data_length - incoming_payload_.size();
-                if (block->payload.size() > bytes_left) {
-                    HandleError("received too many bytes while waiting for payload");
-                    return false;
-                }
-                incoming_payload_.append(std::move(block->payload));
-            }
-
-            if (incoming_header_->data_length == incoming_payload_.size()) {
-                auto packet = std::make_unique<apacket>();
-                packet->msg = *incoming_header_;
-
-                // TODO: Make apacket contain an IOVector so we don't have to coalesce.
-                packet->payload = std::move(incoming_payload_).coalesce();
-                read_callback_(this, std::move(packet));
-
-                incoming_header_.reset();
-                // reuse the capacity of the incoming payload while we can.
-                auto free_block = incoming_payload_.clear();
-                if (block->payload.capacity() == 0) {
-                    block->payload = std::move(free_block);
-                }
-            }
-        }
-
-        PrepareReadBlock(block, block->id().id + kUsbReadQueueDepth);
-        SubmitRead(block);
-        return true;
-    }
-
-    bool SubmitRead(IoReadBlock* block) {
-        block->pending = true;
-        struct iocb* iocb = &block->control;
-        if (io_submit(aio_context_.get(), 1, &iocb) != 1) {
-            HandleError(StringPrintf("failed to submit read: %s", strerror(errno)));
-            return false;
-        }
-
-        return true;
-    }
-
-    void HandleWrite(TransferId id) {
-        std::lock_guard<std::mutex> lock(write_mutex_);
-        auto it =
-                std::find_if(write_requests_.begin(), write_requests_.end(), [id](const auto& req) {
-                    return static_cast<uint64_t>(req.id()) == static_cast<uint64_t>(id);
-                });
-        CHECK(it != write_requests_.end());
-
-        write_requests_.erase(it);
-        size_t outstanding_writes = --writes_submitted_;
-        LOG(DEBUG) << "USB write: reaped, down to " << outstanding_writes;
-    }
-
-    IoWriteBlock CreateWriteBlock(std::shared_ptr<Block> payload, size_t offset, size_t len,
-                                  uint64_t id) {
-        auto block = IoWriteBlock();
-        block.payload = std::move(payload);
-        block.control.aio_data = static_cast<uint64_t>(TransferId::write(id));
-        block.control.aio_rw_flags = 0;
-        block.control.aio_lio_opcode = IOCB_CMD_PWRITE;
-        block.control.aio_reqprio = 0;
-        block.control.aio_fildes = write_fd_.get();
-        block.control.aio_buf = reinterpret_cast<uintptr_t>(block.payload->data() + offset);
-        block.control.aio_nbytes = len;
-        block.control.aio_offset = 0;
-        block.control.aio_flags = IOCB_FLAG_RESFD;
-        block.control.aio_resfd = worker_event_fd_.get();
-        return block;
-    }
-
-    IoWriteBlock CreateWriteBlock(Block&& payload, uint64_t id) {
-        size_t len = payload.size();
-        return CreateWriteBlock(std::make_shared<Block>(std::move(payload)), 0, len, id);
-    }
-
-    void SubmitWrites() REQUIRES(write_mutex_) {
-        if (writes_submitted_ == kUsbWriteQueueDepth) {
-            return;
-        }
-
-        ssize_t writes_to_submit = std::min(kUsbWriteQueueDepth - writes_submitted_,
-                                            write_requests_.size() - writes_submitted_);
-        CHECK_GE(writes_to_submit, 0);
-        if (writes_to_submit == 0) {
-            return;
-        }
-
-        struct iocb* iocbs[kUsbWriteQueueDepth];
-        for (int i = 0; i < writes_to_submit; ++i) {
-            CHECK(!write_requests_[writes_submitted_ + i].pending);
-            write_requests_[writes_submitted_ + i].pending = true;
-            iocbs[i] = &write_requests_[writes_submitted_ + i].control;
-            LOG(VERBOSE) << "submitting write_request " << static_cast<void*>(iocbs[i]);
-        }
-
-        writes_submitted_ += writes_to_submit;
-
-        int rc = io_submit(aio_context_.get(), writes_to_submit, iocbs);
-        if (rc == -1) {
-            HandleError(StringPrintf("failed to submit write requests: %s", strerror(errno)));
-            return;
-        } else if (rc != writes_to_submit) {
-            LOG(FATAL) << "failed to submit all writes: wanted to submit " << writes_to_submit
-                       << ", actually submitted " << rc;
-        }
-    }
-
-    void HandleError(const std::string& error) {
-        std::call_once(error_flag_, [&]() {
-            error_callback_(this, error);
-            if (!stopped_) {
-                Stop();
-            }
-        });
-    }
-
-    std::thread monitor_thread_;
-
-    bool worker_started_;
-    std::thread worker_thread_;
-
-    std::atomic<bool> stopped_;
-    std::promise<void> destruction_notifier_;
-    std::once_flag error_flag_;
-
-    unique_fd worker_event_fd_;
-    unique_fd monitor_event_fd_;
-
-    ScopedAioContext aio_context_;
-    unique_fd control_fd_;
-    unique_fd read_fd_;
-    unique_fd write_fd_;
-
-    std::optional<amessage> incoming_header_;
-    IOVector incoming_payload_;
-
-    std::array<IoReadBlock, kUsbReadQueueDepth> read_requests_;
-    IOVector read_data_;
-
-    // ID of the next request that we're going to send out.
-    size_t next_read_id_ = 0;
-
-    // ID of the next packet we're waiting for.
-    size_t needed_read_id_ = 0;
-
-    std::mutex write_mutex_;
-    std::deque<IoWriteBlock> write_requests_ GUARDED_BY(write_mutex_);
-    size_t next_write_id_ GUARDED_BY(write_mutex_) = 0;
-    size_t writes_submitted_ GUARDED_BY(write_mutex_) = 0;
-
-    static constexpr int kInterruptionSignal = SIGUSR1;
-};
-
-static void usb_ffs_open_thread() {
-    adb_thread_setname("usb ffs open");
-
-    while (true) {
-        unique_fd control;
-        unique_fd bulk_out;
-        unique_fd bulk_in;
-        if (!open_functionfs(&control, &bulk_out, &bulk_in)) {
-            std::this_thread::sleep_for(1s);
-            continue;
-        }
-
-        atransport* transport = new atransport();
-        transport->serial = "UsbFfs";
-        std::promise<void> destruction_notifier;
-        std::future<void> future = destruction_notifier.get_future();
-        transport->SetConnection(std::make_unique<UsbFfsConnection>(
-                std::move(control), std::move(bulk_out), std::move(bulk_in),
-                std::move(destruction_notifier)));
-        register_transport(transport);
-        future.wait();
-    }
-}
-
-void usb_init() {
-    std::thread(usb_ffs_open_thread).detach();
-}
diff --git a/adb/daemon/usb_ffs.cpp b/adb/daemon/usb_ffs.cpp
deleted file mode 100644
index e538ca8..0000000
--- a/adb/daemon/usb_ffs.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#define TRACE_TAG USB
-
-#include "sysdeps.h"
-
-#include "daemon/usb_ffs.h"
-
-#include <linux/usb/ch9.h>
-#include <linux/usb/functionfs.h>
-
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android-base/unique_fd.h>
-
-#include "adb.h"
-
-#define MAX_PACKET_SIZE_FS 64
-#define MAX_PACKET_SIZE_HS 512
-#define MAX_PACKET_SIZE_SS 1024
-
-#define USB_FFS_BULK_SIZE 16384
-
-// Number of buffers needed to fit MAX_PAYLOAD, with an extra for ZLPs.
-#define USB_FFS_NUM_BUFS ((4 * MAX_PAYLOAD / USB_FFS_BULK_SIZE) + 1)
-
-#define USB_EXT_PROP_UNICODE 1
-
-#define cpu_to_le16(x) htole16(x)
-#define cpu_to_le32(x) htole32(x)
-
-// clang-format off
-struct func_desc {
-    struct usb_interface_descriptor intf;
-    struct usb_endpoint_descriptor_no_audio source;
-    struct usb_endpoint_descriptor_no_audio sink;
-} __attribute__((packed));
-
-struct ss_func_desc {
-    struct usb_interface_descriptor intf;
-    struct usb_endpoint_descriptor_no_audio source;
-    struct usb_ss_ep_comp_descriptor source_comp;
-    struct usb_endpoint_descriptor_no_audio sink;
-    struct usb_ss_ep_comp_descriptor sink_comp;
-} __attribute__((packed));
-
-struct desc_v1 {
-    struct usb_functionfs_descs_head_v1 {
-        __le32 magic;
-        __le32 length;
-        __le32 fs_count;
-        __le32 hs_count;
-    } __attribute__((packed)) header;
-    struct func_desc fs_descs, hs_descs;
-} __attribute__((packed));
-
-template <size_t PropertyNameLength, size_t PropertyDataLength>
-struct usb_os_desc_ext_prop {
-    uint32_t dwSize = sizeof(*this);
-    uint32_t dwPropertyDataType = cpu_to_le32(USB_EXT_PROP_UNICODE);
-
-    // Property name and value are transmitted as UTF-16, but the kernel only
-    // accepts ASCII values and performs the conversion for us.
-    uint16_t wPropertyNameLength = cpu_to_le16(PropertyNameLength);
-    char bPropertyName[PropertyNameLength];
-
-    uint32_t dwPropertyDataLength = cpu_to_le32(PropertyDataLength);
-    char bProperty[PropertyDataLength];
-} __attribute__((packed));
-
-using usb_os_desc_guid_t = usb_os_desc_ext_prop<20, 39>;
-usb_os_desc_guid_t os_desc_guid = {
-    .bPropertyName = "DeviceInterfaceGUID",
-    .bProperty = "{F72FE0D4-CBCB-407D-8814-9ED673D0DD6B}",
-};
-
-struct usb_ext_prop_values {
-    usb_os_desc_guid_t guid;
-} __attribute__((packed));
-
-usb_ext_prop_values os_prop_values = {
-    .guid = os_desc_guid,
-};
-
-struct desc_v2 {
-    struct usb_functionfs_descs_head_v2 header;
-    // The rest of the structure depends on the flags in the header.
-    __le32 fs_count;
-    __le32 hs_count;
-    __le32 ss_count;
-    __le32 os_count;
-    struct func_desc fs_descs, hs_descs;
-    struct ss_func_desc ss_descs;
-    struct usb_os_desc_header os_header;
-    struct usb_ext_compat_desc os_desc;
-    struct usb_os_desc_header os_prop_header;
-    struct usb_ext_prop_values os_prop_values;
-} __attribute__((packed));
-
-static struct func_desc fs_descriptors = {
-    .intf = {
-        .bLength = sizeof(fs_descriptors.intf),
-        .bDescriptorType = USB_DT_INTERFACE,
-        .bInterfaceNumber = 0,
-        .bNumEndpoints = 2,
-        .bInterfaceClass = ADB_CLASS,
-        .bInterfaceSubClass = ADB_SUBCLASS,
-        .bInterfaceProtocol = ADB_PROTOCOL,
-        .iInterface = 1, /* first string from the provided table */
-    },
-    .source = {
-        .bLength = sizeof(fs_descriptors.source),
-        .bDescriptorType = USB_DT_ENDPOINT,
-        .bEndpointAddress = 1 | USB_DIR_OUT,
-        .bmAttributes = USB_ENDPOINT_XFER_BULK,
-        .wMaxPacketSize = MAX_PACKET_SIZE_FS,
-    },
-    .sink = {
-        .bLength = sizeof(fs_descriptors.sink),
-        .bDescriptorType = USB_DT_ENDPOINT,
-        .bEndpointAddress = 2 | USB_DIR_IN,
-        .bmAttributes = USB_ENDPOINT_XFER_BULK,
-        .wMaxPacketSize = MAX_PACKET_SIZE_FS,
-    },
-};
-
-static struct func_desc hs_descriptors = {
-    .intf = {
-        .bLength = sizeof(hs_descriptors.intf),
-        .bDescriptorType = USB_DT_INTERFACE,
-        .bInterfaceNumber = 0,
-        .bNumEndpoints = 2,
-        .bInterfaceClass = ADB_CLASS,
-        .bInterfaceSubClass = ADB_SUBCLASS,
-        .bInterfaceProtocol = ADB_PROTOCOL,
-        .iInterface = 1, /* first string from the provided table */
-    },
-    .source = {
-        .bLength = sizeof(hs_descriptors.source),
-        .bDescriptorType = USB_DT_ENDPOINT,
-        .bEndpointAddress = 1 | USB_DIR_OUT,
-        .bmAttributes = USB_ENDPOINT_XFER_BULK,
-        .wMaxPacketSize = MAX_PACKET_SIZE_HS,
-    },
-    .sink = {
-        .bLength = sizeof(hs_descriptors.sink),
-        .bDescriptorType = USB_DT_ENDPOINT,
-        .bEndpointAddress = 2 | USB_DIR_IN,
-        .bmAttributes = USB_ENDPOINT_XFER_BULK,
-        .wMaxPacketSize = MAX_PACKET_SIZE_HS,
-    },
-};
-
-static struct ss_func_desc ss_descriptors = {
-    .intf = {
-        .bLength = sizeof(ss_descriptors.intf),
-        .bDescriptorType = USB_DT_INTERFACE,
-        .bInterfaceNumber = 0,
-        .bNumEndpoints = 2,
-        .bInterfaceClass = ADB_CLASS,
-        .bInterfaceSubClass = ADB_SUBCLASS,
-        .bInterfaceProtocol = ADB_PROTOCOL,
-        .iInterface = 1, /* first string from the provided table */
-    },
-    .source = {
-        .bLength = sizeof(ss_descriptors.source),
-        .bDescriptorType = USB_DT_ENDPOINT,
-        .bEndpointAddress = 1 | USB_DIR_OUT,
-        .bmAttributes = USB_ENDPOINT_XFER_BULK,
-        .wMaxPacketSize = MAX_PACKET_SIZE_SS,
-    },
-    .source_comp = {
-        .bLength = sizeof(ss_descriptors.source_comp),
-        .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
-        .bMaxBurst = 4,
-    },
-    .sink = {
-        .bLength = sizeof(ss_descriptors.sink),
-        .bDescriptorType = USB_DT_ENDPOINT,
-        .bEndpointAddress = 2 | USB_DIR_IN,
-        .bmAttributes = USB_ENDPOINT_XFER_BULK,
-        .wMaxPacketSize = MAX_PACKET_SIZE_SS,
-    },
-    .sink_comp = {
-        .bLength = sizeof(ss_descriptors.sink_comp),
-        .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
-        .bMaxBurst = 4,
-    },
-};
-
-struct usb_ext_compat_desc os_desc_compat = {
-    .bFirstInterfaceNumber = 0,
-    .Reserved1 = cpu_to_le32(1),
-    .CompatibleID = { 'W', 'I', 'N', 'U', 'S', 'B', '\0', '\0'},
-    .SubCompatibleID = {0},
-    .Reserved2 = {0},
-};
-
-static struct usb_os_desc_header os_desc_header = {
-    .interface = cpu_to_le32(0),
-    .dwLength = cpu_to_le32(sizeof(os_desc_header) + sizeof(os_desc_compat)),
-    .bcdVersion = cpu_to_le32(1),
-    .wIndex = cpu_to_le32(4),
-    .bCount = cpu_to_le32(1),
-    .Reserved = cpu_to_le32(0),
-};
-
-static struct usb_os_desc_header os_prop_header = {
-    .interface = cpu_to_le32(0),
-    .dwLength = cpu_to_le32(sizeof(os_desc_header) + sizeof(os_prop_values)),
-    .bcdVersion = cpu_to_le32(1),
-    .wIndex = cpu_to_le32(5),
-    .wCount = cpu_to_le16(1),
-};
-
-#define STR_INTERFACE_ "ADB Interface"
-
-static const struct {
-    struct usb_functionfs_strings_head header;
-    struct {
-        __le16 code;
-        const char str1[sizeof(STR_INTERFACE_)];
-    } __attribute__((packed)) lang0;
-} __attribute__((packed)) strings = {
-    .header = {
-        .magic = cpu_to_le32(FUNCTIONFS_STRINGS_MAGIC),
-        .length = cpu_to_le32(sizeof(strings)),
-        .str_count = cpu_to_le32(1),
-        .lang_count = cpu_to_le32(1),
-    },
-    .lang0 = {
-        cpu_to_le16(0x0409), /* en-us */
-        STR_INTERFACE_,
-    },
-};
-// clang-format on
-
-bool open_functionfs(android::base::unique_fd* out_control, android::base::unique_fd* out_bulk_out,
-                     android::base::unique_fd* out_bulk_in) {
-    unique_fd control, bulk_out, bulk_in;
-    struct desc_v1 v1_descriptor = {};
-    struct desc_v2 v2_descriptor = {};
-
-    v2_descriptor.header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2);
-    v2_descriptor.header.length = cpu_to_le32(sizeof(v2_descriptor));
-    v2_descriptor.header.flags = FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC |
-                                 FUNCTIONFS_HAS_SS_DESC | FUNCTIONFS_HAS_MS_OS_DESC;
-    v2_descriptor.fs_count = 3;
-    v2_descriptor.hs_count = 3;
-    v2_descriptor.ss_count = 5;
-    v2_descriptor.os_count = 2;
-    v2_descriptor.fs_descs = fs_descriptors;
-    v2_descriptor.hs_descs = hs_descriptors;
-    v2_descriptor.ss_descs = ss_descriptors;
-    v2_descriptor.os_header = os_desc_header;
-    v2_descriptor.os_desc = os_desc_compat;
-    v2_descriptor.os_prop_header = os_prop_header;
-    v2_descriptor.os_prop_values = os_prop_values;
-
-    if (out_control->get() < 0) {  // might have already done this before
-        LOG(INFO) << "opening control endpoint " << USB_FFS_ADB_EP0;
-        control.reset(adb_open(USB_FFS_ADB_EP0, O_RDWR));
-        if (control < 0) {
-            PLOG(ERROR) << "cannot open control endpoint " << USB_FFS_ADB_EP0;
-            return false;
-        }
-
-        if (adb_write(control.get(), &v2_descriptor, sizeof(v2_descriptor)) < 0) {
-            D("[ %s: Switching to V1_descriptor format errno=%s ]", USB_FFS_ADB_EP0,
-              strerror(errno));
-            v1_descriptor.header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC);
-            v1_descriptor.header.length = cpu_to_le32(sizeof(v1_descriptor));
-            v1_descriptor.header.fs_count = 3;
-            v1_descriptor.header.hs_count = 3;
-            v1_descriptor.fs_descs = fs_descriptors;
-            v1_descriptor.hs_descs = hs_descriptors;
-            if (adb_write(control.get(), &v1_descriptor, sizeof(v1_descriptor)) < 0) {
-                PLOG(ERROR) << "failed to write USB descriptors";
-                return false;
-            }
-        }
-
-        if (adb_write(control.get(), &strings, sizeof(strings)) < 0) {
-            PLOG(ERROR) << "failed to write USB strings";
-            return false;
-        }
-        // Signal only when writing the descriptors to ffs
-        android::base::SetProperty("sys.usb.ffs.ready", "1");
-    }
-
-    bulk_out.reset(adb_open(USB_FFS_ADB_OUT, O_RDONLY));
-    if (bulk_out < 0) {
-        PLOG(ERROR) << "cannot open bulk-out endpoint " << USB_FFS_ADB_OUT;
-        return false;
-    }
-
-    bulk_in.reset(adb_open(USB_FFS_ADB_IN, O_WRONLY));
-    if (bulk_in < 0) {
-        PLOG(ERROR) << "cannot open bulk-in endpoint " << USB_FFS_ADB_IN;
-        return false;
-    }
-
-    *out_control = std::move(control);
-    *out_bulk_in = std::move(bulk_in);
-    *out_bulk_out = std::move(bulk_out);
-    return true;
-}
diff --git a/adb/daemon/usb_ffs.h b/adb/daemon/usb_ffs.h
deleted file mode 100644
index a19d7cc..0000000
--- a/adb/daemon/usb_ffs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <android-base/unique_fd.h>
-
-bool open_functionfs(android::base::unique_fd* control, android::base::unique_fd* bulk_out,
-                     android::base::unique_fd* bulk_in);
diff --git a/adb/fastdeploy/Android.bp b/adb/fastdeploy/Android.bp
deleted file mode 100644
index f5893aa..0000000
--- a/adb/fastdeploy/Android.bp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// Copyright (C) 2018 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.
-//
-java_library {
-    name: "deployagent_lib",
-    sdk_version: "24",
-    srcs: [
-        "deployagent/src/**/*.java",
-        "proto/**/*.proto",
-    ],
-    proto: {
-        type: "lite",
-    },
-}
-
-java_binary {
-    name: "deployagent",
-    sdk_version: "24",
-    static_libs: [
-        "deployagent_lib",
-    ],
-    dex_preopt: {
-        enabled: false,
-    }
-}
-
-android_test {
-    name: "FastDeployTests",
-
-    manifest: "AndroidManifest.xml",
-
-    srcs: [
-        "deployagent/test/com/android/fastdeploy/ApkArchiveTest.java",
-    ],
-
-    static_libs: [
-        "androidx.test.core",
-        "androidx.test.runner",
-        "androidx.test.rules",
-        "deployagent_lib",
-        "mockito-target-inline-minus-junit4",
-    ],
-
-    libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
-    ],
-
-    data: [
-        "testdata/sample.apk",
-        "testdata/sample.cd",
-    ],
-
-    optimize: {
-        enabled: false,
-    },
-}
-
-java_test_host {
-    name: "FastDeployHostTests",
-    srcs: [
-        "deployagent/test/com/android/fastdeploy/FastDeployTest.java",
-    ],
-    data: [
-        "testdata/helloworld5.apk",
-        "testdata/helloworld7.apk",
-    ],
-    libs: [
-        "compatibility-host-util",
-        "cts-tradefed",
-        "tradefed",
-    ],
-    test_suites: [
-        "general-tests",
-    ],
-}
diff --git a/adb/fastdeploy/AndroidManifest.xml b/adb/fastdeploy/AndroidManifest.xml
deleted file mode 100644
index 89dc745..0000000
--- a/adb/fastdeploy/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.fastdeploytests">
-
-    <application android:testOnly="true"
-                 android:debuggable="true">
-        <uses-library android:name="android.test.runner" />
-    </application>
-
-    <instrumentation
-        android:name="androidx.test.runner.AndroidJUnitRunner"
-        android:targetPackage="com.android.fastdeploytests"
-        android:label="FastDeploy Tests" />
-</manifest>
\ No newline at end of file
diff --git a/adb/fastdeploy/AndroidTest.xml b/adb/fastdeploy/AndroidTest.xml
deleted file mode 100644
index 24a72bc..0000000
--- a/adb/fastdeploy/AndroidTest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2019 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
-  -->
-<configuration description="Runs Device Tests for FastDeploy.">
-    <option name="test-suite-tag" value="FastDeployTests"/>
-
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true"/>
-        <option name="install-arg" value="-t"/>
-        <option name="test-file-name" value="FastDeployTests.apk"/>
-    </target_preparer>
-
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-        <option name="cleanup" value="false" />
-        <option name="push-file" key="sample.apk" value="/data/local/tmp/FastDeployTests/sample.apk" />
-        <option name="push-file" key="sample.cd" value="/data/local/tmp/FastDeployTests/sample.cd" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
-        <option name="package" value="com.android.fastdeploytests"/>
-        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
-    </test>
-
-    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
-        <option name="jar" value="FastDeployHostTests.jar" />
-    </test>
-</configuration>
diff --git a/adb/fastdeploy/OWNERS b/adb/fastdeploy/OWNERS
deleted file mode 100644
index d145834..0000000
--- a/adb/fastdeploy/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-idries@google.com
diff --git a/adb/fastdeploy/deployagent/deployagent.sh b/adb/fastdeploy/deployagent/deployagent.sh
deleted file mode 100755
index 91576ca..0000000
--- a/adb/fastdeploy/deployagent/deployagent.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/system/bin/sh
-base=/data/local/tmp
-export CLASSPATH=$base/deployagent.jar
-exec app_process $base com.android.fastdeploy.DeployAgent "$@"
diff --git a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/ApkArchive.java b/adb/fastdeploy/deployagent/src/com/android/fastdeploy/ApkArchive.java
deleted file mode 100644
index 31e0502..0000000
--- a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/ApkArchive.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.fastdeploy;
-
-import android.util.Log;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
-
-/**
- * Extremely light-weight APK parser class.
- * Aware of Central Directory, Local File Headers and Signature.
- * No Zip64 support yet.
- */
-public final class ApkArchive {
-    private static final String TAG = "ApkArchive";
-
-    // Central Directory constants.
-    private static final int EOCD_SIGNATURE = 0x06054b50;
-    private static final int EOCD_MIN_SIZE = 22;
-    private static final long EOCD_MAX_SIZE = 65_535L + EOCD_MIN_SIZE;
-
-    private static final int CD_ENTRY_HEADER_SIZE_BYTES = 22;
-    private static final int CD_LOCAL_FILE_HEADER_SIZE_OFFSET = 12;
-
-    // Signature constants.
-    private static final int EOSIGNATURE_SIZE = 24;
-
-    public final static class Dump {
-        final byte[] cd;
-        final byte[] signature;
-
-        Dump(byte[] cd, byte[] signature) {
-            this.cd = cd;
-            this.signature = signature;
-        }
-    }
-
-    final static class Location {
-        final long offset;
-        final long size;
-
-        public Location(long offset, long size) {
-            this.offset = offset;
-            this.size = size;
-        }
-    }
-
-    private final RandomAccessFile mFile;
-    private final FileChannel mChannel;
-
-    public ApkArchive(File apk) throws IOException {
-        mFile = new RandomAccessFile(apk, "r");
-        mChannel = mFile.getChannel();
-    }
-
-    /**
-     * Extract the APK metadata: content of Central Directory and Signature.
-     *
-     * @return raw content from APK representing CD and Signature data.
-     */
-    public Dump extractMetadata() throws IOException {
-        Location cdLoc = getCDLocation();
-        byte[] cd = readMetadata(cdLoc);
-
-        byte[] signature = null;
-        Location sigLoc = getSignatureLocation(cdLoc.offset);
-        if (sigLoc != null) {
-            signature = readMetadata(sigLoc);
-            long size = ByteBuffer.wrap(signature).order(ByteOrder.LITTLE_ENDIAN).getLong();
-            if (sigLoc.size != size) {
-                Log.e(TAG, "Mismatching signature sizes: " + sigLoc.size + " != " + size);
-                signature = null;
-            }
-        }
-
-        return new Dump(cd, signature);
-    }
-
-    private long findEndOfCDRecord() throws IOException {
-        final long fileSize = mChannel.size();
-        int sizeToRead = Math.toIntExact(Math.min(fileSize, EOCD_MAX_SIZE));
-        final long readOffset = fileSize - sizeToRead;
-        ByteBuffer buffer = mChannel.map(FileChannel.MapMode.READ_ONLY, readOffset,
-                sizeToRead).order(ByteOrder.LITTLE_ENDIAN);
-
-        buffer.position(sizeToRead - EOCD_MIN_SIZE);
-        while (true) {
-            int signature = buffer.getInt(); // Read 4 bytes.
-            if (signature == EOCD_SIGNATURE) {
-                return readOffset + buffer.position() - 4;
-            }
-            if (buffer.position() == 4) {
-                break;
-            }
-            buffer.position(buffer.position() - Integer.BYTES - 1); // Backtrack 5 bytes.
-        }
-
-        return -1L;
-    }
-
-    private Location findCDRecord(ByteBuffer buf) {
-        if (buf.order() != ByteOrder.LITTLE_ENDIAN) {
-            throw new IllegalArgumentException("ByteBuffer byte order must be little endian");
-        }
-        if (buf.remaining() < CD_ENTRY_HEADER_SIZE_BYTES) {
-            throw new IllegalArgumentException(
-                    "Input too short. Need at least " + CD_ENTRY_HEADER_SIZE_BYTES
-                            + " bytes, available: " + buf.remaining() + "bytes.");
-        }
-
-        int originalPosition = buf.position();
-        int recordSignature = buf.getInt();
-        if (recordSignature != EOCD_SIGNATURE) {
-            throw new IllegalArgumentException(
-                    "Not a Central Directory record. Signature: 0x"
-                            + Long.toHexString(recordSignature & 0xffffffffL));
-        }
-
-        buf.position(originalPosition + CD_LOCAL_FILE_HEADER_SIZE_OFFSET);
-        long size = buf.getInt() & 0xffffffffL;
-        long offset = buf.getInt() & 0xffffffffL;
-        return new Location(offset, size);
-    }
-
-    // Retrieve the location of the Central Directory Record.
-    Location getCDLocation() throws IOException {
-        long eocdRecord = findEndOfCDRecord();
-        if (eocdRecord < 0) {
-            throw new IllegalArgumentException("Unable to find End of Central Directory record.");
-        }
-
-        Location location = findCDRecord(mChannel.map(FileChannel.MapMode.READ_ONLY, eocdRecord,
-                CD_ENTRY_HEADER_SIZE_BYTES).order(ByteOrder.LITTLE_ENDIAN));
-        if (location == null) {
-            throw new IllegalArgumentException("Unable to find Central Directory File Header.");
-        }
-
-        return location;
-    }
-
-    // Retrieve the location of the signature block starting from Central
-    // Directory Record or null if signature is not found.
-    Location getSignatureLocation(long cdRecordOffset) throws IOException {
-        long signatureOffset = cdRecordOffset - EOSIGNATURE_SIZE;
-        if (signatureOffset < 0) {
-            Log.e(TAG, "Unable to find Signature.");
-            return null;
-        }
-
-        ByteBuffer signature = mChannel.map(FileChannel.MapMode.READ_ONLY, signatureOffset,
-                EOSIGNATURE_SIZE).order(ByteOrder.LITTLE_ENDIAN);
-
-        long size = signature.getLong();
-
-        byte[] sign = new byte[16];
-        signature.get(sign);
-        String signAsString = new String(sign);
-        if (!"APK Sig Block 42".equals(signAsString)) {
-            Log.e(TAG, "Signature magic does not match: " + signAsString);
-            return null;
-        }
-
-        long offset = cdRecordOffset - size - 8;
-
-        return new Location(offset, size);
-    }
-
-    private byte[] readMetadata(Location loc) throws IOException {
-        byte[] payload = new byte[(int) loc.size];
-        ByteBuffer buffer = mChannel.map(FileChannel.MapMode.READ_ONLY, loc.offset, loc.size);
-        buffer.get(payload);
-        return payload;
-    }
-}
diff --git a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/DeployAgent.java b/adb/fastdeploy/deployagent/src/com/android/fastdeploy/DeployAgent.java
deleted file mode 100644
index 3812307..0000000
--- a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/DeployAgent.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-package com.android.fastdeploy;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
-import java.nio.channels.Channels;
-import java.nio.channels.FileChannel;
-import java.nio.channels.WritableByteChannel;
-
-import com.android.fastdeploy.PatchFormatException;
-import com.android.fastdeploy.ApkArchive;
-import com.android.fastdeploy.APKDump;
-import com.android.fastdeploy.APKMetaData;
-import com.android.fastdeploy.PatchUtils;
-
-import com.google.protobuf.ByteString;
-
-public final class DeployAgent {
-    private static final int BUFFER_SIZE = 128 * 1024;
-    private static final int AGENT_VERSION = 0x00000003;
-
-    public static void main(String[] args) {
-        int exitCode = 0;
-        try {
-            if (args.length < 1) {
-                showUsage(0);
-            }
-
-            String commandString = args[0];
-            switch (commandString) {
-                case "dump": {
-                    if (args.length != 3) {
-                        showUsage(1);
-                    }
-
-                    String requiredVersion = args[1];
-                    if (AGENT_VERSION == Integer.parseInt(requiredVersion)) {
-                        String packageName = args[2];
-                        String packagePath = getFilenameFromPackageName(packageName);
-                        if (packagePath != null) {
-                            dumpApk(packageName, packagePath);
-                        } else {
-                            exitCode = 3;
-                        }
-                    } else {
-                        System.out.printf("0x%08X\n", AGENT_VERSION);
-                        exitCode = 4;
-                    }
-                    break;
-                }
-                case "apply": {
-                    if (args.length < 3) {
-                        showUsage(1);
-                    }
-
-                    String patchPath = args[1];
-                    String outputParam = args[2];
-
-                    InputStream deltaInputStream = null;
-                    if (patchPath.compareTo("-") == 0) {
-                        deltaInputStream = System.in;
-                    } else {
-                        deltaInputStream = new FileInputStream(patchPath);
-                    }
-
-                    if (outputParam.equals("-o")) {
-                        OutputStream outputStream = null;
-                        if (args.length > 3) {
-                            String outputPath = args[3];
-                            if (!outputPath.equals("-")) {
-                                outputStream = new FileOutputStream(outputPath);
-                            }
-                        }
-                        if (outputStream == null) {
-                            outputStream = System.out;
-                        }
-                        writePatchToStream(deltaInputStream, outputStream);
-                    } else if (outputParam.equals("-pm")) {
-                        String[] sessionArgs = null;
-                        if (args.length > 3) {
-                            int numSessionArgs = args.length - 3;
-                            sessionArgs = new String[numSessionArgs];
-                            for (int i = 0; i < numSessionArgs; i++) {
-                                sessionArgs[i] = args[i + 3];
-                            }
-                        }
-                        exitCode = applyPatch(deltaInputStream, sessionArgs);
-                    }
-                    break;
-                }
-                default:
-                    showUsage(1);
-                    break;
-            }
-        } catch (Exception e) {
-            System.err.println("Error: " + e);
-            e.printStackTrace();
-            System.exit(2);
-        }
-        System.exit(exitCode);
-    }
-
-    private static void showUsage(int exitCode) {
-        System.err.println(
-                "usage: deployagent <command> [<args>]\n\n" +
-                        "commands:\n" +
-                        "dump VERSION PKGNAME  dump info for an installed package given that " +
-                        "VERSION equals current agent's version\n" +
-                        "apply PATCHFILE [-o|-pm]    apply a patch from PATCHFILE " +
-                        "(- for stdin) to an installed package\n" +
-                        " -o <FILE> directs output to FILE, default or - for stdout\n" +
-                        " -pm <ARGS> directs output to package manager, passes <ARGS> to " +
-                        "'pm install-create'\n"
-        );
-        System.exit(exitCode);
-    }
-
-    private static Process executeCommand(String command) throws IOException {
-        try {
-            Process p;
-            p = Runtime.getRuntime().exec(command);
-            p.waitFor();
-            return p;
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-        return null;
-    }
-
-    private static String getFilenameFromPackageName(String packageName) throws IOException {
-        StringBuilder commandBuilder = new StringBuilder();
-        commandBuilder.append("pm list packages -f " + packageName);
-
-        Process p = executeCommand(commandBuilder.toString());
-        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
-
-        String packagePrefix = "package:";
-        String packageSuffix = "=" + packageName;
-        String line = "";
-        while ((line = reader.readLine()) != null) {
-            if (line.endsWith(packageSuffix)) {
-                int packageIndex = line.indexOf(packagePrefix);
-                if (packageIndex == -1) {
-                    throw new IOException("error reading package list");
-                }
-                int equalsIndex = line.lastIndexOf(packageSuffix);
-                String fileName =
-                        line.substring(packageIndex + packagePrefix.length(), equalsIndex);
-                return fileName;
-            }
-        }
-        return null;
-    }
-
-    private static void dumpApk(String packageName, String packagePath) throws IOException {
-        File apk = new File(packagePath);
-        ApkArchive.Dump dump = new ApkArchive(apk).extractMetadata();
-
-        APKDump.Builder apkDumpBuilder = APKDump.newBuilder();
-        apkDumpBuilder.setName(packageName);
-        if (dump.cd != null) {
-            apkDumpBuilder.setCd(ByteString.copyFrom(dump.cd));
-        }
-        if (dump.signature != null) {
-            apkDumpBuilder.setSignature(ByteString.copyFrom(dump.signature));
-        }
-        apkDumpBuilder.setAbsolutePath(apk.getAbsolutePath());
-
-        apkDumpBuilder.build().writeTo(System.out);
-    }
-
-    private static int createInstallSession(String[] args) throws IOException {
-        StringBuilder commandBuilder = new StringBuilder();
-        commandBuilder.append("pm install-create ");
-        for (int i = 0; args != null && i < args.length; i++) {
-            commandBuilder.append(args[i] + " ");
-        }
-
-        Process p = executeCommand(commandBuilder.toString());
-
-        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        String line = "";
-        String successLineStart = "Success: created install session [";
-        String successLineEnd = "]";
-        while ((line = reader.readLine()) != null) {
-            if (line.startsWith(successLineStart) && line.endsWith(successLineEnd)) {
-                return Integer.parseInt(line.substring(successLineStart.length(),
-                        line.lastIndexOf(successLineEnd)));
-            }
-        }
-
-        return -1;
-    }
-
-    private static int commitInstallSession(int sessionId) throws IOException {
-        StringBuilder commandBuilder = new StringBuilder();
-        commandBuilder.append(String.format("pm install-commit %d -- - ", sessionId));
-        Process p = executeCommand(commandBuilder.toString());
-        return p.exitValue();
-    }
-
-    private static int applyPatch(InputStream deltaStream, String[] sessionArgs)
-            throws IOException, PatchFormatException {
-        int sessionId = createInstallSession(sessionArgs);
-        if (sessionId < 0) {
-            System.err.println("PM Create Session Failed");
-            return -1;
-        }
-
-        int writeExitCode = writePatchedDataToSession(deltaStream, sessionId);
-        if (writeExitCode == 0) {
-            return commitInstallSession(sessionId);
-        } else {
-            return -1;
-        }
-    }
-
-    private static long writePatchToStream(InputStream patchData,
-            OutputStream outputStream) throws IOException, PatchFormatException {
-        long newSize = readPatchHeader(patchData);
-        long bytesWritten = writePatchedDataToStream(newSize, patchData, outputStream);
-        outputStream.flush();
-        if (bytesWritten != newSize) {
-            throw new PatchFormatException(String.format(
-                    "output size mismatch (expected %ld but wrote %ld)", newSize, bytesWritten));
-        }
-        return bytesWritten;
-    }
-
-    private static long readPatchHeader(InputStream patchData)
-            throws IOException, PatchFormatException {
-        byte[] signatureBuffer = new byte[PatchUtils.SIGNATURE.length()];
-        try {
-            PatchUtils.readFully(patchData, signatureBuffer);
-        } catch (IOException e) {
-            throw new PatchFormatException("truncated signature");
-        }
-
-        String signature = new String(signatureBuffer);
-        if (!PatchUtils.SIGNATURE.equals(signature)) {
-            throw new PatchFormatException("bad signature");
-        }
-
-        long newSize = PatchUtils.readLELong(patchData);
-        if (newSize < 0) {
-            throw new PatchFormatException("bad newSize: " + newSize);
-        }
-
-        return newSize;
-    }
-
-    // Note that this function assumes patchData has been seek'ed to the start of the delta stream
-    // (i.e. the signature has already been read by readPatchHeader). For a stream that points to
-    // the start of a patch file call writePatchToStream
-    private static long writePatchedDataToStream(long newSize, InputStream patchData,
-            OutputStream outputStream) throws IOException {
-        String deviceFile = PatchUtils.readString(patchData);
-        RandomAccessFile oldDataFile = new RandomAccessFile(deviceFile, "r");
-        FileChannel oldData = oldDataFile.getChannel();
-
-        WritableByteChannel newData = Channels.newChannel(outputStream);
-
-        long newDataBytesWritten = 0;
-        byte[] buffer = new byte[BUFFER_SIZE];
-
-        while (newDataBytesWritten < newSize) {
-            long newDataLen = PatchUtils.readLELong(patchData);
-            if (newDataLen > 0) {
-                PatchUtils.pipe(patchData, outputStream, buffer, newDataLen);
-            }
-
-            long oldDataOffset = PatchUtils.readLELong(patchData);
-            long oldDataLen = PatchUtils.readLELong(patchData);
-            if (oldDataLen >= 0) {
-                long offset = oldDataOffset;
-                long len = oldDataLen;
-                while (len > 0) {
-                    long chunkLen = Math.min(len, 1024*1024*1024);
-                    oldData.transferTo(offset, chunkLen, newData);
-                    offset += chunkLen;
-                    len -= chunkLen;
-                }
-            }
-            newDataBytesWritten += newDataLen + oldDataLen;
-        }
-
-        return newDataBytesWritten;
-    }
-
-    private static int writePatchedDataToSession(InputStream patchData, int sessionId)
-            throws IOException, PatchFormatException {
-        try {
-            Process p;
-            long newSize = readPatchHeader(patchData);
-            String command = String.format("pm install-write -S %d %d -- -", newSize, sessionId);
-            p = Runtime.getRuntime().exec(command);
-
-            OutputStream sessionOutputStream = p.getOutputStream();
-            long bytesWritten = writePatchedDataToStream(newSize, patchData, sessionOutputStream);
-            sessionOutputStream.flush();
-            p.waitFor();
-            if (bytesWritten != newSize) {
-                throw new PatchFormatException(
-                        String.format("output size mismatch (expected %d but wrote %)", newSize,
-                                bytesWritten));
-            }
-            return p.exitValue();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-        return -1;
-    }
-}
diff --git a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/PatchFormatException.java b/adb/fastdeploy/deployagent/src/com/android/fastdeploy/PatchFormatException.java
deleted file mode 100644
index f0655f3..0000000
--- a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/PatchFormatException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-package com.android.fastdeploy;
-
-class PatchFormatException extends Exception {
-    /**
-     * Constructs a new exception with the specified message.
-     * @param message the message
-     */
-    public PatchFormatException(String message) { super(message); }
-
-    /**
-     * Constructs a new exception with the specified message and cause.
-     * @param message the message
-     * @param cause the cause of the error
-     */
-    public PatchFormatException(String message, Throwable cause) {
-        super(message);
-        initCause(cause);
-    }
-}
diff --git a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/PatchUtils.java b/adb/fastdeploy/deployagent/src/com/android/fastdeploy/PatchUtils.java
deleted file mode 100644
index 54be26f..0000000
--- a/adb/fastdeploy/deployagent/src/com/android/fastdeploy/PatchUtils.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-package com.android.fastdeploy;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-class PatchUtils {
-    public static final String SIGNATURE = "FASTDEPLOY";
-
-    /**
-     * Reads a 64-bit signed integer in Little Endian format from the specified {@link
-     * DataInputStream}.
-     *
-     * @param in the stream to read from.
-     */
-    static long readLELong(InputStream in) throws IOException {
-        byte[] buffer = new byte[Long.BYTES];
-        readFully(in, buffer);
-        ByteBuffer buf = ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN);
-        return buf.getLong();
-    }
-
-    static String readString(InputStream in) throws IOException {
-        int size = (int) readLELong(in);
-        byte[] buffer = new byte[size];
-        readFully(in, buffer);
-        return new String(buffer);
-    }
-
-    static void readFully(final InputStream in, final byte[] destination, final int startAt,
-            final int numBytes) throws IOException {
-        int numRead = 0;
-        while (numRead < numBytes) {
-            int readNow = in.read(destination, startAt + numRead, numBytes - numRead);
-            if (readNow == -1) {
-                throw new IOException("truncated input stream");
-            }
-            numRead += readNow;
-        }
-    }
-
-    static void readFully(final InputStream in, final byte[] destination) throws IOException {
-        readFully(in, destination, 0, destination.length);
-    }
-
-    static void pipe(final InputStream in, final OutputStream out, final byte[] buffer,
-            long copyLength) throws IOException {
-        while (copyLength > 0) {
-            int maxCopy = (int) Math.min(buffer.length, copyLength);
-            readFully(in, buffer, 0, maxCopy);
-            out.write(buffer, 0, maxCopy);
-            copyLength -= maxCopy;
-        }
-    }
-}
diff --git a/adb/fastdeploy/deployagent/test/com/android/fastdeploy/ApkArchiveTest.java b/adb/fastdeploy/deployagent/test/com/android/fastdeploy/ApkArchiveTest.java
deleted file mode 100644
index 7c2468f..0000000
--- a/adb/fastdeploy/deployagent/test/com/android/fastdeploy/ApkArchiveTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.fastdeploy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.android.fastdeploy.ApkArchive;
-
-import java.io.File;
-import java.io.IOException;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class ApkArchiveTest {
-    private static final File SAMPLE_APK = new File("/data/local/tmp/FastDeployTests/sample.apk");
-    private static final File WRONG_APK = new File("/data/local/tmp/FastDeployTests/sample.cd");
-
-    @Test
-    public void testApkArchiveSizes() throws IOException {
-        ApkArchive archive = new ApkArchive(SAMPLE_APK);
-
-        ApkArchive.Location cdLoc = archive.getCDLocation();
-        assertNotEquals(cdLoc, null);
-        assertEquals(cdLoc.offset, 2044145);
-        assertEquals(cdLoc.size, 49390);
-
-        // Check that block can be retrieved
-        ApkArchive.Location sigLoc = archive.getSignatureLocation(cdLoc.offset);
-        assertNotEquals(sigLoc, null);
-        assertEquals(sigLoc.offset, 2040049);
-        assertEquals(sigLoc.size, 4088);
-    }
-
-    @Test
-    public void testApkArchiveDump() throws IOException {
-        ApkArchive archive = new ApkArchive(SAMPLE_APK);
-
-        ApkArchive.Dump dump = archive.extractMetadata();
-        assertNotEquals(dump, null);
-        assertNotEquals(dump.cd, null);
-        assertNotEquals(dump.signature, null);
-        assertEquals(dump.cd.length, 49390);
-        assertEquals(dump.signature.length, 4088);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testApkArchiveDumpWrongApk() throws IOException {
-        ApkArchive archive = new ApkArchive(WRONG_APK);
-
-        archive.extractMetadata();
-    }
-}
diff --git a/adb/fastdeploy/deployagent/test/com/android/fastdeploy/FastDeployTest.java b/adb/fastdeploy/deployagent/test/com/android/fastdeploy/FastDeployTest.java
deleted file mode 100644
index 4aa2f79..0000000
--- a/adb/fastdeploy/deployagent/test/com/android/fastdeploy/FastDeployTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-package com.android.fastdeploy;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
-import com.android.ddmlib.Log.LogLevel;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class FastDeployTest extends BaseHostJUnit4Test {
-
-    private static final String TEST_APP_PACKAGE = "com.example.helloworld";
-    private static final String TEST_APK5_NAME = "helloworld5.apk";
-    private static final String TEST_APK7_NAME = "helloworld7.apk";
-
-    private String mTestApk5Path;
-    private String mTestApk7Path;
-
-    @Before
-    public void setUp() throws Exception {
-        CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild());
-        getDevice().uninstallPackage(TEST_APP_PACKAGE);
-        mTestApk5Path = buildHelper.getTestFile(TEST_APK5_NAME).getAbsolutePath();
-        mTestApk7Path = buildHelper.getTestFile(TEST_APK7_NAME).getAbsolutePath();
-    }
-
-    @Test
-    public void testAppInstalls() throws Exception {
-        fastInstallPackage(mTestApk5Path);
-        assertTrue(isAppInstalled(TEST_APP_PACKAGE));
-        getDevice().uninstallPackage(TEST_APP_PACKAGE);
-        assertFalse(isAppInstalled(TEST_APP_PACKAGE));
-    }
-
-    @Test
-    public void testAppPatch() throws Exception {
-        fastInstallPackage(mTestApk5Path);
-        assertTrue(isAppInstalled(TEST_APP_PACKAGE));
-        fastInstallPackage(mTestApk7Path);
-        assertTrue(isAppInstalled(TEST_APP_PACKAGE));
-        getDevice().uninstallPackage(TEST_APP_PACKAGE);
-        assertFalse(isAppInstalled(TEST_APP_PACKAGE));
-    }
-
-    private boolean isAppInstalled(String packageName) throws DeviceNotAvailableException {
-        final String result = getDevice().executeShellCommand("pm list packages");
-        CLog.logAndDisplay(LogLevel.INFO, result);
-        final int prefixLength = "package:".length();
-        return Arrays.stream(result.split("\\r?\\n"))
-                .anyMatch(line -> line.substring(prefixLength).equals(packageName));
-    }
-
-    // Mostly copied from PkgInstallSignatureVerificationTest.java.
-    private void fastInstallPackage(String apkPath)
-            throws IOException, DeviceNotAvailableException {
-        String result = getDevice().executeAdbCommand("install", "-t", "--fastdeploy", "--force-agent",
-                apkPath);
-        CLog.logAndDisplay(LogLevel.INFO, result);
-    }
-}
-
-
diff --git a/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp b/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp
deleted file mode 100644
index 9da256e..0000000
--- a/adb/fastdeploy/deploypatchgenerator/apk_archive.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#define TRACE_TAG ADB
-
-#include "apk_archive.h"
-
-#include <inttypes.h>
-
-#include "adb_trace.h"
-#include "sysdeps.h"
-
-#include <android-base/endian.h>
-#include <android-base/mapped_file.h>
-
-#include <openssl/md5.h>
-
-constexpr uint16_t kCompressStored = 0;
-
-// mask value that signifies that the entry has a DD
-static const uint32_t kGPBDDFlagMask = 0x0008;
-
-namespace {
-struct FileRegion {
-    FileRegion(borrowed_fd fd, off64_t offset, size_t length)
-        : mapped_(android::base::MappedFile::FromOsHandle(adb_get_os_handle(fd), offset, length,
-                                                          PROT_READ)) {
-        if (mapped_ != nullptr) {
-            return;
-        }
-
-        // Mapped file failed, falling back to pread.
-        buffer_.resize(length);
-        if (auto err = adb_pread(fd.get(), buffer_.data(), length, offset); size_t(err) != length) {
-            fprintf(stderr, "Unable to read %lld bytes at offset %" PRId64 " \n",
-                    static_cast<long long>(length), offset);
-            buffer_.clear();
-            return;
-        }
-    }
-
-    const char* data() const { return mapped_ ? mapped_->data() : buffer_.data(); }
-    size_t size() const { return mapped_ ? mapped_->size() : buffer_.size(); }
-
-  private:
-    FileRegion() = default;
-    DISALLOW_COPY_AND_ASSIGN(FileRegion);
-
-    std::unique_ptr<android::base::MappedFile> mapped_;
-    std::string buffer_;
-};
-}  // namespace
-
-using com::android::fastdeploy::APKDump;
-
-ApkArchive::ApkArchive(const std::string& path) : path_(path), size_(0) {
-    fd_.reset(adb_open(path_.c_str(), O_RDONLY));
-    if (fd_ == -1) {
-        fprintf(stderr, "Unable to open file '%s'\n", path_.c_str());
-        return;
-    }
-
-    struct stat st;
-    if (stat(path_.c_str(), &st) == -1) {
-        fprintf(stderr, "Unable to stat file '%s'\n", path_.c_str());
-        return;
-    }
-    size_ = st.st_size;
-}
-
-ApkArchive::~ApkArchive() {}
-
-APKDump ApkArchive::ExtractMetadata() {
-    D("ExtractMetadata");
-    if (!ready()) {
-        return {};
-    }
-
-    Location cdLoc = GetCDLocation();
-    if (!cdLoc.valid) {
-        return {};
-    }
-
-    APKDump dump;
-    dump.set_absolute_path(path_);
-    dump.set_cd(ReadMetadata(cdLoc));
-
-    Location sigLoc = GetSignatureLocation(cdLoc.offset);
-    if (sigLoc.valid) {
-        dump.set_signature(ReadMetadata(sigLoc));
-    }
-    return dump;
-}
-
-off_t ApkArchive::FindEndOfCDRecord() const {
-    constexpr int endOfCDSignature = 0x06054b50;
-    constexpr off_t endOfCDMinSize = 22;
-    constexpr off_t endOfCDMaxSize = 65535 + endOfCDMinSize;
-
-    auto sizeToRead = std::min(size_, endOfCDMaxSize);
-    auto readOffset = size_ - sizeToRead;
-    FileRegion mapped(fd_, readOffset, sizeToRead);
-
-    // Start scanning from the end
-    auto* start = mapped.data();
-    auto* cursor = start + mapped.size() - sizeof(endOfCDSignature);
-
-    // Search for End of Central Directory record signature.
-    while (cursor >= start) {
-        if (*(int32_t*)cursor == endOfCDSignature) {
-            return readOffset + (cursor - start);
-        }
-        cursor--;
-    }
-    return -1;
-}
-
-ApkArchive::Location ApkArchive::FindCDRecord(const char* cursor) {
-    struct ecdr_t {
-        int32_t signature;
-        uint16_t diskNumber;
-        uint16_t numDisk;
-        uint16_t diskEntries;
-        uint16_t numEntries;
-        uint32_t crSize;
-        uint32_t offsetToCdHeader;
-        uint16_t commentSize;
-        uint8_t comment[0];
-    } __attribute__((packed));
-    ecdr_t* header = (ecdr_t*)cursor;
-
-    Location location;
-    location.offset = header->offsetToCdHeader;
-    location.size = header->crSize;
-    location.valid = true;
-    return location;
-}
-
-ApkArchive::Location ApkArchive::GetCDLocation() {
-    constexpr off_t cdEntryHeaderSizeBytes = 22;
-    Location location;
-
-    // Find End of Central Directory Record
-    off_t eocdRecord = FindEndOfCDRecord();
-    if (eocdRecord < 0) {
-        fprintf(stderr, "Unable to find End of Central Directory record in file '%s'\n",
-                path_.c_str());
-        return location;
-    }
-
-    // Find Central Directory Record
-    FileRegion mapped(fd_, eocdRecord, cdEntryHeaderSizeBytes);
-    location = FindCDRecord(mapped.data());
-    if (!location.valid) {
-        fprintf(stderr, "Unable to find Central Directory File Header in file '%s'\n",
-                path_.c_str());
-        return location;
-    }
-
-    return location;
-}
-
-ApkArchive::Location ApkArchive::GetSignatureLocation(off_t cdRecordOffset) {
-    Location location;
-
-    // Signature constants.
-    constexpr off_t endOfSignatureSize = 24;
-    off_t signatureOffset = cdRecordOffset - endOfSignatureSize;
-    if (signatureOffset < 0) {
-        fprintf(stderr, "Unable to find signature in file '%s'\n", path_.c_str());
-        return location;
-    }
-
-    FileRegion mapped(fd_, signatureOffset, endOfSignatureSize);
-
-    uint64_t signatureSize = *(uint64_t*)mapped.data();
-    auto* signature = mapped.data() + sizeof(signatureSize);
-    // Check if there is a v2/v3 Signature block here.
-    if (memcmp(signature, "APK Sig Block 42", 16)) {
-        return location;
-    }
-
-    // This is likely a signature block.
-    location.size = signatureSize;
-    location.offset = cdRecordOffset - location.size - 8;
-    location.valid = true;
-
-    return location;
-}
-
-std::string ApkArchive::ReadMetadata(Location loc) const {
-    FileRegion mapped(fd_, loc.offset, loc.size);
-    return {mapped.data(), mapped.size()};
-}
-
-size_t ApkArchive::ParseCentralDirectoryRecord(const char* input, size_t size, std::string* md5Hash,
-                                               int64_t* localFileHeaderOffset, int64_t* dataSize) {
-    // A structure representing the fixed length fields for a single
-    // record in the central directory of the archive. In addition to
-    // the fixed length fields listed here, each central directory
-    // record contains a variable length "file_name" and "extra_field"
-    // whose lengths are given by |file_name_length| and |extra_field_length|
-    // respectively.
-    static constexpr int kCDFileHeaderMagic = 0x02014b50;
-    struct CentralDirectoryRecord {
-        // The start of record signature. Must be |kSignature|.
-        uint32_t record_signature;
-        // Source tool version. Top byte gives source OS.
-        uint16_t version_made_by;
-        // Tool version. Ignored by this implementation.
-        uint16_t version_needed;
-        // The "general purpose bit flags" for this entry. The only
-        // flag value that we currently check for is the "data descriptor"
-        // flag.
-        uint16_t gpb_flags;
-        // The compression method for this entry, one of |kCompressStored|
-        // and |kCompressDeflated|.
-        uint16_t compression_method;
-        // The file modification time and date for this entry.
-        uint16_t last_mod_time;
-        uint16_t last_mod_date;
-        // The CRC-32 checksum for this entry.
-        uint32_t crc32;
-        // The compressed size (in bytes) of this entry.
-        uint32_t compressed_size;
-        // The uncompressed size (in bytes) of this entry.
-        uint32_t uncompressed_size;
-        // The length of the entry file name in bytes. The file name
-        // will appear immediately after this record.
-        uint16_t file_name_length;
-        // The length of the extra field info (in bytes). This data
-        // will appear immediately after the entry file name.
-        uint16_t extra_field_length;
-        // The length of the entry comment (in bytes). This data will
-        // appear immediately after the extra field.
-        uint16_t comment_length;
-        // The start disk for this entry. Ignored by this implementation).
-        uint16_t file_start_disk;
-        // File attributes. Ignored by this implementation.
-        uint16_t internal_file_attributes;
-        // File attributes. For archives created on Unix, the top bits are the
-        // mode.
-        uint32_t external_file_attributes;
-        // The offset to the local file header for this entry, from the
-        // beginning of this archive.
-        uint32_t local_file_header_offset;
-
-      private:
-        CentralDirectoryRecord() = default;
-        DISALLOW_COPY_AND_ASSIGN(CentralDirectoryRecord);
-    } __attribute__((packed));
-
-    const CentralDirectoryRecord* cdr;
-    if (size < sizeof(*cdr)) {
-        return 0;
-    }
-
-    auto begin = input;
-    cdr = reinterpret_cast<const CentralDirectoryRecord*>(begin);
-    if (cdr->record_signature != kCDFileHeaderMagic) {
-        fprintf(stderr, "Invalid Central Directory Record signature\n");
-        return 0;
-    }
-    auto end = begin + sizeof(*cdr) + cdr->file_name_length + cdr->extra_field_length +
-               cdr->comment_length;
-
-    uint8_t md5Digest[MD5_DIGEST_LENGTH];
-    MD5((const unsigned char*)begin, end - begin, md5Digest);
-    md5Hash->assign((const char*)md5Digest, sizeof(md5Digest));
-
-    *localFileHeaderOffset = cdr->local_file_header_offset;
-    *dataSize = (cdr->compression_method == kCompressStored) ? cdr->uncompressed_size
-                                                             : cdr->compressed_size;
-
-    return end - begin;
-}
-
-size_t ApkArchive::CalculateLocalFileEntrySize(int64_t localFileHeaderOffset,
-                                               int64_t dataSize) const {
-    // The local file header for a given entry. This duplicates information
-    // present in the central directory of the archive. It is an error for
-    // the information here to be different from the central directory
-    // information for a given entry.
-    static constexpr int kLocalFileHeaderMagic = 0x04034b50;
-    struct LocalFileHeader {
-        // The local file header signature, must be |kSignature|.
-        uint32_t lfh_signature;
-        // Tool version. Ignored by this implementation.
-        uint16_t version_needed;
-        // The "general purpose bit flags" for this entry. The only
-        // flag value that we currently check for is the "data descriptor"
-        // flag.
-        uint16_t gpb_flags;
-        // The compression method for this entry, one of |kCompressStored|
-        // and |kCompressDeflated|.
-        uint16_t compression_method;
-        // The file modification time and date for this entry.
-        uint16_t last_mod_time;
-        uint16_t last_mod_date;
-        // The CRC-32 checksum for this entry.
-        uint32_t crc32;
-        // The compressed size (in bytes) of this entry.
-        uint32_t compressed_size;
-        // The uncompressed size (in bytes) of this entry.
-        uint32_t uncompressed_size;
-        // The length of the entry file name in bytes. The file name
-        // will appear immediately after this record.
-        uint16_t file_name_length;
-        // The length of the extra field info (in bytes). This data
-        // will appear immediately after the entry file name.
-        uint16_t extra_field_length;
-
-      private:
-        LocalFileHeader() = default;
-        DISALLOW_COPY_AND_ASSIGN(LocalFileHeader);
-    } __attribute__((packed));
-    static constexpr int kLocalFileHeaderSize = sizeof(LocalFileHeader);
-    CHECK(ready()) << path_;
-
-    const LocalFileHeader* lfh;
-    if (localFileHeaderOffset + kLocalFileHeaderSize > size_) {
-        fprintf(stderr,
-                "Invalid Local File Header offset in file '%s' at offset %lld, file size %lld\n",
-                path_.c_str(), static_cast<long long>(localFileHeaderOffset),
-                static_cast<long long>(size_));
-        return 0;
-    }
-
-    FileRegion lfhMapped(fd_, localFileHeaderOffset, sizeof(LocalFileHeader));
-    lfh = reinterpret_cast<const LocalFileHeader*>(lfhMapped.data());
-    if (lfh->lfh_signature != kLocalFileHeaderMagic) {
-        fprintf(stderr, "Invalid Local File Header signature in file '%s' at offset %lld\n",
-                path_.c_str(), static_cast<long long>(localFileHeaderOffset));
-        return 0;
-    }
-
-    // The *optional* data descriptor start signature.
-    static constexpr int kOptionalDataDescriptorMagic = 0x08074b50;
-    struct DataDescriptor {
-        // CRC-32 checksum of the entry.
-        uint32_t crc32;
-        // Compressed size of the entry.
-        uint32_t compressed_size;
-        // Uncompressed size of the entry.
-        uint32_t uncompressed_size;
-
-      private:
-        DataDescriptor() = default;
-        DISALLOW_COPY_AND_ASSIGN(DataDescriptor);
-    } __attribute__((packed));
-    static constexpr int kDataDescriptorSize = sizeof(DataDescriptor);
-
-    off_t ddOffset = localFileHeaderOffset + kLocalFileHeaderSize + lfh->file_name_length +
-                     lfh->extra_field_length + dataSize;
-    int64_t ddSize = 0;
-
-    int64_t localDataSize;
-    if (lfh->gpb_flags & kGPBDDFlagMask) {
-        // There is trailing data descriptor.
-        const DataDescriptor* dd;
-
-        if (ddOffset + int(sizeof(uint32_t)) > size_) {
-            fprintf(stderr,
-                    "Error reading trailing data descriptor signature in file '%s' at offset %lld, "
-                    "file size %lld\n",
-                    path_.c_str(), static_cast<long long>(ddOffset), static_cast<long long>(size_));
-            return 0;
-        }
-
-        FileRegion ddMapped(fd_, ddOffset, sizeof(uint32_t) + sizeof(DataDescriptor));
-
-        off_t localDDOffset = 0;
-        if (kOptionalDataDescriptorMagic == *(uint32_t*)ddMapped.data()) {
-            ddOffset += sizeof(uint32_t);
-            localDDOffset += sizeof(uint32_t);
-            ddSize += sizeof(uint32_t);
-        }
-        if (ddOffset + kDataDescriptorSize > size_) {
-            fprintf(stderr,
-                    "Error reading trailing data descriptor in file '%s' at offset %lld, file size "
-                    "%lld\n",
-                    path_.c_str(), static_cast<long long>(ddOffset), static_cast<long long>(size_));
-            return 0;
-        }
-
-        dd = reinterpret_cast<const DataDescriptor*>(ddMapped.data() + localDDOffset);
-        localDataSize = (lfh->compression_method == kCompressStored) ? dd->uncompressed_size
-                                                                     : dd->compressed_size;
-        ddSize += sizeof(*dd);
-    } else {
-        localDataSize = (lfh->compression_method == kCompressStored) ? lfh->uncompressed_size
-                                                                     : lfh->compressed_size;
-    }
-    if (localDataSize != dataSize) {
-        fprintf(stderr,
-                "Data sizes mismatch in file '%s' at offset %lld, CDr: %lld vs LHR/DD: %lld\n",
-                path_.c_str(), static_cast<long long>(localFileHeaderOffset),
-                static_cast<long long>(dataSize), static_cast<long long>(localDataSize));
-        return 0;
-    }
-
-    return kLocalFileHeaderSize + lfh->file_name_length + lfh->extra_field_length + dataSize +
-           ddSize;
-}
diff --git a/adb/fastdeploy/deploypatchgenerator/apk_archive.h b/adb/fastdeploy/deploypatchgenerator/apk_archive.h
deleted file mode 100644
index 7127800..0000000
--- a/adb/fastdeploy/deploypatchgenerator/apk_archive.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <adb_unique_fd.h>
-
-#include "fastdeploy/proto/ApkEntry.pb.h"
-
-class ApkArchiveTester;
-
-// Manipulates an APK archive. Process it by mmaping it in order to minimize
-// I/Os.
-class ApkArchive {
-  public:
-    friend ApkArchiveTester;
-
-    // A convenience struct to store the result of search operation when
-    // locating the EoCDr, CDr, and Signature Block.
-    struct Location {
-        off_t offset = 0;
-        off_t size = 0;
-        bool valid = false;
-    };
-
-    ApkArchive(const std::string& path);
-    ~ApkArchive();
-
-    com::android::fastdeploy::APKDump ExtractMetadata();
-
-    // Parses the CDr starting from |input| and returns number of bytes consumed.
-    // Extracts local file header offset, data size and calculates MD5 hash of the record.
-    // 0 indicates invalid CDr.
-    static size_t ParseCentralDirectoryRecord(const char* input, size_t size, std::string* md5Hash,
-                                              int64_t* localFileHeaderOffset, int64_t* dataSize);
-    // Calculates Local File Entry size including header using offset and data size from CDr.
-    // 0 indicates invalid Local File Entry.
-    size_t CalculateLocalFileEntrySize(int64_t localFileHeaderOffset, int64_t dataSize) const;
-
-  private:
-    std::string ReadMetadata(Location loc) const;
-
-    // Retrieve the location of the Central Directory Record.
-    Location GetCDLocation();
-
-    // Retrieve the location of the signature block starting from Central
-    // Directory Record
-    Location GetSignatureLocation(off_t cdRecordOffset);
-
-    // Find the End of Central Directory Record, starting from the end of the
-    // file.
-    off_t FindEndOfCDRecord() const;
-
-    // Find Central Directory Record, starting from the end of the file.
-    Location FindCDRecord(const char* cursor);
-
-    // Checks if the archive can be used.
-    bool ready() const { return fd_ >= 0; }
-
-    std::string path_;
-    off_t size_;
-    unique_fd fd_;
-};
diff --git a/adb/fastdeploy/deploypatchgenerator/apk_archive_test.cpp b/adb/fastdeploy/deploypatchgenerator/apk_archive_test.cpp
deleted file mode 100644
index 554cb57..0000000
--- a/adb/fastdeploy/deploypatchgenerator/apk_archive_test.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <iostream>
-
-#include <gtest/gtest.h>
-
-#include "apk_archive.h"
-
-// Friend test to get around private scope of ApkArchive private functions.
-class ApkArchiveTester {
-  public:
-    ApkArchiveTester(const std::string& path) : archive_(path) {}
-
-    bool ready() { return archive_.ready(); }
-
-    auto ExtractMetadata() { return archive_.ExtractMetadata(); }
-
-    ApkArchive::Location GetCDLocation() { return archive_.GetCDLocation(); }
-    ApkArchive::Location GetSignatureLocation(size_t start) {
-        return archive_.GetSignatureLocation(start);
-    }
-
-  private:
-    ApkArchive archive_;
-};
-
-TEST(ApkArchiveTest, TestApkArchiveSizes) {
-    ApkArchiveTester archiveTester("fastdeploy/testdata/sample.apk");
-    EXPECT_TRUE(archiveTester.ready());
-
-    ApkArchive::Location cdLoc = archiveTester.GetCDLocation();
-    EXPECT_TRUE(cdLoc.valid);
-    ASSERT_EQ(cdLoc.offset, 2044145u);
-    ASSERT_EQ(cdLoc.size, 49390u);
-
-    // Check that block can be retrieved
-    ApkArchive::Location sigLoc = archiveTester.GetSignatureLocation(cdLoc.offset);
-    EXPECT_TRUE(sigLoc.valid);
-    ASSERT_EQ(sigLoc.offset, 2040049u);
-    ASSERT_EQ(sigLoc.size, 4088u);
-}
-
-TEST(ApkArchiveTest, TestApkArchiveDump) {
-    ApkArchiveTester archiveTester("fastdeploy/testdata/sample.apk");
-    EXPECT_TRUE(archiveTester.ready());
-
-    auto dump = archiveTester.ExtractMetadata();
-    ASSERT_EQ(dump.cd().size(), 49390u);
-    ASSERT_EQ(dump.signature().size(), 4088u);
-}
-
-TEST(ApkArchiveTest, WrongApk) {
-    ApkArchiveTester archiveTester("fastdeploy/testdata/sample.cd");
-    EXPECT_TRUE(archiveTester.ready());
-
-    auto dump = archiveTester.ExtractMetadata();
-    ASSERT_EQ(dump.cd().size(), 0u);
-    ASSERT_EQ(dump.signature().size(), 0u);
-}
diff --git a/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp b/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp
deleted file mode 100644
index 8aa7da7..0000000
--- a/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "deploy_patch_generator.h"
-
-#include <inttypes.h>
-#include <stdio.h>
-
-#include <algorithm>
-#include <fstream>
-#include <functional>
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <unordered_map>
-
-#include <openssl/md5.h>
-
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "android-base/file.h"
-#include "patch_utils.h"
-#include "sysdeps.h"
-
-using namespace com::android::fastdeploy;
-
-void DeployPatchGenerator::Log(const char* fmt, ...) {
-    va_list ap;
-    va_start(ap, fmt);
-    vprintf(fmt, ap);
-    printf("\n");
-    va_end(ap);
-}
-
-static std::string HexEncode(const void* in_buffer, unsigned int size) {
-    static const char kHexChars[] = "0123456789ABCDEF";
-
-    // Each input byte creates two output hex characters.
-    std::string out_buffer(size * 2, '\0');
-
-    for (unsigned int i = 0; i < size; ++i) {
-        char byte = ((const uint8_t*)in_buffer)[i];
-        out_buffer[(i << 1)] = kHexChars[(byte >> 4) & 0xf];
-        out_buffer[(i << 1) + 1] = kHexChars[byte & 0xf];
-    }
-    return out_buffer;
-}
-
-void DeployPatchGenerator::APKEntryToLog(const APKEntry& entry) {
-    if (!is_verbose_) {
-        return;
-    }
-    Log("MD5: %s", HexEncode(entry.md5().data(), entry.md5().size()).c_str());
-    Log("Data Offset: %" PRId64, entry.dataoffset());
-    Log("Data Size: %" PRId64, entry.datasize());
-}
-
-void DeployPatchGenerator::APKMetaDataToLog(const APKMetaData& metadata) {
-    if (!is_verbose_) {
-        return;
-    }
-    Log("APK Metadata: %s", metadata.absolute_path().c_str());
-    for (int i = 0; i < metadata.entries_size(); i++) {
-        const APKEntry& entry = metadata.entries(i);
-        APKEntryToLog(entry);
-    }
-}
-
-void DeployPatchGenerator::ReportSavings(const std::vector<SimpleEntry>& identicalEntries,
-                                         uint64_t totalSize) {
-    uint64_t totalEqualBytes = 0;
-    uint64_t totalEqualFiles = 0;
-    for (size_t i = 0; i < identicalEntries.size(); i++) {
-        if (identicalEntries[i].deviceEntry != nullptr) {
-            totalEqualBytes += identicalEntries[i].localEntry->datasize();
-            totalEqualFiles++;
-        }
-    }
-    double savingPercent = (totalEqualBytes * 100.0f) / totalSize;
-    fprintf(stderr, "Detected %" PRIu64 " equal APK entries\n", totalEqualFiles);
-    fprintf(stderr, "%" PRIu64 " bytes are equal out of %" PRIu64 " (%.2f%%)\n", totalEqualBytes,
-            totalSize, savingPercent);
-}
-
-struct PatchEntry {
-    int64_t deltaFromDeviceDataStart = 0;
-    int64_t deviceDataOffset = 0;
-    int64_t deviceDataLength = 0;
-};
-static void WritePatchEntry(const PatchEntry& patchEntry, borrowed_fd input, borrowed_fd output,
-                            size_t* realSizeOut) {
-    if (!(patchEntry.deltaFromDeviceDataStart | patchEntry.deviceDataOffset |
-          patchEntry.deviceDataLength)) {
-        return;
-    }
-
-    PatchUtils::WriteLong(patchEntry.deltaFromDeviceDataStart, output);
-    if (patchEntry.deltaFromDeviceDataStart > 0) {
-        PatchUtils::Pipe(input, output, patchEntry.deltaFromDeviceDataStart);
-    }
-    auto hostDataLength = patchEntry.deviceDataLength;
-    adb_lseek(input, hostDataLength, SEEK_CUR);
-
-    PatchUtils::WriteLong(patchEntry.deviceDataOffset, output);
-    PatchUtils::WriteLong(patchEntry.deviceDataLength, output);
-
-    *realSizeOut += patchEntry.deltaFromDeviceDataStart + hostDataLength;
-}
-
-void DeployPatchGenerator::GeneratePatch(const std::vector<SimpleEntry>& entriesToUseOnDevice,
-                                         const std::string& localApkPath,
-                                         const std::string& deviceApkPath, borrowed_fd output) {
-    unique_fd input(adb_open(localApkPath.c_str(), O_RDONLY | O_CLOEXEC));
-    size_t newApkSize = adb_lseek(input, 0L, SEEK_END);
-    adb_lseek(input, 0L, SEEK_SET);
-
-    // Header.
-    PatchUtils::WriteSignature(output);
-    PatchUtils::WriteLong(newApkSize, output);
-    PatchUtils::WriteString(deviceApkPath, output);
-
-    size_t currentSizeOut = 0;
-    size_t realSizeOut = 0;
-    // Write data from the host upto the first entry we have that matches a device entry. Then write
-    // the metadata about the device entry and repeat for all entries that match on device. Finally
-    // write out any data left. If the device and host APKs are exactly the same this ends up
-    // writing out zip metadata from the local APK followed by offsets to the data to use from the
-    // device APK.
-    PatchEntry patchEntry;
-    for (size_t i = 0, size = entriesToUseOnDevice.size(); i < size; ++i) {
-        auto&& entry = entriesToUseOnDevice[i];
-        int64_t hostDataOffset = entry.localEntry->dataoffset();
-        int64_t hostDataLength = entry.localEntry->datasize();
-        int64_t deviceDataOffset = entry.deviceEntry->dataoffset();
-        // Both entries are the same, using host data length.
-        int64_t deviceDataLength = hostDataLength;
-
-        int64_t deltaFromDeviceDataStart = hostDataOffset - currentSizeOut;
-        if (deltaFromDeviceDataStart > 0) {
-            WritePatchEntry(patchEntry, input, output, &realSizeOut);
-            patchEntry.deltaFromDeviceDataStart = deltaFromDeviceDataStart;
-            patchEntry.deviceDataOffset = deviceDataOffset;
-            patchEntry.deviceDataLength = deviceDataLength;
-        } else {
-            patchEntry.deviceDataLength += deviceDataLength;
-        }
-
-        currentSizeOut += deltaFromDeviceDataStart + hostDataLength;
-    }
-    WritePatchEntry(patchEntry, input, output, &realSizeOut);
-    if (realSizeOut != currentSizeOut) {
-        fprintf(stderr, "Size mismatch current %lld vs real %lld\n",
-                static_cast<long long>(currentSizeOut), static_cast<long long>(realSizeOut));
-        error_exit("Aborting");
-    }
-
-    if (newApkSize > currentSizeOut) {
-        PatchUtils::WriteLong(newApkSize - currentSizeOut, output);
-        PatchUtils::Pipe(input, output, newApkSize - currentSizeOut);
-        PatchUtils::WriteLong(0, output);
-        PatchUtils::WriteLong(0, output);
-    }
-}
-
-bool DeployPatchGenerator::CreatePatch(const char* localApkPath, APKMetaData deviceApkMetadata,
-                                       android::base::borrowed_fd output) {
-    return CreatePatch(PatchUtils::GetHostAPKMetaData(localApkPath), std::move(deviceApkMetadata),
-                       output);
-}
-
-bool DeployPatchGenerator::CreatePatch(APKMetaData localApkMetadata, APKMetaData deviceApkMetadata,
-                                       borrowed_fd output) {
-    // Log metadata info.
-    APKMetaDataToLog(deviceApkMetadata);
-    APKMetaDataToLog(localApkMetadata);
-
-    const std::string localApkPath = localApkMetadata.absolute_path();
-    const std::string deviceApkPath = deviceApkMetadata.absolute_path();
-
-    std::vector<SimpleEntry> identicalEntries;
-    uint64_t totalSize =
-            BuildIdenticalEntries(identicalEntries, localApkMetadata, deviceApkMetadata);
-    ReportSavings(identicalEntries, totalSize);
-    GeneratePatch(identicalEntries, localApkPath, deviceApkPath, output);
-
-    return true;
-}
-
-uint64_t DeployPatchGenerator::BuildIdenticalEntries(std::vector<SimpleEntry>& outIdenticalEntries,
-                                                     const APKMetaData& localApkMetadata,
-                                                     const APKMetaData& deviceApkMetadata) {
-    outIdenticalEntries.reserve(
-            std::min(localApkMetadata.entries_size(), deviceApkMetadata.entries_size()));
-
-    using md5Digest = std::pair<uint64_t, uint64_t>;
-    struct md5Hash {
-        size_t operator()(const md5Digest& digest) const {
-            std::hash<uint64_t> hasher;
-            size_t seed = 0;
-            seed ^= hasher(digest.first) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
-            seed ^= hasher(digest.second) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
-            return seed;
-        }
-    };
-    static_assert(sizeof(md5Digest) == MD5_DIGEST_LENGTH);
-    std::unordered_map<md5Digest, std::vector<const APKEntry*>, md5Hash> deviceEntries;
-    for (const auto& deviceEntry : deviceApkMetadata.entries()) {
-        md5Digest md5;
-        memcpy(&md5, deviceEntry.md5().data(), deviceEntry.md5().size());
-
-        deviceEntries[md5].push_back(&deviceEntry);
-    }
-
-    uint64_t totalSize = 0;
-    for (const auto& localEntry : localApkMetadata.entries()) {
-        totalSize += localEntry.datasize();
-
-        md5Digest md5;
-        memcpy(&md5, localEntry.md5().data(), localEntry.md5().size());
-
-        auto deviceEntriesIt = deviceEntries.find(md5);
-        if (deviceEntriesIt == deviceEntries.end()) {
-            continue;
-        }
-
-        for (const auto* deviceEntry : deviceEntriesIt->second) {
-            if (deviceEntry->md5() == localEntry.md5()) {
-                SimpleEntry simpleEntry;
-                simpleEntry.localEntry = &localEntry;
-                simpleEntry.deviceEntry = deviceEntry;
-                APKEntryToLog(localEntry);
-                outIdenticalEntries.push_back(simpleEntry);
-                break;
-            }
-        }
-    }
-    std::sort(outIdenticalEntries.begin(), outIdenticalEntries.end(),
-              [](const SimpleEntry& lhs, const SimpleEntry& rhs) {
-                  return lhs.localEntry->dataoffset() < rhs.localEntry->dataoffset();
-              });
-    return totalSize;
-}
diff --git a/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator.h b/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator.h
deleted file mode 100644
index fd7eaee..0000000
--- a/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <vector>
-
-#include "adb_unique_fd.h"
-#include "fastdeploy/proto/ApkEntry.pb.h"
-
-/**
- * This class is responsible for creating a patch that can be accepted by the deployagent. The
- * patch format is documented in GeneratePatch.
- */
-class DeployPatchGenerator {
-  public:
-    using APKEntry = com::android::fastdeploy::APKEntry;
-    using APKMetaData = com::android::fastdeploy::APKMetaData;
-
-    /**
-     * Simple struct to hold mapping between local metadata and device metadata.
-     */
-    struct SimpleEntry {
-        const APKEntry* localEntry;
-        const APKEntry* deviceEntry;
-    };
-
-    /**
-     * If |is_verbose| is true ApkEntries that are similar between device and host are written to
-     * the console.
-     */
-    explicit DeployPatchGenerator(bool is_verbose) : is_verbose_(is_verbose) {}
-    /**
-     * Given a |localApkPath|, and the |deviceApkMetadata| from an installed APK this function
-     * writes a patch to the given |output|.
-     */
-    bool CreatePatch(const char* localApkPath, APKMetaData deviceApkMetadata,
-                     android::base::borrowed_fd output);
-
-  private:
-    bool is_verbose_;
-
-    /**
-     * Log function only logs data to stdout when |is_verbose_| is true.
-     */
-    void Log(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3)));
-
-    /**
-     * Helper function to log the APKMetaData structure. If |is_verbose_| is false this function
-     * early outs. This function is used for debugging / information.
-     */
-    void APKMetaDataToLog(const APKMetaData& metadata);
-    /**
-     * Helper function to log APKEntry.
-     */
-    void APKEntryToLog(const APKEntry& entry);
-
-    /**
-     * Given the |localApkMetadata| metadata, and the |deviceApkMetadata| from an installed APK this
-     * function writes a patch to the given |output|.
-     */
-    bool CreatePatch(APKMetaData localApkMetadata, APKMetaData deviceApkMetadata,
-                     android::base::borrowed_fd output);
-
-    /**
-     * Helper function to report savings by fastdeploy. This function prints out savings even with
-     * |is_verbose_| set to false. |totalSize| is used to show a percentage of savings. Note:
-     * |totalSize| is the size of the ZipEntries. Not the size of the entire file. The metadata of
-     * the zip data needs to be sent across with every iteration.
-     * [Patch format]
-     * |Fixed String| Signature
-     * |long|         New Size of Apk
-     * |Packets[]|    Array of Packets
-     *
-     * [Packet Format]
-     * |long|     Size of data to use from patch
-     * |byte[]|   Patch data
-     * |long|     Offset of data to use already on device
-     * |long|     Length of data to read from device APK
-     * TODO(b/138306784): Move the patch format to a proto.
-     */
-    void ReportSavings(const std::vector<SimpleEntry>& identicalEntries, uint64_t totalSize);
-
-    /**
-     * This enumerates each entry in |entriesToUseOnDevice| and builds a patch file copying data
-     * from |localApkPath| where we are unable to use entries already on the device. The new patch
-     * is written to |output|. The entries are expected to be sorted by data offset from lowest to
-     * highest.
-     */
-    void GeneratePatch(const std::vector<SimpleEntry>& entriesToUseOnDevice,
-                       const std::string& localApkPath, const std::string& deviceApkPath,
-                       android::base::borrowed_fd output);
-
-  protected:
-    uint64_t BuildIdenticalEntries(std::vector<SimpleEntry>& outIdenticalEntries,
-                                   const APKMetaData& localApkMetadata,
-                                   const APKMetaData& deviceApkMetadata);
-};
diff --git a/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp b/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp
deleted file mode 100644
index e4c96ea..0000000
--- a/adb/fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "deploy_patch_generator.h"
-#include "apk_archive.h"
-#include "patch_utils.h"
-
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-#include <stdlib.h>
-#include <string.h>
-#include <string>
-
-#include "sysdeps.h"
-
-using namespace com::android::fastdeploy;
-
-static std::string GetTestFile(const std::string& name) {
-    return "fastdeploy/testdata/" + name;
-}
-
-struct TestPatchGenerator : DeployPatchGenerator {
-    using DeployPatchGenerator::BuildIdenticalEntries;
-    using DeployPatchGenerator::DeployPatchGenerator;
-};
-
-TEST(DeployPatchGeneratorTest, IdenticalFileEntries) {
-    std::string apkPath = GetTestFile("rotating_cube-release.apk");
-    APKMetaData metadataA = PatchUtils::GetHostAPKMetaData(apkPath.c_str());
-    TestPatchGenerator generator(false);
-    std::vector<DeployPatchGenerator::SimpleEntry> entries;
-    generator.BuildIdenticalEntries(entries, metadataA, metadataA);
-    // Expect the entry count to match the number of entries in the metadata.
-    const uint32_t identicalCount = entries.size();
-    const uint32_t entriesCount = metadataA.entries_size();
-    EXPECT_EQ(identicalCount, entriesCount);
-}
-
-TEST(DeployPatchGeneratorTest, NoDeviceMetadata) {
-    std::string apkPath = GetTestFile("rotating_cube-release.apk");
-    // Get size of our test apk.
-    long apkSize = 0;
-    {
-        unique_fd apkFile(adb_open(apkPath.c_str(), O_RDWR));
-        apkSize = adb_lseek(apkFile, 0L, SEEK_END);
-    }
-
-    // Create a patch that is 100% different.
-    TemporaryFile output;
-    DeployPatchGenerator generator(true);
-    generator.CreatePatch(apkPath.c_str(), {}, output.fd);
-
-    // Expect a patch file that has a size at least the size of our initial APK.
-    long patchSize = adb_lseek(output.fd, 0L, SEEK_END);
-    EXPECT_GT(patchSize, apkSize);
-}
-
-TEST(DeployPatchGeneratorTest, ZeroSizePatch) {
-    std::string apkPath = GetTestFile("rotating_cube-release.apk");
-    ApkArchive archive(apkPath);
-    auto dump = archive.ExtractMetadata();
-    EXPECT_NE(dump.cd().size(), 0u);
-
-    APKMetaData metadata = PatchUtils::GetDeviceAPKMetaData(dump);
-
-    // Create a patch that is 100% the same.
-    TemporaryFile output;
-    output.DoNotRemove();
-    DeployPatchGenerator generator(true);
-    generator.CreatePatch(apkPath.c_str(), metadata, output.fd);
-
-    // Expect a patch file that is smaller than 0.5K.
-    int64_t patchSize = adb_lseek(output.fd, 0L, SEEK_END);
-    EXPECT_LE(patchSize, 512);
-}
diff --git a/adb/fastdeploy/deploypatchgenerator/patch_utils.cpp b/adb/fastdeploy/deploypatchgenerator/patch_utils.cpp
deleted file mode 100644
index 2b00c80..0000000
--- a/adb/fastdeploy/deploypatchgenerator/patch_utils.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "patch_utils.h"
-
-#include <stdio.h>
-
-#include "adb_io.h"
-#include "adb_utils.h"
-#include "android-base/endian.h"
-#include "sysdeps.h"
-
-#include "apk_archive.h"
-
-using namespace com::android;
-using namespace com::android::fastdeploy;
-using namespace android::base;
-
-static constexpr char kSignature[] = "FASTDEPLOY";
-
-APKMetaData PatchUtils::GetDeviceAPKMetaData(const APKDump& apk_dump) {
-    APKMetaData apkMetaData;
-    apkMetaData.set_absolute_path(apk_dump.absolute_path());
-
-    std::string md5Hash;
-    int64_t localFileHeaderOffset;
-    int64_t dataSize;
-
-    const auto& cd = apk_dump.cd();
-    auto cur = cd.data();
-    int64_t size = cd.size();
-    while (auto consumed = ApkArchive::ParseCentralDirectoryRecord(
-                   cur, size, &md5Hash, &localFileHeaderOffset, &dataSize)) {
-        cur += consumed;
-        size -= consumed;
-
-        auto apkEntry = apkMetaData.add_entries();
-        apkEntry->set_md5(md5Hash);
-        apkEntry->set_dataoffset(localFileHeaderOffset);
-        apkEntry->set_datasize(dataSize);
-    }
-    return apkMetaData;
-}
-
-APKMetaData PatchUtils::GetHostAPKMetaData(const char* apkPath) {
-    ApkArchive archive(apkPath);
-    auto dump = archive.ExtractMetadata();
-    if (dump.cd().empty()) {
-        fprintf(stderr, "adb: Could not extract Central Directory from %s\n", apkPath);
-        error_exit("Aborting");
-    }
-
-    auto apkMetaData = GetDeviceAPKMetaData(dump);
-
-    // Now let's set data sizes.
-    for (auto& apkEntry : *apkMetaData.mutable_entries()) {
-        auto dataSize =
-                archive.CalculateLocalFileEntrySize(apkEntry.dataoffset(), apkEntry.datasize());
-        if (dataSize == 0) {
-            error_exit("Aborting");
-        }
-        apkEntry.set_datasize(dataSize);
-    }
-
-    return apkMetaData;
-}
-
-void PatchUtils::WriteSignature(borrowed_fd output) {
-    WriteFdExactly(output, kSignature, sizeof(kSignature) - 1);
-}
-
-void PatchUtils::WriteLong(int64_t value, borrowed_fd output) {
-    int64_t littleEndian = htole64(value);
-    WriteFdExactly(output, &littleEndian, sizeof(littleEndian));
-}
-
-void PatchUtils::WriteString(const std::string& value, android::base::borrowed_fd output) {
-    WriteLong(value.size(), output);
-    WriteFdExactly(output, value);
-}
-
-void PatchUtils::Pipe(borrowed_fd input, borrowed_fd output, size_t amount) {
-    constexpr static size_t BUFFER_SIZE = 128 * 1024;
-    char buffer[BUFFER_SIZE];
-    size_t transferAmount = 0;
-    while (transferAmount != amount) {
-        auto chunkAmount = std::min(amount - transferAmount, BUFFER_SIZE);
-        auto readAmount = adb_read(input, buffer, chunkAmount);
-        if (readAmount < 0) {
-            fprintf(stderr, "adb: failed to read from input: %s\n", strerror(errno));
-            error_exit("Aborting");
-        }
-        WriteFdExactly(output, buffer, readAmount);
-        transferAmount += readAmount;
-    }
-}
diff --git a/adb/fastdeploy/deploypatchgenerator/patch_utils.h b/adb/fastdeploy/deploypatchgenerator/patch_utils.h
deleted file mode 100644
index 8dc9b9c..0000000
--- a/adb/fastdeploy/deploypatchgenerator/patch_utils.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include "adb_unique_fd.h"
-#include "fastdeploy/proto/ApkEntry.pb.h"
-
-/**
- * Helper class that mirrors the PatchUtils from deploy agent.
- */
-class PatchUtils {
-  public:
-    /**
-     * This function takes the dump of Central Directly and builds the APKMetaData required by the
-     * patching algorithm. The if this function has an error a string is printed to the terminal and
-     * exit(1) is called.
-     */
-    static com::android::fastdeploy::APKMetaData GetDeviceAPKMetaData(
-            const com::android::fastdeploy::APKDump& apk_dump);
-    /**
-     * This function takes a local APK file and builds the APKMetaData required by the patching
-     * algorithm. The if this function has an error a string is printed to the terminal and exit(1)
-     * is called.
-     */
-    static com::android::fastdeploy::APKMetaData GetHostAPKMetaData(const char* file);
-    /**
-     * Writes a fixed signature string to the header of the patch.
-     */
-    static void WriteSignature(android::base::borrowed_fd output);
-    /**
-     * Writes an int64 to the |output| reversing the bytes.
-     */
-    static void WriteLong(int64_t value, android::base::borrowed_fd output);
-    /**
-     * Writes string to the |output|.
-     */
-    static void WriteString(const std::string& value, android::base::borrowed_fd output);
-    /**
-     * Copy |amount| of data from |input| to |output|.
-     */
-    static void Pipe(android::base::borrowed_fd input, android::base::borrowed_fd output,
-                     size_t amount);
-};
diff --git a/adb/fastdeploy/deploypatchgenerator/patch_utils_test.cpp b/adb/fastdeploy/deploypatchgenerator/patch_utils_test.cpp
deleted file mode 100644
index 3ec5ab3..0000000
--- a/adb/fastdeploy/deploypatchgenerator/patch_utils_test.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "patch_utils.h"
-
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sstream>
-#include <string>
-
-#include <google/protobuf/util/message_differencer.h>
-
-#include "adb_io.h"
-#include "sysdeps.h"
-
-using namespace com::android::fastdeploy;
-using google::protobuf::util::MessageDifferencer;
-
-static std::string GetTestFile(const std::string& name) {
-    return "fastdeploy/testdata/" + name;
-}
-
-bool FileMatchesContent(android::base::borrowed_fd input, const char* contents,
-                        ssize_t contentsSize) {
-    adb_lseek(input, 0, SEEK_SET);
-    // Use a temp buffer larger than any test contents.
-    constexpr int BUFFER_SIZE = 2048;
-    char buffer[BUFFER_SIZE];
-    bool result = true;
-    // Validate size of files is equal.
-    ssize_t readAmount = adb_read(input, buffer, BUFFER_SIZE);
-    EXPECT_EQ(readAmount, contentsSize);
-    result = memcmp(buffer, contents, readAmount) == 0;
-    for (int i = 0; i < readAmount; i++) {
-        printf("%x", buffer[i]);
-    }
-    printf(" == ");
-    for (int i = 0; i < contentsSize; i++) {
-        printf("%x", contents[i]);
-    }
-    printf("\n");
-
-    return result;
-}
-
-TEST(PatchUtilsTest, SwapLongWrites) {
-    TemporaryFile output;
-    PatchUtils::WriteLong(0x0011223344556677, output.fd);
-    adb_lseek(output.fd, 0, SEEK_SET);
-    const char expected[] = {0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00};
-    EXPECT_TRUE(FileMatchesContent(output.fd, expected, 8));
-}
-
-TEST(PatchUtilsTest, PipeWritesAmountToOutput) {
-    std::string expected("Some Data");
-    TemporaryFile input;
-    TemporaryFile output;
-    // Populate input file.
-    WriteFdExactly(input.fd, expected);
-    adb_lseek(input.fd, 0, SEEK_SET);
-    // Open input file for read, and output file for write.
-    PatchUtils::Pipe(input.fd, output.fd, expected.size());
-    // Validate pipe worked
-    EXPECT_TRUE(FileMatchesContent(output.fd, expected.c_str(), expected.size()));
-}
-
-TEST(PatchUtilsTest, SignatureConstMatches) {
-    std::string apkFile = GetTestFile("rotating_cube-release.apk");
-    TemporaryFile output;
-    PatchUtils::WriteSignature(output.fd);
-    std::string contents("FASTDEPLOY");
-    EXPECT_TRUE(FileMatchesContent(output.fd, contents.c_str(), contents.size()));
-}
-
-TEST(PatchUtilsTest, GatherMetadata) {
-    std::string apkFile = GetTestFile("rotating_cube-release.apk");
-    APKMetaData actual = PatchUtils::GetHostAPKMetaData(apkFile.c_str());
-
-    std::string expectedMetadata;
-    android::base::ReadFileToString(GetTestFile("rotating_cube-metadata-release.data"),
-                                    &expectedMetadata);
-    APKMetaData expected;
-    EXPECT_TRUE(expected.ParseFromString(expectedMetadata));
-
-    // Test paths might vary.
-    expected.set_absolute_path(actual.absolute_path());
-
-    std::string actualMetadata;
-    actual.SerializeToString(&actualMetadata);
-
-    expected.SerializeToString(&expectedMetadata);
-
-    EXPECT_EQ(expectedMetadata, actualMetadata);
-}
-
-static inline void sanitize(APKMetaData& metadata) {
-    metadata.clear_absolute_path();
-    for (auto&& entry : *metadata.mutable_entries()) {
-        entry.clear_datasize();
-    }
-}
-
-TEST(PatchUtilsTest, GatherDumpMetadata) {
-    APKMetaData hostMetadata;
-    APKMetaData deviceMetadata;
-
-    hostMetadata = PatchUtils::GetHostAPKMetaData(GetTestFile("sample.apk").c_str());
-
-    {
-        std::string cd;
-        android::base::ReadFileToString(GetTestFile("sample.cd"), &cd);
-
-        APKDump dump;
-        dump.set_cd(std::move(cd));
-
-        deviceMetadata = PatchUtils::GetDeviceAPKMetaData(dump);
-    }
-
-    sanitize(hostMetadata);
-    sanitize(deviceMetadata);
-
-    std::string expectedMetadata;
-    hostMetadata.SerializeToString(&expectedMetadata);
-
-    std::string actualMetadata;
-    deviceMetadata.SerializeToString(&actualMetadata);
-
-    EXPECT_EQ(expectedMetadata, actualMetadata);
-}
diff --git a/adb/fastdeploy/proto/ApkEntry.proto b/adb/fastdeploy/proto/ApkEntry.proto
deleted file mode 100644
index d84c5a5..0000000
--- a/adb/fastdeploy/proto/ApkEntry.proto
+++ /dev/null
@@ -1,26 +0,0 @@
-syntax = "proto3";
-
-package com.android.fastdeploy;
-
-option java_package = "com.android.fastdeploy";
-option java_outer_classname = "ApkEntryProto";
-option java_multiple_files = true;
-option optimize_for = LITE_RUNTIME;
-
-message APKDump {
-    string name = 1;
-    bytes cd = 2;
-    bytes signature = 3;
-    string absolute_path = 4;
-}
-
-message APKEntry {
-    bytes md5 = 1;
-    int64 dataOffset = 2;
-    int64 dataSize = 3;
-}
-
-message APKMetaData {
-    string absolute_path = 1;
-    repeated APKEntry entries = 2;
-}
diff --git a/adb/fastdeploy/testdata/helloworld5.apk b/adb/fastdeploy/testdata/helloworld5.apk
deleted file mode 100644
index 4a1539e..0000000
--- a/adb/fastdeploy/testdata/helloworld5.apk
+++ /dev/null
Binary files differ
diff --git a/adb/fastdeploy/testdata/helloworld7.apk b/adb/fastdeploy/testdata/helloworld7.apk
deleted file mode 100644
index 82c46df..0000000
--- a/adb/fastdeploy/testdata/helloworld7.apk
+++ /dev/null
Binary files differ
diff --git a/adb/fastdeploy/testdata/rotating_cube-metadata-release.data b/adb/fastdeploy/testdata/rotating_cube-metadata-release.data
deleted file mode 100644
index 52352ff..0000000
--- a/adb/fastdeploy/testdata/rotating_cube-metadata-release.data
+++ /dev/null
Binary files differ
diff --git a/adb/fastdeploy/testdata/rotating_cube-release.apk b/adb/fastdeploy/testdata/rotating_cube-release.apk
deleted file mode 100644
index d47e0ea..0000000
--- a/adb/fastdeploy/testdata/rotating_cube-release.apk
+++ /dev/null
Binary files differ
diff --git a/adb/fastdeploy/testdata/sample.apk b/adb/fastdeploy/testdata/sample.apk
deleted file mode 100644
index c316205..0000000
--- a/adb/fastdeploy/testdata/sample.apk
+++ /dev/null
Binary files differ
diff --git a/adb/fastdeploy/testdata/sample.cd b/adb/fastdeploy/testdata/sample.cd
deleted file mode 100644
index 5e5b4d4..0000000
--- a/adb/fastdeploy/testdata/sample.cd
+++ /dev/null
Binary files differ
diff --git a/adb/fdevent/fdevent.cpp b/adb/fdevent/fdevent.cpp
deleted file mode 100644
index fd55020..0000000
--- a/adb/fdevent/fdevent.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright 2006, Brian Swetland <swetland@frotz.net>
- *
- * 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.
- */
-
-#define TRACE_TAG FDEVENT
-
-#include "sysdeps.h"
-
-#include <inttypes.h>
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <android-base/threads.h>
-
-#include "adb_utils.h"
-#include "fdevent.h"
-#include "fdevent_epoll.h"
-#include "fdevent_poll.h"
-
-using namespace std::chrono_literals;
-using std::chrono::duration_cast;
-
-void invoke_fde(struct fdevent* fde, unsigned events) {
-    if (auto f = std::get_if<fd_func>(&fde->func)) {
-        (*f)(fde->fd.get(), events, fde->arg);
-    } else if (auto f = std::get_if<fd_func2>(&fde->func)) {
-        (*f)(fde, events, fde->arg);
-    } else {
-        __builtin_unreachable();
-    }
-}
-
-std::string dump_fde(const fdevent* fde) {
-    std::string state;
-    if (fde->state & FDE_READ) {
-        state += "R";
-    }
-    if (fde->state & FDE_WRITE) {
-        state += "W";
-    }
-    if (fde->state & FDE_ERROR) {
-        state += "E";
-    }
-    return android::base::StringPrintf("(fdevent %" PRIu64 ": fd %d %s)", fde->id, fde->fd.get(),
-                                       state.c_str());
-}
-
-fdevent* fdevent_context::Create(unique_fd fd, std::variant<fd_func, fd_func2> func, void* arg) {
-    CheckMainThread();
-    CHECK_GE(fd.get(), 0);
-
-    int fd_num = fd.get();
-
-    auto [it, inserted] = this->installed_fdevents_.emplace(fd_num, fdevent{});
-    CHECK(inserted);
-
-    fdevent* fde = &it->second;
-    fde->id = fdevent_id_++;
-    fde->state = 0;
-    fde->fd = std::move(fd);
-    fde->func = func;
-    fde->arg = arg;
-    if (!set_file_block_mode(fde->fd, false)) {
-        // Here is not proper to handle the error. If it fails here, some error is
-        // likely to be detected by poll(), then we can let the callback function
-        // to handle it.
-        LOG(ERROR) << "failed to set non-blocking mode for fd " << fde->fd.get();
-    }
-
-    this->Register(fde);
-    return fde;
-}
-
-unique_fd fdevent_context::Destroy(fdevent* fde) {
-    CheckMainThread();
-    if (!fde) {
-        return {};
-    }
-
-    this->Unregister(fde);
-
-    unique_fd fd = std::move(fde->fd);
-
-    auto erased = this->installed_fdevents_.erase(fd.get());
-    CHECK_EQ(1UL, erased);
-
-    return fd;
-}
-
-void fdevent_context::Add(fdevent* fde, unsigned events) {
-    CHECK(!(events & FDE_TIMEOUT));
-    Set(fde, fde->state | events);
-}
-
-void fdevent_context::Del(fdevent* fde, unsigned events) {
-    CHECK(!(events & FDE_TIMEOUT));
-    Set(fde, fde->state & ~events);
-}
-
-void fdevent_context::SetTimeout(fdevent* fde, std::optional<std::chrono::milliseconds> timeout) {
-    CheckMainThread();
-    fde->timeout = timeout;
-    fde->last_active = std::chrono::steady_clock::now();
-}
-
-std::optional<std::chrono::milliseconds> fdevent_context::CalculatePollDuration() {
-    std::optional<std::chrono::milliseconds> result = std::nullopt;
-    auto now = std::chrono::steady_clock::now();
-    CheckMainThread();
-
-    for (const auto& [fd, fde] : this->installed_fdevents_) {
-        UNUSED(fd);
-        auto timeout_opt = fde.timeout;
-        if (timeout_opt) {
-            auto deadline = fde.last_active + *timeout_opt;
-            auto time_left = duration_cast<std::chrono::milliseconds>(deadline - now);
-            if (time_left < 0ms) {
-                time_left = 0ms;
-            }
-
-            if (!result) {
-                result = time_left;
-            } else {
-                result = std::min(*result, time_left);
-            }
-        }
-    }
-
-    return result;
-}
-
-void fdevent_context::HandleEvents(const std::vector<fdevent_event>& events) {
-    for (const auto& event : events) {
-        invoke_fde(event.fde, event.events);
-    }
-    FlushRunQueue();
-}
-
-void fdevent_context::FlushRunQueue() {
-    // We need to be careful around reentrancy here, since a function we call can queue up another
-    // function.
-    while (true) {
-        std::function<void()> fn;
-        {
-            std::lock_guard<std::mutex> lock(this->run_queue_mutex_);
-            if (this->run_queue_.empty()) {
-                break;
-            }
-            fn = std::move(this->run_queue_.front());
-            this->run_queue_.pop_front();
-        }
-        fn();
-    }
-}
-
-void fdevent_context::CheckMainThread() {
-    if (main_thread_id_) {
-        CHECK_EQ(*main_thread_id_, android::base::GetThreadId());
-    }
-}
-
-void fdevent_context::Run(std::function<void()> fn) {
-    {
-        std::lock_guard<std::mutex> lock(run_queue_mutex_);
-        run_queue_.push_back(std::move(fn));
-    }
-
-    Interrupt();
-}
-
-void fdevent_context::TerminateLoop() {
-    terminate_loop_ = true;
-    Interrupt();
-}
-
-static std::unique_ptr<fdevent_context> fdevent_create_context() {
-#if defined(__linux__)
-    return std::make_unique<fdevent_context_epoll>();
-#else
-    return std::make_unique<fdevent_context_poll>();
-#endif
-}
-
-static auto& g_ambient_fdevent_context() {
-    static auto context = fdevent_create_context().release();
-    return context;
-}
-
-static fdevent_context* fdevent_get_ambient() {
-    return g_ambient_fdevent_context();
-}
-
-fdevent* fdevent_create(int fd, fd_func func, void* arg) {
-    unique_fd ufd(fd);
-    return fdevent_get_ambient()->Create(std::move(ufd), func, arg);
-}
-
-fdevent* fdevent_create(int fd, fd_func2 func, void* arg) {
-    unique_fd ufd(fd);
-    return fdevent_get_ambient()->Create(std::move(ufd), func, arg);
-}
-
-unique_fd fdevent_release(fdevent* fde) {
-    return fdevent_get_ambient()->Destroy(fde);
-}
-
-void fdevent_destroy(fdevent* fde) {
-    fdevent_get_ambient()->Destroy(fde);
-}
-
-void fdevent_set(fdevent* fde, unsigned events) {
-    fdevent_get_ambient()->Set(fde, events);
-}
-
-void fdevent_add(fdevent* fde, unsigned events) {
-    fdevent_get_ambient()->Add(fde, events);
-}
-
-void fdevent_del(fdevent* fde, unsigned events) {
-    fdevent_get_ambient()->Del(fde, events);
-}
-
-void fdevent_set_timeout(fdevent* fde, std::optional<std::chrono::milliseconds> timeout) {
-    fdevent_get_ambient()->SetTimeout(fde, timeout);
-}
-
-void fdevent_run_on_main_thread(std::function<void()> fn) {
-    fdevent_get_ambient()->Run(std::move(fn));
-}
-
-void fdevent_loop() {
-    fdevent_get_ambient()->Loop();
-}
-
-void check_main_thread() {
-    fdevent_get_ambient()->CheckMainThread();
-}
-
-void fdevent_terminate_loop() {
-    fdevent_get_ambient()->TerminateLoop();
-}
-
-size_t fdevent_installed_count() {
-    return fdevent_get_ambient()->InstalledCount();
-}
-
-void fdevent_reset() {
-    auto old = std::exchange(g_ambient_fdevent_context(), fdevent_create_context().release());
-    delete old;
-}
diff --git a/adb/fdevent/fdevent.h b/adb/fdevent/fdevent.h
deleted file mode 100644
index 9fc3b2c..0000000
--- a/adb/fdevent/fdevent.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef __FDEVENT_H
-#define __FDEVENT_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <atomic>
-#include <chrono>
-#include <deque>
-#include <functional>
-#include <mutex>
-#include <optional>
-#include <unordered_map>
-#include <variant>
-
-#include <android-base/thread_annotations.h>
-
-#include "adb_unique_fd.h"
-
-// Events that may be observed
-#define FDE_READ 0x0001
-#define FDE_WRITE 0x0002
-#define FDE_ERROR 0x0004
-#define FDE_TIMEOUT 0x0008
-
-struct fdevent;
-
-typedef void (*fd_func)(int fd, unsigned events, void *userdata);
-typedef void (*fd_func2)(struct fdevent* fde, unsigned events, void* userdata);
-
-void invoke_fde(struct fdevent* fde, unsigned events);
-std::string dump_fde(const fdevent* fde);
-
-struct fdevent_event {
-    fdevent* fde;
-    unsigned events;
-};
-
-struct fdevent final {
-    uint64_t id;
-
-    unique_fd fd;
-    int force_eof = 0;
-
-    uint16_t state = 0;
-    std::optional<std::chrono::milliseconds> timeout;
-    std::chrono::steady_clock::time_point last_active;
-
-    std::variant<fd_func, fd_func2> func;
-    void* arg = nullptr;
-};
-
-struct fdevent_context {
-  public:
-    virtual ~fdevent_context() = default;
-
-    // Allocate and initialize a new fdevent object.
-    fdevent* Create(unique_fd fd, std::variant<fd_func, fd_func2> func, void* arg);
-
-    // Deallocate an fdevent object, returning the file descriptor that was owned by it.
-    // Note that this calls Set, which is a virtual method, so destructors that call this must be
-    // final.
-    unique_fd Destroy(fdevent* fde);
-
-  protected:
-    virtual void Register(fdevent*) {}
-    virtual void Unregister(fdevent*) {}
-
-  public:
-    // Change which events should cause notifications.
-    virtual void Set(fdevent* fde, unsigned events) = 0;
-    void Add(fdevent* fde, unsigned events);
-    void Del(fdevent* fde, unsigned events);
-
-    // Set a timeout on an fdevent.
-    // If no events are triggered by the timeout, an FDE_TIMEOUT will be generated.
-    // Note timeouts are not defused automatically; if a timeout is set on an fdevent, it will
-    // trigger repeatedly every |timeout| ms.
-    void SetTimeout(fdevent* fde, std::optional<std::chrono::milliseconds> timeout);
-
-  protected:
-    std::optional<std::chrono::milliseconds> CalculatePollDuration();
-    void HandleEvents(const std::vector<fdevent_event>& events);
-
-  private:
-    // Run all pending functions enqueued via Run().
-    void FlushRunQueue() EXCLUDES(run_queue_mutex_);
-
-  public:
-    // Loop until TerminateLoop is called, handling events.
-    // Implementations should call FlushRunQueue on every iteration, and check the value of
-    // terminate_loop_ to determine whether to stop.
-    virtual void Loop() = 0;
-
-    // Assert that the caller is either running on the context's main thread, or that there is no
-    // active main thread.
-    void CheckMainThread();
-
-    // Queue an operation to be run on the main thread.
-    void Run(std::function<void()> fn);
-
-    // Test-only functionality:
-    void TerminateLoop();
-    virtual size_t InstalledCount() = 0;
-
-  protected:
-    // Interrupt the run loop.
-    virtual void Interrupt() = 0;
-
-    std::optional<uint64_t> main_thread_id_ = std::nullopt;
-    std::atomic<bool> terminate_loop_ = false;
-
-  protected:
-    std::unordered_map<int, fdevent> installed_fdevents_;
-
-  private:
-    uint64_t fdevent_id_ = 0;
-    std::mutex run_queue_mutex_;
-    std::deque<std::function<void()>> run_queue_ GUARDED_BY(run_queue_mutex_);
-};
-
-// Backwards compatibility shims that forward to the global fdevent_context.
-fdevent* fdevent_create(int fd, fd_func func, void* arg);
-fdevent* fdevent_create(int fd, fd_func2 func, void* arg);
-
-unique_fd fdevent_release(fdevent* fde);
-void fdevent_destroy(fdevent* fde);
-
-void fdevent_set(fdevent *fde, unsigned events);
-void fdevent_add(fdevent *fde, unsigned events);
-void fdevent_del(fdevent *fde, unsigned events);
-void fdevent_set_timeout(fdevent* fde, std::optional<std::chrono::milliseconds> timeout);
-void fdevent_loop();
-void check_main_thread();
-
-// Queue an operation to run on the main thread.
-void fdevent_run_on_main_thread(std::function<void()> fn);
-
-// The following functions are used only for tests.
-void fdevent_terminate_loop();
-size_t fdevent_installed_count();
-void fdevent_reset();
-
-#endif
diff --git a/adb/fdevent/fdevent_epoll.cpp b/adb/fdevent/fdevent_epoll.cpp
deleted file mode 100644
index 4ef41d1..0000000
--- a/adb/fdevent/fdevent_epoll.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "fdevent_epoll.h"
-
-#if defined(__linux__)
-
-#include <sys/epoll.h>
-#include <sys/eventfd.h>
-
-#include <android-base/logging.h>
-#include <android-base/threads.h>
-
-#include "adb_unique_fd.h"
-#include "fdevent.h"
-
-static void fdevent_interrupt(int fd, unsigned, void*) {
-    uint64_t buf;
-    ssize_t rc = TEMP_FAILURE_RETRY(adb_read(fd, &buf, sizeof(buf)));
-    if (rc == -1) {
-        PLOG(FATAL) << "failed to read from fdevent interrupt fd";
-    }
-}
-
-fdevent_context_epoll::fdevent_context_epoll() {
-    epoll_fd_.reset(epoll_create1(EPOLL_CLOEXEC));
-
-    unique_fd interrupt_fd(eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK));
-    if (interrupt_fd == -1) {
-        PLOG(FATAL) << "failed to create fdevent interrupt eventfd";
-    }
-
-    unique_fd interrupt_fd_dup(fcntl(interrupt_fd.get(), F_DUPFD_CLOEXEC, 3));
-    if (interrupt_fd_dup == -1) {
-        PLOG(FATAL) << "failed to dup fdevent interrupt eventfd";
-    }
-
-    this->interrupt_fd_ = std::move(interrupt_fd_dup);
-    fdevent* fde = this->Create(std::move(interrupt_fd), fdevent_interrupt, nullptr);
-    CHECK(fde != nullptr);
-    this->Add(fde, FDE_READ);
-}
-
-fdevent_context_epoll::~fdevent_context_epoll() {
-    // Destroy calls virtual methods, but this class is final, so that's okay.
-    this->Destroy(this->interrupt_fde_);
-}
-
-static epoll_event calculate_epoll_event(fdevent* fde) {
-    epoll_event result;
-    result.events = 0;
-    if (fde->state & FDE_READ) {
-        result.events |= EPOLLIN;
-    }
-    if (fde->state & FDE_WRITE) {
-        result.events |= EPOLLOUT;
-    }
-    if (fde->state & FDE_ERROR) {
-        result.events |= EPOLLERR;
-    }
-    result.events |= EPOLLRDHUP;
-    result.data.ptr = fde;
-    return result;
-}
-
-void fdevent_context_epoll::Register(fdevent* fde) {
-    epoll_event ev = calculate_epoll_event(fde);
-    if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, fde->fd.get(), &ev) != 0) {
-        PLOG(FATAL) << "failed to register fd " << fde->fd.get() << " with epoll";
-    }
-}
-
-void fdevent_context_epoll::Unregister(fdevent* fde) {
-    if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_DEL, fde->fd.get(), nullptr) != 0) {
-        PLOG(FATAL) << "failed to unregister fd " << fde->fd.get() << " with epoll";
-    }
-}
-
-void fdevent_context_epoll::Set(fdevent* fde, unsigned events) {
-    unsigned previous_state = fde->state;
-    fde->state = events;
-
-    // If the state is the same, or only differed by FDE_TIMEOUT, we don't need to modify epoll.
-    if ((previous_state & ~FDE_TIMEOUT) == (events & ~FDE_TIMEOUT)) {
-        return;
-    }
-
-    epoll_event ev = calculate_epoll_event(fde);
-    if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_MOD, fde->fd.get(), &ev) != 0) {
-        PLOG(FATAL) << "failed to modify fd " << fde->fd.get() << " with epoll";
-    }
-}
-
-void fdevent_context_epoll::Loop() {
-    main_thread_id_ = android::base::GetThreadId();
-
-    std::vector<fdevent_event> fde_events;
-    std::vector<epoll_event> epoll_events;
-    epoll_events.resize(this->installed_fdevents_.size());
-
-    while (true) {
-        if (terminate_loop_) {
-            break;
-        }
-
-        int rc = -1;
-        while (rc == -1) {
-            std::optional<std::chrono::milliseconds> timeout = CalculatePollDuration();
-            int timeout_ms;
-            if (!timeout) {
-                timeout_ms = -1;
-            } else {
-                timeout_ms = timeout->count();
-            }
-
-            rc = epoll_wait(epoll_fd_.get(), epoll_events.data(), epoll_events.size(), timeout_ms);
-            if (rc == -1 && errno != EINTR) {
-                PLOG(FATAL) << "epoll_wait failed";
-            }
-        }
-
-        auto post_poll = std::chrono::steady_clock::now();
-        std::unordered_map<fdevent*, unsigned> event_map;
-        for (int i = 0; i < rc; ++i) {
-            fdevent* fde = static_cast<fdevent*>(epoll_events[i].data.ptr);
-
-            unsigned events = 0;
-            if (epoll_events[i].events & EPOLLIN) {
-                CHECK(fde->state & FDE_READ);
-                events |= FDE_READ;
-            }
-            if (epoll_events[i].events & EPOLLOUT) {
-                CHECK(fde->state & FDE_WRITE);
-                events |= FDE_WRITE;
-            }
-            if (epoll_events[i].events & (EPOLLERR | EPOLLHUP | EPOLLRDHUP)) {
-                // We fake a read, as the rest of the code assumes that errors will
-                // be detected at that point.
-                events |= FDE_READ | FDE_ERROR;
-            }
-
-            event_map[fde] = events;
-        }
-
-        for (auto& [fd, fde] : installed_fdevents_) {
-            unsigned events = 0;
-            if (auto it = event_map.find(&fde); it != event_map.end()) {
-                events = it->second;
-            }
-
-            if (events == 0) {
-                if (fde.timeout) {
-                    auto deadline = fde.last_active + *fde.timeout;
-                    if (deadline < post_poll) {
-                        events |= FDE_TIMEOUT;
-                    }
-                }
-            }
-
-            if (events != 0) {
-                LOG(DEBUG) << dump_fde(&fde) << " got events " << std::hex << std::showbase
-                           << events;
-                fde_events.push_back({&fde, events});
-                fde.last_active = post_poll;
-            }
-        }
-        this->HandleEvents(fde_events);
-        fde_events.clear();
-    }
-
-    main_thread_id_.reset();
-}
-
-size_t fdevent_context_epoll::InstalledCount() {
-    // We always have an installed fde for interrupt.
-    return this->installed_fdevents_.size() - 1;
-}
-
-void fdevent_context_epoll::Interrupt() {
-    uint64_t i = 1;
-    ssize_t rc = TEMP_FAILURE_RETRY(adb_write(this->interrupt_fd_, &i, sizeof(i)));
-    if (rc != sizeof(i)) {
-        PLOG(FATAL) << "failed to write to fdevent interrupt eventfd";
-    }
-}
-
-#endif  // defined(__linux__)
diff --git a/adb/fdevent/fdevent_epoll.h b/adb/fdevent/fdevent_epoll.h
deleted file mode 100644
index 6214d2e..0000000
--- a/adb/fdevent/fdevent_epoll.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2019 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.
- */
-
-#if defined(__linux__)
-
-#include "sysdeps.h"
-
-#include <sys/epoll.h>
-
-#include <deque>
-#include <list>
-#include <mutex>
-#include <unordered_map>
-
-#include <android-base/thread_annotations.h>
-
-#include "adb_unique_fd.h"
-#include "fdevent.h"
-
-struct fdevent_context_epoll final : public fdevent_context {
-    fdevent_context_epoll();
-    virtual ~fdevent_context_epoll();
-
-    virtual void Register(fdevent* fde) final;
-    virtual void Unregister(fdevent* fde) final;
-
-    virtual void Set(fdevent* fde, unsigned events) final;
-
-    virtual void Loop() final;
-    size_t InstalledCount() final;
-
-  protected:
-    virtual void Interrupt() final;
-
-  private:
-    unique_fd epoll_fd_;
-    unique_fd interrupt_fd_;
-    fdevent* interrupt_fde_ = nullptr;
-};
-
-#endif  // defined(__linux__)
diff --git a/adb/fdevent/fdevent_poll.cpp b/adb/fdevent/fdevent_poll.cpp
deleted file mode 100644
index ac86c08..0000000
--- a/adb/fdevent/fdevent_poll.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#define TRACE_TAG FDEVENT
-
-#include "sysdeps.h"
-#include "fdevent_poll.h"
-
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <atomic>
-#include <deque>
-#include <functional>
-#include <list>
-#include <mutex>
-#include <optional>
-#include <unordered_map>
-#include <utility>
-#include <variant>
-#include <vector>
-
-#include <android-base/chrono_utils.h>
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <android-base/threads.h>
-
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "fdevent.h"
-#include "sysdeps/chrono.h"
-
-static void fdevent_interrupt(int fd, unsigned, void*) {
-    char buf[BUFSIZ];
-    ssize_t rc = TEMP_FAILURE_RETRY(adb_read(fd, buf, sizeof(buf)));
-    if (rc == -1) {
-        PLOG(FATAL) << "failed to read from fdevent interrupt fd";
-    }
-}
-
-fdevent_context_poll::fdevent_context_poll() {
-    int s[2];
-    if (adb_socketpair(s) != 0) {
-        PLOG(FATAL) << "failed to create fdevent interrupt socketpair";
-    }
-
-    if (!set_file_block_mode(s[0], false) || !set_file_block_mode(s[1], false)) {
-        PLOG(FATAL) << "failed to make fdevent interrupt socket nonblocking";
-    }
-
-    this->interrupt_fd_.reset(s[0]);
-    fdevent* fde = this->Create(unique_fd(s[1]), fdevent_interrupt, nullptr);
-    CHECK(fde != nullptr);
-    this->Add(fde, FDE_READ);
-}
-
-fdevent_context_poll::~fdevent_context_poll() {
-    // Destroy calls virtual methods, but this class is final, so that's okay.
-    this->Destroy(this->interrupt_fde_);
-}
-
-void fdevent_context_poll::Set(fdevent* fde, unsigned events) {
-    CheckMainThread();
-    fde->state = events;
-    D("fdevent_set: %s, events = %u", dump_fde(fde).c_str(), events);
-}
-
-static std::string dump_pollfds(const std::vector<adb_pollfd>& pollfds) {
-    std::string result;
-    for (const auto& pollfd : pollfds) {
-        std::string op;
-        if (pollfd.events & POLLIN) {
-            op += "R";
-        }
-        if (pollfd.events & POLLOUT) {
-            op += "W";
-        }
-        android::base::StringAppendF(&result, " %d(%s)", pollfd.fd, op.c_str());
-    }
-    return result;
-}
-
-void fdevent_context_poll::Loop() {
-    main_thread_id_ = android::base::GetThreadId();
-
-    std::vector<adb_pollfd> pollfds;
-    std::vector<fdevent_event> poll_events;
-
-    while (true) {
-        if (terminate_loop_) {
-            break;
-        }
-
-        D("--- --- waiting for events");
-        pollfds.clear();
-        for (const auto& [fd, fde] : this->installed_fdevents_) {
-            adb_pollfd pfd;
-            pfd.fd = fd;
-            pfd.events = 0;
-            if (fde.state & FDE_READ) {
-                pfd.events |= POLLIN;
-            }
-            if (fde.state & FDE_WRITE) {
-                pfd.events |= POLLOUT;
-            }
-            if (fde.state & FDE_ERROR) {
-                pfd.events |= POLLERR;
-            }
-#if defined(__linux__)
-            pfd.events |= POLLRDHUP;
-#endif
-            pfd.revents = 0;
-            pollfds.push_back(pfd);
-        }
-        CHECK_GT(pollfds.size(), 0u);
-        D("poll(), pollfds = %s", dump_pollfds(pollfds).c_str());
-
-        std::optional<std::chrono::milliseconds> timeout = CalculatePollDuration();
-        int timeout_ms;
-        if (!timeout) {
-            timeout_ms = -1;
-        } else {
-            timeout_ms = timeout->count();
-        }
-
-        int ret = adb_poll(pollfds.data(), pollfds.size(), timeout_ms);
-        if (ret == -1) {
-            PLOG(ERROR) << "poll(), ret = " << ret;
-            return;
-        }
-
-        auto post_poll = std::chrono::steady_clock::now();
-
-        for (const auto& pollfd : pollfds) {
-            unsigned events = 0;
-            if (pollfd.revents & POLLIN) {
-                events |= FDE_READ;
-            }
-            if (pollfd.revents & POLLOUT) {
-                events |= FDE_WRITE;
-            }
-            if (pollfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
-                // We fake a read, as the rest of the code assumes that errors will
-                // be detected at that point.
-                events |= FDE_READ | FDE_ERROR;
-            }
-#if defined(__linux__)
-            if (pollfd.revents & POLLRDHUP) {
-                events |= FDE_READ | FDE_ERROR;
-            }
-#endif
-
-            auto it = this->installed_fdevents_.find(pollfd.fd);
-            CHECK(it != this->installed_fdevents_.end());
-            fdevent* fde = &it->second;
-
-            if (events == 0) {
-                if (fde->timeout) {
-                    auto deadline = fde->last_active + *fde->timeout;
-                    if (deadline < post_poll) {
-                        events |= FDE_TIMEOUT;
-                    }
-                }
-            }
-
-            if (events != 0) {
-                D("%s got events %x", dump_fde(fde).c_str(), events);
-                poll_events.push_back({fde, events});
-                fde->last_active = post_poll;
-            }
-        }
-        this->HandleEvents(poll_events);
-        poll_events.clear();
-    }
-
-    main_thread_id_.reset();
-}
-
-size_t fdevent_context_poll::InstalledCount() {
-    // We always have an installed fde for interrupt.
-    return this->installed_fdevents_.size() - 1;
-}
-
-void fdevent_context_poll::Interrupt() {
-    int rc = adb_write(this->interrupt_fd_, "", 1);
-
-    // It's possible that we get EAGAIN here, if lots of notifications came in while handling.
-    if (rc == 0) {
-        PLOG(FATAL) << "fdevent interrupt fd was closed?";
-    } else if (rc == -1 && errno != EAGAIN) {
-        PLOG(FATAL) << "failed to write to fdevent interrupt fd";
-    }
-}
diff --git a/adb/fdevent/fdevent_poll.h b/adb/fdevent/fdevent_poll.h
deleted file mode 100644
index 98abab2..0000000
--- a/adb/fdevent/fdevent_poll.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "sysdeps.h"
-
-#include <deque>
-#include <list>
-#include <mutex>
-#include <unordered_map>
-
-#include <android-base/thread_annotations.h>
-
-#include "adb_unique_fd.h"
-#include "fdevent.h"
-
-struct PollNode {
-  fdevent* fde;
-  adb_pollfd pollfd;
-
-  explicit PollNode(fdevent* fde) : fde(fde) {
-      memset(&pollfd, 0, sizeof(pollfd));
-      pollfd.fd = fde->fd.get();
-
-#if defined(__linux__)
-      // Always enable POLLRDHUP, so the host server can take action when some clients disconnect.
-      // Then we can avoid leaving many sockets in CLOSE_WAIT state. See http://b/23314034.
-      pollfd.events = POLLRDHUP;
-#endif
-  }
-};
-
-struct fdevent_context_poll final : public fdevent_context {
-    fdevent_context_poll();
-    virtual ~fdevent_context_poll();
-
-    virtual void Set(fdevent* fde, unsigned events) final;
-
-    virtual void Loop() final;
-
-    virtual size_t InstalledCount() final;
-
-  protected:
-    virtual void Interrupt() final;
-
-  public:
-    unique_fd interrupt_fd_;
-    fdevent* interrupt_fde_ = nullptr;
-};
diff --git a/adb/fdevent/fdevent_test.cpp b/adb/fdevent/fdevent_test.cpp
deleted file mode 100644
index e06b3b3..0000000
--- a/adb/fdevent/fdevent_test.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "fdevent.h"
-
-#include <gtest/gtest.h>
-
-#include <chrono>
-#include <limits>
-#include <memory>
-#include <queue>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include "adb_io.h"
-#include "fdevent_test.h"
-
-using namespace std::chrono_literals;
-
-class FdHandler {
-  public:
-    FdHandler(int read_fd, int write_fd, bool use_new_callback)
-        : read_fd_(read_fd), write_fd_(write_fd) {
-        if (use_new_callback) {
-            read_fde_ = fdevent_create(read_fd_, FdEventNewCallback, this);
-            write_fde_ = fdevent_create(write_fd_, FdEventNewCallback, this);
-        } else {
-            read_fde_ = fdevent_create(read_fd_, FdEventCallback, this);
-            write_fde_ = fdevent_create(write_fd_, FdEventCallback, this);
-        }
-        fdevent_add(read_fde_, FDE_READ);
-    }
-
-    ~FdHandler() {
-        fdevent_destroy(read_fde_);
-        fdevent_destroy(write_fde_);
-    }
-
-  private:
-    static void FdEventCallback(int fd, unsigned events, void* userdata) {
-        FdHandler* handler = reinterpret_cast<FdHandler*>(userdata);
-        ASSERT_EQ(0u, (events & ~(FDE_READ | FDE_WRITE))) << "unexpected events: " << events;
-        if (events & FDE_READ) {
-            ASSERT_EQ(fd, handler->read_fd_);
-            char c;
-            ASSERT_EQ(1, adb_read(fd, &c, 1));
-            handler->queue_.push(c);
-            fdevent_add(handler->write_fde_, FDE_WRITE);
-        }
-        if (events & FDE_WRITE) {
-            ASSERT_EQ(fd, handler->write_fd_);
-            ASSERT_FALSE(handler->queue_.empty());
-            char c = handler->queue_.front();
-            handler->queue_.pop();
-            ASSERT_EQ(1, adb_write(fd, &c, 1));
-            if (handler->queue_.empty()) {
-                fdevent_del(handler->write_fde_, FDE_WRITE);
-            }
-        }
-    }
-
-    static void FdEventNewCallback(fdevent* fde, unsigned events, void* userdata) {
-        int fd = fde->fd.get();
-        FdHandler* handler = reinterpret_cast<FdHandler*>(userdata);
-        ASSERT_EQ(0u, (events & ~(FDE_READ | FDE_WRITE))) << "unexpected events: " << events;
-        if (events & FDE_READ) {
-            ASSERT_EQ(fd, handler->read_fd_);
-            char c;
-            ASSERT_EQ(1, adb_read(fd, &c, 1));
-            handler->queue_.push(c);
-            fdevent_add(handler->write_fde_, FDE_WRITE);
-        }
-        if (events & FDE_WRITE) {
-            ASSERT_EQ(fd, handler->write_fd_);
-            ASSERT_FALSE(handler->queue_.empty());
-            char c = handler->queue_.front();
-            handler->queue_.pop();
-            ASSERT_EQ(1, adb_write(fd, &c, 1));
-            if (handler->queue_.empty()) {
-                fdevent_del(handler->write_fde_, FDE_WRITE);
-            }
-        }
-    }
-
-  private:
-    const int read_fd_;
-    const int write_fd_;
-    fdevent* read_fde_;
-    fdevent* write_fde_;
-    std::queue<char> queue_;
-};
-
-struct ThreadArg {
-    int first_read_fd;
-    int last_write_fd;
-    size_t middle_pipe_count;
-};
-
-TEST_F(FdeventTest, fdevent_terminate) {
-    PrepareThread();
-    TerminateThread();
-}
-
-TEST_F(FdeventTest, smoke) {
-    for (bool use_new_callback : {true, false}) {
-        fdevent_reset();
-        const size_t PIPE_COUNT = 512;
-        const size_t MESSAGE_LOOP_COUNT = 10;
-        const std::string MESSAGE = "fdevent_test";
-        int fd_pair1[2];
-        int fd_pair2[2];
-        ASSERT_EQ(0, adb_socketpair(fd_pair1));
-        ASSERT_EQ(0, adb_socketpair(fd_pair2));
-        ThreadArg thread_arg;
-        thread_arg.first_read_fd = fd_pair1[0];
-        thread_arg.last_write_fd = fd_pair2[1];
-        thread_arg.middle_pipe_count = PIPE_COUNT;
-        int writer = fd_pair1[1];
-        int reader = fd_pair2[0];
-
-        PrepareThread();
-
-        std::vector<std::unique_ptr<FdHandler>> fd_handlers;
-        fdevent_run_on_main_thread([&thread_arg, &fd_handlers, use_new_callback]() {
-            std::vector<int> read_fds;
-            std::vector<int> write_fds;
-
-            read_fds.push_back(thread_arg.first_read_fd);
-            for (size_t i = 0; i < thread_arg.middle_pipe_count; ++i) {
-                int fds[2];
-                ASSERT_EQ(0, adb_socketpair(fds));
-                read_fds.push_back(fds[0]);
-                write_fds.push_back(fds[1]);
-            }
-            write_fds.push_back(thread_arg.last_write_fd);
-
-            for (size_t i = 0; i < read_fds.size(); ++i) {
-                fd_handlers.push_back(
-                        std::make_unique<FdHandler>(read_fds[i], write_fds[i], use_new_callback));
-            }
-        });
-        WaitForFdeventLoop();
-
-        for (size_t i = 0; i < MESSAGE_LOOP_COUNT; ++i) {
-            std::string read_buffer = MESSAGE;
-            std::string write_buffer(MESSAGE.size(), 'a');
-            ASSERT_TRUE(WriteFdExactly(writer, read_buffer.c_str(), read_buffer.size()));
-            ASSERT_TRUE(ReadFdExactly(reader, &write_buffer[0], write_buffer.size()));
-            ASSERT_EQ(read_buffer, write_buffer);
-        }
-
-        fdevent_run_on_main_thread([&fd_handlers]() { fd_handlers.clear(); });
-        WaitForFdeventLoop();
-
-        TerminateThread();
-        ASSERT_EQ(0, adb_close(writer));
-        ASSERT_EQ(0, adb_close(reader));
-    }
-}
-
-TEST_F(FdeventTest, run_on_main_thread) {
-    std::vector<int> vec;
-
-    PrepareThread();
-
-    // Block the main thread for a long time while we queue our callbacks.
-    fdevent_run_on_main_thread([]() {
-        check_main_thread();
-        std::this_thread::sleep_for(std::chrono::seconds(1));
-    });
-
-    for (int i = 0; i < 1000000; ++i) {
-        fdevent_run_on_main_thread([i, &vec]() {
-            check_main_thread();
-            vec.push_back(i);
-        });
-    }
-
-    TerminateThread();
-
-    ASSERT_EQ(1000000u, vec.size());
-    for (int i = 0; i < 1000000; ++i) {
-        ASSERT_EQ(i, vec[i]);
-    }
-}
-
-static std::function<void()> make_appender(std::vector<int>* vec, int value) {
-    return [vec, value]() {
-        check_main_thread();
-        if (value == 100) {
-            return;
-        }
-
-        vec->push_back(value);
-        fdevent_run_on_main_thread(make_appender(vec, value + 1));
-    };
-}
-
-TEST_F(FdeventTest, run_on_main_thread_reentrant) {
-    std::vector<int> vec;
-
-    PrepareThread();
-    fdevent_run_on_main_thread(make_appender(&vec, 0));
-    TerminateThread();
-
-    ASSERT_EQ(100u, vec.size());
-    for (int i = 0; i < 100; ++i) {
-        ASSERT_EQ(i, vec[i]);
-    }
-}
-
-TEST_F(FdeventTest, timeout) {
-    fdevent_reset();
-    PrepareThread();
-
-    enum class TimeoutEvent {
-        read,
-        timeout,
-        done,
-    };
-
-    struct TimeoutTest {
-        std::vector<std::pair<TimeoutEvent, std::chrono::steady_clock::time_point>> events;
-        fdevent* fde;
-    };
-    TimeoutTest test;
-
-    int fds[2];
-    ASSERT_EQ(0, adb_socketpair(fds));
-    static constexpr auto delta = 100ms;
-    fdevent_run_on_main_thread([&]() {
-        test.fde = fdevent_create(fds[0], [](fdevent* fde, unsigned events, void* arg) {
-            auto test = static_cast<TimeoutTest*>(arg);
-            auto now = std::chrono::steady_clock::now();
-            CHECK((events & FDE_READ) ^ (events & FDE_TIMEOUT));
-            TimeoutEvent event;
-            if ((events & FDE_READ)) {
-                char buf[2];
-                ssize_t rc = adb_read(fde->fd.get(), buf, sizeof(buf));
-                if (rc == 0) {
-                    event = TimeoutEvent::done;
-                } else if (rc == 1) {
-                    event = TimeoutEvent::read;
-                } else {
-                    abort();
-                }
-            } else if ((events & FDE_TIMEOUT)) {
-                event = TimeoutEvent::timeout;
-            } else {
-                abort();
-            }
-
-            CHECK_EQ(fde, test->fde);
-            test->events.emplace_back(event, now);
-
-            if (event == TimeoutEvent::done) {
-                fdevent_destroy(fde);
-            }
-        }, &test);
-        fdevent_add(test.fde, FDE_READ);
-        fdevent_set_timeout(test.fde, delta);
-    });
-
-    ASSERT_EQ(1, adb_write(fds[1], "", 1));
-
-    // Timeout should happen here
-    std::this_thread::sleep_for(delta);
-
-    // and another.
-    std::this_thread::sleep_for(delta);
-
-    // No timeout should happen here.
-    std::this_thread::sleep_for(delta / 2);
-    adb_close(fds[1]);
-
-    TerminateThread();
-
-    ASSERT_EQ(4ULL, test.events.size());
-    ASSERT_EQ(TimeoutEvent::read, test.events[0].first);
-    ASSERT_EQ(TimeoutEvent::timeout, test.events[1].first);
-    ASSERT_EQ(TimeoutEvent::timeout, test.events[2].first);
-    ASSERT_EQ(TimeoutEvent::done, test.events[3].first);
-
-    std::vector<int> time_deltas;
-    for (size_t i = 0; i < test.events.size() - 1; ++i) {
-        auto before = test.events[i].second;
-        auto after = test.events[i + 1].second;
-        auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(after - before);
-        time_deltas.push_back(diff.count());
-    }
-
-    std::vector<int> expected = {
-        delta.count(),
-        delta.count(),
-        delta.count() / 2,
-    };
-
-    std::vector<int> diff;
-    ASSERT_EQ(time_deltas.size(), expected.size());
-    for (size_t i = 0; i < time_deltas.size(); ++i) {
-        diff.push_back(std::abs(time_deltas[i] - expected[i]));
-    }
-
-    ASSERT_LT(diff[0], delta.count() * 0.5);
-    ASSERT_LT(diff[1], delta.count() * 0.5);
-    ASSERT_LT(diff[2], delta.count() * 0.5);
-}
diff --git a/adb/fdevent/fdevent_test.h b/adb/fdevent/fdevent_test.h
deleted file mode 100644
index ecda4da..0000000
--- a/adb/fdevent/fdevent_test.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "socket.h"
-#include "sysdeps.h"
-#include "sysdeps/chrono.h"
-
-static void WaitForFdeventLoop() {
-    // Sleep for a bit to make sure that network events have propagated.
-    std::this_thread::sleep_for(100ms);
-
-    // fdevent_run_on_main_thread has a guaranteed ordering, and is guaranteed to happen after
-    // socket events, so as soon as our function is called, we know that we've processed all
-    // previous events.
-    std::mutex mutex;
-    std::condition_variable cv;
-    std::unique_lock<std::mutex> lock(mutex);
-    fdevent_run_on_main_thread([&]() {
-        mutex.lock();
-        mutex.unlock();
-        cv.notify_one();
-    });
-    cv.wait(lock);
-}
-
-class FdeventTest : public ::testing::Test {
-  protected:
-    unique_fd dummy;
-
-    ~FdeventTest() {
-        if (thread_.joinable()) {
-            TerminateThread();
-        }
-    }
-
-    static void SetUpTestCase() {
-#if !defined(_WIN32)
-        ASSERT_NE(SIG_ERR, signal(SIGPIPE, SIG_IGN));
-#endif
-    }
-
-    void SetUp() override {
-        fdevent_reset();
-        ASSERT_EQ(0u, fdevent_installed_count());
-    }
-
-    // Register a dummy socket used to wake up the fdevent loop to tell it to die.
-    void PrepareThread() {
-        int dummy_fds[2];
-        if (adb_socketpair(dummy_fds) != 0) {
-            FAIL() << "failed to create socketpair: " << strerror(errno);
-        }
-
-        asocket* dummy_socket = create_local_socket(unique_fd(dummy_fds[1]));
-        if (!dummy_socket) {
-            FAIL() << "failed to create local socket: " << strerror(errno);
-        }
-        dummy_socket->ready(dummy_socket);
-        dummy.reset(dummy_fds[0]);
-
-        thread_ = std::thread([]() { fdevent_loop(); });
-        WaitForFdeventLoop();
-    }
-
-    size_t GetAdditionalLocalSocketCount() {
-        // dummy socket installed in PrepareThread()
-        return 1;
-    }
-
-    void TerminateThread() {
-        fdevent_terminate_loop();
-        ASSERT_TRUE(WriteFdExactly(dummy, "", 1));
-        thread_.join();
-        dummy.reset();
-    }
-
-    std::thread thread_;
-};
diff --git a/adb/file_sync_protocol.h b/adb/file_sync_protocol.h
deleted file mode 100644
index fd9a516..0000000
--- a/adb/file_sync_protocol.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#pragma once
-
-#define MKID(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
-
-#define ID_LSTAT_V1 MKID('S', 'T', 'A', 'T')
-#define ID_STAT_V2 MKID('S', 'T', 'A', '2')
-#define ID_LSTAT_V2 MKID('L', 'S', 'T', '2')
-
-#define ID_LIST_V1 MKID('L', 'I', 'S', 'T')
-#define ID_LIST_V2 MKID('L', 'I', 'S', '2')
-#define ID_DENT_V1 MKID('D', 'E', 'N', 'T')
-#define ID_DENT_V2 MKID('D', 'N', 'T', '2')
-
-#define ID_SEND_V1 MKID('S', 'E', 'N', 'D')
-#define ID_SEND_V2 MKID('S', 'N', 'D', '2')
-#define ID_RECV_V1 MKID('R', 'E', 'C', 'V')
-#define ID_RECV_V2 MKID('R', 'C', 'V', '2')
-#define ID_DONE MKID('D', 'O', 'N', 'E')
-#define ID_DATA MKID('D', 'A', 'T', 'A')
-#define ID_OKAY MKID('O', 'K', 'A', 'Y')
-#define ID_FAIL MKID('F', 'A', 'I', 'L')
-#define ID_QUIT MKID('Q', 'U', 'I', 'T')
-
-struct SyncRequest {
-    uint32_t id;           // ID_STAT, et cetera.
-    uint32_t path_length;  // <= 1024
-    // Followed by 'path_length' bytes of path (not NUL-terminated).
-} __attribute__((packed));
-
-struct __attribute__((packed)) sync_stat_v1 {
-    uint32_t id;
-    uint32_t mode;
-    uint32_t size;
-    uint32_t mtime;
-};
-
-struct __attribute__((packed)) sync_stat_v2 {
-    uint32_t id;
-    uint32_t error;
-    uint64_t dev;
-    uint64_t ino;
-    uint32_t mode;
-    uint32_t nlink;
-    uint32_t uid;
-    uint32_t gid;
-    uint64_t size;
-    int64_t atime;
-    int64_t mtime;
-    int64_t ctime;
-};
-
-struct __attribute__((packed)) sync_dent_v1 {
-    uint32_t id;
-    uint32_t mode;
-    uint32_t size;
-    uint32_t mtime;
-    uint32_t namelen;
-};  // followed by `namelen` bytes of the name.
-
-struct __attribute__((packed)) sync_dent_v2 {
-    uint32_t id;
-    uint32_t error;
-    uint64_t dev;
-    uint64_t ino;
-    uint32_t mode;
-    uint32_t nlink;
-    uint32_t uid;
-    uint32_t gid;
-    uint64_t size;
-    int64_t atime;
-    int64_t mtime;
-    int64_t ctime;
-    uint32_t namelen;
-};  // followed by `namelen` bytes of the name.
-
-enum SyncFlag : uint32_t {
-    kSyncFlagNone = 0,
-    kSyncFlagBrotli = 1,
-};
-
-// send_v1 sent the path in a buffer, followed by a comma and the mode as a string.
-// send_v2 sends just the path in the first request, and then sends another syncmsg (with the
-// same ID!) with details.
-struct __attribute__((packed)) sync_send_v2 {
-    uint32_t id;
-    uint32_t mode;
-    uint32_t flags;
-};
-
-// Likewise, recv_v1 just sent the path without any accompanying data.
-struct __attribute__((packed)) sync_recv_v2 {
-    uint32_t id;
-    uint32_t flags;
-};
-
-struct __attribute__((packed)) sync_data {
-    uint32_t id;
-    uint32_t size;
-};  // followed by `size` bytes of data.
-
-struct __attribute__((packed)) sync_status {
-    uint32_t id;
-    uint32_t msglen;
-};  // followed by `msglen` bytes of error message, if id == ID_FAIL.
-
-union syncmsg {
-    sync_stat_v1 stat_v1;
-    sync_stat_v2 stat_v2;
-    sync_dent_v1 dent_v1;
-    sync_dent_v2 dent_v2;
-    sync_data data;
-    sync_status status;
-    sync_send_v2 send_v2_setup;
-    sync_recv_v2 recv_v2_setup;
-};
-
-#define SYNC_DATA_MAX (64 * 1024)
diff --git a/adb/libs/.clang-format b/adb/libs/.clang-format
deleted file mode 120000
index e545823..0000000
--- a/adb/libs/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../../.clang-format-2
\ No newline at end of file
diff --git a/adb/libs/adbconnection/.clang-format b/adb/libs/adbconnection/.clang-format
deleted file mode 120000
index e545823..0000000
--- a/adb/libs/adbconnection/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../../.clang-format-2
\ No newline at end of file
diff --git a/adb/libs/adbconnection/Android.bp b/adb/libs/adbconnection/Android.bp
deleted file mode 100644
index ce2ab51..0000000
--- a/adb/libs/adbconnection/Android.bp
+++ /dev/null
@@ -1,64 +0,0 @@
-// libadbconnection
-// =========================================================
-// libadbconnection_client/server implement the socket handling for jdwp
-// forwarding and the track-jdwp service.
-cc_library {
-    name: "libadbconnection_server",
-    srcs: ["adbconnection_server.cpp"],
-
-    export_include_dirs: ["include"],
-
-    stl: "libc++_static",
-    shared_libs: ["liblog"],
-    static_libs: ["libbase"],
-
-    defaults: ["adbd_defaults", "host_adbd_supported"],
-
-    // Avoid getting duplicate symbol of android::build::GetBuildNumber().
-    use_version_lib: false,
-
-    recovery_available: true,
-    apex_available: [
-        "com.android.adbd",
-        // TODO(b/151398197) remove the below
-        "//apex_available:platform",
-    ],
-    compile_multilib: "both",
-}
-
-cc_library {
-    name: "libadbconnection_client",
-    srcs: ["adbconnection_client.cpp"],
-
-    export_include_dirs: ["include"],
-
-    stl: "libc++_static",
-    shared_libs: ["liblog"],
-    static_libs: ["libbase"],
-
-    defaults: ["adbd_defaults"],
-    visibility: [
-        "//art:__subpackages__",
-        "//system/core/adb/apex:__subpackages__",
-    ],
-    apex_available: [
-        "com.android.adbd",
-        "test_com.android.adbd",
-    ],
-
-    // libadbconnection_client doesn't need an embedded build number.
-    use_version_lib: false,
-
-    target: {
-        linux: {
-            version_script: "libadbconnection_client.map.txt",
-        },
-    },
-    stubs: {
-        symbol_file: "libadbconnection_client.map.txt",
-        versions: ["1"],
-    },
-
-    host_supported: true,
-    compile_multilib: "both",
-}
diff --git a/adb/libs/adbconnection/adbconnection_client.cpp b/adb/libs/adbconnection/adbconnection_client.cpp
deleted file mode 100644
index ee48abb..0000000
--- a/adb/libs/adbconnection/adbconnection_client.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "adbconnection/client.h"
-
-#include <pwd.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include <memory>
-#include <optional>
-
-#include <android-base/cmsg.h>
-#include <android-base/logging.h>
-#include <android-base/unique_fd.h>
-
-using android::base::unique_fd;
-
-static constexpr char kJdwpControlName[] = "\0jdwp-control";
-
-struct AdbConnectionClientContext {
-  unique_fd control_socket_;
-};
-
-bool SocketPeerIsTrusted(int fd) {
-  ucred cr;
-  socklen_t cr_length = sizeof(cr);
-  if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_length) != 0) {
-    PLOG(ERROR) << "couldn't get socket credentials";
-    return false;
-  }
-
-  passwd* shell = getpwnam("shell");
-  if (cr.uid != 0 && cr.uid != shell->pw_uid) {
-    LOG(ERROR) << "untrusted uid " << cr.uid << " on other end of socket";
-    return false;
-  }
-
-  return true;
-}
-
-AdbConnectionClientContext* adbconnection_client_new(
-    const AdbConnectionClientInfo* const* info_elems, size_t info_count) {
-  auto ctx = std::make_unique<AdbConnectionClientContext>();
-
-  std::optional<uint64_t> pid;
-  std::optional<bool> debuggable;
-
-  for (size_t i = 0; i < info_count; ++i) {
-    auto info = info_elems[i];
-    switch (info->type) {
-      case AdbConnectionClientInfoType::pid:
-        if (pid) {
-          LOG(ERROR) << "multiple pid entries in AdbConnectionClientInfo, ignoring";
-          continue;
-        }
-        pid = info->data.pid;
-        break;
-
-      case AdbConnectionClientInfoType::debuggable:
-        if (debuggable) {
-          LOG(ERROR) << "multiple debuggable entries in AdbConnectionClientInfo, ignoring";
-          continue;
-        }
-        debuggable = info->data.pid;
-        break;
-    }
-  }
-
-  if (!pid) {
-    LOG(ERROR) << "AdbConnectionClientInfo missing required field pid";
-    return nullptr;
-  }
-
-  if (!debuggable) {
-    LOG(ERROR) << "AdbConnectionClientInfo missing required field debuggable";
-    return nullptr;
-  }
-
-  ctx->control_socket_.reset(socket(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0));
-  if (ctx->control_socket_ < 0) {
-    PLOG(ERROR) << "failed to create Unix domain socket";
-    return nullptr;
-  }
-
-  struct timeval timeout;
-  timeout.tv_sec = 1;
-  timeout.tv_usec = 0;
-  setsockopt(ctx->control_socket_.get(), SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
-
-  sockaddr_un addr = {};
-  addr.sun_family = AF_UNIX;
-  memcpy(addr.sun_path, kJdwpControlName, sizeof(kJdwpControlName));
-  size_t addr_len = offsetof(sockaddr_un, sun_path) + sizeof(kJdwpControlName) - 1;
-
-  int rc = connect(ctx->control_socket_.get(), reinterpret_cast<sockaddr*>(&addr), addr_len);
-  if (rc != 0) {
-    PLOG(ERROR) << "failed to connect to jdwp control socket";
-    return nullptr;
-  }
-
-  bool trusted = SocketPeerIsTrusted(ctx->control_socket_.get());
-  if (!trusted) {
-    LOG(ERROR) << "adb socket is not trusted, aborting connection";
-    return nullptr;
-  }
-
-  uint32_t pid_u32 = static_cast<uint32_t>(*pid);
-  rc = TEMP_FAILURE_RETRY(write(ctx->control_socket_.get(), &pid_u32, sizeof(pid_u32)));
-  if (rc != sizeof(pid_u32)) {
-    PLOG(ERROR) << "failed to send JDWP process pid to adbd";
-  }
-
-  return ctx.release();
-}
-
-void adbconnection_client_destroy(AdbConnectionClientContext* ctx) {
-  delete ctx;
-}
-
-int adbconnection_client_pollfd(AdbConnectionClientContext* ctx) {
-  return ctx->control_socket_.get();
-}
-
-int adbconnection_client_receive_jdwp_fd(AdbConnectionClientContext* ctx) {
-  char dummy;
-  unique_fd jdwp_fd;
-  ssize_t rc = android::base::ReceiveFileDescriptors(ctx->control_socket_, &dummy, 1, &jdwp_fd);
-  if (rc != 1) {
-    return rc;
-  }
-  return jdwp_fd.release();
-}
diff --git a/adb/libs/adbconnection/adbconnection_server.cpp b/adb/libs/adbconnection/adbconnection_server.cpp
deleted file mode 100644
index 939da2f..0000000
--- a/adb/libs/adbconnection/adbconnection_server.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adbconnection/server.h"
-
-#include <sys/epoll.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <array>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/unique_fd.h>
-
-using android::base::unique_fd;
-
-#define JDWP_CONTROL_NAME "\0jdwp-control"
-#define JDWP_CONTROL_NAME_LEN (sizeof(JDWP_CONTROL_NAME) - 1)
-
-static_assert(JDWP_CONTROL_NAME_LEN <= sizeof(reinterpret_cast<sockaddr_un*>(0)->sun_path));
-
-// Listen for incoming jdwp clients forever.
-void adbconnection_listen(void (*callback)(int fd, pid_t pid)) {
-  sockaddr_un addr = {};
-  socklen_t addrlen = JDWP_CONTROL_NAME_LEN + sizeof(addr.sun_family);
-
-  addr.sun_family = AF_UNIX;
-  memcpy(addr.sun_path, JDWP_CONTROL_NAME, JDWP_CONTROL_NAME_LEN);
-
-  unique_fd s(socket(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0));
-  if (s < 0) {
-    PLOG(ERROR) << "failed to create JDWP control socket";
-    return;
-  }
-
-  if (bind(s.get(), reinterpret_cast<sockaddr*>(&addr), addrlen) < 0) {
-    PLOG(ERROR) << "failed to bind JDWP control socket";
-    return;
-  }
-
-  if (listen(s.get(), 4) < 0) {
-    PLOG(ERROR) << "failed to listen on JDWP control socket";
-    return;
-  }
-
-  std::vector<unique_fd> pending_connections;
-
-  unique_fd epfd(epoll_create1(EPOLL_CLOEXEC));
-  std::array<epoll_event, 16> events;
-
-  events[0].events = EPOLLIN;
-  events[0].data.fd = -1;
-  if (epoll_ctl(epfd.get(), EPOLL_CTL_ADD, s.get(), &events[0]) != 0) {
-    LOG(FATAL) << "failed to register event with epoll fd";
-  }
-
-  while (true) {
-    int epoll_rc = TEMP_FAILURE_RETRY(epoll_wait(epfd.get(), events.data(), events.size(), -1));
-    if (epoll_rc == -1) {
-      PLOG(FATAL) << "epoll_wait failed";
-    }
-
-    for (int i = 0; i < epoll_rc; ++i) {
-      const epoll_event& event = events[i];
-      if (event.data.fd == -1) {
-        unique_fd client(
-            TEMP_FAILURE_RETRY(accept4(s.get(), nullptr, nullptr, SOCK_NONBLOCK | SOCK_CLOEXEC)));
-
-        if (client == -1) {
-          PLOG(WARNING) << "failed to accept client on JDWP control socket";
-          continue;
-        }
-
-        epoll_event register_event;
-        register_event.events = EPOLLIN;
-        register_event.data.fd = client.get();
-
-        if (epoll_ctl(epfd.get(), EPOLL_CTL_ADD, client.get(), &register_event) != 0) {
-          PLOG(FATAL) << "failed to register JDWP client with epoll";
-        }
-
-        pending_connections.emplace_back(std::move(client));
-      } else {
-        // n^2, but the backlog should be short.
-        auto it = std::find_if(pending_connections.begin(), pending_connections.end(),
-                               [&](const unique_fd& fd) { return fd.get() == event.data.fd; });
-
-        if (it == pending_connections.end()) {
-          LOG(FATAL) << "failed to find JDWP client (" << event.data.fd
-                     << ") in pending connections";
-        }
-
-        // Massively oversized buffer: we're expecting an int32_t from the other end.
-        char buf[32];
-        int rc = TEMP_FAILURE_RETRY(recv(it->get(), buf, sizeof(buf), MSG_DONTWAIT));
-        if (rc != 4) {
-          LOG(ERROR) << "received data of incorrect size from JDWP client: read " << rc
-                     << ", expected 4";
-        } else {
-          int32_t pid;
-          memcpy(&pid, buf, sizeof(pid));
-          callback(it->release(), static_cast<pid_t>(pid));
-        }
-
-        if (epoll_ctl(epfd.get(), EPOLL_CTL_DEL, event.data.fd, nullptr) != 0) {
-          LOG(FATAL) << "failed to delete fd from JDWP epoll fd";
-        }
-
-        pending_connections.erase(it);
-      }
-    }
-  }
-}
diff --git a/adb/libs/adbconnection/include/adbconnection/client.h b/adb/libs/adbconnection/include/adbconnection/client.h
deleted file mode 100644
index 692fea0..0000000
--- a/adb/libs/adbconnection/include/adbconnection/client.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <android-base/unique_fd.h>
-
-extern "C" {
-
-struct AdbConnectionClientContext;
-
-enum AdbConnectionClientInfoType {
-  pid,
-  debuggable,
-};
-
-struct AdbConnectionClientInfo {
-  AdbConnectionClientInfoType type;
-  union {
-    uint64_t pid;
-    bool debuggable;
-  } data;
-};
-
-// Construct a context and connect to adbd.
-// Returns null if we fail to connect to adbd.
-AdbConnectionClientContext* adbconnection_client_new(
-    const AdbConnectionClientInfo* const* info_elems, size_t info_count);
-
-void adbconnection_client_destroy(AdbConnectionClientContext* ctx);
-
-// Get an fd which can be polled upon to detect when a jdwp socket is available.
-// You do not own this fd. Do not close it.
-int adbconnection_client_pollfd(AdbConnectionClientContext* ctx);
-
-// Receive a jdwp client fd.
-// Ownership is transferred to the caller of this function.
-int adbconnection_client_receive_jdwp_fd(AdbConnectionClientContext* ctx);
-}
diff --git a/adb/libs/adbconnection/include/adbconnection/server.h b/adb/libs/adbconnection/include/adbconnection/server.h
deleted file mode 100644
index 57ca6cd..0000000
--- a/adb/libs/adbconnection/include/adbconnection/server.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <sys/types.h>
-
-#include <android-base/unique_fd.h>
-
-extern "C" {
-
-void adbconnection_listen(void (*callback)(int fd, pid_t pid));
-}
diff --git a/adb/libs/adbconnection/libadbconnection_client.map.txt b/adb/libs/adbconnection/libadbconnection_client.map.txt
deleted file mode 100644
index 153a0e4..0000000
--- a/adb/libs/adbconnection/libadbconnection_client.map.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (C) 2019 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.
-#
-
-LIBADBCONNECTION_CLIENT_1 {
-  global:
-    adbconnection_client_new;
-    adbconnection_client_destroy;
-    adbconnection_client_pollfd;
-    adbconnection_client_receive_jdwp_fd;
-  local:
-    *;
-};
diff --git a/adb/libs/libadbd_fs/Android.bp b/adb/libs/libadbd_fs/Android.bp
deleted file mode 100644
index d178148..0000000
--- a/adb/libs/libadbd_fs/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-// libadbd_fs
-// =========================================================
-cc_library {
-    name: "libadbd_fs",
-    defaults: ["adbd_defaults"],
-
-    srcs: ["adbd_fs.cpp"],
-    static_libs: [
-        "libbase",
-        "libcutils",
-        "liblog",
-    ],
-    export_include_dirs: ["include"],
-
-    version_script: "libadbd_fs.map.txt",
-    stubs: {
-        versions: ["1"],
-        symbol_file: "libadbd_fs.map.txt",
-    },
-
-    host_supported: true,
-    recovery_available: true,
-    compile_multilib: "both",
-
-    target: {
-        darwin: {
-            enabled: false,
-        }
-    },
-}
diff --git a/adb/libs/libadbd_fs/adbd_fs.cpp b/adb/libs/libadbd_fs/adbd_fs.cpp
deleted file mode 100644
index 8e62d40..0000000
--- a/adb/libs/libadbd_fs/adbd_fs.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <adbd_fs.h>
-
-#include <private/fs_config.h>
-
-void adbd_fs_config(const char* path, int dir, const char* target_out_path, uid_t* uid, gid_t* gid,
-                    mode_t* mode, uint64_t* capabilities) {
-  unsigned uid_hack;
-  unsigned gid_hack;
-  unsigned mode_hack;
-  fs_config(path, dir, target_out_path, &uid_hack, &gid_hack, &mode_hack, capabilities);
-  *uid = uid_hack;
-  *gid = gid_hack;
-  *mode = mode_hack;
-}
diff --git a/adb/libs/libadbd_fs/include/adbd_fs.h b/adb/libs/libadbd_fs/include/adbd_fs.h
deleted file mode 100644
index 6158d72..0000000
--- a/adb/libs/libadbd_fs/include/adbd_fs.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <sys/types.h>
-
-extern "C" {
-// Thin wrapper around libcutils fs_config.
-void adbd_fs_config(const char* path, int dir, const char* target_out_path, uid_t* uid, gid_t* gid,
-                    mode_t* mode, uint64_t* capabilities);
-}
diff --git a/adb/libs/libadbd_fs/libadbd_fs.map.txt b/adb/libs/libadbd_fs/libadbd_fs.map.txt
deleted file mode 100644
index 1454e96..0000000
--- a/adb/libs/libadbd_fs/libadbd_fs.map.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBADBD_FS {
-  global:
-    adbd_fs_config; # apex
-  local:
-    *;
-};
diff --git a/adb/mdns_test.cpp b/adb/mdns_test.cpp
deleted file mode 100644
index 1f662c1..0000000
--- a/adb/mdns_test.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-
-#include "adb_mdns.h"
-
-static bool isValidMdnsServiceName(std::string_view name) {
-    // The rules for Service Names [RFC6335] state that they may be no more
-    // than fifteen characters long (not counting the mandatory underscore),
-    // consisting of only letters, digits, and hyphens, must begin and end
-    // with a letter or digit, must not contain consecutive hyphens, and
-    // must contain at least one letter.
-
-    // No more than 15 characters long
-    if (name.empty() || name.size() > 15) {
-        return false;
-    }
-
-    bool hasAtLeastOneLetter = false;
-    bool sawHyphen = false;
-    for (size_t i = 0; i < name.size(); ++i) {
-        // Must contain at least one letter
-        // Only contains letters, digits and hyphens
-        if (name[i] == '-') {
-            // Cannot be at beginning or end
-            if (i == 0 || i == name.size() - 1) {
-                return false;
-            }
-            if (sawHyphen) {
-                // Consecutive hyphen found
-                return false;
-            }
-            sawHyphen = true;
-            continue;
-        }
-
-        sawHyphen = false;
-        if ((name[i] >= 'a' && name[i] <= 'z') || (name[i] >= 'A' && name[i] <= 'Z')) {
-            hasAtLeastOneLetter = true;
-            continue;
-        }
-
-        if (name[i] >= '0' && name[i] <= '9') {
-            continue;
-        }
-
-        // Invalid character
-        return false;
-    }
-
-    return hasAtLeastOneLetter;
-}
-
-TEST(mdns, test_isValidMdnsServiceName) {
-    // Longer than 15 characters
-    EXPECT_FALSE(isValidMdnsServiceName("abcd1234abcd1234"));
-
-    // Contains invalid characters
-    EXPECT_FALSE(isValidMdnsServiceName("a*a"));
-    EXPECT_FALSE(isValidMdnsServiceName("a_a"));
-    EXPECT_FALSE(isValidMdnsServiceName("_a"));
-
-    // Does not begin or end with letter or digit
-    EXPECT_FALSE(isValidMdnsServiceName(""));
-    EXPECT_FALSE(isValidMdnsServiceName("-"));
-    EXPECT_FALSE(isValidMdnsServiceName("-a"));
-    EXPECT_FALSE(isValidMdnsServiceName("-1"));
-    EXPECT_FALSE(isValidMdnsServiceName("a-"));
-    EXPECT_FALSE(isValidMdnsServiceName("1-"));
-
-    // Contains consecutive hyphens
-    EXPECT_FALSE(isValidMdnsServiceName("a--a"));
-
-    // Does not contain at least one letter
-    EXPECT_FALSE(isValidMdnsServiceName("1"));
-    EXPECT_FALSE(isValidMdnsServiceName("12"));
-    EXPECT_FALSE(isValidMdnsServiceName("1-2"));
-
-    // Some valid names
-    EXPECT_TRUE(isValidMdnsServiceName("a"));
-    EXPECT_TRUE(isValidMdnsServiceName("a1"));
-    EXPECT_TRUE(isValidMdnsServiceName("1A"));
-    EXPECT_TRUE(isValidMdnsServiceName("aZ"));
-    EXPECT_TRUE(isValidMdnsServiceName("a-Z"));
-    EXPECT_TRUE(isValidMdnsServiceName("a-b-Z"));
-    EXPECT_TRUE(isValidMdnsServiceName("abc-def-123-456"));
-}
-
-TEST(mdns, ServiceName_RFC6335) {
-    EXPECT_TRUE(isValidMdnsServiceName(ADB_MDNS_SERVICE_TYPE));
-    EXPECT_TRUE(isValidMdnsServiceName(ADB_MDNS_TLS_PAIRING_TYPE));
-    EXPECT_TRUE(isValidMdnsServiceName(ADB_MDNS_TLS_CONNECT_TYPE));
-}
diff --git a/adb/pairing_auth/Android.bp b/adb/pairing_auth/Android.bp
deleted file mode 100644
index a43f4d0..0000000
--- a/adb/pairing_auth/Android.bp
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (C) 2020 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.
-
-cc_defaults {
-    name: "libadb_pairing_auth_defaults",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Wthread-safety",
-        "-Werror",
-    ],
-
-    compile_multilib: "both",
-
-    srcs: [
-        "aes_128_gcm.cpp",
-        "pairing_auth.cpp",
-    ],
-    target: {
-        android: {
-            version_script: "libadb_pairing_auth.map.txt",
-        },
-        windows: {
-            compile_multilib: "first",
-            enabled: true,
-        },
-    },
-    export_include_dirs: ["include"],
-
-    visibility: [
-        "//art:__subpackages__",
-        "//system/core/adb:__subpackages__",
-    ],
-
-    // libadb_pairing_auth doesn't need an embedded build number.
-    use_version_lib: false,
-
-    host_supported: true,
-    recovery_available: false,
-
-    stl: "libc++_static",
-
-    static_libs: ["libbase"],
-    shared_libs: [
-        "libcrypto",
-        "liblog",
-    ],
-}
-
-cc_library {
-    name: "libadb_pairing_auth",
-    defaults: ["libadb_pairing_auth_defaults"],
-
-    apex_available: [
-        "com.android.adbd",
-    ],
-
-    stubs: {
-        symbol_file: "libadb_pairing_auth.map.txt",
-        versions: ["30"],
-    },
-}
-
-// For running atest (b/147158681)
-cc_library_static {
-    name: "libadb_pairing_auth_static",
-    defaults: ["libadb_pairing_auth_defaults"],
-
-    apex_available: [
-        "//apex_available:platform",
-    ],
-}
diff --git a/adb/pairing_auth/aes_128_gcm.cpp b/adb/pairing_auth/aes_128_gcm.cpp
deleted file mode 100644
index 51520d8..0000000
--- a/adb/pairing_auth/aes_128_gcm.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "adb/pairing/aes_128_gcm.h"
-
-#include <android-base/endian.h>
-#include <android-base/logging.h>
-
-#include <openssl/evp.h>
-#include <openssl/hkdf.h>
-#include <openssl/rand.h>
-
-namespace adb {
-namespace pairing {
-
-namespace {
-// Size of AES-128-GCM key, in bytes
-static constexpr size_t kHkdfKeyLength = 16;
-
-}  // namespace
-
-Aes128Gcm::Aes128Gcm(const uint8_t* key_material, size_t key_material_len) {
-    CHECK(key_material);
-    CHECK_NE(key_material_len, 0ul);
-
-    uint8_t key[kHkdfKeyLength];
-    uint8_t info[] = "adb pairing_auth aes-128-gcm key";
-    CHECK_EQ(HKDF(key, sizeof(key), EVP_sha256(), key_material, key_material_len, nullptr, 0, info,
-                  sizeof(info) - 1),
-             1);
-    CHECK(EVP_AEAD_CTX_init(context_.get(), EVP_aead_aes_128_gcm(), key, sizeof(key),
-                            EVP_AEAD_DEFAULT_TAG_LENGTH, nullptr));
-}
-
-std::optional<size_t> Aes128Gcm::Encrypt(const uint8_t* in, size_t in_len, uint8_t* out,
-                                         size_t out_len) {
-    std::vector<uint8_t> nonce(EVP_AEAD_nonce_length(EVP_AEAD_CTX_aead(context_.get())), 0);
-    memcpy(nonce.data(), &enc_sequence_, sizeof(enc_sequence_));
-    size_t written_sz;
-    if (!EVP_AEAD_CTX_seal(context_.get(), out, &written_sz, out_len, nonce.data(), nonce.size(),
-                           in, in_len, nullptr, 0)) {
-        LOG(ERROR) << "Failed to encrypt (in_len=" << in_len << ", out_len=" << out_len
-                   << ", out_len_needed=" << EncryptedSize(in_len) << ")";
-        return std::nullopt;
-    }
-
-    ++enc_sequence_;
-    return written_sz;
-}
-
-std::optional<size_t> Aes128Gcm::Decrypt(const uint8_t* in, size_t in_len, uint8_t* out,
-                                         size_t out_len) {
-    std::vector<uint8_t> nonce(EVP_AEAD_nonce_length(EVP_AEAD_CTX_aead(context_.get())), 0);
-    memcpy(nonce.data(), &dec_sequence_, sizeof(dec_sequence_));
-    size_t written_sz;
-    if (!EVP_AEAD_CTX_open(context_.get(), out, &written_sz, out_len, nonce.data(), nonce.size(),
-                           in, in_len, nullptr, 0)) {
-        LOG(ERROR) << "Failed to decrypt (in_len=" << in_len << ", out_len=" << out_len
-                   << ", out_len_needed=" << DecryptedSize(in_len) << ")";
-        return std::nullopt;
-    }
-
-    ++dec_sequence_;
-    return written_sz;
-}
-
-size_t Aes128Gcm::EncryptedSize(size_t size) {
-    // https://commondatastorage.googleapis.com/chromium-boringssl-docs/aead.h.html#EVP_AEAD_CTX_seal
-    return size + EVP_AEAD_max_overhead(EVP_AEAD_CTX_aead(context_.get()));
-}
-
-size_t Aes128Gcm::DecryptedSize(size_t size) {
-    // https://commondatastorage.googleapis.com/chromium-boringssl-docs/aead.h.html#EVP_AEAD_CTX_open
-    return size;
-}
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_auth/include/adb/pairing/aes_128_gcm.h b/adb/pairing_auth/include/adb/pairing/aes_128_gcm.h
deleted file mode 100644
index 6be5856..0000000
--- a/adb/pairing_auth/include/adb/pairing/aes_128_gcm.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#include <optional>
-#include <vector>
-
-#include <openssl/aead.h>
-
-namespace adb {
-namespace pairing {
-
-class Aes128Gcm {
-  public:
-    explicit Aes128Gcm(const uint8_t* key_material, size_t key_material_len);
-
-    // Encrypt a block of data in |in| of length |in_len|, this consumes all data
-    // in |in| and places the encrypted data in |out| if |out_len| indicates that
-    // there is enough space. The data contains information needed for
-    // decryption that is specific to this implementation and is therefore only
-    // suitable for decryption with this class.
-    // The method returns the number of bytes placed in |out| on success and a
-    // negative value if an error occurs.
-    std::optional<size_t> Encrypt(const uint8_t* in, size_t in_len, uint8_t* out, size_t out_len);
-    // Decrypt a block of data in |in| of length |in_len|, this consumes all data
-    // in |in_len| bytes of data. The decrypted output is placed in the |out|
-    // buffer of length |out_len|. On successful decryption the number of bytes in
-    // |out| will be placed in |out_len|.
-    // The method returns the number of bytes consumed from the |in| buffer. If
-    // there is not enough data available in |in| the method returns zero. If
-    // an error occurs the method returns a negative value.
-    std::optional<size_t> Decrypt(const uint8_t* in, size_t in_len, uint8_t* out, size_t out_len);
-
-    // Return a safe amount of buffer storage needed to encrypt |size| bytes.
-    size_t EncryptedSize(size_t size);
-    // Return a safe amount of buffer storage needed to decrypt |size| bytes.
-    size_t DecryptedSize(size_t size);
-
-  private:
-    bssl::ScopedEVP_AEAD_CTX context_;
-    // Sequence numbers to use as nonces in the encryption scheme
-    uint64_t dec_sequence_ = 0;
-    uint64_t enc_sequence_ = 0;
-};
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_auth/include/adb/pairing/pairing_auth.h b/adb/pairing_auth/include/adb/pairing/pairing_auth.h
deleted file mode 100644
index 9ef97e2..0000000
--- a/adb/pairing_auth/include/adb/pairing/pairing_auth.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-#if !defined(__INTRODUCED_IN)
-#define __INTRODUCED_IN(__api_level) /* nothing */
-#endif
-
-__BEGIN_DECLS
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
-
-/**
- * PairingAuthCtx is a wrapper around the SPAKE2 protocol + cipher initialization
- * for encryption. On construction, the |password| will be used to generate a
- * SPAKE2 message. Each peer will exchange the messages in |pairing_auth_get_msg|
- * to initialize their ciphers in |pairing_auth_init_cipher|. If both peers used the
- * same |password|, then both sides will be able to decrypt each other's messages.
- *
- * On creation of a PairingAuthCtx, |pairing_auth_init_cipher| prior to using
- * the encrypt and decrypt APIs. Furthermore, you can only initialize the cipher
- * once.
- *
- * See pairing_auth_test.cpp for example usage.
- *
- */
-struct PairingAuthCtx;
-typedef struct PairingAuthCtx PairingAuthCtx;
-
-/**
- * Creates a new PairingAuthCtx instance as the server.
- *
- * @param pswd the shared secret the server and client use to authenticate each
- *             other. Will abort if null.
- * @param len the length of the pswd in bytes. Will abort if 0.
- * @return a new PairingAuthCtx server instance. Caller is responsible for
- *         destroying the context via #pairing_auth_destroy.
- */
-PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(30);
-
-/**
- * Creates a new PairingAuthCtx instance as the client.
- *
- * @param pswd the shared secret the server and client use to authenticate each
- *             other. Will abort if null.
- * @param len the length of the pswd in bytes. Will abort if 0.
- * @return a new PairingAuthCtx client instance. Caller is responsible for
- *         destroying the context via #pairing_auth_destroy.
- */
-PairingAuthCtx* pairing_auth_client_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(30);
-
-/**
- * Destroys the PairingAuthCtx.
- *
- * @param ctx the PairingAuthCtx instance to destroy. Will abort if null.
- */
-void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(30);
-
-/**
- * Returns the exact size of the SPAKE2 msg.
- *
- * Use this size as the buffer size when retrieving the message via
- * #pairing_auth_get_msg.
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @return the size of the SPAKE2 message in bytes. This is guaranteed to be > 0.
- */
-size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(30);
-
-/**
- * Writes the SPAKE2 message to exchange with the other party to |out_buf|.
- *
- * This is guaranteed to write a valid message to |out_buf|. Use #pairing_auth_msg_size
- * to get the size the |out_buf| should be. The SPAKE2 messages will be used to
- * initialize the cipher for encryption/decryption (see #pairing_auth_init_cipher).
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @param out_buf the buffer the message is written to. The buffer is assumed to
- *                be have at least #pairing_auth_msg_size size. Will abort if
- *                out_buf is null.
- */
-void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTRODUCED_IN(30);
-
-/**
- * Processes the peer's |their_msg| and attempts to initialize the cipher for
- * encryption.
- *
- * You can only call this method ONCE with a non-empty |msg|, regardless of success
- * or failure. On success, you can use the #pairing_auth_decrypt and #pairing_auth_encrypt
- * methods to exchange any further information securely. On failure, this
- * PairingAuthCtx instance has no more purpose and should be destroyed.
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @param their_msg the peer's SPAKE2 msg. See #pairing_auth_get_msg. Will abort
- *        if null.
- * @param msg_len the length of their_msg in bytes. Will abort if 0.
- * @return true iff the client and server used the same password when creating
- *         the PairingAuthCtx. See
- *         https: *commondatastorage.googleapis.com/chromium-boringssl-docs/curve25519.h.html#SPAKE2
- *         for more details on the SPAKE2 protocol.
- */
-bool pairing_auth_init_cipher(PairingAuthCtx* ctx, const uint8_t* their_msg, size_t msg_len)
-        __INTRODUCED_IN(30);
-
-/**
- * Returns a safe buffer size for encrypting data of a certain size.
- *
- * IMPORTANT: This will abort if either #pairing_auth_init_cipher was not called
- * or #pairing_auth_init_cipher failed.
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @param len the size of the message wanting to encrypt in bytes.
- * @return the minimum buffer size, in bytes, to hold an encrypted message of size len. See
- * #pairing_auth_encrypt for usage.
- */
-size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRODUCED_IN(30);
-
-/**
- * Encrypts input data and writes the encrypted data into a user-provided buffer.
- *
- * IMPORTANT: This will abort if either #pairing_auth_init_cipher was not called
- * or #pairing_auth_init_cipher failed.
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @param inbuf the buffer containing the data to encrypt. Will abort if null.
- * @param inlen the size of inbuf in bytes. Will abort if 0.
- * @param outbuf the buffer to write the encrypted data to. Will abort if null
- * @param outlen the size of outbuf in bytes. See #pairing_auth_safe_encrypted_size.
- * @return true if all the data was encrypted and written to outbuf, false
- *         otherwise.
- */
-bool pairing_auth_encrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf,
-                          size_t* outlen) __INTRODUCED_IN(30);
-
-/**
- * Returns a safe buffer size for decrypting data of a certain size.
- *
- * IMPORTANT: This will abort if either #pairing_auth_init_cipher was not called
- * or #pairing_auth_init_cipher failed.
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @param buf the buffer containing the encrypted data. Will abort if null.
- * @param len the size of the buf in bytes. Will abort if 0.
- * @return the minimum buffer size, in bytes, to hold a decrypted message of size len. See
- *         #pairing_auth_decrypt for usage.
- */
-size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf, size_t len)
-        __INTRODUCED_IN(30);
-
-/**
- * Decrypts input data and writes the decrypted data into a user-provided buffer.
- *
- * IMPORTANT: This will abort if either #pairing_auth_init_cipher was not called
- * or #pairing_auth_init_cipher failed.
- *
- * @param ctx the PairingAuthCtx instance. Will abort if null.
- * @param inbuf the buffer containing the data to decrypt. Will abort if null.
- * @param inlen the size of inbuf in bytes. WIll abort if 0.
- * @param outbuf the buffer to write the decrypted data to. Will abort if null.
- * @param outlen the size of outbuf in bytes. See #pairing_auth_safe_decrypted_size.
- *        Will abort if 0.
- * @return true if all the data was decrypted and written to outbuf, false
- *         otherwise.
- */
-bool pairing_auth_decrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf,
-                          size_t* outlen) __INTRODUCED_IN(30);
-
-#endif  //!__ANDROID__ || __ANDROID_API__ >= 30
-__END_DECLS
diff --git a/adb/pairing_auth/libadb_pairing_auth.map.txt b/adb/pairing_auth/libadb_pairing_auth.map.txt
deleted file mode 100644
index fdc1557..0000000
--- a/adb/pairing_auth/libadb_pairing_auth.map.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-LIBADB_PAIRING_AUTH {
-  global:
-    pairing_auth_msg_size; # apex introduced=30
-    pairing_auth_get_spake2_msg; # apex introduced=30
-    pairing_auth_init_cipher; # apex introduced=30
-    pairing_auth_safe_encrypted_size; # apex introduced=30
-    pairing_auth_encrypt; # apex introduced=30
-    pairing_auth_safe_decrypted_size; # apex introduced=30
-    pairing_auth_decrypt; # apex introduced=30
-    pairing_auth_server_new; # apex introduced=30
-    pairing_auth_client_new; # apex introduced=30
-    pairing_auth_destroy; # apex introduced=30
-  local:
-    *;
-};
diff --git a/adb/pairing_auth/pairing_auth.cpp b/adb/pairing_auth/pairing_auth.cpp
deleted file mode 100644
index 0ac04e6..0000000
--- a/adb/pairing_auth/pairing_auth.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "adb/pairing/pairing_auth.h"
-
-#include <android-base/logging.h>
-
-#include <openssl/curve25519.h>
-#include <openssl/mem.h>
-
-#include <iomanip>
-#include <sstream>
-#include <vector>
-
-#include "adb/pairing/aes_128_gcm.h"
-
-using namespace adb::pairing;
-
-static constexpr spake2_role_t kClientRole = spake2_role_alice;
-static constexpr spake2_role_t kServerRole = spake2_role_bob;
-
-static const uint8_t kClientName[] = "adb pair client";
-static const uint8_t kServerName[] = "adb pair server";
-
-// This class is basically a wrapper around the SPAKE2 protocol + initializing a
-// cipher with the generated key material for encryption.
-struct PairingAuthCtx {
-  public:
-    using Data = std::vector<uint8_t>;
-    enum class Role {
-        Client,
-        Server,
-    };
-
-    explicit PairingAuthCtx(Role role, const Data& pswd);
-
-    // Returns the message to exchange with the other party. This is guaranteed
-    // to have a non-empty message if creating this object with
-    // |PairingAuthCtx::Create|, so you won't need to check.
-    const Data& msg() const;
-
-    // Processes the peer's |msg| and attempts to initialize the cipher for
-    // encryption. You can only call this method ONCE with a non-empty |msg|,
-    // regardless of success or failure. Subsequent calls will always return
-    // false. On success, you can use the |decrypt|
-    // and |encrypt| methods to exchange any further information securely.
-    //
-    // Note: Once you call this with a non-empty key, the state is locked, which
-    // means that you cannot try and register another key, regardless of the
-    // return value. In order to register another key, you have to create a new
-    // instance of PairingAuthCtx.
-    bool InitCipher(const Data& their_msg);
-
-    // Encrypts |data| and returns the result. If encryption fails, the return
-    // will be an empty vector.
-    Data Encrypt(const Data& data);
-
-    // Decrypts |data| and returns the result. If decryption fails, the return
-    // will be an empty vector.
-    Data Decrypt(const Data& data);
-
-    // Returns a safe buffer size for encrypting a buffer of size |len|.
-    size_t SafeEncryptedSize(size_t len);
-
-    // Returns a safe buffer size for decrypting a buffer of size |len|.
-    size_t SafeDecryptedSize(size_t len);
-
-  private:
-    Data our_msg_;
-    Role role_;
-    bssl::UniquePtr<SPAKE2_CTX> spake2_ctx_;
-    std::unique_ptr<Aes128Gcm> cipher_;
-};  // PairingAuthCtx
-
-PairingAuthCtx::PairingAuthCtx(Role role, const Data& pswd) : role_(role) {
-    CHECK(!pswd.empty());
-    // Try to create the spake2 context and generate the public key.
-    spake2_role_t spake_role;
-    const uint8_t* my_name = nullptr;
-    const uint8_t* their_name = nullptr;
-    size_t my_len = 0;
-    size_t their_len = 0;
-
-    // Create the SPAKE2 context
-    switch (role_) {
-        case Role::Client:
-            spake_role = kClientRole;
-            my_name = kClientName;
-            my_len = sizeof(kClientName);
-            their_name = kServerName;
-            their_len = sizeof(kServerName);
-            break;
-        case Role::Server:
-            spake_role = kServerRole;
-            my_name = kServerName;
-            my_len = sizeof(kServerName);
-            their_name = kClientName;
-            their_len = sizeof(kClientName);
-            break;
-    }
-    spake2_ctx_.reset(SPAKE2_CTX_new(spake_role, my_name, my_len, their_name, their_len));
-    if (spake2_ctx_ == nullptr) {
-        LOG(ERROR) << "Unable to create a SPAKE2 context.";
-        return;
-    }
-
-    // Generate the SPAKE2 public key
-    size_t key_size = 0;
-    uint8_t key[SPAKE2_MAX_MSG_SIZE];
-    int status = SPAKE2_generate_msg(spake2_ctx_.get(), key, &key_size, SPAKE2_MAX_MSG_SIZE,
-                                     pswd.data(), pswd.size());
-    if (status != 1 || key_size == 0) {
-        LOG(ERROR) << "Unable to generate the SPAKE2 public key.";
-        return;
-    }
-    our_msg_.assign(key, key + key_size);
-}
-
-const PairingAuthCtx::Data& PairingAuthCtx::msg() const {
-    return our_msg_;
-}
-
-bool PairingAuthCtx::InitCipher(const PairingAuthCtx::Data& their_msg) {
-    // You can only register a key once.
-    CHECK(!their_msg.empty());
-    CHECK(!cipher_);
-
-    // Don't even try to process a message over the SPAKE2_MAX_MSG_SIZE
-    if (their_msg.size() > SPAKE2_MAX_MSG_SIZE) {
-        LOG(ERROR) << "their_msg size [" << their_msg.size() << "] greater then max size ["
-                   << SPAKE2_MAX_MSG_SIZE << "].";
-        return false;
-    }
-
-    size_t key_material_len = 0;
-    uint8_t key_material[SPAKE2_MAX_KEY_SIZE];
-    int status = SPAKE2_process_msg(spake2_ctx_.get(), key_material, &key_material_len,
-                                    sizeof(key_material), their_msg.data(), their_msg.size());
-    if (status != 1) {
-        LOG(ERROR) << "Unable to process their public key";
-        return false;
-    }
-
-    // Once SPAKE2_process_msg returns successfully, you can't do anything else
-    // with the context, besides destroy it.
-    cipher_.reset(new Aes128Gcm(key_material, key_material_len));
-
-    return true;
-}
-
-PairingAuthCtx::Data PairingAuthCtx::Encrypt(const PairingAuthCtx::Data& data) {
-    CHECK(cipher_);
-    CHECK(!data.empty());
-
-    // Determine the size for the encrypted data based on the raw data.
-    Data encrypted(cipher_->EncryptedSize(data.size()));
-    auto out_size = cipher_->Encrypt(data.data(), data.size(), encrypted.data(), encrypted.size());
-    if (!out_size.has_value() || *out_size == 0) {
-        LOG(ERROR) << "Unable to encrypt data";
-        return Data();
-    }
-    encrypted.resize(*out_size);
-
-    return encrypted;
-}
-
-PairingAuthCtx::Data PairingAuthCtx::Decrypt(const PairingAuthCtx::Data& data) {
-    CHECK(cipher_);
-    CHECK(!data.empty());
-
-    // Determine the size for the decrypted data based on the raw data.
-    Data decrypted(cipher_->DecryptedSize(data.size()));
-    size_t decrypted_size = decrypted.size();
-    auto out_size = cipher_->Decrypt(data.data(), data.size(), decrypted.data(), decrypted_size);
-    if (!out_size.has_value() || *out_size == 0) {
-        LOG(ERROR) << "Unable to decrypt data";
-        return Data();
-    }
-    decrypted.resize(*out_size);
-
-    return decrypted;
-}
-
-size_t PairingAuthCtx::SafeEncryptedSize(size_t len) {
-    CHECK(cipher_);
-    return cipher_->EncryptedSize(len);
-}
-
-size_t PairingAuthCtx::SafeDecryptedSize(size_t len) {
-    CHECK(cipher_);
-    return cipher_->DecryptedSize(len);
-}
-
-PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) {
-    CHECK(pswd);
-    CHECK_GT(len, 0U);
-    std::vector<uint8_t> p(pswd, pswd + len);
-    auto* ret = new PairingAuthCtx(PairingAuthCtx::Role::Server, std::move(p));
-    CHECK(!ret->msg().empty());
-    return ret;
-}
-
-PairingAuthCtx* pairing_auth_client_new(const uint8_t* pswd, size_t len) {
-    CHECK(pswd);
-    CHECK_GT(len, 0U);
-    std::vector<uint8_t> p(pswd, pswd + len);
-    auto* ret = new PairingAuthCtx(PairingAuthCtx::Role::Client, std::move(p));
-    CHECK(!ret->msg().empty());
-    return ret;
-}
-
-size_t pairing_auth_msg_size(PairingAuthCtx* ctx) {
-    CHECK(ctx);
-    return ctx->msg().size();
-}
-
-void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) {
-    CHECK(ctx);
-    CHECK(out_buf);
-    auto& msg = ctx->msg();
-    memcpy(out_buf, msg.data(), msg.size());
-}
-
-bool pairing_auth_init_cipher(PairingAuthCtx* ctx, const uint8_t* their_msg, size_t msg_len) {
-    CHECK(ctx);
-    CHECK(their_msg);
-    CHECK_GT(msg_len, 0U);
-
-    std::vector<uint8_t> p(their_msg, their_msg + msg_len);
-    return ctx->InitCipher(p);
-}
-
-size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) {
-    CHECK(ctx);
-    return ctx->SafeEncryptedSize(len);
-}
-
-bool pairing_auth_encrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf,
-                          size_t* outlen) {
-    CHECK(ctx);
-    CHECK(inbuf);
-    CHECK(outbuf);
-    CHECK(outlen);
-    CHECK_GT(inlen, 0U);
-
-    std::vector<uint8_t> in(inbuf, inbuf + inlen);
-    auto out = ctx->Encrypt(in);
-    if (out.empty()) {
-        return false;
-    }
-
-    memcpy(outbuf, out.data(), out.size());
-    *outlen = out.size();
-    return true;
-}
-
-size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf, size_t len) {
-    CHECK(ctx);
-    CHECK(buf);
-    CHECK_GT(len, 0U);
-    // We no longer need buf for EVP_AEAD
-    return ctx->SafeDecryptedSize(len);
-}
-
-bool pairing_auth_decrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf,
-                          size_t* outlen) {
-    CHECK(ctx);
-    CHECK(inbuf);
-    CHECK(outbuf);
-    CHECK(outlen);
-    CHECK_GT(inlen, 0U);
-
-    std::vector<uint8_t> in(inbuf, inbuf + inlen);
-    auto out = ctx->Decrypt(in);
-    if (out.empty()) {
-        return false;
-    }
-
-    memcpy(outbuf, out.data(), out.size());
-    *outlen = out.size();
-    return true;
-}
-
-void pairing_auth_destroy(PairingAuthCtx* ctx) {
-    CHECK(ctx);
-    delete ctx;
-}
diff --git a/adb/pairing_auth/tests/Android.bp b/adb/pairing_auth/tests/Android.bp
deleted file mode 100644
index 213123d..0000000
--- a/adb/pairing_auth/tests/Android.bp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright (C) 2020 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.
-//
-
-cc_test {
-    name: "adb_pairing_auth_test",
-    srcs: [
-        "aes_128_gcm_test.cpp",
-        "pairing_auth_test.cpp",
-    ],
-
-    compile_multilib: "first",
-
-    shared_libs: [
-        "libbase",
-        "libcrypto",
-    ],
-
-    // Let's statically link them so we don't have to install it onto the
-    // system image for testing.
-    static_libs: [
-        "libadb_pairing_auth_static",
-    ],
-
-    test_suites: ["device-tests"],
-}
diff --git a/adb/pairing_auth/tests/aes_128_gcm_test.cpp b/adb/pairing_auth/tests/aes_128_gcm_test.cpp
deleted file mode 100644
index 55689d6..0000000
--- a/adb/pairing_auth/tests/aes_128_gcm_test.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <memory>
-
-#include <adb/pairing/aes_128_gcm.h>
-#include <openssl/rand.h>
-
-namespace adb {
-namespace pairing {
-
-TEST(Aes128GcmTest, init_null_material) {
-    std::unique_ptr<Aes128Gcm> cipher;
-    ASSERT_DEATH({ cipher.reset(new Aes128Gcm(nullptr, 42)); }, "");
-}
-
-TEST(Aes128GcmTest, init_empty_material) {
-    uint8_t material[64];
-    std::unique_ptr<Aes128Gcm> cipher;
-    ASSERT_DEATH({ cipher.reset(new Aes128Gcm(material, 0)); }, "");
-}
-
-TEST(Aes128GcmTest, encrypt_decrypt) {
-    const uint8_t msg[] = "alice and bob, sitting in a binary tree";
-    uint8_t material[256];
-    uint8_t encrypted[1024];
-    uint8_t out_buf[1024] = {};
-
-    RAND_bytes(material, sizeof(material));
-    Aes128Gcm alice(material, sizeof(material));
-    Aes128Gcm bob(material, sizeof(material));
-    ;
-
-    ASSERT_GE(alice.EncryptedSize(sizeof(msg)), sizeof(msg));
-    auto encrypted_size = alice.Encrypt(msg, sizeof(msg), encrypted, sizeof(encrypted));
-    ASSERT_TRUE(encrypted_size.has_value());
-    ASSERT_GT(*encrypted_size, 0);
-    size_t out_size = sizeof(out_buf);
-    ASSERT_GE(bob.DecryptedSize(*encrypted_size), sizeof(msg));
-    auto decrypted_size = bob.Decrypt(encrypted, *encrypted_size, out_buf, out_size);
-    ASSERT_TRUE(decrypted_size.has_value());
-    ASSERT_EQ(sizeof(msg), *decrypted_size);
-    ASSERT_STREQ(reinterpret_cast<const char*>(msg), reinterpret_cast<const char*>(out_buf));
-}
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_auth/tests/pairing_auth_test.cpp b/adb/pairing_auth/tests/pairing_auth_test.cpp
deleted file mode 100644
index fdc07f1..0000000
--- a/adb/pairing_auth/tests/pairing_auth_test.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#define LOG_TAG "AdbPairingAuthTest"
-
-#include <gtest/gtest.h>
-
-#include <adb/pairing/pairing_auth.h>
-#include <android-base/endian.h>
-
-namespace adb {
-namespace pairing {
-
-static void PairingAuthDeleter(PairingAuthCtx* p) {
-    pairing_auth_destroy(p);
-}
-
-class AdbPairingAuthTest : public testing::Test {
-  protected:
-    virtual void SetUp() override {}
-
-    virtual void TearDown() override {}
-
-    using PairingAuthUniquePtr = std::unique_ptr<PairingAuthCtx, decltype(&PairingAuthDeleter)>;
-
-    PairingAuthUniquePtr makeClient(std::vector<uint8_t> pswd) {
-        return PairingAuthUniquePtr(pairing_auth_client_new(pswd.data(), pswd.size()),
-                                    PairingAuthDeleter);
-    }
-
-    PairingAuthUniquePtr makeServer(std::vector<uint8_t> pswd) {
-        return PairingAuthUniquePtr(pairing_auth_server_new(pswd.data(), pswd.size()),
-                                    PairingAuthDeleter);
-    }
-};
-
-TEST_F(AdbPairingAuthTest, EmptyPassword) {
-    // Context creation should fail if password is empty
-    PairingAuthUniquePtr client(nullptr, PairingAuthDeleter);
-    ASSERT_DEATH(
-            {
-                client = PairingAuthUniquePtr(pairing_auth_client_new(nullptr, 0),
-                                              PairingAuthDeleter);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                client = PairingAuthUniquePtr(pairing_auth_client_new(nullptr, 2),
-                                              PairingAuthDeleter);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                uint8_t p;
-                client = PairingAuthUniquePtr(pairing_auth_client_new(&p, 0), PairingAuthDeleter);
-            },
-            "");
-}
-
-TEST_F(AdbPairingAuthTest, ValidPassword) {
-    const char* kPswd = "password";
-    std::vector<uint8_t> pswd(kPswd, kPswd + sizeof(kPswd));
-    auto client = makeClient(pswd);
-    auto server = makeServer(pswd);
-
-    ASSERT_NE(nullptr, client);
-    ASSERT_NE(nullptr, server);
-
-    // msg should not be empty.
-    {
-        size_t msg_size = pairing_auth_msg_size(client.get());
-        std::vector<uint8_t> buf(msg_size);
-        ASSERT_GT(msg_size, 0);
-        pairing_auth_get_spake2_msg(client.get(), buf.data());
-    }
-    {
-        size_t msg_size = pairing_auth_msg_size(server.get());
-        std::vector<uint8_t> buf(msg_size);
-        ASSERT_GT(msg_size, 0);
-        pairing_auth_get_spake2_msg(server.get(), buf.data());
-    }
-}
-
-TEST_F(AdbPairingAuthTest, NoInitCipher) {
-    // Register a non-empty password, but not the peer's msg.
-    // You should not be able to encrypt/decrypt messages.
-    const char* kPswd = "password";
-    std::vector<uint8_t> pswd(kPswd, kPswd + sizeof(kPswd));
-    std::vector<uint8_t> data{0x01, 0x02, 0x03};
-    uint8_t outbuf[256];
-    size_t outsize;
-
-    // All other functions should crash if cipher hasn't been initialized.
-    ASSERT_DEATH(
-            {
-                auto server = makeServer(pswd);
-                pairing_auth_init_cipher(server.get(), nullptr, 0);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                auto server = makeServer(pswd);
-                pairing_auth_encrypt(server.get(), data.data(), data.size(), outbuf, &outsize);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                auto server = makeServer(pswd);
-                pairing_auth_decrypt(server.get(), data.data(), data.size(), outbuf, &outsize);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                auto server = makeServer(pswd);
-                pairing_auth_safe_decrypted_size(server.get(), data.data(), data.size());
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                auto server = makeServer(pswd);
-                pairing_auth_safe_encrypted_size(server.get(), data.size());
-            },
-            "");
-}
-
-TEST_F(AdbPairingAuthTest, DifferentPasswords) {
-    // Register different passwords and then exchange the msgs. The
-    // encryption should succeed, but the decryption should fail, since the
-    // ciphers have been initialized with different keys.
-    auto client = makeClient({0x01, 0x02, 0x03});
-    std::vector<uint8_t> client_msg(pairing_auth_msg_size(client.get()));
-    ASSERT_FALSE(client_msg.empty());
-    pairing_auth_get_spake2_msg(client.get(), client_msg.data());
-
-    auto server = makeServer({0x01, 0x02, 0x04});
-    std::vector<uint8_t> server_msg(pairing_auth_msg_size(server.get()));
-    ASSERT_FALSE(server_msg.empty());
-    pairing_auth_get_spake2_msg(server.get(), server_msg.data());
-
-    EXPECT_TRUE(pairing_auth_init_cipher(client.get(), server_msg.data(), server_msg.size()));
-    EXPECT_TRUE(pairing_auth_init_cipher(server.get(), client_msg.data(), client_msg.size()));
-
-    // We shouldn't be able to decrypt.
-    std::vector<uint8_t> msg{0x2a, 0x2b, 0x2c};
-    // Client encrypts, server can't decrypt
-    size_t out_size;
-    client_msg.resize(pairing_auth_safe_encrypted_size(client.get(), msg.size()));
-    ASSERT_GT(client_msg.size(), 0);
-    ASSERT_TRUE(pairing_auth_encrypt(client.get(), msg.data(), msg.size(), client_msg.data(),
-                                     &out_size));
-    ASSERT_GT(out_size, 0);
-    client_msg.resize(out_size);
-
-    server_msg.resize(
-            pairing_auth_safe_decrypted_size(server.get(), client_msg.data(), client_msg.size()));
-    ASSERT_GT(server_msg.size(), 0);
-    ASSERT_FALSE(pairing_auth_decrypt(server.get(), client_msg.data(), client_msg.size(),
-                                      server_msg.data(), &out_size));
-
-    // Server encrypts, client can't decrypt
-    server_msg.resize(pairing_auth_safe_encrypted_size(server.get(), msg.size()));
-    ASSERT_GT(server_msg.size(), 0);
-    ASSERT_TRUE(pairing_auth_encrypt(server.get(), msg.data(), msg.size(), server_msg.data(),
-                                     &out_size));
-    ASSERT_GT(out_size, 0);
-    server_msg.resize(out_size);
-
-    client_msg.resize(
-            pairing_auth_safe_decrypted_size(client.get(), server_msg.data(), server_msg.size()));
-    ASSERT_GT(client_msg.size(), 0);
-    ASSERT_FALSE(pairing_auth_decrypt(client.get(), server_msg.data(), server_msg.size(),
-                                      client_msg.data(), &out_size));
-}
-
-TEST_F(AdbPairingAuthTest, SamePasswords) {
-    // Register same password and then exchange the msgs. The
-    // encryption and decryption should succeed and have the same, unencrypted
-    // values.
-    std::vector<uint8_t> pswd{0x4f, 0x5a, 0x01, 0x46};
-    auto client = makeClient(pswd);
-    std::vector<uint8_t> client_msg(pairing_auth_msg_size(client.get()));
-    ASSERT_FALSE(client_msg.empty());
-    pairing_auth_get_spake2_msg(client.get(), client_msg.data());
-
-    auto server = makeServer(pswd);
-    std::vector<uint8_t> server_msg(pairing_auth_msg_size(server.get()));
-    ASSERT_FALSE(server_msg.empty());
-    pairing_auth_get_spake2_msg(server.get(), server_msg.data());
-
-    EXPECT_TRUE(pairing_auth_init_cipher(client.get(), server_msg.data(), server_msg.size()));
-    EXPECT_TRUE(pairing_auth_init_cipher(server.get(), client_msg.data(), client_msg.size()));
-
-    // We should be able to decrypt.
-    std::vector<uint8_t> msg{0x2a, 0x2b, 0x2c, 0xff, 0x45, 0x12, 0x33};
-    // Client encrypts, server decrypts
-    size_t out_size;
-    client_msg.resize(pairing_auth_safe_encrypted_size(client.get(), msg.size()));
-    ASSERT_GT(client_msg.size(), 0);
-    ASSERT_TRUE(pairing_auth_encrypt(client.get(), msg.data(), msg.size(), client_msg.data(),
-                                     &out_size));
-    ASSERT_GT(out_size, 0);
-    client_msg.resize(out_size);
-
-    server_msg.resize(
-            pairing_auth_safe_decrypted_size(server.get(), client_msg.data(), client_msg.size()));
-    ASSERT_GT(server_msg.size(), 0);
-    ASSERT_TRUE(pairing_auth_decrypt(server.get(), client_msg.data(), client_msg.size(),
-                                     server_msg.data(), &out_size));
-    ASSERT_EQ(out_size, msg.size());
-    EXPECT_EQ(memcmp(msg.data(), server_msg.data(), out_size), 0);
-
-    // Server encrypts, client decrypt
-    server_msg.resize(pairing_auth_safe_encrypted_size(server.get(), msg.size()));
-    ASSERT_GT(server_msg.size(), 0);
-    ASSERT_TRUE(pairing_auth_encrypt(server.get(), msg.data(), msg.size(), server_msg.data(),
-                                     &out_size));
-    ASSERT_GT(out_size, 0);
-    server_msg.resize(out_size);
-
-    client_msg.resize(
-            pairing_auth_safe_decrypted_size(client.get(), server_msg.data(), server_msg.size()));
-    ASSERT_GT(client_msg.size(), 0);
-    ASSERT_TRUE(pairing_auth_decrypt(client.get(), server_msg.data(), server_msg.size(),
-                                     client_msg.data(), &out_size));
-    ASSERT_EQ(out_size, msg.size());
-    EXPECT_EQ(memcmp(msg.data(), client_msg.data(), out_size), 0);
-}
-
-TEST_F(AdbPairingAuthTest, CorruptedPayload) {
-    // Do a matching password for both server/client, but let's fudge with the
-    // header payload field. The decryption should fail.
-    std::vector<uint8_t> pswd{0x4f, 0x5a, 0x01, 0x46};
-    auto client = makeClient(pswd);
-    std::vector<uint8_t> client_msg(pairing_auth_msg_size(client.get()));
-    ASSERT_FALSE(client_msg.empty());
-    pairing_auth_get_spake2_msg(client.get(), client_msg.data());
-
-    auto server = makeServer(pswd);
-    std::vector<uint8_t> server_msg(pairing_auth_msg_size(server.get()));
-    ASSERT_FALSE(server_msg.empty());
-    pairing_auth_get_spake2_msg(server.get(), server_msg.data());
-
-    EXPECT_TRUE(pairing_auth_init_cipher(client.get(), server_msg.data(), server_msg.size()));
-    EXPECT_TRUE(pairing_auth_init_cipher(server.get(), client_msg.data(), client_msg.size()));
-
-    std::vector<uint8_t> msg{0x2a, 0x2b, 0x2c, 0xff, 0x45, 0x12,
-                             0x33, 0x45, 0x12, 0xea, 0xf2, 0xdb};
-    {
-        // Client encrypts whole msg, server decrypts msg. Should be fine.
-        size_t out_size;
-        client_msg.resize(pairing_auth_safe_encrypted_size(client.get(), msg.size()));
-        ASSERT_GT(client_msg.size(), 0);
-        ASSERT_TRUE(pairing_auth_encrypt(client.get(), msg.data(), msg.size(), client_msg.data(),
-                                         &out_size));
-        ASSERT_GT(out_size, 0);
-        client_msg.resize(out_size);
-
-        server_msg.resize(pairing_auth_safe_decrypted_size(server.get(), client_msg.data(),
-                                                           client_msg.size()));
-        ASSERT_GT(server_msg.size(), 0);
-        ASSERT_TRUE(pairing_auth_decrypt(server.get(), client_msg.data(), client_msg.size(),
-                                         server_msg.data(), &out_size));
-        ASSERT_EQ(out_size, msg.size());
-        EXPECT_EQ(memcmp(msg.data(), server_msg.data(), out_size), 0);
-    }
-    {
-        // 1) Client encrypts msg
-        // 2) append some data to the encrypted msg
-        // 3) change the payload field
-        // 4) server tries to decrypt. It should fail.
-        size_t out_size;
-        client_msg.resize(pairing_auth_safe_encrypted_size(client.get(), msg.size()));
-        ASSERT_GT(client_msg.size(), 0);
-        ASSERT_TRUE(pairing_auth_encrypt(client.get(), msg.data(), msg.size(), client_msg.data(),
-                                         &out_size));
-        ASSERT_GT(out_size, 0);
-        client_msg.resize(out_size);
-        client_msg.push_back(0xaa);
-        // This requires knowledge of the layout of the data. payload is the
-        // first four bytes of the client_msg.
-        uint32_t* payload = reinterpret_cast<uint32_t*>(client_msg.data());
-        *payload = ntohl(*payload);
-        *payload = htonl(*payload + 1);
-
-        server_msg.resize(pairing_auth_safe_decrypted_size(server.get(), client_msg.data(),
-                                                           client_msg.size()));
-        ASSERT_GT(server_msg.size(), 0);
-        ASSERT_FALSE(pairing_auth_decrypt(server.get(), client_msg.data(), client_msg.size(),
-                                          server_msg.data(), &out_size));
-    }
-    {
-        // 1) Client encrypts msg
-        // 3) decrement the payload field
-        // 4) server tries to decrypt. It should fail.
-        size_t out_size;
-        client_msg.resize(pairing_auth_safe_encrypted_size(client.get(), msg.size()));
-        ASSERT_GT(client_msg.size(), 0);
-        ASSERT_TRUE(pairing_auth_encrypt(client.get(), msg.data(), msg.size(), client_msg.data(),
-                                         &out_size));
-        ASSERT_GT(out_size, 0);
-        client_msg.resize(out_size);
-        // This requires knowledge of the layout of the data. payload is the
-        // first four bytes of the client_msg.
-        uint32_t* payload = reinterpret_cast<uint32_t*>(client_msg.data());
-        *payload = ntohl(*payload);
-        *payload = htonl(*payload - 1);
-
-        server_msg.resize(pairing_auth_safe_decrypted_size(server.get(), client_msg.data(),
-                                                           client_msg.size()));
-        ASSERT_GT(server_msg.size(), 0);
-        ASSERT_FALSE(pairing_auth_decrypt(server.get(), client_msg.data(), client_msg.size(),
-                                          server_msg.data(), &out_size));
-    }
-}
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_connection/Android.bp b/adb/pairing_connection/Android.bp
deleted file mode 100644
index 707161b..0000000
--- a/adb/pairing_connection/Android.bp
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (C) 2020 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.
-
-cc_defaults {
-    name: "libadb_pairing_connection_defaults",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Wthread-safety",
-        "-Werror",
-    ],
-
-    compile_multilib: "both",
-
-    srcs: [
-        "pairing_connection.cpp",
-    ],
-    target: {
-        android: {
-            version_script: "libadb_pairing_connection.map.txt",
-        },
-        windows: {
-            compile_multilib: "first",
-            enabled: true,
-        },
-    },
-    export_include_dirs: ["include"],
-
-    visibility: [
-        "//art:__subpackages__",
-        "//system/core/adb:__subpackages__",
-        "//frameworks/base/services:__subpackages__",
-
-        // This needs to be visible to minadbd, even though it's removed via exclude_shared_libs.
-        "//bootable/recovery/minadbd:__subpackages__",
-    ],
-    apex_available: [
-        "com.android.adbd",
-    ],
-
-    // libadb_pairing_connection doesn't need an embedded build number.
-    use_version_lib: false,
-
-    stl: "libc++_static",
-
-    host_supported: true,
-    recovery_available: false,
-
-    static_libs: [
-        "libbase",
-        "libssl",
-    ],
-    shared_libs: [
-        "libcrypto",
-        "liblog",
-        "libadb_pairing_auth",
-    ],
-}
-
-cc_library {
-    name: "libadb_pairing_connection",
-    defaults: ["libadb_pairing_connection_defaults"],
-
-    apex_available: [
-        "com.android.adbd",
-    ],
-
-    stubs: {
-        symbol_file: "libadb_pairing_connection.map.txt",
-        versions: ["30"],
-    },
-
-    static_libs: [
-        "libadb_protos",
-        // Statically link libadb_tls_connection because it is not
-	// ABI-stable.
-        "libadb_tls_connection",
-        "libprotobuf-cpp-lite",
-    ],
-}
-
-// For running atest (b/147158681)
-cc_library_static {
-    name: "libadb_pairing_connection_static",
-    defaults: ["libadb_pairing_connection_defaults"],
-
-    apex_available: [
-        "//apex_available:platform",
-    ],
-
-    static_libs: [
-        "libadb_protos_static",
-        "libprotobuf-cpp-lite",
-        "libadb_tls_connection_static",
-    ],
-}
-
-cc_defaults {
-    name: "libadb_pairing_server_defaults",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Wthread-safety",
-        "-Werror",
-    ],
-
-    compile_multilib: "both",
-
-    srcs: [
-        "pairing_server.cpp",
-    ],
-    target: {
-        android: {
-            version_script: "libadb_pairing_server.map.txt",
-        },
-    },
-    export_include_dirs: ["include"],
-
-    visibility: [
-        "//art:__subpackages__",
-        "//system/core/adb:__subpackages__",
-        "//frameworks/base/services:__subpackages__",
-    ],
-
-    host_supported: true,
-    recovery_available: false,
-
-    stl: "libc++_static",
-
-    static_libs: [
-        "libbase",
-    ],
-    shared_libs: [
-        "libcrypto",
-        "libcrypto_utils",
-        "libcutils",
-        "liblog",
-        "libadb_pairing_auth",
-        "libadb_pairing_connection",
-    ],
-}
-
-cc_library {
-    name: "libadb_pairing_server",
-    defaults: ["libadb_pairing_server_defaults"],
-
-    apex_available: [
-        "com.android.adbd",
-    ],
-
-    stubs: {
-        symbol_file: "libadb_pairing_server.map.txt",
-        versions: ["30"],
-    },
-
-    static_libs: [
-        // Statically link libadb_crypto because it is not
-	// ABI-stable.
-        "libadb_crypto",
-        "libadb_protos",
-    ],
-}
-
-// For running atest (b/147158681)
-cc_library_static {
-    name: "libadb_pairing_server_static",
-    defaults: ["libadb_pairing_server_defaults"],
-
-    apex_available: [
-        "//apex_available:platform",
-    ],
-
-    static_libs: [
-        "libadb_crypto_static",
-        "libadb_protos_static",
-    ],
-}
diff --git a/adb/pairing_connection/include/adb/pairing/pairing_connection.h b/adb/pairing_connection/include/adb/pairing/pairing_connection.h
deleted file mode 100644
index 3543b87..0000000
--- a/adb/pairing_connection/include/adb/pairing/pairing_connection.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-#if !defined(__INTRODUCED_IN)
-#define __INTRODUCED_IN(__api_level) /* nothing */
-#endif
-
-// These APIs are for the Adb pairing protocol. This protocol requires both
-// sides to possess a shared secret to authenticate each other. The connection
-// is over TLS, and requires that both the client and server have a valid
-// certificate.
-//
-// This protocol is one-to-one, i.e., one PairingConnectionCtx server instance
-// interacts with only one PairingConnectionCtx client instance. In other words,
-// every new client instance must be bound to a new server instance.
-//
-// If both sides have authenticated, they will exchange their peer information
-// (see #PeerInfo).
-__BEGIN_DECLS
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
-
-const uint32_t kMaxPeerInfoSize = 8192;
-struct PeerInfo {
-    uint8_t type;
-    uint8_t data[kMaxPeerInfoSize - 1];
-} __attribute__((packed));
-typedef struct PeerInfo PeerInfo;
-static_assert(sizeof(PeerInfo) == kMaxPeerInfoSize, "PeerInfo has weird size");
-
-enum PeerInfoType : uint8_t {
-    ADB_RSA_PUB_KEY = 0,
-    ADB_DEVICE_GUID = 1,
-};
-
-struct PairingConnectionCtx;
-typedef struct PairingConnectionCtx PairingConnectionCtx;
-typedef void (*pairing_result_cb)(const PeerInfo*, int, void*);
-
-// Starts the pairing connection on a separate thread.
-//
-// Upon completion, if the pairing was successful,
-// |cb| will be called with the peer information and certificate.
-// Otherwise, |cb| will be called with empty data. |fd| should already
-// be opened. PairingConnectionCtx will take ownership of the |fd|.
-//
-// Pairing is successful if both server/client uses the same non-empty
-// |pswd|, and they are able to exchange the information. |pswd| and
-// |certificate| must be non-empty. start() can only be called once in the
-// lifetime of this object.
-//
-// @param ctx the PairingConnectionCtx instance. Will abort if null.
-// @param fd the fd connecting the peers. This will take ownership of fd.
-// @param cb the user-provided callback that is called with the result of the
-//        pairing. The callback will be called on a different thread from the
-//        caller.
-// @param opaque opaque userdata.
-// @return true if the thread was successfully started, false otherwise. To stop
-//         the connection process, destroy the instance (see
-//         #pairing_connection_destroy). If false is returned, cb will not be
-//         invoked. Otherwise, cb is guaranteed to be invoked, even if you
-//         destroy the ctx while in the pairing process.
-bool pairing_connection_start(PairingConnectionCtx* ctx, int fd, pairing_result_cb cb, void* opaque)
-        __INTRODUCED_IN(30);
-
-// Creates a new PairingConnectionCtx instance as the client.
-//
-// @param pswd the password to authenticate both peers. Will abort if null.
-// @param pswd_len the length of pswd. Will abort if 0.
-// @param peer_info the PeerInfo struct that is exchanged between peers if the
-//                  pairing was successful. Will abort if null.
-// @param x509_cert_pem the X.509 certificate in PEM format. Will abort if null.
-// @param x509_size the size of x509_cert_pem. Will abort if 0.
-// @param priv_key_pem the private key corresponding to the given X.509
-//                     certificate, in PEM format. Will abort if null.
-// @param priv_size the size of priv_key_pem. Will abort if 0.
-// @return a new PairingConnectionCtx client instance. The caller is responsible
-//         for destroying the context via #pairing_connection_destroy.
-PairingConnectionCtx* pairing_connection_client_new(const uint8_t* pswd, size_t pswd_len,
-                                                    const PeerInfo* peer_info,
-                                                    const uint8_t* x509_cert_pem, size_t x509_size,
-                                                    const uint8_t* priv_key_pem, size_t priv_size)
-        __INTRODUCED_IN(30);
-
-// Creates a new PairingConnectionCtx instance as the server.
-//
-// @param pswd the password to authenticate both peers. Will abort if null.
-// @param pswd_len the length of pswd. Will abort if 0.
-// @param peer_info the PeerInfo struct that is exchanged between peers if the
-//                  pairing was successful. Will abort if null.
-// @param x509_cert_pem the X.509 certificate in PEM format. Will abort if null.
-// @param x509_size the size of x509_cert_pem. Will abort if 0.
-// @param priv_key_pem the private key corresponding to the given X.509
-//                     certificate, in PEM format. Will abort if null.
-// @param priv_size the size of priv_key_pem. Will abort if 0.
-// @return a new PairingConnectionCtx server instance. The caller is responsible
-//         for destroying the context via #pairing_connection_destroy.
-PairingConnectionCtx* pairing_connection_server_new(const uint8_t* pswd, size_t pswd_len,
-                                                    const PeerInfo* peer_info,
-                                                    const uint8_t* x509_cert_pem, size_t x509_size,
-                                                    const uint8_t* priv_key_pem, size_t priv_size)
-        __INTRODUCED_IN(30);
-
-// Destroys the PairingConnectionCtx instance.
-//
-// It is safe to destroy the instance at any point in the pairing process.
-//
-// @param ctx the PairingConnectionCtx instance to destroy. Will abort if null.
-void pairing_connection_destroy(PairingConnectionCtx* ctx) __INTRODUCED_IN(30);
-
-#endif  //!__ANDROID__ || __ANDROID_API__ >= 30
-__END_DECLS
diff --git a/adb/pairing_connection/include/adb/pairing/pairing_server.h b/adb/pairing_connection/include/adb/pairing/pairing_server.h
deleted file mode 100644
index 178a174..0000000
--- a/adb/pairing_connection/include/adb/pairing/pairing_server.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-#include <functional>
-#include <memory>
-#include <string_view>
-#include <vector>
-
-#include "adb/pairing/pairing_connection.h"
-
-#if !defined(__INTRODUCED_IN)
-#define __INTRODUCED_IN(__api_level) /* nothing */
-#endif
-
-__BEGIN_DECLS
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
-
-// PairingServerCtx is a wrapper around the #PairingConnectionCtx APIs,
-// which handles multiple client connections.
-//
-// See pairing_connection_test.cpp for example usage.
-//
-struct PairingServerCtx;
-typedef struct PairingServerCtx PairingServerCtx;
-
-// Callback containing the result of the pairing. If #PeerInfo is null,
-// then the pairing failed. Otherwise, pairing succeeded and #PeerInfo
-// contains information about the peer.
-typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN(30);
-
-// Starts the pairing server.
-//
-// This call is non-blocking. Upon completion, if the pairing was successful,
-// then |cb| will be called with the PeerInfo
-// containing the info of the trusted peer. Otherwise, |cb| will be
-// called with an empty value. Start can only be called once in the lifetime
-// of this object.
-//
-// @param ctx the PairingServerCtx instance.
-// @param cb the user-provided callback to notify the result of the pairing. See
-//           #pairing_server_result_cb.
-// @param opaque the opaque userdata.
-// @return the port number the server is listening on. Returns 0 on failure.
-uint16_t pairing_server_start(PairingServerCtx* ctx, pairing_server_result_cb cb, void* opaque)
-        __INTRODUCED_IN(30);
-
-// Creates a new PairingServerCtx instance.
-//
-// @param pswd the password used to authenticate the client and server.
-// @param pswd_len the length of pswd.
-// @param peer_info the #PeerInfo struct passed to the client on successful
-//                  pairing.
-// @param x509_cert_pem the X.509 certificate in PEM format. Cannot be empty.
-// @param x509_size the size of x509_cert_pem.
-// @param priv_key_pem the private key corresponding to the given X.509
-//                     certificate, in PEM format. Cannot be empty.
-// @param priv_size the size of priv_key_pem.
-// @param port the port number the server should listen on. Must be within the
-//             valid port range [0, 65535]. If port is 0, then the server will
-//             find an open port to listen on. See #pairing_server_start to
-//             obtain the port used.
-// @return a new PairingServerCtx instance The caller is responsible
-//         for destroying the context via #pairing_server_destroy.
-PairingServerCtx* pairing_server_new(const uint8_t* pswd, size_t pswd_len,
-                                     const PeerInfo* peer_info, const uint8_t* x509_cert_pem,
-                                     size_t x509_size, const uint8_t* priv_key_pem,
-                                     size_t priv_size, uint16_t port) __INTRODUCED_IN(30);
-
-// Same as #pairing_server_new, except that the x509 certificate and private key
-// is generated internally.
-//
-// @param pswd the password used to authenticate the client and server.
-// @param pswd_len the length of pswd.
-// @param peer_info the #PeerInfo struct passed to the client on successful
-//                  pairing.
-// @param port the port number the server should listen on. Must be within the
-//             valid port range [0, 65535]. If port is 0, then the server will
-//             find an open port to listen on. See #pairing_server_start to
-//             obtain the port used.
-// @return a new PairingServerCtx instance The caller is responsible
-//         for destroying the context via #pairing_server_destroy.
-PairingServerCtx* pairing_server_new_no_cert(const uint8_t* pswd, size_t pswd_len,
-                                             const PeerInfo* peer_info, uint16_t port)
-        __INTRODUCED_IN(30);
-
-// Destroys the PairingServerCtx instance.
-//
-// @param ctx the PairingServerCtx instance to destroy.
-void pairing_server_destroy(PairingServerCtx* ctx) __INTRODUCED_IN(30);
-
-#endif  //!__ANDROID__ || __ANDROID_API__ >= 30
-__END_DECLS
diff --git a/adb/pairing_connection/internal/constants.h b/adb/pairing_connection/internal/constants.h
deleted file mode 100644
index 9a04f17..0000000
--- a/adb/pairing_connection/internal/constants.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-// This file contains constants that can be used both in the pairing_connection
-// code and tested in the pairing_connection_test code.
-namespace adb {
-namespace pairing {
-namespace internal {
-
-// The maximum number of connections the PairingServer can handle at once.
-constexpr int kMaxConnections = 10;
-// The maximum number of attempts the PairingServer will take before quitting.
-// This is to prevent someone malicious from quickly brute-forcing every
-// combination.
-constexpr int kMaxPairingAttempts = 20;
-
-}  // namespace internal
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_connection/libadb_pairing_connection.map.txt b/adb/pairing_connection/libadb_pairing_connection.map.txt
deleted file mode 100644
index abd5f16..0000000
--- a/adb/pairing_connection/libadb_pairing_connection.map.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-LIBADB_PAIRING_CONNECTION {
-  global:
-    pairing_connection_client_new; # apex introduced=30
-    pairing_connection_server_new; # apex introduced=30
-    pairing_connection_start; # apex introduced=30
-    pairing_connection_destroy; # apex introduced=30
-
-  local:
-    *;
-};
diff --git a/adb/pairing_connection/libadb_pairing_server.map.txt b/adb/pairing_connection/libadb_pairing_server.map.txt
deleted file mode 100644
index dc0dc89..0000000
--- a/adb/pairing_connection/libadb_pairing_server.map.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-LIBADB_PAIRING_SERVER {
-  global:
-    pairing_server_start; # apex introduced=30
-    pairing_server_new; # apex introduced=30
-    pairing_server_new_no_cert; # apex introduced=30
-    pairing_server_destroy; # apex introduced=30
-
-  local:
-    *;
-};
diff --git a/adb/pairing_connection/pairing_connection.cpp b/adb/pairing_connection/pairing_connection.cpp
deleted file mode 100644
index ffe49a9..0000000
--- a/adb/pairing_connection/pairing_connection.cpp
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "adb/pairing/pairing_connection.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <functional>
-#include <memory>
-#include <string_view>
-#include <thread>
-#include <vector>
-
-#include <adb/pairing/pairing_auth.h>
-#include <adb/tls/tls_connection.h>
-#include <android-base/endian.h>
-#include <android-base/logging.h>
-#include <android-base/macros.h>
-#include <android-base/unique_fd.h>
-
-#include "pairing.pb.h"
-
-using namespace adb;
-using android::base::unique_fd;
-using TlsError = tls::TlsConnection::TlsError;
-
-const uint8_t kCurrentKeyHeaderVersion = 1;
-const uint8_t kMinSupportedKeyHeaderVersion = 1;
-const uint8_t kMaxSupportedKeyHeaderVersion = 1;
-const uint32_t kMaxPayloadSize = kMaxPeerInfoSize * 2;
-
-struct PairingPacketHeader {
-    uint8_t version;   // PairingPacket version
-    uint8_t type;      // the type of packet (PairingPacket.Type)
-    uint32_t payload;  // Size of the payload in bytes
-} __attribute__((packed));
-
-struct PairingAuthDeleter {
-    void operator()(PairingAuthCtx* p) { pairing_auth_destroy(p); }
-};  // PairingAuthDeleter
-using PairingAuthPtr = std::unique_ptr<PairingAuthCtx, PairingAuthDeleter>;
-
-// PairingConnectionCtx encapsulates the protocol to authenticate two peers with
-// each other. This class will open the tcp sockets and handle the pairing
-// process. On completion, both sides will have each other's public key
-// (certificate) if successful, otherwise, the pairing failed. The tcp port
-// number is hardcoded (see pairing_connection.cpp).
-//
-// Each PairingConnectionCtx instance represents a different device trying to
-// pair. So for the device, we can have multiple PairingConnectionCtxs while the
-// host may have only one (unless host has a PairingServer).
-//
-// See pairing_connection_test.cpp for example usage.
-//
-struct PairingConnectionCtx {
-  public:
-    using Data = std::vector<uint8_t>;
-    using ResultCallback = pairing_result_cb;
-    enum class Role {
-        Client,
-        Server,
-    };
-
-    explicit PairingConnectionCtx(Role role, const Data& pswd, const PeerInfo& peer_info,
-                                  const Data& certificate, const Data& priv_key);
-    virtual ~PairingConnectionCtx();
-
-    // Starts the pairing connection on a separate thread.
-    // Upon completion, if the pairing was successful,
-    // |cb| will be called with the peer information and certificate.
-    // Otherwise, |cb| will be called with empty data. |fd| should already
-    // be opened. PairingConnectionCtx will take ownership of the |fd|.
-    //
-    // Pairing is successful if both server/client uses the same non-empty
-    // |pswd|, and they are able to exchange the information. |pswd| and
-    // |certificate| must be non-empty. Start() can only be called once in the
-    // lifetime of this object.
-    //
-    // Returns true if the thread was successfully started, false otherwise.
-    bool Start(int fd, ResultCallback cb, void* opaque);
-
-  private:
-    // Setup the tls connection.
-    bool SetupTlsConnection();
-
-    /************ PairingPacketHeader methods ****************/
-    // Tries to write out the header and payload.
-    bool WriteHeader(const PairingPacketHeader* header, std::string_view payload);
-    // Tries to parse incoming data into the |header|. Returns true if header
-    // is valid and header version is supported. |header| is filled on success.
-    // |header| may contain garbage if unsuccessful.
-    bool ReadHeader(PairingPacketHeader* header);
-    // Creates a PairingPacketHeader.
-    void CreateHeader(PairingPacketHeader* header, adb::proto::PairingPacket::Type type,
-                      uint32_t payload_size);
-    // Checks if actual matches expected.
-    bool CheckHeaderType(adb::proto::PairingPacket::Type expected, uint8_t actual);
-
-    /*********** State related methods **************/
-    // Handles the State::ExchangingMsgs state.
-    bool DoExchangeMsgs();
-    // Handles the State::ExchangingPeerInfo state.
-    bool DoExchangePeerInfo();
-
-    // The background task to do the pairing.
-    void StartWorker();
-
-    // Calls |cb_| and sets the state to Stopped.
-    void NotifyResult(const PeerInfo* p);
-
-    static PairingAuthPtr CreatePairingAuthPtr(Role role, const Data& pswd);
-
-    enum class State {
-        Ready,
-        ExchangingMsgs,
-        ExchangingPeerInfo,
-        Stopped,
-    };
-
-    std::atomic<State> state_{State::Ready};
-    Role role_;
-    Data pswd_;
-    PeerInfo peer_info_;
-    Data cert_;
-    Data priv_key_;
-
-    // Peer's info
-    PeerInfo their_info_;
-
-    ResultCallback cb_;
-    void* opaque_ = nullptr;
-    std::unique_ptr<tls::TlsConnection> tls_;
-    PairingAuthPtr auth_;
-    unique_fd fd_;
-    std::thread thread_;
-    static constexpr size_t kExportedKeySize = 64;
-};  // PairingConnectionCtx
-
-PairingConnectionCtx::PairingConnectionCtx(Role role, const Data& pswd, const PeerInfo& peer_info,
-                                           const Data& cert, const Data& priv_key)
-    : role_(role), pswd_(pswd), peer_info_(peer_info), cert_(cert), priv_key_(priv_key) {
-    CHECK(!pswd_.empty() && !cert_.empty() && !priv_key_.empty());
-}
-
-PairingConnectionCtx::~PairingConnectionCtx() {
-    // Force close the fd and wait for the worker thread to finish.
-    fd_.reset();
-    if (thread_.joinable()) {
-        thread_.join();
-    }
-}
-
-bool PairingConnectionCtx::SetupTlsConnection() {
-    tls_ = tls::TlsConnection::Create(
-            role_ == Role::Server ? tls::TlsConnection::Role::Server
-                                  : tls::TlsConnection::Role::Client,
-            std::string_view(reinterpret_cast<const char*>(cert_.data()), cert_.size()),
-            std::string_view(reinterpret_cast<const char*>(priv_key_.data()), priv_key_.size()),
-            fd_);
-
-    if (tls_ == nullptr) {
-        LOG(ERROR) << "Unable to start TlsConnection. Unable to pair fd=" << fd_.get();
-        return false;
-    }
-
-    // Allow any peer certificate
-    tls_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-
-    // SSL doesn't seem to behave correctly with fdevents so just do a blocking
-    // read for the pairing data.
-    if (tls_->DoHandshake() != TlsError::Success) {
-        LOG(ERROR) << "Failed to handshake with the peer fd=" << fd_.get();
-        return false;
-    }
-
-    // To ensure the connection is not stolen while we do the PAKE, append the
-    // exported key material from the tls connection to the password.
-    std::vector<uint8_t> exportedKeyMaterial = tls_->ExportKeyingMaterial(kExportedKeySize);
-    if (exportedKeyMaterial.empty()) {
-        LOG(ERROR) << "Failed to export key material";
-        return false;
-    }
-    pswd_.insert(pswd_.end(), std::make_move_iterator(exportedKeyMaterial.begin()),
-                 std::make_move_iterator(exportedKeyMaterial.end()));
-    auth_ = CreatePairingAuthPtr(role_, pswd_);
-
-    return true;
-}
-
-bool PairingConnectionCtx::WriteHeader(const PairingPacketHeader* header,
-                                       std::string_view payload) {
-    PairingPacketHeader network_header = *header;
-    network_header.payload = htonl(network_header.payload);
-    if (!tls_->WriteFully(std::string_view(reinterpret_cast<const char*>(&network_header),
-                                           sizeof(PairingPacketHeader))) ||
-        !tls_->WriteFully(payload)) {
-        LOG(ERROR) << "Failed to write out PairingPacketHeader";
-        state_ = State::Stopped;
-        return false;
-    }
-    return true;
-}
-
-bool PairingConnectionCtx::ReadHeader(PairingPacketHeader* header) {
-    auto data = tls_->ReadFully(sizeof(PairingPacketHeader));
-    if (data.empty()) {
-        return false;
-    }
-
-    uint8_t* p = data.data();
-    // First byte is always PairingPacketHeader version
-    header->version = *p;
-    ++p;
-    if (header->version < kMinSupportedKeyHeaderVersion ||
-        header->version > kMaxSupportedKeyHeaderVersion) {
-        LOG(ERROR) << "PairingPacketHeader version mismatch (us=" << kCurrentKeyHeaderVersion
-                   << " them=" << header->version << ")";
-        return false;
-    }
-    // Next byte is the PairingPacket::Type
-    if (!adb::proto::PairingPacket::Type_IsValid(*p)) {
-        LOG(ERROR) << "Unknown PairingPacket type=" << static_cast<uint32_t>(*p);
-        return false;
-    }
-    header->type = *p;
-    ++p;
-    // Last, the payload size
-    header->payload = ntohl(*(reinterpret_cast<uint32_t*>(p)));
-    if (header->payload == 0 || header->payload > kMaxPayloadSize) {
-        LOG(ERROR) << "header payload not within a safe payload size (size=" << header->payload
-                   << ")";
-        return false;
-    }
-
-    return true;
-}
-
-void PairingConnectionCtx::CreateHeader(PairingPacketHeader* header,
-                                        adb::proto::PairingPacket::Type type,
-                                        uint32_t payload_size) {
-    header->version = kCurrentKeyHeaderVersion;
-    uint8_t type8 = static_cast<uint8_t>(static_cast<int>(type));
-    header->type = type8;
-    header->payload = payload_size;
-}
-
-bool PairingConnectionCtx::CheckHeaderType(adb::proto::PairingPacket::Type expected_type,
-                                           uint8_t actual) {
-    uint8_t expected = *reinterpret_cast<uint8_t*>(&expected_type);
-    if (actual != expected) {
-        LOG(ERROR) << "Unexpected header type (expected=" << static_cast<uint32_t>(expected)
-                   << " actual=" << static_cast<uint32_t>(actual) << ")";
-        return false;
-    }
-    return true;
-}
-
-void PairingConnectionCtx::NotifyResult(const PeerInfo* p) {
-    cb_(p, fd_.get(), opaque_);
-    state_ = State::Stopped;
-}
-
-bool PairingConnectionCtx::Start(int fd, ResultCallback cb, void* opaque) {
-    if (fd < 0) {
-        return false;
-    }
-    fd_.reset(fd);
-
-    State expected = State::Ready;
-    if (!state_.compare_exchange_strong(expected, State::ExchangingMsgs)) {
-        return false;
-    }
-
-    cb_ = cb;
-    opaque_ = opaque;
-
-    thread_ = std::thread([this] { StartWorker(); });
-    return true;
-}
-
-bool PairingConnectionCtx::DoExchangeMsgs() {
-    uint32_t payload = pairing_auth_msg_size(auth_.get());
-    std::vector<uint8_t> msg(payload);
-    pairing_auth_get_spake2_msg(auth_.get(), msg.data());
-
-    PairingPacketHeader header;
-    CreateHeader(&header, adb::proto::PairingPacket::SPAKE2_MSG, payload);
-
-    // Write our SPAKE2 msg
-    if (!WriteHeader(&header,
-                     std::string_view(reinterpret_cast<const char*>(msg.data()), msg.size()))) {
-        LOG(ERROR) << "Failed to write SPAKE2 msg.";
-        return false;
-    }
-
-    // Read the peer's SPAKE2 msg header
-    if (!ReadHeader(&header)) {
-        LOG(ERROR) << "Invalid PairingPacketHeader.";
-        return false;
-    }
-    if (!CheckHeaderType(adb::proto::PairingPacket::SPAKE2_MSG, header.type)) {
-        return false;
-    }
-
-    // Read the SPAKE2 msg payload and initialize the cipher for
-    // encrypting the PeerInfo and certificate.
-    auto their_msg = tls_->ReadFully(header.payload);
-    if (their_msg.empty() ||
-        !pairing_auth_init_cipher(auth_.get(), their_msg.data(), their_msg.size())) {
-        LOG(ERROR) << "Unable to initialize pairing cipher [their_msg.size=" << their_msg.size()
-                   << "]";
-        return false;
-    }
-
-    return true;
-}
-
-bool PairingConnectionCtx::DoExchangePeerInfo() {
-    // Encrypt PeerInfo
-    std::vector<uint8_t> buf;
-    uint8_t* p = reinterpret_cast<uint8_t*>(&peer_info_);
-    buf.assign(p, p + sizeof(peer_info_));
-    std::vector<uint8_t> outbuf(pairing_auth_safe_encrypted_size(auth_.get(), buf.size()));
-    CHECK(!outbuf.empty());
-    size_t outsize;
-    if (!pairing_auth_encrypt(auth_.get(), buf.data(), buf.size(), outbuf.data(), &outsize)) {
-        LOG(ERROR) << "Failed to encrypt peer info";
-        return false;
-    }
-    outbuf.resize(outsize);
-
-    // Write out the packet header
-    PairingPacketHeader out_header;
-    out_header.version = kCurrentKeyHeaderVersion;
-    out_header.type = static_cast<uint8_t>(static_cast<int>(adb::proto::PairingPacket::PEER_INFO));
-    out_header.payload = htonl(outbuf.size());
-    if (!tls_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(&out_header), sizeof(out_header)))) {
-        LOG(ERROR) << "Unable to write PairingPacketHeader";
-        return false;
-    }
-
-    // Write out the encrypted payload
-    if (!tls_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(outbuf.data()), outbuf.size()))) {
-        LOG(ERROR) << "Unable to write encrypted peer info";
-        return false;
-    }
-
-    // Read in the peer's packet header
-    PairingPacketHeader header;
-    if (!ReadHeader(&header)) {
-        LOG(ERROR) << "Invalid PairingPacketHeader.";
-        return false;
-    }
-
-    if (!CheckHeaderType(adb::proto::PairingPacket::PEER_INFO, header.type)) {
-        return false;
-    }
-
-    // Read in the encrypted peer certificate
-    buf = tls_->ReadFully(header.payload);
-    if (buf.empty()) {
-        return false;
-    }
-
-    // Try to decrypt the certificate
-    outbuf.resize(pairing_auth_safe_decrypted_size(auth_.get(), buf.data(), buf.size()));
-    if (outbuf.empty()) {
-        LOG(ERROR) << "Unsupported payload while decrypting peer info.";
-        return false;
-    }
-
-    if (!pairing_auth_decrypt(auth_.get(), buf.data(), buf.size(), outbuf.data(), &outsize)) {
-        LOG(ERROR) << "Failed to decrypt";
-        return false;
-    }
-    outbuf.resize(outsize);
-
-    // The decrypted message should contain the PeerInfo.
-    if (outbuf.size() != sizeof(PeerInfo)) {
-        LOG(ERROR) << "Got size=" << outbuf.size() << "PeerInfo.size=" << sizeof(PeerInfo);
-        return false;
-    }
-
-    p = outbuf.data();
-    ::memcpy(&their_info_, p, sizeof(PeerInfo));
-    p += sizeof(PeerInfo);
-
-    return true;
-}
-
-void PairingConnectionCtx::StartWorker() {
-    // Setup the secure transport
-    if (!SetupTlsConnection()) {
-        NotifyResult(nullptr);
-        return;
-    }
-
-    for (;;) {
-        switch (state_) {
-            case State::ExchangingMsgs:
-                if (!DoExchangeMsgs()) {
-                    NotifyResult(nullptr);
-                    return;
-                }
-                state_ = State::ExchangingPeerInfo;
-                break;
-            case State::ExchangingPeerInfo:
-                if (!DoExchangePeerInfo()) {
-                    NotifyResult(nullptr);
-                    return;
-                }
-                NotifyResult(&their_info_);
-                return;
-            case State::Ready:
-            case State::Stopped:
-                LOG(FATAL) << __func__ << ": Got invalid state";
-                return;
-        }
-    }
-}
-
-// static
-PairingAuthPtr PairingConnectionCtx::CreatePairingAuthPtr(Role role, const Data& pswd) {
-    switch (role) {
-        case Role::Client:
-            return PairingAuthPtr(pairing_auth_client_new(pswd.data(), pswd.size()));
-            break;
-        case Role::Server:
-            return PairingAuthPtr(pairing_auth_server_new(pswd.data(), pswd.size()));
-            break;
-    }
-}
-
-static PairingConnectionCtx* CreateConnection(PairingConnectionCtx::Role role, const uint8_t* pswd,
-                                              size_t pswd_len, const PeerInfo* peer_info,
-                                              const uint8_t* x509_cert_pem, size_t x509_size,
-                                              const uint8_t* priv_key_pem, size_t priv_size) {
-    CHECK(pswd);
-    CHECK_GT(pswd_len, 0U);
-    CHECK(x509_cert_pem);
-    CHECK_GT(x509_size, 0U);
-    CHECK(priv_key_pem);
-    CHECK_GT(priv_size, 0U);
-    CHECK(peer_info);
-    std::vector<uint8_t> vec_pswd(pswd, pswd + pswd_len);
-    std::vector<uint8_t> vec_x509_cert(x509_cert_pem, x509_cert_pem + x509_size);
-    std::vector<uint8_t> vec_priv_key(priv_key_pem, priv_key_pem + priv_size);
-    return new PairingConnectionCtx(role, vec_pswd, *peer_info, vec_x509_cert, vec_priv_key);
-}
-
-PairingConnectionCtx* pairing_connection_client_new(const uint8_t* pswd, size_t pswd_len,
-                                                    const PeerInfo* peer_info,
-                                                    const uint8_t* x509_cert_pem, size_t x509_size,
-                                                    const uint8_t* priv_key_pem, size_t priv_size) {
-    return CreateConnection(PairingConnectionCtx::Role::Client, pswd, pswd_len, peer_info,
-                            x509_cert_pem, x509_size, priv_key_pem, priv_size);
-}
-
-PairingConnectionCtx* pairing_connection_server_new(const uint8_t* pswd, size_t pswd_len,
-                                                    const PeerInfo* peer_info,
-                                                    const uint8_t* x509_cert_pem, size_t x509_size,
-                                                    const uint8_t* priv_key_pem, size_t priv_size) {
-    return CreateConnection(PairingConnectionCtx::Role::Server, pswd, pswd_len, peer_info,
-                            x509_cert_pem, x509_size, priv_key_pem, priv_size);
-}
-
-void pairing_connection_destroy(PairingConnectionCtx* ctx) {
-    CHECK(ctx);
-    delete ctx;
-}
-
-bool pairing_connection_start(PairingConnectionCtx* ctx, int fd, pairing_result_cb cb,
-                              void* opaque) {
-    return ctx->Start(fd, cb, opaque);
-}
diff --git a/adb/pairing_connection/pairing_server.cpp b/adb/pairing_connection/pairing_server.cpp
deleted file mode 100644
index 7218eac..0000000
--- a/adb/pairing_connection/pairing_server.cpp
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "adb/pairing/pairing_server.h"
-
-#include <sys/epoll.h>
-#include <sys/eventfd.h>
-
-#include <atomic>
-#include <deque>
-#include <iomanip>
-#include <mutex>
-#include <sstream>
-#include <thread>
-#include <tuple>
-#include <unordered_map>
-#include <variant>
-#include <vector>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <adb/crypto/x509_generator.h>
-#include <adb/pairing/pairing_connection.h>
-#include <android-base/logging.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/thread_annotations.h>
-#include <android-base/unique_fd.h>
-#include <cutils/sockets.h>
-
-#include "internal/constants.h"
-
-using android::base::ScopedLockAssertion;
-using android::base::unique_fd;
-using namespace adb::crypto;
-using namespace adb::pairing;
-
-// The implementation has two background threads running: one to handle and
-// accept any new pairing connection requests (socket accept), and the other to
-// handle connection events (connection started, connection finished).
-struct PairingServerCtx {
-  public:
-    using Data = std::vector<uint8_t>;
-
-    virtual ~PairingServerCtx();
-
-    // All parameters must be non-empty.
-    explicit PairingServerCtx(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                              const Data& priv_key, uint16_t port);
-
-    // Starts the pairing server. This call is non-blocking. Upon completion,
-    // if the pairing was successful, then |cb| will be called with the PublicKeyHeader
-    // containing the info of the trusted peer. Otherwise, |cb| will be
-    // called with an empty value. Start can only be called once in the lifetime
-    // of this object.
-    //
-    // Returns the port number if PairingServerCtx was successfully started. Otherwise,
-    // returns 0.
-    uint16_t Start(pairing_server_result_cb cb, void* opaque);
-
-  private:
-    // Setup the server socket to accept incoming connections. Returns the
-    // server port number (> 0 on success).
-    uint16_t SetupServer();
-    // Force stop the server thread.
-    void StopServer();
-
-    // handles a new pairing client connection
-    bool HandleNewClientConnection(int fd) EXCLUDES(conn_mutex_);
-
-    // ======== connection events thread =============
-    std::mutex conn_mutex_;
-    std::condition_variable conn_cv_;
-
-    using FdVal = int;
-    struct ConnectionDeleter {
-        void operator()(PairingConnectionCtx* p) { pairing_connection_destroy(p); }
-    };
-    using ConnectionPtr = std::unique_ptr<PairingConnectionCtx, ConnectionDeleter>;
-    static ConnectionPtr CreatePairingConnection(const Data& pswd, const PeerInfo& peer_info,
-                                                 const Data& cert, const Data& priv_key);
-    using NewConnectionEvent = std::tuple<unique_fd, ConnectionPtr>;
-    // <fd, PeerInfo.type, PeerInfo.data>
-    using ConnectionFinishedEvent = std::tuple<FdVal, uint8_t, std::optional<std::string>>;
-    using ConnectionEvent = std::variant<NewConnectionEvent, ConnectionFinishedEvent>;
-    // Queue for connections to write into. We have a separate queue to read
-    // from, in order to minimize the time the server thread is blocked.
-    std::deque<ConnectionEvent> conn_write_queue_ GUARDED_BY(conn_mutex_);
-    std::deque<ConnectionEvent> conn_read_queue_;
-    // Map of fds to their PairingConnections currently running.
-    std::unordered_map<FdVal, ConnectionPtr> connections_;
-
-    // Two threads launched when starting the pairing server:
-    // 1) A server thread that waits for incoming client connections, and
-    // 2) A connection events thread that synchonizes events from all of the
-    //    clients, since each PairingConnection is running in it's own thread.
-    void StartConnectionEventsThread();
-    void StartServerThread();
-
-    static void PairingConnectionCallback(const PeerInfo* peer_info, int fd, void* opaque);
-
-    std::thread conn_events_thread_;
-    void ConnectionEventsWorker();
-    std::thread server_thread_;
-    void ServerWorker();
-    bool is_terminate_ GUARDED_BY(conn_mutex_) = false;
-
-    enum class State {
-        Ready,
-        Running,
-        Stopped,
-    };
-    State state_ = State::Ready;
-    Data pswd_;
-    PeerInfo peer_info_;
-    Data cert_;
-    Data priv_key_;
-    uint16_t port_;
-
-    pairing_server_result_cb cb_;
-    void* opaque_ = nullptr;
-    bool got_valid_pairing_ = false;
-
-    static const int kEpollConstSocket = 0;
-    // Used to break the server thread from epoll_wait
-    static const int kEpollConstEventFd = 1;
-    unique_fd epoll_fd_;
-    unique_fd server_fd_;
-    unique_fd event_fd_;
-};  // PairingServerCtx
-
-// static
-PairingServerCtx::ConnectionPtr PairingServerCtx::CreatePairingConnection(const Data& pswd,
-                                                                          const PeerInfo& peer_info,
-                                                                          const Data& cert,
-                                                                          const Data& priv_key) {
-    return ConnectionPtr(pairing_connection_server_new(pswd.data(), pswd.size(), &peer_info,
-                                                       cert.data(), cert.size(), priv_key.data(),
-                                                       priv_key.size()));
-}
-
-PairingServerCtx::PairingServerCtx(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                                   const Data& priv_key, uint16_t port)
-    : pswd_(pswd), peer_info_(peer_info), cert_(cert), priv_key_(priv_key), port_(port) {
-    CHECK(!pswd_.empty() && !cert_.empty() && !priv_key_.empty());
-}
-
-PairingServerCtx::~PairingServerCtx() {
-    // Since these connections have references to us, let's make sure they
-    // destruct before us.
-    if (server_thread_.joinable()) {
-        StopServer();
-        server_thread_.join();
-    }
-
-    {
-        std::lock_guard<std::mutex> lock(conn_mutex_);
-        is_terminate_ = true;
-    }
-    conn_cv_.notify_one();
-    if (conn_events_thread_.joinable()) {
-        conn_events_thread_.join();
-    }
-
-    // Notify the cb_ if it hasn't already.
-    if (!got_valid_pairing_ && cb_ != nullptr) {
-        cb_(nullptr, opaque_);
-    }
-}
-
-uint16_t PairingServerCtx::Start(pairing_server_result_cb cb, void* opaque) {
-    cb_ = cb;
-    opaque_ = opaque;
-
-    if (state_ != State::Ready) {
-        LOG(ERROR) << "PairingServerCtx already running or stopped";
-        return 0;
-    }
-
-    port_ = SetupServer();
-    if (port_ == 0) {
-        LOG(ERROR) << "Unable to start PairingServer";
-        state_ = State::Stopped;
-        return 0;
-    }
-    LOG(INFO) << "Pairing server started on port " << port_;
-
-    state_ = State::Running;
-    return port_;
-}
-
-void PairingServerCtx::StopServer() {
-    if (event_fd_.get() == -1) {
-        return;
-    }
-    uint64_t value = 1;
-    ssize_t rc = write(event_fd_.get(), &value, sizeof(value));
-    if (rc == -1) {
-        // This can happen if the server didn't start.
-        PLOG(ERROR) << "write to eventfd failed";
-    } else if (rc != sizeof(value)) {
-        LOG(FATAL) << "write to event returned short (" << rc << ")";
-    }
-}
-
-uint16_t PairingServerCtx::SetupServer() {
-    epoll_fd_.reset(epoll_create1(EPOLL_CLOEXEC));
-    if (epoll_fd_ == -1) {
-        PLOG(ERROR) << "failed to create epoll fd";
-        return 0;
-    }
-
-    event_fd_.reset(eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK));
-    if (event_fd_ == -1) {
-        PLOG(ERROR) << "failed to create eventfd";
-        return 0;
-    }
-
-    server_fd_.reset(socket_inaddr_any_server(port_, SOCK_STREAM));
-    if (server_fd_.get() == -1) {
-        PLOG(ERROR) << "Failed to start pairing connection server";
-        return 0;
-    } else if (fcntl(server_fd_.get(), F_SETFD, FD_CLOEXEC) != 0) {
-        PLOG(ERROR) << "Failed to make server socket cloexec";
-        return 0;
-    } else if (fcntl(server_fd_.get(), F_SETFD, O_NONBLOCK) != 0) {
-        PLOG(ERROR) << "Failed to make server socket nonblocking";
-        return 0;
-    }
-
-    StartConnectionEventsThread();
-    StartServerThread();
-    int port = socket_get_local_port(server_fd_.get());
-    return (port <= 0 ? 0 : port);
-}
-
-void PairingServerCtx::StartServerThread() {
-    server_thread_ = std::thread([this]() { ServerWorker(); });
-}
-
-void PairingServerCtx::StartConnectionEventsThread() {
-    conn_events_thread_ = std::thread([this]() { ConnectionEventsWorker(); });
-}
-
-void PairingServerCtx::ServerWorker() {
-    {
-        struct epoll_event event;
-        event.events = EPOLLIN;
-        event.data.u64 = kEpollConstSocket;
-        CHECK_EQ(0, epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, server_fd_.get(), &event));
-    }
-
-    {
-        struct epoll_event event;
-        event.events = EPOLLIN;
-        event.data.u64 = kEpollConstEventFd;
-        CHECK_EQ(0, epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, event_fd_.get(), &event));
-    }
-
-    while (true) {
-        struct epoll_event events[2];
-        int rc = TEMP_FAILURE_RETRY(epoll_wait(epoll_fd_.get(), events, 2, -1));
-        if (rc == -1) {
-            PLOG(ERROR) << "epoll_wait failed";
-            return;
-        } else if (rc == 0) {
-            LOG(ERROR) << "epoll_wait returned 0";
-            return;
-        }
-
-        for (int i = 0; i < rc; ++i) {
-            struct epoll_event& event = events[i];
-            switch (event.data.u64) {
-                case kEpollConstSocket:
-                    HandleNewClientConnection(server_fd_.get());
-                    break;
-                case kEpollConstEventFd:
-                    uint64_t dummy;
-                    int rc = TEMP_FAILURE_RETRY(read(event_fd_.get(), &dummy, sizeof(dummy)));
-                    if (rc != sizeof(dummy)) {
-                        PLOG(FATAL) << "failed to read from eventfd (rc=" << rc << ")";
-                    }
-                    return;
-            }
-        }
-    }
-}
-
-// static
-void PairingServerCtx::PairingConnectionCallback(const PeerInfo* peer_info, int fd, void* opaque) {
-    auto* p = reinterpret_cast<PairingServerCtx*>(opaque);
-
-    ConnectionFinishedEvent event;
-    if (peer_info != nullptr) {
-        if (peer_info->type == ADB_RSA_PUB_KEY) {
-            event = std::make_tuple(fd, peer_info->type,
-                                    std::string(reinterpret_cast<const char*>(peer_info->data)));
-        } else {
-            LOG(WARNING) << "Ignoring successful pairing because of unknown "
-                         << "PeerInfo type=" << peer_info->type;
-        }
-    } else {
-        event = std::make_tuple(fd, 0, std::nullopt);
-    }
-    {
-        std::lock_guard<std::mutex> lock(p->conn_mutex_);
-        p->conn_write_queue_.push_back(std::move(event));
-    }
-    p->conn_cv_.notify_one();
-}
-
-void PairingServerCtx::ConnectionEventsWorker() {
-    uint8_t num_tries = 0;
-    for (;;) {
-        // Transfer the write queue to the read queue.
-        {
-            std::unique_lock<std::mutex> lock(conn_mutex_);
-            ScopedLockAssertion assume_locked(conn_mutex_);
-
-            if (is_terminate_) {
-                // We check |is_terminate_| twice because condition_variable's
-                // notify() only wakes up a thread if it is in the wait state
-                // prior to notify(). Furthermore, we aren't holding the mutex
-                // when processing the events in |conn_read_queue_|.
-                return;
-            }
-            if (conn_write_queue_.empty()) {
-                // We need to wait for new events, or the termination signal.
-                conn_cv_.wait(lock, [this]() REQUIRES(conn_mutex_) {
-                    return (is_terminate_ || !conn_write_queue_.empty());
-                });
-            }
-            if (is_terminate_) {
-                // We're done.
-                return;
-            }
-            // Move all events into the read queue.
-            conn_read_queue_ = std::move(conn_write_queue_);
-            conn_write_queue_.clear();
-        }
-
-        // Process all events in the read queue.
-        while (conn_read_queue_.size() > 0) {
-            auto& event = conn_read_queue_.front();
-            if (auto* p = std::get_if<NewConnectionEvent>(&event)) {
-                // Ignore if we are already at the max number of connections
-                if (connections_.size() >= internal::kMaxConnections) {
-                    conn_read_queue_.pop_front();
-                    continue;
-                }
-                auto [ufd, connection] = std::move(*p);
-                int fd = ufd.release();
-                bool started = pairing_connection_start(connection.get(), fd,
-                                                        PairingConnectionCallback, this);
-                if (!started) {
-                    LOG(ERROR) << "PairingServer unable to start a PairingConnection fd=" << fd;
-                    ufd.reset(fd);
-                } else {
-                    connections_[fd] = std::move(connection);
-                }
-            } else if (auto* p = std::get_if<ConnectionFinishedEvent>(&event)) {
-                auto [fd, info_type, public_key] = std::move(*p);
-                if (public_key.has_value() && !public_key->empty()) {
-                    // Valid pairing. Let's shutdown the server and close any
-                    // pairing connections in progress.
-                    StopServer();
-                    connections_.clear();
-
-                    PeerInfo info = {};
-                    info.type = info_type;
-                    strncpy(reinterpret_cast<char*>(info.data), public_key->data(),
-                            public_key->size());
-
-                    cb_(&info, opaque_);
-
-                    got_valid_pairing_ = true;
-                    return;
-                }
-                // Invalid pairing. Close the invalid connection.
-                if (connections_.find(fd) != connections_.end()) {
-                    connections_.erase(fd);
-                }
-
-                if (++num_tries >= internal::kMaxPairingAttempts) {
-                    cb_(nullptr, opaque_);
-                    // To prevent the destructor from calling it again.
-                    cb_ = nullptr;
-                    return;
-                }
-            }
-            conn_read_queue_.pop_front();
-        }
-    }
-}
-
-bool PairingServerCtx::HandleNewClientConnection(int fd) {
-    unique_fd ufd(TEMP_FAILURE_RETRY(accept4(fd, nullptr, nullptr, SOCK_CLOEXEC)));
-    if (ufd == -1) {
-        PLOG(WARNING) << "adb_socket_accept failed fd=" << fd;
-        return false;
-    }
-    auto connection = CreatePairingConnection(pswd_, peer_info_, cert_, priv_key_);
-    if (connection == nullptr) {
-        LOG(ERROR) << "PairingServer unable to create a PairingConnection fd=" << fd;
-        return false;
-    }
-    // send the new connection to the connection thread for further processing
-    NewConnectionEvent event = std::make_tuple(std::move(ufd), std::move(connection));
-    {
-        std::lock_guard<std::mutex> lock(conn_mutex_);
-        conn_write_queue_.push_back(std::move(event));
-    }
-    conn_cv_.notify_one();
-
-    return true;
-}
-
-uint16_t pairing_server_start(PairingServerCtx* ctx, pairing_server_result_cb cb, void* opaque) {
-    return ctx->Start(cb, opaque);
-}
-
-PairingServerCtx* pairing_server_new(const uint8_t* pswd, size_t pswd_len,
-                                     const PeerInfo* peer_info, const uint8_t* x509_cert_pem,
-                                     size_t x509_size, const uint8_t* priv_key_pem,
-                                     size_t priv_size, uint16_t port) {
-    CHECK(pswd);
-    CHECK_GT(pswd_len, 0U);
-    CHECK(x509_cert_pem);
-    CHECK_GT(x509_size, 0U);
-    CHECK(priv_key_pem);
-    CHECK_GT(priv_size, 0U);
-    CHECK(peer_info);
-    std::vector<uint8_t> vec_pswd(pswd, pswd + pswd_len);
-    std::vector<uint8_t> vec_x509_cert(x509_cert_pem, x509_cert_pem + x509_size);
-    std::vector<uint8_t> vec_priv_key(priv_key_pem, priv_key_pem + priv_size);
-    return new PairingServerCtx(vec_pswd, *peer_info, vec_x509_cert, vec_priv_key, port);
-}
-
-PairingServerCtx* pairing_server_new_no_cert(const uint8_t* pswd, size_t pswd_len,
-                                             const PeerInfo* peer_info, uint16_t port) {
-    auto rsa_2048 = CreateRSA2048Key();
-    auto x509_cert = GenerateX509Certificate(rsa_2048->GetEvpPkey());
-    std::string pkey_pem = Key::ToPEMString(rsa_2048->GetEvpPkey());
-    std::string cert_pem = X509ToPEMString(x509_cert.get());
-
-    return pairing_server_new(pswd, pswd_len, peer_info,
-                              reinterpret_cast<const uint8_t*>(cert_pem.data()), cert_pem.size(),
-                              reinterpret_cast<const uint8_t*>(pkey_pem.data()), pkey_pem.size(),
-                              port);
-}
-
-void pairing_server_destroy(PairingServerCtx* ctx) {
-    CHECK(ctx);
-    delete ctx;
-}
diff --git a/adb/pairing_connection/tests/Android.bp b/adb/pairing_connection/tests/Android.bp
deleted file mode 100644
index bf075bc..0000000
--- a/adb/pairing_connection/tests/Android.bp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Copyright (C) 2020 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.
-//
-
-cc_test {
-    name: "adb_pairing_connection_test",
-    srcs: [
-        "pairing_client.cpp",
-        "pairing_connection_test.cpp",
-    ],
-
-    compile_multilib: "first",
-
-    shared_libs: [
-        "libbase",
-        "libcutils",
-        "libcrypto",
-        "libcrypto_utils",
-        "libprotobuf-cpp-lite",
-        "libssl",
-    ],
-
-    // Let's statically link them so we don't have to install it onto the
-    // system image for testing.
-    static_libs: [
-        "libadb_pairing_auth_static",
-        "libadb_pairing_connection_static",
-        "libadb_pairing_server_static",
-        "libadb_crypto_static",
-        "libadb_protos_static",
-        "libadb_tls_connection_static",
-    ],
-
-    test_suites: ["device-tests"],
-}
diff --git a/adb/pairing_connection/tests/pairing_client.cpp b/adb/pairing_connection/tests/pairing_client.cpp
deleted file mode 100644
index 1f3ef5a..0000000
--- a/adb/pairing_connection/tests/pairing_client.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "pairing_client.h"
-
-#include <netdb.h>
-#include <netinet/tcp.h>
-
-#include <atomic>
-#include <iomanip>
-#include <mutex>
-#include <sstream>
-#include <thread>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/stringprintf.h>
-#include <android-base/thread_annotations.h>
-#include <android-base/unique_fd.h>
-#include <cutils/sockets.h>
-
-namespace adb {
-namespace pairing {
-
-using android::base::unique_fd;
-
-static void ConnectionDeleter(PairingConnectionCtx* p) {
-    pairing_connection_destroy(p);
-}
-using ConnectionPtr = std::unique_ptr<PairingConnectionCtx, decltype(&ConnectionDeleter)>;
-
-namespace {
-
-class PairingClientImpl : public PairingClient {
-  public:
-    explicit PairingClientImpl(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                               const Data& priv_key);
-
-    // Starts the pairing client. This call is non-blocking. Upon pairing
-    // completion, |cb| will be called with the PeerInfo on success,
-    // or an empty value on failure.
-    //
-    // Returns true if PairingClient was successfully started. Otherwise,
-    // return false.
-    virtual bool Start(std::string_view ip_addr, pairing_client_result_cb cb,
-                       void* opaque) override;
-
-  private:
-    static ConnectionPtr CreatePairingConnection(const Data& pswd, const PeerInfo& peer_info,
-                                                 const Data& cert, const Data& priv_key);
-
-    static void PairingResultCallback(const PeerInfo* peer_info, int fd, void* opaque);
-    // Setup and start the PairingConnection
-    bool StartConnection();
-
-    enum class State {
-        Ready,
-        Running,
-        Stopped,
-    };
-
-    State state_ = State::Ready;
-    Data pswd_;
-    PeerInfo peer_info_;
-    Data cert_;
-    Data priv_key_;
-    std::string host_;
-    int port_;
-
-    ConnectionPtr connection_;
-    pairing_client_result_cb cb_;
-    void* opaque_ = nullptr;
-};  // PairingClientImpl
-
-// static
-ConnectionPtr PairingClientImpl::CreatePairingConnection(const Data& pswd,
-                                                         const PeerInfo& peer_info,
-                                                         const Data& cert, const Data& priv_key) {
-    return ConnectionPtr(
-            pairing_connection_client_new(pswd.data(), pswd.size(), &peer_info, cert.data(),
-                                          cert.size(), priv_key.data(), priv_key.size()),
-            ConnectionDeleter);
-}
-
-PairingClientImpl::PairingClientImpl(const Data& pswd, const PeerInfo& peer_info, const Data& cert,
-                                     const Data& priv_key)
-    : pswd_(pswd),
-      peer_info_(peer_info),
-      cert_(cert),
-      priv_key_(priv_key),
-      connection_(nullptr, ConnectionDeleter) {
-    CHECK(!pswd_.empty() && !cert_.empty() && !priv_key_.empty());
-
-    state_ = State::Ready;
-}
-
-bool PairingClientImpl::Start(std::string_view ip_addr, pairing_client_result_cb cb, void* opaque) {
-    CHECK(!ip_addr.empty());
-    cb_ = cb;
-    opaque_ = opaque;
-
-    if (state_ != State::Ready) {
-        LOG(ERROR) << "PairingClient already running or finished";
-        return false;
-    }
-
-    // Try to parse the host address
-    std::string err;
-    CHECK(android::base::ParseNetAddress(std::string(ip_addr), &host_, &port_, nullptr, &err));
-    CHECK(port_ > 0 && port_ <= 65535);
-
-    if (!StartConnection()) {
-        LOG(ERROR) << "Unable to start PairingClient connection";
-        state_ = State::Stopped;
-        return false;
-    }
-
-    state_ = State::Running;
-    return true;
-}
-
-static int network_connect(const std::string& host, int port, int type, int timeout,
-                           std::string* error) {
-    int getaddrinfo_error = 0;
-    int fd = socket_network_client_timeout(host.c_str(), port, type, timeout, &getaddrinfo_error);
-    if (fd != -1) {
-        return fd;
-    }
-    if (getaddrinfo_error != 0) {
-        *error = android::base::StringPrintf("failed to resolve host: '%s': %s", host.c_str(),
-                                             gai_strerror(getaddrinfo_error));
-        LOG(WARNING) << *error;
-    } else {
-        *error = android::base::StringPrintf("failed to connect to '%s:%d': %s", host.c_str(), port,
-                                             strerror(errno));
-        LOG(WARNING) << *error;
-    }
-    return -1;
-}
-
-// static
-void PairingClientImpl::PairingResultCallback(const PeerInfo* peer_info, int /* fd */,
-                                              void* opaque) {
-    auto* p = reinterpret_cast<PairingClientImpl*>(opaque);
-    p->cb_(peer_info, p->opaque_);
-}
-
-bool PairingClientImpl::StartConnection() {
-    std::string err;
-    const int timeout = 10;  // seconds
-    unique_fd fd(network_connect(host_, port_, SOCK_STREAM, timeout, &err));
-    if (fd.get() == -1) {
-        LOG(ERROR) << "Failed to start pairing connection client [" << err << "]";
-        return false;
-    }
-    int off = 1;
-    setsockopt(fd.get(), IPPROTO_TCP, TCP_NODELAY, &off, sizeof(off));
-
-    connection_ = CreatePairingConnection(pswd_, peer_info_, cert_, priv_key_);
-    if (connection_ == nullptr) {
-        LOG(ERROR) << "PairingClient unable to create a PairingConnection";
-        return false;
-    }
-
-    if (!pairing_connection_start(connection_.get(), fd.release(), PairingResultCallback, this)) {
-        LOG(ERROR) << "PairingClient failed to start the PairingConnection";
-        state_ = State::Stopped;
-        return false;
-    }
-
-    return true;
-}
-
-}  // namespace
-
-// static
-std::unique_ptr<PairingClient> PairingClient::Create(const Data& pswd, const PeerInfo& peer_info,
-                                                     const Data& cert, const Data& priv_key) {
-    CHECK(!pswd.empty());
-    CHECK(!cert.empty());
-    CHECK(!priv_key.empty());
-
-    return std::unique_ptr<PairingClient>(new PairingClientImpl(pswd, peer_info, cert, priv_key));
-}
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_connection/tests/pairing_client.h b/adb/pairing_connection/tests/pairing_client.h
deleted file mode 100644
index be0db5c..0000000
--- a/adb/pairing_connection/tests/pairing_client.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <functional>
-#include <memory>
-#include <string_view>
-#include <vector>
-
-#include "adb/pairing/pairing_connection.h"
-
-typedef void (*pairing_client_result_cb)(const PeerInfo*, void*);
-
-namespace adb {
-namespace pairing {
-
-// PairingClient is the client side of the PairingConnection protocol. It will
-// attempt to connect to a PairingServer specified at |host| and |port|, and
-// allocate a new PairingConnection for processing.
-//
-// See pairing_connection_test.cpp for example usage.
-//
-class PairingClient {
-  public:
-    using Data = std::vector<uint8_t>;
-
-    virtual ~PairingClient() = default;
-
-    // Starts the pairing client. This call is non-blocking. Upon completion,
-    // if the pairing was successful, then |cb| will be called with the PeerInfo
-    // containing the info of the trusted peer. Otherwise, |cb| will be
-    // called with an empty value. Start can only be called once in the lifetime
-    // of this object. |ip_addr| requires a port to be specified.
-    //
-    // Returns true if PairingClient was successfully started. Otherwise,
-    // returns false.
-    virtual bool Start(std::string_view ip_addr, pairing_client_result_cb cb, void* opaque) = 0;
-
-    // Creates a new PairingClient instance. May return null if unable
-    // to create an instance. |pswd|, |certificate|, |priv_key| and
-    // |ip_addr| cannot be empty. |peer_info| must contain non-empty strings for
-    // the guid and name fields.
-    static std::unique_ptr<PairingClient> Create(const Data& pswd, const PeerInfo& peer_info,
-                                                 const Data& certificate, const Data& priv_key);
-
-  protected:
-    PairingClient() = default;
-};  // class PairingClient
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/pairing_connection/tests/pairing_connection_test.cpp b/adb/pairing_connection/tests/pairing_connection_test.cpp
deleted file mode 100644
index b6e09f1..0000000
--- a/adb/pairing_connection/tests/pairing_connection_test.cpp
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#define LOG_TAG "AdbPairingConnectionTest"
-
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-#include <adb/pairing/pairing_server.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <gtest/gtest.h>
-
-#include "../internal/constants.h"
-#include "pairing_client.h"
-
-using namespace std::chrono_literals;
-
-namespace adb {
-namespace pairing {
-
-// Test X.509 certificates (RSA 2048)
-static const std::string kTestRsa2048ServerCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIDFzCCAf+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAtMQswCQYDVQQGEwJVUzEQ\n"
-        "MA4GA1UECgwHQW5kcm9pZDEMMAoGA1UEAwwDQWRiMB4XDTIwMDEyMTIyMjU1NVoX\n"
-        "DTMwMDExODIyMjU1NVowLTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJvaWQx\n"
-        "DDAKBgNVBAMMA0FkYjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK8E\n"
-        "2Ck9TfuKlz7wqWdMfknjZ1luFDp2IHxAUZzh/F6jeI2dOFGAjpeloSnGOE86FIaT\n"
-        "d1EvpyTh7nBwbrLZAA6XFZTo7Bl6BdNOQdqb2d2+cLEN0inFxqUIycevRtohUE1Y\n"
-        "FHM9fg442X1jOTWXjDZWeiqFWo95paAPhzm6pWqfJK1+YKfT1LsWZpYqJGGQE5pi\n"
-        "C3qOBYYgFpoXMxTYJNoZo3uOYEdM6upc8/vh15nMgIxX/ymJxEY5BHPpZPPWjXLg\n"
-        "BfzVaV9fUfv0JT4HQ4t2WvxC3cD/UsjWp2a6p454uUp2ENrANa+jRdRJepepg9D2\n"
-        "DKsx9L8zjc5Obqexrt0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B\n"
-        "Af8EBAMCAYYwHQYDVR0OBBYEFDFW+8GTErwoZN5Uu9KyY4QdGYKpMA0GCSqGSIb3\n"
-        "DQEBCwUAA4IBAQBCDEn6SHXGlq5TU7J8cg1kRPd9bsJW+0hDuKSq0REXDkl0PcBf\n"
-        "fy282Agg9enKPPKmnpeQjM1dmnxdM8tT8LIUbMl779i3fn6v9HJVB+yG4gmRFThW\n"
-        "c+AGlBnrIT820cX/gU3h3R3FTahfsq+1rrSJkEgHyuC0HYeRyveSckBdaEOLvx0S\n"
-        "toun+32JJl5hWydpUUZhE9Mbb3KHBRM2YYZZU9JeJ08Apjl+3lRUeMAUwI5fkAAu\n"
-        "z/1SqnuGL96bd8P5ixdkA1+rF8FPhodGcq9mQOuUGP9g5HOXjaNoJYvwVRUdLeGh\n"
-        "cP/ReOTwQIzM1K5a83p8cX8AGGYmM7dQp7ec\n"
-        "-----END CERTIFICATE-----\n";
-
-static const std::string kTestRsa2048ServerPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCvBNgpPU37ipc+\n"
-        "8KlnTH5J42dZbhQ6diB8QFGc4fxeo3iNnThRgI6XpaEpxjhPOhSGk3dRL6ck4e5w\n"
-        "cG6y2QAOlxWU6OwZegXTTkHam9ndvnCxDdIpxcalCMnHr0baIVBNWBRzPX4OONl9\n"
-        "Yzk1l4w2VnoqhVqPeaWgD4c5uqVqnyStfmCn09S7FmaWKiRhkBOaYgt6jgWGIBaa\n"
-        "FzMU2CTaGaN7jmBHTOrqXPP74deZzICMV/8picRGOQRz6WTz1o1y4AX81WlfX1H7\n"
-        "9CU+B0OLdlr8Qt3A/1LI1qdmuqeOeLlKdhDawDWvo0XUSXqXqYPQ9gyrMfS/M43O\n"
-        "Tm6nsa7dAgMBAAECggEAFCS2bPdUKIgjbzLgtHW+hT+J2hD20rcHdyAp+dNH/2vI\n"
-        "yLfDJHJA4chGMRondKA704oDw2bSJxxlG9t83326lB35yxPhye7cM8fqgWrK8PVl\n"
-        "tU22FhO1ZgeJvb9OeXWNxKZyDW9oOOJ8eazNXVMuEo+dFj7B6l3MXQyHJPL2mJDm\n"
-        "u9ofFLdypX+gJncVO0oW0FNJnEUn2MMwHDNlo7gc4WdQuidPkuZItKRGcB8TTGF3\n"
-        "Ka1/2taYdTQ4Aq//Z84LlFvE0zD3T4c8LwYYzOzD4gGGTXvft7vSHzIun1S8YLRS\n"
-        "dEKXdVjtaFhgH3uUe4j+1b/vMvSHeoGBNX/G88GD+wKBgQDWUYVlMVqc9HD2IeYi\n"
-        "EfBcNwAJFJkh51yAl5QbUBgFYgFJVkkS/EDxEGFPvEmI3/pAeQFHFY13BI466EPs\n"
-        "o8Z8UUwWDp+Z1MFHHKQKnFakbsZbZlbqjJ9VJsqpezbpWhMHTOmcG0dmE7rf0lyM\n"
-        "eQv9slBB8qp2NEUs5Of7f2C2bwKBgQDRDq4nUuMQF1hbjM05tGKSIwkobmGsLspv\n"
-        "TMhkM7fq4RpbFHmbNgsFqMhcqYZ8gY6/scv5KCuAZ4yHUkbqwf5h+QCwrJ4uJeUJ\n"
-        "ZgJfHus2mmcNSo8FwSkNoojIQtzcbJav7bs2K9VTuertk/i7IJLApU4FOZZ5pghN\n"
-        "EXu0CZF1cwKBgDWFGhjRIF29tU/h20R60llU6s9Zs3wB+NmsALJpZ/ZAKS4VPB5f\n"
-        "nCAXBRYSYRKrTCU5kpYbzb4BBzuysPOxWmnFK4j+keCqfrGxd02nCQP7HdHJVr8v\n"
-        "6sIq88UrHeVcNxBFprjzHvtgxfQK5k22FMZ/9wbhAKyQFQ5HA5+MiaxFAoGAIcZZ\n"
-        "ZIkDninnYIMS9OursShv5lRO+15j3i9tgKLKZ+wOMgDQ1L6acUOfezj4PU1BHr8+\n"
-        "0PYocQpJreMhCfRlgLaV4fVBaPs+UZJld7CrF5tCYudUy/01ALrtlk0XGZWBktK5\n"
-        "mDrksC4tQkzRtonAq9cJD9cJ9IVaefkFH0UcdvkCgYBpZj50VLeGhnHHBnkJRlV1\n"
-        "fV+/P6PAq6RtqjA6O9Qdaoj5V3w2d63aQcQXQLJjH2BBmtCIy47r04rFvZpbCxP7\n"
-        "NH/OnK9NHpk2ucRTe8TAnVbvF/TZzPJoIxAO/D3OWaW6df4R8en8u6GYzWFglAyT\n"
-        "sydGT8yfWD1FYUWgfrVRbg==\n"
-        "-----END PRIVATE KEY-----\n";
-
-static const std::string kTestRsa2048ClientCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIDFzCCAf+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAtMQswCQYDVQQGEwJVUzEQ\n"
-        "MA4GA1UECgwHQW5kcm9pZDEMMAoGA1UEAwwDQWRiMB4XDTIwMDEyMTIyMjU1NloX\n"
-        "DTMwMDExODIyMjU1NlowLTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJvaWQx\n"
-        "DDAKBgNVBAMMA0FkYjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI3a\n"
-        "EXh1S5FTbet7JVONswffRPaekdIK53cb8SnAbSO9X5OLA4zGwdkrBvDTsd96SKrp\n"
-        "JxmoNOE1DhbZh05KPlWAPkGKacjGWaz+S7biDOL0I6aaLbTlU/il1Ub9olPSBVUx\n"
-        "0nhdtEFgIOzddnP6/1KmyIIeRxS5lTKeg4avqUkZNXkz/wL1dHBFL7FNFf0SCcbo\n"
-        "tsub/deFbjZ27LTDN+SIBgFttTNqC5NTvoBAoMdyCOAgNYwaHO+fKiK3edfJieaw\n"
-        "7HD8qqmQxcpCtRlA8CUPj7GfR+WHiCJmlevhnkFXCo56R1BS0F4wuD4KPdSWt8gc\n"
-        "27ejH/9/z2cKo/6SLJMCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B\n"
-        "Af8EBAMCAYYwHQYDVR0OBBYEFO/Mr5ygqqpyU/EHM9v7RDvcqaOkMA0GCSqGSIb3\n"
-        "DQEBCwUAA4IBAQAH33KMouzF2DYbjg90KDrDQr4rq3WfNb6P743knxdUFuvb+40U\n"
-        "QjC2OJZHkSexH7wfG/y6ic7vfCfF4clNs3QvU1lEjOZC57St8Fk7mdNdsWLwxEMD\n"
-        "uePFz0dvclSxNUHyCVMqNxddzQYzxiDWQRmXWrUBliMduQqEQelcxW2yDtg8bj+s\n"
-        "aMpR1ra9scaD4jzIZIIxLoOS9zBMuNRbgP217sZrniyGMhzoI1pZ/izN4oXpyH7O\n"
-        "THuaCzzRT3ph2f8EgmHSodz3ttgSf2DHzi/Ez1xUkk7NOlgNtmsxEdrM47+cC5ae\n"
-        "fIf2V+1o1JW8J7D11RmRbNPh3vfisueB4f88\n"
-        "-----END CERTIFICATE-----\n";
-
-static const std::string kTestRsa2048ClientPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCN2hF4dUuRU23r\n"
-        "eyVTjbMH30T2npHSCud3G/EpwG0jvV+TiwOMxsHZKwbw07Hfekiq6ScZqDThNQ4W\n"
-        "2YdOSj5VgD5BimnIxlms/ku24gzi9COmmi205VP4pdVG/aJT0gVVMdJ4XbRBYCDs\n"
-        "3XZz+v9SpsiCHkcUuZUynoOGr6lJGTV5M/8C9XRwRS+xTRX9EgnG6LbLm/3XhW42\n"
-        "duy0wzfkiAYBbbUzaguTU76AQKDHcgjgIDWMGhzvnyoit3nXyYnmsOxw/KqpkMXK\n"
-        "QrUZQPAlD4+xn0flh4giZpXr4Z5BVwqOekdQUtBeMLg+Cj3UlrfIHNu3ox//f89n\n"
-        "CqP+kiyTAgMBAAECggEAAa64eP6ggCob1P3c73oayYPIbvRqiQdAFOrr7Vwu7zbr\n"
-        "z0rde+n6RU0mrpc+4NuzyPMtrOGQiatLbidJB5Cx3z8U00ovqbCl7PtcgorOhFKe\n"
-        "VEzihebCcYyQqbWQcKtpDMhOgBxRwFoXieJb6VGXfa96FAZalCWvXgOrTl7/BF2X\n"
-        "qMqIm9nJi+yS5tIO8VdOsOmrMWRH/b/ENUcef4WpLoxTXr0EEgyKWraeZ/hhXo1e\n"
-        "z29dZKqdr9wMsq11NPsRddwS94jnDkXTo+EQyWVTfB7gb6yyp07s8jysaDb21tVv\n"
-        "UXB9MRhDV1mOv0ncXfXZ4/+4A2UahmZaLDAVLaat4QKBgQDAVRredhGRGl2Nkic3\n"
-        "KvZCAfyxug788CgasBdEiouz19iCCwcgMIDwnq0s3/WM7h/laCamT2x38riYDnpq\n"
-        "rkYMfuVtU9CjEL9pTrdfwbIRhTwYNqADaPz2mXwQUhRXutE5TIdgxxC/a+ZTh0qN\n"
-        "S+vhTj/4hf0IZhMh5Nqj7IPExQKBgQC8zxEzhmSGjys0GuE6Wl6Doo2TpiR6vwvi\n"
-        "xPLU9lmIz5eca/Rd/eERioFQqeoIWDLzx52DXuz6rUoQhbJWz9hP3yqCwXD+pbNP\n"
-        "oDJqDDbCC4IMYEb0IK/PEPH+gIpnTjoFcW+ecKDFG7W5Lt05J8WsJsfOaJvMrOU+\n"
-        "dLXq3IgxdwKBgQC5RAFq0v6e8G+3hFaEHL0z3igkpt3zJf7rnj37hx2FMmDa+3Z0\n"
-        "umQp5B9af61PgL12xLmeMBmC/Wp1BlVDV/Yf6Uhk5Hyv5t0KuomHEtTNbbLyfAPs\n"
-        "5P/vJu/L5NS1oT4S3LX3MineyjgGs+bLbpub3z1dzutrYLADUSiPCK/xJQKBgBQt\n"
-        "nQ0Ao+Wtj1R2OvPdjJRM3wyUiPmFSWPm4HzaBx+T8AQLlYYmB9O0FbXlMtnJc0iS\n"
-        "YMcVcgYoVu4FG9YjSF7g3s4yljzgwJUV7c1fmMqMKE3iTDLy+1cJ3JLycdgwiArk\n"
-        "4KTyLHxkRbuQwpvFIF8RlfD9RQlOwQE3v+llwDhpAoGBAL6XG6Rp6mBoD2Ds5c9R\n"
-        "943yYgSUes3ji1SI9zFqeJtj8Ml/enuK1xu+8E/BxB0//+vgZsH6i3i8GFwygKey\n"
-        "CGJF8CbiHc3EJc3NQIIRXcni/CGacf0HwC6m+PGFDBIpA4H2iDpVvCSofxttQiq0\n"
-        "/Z7HXmXUvZHVyYi/QzX2Gahj\n"
-        "-----END PRIVATE KEY-----\n";
-
-struct ServerDeleter {
-    void operator()(PairingServerCtx* p) { pairing_server_destroy(p); }
-};
-using ServerPtr = std::unique_ptr<PairingServerCtx, ServerDeleter>;
-
-struct ResultWaiter {
-    std::mutex mutex_;
-    std::condition_variable cv_;
-    std::optional<bool> is_valid_;
-    PeerInfo peer_info_;
-
-    static void ResultCallback(const PeerInfo* peer_info, void* opaque) {
-        auto* p = reinterpret_cast<ResultWaiter*>(opaque);
-        {
-            std::unique_lock<std::mutex> lock(p->mutex_);
-            if (peer_info) {
-                memcpy(&(p->peer_info_), peer_info, sizeof(PeerInfo));
-            }
-            p->is_valid_ = (peer_info != nullptr);
-        }
-        p->cv_.notify_one();
-    }
-};
-
-class AdbPairingConnectionTest : public testing::Test {
-  protected:
-    virtual void SetUp() override {}
-
-    virtual void TearDown() override {}
-
-    void InitPairing(const std::vector<uint8_t>& server_pswd,
-                     const std::vector<uint8_t>& client_pswd) {
-        server_ = CreateServer(server_pswd);
-        client_ = CreateClient(client_pswd);
-    }
-
-    ServerPtr CreateServer(const std::vector<uint8_t>& pswd) {
-        return CreateServer(pswd, &server_info_, kTestRsa2048ServerCert, kTestRsa2048ServerPrivKey,
-                            0);
-    }
-
-    std::unique_ptr<PairingClient> CreateClient(const std::vector<uint8_t> pswd) {
-        std::vector<uint8_t> cert;
-        std::vector<uint8_t> key;
-        // Include the null-byte as well.
-        cert.assign(reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-                    reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()) +
-                            kTestRsa2048ClientCert.size() + 1);
-        key.assign(reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-                   reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()) +
-                           kTestRsa2048ClientPrivKey.size() + 1);
-        return PairingClient::Create(pswd, client_info_, cert, key);
-    }
-
-    static ServerPtr CreateServer(const std::vector<uint8_t>& pswd, const PeerInfo* peer_info,
-                                  const std::string_view cert, const std::string_view priv_key,
-                                  int port) {
-        return ServerPtr(pairing_server_new(
-                pswd.data(), pswd.size(), peer_info, reinterpret_cast<const uint8_t*>(cert.data()),
-                cert.size(), reinterpret_cast<const uint8_t*>(priv_key.data()), priv_key.size(),
-                port));
-    }
-
-    ServerPtr server_;
-    const PeerInfo server_info_ = {
-            .type = ADB_DEVICE_GUID,
-            .data = "my_server_info",
-    };
-    std::unique_ptr<PairingClient> client_;
-    const PeerInfo client_info_ = {
-            .type = ADB_RSA_PUB_KEY,
-            .data = "my_client_info",
-    };
-    std::string ip_addr_ = "127.0.0.1:";
-};
-
-TEST_F(AdbPairingConnectionTest, ServerCreation) {
-    // All parameters bad
-    ASSERT_DEATH({ auto server = CreateServer({}, nullptr, "", "", 0); }, "");
-    // Bad password
-    ASSERT_DEATH(
-            {
-                auto server = CreateServer({}, &server_info_, kTestRsa2048ServerCert,
-                                           kTestRsa2048ServerPrivKey, 0);
-            },
-            "");
-    // Bad peer_info
-    ASSERT_DEATH(
-            {
-                auto server = CreateServer({0x01}, nullptr, kTestRsa2048ServerCert,
-                                           kTestRsa2048ServerPrivKey, 0);
-            },
-            "");
-    // Bad certificate
-    ASSERT_DEATH(
-            {
-                auto server = CreateServer({0x01}, &server_info_, "", kTestRsa2048ServerPrivKey, 0);
-            },
-            "");
-    // Bad private key
-    ASSERT_DEATH(
-            { auto server = CreateServer({0x01}, &server_info_, kTestRsa2048ServerCert, "", 0); },
-            "");
-    // Valid params
-    auto server = CreateServer({0x01}, &server_info_, kTestRsa2048ServerCert,
-                               kTestRsa2048ServerPrivKey, 0);
-    EXPECT_NE(nullptr, server);
-}
-
-TEST_F(AdbPairingConnectionTest, ClientCreation) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    // Bad password
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        nullptr, pswd.size(), &client_info_,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-                        kTestRsa2048ClientCert.size(),
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-                        kTestRsa2048ClientPrivKey.size());
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        pswd.data(), 0, &client_info_,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-                        kTestRsa2048ClientCert.size(),
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-                        kTestRsa2048ClientPrivKey.size());
-            },
-            "");
-
-    // Bad peer_info
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        pswd.data(), pswd.size(), nullptr,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-                        kTestRsa2048ClientCert.size(),
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-                        kTestRsa2048ClientPrivKey.size());
-            },
-            "");
-
-    // Bad certificate
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        pswd.data(), pswd.size(), &client_info_, nullptr,
-                        kTestRsa2048ClientCert.size(),
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-                        kTestRsa2048ClientPrivKey.size());
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        pswd.data(), pswd.size(), &client_info_,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()), 0,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-                        kTestRsa2048ClientPrivKey.size());
-            },
-            "");
-
-    // Bad private key
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        pswd.data(), pswd.size(), &client_info_,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-                        kTestRsa2048ClientCert.size(), nullptr, kTestRsa2048ClientPrivKey.size());
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                pairing_connection_client_new(
-                        pswd.data(), pswd.size(), &client_info_,
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-                        kTestRsa2048ClientCert.size(),
-                        reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()), 0);
-            },
-            "");
-
-    // Valid params
-    auto client = pairing_connection_client_new(
-            pswd.data(), pswd.size(), &client_info_,
-            reinterpret_cast<const uint8_t*>(kTestRsa2048ClientCert.data()),
-            kTestRsa2048ClientCert.size(),
-            reinterpret_cast<const uint8_t*>(kTestRsa2048ClientPrivKey.data()),
-            kTestRsa2048ClientPrivKey.size());
-    EXPECT_NE(nullptr, client);
-}
-
-TEST_F(AdbPairingConnectionTest, SmokeValidPairing) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    InitPairing(pswd, pswd);
-
-    // Start the server
-    ResultWaiter server_waiter;
-    std::unique_lock<std::mutex> server_lock(server_waiter.mutex_);
-    auto port = pairing_server_start(server_.get(), server_waiter.ResultCallback, &server_waiter);
-    ASSERT_GT(port, 0);
-    ip_addr_ += std::to_string(port);
-
-    // Start the client
-    ResultWaiter client_waiter;
-    std::unique_lock<std::mutex> client_lock(client_waiter.mutex_);
-    ASSERT_TRUE(client_->Start(ip_addr_, client_waiter.ResultCallback, &client_waiter));
-    client_waiter.cv_.wait(client_lock, [&]() { return client_waiter.is_valid_.has_value(); });
-    ASSERT_TRUE(*(client_waiter.is_valid_));
-    ASSERT_EQ(strlen(reinterpret_cast<const char*>(client_waiter.peer_info_.data)),
-              strlen(reinterpret_cast<const char*>(server_info_.data)));
-    EXPECT_EQ(memcmp(client_waiter.peer_info_.data, server_info_.data, sizeof(server_info_.data)),
-              0);
-
-    // Kill server if the pairing failed, since server only shuts down when
-    // it gets a valid pairing.
-    if (!client_waiter.is_valid_) {
-        server_lock.unlock();
-        server_.reset();
-    } else {
-        server_waiter.cv_.wait(server_lock, [&]() { return server_waiter.is_valid_.has_value(); });
-        ASSERT_TRUE(*(server_waiter.is_valid_));
-        ASSERT_EQ(strlen(reinterpret_cast<const char*>(server_waiter.peer_info_.data)),
-                  strlen(reinterpret_cast<const char*>(client_info_.data)));
-        EXPECT_EQ(
-                memcmp(server_waiter.peer_info_.data, client_info_.data, sizeof(client_info_.data)),
-                0);
-    }
-}
-
-TEST_F(AdbPairingConnectionTest, CancelPairing) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    std::vector<uint8_t> pswd2{0x01, 0x03, 0x05, 0x06};
-    InitPairing(pswd, pswd2);
-
-    // Start the server
-    ResultWaiter server_waiter;
-    std::unique_lock<std::mutex> server_lock(server_waiter.mutex_);
-    auto port = pairing_server_start(server_.get(), server_waiter.ResultCallback, &server_waiter);
-    ASSERT_GT(port, 0);
-    ip_addr_ += std::to_string(port);
-
-    // Start the client. Client should fail to pair
-    ResultWaiter client_waiter;
-    std::unique_lock<std::mutex> client_lock(client_waiter.mutex_);
-    ASSERT_TRUE(client_->Start(ip_addr_, client_waiter.ResultCallback, &client_waiter));
-    client_waiter.cv_.wait(client_lock, [&]() { return client_waiter.is_valid_.has_value(); });
-    ASSERT_FALSE(*(client_waiter.is_valid_));
-
-    // Kill the server. We should still receive the callback with no valid
-    // pairing.
-    server_lock.unlock();
-    server_.reset();
-    server_lock.lock();
-    ASSERT_TRUE(server_waiter.is_valid_.has_value());
-    EXPECT_FALSE(*(server_waiter.is_valid_));
-}
-
-TEST_F(AdbPairingConnectionTest, MultipleClientsAllFail) {
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    std::vector<uint8_t> pswd2{0x01, 0x03, 0x05, 0x06};
-
-    // Start the server
-    auto server = CreateServer(pswd);
-    ResultWaiter server_waiter;
-    std::unique_lock<std::mutex> server_lock(server_waiter.mutex_);
-    auto port = pairing_server_start(server.get(), server_waiter.ResultCallback, &server_waiter);
-    ASSERT_GT(port, 0);
-    ip_addr_ += std::to_string(port);
-
-    // Start multiple clients, all with bad passwords
-    int test_num_clients = 5;
-    int num_clients_done = 0;
-    std::mutex global_clients_mutex;
-    std::unique_lock<std::mutex> global_clients_lock(global_clients_mutex);
-    std::condition_variable global_cv_;
-    for (int i = 0; i < test_num_clients; ++i) {
-        std::thread([&]() {
-            auto client = CreateClient(pswd2);
-            ResultWaiter client_waiter;
-            std::unique_lock<std::mutex> client_lock(client_waiter.mutex_);
-            ASSERT_TRUE(client->Start(ip_addr_, client_waiter.ResultCallback, &client_waiter));
-            client_waiter.cv_.wait(client_lock,
-                                   [&]() { return client_waiter.is_valid_.has_value(); });
-            ASSERT_FALSE(*(client_waiter.is_valid_));
-            {
-                std::lock_guard<std::mutex> global_lock(global_clients_mutex);
-                ++num_clients_done;
-            }
-            global_cv_.notify_one();
-        }).detach();
-    }
-
-    global_cv_.wait(global_clients_lock, [&]() { return num_clients_done == test_num_clients; });
-    server_lock.unlock();
-    server.reset();
-    server_lock.lock();
-    ASSERT_TRUE(server_waiter.is_valid_.has_value());
-    EXPECT_FALSE(*(server_waiter.is_valid_));
-}
-
-TEST_F(AdbPairingConnectionTest, MultipleClientsOnePass) {
-    // Send multiple clients with bad passwords, but send the last one with the
-    // correct password.
-    std::vector<uint8_t> pswd{0x01, 0x03, 0x05, 0x07};
-    std::vector<uint8_t> pswd2{0x01, 0x03, 0x05, 0x06};
-
-    // Start the server
-    auto server = CreateServer(pswd);
-    ResultWaiter server_waiter;
-    std::unique_lock<std::mutex> server_lock(server_waiter.mutex_);
-    auto port = pairing_server_start(server.get(), server_waiter.ResultCallback, &server_waiter);
-    ASSERT_GT(port, 0);
-    ip_addr_ += std::to_string(port);
-
-    // Start multiple clients, all with bad passwords
-    int test_num_clients = 5;
-    int num_clients_done = 0;
-    std::mutex global_clients_mutex;
-    std::unique_lock<std::mutex> global_clients_lock(global_clients_mutex);
-    std::condition_variable global_cv_;
-    for (int i = 0; i < test_num_clients; ++i) {
-        std::thread([&, i]() {
-            bool good_client = (i == (test_num_clients - 1));
-            auto client = CreateClient((good_client ? pswd : pswd2));
-            ResultWaiter client_waiter;
-            std::unique_lock<std::mutex> client_lock(client_waiter.mutex_);
-            ASSERT_TRUE(client->Start(ip_addr_, client_waiter.ResultCallback, &client_waiter));
-            client_waiter.cv_.wait(client_lock,
-                                   [&]() { return client_waiter.is_valid_.has_value(); });
-            if (good_client) {
-                ASSERT_TRUE(*(client_waiter.is_valid_));
-                ASSERT_EQ(strlen(reinterpret_cast<const char*>(client_waiter.peer_info_.data)),
-                          strlen(reinterpret_cast<const char*>(server_info_.data)));
-                EXPECT_EQ(memcmp(client_waiter.peer_info_.data, server_info_.data,
-                                 sizeof(server_info_.data)),
-                          0);
-            } else {
-                ASSERT_FALSE(*(client_waiter.is_valid_));
-            }
-            {
-                std::lock_guard<std::mutex> global_lock(global_clients_mutex);
-                ++num_clients_done;
-            }
-            global_cv_.notify_one();
-        }).detach();
-    }
-
-    global_cv_.wait(global_clients_lock, [&]() { return num_clients_done == test_num_clients; });
-    server_waiter.cv_.wait(server_lock, [&]() { return server_waiter.is_valid_.has_value(); });
-    ASSERT_TRUE(*(server_waiter.is_valid_));
-    ASSERT_EQ(strlen(reinterpret_cast<const char*>(server_waiter.peer_info_.data)),
-              strlen(reinterpret_cast<const char*>(client_info_.data)));
-    EXPECT_EQ(memcmp(server_waiter.peer_info_.data, client_info_.data, sizeof(client_info_.data)),
-              0);
-}
-
-}  // namespace pairing
-}  // namespace adb
diff --git a/adb/proto/Android.bp b/adb/proto/Android.bp
deleted file mode 100644
index f7cba95..0000000
--- a/adb/proto/Android.bp
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (C) 2020 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.
-
-cc_defaults {
-    name: "libadb_protos_defaults",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Wthread-safety",
-        "-Werror",
-    ],
-
-    compile_multilib: "both",
-
-    proto: {
-        export_proto_headers: true,
-        type: "lite",
-    },
-    srcs: [
-        "adb_known_hosts.proto",
-        "key_type.proto",
-        "pairing.proto",
-    ],
-    target: {
-        windows: {
-            compile_multilib: "first",
-            enabled: true,
-        },
-    },
-
-    visibility: [
-        "//system/core/adb:__subpackages__",
-
-        // This needs to be visible to minadbd, even though it's removed via exclude_shared_libs.
-        "//bootable/recovery/minadbd:__subpackages__",
-    ],
-
-    stl: "libc++_static",
-
-    host_supported: true,
-    recovery_available: true,
-}
-
-cc_library {
-    name: "libadb_protos",
-    defaults: ["libadb_protos_defaults"],
-
-    apex_available: [
-        "com.android.adbd",
-        "test_com.android.adbd",
-    ],
-}
-
-// For running atest (b/147158681)
-cc_library_static {
-    name: "libadb_protos_static",
-    defaults: ["libadb_protos_defaults"],
-
-    apex_available: [
-        "//apex_available:platform",
-    ],
-}
diff --git a/adb/proto/adb_known_hosts.proto b/adb/proto/adb_known_hosts.proto
deleted file mode 100644
index 85d1489..0000000
--- a/adb/proto/adb_known_hosts.proto
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-syntax = "proto3";
-
-option java_package = "com.android.server.adb.protos";
-option java_outer_classname = "AdbKnownHostsProto";
-
-package adb.proto;
-
-// Each known host
-message HostInfo {
-    string guid = 1;
-}
-
-// Protobuf definition for the adb_known_hosts.
-message AdbKnownHosts {
-    repeated HostInfo host_infos = 1;
-}
diff --git a/adb/proto/jarjar-rules.txt b/adb/proto/jarjar-rules.txt
deleted file mode 100644
index 4e40637..0000000
--- a/adb/proto/jarjar-rules.txt
+++ /dev/null
@@ -1 +0,0 @@
-rule com.google.protobuf.** com.android.framework.protobuf.@1
diff --git a/adb/proto/key_type.proto b/adb/proto/key_type.proto
deleted file mode 100644
index ed451c5..0000000
--- a/adb/proto/key_type.proto
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-syntax = "proto3";
-
-option java_package = "com.android.server.adb.protos";
-option java_outer_classname = "KeyTypeProto";
-
-package adb.proto;
-
-enum KeyType {
-    RSA_2048 = 0;
-}
diff --git a/adb/proto/pairing.proto b/adb/proto/pairing.proto
deleted file mode 100644
index b0be20e..0000000
--- a/adb/proto/pairing.proto
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-syntax = "proto3";
-
-option java_package = "com.android.server.adb.protos";
-option java_outer_classname = "PairingProto";
-
-package adb.proto;
-
-// The type of packets used in the pairing protocol
-message PairingPacket {
-    enum Type {
-        SPAKE2_MSG = 0;
-        PEER_INFO = 1;
-    }
-}
diff --git a/adb/protocol.txt b/adb/protocol.txt
deleted file mode 100644
index 75700a4..0000000
--- a/adb/protocol.txt
+++ /dev/null
@@ -1,298 +0,0 @@
-
---- a replacement for aproto -------------------------------------------
-
-When it comes down to it, aproto's primary purpose is to forward
-various streams between the host computer and client device (in either
-direction).
-
-This replacement further simplifies the concept, reducing the protocol
-to an extremely straightforward model optimized to accomplish the
-forwarding of these streams and removing additional state or
-complexity.
-
-The host side becomes a simple comms bridge with no "UI", which will 
-be used by either commandline or interactive tools to communicate with 
-a device or emulator that is connected to the bridge.
-
-The protocol is designed to be straightforward and well-defined enough 
-that if it needs to be reimplemented in another environment (Java 
-perhaps), there should not problems ensuring perfect interoperability.
-
-The protocol discards the layering aproto has and should allow the 
-implementation to be much more robust.
-
-
---- protocol overview and basics ---------------------------------------
-
-The transport layer deals in "messages", which consist of a 24 byte
-header followed (optionally) by a payload.  The header consists of 6
-32 bit words which are sent across the wire in little endian format.
-
-struct message {
-    unsigned command;       /* command identifier constant (A_CNXN, ...) */
-    unsigned arg0;          /* first argument                            */
-    unsigned arg1;          /* second argument                           */
-    unsigned data_length;   /* length of payload (0 is allowed)          */
-    unsigned data_crc32;    /* crc32 of data payload                     */
-    unsigned magic;         /* command ^ 0xffffffff                      */
-};
-
-Receipt of an invalid message header, corrupt message payload, or an
-unrecognized command MUST result in the closing of the remote
-connection.  The protocol depends on shared state and any break in the
-message stream will result in state getting out of sync.
-
-The following sections describe the six defined message types in
-detail.  Their format is COMMAND(arg0, arg1, payload) where the payload
-is represented by a quoted string or an empty string if none should be
-sent.
-
-The identifiers "local-id" and "remote-id" are always relative to the
-*sender* of the message, so for a receiver, the meanings are effectively
-reversed.
-
-
-
---- CONNECT(version, maxdata, "system-identity-string") ----------------
-
-Command constant: A_CNXN
-
-The CONNECT message establishes the presence of a remote system.
-The version is used to ensure protocol compatibility and maxdata
-declares the maximum message body size that the remote system
-is willing to accept.
-
-Currently, version=0x01000000 and maxdata=256*1024. Older versions of adb
-hard-coded maxdata=4096, so CONNECT and AUTH packets sent to a device must not
-be larger than that because they're sent before the CONNECT from the device
-that tells the adb server what maxdata the device can support.
-
-Both sides send a CONNECT message when the connection between them is
-established.  Until a CONNECT message is received no other messages may
-be sent. Any messages received before a CONNECT message MUST be ignored.
-
-If a CONNECT message is received with an unknown version or insufficiently
-large maxdata value, the connection with the other side must be closed.
-
-The system identity string should be "<systemtype>:<serialno>:<banner>"
-where systemtype is "bootloader", "device", or "host", serialno is some
-kind of unique ID (or empty), and banner is a human-readable version
-or identifier string.  The banner is used to transmit useful properties.
-
---- STLS(type, version, "") --------------------------------------------
-
-Command constant: A_STLS
-
-The TLS message informs the recipient that the connection will be encrypted
-and will need to perform a TLS handshake. version is the current version of
-the protocol.
-
-
---- AUTH(type, 0, "data") ----------------------------------------------
-
-Command constant: A_AUTH
-
-The AUTH message informs the recipient that authentication is required to
-connect to the sender. If type is TOKEN(1), data is a random token that
-the recipient can sign with a private key. The recipient replies with an
-AUTH packet where type is SIGNATURE(2) and data is the signature. If the
-signature verification succeeds, the sender replies with a CONNECT packet.
-
-If the signature verification fails, the sender replies with a new AUTH
-packet and a new random token, so that the recipient can retry signing
-with a different private key.
-
-Once the recipient has tried all its private keys, it can reply with an
-AUTH packet where type is RSAPUBLICKEY(3) and data is the public key. If
-possible, an on-screen confirmation may be displayed for the user to
-confirm they want to install the public key on the device.
-
-
---- OPEN(local-id, 0, "destination") -----------------------------------
-
-Command constant: A_OPEN
-
-The OPEN message informs the recipient that the sender has a stream
-identified by local-id that it wishes to connect to the named
-destination in the message payload.  The local-id may not be zero.
-
-The OPEN message MUST result in either a READY message indicating that
-the connection has been established (and identifying the other end) or
-a CLOSE message, indicating failure.  An OPEN message also implies
-a READY message sent at the same time.
-
-Common destination naming conventions include:
-
-* "tcp:<host>:<port>" - host may be omitted to indicate localhost
-* "udp:<host>:<port>" - host may be omitted to indicate localhost
-* "local-dgram:<identifier>"
-* "local-stream:<identifier>"
-* "shell" - local shell service
-* "upload" - service for pushing files across (like aproto's /sync)
-* "fs-bridge" - FUSE protocol filesystem bridge
-
-
---- READY(local-id, remote-id, "") -------------------------------------
-
-Command constant: A_OKAY
-
-The READY message informs the recipient that the sender's stream
-identified by local-id is ready for write messages and that it is
-connected to the recipient's stream identified by remote-id.
-
-Neither the local-id nor the remote-id may be zero.
-
-A READY message containing a remote-id which does not map to an open
-stream on the recipient's side is ignored.  The stream may have been
-closed while this message was in-flight.
-
-The local-id is ignored on all but the first READY message (where it
-is used to establish the connection).  Nonetheless, the local-id MUST
-not change on later READY messages sent to the same stream.
-
-
---- WRITE(local-id, remote-id, "data") ---------------------------------
-
-Command constant: A_WRTE
-
-The WRITE message sends data to the recipient's stream identified by
-remote-id.  The payload MUST be <= maxdata in length.
-
-A WRITE message containing a remote-id which does not map to an open
-stream on the recipient's side is ignored.  The stream may have been
-closed while this message was in-flight.
-
-A WRITE message may not be sent until a READY message is received.
-Once a WRITE message is sent, an additional WRITE message may not be
-sent until another READY message has been received.  Recipients of
-a WRITE message that is in violation of this requirement will CLOSE
-the connection.
-
-
---- CLOSE(local-id, remote-id, "") -------------------------------------
-
-Command constant: A_CLSE
-
-The CLOSE message informs recipient that the connection between the
-sender's stream (local-id) and the recipient's stream (remote-id) is
-broken.  The remote-id MUST not be zero, but the local-id MAY be zero
-if this CLOSE indicates a failed OPEN.
-
-A CLOSE message containing a remote-id which does not map to an open
-stream on the recipient's side is ignored.  The stream may have
-already been closed by the recipient while this message was in-flight.
-
-The recipient should not respond to a CLOSE message in any way.  The
-recipient should cancel pending WRITEs or CLOSEs, but this is not a
-requirement, since they will be ignored.
-
-
---- SYNC(online, sequence, "") -----------------------------------------
-
-Command constant: A_SYNC
-
-*** obsolete, no longer used ***
-
-The SYNC message was used by the io pump to make sure that stale
-outbound messages are discarded when the connection to the remote side
-is broken.  It was only used internally to the bridge and never valid
-to send across the wire.
-
-* when the connection to the remote side goes offline, the io pump
-  sends a SYNC(0, 0) and starts discarding all messages
-* when the connection to the remote side is established, the io pump
-  sends a SYNC(1, token) and continues to discard messages
-* when the io pump receives a matching SYNC(1, token), it once again
-  starts accepting messages to forward to the remote side
-
-
---- message command constants ------------------------------------------
-
-#define A_SYNC 0x434e5953
-#define A_CNXN 0x4e584e43
-#define A_AUTH 0x48545541
-#define A_OPEN 0x4e45504f
-#define A_OKAY 0x59414b4f
-#define A_CLSE 0x45534c43
-#define A_WRTE 0x45545257
-#define A_STLS 0x534C5453
-
-
-
---- implementation details ---------------------------------------------
-
-The core of the bridge program will use three threads.  One thread
-will be a select/epoll loop to handle io between various inbound and
-outbound connections and the connection to the remote side.
-
-The remote side connection will be implemented as two threads (one for
-reading, one for writing) and a datagram socketpair to provide the
-channel between the main select/epoll thread and the remote connection
-threadpair.  The reason for this is that for usb connections, the
-kernel interface on linux and osx does not allow you to do meaningful
-nonblocking IO.
-
-The endian swapping for the message headers will happen (as needed) in
-the remote connection threadpair and that the rest of the program will
-always treat message header values as native-endian.
-
-The bridge program will be able to have a number of mini-servers
-compiled in.  They will be published under known names (examples
-"shell", "fs-bridge", etc) and upon receiving an OPEN() to such a
-service, the bridge program will create a stream socketpair and spawn
-a thread or subprocess to handle the io.
-
-
---- simplified / embedded implementation -------------------------------
-
-For limited environments, like the bootloader, it is allowable to
-support a smaller, fixed number of channels using pre-assigned channel
-ID numbers such that only one stream may be connected to a bootloader
-endpoint at any given time.  The protocol remains unchanged, but the
-"embedded" version of it is less dynamic.
-
-The bootloader will support two streams.  A "bootloader:debug" stream,
-which may be opened to get debug messages from the bootloader and a 
-"bootloader:control", stream which will support the set of basic 
-bootloader commands.
-
-Example command stream dialogues:  
-  "flash_kernel,2515049,........\n" "okay\n" 
-  "flash_ramdisk,5038,........\n" "fail,flash write error\n" 
-  "bogus_command......" <CLOSE>
-
-
---- future expansion ---------------------------------------------------
-
-I plan on providing either a message or a special control stream so that
-the client device could ask the host computer to setup inbound socket
-translations on the fly on behalf of the client device.
-
-
-The initial design does handshaking to provide flow control, with a
-message flow that looks like:
-
-  >OPEN <READY >WRITE <READY >WRITE <READY >WRITE <CLOSE
-
-The far side may choose to issue the READY message as soon as it receives
-a WRITE or it may defer the READY until the write to the local stream
-succeeds.  A future version may want to do some level of windowing where
-multiple WRITEs may be sent without requiring individual READY acks.
-
-------------------------------------------------------------------------
-
---- smartsockets -------------------------------------------------------
-
-Port 5037 is used for smart sockets which allow a client on the host
-side to request access to a service in the host adb daemon or in the
-remote (device) daemon.  The service is requested by ascii name,
-preceeded by a 4 digit hex length.  Upon successful connection an
-"OKAY" response is sent, otherwise a "FAIL" message is returned.  Once
-connected the client is talking to that (remote or local) service.
-
-client: <hex4> <service-name>
-server: "OKAY"
-
-client: <hex4> <service-name>
-server: "FAIL" <hex4> <reason>
-
diff --git a/adb/security_log_tags.h b/adb/security_log_tags.h
deleted file mode 100644
index 1d02744..0000000
--- a/adb/security_log_tags.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-#ifndef __SECURITY_LOG_TAGS_H
-#define __SECURITY_LOG_TAGS_H
-
-/* TODO: Automatically generate this file from the logtags file when build
- * infrastructure is in place.
- * Defined in frameworks/base/core/java/android/auditing/SecurityLog.logtags
- */
-#define SEC_TAG_ADB_SHELL_INTERACTIVE 210001
-#define SEC_TAG_ADB_SHELL_CMD         210002
-#define SEC_TAG_ADB_RECV_FILE         210003
-#define SEC_TAG_ADB_SEND_FILE         210004
-
-#endif
diff --git a/adb/services.cpp b/adb/services.cpp
deleted file mode 100644
index 853d658..0000000
--- a/adb/services.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG SERVICES
-
-#include "sysdeps.h"
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstring>
-#include <thread>
-
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <cutils/sockets.h>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "adb_wifi.h"
-#include "services.h"
-#include "socket_spec.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-namespace {
-
-void service_bootstrap_func(std::string service_name, std::function<void(unique_fd)> func,
-                            unique_fd fd) {
-    adb_thread_setname(android::base::StringPrintf("%s svc %d", service_name.c_str(), fd.get()));
-    func(std::move(fd));
-}
-
-}  // namespace
-
-unique_fd create_service_thread(const char* service_name, std::function<void(unique_fd)> func) {
-    int s[2];
-    if (adb_socketpair(s)) {
-        printf("cannot create service socket pair\n");
-        return unique_fd();
-    }
-    D("socketpair: (%d,%d)", s[0], s[1]);
-
-#if !ADB_HOST
-    if (strcmp(service_name, "sync") == 0) {
-        // Set file sync service socket to maximum size
-        int max_buf = LINUX_MAX_SOCKET_SIZE;
-        adb_setsockopt(s[0], SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
-        adb_setsockopt(s[1], SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
-    }
-#endif  // !ADB_HOST
-
-    std::thread(service_bootstrap_func, service_name, func, unique_fd(s[1])).detach();
-
-    D("service thread started, %d:%d", s[0], s[1]);
-    return unique_fd(s[0]);
-}
-
-unique_fd service_to_fd(std::string_view name, atransport* transport) {
-    unique_fd ret;
-
-    if (is_socket_spec(name)) {
-        std::string error;
-        if (!socket_spec_connect(&ret, name, nullptr, nullptr, &error)) {
-            LOG(ERROR) << "failed to connect to socket '" << name << "': " << error;
-        }
-    } else {
-#if !ADB_HOST
-        ret = daemon_service_to_fd(name, transport);
-#endif
-    }
-
-    if (ret >= 0) {
-        close_on_exec(ret.get());
-    }
-    return ret;
-}
-
-#if ADB_HOST
-struct state_info {
-    TransportType transport_type;
-    std::string serial;
-    TransportId transport_id;
-    ConnectionState state;
-};
-
-static void wait_for_state(unique_fd fd, state_info* sinfo) {
-    D("wait_for_state %d", sinfo->state);
-
-    while (true) {
-        bool is_ambiguous = false;
-        std::string error = "unknown error";
-        const char* serial = sinfo->serial.length() ? sinfo->serial.c_str() : nullptr;
-        atransport* t = acquire_one_transport(sinfo->transport_type, serial, sinfo->transport_id,
-                                              &is_ambiguous, &error);
-        if (sinfo->state == kCsOffline) {
-            // wait-for-disconnect uses kCsOffline, we don't actually want to wait for 'offline'.
-            if (t == nullptr) {
-                SendOkay(fd);
-                break;
-            }
-        } else if (t != nullptr &&
-                   (sinfo->state == kCsAny || sinfo->state == t->GetConnectionState())) {
-            SendOkay(fd);
-            break;
-        }
-
-        if (!is_ambiguous) {
-            adb_pollfd pfd = {.fd = fd.get(), .events = POLLIN};
-            int rc = adb_poll(&pfd, 1, 100);
-            if (rc < 0) {
-                SendFail(fd, error);
-                break;
-            } else if (rc > 0 && (pfd.revents & POLLHUP) != 0) {
-                // The other end of the socket is closed, probably because the other side was
-                // terminated, bail out.
-                break;
-            }
-
-            // Try again...
-        } else {
-            SendFail(fd, error);
-            break;
-        }
-    }
-
-    D("wait_for_state is done");
-}
-
-void connect_emulator(const std::string& port_spec, std::string* response) {
-    std::vector<std::string> pieces = android::base::Split(port_spec, ",");
-    if (pieces.size() != 2) {
-        *response = android::base::StringPrintf("unable to parse '%s' as <console port>,<adb port>",
-                                                port_spec.c_str());
-        return;
-    }
-
-    int console_port = strtol(pieces[0].c_str(), nullptr, 0);
-    int adb_port = strtol(pieces[1].c_str(), nullptr, 0);
-    if (console_port <= 0 || adb_port <= 0) {
-        *response = android::base::StringPrintf("Invalid port numbers: %s", port_spec.c_str());
-        return;
-    }
-
-    // Check if the emulator is already known.
-    // Note: There's a small but harmless race condition here: An emulator not
-    // present just yet could be registered by another invocation right
-    // after doing this check here. However, local_connect protects
-    // against double-registration too. From here, a better error message
-    // can be produced. In the case of the race condition, the very specific
-    // error message won't be shown, but the data doesn't get corrupted.
-    atransport* known_emulator = find_emulator_transport_by_adb_port(adb_port);
-    if (known_emulator != nullptr) {
-        *response = android::base::StringPrintf("Emulator already registered on port %d", adb_port);
-        return;
-    }
-
-    // Preconditions met, try to connect to the emulator.
-    std::string error;
-    if (!local_connect_arbitrary_ports(console_port, adb_port, &error)) {
-        *response = android::base::StringPrintf("Connected to emulator on ports %d,%d",
-                                                console_port, adb_port);
-    } else {
-        *response = android::base::StringPrintf("Could not connect to emulator on ports %d,%d: %s",
-                                                console_port, adb_port, error.c_str());
-    }
-}
-
-static void connect_service(unique_fd fd, std::string host) {
-    std::string response;
-    if (!strncmp(host.c_str(), "emu:", 4)) {
-        connect_emulator(host.c_str() + 4, &response);
-    } else {
-        connect_device(host, &response);
-    }
-
-    // Send response for emulator and device
-    SendProtocolString(fd.get(), response);
-}
-
-static void pair_service(unique_fd fd, std::string host, std::string password) {
-    std::string response;
-    adb_wifi_pair_device(host, password, response);
-    SendProtocolString(fd.get(), response);
-}
-#endif
-
-#if ADB_HOST
-asocket* host_service_to_socket(std::string_view name, std::string_view serial,
-                                TransportId transport_id) {
-    if (name == "track-devices") {
-        return create_device_tracker(false);
-    } else if (name == "track-devices-l") {
-        return create_device_tracker(true);
-    } else if (android::base::ConsumePrefix(&name, "wait-for-")) {
-        std::shared_ptr<state_info> sinfo = std::make_shared<state_info>();
-        if (sinfo == nullptr) {
-            fprintf(stderr, "couldn't allocate state_info: %s", strerror(errno));
-            return nullptr;
-        }
-
-        sinfo->serial = serial;
-        sinfo->transport_id = transport_id;
-
-        if (android::base::ConsumePrefix(&name, "local")) {
-            sinfo->transport_type = kTransportLocal;
-        } else if (android::base::ConsumePrefix(&name, "usb")) {
-            sinfo->transport_type = kTransportUsb;
-        } else if (android::base::ConsumePrefix(&name, "any")) {
-            sinfo->transport_type = kTransportAny;
-        } else {
-            return nullptr;
-        }
-
-        if (name == "-device") {
-            sinfo->state = kCsDevice;
-        } else if (name == "-recovery") {
-            sinfo->state = kCsRecovery;
-        } else if (name == "-rescue") {
-            sinfo->state = kCsRescue;
-        } else if (name == "-sideload") {
-            sinfo->state = kCsSideload;
-        } else if (name == "-bootloader") {
-            sinfo->state = kCsBootloader;
-        } else if (name == "-any") {
-            sinfo->state = kCsAny;
-        } else if (name == "-disconnect") {
-            sinfo->state = kCsOffline;
-        } else {
-            return nullptr;
-        }
-
-        unique_fd fd = create_service_thread(
-                "wait", [sinfo](unique_fd fd) { wait_for_state(std::move(fd), sinfo.get()); });
-        return create_local_socket(std::move(fd));
-    } else if (android::base::ConsumePrefix(&name, "connect:")) {
-        std::string host(name);
-        unique_fd fd = create_service_thread(
-                "connect", std::bind(connect_service, std::placeholders::_1, host));
-        return create_local_socket(std::move(fd));
-    } else if (android::base::ConsumePrefix(&name, "pair:")) {
-        const char* divider = strchr(name.data(), ':');
-        if (!divider) {
-            return nullptr;
-        }
-        std::string password(name.data(), divider);
-        std::string host(divider + 1);
-        unique_fd fd = create_service_thread(
-                "pair", std::bind(pair_service, std::placeholders::_1, host, password));
-        return create_local_socket(std::move(fd));
-    }
-    return nullptr;
-}
-#endif /* ADB_HOST */
diff --git a/adb/services.h b/adb/services.h
deleted file mode 100644
index 6fc89d7..0000000
--- a/adb/services.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef SERVICES_H_
-#define SERVICES_H_
-
-#include "adb_unique_fd.h"
-
-constexpr char kShellServiceArgRaw[] = "raw";
-constexpr char kShellServiceArgPty[] = "pty";
-constexpr char kShellServiceArgShellProtocol[] = "v2";
-
-// Special flags sent by minadbd. They indicate the end of sideload transfer and the result of
-// installation or wipe.
-constexpr char kMinadbdServicesExitSuccess[] = "DONEDONE";
-constexpr char kMinadbdServicesExitFailure[] = "FAILFAIL";
-
-unique_fd create_service_thread(const char* service_name, std::function<void(unique_fd)> func);
-#endif  // SERVICES_H_
diff --git a/adb/shell_protocol.h b/adb/shell_protocol.h
deleted file mode 100644
index 4aab813..0000000
--- a/adb/shell_protocol.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#include <android-base/macros.h>
-
-#include "adb.h"
-#include "adb_unique_fd.h"
-
-// Class to send and receive shell protocol packets.
-//
-// To keep things simple and predictable, reads and writes block until an entire
-// packet is complete.
-//
-// Example: read raw data from |fd| and send it in a packet.
-//   ShellProtocol* p = new ShellProtocol(protocol_fd);
-//   int len = adb_read(stdout_fd, p->data(), p->data_capacity());
-//   packet->WritePacket(ShellProtocol::kIdStdout, len);
-//
-// Example: read a packet and print it to |stdout|.
-//   ShellProtocol* p = new ShellProtocol(protocol_fd);
-//   if (p->ReadPacket() && p->id() == kIdStdout) {
-//       fwrite(p->data(), 1, p->data_length(), stdout);
-//   }
-class ShellProtocol {
-  public:
-    // This is an unscoped enum to make it easier to compare against raw bytes.
-    enum Id : uint8_t {
-        kIdStdin = 0,
-        kIdStdout = 1,
-        kIdStderr = 2,
-        kIdExit = 3,
-
-        // Close subprocess stdin if possible.
-        kIdCloseStdin = 4,
-
-        // Window size change (an ASCII version of struct winsize).
-        kIdWindowSizeChange = 5,
-
-        // Indicates an invalid or unknown packet.
-        kIdInvalid = 255,
-    };
-
-    // ShellPackets will probably be too large to allocate on the stack so they
-    // should be dynamically allocated on the heap instead.
-    //
-    // |fd| is an open file descriptor to be used to send or receive packets.
-    explicit ShellProtocol(borrowed_fd fd);
-    virtual ~ShellProtocol();
-
-    // Returns a pointer to the data buffer.
-    const char* data() const { return buffer_ + kHeaderSize; }
-    char* data() { return buffer_ + kHeaderSize; }
-
-    // Returns the total capacity of the data buffer.
-    size_t data_capacity() const { return buffer_end_ - data(); }
-
-    // Reads a packet from the FD.
-    //
-    // If a packet is too big to fit in the buffer then Read() will split the
-    // packet across multiple calls. For example, reading a 50-byte packet into
-    // a 20-byte buffer would read 20 bytes, 20 bytes, then 10 bytes.
-    //
-    // Returns false if the FD closed or errored.
-    bool Read();
-
-    // Returns the ID of the packet in the buffer.
-    int id() const { return buffer_[0]; }
-
-    // Returns the number of bytes that have been read into the data buffer.
-    size_t data_length() const { return data_length_; }
-
-    // Writes the packet currently in the buffer to the FD.
-    //
-    // Returns false if the FD closed or errored.
-    bool Write(Id id, size_t length);
-
-  private:
-    // Packets support 4-byte lengths.
-    typedef uint32_t length_t;
-
-    enum {
-        // It's OK if MAX_PAYLOAD doesn't match on the sending and receiving
-        // end, reading will split larger packets into multiple smaller ones.
-        kBufferSize = MAX_PAYLOAD,
-
-        // Header is 1 byte ID + 4 bytes length.
-        kHeaderSize = sizeof(Id) + sizeof(length_t)
-    };
-
-    borrowed_fd fd_;
-    char buffer_[kBufferSize];
-    size_t data_length_ = 0, bytes_left_ = 0;
-
-    // We need to be able to modify this value for testing purposes, but it
-    // will stay constant during actual program use.
-    char* buffer_end_ = buffer_ + sizeof(buffer_);
-
-    friend class ShellProtocolTest;
-
-    DISALLOW_COPY_AND_ASSIGN(ShellProtocol);
-};
diff --git a/adb/shell_service_protocol.cpp b/adb/shell_service_protocol.cpp
deleted file mode 100644
index 95afaff..0000000
--- a/adb/shell_service_protocol.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "shell_protocol.h"
-
-#include <string.h>
-
-#include <algorithm>
-
-#include "adb_io.h"
-
-ShellProtocol::ShellProtocol(borrowed_fd fd) : fd_(fd) {
-    buffer_[0] = kIdInvalid;
-}
-
-ShellProtocol::~ShellProtocol() {
-}
-
-bool ShellProtocol::Read() {
-    // Only read a new header if we've finished the last packet.
-    if (!bytes_left_) {
-        if (!ReadFdExactly(fd_, buffer_, kHeaderSize)) {
-            return false;
-        }
-
-        length_t packet_length;
-        memcpy(&packet_length, &buffer_[1], sizeof(packet_length));
-        bytes_left_ = packet_length;
-        data_length_ = 0;
-    }
-
-    size_t read_length = std::min(bytes_left_, data_capacity());
-    if (read_length && !ReadFdExactly(fd_, data(), read_length)) {
-        return false;
-    }
-
-    bytes_left_ -= read_length;
-    data_length_ = read_length;
-
-    return true;
-}
-
-bool ShellProtocol::Write(Id id, size_t length) {
-    buffer_[0] = id;
-    length_t typed_length = length;
-    memcpy(&buffer_[1], &typed_length, sizeof(typed_length));
-
-    return WriteFdExactly(fd_, buffer_, kHeaderSize + length);
-}
diff --git a/adb/shell_service_protocol_test.cpp b/adb/shell_service_protocol_test.cpp
deleted file mode 100644
index a10b5c0..0000000
--- a/adb/shell_service_protocol_test.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "shell_protocol.h"
-
-#include <gtest/gtest.h>
-
-#include <signal.h>
-#include <string.h>
-
-#include "sysdeps.h"
-
-class ShellProtocolTest : public ::testing::Test {
-  public:
-    static void SetUpTestCase() {
-#if !defined(_WIN32)
-        // This is normally done in main.cpp.
-        saved_sigpipe_handler_ = signal(SIGPIPE, SIG_IGN);
-#endif
-    }
-
-    static void TearDownTestCase() {
-#if !defined(_WIN32)
-        signal(SIGPIPE, saved_sigpipe_handler_);
-#endif
-    }
-
-    // Initializes the socketpair and ShellProtocols needed for testing.
-    void SetUp() {
-        int fds[2];
-        ASSERT_EQ(0, adb_socketpair(fds));
-        read_fd_ = fds[0];
-        write_fd_ = fds[1];
-
-        write_protocol_ = new ShellProtocol(write_fd_);
-        ASSERT_TRUE(write_protocol_ != nullptr);
-
-        read_protocol_ = new ShellProtocol(read_fd_);
-        ASSERT_TRUE(read_protocol_ != nullptr);
-    }
-
-    // Cleans up FDs and ShellProtocols. If an FD is closed manually during a
-    // test, set it to -1 to prevent TearDown() trying to close it again.
-    void TearDown() {
-        for (int fd : {read_fd_, write_fd_}) {
-            if (fd >= 0) {
-                adb_close(fd);
-            }
-        }
-        for (ShellProtocol* protocol : {read_protocol_, write_protocol_}) {
-            if (protocol) {
-                delete protocol;
-            }
-        }
-    }
-
-    // Fakes the buffer size so we can test filling buffers.
-    void SetReadDataCapacity(size_t size) {
-        read_protocol_->buffer_end_ = read_protocol_->data() + size;
-    }
-
-#if !defined(_WIN32)
-    static sig_t saved_sigpipe_handler_;
-#endif
-
-    int read_fd_ = -1, write_fd_ = -1;
-    ShellProtocol *read_protocol_ = nullptr, *write_protocol_ = nullptr;
-};
-
-#if !defined(_WIN32)
-sig_t ShellProtocolTest::saved_sigpipe_handler_ = nullptr;
-#endif
-
-namespace {
-
-// Returns true if the packet contains the given values. `data` can't be null.
-bool PacketEquals(const ShellProtocol* protocol, ShellProtocol::Id id,
-                    const void* data, size_t data_length) {
-    // Note that passing memcmp null is bad, even if data_length is 0.
-    return (protocol->id() == id &&
-            protocol->data_length() == data_length &&
-            !memcmp(data, protocol->data(), data_length));
-}
-
-}  // namespace
-
-// Tests data that can fit in a single packet.
-TEST_F(ShellProtocolTest, FullPacket) {
-    ShellProtocol::Id id = ShellProtocol::kIdStdout;
-    char data[] = "abc 123 \0\r\n";
-
-    memcpy(write_protocol_->data(), data, sizeof(data));
-    ASSERT_TRUE(write_protocol_->Write(id, sizeof(data)));
-
-    ASSERT_TRUE(read_protocol_->Read());
-    ASSERT_TRUE(PacketEquals(read_protocol_, id, data, sizeof(data)));
-}
-
-// Tests data that has to be read multiple times due to smaller read buffer.
-TEST_F(ShellProtocolTest, ReadBufferOverflow) {
-    ShellProtocol::Id id = ShellProtocol::kIdStdin;
-
-    memcpy(write_protocol_->data(), "1234567890", 10);
-    ASSERT_TRUE(write_protocol_->Write(id, 10));
-
-    SetReadDataCapacity(4);
-    ASSERT_TRUE(read_protocol_->Read());
-    ASSERT_TRUE(PacketEquals(read_protocol_, id, "1234", 4));
-    ASSERT_TRUE(read_protocol_->Read());
-    ASSERT_TRUE(PacketEquals(read_protocol_, id, "5678", 4));
-    ASSERT_TRUE(read_protocol_->Read());
-    ASSERT_TRUE(PacketEquals(read_protocol_, id, "90", 2));
-}
-
-// Tests a zero length packet.
-TEST_F(ShellProtocolTest, ZeroLengthPacket) {
-    ShellProtocol::Id id = ShellProtocol::kIdStderr;
-
-    ASSERT_TRUE(write_protocol_->Write(id, 0));
-    ASSERT_TRUE(read_protocol_->Read());
-    char buf[1];
-    ASSERT_TRUE(PacketEquals(read_protocol_, id, buf, 0));
-}
-
-// Tests exit code packets.
-TEST_F(ShellProtocolTest, ExitCodePacket) {
-    write_protocol_->data()[0] = 20;
-    ASSERT_TRUE(write_protocol_->Write(ShellProtocol::kIdExit, 1));
-
-    ASSERT_TRUE(read_protocol_->Read());
-    ASSERT_EQ(ShellProtocol::kIdExit, read_protocol_->id());
-    ASSERT_EQ(20, read_protocol_->data()[0]);
-}
-
-// Tests writing to a closed pipe.
-TEST_F(ShellProtocolTest, WriteToClosedPipeFail) {
-    adb_close(read_fd_);
-    read_fd_ = -1;
-
-    ASSERT_FALSE(write_protocol_->Write(ShellProtocol::kIdStdout, 0));
-}
-
-// Tests writing to a closed FD.
-TEST_F(ShellProtocolTest, WriteToClosedFdFail) {
-    adb_close(write_fd_);
-    write_fd_ = -1;
-
-    ASSERT_FALSE(write_protocol_->Write(ShellProtocol::kIdStdout, 0));
-}
-
-// Tests reading from a closed pipe.
-TEST_F(ShellProtocolTest, ReadFromClosedPipeFail) {
-    adb_close(write_fd_);
-    write_fd_ = -1;
-
-    ASSERT_FALSE(read_protocol_->Read());
-}
-
-// Tests reading from a closed FD.
-TEST_F(ShellProtocolTest, ReadFromClosedFdFail) {
-    adb_close(read_fd_);
-    read_fd_ = -1;
-
-    ASSERT_FALSE(read_protocol_->Read());
-}
-
-// Tests reading from a closed pipe that has a packet waiting. This checks that
-// even if the pipe closes before we can fully read its contents we will still
-// be able to access the last packets.
-TEST_F(ShellProtocolTest, ReadPacketFromClosedPipe) {
-    ShellProtocol::Id id = ShellProtocol::kIdStdout;
-    char data[] = "foo bar";
-
-    memcpy(write_protocol_->data(), data, sizeof(data));
-    ASSERT_TRUE(write_protocol_->Write(id, sizeof(data)));
-    adb_close(write_fd_);
-    write_fd_ = -1;
-
-    // First read should grab the packet.
-    ASSERT_TRUE(read_protocol_->Read());
-    ASSERT_TRUE(PacketEquals(read_protocol_, id, data, sizeof(data)));
-
-    // Second read should fail.
-    ASSERT_FALSE(read_protocol_->Read());
-}
diff --git a/adb/socket.h b/adb/socket.h
deleted file mode 100644
index 4276851..0000000
--- a/adb/socket.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef __ADB_SOCKET_H
-#define __ADB_SOCKET_H
-
-#include <stddef.h>
-
-#include <deque>
-#include <memory>
-#include <string>
-
-#include "adb_unique_fd.h"
-#include "fdevent/fdevent.h"
-#include "types.h"
-
-class atransport;
-
-/* An asocket represents one half of a connection between a local and
- * remote entity.  A local asocket is bound to a file descriptor.  A
- * remote asocket is bound to the protocol engine.
- */
-struct asocket {
-    /* the unique identifier for this asocket
-     */
-    unsigned id = 0;
-
-    /* flag: set when the socket's peer has closed
-     * but packets are still queued for delivery
-     */
-    int closing = 0;
-
-    // flag: set when the socket failed to write, so the socket will not wait to
-    // write packets and close directly.
-    bool has_write_error = 0;
-
-    /* flag: quit adbd when both ends close the
-     * local service socket
-     */
-    int exit_on_close = 0;
-
-    // the asocket we are connected to
-    asocket* peer = nullptr;
-
-    /* For local asockets, the fde is used to bind
-     * us to our fd event system.  For remote asockets
-     * these fields are not used.
-     */
-    fdevent* fde = nullptr;
-    int fd = -1;
-
-    // queue of data waiting to be written
-    IOVector packet_queue;
-
-    std::string smart_socket_data;
-
-    /* enqueue is called by our peer when it has data
-     * for us.  It should return 0 if we can accept more
-     * data or 1 if not.  If we return 1, we must call
-     * peer->ready() when we once again are ready to
-     * receive data.
-     */
-    int (*enqueue)(asocket* s, apacket::payload_type data) = nullptr;
-
-    /* ready is called by the peer when it is ready for
-     * us to send data via enqueue again
-     */
-    void (*ready)(asocket* s) = nullptr;
-
-    /* shutdown is called by the peer before it goes away.
-     * the socket should not do any further calls on its peer.
-     * Always followed by a call to close. Optional, i.e. can be NULL.
-     */
-    void (*shutdown)(asocket* s) = nullptr;
-
-    /* close is called by the peer when it has gone away.
-     * we are not allowed to make any further calls on the
-     * peer once our close method is called.
-     */
-    void (*close)(asocket* s) = nullptr;
-
-    /* A socket is bound to atransport */
-    atransport* transport = nullptr;
-
-    size_t get_max_payload() const;
-};
-
-asocket *find_local_socket(unsigned local_id, unsigned remote_id);
-void install_local_socket(asocket *s);
-void remove_socket(asocket *s);
-void close_all_sockets(atransport *t);
-
-asocket* create_local_socket(unique_fd fd);
-asocket* create_local_service_socket(std::string_view destination, atransport* transport);
-
-asocket *create_remote_socket(unsigned id, atransport *t);
-void connect_to_remote(asocket* s, std::string_view destination);
-void connect_to_smartsocket(asocket *s);
-
-// Internal functions that are only made available here for testing purposes.
-namespace internal {
-
-#if ADB_HOST
-bool parse_host_service(std::string_view* out_serial, std::string_view* out_command,
-                        std::string_view service);
-#endif
-
-}  // namespace internal
-
-#endif  // __ADB_SOCKET_H
diff --git a/adb/socket_spec.cpp b/adb/socket_spec.cpp
deleted file mode 100644
index d17036c..0000000
--- a/adb/socket_spec.cpp
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "socket_spec.h"
-
-#include <limits>
-#include <string>
-#include <string_view>
-#include <unordered_map>
-#include <vector>
-
-#include <android-base/parseint.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <cutils/sockets.h>
-
-#include "adb.h"
-#include "adb_utils.h"
-#include "sysdeps.h"
-
-using namespace std::string_literals;
-
-using android::base::ConsumePrefix;
-using android::base::StringPrintf;
-
-#if defined(__linux__)
-#define ADB_LINUX 1
-#else
-#define ADB_LINUX 0
-#endif
-
-#if defined(_WIN32)
-#define ADB_WINDOWS 1
-#else
-#define ADB_WINDOWS 0
-#endif
-
-#if ADB_LINUX
-#include <sys/socket.h>
-#include "sysdeps/vm_sockets.h"
-#endif
-
-// Not static because it is used in commandline.c.
-int gListenAll = 0;
-
-struct LocalSocketType {
-    int socket_namespace;
-    bool available;
-};
-
-static auto& kLocalSocketTypes = *new std::unordered_map<std::string, LocalSocketType>({
-#if ADB_HOST
-    { "local", { ANDROID_SOCKET_NAMESPACE_FILESYSTEM, !ADB_WINDOWS } },
-#else
-    { "local", { ANDROID_SOCKET_NAMESPACE_RESERVED, !ADB_WINDOWS } },
-#endif
-
-    { "localreserved", { ANDROID_SOCKET_NAMESPACE_RESERVED, !ADB_HOST } },
-    { "localabstract", { ANDROID_SOCKET_NAMESPACE_ABSTRACT, ADB_LINUX } },
-    { "localfilesystem", { ANDROID_SOCKET_NAMESPACE_FILESYSTEM, !ADB_WINDOWS } },
-});
-
-bool parse_tcp_socket_spec(std::string_view spec, std::string* hostname, int* port,
-                           std::string* serial, std::string* error) {
-    if (!spec.starts_with("tcp:")) {
-        *error = "specification is not tcp: ";
-        *error += spec;
-        return false;
-    }
-
-    std::string hostname_value;
-    int port_value;
-
-    // If the spec is tcp:<port>, parse it ourselves.
-    // Otherwise, delegate to android::base::ParseNetAddress.
-    if (android::base::ParseInt(&spec[4], &port_value)) {
-        // Do the range checking ourselves, because ParseInt rejects 'tcp:65536' and 'tcp:foo:1234'
-        // identically.
-        if (port_value < 0 || port_value > 65535) {
-            *error = StringPrintf("bad port number '%d'", port_value);
-            return false;
-        }
-    } else {
-        std::string addr(spec.substr(4));
-        port_value = DEFAULT_ADB_LOCAL_TRANSPORT_PORT;
-
-        // FIXME: ParseNetAddress rejects port 0. This currently doesn't hurt, because listening
-        //        on an address that isn't 'localhost' is unsupported.
-        if (!android::base::ParseNetAddress(addr, &hostname_value, &port_value, serial, error)) {
-            return false;
-        }
-
-        if (port_value == -1) {
-            *error = "missing port in specification: ";
-            *error += spec;
-            return false;
-        }
-    }
-
-    if (hostname) {
-        *hostname = std::move(hostname_value);
-    }
-
-    if (port) {
-        *port = port_value;
-    }
-
-    return true;
-}
-
-int get_host_socket_spec_port(std::string_view spec, std::string* error) {
-    int port;
-    if (spec.starts_with("tcp:")) {
-        if (!parse_tcp_socket_spec(spec, nullptr, &port, nullptr, error)) {
-            return -1;
-        }
-    } else if (spec.starts_with("vsock:")) {
-#if ADB_LINUX
-        std::string spec_str(spec);
-        std::vector<std::string> fragments = android::base::Split(spec_str, ":");
-        if (fragments.size() != 2) {
-            *error = "given vsock server socket string was invalid";
-            return -1;
-        }
-        if (!android::base::ParseInt(fragments[1], &port)) {
-            *error = "could not parse vsock port";
-            errno = EINVAL;
-            return -1;
-        }
-        if (port < 0) {
-            *error = "vsock port was negative.";
-            errno = EINVAL;
-            return -1;
-        }
-#else   // ADB_LINUX
-        *error = "vsock is only supported on linux";
-        return -1;
-#endif  // ADB_LINUX
-    } else {
-        *error = "given socket spec string was invalid";
-        return -1;
-    }
-    return port;
-}
-
-static bool tcp_host_is_local(std::string_view hostname) {
-    // FIXME
-    return hostname.empty() || hostname == "localhost";
-}
-
-bool is_socket_spec(std::string_view spec) {
-    for (const auto& it : kLocalSocketTypes) {
-        std::string prefix = it.first + ":";
-        if (spec.starts_with(prefix)) {
-            return true;
-        }
-    }
-    return spec.starts_with("tcp:") || spec.starts_with("acceptfd:");
-}
-
-bool is_local_socket_spec(std::string_view spec) {
-    for (const auto& it : kLocalSocketTypes) {
-        std::string prefix = it.first + ":";
-        if (spec.starts_with(prefix)) {
-            return true;
-        }
-    }
-
-    std::string error;
-    std::string hostname;
-    if (!parse_tcp_socket_spec(spec, &hostname, nullptr, nullptr, &error)) {
-        return false;
-    }
-    return tcp_host_is_local(hostname);
-}
-
-bool socket_spec_connect(unique_fd* fd, std::string_view address, int* port, std::string* serial,
-                         std::string* error) {
-    if (address.starts_with("tcp:")) {
-        std::string hostname;
-        int port_value = port ? *port : 0;
-        if (!parse_tcp_socket_spec(address, &hostname, &port_value, serial, error)) {
-            return false;
-        }
-
-        if (tcp_host_is_local(hostname)) {
-            fd->reset(network_loopback_client(port_value, SOCK_STREAM, error));
-        } else {
-#if ADB_HOST
-            fd->reset(network_connect(hostname, port_value, SOCK_STREAM, 0, error));
-#else
-            // Disallow arbitrary connections in adbd.
-            *error = "adbd does not support arbitrary tcp connections";
-            return false;
-#endif
-        }
-
-        if (fd->get() > 0) {
-            disable_tcp_nagle(fd->get());
-            if (port) {
-                *port = port_value;
-            }
-            return true;
-        }
-        return false;
-    } else if (address.starts_with("vsock:")) {
-#if ADB_LINUX
-        std::string spec_str(address);
-        std::vector<std::string> fragments = android::base::Split(spec_str, ":");
-        unsigned int port_value = port ? *port : 0;
-        if (fragments.size() != 2 && fragments.size() != 3) {
-            *error = android::base::StringPrintf("expected vsock:cid or vsock:port:cid in '%s'",
-                                                 spec_str.c_str());
-            errno = EINVAL;
-            return false;
-        }
-        unsigned int cid = 0;
-        if (!android::base::ParseUint(fragments[1], &cid)) {
-            *error = android::base::StringPrintf("could not parse vsock cid in '%s'",
-                                                 spec_str.c_str());
-            errno = EINVAL;
-            return false;
-        }
-        if (fragments.size() == 3 && !android::base::ParseUint(fragments[2], &port_value)) {
-            *error = android::base::StringPrintf("could not parse vsock port in '%s'",
-                                                 spec_str.c_str());
-            errno = EINVAL;
-            return false;
-        }
-        if (port_value == 0) {
-            *error = android::base::StringPrintf("vsock port was not provided.");
-            errno = EINVAL;
-            return false;
-        }
-        fd->reset(socket(AF_VSOCK, SOCK_STREAM, 0));
-        if (fd->get() == -1) {
-            *error = "could not open vsock socket";
-            return false;
-        }
-        sockaddr_vm addr{};
-        addr.svm_family = AF_VSOCK;
-        addr.svm_port = port_value;
-        addr.svm_cid = cid;
-        if (serial) {
-            *serial = android::base::StringPrintf("vsock:%u:%d", cid, port_value);
-        }
-        if (connect(fd->get(), reinterpret_cast<sockaddr*>(&addr), sizeof(addr))) {
-            int error_num = errno;
-            *error = android::base::StringPrintf("could not connect to vsock address '%s'",
-                                                 spec_str.c_str());
-            errno = error_num;
-            return false;
-        }
-        if (port) {
-            *port = port_value;
-        }
-        return true;
-#else   // ADB_LINUX
-        *error = "vsock is only supported on linux";
-        return false;
-#endif  // ADB_LINUX
-    } else if (address.starts_with("acceptfd:")) {
-        *error = "cannot connect to acceptfd";
-        return false;
-    }
-
-    for (const auto& it : kLocalSocketTypes) {
-        std::string prefix = it.first + ":";
-        if (address.starts_with(prefix)) {
-            if (!it.second.available) {
-                *error = StringPrintf("socket type %s is unavailable on this platform",
-                                      it.first.c_str());
-                return false;
-            }
-
-            fd->reset(network_local_client(&address[prefix.length()], it.second.socket_namespace,
-                                           SOCK_STREAM, error));
-
-            if (fd->get() < 0) {
-                *error =
-                        android::base::StringPrintf("could not connect to %s address '%s'",
-                                                    it.first.c_str(), std::string(address).c_str());
-                return false;
-            }
-
-            if (serial) {
-                *serial = address;
-            }
-            return true;
-        }
-    }
-
-    *error = "unknown socket specification: ";
-    *error += address;
-    return false;
-}
-
-int socket_spec_listen(std::string_view spec, std::string* error, int* resolved_port) {
-    if (spec.starts_with("tcp:")) {
-        std::string hostname;
-        int port;
-        if (!parse_tcp_socket_spec(spec, &hostname, &port, nullptr, error)) {
-            return -1;
-        }
-
-        int result;
-#if ADB_HOST
-        if (hostname.empty() && gListenAll) {
-#else
-        if (hostname.empty()) {
-#endif
-            result = network_inaddr_any_server(port, SOCK_STREAM, error);
-        } else if (tcp_host_is_local(hostname)) {
-            result = network_loopback_server(port, SOCK_STREAM, error, true);
-        } else if (hostname == "::1") {
-            result = network_loopback_server(port, SOCK_STREAM, error, false);
-        } else {
-            // TODO: Implement me.
-            *error = "listening on specified hostname currently unsupported";
-            return -1;
-        }
-
-        if (result >= 0 && resolved_port) {
-            *resolved_port = adb_socket_get_local_port(result);
-        }
-        return result;
-    } else if (spec.starts_with("vsock:")) {
-#if ADB_LINUX
-        std::string spec_str(spec);
-        std::vector<std::string> fragments = android::base::Split(spec_str, ":");
-        if (fragments.size() != 2) {
-            *error = "given vsock server socket string was invalid";
-            return -1;
-        }
-        int port;
-        if (!android::base::ParseInt(fragments[1], &port)) {
-            *error = "could not parse vsock port";
-            errno = EINVAL;
-            return -1;
-        } else if (port < 0) {
-            *error = "vsock port was negative.";
-            errno = EINVAL;
-            return -1;
-        }
-        unique_fd serverfd(socket(AF_VSOCK, SOCK_STREAM, 0));
-        if (serverfd == -1) {
-            int error_num = errno;
-            *error = android::base::StringPrintf("could not create vsock server: '%s'",
-                                                 strerror(error_num));
-            errno = error_num;
-            return -1;
-        }
-        sockaddr_vm addr{};
-        addr.svm_family = AF_VSOCK;
-        addr.svm_port = port == 0 ? VMADDR_PORT_ANY : port;
-        addr.svm_cid = VMADDR_CID_ANY;
-        socklen_t addr_len = sizeof(addr);
-        if (bind(serverfd.get(), reinterpret_cast<struct sockaddr*>(&addr), addr_len)) {
-            return -1;
-        }
-        if (listen(serverfd.get(), 4)) {
-            return -1;
-        }
-        if (serverfd >= 0 && resolved_port) {
-            if (getsockname(serverfd.get(), reinterpret_cast<sockaddr*>(&addr), &addr_len) == 0) {
-                *resolved_port = addr.svm_port;
-            } else {
-                return -1;
-            }
-        }
-        return serverfd.release();
-#else   // ADB_LINUX
-        *error = "vsock is only supported on linux";
-        return -1;
-#endif  // ADB_LINUX
-    } else if (ConsumePrefix(&spec, "acceptfd:")) {
-#if ADB_WINDOWS
-        *error = "socket activation not supported under Windows";
-        return -1;
-#else
-        // We inherited the socket from some kind of launcher. It's already bound and
-        // listening. Return a copy of the FD instead of the FD itself so we implement the
-        // normal "listen" contract and can succeed more than once.
-        unsigned int fd_u;
-        if (!ParseUint(&fd_u, spec) || fd_u > std::numeric_limits<int>::max()) {
-            *error = "invalid fd";
-            return -1;
-        }
-        int fd = static_cast<int>(fd_u);
-        int flags = get_fd_flags(fd);
-        if (flags < 0) {
-            *error = android::base::StringPrintf("could not get flags of inherited fd %d: '%s'", fd,
-                                                 strerror(errno));
-            return -1;
-        }
-        if (flags & FD_CLOEXEC) {
-            *error = android::base::StringPrintf("fd %d was not inherited from parent", fd);
-            return -1;
-        }
-
-        int dummy_sock_type;
-        socklen_t dummy_sock_type_size = sizeof(dummy_sock_type);
-        if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &dummy_sock_type, &dummy_sock_type_size)) {
-            *error = android::base::StringPrintf("fd %d does not refer to a socket", fd);
-            return -1;
-        }
-
-        int new_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
-        if (new_fd < 0) {
-            *error = android::base::StringPrintf("could not dup inherited fd %d: '%s'", fd,
-                                                 strerror(errno));
-            return -1;
-        }
-        return new_fd;
-#endif
-    }
-
-    for (const auto& it : kLocalSocketTypes) {
-        std::string prefix = it.first + ":";
-        if (spec.starts_with(prefix)) {
-            if (!it.second.available) {
-                *error = "attempted to listen on unavailable socket type: ";
-                *error += spec;
-                return -1;
-            }
-
-            return network_local_server(&spec[prefix.length()], it.second.socket_namespace,
-                                        SOCK_STREAM, error);
-        }
-    }
-
-    *error = "unknown socket specification:";
-    *error += spec;
-    return -1;
-}
diff --git a/adb/socket_spec.h b/adb/socket_spec.h
deleted file mode 100644
index 94719c8..0000000
--- a/adb/socket_spec.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <string>
-#include <tuple>
-
-#include "adb_unique_fd.h"
-
-// Returns true if the argument starts with a plausible socket prefix.
-bool is_socket_spec(std::string_view spec);
-bool is_local_socket_spec(std::string_view spec);
-
-bool socket_spec_connect(unique_fd* fd, std::string_view address, int* port, std::string* serial,
-                         std::string* error);
-int socket_spec_listen(std::string_view spec, std::string* error, int* resolved_tcp_port = nullptr);
-
-bool parse_tcp_socket_spec(std::string_view spec, std::string* hostname, int* port,
-                           std::string* serial, std::string* error);
-
-int get_host_socket_spec_port(std::string_view spec, std::string* error);
diff --git a/adb/socket_spec_test.cpp b/adb/socket_spec_test.cpp
deleted file mode 100644
index e9d5270..0000000
--- a/adb/socket_spec_test.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "socket_spec.h"
-
-#include <string>
-
-#include <unistd.h>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <gtest/gtest.h>
-
-TEST(socket_spec, parse_tcp_socket_spec_just_port) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_TRUE(parse_tcp_socket_spec("tcp:5037", &hostname, &port, &serial, &error));
-    EXPECT_EQ("", hostname);
-    EXPECT_EQ(5037, port);
-    EXPECT_EQ("", serial);
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_bad_ports) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:", &hostname, &port, &serial, &error));
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:-1", &hostname, &port, &serial, &error));
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:65536", &hostname, &port, &serial, &error));
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_host_and_port) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_TRUE(parse_tcp_socket_spec("tcp:localhost:1234", &hostname, &port, &serial, &error));
-    EXPECT_EQ("localhost", hostname);
-    EXPECT_EQ(1234, port);
-    EXPECT_EQ("localhost:1234", serial);
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_host_no_port) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_TRUE(parse_tcp_socket_spec("tcp:localhost", &hostname, &port, &serial, &error));
-    EXPECT_EQ("localhost", hostname);
-    EXPECT_EQ(5555, port);
-    EXPECT_EQ("localhost:5555", serial);
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_host_bad_ports) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:localhost:", &hostname, &port, &serial, &error));
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:localhost:-1", &hostname, &port, &serial, &error));
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:localhost:65536", &hostname, &port, &serial, &error));
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_ipv6_and_port) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_TRUE(parse_tcp_socket_spec("tcp:[::1]:1234", &hostname, &port, &serial, &error));
-    EXPECT_EQ("::1", hostname);
-    EXPECT_EQ(1234, port);
-    EXPECT_EQ("[::1]:1234", serial);
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_ipv6_no_port) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_TRUE(parse_tcp_socket_spec("tcp:::1", &hostname, &port, &serial, &error));
-    EXPECT_EQ("::1", hostname);
-    EXPECT_EQ(5555, port);
-    EXPECT_EQ("[::1]:5555", serial);
-}
-
-TEST(socket_spec, parse_tcp_socket_spec_ipv6_bad_ports) {
-    std::string hostname, error, serial;
-    int port;
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:[::1]", &hostname, &port, &serial, &error));
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:[::1]:", &hostname, &port, &serial, &error));
-    EXPECT_FALSE(parse_tcp_socket_spec("tcp:[::1]:-1", &hostname, &port, &serial, &error));
-}
-
-TEST(socket_spec, get_host_socket_spec_port) {
-    std::string error;
-    EXPECT_EQ(5555, get_host_socket_spec_port("tcp:5555", &error));
-    EXPECT_EQ(5555, get_host_socket_spec_port("tcp:localhost:5555", &error));
-    EXPECT_EQ(5555, get_host_socket_spec_port("tcp:[::1]:5555", &error));
-    EXPECT_EQ(5555, get_host_socket_spec_port("vsock:5555", &error));
-}
-
-TEST(socket_spec, get_host_socket_spec_port_no_port) {
-    std::string error;
-    EXPECT_EQ(5555, get_host_socket_spec_port("tcp:localhost", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("vsock:localhost", &error));
-}
-
-TEST(socket_spec, get_host_socket_spec_port_bad_ports) {
-    std::string error;
-    EXPECT_EQ(-1, get_host_socket_spec_port("tcp:65536", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("tcp:-5", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("vsock:-5", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("vsock:5:5555", &error));
-}
-
-TEST(socket_spec, get_host_socket_spec_port_bad_string) {
-    std::string error;
-    EXPECT_EQ(-1, get_host_socket_spec_port("tcpz:5555", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("vsockz:5555", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("abcd:5555", &error));
-    EXPECT_EQ(-1, get_host_socket_spec_port("abcd", &error));
-}
-
-TEST(socket_spec, socket_spec_listen_connect_tcp) {
-    std::string error, serial;
-    int port;
-    unique_fd server_fd, client_fd;
-    EXPECT_FALSE(socket_spec_connect(&client_fd, "tcp:localhost:7777", &port, &serial, &error));
-    server_fd.reset(socket_spec_listen("tcp:7777", &error, &port));
-    EXPECT_NE(server_fd.get(), -1);
-    EXPECT_TRUE(socket_spec_connect(&client_fd, "tcp:localhost:7777", &port, &serial, &error));
-    EXPECT_NE(client_fd.get(), -1);
-}
-
-TEST(socket_spec, socket_spec_listen_connect_localfilesystem) {
-    std::string error, serial;
-    int port;
-    unique_fd server_fd, client_fd;
-    TemporaryDir sock_dir;
-
-    // Only run this test if the created directory is writable.
-    int result = access(sock_dir.path, W_OK);
-    if (result == 0) {
-        std::string sock_addr =
-                android::base::StringPrintf("localfilesystem:%s/af_unix_socket", sock_dir.path);
-        EXPECT_FALSE(socket_spec_connect(&client_fd, sock_addr, &port, &serial, &error));
-        server_fd.reset(socket_spec_listen(sock_addr, &error, &port));
-        EXPECT_NE(server_fd.get(), -1);
-        EXPECT_TRUE(socket_spec_connect(&client_fd, sock_addr, &port, &serial, &error));
-        EXPECT_NE(client_fd.get(), -1);
-    }
-}
diff --git a/adb/socket_test.cpp b/adb/socket_test.cpp
deleted file mode 100644
index 1601ff0..0000000
--- a/adb/socket_test.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "fdevent/fdevent.h"
-
-#include <gtest/gtest.h>
-
-#include <array>
-#include <limits>
-#include <queue>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include <unistd.h>
-
-#include "adb.h"
-#include "adb_io.h"
-#include "fdevent/fdevent_test.h"
-#include "socket.h"
-#include "sysdeps.h"
-#include "sysdeps/chrono.h"
-
-using namespace std::string_literals;
-using namespace std::string_view_literals;
-
-struct ThreadArg {
-    int first_read_fd;
-    int last_write_fd;
-    size_t middle_pipe_count;
-};
-
-class LocalSocketTest : public FdeventTest {};
-
-TEST_F(LocalSocketTest, smoke) {
-    // Join two socketpairs with a chain of intermediate socketpairs.
-    int first[2];
-    std::vector<std::array<int, 2>> intermediates;
-    int last[2];
-
-    constexpr size_t INTERMEDIATE_COUNT = 50;
-    constexpr size_t MESSAGE_LOOP_COUNT = 100;
-    const std::string MESSAGE = "socket_test";
-
-    intermediates.resize(INTERMEDIATE_COUNT);
-    ASSERT_EQ(0, adb_socketpair(first)) << strerror(errno);
-    ASSERT_EQ(0, adb_socketpair(last)) << strerror(errno);
-    asocket* prev_tail = create_local_socket(unique_fd(first[1]));
-    ASSERT_NE(nullptr, prev_tail);
-
-    auto connect = [](asocket* tail, asocket* head) {
-        tail->peer = head;
-        head->peer = tail;
-        tail->ready(tail);
-    };
-
-    for (auto& intermediate : intermediates) {
-        ASSERT_EQ(0, adb_socketpair(intermediate.data())) << strerror(errno);
-
-        asocket* head = create_local_socket(unique_fd(intermediate[0]));
-        ASSERT_NE(nullptr, head);
-
-        asocket* tail = create_local_socket(unique_fd(intermediate[1]));
-        ASSERT_NE(nullptr, tail);
-
-        connect(prev_tail, head);
-        prev_tail = tail;
-    }
-
-    asocket* end = create_local_socket(unique_fd(last[0]));
-    ASSERT_NE(nullptr, end);
-    connect(prev_tail, end);
-
-    PrepareThread();
-
-    for (size_t i = 0; i < MESSAGE_LOOP_COUNT; ++i) {
-        std::string read_buffer = MESSAGE;
-        std::string write_buffer(MESSAGE.size(), 'a');
-        ASSERT_TRUE(WriteFdExactly(first[0], &read_buffer[0], read_buffer.size()));
-        ASSERT_TRUE(ReadFdExactly(last[1], &write_buffer[0], write_buffer.size()));
-        ASSERT_EQ(read_buffer, write_buffer);
-    }
-
-    ASSERT_EQ(0, adb_close(first[0]));
-    ASSERT_EQ(0, adb_close(last[1]));
-
-    // Wait until the local sockets are closed.
-    WaitForFdeventLoop();
-    ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    TerminateThread();
-}
-
-struct CloseWithPacketArg {
-    unique_fd socket_fd;
-    size_t bytes_written;
-    unique_fd cause_close_fd;
-};
-
-static void CreateCloser(CloseWithPacketArg* arg) {
-    fdevent_run_on_main_thread([arg]() {
-        asocket* s = create_local_socket(std::move(arg->socket_fd));
-        ASSERT_TRUE(s != nullptr);
-        arg->bytes_written = 0;
-
-        // On platforms that implement sockets via underlying sockets (e.g. Wine),
-        // a socket can appear to be full, and then become available for writes
-        // again without read being called on the other end. Loop and sleep after
-        // each write to give the underlying implementation time to flush.
-        bool socket_filled = false;
-        for (int i = 0; i < 128; ++i) {
-            apacket::payload_type data;
-            data.resize(MAX_PAYLOAD);
-            arg->bytes_written += data.size();
-            int ret = s->enqueue(s, std::move(data));
-            if (ret == 1) {
-                socket_filled = true;
-                break;
-            }
-            ASSERT_NE(-1, ret);
-
-            std::this_thread::sleep_for(250ms);
-        }
-        ASSERT_TRUE(socket_filled);
-
-        asocket* cause_close_s = create_local_socket(std::move(arg->cause_close_fd));
-        ASSERT_TRUE(cause_close_s != nullptr);
-        cause_close_s->peer = s;
-        s->peer = cause_close_s;
-        cause_close_s->ready(cause_close_s);
-    });
-    WaitForFdeventLoop();
-}
-
-// This test checks if we can close local socket in the following situation:
-// The socket is closing but having some packets, so it is not closed. Then
-// some write error happens in the socket's file handler, e.g., the file
-// handler is closed.
-TEST_F(LocalSocketTest, close_socket_with_packet) {
-    int socket_fd[2];
-    ASSERT_EQ(0, adb_socketpair(socket_fd));
-    int cause_close_fd[2];
-    ASSERT_EQ(0, adb_socketpair(cause_close_fd));
-    CloseWithPacketArg arg;
-    arg.socket_fd.reset(socket_fd[1]);
-    arg.cause_close_fd.reset(cause_close_fd[1]);
-
-    PrepareThread();
-    CreateCloser(&arg);
-
-    ASSERT_EQ(0, adb_close(cause_close_fd[0]));
-
-    WaitForFdeventLoop();
-    EXPECT_EQ(1u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    ASSERT_EQ(0, adb_close(socket_fd[0]));
-
-    WaitForFdeventLoop();
-    ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    TerminateThread();
-}
-
-// This test checks if we can read packets from a closing local socket.
-TEST_F(LocalSocketTest, read_from_closing_socket) {
-    int socket_fd[2];
-    ASSERT_EQ(0, adb_socketpair(socket_fd));
-    int cause_close_fd[2];
-    ASSERT_EQ(0, adb_socketpair(cause_close_fd));
-    CloseWithPacketArg arg;
-    arg.socket_fd.reset(socket_fd[1]);
-    arg.cause_close_fd.reset(cause_close_fd[1]);
-
-    PrepareThread();
-    CreateCloser(&arg);
-
-    WaitForFdeventLoop();
-    ASSERT_EQ(0, adb_close(cause_close_fd[0]));
-
-    WaitForFdeventLoop();
-    EXPECT_EQ(1u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
-
-    // Verify if we can read successfully.
-    std::vector<char> buf(arg.bytes_written);
-    ASSERT_NE(0u, arg.bytes_written);
-    ASSERT_EQ(true, ReadFdExactly(socket_fd[0], buf.data(), buf.size()));
-    ASSERT_EQ(0, adb_close(socket_fd[0]));
-
-    WaitForFdeventLoop();
-    ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    TerminateThread();
-}
-
-// This test checks if we can close local socket in the following situation:
-// The socket is not closed and has some packets. When it fails to write to
-// the socket's file handler because the other end is closed, we check if the
-// socket is closed.
-TEST_F(LocalSocketTest, write_error_when_having_packets) {
-    int socket_fd[2];
-    ASSERT_EQ(0, adb_socketpair(socket_fd));
-    int cause_close_fd[2];
-    ASSERT_EQ(0, adb_socketpair(cause_close_fd));
-    CloseWithPacketArg arg;
-    arg.socket_fd.reset(socket_fd[1]);
-    arg.cause_close_fd.reset(cause_close_fd[1]);
-
-    PrepareThread();
-    CreateCloser(&arg);
-
-    WaitForFdeventLoop();
-    EXPECT_EQ(2u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    ASSERT_EQ(0, adb_close(socket_fd[0]));
-
-    std::this_thread::sleep_for(2s);
-
-    WaitForFdeventLoop();
-    ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    TerminateThread();
-}
-
-// Ensure that if we fail to write output to an fd, we will still flush data coming from it.
-TEST_F(LocalSocketTest, flush_after_shutdown) {
-    int head_fd[2];
-    int tail_fd[2];
-    ASSERT_EQ(0, adb_socketpair(head_fd));
-    ASSERT_EQ(0, adb_socketpair(tail_fd));
-
-    asocket* head = create_local_socket(unique_fd(head_fd[1]));
-    asocket* tail = create_local_socket(unique_fd(tail_fd[1]));
-
-    head->peer = tail;
-    head->ready(head);
-
-    tail->peer = head;
-    tail->ready(tail);
-
-    PrepareThread();
-
-    EXPECT_TRUE(WriteFdExactly(head_fd[0], "foo", 3));
-
-    EXPECT_EQ(0, adb_shutdown(head_fd[0], SHUT_RD));
-    const char* str = "write succeeds, but local_socket will fail to write";
-    EXPECT_TRUE(WriteFdExactly(tail_fd[0], str, strlen(str)));
-    EXPECT_TRUE(WriteFdExactly(head_fd[0], "bar", 3));
-
-    char buf[6];
-    EXPECT_TRUE(ReadFdExactly(tail_fd[0], buf, 6));
-    EXPECT_EQ(0, memcmp(buf, "foobar", 6));
-
-    adb_close(head_fd[0]);
-    adb_close(tail_fd[0]);
-
-    WaitForFdeventLoop();
-    ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    TerminateThread();
-}
-
-#if defined(__linux__)
-
-static void ClientThreadFunc() {
-    std::string error;
-    int fd = network_loopback_client(5038, SOCK_STREAM, &error);
-    ASSERT_GE(fd, 0) << error;
-    std::this_thread::sleep_for(1s);
-    ASSERT_EQ(0, adb_close(fd));
-}
-
-// This test checks if we can close sockets in CLOSE_WAIT state.
-TEST_F(LocalSocketTest, close_socket_in_CLOSE_WAIT_state) {
-    std::string error;
-    int listen_fd = network_inaddr_any_server(5038, SOCK_STREAM, &error);
-    ASSERT_GE(listen_fd, 0);
-
-    std::thread client_thread(ClientThreadFunc);
-
-    int accept_fd = adb_socket_accept(listen_fd, nullptr, nullptr);
-    ASSERT_GE(accept_fd, 0);
-
-    PrepareThread();
-
-    fdevent_run_on_main_thread([accept_fd]() {
-        asocket* s = create_local_socket(unique_fd(accept_fd));
-        ASSERT_TRUE(s != nullptr);
-    });
-
-    WaitForFdeventLoop();
-    EXPECT_EQ(1u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
-
-    // Wait until the client closes its socket.
-    client_thread.join();
-
-    WaitForFdeventLoop();
-    ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
-    TerminateThread();
-}
-
-#endif  // defined(__linux__)
-
-#if ADB_HOST
-
-#define VerifyParseHostServiceFailed(s)                                         \
-    do {                                                                        \
-        std::string service(s);                                                 \
-        std::string_view serial, command;                                       \
-        bool result = internal::parse_host_service(&serial, &command, service); \
-        EXPECT_FALSE(result);                                                   \
-    } while (0)
-
-#define VerifyParseHostService(s, expected_serial, expected_command)            \
-    do {                                                                        \
-        std::string service(s);                                                 \
-        std::string_view serial, command;                                       \
-        bool result = internal::parse_host_service(&serial, &command, service); \
-        EXPECT_TRUE(result);                                                    \
-        EXPECT_EQ(std::string(expected_serial), std::string(serial));           \
-        EXPECT_EQ(std::string(expected_command), std::string(command));         \
-    } while (0);
-
-// Check [tcp:|udp:]<serial>[:<port>]:<command> format.
-TEST(socket_test, test_parse_host_service) {
-    for (const std::string& protocol : {"", "tcp:", "udp:"}) {
-        VerifyParseHostServiceFailed(protocol);
-        VerifyParseHostServiceFailed(protocol + "foo");
-
-        {
-            std::string serial = protocol + "foo";
-            VerifyParseHostService(serial + ":bar", serial, "bar");
-            VerifyParseHostService(serial + " :bar:baz", serial, "bar:baz");
-        }
-
-        {
-            // With port.
-            std::string serial = protocol + "foo:123";
-            VerifyParseHostService(serial + ":bar", serial, "bar");
-            VerifyParseHostService(serial + ":456", serial, "456");
-            VerifyParseHostService(serial + ":bar:baz", serial, "bar:baz");
-        }
-
-        // Don't register a port unless it's all numbers and ends with ':'.
-        VerifyParseHostService(protocol + "foo:123", protocol + "foo", "123");
-        VerifyParseHostService(protocol + "foo:123bar:baz", protocol + "foo", "123bar:baz");
-
-        std::string addresses[] = {"100.100.100.100", "[0123:4567:89ab:CDEF:0:9:a:f]", "[::1]"};
-        for (const std::string& address : addresses) {
-            std::string serial = protocol + address;
-            std::string serial_with_port = protocol + address + ":5555";
-            VerifyParseHostService(serial + ":foo", serial, "foo");
-            VerifyParseHostService(serial_with_port + ":foo", serial_with_port, "foo");
-        }
-
-        // If we can't find both [] then treat it as a normal serial with [ in it.
-        VerifyParseHostService(protocol + "[0123:foo", protocol + "[0123", "foo");
-
-        // Don't be fooled by random IPv6 addresses in the command string.
-        VerifyParseHostService(protocol + "foo:ping [0123:4567:89ab:CDEF:0:9:a:f]:5555",
-                               protocol + "foo", "ping [0123:4567:89ab:CDEF:0:9:a:f]:5555");
-
-        // Handle embedded NULs properly.
-        VerifyParseHostService(protocol + "foo:echo foo\0bar"s, protocol + "foo",
-                               "echo foo\0bar"sv);
-    }
-}
-
-// Check <prefix>:<serial>:<command> format.
-TEST(socket_test, test_parse_host_service_prefix) {
-    for (const std::string& prefix : {"usb:", "product:", "model:", "device:"}) {
-        VerifyParseHostServiceFailed(prefix);
-        VerifyParseHostServiceFailed(prefix + "foo");
-
-        VerifyParseHostService(prefix + "foo:bar", prefix + "foo", "bar");
-        VerifyParseHostService(prefix + "foo:bar:baz", prefix + "foo", "bar:baz");
-        VerifyParseHostService(prefix + "foo:123:bar", prefix + "foo", "123:bar");
-    }
-}
-
-#endif  // ADB_HOST
diff --git a/adb/sockets.cpp b/adb/sockets.cpp
deleted file mode 100644
index 423af67..0000000
--- a/adb/sockets.cpp
+++ /dev/null
@@ -1,935 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG SOCKETS
-
-#include "sysdeps.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <chrono>
-#include <mutex>
-#include <string>
-#include <vector>
-
-#include <android-base/strings.h>
-
-#if !ADB_HOST
-#include <android-base/properties.h>
-#include <log/log_properties.h>
-#endif
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_utils.h"
-#include "transport.h"
-#include "types.h"
-
-using namespace std::chrono_literals;
-
-static std::recursive_mutex& local_socket_list_lock = *new std::recursive_mutex();
-static unsigned local_socket_next_id = 1;
-
-static auto& local_socket_list = *new std::vector<asocket*>();
-
-/* the the list of currently closing local sockets.
-** these have no peer anymore, but still packets to
-** write to their fd.
-*/
-static auto& local_socket_closing_list = *new std::vector<asocket*>();
-
-// Parse the global list of sockets to find one with id |local_id|.
-// If |peer_id| is not 0, also check that it is connected to a peer
-// with id |peer_id|. Returns an asocket handle on success, NULL on failure.
-asocket* find_local_socket(unsigned local_id, unsigned peer_id) {
-    asocket* result = nullptr;
-
-    std::lock_guard<std::recursive_mutex> lock(local_socket_list_lock);
-    for (asocket* s : local_socket_list) {
-        if (s->id != local_id) {
-            continue;
-        }
-        if (peer_id == 0 || (s->peer && s->peer->id == peer_id)) {
-            result = s;
-        }
-        break;
-    }
-
-    return result;
-}
-
-void install_local_socket(asocket* s) {
-    std::lock_guard<std::recursive_mutex> lock(local_socket_list_lock);
-
-    s->id = local_socket_next_id++;
-
-    // Socket ids should never be 0.
-    if (local_socket_next_id == 0) {
-        LOG(FATAL) << "local socket id overflow";
-    }
-
-    local_socket_list.push_back(s);
-}
-
-void remove_socket(asocket* s) {
-    std::lock_guard<std::recursive_mutex> lock(local_socket_list_lock);
-    for (auto list : { &local_socket_list, &local_socket_closing_list }) {
-        list->erase(std::remove_if(list->begin(), list->end(), [s](asocket* x) { return x == s; }),
-                    list->end());
-    }
-}
-
-void close_all_sockets(atransport* t) {
-    /* this is a little gross, but since s->close() *will* modify
-    ** the list out from under you, your options are limited.
-    */
-    std::lock_guard<std::recursive_mutex> lock(local_socket_list_lock);
-restart:
-    for (asocket* s : local_socket_list) {
-        if (s->transport == t || (s->peer && s->peer->transport == t)) {
-            s->close(s);
-            goto restart;
-        }
-    }
-}
-
-enum class SocketFlushResult {
-    Destroyed,
-    TryAgain,
-    Completed,
-};
-
-static SocketFlushResult local_socket_flush_incoming(asocket* s) {
-    if (!s->packet_queue.empty()) {
-        std::vector<adb_iovec> iov = s->packet_queue.iovecs();
-        ssize_t rc = adb_writev(s->fd, iov.data(), iov.size());
-        if (rc > 0 && static_cast<size_t>(rc) == s->packet_queue.size()) {
-            s->packet_queue.clear();
-        } else if (rc > 0) {
-            s->packet_queue.drop_front(rc);
-            fdevent_add(s->fde, FDE_WRITE);
-            return SocketFlushResult::TryAgain;
-        } else if (rc == -1 && errno == EAGAIN) {
-            fdevent_add(s->fde, FDE_WRITE);
-            return SocketFlushResult::TryAgain;
-        } else {
-            // We failed to write, but it's possible that we can still read from the socket.
-            // Give that a try before giving up.
-            s->has_write_error = true;
-        }
-    }
-
-    // If we sent the last packet of a closing socket, we can now destroy it.
-    if (s->closing) {
-        s->close(s);
-        return SocketFlushResult::Destroyed;
-    }
-
-    fdevent_del(s->fde, FDE_WRITE);
-    return SocketFlushResult::Completed;
-}
-
-// Returns false if the socket has been closed and destroyed as a side-effect of this function.
-static bool local_socket_flush_outgoing(asocket* s) {
-    const size_t max_payload = s->get_max_payload();
-    apacket::payload_type data;
-    data.resize(max_payload);
-    char* x = &data[0];
-    size_t avail = max_payload;
-    int r = 0;
-    int is_eof = 0;
-
-    while (avail > 0) {
-        r = adb_read(s->fd, x, avail);
-        D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%zu", s->id, s->fd, r,
-          r < 0 ? errno : 0, avail);
-        if (r == -1) {
-            if (errno == EAGAIN) {
-                break;
-            }
-        } else if (r > 0) {
-            avail -= r;
-            x += r;
-            continue;
-        }
-
-        /* r = 0 or unhandled error */
-        is_eof = 1;
-        break;
-    }
-    D("LS(%d): fd=%d post avail loop. r=%d is_eof=%d forced_eof=%d", s->id, s->fd, r, is_eof,
-      s->fde->force_eof);
-
-    if (avail != max_payload && s->peer) {
-        data.resize(max_payload - avail);
-
-        // s->peer->enqueue() may call s->close() and free s,
-        // so save variables for debug printing below.
-        unsigned saved_id = s->id;
-        int saved_fd = s->fd;
-        r = s->peer->enqueue(s->peer, std::move(data));
-        D("LS(%u): fd=%d post peer->enqueue(). r=%d", saved_id, saved_fd, r);
-
-        if (r < 0) {
-            // Error return means they closed us as a side-effect and we must
-            // return immediately.
-            //
-            // Note that if we still have buffered packets, the socket will be
-            // placed on the closing socket list. This handler function will be
-            // called again to process FDE_WRITE events.
-            return false;
-        }
-
-        if (r > 0) {
-            /* if the remote cannot accept further events,
-            ** we disable notification of READs.  They'll
-            ** be enabled again when we get a call to ready()
-            */
-            fdevent_del(s->fde, FDE_READ);
-        }
-    }
-
-    // Don't allow a forced eof if data is still there.
-    if ((s->fde->force_eof && !r) || is_eof) {
-        D(" closing because is_eof=%d r=%d s->fde.force_eof=%d", is_eof, r, s->fde->force_eof);
-        s->close(s);
-        return false;
-    }
-
-    return true;
-}
-
-static int local_socket_enqueue(asocket* s, apacket::payload_type data) {
-    D("LS(%d): enqueue %zu", s->id, data.size());
-
-    s->packet_queue.append(std::move(data));
-    switch (local_socket_flush_incoming(s)) {
-        case SocketFlushResult::Destroyed:
-            return -1;
-
-        case SocketFlushResult::TryAgain:
-            return 1;
-
-        case SocketFlushResult::Completed:
-            return 0;
-    }
-
-    return !s->packet_queue.empty();
-}
-
-static void local_socket_ready(asocket* s) {
-    /* far side is ready for data, pay attention to
-       readable events */
-    fdevent_add(s->fde, FDE_READ);
-}
-
-struct ClosingSocket {
-    std::chrono::steady_clock::time_point begin;
-};
-
-// The standard (RFC 1122 - 4.2.2.13) says that if we call close on a
-// socket while we have pending data, a TCP RST should be sent to the
-// other end to notify it that we didn't read all of its data. However,
-// this can result in data that we've successfully written out to be dropped
-// on the other end. To avoid this, instead of immediately closing a
-// socket, call shutdown on it instead, and then read from the file
-// descriptor until we hit EOF or an error before closing.
-static void deferred_close(unique_fd fd) {
-    // Shutdown the socket in the outgoing direction only, so that
-    // we don't have the same problem on the opposite end.
-    adb_shutdown(fd.get(), SHUT_WR);
-    auto callback = [](fdevent* fde, unsigned event, void* arg) {
-        auto socket_info = static_cast<ClosingSocket*>(arg);
-        if (event & FDE_READ) {
-            ssize_t rc;
-            char buf[BUFSIZ];
-            while ((rc = adb_read(fde->fd.get(), buf, sizeof(buf))) > 0) {
-                continue;
-            }
-
-            if (rc == -1 && errno == EAGAIN) {
-                // There's potentially more data to read.
-                auto duration = std::chrono::steady_clock::now() - socket_info->begin;
-                if (duration > 1s) {
-                    LOG(WARNING) << "timeout expired while flushing socket, closing";
-                } else {
-                    return;
-                }
-            }
-        } else if (event & FDE_TIMEOUT) {
-            LOG(WARNING) << "timeout expired while flushing socket, closing";
-        }
-
-        // Either there was an error, we hit the end of the socket, or our timeout expired.
-        fdevent_destroy(fde);
-        delete socket_info;
-    };
-
-    ClosingSocket* socket_info = new ClosingSocket{
-            .begin = std::chrono::steady_clock::now(),
-    };
-
-    fdevent* fde = fdevent_create(fd.release(), callback, socket_info);
-    fdevent_add(fde, FDE_READ);
-    fdevent_set_timeout(fde, 1s);
-}
-
-// be sure to hold the socket list lock when calling this
-static void local_socket_destroy(asocket* s) {
-    int exit_on_close = s->exit_on_close;
-
-    D("LS(%d): destroying fde.fd=%d", s->id, s->fd);
-
-    deferred_close(fdevent_release(s->fde));
-
-    remove_socket(s);
-    delete s;
-
-    if (exit_on_close) {
-        D("local_socket_destroy: exiting");
-        exit(1);
-    }
-}
-
-static void local_socket_close(asocket* s) {
-    D("entered local_socket_close. LS(%d) fd=%d", s->id, s->fd);
-    std::lock_guard<std::recursive_mutex> lock(local_socket_list_lock);
-    if (s->peer) {
-        D("LS(%d): closing peer. peer->id=%d peer->fd=%d", s->id, s->peer->id, s->peer->fd);
-        /* Note: it's important to call shutdown before disconnecting from
-         * the peer, this ensures that remote sockets can still get the id
-         * of the local socket they're connected to, to send a CLOSE()
-         * protocol event. */
-        if (s->peer->shutdown) {
-            s->peer->shutdown(s->peer);
-        }
-        s->peer->peer = nullptr;
-        s->peer->close(s->peer);
-        s->peer = nullptr;
-    }
-
-    /* If we are already closing, or if there are no
-    ** pending packets, destroy immediately
-    */
-    if (s->closing || s->has_write_error || s->packet_queue.empty()) {
-        int id = s->id;
-        local_socket_destroy(s);
-        D("LS(%d): closed", id);
-        return;
-    }
-
-    /* otherwise, put on the closing list
-    */
-    D("LS(%d): closing", s->id);
-    s->closing = 1;
-    fdevent_del(s->fde, FDE_READ);
-    remove_socket(s);
-    D("LS(%d): put on socket_closing_list fd=%d", s->id, s->fd);
-    local_socket_closing_list.push_back(s);
-    CHECK_EQ(FDE_WRITE, s->fde->state & FDE_WRITE);
-}
-
-static void local_socket_event_func(int fd, unsigned ev, void* _s) {
-    asocket* s = reinterpret_cast<asocket*>(_s);
-    D("LS(%d): event_func(fd=%d(==%d), ev=%04x)", s->id, s->fd, fd, ev);
-
-    /* put the FDE_WRITE processing before the FDE_READ
-    ** in order to simplify the code.
-    */
-    if (ev & FDE_WRITE) {
-        switch (local_socket_flush_incoming(s)) {
-            case SocketFlushResult::Destroyed:
-                return;
-
-            case SocketFlushResult::TryAgain:
-                break;
-
-            case SocketFlushResult::Completed:
-                s->peer->ready(s->peer);
-                break;
-        }
-    }
-
-    if (ev & FDE_READ) {
-        if (!local_socket_flush_outgoing(s)) {
-            return;
-        }
-    }
-
-    if (ev & FDE_ERROR) {
-        /* this should be caught be the next read or write
-        ** catching it here means we may skip the last few
-        ** bytes of readable data.
-        */
-        D("LS(%d): FDE_ERROR (fd=%d)", s->id, s->fd);
-        return;
-    }
-}
-
-asocket* create_local_socket(unique_fd ufd) {
-    int fd = ufd.release();
-    asocket* s = new asocket();
-    s->fd = fd;
-    s->enqueue = local_socket_enqueue;
-    s->ready = local_socket_ready;
-    s->shutdown = nullptr;
-    s->close = local_socket_close;
-    install_local_socket(s);
-
-    s->fde = fdevent_create(fd, local_socket_event_func, s);
-    D("LS(%d): created (fd=%d)", s->id, s->fd);
-    return s;
-}
-
-asocket* create_local_service_socket(std::string_view name, atransport* transport) {
-#if !ADB_HOST
-    if (asocket* s = daemon_service_to_socket(name); s) {
-        return s;
-    }
-#endif
-    unique_fd fd = service_to_fd(name, transport);
-    if (fd < 0) {
-        return nullptr;
-    }
-
-    int fd_value = fd.get();
-    asocket* s = create_local_socket(std::move(fd));
-    LOG(VERBOSE) << "LS(" << s->id << "): bound to '" << name << "' via " << fd_value;
-
-#if !ADB_HOST
-    if ((name.starts_with("root:") && getuid() != 0 && __android_log_is_debuggable()) ||
-        (name.starts_with("unroot:") && getuid() == 0) || name.starts_with("usb:") ||
-        name.starts_with("tcpip:")) {
-        D("LS(%d): enabling exit_on_close", s->id);
-        s->exit_on_close = 1;
-    }
-#endif
-
-    return s;
-}
-
-static int remote_socket_enqueue(asocket* s, apacket::payload_type data) {
-    D("entered remote_socket_enqueue RS(%d) WRITE fd=%d peer.fd=%d", s->id, s->fd, s->peer->fd);
-    apacket* p = get_apacket();
-
-    p->msg.command = A_WRTE;
-    p->msg.arg0 = s->peer->id;
-    p->msg.arg1 = s->id;
-
-    if (data.size() > MAX_PAYLOAD) {
-        put_apacket(p);
-        return -1;
-    }
-
-    p->payload = std::move(data);
-    p->msg.data_length = p->payload.size();
-
-    send_packet(p, s->transport);
-    return 1;
-}
-
-static void remote_socket_ready(asocket* s) {
-    D("entered remote_socket_ready RS(%d) OKAY fd=%d peer.fd=%d", s->id, s->fd, s->peer->fd);
-    apacket* p = get_apacket();
-    p->msg.command = A_OKAY;
-    p->msg.arg0 = s->peer->id;
-    p->msg.arg1 = s->id;
-    send_packet(p, s->transport);
-}
-
-static void remote_socket_shutdown(asocket* s) {
-    D("entered remote_socket_shutdown RS(%d) CLOSE fd=%d peer->fd=%d", s->id, s->fd,
-      s->peer ? s->peer->fd : -1);
-    apacket* p = get_apacket();
-    p->msg.command = A_CLSE;
-    if (s->peer) {
-        p->msg.arg0 = s->peer->id;
-    }
-    p->msg.arg1 = s->id;
-    send_packet(p, s->transport);
-}
-
-static void remote_socket_close(asocket* s) {
-    if (s->peer) {
-        s->peer->peer = nullptr;
-        D("RS(%d) peer->close()ing peer->id=%d peer->fd=%d", s->id, s->peer->id, s->peer->fd);
-        s->peer->close(s->peer);
-    }
-    D("entered remote_socket_close RS(%d) CLOSE fd=%d peer->fd=%d", s->id, s->fd,
-      s->peer ? s->peer->fd : -1);
-    D("RS(%d): closed", s->id);
-    delete s;
-}
-
-// Create a remote socket to exchange packets with a remote service through transport
-// |t|. Where |id| is the socket id of the corresponding service on the other
-//  side of the transport (it is allocated by the remote side and _cannot_ be 0).
-// Returns a new non-NULL asocket handle.
-asocket* create_remote_socket(unsigned id, atransport* t) {
-    if (id == 0) {
-        LOG(FATAL) << "invalid remote socket id (0)";
-    }
-    asocket* s = new asocket();
-    s->id = id;
-    s->enqueue = remote_socket_enqueue;
-    s->ready = remote_socket_ready;
-    s->shutdown = remote_socket_shutdown;
-    s->close = remote_socket_close;
-    s->transport = t;
-
-    D("RS(%d): created", s->id);
-    return s;
-}
-
-void connect_to_remote(asocket* s, std::string_view destination) {
-    D("Connect_to_remote call RS(%d) fd=%d", s->id, s->fd);
-    apacket* p = get_apacket();
-
-    LOG(VERBOSE) << "LS(" << s->id << ": connect(" << destination << ")";
-    p->msg.command = A_OPEN;
-    p->msg.arg0 = s->id;
-
-    // adbd used to expect a null-terminated string.
-    // Keep doing so to maintain backward compatibility.
-    p->payload.resize(destination.size() + 1);
-    memcpy(p->payload.data(), destination.data(), destination.size());
-    p->payload[destination.size()] = '\0';
-    p->msg.data_length = p->payload.size();
-
-    CHECK_LE(p->msg.data_length, s->get_max_payload());
-
-    send_packet(p, s->transport);
-}
-
-/* this is used by magic sockets to rig local sockets to
-   send the go-ahead message when they connect */
-static void local_socket_ready_notify(asocket* s) {
-    s->ready = local_socket_ready;
-    s->shutdown = nullptr;
-    s->close = local_socket_close;
-    SendOkay(s->fd);
-    s->ready(s);
-}
-
-/* this is used by magic sockets to rig local sockets to
-   send the failure message if they are closed before
-   connected (to avoid closing them without a status message) */
-static void local_socket_close_notify(asocket* s) {
-    s->ready = local_socket_ready;
-    s->shutdown = nullptr;
-    s->close = local_socket_close;
-    SendFail(s->fd, "closed");
-    s->close(s);
-}
-
-static unsigned unhex(const char* s, int len) {
-    unsigned n = 0, c;
-
-    while (len-- > 0) {
-        switch ((c = *s++)) {
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-                c -= '0';
-                break;
-            case 'a':
-            case 'b':
-            case 'c':
-            case 'd':
-            case 'e':
-            case 'f':
-                c = c - 'a' + 10;
-                break;
-            case 'A':
-            case 'B':
-            case 'C':
-            case 'D':
-            case 'E':
-            case 'F':
-                c = c - 'A' + 10;
-                break;
-            default:
-                return 0xffffffff;
-        }
-
-        n = (n << 4) | c;
-    }
-
-    return n;
-}
-
-#if ADB_HOST
-
-namespace internal {
-
-// Parses a host service string of the following format:
-//   * [tcp:|udp:]<serial>[:<port>]:<command>
-//   * <prefix>:<serial>:<command>
-// Where <port> must be a base-10 number and <prefix> may be any of {usb,product,model,device}.
-bool parse_host_service(std::string_view* out_serial, std::string_view* out_command,
-                        std::string_view full_service) {
-    if (full_service.empty()) {
-        return false;
-    }
-
-    std::string_view serial;
-    std::string_view command = full_service;
-    // Remove |count| bytes from the beginning of command and add them to |serial|.
-    auto consume = [&full_service, &serial, &command](size_t count) {
-        CHECK_LE(count, command.size());
-        if (!serial.empty()) {
-            CHECK_EQ(serial.data() + serial.size(), command.data());
-        }
-
-        serial = full_service.substr(0, serial.size() + count);
-        command.remove_prefix(count);
-    };
-
-    // Remove the trailing : from serial, and assign the values to the output parameters.
-    auto finish = [out_serial, out_command, &serial, &command] {
-        if (serial.empty() || command.empty()) {
-            return false;
-        }
-
-        CHECK_EQ(':', serial.back());
-        serial.remove_suffix(1);
-
-        *out_serial = serial;
-        *out_command = command;
-        return true;
-    };
-
-    static constexpr std::string_view prefixes[] = {
-            "usb:", "product:", "model:", "device:", "localfilesystem:"};
-    for (std::string_view prefix : prefixes) {
-        if (command.starts_with(prefix)) {
-            consume(prefix.size());
-
-            size_t offset = command.find_first_of(':');
-            if (offset == std::string::npos) {
-                return false;
-            }
-            consume(offset + 1);
-            return finish();
-        }
-    }
-
-    // For fastboot compatibility, ignore protocol prefixes.
-    if (command.starts_with("tcp:") || command.starts_with("udp:")) {
-        consume(4);
-        if (command.empty()) {
-            return false;
-        }
-    }
-    if (command.starts_with("vsock:")) {
-        // vsock serials are vsock:cid:port, which have an extra colon compared to tcp.
-        size_t next_colon = command.find(':');
-        if (next_colon == std::string::npos) {
-            return false;
-        }
-        consume(next_colon + 1);
-    }
-
-    bool found_address = false;
-    if (command[0] == '[') {
-        // Read an IPv6 address. `adb connect` creates the serial number from the canonical
-        // network address so it will always have the [] delimiters.
-        size_t ipv6_end = command.find_first_of(']');
-        if (ipv6_end != std::string::npos) {
-            consume(ipv6_end + 1);
-            if (command.empty()) {
-                // Nothing after the IPv6 address.
-                return false;
-            } else if (command[0] != ':') {
-                // Garbage after the IPv6 address.
-                return false;
-            }
-            consume(1);
-            found_address = true;
-        }
-    }
-
-    if (!found_address) {
-        // Scan ahead to the next colon.
-        size_t offset = command.find_first_of(':');
-        if (offset == std::string::npos) {
-            return false;
-        }
-        consume(offset + 1);
-    }
-
-    // We're either at the beginning of a port, or the command itself.
-    // Look for a port in between colons.
-    size_t next_colon = command.find_first_of(':');
-    if (next_colon == std::string::npos) {
-        // No colon, we must be at the command.
-        return finish();
-    }
-
-    bool port_valid = true;
-    if (command.size() <= next_colon) {
-        return false;
-    }
-
-    std::string_view port = command.substr(0, next_colon);
-    for (auto digit : port) {
-        if (!isdigit(digit)) {
-            // Port isn't a number.
-            port_valid = false;
-            break;
-        }
-    }
-
-    if (port_valid) {
-        consume(next_colon + 1);
-    }
-    return finish();
-}
-
-}  // namespace internal
-
-#endif  // ADB_HOST
-
-static int smart_socket_enqueue(asocket* s, apacket::payload_type data) {
-#if ADB_HOST
-    std::string_view service;
-    std::string_view serial;
-    TransportId transport_id = 0;
-    TransportType type = kTransportAny;
-#endif
-
-    D("SS(%d): enqueue %zu", s->id, data.size());
-
-    if (s->smart_socket_data.empty()) {
-        // TODO: Make this an IOVector?
-        s->smart_socket_data.assign(data.begin(), data.end());
-    } else {
-        std::copy(data.begin(), data.end(), std::back_inserter(s->smart_socket_data));
-    }
-
-    /* don't bother if we can't decode the length */
-    if (s->smart_socket_data.size() < 4) {
-        return 0;
-    }
-
-    uint32_t len = unhex(s->smart_socket_data.data(), 4);
-    if (len == 0 || len > MAX_PAYLOAD) {
-        D("SS(%d): bad size (%u)", s->id, len);
-        goto fail;
-    }
-
-    D("SS(%d): len is %u", s->id, len);
-    /* can't do anything until we have the full header */
-    if ((len + 4) > s->smart_socket_data.size()) {
-        D("SS(%d): waiting for %zu more bytes", s->id, len + 4 - s->smart_socket_data.size());
-        return 0;
-    }
-
-    s->smart_socket_data[len + 4] = 0;
-
-    D("SS(%d): '%s'", s->id, (char*)(s->smart_socket_data.data() + 4));
-
-#if ADB_HOST
-    service = std::string_view(s->smart_socket_data).substr(4);
-
-    // TODO: These should be handled in handle_host_request.
-    if (android::base::ConsumePrefix(&service, "host-serial:")) {
-        // serial number should follow "host:" and could be a host:port string.
-        if (!internal::parse_host_service(&serial, &service, service)) {
-            LOG(ERROR) << "SS(" << s->id << "): failed to parse host service: " << service;
-            goto fail;
-        }
-    } else if (android::base::ConsumePrefix(&service, "host-transport-id:")) {
-        if (!ParseUint(&transport_id, service, &service)) {
-            LOG(ERROR) << "SS(" << s->id << "): failed to parse host transport id: " << service;
-            return -1;
-        }
-        if (!android::base::ConsumePrefix(&service, ":")) {
-            LOG(ERROR) << "SS(" << s->id << "): host-transport-id without command";
-            return -1;
-        }
-    } else if (android::base::ConsumePrefix(&service, "host-usb:")) {
-        type = kTransportUsb;
-    } else if (android::base::ConsumePrefix(&service, "host-local:")) {
-        type = kTransportLocal;
-    } else if (android::base::ConsumePrefix(&service, "host:")) {
-        type = kTransportAny;
-    } else {
-        service = std::string_view{};
-    }
-
-    if (!service.empty()) {
-        asocket* s2;
-
-        // Some requests are handled immediately -- in that case the handle_host_request() routine
-        // has sent the OKAY or FAIL message and all we have to do is clean up.
-        auto host_request_result = handle_host_request(
-                service, type, serial.empty() ? nullptr : std::string(serial).c_str(), transport_id,
-                s->peer->fd, s);
-
-        switch (host_request_result) {
-            case HostRequestResult::Handled:
-                LOG(VERBOSE) << "SS(" << s->id << "): handled host service '" << service << "'";
-                goto fail;
-
-            case HostRequestResult::SwitchedTransport:
-                D("SS(%d): okay transport", s->id);
-                s->smart_socket_data.clear();
-                return 0;
-
-            case HostRequestResult::Unhandled:
-                break;
-        }
-
-        /* try to find a local service with this name.
-        ** if no such service exists, we'll fail out
-        ** and tear down here.
-        */
-        // TODO: Convert to string_view.
-        s2 = host_service_to_socket(service, serial, transport_id);
-        if (s2 == nullptr) {
-            LOG(VERBOSE) << "SS(" << s->id << "): couldn't create host service '" << service << "'";
-            SendFail(s->peer->fd, "unknown host service");
-            goto fail;
-        }
-
-        /* we've connected to a local host service,
-        ** so we make our peer back into a regular
-        ** local socket and bind it to the new local
-        ** service socket, acknowledge the successful
-        ** connection, and close this smart socket now
-        ** that its work is done.
-        */
-        SendOkay(s->peer->fd);
-
-        s->peer->ready = local_socket_ready;
-        s->peer->shutdown = nullptr;
-        s->peer->close = local_socket_close;
-        s->peer->peer = s2;
-        s2->peer = s->peer;
-        s->peer = nullptr;
-        D("SS(%d): okay", s->id);
-        s->close(s);
-
-        /* initial state is "ready" */
-        s2->ready(s2);
-        return 0;
-    }
-#else /* !ADB_HOST */
-    if (s->transport == nullptr) {
-        std::string error_msg = "unknown failure";
-        s->transport = acquire_one_transport(kTransportAny, nullptr, 0, nullptr, &error_msg);
-        if (s->transport == nullptr) {
-            SendFail(s->peer->fd, error_msg);
-            goto fail;
-        }
-    }
-#endif
-
-    if (!s->transport) {
-        SendFail(s->peer->fd, "device offline (no transport)");
-        goto fail;
-    } else if (!ConnectionStateIsOnline(s->transport->GetConnectionState())) {
-        /* if there's no remote we fail the connection
-         ** right here and terminate it
-         */
-        SendFail(s->peer->fd, "device offline (transport offline)");
-        goto fail;
-    }
-
-    /* instrument our peer to pass the success or fail
-    ** message back once it connects or closes, then
-    ** detach from it, request the connection, and
-    ** tear down
-    */
-    s->peer->ready = local_socket_ready_notify;
-    s->peer->shutdown = nullptr;
-    s->peer->close = local_socket_close_notify;
-    s->peer->peer = nullptr;
-    /* give him our transport and upref it */
-    s->peer->transport = s->transport;
-
-    connect_to_remote(s->peer, std::string_view(s->smart_socket_data).substr(4));
-    s->peer = nullptr;
-    s->close(s);
-    return 1;
-
-fail:
-    /* we're going to close our peer as a side-effect, so
-    ** return -1 to signal that state to the local socket
-    ** who is enqueueing against us
-    */
-    s->close(s);
-    return -1;
-}
-
-static void smart_socket_ready(asocket* s) {
-    D("SS(%d): ready", s->id);
-}
-
-static void smart_socket_close(asocket* s) {
-    D("SS(%d): closed", s->id);
-    if (s->peer) {
-        s->peer->peer = nullptr;
-        s->peer->close(s->peer);
-        s->peer = nullptr;
-    }
-    delete s;
-}
-
-static asocket* create_smart_socket(void) {
-    D("Creating smart socket");
-    asocket* s = new asocket();
-    s->enqueue = smart_socket_enqueue;
-    s->ready = smart_socket_ready;
-    s->shutdown = nullptr;
-    s->close = smart_socket_close;
-
-    D("SS(%d)", s->id);
-    return s;
-}
-
-void connect_to_smartsocket(asocket* s) {
-    D("Connecting to smart socket");
-    asocket* ss = create_smart_socket();
-    s->peer = ss;
-    ss->peer = s;
-    s->ready(s);
-}
-
-size_t asocket::get_max_payload() const {
-    size_t max_payload = MAX_PAYLOAD;
-    if (transport) {
-        max_payload = std::min(max_payload, transport->get_max_payload());
-    }
-    if (peer && peer->transport) {
-        max_payload = std::min(max_payload, peer->transport->get_max_payload());
-    }
-    return max_payload;
-}
diff --git a/adb/sockets.dia b/adb/sockets.dia
deleted file mode 100644
index c626f20..0000000
--- a/adb/sockets.dia
+++ /dev/null
Binary files differ
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
deleted file mode 100644
index 1eed0d2..0000000
--- a/adb/sysdeps.h
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#pragma once
-
-/* this file contains system-dependent definitions used by ADB
- * they're related to threads, sockets and file descriptors
- */
-
-#ifdef __CYGWIN__
-#  undef _WIN32
-#endif
-
-#include <errno.h>
-
-#include <string>
-#include <string_view>
-#include <vector>
-
-// Include this before open/close/unlink are defined as macros below.
-#include <android-base/errors.h>
-#include <android-base/macros.h>
-#include <android-base/off64_t.h>
-#include <android-base/unique_fd.h>
-#include <android-base/utf8.h>
-
-#include "adb_unique_fd.h"
-#include "sysdeps/errno.h"
-#include "sysdeps/network.h"
-#include "sysdeps/stat.h"
-
-#if defined(__APPLE__)
-static inline void* mempcpy(void* dst, const void* src, size_t n) {
-    return static_cast<char*>(memcpy(dst, src, n)) + n;
-}
-#endif
-
-#ifdef _WIN32
-
-// Clang-only nullability specifiers
-#define _Nonnull
-#define _Nullable
-
-#include <ctype.h>
-#include <direct.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <io.h>
-#include <process.h>
-#include <stdint.h>
-#include <sys/stat.h>
-#include <utime.h>
-#include <windows.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-#include <memory>   // unique_ptr
-#include <string>
-
-#define OS_PATH_SEPARATORS "\\/"
-#define OS_PATH_SEPARATOR '\\'
-#define OS_PATH_SEPARATOR_STR "\\"
-#define ENV_PATH_SEPARATOR_STR ";"
-
-static inline bool adb_is_separator(char c) {
-    return c == '\\' || c == '/';
-}
-
-extern int adb_thread_setname(const std::string& name);
-
-static inline void close_on_exec(borrowed_fd fd) {
-    /* nothing really */
-}
-
-extern int adb_unlink(const char* path);
-#undef unlink
-#define unlink ___xxx_unlink
-
-extern int adb_mkdir(const std::string& path, int mode);
-#undef mkdir
-#define mkdir ___xxx_mkdir
-
-extern int adb_rename(const char* oldpath, const char* newpath);
-
-// See the comments for the !defined(_WIN32) versions of adb_*().
-extern int adb_open(const char* path, int options);
-extern int adb_creat(const char* path, int mode);
-extern int adb_read(borrowed_fd fd, void* buf, int len);
-extern int adb_pread(borrowed_fd fd, void* buf, int len, off64_t offset);
-extern int adb_write(borrowed_fd fd, const void* buf, int len);
-extern int adb_pwrite(borrowed_fd fd, const void* buf, int len, off64_t offset);
-extern int64_t adb_lseek(borrowed_fd fd, int64_t pos, int where);
-extern int adb_shutdown(borrowed_fd fd, int direction = SHUT_RDWR);
-extern int adb_close(int fd);
-extern int adb_register_socket(SOCKET s);
-extern HANDLE adb_get_os_handle(borrowed_fd fd);
-
-extern int adb_gethostname(char* name, size_t len);
-extern int adb_getlogin_r(char* buf, size_t bufsize);
-
-// See the comments for the !defined(_WIN32) version of unix_close().
-static inline int unix_close(int fd) {
-    return close(fd);
-}
-#undef close
-#define close ____xxx_close
-
-// Like unix_read(), but may return EINTR.
-extern int unix_read_interruptible(borrowed_fd fd, void* buf, size_t len);
-
-// See the comments for the !defined(_WIN32) version of unix_read().
-static inline int unix_read(borrowed_fd fd, void* buf, size_t len) {
-    return TEMP_FAILURE_RETRY(unix_read_interruptible(fd, buf, len));
-}
-
-#undef   read
-#define  read  ___xxx_read
-
-#undef pread
-#define pread ___xxx_pread
-
-// See the comments for the !defined(_WIN32) version of unix_write().
-static inline int unix_write(borrowed_fd fd, const void* buf, size_t len) {
-    return write(fd.get(), buf, len);
-}
-#undef   write
-#define  write  ___xxx_write
-
-#undef pwrite
-#define pwrite ___xxx_pwrite
-
-// See the comments for the !defined(_WIN32) version of unix_lseek().
-static inline int unix_lseek(borrowed_fd fd, int pos, int where) {
-    return lseek(fd.get(), pos, where);
-}
-#undef lseek
-#define lseek ___xxx_lseek
-
-// See the comments for the !defined(_WIN32) version of adb_open_mode().
-static inline int adb_open_mode(const char* path, int options, int mode) {
-    return adb_open(path, options);
-}
-
-// See the comments for the !defined(_WIN32) version of unix_open().
-extern int unix_open(std::string_view path, int options, ...);
-#define  open    ___xxx_unix_open
-
-// Checks if |fd| corresponds to a console.
-// Standard Windows isatty() returns 1 for both console FDs and character
-// devices like NUL. unix_isatty() performs some extra checking to only match
-// console FDs.
-// |fd| must be a real file descriptor, meaning STDxx_FILENO or unix_open() FDs
-// will work but adb_open() FDs will not. Additionally the OS handle associated
-// with |fd| must have GENERIC_READ access (which console FDs have by default).
-// Returns 1 if |fd| is a console FD, 0 otherwise. The value of errno after
-// calling this function is unreliable and should not be used.
-int unix_isatty(borrowed_fd fd);
-#define  isatty  ___xxx_isatty
-
-int network_inaddr_any_server(int port, int type, std::string* error);
-
-inline int network_local_client(const char* name, int namespace_id, int type, std::string* error) {
-    abort();
-}
-
-inline int network_local_server(const char* name, int namespace_id, int type, std::string* error) {
-    abort();
-}
-
-int network_connect(const std::string& host, int port, int type, int timeout,
-                    std::string* error);
-
-extern int adb_socket_accept(borrowed_fd serverfd, struct sockaddr* addr, socklen_t* addrlen);
-
-#undef   accept
-#define  accept  ___xxx_accept
-
-// Returns the local port number of a bound socket, or -1 on failure.
-int adb_socket_get_local_port(borrowed_fd fd);
-
-extern int adb_setsockopt(borrowed_fd fd, int level, int optname, const void* optval,
-                          socklen_t optlen);
-
-#undef   setsockopt
-#define  setsockopt  ___xxx_setsockopt
-
-extern int adb_socketpair(int sv[2]);
-
-struct adb_pollfd {
-    int fd;
-    short events;
-    short revents;
-};
-extern int adb_poll(adb_pollfd* fds, size_t nfds, int timeout);
-#define poll ___xxx_poll
-
-static inline int adb_is_absolute_host_path(const char* path) {
-    return isalpha(path[0]) && path[1] == ':' && path[2] == '\\';
-}
-
-// UTF-8 versions of POSIX APIs.
-extern DIR* adb_opendir(const char* dirname);
-extern struct dirent* adb_readdir(DIR* dir);
-extern int adb_closedir(DIR* dir);
-
-extern int adb_utime(const char *, struct utimbuf *);
-extern int adb_chmod(const char *, int);
-
-extern int adb_vfprintf(FILE* stream, const char* format, va_list ap)
-        __attribute__((__format__(__printf__, 2, 0)));
-extern int adb_vprintf(const char* format, va_list ap) __attribute__((__format__(__printf__, 1, 0)));
-extern int adb_fprintf(FILE* stream, const char* format, ...)
-        __attribute__((__format__(__printf__, 2, 3)));
-extern int adb_printf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
-
-extern int adb_fputs(const char* buf, FILE* stream);
-extern int adb_fputc(int ch, FILE* stream);
-extern int adb_putchar(int ch);
-extern int adb_puts(const char* buf);
-extern size_t adb_fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream);
-
-extern FILE* adb_fopen(const char* f, const char* m);
-
-extern char* adb_getenv(const char* name);
-
-extern char* adb_getcwd(char* buf, int size);
-
-// Remap calls to POSIX APIs to our UTF-8 versions.
-#define opendir adb_opendir
-#define readdir adb_readdir
-#define closedir adb_closedir
-#define rewinddir rewinddir_utf8_not_yet_implemented
-#define telldir telldir_utf8_not_yet_implemented
-// Some compiler's C++ headers have members named seekdir, so we can't do the
-// macro technique and instead cause a link error if seekdir is called.
-inline void seekdir(DIR*, long) {
-    extern int seekdir_utf8_not_yet_implemented;
-    seekdir_utf8_not_yet_implemented = 1;
-}
-
-#define utime adb_utime
-#define chmod adb_chmod
-
-#define vfprintf adb_vfprintf
-#define vprintf adb_vprintf
-#define fprintf adb_fprintf
-#define printf adb_printf
-#define fputs adb_fputs
-#define fputc adb_fputc
-// putc may be a macro, so if so, undefine it, so that we can redefine it.
-#undef putc
-#define putc(c, s) adb_fputc(c, s)
-#define putchar adb_putchar
-#define puts adb_puts
-#define fwrite adb_fwrite
-
-#define fopen adb_fopen
-#define freopen freopen_utf8_not_yet_implemented
-
-#define getenv adb_getenv
-#define putenv putenv_utf8_not_yet_implemented
-#define setenv setenv_utf8_not_yet_implemented
-#define unsetenv unsetenv_utf8_not_yet_implemented
-
-#define getcwd adb_getcwd
-
-// A very simple wrapper over a launched child process
-class Process {
-  public:
-    constexpr explicit Process(HANDLE h = nullptr) : h_(h) {}
-    constexpr Process(Process&& other) : h_(std::exchange(other.h_, nullptr)) {}
-    ~Process() { close(); }
-    constexpr explicit operator bool() const { return h_ != nullptr; }
-
-    void wait() {
-        if (*this) {
-            ::WaitForSingleObject(h_, INFINITE);
-            close();
-        }
-    }
-    void kill() {
-        if (*this) {
-            ::TerminateProcess(h_, -1);
-        }
-    }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Process);
-
-    void close() {
-        if (*this) {
-            ::CloseHandle(h_);
-            h_ = nullptr;
-        }
-    }
-
-    HANDLE h_;
-};
-
-Process adb_launch_process(std::string_view executable, std::vector<std::string> args,
-                           std::initializer_list<int> fds_to_inherit = {});
-
-// Helper class to convert UTF-16 argv from wmain() to UTF-8 args that can be
-// passed to main().
-class NarrowArgs {
-public:
-    NarrowArgs(int argc, wchar_t** argv);
-    ~NarrowArgs();
-
-    inline char** data() {
-        return narrow_args;
-    }
-
-private:
-    char** narrow_args;
-};
-
-// Windows HANDLE values only use 32-bits of the type, even on 64-bit machines,
-// so they can fit in an int. To convert back, we just need to sign-extend.
-// https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203%28v=vs.85%29.aspx
-// Note that this does not make a HANDLE value work with APIs like open(), nor
-// does this make a value from open() passable to APIs taking a HANDLE. This
-// just lets you take a HANDLE, pass it around as an int, and then use it again
-// as a HANDLE.
-inline int cast_handle_to_int(const HANDLE h) {
-    // truncate
-    return static_cast<int>(reinterpret_cast<INT_PTR>(h));
-}
-
-inline HANDLE cast_int_to_handle(const int fd) {
-    // sign-extend
-    return reinterpret_cast<HANDLE>(static_cast<INT_PTR>(fd));
-}
-
-// Deleter for unique_handle. Adapted from many sources, including:
-// http://stackoverflow.com/questions/14841396/stdunique-ptr-deleters-and-the-win32-api
-// https://visualstudiomagazine.com/articles/2013/09/01/get-a-handle-on-the-windows-api.aspx
-class handle_deleter {
-public:
-    typedef HANDLE pointer;
-
-    void operator()(HANDLE h);
-};
-
-// Like std::unique_ptr, but for Windows HANDLE objects that should be
-// CloseHandle()'d. Operator bool() only checks if the handle != nullptr,
-// but does not check if the handle != INVALID_HANDLE_VALUE.
-typedef std::unique_ptr<HANDLE, handle_deleter> unique_handle;
-
-namespace internal {
-
-size_t ParseCompleteUTF8(const char* first, const char* last, std::vector<char>* remaining_bytes);
-
-}
-
-#else /* !_WIN32 a.k.a. Unix */
-
-#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <poll.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <cutils/sockets.h>
-
-#define OS_PATH_SEPARATORS "/"
-#define OS_PATH_SEPARATOR '/'
-#define OS_PATH_SEPARATOR_STR "/"
-#define ENV_PATH_SEPARATOR_STR ":"
-
-static inline bool adb_is_separator(char c) {
-    return c == '/';
-}
-
-static inline int get_fd_flags(borrowed_fd fd) {
-    return fcntl(fd.get(), F_GETFD);
-}
-
-static inline void close_on_exec(borrowed_fd fd) {
-    int flags = get_fd_flags(fd);
-    if (flags >= 0 && (flags & FD_CLOEXEC) == 0) {
-        fcntl(fd.get(), F_SETFD, flags | FD_CLOEXEC);
-    }
-}
-
-// Open a file and return a file descriptor that may be used with unix_read(),
-// unix_write(), unix_close(), but not adb_read(), adb_write(), adb_close().
-//
-// On Unix, this is based on open(), so the file descriptor is a real OS file
-// descriptor, but the Windows implementation (in sysdeps_win32.cpp) returns a
-// file descriptor that can only be used with C Runtime APIs (which are wrapped
-// by unix_read(), unix_write(), unix_close()). Also, the C Runtime has
-// configurable CR/LF translation which defaults to text mode, but is settable
-// with _setmode().
-static inline int unix_open(std::string_view path, int options, ...) {
-    std::string zero_terminated(path.begin(), path.end());
-    if ((options & O_CREAT) == 0) {
-        return TEMP_FAILURE_RETRY(open(zero_terminated.c_str(), options));
-    } else {
-        int mode;
-        va_list args;
-        va_start(args, options);
-        mode = va_arg(args, int);
-        va_end(args);
-        return TEMP_FAILURE_RETRY(open(zero_terminated.c_str(), options, mode));
-    }
-}
-
-// Similar to the two-argument adb_open(), but takes a mode parameter for file
-// creation. See adb_open() for more info.
-static inline int adb_open_mode(const char* pathname, int options, int mode) {
-    return TEMP_FAILURE_RETRY(open(pathname, options, mode));
-}
-
-// Open a file and return a file descriptor that may be used with adb_read(),
-// adb_write(), adb_close(), but not unix_read(), unix_write(), unix_close().
-//
-// On Unix, this is based on open(), but the Windows implementation (in
-// sysdeps_win32.cpp) uses Windows native file I/O and bypasses the C Runtime
-// and its CR/LF translation. The returned file descriptor should be used with
-// adb_read(), adb_write(), adb_close(), etc.
-static inline int adb_open(const char* pathname, int options) {
-    int fd = TEMP_FAILURE_RETRY(open(pathname, options));
-    if (fd < 0) return -1;
-    close_on_exec(fd);
-    return fd;
-}
-#undef open
-#define open ___xxx_open
-
-static inline int adb_shutdown(borrowed_fd fd, int direction = SHUT_RDWR) {
-    return shutdown(fd.get(), direction);
-}
-
-#undef shutdown
-#define shutdown ____xxx_shutdown
-
-// Closes a file descriptor that came from adb_open() or adb_open_mode(), but
-// not designed to take a file descriptor from unix_open(). See the comments
-// for adb_open() for more info.
-inline int adb_close(int fd) {
-    return close(fd);
-}
-#undef close
-#define close ____xxx_close
-
-// On Windows, ADB has an indirection layer for file descriptors. If we get a
-// Win32 SOCKET object from an external library, we have to map it in to that
-// indirection layer, which this does.
-inline int adb_register_socket(int s) {
-    return s;
-}
-
-static inline int adb_gethostname(char* name, size_t len) {
-    return gethostname(name, len);
-}
-
-static inline int adb_getlogin_r(char* buf, size_t bufsize) {
-    return getlogin_r(buf, bufsize);
-}
-
-static inline int adb_read(borrowed_fd fd, void* buf, size_t len) {
-    return TEMP_FAILURE_RETRY(read(fd.get(), buf, len));
-}
-
-static inline int adb_pread(borrowed_fd fd, void* buf, size_t len, off64_t offset) {
-#if defined(__APPLE__)
-    return TEMP_FAILURE_RETRY(pread(fd.get(), buf, len, offset));
-#else
-    return TEMP_FAILURE_RETRY(pread64(fd.get(), buf, len, offset));
-#endif
-}
-
-// Like unix_read(), but does not handle EINTR.
-static inline int unix_read_interruptible(borrowed_fd fd, void* buf, size_t len) {
-    return read(fd.get(), buf, len);
-}
-
-#undef read
-#define read ___xxx_read
-#undef pread
-#define pread ___xxx_pread
-
-static inline int adb_write(borrowed_fd fd, const void* buf, size_t len) {
-    return TEMP_FAILURE_RETRY(write(fd.get(), buf, len));
-}
-
-static inline int adb_pwrite(int fd, const void* buf, size_t len, off64_t offset) {
-#if defined(__APPLE__)
-    return TEMP_FAILURE_RETRY(pwrite(fd, buf, len, offset));
-#else
-    return TEMP_FAILURE_RETRY(pwrite64(fd, buf, len, offset));
-#endif
-}
-
-#undef   write
-#define  write  ___xxx_write
-#undef pwrite
-#define pwrite ___xxx_pwrite
-
-static inline int64_t adb_lseek(borrowed_fd fd, int64_t pos, int where) {
-#if defined(__APPLE__)
-    return lseek(fd.get(), pos, where);
-#else
-    return lseek64(fd.get(), pos, where);
-#endif
-}
-#undef lseek
-#define lseek ___xxx_lseek
-
-static inline int adb_unlink(const char* path) {
-    return unlink(path);
-}
-#undef unlink
-#define unlink ___xxx_unlink
-
-static inline int adb_creat(const char* path, int mode) {
-    int fd = TEMP_FAILURE_RETRY(creat(path, mode));
-
-    if (fd < 0) return -1;
-
-    close_on_exec(fd);
-    return fd;
-}
-#undef creat
-#define creat ___xxx_creat
-
-static inline int unix_isatty(borrowed_fd fd) {
-    return isatty(fd.get());
-}
-#define isatty ___xxx_isatty
-
-// Helper for network_* functions.
-inline int _fd_set_error_str(int fd, std::string* error) {
-    if (fd == -1) {
-        *error = strerror(errno);
-    }
-    return fd;
-}
-
-inline int network_inaddr_any_server(int port, int type, std::string* error) {
-    return _fd_set_error_str(socket_inaddr_any_server(port, type), error);
-}
-
-inline int network_local_client(const char* name, int namespace_id, int type, std::string* error) {
-    return _fd_set_error_str(socket_local_client(name, namespace_id, type), error);
-}
-
-inline int network_local_server(const char* name, int namespace_id, int type, std::string* error) {
-    return _fd_set_error_str(socket_local_server(name, namespace_id, type), error);
-}
-
-int network_connect(const std::string& host, int port, int type, int timeout, std::string* error);
-
-static inline int adb_socket_accept(borrowed_fd serverfd, struct sockaddr* addr,
-                                    socklen_t* addrlen) {
-    int fd;
-
-    fd = TEMP_FAILURE_RETRY(accept(serverfd.get(), addr, addrlen));
-    if (fd >= 0) close_on_exec(fd);
-
-    return fd;
-}
-
-#undef accept
-#define accept ___xxx_accept
-
-inline int adb_socket_get_local_port(borrowed_fd fd) {
-    return socket_get_local_port(fd.get());
-}
-
-// Operate on a file descriptor returned from unix_open() or a well-known file
-// descriptor such as STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.
-//
-// On Unix, unix_read(), unix_write(), unix_close() map to adb_read(),
-// adb_write(), adb_close() (which all map to Unix system calls), but the
-// Windows implementations (in the ifdef above and in sysdeps_win32.cpp) call
-// into the C Runtime and its configurable CR/LF translation (which is settable
-// via _setmode()).
-#define unix_read adb_read
-#define unix_write adb_write
-#define unix_lseek adb_lseek
-#define unix_close adb_close
-
-static inline int adb_thread_setname(const std::string& name) {
-#ifdef __APPLE__
-    return pthread_setname_np(name.c_str());
-#else
-    // Both bionic and glibc's pthread_setname_np fails rather than truncating long strings.
-    // glibc doesn't have strlcpy, so we have to fake it.
-    char buf[16];  // MAX_TASK_COMM_LEN, but that's not exported by the kernel headers.
-    strncpy(buf, name.c_str(), sizeof(buf) - 1);
-    buf[sizeof(buf) - 1] = '\0';
-    return pthread_setname_np(pthread_self(), buf);
-#endif
-}
-
-static inline int adb_setsockopt(borrowed_fd fd, int level, int optname, const void* optval,
-                                 socklen_t optlen) {
-    return setsockopt(fd.get(), level, optname, optval, optlen);
-}
-
-#undef setsockopt
-#define setsockopt ___xxx_setsockopt
-
-static inline int unix_socketpair(int d, int type, int protocol, int sv[2]) {
-    return socketpair(d, type, protocol, sv);
-}
-
-static inline int adb_socketpair(int sv[2]) {
-    int rc;
-
-    rc = unix_socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
-    if (rc < 0) return -1;
-
-    close_on_exec(sv[0]);
-    close_on_exec(sv[1]);
-    return 0;
-}
-
-#undef socketpair
-#define socketpair ___xxx_socketpair
-
-typedef struct pollfd adb_pollfd;
-static inline int adb_poll(adb_pollfd* fds, size_t nfds, int timeout) {
-    return TEMP_FAILURE_RETRY(poll(fds, nfds, timeout));
-}
-
-#define poll ___xxx_poll
-
-static inline int adb_mkdir(const std::string& path, int mode) {
-    return mkdir(path.c_str(), mode);
-}
-
-#undef mkdir
-#define mkdir ___xxx_mkdir
-
-static inline int adb_rename(const char* oldpath, const char* newpath) {
-    return rename(oldpath, newpath);
-}
-
-static inline int adb_is_absolute_host_path(const char* path) {
-    return path[0] == '/';
-}
-
-static inline int adb_get_os_handle(borrowed_fd fd) {
-    return fd.get();
-}
-
-// A very simple wrapper over a launched child process
-class Process {
-  public:
-    constexpr explicit Process(pid_t pid) : pid_(pid) {}
-    constexpr Process(Process&& other) : pid_(std::exchange(other.pid_, -1)) {}
-
-    constexpr explicit operator bool() const { return pid_ >= 0; }
-
-    void wait() {
-        if (*this) {
-            int status;
-            ::waitpid(pid_, &status, 0);
-            pid_ = -1;
-        }
-    }
-    void kill() {
-        if (*this) {
-            ::kill(pid_, SIGTERM);
-        }
-    }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Process);
-
-    pid_t pid_;
-};
-
-Process adb_launch_process(std::string_view executable, std::vector<std::string> args,
-                           std::initializer_list<int> fds_to_inherit = {});
-
-#endif /* !_WIN32 */
-
-static inline void disable_tcp_nagle(borrowed_fd fd) {
-    int off = 1;
-    adb_setsockopt(fd.get(), IPPROTO_TCP, TCP_NODELAY, &off, sizeof(off));
-}
-
-// Sets TCP socket |fd| to send a keepalive TCP message every |interval_sec| seconds. Set
-// |interval_sec| to 0 to disable keepalives. If keepalives are enabled, the connection will be
-// configured to drop after 10 missed keepalives. Returns true on success.
-bool set_tcp_keepalive(borrowed_fd fd, int interval_sec);
-
-#if defined(_WIN32)
-// Win32 defines ERROR, which we don't need, but which conflicts with google3 logging.
-#undef ERROR
-#endif
diff --git a/adb/sysdeps/chrono.h b/adb/sysdeps/chrono.h
deleted file mode 100644
index 5c5af7c..0000000
--- a/adb/sysdeps/chrono.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <chrono>
-
-using namespace std::chrono_literals;
diff --git a/adb/sysdeps/errno.cpp b/adb/sysdeps/errno.cpp
deleted file mode 100644
index 9a37ea2..0000000
--- a/adb/sysdeps/errno.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "sysdeps/errno.h"
-
-#include <errno.h>
-
-#include <thread>
-#include <unordered_map>
-#include <utility>
-
-#include "adb.h"
-
-// Use the linux asm-generic values for errno (which are used on all android archs but mips).
-#define ERRNO_VALUES()             \
-    ERRNO_VALUE(EACCES, 13);       \
-    ERRNO_VALUE(EEXIST, 17);       \
-    ERRNO_VALUE(EFAULT, 14);       \
-    ERRNO_VALUE(EFBIG, 27);        \
-    ERRNO_VALUE(EINTR, 4);         \
-    ERRNO_VALUE(EINVAL, 22);       \
-    ERRNO_VALUE(EIO, 5);           \
-    ERRNO_VALUE(EISDIR, 21);       \
-    ERRNO_VALUE(ELOOP, 40);        \
-    ERRNO_VALUE(EMFILE, 24);       \
-    ERRNO_VALUE(ENAMETOOLONG, 36); \
-    ERRNO_VALUE(ENFILE, 23);       \
-    ERRNO_VALUE(ENOENT, 2);        \
-    ERRNO_VALUE(ENOMEM, 12);       \
-    ERRNO_VALUE(ENOSPC, 28);       \
-    ERRNO_VALUE(ENOTDIR, 20);      \
-    ERRNO_VALUE(EOVERFLOW, 75);    \
-    ERRNO_VALUE(EPERM, 1);         \
-    ERRNO_VALUE(EROFS, 30);        \
-    ERRNO_VALUE(ETXTBSY, 26)
-
-// Make sure these values are actually correct.
-#if defined(__linux__) && !defined(__mips__)
-#define ERRNO_VALUE(error_name, wire_value) static_assert((error_name) == (wire_value), "")
-ERRNO_VALUES();
-#undef ERRNO_VALUE
-#endif
-
-static std::unordered_map<int, int>* generate_host_to_wire() {
-    auto result = new std::unordered_map<int, int>();
-#define ERRNO_VALUE(error_name, wire_value) \
-    result->insert(std::make_pair((error_name), (wire_value)))
-    ERRNO_VALUES();
-#undef ERRNO_VALUE
-    return result;
-}
-
-static std::unordered_map<int, int>* generate_wire_to_host() {
-    auto result = new std::unordered_map<int, int>();
-#define ERRNO_VALUE(error_name, wire_value) \
-    result->insert(std::make_pair((wire_value), (error_name)))
-    ERRNO_VALUES();
-#undef ERRNO_VALUE
-    return result;
-}
-
-static std::unordered_map<int, int>& host_to_wire = *generate_host_to_wire();
-static std::unordered_map<int, int>& wire_to_host = *generate_wire_to_host();
-
-int errno_to_wire(int error) {
-    auto it = host_to_wire.find(error);
-    if (it == host_to_wire.end()) {
-        LOG(ERROR) << "failed to convert errno " << error << " (" << strerror(error) << ") to wire";
-
-        // Return EIO;
-        return 5;
-    }
-    return it->second;
-}
-
-int errno_from_wire(int error) {
-    auto it = host_to_wire.find(error);
-    if (it == host_to_wire.end()) {
-        LOG(ERROR) << "failed to convert errno " << error << " from wire";
-        return EIO;
-    }
-    return it->second;
-}
diff --git a/adb/sysdeps/errno.h b/adb/sysdeps/errno.h
deleted file mode 100644
index 72816b1..0000000
--- a/adb/sysdeps/errno.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <string.h>
-
-#if defined(_WIN32)
-char* adb_strerror(int err);
-#define strerror adb_strerror
-#endif
-
-// errno values differ between operating systems and between Linux architectures.
-// Arbitrarily select the Linux asm-generic values to use in the wire protocol.
-int errno_to_wire(int error);
-int errno_from_wire(int error);
diff --git a/adb/sysdeps/network.h b/adb/sysdeps/network.h
deleted file mode 100644
index fadd155..0000000
--- a/adb/sysdeps/network.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <string>
-
-int network_loopback_client(int port, int type, std::string* error);
-int network_loopback_server(int port, int type, std::string* error, bool prefer_ipv4);
diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp
deleted file mode 100644
index a4d9013..0000000
--- a/adb/sysdeps/posix/network.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "sysdeps/network.h"
-
-#include <errno.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#include <string>
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <cutils/sockets.h>
-
-#include "adb_unique_fd.h"
-
-static void set_error(std::string* error) {
-    if (error) {
-        *error = strerror(errno);
-    }
-}
-
-static sockaddr* loopback_addr4(sockaddr_storage* addr, socklen_t* addrlen, int port) {
-    struct sockaddr_in* addr4 = reinterpret_cast<sockaddr_in*>(addr);
-    *addrlen = sizeof(*addr4);
-
-    addr4->sin_family = AF_INET;
-    addr4->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-    addr4->sin_port = htons(port);
-    return reinterpret_cast<sockaddr*>(addr);
-}
-
-static sockaddr* loopback_addr6(sockaddr_storage* addr, socklen_t* addrlen, int port) {
-    struct sockaddr_in6* addr6 = reinterpret_cast<sockaddr_in6*>(addr);
-    *addrlen = sizeof(*addr6);
-
-    addr6->sin6_family = AF_INET6;
-    addr6->sin6_addr = in6addr_loopback;
-    addr6->sin6_port = htons(port);
-    return reinterpret_cast<sockaddr*>(addr);
-}
-
-static int _network_loopback_client(bool ipv6, int port, int type, std::string* error) {
-    unique_fd s(socket(ipv6 ? AF_INET6 : AF_INET, type, 0));
-    if (s == -1) {
-        set_error(error);
-        return -1;
-    }
-
-    struct sockaddr_storage addr_storage = {};
-    socklen_t addrlen = sizeof(addr_storage);
-    sockaddr* addr = (ipv6 ? loopback_addr6 : loopback_addr4)(&addr_storage, &addrlen, 0);
-
-    if (bind(s.get(), addr, addrlen) != 0) {
-        set_error(error);
-        return -1;
-    }
-
-    addr = (ipv6 ? loopback_addr6 : loopback_addr4)(&addr_storage, &addrlen, port);
-
-    if (connect(s.get(), addr, addrlen) != 0) {
-        set_error(error);
-        return -1;
-    }
-
-    return s.release();
-}
-
-int network_loopback_client(int port, int type, std::string* error) {
-    // Try IPv4 first, use IPv6 as a fallback.
-    int rc = _network_loopback_client(false, port, type, error);
-    if (rc == -1) {
-        return _network_loopback_client(true, port, type, error);
-    }
-    return rc;
-}
-
-static int _network_loopback_server(bool ipv6, int port, int type, std::string* error) {
-    unique_fd s(socket(ipv6 ? AF_INET6 : AF_INET, type, 0));
-    if (s == -1) {
-        set_error(error);
-        return -1;
-    }
-
-    int n = 1;
-    setsockopt(s.get(), SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n));
-
-    struct sockaddr_storage addr_storage = {};
-    socklen_t addrlen = sizeof(addr_storage);
-    sockaddr* addr = (ipv6 ? loopback_addr6 : loopback_addr4)(&addr_storage, &addrlen, port);
-
-    if (bind(s.get(), addr, addrlen) != 0) {
-        set_error(error);
-        return -1;
-    }
-
-    if (type == SOCK_STREAM || type == SOCK_SEQPACKET) {
-        if (listen(s.get(), SOMAXCONN) != 0) {
-            set_error(error);
-            return -1;
-        }
-    }
-
-    return s.release();
-}
-
-int network_loopback_server(int port, int type, std::string* error, bool prefer_ipv4) {
-    int rc = -1;
-    if (prefer_ipv4) {
-        rc = _network_loopback_server(false, port, type, error);
-    }
-
-    // Only attempt to listen on IPv6 if IPv4 is unavailable or prefer_ipv4 is false
-    // We don't want to start an IPv6 server if there's already an IPv4 one running.
-    if (rc == -1 && (errno == EADDRNOTAVAIL || errno == EAFNOSUPPORT || !prefer_ipv4)) {
-        return _network_loopback_server(true, port, type, error);
-    }
-    return rc;
-}
-
-int network_connect(const std::string& host, int port, int type, int timeout, std::string* error) {
-    int getaddrinfo_error = 0;
-    int fd = socket_network_client_timeout(host.c_str(), port, type, timeout, &getaddrinfo_error);
-    if (fd != -1) {
-        return fd;
-    }
-    if (getaddrinfo_error != 0) {
-        *error = android::base::StringPrintf("failed to resolve host: '%s': %s", host.c_str(),
-                                             gai_strerror(getaddrinfo_error));
-        LOG(WARNING) << *error;
-    } else {
-        *error = android::base::StringPrintf("failed to connect to '%s:%d': %s", host.c_str(), port,
-                                             strerror(errno));
-        LOG(WARNING) << *error;
-    }
-    return -1;
-}
diff --git a/adb/sysdeps/stat.h b/adb/sysdeps/stat.h
deleted file mode 100644
index ed2cf25..0000000
--- a/adb/sysdeps/stat.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#if defined(_WIN32)
-// stat is broken on Win32: stat on a path with a trailing slash or backslash will always fail with
-// ENOENT.
-int adb_stat(const char* path, struct adb_stat* buf);
-
-// We later define a macro mapping 'stat' to 'adb_stat'. This causes:
-//   struct stat s;
-//   stat(filename, &s);
-// To turn into the following:
-//   struct adb_stat s;
-//   adb_stat(filename, &s);
-// To get this to work, we need to make 'struct adb_stat' the same as
-// 'struct stat'. Note that this definition of 'struct adb_stat' uses the
-// *current* macro definition of stat, so it may actually be inheriting from
-// struct _stat32i64 (or some other remapping).
-struct adb_stat : public stat {};
-
-#undef stat
-#define stat adb_stat
-
-// Windows doesn't have lstat.
-#define lstat adb_stat
-
-// mingw doesn't define S_IFLNK or S_ISLNK.
-#define S_IFLNK 0120000
-#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
-
-// mingw defines S_IFBLK to a different value from bionic.
-#undef S_IFBLK
-#define S_IFBLK 0060000
-#undef S_ISBLK
-#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
-#endif
-
-// Make sure that host file mode values match the ones on the device.
-static_assert(S_IFMT == 00170000, "");
-static_assert(S_IFLNK == 0120000, "");
-static_assert(S_IFREG == 0100000, "");
-static_assert(S_IFBLK == 0060000, "");
-static_assert(S_IFDIR == 0040000, "");
-static_assert(S_IFCHR == 0020000, "");
diff --git a/adb/sysdeps/stat_test.cpp b/adb/sysdeps/stat_test.cpp
deleted file mode 100644
index 67155d9..0000000
--- a/adb/sysdeps/stat_test.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <string>
-
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-
-#include "adb_utils.h"
-#include "sysdeps.h"
-
-TEST(sysdeps, stat) {
-    TemporaryDir td;
-    TemporaryFile tf;
-
-    struct stat st;
-    ASSERT_EQ(0, stat(td.path, &st));
-    ASSERT_FALSE(S_ISREG(st.st_mode));
-    ASSERT_TRUE(S_ISDIR(st.st_mode));
-
-    ASSERT_EQ(0, stat((std::string(td.path) + '/').c_str(), &st));
-    ASSERT_TRUE(S_ISDIR(st.st_mode));
-
-#if defined(_WIN32)
-    ASSERT_EQ(0, stat((std::string(td.path) + '\\').c_str(), &st));
-    ASSERT_TRUE(S_ISDIR(st.st_mode));
-#endif
-
-    std::string nonexistent_path = std::string(td.path) + "/nonexistent";
-    ASSERT_EQ(-1, stat(nonexistent_path.c_str(), &st));
-    ASSERT_EQ(ENOENT, errno);
-
-    ASSERT_EQ(-1, stat((nonexistent_path + "/").c_str(), &st));
-    ASSERT_EQ(ENOENT, errno);
-
-#if defined(_WIN32)
-    ASSERT_EQ(-1, stat((nonexistent_path + "\\").c_str(), &st));
-    ASSERT_EQ(ENOENT, errno);
-#endif
-
-    ASSERT_EQ(0, stat(tf.path, &st));
-    ASSERT_TRUE(S_ISREG(st.st_mode));
-    ASSERT_FALSE(S_ISDIR(st.st_mode));
-
-    ASSERT_EQ(-1, stat((std::string(tf.path) + '/').c_str(), &st));
-    ASSERT_EQ(ENOTDIR, errno);
-
-#if defined(_WIN32)
-    ASSERT_EQ(-1, stat((std::string(tf.path) + '\\').c_str(), &st));
-    ASSERT_EQ(ENOTDIR, errno);
-#endif
-}
diff --git a/adb/sysdeps/uio.h b/adb/sysdeps/uio.h
deleted file mode 100644
index ced884b..0000000
--- a/adb/sysdeps/uio.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <sys/types.h>
-
-#include "adb_unique_fd.h"
-
-#if defined(_WIN32)
-
-// Layout of this struct must match struct WSABUF (verified via static assert in sysdeps_win32.cpp)
-struct adb_iovec {
-    size_t iov_len;
-    void* iov_base;
-};
-
-ssize_t adb_writev(borrowed_fd fd, const adb_iovec* iov, int iovcnt);
-
-#else
-
-#include <sys/uio.h>
-using adb_iovec = struct iovec;
-inline ssize_t adb_writev(borrowed_fd fd, const adb_iovec* iov, int iovcnt) {
-    return writev(fd.get(), iov, iovcnt);
-}
-
-#endif
-
-#pragma GCC poison writev
diff --git a/adb/sysdeps/vm_sockets.h b/adb/sysdeps/vm_sockets.h
deleted file mode 100644
index 75c5f44..0000000
--- a/adb/sysdeps/vm_sockets.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#if __BIONIC__
-#include <linux/vm_sockets.h>
-#else
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   Copied and modified from bionic/libc/kernel/uapi/linux/vm_sockets.h
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_VM_SOCKETS_H
-#define _UAPI_VM_SOCKETS_H
-#include <linux/socket.h>
-#define SO_VM_SOCKETS_BUFFER_SIZE 0
-#define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1
-#define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2
-#define SO_VM_SOCKETS_PEER_HOST_VM_ID 3
-#define SO_VM_SOCKETS_TRUSTED 5
-#define SO_VM_SOCKETS_CONNECT_TIMEOUT 6
-#define SO_VM_SOCKETS_NONBLOCK_TXRX 7
-#define VMADDR_CID_ANY -1U
-#define VMADDR_PORT_ANY -1U
-#define VMADDR_CID_HYPERVISOR 0
-#define VMADDR_CID_RESERVED 1
-#define VMADDR_CID_HOST 2
-#define VM_SOCKETS_INVALID_VERSION -1U
-#define VM_SOCKETS_VERSION_EPOCH(_v) (((_v)&0xFF000000) >> 24)
-#define VM_SOCKETS_VERSION_MAJOR(_v) (((_v)&0x00FF0000) >> 16)
-#define VM_SOCKETS_VERSION_MINOR(_v) (((_v)&0x0000FFFF))
-struct sockaddr_vm {
-    __kernel_sa_family_t svm_family;
-    unsigned short svm_reserved1;
-    unsigned int svm_port;
-    unsigned int svm_cid;
-    unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) -
-                           sizeof(unsigned int) - sizeof(unsigned int)];
-};
-#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
-#ifndef AF_VSOCK
-#define AF_VSOCK 40
-#endif
-#endif
-#endif
diff --git a/adb/sysdeps/win32/errno.cpp b/adb/sysdeps/win32/errno.cpp
deleted file mode 100644
index a3b9d9b..0000000
--- a/adb/sysdeps/win32/errno.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "sysdeps/errno.h"
-
-#include <windows.h>
-
-#include <string>
-
-// Overrides strerror() to handle error codes not supported by the Windows C
-// Runtime (MSVCRT.DLL).
-char* adb_strerror(int err) {
-// sysdeps.h defines strerror to adb_strerror, but in this function, we
-// want to call the real C Runtime strerror().
-#pragma push_macro("strerror")
-#undef strerror
-    const int saved_err = errno;  // Save because we overwrite it later.
-
-    // Lookup the string for an unknown error.
-    char* errmsg = strerror(-1);
-    const std::string unknown_error = (errmsg == nullptr) ? "" : errmsg;
-
-    // Lookup the string for this error to see if the C Runtime has it.
-    errmsg = strerror(err);
-    if (errmsg != nullptr && unknown_error != errmsg) {
-        // The CRT returned an error message and it is different than the error
-        // message for an unknown error, so it is probably valid, so use it.
-    } else {
-        // Check if we have a string for this error code.
-        const char* custom_msg = nullptr;
-        switch (err) {
-#pragma push_macro("ERR")
-#undef ERR
-#define ERR(errnum, desc) case errnum: custom_msg = desc; break
-            // These error strings are from AOSP bionic/libc/include/sys/_errdefs.h.
-            // Note that these cannot be longer than 94 characters because we
-            // pass this to _strerror() which has that requirement.
-            ERR(ECONNRESET,    "Connection reset by peer");
-            ERR(EHOSTUNREACH,  "No route to host");
-            ERR(ENETDOWN,      "Network is down");
-            ERR(ENETRESET,     "Network dropped connection because of reset");
-            ERR(ENOBUFS,       "No buffer space available");
-            ERR(ENOPROTOOPT,   "Protocol not available");
-            ERR(ENOTCONN,      "Transport endpoint is not connected");
-            ERR(ENOTSOCK,      "Socket operation on non-socket");
-            ERR(EOPNOTSUPP,    "Operation not supported on transport endpoint");
-#pragma pop_macro("ERR")
-        }
-
-        if (custom_msg != nullptr) {
-            // Use _strerror() to write our string into the writable per-thread
-            // buffer used by strerror()/_strerror(). _strerror() appends the
-            // msg for the current value of errno, so set errno to a consistent
-            // value for every call so that our code-path is always the same.
-            errno = 0;
-            errmsg = _strerror(custom_msg);
-            const size_t custom_msg_len = strlen(custom_msg);
-            // Just in case _strerror() returned a read-only string, check if
-            // the returned string starts with our custom message because that
-            // implies that the string is not read-only.
-            if ((errmsg != nullptr) && !strncmp(custom_msg, errmsg, custom_msg_len)) {
-                // _strerror() puts other text after our custom message, so
-                // remove that by terminating after our message.
-                errmsg[custom_msg_len] = '\0';
-            } else {
-                // For some reason nullptr was returned or a pointer to a
-                // read-only string was returned, so fallback to whatever
-                // strerror() can muster (probably "Unknown error" or some
-                // generic CRT error string).
-                errmsg = strerror(err);
-            }
-        } else {
-            // We don't have a custom message, so use whatever strerror(err)
-            // returned earlier.
-        }
-    }
-
-    errno = saved_err;  // restore
-
-    return errmsg;
-#pragma pop_macro("strerror")
-}
diff --git a/adb/sysdeps/win32/errno_test.cpp b/adb/sysdeps/win32/errno_test.cpp
deleted file mode 100644
index 09ec52c..0000000
--- a/adb/sysdeps/win32/errno_test.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "sysdeps/errno.h"
-
-#include <string>
-
-#include <gtest/gtest.h>
-
-void TestAdbStrError(int err, const char* expected) {
-    errno = 12345;
-    const char* result = adb_strerror(err);
-    // Check that errno is not overwritten.
-    EXPECT_EQ(12345, errno);
-    EXPECT_STREQ(expected, result);
-}
-
-TEST(sysdeps_win32, adb_strerror) {
-    // Test an error code that should not have a mapped string. Use an error
-    // code that is not used by the internal implementation of adb_strerror().
-    TestAdbStrError(-2, "Unknown error");
-    // adb_strerror() uses -1 internally, so test that it can still be passed
-    // as a parameter.
-    TestAdbStrError(-1, "Unknown error");
-    // Test very big, positive unknown error.
-    TestAdbStrError(1000000, "Unknown error");
-
-    // Test success case.
-    // Wine returns "Success" for strerror(0), Windows returns "No error", so accept both.
-    std::string success = adb_strerror(0);
-    EXPECT_TRUE(success == "Success" || success == "No error") << "strerror(0) = " << success;
-
-    // Test error that regular strerror() should have a string for.
-    TestAdbStrError(EPERM, "Operation not permitted");
-    // Test error that regular strerror() doesn't have a string for, but that
-    // adb_strerror() returns.
-    TestAdbStrError(ECONNRESET, "Connection reset by peer");
-}
diff --git a/adb/sysdeps/win32/stat.cpp b/adb/sysdeps/win32/stat.cpp
deleted file mode 100644
index 844c1ce..0000000
--- a/adb/sysdeps/win32/stat.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "sysdeps/stat.h"
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/utf8.h>
-
-// Version of stat() that takes a UTF-8 path.
-int adb_stat(const char* path, struct adb_stat* s) {
-// This definition of wstat seems to be missing from <sys/stat.h>.
-#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
-#ifdef _USE_32BIT_TIME_T
-#define wstat _wstat32i64
-#else
-#define wstat _wstat64
-#endif
-#else
-// <sys/stat.h> has a function prototype for wstat() that should be available.
-#endif
-
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        errno = ENOENT;
-        return -1;
-    }
-
-    // If the path has a trailing slash, stat will fail with ENOENT regardless of whether the path
-    // is a directory or not.
-    bool expected_directory = false;
-    while (*path_wide.rbegin() == u'/' || *path_wide.rbegin() == u'\\') {
-        path_wide.pop_back();
-        expected_directory = true;
-    }
-
-    struct adb_stat st;
-    int result = wstat(path_wide.c_str(), &st);
-    if (result == 0 && expected_directory) {
-        if (!S_ISDIR(st.st_mode)) {
-            errno = ENOTDIR;
-            return -1;
-        }
-    }
-
-    memcpy(s, &st, sizeof(st));
-    return result;
-}
diff --git a/adb/sysdeps_test.cpp b/adb/sysdeps_test.cpp
deleted file mode 100644
index 0f4b39c..0000000
--- a/adb/sysdeps_test.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <gtest/gtest.h>
-#include <unistd.h>
-
-#include <atomic>
-#include <condition_variable>
-#include <thread>
-
-#include "adb_io.h"
-#include "sysdeps.h"
-#include "sysdeps/chrono.h"
-
-#if defined(_WIN32)
-#include <windows.h>
-static bool IsWine() {
-    HMODULE ntdll = GetModuleHandleW(L"ntdll.dll");
-    if (!ntdll) {
-        return false;
-    }
-    return GetProcAddress(ntdll, "wine_get_version") != nullptr;
-}
-#else
-static bool IsWine() {
-    return false;
-}
-#endif
-
-TEST(sysdeps_socketpair, smoke) {
-    int fds[2];
-    ASSERT_EQ(0, adb_socketpair(fds)) << strerror(errno);
-    ASSERT_TRUE(WriteFdExactly(fds[0], "foo", 4));
-    ASSERT_TRUE(WriteFdExactly(fds[1], "bar", 4));
-
-    char buf[4];
-    ASSERT_TRUE(ReadFdExactly(fds[1], buf, 4));
-    ASSERT_STREQ(buf, "foo");
-    ASSERT_TRUE(ReadFdExactly(fds[0], buf, 4));
-    ASSERT_STREQ(buf, "bar");
-    ASSERT_EQ(0, adb_close(fds[0]));
-    ASSERT_EQ(0, adb_close(fds[1]));
-}
-
-TEST(sysdeps_fd, exhaustion) {
-    std::vector<int> fds;
-    int socketpair[2];
-
-    while (adb_socketpair(socketpair) == 0) {
-        fds.push_back(socketpair[0]);
-        fds.push_back(socketpair[1]);
-    }
-
-    ASSERT_EQ(EMFILE, errno) << strerror(errno);
-    for (int fd : fds) {
-        ASSERT_EQ(0, adb_close(fd));
-    }
-    ASSERT_EQ(0, adb_socketpair(socketpair));
-    ASSERT_EQ(socketpair[0], fds[0]);
-    ASSERT_EQ(socketpair[1], fds[1]);
-    ASSERT_EQ(0, adb_close(socketpair[0]));
-    ASSERT_EQ(0, adb_close(socketpair[1]));
-}
-
-class sysdeps_poll : public ::testing::Test {
-  protected:
-    int fds[2];
-    void SetUp() override {
-        ASSERT_EQ(0, adb_socketpair(fds)) << strerror(errno);
-    }
-
-    void TearDown() override {
-        if (fds[0] >= 0) {
-            ASSERT_EQ(0, adb_close(fds[0]));
-        }
-        if (fds[1] >= 0) {
-            ASSERT_EQ(0, adb_close(fds[1]));
-        }
-    }
-};
-
-TEST_F(sysdeps_poll, smoke) {
-    adb_pollfd pfd[2] = {};
-    pfd[0].fd = fds[0];
-    pfd[0].events = POLLRDNORM;
-    pfd[1].fd = fds[1];
-    pfd[1].events = POLLWRNORM;
-
-    pfd[0].revents = -1;
-    pfd[1].revents = -1;
-    EXPECT_EQ(1, adb_poll(pfd, 2, 0));
-    EXPECT_EQ(0, pfd[0].revents);
-    EXPECT_EQ(POLLWRNORM, pfd[1].revents);
-
-    ASSERT_TRUE(WriteFdExactly(fds[1], "foo", 4));
-
-    // Wait for the socketpair to be flushed.
-    pfd[0].revents = -1;
-    EXPECT_EQ(1, adb_poll(pfd, 1, 100));
-    EXPECT_EQ(POLLRDNORM, pfd[0].revents);
-    pfd[0].revents = -1;
-    pfd[1].revents = -1;
-    EXPECT_EQ(2, adb_poll(pfd, 2, 0));
-    EXPECT_EQ(POLLRDNORM, pfd[0].revents);
-    EXPECT_EQ(POLLWRNORM, pfd[1].revents);
-}
-
-TEST_F(sysdeps_poll, timeout) {
-    adb_pollfd pfd = {};
-    pfd.fd = fds[0];
-    pfd.events = POLLRDNORM;
-
-    EXPECT_EQ(0, adb_poll(&pfd, 1, 100));
-    EXPECT_EQ(0, pfd.revents);
-
-    ASSERT_TRUE(WriteFdExactly(fds[1], "foo", 4));
-
-    EXPECT_EQ(1, adb_poll(&pfd, 1, 100));
-    EXPECT_EQ(POLLRDNORM, pfd.revents);
-}
-
-TEST_F(sysdeps_poll, invalid_fd) {
-    adb_pollfd pfd[3] = {};
-    pfd[0].fd = fds[0];
-    pfd[0].events = POLLRDNORM;
-    pfd[0].revents = ~0;
-    pfd[1].fd = INT_MAX;
-    pfd[1].events = POLLRDNORM;
-    pfd[1].revents = ~0;
-    pfd[2].fd = fds[1];
-    pfd[2].events = POLLWRNORM;
-    pfd[2].revents = ~0;
-
-    ASSERT_TRUE(WriteFdExactly(fds[1], "foo", 4));
-
-    // Wait for the socketpair to be flushed.
-    EXPECT_EQ(1, adb_poll(pfd, 1, 100));
-    EXPECT_EQ(POLLRDNORM, pfd[0].revents);
-
-    EXPECT_EQ(3, adb_poll(pfd, 3, 0));
-    EXPECT_EQ(POLLRDNORM, pfd[0].revents);
-    EXPECT_EQ(POLLNVAL, pfd[1].revents);
-    EXPECT_EQ(POLLWRNORM, pfd[2].revents);
-
-    // Make sure that we return immediately if an invalid FD is given.
-    pfd[0].fd = fds[0];
-    pfd[0].events = POLLRDNORM;
-    pfd[0].revents = ~0;
-    pfd[1].fd = INT_MAX;
-    pfd[1].events = POLLRDNORM;
-    pfd[1].revents = ~0;
-    EXPECT_EQ(2, adb_poll(pfd, 2, -1));
-    EXPECT_EQ(POLLRDNORM, pfd[0].revents);
-    EXPECT_EQ(POLLNVAL, pfd[1].revents);
-}
-
-TEST_F(sysdeps_poll, duplicate_fd) {
-    adb_pollfd pfd[2] = {};
-    pfd[0].fd = fds[0];
-    pfd[0].events = POLLRDNORM;
-    pfd[1] = pfd[0];
-
-    EXPECT_EQ(0, adb_poll(pfd, 2, 0));
-    EXPECT_EQ(0, pfd[0].revents);
-    EXPECT_EQ(0, pfd[1].revents);
-
-    ASSERT_TRUE(WriteFdExactly(fds[1], "foo", 4));
-
-    EXPECT_EQ(2, adb_poll(pfd, 2, 100));
-    EXPECT_EQ(POLLRDNORM, pfd[0].revents);
-    EXPECT_EQ(POLLRDNORM, pfd[1].revents);
-}
-
-TEST_F(sysdeps_poll, disconnect) {
-    adb_pollfd pfd = {};
-    pfd.fd = fds[0];
-    pfd.events = POLLIN;
-
-    EXPECT_EQ(0, adb_poll(&pfd, 1, 0));
-    EXPECT_EQ(0, pfd.revents);
-
-    EXPECT_EQ(0, adb_close(fds[1]));
-    fds[1] = -1;
-
-    EXPECT_EQ(1, adb_poll(&pfd, 1, 100));
-
-    if (!IsWine()) {
-        // Linux returns POLLIN | POLLHUP, Windows returns just POLLHUP.
-        EXPECT_EQ(POLLHUP, pfd.revents & POLLHUP);
-    }
-}
-
-TEST_F(sysdeps_poll, fd_count) {
-    // https://code.google.com/p/android/issues/detail?id=12141
-    static constexpr int num_sockets = 256;
-    std::vector<int> sockets;
-    std::vector<adb_pollfd> pfds;
-    sockets.resize(num_sockets * 2);
-    for (int32_t i = 0; i < num_sockets; ++i) {
-        ASSERT_EQ(0, adb_socketpair(&sockets[i * 2])) << strerror(errno);
-        ASSERT_TRUE(WriteFdExactly(sockets[i * 2], &i, sizeof(i)));
-        adb_pollfd pfd;
-        pfd.events = POLLIN;
-        pfd.fd = sockets[i * 2 + 1];
-        pfds.push_back(pfd);
-    }
-
-    ASSERT_EQ(num_sockets, adb_poll(pfds.data(), pfds.size(), 0));
-    for (int i = 0; i < num_sockets; ++i) {
-        ASSERT_NE(0, pfds[i].revents & POLLIN);
-
-        int32_t buf[2] = { -1, -1 };
-        ASSERT_EQ(adb_read(pfds[i].fd, buf, sizeof(buf)), static_cast<ssize_t>(sizeof(int32_t)));
-        ASSERT_EQ(i, buf[0]);
-    }
-
-    for (int fd : sockets) {
-        adb_close(fd);
-    }
-}
-
-TEST(sysdeps_condition_variable, smoke) {
-    static std::mutex &m = *new std::mutex;
-    static std::condition_variable &cond = *new std::condition_variable;
-    static volatile bool flag = false;
-
-    std::unique_lock<std::mutex> lock(m);
-    std::thread thread([]() {
-        m.lock();
-        flag = true;
-        cond.notify_one();
-        m.unlock();
-    });
-
-    while (!flag) {
-        cond.wait(lock);
-    }
-
-    thread.join();
-}
diff --git a/adb/sysdeps_unix.cpp b/adb/sysdeps_unix.cpp
deleted file mode 100644
index e565706..0000000
--- a/adb/sysdeps_unix.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "sysdeps.h"
-
-bool set_tcp_keepalive(borrowed_fd fd, int interval_sec) {
-    int enable = (interval_sec > 0);
-    if (adb_setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable))) {
-        return false;
-    }
-
-    if (!enable) {
-        return true;
-    }
-
-    // Idle time before sending the first keepalive is TCP_KEEPIDLE on Linux, TCP_KEEPALIVE on Mac.
-#if defined(TCP_KEEPIDLE)
-    if (adb_setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &interval_sec, sizeof(interval_sec))) {
-        return false;
-    }
-#elif defined(TCP_KEEPALIVE)
-    if (adb_setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &interval_sec, sizeof(interval_sec))) {
-        return false;
-    }
-#endif
-
-    // TCP_KEEPINTVL and TCP_KEEPCNT are available on Linux 2.4+ and OS X 10.8+ (Mountain Lion).
-#if defined(TCP_KEEPINTVL)
-    if (adb_setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &interval_sec, sizeof(interval_sec))) {
-        return false;
-    }
-#endif
-
-#if defined(TCP_KEEPCNT)
-    // On Windows this value is hardcoded to 10. This is a reasonable value, so we do the same here
-    // to match behavior. See SO_KEEPALIVE documentation at
-    // https://msdn.microsoft.com/en-us/library/windows/desktop/ee470551(v=vs.85).aspx.
-    const int keepcnt = 10;
-    if (adb_setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt))) {
-        return false;
-    }
-#endif
-
-    return true;
-}
-
-static __inline__ void disable_close_on_exec(borrowed_fd fd) {
-    const auto oldFlags = fcntl(fd.get(), F_GETFD);
-    const auto newFlags = (oldFlags & ~FD_CLOEXEC);
-    if (newFlags != oldFlags) {
-        fcntl(fd.get(), F_SETFD, newFlags);
-    }
-}
-
-Process adb_launch_process(std::string_view executable, std::vector<std::string> args,
-                           std::initializer_list<int> fds_to_inherit) {
-    const auto pid = fork();
-    if (pid != 0) {
-        // parent, includes the case when failed to fork()
-        return Process(pid);
-    }
-    // child
-    std::vector<std::string> copies;
-    copies.reserve(args.size() + 1);
-    copies.emplace_back(executable);
-    copies.insert(copies.end(), std::make_move_iterator(args.begin()),
-                  std::make_move_iterator(args.end()));
-
-    std::vector<char*> rawArgs;
-    rawArgs.reserve(copies.size() + 1);
-    for (auto&& str : copies) {
-        rawArgs.push_back(str.data());
-    }
-    rawArgs.push_back(nullptr);
-    for (auto fd : fds_to_inherit) {
-        disable_close_on_exec(fd);
-    }
-    exit(execv(copies.front().data(), rawArgs.data()));
-}
diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp
deleted file mode 100644
index be82bc0..0000000
--- a/adb/sysdeps_win32.cpp
+++ /dev/null
@@ -1,2981 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define TRACE_TAG SYSDEPS
-
-#include "sysdeps.h"
-
-#include <lmcons.h>
-#include <windows.h>
-#include <winsock2.h> /* winsock.h *must* be included before windows.h. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <algorithm>
-#include <memory>
-#include <mutex>
-#include <string>
-#include <string_view>
-#include <unordered_map>
-#include <vector>
-
-#include <cutils/sockets.h>
-
-#include <android-base/errors.h>
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <android-base/utf8.h>
-
-#include "adb.h"
-#include "adb_utils.h"
-
-#include "sysdeps/uio.h"
-
-/* forward declarations */
-
-typedef const struct FHClassRec_* FHClass;
-typedef struct FHRec_* FH;
-
-typedef struct FHClassRec_ {
-    void (*_fh_init)(FH);
-    int (*_fh_close)(FH);
-    int64_t (*_fh_lseek)(FH, int64_t, int);
-    int (*_fh_read)(FH, void*, int);
-    int (*_fh_write)(FH, const void*, int);
-    int (*_fh_writev)(FH, const adb_iovec*, int);
-    intptr_t (*_fh_get_os_handle)(FH);
-} FHClassRec;
-
-static void _fh_file_init(FH);
-static int _fh_file_close(FH);
-static int64_t _fh_file_lseek(FH, int64_t, int);
-static int _fh_file_read(FH, void*, int);
-static int _fh_file_write(FH, const void*, int);
-static int _fh_file_writev(FH, const adb_iovec*, int);
-static intptr_t _fh_file_get_os_handle(FH f);
-
-static const FHClassRec _fh_file_class = {
-        _fh_file_init,  _fh_file_close,  _fh_file_lseek,         _fh_file_read,
-        _fh_file_write, _fh_file_writev, _fh_file_get_os_handle,
-};
-
-static void _fh_socket_init(FH);
-static int _fh_socket_close(FH);
-static int64_t _fh_socket_lseek(FH, int64_t, int);
-static int _fh_socket_read(FH, void*, int);
-static int _fh_socket_write(FH, const void*, int);
-static int _fh_socket_writev(FH, const adb_iovec*, int);
-static intptr_t _fh_socket_get_os_handle(FH f);
-
-static const FHClassRec _fh_socket_class = {
-        _fh_socket_init,  _fh_socket_close,  _fh_socket_lseek,         _fh_socket_read,
-        _fh_socket_write, _fh_socket_writev, _fh_socket_get_os_handle,
-};
-
-#if defined(assert)
-#undef assert
-#endif
-
-void handle_deleter::operator()(HANDLE h) {
-    // CreateFile() is documented to return INVALID_HANDLE_FILE on error,
-    // implying that NULL is a valid handle, but this is probably impossible.
-    // Other APIs like CreateEvent() are documented to return NULL on error,
-    // implying that INVALID_HANDLE_VALUE is a valid handle, but this is also
-    // probably impossible. Thus, consider both NULL and INVALID_HANDLE_VALUE
-    // as invalid handles. std::unique_ptr won't call a deleter with NULL, so we
-    // only need to check for INVALID_HANDLE_VALUE.
-    if (h != INVALID_HANDLE_VALUE) {
-        if (!CloseHandle(h)) {
-            D("CloseHandle(%p) failed: %s", h,
-              android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        }
-    }
-}
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****    common file descriptor handling                             *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-typedef struct FHRec_
-{
-    FHClass    clazz;
-    int        used;
-    int        eof;
-    union {
-        HANDLE      handle;
-        SOCKET      socket;
-    } u;
-
-    char  name[32];
-} FHRec;
-
-#define  fh_handle  u.handle
-#define  fh_socket  u.socket
-
-#define  WIN32_FH_BASE    2048
-#define  WIN32_MAX_FHS    2048
-
-static  std::mutex&  _win32_lock = *new std::mutex();
-static  FHRec        _win32_fhs[ WIN32_MAX_FHS ];
-static  int          _win32_fh_next;  // where to start search for free FHRec
-
-static FH _fh_from_int(borrowed_fd bfd, const char* func) {
-    FH f;
-
-    int fd = bfd.get();
-    fd -= WIN32_FH_BASE;
-
-    if (fd < 0 || fd >= WIN32_MAX_FHS) {
-        D("_fh_from_int: invalid fd %d passed to %s", fd + WIN32_FH_BASE, func);
-        errno = EBADF;
-        return nullptr;
-    }
-
-    f = &_win32_fhs[fd];
-
-    if (f->used == 0) {
-        D("_fh_from_int: invalid fd %d passed to %s", fd + WIN32_FH_BASE, func);
-        errno = EBADF;
-        return nullptr;
-    }
-
-    return f;
-}
-
-static int _fh_to_int(FH f) {
-    if (f && f->used && f >= _win32_fhs && f < _win32_fhs + WIN32_MAX_FHS)
-        return (int)(f - _win32_fhs) + WIN32_FH_BASE;
-
-    return -1;
-}
-
-static FH _fh_alloc(FHClass clazz) {
-    FH f = nullptr;
-
-    std::lock_guard<std::mutex> lock(_win32_lock);
-
-    for (int i = _win32_fh_next; i < WIN32_MAX_FHS; ++i) {
-        if (_win32_fhs[i].clazz == nullptr) {
-            f = &_win32_fhs[i];
-            _win32_fh_next = i + 1;
-            f->clazz = clazz;
-            f->used = 1;
-            f->eof = 0;
-            f->name[0] = '\0';
-            clazz->_fh_init(f);
-            return f;
-        }
-    }
-
-    D("_fh_alloc: no more free file descriptors");
-    errno = EMFILE;  // Too many open files
-    return nullptr;
-}
-
-static int _fh_close(FH f) {
-    // Use lock so that closing only happens once and so that _fh_alloc can't
-    // allocate a FH that we're in the middle of closing.
-    std::lock_guard<std::mutex> lock(_win32_lock);
-
-    int offset = f - _win32_fhs;
-    if (_win32_fh_next > offset) {
-        _win32_fh_next = offset;
-    }
-
-    if (f->used) {
-        f->clazz->_fh_close( f );
-        f->name[0] = '\0';
-        f->eof     = 0;
-        f->used    = 0;
-        f->clazz   = nullptr;
-    }
-    return 0;
-}
-
-// Deleter for unique_fh.
-class fh_deleter {
- public:
-  void operator()(struct FHRec_* fh) {
-    // We're called from a destructor and destructors should not overwrite
-    // errno because callers may do:
-    //   errno = EBLAH;
-    //   return -1; // calls destructor, which should not overwrite errno
-    const int saved_errno = errno;
-    _fh_close(fh);
-    errno = saved_errno;
-  }
-};
-
-// Like std::unique_ptr, but calls _fh_close() instead of operator delete().
-typedef std::unique_ptr<struct FHRec_, fh_deleter> unique_fh;
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****    file-based descriptor handling                              *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-static void _fh_file_init(FH f) {
-    f->fh_handle = INVALID_HANDLE_VALUE;
-}
-
-static int _fh_file_close(FH f) {
-    CloseHandle(f->fh_handle);
-    f->fh_handle = INVALID_HANDLE_VALUE;
-    return 0;
-}
-
-static int _fh_file_read(FH f, void* buf, int len) {
-    DWORD read_bytes;
-
-    if (!ReadFile(f->fh_handle, buf, (DWORD)len, &read_bytes, nullptr)) {
-        D("adb_read: could not read %d bytes from %s", len, f->name);
-        errno = EIO;
-        return -1;
-    } else if (read_bytes < (DWORD)len) {
-        f->eof = 1;
-    }
-    return read_bytes;
-}
-
-static int _fh_file_write(FH f, const void* buf, int len) {
-    DWORD wrote_bytes;
-
-    if (!WriteFile(f->fh_handle, buf, (DWORD)len, &wrote_bytes, nullptr)) {
-        D("adb_file_write: could not write %d bytes from %s", len, f->name);
-        errno = EIO;
-        return -1;
-    } else if (wrote_bytes < (DWORD)len) {
-        f->eof = 1;
-    }
-    return wrote_bytes;
-}
-
-static int _fh_file_writev(FH f, const adb_iovec* iov, int iovcnt) {
-    if (iovcnt <= 0) {
-        errno = EINVAL;
-        return -1;
-    }
-
-    DWORD wrote_bytes = 0;
-
-    for (int i = 0; i < iovcnt; ++i) {
-        ssize_t rc = _fh_file_write(f, iov[i].iov_base, iov[i].iov_len);
-        if (rc == -1) {
-            return wrote_bytes > 0 ? wrote_bytes : -1;
-        } else if (rc == 0) {
-            return wrote_bytes;
-        }
-
-        wrote_bytes += rc;
-
-        if (static_cast<size_t>(rc) < iov[i].iov_len) {
-            return wrote_bytes;
-        }
-    }
-
-    return wrote_bytes;
-}
-
-static int64_t _fh_file_lseek(FH f, int64_t pos, int origin) {
-    DWORD method;
-    switch (origin) {
-        case SEEK_SET:
-            method = FILE_BEGIN;
-            break;
-        case SEEK_CUR:
-            method = FILE_CURRENT;
-            break;
-        case SEEK_END:
-            method = FILE_END;
-            break;
-        default:
-            errno = EINVAL;
-            return -1;
-    }
-
-    LARGE_INTEGER li = {.QuadPart = pos};
-    if (!SetFilePointerEx(f->fh_handle, li, &li, method)) {
-        errno = EIO;
-        return -1;
-    }
-    f->eof = 0;
-    return li.QuadPart;
-}
-
-static intptr_t _fh_file_get_os_handle(FH f) {
-    return reinterpret_cast<intptr_t>(f->u.handle);
-}
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****    file-based descriptor handling                              *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-int adb_open(const char* path, int options) {
-    FH f;
-
-    DWORD desiredAccess = 0;
-    DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
-
-    // CreateFileW is inherently O_CLOEXEC by default.
-    options &= ~O_CLOEXEC;
-
-    switch (options) {
-        case O_RDONLY:
-            desiredAccess = GENERIC_READ;
-            break;
-        case O_WRONLY:
-            desiredAccess = GENERIC_WRITE;
-            break;
-        case O_RDWR:
-            desiredAccess = GENERIC_READ | GENERIC_WRITE;
-            break;
-        default:
-            D("adb_open: invalid options (0x%0x)", options);
-            errno = EINVAL;
-            return -1;
-    }
-
-    f = _fh_alloc(&_fh_file_class);
-    if (!f) {
-        return -1;
-    }
-
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return -1;
-    }
-    f->fh_handle =
-        CreateFileW(path_wide.c_str(), desiredAccess, shareMode, nullptr, OPEN_EXISTING, 0, nullptr);
-
-    if (f->fh_handle == INVALID_HANDLE_VALUE) {
-        const DWORD err = GetLastError();
-        _fh_close(f);
-        D("adb_open: could not open '%s': ", path);
-        switch (err) {
-            case ERROR_FILE_NOT_FOUND:
-                D("file not found");
-                errno = ENOENT;
-                return -1;
-
-            case ERROR_PATH_NOT_FOUND:
-                D("path not found");
-                errno = ENOTDIR;
-                return -1;
-
-            default:
-                D("unknown error: %s", android::base::SystemErrorCodeToString(err).c_str());
-                errno = ENOENT;
-                return -1;
-        }
-    }
-
-    snprintf(f->name, sizeof(f->name), "%d(%s)", _fh_to_int(f), path);
-    D("adb_open: '%s' => fd %d", path, _fh_to_int(f));
-    return _fh_to_int(f);
-}
-
-/* ignore mode on Win32 */
-int adb_creat(const char* path, int mode) {
-    FH f;
-
-    f = _fh_alloc(&_fh_file_class);
-    if (!f) {
-        return -1;
-    }
-
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return -1;
-    }
-    f->fh_handle = CreateFileW(path_wide.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
-                               nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
-
-    if (f->fh_handle == INVALID_HANDLE_VALUE) {
-        const DWORD err = GetLastError();
-        _fh_close(f);
-        D("adb_creat: could not open '%s': ", path);
-        switch (err) {
-            case ERROR_FILE_NOT_FOUND:
-                D("file not found");
-                errno = ENOENT;
-                return -1;
-
-            case ERROR_PATH_NOT_FOUND:
-                D("path not found");
-                errno = ENOTDIR;
-                return -1;
-
-            default:
-                D("unknown error: %s", android::base::SystemErrorCodeToString(err).c_str());
-                errno = ENOENT;
-                return -1;
-        }
-    }
-    snprintf(f->name, sizeof(f->name), "%d(%s)", _fh_to_int(f), path);
-    D("adb_creat: '%s' => fd %d", path, _fh_to_int(f));
-    return _fh_to_int(f);
-}
-
-int adb_read(borrowed_fd fd, void* buf, int len) {
-    FH f = _fh_from_int(fd, __func__);
-
-    if (f == nullptr) {
-        errno = EBADF;
-        return -1;
-    }
-
-    return f->clazz->_fh_read(f, buf, len);
-}
-
-int adb_pread(borrowed_fd fd, void* buf, int len, off64_t offset) {
-    OVERLAPPED overlapped = {};
-    overlapped.Offset = static_cast<DWORD>(offset);
-    overlapped.OffsetHigh = static_cast<DWORD>(offset >> 32);
-    DWORD bytes_read;
-    if (!::ReadFile(adb_get_os_handle(fd), buf, static_cast<DWORD>(len), &bytes_read,
-                    &overlapped)) {
-        D("adb_pread: could not read %d bytes from FD %d", len, fd.get());
-        switch (::GetLastError()) {
-            case ERROR_IO_PENDING:
-                errno = EAGAIN;
-                return -1;
-            default:
-                errno = EINVAL;
-                return -1;
-        }
-    }
-    return static_cast<int>(bytes_read);
-}
-
-int adb_write(borrowed_fd fd, const void* buf, int len) {
-    FH f = _fh_from_int(fd, __func__);
-
-    if (f == nullptr) {
-        errno = EBADF;
-        return -1;
-    }
-
-    return f->clazz->_fh_write(f, buf, len);
-}
-
-ssize_t adb_writev(borrowed_fd fd, const adb_iovec* iov, int iovcnt) {
-    FH f = _fh_from_int(fd, __func__);
-
-    if (f == nullptr) {
-        errno = EBADF;
-        return -1;
-    }
-
-    return f->clazz->_fh_writev(f, iov, iovcnt);
-}
-
-int adb_pwrite(borrowed_fd fd, const void* buf, int len, off64_t offset) {
-    OVERLAPPED params = {};
-    params.Offset = static_cast<DWORD>(offset);
-    params.OffsetHigh = static_cast<DWORD>(offset >> 32);
-    DWORD bytes_written = 0;
-    if (!::WriteFile(adb_get_os_handle(fd), buf, len, &bytes_written, &params)) {
-        D("adb_pwrite: could not write %d bytes to FD %d", len, fd.get());
-        switch (::GetLastError()) {
-            case ERROR_IO_PENDING:
-                errno = EAGAIN;
-                return -1;
-            default:
-                errno = EINVAL;
-                return -1;
-        }
-    }
-    return static_cast<int>(bytes_written);
-}
-
-int64_t adb_lseek(borrowed_fd fd, int64_t pos, int where) {
-    FH f = _fh_from_int(fd, __func__);
-    if (!f) {
-        errno = EBADF;
-        return -1;
-    }
-    return f->clazz->_fh_lseek(f, pos, where);
-}
-
-int adb_close(int fd) {
-    FH f = _fh_from_int(fd, __func__);
-
-    if (!f) {
-        errno = EBADF;
-        return -1;
-    }
-
-    D("adb_close: %s", f->name);
-    _fh_close(f);
-    return 0;
-}
-
-HANDLE adb_get_os_handle(borrowed_fd fd) {
-    FH f = _fh_from_int(fd, __func__);
-
-    if (!f) {
-        errno = EBADF;
-        return nullptr;
-    }
-
-    D("adb_get_os_handle: %s", f->name);
-    const intptr_t intptr_handle = f->clazz->_fh_get_os_handle(f);
-    const HANDLE handle = reinterpret_cast<const HANDLE>(intptr_handle);
-    return handle;
-}
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****    socket-based file descriptors                               *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-#undef setsockopt
-
-static void _socket_set_errno( const DWORD err ) {
-    // Because the Windows C Runtime (MSVCRT.DLL) strerror() does not support a
-    // lot of POSIX and socket error codes, some of the resulting error codes
-    // are mapped to strings by adb_strerror().
-    switch ( err ) {
-    case 0:              errno = 0; break;
-    // Don't map WSAEINTR since that is only for Winsock 1.1 which we don't use.
-    // case WSAEINTR:    errno = EINTR; break;
-    case WSAEFAULT:      errno = EFAULT; break;
-    case WSAEINVAL:      errno = EINVAL; break;
-    case WSAEMFILE:      errno = EMFILE; break;
-    // Mapping WSAEWOULDBLOCK to EAGAIN is absolutely critical because
-    // non-blocking sockets can cause an error code of WSAEWOULDBLOCK and
-    // callers check specifically for EAGAIN.
-    case WSAEWOULDBLOCK: errno = EAGAIN; break;
-    case WSAENOTSOCK:    errno = ENOTSOCK; break;
-    case WSAENOPROTOOPT: errno = ENOPROTOOPT; break;
-    case WSAEOPNOTSUPP:  errno = EOPNOTSUPP; break;
-    case WSAENETDOWN:    errno = ENETDOWN; break;
-    case WSAENETRESET:   errno = ENETRESET; break;
-    // Map WSAECONNABORTED to EPIPE instead of ECONNABORTED because POSIX seems
-    // to use EPIPE for these situations and there are some callers that look
-    // for EPIPE.
-    case WSAECONNABORTED: errno = EPIPE; break;
-    case WSAECONNRESET:  errno = ECONNRESET; break;
-    case WSAENOBUFS:     errno = ENOBUFS; break;
-    case WSAENOTCONN:    errno = ENOTCONN; break;
-    // Don't map WSAETIMEDOUT because we don't currently use SO_RCVTIMEO or
-    // SO_SNDTIMEO which would cause WSAETIMEDOUT to be returned. Future
-    // considerations: Reportedly send() can return zero on timeout, and POSIX
-    // code may expect EAGAIN instead of ETIMEDOUT on timeout.
-    // case WSAETIMEDOUT: errno = ETIMEDOUT; break;
-    case WSAEHOSTUNREACH: errno = EHOSTUNREACH; break;
-    default:
-        errno = EINVAL;
-        D( "_socket_set_errno: mapping Windows error code %lu to errno %d",
-           err, errno );
-    }
-}
-
-extern int adb_poll(adb_pollfd* fds, size_t nfds, int timeout) {
-    // WSAPoll doesn't handle invalid/non-socket handles, so we need to handle them ourselves.
-    int skipped = 0;
-    std::vector<WSAPOLLFD> sockets;
-    std::vector<adb_pollfd*> original;
-
-    for (size_t i = 0; i < nfds; ++i) {
-        FH fh = _fh_from_int(fds[i].fd, __func__);
-        if (!fh || !fh->used || fh->clazz != &_fh_socket_class) {
-            D("adb_poll received bad FD %d", fds[i].fd);
-            fds[i].revents = POLLNVAL;
-            ++skipped;
-        } else {
-            WSAPOLLFD wsapollfd = {
-                .fd = fh->u.socket,
-                .events = static_cast<short>(fds[i].events)
-            };
-            sockets.push_back(wsapollfd);
-            original.push_back(&fds[i]);
-        }
-    }
-
-    if (sockets.empty()) {
-        return skipped;
-    }
-
-    // If we have any invalid FDs in our FD set, make sure to return immediately.
-    if (skipped > 0) {
-        timeout = 0;
-    }
-
-    int result = WSAPoll(sockets.data(), sockets.size(), timeout);
-    if (result == SOCKET_ERROR) {
-        _socket_set_errno(WSAGetLastError());
-        return -1;
-    }
-
-    // Map the results back onto the original set.
-    for (size_t i = 0; i < sockets.size(); ++i) {
-        original[i]->revents = sockets[i].revents;
-    }
-
-    // WSAPoll appears to return the number of unique FDs with available events, instead of how many
-    // of the pollfd elements have a non-zero revents field, which is what it and poll are specified
-    // to do. Ignore its result and calculate the proper return value.
-    result = 0;
-    for (size_t i = 0; i < nfds; ++i) {
-        if (fds[i].revents != 0) {
-            ++result;
-        }
-    }
-    return result;
-}
-
-static void _fh_socket_init(FH f) {
-    f->fh_socket = INVALID_SOCKET;
-}
-
-static int _fh_socket_close(FH f) {
-    if (f->fh_socket != INVALID_SOCKET) {
-        if (closesocket(f->fh_socket) == SOCKET_ERROR) {
-            // Don't set errno here, since adb_close will ignore it.
-            const DWORD err = WSAGetLastError();
-            D("closesocket failed: %s", android::base::SystemErrorCodeToString(err).c_str());
-        }
-        f->fh_socket = INVALID_SOCKET;
-    }
-    return 0;
-}
-
-static int64_t _fh_socket_lseek(FH f, int64_t pos, int origin) {
-    errno = EPIPE;
-    return -1;
-}
-
-static int _fh_socket_read(FH f, void* buf, int len) {
-    int result = recv(f->fh_socket, reinterpret_cast<char*>(buf), len, 0);
-    if (result == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        // WSAEWOULDBLOCK is normal with a non-blocking socket, so don't trace
-        // that to reduce spam and confusion.
-        if (err != WSAEWOULDBLOCK) {
-            D("recv fd %d failed: %s", _fh_to_int(f),
-              android::base::SystemErrorCodeToString(err).c_str());
-        }
-        _socket_set_errno(err);
-        result = -1;
-    }
-    return result;
-}
-
-static int _fh_socket_write(FH f, const void* buf, int len) {
-    int result = send(f->fh_socket, reinterpret_cast<const char*>(buf), len, 0);
-    if (result == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        // WSAEWOULDBLOCK is normal with a non-blocking socket, so don't trace
-        // that to reduce spam and confusion.
-        if (err != WSAEWOULDBLOCK) {
-            D("send fd %d failed: %s", _fh_to_int(f),
-              android::base::SystemErrorCodeToString(err).c_str());
-        }
-        _socket_set_errno(err);
-        result = -1;
-    } else {
-        // According to https://code.google.com/p/chromium/issues/detail?id=27870
-        // Winsock Layered Service Providers may cause this.
-        CHECK_LE(result, len) << "Tried to write " << len << " bytes to " << f->name << ", but "
-                              << result << " bytes reportedly written";
-    }
-    return result;
-}
-
-// Make sure that adb_iovec is compatible with WSABUF.
-static_assert(sizeof(adb_iovec) == sizeof(WSABUF), "");
-static_assert(SIZEOF_MEMBER(adb_iovec, iov_len) == SIZEOF_MEMBER(WSABUF, len), "");
-static_assert(offsetof(adb_iovec, iov_len) == offsetof(WSABUF, len), "");
-
-static_assert(SIZEOF_MEMBER(adb_iovec, iov_base) == SIZEOF_MEMBER(WSABUF, buf), "");
-static_assert(offsetof(adb_iovec, iov_base) == offsetof(WSABUF, buf), "");
-
-static int _fh_socket_writev(FH f, const adb_iovec* iov, int iovcnt) {
-    if (iovcnt <= 0) {
-        errno = EINVAL;
-        return -1;
-    }
-
-    WSABUF* wsabuf = reinterpret_cast<WSABUF*>(const_cast<adb_iovec*>(iov));
-    DWORD bytes_written = 0;
-    int result = WSASend(f->fh_socket, wsabuf, iovcnt, &bytes_written, 0, nullptr, nullptr);
-    if (result == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        // WSAEWOULDBLOCK is normal with a non-blocking socket, so don't trace
-        // that to reduce spam and confusion.
-        if (err != WSAEWOULDBLOCK) {
-            D("send fd %d failed: %s", _fh_to_int(f),
-              android::base::SystemErrorCodeToString(err).c_str());
-        }
-        _socket_set_errno(err);
-        return -1;
-    }
-    CHECK_GE(static_cast<DWORD>(std::numeric_limits<int>::max()), bytes_written);
-    return static_cast<int>(bytes_written);
-}
-
-static intptr_t _fh_socket_get_os_handle(FH f) {
-    return f->u.socket;
-}
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****    replacement for libs/cutils/socket_xxxx.c                   *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-static void _init_winsock() {
-    static std::once_flag once;
-    std::call_once(once, []() {
-        WSADATA wsaData;
-        int rc = WSAStartup(MAKEWORD(2, 2), &wsaData);
-        if (rc != 0) {
-            LOG(FATAL) << "could not initialize Winsock: "
-                       << android::base::SystemErrorCodeToString(rc);
-        }
-
-        // Note that we do not call atexit() to register WSACleanup to be called
-        // at normal process termination because:
-        // 1) When exit() is called, there are still threads actively using
-        //    Winsock because we don't cleanly shutdown all threads, so it
-        //    doesn't make sense to call WSACleanup() and may cause problems
-        //    with those threads.
-        // 2) A deadlock can occur when exit() holds a C Runtime lock, then it
-        //    calls WSACleanup() which tries to unload a DLL, which tries to
-        //    grab the LoaderLock. This conflicts with the device_poll_thread
-        //    which holds the LoaderLock because AdbWinApi.dll calls
-        //    setupapi.dll which tries to load wintrust.dll which tries to load
-        //    crypt32.dll which calls atexit() which tries to acquire the C
-        //    Runtime lock that the other thread holds.
-    });
-}
-
-// Map a socket type to an explicit socket protocol instead of using the socket
-// protocol of 0. Explicit socket protocols are used by most apps and we should
-// do the same to reduce the chance of exercising uncommon code-paths that might
-// have problems or that might load different Winsock service providers that
-// have problems.
-static int GetSocketProtocolFromSocketType(int type) {
-    switch (type) {
-        case SOCK_STREAM:
-            return IPPROTO_TCP;
-        case SOCK_DGRAM:
-            return IPPROTO_UDP;
-        default:
-            LOG(FATAL) << "Unknown socket type: " << type;
-            return 0;
-    }
-}
-
-int network_loopback_client(int port, int type, std::string* error) {
-    struct sockaddr_in addr;
-    SOCKET s;
-
-    unique_fh f(_fh_alloc(&_fh_socket_class));
-    if (!f) {
-        *error = strerror(errno);
-        return -1;
-    }
-
-    memset(&addr, 0, sizeof(addr));
-    addr.sin_family = AF_INET;
-    addr.sin_port = htons(port);
-    addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
-    s = socket(AF_INET, type, GetSocketProtocolFromSocketType(type));
-    if (s == INVALID_SOCKET) {
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot create socket: %s",
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("%s", error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-    f->fh_socket = s;
-
-    if (connect(s, (struct sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) {
-        // Save err just in case inet_ntoa() or ntohs() changes the last error.
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot connect to %s:%u: %s",
-                                             inet_ntoa(addr.sin_addr), ntohs(addr.sin_port),
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("could not connect to %s:%d: %s", type != SOCK_STREAM ? "udp" : "tcp", port,
-          error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-
-    const int fd = _fh_to_int(f.get());
-    snprintf(f->name, sizeof(f->name), "%d(lo-client:%s%d)", fd, type != SOCK_STREAM ? "udp:" : "",
-             port);
-    D("port %d type %s => fd %d", port, type != SOCK_STREAM ? "udp" : "tcp", fd);
-    f.release();
-    return fd;
-}
-
-// interface_address is INADDR_LOOPBACK or INADDR_ANY.
-static int _network_server(int port, int type, u_long interface_address, std::string* error) {
-    struct sockaddr_in addr;
-    SOCKET s;
-    int n;
-
-    unique_fh f(_fh_alloc(&_fh_socket_class));
-    if (!f) {
-        *error = strerror(errno);
-        return -1;
-    }
-
-    memset(&addr, 0, sizeof(addr));
-    addr.sin_family = AF_INET;
-    addr.sin_port = htons(port);
-    addr.sin_addr.s_addr = htonl(interface_address);
-
-    // TODO: Consider using dual-stack socket that can simultaneously listen on
-    // IPv4 and IPv6.
-    s = socket(AF_INET, type, GetSocketProtocolFromSocketType(type));
-    if (s == INVALID_SOCKET) {
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot create socket: %s",
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("%s", error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-
-    f->fh_socket = s;
-
-    // Note: SO_REUSEADDR on Windows allows multiple processes to bind to the
-    // same port, so instead use SO_EXCLUSIVEADDRUSE.
-    n = 1;
-    if (setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (const char*)&n, sizeof(n)) == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot set socket option SO_EXCLUSIVEADDRUSE: %s",
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("%s", error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-
-    if (bind(s, (struct sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) {
-        // Save err just in case inet_ntoa() or ntohs() changes the last error.
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot bind to %s:%u: %s", inet_ntoa(addr.sin_addr),
-                                             ntohs(addr.sin_port),
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("could not bind to %s:%d: %s", type != SOCK_STREAM ? "udp" : "tcp", port, error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-    if (type == SOCK_STREAM) {
-        if (listen(s, SOMAXCONN) == SOCKET_ERROR) {
-            const DWORD err = WSAGetLastError();
-            *error = android::base::StringPrintf(
-                "cannot listen on socket: %s", android::base::SystemErrorCodeToString(err).c_str());
-            D("could not listen on %s:%d: %s", type != SOCK_STREAM ? "udp" : "tcp", port,
-              error->c_str());
-            _socket_set_errno(err);
-            return -1;
-        }
-    }
-    const int fd = _fh_to_int(f.get());
-    snprintf(f->name, sizeof(f->name), "%d(%s-server:%s%d)", fd,
-             interface_address == INADDR_LOOPBACK ? "lo" : "any", type != SOCK_STREAM ? "udp:" : "",
-             port);
-    D("port %d type %s => fd %d", port, type != SOCK_STREAM ? "udp" : "tcp", fd);
-    f.release();
-    return fd;
-}
-
-int network_loopback_server(int port, int type, std::string* error, bool prefer_ipv4) {
-    // TODO implement IPv6 support on windows
-    return _network_server(port, type, INADDR_LOOPBACK, error);
-}
-
-int network_inaddr_any_server(int port, int type, std::string* error) {
-    return _network_server(port, type, INADDR_ANY, error);
-}
-
-int network_connect(const std::string& host, int port, int type, int timeout, std::string* error) {
-    unique_fh f(_fh_alloc(&_fh_socket_class));
-    if (!f) {
-        *error = strerror(errno);
-        return -1;
-    }
-
-    struct addrinfo hints;
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_family = AF_UNSPEC;
-    hints.ai_socktype = type;
-    hints.ai_protocol = GetSocketProtocolFromSocketType(type);
-
-    char port_str[16];
-    snprintf(port_str, sizeof(port_str), "%d", port);
-
-    struct addrinfo* addrinfo_ptr = nullptr;
-
-#if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= _WIN32_WINNT_WS03)
-// TODO: When the Android SDK tools increases the Windows system
-// requirements >= WinXP SP2, switch to android::base::UTF8ToWide() + GetAddrInfoW().
-#else
-// Otherwise, keep using getaddrinfo(), or do runtime API detection
-// with GetProcAddress("GetAddrInfoW").
-#endif
-    if (getaddrinfo(host.c_str(), port_str, &hints, &addrinfo_ptr) != 0) {
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot resolve host '%s' and port %s: %s",
-                                             host.c_str(), port_str,
-                                             android::base::SystemErrorCodeToString(err).c_str());
-
-        D("%s", error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-    std::unique_ptr<struct addrinfo, decltype(&freeaddrinfo)> addrinfo(addrinfo_ptr, freeaddrinfo);
-    addrinfo_ptr = nullptr;
-
-    // TODO: Try all the addresses if there's more than one? This just uses
-    // the first. Or, could call WSAConnectByName() (Windows Vista and newer)
-    // which tries all addresses, takes a timeout and more.
-    SOCKET s = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol);
-    if (s == INVALID_SOCKET) {
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot create socket: %s",
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("%s", error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-    f->fh_socket = s;
-
-    // TODO: Implement timeouts for Windows. Seems like the default in theory
-    // (according to http://serverfault.com/a/671453) and in practice is 21 sec.
-    if (connect(s, addrinfo->ai_addr, addrinfo->ai_addrlen) == SOCKET_ERROR) {
-        // TODO: Use WSAAddressToString or inet_ntop on address.
-        const DWORD err = WSAGetLastError();
-        *error = android::base::StringPrintf("cannot connect to %s:%s: %s", host.c_str(), port_str,
-                                             android::base::SystemErrorCodeToString(err).c_str());
-        D("could not connect to %s:%s:%s: %s", type != SOCK_STREAM ? "udp" : "tcp", host.c_str(),
-          port_str, error->c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-
-    const int fd = _fh_to_int(f.get());
-    snprintf(f->name, sizeof(f->name), "%d(net-client:%s%d)", fd, type != SOCK_STREAM ? "udp:" : "",
-             port);
-    D("host '%s' port %d type %s => fd %d", host.c_str(), port, type != SOCK_STREAM ? "udp" : "tcp",
-      fd);
-    f.release();
-    return fd;
-}
-
-int adb_register_socket(SOCKET s) {
-    FH f = _fh_alloc(&_fh_socket_class);
-    f->fh_socket = s;
-    return _fh_to_int(f);
-}
-
-static bool isBlankStr(const char* str) {
-    for (; *str != '\0'; ++str) {
-        if (!isblank(*str)) {
-            return false;
-        }
-    }
-    return true;
-}
-
-int adb_gethostname(char* name, size_t len) {
-    const char* computerName = adb_getenv("COMPUTERNAME");
-    if (computerName && !isBlankStr(computerName)) {
-        strncpy(name, computerName, len);
-        name[len - 1] = '\0';
-        return 0;
-    }
-
-    wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1];
-    DWORD size = sizeof(buffer);
-    if (!GetComputerNameW(buffer, &size)) {
-        return -1;
-    }
-    std::string name_utf8;
-    if (!android::base::WideToUTF8(buffer, &name_utf8)) {
-        return -1;
-    }
-
-    strncpy(name, name_utf8.c_str(), len);
-    name[len - 1] = '\0';
-    return 0;
-}
-
-int adb_getlogin_r(char* buf, size_t bufsize) {
-    wchar_t buffer[UNLEN + 1];
-    DWORD len = sizeof(buffer);
-    if (!GetUserNameW(buffer, &len)) {
-        return -1;
-    }
-
-    std::string login;
-    if (!android::base::WideToUTF8(buffer, &login)) {
-        return -1;
-    }
-
-    strncpy(buf, login.c_str(), bufsize);
-    buf[bufsize - 1] = '\0';
-    return 0;
-}
-
-#undef accept
-int adb_socket_accept(borrowed_fd serverfd, struct sockaddr* addr, socklen_t* addrlen) {
-    FH serverfh = _fh_from_int(serverfd, __func__);
-
-    if (!serverfh || serverfh->clazz != &_fh_socket_class) {
-        D("adb_socket_accept: invalid fd %d", serverfd.get());
-        errno = EBADF;
-        return -1;
-    }
-
-    unique_fh fh(_fh_alloc(&_fh_socket_class));
-    if (!fh) {
-        PLOG(ERROR) << "adb_socket_accept: failed to allocate accepted socket "
-                       "descriptor";
-        return -1;
-    }
-
-    fh->fh_socket = accept(serverfh->fh_socket, addr, addrlen);
-    if (fh->fh_socket == INVALID_SOCKET) {
-        const DWORD err = WSAGetLastError();
-        LOG(ERROR) << "adb_socket_accept: accept on fd " << serverfd.get()
-                   << " failed: " + android::base::SystemErrorCodeToString(err);
-        _socket_set_errno(err);
-        return -1;
-    }
-
-    const int fd = _fh_to_int(fh.get());
-    snprintf(fh->name, sizeof(fh->name), "%d(accept:%s)", fd, serverfh->name);
-    D("adb_socket_accept on fd %d returns fd %d", serverfd.get(), fd);
-    fh.release();
-    return fd;
-}
-
-int adb_setsockopt(borrowed_fd fd, int level, int optname, const void* optval, socklen_t optlen) {
-    FH fh = _fh_from_int(fd, __func__);
-
-    if (!fh || fh->clazz != &_fh_socket_class) {
-        D("adb_setsockopt: invalid fd %d", fd.get());
-        errno = EBADF;
-        return -1;
-    }
-
-    // TODO: Once we can assume Windows Vista or later, if the caller is trying
-    // to set SOL_SOCKET, SO_SNDBUF/SO_RCVBUF, ignore it since the OS has
-    // auto-tuning.
-
-    int result =
-        setsockopt(fh->fh_socket, level, optname, reinterpret_cast<const char*>(optval), optlen);
-    if (result == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        D("adb_setsockopt: setsockopt on fd %d level %d optname %d failed: %s\n", fd.get(), level,
-          optname, android::base::SystemErrorCodeToString(err).c_str());
-        _socket_set_errno(err);
-        result = -1;
-    }
-    return result;
-}
-
-static int adb_getsockname(borrowed_fd fd, struct sockaddr* sockaddr, socklen_t* optlen) {
-    FH fh = _fh_from_int(fd, __func__);
-
-    if (!fh || fh->clazz != &_fh_socket_class) {
-        D("adb_getsockname: invalid fd %d", fd.get());
-        errno = EBADF;
-        return -1;
-    }
-
-    int result = getsockname(fh->fh_socket, sockaddr, optlen);
-    if (result == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        D("adb_getsockname: setsockopt on fd %d failed: %s\n", fd.get(),
-          android::base::SystemErrorCodeToString(err).c_str());
-        _socket_set_errno(err);
-        result = -1;
-    }
-    return result;
-}
-
-int adb_socket_get_local_port(borrowed_fd fd) {
-    sockaddr_storage addr_storage;
-    socklen_t addr_len = sizeof(addr_storage);
-
-    if (adb_getsockname(fd, reinterpret_cast<sockaddr*>(&addr_storage), &addr_len) < 0) {
-        D("adb_socket_get_local_port: adb_getsockname failed: %s", strerror(errno));
-        return -1;
-    }
-
-    if (!(addr_storage.ss_family == AF_INET || addr_storage.ss_family == AF_INET6)) {
-        D("adb_socket_get_local_port: unknown address family received: %d", addr_storage.ss_family);
-        errno = ECONNABORTED;
-        return -1;
-    }
-
-    return ntohs(reinterpret_cast<sockaddr_in*>(&addr_storage)->sin_port);
-}
-
-int adb_shutdown(borrowed_fd fd, int direction) {
-    FH f = _fh_from_int(fd, __func__);
-
-    if (!f || f->clazz != &_fh_socket_class) {
-        D("adb_shutdown: invalid fd %d", fd.get());
-        errno = EBADF;
-        return -1;
-    }
-
-    D("adb_shutdown: %s", f->name);
-    if (shutdown(f->fh_socket, direction) == SOCKET_ERROR) {
-        const DWORD err = WSAGetLastError();
-        D("socket shutdown fd %d failed: %s", fd.get(),
-          android::base::SystemErrorCodeToString(err).c_str());
-        _socket_set_errno(err);
-        return -1;
-    }
-    return 0;
-}
-
-// Emulate socketpair(2) by binding and connecting to a socket.
-int adb_socketpair(int sv[2]) {
-    int server = -1;
-    int client = -1;
-    int accepted = -1;
-    int local_port = -1;
-    std::string error;
-
-    server = network_loopback_server(0, SOCK_STREAM, &error, true);
-    if (server < 0) {
-        D("adb_socketpair: failed to create server: %s", error.c_str());
-        goto fail;
-    }
-
-    local_port = adb_socket_get_local_port(server);
-    if (local_port < 0) {
-        D("adb_socketpair: failed to get server port number: %s", error.c_str());
-        goto fail;
-    }
-    D("adb_socketpair: bound on port %d", local_port);
-
-    client = network_loopback_client(local_port, SOCK_STREAM, &error);
-    if (client < 0) {
-        D("adb_socketpair: failed to connect client: %s", error.c_str());
-        goto fail;
-    }
-
-    accepted = adb_socket_accept(server, nullptr, nullptr);
-    if (accepted < 0) {
-        D("adb_socketpair: failed to accept: %s", strerror(errno));
-        goto fail;
-    }
-    adb_close(server);
-    sv[0] = client;
-    sv[1] = accepted;
-    return 0;
-
-fail:
-    if (server >= 0) {
-        adb_close(server);
-    }
-    if (client >= 0) {
-        adb_close(client);
-    }
-    if (accepted >= 0) {
-        adb_close(accepted);
-    }
-    return -1;
-}
-
-bool set_file_block_mode(borrowed_fd fd, bool block) {
-    FH fh = _fh_from_int(fd, __func__);
-
-    if (!fh || !fh->used) {
-        errno = EBADF;
-        D("Setting nonblocking on bad file descriptor %d", fd.get());
-        return false;
-    }
-
-    if (fh->clazz == &_fh_socket_class) {
-        u_long x = !block;
-        if (ioctlsocket(fh->u.socket, FIONBIO, &x) != 0) {
-            int error = WSAGetLastError();
-            _socket_set_errno(error);
-            D("Setting %d nonblocking failed (%d)", fd.get(), error);
-            return false;
-        }
-        return true;
-    } else {
-        errno = ENOTSOCK;
-        D("Setting nonblocking on non-socket %d", fd.get());
-        return false;
-    }
-}
-
-bool set_tcp_keepalive(borrowed_fd fd, int interval_sec) {
-    FH fh = _fh_from_int(fd, __func__);
-
-    if (!fh || fh->clazz != &_fh_socket_class) {
-        D("set_tcp_keepalive(%d) failed: invalid fd", fd.get());
-        errno = EBADF;
-        return false;
-    }
-
-    tcp_keepalive keepalive;
-    keepalive.onoff = (interval_sec > 0);
-    keepalive.keepalivetime = interval_sec * 1000;
-    keepalive.keepaliveinterval = interval_sec * 1000;
-
-    DWORD bytes_returned = 0;
-    if (WSAIoctl(fh->fh_socket, SIO_KEEPALIVE_VALS, &keepalive, sizeof(keepalive), nullptr, 0,
-                 &bytes_returned, nullptr, nullptr) != 0) {
-        const DWORD err = WSAGetLastError();
-        D("set_tcp_keepalive(%d) failed: %s", fd.get(),
-          android::base::SystemErrorCodeToString(err).c_str());
-        _socket_set_errno(err);
-        return false;
-    }
-
-    return true;
-}
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****      Console Window Terminal Emulation                         *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-// This reads input from a Win32 console window and translates it into Unix
-// terminal-style sequences. This emulates mostly Gnome Terminal (in Normal
-// mode, not Application mode), which itself emulates xterm. Gnome Terminal
-// is emulated instead of xterm because it is probably more popular than xterm:
-// Ubuntu's default Ctrl-Alt-T shortcut opens Gnome Terminal, Gnome Terminal
-// supports modern fonts, etc. It seems best to emulate the terminal that most
-// Android developers use because they'll fix apps (the shell, etc.) to keep
-// working with that terminal's emulation.
-//
-// The point of this emulation is not to be perfect or to solve all issues with
-// console windows on Windows, but to be better than the original code which
-// just called read() (which called ReadFile(), which called ReadConsoleA())
-// which did not support Ctrl-C, tab completion, shell input line editing
-// keys, server echo, and more.
-//
-// This implementation reconfigures the console with SetConsoleMode(), then
-// calls ReadConsoleInput() to get raw input which it remaps to Unix
-// terminal-style sequences which is returned via unix_read() which is used
-// by the 'adb shell' command.
-//
-// Code organization:
-//
-// * _get_console_handle() and unix_isatty() provide console information.
-// * stdin_raw_init() and stdin_raw_restore() reconfigure the console.
-// * unix_read() detects console windows (as opposed to pipes, files, etc.).
-// * _console_read() is the main code of the emulation.
-
-// Returns a console HANDLE if |fd| is a console, otherwise returns nullptr.
-// If a valid HANDLE is returned and |mode| is not null, |mode| is also filled
-// with the console mode. Requires GENERIC_READ access to the underlying HANDLE.
-static HANDLE _get_console_handle(borrowed_fd fd, DWORD* mode = nullptr) {
-    // First check isatty(); this is very fast and eliminates most non-console
-    // FDs, but returns 1 for both consoles and character devices like NUL.
-#pragma push_macro("isatty")
-#undef isatty
-    if (!isatty(fd.get())) {
-        return nullptr;
-    }
-#pragma pop_macro("isatty")
-
-    // To differentiate between character devices and consoles we need to get
-    // the underlying HANDLE and use GetConsoleMode(), which is what requires
-    // GENERIC_READ permissions.
-    const intptr_t intptr_handle = _get_osfhandle(fd.get());
-    if (intptr_handle == -1) {
-        return nullptr;
-    }
-    const HANDLE handle = reinterpret_cast<const HANDLE>(intptr_handle);
-    DWORD temp_mode = 0;
-    if (!GetConsoleMode(handle, mode ? mode : &temp_mode)) {
-        return nullptr;
-    }
-
-    return handle;
-}
-
-// Returns a console handle if |stream| is a console, otherwise returns nullptr.
-static HANDLE _get_console_handle(FILE* const stream) {
-    // Save and restore errno to make it easier for callers to prevent from overwriting errno.
-    android::base::ErrnoRestorer er;
-    const int fd = fileno(stream);
-    if (fd < 0) {
-        return nullptr;
-    }
-    return _get_console_handle(fd);
-}
-
-int unix_isatty(borrowed_fd fd) {
-    return _get_console_handle(fd) ? 1 : 0;
-}
-
-// Get the next KEY_EVENT_RECORD that should be processed.
-static bool _get_key_event_record(const HANDLE console, INPUT_RECORD* const input_record) {
-    for (;;) {
-        DWORD read_count = 0;
-        memset(input_record, 0, sizeof(*input_record));
-        if (!ReadConsoleInputA(console, input_record, 1, &read_count)) {
-            D("_get_key_event_record: ReadConsoleInputA() failed: %s\n",
-              android::base::SystemErrorCodeToString(GetLastError()).c_str());
-            errno = EIO;
-            return false;
-        }
-
-        if (read_count == 0) {   // should be impossible
-            LOG(FATAL) << "ReadConsoleInputA returned 0";
-        }
-
-        if (read_count != 1) {   // should be impossible
-            LOG(FATAL) << "ReadConsoleInputA did not return one input record";
-        }
-
-        // If the console window is resized, emulate SIGWINCH by breaking out
-        // of read() with errno == EINTR. Note that there is no event on
-        // vertical resize because we don't give the console our own custom
-        // screen buffer (with CreateConsoleScreenBuffer() +
-        // SetConsoleActiveScreenBuffer()). Instead, we use the default which
-        // supports scrollback, but doesn't seem to raise an event for vertical
-        // window resize.
-        if (input_record->EventType == WINDOW_BUFFER_SIZE_EVENT) {
-            errno = EINTR;
-            return false;
-        }
-
-        if ((input_record->EventType == KEY_EVENT) &&
-            (input_record->Event.KeyEvent.bKeyDown)) {
-            if (input_record->Event.KeyEvent.wRepeatCount == 0) {
-                LOG(FATAL) << "ReadConsoleInputA returned a key event with zero repeat count";
-            }
-
-            // Got an interesting INPUT_RECORD, so return
-            return true;
-        }
-    }
-}
-
-static __inline__ bool _is_shift_pressed(const DWORD control_key_state) {
-    return (control_key_state & SHIFT_PRESSED) != 0;
-}
-
-static __inline__ bool _is_ctrl_pressed(const DWORD control_key_state) {
-    return (control_key_state & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) != 0;
-}
-
-static __inline__ bool _is_alt_pressed(const DWORD control_key_state) {
-    return (control_key_state & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) != 0;
-}
-
-static __inline__ bool _is_numlock_on(const DWORD control_key_state) {
-    return (control_key_state & NUMLOCK_ON) != 0;
-}
-
-static __inline__ bool _is_capslock_on(const DWORD control_key_state) {
-    return (control_key_state & CAPSLOCK_ON) != 0;
-}
-
-static __inline__ bool _is_enhanced_key(const DWORD control_key_state) {
-    return (control_key_state & ENHANCED_KEY) != 0;
-}
-
-// Constants from MSDN for ToAscii().
-static const BYTE TOASCII_KEY_OFF = 0x00;
-static const BYTE TOASCII_KEY_DOWN = 0x80;
-static const BYTE TOASCII_KEY_TOGGLED_ON = 0x01;   // for CapsLock
-
-// Given a key event, ignore a modifier key and return the character that was
-// entered without the modifier. Writes to *ch and returns the number of bytes
-// written.
-static size_t _get_char_ignoring_modifier(char* const ch,
-    const KEY_EVENT_RECORD* const key_event, const DWORD control_key_state,
-    const WORD modifier) {
-    // If there is no character from Windows, try ignoring the specified
-    // modifier and look for a character. Note that if AltGr is being used,
-    // there will be a character from Windows.
-    if (key_event->uChar.AsciiChar == '\0') {
-        // Note that we read the control key state from the passed in argument
-        // instead of from key_event since the argument has been normalized.
-        if (((modifier == VK_SHIFT)   &&
-            _is_shift_pressed(control_key_state)) ||
-            ((modifier == VK_CONTROL) &&
-            _is_ctrl_pressed(control_key_state)) ||
-            ((modifier == VK_MENU)    && _is_alt_pressed(control_key_state))) {
-
-            BYTE key_state[256]   = {0};
-            key_state[VK_SHIFT]   = _is_shift_pressed(control_key_state) ?
-                TOASCII_KEY_DOWN : TOASCII_KEY_OFF;
-            key_state[VK_CONTROL] = _is_ctrl_pressed(control_key_state)  ?
-                TOASCII_KEY_DOWN : TOASCII_KEY_OFF;
-            key_state[VK_MENU]    = _is_alt_pressed(control_key_state)   ?
-                TOASCII_KEY_DOWN : TOASCII_KEY_OFF;
-            key_state[VK_CAPITAL] = _is_capslock_on(control_key_state)   ?
-                TOASCII_KEY_TOGGLED_ON : TOASCII_KEY_OFF;
-
-            // cause this modifier to be ignored
-            key_state[modifier]   = TOASCII_KEY_OFF;
-
-            WORD translated = 0;
-            if (ToAscii(key_event->wVirtualKeyCode,
-                key_event->wVirtualScanCode, key_state, &translated, 0) == 1) {
-                // Ignoring the modifier, we found a character.
-                *ch = (CHAR)translated;
-                return 1;
-            }
-        }
-    }
-
-    // Just use whatever Windows told us originally.
-    *ch = key_event->uChar.AsciiChar;
-
-    // If the character from Windows is NULL, return a size of zero.
-    return (*ch == '\0') ? 0 : 1;
-}
-
-// If a Ctrl key is pressed, lookup the character, ignoring the Ctrl key,
-// but taking into account the shift key. This is because for a sequence like
-// Ctrl-Alt-0, we want to find the character '0' and for Ctrl-Alt-Shift-0,
-// we want to find the character ')'.
-//
-// Note that Windows doesn't seem to pass bKeyDown for Ctrl-Shift-NoAlt-0
-// because it is the default key-sequence to switch the input language.
-// This is configurable in the Region and Language control panel.
-static __inline__ size_t _get_non_control_char(char* const ch,
-    const KEY_EVENT_RECORD* const key_event, const DWORD control_key_state) {
-    return _get_char_ignoring_modifier(ch, key_event, control_key_state,
-        VK_CONTROL);
-}
-
-// Get without Alt.
-static __inline__ size_t _get_non_alt_char(char* const ch,
-    const KEY_EVENT_RECORD* const key_event, const DWORD control_key_state) {
-    return _get_char_ignoring_modifier(ch, key_event, control_key_state,
-        VK_MENU);
-}
-
-// Ignore the control key, find the character from Windows, and apply any
-// Control key mappings (for example, Ctrl-2 is a NULL character). Writes to
-// *pch and returns number of bytes written.
-static size_t _get_control_character(char* const pch,
-    const KEY_EVENT_RECORD* const key_event, const DWORD control_key_state) {
-    const size_t len = _get_non_control_char(pch, key_event,
-        control_key_state);
-
-    if ((len == 1) && _is_ctrl_pressed(control_key_state)) {
-        char ch = *pch;
-        switch (ch) {
-        case '2':
-        case '@':
-        case '`':
-            ch = '\0';
-            break;
-        case '3':
-        case '[':
-        case '{':
-            ch = '\x1b';
-            break;
-        case '4':
-        case '\\':
-        case '|':
-            ch = '\x1c';
-            break;
-        case '5':
-        case ']':
-        case '}':
-            ch = '\x1d';
-            break;
-        case '6':
-        case '^':
-        case '~':
-            ch = '\x1e';
-            break;
-        case '7':
-        case '-':
-        case '_':
-            ch = '\x1f';
-            break;
-        case '8':
-            ch = '\x7f';
-            break;
-        case '/':
-            if (!_is_alt_pressed(control_key_state)) {
-                ch = '\x1f';
-            }
-            break;
-        case '?':
-            if (!_is_alt_pressed(control_key_state)) {
-                ch = '\x7f';
-            }
-            break;
-        }
-        *pch = ch;
-    }
-
-    return len;
-}
-
-static DWORD _normalize_altgr_control_key_state(
-    const KEY_EVENT_RECORD* const key_event) {
-    DWORD control_key_state = key_event->dwControlKeyState;
-
-    // If we're in an AltGr situation where the AltGr key is down (depending on
-    // the keyboard layout, that might be the physical right alt key which
-    // produces a control_key_state where Right-Alt and Left-Ctrl are down) or
-    // AltGr-equivalent keys are down (any Ctrl key + any Alt key), and we have
-    // a character (which indicates that there was an AltGr mapping), then act
-    // as if alt and control are not really down for the purposes of modifiers.
-    // This makes it so that if the user with, say, a German keyboard layout
-    // presses AltGr-] (which we see as Right-Alt + Left-Ctrl + key), we just
-    // output the key and we don't see the Alt and Ctrl keys.
-    if (_is_ctrl_pressed(control_key_state) &&
-        _is_alt_pressed(control_key_state)
-        && (key_event->uChar.AsciiChar != '\0')) {
-        // Try to remove as few bits as possible to improve our chances of
-        // detecting combinations like Left-Alt + AltGr, Right-Ctrl + AltGr, or
-        // Left-Alt + Right-Ctrl + AltGr.
-        if ((control_key_state & RIGHT_ALT_PRESSED) != 0) {
-            // Remove Right-Alt.
-            control_key_state &= ~RIGHT_ALT_PRESSED;
-            // If uChar is set, a Ctrl key is pressed, and Right-Alt is
-            // pressed, Left-Ctrl is almost always set, except if the user
-            // presses Right-Ctrl, then AltGr (in that specific order) for
-            // whatever reason. At any rate, make sure the bit is not set.
-            control_key_state &= ~LEFT_CTRL_PRESSED;
-        } else if ((control_key_state & LEFT_ALT_PRESSED) != 0) {
-            // Remove Left-Alt.
-            control_key_state &= ~LEFT_ALT_PRESSED;
-            // Whichever Ctrl key is down, remove it from the state. We only
-            // remove one key, to improve our chances of detecting the
-            // corner-case of Left-Ctrl + Left-Alt + Right-Ctrl.
-            if ((control_key_state & LEFT_CTRL_PRESSED) != 0) {
-                // Remove Left-Ctrl.
-                control_key_state &= ~LEFT_CTRL_PRESSED;
-            } else if ((control_key_state & RIGHT_CTRL_PRESSED) != 0) {
-                // Remove Right-Ctrl.
-                control_key_state &= ~RIGHT_CTRL_PRESSED;
-            }
-        }
-
-        // Note that this logic isn't 100% perfect because Windows doesn't
-        // allow us to detect all combinations because a physical AltGr key
-        // press shows up as two bits, plus some combinations are ambiguous
-        // about what is actually physically pressed.
-    }
-
-    return control_key_state;
-}
-
-// If NumLock is on and Shift is pressed, SHIFT_PRESSED is not set in
-// dwControlKeyState for the following keypad keys: period, 0-9. If we detect
-// this scenario, set the SHIFT_PRESSED bit so we can add modifiers
-// appropriately.
-static DWORD _normalize_keypad_control_key_state(const WORD vk,
-    const DWORD control_key_state) {
-    if (!_is_numlock_on(control_key_state)) {
-        return control_key_state;
-    }
-    if (!_is_enhanced_key(control_key_state)) {
-        switch (vk) {
-            case VK_INSERT: // 0
-            case VK_DELETE: // .
-            case VK_END:    // 1
-            case VK_DOWN:   // 2
-            case VK_NEXT:   // 3
-            case VK_LEFT:   // 4
-            case VK_CLEAR:  // 5
-            case VK_RIGHT:  // 6
-            case VK_HOME:   // 7
-            case VK_UP:     // 8
-            case VK_PRIOR:  // 9
-                return control_key_state | SHIFT_PRESSED;
-        }
-    }
-
-    return control_key_state;
-}
-
-static const char* _get_keypad_sequence(const DWORD control_key_state,
-    const char* const normal, const char* const shifted) {
-    if (_is_shift_pressed(control_key_state)) {
-        // Shift is pressed and NumLock is off
-        return shifted;
-    } else {
-        // Shift is not pressed and NumLock is off, or,
-        // Shift is pressed and NumLock is on, in which case we want the
-        // NumLock and Shift to neutralize each other, thus, we want the normal
-        // sequence.
-        return normal;
-    }
-    // If Shift is not pressed and NumLock is on, a different virtual key code
-    // is returned by Windows, which can be taken care of by a different case
-    // statement in _console_read().
-}
-
-// Write sequence to buf and return the number of bytes written.
-static size_t _get_modifier_sequence(char* const buf, const WORD vk,
-    DWORD control_key_state, const char* const normal) {
-    // Copy the base sequence into buf.
-    const size_t len = strlen(normal);
-    memcpy(buf, normal, len);
-
-    int code = 0;
-
-    control_key_state = _normalize_keypad_control_key_state(vk,
-        control_key_state);
-
-    if (_is_shift_pressed(control_key_state)) {
-        code |= 0x1;
-    }
-    if (_is_alt_pressed(control_key_state)) {   // any alt key pressed
-        code |= 0x2;
-    }
-    if (_is_ctrl_pressed(control_key_state)) {  // any control key pressed
-        code |= 0x4;
-    }
-    // If some modifier was held down, then we need to insert the modifier code
-    if (code != 0) {
-        if (len == 0) {
-            // Should be impossible because caller should pass a string of
-            // non-zero length.
-            return 0;
-        }
-        size_t index = len - 1;
-        const char lastChar = buf[index];
-        if (lastChar != '~') {
-            buf[index++] = '1';
-        }
-        buf[index++] = ';';         // modifier separator
-        // 2 = shift, 3 = alt, 4 = shift & alt, 5 = control,
-        // 6 = shift & control, 7 = alt & control, 8 = shift & alt & control
-        buf[index++] = '1' + code;
-        buf[index++] = lastChar;    // move ~ (or other last char) to the end
-        return index;
-    }
-    return len;
-}
-
-// Write sequence to buf and return the number of bytes written.
-static size_t _get_modifier_keypad_sequence(char* const buf, const WORD vk,
-    const DWORD control_key_state, const char* const normal,
-    const char shifted) {
-    if (_is_shift_pressed(control_key_state)) {
-        // Shift is pressed and NumLock is off
-        if (shifted != '\0') {
-            buf[0] = shifted;
-            return sizeof(buf[0]);
-        } else {
-            return 0;
-        }
-    } else {
-        // Shift is not pressed and NumLock is off, or,
-        // Shift is pressed and NumLock is on, in which case we want the
-        // NumLock and Shift to neutralize each other, thus, we want the normal
-        // sequence.
-        return _get_modifier_sequence(buf, vk, control_key_state, normal);
-    }
-    // If Shift is not pressed and NumLock is on, a different virtual key code
-    // is returned by Windows, which can be taken care of by a different case
-    // statement in _console_read().
-}
-
-// The decimal key on the keypad produces a '.' for U.S. English and a ',' for
-// Standard German. Figure this out at runtime so we know what to output for
-// Shift-VK_DELETE.
-static char _get_decimal_char() {
-    return (char)MapVirtualKeyA(VK_DECIMAL, MAPVK_VK_TO_CHAR);
-}
-
-// Prefix the len bytes in buf with the escape character, and then return the
-// new buffer length.
-static size_t _escape_prefix(char* const buf, const size_t len) {
-    // If nothing to prefix, don't do anything. We might be called with
-    // len == 0, if alt was held down with a dead key which produced nothing.
-    if (len == 0) {
-        return 0;
-    }
-
-    memmove(&buf[1], buf, len);
-    buf[0] = '\x1b';
-    return len + 1;
-}
-
-// Internal buffer to satisfy future _console_read() calls.
-static auto& g_console_input_buffer = *new std::vector<char>();
-
-// Writes to buffer buf (of length len), returning number of bytes written or -1 on error. Never
-// returns zero on console closure because Win32 consoles are never 'closed' (as far as I can tell).
-static int _console_read(const HANDLE console, void* buf, size_t len) {
-    for (;;) {
-        // Read of zero bytes should not block waiting for something from the console.
-        if (len == 0) {
-            return 0;
-        }
-
-        // Flush as much as possible from input buffer.
-        if (!g_console_input_buffer.empty()) {
-            const int bytes_read = std::min(len, g_console_input_buffer.size());
-            memcpy(buf, g_console_input_buffer.data(), bytes_read);
-            const auto begin = g_console_input_buffer.begin();
-            g_console_input_buffer.erase(begin, begin + bytes_read);
-            return bytes_read;
-        }
-
-        // Read from the actual console. This may block until input.
-        INPUT_RECORD input_record;
-        if (!_get_key_event_record(console, &input_record)) {
-            return -1;
-        }
-
-        KEY_EVENT_RECORD* const key_event = &input_record.Event.KeyEvent;
-        const WORD vk = key_event->wVirtualKeyCode;
-        const CHAR ch = key_event->uChar.AsciiChar;
-        const DWORD control_key_state = _normalize_altgr_control_key_state(
-            key_event);
-
-        // The following emulation code should write the output sequence to
-        // either seqstr or to seqbuf and seqbuflen.
-        const char* seqstr = nullptr;  // NULL terminated C-string
-        // Enough space for max sequence string below, plus modifiers and/or
-        // escape prefix.
-        char seqbuf[16];
-        size_t seqbuflen = 0;       // Space used in seqbuf.
-
-#define MATCH(vk, normal) \
-            case (vk): \
-            { \
-                seqstr = (normal); \
-            } \
-            break;
-
-        // Modifier keys should affect the output sequence.
-#define MATCH_MODIFIER(vk, normal) \
-            case (vk): \
-            { \
-                seqbuflen = _get_modifier_sequence(seqbuf, (vk), \
-                    control_key_state, (normal)); \
-            } \
-            break;
-
-        // The shift key should affect the output sequence.
-#define MATCH_KEYPAD(vk, normal, shifted) \
-            case (vk): \
-            { \
-                seqstr = _get_keypad_sequence(control_key_state, (normal), \
-                    (shifted)); \
-            } \
-            break;
-
-        // The shift key and other modifier keys should affect the output
-        // sequence.
-#define MATCH_MODIFIER_KEYPAD(vk, normal, shifted) \
-            case (vk): \
-            { \
-                seqbuflen = _get_modifier_keypad_sequence(seqbuf, (vk), \
-                    control_key_state, (normal), (shifted)); \
-            } \
-            break;
-
-#define ESC "\x1b"
-#define CSI ESC "["
-#define SS3 ESC "O"
-
-        // Only support normal mode, not application mode.
-
-        // Enhanced keys:
-        // * 6-pack: insert, delete, home, end, page up, page down
-        // * cursor keys: up, down, right, left
-        // * keypad: divide, enter
-        // * Undocumented: VK_PAUSE (Ctrl-NumLock), VK_SNAPSHOT,
-        //   VK_CANCEL (Ctrl-Pause/Break), VK_NUMLOCK
-        if (_is_enhanced_key(control_key_state)) {
-            switch (vk) {
-                case VK_RETURN: // Enter key on keypad
-                    if (_is_ctrl_pressed(control_key_state)) {
-                        seqstr = "\n";
-                    } else {
-                        seqstr = "\r";
-                    }
-                    break;
-
-                MATCH_MODIFIER(VK_PRIOR, CSI "5~"); // Page Up
-                MATCH_MODIFIER(VK_NEXT,  CSI "6~"); // Page Down
-
-                // gnome-terminal currently sends SS3 "F" and SS3 "H", but that
-                // will be fixed soon to match xterm which sends CSI "F" and
-                // CSI "H". https://bugzilla.redhat.com/show_bug.cgi?id=1119764
-                MATCH(VK_END,  CSI "F");
-                MATCH(VK_HOME, CSI "H");
-
-                MATCH_MODIFIER(VK_LEFT,  CSI "D");
-                MATCH_MODIFIER(VK_UP,    CSI "A");
-                MATCH_MODIFIER(VK_RIGHT, CSI "C");
-                MATCH_MODIFIER(VK_DOWN,  CSI "B");
-
-                MATCH_MODIFIER(VK_INSERT, CSI "2~");
-                MATCH_MODIFIER(VK_DELETE, CSI "3~");
-
-                MATCH(VK_DIVIDE, "/");
-            }
-        } else {    // Non-enhanced keys:
-            switch (vk) {
-                case VK_BACK:   // backspace
-                    if (_is_alt_pressed(control_key_state)) {
-                        seqstr = ESC "\x7f";
-                    } else {
-                        seqstr = "\x7f";
-                    }
-                    break;
-
-                case VK_TAB:
-                    if (_is_shift_pressed(control_key_state)) {
-                        seqstr = CSI "Z";
-                    } else {
-                        seqstr = "\t";
-                    }
-                    break;
-
-                // Number 5 key in keypad when NumLock is off, or if NumLock is
-                // on and Shift is down.
-                MATCH_KEYPAD(VK_CLEAR, CSI "E", "5");
-
-                case VK_RETURN:     // Enter key on main keyboard
-                    if (_is_alt_pressed(control_key_state)) {
-                        seqstr = ESC "\n";
-                    } else if (_is_ctrl_pressed(control_key_state)) {
-                        seqstr = "\n";
-                    } else {
-                        seqstr = "\r";
-                    }
-                    break;
-
-                // VK_ESCAPE: Don't do any special handling. The OS uses many
-                // of the sequences with Escape and many of the remaining
-                // sequences don't produce bKeyDown messages, only !bKeyDown
-                // for whatever reason.
-
-                case VK_SPACE:
-                    if (_is_alt_pressed(control_key_state)) {
-                        seqstr = ESC " ";
-                    } else if (_is_ctrl_pressed(control_key_state)) {
-                        seqbuf[0] = '\0';   // NULL char
-                        seqbuflen = 1;
-                    } else {
-                        seqstr = " ";
-                    }
-                    break;
-
-                MATCH_MODIFIER_KEYPAD(VK_PRIOR, CSI "5~", '9'); // Page Up
-                MATCH_MODIFIER_KEYPAD(VK_NEXT,  CSI "6~", '3'); // Page Down
-
-                MATCH_KEYPAD(VK_END,  CSI "4~", "1");
-                MATCH_KEYPAD(VK_HOME, CSI "1~", "7");
-
-                MATCH_MODIFIER_KEYPAD(VK_LEFT,  CSI "D", '4');
-                MATCH_MODIFIER_KEYPAD(VK_UP,    CSI "A", '8');
-                MATCH_MODIFIER_KEYPAD(VK_RIGHT, CSI "C", '6');
-                MATCH_MODIFIER_KEYPAD(VK_DOWN,  CSI "B", '2');
-
-                MATCH_MODIFIER_KEYPAD(VK_INSERT, CSI "2~", '0');
-                MATCH_MODIFIER_KEYPAD(VK_DELETE, CSI "3~",
-                    _get_decimal_char());
-
-                case 0x30:          // 0
-                case 0x31:          // 1
-                case 0x39:          // 9
-                case VK_OEM_1:      // ;:
-                case VK_OEM_PLUS:   // =+
-                case VK_OEM_COMMA:  // ,<
-                case VK_OEM_PERIOD: // .>
-                case VK_OEM_7:      // '"
-                case VK_OEM_102:    // depends on keyboard, could be <> or \|
-                case VK_OEM_2:      // /?
-                case VK_OEM_3:      // `~
-                case VK_OEM_4:      // [{
-                case VK_OEM_5:      // \|
-                case VK_OEM_6:      // ]}
-                {
-                    seqbuflen = _get_control_character(seqbuf, key_event,
-                        control_key_state);
-
-                    if (_is_alt_pressed(control_key_state)) {
-                        seqbuflen = _escape_prefix(seqbuf, seqbuflen);
-                    }
-                }
-                break;
-
-                case 0x32:          // 2
-                case 0x33:          // 3
-                case 0x34:          // 4
-                case 0x35:          // 5
-                case 0x36:          // 6
-                case 0x37:          // 7
-                case 0x38:          // 8
-                case VK_OEM_MINUS:  // -_
-                {
-                    seqbuflen = _get_control_character(seqbuf, key_event,
-                        control_key_state);
-
-                    // If Alt is pressed and it isn't Ctrl-Alt-ShiftUp, then
-                    // prefix with escape.
-                    if (_is_alt_pressed(control_key_state) &&
-                        !(_is_ctrl_pressed(control_key_state) &&
-                        !_is_shift_pressed(control_key_state))) {
-                        seqbuflen = _escape_prefix(seqbuf, seqbuflen);
-                    }
-                }
-                break;
-
-                case 0x41:  // a
-                case 0x42:  // b
-                case 0x43:  // c
-                case 0x44:  // d
-                case 0x45:  // e
-                case 0x46:  // f
-                case 0x47:  // g
-                case 0x48:  // h
-                case 0x49:  // i
-                case 0x4a:  // j
-                case 0x4b:  // k
-                case 0x4c:  // l
-                case 0x4d:  // m
-                case 0x4e:  // n
-                case 0x4f:  // o
-                case 0x50:  // p
-                case 0x51:  // q
-                case 0x52:  // r
-                case 0x53:  // s
-                case 0x54:  // t
-                case 0x55:  // u
-                case 0x56:  // v
-                case 0x57:  // w
-                case 0x58:  // x
-                case 0x59:  // y
-                case 0x5a:  // z
-                {
-                    seqbuflen = _get_non_alt_char(seqbuf, key_event,
-                        control_key_state);
-
-                    // If Alt is pressed, then prefix with escape.
-                    if (_is_alt_pressed(control_key_state)) {
-                        seqbuflen = _escape_prefix(seqbuf, seqbuflen);
-                    }
-                }
-                break;
-
-                // These virtual key codes are generated by the keys on the
-                // keypad *when NumLock is on* and *Shift is up*.
-                MATCH(VK_NUMPAD0, "0");
-                MATCH(VK_NUMPAD1, "1");
-                MATCH(VK_NUMPAD2, "2");
-                MATCH(VK_NUMPAD3, "3");
-                MATCH(VK_NUMPAD4, "4");
-                MATCH(VK_NUMPAD5, "5");
-                MATCH(VK_NUMPAD6, "6");
-                MATCH(VK_NUMPAD7, "7");
-                MATCH(VK_NUMPAD8, "8");
-                MATCH(VK_NUMPAD9, "9");
-
-                MATCH(VK_MULTIPLY, "*");
-                MATCH(VK_ADD,      "+");
-                MATCH(VK_SUBTRACT, "-");
-                // VK_DECIMAL is generated by the . key on the keypad *when
-                // NumLock is on* and *Shift is up* and the sequence is not
-                // Ctrl-Alt-NoShift-. (which causes Ctrl-Alt-Del and the
-                // Windows Security screen to come up).
-                case VK_DECIMAL:
-                    // U.S. English uses '.', Germany German uses ','.
-                    seqbuflen = _get_non_control_char(seqbuf, key_event,
-                        control_key_state);
-                    break;
-
-                MATCH_MODIFIER(VK_F1,  SS3 "P");
-                MATCH_MODIFIER(VK_F2,  SS3 "Q");
-                MATCH_MODIFIER(VK_F3,  SS3 "R");
-                MATCH_MODIFIER(VK_F4,  SS3 "S");
-                MATCH_MODIFIER(VK_F5,  CSI "15~");
-                MATCH_MODIFIER(VK_F6,  CSI "17~");
-                MATCH_MODIFIER(VK_F7,  CSI "18~");
-                MATCH_MODIFIER(VK_F8,  CSI "19~");
-                MATCH_MODIFIER(VK_F9,  CSI "20~");
-                MATCH_MODIFIER(VK_F10, CSI "21~");
-                MATCH_MODIFIER(VK_F11, CSI "23~");
-                MATCH_MODIFIER(VK_F12, CSI "24~");
-
-                MATCH_MODIFIER(VK_F13, CSI "25~");
-                MATCH_MODIFIER(VK_F14, CSI "26~");
-                MATCH_MODIFIER(VK_F15, CSI "28~");
-                MATCH_MODIFIER(VK_F16, CSI "29~");
-                MATCH_MODIFIER(VK_F17, CSI "31~");
-                MATCH_MODIFIER(VK_F18, CSI "32~");
-                MATCH_MODIFIER(VK_F19, CSI "33~");
-                MATCH_MODIFIER(VK_F20, CSI "34~");
-
-                // MATCH_MODIFIER(VK_F21, ???);
-                // MATCH_MODIFIER(VK_F22, ???);
-                // MATCH_MODIFIER(VK_F23, ???);
-                // MATCH_MODIFIER(VK_F24, ???);
-            }
-        }
-
-#undef MATCH
-#undef MATCH_MODIFIER
-#undef MATCH_KEYPAD
-#undef MATCH_MODIFIER_KEYPAD
-#undef ESC
-#undef CSI
-#undef SS3
-
-        const char* out;
-        size_t outlen;
-
-        // Check for output in any of:
-        // * seqstr is set (and strlen can be used to determine the length).
-        // * seqbuf and seqbuflen are set
-        // Fallback to ch from Windows.
-        if (seqstr != nullptr) {
-            out = seqstr;
-            outlen = strlen(seqstr);
-        } else if (seqbuflen > 0) {
-            out = seqbuf;
-            outlen = seqbuflen;
-        } else if (ch != '\0') {
-            // Use whatever Windows told us it is.
-            seqbuf[0] = ch;
-            seqbuflen = 1;
-            out = seqbuf;
-            outlen = seqbuflen;
-        } else {
-            // No special handling for the virtual key code and Windows isn't
-            // telling us a character code, then we don't know how to translate
-            // the key press.
-            //
-            // Consume the input and 'continue' to cause us to get a new key
-            // event.
-            D("_console_read: unknown virtual key code: %d, enhanced: %s",
-                vk, _is_enhanced_key(control_key_state) ? "true" : "false");
-            continue;
-        }
-
-        // put output wRepeatCount times into g_console_input_buffer
-        while (key_event->wRepeatCount-- > 0) {
-            g_console_input_buffer.insert(g_console_input_buffer.end(), out, out + outlen);
-        }
-
-        // Loop around and try to flush g_console_input_buffer
-    }
-}
-
-static DWORD _old_console_mode; // previous GetConsoleMode() result
-static HANDLE _console_handle;  // when set, console mode should be restored
-
-void stdin_raw_init() {
-    const HANDLE in = _get_console_handle(STDIN_FILENO, &_old_console_mode);
-    if (in == nullptr) {
-        return;
-    }
-
-    // Disable ENABLE_PROCESSED_INPUT so that Ctrl-C is read instead of
-    // calling the process Ctrl-C routine (configured by
-    // SetConsoleCtrlHandler()).
-    // Disable ENABLE_LINE_INPUT so that input is immediately sent.
-    // Disable ENABLE_ECHO_INPUT to disable local echo. Disabling this
-    // flag also seems necessary to have proper line-ending processing.
-    DWORD new_console_mode = _old_console_mode & ~(ENABLE_PROCESSED_INPUT |
-                                                   ENABLE_LINE_INPUT |
-                                                   ENABLE_ECHO_INPUT);
-    // Enable ENABLE_WINDOW_INPUT to get window resizes.
-    new_console_mode |= ENABLE_WINDOW_INPUT;
-
-    if (!SetConsoleMode(in, new_console_mode)) {
-        // This really should not fail.
-        D("stdin_raw_init: SetConsoleMode() failed: %s",
-          android::base::SystemErrorCodeToString(GetLastError()).c_str());
-    }
-
-    // Once this is set, it means that stdin has been configured for
-    // reading from and that the old console mode should be restored later.
-    _console_handle = in;
-
-    // Note that we don't need to configure C Runtime line-ending
-    // translation because _console_read() does not call the C Runtime to
-    // read from the console.
-}
-
-void stdin_raw_restore() {
-    if (_console_handle != nullptr) {
-        const HANDLE in = _console_handle;
-        _console_handle = nullptr;  // clear state
-
-        if (!SetConsoleMode(in, _old_console_mode)) {
-            // This really should not fail.
-            D("stdin_raw_restore: SetConsoleMode() failed: %s",
-              android::base::SystemErrorCodeToString(GetLastError()).c_str());
-        }
-    }
-}
-
-// Called by 'adb shell' and 'adb exec-in' (via unix_read()) to read from stdin.
-int unix_read_interruptible(borrowed_fd fd, void* buf, size_t len) {
-    if ((fd == STDIN_FILENO) && (_console_handle != nullptr)) {
-        // If it is a request to read from stdin, and stdin_raw_init() has been
-        // called, and it successfully configured the console, then read from
-        // the console using Win32 console APIs and partially emulate a unix
-        // terminal.
-        return _console_read(_console_handle, buf, len);
-    } else {
-        // On older versions of Windows (definitely 7, definitely not 10),
-        // ReadConsole() with a size >= 31367 fails, so if |fd| is a console
-        // we need to limit the read size.
-        if (len > 4096 && unix_isatty(fd)) {
-            len = 4096;
-        }
-        // Just call into C Runtime which can read from pipes/files and which
-        // can do LF/CR translation (which is overridable with _setmode()).
-        // Undefine the macro that is set in sysdeps.h which bans calls to
-        // plain read() in favor of unix_read() or adb_read().
-#pragma push_macro("read")
-#undef read
-        return read(fd.get(), buf, len);
-#pragma pop_macro("read")
-    }
-}
-
-/**************************************************************************/
-/**************************************************************************/
-/*****                                                                *****/
-/*****      Unicode support                                           *****/
-/*****                                                                *****/
-/**************************************************************************/
-/**************************************************************************/
-
-// This implements support for using files with Unicode filenames and for
-// outputting Unicode text to a Win32 console window. This is inspired from
-// http://utf8everywhere.org/.
-//
-// Background
-// ----------
-//
-// On POSIX systems, to deal with files with Unicode filenames, just pass UTF-8
-// filenames to APIs such as open(). This works because filenames are largely
-// opaque 'cookies' (perhaps excluding path separators).
-//
-// On Windows, the native file APIs such as CreateFileW() take 2-byte wchar_t
-// UTF-16 strings. There is an API, CreateFileA() that takes 1-byte char
-// strings, but the strings are in the ANSI codepage and not UTF-8. (The
-// CreateFile() API is really just a macro that adds the W/A based on whether
-// the UNICODE preprocessor symbol is defined).
-//
-// Options
-// -------
-//
-// Thus, to write a portable program, there are a few options:
-//
-// 1. Write the program with wchar_t filenames (wchar_t path[256];).
-//    For Windows, just call CreateFileW(). For POSIX, write a wrapper openW()
-//    that takes a wchar_t string, converts it to UTF-8 and then calls the real
-//    open() API.
-//
-// 2. Write the program with a TCHAR typedef that is 2 bytes on Windows and
-//    1 byte on POSIX. Make T-* wrappers for various OS APIs and call those,
-//    potentially touching a lot of code.
-//
-// 3. Write the program with a 1-byte char filenames (char path[256];) that are
-//    UTF-8. For POSIX, just call open(). For Windows, write a wrapper that
-//    takes a UTF-8 string, converts it to UTF-16 and then calls the real OS
-//    or C Runtime API.
-//
-// The Choice
-// ----------
-//
-// The code below chooses option 3, the UTF-8 everywhere strategy. It uses
-// android::base::WideToUTF8() which converts UTF-16 to UTF-8. This is used by the
-// NarrowArgs helper class that is used to convert wmain() args into UTF-8
-// args that are passed to main() at the beginning of program startup. We also use
-// android::base::UTF8ToWide() which converts from UTF-8 to UTF-16. This is used to
-// implement wrappers below that call UTF-16 OS and C Runtime APIs.
-//
-// Unicode console output
-// ----------------------
-//
-// The way to output Unicode to a Win32 console window is to call
-// WriteConsoleW() with UTF-16 text. (The user must also choose a proper font
-// such as Lucida Console or Consolas, and in the case of East Asian languages
-// (such as Chinese, Japanese, Korean), the user must go to the Control Panel
-// and change the "system locale" to Chinese, etc., which allows a Chinese, etc.
-// font to be used in console windows.)
-//
-// The problem is getting the C Runtime to make fprintf and related APIs call
-// WriteConsoleW() under the covers. The C Runtime API, _setmode() sounds
-// promising, but the various modes have issues:
-//
-// 1. _setmode(_O_TEXT) (the default) does not use WriteConsoleW() so UTF-8 and
-//    UTF-16 do not display properly.
-// 2. _setmode(_O_BINARY) does not use WriteConsoleW() and the text comes out
-//    totally wrong.
-// 3. _setmode(_O_U8TEXT) seems to cause the C Runtime _invalid_parameter
-//    handler to be called (upon a later I/O call), aborting the process.
-// 4. _setmode(_O_U16TEXT) and _setmode(_O_WTEXT) cause non-wide printf/fprintf
-//    to output nothing.
-//
-// So the only solution is to write our own adb_fprintf() that converts UTF-8
-// to UTF-16 and then calls WriteConsoleW().
-
-
-// Constructor for helper class to convert wmain() UTF-16 args to UTF-8 to
-// be passed to main().
-NarrowArgs::NarrowArgs(const int argc, wchar_t** const argv) {
-    narrow_args = new char*[argc + 1];
-
-    for (int i = 0; i < argc; ++i) {
-        std::string arg_narrow;
-        if (!android::base::WideToUTF8(argv[i], &arg_narrow)) {
-            PLOG(FATAL) << "cannot convert argument from UTF-16 to UTF-8";
-        }
-        narrow_args[i] = strdup(arg_narrow.c_str());
-    }
-    narrow_args[argc] = nullptr;   // terminate
-}
-
-NarrowArgs::~NarrowArgs() {
-    if (narrow_args != nullptr) {
-        for (char** argp = narrow_args; *argp != nullptr; ++argp) {
-            free(*argp);
-        }
-        delete[] narrow_args;
-        narrow_args = nullptr;
-    }
-}
-
-int unix_open(std::string_view path, int options, ...) {
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path.data(), path.size(), &path_wide)) {
-        return -1;
-    }
-    if ((options & O_CREAT) == 0) {
-        return _wopen(path_wide.c_str(), options);
-    } else {
-        int mode;
-        va_list  args;
-        va_start(args, options);
-        mode = va_arg(args, int);
-        va_end(args);
-        return _wopen(path_wide.c_str(), options, mode);
-    }
-}
-
-// Version of opendir() that takes a UTF-8 path.
-DIR* adb_opendir(const char* path) {
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return nullptr;
-    }
-
-    // Just cast _WDIR* to DIR*. This doesn't work if the caller reads any of
-    // the fields, but right now all the callers treat the structure as
-    // opaque.
-    return reinterpret_cast<DIR*>(_wopendir(path_wide.c_str()));
-}
-
-// Version of readdir() that returns UTF-8 paths.
-struct dirent* adb_readdir(DIR* dir) {
-    _WDIR* const wdir = reinterpret_cast<_WDIR*>(dir);
-    struct _wdirent* const went = _wreaddir(wdir);
-    if (went == nullptr) {
-        return nullptr;
-    }
-
-    // Convert from UTF-16 to UTF-8.
-    std::string name_utf8;
-    if (!android::base::WideToUTF8(went->d_name, &name_utf8)) {
-        return nullptr;
-    }
-
-    // Cast the _wdirent* to dirent* and overwrite the d_name field (which has
-    // space for UTF-16 wchar_t's) with UTF-8 char's.
-    struct dirent* ent = reinterpret_cast<struct dirent*>(went);
-
-    if (name_utf8.length() + 1 > sizeof(went->d_name)) {
-        // Name too big to fit in existing buffer.
-        errno = ENOMEM;
-        return nullptr;
-    }
-
-    // Note that sizeof(_wdirent::d_name) is bigger than sizeof(dirent::d_name)
-    // because _wdirent contains wchar_t instead of char. So even if name_utf8
-    // can fit in _wdirent::d_name, the resulting dirent::d_name field may be
-    // bigger than the caller expects because they expect a dirent structure
-    // which has a smaller d_name field. Ignore this since the caller should be
-    // resilient.
-
-    // Rewrite the UTF-16 d_name field to UTF-8.
-    strcpy(ent->d_name, name_utf8.c_str());
-
-    return ent;
-}
-
-// Version of closedir() to go with our version of adb_opendir().
-int adb_closedir(DIR* dir) {
-    return _wclosedir(reinterpret_cast<_WDIR*>(dir));
-}
-
-// Version of unlink() that takes a UTF-8 path.
-int adb_unlink(const char* path) {
-    std::wstring wpath;
-    if (!android::base::UTF8ToWide(path, &wpath)) {
-        return -1;
-    }
-
-    int  rc = _wunlink(wpath.c_str());
-
-    if (rc == -1 && errno == EACCES) {
-        /* unlink returns EACCES when the file is read-only, so we first */
-        /* try to make it writable, then unlink again...                 */
-        rc = _wchmod(wpath.c_str(), _S_IREAD | _S_IWRITE);
-        if (rc == 0)
-            rc = _wunlink(wpath.c_str());
-    }
-    return rc;
-}
-
-// Version of mkdir() that takes a UTF-8 path.
-int adb_mkdir(const std::string& path, int mode) {
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return -1;
-    }
-
-    return _wmkdir(path_wide.c_str());
-}
-
-int adb_rename(const char* oldpath, const char* newpath) {
-    std::wstring oldpath_wide, newpath_wide;
-    if (!android::base::UTF8ToWide(oldpath, &oldpath_wide)) {
-        return -1;
-    }
-    if (!android::base::UTF8ToWide(newpath, &newpath_wide)) {
-        return -1;
-    }
-
-    // MSDN just says the return value is non-zero on failure, make sure it
-    // returns -1 on failure so that it behaves the same as other systems.
-    return _wrename(oldpath_wide.c_str(), newpath_wide.c_str()) ? -1 : 0;
-}
-
-// Version of utime() that takes a UTF-8 path.
-int adb_utime(const char* path, struct utimbuf* u) {
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return -1;
-    }
-
-    static_assert(sizeof(struct utimbuf) == sizeof(struct _utimbuf),
-        "utimbuf and _utimbuf should be the same size because they both "
-        "contain the same types, namely time_t");
-    return _wutime(path_wide.c_str(), reinterpret_cast<struct _utimbuf*>(u));
-}
-
-// Version of chmod() that takes a UTF-8 path.
-int adb_chmod(const char* path, int mode) {
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return -1;
-    }
-
-    return _wchmod(path_wide.c_str(), mode);
-}
-
-// From libutils/Unicode.cpp, get the length of a UTF-8 sequence given the lead byte.
-static inline size_t utf8_codepoint_len(uint8_t ch) {
-    return ((0xe5000000 >> ((ch >> 3) & 0x1e)) & 3) + 1;
-}
-
-namespace internal {
-
-// Given a sequence of UTF-8 bytes (denoted by the range [first, last)), return the number of bytes
-// (from the beginning) that are complete UTF-8 sequences and append the remaining bytes to
-// remaining_bytes.
-size_t ParseCompleteUTF8(const char* const first, const char* const last,
-                         std::vector<char>* const remaining_bytes) {
-    // Walk backwards from the end of the sequence looking for the beginning of a UTF-8 sequence.
-    // Current_after points one byte past the current byte to be examined.
-    for (const char* current_after = last; current_after != first; --current_after) {
-        const char* const current = current_after - 1;
-        const char ch = *current;
-        const char kHighBit = 0x80u;
-        const char kTwoHighestBits = 0xC0u;
-        if ((ch & kHighBit) == 0) { // high bit not set
-            // The buffer ends with a one-byte UTF-8 sequence, possibly followed by invalid trailing
-            // bytes with no leading byte, so return the entire buffer.
-            break;
-        } else if ((ch & kTwoHighestBits) == kTwoHighestBits) { // top two highest bits set
-            // Lead byte in UTF-8 sequence, so check if we have all the bytes in the sequence.
-            const size_t bytes_available = last - current;
-            if (bytes_available < utf8_codepoint_len(ch)) {
-                // We don't have all the bytes in the UTF-8 sequence, so return all the bytes
-                // preceding the current incomplete UTF-8 sequence and append the remaining bytes
-                // to remaining_bytes.
-                remaining_bytes->insert(remaining_bytes->end(), current, last);
-                return current - first;
-            } else {
-                // The buffer ends with a complete UTF-8 sequence, possibly followed by invalid
-                // trailing bytes with no lead byte, so return the entire buffer.
-                break;
-            }
-        } else {
-            // Trailing byte, so keep going backwards looking for the lead byte.
-        }
-    }
-
-    // Return the size of the entire buffer. It is possible that we walked backward past invalid
-    // trailing bytes with no lead byte, in which case we want to return all those invalid bytes
-    // so that they can be processed.
-    return last - first;
-}
-
-}
-
-// Bytes that have not yet been output to the console because they are incomplete UTF-8 sequences.
-// Note that we use only one buffer even though stderr and stdout are logically separate streams.
-// This matches the behavior of Linux.
-
-// Internal helper function to write UTF-8 bytes to a console. Returns -1 on error.
-static int _console_write_utf8(const char* const buf, const size_t buf_size, FILE* stream,
-                               HANDLE console) {
-    static std::mutex& console_output_buffer_lock = *new std::mutex();
-    static auto& console_output_buffer = *new std::vector<char>();
-
-    const int saved_errno = errno;
-    std::vector<char> combined_buffer;
-
-    // Complete UTF-8 sequences that should be immediately written to the console.
-    const char* utf8;
-    size_t utf8_size;
-
-    {
-        std::lock_guard<std::mutex> lock(console_output_buffer_lock);
-        if (console_output_buffer.empty()) {
-            // If console_output_buffer doesn't have a buffered up incomplete UTF-8 sequence (the
-            // common case with plain ASCII), parse buf directly.
-            utf8 = buf;
-            utf8_size = internal::ParseCompleteUTF8(buf, buf + buf_size, &console_output_buffer);
-        } else {
-            // If console_output_buffer has a buffered up incomplete UTF-8 sequence, move it to
-            // combined_buffer (and effectively clear console_output_buffer) and append buf to
-            // combined_buffer, then parse it all together.
-            combined_buffer.swap(console_output_buffer);
-            combined_buffer.insert(combined_buffer.end(), buf, buf + buf_size);
-
-            utf8 = combined_buffer.data();
-            utf8_size = internal::ParseCompleteUTF8(utf8, utf8 + combined_buffer.size(),
-                                                    &console_output_buffer);
-        }
-    }
-
-    std::wstring utf16;
-
-    // Try to convert from data that might be UTF-8 to UTF-16, ignoring errors (just like Linux
-    // which does not return an error on bad UTF-8). Data might not be UTF-8 if the user cat's
-    // random data, runs dmesg (which might have non-UTF-8), etc.
-    // This could throw std::bad_alloc.
-    (void)android::base::UTF8ToWide(utf8, utf8_size, &utf16);
-
-    // Note that this does not do \n => \r\n translation because that
-    // doesn't seem necessary for the Windows console. For the Windows
-    // console \r moves to the beginning of the line and \n moves to a new
-    // line.
-
-    // Flush any stream buffering so that our output is afterwards which
-    // makes sense because our call is afterwards.
-    (void)fflush(stream);
-
-    // Write UTF-16 to the console.
-    DWORD written = 0;
-    if (!WriteConsoleW(console, utf16.c_str(), utf16.length(), &written, nullptr)) {
-        errno = EIO;
-        return -1;
-    }
-
-    // Return the size of the original buffer passed in, signifying that we consumed it all, even
-    // if nothing was displayed, in the case of being passed an incomplete UTF-8 sequence. This
-    // matches the Linux behavior.
-    errno = saved_errno;
-    return buf_size;
-}
-
-// Function prototype because attributes cannot be placed on func definitions.
-static int _console_vfprintf(const HANDLE console, FILE* stream, const char* format, va_list ap)
-        __attribute__((__format__(__printf__, 3, 0)));
-
-// Internal function to format a UTF-8 string and write it to a Win32 console.
-// Returns -1 on error.
-static int _console_vfprintf(const HANDLE console, FILE* stream,
-                             const char *format, va_list ap) {
-    const int saved_errno = errno;
-    std::string output_utf8;
-
-    // Format the string.
-    // This could throw std::bad_alloc.
-    android::base::StringAppendV(&output_utf8, format, ap);
-
-    const int result = _console_write_utf8(output_utf8.c_str(), output_utf8.length(), stream,
-                                           console);
-    if (result != -1) {
-        errno = saved_errno;
-    } else {
-        // If -1 was returned, errno has been set.
-    }
-    return result;
-}
-
-// Version of vfprintf() that takes UTF-8 and can write Unicode to a
-// Windows console.
-int adb_vfprintf(FILE *stream, const char *format, va_list ap) {
-    const HANDLE console = _get_console_handle(stream);
-
-    // If there is an associated Win32 console, write to it specially,
-    // otherwise defer to the regular C Runtime, passing it UTF-8.
-    if (console != nullptr) {
-        return _console_vfprintf(console, stream, format, ap);
-    } else {
-        // If vfprintf is a macro, undefine it, so we can call the real
-        // C Runtime API.
-#pragma push_macro("vfprintf")
-#undef vfprintf
-        return vfprintf(stream, format, ap);
-#pragma pop_macro("vfprintf")
-    }
-}
-
-// Version of vprintf() that takes UTF-8 and can write Unicode to a Windows console.
-int adb_vprintf(const char *format, va_list ap) {
-    return adb_vfprintf(stdout, format, ap);
-}
-
-// Version of fprintf() that takes UTF-8 and can write Unicode to a
-// Windows console.
-int adb_fprintf(FILE *stream, const char *format, ...) {
-    va_list ap;
-    va_start(ap, format);
-    const int result = adb_vfprintf(stream, format, ap);
-    va_end(ap);
-
-    return result;
-}
-
-// Version of printf() that takes UTF-8 and can write Unicode to a
-// Windows console.
-int adb_printf(const char *format, ...) {
-    va_list ap;
-    va_start(ap, format);
-    const int result = adb_vfprintf(stdout, format, ap);
-    va_end(ap);
-
-    return result;
-}
-
-// Version of fputs() that takes UTF-8 and can write Unicode to a
-// Windows console.
-int adb_fputs(const char* buf, FILE* stream) {
-    // adb_fprintf returns -1 on error, which is conveniently the same as EOF
-    // which fputs (and hence adb_fputs) should return on error.
-    static_assert(EOF == -1, "EOF is not -1, so this code needs to be fixed");
-    return adb_fprintf(stream, "%s", buf);
-}
-
-// Version of fputc() that takes UTF-8 and can write Unicode to a
-// Windows console.
-int adb_fputc(int ch, FILE* stream) {
-    const int result = adb_fprintf(stream, "%c", ch);
-    if (result == -1) {
-        return EOF;
-    }
-    // For success, fputc returns the char, cast to unsigned char, then to int.
-    return static_cast<unsigned char>(ch);
-}
-
-// Version of putchar() that takes UTF-8 and can write Unicode to a Windows console.
-int adb_putchar(int ch) {
-    return adb_fputc(ch, stdout);
-}
-
-// Version of puts() that takes UTF-8 and can write Unicode to a Windows console.
-int adb_puts(const char* buf) {
-    // adb_printf returns -1 on error, which is conveniently the same as EOF
-    // which puts (and hence adb_puts) should return on error.
-    static_assert(EOF == -1, "EOF is not -1, so this code needs to be fixed");
-    return adb_printf("%s\n", buf);
-}
-
-// Internal function to write UTF-8 to a Win32 console. Returns the number of
-// items (of length size) written. On error, returns a short item count or 0.
-static size_t _console_fwrite(const void* ptr, size_t size, size_t nmemb,
-                              FILE* stream, HANDLE console) {
-    const int result = _console_write_utf8(reinterpret_cast<const char*>(ptr), size * nmemb, stream,
-                                           console);
-    if (result == -1) {
-        return 0;
-    }
-    return result / size;
-}
-
-// Version of fwrite() that takes UTF-8 and can write Unicode to a
-// Windows console.
-size_t adb_fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream) {
-    const HANDLE console = _get_console_handle(stream);
-
-    // If there is an associated Win32 console, write to it specially,
-    // otherwise defer to the regular C Runtime, passing it UTF-8.
-    if (console != nullptr) {
-        return _console_fwrite(ptr, size, nmemb, stream, console);
-    } else {
-        // If fwrite is a macro, undefine it, so we can call the real
-        // C Runtime API.
-#pragma push_macro("fwrite")
-#undef fwrite
-        return fwrite(ptr, size, nmemb, stream);
-#pragma pop_macro("fwrite")
-    }
-}
-
-// Version of fopen() that takes a UTF-8 filename and can access a file with
-// a Unicode filename.
-FILE* adb_fopen(const char* path, const char* mode) {
-    std::wstring path_wide;
-    if (!android::base::UTF8ToWide(path, &path_wide)) {
-        return nullptr;
-    }
-
-    std::wstring mode_wide;
-    if (!android::base::UTF8ToWide(mode, &mode_wide)) {
-        return nullptr;
-    }
-
-    return _wfopen(path_wide.c_str(), mode_wide.c_str());
-}
-
-// Return a lowercase version of the argument. Uses C Runtime tolower() on
-// each byte which is not UTF-8 aware, and theoretically uses the current C
-// Runtime locale (which in practice is not changed, so this becomes a ASCII
-// conversion).
-static std::string ToLower(const std::string& anycase) {
-    // copy string
-    std::string str(anycase);
-    // transform the copy
-    std::transform(str.begin(), str.end(), str.begin(), tolower);
-    return str;
-}
-
-extern "C" int main(int argc, char** argv);
-
-// Link with -municode to cause this wmain() to be used as the program
-// entrypoint. It will convert the args from UTF-16 to UTF-8 and call the
-// regular main() with UTF-8 args.
-extern "C" int wmain(int argc, wchar_t **argv) {
-    // Convert args from UTF-16 to UTF-8 and pass that to main().
-    NarrowArgs narrow_args(argc, argv);
-
-    // Avoid destructing NarrowArgs: argv might have been mutated to point to string literals.
-    _exit(main(argc, narrow_args.data()));
-}
-
-// Shadow UTF-8 environment variable name/value pairs that are created from
-// _wenviron by _init_env(). Note that this is not currently updated if putenv, setenv, unsetenv are
-// called. Note that no thread synchronization is done, but we're called early enough in
-// single-threaded startup that things work ok.
-static auto& g_environ_utf8 = *new std::unordered_map<std::string, char*>();
-
-// Setup shadow UTF-8 environment variables.
-static void _init_env() {
-    // If some name/value pairs exist, then we've already done the setup below.
-    if (g_environ_utf8.size() != 0) {
-        return;
-    }
-
-    if (_wenviron == nullptr) {
-        // If _wenviron is null, then -municode probably wasn't used. That
-        // linker flag will cause the entry point to setup _wenviron. It will
-        // also require an implementation of wmain() (which we provide above).
-        LOG(FATAL) << "_wenviron is not set, did you link with -municode?";
-    }
-
-    // Read name/value pairs from UTF-16 _wenviron and write new name/value
-    // pairs to UTF-8 g_environ_utf8. Note that it probably does not make sense
-    // to use the D() macro here because that tracing only works if the
-    // ADB_TRACE environment variable is setup, but that env var can't be read
-    // until this code completes.
-    for (wchar_t** env = _wenviron; *env != nullptr; ++env) {
-        wchar_t* const equal = wcschr(*env, L'=');
-        if (equal == nullptr) {
-            // Malformed environment variable with no equal sign. Shouldn't
-            // really happen, but we should be resilient to this.
-            continue;
-        }
-
-        // If we encounter an error converting UTF-16, don't error-out on account of a single env
-        // var because the program might never even read this particular variable.
-        std::string name_utf8;
-        if (!android::base::WideToUTF8(*env, equal - *env, &name_utf8)) {
-            continue;
-        }
-
-        // Store lowercase name so that we can do case-insensitive searches.
-        name_utf8 = ToLower(name_utf8);
-
-        std::string value_utf8;
-        if (!android::base::WideToUTF8(equal + 1, &value_utf8)) {
-            continue;
-        }
-
-        char* const value_dup = strdup(value_utf8.c_str());
-
-        // Don't overwrite a previus env var with the same name. In reality,
-        // the system probably won't let two env vars with the same name exist
-        // in _wenviron.
-        g_environ_utf8.insert({name_utf8, value_dup});
-    }
-}
-
-// Version of getenv() that takes a UTF-8 environment variable name and
-// retrieves a UTF-8 value. Case-insensitive to match getenv() on Windows.
-char* adb_getenv(const char* name) {
-    // Case-insensitive search by searching for lowercase name in a map of
-    // lowercase names.
-    const auto it = g_environ_utf8.find(ToLower(std::string(name)));
-    if (it == g_environ_utf8.end()) {
-        return nullptr;
-    }
-
-    return it->second;
-}
-
-// Version of getcwd() that returns the current working directory in UTF-8.
-char* adb_getcwd(char* buf, int size) {
-    wchar_t* wbuf = _wgetcwd(nullptr, 0);
-    if (wbuf == nullptr) {
-        return nullptr;
-    }
-
-    std::string buf_utf8;
-    const bool narrow_result = android::base::WideToUTF8(wbuf, &buf_utf8);
-    free(wbuf);
-    wbuf = nullptr;
-
-    if (!narrow_result) {
-        return nullptr;
-    }
-
-    // If size was specified, make sure all the chars will fit.
-    if (size != 0) {
-        if (size < static_cast<int>(buf_utf8.length() + 1)) {
-            errno = ERANGE;
-            return nullptr;
-        }
-    }
-
-    // If buf was not specified, allocate storage.
-    if (buf == nullptr) {
-        if (size == 0) {
-            size = buf_utf8.length() + 1;
-        }
-        buf = reinterpret_cast<char*>(malloc(size));
-        if (buf == nullptr) {
-            return nullptr;
-        }
-    }
-
-    // Destination buffer was allocated with enough space, or we've already
-    // checked an existing buffer size for enough space.
-    strcpy(buf, buf_utf8.c_str());
-
-    return buf;
-}
-
-void enable_inherit(borrowed_fd fd) {
-    auto osh = adb_get_os_handle(fd);
-    const auto h = reinterpret_cast<HANDLE>(osh);
-    ::SetHandleInformation(h, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
-}
-
-void disable_inherit(borrowed_fd fd) {
-    auto osh = adb_get_os_handle(fd);
-    const auto h = reinterpret_cast<HANDLE>(osh);
-    ::SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0);
-}
-
-Process adb_launch_process(std::string_view executable, std::vector<std::string> args,
-                           std::initializer_list<int> fds_to_inherit) {
-    std::wstring wexe;
-    if (!android::base::UTF8ToWide(executable.data(), executable.size(), &wexe)) {
-        return Process();
-    }
-
-    std::wstring wargs = L"\"" + wexe + L"\"";
-    std::wstring warg;
-    for (auto arg : args) {
-        warg.clear();
-        if (!android::base::UTF8ToWide(arg.data(), arg.size(), &warg)) {
-            return Process();
-        }
-        wargs += L" \"";
-        wargs += warg;
-        wargs += L'\"';
-    }
-
-    STARTUPINFOW sinfo = {sizeof(sinfo)};
-    PROCESS_INFORMATION pinfo = {};
-
-    // TODO: use the Vista+ API to pass the list of inherited handles explicitly;
-    // see http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx
-    for (auto fd : fds_to_inherit) {
-        enable_inherit(fd);
-    }
-    const auto created = CreateProcessW(wexe.c_str(), wargs.data(),
-                                        nullptr,                    // process attributes
-                                        nullptr,                    // thread attributes
-                                        fds_to_inherit.size() > 0,  // inherit any handles?
-                                        0,                          // flags
-                                        nullptr,                    // environment
-                                        nullptr,                    // current directory
-                                        &sinfo,                     // startup info
-                                        &pinfo);
-    for (auto fd : fds_to_inherit) {
-        disable_inherit(fd);
-    }
-
-    if (!created) {
-        return Process();
-    }
-
-    ::CloseHandle(pinfo.hThread);
-    return Process(pinfo.hProcess);
-}
-
-// The SetThreadDescription API was brought in version 1607 of Windows 10.
-typedef HRESULT(WINAPI* SetThreadDescription)(HANDLE hThread, PCWSTR lpThreadDescription);
-
-// Based on PlatformThread::SetName() from
-// https://cs.chromium.org/chromium/src/base/threading/platform_thread_win.cc
-int adb_thread_setname(const std::string& name) {
-    // The SetThreadDescription API works even if no debugger is attached.
-    auto set_thread_description_func = reinterpret_cast<SetThreadDescription>(
-            ::GetProcAddress(::GetModuleHandleW(L"Kernel32.dll"), "SetThreadDescription"));
-    if (set_thread_description_func) {
-        std::wstring name_wide;
-        if (!android::base::UTF8ToWide(name.c_str(), &name_wide)) {
-            return errno;
-        }
-        set_thread_description_func(::GetCurrentThread(), name_wide.c_str());
-    }
-
-    // Don't use the thread naming SEH exception because we're compiled with -fno-exceptions.
-    // https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code?view=vs-2017
-
-    return 0;
-}
-
-#if !defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
-#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
-#endif
-
-#if !defined(DISABLE_NEWLINE_AUTO_RETURN)
-#define DISABLE_NEWLINE_AUTO_RETURN 0x0008
-#endif
-
-static void _init_console() {
-    DWORD old_out_console_mode;
-
-    const HANDLE out = _get_console_handle(STDOUT_FILENO, &old_out_console_mode);
-    if (out == nullptr) {
-        return;
-    }
-
-    // Try to use ENABLE_VIRTUAL_TERMINAL_PROCESSING on the output console to process virtual
-    // terminal sequences on newer versions of Windows 10 and later.
-    // https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
-    // On older OSes that don't support the flag, SetConsoleMode() will return an error.
-    // ENABLE_VIRTUAL_TERMINAL_PROCESSING also solves a problem where the last column of the
-    // console cannot be overwritten.
-    //
-    // Note that we don't use DISABLE_NEWLINE_AUTO_RETURN because it doesn't seem to be necessary.
-    // If we use DISABLE_NEWLINE_AUTO_RETURN, _console_write_utf8() would need to be modified to
-    // translate \n to \r\n.
-    if (!SetConsoleMode(out, old_out_console_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) {
-        return;
-    }
-
-    // If SetConsoleMode() succeeded, the console supports virtual terminal processing, so we
-    // should set the TERM env var to match so that it will be propagated to adbd on devices.
-    //
-    // Below's direct manipulation of env vars and not g_environ_utf8 assumes that _init_env() has
-    // not yet been called. If this fails, _init_env() should be called after _init_console().
-    if (g_environ_utf8.size() > 0) {
-        LOG(FATAL) << "environment variables have already been converted to UTF-8";
-    }
-
-#pragma push_macro("getenv")
-#undef getenv
-#pragma push_macro("putenv")
-#undef putenv
-    if (getenv("TERM") == nullptr) {
-        // This is the same TERM value used by Gnome Terminal and the version of ssh included with
-        // Windows.
-        putenv("TERM=xterm-256color");
-    }
-#pragma pop_macro("putenv")
-#pragma pop_macro("getenv")
-}
-
-static bool _init_sysdeps() {
-    // _init_console() depends on _init_env() not being called yet.
-    _init_console();
-    _init_env();
-    _init_winsock();
-    return true;
-}
-
-static bool _sysdeps_init = _init_sysdeps();
diff --git a/adb/sysdeps_win32_test.cpp b/adb/sysdeps_win32_test.cpp
deleted file mode 100644
index 183cd5b..0000000
--- a/adb/sysdeps_win32_test.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <gtest/gtest.h>
-
-#include "sysdeps.h"
-
-#include <android-base/file.h>
-
-TEST(sysdeps_win32, adb_getenv) {
-    // Insert all test env vars before first call to adb_getenv() which will
-    // read the env var block only once.
-    ASSERT_EQ(0, _putenv("SYSDEPS_WIN32_TEST_UPPERCASE=1"));
-    ASSERT_EQ(0, _putenv("sysdeps_win32_test_lowercase=2"));
-    ASSERT_EQ(0, _putenv("Sysdeps_Win32_Test_MixedCase=3"));
-
-    // UTF-16 value
-    ASSERT_EQ(0, _wputenv(L"SYSDEPS_WIN32_TEST_UNICODE=\u00a1\u0048\u006f\u006c"
-                          L"\u0061\u0021\u03b1\u03b2\u03b3\u0061\u006d\u0062"
-                          L"\u0075\u006c\u014d\u043f\u0440\u0438\u0432\u0435"
-                          L"\u0442"));
-
-    // Search for non-existant env vars.
-    EXPECT_STREQ(nullptr, adb_getenv("SYSDEPS_WIN32_TEST_NONEXISTANT"));
-
-    // Search for existing env vars.
-
-    // There is no test for an env var with a value of a zero-length string
-    // because _putenv() does not support inserting such an env var.
-
-    // Search for env var that is uppercase.
-    EXPECT_STREQ("1", adb_getenv("SYSDEPS_WIN32_TEST_UPPERCASE"));
-    EXPECT_STREQ("1", adb_getenv("sysdeps_win32_test_uppercase"));
-    EXPECT_STREQ("1", adb_getenv("Sysdeps_Win32_Test_Uppercase"));
-
-    // Search for env var that is lowercase.
-    EXPECT_STREQ("2", adb_getenv("SYSDEPS_WIN32_TEST_LOWERCASE"));
-    EXPECT_STREQ("2", adb_getenv("sysdeps_win32_test_lowercase"));
-    EXPECT_STREQ("2", adb_getenv("Sysdeps_Win32_Test_Lowercase"));
-
-    // Search for env var that is mixed-case.
-    EXPECT_STREQ("3", adb_getenv("SYSDEPS_WIN32_TEST_MIXEDCASE"));
-    EXPECT_STREQ("3", adb_getenv("sysdeps_win32_test_mixedcase"));
-    EXPECT_STREQ("3", adb_getenv("Sysdeps_Win32_Test_MixedCase"));
-
-    // Check that UTF-16 was converted to UTF-8.
-    EXPECT_STREQ("\xc2\xa1\x48\x6f\x6c\x61\x21\xce\xb1\xce\xb2\xce\xb3\x61\x6d"
-                 "\x62\x75\x6c\xc5\x8d\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5"
-                 "\xd1\x82",
-                 adb_getenv("SYSDEPS_WIN32_TEST_UNICODE"));
-
-    // Check an env var that should always be set.
-    const char* path_val = adb_getenv("PATH");
-    EXPECT_NE(nullptr, path_val);
-    if (path_val != nullptr) {
-        EXPECT_GT(strlen(path_val), 0U);
-    }
-}
-
-TEST(sysdeps_win32, unix_isatty) {
-    // stdin and stdout should be consoles. Use CONIN$ and CONOUT$ special files
-    // so that we can test this even if stdin/stdout have been redirected. Read
-    // permissions are required for unix_isatty().
-    int conin_fd = unix_open("CONIN$", O_RDONLY);
-    int conout_fd = unix_open("CONOUT$", O_RDWR);
-    for (const int fd : {conin_fd, conout_fd}) {
-        EXPECT_TRUE(fd >= 0);
-        EXPECT_EQ(1, unix_isatty(fd));
-        EXPECT_EQ(0, unix_close(fd));
-    }
-
-    // nul returns 1 from isatty(), make sure unix_isatty() corrects that.
-    for (auto flags : {O_RDONLY, O_RDWR}) {
-        int nul_fd = unix_open("nul", flags);
-        EXPECT_TRUE(nul_fd >= 0);
-        EXPECT_EQ(0, unix_isatty(nul_fd));
-        EXPECT_EQ(0, unix_close(nul_fd));
-    }
-
-    // Check a real file, both read-write and read-only.
-    TemporaryFile temp_file;
-    EXPECT_TRUE(temp_file.fd >= 0);
-    EXPECT_EQ(0, unix_isatty(temp_file.fd));
-
-    int temp_file_ro_fd = unix_open(temp_file.path, O_RDONLY);
-    EXPECT_TRUE(temp_file_ro_fd >= 0);
-    EXPECT_EQ(0, unix_isatty(temp_file_ro_fd));
-    EXPECT_EQ(0, unix_close(temp_file_ro_fd));
-
-    // Check a real OS pipe.
-    int pipe_fds[2];
-    EXPECT_EQ(0, _pipe(pipe_fds, 64, _O_BINARY));
-    EXPECT_EQ(0, unix_isatty(pipe_fds[0]));
-    EXPECT_EQ(0, unix_isatty(pipe_fds[1]));
-    EXPECT_EQ(0, _close(pipe_fds[0]));
-    EXPECT_EQ(0, _close(pipe_fds[1]));
-
-    // Make sure an invalid FD is handled correctly.
-    EXPECT_EQ(0, unix_isatty(-1));
-}
-
-void TestParseCompleteUTF8(const char* buf, const size_t buf_size,
-                           const size_t expected_complete_bytes,
-                           const std::vector<char>& expected_remaining_bytes) {
-    std::vector<char> remaining_bytes;
-    const size_t complete_bytes = internal::ParseCompleteUTF8(buf, buf + buf_size,
-                                                              &remaining_bytes);
-    EXPECT_EQ(expected_complete_bytes, complete_bytes);
-    EXPECT_EQ(expected_remaining_bytes, remaining_bytes);
-}
-
-TEST(sysdeps_win32, ParseCompleteUTF8) {
-    const std::vector<std::vector<char>> multi_byte_sequences = {
-        { '\xc2', '\xa9' },                 // 2 byte UTF-8 sequence
-        { '\xe1', '\xb4', '\xa8' },         // 3 byte UTF-8 sequence
-        { '\xf0', '\x9f', '\x98', '\x80' }, // 4 byte UTF-8 sequence
-    };
-    std::vector<std::vector<char>> all_sequences = {
-        {},                                 // 0 bytes
-        { '\0' },                           // NULL byte
-        { 'a' },                            // 1 byte UTF-8 sequence
-    };
-    all_sequences.insert(all_sequences.end(), multi_byte_sequences.begin(),
-                         multi_byte_sequences.end());
-
-    // Vary a prefix of bytes in front of the sequence that we're actually interested in parsing.
-    for (const auto& prefix : all_sequences) {
-        // Parse (prefix + one byte of the sequence at a time)
-        for (const auto& seq : multi_byte_sequences) {
-            std::vector<char> buffer(prefix);
-
-            // For every byte of the sequence except the last
-            for (size_t i = 0; i < seq.size() - 1; ++i) {
-                buffer.push_back(seq[i]);
-
-                // When parsing an incomplete UTF-8 sequence, the amount of the buffer preceding
-                // the start of the incomplete UTF-8 sequence is valid. The remaining bytes are the
-                // bytes of the incomplete UTF-8 sequence.
-                TestParseCompleteUTF8(buffer.data(), buffer.size(), prefix.size(),
-                                      std::vector<char>(seq.begin(), seq.begin() + i + 1));
-            }
-
-            // For the last byte of the sequence
-            buffer.push_back(seq.back());
-            TestParseCompleteUTF8(buffer.data(), buffer.size(), buffer.size(), std::vector<char>());
-        }
-
-        // Parse (prefix (aka sequence) + invalid trailing bytes) to verify that the invalid
-        // trailing bytes are immediately "returned" to prevent them from being stuck in some
-        // buffer.
-        std::vector<char> buffer(prefix);
-        for (size_t i = 0; i < 8; ++i) {
-            buffer.push_back(0x80); // trailing byte
-            TestParseCompleteUTF8(buffer.data(), buffer.size(), buffer.size(), std::vector<char>());
-        }
-    }
-}
diff --git a/adb/test_adb.py b/adb/test_adb.py
deleted file mode 100755
index c872fb0..0000000
--- a/adb/test_adb.py
+++ /dev/null
@@ -1,587 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2015 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.
-#
-"""Tests for the adb program itself.
-
-This differs from things in test_device.py in that there is no API for these
-things. Most of these tests involve specific error messages or the help text.
-"""
-
-import contextlib
-import os
-import random
-import select
-import socket
-import struct
-import subprocess
-import sys
-import threading
-import time
-import unittest
-import warnings
-
-def find_open_port():
-    # Find an open port.
-    with socket.socket() as s:
-        s.bind(("localhost", 0))
-        return s.getsockname()[1]
-
-@contextlib.contextmanager
-def fake_adbd(protocol=socket.AF_INET, port=0):
-    """Creates a fake ADB daemon that just replies with a CNXN packet."""
-
-    serversock = socket.socket(protocol, socket.SOCK_STREAM)
-    serversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-    if protocol == socket.AF_INET:
-        serversock.bind(("127.0.0.1", port))
-    else:
-        serversock.bind(("::1", port))
-    serversock.listen(1)
-
-    # A pipe that is used to signal the thread that it should terminate.
-    readsock, writesock = socket.socketpair()
-
-    def _adb_packet(command: bytes, arg0: int, arg1: int, data: bytes) -> bytes:
-        bin_command = struct.unpack("I", command)[0]
-        buf = struct.pack("IIIIII", bin_command, arg0, arg1, len(data), 0,
-                          bin_command ^ 0xffffffff)
-        buf += data
-        return buf
-
-    def _handle(sock):
-        with contextlib.closing(sock) as serversock:
-            rlist = [readsock, serversock]
-            cnxn_sent = {}
-            while True:
-                read_ready, _, _ = select.select(rlist, [], [])
-                for ready in read_ready:
-                    if ready == readsock:
-                        # Closure pipe
-                        for f in rlist:
-                            f.close()
-                        return
-                    elif ready == serversock:
-                        # Server socket
-                        conn, _ = ready.accept()
-                        rlist.append(conn)
-                    else:
-                        # Client socket
-                        data = ready.recv(1024)
-                        if not data or data.startswith(b"OPEN"):
-                            if ready in cnxn_sent:
-                                del cnxn_sent[ready]
-                            ready.shutdown(socket.SHUT_RDWR)
-                            ready.close()
-                            rlist.remove(ready)
-                            continue
-                        if ready in cnxn_sent:
-                            continue
-                        cnxn_sent[ready] = True
-                        ready.sendall(_adb_packet(b"CNXN", 0x01000001, 1024 * 1024,
-                                                  b"device::ro.product.name=fakeadb"))
-
-    port = serversock.getsockname()[1]
-    server_thread = threading.Thread(target=_handle, args=(serversock,))
-    server_thread.start()
-
-    try:
-        yield port, writesock
-    finally:
-        writesock.close()
-        server_thread.join()
-
-
-@contextlib.contextmanager
-def adb_connect(unittest, serial):
-    """Context manager for an ADB connection.
-
-    This automatically disconnects when done with the connection.
-    """
-
-    output = subprocess.check_output(["adb", "connect", serial])
-    unittest.assertEqual(output.strip(),
-                        "connected to {}".format(serial).encode("utf8"))
-
-    try:
-        yield
-    finally:
-        # Perform best-effort disconnection. Discard the output.
-        subprocess.Popen(["adb", "disconnect", serial],
-                         stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE).communicate()
-
-
-@contextlib.contextmanager
-def adb_server():
-    """Context manager for an ADB server.
-
-    This creates an ADB server and returns the port it's listening on.
-    """
-
-    port = find_open_port()
-    read_pipe, write_pipe = os.pipe()
-
-    if sys.platform == "win32":
-        import msvcrt
-        write_handle = msvcrt.get_osfhandle(write_pipe)
-        os.set_handle_inheritable(write_handle, True)
-        reply_fd = str(write_handle)
-    else:
-        os.set_inheritable(write_pipe, True)
-        reply_fd = str(write_pipe)
-
-    proc = subprocess.Popen(["adb", "-L", "tcp:localhost:{}".format(port),
-                             "fork-server", "server",
-                             "--reply-fd", reply_fd], close_fds=False)
-    try:
-        os.close(write_pipe)
-        greeting = os.read(read_pipe, 1024)
-        assert greeting == b"OK\n", repr(greeting)
-        yield port
-    finally:
-        proc.terminate()
-        proc.wait()
-
-
-class CommandlineTest(unittest.TestCase):
-    """Tests for the ADB commandline."""
-
-    def test_help(self):
-        """Make sure we get _something_ out of help."""
-        out = subprocess.check_output(
-            ["adb", "help"], stderr=subprocess.STDOUT)
-        self.assertGreater(len(out), 0)
-
-    def test_version(self):
-        """Get a version number out of the output of adb."""
-        lines = subprocess.check_output(["adb", "version"]).splitlines()
-        version_line = lines[0]
-        self.assertRegex(
-            version_line, rb"^Android Debug Bridge version \d+\.\d+\.\d+$")
-        if len(lines) == 2:
-            # Newer versions of ADB have a second line of output for the
-            # version that includes a specific revision (git SHA).
-            revision_line = lines[1]
-            self.assertRegex(
-                revision_line, rb"^Revision [0-9a-f]{12}-android$")
-
-    def test_tcpip_error_messages(self):
-        """Make sure 'adb tcpip' parsing is sane."""
-        proc = subprocess.Popen(["adb", "tcpip"],
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.STDOUT)
-        out, _ = proc.communicate()
-        self.assertEqual(1, proc.returncode)
-        self.assertIn(b"requires an argument", out)
-
-        proc = subprocess.Popen(["adb", "tcpip", "foo"],
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.STDOUT)
-        out, _ = proc.communicate()
-        self.assertEqual(1, proc.returncode)
-        self.assertIn(b"invalid port", out)
-
-
-class ServerTest(unittest.TestCase):
-    """Tests for the ADB server."""
-
-    @staticmethod
-    def _read_pipe_and_set_event(pipe, event):
-        """Reads a pipe until it is closed, then sets the event."""
-        pipe.read()
-        event.set()
-
-    def test_handle_inheritance(self):
-        """Test that launch_server() does not inherit handles.
-
-        launch_server() should not let the adb server inherit
-        stdin/stdout/stderr handles, which can cause callers of adb.exe to hang.
-        This test also runs fine on unix even though the impetus is an issue
-        unique to Windows.
-        """
-        # This test takes 5 seconds to run on Windows: if there is no adb server
-        # running on the the port used below, adb kill-server tries to make a
-        # TCP connection to a closed port and that takes 1 second on Windows;
-        # adb start-server does the same TCP connection which takes another
-        # second, and it waits 3 seconds after starting the server.
-
-        # Start adb client with redirected stdin/stdout/stderr to check if it
-        # passes those redirections to the adb server that it starts. To do
-        # this, run an instance of the adb server on a non-default port so we
-        # don't conflict with a pre-existing adb server that may already be
-        # setup with adb TCP/emulator connections. If there is a pre-existing
-        # adb server, this also tests whether multiple instances of the adb
-        # server conflict on adb.log.
-
-        port = find_open_port()
-
-        try:
-            # We get warnings for unclosed files for the subprocess's pipes,
-            # and it's somewhat cumbersome to close them, so just ignore this.
-            warnings.simplefilter("ignore", ResourceWarning)
-
-            # Run the adb client and have it start the adb server.
-            proc = subprocess.Popen(["adb", "-P", str(port), "start-server"],
-                                    stdin=subprocess.PIPE,
-                                    stdout=subprocess.PIPE,
-                                    stderr=subprocess.PIPE)
-
-            # Start threads that set events when stdout/stderr are closed.
-            stdout_event = threading.Event()
-            stdout_thread = threading.Thread(
-                target=ServerTest._read_pipe_and_set_event,
-                args=(proc.stdout, stdout_event))
-            stdout_thread.start()
-
-            stderr_event = threading.Event()
-            stderr_thread = threading.Thread(
-                target=ServerTest._read_pipe_and_set_event,
-                args=(proc.stderr, stderr_event))
-            stderr_thread.start()
-
-            # Wait for the adb client to finish. Once that has occurred, if
-            # stdin/stderr/stdout are still open, it must be open in the adb
-            # server.
-            proc.wait()
-
-            # Try to write to stdin which we expect is closed. If it isn't
-            # closed, we should get an IOError. If we don't get an IOError,
-            # stdin must still be open in the adb server. The adb client is
-            # probably letting the adb server inherit stdin which would be
-            # wrong.
-            with self.assertRaises(IOError):
-                proc.stdin.write(b"x")
-                proc.stdin.flush()
-
-            # Wait a few seconds for stdout/stderr to be closed (in the success
-            # case, this won't wait at all). If there is a timeout, that means
-            # stdout/stderr were not closed and and they must be open in the adb
-            # server, suggesting that the adb client is letting the adb server
-            # inherit stdout/stderr which would be wrong.
-            self.assertTrue(stdout_event.wait(5), "adb stdout not closed")
-            self.assertTrue(stderr_event.wait(5), "adb stderr not closed")
-            stdout_thread.join()
-            stderr_thread.join()
-        finally:
-            # If we started a server, kill it.
-            subprocess.check_output(["adb", "-P", str(port), "kill-server"],
-                                    stderr=subprocess.STDOUT)
-
-    @unittest.skipUnless(
-        os.name == "posix",
-        "adb doesn't yet support IPv6 on Windows",
-    )
-    def test_starts_on_ipv6_localhost(self):
-        """
-        Tests that the server can start up on ::1 and that it's accessible
-        """
-
-        server_port = find_open_port()
-        try:
-            subprocess.check_output(
-                ["adb", "-L", "tcp:[::1]:{}".format(server_port), "server"],
-                stderr=subprocess.STDOUT,
-            )
-            with fake_adbd() as (port, _):
-                with adb_connect(self, serial="localhost:{}".format(port)):
-                    pass
-        finally:
-            # If we started a server, kill it.
-            subprocess.check_output(
-                ["adb", "-P", str(server_port), "kill-server"],
-                stderr=subprocess.STDOUT,
-            )
-
-
-
-
-class EmulatorTest(unittest.TestCase):
-    """Tests for the emulator connection."""
-
-    def _reset_socket_on_close(self, sock):
-        """Use SO_LINGER to cause TCP RST segment to be sent on socket close."""
-        # The linger structure is two shorts on Windows, but two ints on Unix.
-        linger_format = "hh" if os.name == "nt" else "ii"
-        l_onoff = 1
-        l_linger = 0
-
-        sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
-                        struct.pack(linger_format, l_onoff, l_linger))
-        # Verify that we set the linger structure properly by retrieving it.
-        linger = sock.getsockopt(socket.SOL_SOCKET, socket.SO_LINGER, 16)
-        self.assertEqual((l_onoff, l_linger),
-                         struct.unpack_from(linger_format, linger))
-
-    def test_emu_kill(self):
-        """Ensure that adb emu kill works.
-
-        Bug: https://code.google.com/p/android/issues/detail?id=21021
-        """
-        with contextlib.closing(
-            socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as listener:
-            # Use SO_REUSEADDR so subsequent runs of the test can grab the port
-            # even if it is in TIME_WAIT.
-            listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-            listener.bind(("127.0.0.1", 0))
-            listener.listen(4)
-            port = listener.getsockname()[1]
-
-            # Now that listening has started, start adb emu kill, telling it to
-            # connect to our mock emulator.
-            proc = subprocess.Popen(
-                ["adb", "-s", "emulator-" + str(port), "emu", "kill"],
-                stderr=subprocess.STDOUT)
-
-            accepted_connection, addr = listener.accept()
-            with contextlib.closing(accepted_connection) as conn:
-                # If WSAECONNABORTED (10053) is raised by any socket calls,
-                # then adb probably isn't reading the data that we sent it.
-                conn.sendall(("Android Console: type 'help' for a list "
-                             "of commands\r\n").encode("utf8"))
-                conn.sendall(b"OK\r\n")
-
-                with contextlib.closing(conn.makefile()) as connf:
-                    line = connf.readline()
-                    if line.startswith("auth"):
-                        # Ignore the first auth line.
-                        line = connf.readline()
-                    self.assertEqual("kill\n", line)
-                    self.assertEqual("quit\n", connf.readline())
-
-                conn.sendall(b"OK: killing emulator, bye bye\r\n")
-
-                # Use SO_LINGER to send TCP RST segment to test whether adb
-                # ignores WSAECONNRESET on Windows. This happens with the
-                # real emulator because it just calls exit() without closing
-                # the socket or calling shutdown(SD_SEND). At process
-                # termination, Windows sends a TCP RST segment for every
-                # open socket that shutdown(SD_SEND) wasn't used on.
-                self._reset_socket_on_close(conn)
-
-            # Wait for adb to finish, so we can check return code.
-            proc.communicate()
-
-            # If this fails, adb probably isn't ignoring WSAECONNRESET when
-            # reading the response from the adb emu kill command (on Windows).
-            self.assertEqual(0, proc.returncode)
-
-    def test_emulator_connect(self):
-        """Ensure that the emulator can connect.
-
-        Bug: http://b/78991667
-        """
-        with adb_server() as server_port:
-            with fake_adbd() as (port, _):
-                serial = "emulator-{}".format(port - 1)
-                # Ensure that the emulator is not there.
-                try:
-                    subprocess.check_output(["adb", "-P", str(server_port),
-                                             "-s", serial, "get-state"],
-                                            stderr=subprocess.STDOUT)
-                    self.fail("Device should not be available")
-                except subprocess.CalledProcessError as err:
-                    self.assertEqual(
-                        err.output.strip(),
-                        "error: device '{}' not found".format(serial).encode("utf8"))
-
-                # Let the ADB server know that the emulator has started.
-                with contextlib.closing(
-                        socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
-                    sock.connect(("localhost", server_port))
-                    command = "host:emulator:{}".format(port).encode("utf8")
-                    sock.sendall(b"%04x%s" % (len(command), command))
-
-                # Ensure the emulator is there.
-                subprocess.check_call(["adb", "-P", str(server_port),
-                                       "-s", serial, "wait-for-device"])
-                output = subprocess.check_output(["adb", "-P", str(server_port),
-                                                  "-s", serial, "get-state"])
-                self.assertEqual(output.strip(), b"device")
-
-
-class ConnectionTest(unittest.TestCase):
-    """Tests for adb connect."""
-
-    def test_connect_ipv4_ipv6(self):
-        """Ensure that `adb connect localhost:1234` will try both IPv4 and IPv6.
-
-        Bug: http://b/30313466
-        """
-        for protocol in (socket.AF_INET, socket.AF_INET6):
-            try:
-                with fake_adbd(protocol=protocol) as (port, _):
-                    serial = "localhost:{}".format(port)
-                    with adb_connect(self, serial):
-                        pass
-            except socket.error:
-                print("IPv6 not available, skipping")
-                continue
-
-    def test_already_connected(self):
-        """Ensure that an already-connected device stays connected."""
-
-        with fake_adbd() as (port, _):
-            serial = "localhost:{}".format(port)
-            with adb_connect(self, serial):
-                # b/31250450: this always returns 0 but probably shouldn't.
-                output = subprocess.check_output(["adb", "connect", serial])
-                self.assertEqual(
-                    output.strip(),
-                    "already connected to {}".format(serial).encode("utf8"))
-
-    @unittest.skip("Currently failing b/123247844")
-    def test_reconnect(self):
-        """Ensure that a disconnected device reconnects."""
-
-        with fake_adbd() as (port, _):
-            serial = "localhost:{}".format(port)
-            with adb_connect(self, serial):
-                # Wait a bit to give adb some time to connect.
-                time.sleep(0.25)
-
-                output = subprocess.check_output(["adb", "-s", serial,
-                                                  "get-state"])
-                self.assertEqual(output.strip(), b"device")
-
-                # This will fail.
-                proc = subprocess.Popen(["adb", "-s", serial, "shell", "true"],
-                                        stdout=subprocess.PIPE,
-                                        stderr=subprocess.STDOUT)
-                output, _ = proc.communicate()
-                self.assertEqual(output.strip(), b"error: closed")
-
-                subprocess.check_call(["adb", "-s", serial, "wait-for-device"])
-
-                output = subprocess.check_output(["adb", "-s", serial,
-                                                  "get-state"])
-                self.assertEqual(output.strip(), b"device")
-
-                # Once we explicitly kick a device, it won't attempt to
-                # reconnect.
-                output = subprocess.check_output(["adb", "disconnect", serial])
-                self.assertEqual(
-                    output.strip(),
-                    "disconnected {}".format(serial).encode("utf8"))
-                try:
-                    subprocess.check_output(["adb", "-s", serial, "get-state"],
-                                            stderr=subprocess.STDOUT)
-                    self.fail("Device should not be available")
-                except subprocess.CalledProcessError as err:
-                    self.assertEqual(
-                        err.output.strip(),
-                        "error: device '{}' not found".format(serial).encode("utf8"))
-
-
-class DisconnectionTest(unittest.TestCase):
-    """Tests for adb disconnect."""
-
-    def test_disconnect(self):
-        """Ensure that `adb disconnect` takes effect immediately."""
-
-        def _devices(port):
-            output = subprocess.check_output(["adb", "-P", str(port), "devices"])
-            return [x.split("\t") for x in output.decode("utf8").strip().splitlines()[1:]]
-
-        with adb_server() as server_port:
-            with fake_adbd() as (port, sock):
-                device_name = "localhost:{}".format(port)
-                output = subprocess.check_output(["adb", "-P", str(server_port),
-                                                  "connect", device_name])
-                self.assertEqual(output.strip(),
-                                  "connected to {}".format(device_name).encode("utf8"))
-
-
-                self.assertEqual(_devices(server_port), [[device_name, "device"]])
-
-                # Send a deliberately malformed packet to make the device go offline.
-                packet = struct.pack("IIIIII", 0, 0, 0, 0, 0, 0)
-                sock.sendall(packet)
-
-                # Wait a bit.
-                time.sleep(0.1)
-
-                self.assertEqual(_devices(server_port), [[device_name, "offline"]])
-
-                # Disconnect the device.
-                output = subprocess.check_output(["adb", "-P", str(server_port),
-                                                  "disconnect", device_name])
-
-                # Wait a bit.
-                time.sleep(0.1)
-
-                self.assertEqual(_devices(server_port), [])
-
-
-@unittest.skipUnless(sys.platform == "win32", "requires Windows")
-class PowerTest(unittest.TestCase):
-    def test_resume_usb_kick(self):
-        """Resuming from sleep/hibernate should kick USB devices."""
-        try:
-            usb_serial = subprocess.check_output(["adb", "-d", "get-serialno"]).strip()
-        except subprocess.CalledProcessError:
-            # If there are multiple USB devices, we don't have a way to check whether the selected
-            # device is USB.
-            raise unittest.SkipTest('requires single USB device')
-
-        try:
-            serial = subprocess.check_output(["adb", "get-serialno"]).strip()
-        except subprocess.CalledProcessError:
-            # Did you forget to select a device with $ANDROID_SERIAL?
-            raise unittest.SkipTest('requires $ANDROID_SERIAL set to a USB device')
-
-        # Test only works with USB devices because adb _power_notification_thread does not kick
-        # non-USB devices on resume event.
-        if serial != usb_serial:
-            raise unittest.SkipTest('requires USB device')
-
-        # Run an adb shell command in the background that takes a while to complete.
-        proc = subprocess.Popen(['adb', 'shell', 'sleep', '5'])
-
-        # Wait for startup of adb server's _power_notification_thread.
-        time.sleep(0.1)
-
-        # Simulate resuming from sleep/hibernation by sending Windows message.
-        import ctypes
-        from ctypes import wintypes
-        HWND_BROADCAST = 0xffff
-        WM_POWERBROADCAST = 0x218
-        PBT_APMRESUMEAUTOMATIC = 0x12
-
-        PostMessageW = ctypes.windll.user32.PostMessageW
-        PostMessageW.restype = wintypes.BOOL
-        PostMessageW.argtypes = (wintypes.HWND, wintypes.UINT, wintypes.WPARAM, wintypes.LPARAM)
-        result = PostMessageW(HWND_BROADCAST, WM_POWERBROADCAST, PBT_APMRESUMEAUTOMATIC, 0)
-        if not result:
-            raise ctypes.WinError()
-
-        # Wait for connection to adb shell to be broken by _power_notification_thread detecting the
-        # Windows message.
-        start = time.time()
-        proc.wait()
-        end = time.time()
-
-        # If the power event was detected, the adb shell command should be broken very quickly.
-        self.assertLess(end - start, 2)
-
-
-def main():
-    """Main entrypoint."""
-    random.seed(0)
-    unittest.main(verbosity=3)
-
-
-if __name__ == "__main__":
-    main()
diff --git a/adb/test_device.py b/adb/test_device.py
deleted file mode 100755
index 6a9ff89..0000000
--- a/adb/test_device.py
+++ /dev/null
@@ -1,1678 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2015 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.
-#
-from __future__ import print_function
-
-import contextlib
-import hashlib
-import os
-import posixpath
-import random
-import re
-import shlex
-import shutil
-import signal
-import socket
-import string
-import subprocess
-import sys
-import tempfile
-import threading
-import time
-import unittest
-
-from datetime import datetime
-
-import adb
-
-def requires_root(func):
-    def wrapper(self, *args):
-        if self.device.get_prop('ro.debuggable') != '1':
-            raise unittest.SkipTest('requires rootable build')
-
-        was_root = self.device.shell(['id', '-un'])[0].strip() == 'root'
-        if not was_root:
-            self.device.root()
-            self.device.wait()
-
-        try:
-            func(self, *args)
-        finally:
-            if not was_root:
-                self.device.unroot()
-                self.device.wait()
-
-    return wrapper
-
-
-def requires_non_root(func):
-    def wrapper(self, *args):
-        was_root = self.device.shell(['id', '-un'])[0].strip() == 'root'
-        if was_root:
-            self.device.unroot()
-            self.device.wait()
-
-        try:
-            func(self, *args)
-        finally:
-            if was_root:
-                self.device.root()
-                self.device.wait()
-
-    return wrapper
-
-
-class DeviceTest(unittest.TestCase):
-    def setUp(self):
-        self.device = adb.get_device()
-
-
-class AbbTest(DeviceTest):
-    def test_smoke(self):
-        result = subprocess.run(['adb', 'abb'], capture_output=True)
-        self.assertEqual(1, result.returncode)
-        expected_output = b"cmd: No service specified; use -l to list all services\n"
-        self.assertEqual(expected_output, result.stderr)
-
-class ForwardReverseTest(DeviceTest):
-    def _test_no_rebind(self, description, direction_list, direction,
-                       direction_no_rebind, direction_remove_all):
-        msg = direction_list()
-        self.assertEqual('', msg.strip(),
-                         description + ' list must be empty to run this test.')
-
-        # Use --no-rebind with no existing binding
-        direction_no_rebind('tcp:5566', 'tcp:6655')
-        msg = direction_list()
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-
-        # Use --no-rebind with existing binding
-        with self.assertRaises(subprocess.CalledProcessError):
-            direction_no_rebind('tcp:5566', 'tcp:6677')
-        msg = direction_list()
-        self.assertFalse(re.search(r'tcp:5566.+tcp:6677', msg))
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-
-        # Use the absence of --no-rebind with existing binding
-        direction('tcp:5566', 'tcp:6677')
-        msg = direction_list()
-        self.assertFalse(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6677', msg))
-
-        direction_remove_all()
-        msg = direction_list()
-        self.assertEqual('', msg.strip())
-
-    def test_forward_no_rebind(self):
-        self._test_no_rebind('forward', self.device.forward_list,
-                            self.device.forward, self.device.forward_no_rebind,
-                            self.device.forward_remove_all)
-
-    def test_reverse_no_rebind(self):
-        self._test_no_rebind('reverse', self.device.reverse_list,
-                            self.device.reverse, self.device.reverse_no_rebind,
-                            self.device.reverse_remove_all)
-
-    def test_forward(self):
-        msg = self.device.forward_list()
-        self.assertEqual('', msg.strip(),
-                         'Forwarding list must be empty to run this test.')
-        self.device.forward('tcp:5566', 'tcp:6655')
-        msg = self.device.forward_list()
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.device.forward('tcp:7788', 'tcp:8877')
-        msg = self.device.forward_list()
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.assertTrue(re.search(r'tcp:7788.+tcp:8877', msg))
-        self.device.forward_remove('tcp:5566')
-        msg = self.device.forward_list()
-        self.assertFalse(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.assertTrue(re.search(r'tcp:7788.+tcp:8877', msg))
-        self.device.forward_remove_all()
-        msg = self.device.forward_list()
-        self.assertEqual('', msg.strip())
-
-    def test_forward_old_protocol(self):
-        serialno = subprocess.check_output(self.device.adb_cmd + ['get-serialno']).strip()
-
-        msg = self.device.forward_list()
-        self.assertEqual('', msg.strip(),
-                         'Forwarding list must be empty to run this test.')
-
-        s = socket.create_connection(("localhost", 5037))
-        service = b"host-serial:%s:forward:tcp:5566;tcp:6655" % serialno
-        cmd = b"%04x%s" % (len(service), service)
-        s.sendall(cmd)
-
-        msg = self.device.forward_list()
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-
-        self.device.forward_remove_all()
-        msg = self.device.forward_list()
-        self.assertEqual('', msg.strip())
-
-    def test_forward_tcp_port_0(self):
-        self.assertEqual('', self.device.forward_list().strip(),
-                         'Forwarding list must be empty to run this test.')
-
-        try:
-            # If resolving TCP port 0 is supported, `adb forward` will print
-            # the actual port number.
-            port = self.device.forward('tcp:0', 'tcp:8888').strip()
-            if not port:
-                raise unittest.SkipTest('Forwarding tcp:0 is not available.')
-
-            self.assertTrue(re.search(r'tcp:{}.+tcp:8888'.format(port),
-                                      self.device.forward_list()))
-        finally:
-            self.device.forward_remove_all()
-
-    def test_reverse(self):
-        msg = self.device.reverse_list()
-        self.assertEqual('', msg.strip(),
-                         'Reverse forwarding list must be empty to run this test.')
-        self.device.reverse('tcp:5566', 'tcp:6655')
-        msg = self.device.reverse_list()
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.device.reverse('tcp:7788', 'tcp:8877')
-        msg = self.device.reverse_list()
-        self.assertTrue(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.assertTrue(re.search(r'tcp:7788.+tcp:8877', msg))
-        self.device.reverse_remove('tcp:5566')
-        msg = self.device.reverse_list()
-        self.assertFalse(re.search(r'tcp:5566.+tcp:6655', msg))
-        self.assertTrue(re.search(r'tcp:7788.+tcp:8877', msg))
-        self.device.reverse_remove_all()
-        msg = self.device.reverse_list()
-        self.assertEqual('', msg.strip())
-
-    def test_reverse_tcp_port_0(self):
-        self.assertEqual('', self.device.reverse_list().strip(),
-                         'Reverse list must be empty to run this test.')
-
-        try:
-            # If resolving TCP port 0 is supported, `adb reverse` will print
-            # the actual port number.
-            port = self.device.reverse('tcp:0', 'tcp:8888').strip()
-            if not port:
-                raise unittest.SkipTest('Reversing tcp:0 is not available.')
-
-            self.assertTrue(re.search(r'tcp:{}.+tcp:8888'.format(port),
-                                      self.device.reverse_list()))
-        finally:
-            self.device.reverse_remove_all()
-
-    def test_forward_reverse_echo(self):
-        """Send data through adb forward and read it back via adb reverse"""
-        forward_port = 12345
-        reverse_port = forward_port + 1
-        forward_spec = 'tcp:' + str(forward_port)
-        reverse_spec = 'tcp:' + str(reverse_port)
-        forward_setup = False
-        reverse_setup = False
-
-        try:
-            # listen on localhost:forward_port, connect to remote:forward_port
-            self.device.forward(forward_spec, forward_spec)
-            forward_setup = True
-            # listen on remote:forward_port, connect to localhost:reverse_port
-            self.device.reverse(forward_spec, reverse_spec)
-            reverse_setup = True
-
-            listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            with contextlib.closing(listener):
-                # Use SO_REUSEADDR so that subsequent runs of the test can grab
-                # the port even if it is in TIME_WAIT.
-                listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-
-                # Listen on localhost:reverse_port before connecting to
-                # localhost:forward_port because that will cause adb to connect
-                # back to localhost:reverse_port.
-                listener.bind(('127.0.0.1', reverse_port))
-                listener.listen(4)
-
-                client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-                with contextlib.closing(client):
-                    # Connect to the listener.
-                    client.connect(('127.0.0.1', forward_port))
-
-                    # Accept the client connection.
-                    accepted_connection, addr = listener.accept()
-                    with contextlib.closing(accepted_connection) as server:
-                        data = b'hello'
-
-                        # Send data into the port setup by adb forward.
-                        client.sendall(data)
-                        # Explicitly close() so that server gets EOF.
-                        client.close()
-
-                        # Verify that the data came back via adb reverse.
-                        self.assertEqual(data, server.makefile().read().encode("utf8"))
-        finally:
-            if reverse_setup:
-                self.device.reverse_remove(forward_spec)
-            if forward_setup:
-                self.device.forward_remove(forward_spec)
-
-
-class ShellTest(DeviceTest):
-    def _interactive_shell(self, shell_args, input):
-        """Runs an interactive adb shell.
-
-        Args:
-          shell_args: List of string arguments to `adb shell`.
-          input: bytes input to send to the interactive shell.
-
-        Returns:
-          The remote exit code.
-
-        Raises:
-          unittest.SkipTest: The device doesn't support exit codes.
-        """
-        if not self.device.has_shell_protocol():
-            raise unittest.SkipTest('exit codes are unavailable on this device')
-
-        proc = subprocess.Popen(
-                self.device.adb_cmd + ['shell'] + shell_args,
-                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE)
-        # Closing host-side stdin doesn't trigger a PTY shell to exit so we need
-        # to explicitly add an exit command to close the session from the device
-        # side, plus the necessary newline to complete the interactive command.
-        proc.communicate(input + b'; exit\n')
-        return proc.returncode
-
-    def test_cat(self):
-        """Check that we can at least cat a file."""
-        out = self.device.shell(['cat', '/proc/uptime'])[0].strip()
-        elements = out.split()
-        self.assertEqual(len(elements), 2)
-
-        uptime, idle = elements
-        self.assertGreater(float(uptime), 0.0)
-        self.assertGreater(float(idle), 0.0)
-
-    def test_throws_on_failure(self):
-        self.assertRaises(adb.ShellError, self.device.shell, ['false'])
-
-    def test_output_not_stripped(self):
-        out = self.device.shell(['echo', 'foo'])[0]
-        self.assertEqual(out, 'foo' + self.device.linesep)
-
-    def test_shell_command_length(self):
-        # Devices that have shell_v2 should be able to handle long commands.
-        if self.device.has_shell_protocol():
-            rc, out, err = self.device.shell_nocheck(['echo', 'x' * 16384])
-            self.assertEqual(rc, 0)
-            self.assertTrue(out == ('x' * 16384 + '\n'))
-
-    def test_shell_nocheck_failure(self):
-        rc, out, _ = self.device.shell_nocheck(['false'])
-        self.assertNotEqual(rc, 0)
-        self.assertEqual(out, '')
-
-    def test_shell_nocheck_output_not_stripped(self):
-        rc, out, _ = self.device.shell_nocheck(['echo', 'foo'])
-        self.assertEqual(rc, 0)
-        self.assertEqual(out, 'foo' + self.device.linesep)
-
-    def test_can_distinguish_tricky_results(self):
-        # If result checking on ADB shell is naively implemented as
-        # `adb shell <cmd>; echo $?`, we would be unable to distinguish the
-        # output from the result for a cmd of `echo -n 1`.
-        rc, out, _ = self.device.shell_nocheck(['echo', '-n', '1'])
-        self.assertEqual(rc, 0)
-        self.assertEqual(out, '1')
-
-    def test_line_endings(self):
-        """Ensure that line ending translation is not happening in the pty.
-
-        Bug: http://b/19735063
-        """
-        output = self.device.shell(['uname'])[0]
-        self.assertEqual(output, 'Linux' + self.device.linesep)
-
-    def test_pty_logic(self):
-        """Tests that a PTY is allocated when it should be.
-
-        PTY allocation behavior should match ssh.
-        """
-        def check_pty(args):
-            """Checks adb shell PTY allocation.
-
-            Tests |args| for terminal and non-terminal stdin.
-
-            Args:
-                args: -Tt args in a list (e.g. ['-t', '-t']).
-
-            Returns:
-                A tuple (<terminal>, <non-terminal>). True indicates
-                the corresponding shell allocated a remote PTY.
-            """
-            test_cmd = self.device.adb_cmd + ['shell'] + args + ['[ -t 0 ]']
-
-            terminal = subprocess.Popen(
-                    test_cmd, stdin=None,
-                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            terminal.communicate()
-
-            non_terminal = subprocess.Popen(
-                    test_cmd, stdin=subprocess.PIPE,
-                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            non_terminal.communicate()
-
-            return (terminal.returncode == 0, non_terminal.returncode == 0)
-
-        # -T: never allocate PTY.
-        self.assertEqual((False, False), check_pty(['-T']))
-
-        # These tests require a new device.
-        if self.device.has_shell_protocol() and os.isatty(sys.stdin.fileno()):
-            # No args: PTY only if stdin is a terminal and shell is interactive,
-            # which is difficult to reliably test from a script.
-            self.assertEqual((False, False), check_pty([]))
-
-            # -t: PTY if stdin is a terminal.
-            self.assertEqual((True, False), check_pty(['-t']))
-
-        # -t -t: always allocate PTY.
-        self.assertEqual((True, True), check_pty(['-t', '-t']))
-
-        # -tt: always allocate PTY, POSIX style (http://b/32216152).
-        self.assertEqual((True, True), check_pty(['-tt']))
-
-        # -ttt: ssh has weird even/odd behavior with multiple -t flags, but
-        # we follow the man page instead.
-        self.assertEqual((True, True), check_pty(['-ttt']))
-
-        # -ttx: -x and -tt aren't incompatible (though -Tx would be an error).
-        self.assertEqual((True, True), check_pty(['-ttx']))
-
-        # -Ttt: -tt cancels out -T.
-        self.assertEqual((True, True), check_pty(['-Ttt']))
-
-        # -ttT: -T cancels out -tt.
-        self.assertEqual((False, False), check_pty(['-ttT']))
-
-    def test_shell_protocol(self):
-        """Tests the shell protocol on the device.
-
-        If the device supports shell protocol, this gives us the ability
-        to separate stdout/stderr and return the exit code directly.
-
-        Bug: http://b/19734861
-        """
-        if not self.device.has_shell_protocol():
-            raise unittest.SkipTest('shell protocol unsupported on this device')
-
-        # Shell protocol should be used by default.
-        result = self.device.shell_nocheck(
-                shlex.split('echo foo; echo bar >&2; exit 17'))
-        self.assertEqual(17, result[0])
-        self.assertEqual('foo' + self.device.linesep, result[1])
-        self.assertEqual('bar' + self.device.linesep, result[2])
-
-        self.assertEqual(17, self._interactive_shell([], b'exit 17'))
-
-        # -x flag should disable shell protocol.
-        result = self.device.shell_nocheck(
-                shlex.split('-x echo foo; echo bar >&2; exit 17'))
-        self.assertEqual(0, result[0])
-        self.assertEqual('foo{0}bar{0}'.format(self.device.linesep), result[1])
-        self.assertEqual('', result[2])
-
-        self.assertEqual(0, self._interactive_shell(['-x'], b'exit 17'))
-
-    def test_non_interactive_sigint(self):
-        """Tests that SIGINT in a non-interactive shell kills the process.
-
-        This requires the shell protocol in order to detect the broken
-        pipe; raw data transfer mode will only see the break once the
-        subprocess tries to read or write.
-
-        Bug: http://b/23825725
-        """
-        if not self.device.has_shell_protocol():
-            raise unittest.SkipTest('shell protocol unsupported on this device')
-
-        # Start a long-running process.
-        sleep_proc = subprocess.Popen(
-                self.device.adb_cmd + shlex.split('shell echo $$; sleep 60'),
-                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-                stderr=subprocess.STDOUT)
-        remote_pid = sleep_proc.stdout.readline().strip().decode("utf8")
-        self.assertIsNone(sleep_proc.returncode, 'subprocess terminated early')
-        proc_query = shlex.split('ps {0} | grep {0}'.format(remote_pid))
-
-        # Verify that the process is running, send signal, verify it stopped.
-        self.device.shell(proc_query)
-        os.kill(sleep_proc.pid, signal.SIGINT)
-        sleep_proc.communicate()
-
-        # It can take some time for the process to receive the signal and die.
-        end_time = time.time() + 3
-        while self.device.shell_nocheck(proc_query)[0] != 1:
-            self.assertFalse(time.time() > end_time,
-                             'subprocess failed to terminate in time')
-
-    def test_non_interactive_stdin(self):
-        """Tests that non-interactive shells send stdin."""
-        if not self.device.has_shell_protocol():
-            raise unittest.SkipTest('non-interactive stdin unsupported '
-                                    'on this device')
-
-        # Test both small and large inputs.
-        small_input = b'foo'
-        characters = [c.encode("utf8") for c in string.ascii_letters + string.digits]
-        large_input = b'\n'.join(characters)
-
-
-        for input in (small_input, large_input):
-            proc = subprocess.Popen(self.device.adb_cmd + ['shell', 'cat'],
-                                    stdin=subprocess.PIPE,
-                                    stdout=subprocess.PIPE,
-                                    stderr=subprocess.PIPE)
-            stdout, stderr = proc.communicate(input)
-            self.assertEqual(input.splitlines(), stdout.splitlines())
-            self.assertEqual(b'', stderr)
-
-    def test_sighup(self):
-        """Ensure that SIGHUP gets sent upon non-interactive ctrl-c"""
-        log_path = "/data/local/tmp/adb_signal_test.log"
-
-        # Clear the output file.
-        self.device.shell_nocheck(["echo", ">", log_path])
-
-        script = """
-            trap "echo SIGINT > {path}; exit 0" SIGINT
-            trap "echo SIGHUP > {path}; exit 0" SIGHUP
-            echo Waiting
-            read
-        """.format(path=log_path)
-
-        script = ";".join([x.strip() for x in script.strip().splitlines()])
-
-        process = self.device.shell_popen([script], kill_atexit=False,
-                                          stdin=subprocess.PIPE,
-                                          stdout=subprocess.PIPE)
-
-        self.assertEqual(b"Waiting\n", process.stdout.readline())
-        process.send_signal(signal.SIGINT)
-        process.wait()
-
-        # Waiting for the local adb to finish is insufficient, since it hangs
-        # up immediately.
-        time.sleep(1)
-
-        stdout, _ = self.device.shell(["cat", log_path])
-        self.assertEqual(stdout.strip(), "SIGHUP")
-
-    def test_exit_stress(self):
-        """Hammer `adb shell exit 42` with multiple threads."""
-        thread_count = 48
-        result = dict()
-        def hammer(thread_idx, thread_count, result):
-            success = True
-            for i in range(thread_idx, 240, thread_count):
-                ret = subprocess.call(['adb', 'shell', 'exit {}'.format(i)])
-                if ret != i % 256:
-                    success = False
-                    break
-            result[thread_idx] = success
-
-        threads = []
-        for i in range(thread_count):
-            thread = threading.Thread(target=hammer, args=(i, thread_count, result))
-            thread.start()
-            threads.append(thread)
-        for thread in threads:
-            thread.join()
-        for i, success in result.items():
-            self.assertTrue(success)
-
-    def disabled_test_parallel(self):
-        """Spawn a bunch of `adb shell` instances in parallel.
-
-        This was broken historically due to the use of select, which only works
-        for fds that are numerically less than 1024.
-
-        Bug: http://b/141955761"""
-
-        n_procs = 2048
-        procs = dict()
-        for i in range(0, n_procs):
-            procs[i] = subprocess.Popen(
-                ['adb', 'shell', 'read foo; echo $foo; read rc; exit $rc'],
-                stdin=subprocess.PIPE,
-                stdout=subprocess.PIPE
-            )
-
-        for i in range(0, n_procs):
-            procs[i].stdin.write("%d\n" % i)
-
-        for i in range(0, n_procs):
-            response = procs[i].stdout.readline()
-            assert(response == "%d\n" % i)
-
-        for i in range(0, n_procs):
-            procs[i].stdin.write("%d\n" % (i % 256))
-
-        for i in range(0, n_procs):
-            assert(procs[i].wait() == i % 256)
-
-
-class ArgumentEscapingTest(DeviceTest):
-    def test_shell_escaping(self):
-        """Make sure that argument escaping is somewhat sane."""
-
-        # http://b/19734868
-        # Note that this actually matches ssh(1)'s behavior --- it's
-        # converted to `sh -c echo hello; echo world` which sh interprets
-        # as `sh -c echo` (with an argument to that shell of "hello"),
-        # and then `echo world` back in the first shell.
-        result = self.device.shell(
-            shlex.split("sh -c 'echo hello; echo world'"))[0]
-        result = result.splitlines()
-        self.assertEqual(['', 'world'], result)
-        # If you really wanted "hello" and "world", here's what you'd do:
-        result = self.device.shell(
-            shlex.split(r'echo hello\;echo world'))[0].splitlines()
-        self.assertEqual(['hello', 'world'], result)
-
-        # http://b/15479704
-        result = self.device.shell(shlex.split("'true && echo t'"))[0].strip()
-        self.assertEqual('t', result)
-        result = self.device.shell(
-            shlex.split("sh -c 'true && echo t'"))[0].strip()
-        self.assertEqual('t', result)
-
-        # http://b/20564385
-        result = self.device.shell(shlex.split('FOO=a BAR=b echo t'))[0].strip()
-        self.assertEqual('t', result)
-        result = self.device.shell(
-            shlex.split(r'echo -n 123\;uname'))[0].strip()
-        self.assertEqual('123Linux', result)
-
-    def test_install_argument_escaping(self):
-        """Make sure that install argument escaping works."""
-        # http://b/20323053, http://b/3090932.
-        for file_suffix in (b'-text;ls;1.apk', b"-Live Hold'em.apk"):
-            tf = tempfile.NamedTemporaryFile('wb', suffix=file_suffix,
-                                             delete=False)
-            tf.close()
-
-            # Installing bogus .apks fails if the device supports exit codes.
-            try:
-                output = self.device.install(tf.name.decode("utf8"))
-            except subprocess.CalledProcessError as e:
-                output = e.output
-
-            self.assertIn(file_suffix, output)
-            os.remove(tf.name)
-
-
-class RootUnrootTest(DeviceTest):
-    def _test_root(self):
-        message = self.device.root()
-        if 'adbd cannot run as root in production builds' in message:
-            return
-        self.device.wait()
-        self.assertEqual('root', self.device.shell(['id', '-un'])[0].strip())
-
-    def _test_unroot(self):
-        self.device.unroot()
-        self.device.wait()
-        self.assertEqual('shell', self.device.shell(['id', '-un'])[0].strip())
-
-    def test_root_unroot(self):
-        """Make sure that adb root and adb unroot work, using id(1)."""
-        if self.device.get_prop('ro.debuggable') != '1':
-            raise unittest.SkipTest('requires rootable build')
-
-        original_user = self.device.shell(['id', '-un'])[0].strip()
-        try:
-            if original_user == 'root':
-                self._test_unroot()
-                self._test_root()
-            elif original_user == 'shell':
-                self._test_root()
-                self._test_unroot()
-        finally:
-            if original_user == 'root':
-                self.device.root()
-            else:
-                self.device.unroot()
-            self.device.wait()
-
-
-class TcpIpTest(DeviceTest):
-    def test_tcpip_failure_raises(self):
-        """adb tcpip requires a port.
-
-        Bug: http://b/22636927
-        """
-        self.assertRaises(
-            subprocess.CalledProcessError, self.device.tcpip, '')
-        self.assertRaises(
-            subprocess.CalledProcessError, self.device.tcpip, 'foo')
-
-
-class SystemPropertiesTest(DeviceTest):
-    def test_get_prop(self):
-        self.assertEqual(self.device.get_prop('init.svc.adbd'), 'running')
-
-    @requires_root
-    def test_set_prop(self):
-        prop_name = 'foo.bar'
-        self.device.shell(['setprop', prop_name, '""'])
-
-        self.device.set_prop(prop_name, 'qux')
-        self.assertEqual(
-            self.device.shell(['getprop', prop_name])[0].strip(), 'qux')
-
-
-def compute_md5(string):
-    hsh = hashlib.md5()
-    hsh.update(string)
-    return hsh.hexdigest()
-
-
-def get_md5_prog(device):
-    """Older platforms (pre-L) had the name md5 rather than md5sum."""
-    try:
-        device.shell(['md5sum', '/proc/uptime'])
-        return 'md5sum'
-    except adb.ShellError:
-        return 'md5'
-
-
-class HostFile(object):
-    def __init__(self, handle, checksum):
-        self.handle = handle
-        self.checksum = checksum
-        self.full_path = handle.name
-        self.base_name = os.path.basename(self.full_path)
-
-
-class DeviceFile(object):
-    def __init__(self, checksum, full_path):
-        self.checksum = checksum
-        self.full_path = full_path
-        self.base_name = posixpath.basename(self.full_path)
-
-
-def make_random_host_files(in_dir, num_files):
-    min_size = 1 * (1 << 10)
-    max_size = 16 * (1 << 10)
-
-    files = []
-    for _ in range(num_files):
-        file_handle = tempfile.NamedTemporaryFile(dir=in_dir, delete=False)
-
-        size = random.randrange(min_size, max_size, 1024)
-        rand_str = os.urandom(size)
-        file_handle.write(rand_str)
-        file_handle.flush()
-        file_handle.close()
-
-        md5 = compute_md5(rand_str)
-        files.append(HostFile(file_handle, md5))
-    return files
-
-
-def make_random_device_files(device, in_dir, num_files, prefix='device_tmpfile'):
-    min_size = 1 * (1 << 10)
-    max_size = 16 * (1 << 10)
-
-    files = []
-    for file_num in range(num_files):
-        size = random.randrange(min_size, max_size, 1024)
-
-        base_name = prefix + str(file_num)
-        full_path = posixpath.join(in_dir, base_name)
-
-        device.shell(['dd', 'if=/dev/urandom', 'of={}'.format(full_path),
-                      'bs={}'.format(size), 'count=1'])
-        dev_md5, _ = device.shell([get_md5_prog(device), full_path])[0].split()
-
-        files.append(DeviceFile(dev_md5, full_path))
-    return files
-
-
-class FileOperationsTest(DeviceTest):
-    SCRATCH_DIR = '/data/local/tmp'
-    DEVICE_TEMP_FILE = SCRATCH_DIR + '/adb_test_file'
-    DEVICE_TEMP_DIR = SCRATCH_DIR + '/adb_test_dir'
-
-    def _verify_remote(self, checksum, remote_path):
-        dev_md5, _ = self.device.shell([get_md5_prog(self.device),
-                                        remote_path])[0].split()
-        self.assertEqual(checksum, dev_md5)
-
-    def _verify_local(self, checksum, local_path):
-        with open(local_path, 'rb') as host_file:
-            host_md5 = compute_md5(host_file.read())
-            self.assertEqual(host_md5, checksum)
-
-    def test_push(self):
-        """Push a randomly generated file to specified device."""
-        kbytes = 512
-        tmp = tempfile.NamedTemporaryFile(mode='wb', delete=False)
-        rand_str = os.urandom(1024 * kbytes)
-        tmp.write(rand_str)
-        tmp.close()
-
-        self.device.shell(['rm', '-rf', self.DEVICE_TEMP_FILE])
-        self.device.push(local=tmp.name, remote=self.DEVICE_TEMP_FILE)
-
-        self._verify_remote(compute_md5(rand_str), self.DEVICE_TEMP_FILE)
-        self.device.shell(['rm', '-f', self.DEVICE_TEMP_FILE])
-
-        os.remove(tmp.name)
-
-    def test_push_dir(self):
-        """Push a randomly generated directory of files to the device."""
-        self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        self.device.shell(['mkdir', self.DEVICE_TEMP_DIR])
-
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            # Make sure the temp directory isn't setuid, or else adb will complain.
-            os.chmod(host_dir, 0o700)
-
-            # Create 32 random files.
-            temp_files = make_random_host_files(in_dir=host_dir, num_files=32)
-            self.device.push(host_dir, self.DEVICE_TEMP_DIR)
-
-            for temp_file in temp_files:
-                remote_path = posixpath.join(self.DEVICE_TEMP_DIR,
-                                             os.path.basename(host_dir),
-                                             temp_file.base_name)
-                self._verify_remote(temp_file.checksum, remote_path)
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def disabled_test_push_empty(self):
-        """Push an empty directory to the device."""
-        self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        self.device.shell(['mkdir', self.DEVICE_TEMP_DIR])
-
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            # Make sure the temp directory isn't setuid, or else adb will complain.
-            os.chmod(host_dir, 0o700)
-
-            # Create an empty directory.
-            empty_dir_path = os.path.join(host_dir, 'empty')
-            os.mkdir(empty_dir_path);
-
-            self.device.push(empty_dir_path, self.DEVICE_TEMP_DIR)
-
-            remote_path = os.path.join(self.DEVICE_TEMP_DIR, "empty")
-            test_empty_cmd = ["[", "-d", remote_path, "]"]
-            rc, _, _ = self.device.shell_nocheck(test_empty_cmd)
-
-            self.assertEqual(rc, 0)
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    @unittest.skipIf(sys.platform == "win32", "symlinks require elevated privileges on windows")
-    def test_push_symlink(self):
-        """Push a symlink.
-
-        Bug: http://b/31491920
-        """
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            # Make sure the temp directory isn't setuid, or else adb will
-            # complain.
-            os.chmod(host_dir, 0o700)
-
-            with open(os.path.join(host_dir, 'foo'), 'w') as f:
-                f.write('foo')
-
-            symlink_path = os.path.join(host_dir, 'symlink')
-            os.symlink('foo', symlink_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', self.DEVICE_TEMP_DIR])
-            self.device.push(symlink_path, self.DEVICE_TEMP_DIR)
-            rc, out, _ = self.device.shell_nocheck(
-                ['cat', posixpath.join(self.DEVICE_TEMP_DIR, 'symlink')])
-            self.assertEqual(0, rc)
-            self.assertEqual(out.strip(), 'foo')
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def test_multiple_push(self):
-        """Push multiple files to the device in one adb push command.
-
-        Bug: http://b/25324823
-        """
-
-        self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        self.device.shell(['mkdir', self.DEVICE_TEMP_DIR])
-
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            # Create some random files and a subdirectory containing more files.
-            temp_files = make_random_host_files(in_dir=host_dir, num_files=4)
-
-            subdir = os.path.join(host_dir, 'subdir')
-            os.mkdir(subdir)
-            subdir_temp_files = make_random_host_files(in_dir=subdir,
-                                                       num_files=4)
-
-            paths = [x.full_path for x in temp_files]
-            paths.append(subdir)
-            self.device._simple_call(['push'] + paths + [self.DEVICE_TEMP_DIR])
-
-            for temp_file in temp_files:
-                remote_path = posixpath.join(self.DEVICE_TEMP_DIR,
-                                             temp_file.base_name)
-                self._verify_remote(temp_file.checksum, remote_path)
-
-            for subdir_temp_file in subdir_temp_files:
-                remote_path = posixpath.join(self.DEVICE_TEMP_DIR,
-                                             # BROKEN: http://b/25394682
-                                             # 'subdir';
-                                             temp_file.base_name)
-                self._verify_remote(temp_file.checksum, remote_path)
-
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    @requires_non_root
-    def test_push_error_reporting(self):
-        """Make sure that errors that occur while pushing a file get reported
-
-        Bug: http://b/26816782
-        """
-        with tempfile.NamedTemporaryFile() as tmp_file:
-            tmp_file.write(b'\0' * 1024 * 1024)
-            tmp_file.flush()
-            try:
-                self.device.push(local=tmp_file.name, remote='/system/')
-                self.fail('push should not have succeeded')
-            except subprocess.CalledProcessError as e:
-                output = e.output
-
-            self.assertTrue(b'Permission denied' in output or
-                            b'Read-only file system' in output)
-
-    @requires_non_root
-    def test_push_directory_creation(self):
-        """Regression test for directory creation.
-
-        Bug: http://b/110953234
-        """
-        with tempfile.NamedTemporaryFile() as tmp_file:
-            tmp_file.write(b'\0' * 1024 * 1024)
-            tmp_file.flush()
-            remote_path = self.DEVICE_TEMP_DIR + '/test_push_directory_creation'
-            self.device.shell(['rm', '-rf', remote_path])
-
-            remote_path += '/filename'
-            self.device.push(local=tmp_file.name, remote=remote_path)
-
-    def disabled_test_push_multiple_slash_root(self):
-        """Regression test for pushing to //data/local/tmp.
-
-        Bug: http://b/141311284
-
-        Disabled because this broken on the adbd side as well: b/141943968
-        """
-        with tempfile.NamedTemporaryFile() as tmp_file:
-            tmp_file.write('\0' * 1024 * 1024)
-            tmp_file.flush()
-            remote_path = '/' + self.DEVICE_TEMP_DIR + '/test_push_multiple_slash_root'
-            self.device.shell(['rm', '-rf', remote_path])
-            self.device.push(local=tmp_file.name, remote=remote_path)
-
-    def _test_pull(self, remote_file, checksum):
-        tmp_write = tempfile.NamedTemporaryFile(mode='wb', delete=False)
-        tmp_write.close()
-        self.device.pull(remote=remote_file, local=tmp_write.name)
-        with open(tmp_write.name, 'rb') as tmp_read:
-            host_contents = tmp_read.read()
-            host_md5 = compute_md5(host_contents)
-        self.assertEqual(checksum, host_md5)
-        os.remove(tmp_write.name)
-
-    @requires_non_root
-    def test_pull_error_reporting(self):
-        self.device.shell(['touch', self.DEVICE_TEMP_FILE])
-        self.device.shell(['chmod', 'a-rwx', self.DEVICE_TEMP_FILE])
-
-        try:
-            output = self.device.pull(remote=self.DEVICE_TEMP_FILE, local='x')
-        except subprocess.CalledProcessError as e:
-            output = e.output
-
-        self.assertIn(b'Permission denied', output)
-
-        self.device.shell(['rm', '-f', self.DEVICE_TEMP_FILE])
-
-    def test_pull(self):
-        """Pull a randomly generated file from specified device."""
-        kbytes = 512
-        self.device.shell(['rm', '-rf', self.DEVICE_TEMP_FILE])
-        cmd = ['dd', 'if=/dev/urandom',
-               'of={}'.format(self.DEVICE_TEMP_FILE), 'bs=1024',
-               'count={}'.format(kbytes)]
-        self.device.shell(cmd)
-        dev_md5, _ = self.device.shell(
-            [get_md5_prog(self.device), self.DEVICE_TEMP_FILE])[0].split()
-        self._test_pull(self.DEVICE_TEMP_FILE, dev_md5)
-        self.device.shell_nocheck(['rm', self.DEVICE_TEMP_FILE])
-
-    def test_pull_dir(self):
-        """Pull a randomly generated directory of files from the device."""
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', self.DEVICE_TEMP_DIR])
-
-            # Populate device directory with random files.
-            temp_files = make_random_device_files(
-                self.device, in_dir=self.DEVICE_TEMP_DIR, num_files=32)
-
-            self.device.pull(remote=self.DEVICE_TEMP_DIR, local=host_dir)
-
-            for temp_file in temp_files:
-                host_path = os.path.join(
-                    host_dir, posixpath.basename(self.DEVICE_TEMP_DIR),
-                    temp_file.base_name)
-                self._verify_local(temp_file.checksum, host_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def test_pull_dir_symlink(self):
-        """Pull a directory into a symlink to a directory.
-
-        Bug: http://b/27362811
-        """
-        if os.name != 'posix':
-            raise unittest.SkipTest('requires POSIX')
-
-        try:
-            host_dir = tempfile.mkdtemp()
-            real_dir = os.path.join(host_dir, 'dir')
-            symlink = os.path.join(host_dir, 'symlink')
-            os.mkdir(real_dir)
-            os.symlink(real_dir, symlink)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', self.DEVICE_TEMP_DIR])
-
-            # Populate device directory with random files.
-            temp_files = make_random_device_files(
-                self.device, in_dir=self.DEVICE_TEMP_DIR, num_files=32)
-
-            self.device.pull(remote=self.DEVICE_TEMP_DIR, local=symlink)
-
-            for temp_file in temp_files:
-                host_path = os.path.join(
-                    real_dir, posixpath.basename(self.DEVICE_TEMP_DIR),
-                    temp_file.base_name)
-                self._verify_local(temp_file.checksum, host_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def test_pull_dir_symlink_collision(self):
-        """Pull a directory into a colliding symlink to directory."""
-        if os.name != 'posix':
-            raise unittest.SkipTest('requires POSIX')
-
-        try:
-            host_dir = tempfile.mkdtemp()
-            real_dir = os.path.join(host_dir, 'real')
-            tmp_dirname = os.path.basename(self.DEVICE_TEMP_DIR)
-            symlink = os.path.join(host_dir, tmp_dirname)
-            os.mkdir(real_dir)
-            os.symlink(real_dir, symlink)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', self.DEVICE_TEMP_DIR])
-
-            # Populate device directory with random files.
-            temp_files = make_random_device_files(
-                self.device, in_dir=self.DEVICE_TEMP_DIR, num_files=32)
-
-            self.device.pull(remote=self.DEVICE_TEMP_DIR, local=host_dir)
-
-            for temp_file in temp_files:
-                host_path = os.path.join(real_dir, temp_file.base_name)
-                self._verify_local(temp_file.checksum, host_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def test_pull_dir_nonexistent(self):
-        """Pull a directory of files from the device to a nonexistent path."""
-        try:
-            host_dir = tempfile.mkdtemp()
-            dest_dir = os.path.join(host_dir, 'dest')
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', self.DEVICE_TEMP_DIR])
-
-            # Populate device directory with random files.
-            temp_files = make_random_device_files(
-                self.device, in_dir=self.DEVICE_TEMP_DIR, num_files=32)
-
-            self.device.pull(remote=self.DEVICE_TEMP_DIR, local=dest_dir)
-
-            for temp_file in temp_files:
-                host_path = os.path.join(dest_dir, temp_file.base_name)
-                self._verify_local(temp_file.checksum, host_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    # selinux prevents adbd from accessing symlinks on /data/local/tmp.
-    def disabled_test_pull_symlink_dir(self):
-        """Pull a symlink to a directory of symlinks to files."""
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            remote_dir = posixpath.join(self.DEVICE_TEMP_DIR, 'contents')
-            remote_links = posixpath.join(self.DEVICE_TEMP_DIR, 'links')
-            remote_symlink = posixpath.join(self.DEVICE_TEMP_DIR, 'symlink')
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', remote_dir, remote_links])
-            self.device.shell(['ln', '-s', remote_links, remote_symlink])
-
-            # Populate device directory with random files.
-            temp_files = make_random_device_files(
-                self.device, in_dir=remote_dir, num_files=32)
-
-            for temp_file in temp_files:
-                self.device.shell(
-                    ['ln', '-s', '../contents/{}'.format(temp_file.base_name),
-                     posixpath.join(remote_links, temp_file.base_name)])
-
-            self.device.pull(remote=remote_symlink, local=host_dir)
-
-            for temp_file in temp_files:
-                host_path = os.path.join(
-                    host_dir, 'symlink', temp_file.base_name)
-                self._verify_local(temp_file.checksum, host_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def test_pull_empty(self):
-        """Pull a directory containing an empty directory from the device."""
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            remote_empty_path = posixpath.join(self.DEVICE_TEMP_DIR, 'empty')
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', remote_empty_path])
-
-            self.device.pull(remote=remote_empty_path, local=host_dir)
-            self.assertTrue(os.path.isdir(os.path.join(host_dir, 'empty')))
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def test_multiple_pull(self):
-        """Pull a randomly generated directory of files from the device."""
-
-        try:
-            host_dir = tempfile.mkdtemp()
-
-            subdir = posixpath.join(self.DEVICE_TEMP_DIR, 'subdir')
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-            self.device.shell(['mkdir', '-p', subdir])
-
-            # Create some random files and a subdirectory containing more files.
-            temp_files = make_random_device_files(
-                self.device, in_dir=self.DEVICE_TEMP_DIR, num_files=4)
-
-            subdir_temp_files = make_random_device_files(
-                self.device, in_dir=subdir, num_files=4, prefix='subdir_')
-
-            paths = [x.full_path for x in temp_files]
-            paths.append(subdir)
-            self.device._simple_call(['pull'] + paths + [host_dir])
-
-            for temp_file in temp_files:
-                local_path = os.path.join(host_dir, temp_file.base_name)
-                self._verify_local(temp_file.checksum, local_path)
-
-            for subdir_temp_file in subdir_temp_files:
-                local_path = os.path.join(host_dir,
-                                          'subdir',
-                                          subdir_temp_file.base_name)
-                self._verify_local(subdir_temp_file.checksum, local_path)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if host_dir is not None:
-                shutil.rmtree(host_dir)
-
-    def verify_sync(self, device, temp_files, device_dir):
-        """Verifies that a list of temp files was synced to the device."""
-        # Confirm that every file on the device mirrors that on the host.
-        for temp_file in temp_files:
-            device_full_path = posixpath.join(
-                device_dir, temp_file.base_name)
-            dev_md5, _ = device.shell(
-                [get_md5_prog(self.device), device_full_path])[0].split()
-            self.assertEqual(temp_file.checksum, dev_md5)
-
-    def test_sync(self):
-        """Sync a host directory to the data partition."""
-
-        try:
-            base_dir = tempfile.mkdtemp()
-
-            # Create mirror device directory hierarchy within base_dir.
-            full_dir_path = base_dir + self.DEVICE_TEMP_DIR
-            os.makedirs(full_dir_path)
-
-            # Create 32 random files within the host mirror.
-            temp_files = make_random_host_files(
-                in_dir=full_dir_path, num_files=32)
-
-            # Clean up any stale files on the device.
-            device = adb.get_device()  # pylint: disable=no-member
-            device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-
-            old_product_out = os.environ.get('ANDROID_PRODUCT_OUT')
-            os.environ['ANDROID_PRODUCT_OUT'] = base_dir
-            device.sync('data')
-            if old_product_out is None:
-                del os.environ['ANDROID_PRODUCT_OUT']
-            else:
-                os.environ['ANDROID_PRODUCT_OUT'] = old_product_out
-
-            self.verify_sync(device, temp_files, self.DEVICE_TEMP_DIR)
-
-            #self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if base_dir is not None:
-                shutil.rmtree(base_dir)
-
-    def test_push_sync(self):
-        """Sync a host directory to a specific path."""
-
-        try:
-            temp_dir = tempfile.mkdtemp()
-            temp_files = make_random_host_files(in_dir=temp_dir, num_files=32)
-
-            device_dir = posixpath.join(self.DEVICE_TEMP_DIR, 'sync_src_dst')
-
-            # Clean up any stale files on the device.
-            device = adb.get_device()  # pylint: disable=no-member
-            device.shell(['rm', '-rf', device_dir])
-
-            device.push(temp_dir, device_dir, sync=True)
-
-            self.verify_sync(device, temp_files, device_dir)
-
-            self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
-        finally:
-            if temp_dir is not None:
-                shutil.rmtree(temp_dir)
-
-    def test_unicode_paths(self):
-        """Ensure that we can support non-ASCII paths, even on Windows."""
-        name = u'로보카 폴리'
-
-        self.device.shell(['rm', '-f', '/data/local/tmp/adb-test-*'])
-        remote_path = u'/data/local/tmp/adb-test-{}'.format(name)
-
-        ## push.
-        tf = tempfile.NamedTemporaryFile('wb', suffix=name, delete=False)
-        tf.close()
-        self.device.push(tf.name, remote_path)
-        os.remove(tf.name)
-        self.assertFalse(os.path.exists(tf.name))
-
-        # Verify that the device ended up with the expected UTF-8 path
-        output = self.device.shell(
-                ['ls', '/data/local/tmp/adb-test-*'])[0].strip()
-        self.assertEqual(remote_path, output)
-
-        # pull.
-        self.device.pull(remote_path, tf.name)
-        self.assertTrue(os.path.exists(tf.name))
-        os.remove(tf.name)
-        self.device.shell(['rm', '-f', '/data/local/tmp/adb-test-*'])
-
-
-class DeviceOfflineTest(DeviceTest):
-    def _get_device_state(self, serialno):
-        output = subprocess.check_output(self.device.adb_cmd + ['devices'])
-        for line in output.split('\n'):
-            m = re.match('(\S+)\s+(\S+)', line)
-            if m and m.group(1) == serialno:
-                return m.group(2)
-        return None
-
-    def disabled_test_killed_when_pushing_a_large_file(self):
-        """
-           While running adb push with a large file, kill adb server.
-           Occasionally the device becomes offline. Because the device is still
-           reading data without realizing that the adb server has been restarted.
-           Test if we can bring the device online automatically now.
-           http://b/32952319
-        """
-        serialno = subprocess.check_output(self.device.adb_cmd + ['get-serialno']).strip()
-        # 1. Push a large file
-        file_path = 'tmp_large_file'
-        try:
-            fh = open(file_path, 'w')
-            fh.write('\0' * (100 * 1024 * 1024))
-            fh.close()
-            subproc = subprocess.Popen(self.device.adb_cmd + ['push', file_path, '/data/local/tmp'])
-            time.sleep(0.1)
-            # 2. Kill the adb server
-            subprocess.check_call(self.device.adb_cmd + ['kill-server'])
-            subproc.terminate()
-        finally:
-            try:
-                os.unlink(file_path)
-            except:
-                pass
-        # 3. See if the device still exist.
-        # Sleep to wait for the adb server exit.
-        time.sleep(0.5)
-        # 4. The device should be online
-        self.assertEqual(self._get_device_state(serialno), 'device')
-
-    def disabled_test_killed_when_pulling_a_large_file(self):
-        """
-           While running adb pull with a large file, kill adb server.
-           Occasionally the device can't be connected. Because the device is trying to
-           send a message larger than what is expected by the adb server.
-           Test if we can bring the device online automatically now.
-        """
-        serialno = subprocess.check_output(self.device.adb_cmd + ['get-serialno']).strip()
-        file_path = 'tmp_large_file'
-        try:
-            # 1. Create a large file on device.
-            self.device.shell(['dd', 'if=/dev/zero', 'of=/data/local/tmp/tmp_large_file',
-                               'bs=1000000', 'count=100'])
-            # 2. Pull the large file on host.
-            subproc = subprocess.Popen(self.device.adb_cmd +
-                                       ['pull','/data/local/tmp/tmp_large_file', file_path])
-            time.sleep(0.1)
-            # 3. Kill the adb server
-            subprocess.check_call(self.device.adb_cmd + ['kill-server'])
-            subproc.terminate()
-        finally:
-            try:
-                os.unlink(file_path)
-            except:
-                pass
-        # 4. See if the device still exist.
-        # Sleep to wait for the adb server exit.
-        time.sleep(0.5)
-        self.assertEqual(self._get_device_state(serialno), 'device')
-
-
-    def test_packet_size_regression(self):
-        """Test for http://b/37783561
-
-        Receiving packets of a length divisible by 512 but not 1024 resulted in
-        the adb client waiting indefinitely for more input.
-        """
-        # The values that trigger things are 507 (512 - 5 bytes from shell protocol) + 1024*n
-        # Probe some surrounding values as well, for the hell of it.
-        for base in [512] + list(range(1024, 1024 * 16, 1024)):
-            for offset in [-6, -5, -4]:
-                length = base + offset
-                cmd = ['dd', 'if=/dev/zero', 'bs={}'.format(length), 'count=1', '2>/dev/null;'
-                       'echo', 'foo']
-                rc, stdout, _ = self.device.shell_nocheck(cmd)
-
-                self.assertEqual(0, rc)
-
-                # Output should be '\0' * length, followed by "foo\n"
-                self.assertEqual(length, len(stdout) - 4)
-                self.assertEqual(stdout, "\0" * length + "foo\n")
-
-    def test_zero_packet(self):
-        """Test for http://b/113070258
-
-        Make sure that we don't blow up when sending USB transfers that line up
-        exactly with the USB packet size.
-        """
-
-        local_port = int(self.device.forward("tcp:0", "tcp:12345"))
-        try:
-            for size in [512, 1024]:
-                def listener():
-                    cmd = ["echo foo | nc -l -p 12345; echo done"]
-                    rc, stdout, stderr = self.device.shell_nocheck(cmd)
-
-                thread = threading.Thread(target=listener)
-                thread.start()
-
-                # Wait a bit to let the shell command start.
-                time.sleep(0.25)
-
-                sock = socket.create_connection(("localhost", local_port))
-                with contextlib.closing(sock):
-                    bytesWritten = sock.send(b"a" * size)
-                    self.assertEqual(size, bytesWritten)
-                    readBytes = sock.recv(4096)
-                    self.assertEqual(b"foo\n", readBytes)
-
-                thread.join()
-        finally:
-            self.device.forward_remove("tcp:{}".format(local_port))
-
-
-class SocketTest(DeviceTest):
-    def test_socket_flush(self):
-        """Test that we handle socket closure properly.
-
-        If we're done writing to a socket, closing before the other end has
-        closed will send a TCP_RST if we have incoming data queued up, which
-        may result in data that we've written being discarded.
-
-        Bug: http://b/74616284
-        """
-        s = socket.create_connection(("localhost", 5037))
-
-        def adb_length_prefixed(string):
-            encoded = string.encode("utf8")
-            result = b"%04x%s" % (len(encoded), encoded)
-            return result
-
-        if "ANDROID_SERIAL" in os.environ:
-            transport_string = "host:transport:" + os.environ["ANDROID_SERIAL"]
-        else:
-            transport_string = "host:transport-any"
-
-        s.sendall(adb_length_prefixed(transport_string))
-        response = s.recv(4)
-        self.assertEqual(b"OKAY", response)
-
-        shell_string = "shell:sleep 0.5; dd if=/dev/zero bs=1m count=1 status=none; echo foo"
-        s.sendall(adb_length_prefixed(shell_string))
-
-        response = s.recv(4)
-        self.assertEqual(b"OKAY", response)
-
-        # Spawn a thread that dumps garbage into the socket until failure.
-        def spam():
-            buf = b"\0" * 16384
-            try:
-                while True:
-                    s.sendall(buf)
-            except Exception as ex:
-                print(ex)
-
-        thread = threading.Thread(target=spam)
-        thread.start()
-
-        time.sleep(1)
-
-        received = b""
-        while True:
-            read = s.recv(512)
-            if len(read) == 0:
-                break
-            received += read
-
-        self.assertEqual(1024 * 1024 + len("foo\n"), len(received))
-        thread.join()
-
-
-if sys.platform == "win32":
-    # From https://stackoverflow.com/a/38749458
-    import os
-    import contextlib
-    import msvcrt
-    import ctypes
-    from ctypes import wintypes
-
-    kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
-
-    GENERIC_READ  = 0x80000000
-    GENERIC_WRITE = 0x40000000
-    FILE_SHARE_READ  = 1
-    FILE_SHARE_WRITE = 2
-    CONSOLE_TEXTMODE_BUFFER = 1
-    INVALID_HANDLE_VALUE = wintypes.HANDLE(-1).value
-    STD_OUTPUT_HANDLE = wintypes.DWORD(-11)
-    STD_ERROR_HANDLE = wintypes.DWORD(-12)
-
-    def _check_zero(result, func, args):
-        if not result:
-            raise ctypes.WinError(ctypes.get_last_error())
-        return args
-
-    def _check_invalid(result, func, args):
-        if result == INVALID_HANDLE_VALUE:
-            raise ctypes.WinError(ctypes.get_last_error())
-        return args
-
-    if not hasattr(wintypes, 'LPDWORD'): # Python 2
-        wintypes.LPDWORD = ctypes.POINTER(wintypes.DWORD)
-        wintypes.PSMALL_RECT = ctypes.POINTER(wintypes.SMALL_RECT)
-
-    class COORD(ctypes.Structure):
-        _fields_ = (('X', wintypes.SHORT),
-                    ('Y', wintypes.SHORT))
-
-    class CONSOLE_SCREEN_BUFFER_INFOEX(ctypes.Structure):
-        _fields_ = (('cbSize',               wintypes.ULONG),
-                    ('dwSize',               COORD),
-                    ('dwCursorPosition',     COORD),
-                    ('wAttributes',          wintypes.WORD),
-                    ('srWindow',             wintypes.SMALL_RECT),
-                    ('dwMaximumWindowSize',  COORD),
-                    ('wPopupAttributes',     wintypes.WORD),
-                    ('bFullscreenSupported', wintypes.BOOL),
-                    ('ColorTable',           wintypes.DWORD * 16))
-        def __init__(self, *args, **kwds):
-            super(CONSOLE_SCREEN_BUFFER_INFOEX, self).__init__(
-                    *args, **kwds)
-            self.cbSize = ctypes.sizeof(self)
-
-    PCONSOLE_SCREEN_BUFFER_INFOEX = ctypes.POINTER(
-                                        CONSOLE_SCREEN_BUFFER_INFOEX)
-    LPSECURITY_ATTRIBUTES = wintypes.LPVOID
-
-    kernel32.GetStdHandle.errcheck = _check_invalid
-    kernel32.GetStdHandle.restype = wintypes.HANDLE
-    kernel32.GetStdHandle.argtypes = (
-        wintypes.DWORD,) # _In_ nStdHandle
-
-    kernel32.CreateConsoleScreenBuffer.errcheck = _check_invalid
-    kernel32.CreateConsoleScreenBuffer.restype = wintypes.HANDLE
-    kernel32.CreateConsoleScreenBuffer.argtypes = (
-        wintypes.DWORD,        # _In_       dwDesiredAccess
-        wintypes.DWORD,        # _In_       dwShareMode
-        LPSECURITY_ATTRIBUTES, # _In_opt_   lpSecurityAttributes
-        wintypes.DWORD,        # _In_       dwFlags
-        wintypes.LPVOID)       # _Reserved_ lpScreenBufferData
-
-    kernel32.GetConsoleScreenBufferInfoEx.errcheck = _check_zero
-    kernel32.GetConsoleScreenBufferInfoEx.argtypes = (
-        wintypes.HANDLE,               # _In_  hConsoleOutput
-        PCONSOLE_SCREEN_BUFFER_INFOEX) # _Out_ lpConsoleScreenBufferInfo
-
-    kernel32.SetConsoleScreenBufferInfoEx.errcheck = _check_zero
-    kernel32.SetConsoleScreenBufferInfoEx.argtypes = (
-        wintypes.HANDLE,               # _In_  hConsoleOutput
-        PCONSOLE_SCREEN_BUFFER_INFOEX) # _In_  lpConsoleScreenBufferInfo
-
-    kernel32.SetConsoleWindowInfo.errcheck = _check_zero
-    kernel32.SetConsoleWindowInfo.argtypes = (
-        wintypes.HANDLE,      # _In_ hConsoleOutput
-        wintypes.BOOL,        # _In_ bAbsolute
-        wintypes.PSMALL_RECT) # _In_ lpConsoleWindow
-
-    kernel32.FillConsoleOutputCharacterW.errcheck = _check_zero
-    kernel32.FillConsoleOutputCharacterW.argtypes = (
-        wintypes.HANDLE,  # _In_  hConsoleOutput
-        wintypes.WCHAR,   # _In_  cCharacter
-        wintypes.DWORD,   # _In_  nLength
-        COORD,            # _In_  dwWriteCoord
-        wintypes.LPDWORD) # _Out_ lpNumberOfCharsWritten
-
-    kernel32.ReadConsoleOutputCharacterW.errcheck = _check_zero
-    kernel32.ReadConsoleOutputCharacterW.argtypes = (
-        wintypes.HANDLE,  # _In_  hConsoleOutput
-        wintypes.LPWSTR,  # _Out_ lpCharacter
-        wintypes.DWORD,   # _In_  nLength
-        COORD,            # _In_  dwReadCoord
-        wintypes.LPDWORD) # _Out_ lpNumberOfCharsRead
-
-    @contextlib.contextmanager
-    def allocate_console():
-        allocated = kernel32.AllocConsole()
-        try:
-            yield allocated
-        finally:
-            if allocated:
-                kernel32.FreeConsole()
-
-    @contextlib.contextmanager
-    def console_screen(ncols=None, nrows=None):
-        info = CONSOLE_SCREEN_BUFFER_INFOEX()
-        new_info = CONSOLE_SCREEN_BUFFER_INFOEX()
-        nwritten = (wintypes.DWORD * 1)()
-        hStdOut = kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
-        kernel32.GetConsoleScreenBufferInfoEx(
-               hStdOut, ctypes.byref(info))
-        if ncols is None:
-            ncols = info.dwSize.X
-        if nrows is None:
-            nrows = info.dwSize.Y
-        elif nrows > 9999:
-            raise ValueError('nrows must be 9999 or less')
-        fd_screen = None
-        hScreen = kernel32.CreateConsoleScreenBuffer(
-                    GENERIC_READ | GENERIC_WRITE,
-                    FILE_SHARE_READ | FILE_SHARE_WRITE,
-                    None, CONSOLE_TEXTMODE_BUFFER, None)
-        try:
-            fd_screen = msvcrt.open_osfhandle(
-                            hScreen, os.O_RDWR | os.O_BINARY)
-            kernel32.GetConsoleScreenBufferInfoEx(
-                   hScreen, ctypes.byref(new_info))
-            new_info.dwSize = COORD(ncols, nrows)
-            new_info.srWindow = wintypes.SMALL_RECT(
-                    Left=0, Top=0, Right=(ncols - 1),
-                    Bottom=(info.srWindow.Bottom - info.srWindow.Top))
-            kernel32.SetConsoleScreenBufferInfoEx(
-                    hScreen, ctypes.byref(new_info))
-            kernel32.SetConsoleWindowInfo(hScreen, True,
-                    ctypes.byref(new_info.srWindow))
-            kernel32.FillConsoleOutputCharacterW(
-                    hScreen, u'\0', ncols * nrows, COORD(0,0), nwritten)
-            kernel32.SetConsoleActiveScreenBuffer(hScreen)
-            try:
-                yield fd_screen
-            finally:
-                kernel32.SetConsoleScreenBufferInfoEx(
-                    hStdOut, ctypes.byref(info))
-                kernel32.SetConsoleWindowInfo(hStdOut, True,
-                        ctypes.byref(info.srWindow))
-                kernel32.SetConsoleActiveScreenBuffer(hStdOut)
-        finally:
-            if fd_screen is not None:
-                os.close(fd_screen)
-            else:
-                kernel32.CloseHandle(hScreen)
-
-    def read_screen(fd):
-        hScreen = msvcrt.get_osfhandle(fd)
-        csbi = CONSOLE_SCREEN_BUFFER_INFOEX()
-        kernel32.GetConsoleScreenBufferInfoEx(
-            hScreen, ctypes.byref(csbi))
-        ncols = csbi.dwSize.X
-        pos = csbi.dwCursorPosition
-        length = ncols * pos.Y + pos.X + 1
-        buf = (ctypes.c_wchar * length)()
-        n = (wintypes.DWORD * 1)()
-        kernel32.ReadConsoleOutputCharacterW(
-            hScreen, buf, length, COORD(0,0), n)
-        lines = [buf[i:i+ncols].rstrip(u'\0')
-                    for i in range(0, n[0], ncols)]
-        return u'\n'.join(lines)
-
-@unittest.skipUnless(sys.platform == "win32", "requires Windows")
-class WindowsConsoleTest(DeviceTest):
-    def test_unicode_output(self):
-        """Test Unicode command line parameters and Unicode console window output.
-
-        Bug: https://issuetracker.google.com/issues/111972753
-        """
-        # If we don't have a console window, allocate one. This isn't necessary if we're already
-        # being run from a console window, which is typical.
-        with allocate_console() as allocated_console:
-            # Create a temporary console buffer and switch to it. We could also pass a parameter of
-            # ncols=len(unicode_string), but it causes the window to flash as it is resized and
-            # likely unnecessary given the typical console window size.
-            with console_screen(nrows=1000) as screen:
-                unicode_string = u'로보카 폴리'
-                # Run adb and allow it to detect that stdout is a console, not a pipe, by using
-                # device.shell_popen() which does not use a pipe, unlike device.shell().
-                process = self.device.shell_popen(['echo', '"' + unicode_string + '"'])
-                process.wait()
-                # Read what was written by adb to the temporary console buffer.
-                console_output = read_screen(screen)
-                self.assertEqual(unicode_string, console_output)
-
-
-def main():
-    random.seed(0)
-    if len(adb.get_devices()) > 0:
-        suite = unittest.TestLoader().loadTestsFromName(__name__)
-        unittest.TextTestRunner(verbosity=3).run(suite)
-    else:
-        print('Test suite must be run with attached devices')
-
-
-if __name__ == '__main__':
-    main()
diff --git a/adb/tls/Android.bp b/adb/tls/Android.bp
deleted file mode 100644
index e5204f3..0000000
--- a/adb/tls/Android.bp
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (C) 2020 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.
-
-cc_defaults {
-    name: "libadb_tls_connection_defaults",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Wthread-safety",
-        "-Werror",
-    ],
-
-    compile_multilib: "both",
-
-    srcs: [
-        "adb_ca_list.cpp",
-        "tls_connection.cpp",
-    ],
-    target: {
-        windows: {
-            compile_multilib: "first",
-            enabled: true,
-        },
-    },
-    export_include_dirs: ["include"],
-
-    host_supported: true,
-    recovery_available: true,
-
-    visibility: [
-        "//bootable/recovery/minadbd:__subpackages__",
-        "//system/core/adb:__subpackages__",
-    ],
-
-    shared_libs: [
-        "libbase",
-        "libcrypto",
-        "liblog",
-        "libssl",
-    ],
-}
-
-cc_library {
-    name: "libadb_tls_connection",
-    defaults: ["libadb_tls_connection_defaults"],
-
-    apex_available: [
-        "com.android.adbd",
-        "test_com.android.adbd",
-    ],
-}
-
-// For running atest (b/147158681)
-cc_library_static {
-    name: "libadb_tls_connection_static",
-    defaults: ["libadb_tls_connection_defaults"],
-
-    apex_available: [
-        "//apex_available:platform",
-    ],
-}
diff --git a/adb/tls/adb_ca_list.cpp b/adb/tls/adb_ca_list.cpp
deleted file mode 100644
index 36afe42..0000000
--- a/adb/tls/adb_ca_list.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "adb/tls/adb_ca_list.h"
-
-#include <iomanip>
-#include <sstream>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <openssl/ssl.h>
-
-namespace adb {
-namespace tls {
-
-namespace {
-
-// CA issuer identifier to distinguished embedded keys. Also has version
-// information appended to the end of the string (e.g. "AdbKey-0").
-static constexpr int kAdbKeyIdentifierNid = NID_organizationName;
-static constexpr char kAdbKeyIdentifierV0[] = "AdbKey-0";
-
-// Where we store the actual data
-static constexpr int kAdbKeyValueNid = NID_commonName;
-
-// TODO: Remove this once X509_NAME_add_entry_by_NID is fixed to use const unsigned char*
-// https://boringssl-review.googlesource.com/c/boringssl/+/39764
-int X509_NAME_add_entry_by_NID_const(X509_NAME* name, int nid, int type, const unsigned char* bytes,
-                                     int len, int loc, int set) {
-    return X509_NAME_add_entry_by_NID(name, nid, type, const_cast<unsigned char*>(bytes), len, loc,
-                                      set);
-}
-
-bool IsHexDigit(char c) {
-    return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
-}
-
-// Wrapper around X509_NAME_get_text_by_NID that first calculates the size
-// of the string. Returns empty string on failure.
-std::optional<std::string> GetX509NameTextByNid(X509_NAME* name, int nid) {
-    // |len| is the len of the text excluding the final null
-    int len = X509_NAME_get_text_by_NID(name, nid, nullptr, -1);
-    if (len <= 0) {
-        return std::nullopt;
-    }
-
-    // Include the space for the final null byte
-    std::vector<char> buf(len + 1, '\0');
-    CHECK(X509_NAME_get_text_by_NID(name, nid, buf.data(), buf.size()));
-    return std::make_optional(std::string(buf.data()));
-}
-
-}  // namespace
-
-// Takes an encoded public key and generates a X509_NAME that can be used in
-// TlsConnection::SetClientCAList(), to allow the client to figure out which of
-// its keys it should try to use in the TLS handshake.
-bssl::UniquePtr<X509_NAME> CreateCAIssuerFromEncodedKey(std::string_view key) {
-    // "O=AdbKey-0;CN=<key>;"
-    CHECK(!key.empty());
-
-    std::string identifier = kAdbKeyIdentifierV0;
-    bssl::UniquePtr<X509_NAME> name(X509_NAME_new());
-    CHECK(X509_NAME_add_entry_by_NID_const(name.get(), kAdbKeyIdentifierNid, MBSTRING_ASC,
-                                           reinterpret_cast<const uint8_t*>(identifier.data()),
-                                           identifier.size(), -1, 0));
-
-    CHECK(X509_NAME_add_entry_by_NID_const(name.get(), kAdbKeyValueNid, MBSTRING_ASC,
-                                           reinterpret_cast<const uint8_t*>(key.data()), key.size(),
-                                           -1, 0));
-    return name;
-}
-
-// Parses a CA issuer and returns the encoded key, if any.
-std::optional<std::string> ParseEncodedKeyFromCAIssuer(X509_NAME* issuer) {
-    CHECK(issuer);
-
-    auto buf = GetX509NameTextByNid(issuer, kAdbKeyIdentifierNid);
-    if (!buf) {
-        return std::nullopt;
-    }
-
-    // Check for supported versions
-    if (*buf == kAdbKeyIdentifierV0) {
-        return GetX509NameTextByNid(issuer, kAdbKeyValueNid);
-    }
-    return std::nullopt;
-}
-
-std::string SHA256BitsToHexString(std::string_view sha256) {
-    CHECK_EQ(sha256.size(), static_cast<size_t>(SHA256_DIGEST_LENGTH));
-    std::stringstream ss;
-    auto* u8 = reinterpret_cast<const uint8_t*>(sha256.data());
-    ss << std::uppercase << std::setfill('0') << std::hex;
-    // Convert to hex-string representation
-    for (size_t i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
-        // Need to cast to something bigger than one byte, or
-        // stringstream will interpret it as a char value.
-        ss << std::setw(2) << static_cast<uint16_t>(u8[i]);
-    }
-    return ss.str();
-}
-
-std::optional<std::string> SHA256HexStringToBits(std::string_view sha256_str) {
-    if (sha256_str.size() != SHA256_DIGEST_LENGTH * 2) {
-        return std::nullopt;
-    }
-
-    std::string result;
-    for (size_t i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
-        auto bytestr = std::string(sha256_str.substr(i * 2, 2));
-        if (!IsHexDigit(bytestr[0]) || !IsHexDigit(bytestr[1])) {
-            LOG(ERROR) << "SHA256 string has invalid non-hex chars";
-            return std::nullopt;
-        }
-        result += static_cast<char>(std::stol(bytestr, nullptr, 16));
-    }
-    return result;
-}
-
-}  // namespace tls
-}  // namespace adb
diff --git a/adb/tls/include/adb/tls/adb_ca_list.h b/adb/tls/include/adb/tls/adb_ca_list.h
deleted file mode 100644
index a1ab9a7..0000000
--- a/adb/tls/include/adb/tls/adb_ca_list.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <openssl/base.h>
-#include <optional>
-#include <string>
-
-// These APIs is used to embed adbd's known public keys into client-allowed CA
-// issuer list that can indicate to the client which key to use.
-namespace adb {
-namespace tls {
-
-// Takes an encoded public key and generates a X509_NAME that can be used in
-// TlsConnection::SetClientCAList(), to allow the client to figure out which of
-// its keys it should try to use in the TLS handshake. This is guaranteed to
-// return a valid X509_NAME, given a non-empty key.
-bssl::UniquePtr<X509_NAME> CreateCAIssuerFromEncodedKey(std::string_view key);
-
-// Parses a CA issuer and returns the encoded key, if any. On failure, returns
-// nullopt.
-std::optional<std::string> ParseEncodedKeyFromCAIssuer(X509_NAME* issuer);
-
-// Converts SHA256 bits to a hex string representation. |sha256| must be exactly
-// |SHA256_DIGEST_LENGTH| in size.
-std::string SHA256BitsToHexString(std::string_view sha256);
-
-// Converts a valid SHA256 hex string to the actual bits. Returns nullopt on
-// failure.
-std::optional<std::string> SHA256HexStringToBits(std::string_view sha256_str);
-
-}  // namespace tls
-}  // namespace adb
diff --git a/adb/tls/include/adb/tls/tls_connection.h b/adb/tls/include/adb/tls/tls_connection.h
deleted file mode 100644
index bc5b98a..0000000
--- a/adb/tls/include/adb/tls/tls_connection.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <string_view>
-#include <vector>
-
-#include <android-base/unique_fd.h>
-#include <openssl/ssl.h>
-#include <openssl/x509.h>
-
-namespace adb {
-namespace tls {
-
-class TlsConnection {
-  public:
-    // This class will require both client and server to exchange valid
-    // certificates.
-    enum class Role {
-        Server,
-        Client,
-    };
-
-    enum class TlsError : uint8_t {
-        Success = 0,
-        // An error indicating that we rejected the peer's certificate.
-        CertificateRejected,
-        // An error indicating that the peer rejected our certificate.
-        PeerRejectedCertificate,
-        // Add more if needed
-        UnknownFailure,
-    };
-
-    using CertVerifyCb = std::function<int(X509_STORE_CTX*)>;
-    using SetCertCb = std::function<int(SSL*)>;
-
-    virtual ~TlsConnection() = default;
-
-    // Adds a trusted certificate to the list for the SSL connection.
-    // During the handshake phase, it will check the list of trusted certificates.
-    // The connection will fail if the peer's certificate is not in the list. If
-    // you would like to accept any certificate, use #SetCertVerifyCallback and
-    // set your callback to always return 1.
-    //
-    // Returns true if |cert| was successfully added, false otherwise.
-    virtual bool AddTrustedCertificate(std::string_view cert) = 0;
-
-    // Sets a custom certificate verify callback. |cb| must return 1 if the
-    // certificate is trusted. Otherwise, return 0 if not.
-    virtual void SetCertVerifyCallback(CertVerifyCb cb) = 0;
-
-    // Configures a client |ca_list| that the server sends to the client in the
-    // CertificateRequest message.
-    virtual void SetClientCAList(STACK_OF(X509_NAME) * ca_list) = 0;
-
-    // Sets a callback that will be called to select a certificate. See
-    // https://commondatastorage.googleapis.com/chromium-boringssl-docs/ssl.h.html#SSL_CTX_set_cert_cb
-    // for more details.
-    virtual void SetCertificateCallback(SetCertCb cb) = 0;
-
-    // Exports a value derived from the master secret used in the TLS
-    // connection. This value should be used alongside any PAKE to ensure the
-    // peer is the intended peer. |length| is the requested length for the
-    // keying material. This is only valid after |DoHandshake| succeeds.
-    virtual std::vector<uint8_t> ExportKeyingMaterial(size_t length) = 0;
-
-    // Enable client-side check on whether server accepted the handshake. In TLS
-    // 1.3, client will not know the server rejected the handshake until after
-    // performing a read operation. Basically, this will perform an
-    // SSL_peek right after the handshake and see whether that succeeds.
-    //
-    // IMPORTANT: this will only work if the protocol is a server-speaks-first
-    // type. Enabling this for the server is a no-op. This is disabled by
-    // default.
-    virtual void EnableClientPostHandshakeCheck(bool enable) = 0;
-
-    // Starts the handshake process. Returns TlsError::Success if handshake
-    // succeeded.
-    virtual TlsError DoHandshake() = 0;
-
-    // Reads |size| bytes and returns the data. The returned data has either
-    // size |size| or zero, in which case the read failed.
-    virtual std::vector<uint8_t> ReadFully(size_t size) = 0;
-
-    // Overloaded ReadFully method, which accepts a buffer for writing in.
-    // Returns true iff exactly |size| amount of data was written into |buf|,
-    // false otherwise.
-    virtual bool ReadFully(void* buf, size_t size) = 0;
-
-    // Writes |size| bytes. Returns true if all |size| bytes were read.
-    // Returns false otherwise.
-    virtual bool WriteFully(std::string_view data) = 0;
-
-    // Create a new TlsConnection instance. |cert| and |priv_key| cannot be
-    // empty.
-    static std::unique_ptr<TlsConnection> Create(Role role, std::string_view cert,
-                                                 std::string_view priv_key,
-                                                 android::base::borrowed_fd fd);
-
-    // Helper to set the certificate and key strings to a SSL client/server.
-    // Useful when in the set-certificate callback.
-    static bool SetCertAndKey(SSL* ssl, std::string_view cert_chain, std::string_view priv_key);
-
-  protected:
-    TlsConnection() = default;
-};  // TlsConnection
-
-}  // namespace tls
-}  // namespace adb
diff --git a/adb/tls/tests/Android.bp b/adb/tls/tests/Android.bp
deleted file mode 100644
index 198de58..0000000
--- a/adb/tls/tests/Android.bp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Copyright (C) 2019 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.
-//
-
-cc_test {
-    name: "adb_tls_connection_test",
-    srcs: [
-        "adb_ca_list_test.cpp",
-        "tls_connection_test.cpp",
-    ],
-
-    compile_multilib: "first",
-
-    shared_libs: [
-        "libbase",
-        "libcrypto",
-        "libcrypto_utils",
-        "libssl",
-    ],
-
-    // Let's statically link them so we don't have to install it onto the
-    // system image for testing.
-    static_libs: [
-        "libadb_crypto_static",
-        "libadb_protos_static",
-        "libadb_tls_connection_static",
-    ],
-
-    test_suites: ["device-tests"],
-}
diff --git a/adb/tls/tests/adb_ca_list_test.cpp b/adb/tls/tests/adb_ca_list_test.cpp
deleted file mode 100644
index c727e5f..0000000
--- a/adb/tls/tests/adb_ca_list_test.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#define LOG_TAG "AdbCAListTest"
-
-#include <gtest/gtest.h>
-
-#include <adb/tls/adb_ca_list.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <openssl/ssl.h>
-
-namespace adb {
-namespace tls {
-
-class AdbCAListTest : public testing::Test {
-  protected:
-    virtual void SetUp() override {}
-
-    virtual void TearDown() override {}
-};
-
-TEST_F(AdbCAListTest, SHA256BitsToHexString_BadParam) {
-    // Should crash if not exactly SHA256_DIGEST_LENGTH size
-    ASSERT_DEATH(
-            {
-                // empty
-                std::string sha;
-                SHA256BitsToHexString(sha);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                std::string sha(1, 0x80);
-                SHA256BitsToHexString(sha);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                std::string sha(SHA256_DIGEST_LENGTH - 1, 0x80);
-                SHA256BitsToHexString(sha);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                std::string sha(SHA256_DIGEST_LENGTH + 1, 0x80);
-                SHA256BitsToHexString(sha);
-            },
-            "");
-}
-
-TEST_F(AdbCAListTest, SHA256HexStringToBits_BadParam) {
-    {
-        // empty
-        std::string sha_str;
-        auto res = SHA256HexStringToBits(sha_str);
-        EXPECT_FALSE(res.has_value());
-    }
-    {
-        std::string sha_str(1, 'a');
-        auto res = SHA256HexStringToBits(sha_str);
-        EXPECT_FALSE(res.has_value());
-    }
-    {
-        std::string sha_str(SHA256_DIGEST_LENGTH * 2 - 1, 'a');
-        auto res = SHA256HexStringToBits(sha_str);
-        EXPECT_FALSE(res.has_value());
-    }
-    {
-        std::string sha_str(SHA256_DIGEST_LENGTH * 2 + 1, 'a');
-        auto res = SHA256HexStringToBits(sha_str);
-        EXPECT_FALSE(res.has_value());
-    }
-    {
-        // Non-hex chars
-        std::string sha_str(SHA256_DIGEST_LENGTH * 2, 'a');
-        sha_str[32] = 'x';
-        auto res = SHA256HexStringToBits(sha_str);
-        EXPECT_FALSE(res.has_value());
-    }
-}
-
-TEST_F(AdbCAListTest, SHA256BitsToHexString_ValidParam) {
-    uint8_t ct = 0;
-    // Test every possible byte
-    std::vector<std::string> expectedStr = {
-            "000102030405060708090A0B0C0D0E0F"
-            "101112131415161718191A1B1C1D1E1F",
-
-            "202122232425262728292A2B2C2D2E2F"
-            "303132333435363738393A3B3C3D3E3F",
-
-            "404142434445464748494A4B4C4D4E4F"
-            "505152535455565758595A5B5C5D5E5F",
-
-            "606162636465666768696A6B6C6D6E6F"
-            "707172737475767778797A7B7C7D7E7F",
-
-            "808182838485868788898A8B8C8D8E8F"
-            "909192939495969798999A9B9C9D9E9F",
-
-            "A0A1A2A3A4A5A6A7A8A9AAABACADAEAF"
-            "B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF",
-
-            "C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF"
-            "D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF",
-
-            "E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF"
-            "F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF",
-    };
-
-    for (auto& expected : expectedStr) {
-        std::string sha;
-        while (sha.size() < SHA256_DIGEST_LENGTH) {
-            sha += ct++;
-        }
-
-        auto sha_str = SHA256BitsToHexString(sha);
-        EXPECT_EQ(expected, sha_str);
-
-        // try to convert back to bits
-        auto out_sha = SHA256HexStringToBits(sha_str);
-        ASSERT_TRUE(out_sha.has_value());
-        EXPECT_EQ(*out_sha, sha);
-    }
-}
-
-TEST_F(AdbCAListTest, CreateCAIssuerFromEncodedKey_EmptyKey) {
-    ASSERT_DEATH({ auto issuer = CreateCAIssuerFromEncodedKey(""); }, "");
-}
-
-TEST_F(AdbCAListTest, Smoke) {
-    {
-        std::string key =
-                "A45BC1FF6C89BF0E"
-                "65F9BA153FBC9876"
-                "4969B4113F1CF878"
-                "EEF9BF1C3F9C9227";
-        auto issuer = CreateCAIssuerFromEncodedKey(key);
-        ASSERT_NE(issuer, nullptr);
-
-        // Try to parse the encoded key out of the X509_NAME
-        auto out_key = ParseEncodedKeyFromCAIssuer(issuer.get());
-        ASSERT_TRUE(out_key.has_value());
-        EXPECT_EQ(key, *out_key);
-    }
-}
-
-}  // namespace tls
-}  // namespace adb
diff --git a/adb/tls/tests/tls_connection_test.cpp b/adb/tls/tests/tls_connection_test.cpp
deleted file mode 100644
index 27bc1c9..0000000
--- a/adb/tls/tests/tls_connection_test.cpp
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#define LOG_TAG "AdbWifiTlsConnectionTest"
-
-#include <thread>
-
-#include <gtest/gtest.h>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <adb/crypto/x509_generator.h>
-#include <adb/tls/adb_ca_list.h>
-#include <adb/tls/tls_connection.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <android-base/unique_fd.h>
-#include <openssl/ssl.h>
-
-using namespace adb::crypto;
-
-namespace adb {
-namespace tls {
-
-using android::base::unique_fd;
-using TlsError = TlsConnection::TlsError;
-
-// Test X.509 certificates (RSA 2048)
-static const std::string kTestRsa2048ServerCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIDFzCCAf+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAtMQswCQYDVQQGEwJVUzEQ\n"
-        "MA4GA1UECgwHQW5kcm9pZDEMMAoGA1UEAwwDQWRiMB4XDTIwMDEyMTIyMjU1NVoX\n"
-        "DTMwMDExODIyMjU1NVowLTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJvaWQx\n"
-        "DDAKBgNVBAMMA0FkYjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK8E\n"
-        "2Ck9TfuKlz7wqWdMfknjZ1luFDp2IHxAUZzh/F6jeI2dOFGAjpeloSnGOE86FIaT\n"
-        "d1EvpyTh7nBwbrLZAA6XFZTo7Bl6BdNOQdqb2d2+cLEN0inFxqUIycevRtohUE1Y\n"
-        "FHM9fg442X1jOTWXjDZWeiqFWo95paAPhzm6pWqfJK1+YKfT1LsWZpYqJGGQE5pi\n"
-        "C3qOBYYgFpoXMxTYJNoZo3uOYEdM6upc8/vh15nMgIxX/ymJxEY5BHPpZPPWjXLg\n"
-        "BfzVaV9fUfv0JT4HQ4t2WvxC3cD/UsjWp2a6p454uUp2ENrANa+jRdRJepepg9D2\n"
-        "DKsx9L8zjc5Obqexrt0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B\n"
-        "Af8EBAMCAYYwHQYDVR0OBBYEFDFW+8GTErwoZN5Uu9KyY4QdGYKpMA0GCSqGSIb3\n"
-        "DQEBCwUAA4IBAQBCDEn6SHXGlq5TU7J8cg1kRPd9bsJW+0hDuKSq0REXDkl0PcBf\n"
-        "fy282Agg9enKPPKmnpeQjM1dmnxdM8tT8LIUbMl779i3fn6v9HJVB+yG4gmRFThW\n"
-        "c+AGlBnrIT820cX/gU3h3R3FTahfsq+1rrSJkEgHyuC0HYeRyveSckBdaEOLvx0S\n"
-        "toun+32JJl5hWydpUUZhE9Mbb3KHBRM2YYZZU9JeJ08Apjl+3lRUeMAUwI5fkAAu\n"
-        "z/1SqnuGL96bd8P5ixdkA1+rF8FPhodGcq9mQOuUGP9g5HOXjaNoJYvwVRUdLeGh\n"
-        "cP/ReOTwQIzM1K5a83p8cX8AGGYmM7dQp7ec\n"
-        "-----END CERTIFICATE-----\n";
-
-static const std::string kTestRsa2048ServerPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCvBNgpPU37ipc+\n"
-        "8KlnTH5J42dZbhQ6diB8QFGc4fxeo3iNnThRgI6XpaEpxjhPOhSGk3dRL6ck4e5w\n"
-        "cG6y2QAOlxWU6OwZegXTTkHam9ndvnCxDdIpxcalCMnHr0baIVBNWBRzPX4OONl9\n"
-        "Yzk1l4w2VnoqhVqPeaWgD4c5uqVqnyStfmCn09S7FmaWKiRhkBOaYgt6jgWGIBaa\n"
-        "FzMU2CTaGaN7jmBHTOrqXPP74deZzICMV/8picRGOQRz6WTz1o1y4AX81WlfX1H7\n"
-        "9CU+B0OLdlr8Qt3A/1LI1qdmuqeOeLlKdhDawDWvo0XUSXqXqYPQ9gyrMfS/M43O\n"
-        "Tm6nsa7dAgMBAAECggEAFCS2bPdUKIgjbzLgtHW+hT+J2hD20rcHdyAp+dNH/2vI\n"
-        "yLfDJHJA4chGMRondKA704oDw2bSJxxlG9t83326lB35yxPhye7cM8fqgWrK8PVl\n"
-        "tU22FhO1ZgeJvb9OeXWNxKZyDW9oOOJ8eazNXVMuEo+dFj7B6l3MXQyHJPL2mJDm\n"
-        "u9ofFLdypX+gJncVO0oW0FNJnEUn2MMwHDNlo7gc4WdQuidPkuZItKRGcB8TTGF3\n"
-        "Ka1/2taYdTQ4Aq//Z84LlFvE0zD3T4c8LwYYzOzD4gGGTXvft7vSHzIun1S8YLRS\n"
-        "dEKXdVjtaFhgH3uUe4j+1b/vMvSHeoGBNX/G88GD+wKBgQDWUYVlMVqc9HD2IeYi\n"
-        "EfBcNwAJFJkh51yAl5QbUBgFYgFJVkkS/EDxEGFPvEmI3/pAeQFHFY13BI466EPs\n"
-        "o8Z8UUwWDp+Z1MFHHKQKnFakbsZbZlbqjJ9VJsqpezbpWhMHTOmcG0dmE7rf0lyM\n"
-        "eQv9slBB8qp2NEUs5Of7f2C2bwKBgQDRDq4nUuMQF1hbjM05tGKSIwkobmGsLspv\n"
-        "TMhkM7fq4RpbFHmbNgsFqMhcqYZ8gY6/scv5KCuAZ4yHUkbqwf5h+QCwrJ4uJeUJ\n"
-        "ZgJfHus2mmcNSo8FwSkNoojIQtzcbJav7bs2K9VTuertk/i7IJLApU4FOZZ5pghN\n"
-        "EXu0CZF1cwKBgDWFGhjRIF29tU/h20R60llU6s9Zs3wB+NmsALJpZ/ZAKS4VPB5f\n"
-        "nCAXBRYSYRKrTCU5kpYbzb4BBzuysPOxWmnFK4j+keCqfrGxd02nCQP7HdHJVr8v\n"
-        "6sIq88UrHeVcNxBFprjzHvtgxfQK5k22FMZ/9wbhAKyQFQ5HA5+MiaxFAoGAIcZZ\n"
-        "ZIkDninnYIMS9OursShv5lRO+15j3i9tgKLKZ+wOMgDQ1L6acUOfezj4PU1BHr8+\n"
-        "0PYocQpJreMhCfRlgLaV4fVBaPs+UZJld7CrF5tCYudUy/01ALrtlk0XGZWBktK5\n"
-        "mDrksC4tQkzRtonAq9cJD9cJ9IVaefkFH0UcdvkCgYBpZj50VLeGhnHHBnkJRlV1\n"
-        "fV+/P6PAq6RtqjA6O9Qdaoj5V3w2d63aQcQXQLJjH2BBmtCIy47r04rFvZpbCxP7\n"
-        "NH/OnK9NHpk2ucRTe8TAnVbvF/TZzPJoIxAO/D3OWaW6df4R8en8u6GYzWFglAyT\n"
-        "sydGT8yfWD1FYUWgfrVRbg==\n"
-        "-----END PRIVATE KEY-----\n";
-
-static const std::string kTestRsa2048ClientCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIDFzCCAf+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAtMQswCQYDVQQGEwJVUzEQ\n"
-        "MA4GA1UECgwHQW5kcm9pZDEMMAoGA1UEAwwDQWRiMB4XDTIwMDEyMTIyMjU1NloX\n"
-        "DTMwMDExODIyMjU1NlowLTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJvaWQx\n"
-        "DDAKBgNVBAMMA0FkYjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI3a\n"
-        "EXh1S5FTbet7JVONswffRPaekdIK53cb8SnAbSO9X5OLA4zGwdkrBvDTsd96SKrp\n"
-        "JxmoNOE1DhbZh05KPlWAPkGKacjGWaz+S7biDOL0I6aaLbTlU/il1Ub9olPSBVUx\n"
-        "0nhdtEFgIOzddnP6/1KmyIIeRxS5lTKeg4avqUkZNXkz/wL1dHBFL7FNFf0SCcbo\n"
-        "tsub/deFbjZ27LTDN+SIBgFttTNqC5NTvoBAoMdyCOAgNYwaHO+fKiK3edfJieaw\n"
-        "7HD8qqmQxcpCtRlA8CUPj7GfR+WHiCJmlevhnkFXCo56R1BS0F4wuD4KPdSWt8gc\n"
-        "27ejH/9/z2cKo/6SLJMCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B\n"
-        "Af8EBAMCAYYwHQYDVR0OBBYEFO/Mr5ygqqpyU/EHM9v7RDvcqaOkMA0GCSqGSIb3\n"
-        "DQEBCwUAA4IBAQAH33KMouzF2DYbjg90KDrDQr4rq3WfNb6P743knxdUFuvb+40U\n"
-        "QjC2OJZHkSexH7wfG/y6ic7vfCfF4clNs3QvU1lEjOZC57St8Fk7mdNdsWLwxEMD\n"
-        "uePFz0dvclSxNUHyCVMqNxddzQYzxiDWQRmXWrUBliMduQqEQelcxW2yDtg8bj+s\n"
-        "aMpR1ra9scaD4jzIZIIxLoOS9zBMuNRbgP217sZrniyGMhzoI1pZ/izN4oXpyH7O\n"
-        "THuaCzzRT3ph2f8EgmHSodz3ttgSf2DHzi/Ez1xUkk7NOlgNtmsxEdrM47+cC5ae\n"
-        "fIf2V+1o1JW8J7D11RmRbNPh3vfisueB4f88\n"
-        "-----END CERTIFICATE-----\n";
-
-static const std::string kTestRsa2048ClientPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCN2hF4dUuRU23r\n"
-        "eyVTjbMH30T2npHSCud3G/EpwG0jvV+TiwOMxsHZKwbw07Hfekiq6ScZqDThNQ4W\n"
-        "2YdOSj5VgD5BimnIxlms/ku24gzi9COmmi205VP4pdVG/aJT0gVVMdJ4XbRBYCDs\n"
-        "3XZz+v9SpsiCHkcUuZUynoOGr6lJGTV5M/8C9XRwRS+xTRX9EgnG6LbLm/3XhW42\n"
-        "duy0wzfkiAYBbbUzaguTU76AQKDHcgjgIDWMGhzvnyoit3nXyYnmsOxw/KqpkMXK\n"
-        "QrUZQPAlD4+xn0flh4giZpXr4Z5BVwqOekdQUtBeMLg+Cj3UlrfIHNu3ox//f89n\n"
-        "CqP+kiyTAgMBAAECggEAAa64eP6ggCob1P3c73oayYPIbvRqiQdAFOrr7Vwu7zbr\n"
-        "z0rde+n6RU0mrpc+4NuzyPMtrOGQiatLbidJB5Cx3z8U00ovqbCl7PtcgorOhFKe\n"
-        "VEzihebCcYyQqbWQcKtpDMhOgBxRwFoXieJb6VGXfa96FAZalCWvXgOrTl7/BF2X\n"
-        "qMqIm9nJi+yS5tIO8VdOsOmrMWRH/b/ENUcef4WpLoxTXr0EEgyKWraeZ/hhXo1e\n"
-        "z29dZKqdr9wMsq11NPsRddwS94jnDkXTo+EQyWVTfB7gb6yyp07s8jysaDb21tVv\n"
-        "UXB9MRhDV1mOv0ncXfXZ4/+4A2UahmZaLDAVLaat4QKBgQDAVRredhGRGl2Nkic3\n"
-        "KvZCAfyxug788CgasBdEiouz19iCCwcgMIDwnq0s3/WM7h/laCamT2x38riYDnpq\n"
-        "rkYMfuVtU9CjEL9pTrdfwbIRhTwYNqADaPz2mXwQUhRXutE5TIdgxxC/a+ZTh0qN\n"
-        "S+vhTj/4hf0IZhMh5Nqj7IPExQKBgQC8zxEzhmSGjys0GuE6Wl6Doo2TpiR6vwvi\n"
-        "xPLU9lmIz5eca/Rd/eERioFQqeoIWDLzx52DXuz6rUoQhbJWz9hP3yqCwXD+pbNP\n"
-        "oDJqDDbCC4IMYEb0IK/PEPH+gIpnTjoFcW+ecKDFG7W5Lt05J8WsJsfOaJvMrOU+\n"
-        "dLXq3IgxdwKBgQC5RAFq0v6e8G+3hFaEHL0z3igkpt3zJf7rnj37hx2FMmDa+3Z0\n"
-        "umQp5B9af61PgL12xLmeMBmC/Wp1BlVDV/Yf6Uhk5Hyv5t0KuomHEtTNbbLyfAPs\n"
-        "5P/vJu/L5NS1oT4S3LX3MineyjgGs+bLbpub3z1dzutrYLADUSiPCK/xJQKBgBQt\n"
-        "nQ0Ao+Wtj1R2OvPdjJRM3wyUiPmFSWPm4HzaBx+T8AQLlYYmB9O0FbXlMtnJc0iS\n"
-        "YMcVcgYoVu4FG9YjSF7g3s4yljzgwJUV7c1fmMqMKE3iTDLy+1cJ3JLycdgwiArk\n"
-        "4KTyLHxkRbuQwpvFIF8RlfD9RQlOwQE3v+llwDhpAoGBAL6XG6Rp6mBoD2Ds5c9R\n"
-        "943yYgSUes3ji1SI9zFqeJtj8Ml/enuK1xu+8E/BxB0//+vgZsH6i3i8GFwygKey\n"
-        "CGJF8CbiHc3EJc3NQIIRXcni/CGacf0HwC6m+PGFDBIpA4H2iDpVvCSofxttQiq0\n"
-        "/Z7HXmXUvZHVyYi/QzX2Gahj\n"
-        "-----END PRIVATE KEY-----\n";
-
-static const std::string kTestRsa2048UnknownPrivKey =
-        "-----BEGIN PRIVATE KEY-----\n"
-        "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCrIhr+CS+6UI0w\n"
-        "CTaVzQAicKBe6X531LeQAGYx7j5RLHR1QIoJ0WCc5msmXKe2VzcWuLbVdTGAIP1H\n"
-        "mwbPqlbO4ioxeJhiDv+WPuLG8+j4Iw1Yqxt8cfohxjfvNmIQM8aF5hGyyaaTetDF\n"
-        "EYWONoYCBC4WnFWgYCPb8mzWXlhHE3F66GnHpc32zydPTg3ZurGvSsFf7fNY9yRw\n"
-        "8WtwPiI6mpRxt+n2bQUp+LZ+g/3rXLFPg8uWDGYG7IvLluWc9gR9lxjL64t6ryLU\n"
-        "2cm7eTfDgLw/B1F/wEgCJDnby1JgQ4rq6klJO3BR2ooUr/7T343y5njG5hQJreV7\n"
-        "5ZnSmRLZAgMBAAECggEABPrfeHZFuWkj7KqN+DbAmt/2aMCodZ3+7/20+528WkIe\n"
-        "CvXzdmTth+9UHagLWNzpnVuHdYd9JuZ+3F00aelh8JAIDIu++naHhUSj9ohtRoBF\n"
-        "oIeNK5ZJAj/Zi5hkauaIz8dxyyc/VdIYfm2bundXd7pNqYqH2tyFWp6PwH67GKlZ\n"
-        "1lC7o8gKAK8sz9g0Ctdoe+hDqAsvYFCW4EWDM2qboucSgn8g3E/Gux/KrpXVv7d0\n"
-        "PMQ60m+dyTOCMGqXIoDR3TAvQR7ex5sQ/QZSREdxKy878s/2FY4ktxtCUWlhrmcI\n"
-        "VKtrDOGEKwNoiMluf2635rsVq2e01XhQlmdxbRFU0QKBgQDjOhhD1m9duFTQ2b+J\n"
-        "Xfn6m8Rs7sZqO4Az7gLOWmD/vYWlK4n2nZsh6u5/cB1N+PA+ncvvV4yKJAlLHxbT\n"
-        "pVvfzJ/jbUsj/NJg/w7+KYC9gXgRmBonuG2gRZF/5Otdlza4vMcoSkqGjlGxJyzL\n"
-        "+9umEziN3tEYMRwipYvt7BgbUQKBgQDAzaXryJ3YD3jpecy/+fSnQvFjpyeDRqU1\n"
-        "KDA9nxN5tJN6bnKhUlMhy64SsgvVX9jUuN7cK+qYV0uzdBn6kIAJNLWTdbtH93+e\n"
-        "vNVgluR3jmixW4QfY9vfZKdXZbVGNc0DFMi1vJqgxTgQ5Mq5PxxxRL4FsAF840V1\n"
-        "Wu9uhU0NCQKBgBfjga2QG8E0oeYbHmHouWE5gxsYt09v1fifqzfalJwOZsCIpUaC\n"
-        "J08Xjd9kABC0fT14BXqyL5pOU5PMPvAdUF1k++JDGUU9TTjZV9AsuNYziFYBMa6/\n"
-        "WvcgmT1i6cO7JAuj/SQlO1SOHdSME8+WOO9q0eVIaZ8repPB58YprhchAoGBAJyR\n"
-        "Y8AJdkTSq7nNszvi245IioYGY8vzPo3gSOyBlesrfOfbcTMYC3JSWNXNyFZKM2br\n"
-        "ie75qtRzb4IXMlGLrq3LI/jPjnpuvjBF4HFDl9yOxO3iB3UGPrM2pb4PVhnh7s4l\n"
-        "vqf2tQsBnPn7EbVFTu+ch0NPHqYwWWNnqS/zCBMhAoGBAIkYjOE0iD9W2FXee6VL\n"
-        "iN8wDqlqsGEEtLvykIDmTmM+ZX5ftQuPo18khpE9wQKmJ5OpoVTYIP1UsJFBakgo\n"
-        "+dGaf6xVuPvmydNFqixlW3z227n4Px6GX7CXlCaAleTeItezli+dWf/9astwTA3x\n"
-        "IazYzsxUUpZFC4dJ1GhBn3y1\n"
-        "-----END PRIVATE KEY-----\n";
-
-static const std::string kTestRsa2048UnknownCert =
-        "-----BEGIN CERTIFICATE-----\n"
-        "MIIDFzCCAf+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAtMQswCQYDVQQGEwJVUzEQ\n"
-        "MA4GA1UECgwHQW5kcm9pZDEMMAoGA1UEAwwDQWRiMB4XDTIwMDEyNDE4MzMwNVoX\n"
-        "DTMwMDEyMTE4MzMwNVowLTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB0FuZHJvaWQx\n"
-        "DDAKBgNVBAMMA0FkYjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKsi\n"
-        "Gv4JL7pQjTAJNpXNACJwoF7pfnfUt5AAZjHuPlEsdHVAignRYJzmayZcp7ZXNxa4\n"
-        "ttV1MYAg/UebBs+qVs7iKjF4mGIO/5Y+4sbz6PgjDVirG3xx+iHGN+82YhAzxoXm\n"
-        "EbLJppN60MURhY42hgIELhacVaBgI9vybNZeWEcTcXroacelzfbPJ09ODdm6sa9K\n"
-        "wV/t81j3JHDxa3A+IjqalHG36fZtBSn4tn6D/etcsU+Dy5YMZgbsi8uW5Zz2BH2X\n"
-        "GMvri3qvItTZybt5N8OAvD8HUX/ASAIkOdvLUmBDiurqSUk7cFHaihSv/tPfjfLm\n"
-        "eMbmFAmt5XvlmdKZEtkCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B\n"
-        "Af8EBAMCAYYwHQYDVR0OBBYEFDtRSOm1ilhnq6bKN4qJ1ekK/PAkMA0GCSqGSIb3\n"
-        "DQEBCwUAA4IBAQAP6Q8/OxnBA3BO8oxKer0tjI4rZMefUhbAKUWXYjTTNEBm5//b\n"
-        "lVGP2RptO7bxj8w1L3rxsjmVcv2TqBOhrbJqvGVPE2ntoYlFhBBkRvmxuu1y5W9V\n"
-        "uJU7SF9lNmDXShTURULu3P8GdeT1HGeXzWQ4x7VhY9a3VIbmN5VxjB+3C6hYZxSs\n"
-        "DCpmidu/sR+n5Azlh6oqrhOxmv17PuF/ioTUsHd4y2Z41IvvO47oghxNDtboUUsg\n"
-        "LfsM1MOxVC9PqOfQphFU4i8owNIYzBMadDLw+1TSQj0ALqZVyc9Dq+WDFdz+JAE+\n"
-        "k7TkVU06UPGVSnLVzJeYwGCXQp3apBszY9vO\n"
-        "-----END CERTIFICATE-----\n";
-
-struct CAIssuerField {
-    int nid;
-    std::vector<uint8_t> val;
-};
-using CAIssuer = std::vector<CAIssuerField>;
-static std::vector<CAIssuer> kCAIssuers = {
-        {
-                {NID_commonName, {'a', 'b', 'c', 'd', 'e'}},
-                {NID_organizationName, {'d', 'e', 'f', 'g'}},
-        },
-        {
-                {NID_commonName, {'h', 'i', 'j', 'k', 'l', 'm'}},
-                {NID_countryName, {'n', 'o'}},
-        },
-};
-
-class AdbWifiTlsConnectionTest : public testing::Test {
-  protected:
-    virtual void SetUp() override {
-        android::base::Socketpair(SOCK_STREAM, &server_fd_, &client_fd_);
-        server_ = TlsConnection::Create(TlsConnection::Role::Server, kTestRsa2048ServerCert,
-                                        kTestRsa2048ServerPrivKey, server_fd_);
-        client_ = TlsConnection::Create(TlsConnection::Role::Client, kTestRsa2048ClientCert,
-                                        kTestRsa2048ClientPrivKey, client_fd_);
-        ASSERT_NE(nullptr, server_);
-        ASSERT_NE(nullptr, client_);
-    }
-
-    virtual void TearDown() override {
-        WaitForClientConnection();
-        // Shutdown the SSL connection first.
-        server_.reset();
-        client_.reset();
-    }
-
-    bssl::UniquePtr<STACK_OF(X509_NAME)> GetCAIssuerList() {
-        bssl::UniquePtr<STACK_OF(X509_NAME)> ret(sk_X509_NAME_new_null());
-        for (auto& issuer : kCAIssuers) {
-            bssl::UniquePtr<X509_NAME> name(X509_NAME_new());
-            for (auto& attr : issuer) {
-                CHECK(X509_NAME_add_entry_by_NID(name.get(), attr.nid, MBSTRING_ASC,
-                                                 attr.val.data(), attr.val.size(), -1, 0));
-            }
-
-            CHECK(bssl::PushToStack(ret.get(), std::move(name)));
-        }
-
-        return ret;
-    }
-
-    void StartClientHandshakeAsync(TlsError expected) {
-        client_thread_ = std::thread([=]() { EXPECT_EQ(client_->DoHandshake(), expected); });
-    }
-
-    void WaitForClientConnection() {
-        if (client_thread_.joinable()) {
-            client_thread_.join();
-        }
-    }
-
-    unique_fd server_fd_;
-    unique_fd client_fd_;
-    const std::vector<uint8_t> msg_{0xff, 0xab, 0x32, 0xf6, 0x12, 0x56};
-    std::unique_ptr<TlsConnection> server_;
-    std::unique_ptr<TlsConnection> client_;
-    std::thread client_thread_;
-};
-
-TEST_F(AdbWifiTlsConnectionTest, InvalidCreationParams) {
-    // Verify that passing empty certificate/private key results in a crash.
-    ASSERT_DEATH(
-            {
-                server_ = TlsConnection::Create(TlsConnection::Role::Server, "",
-                                                kTestRsa2048ServerPrivKey, server_fd_);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                server_ = TlsConnection::Create(TlsConnection::Role::Server, kTestRsa2048ServerCert,
-                                                "", server_fd_);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                client_ = TlsConnection::Create(TlsConnection::Role::Client, "",
-                                                kTestRsa2048ClientPrivKey, client_fd_);
-            },
-            "");
-    ASSERT_DEATH(
-            {
-                client_ = TlsConnection::Create(TlsConnection::Role::Client, kTestRsa2048ClientCert,
-                                                "", client_fd_);
-            },
-            "");
-}
-
-TEST_F(AdbWifiTlsConnectionTest, NoCertificateVerification) {
-    // Allow any certificate
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    StartClientHandshakeAsync(TlsError::Success);
-
-    // Handshake should succeed
-    ASSERT_EQ(server_->DoHandshake(), TlsError::Success);
-    WaitForClientConnection();
-
-    // Test client/server read and writes
-    client_thread_ = std::thread([&]() {
-        EXPECT_TRUE(client_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-        // Try with overloaded ReadFully
-        std::vector<uint8_t> buf(msg_.size());
-        ASSERT_TRUE(client_->ReadFully(buf.data(), msg_.size()));
-        EXPECT_EQ(buf, msg_);
-    });
-
-    auto data = server_->ReadFully(msg_.size());
-    EXPECT_EQ(data, msg_);
-    EXPECT_TRUE(server_->WriteFully(
-            std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, NoTrustedCertificates) {
-    StartClientHandshakeAsync(TlsError::CertificateRejected);
-
-    // Handshake should not succeed
-    ASSERT_EQ(server_->DoHandshake(), TlsError::PeerRejectedCertificate);
-    WaitForClientConnection();
-
-    // All writes and reads should fail
-    client_thread_ = std::thread([&]() {
-        // Client write, server read should fail
-        EXPECT_FALSE(client_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-        auto data = client_->ReadFully(msg_.size());
-        EXPECT_EQ(data.size(), 0);
-    });
-
-    auto data = server_->ReadFully(msg_.size());
-    EXPECT_EQ(data.size(), 0);
-    EXPECT_FALSE(server_->WriteFully(
-            std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, AddTrustedCertificates) {
-    // Add peer certificates
-    EXPECT_TRUE(client_->AddTrustedCertificate(kTestRsa2048ServerCert));
-    EXPECT_TRUE(server_->AddTrustedCertificate(kTestRsa2048ClientCert));
-
-    StartClientHandshakeAsync(TlsError::Success);
-
-    // Handshake should succeed
-    ASSERT_EQ(server_->DoHandshake(), TlsError::Success);
-    WaitForClientConnection();
-
-    // All read writes should succeed
-    client_thread_ = std::thread([&]() {
-        EXPECT_TRUE(client_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-        auto data = client_->ReadFully(msg_.size());
-        EXPECT_EQ(data, msg_);
-    });
-
-    auto data = server_->ReadFully(msg_.size());
-    EXPECT_EQ(data, msg_);
-    EXPECT_TRUE(server_->WriteFully(
-            std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, AddTrustedCertificates_ClientWrongCert) {
-    // Server trusts a certificate, client has the wrong certificate
-    EXPECT_TRUE(server_->AddTrustedCertificate(kTestRsa2048UnknownCert));
-    // Client accepts any certificate
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-
-    // Without enabling EnableClientPostHandshakeCheck(), DoHandshake() will
-    // succeed, because in TLS 1.3, the client doesn't get notified if the
-    // server rejected the certificate until a read operation is called.
-    StartClientHandshakeAsync(TlsError::Success);
-
-    // Handshake should fail for server, succeed for client
-    ASSERT_EQ(server_->DoHandshake(), TlsError::CertificateRejected);
-    WaitForClientConnection();
-
-    // Client writes will succeed, everything else will fail.
-    client_thread_ = std::thread([&]() {
-        EXPECT_TRUE(client_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-        auto data = client_->ReadFully(msg_.size());
-        EXPECT_EQ(data.size(), 0);
-    });
-
-    auto data = server_->ReadFully(msg_.size());
-    EXPECT_EQ(data.size(), 0);
-    EXPECT_FALSE(server_->WriteFully(
-            std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, ExportKeyingMaterial) {
-    // Allow any certificate
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-
-    // Add peer certificates
-    EXPECT_TRUE(client_->AddTrustedCertificate(kTestRsa2048ServerCert));
-    EXPECT_TRUE(server_->AddTrustedCertificate(kTestRsa2048ClientCert));
-
-    StartClientHandshakeAsync(TlsError::Success);
-
-    // Handshake should succeed
-    ASSERT_EQ(server_->DoHandshake(), TlsError::Success);
-    WaitForClientConnection();
-
-    // Verify the client and server's exported key material match.
-    const size_t key_size = 64;
-    auto client_key_material = client_->ExportKeyingMaterial(key_size);
-    ASSERT_FALSE(client_key_material.empty());
-    auto server_key_material = server_->ExportKeyingMaterial(key_size);
-    ASSERT_TRUE(!server_key_material.empty());
-    ASSERT_EQ(client_key_material.size(), key_size);
-    ASSERT_EQ(client_key_material, server_key_material);
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetCertVerifyCallback_ClientAcceptsServerRejects) {
-    // Client accepts all
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    // Server rejects all
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 0; });
-    // Client handshake should succeed, because in TLS 1.3, client does not
-    // realize that the peer rejected the certificate until after a read
-    // operation.
-    StartClientHandshakeAsync(TlsError::Success);
-
-    // Server handshake should fail
-    ASSERT_EQ(server_->DoHandshake(), TlsError::CertificateRejected);
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetCertVerifyCallback_ClientAcceptsServerRejects_PostHSCheck) {
-    // Client accepts all
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    // Client should now get a failure in the handshake
-    client_->EnableClientPostHandshakeCheck(true);
-    // Server rejects all
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 0; });
-
-    // Client handshake should fail because server rejects everything
-    StartClientHandshakeAsync(TlsError::PeerRejectedCertificate);
-
-    // Server handshake should fail
-    ASSERT_EQ(server_->DoHandshake(), TlsError::CertificateRejected);
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetCertVerifyCallback_ClientRejectsServerAccepts) {
-    // Client rejects all
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 0; });
-    // Server accepts all
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    // Client handshake should fail
-    StartClientHandshakeAsync(TlsError::CertificateRejected);
-
-    // Server handshake should fail
-    ASSERT_EQ(server_->DoHandshake(), TlsError::PeerRejectedCertificate);
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetCertVerifyCallback_ClientRejectsServerAccepts_PostHSCheck) {
-    // Client rejects all
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 0; });
-    // This shouldn't affect the error types returned in the
-    // #SetCertVerifyCallback_ClientRejectsServerAccepts test, since
-    // the failure is still within the TLS 1.3 handshake.
-    client_->EnableClientPostHandshakeCheck(true);
-    // Server accepts all
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-
-    // Client handshake should fail
-    StartClientHandshakeAsync(TlsError::CertificateRejected);
-
-    // Server handshake should fail
-    ASSERT_EQ(server_->DoHandshake(), TlsError::PeerRejectedCertificate);
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, EnableClientPostHandshakeCheck_ClientWrongCert) {
-    client_->AddTrustedCertificate(kTestRsa2048ServerCert);
-    // client's DoHandshake() will fail if the server rejected the certificate
-    client_->EnableClientPostHandshakeCheck(true);
-
-    // Add peer certificates
-    EXPECT_TRUE(server_->AddTrustedCertificate(kTestRsa2048UnknownCert));
-
-    // Handshake should fail for client
-    StartClientHandshakeAsync(TlsError::PeerRejectedCertificate);
-
-    // Handshake should fail for server
-    ASSERT_EQ(server_->DoHandshake(), TlsError::CertificateRejected);
-    WaitForClientConnection();
-
-    // All read writes should fail
-    client_thread_ = std::thread([&]() {
-        EXPECT_FALSE(client_->WriteFully(
-                std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-        auto data = client_->ReadFully(msg_.size());
-        EXPECT_EQ(data.size(), 0);
-    });
-
-    auto data = server_->ReadFully(msg_.size());
-    EXPECT_EQ(data.size(), 0);
-    EXPECT_FALSE(server_->WriteFully(
-            std::string_view(reinterpret_cast<const char*>(msg_.data()), msg_.size())));
-
-    WaitForClientConnection();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetClientCAList_Empty) {
-    // Setting an empty CA list should not crash
-    server_->SetClientCAList(nullptr);
-    ASSERT_DEATH(
-            {
-                // Client cannot use this API
-                client_->SetClientCAList(nullptr);
-            },
-            "");
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetClientCAList_Smoke) {
-    auto bsslIssuerList = GetCAIssuerList();
-    server_->SetClientCAList(bsslIssuerList.get());
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-
-    client_thread_ = std::thread([&]() {
-        client_->SetCertificateCallback([&](SSL* ssl) -> int {
-            const STACK_OF(X509_NAME)* received = SSL_get_client_CA_list(ssl);
-            EXPECT_NE(received, nullptr);
-            const size_t num_names = sk_X509_NAME_num(received);
-            EXPECT_EQ(kCAIssuers.size(), num_names);
-
-            // Client initially registered with the wrong key. Let's change it
-            // here to verify this callback actually changes the client
-            // certificate to the right one.
-            EXPECT_TRUE(TlsConnection::SetCertAndKey(ssl, kTestRsa2048UnknownCert,
-                                                     kTestRsa2048UnknownPrivKey));
-
-            const size_t buf_size = 256;
-            uint8_t buf[buf_size];
-            size_t idx = 0;
-            for (auto& issuer : kCAIssuers) {
-                auto* name = sk_X509_NAME_value(received, idx++);
-                for (auto& attr : issuer) {
-                    EXPECT_EQ(X509_NAME_get_text_by_NID(name, attr.nid,
-                                                        reinterpret_cast<char*>(buf), buf_size),
-                              attr.val.size());
-                    std::vector<uint8_t> out(buf, buf + attr.val.size());
-                    EXPECT_EQ(out, attr.val);
-                }
-            }
-
-            return 1;
-        });
-        // Client handshake should succeed
-        ASSERT_EQ(client_->DoHandshake(), TlsError::Success);
-    });
-
-    EXPECT_TRUE(server_->AddTrustedCertificate(kTestRsa2048UnknownCert));
-    // Server handshake should succeed
-    ASSERT_EQ(server_->DoHandshake(), TlsError::Success);
-    client_thread_.join();
-}
-
-TEST_F(AdbWifiTlsConnectionTest, SetClientCAList_AdbCAList) {
-    bssl::UniquePtr<STACK_OF(X509_NAME)> ca_list(sk_X509_NAME_new_null());
-    std::string keyhash = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-    auto issuer = CreateCAIssuerFromEncodedKey(keyhash);
-    ASSERT_TRUE(bssl::PushToStack(ca_list.get(), std::move(issuer)));
-    server_->SetClientCAList(ca_list.get());
-    client_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-
-    client_thread_ = std::thread([&]() {
-        client_->SetCertificateCallback([&](SSL* ssl) -> int {
-            // Client initially registered with a certificate that is not trusted by
-            // the server. Let's test that we can change the certificate to the
-            // trusted one here.
-            const STACK_OF(X509_NAME)* received = SSL_get_client_CA_list(ssl);
-            EXPECT_NE(received, nullptr);
-            const size_t num_names = sk_X509_NAME_num(received);
-            EXPECT_EQ(1, num_names);
-
-            auto* name = sk_X509_NAME_value(received, 0);
-            EXPECT_NE(name, nullptr);
-            auto enc_key = ParseEncodedKeyFromCAIssuer(name);
-            EXPECT_EQ(keyhash, enc_key);
-
-            return 1;
-        });
-        // Client handshake should succeed
-        ASSERT_EQ(client_->DoHandshake(), TlsError::Success);
-    });
-
-    server_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-    // Server handshake should succeed
-    ASSERT_EQ(server_->DoHandshake(), TlsError::Success);
-    client_thread_.join();
-}
-}  // namespace tls
-}  // namespace adb
diff --git a/adb/tls/tls_connection.cpp b/adb/tls/tls_connection.cpp
deleted file mode 100644
index 853cdac..0000000
--- a/adb/tls/tls_connection.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "adb/tls/tls_connection.h"
-
-#include <algorithm>
-#include <vector>
-
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <openssl/err.h>
-#include <openssl/ssl.h>
-
-using android::base::borrowed_fd;
-
-namespace adb {
-namespace tls {
-
-namespace {
-
-static constexpr char kExportedKeyLabel[] = "adb-label";
-
-class TlsConnectionImpl : public TlsConnection {
-  public:
-    explicit TlsConnectionImpl(Role role, std::string_view cert, std::string_view priv_key,
-                               borrowed_fd fd);
-    ~TlsConnectionImpl() override;
-
-    bool AddTrustedCertificate(std::string_view cert) override;
-    void SetCertVerifyCallback(CertVerifyCb cb) override;
-    void SetCertificateCallback(SetCertCb cb) override;
-    void SetClientCAList(STACK_OF(X509_NAME) * ca_list) override;
-    std::vector<uint8_t> ExportKeyingMaterial(size_t length) override;
-    void EnableClientPostHandshakeCheck(bool enable) override;
-    TlsError DoHandshake() override;
-    std::vector<uint8_t> ReadFully(size_t size) override;
-    bool ReadFully(void* buf, size_t size) override;
-    bool WriteFully(std::string_view data) override;
-
-    static bssl::UniquePtr<EVP_PKEY> EvpPkeyFromPEM(std::string_view pem);
-    static bssl::UniquePtr<CRYPTO_BUFFER> BufferFromPEM(std::string_view pem);
-
-  private:
-    static int SSLSetCertVerifyCb(X509_STORE_CTX* ctx, void* opaque);
-    static int SSLSetCertCb(SSL* ssl, void* opaque);
-
-    static bssl::UniquePtr<X509> X509FromBuffer(bssl::UniquePtr<CRYPTO_BUFFER> buffer);
-    static const char* SSLErrorString();
-    void Invalidate();
-    TlsError GetFailureReason(int err);
-    const char* RoleToString() { return role_ == Role::Server ? kServerRoleStr : kClientRoleStr; }
-
-    Role role_;
-    bssl::UniquePtr<EVP_PKEY> priv_key_;
-    bssl::UniquePtr<CRYPTO_BUFFER> cert_;
-
-    bssl::UniquePtr<STACK_OF(X509_NAME)> ca_list_;
-    bssl::UniquePtr<SSL_CTX> ssl_ctx_;
-    bssl::UniquePtr<SSL> ssl_;
-    std::vector<bssl::UniquePtr<X509>> known_certificates_;
-    bool client_verify_post_handshake_ = false;
-
-    CertVerifyCb cert_verify_cb_;
-    SetCertCb set_cert_cb_;
-    borrowed_fd fd_;
-    static constexpr char kClientRoleStr[] = "[client]: ";
-    static constexpr char kServerRoleStr[] = "[server]: ";
-};  // TlsConnectionImpl
-
-TlsConnectionImpl::TlsConnectionImpl(Role role, std::string_view cert, std::string_view priv_key,
-                                     borrowed_fd fd)
-    : role_(role), fd_(fd) {
-    CHECK(!cert.empty() && !priv_key.empty());
-    LOG(INFO) << RoleToString() << "Initializing adbwifi TlsConnection";
-    cert_ = BufferFromPEM(cert);
-    CHECK(cert_);
-    priv_key_ = EvpPkeyFromPEM(priv_key);
-    CHECK(priv_key_);
-}
-
-TlsConnectionImpl::~TlsConnectionImpl() {
-    // shutdown the SSL connection
-    if (ssl_ != nullptr) {
-        SSL_shutdown(ssl_.get());
-    }
-}
-
-// static
-const char* TlsConnectionImpl::SSLErrorString() {
-    auto sslerr = ERR_peek_last_error();
-    return ERR_reason_error_string(sslerr);
-}
-
-// static
-bssl::UniquePtr<EVP_PKEY> TlsConnectionImpl::EvpPkeyFromPEM(std::string_view pem) {
-    bssl::UniquePtr<BIO> bio(BIO_new_mem_buf(pem.data(), pem.size()));
-    return bssl::UniquePtr<EVP_PKEY>(PEM_read_bio_PrivateKey(bio.get(), nullptr, nullptr, nullptr));
-}
-
-// static
-bssl::UniquePtr<CRYPTO_BUFFER> TlsConnectionImpl::BufferFromPEM(std::string_view pem) {
-    bssl::UniquePtr<BIO> bio(BIO_new_mem_buf(pem.data(), pem.size()));
-    char* name = nullptr;
-    char* header = nullptr;
-    uint8_t* data = nullptr;
-    long data_len = 0;
-
-    if (!PEM_read_bio(bio.get(), &name, &header, &data, &data_len)) {
-        LOG(ERROR) << "Failed to read certificate";
-        return nullptr;
-    }
-    OPENSSL_free(name);
-    OPENSSL_free(header);
-
-    auto ret = bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new(data, data_len, nullptr));
-    OPENSSL_free(data);
-    return ret;
-}
-
-// static
-bssl::UniquePtr<X509> TlsConnectionImpl::X509FromBuffer(bssl::UniquePtr<CRYPTO_BUFFER> buffer) {
-    if (!buffer) {
-        return nullptr;
-    }
-    return bssl::UniquePtr<X509>(X509_parse_from_buffer(buffer.get()));
-}
-
-// static
-int TlsConnectionImpl::SSLSetCertVerifyCb(X509_STORE_CTX* ctx, void* opaque) {
-    auto* p = reinterpret_cast<TlsConnectionImpl*>(opaque);
-    return p->cert_verify_cb_(ctx);
-}
-
-// static
-int TlsConnectionImpl::SSLSetCertCb(SSL* ssl, void* opaque) {
-    auto* p = reinterpret_cast<TlsConnectionImpl*>(opaque);
-    return p->set_cert_cb_(ssl);
-}
-
-bool TlsConnectionImpl::AddTrustedCertificate(std::string_view cert) {
-    // Create X509 buffer from the certificate string
-    auto buf = X509FromBuffer(BufferFromPEM(cert));
-    if (buf == nullptr) {
-        LOG(ERROR) << RoleToString() << "Failed to create a X509 buffer for the certificate.";
-        return false;
-    }
-    known_certificates_.push_back(std::move(buf));
-    return true;
-}
-
-void TlsConnectionImpl::SetCertVerifyCallback(CertVerifyCb cb) {
-    cert_verify_cb_ = cb;
-}
-
-void TlsConnectionImpl::SetCertificateCallback(SetCertCb cb) {
-    set_cert_cb_ = cb;
-}
-
-void TlsConnectionImpl::SetClientCAList(STACK_OF(X509_NAME) * ca_list) {
-    CHECK(role_ == Role::Server);
-    ca_list_.reset(ca_list != nullptr ? SSL_dup_CA_list(ca_list) : nullptr);
-}
-
-std::vector<uint8_t> TlsConnectionImpl::ExportKeyingMaterial(size_t length) {
-    if (ssl_.get() == nullptr) {
-        return {};
-    }
-
-    std::vector<uint8_t> out(length);
-    if (SSL_export_keying_material(ssl_.get(), out.data(), out.size(), kExportedKeyLabel,
-                                   sizeof(kExportedKeyLabel), nullptr, 0, false) == 0) {
-        return {};
-    }
-    return out;
-}
-
-void TlsConnectionImpl::EnableClientPostHandshakeCheck(bool enable) {
-    client_verify_post_handshake_ = enable;
-}
-
-TlsConnection::TlsError TlsConnectionImpl::GetFailureReason(int err) {
-    switch (ERR_GET_REASON(err)) {
-        case SSL_R_SSLV3_ALERT_BAD_CERTIFICATE:
-        case SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE:
-        case SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED:
-        case SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED:
-        case SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN:
-        case SSL_R_TLSV1_ALERT_ACCESS_DENIED:
-        case SSL_R_TLSV1_ALERT_UNKNOWN_CA:
-        case SSL_R_TLSV1_CERTIFICATE_REQUIRED:
-            return TlsError::PeerRejectedCertificate;
-        case SSL_R_CERTIFICATE_VERIFY_FAILED:
-            return TlsError::CertificateRejected;
-        default:
-            return TlsError::UnknownFailure;
-    }
-}
-
-TlsConnection::TlsError TlsConnectionImpl::DoHandshake() {
-    LOG(INFO) << RoleToString() << "Starting adbwifi tls handshake";
-    ssl_ctx_.reset(SSL_CTX_new(TLS_method()));
-    // TODO: Remove set_max_proto_version() once external/boringssl is updated
-    // past
-    // https://boringssl.googlesource.com/boringssl/+/58d56f4c59969a23e5f52014e2651c76fea2f877
-    if (ssl_ctx_.get() == nullptr ||
-        !SSL_CTX_set_min_proto_version(ssl_ctx_.get(), TLS1_3_VERSION) ||
-        !SSL_CTX_set_max_proto_version(ssl_ctx_.get(), TLS1_3_VERSION)) {
-        LOG(ERROR) << RoleToString() << "Failed to create SSL context";
-        return TlsError::UnknownFailure;
-    }
-
-    // Register user-supplied known certificates
-    for (auto const& cert : known_certificates_) {
-        if (X509_STORE_add_cert(SSL_CTX_get_cert_store(ssl_ctx_.get()), cert.get()) == 0) {
-            LOG(ERROR) << RoleToString() << "Unable to add certificates into the X509_STORE";
-            return TlsError::UnknownFailure;
-        }
-    }
-
-    // Custom certificate verification
-    if (cert_verify_cb_) {
-        SSL_CTX_set_cert_verify_callback(ssl_ctx_.get(), SSLSetCertVerifyCb, this);
-    }
-
-    // set select certificate callback, if any.
-    if (set_cert_cb_) {
-        SSL_CTX_set_cert_cb(ssl_ctx_.get(), SSLSetCertCb, this);
-    }
-
-    // Server-allowed client CA list
-    if (ca_list_ != nullptr) {
-        bssl::UniquePtr<STACK_OF(X509_NAME)> names(SSL_dup_CA_list(ca_list_.get()));
-        SSL_CTX_set_client_CA_list(ssl_ctx_.get(), names.release());
-    }
-
-    // Register our certificate and private key.
-    std::vector<CRYPTO_BUFFER*> cert_chain = {
-            cert_.get(),
-    };
-    if (!SSL_CTX_set_chain_and_key(ssl_ctx_.get(), cert_chain.data(), cert_chain.size(),
-                                   priv_key_.get(), nullptr)) {
-        LOG(ERROR) << RoleToString()
-                   << "Unable to register the certificate chain file and private key ["
-                   << SSLErrorString() << "]";
-        Invalidate();
-        return TlsError::UnknownFailure;
-    }
-
-    SSL_CTX_set_verify(ssl_ctx_.get(), SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr);
-
-    // Okay! Let's try to do the handshake!
-    ssl_.reset(SSL_new(ssl_ctx_.get()));
-    if (!SSL_set_fd(ssl_.get(), fd_.get())) {
-        LOG(ERROR) << RoleToString() << "SSL_set_fd failed. [" << SSLErrorString() << "]";
-        return TlsError::UnknownFailure;
-    }
-
-    switch (role_) {
-        case Role::Server:
-            SSL_set_accept_state(ssl_.get());
-            break;
-        case Role::Client:
-            SSL_set_connect_state(ssl_.get());
-            break;
-    }
-    if (SSL_do_handshake(ssl_.get()) != 1) {
-        LOG(ERROR) << RoleToString() << "Handshake failed in SSL_accept/SSL_connect ["
-                   << SSLErrorString() << "]";
-        auto sslerr = ERR_get_error();
-        Invalidate();
-        return GetFailureReason(sslerr);
-    }
-
-    if (client_verify_post_handshake_ && role_ == Role::Client) {
-        uint8_t check;
-        // Try to peek one byte for any failures. This assumes on success that
-        // the server actually sends something.
-        if (SSL_peek(ssl_.get(), &check, 1) <= 0) {
-            LOG(ERROR) << RoleToString() << "Post-handshake SSL_peek failed [" << SSLErrorString()
-                       << "]";
-            auto sslerr = ERR_get_error();
-            Invalidate();
-            return GetFailureReason(sslerr);
-        }
-    }
-
-    LOG(INFO) << RoleToString() << "Handshake succeeded.";
-    return TlsError::Success;
-}
-
-void TlsConnectionImpl::Invalidate() {
-    ssl_.reset();
-    ssl_ctx_.reset();
-}
-
-std::vector<uint8_t> TlsConnectionImpl::ReadFully(size_t size) {
-    std::vector<uint8_t> buf(size);
-    if (!ReadFully(buf.data(), buf.size())) {
-        return {};
-    }
-
-    return buf;
-}
-
-bool TlsConnectionImpl::ReadFully(void* buf, size_t size) {
-    CHECK_GT(size, 0U);
-    if (!ssl_) {
-        LOG(ERROR) << RoleToString() << "Tried to read on a null SSL connection";
-        return false;
-    }
-
-    size_t offset = 0;
-    uint8_t* p8 = reinterpret_cast<uint8_t*>(buf);
-    while (size > 0) {
-        int bytes_read =
-                SSL_read(ssl_.get(), p8 + offset, std::min(static_cast<size_t>(INT_MAX), size));
-        if (bytes_read <= 0) {
-            LOG(ERROR) << RoleToString() << "SSL_read failed [" << SSLErrorString() << "]";
-            return false;
-        }
-        size -= bytes_read;
-        offset += bytes_read;
-    }
-    return true;
-}
-
-bool TlsConnectionImpl::WriteFully(std::string_view data) {
-    CHECK(!data.empty());
-    if (!ssl_) {
-        LOG(ERROR) << RoleToString() << "Tried to read on a null SSL connection";
-        return false;
-    }
-
-    while (!data.empty()) {
-        int bytes_out = SSL_write(ssl_.get(), data.data(),
-                                  std::min(static_cast<size_t>(INT_MAX), data.size()));
-        if (bytes_out <= 0) {
-            LOG(ERROR) << RoleToString() << "SSL_write failed [" << SSLErrorString() << "]";
-            return false;
-        }
-        data = data.substr(bytes_out);
-    }
-    return true;
-}
-}  // namespace
-
-// static
-std::unique_ptr<TlsConnection> TlsConnection::Create(TlsConnection::Role role,
-                                                     std::string_view cert,
-                                                     std::string_view priv_key, borrowed_fd fd) {
-    CHECK(!cert.empty());
-    CHECK(!priv_key.empty());
-
-    return std::make_unique<TlsConnectionImpl>(role, cert, priv_key, fd);
-}
-
-// static
-bool TlsConnection::SetCertAndKey(SSL* ssl, std::string_view cert, std::string_view priv_key) {
-    CHECK(ssl);
-    // Note: declaring these in local scope is okay because
-    // SSL_set_chain_and_key will increase the refcount (bssl::UpRef).
-    auto x509_cert = TlsConnectionImpl::BufferFromPEM(cert);
-    auto evp_pkey = TlsConnectionImpl::EvpPkeyFromPEM(priv_key);
-    if (x509_cert == nullptr || evp_pkey == nullptr) {
-        return false;
-    }
-
-    std::vector<CRYPTO_BUFFER*> cert_chain = {
-            x509_cert.get(),
-    };
-    if (!SSL_set_chain_and_key(ssl, cert_chain.data(), cert_chain.size(), evp_pkey.get(),
-                               nullptr)) {
-        LOG(ERROR) << "SSL_set_chain_and_key failed";
-        return false;
-    }
-
-    return true;
-}
-
-}  // namespace tls
-}  // namespace adb
diff --git a/adb/tools/Android.bp b/adb/tools/Android.bp
deleted file mode 100644
index 71e32b7..0000000
--- a/adb/tools/Android.bp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2017 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.
-
-cc_binary_host {
-    name: "check_ms_os_desc",
-
-    defaults: ["adb_defaults"],
-
-    srcs: [
-        "check_ms_os_desc.cpp",
-    ],
-
-    static_libs: [
-        "libbase",
-        "libusb",
-    ],
-
-    stl: "libc++_static",
-
-    dist: {
-        targets: [
-            "sdk",
-        ],
-    },
-}
diff --git a/adb/tools/check_ms_os_desc.cpp b/adb/tools/check_ms_os_desc.cpp
deleted file mode 100644
index 8e85809..0000000
--- a/adb/tools/check_ms_os_desc.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <err.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <optional>
-#include <string>
-#include <vector>
-
-#include <libusb/libusb.h>
-
-static bool is_adb_device(libusb_device* device) {
-    libusb_device_descriptor device_desc;
-    libusb_get_device_descriptor(device, &device_desc);
-    if (device_desc.bDeviceClass != 0) {
-        return false;
-    }
-
-    libusb_config_descriptor* config_desc;
-    int rc = libusb_get_active_config_descriptor(device, &config_desc);
-    if (rc != 0) {
-        fprintf(stderr, "failed to get config descriptor for device %u:%u: %s\n",
-                libusb_get_bus_number(device), libusb_get_port_number(device),
-                libusb_error_name(rc));
-        return false;
-    }
-
-    for (size_t i = 0; i < config_desc->bNumInterfaces; ++i) {
-        const libusb_interface* interface = &config_desc->interface[i];
-        for (int j = 0; j < interface->num_altsetting; ++j) {
-            const libusb_interface_descriptor* interface_descriptor = &interface->altsetting[j];
-            if (interface_descriptor->bInterfaceClass == 0xff &&
-                interface_descriptor->bInterfaceSubClass == 0x42 &&
-                interface_descriptor->bInterfaceProtocol == 1) {
-                return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-static std::optional<std::vector<uint8_t>> get_descriptor(libusb_device_handle* handle,
-                                                          uint8_t type, uint8_t index,
-                                                          uint16_t length) {
-    std::vector<uint8_t> result;
-    result.resize(length);
-    int rc = libusb_get_descriptor(handle, type, index, result.data(), result.size());
-    if (rc < 0) {
-        fprintf(stderr, "libusb_get_descriptor failed: %s\n", libusb_error_name(rc));
-        return std::nullopt;
-    }
-    result.resize(rc);
-    return result;
-}
-
-static std::optional<std::string> get_string_descriptor(libusb_device_handle* handle,
-                                                        uint8_t index) {
-    std::string result;
-    result.resize(4096);
-    int rc = libusb_get_string_descriptor_ascii(
-            handle, index, reinterpret_cast<uint8_t*>(result.data()), result.size());
-    if (rc < 0) {
-        fprintf(stderr, "libusb_get_string_descriptor_ascii failed: %s\n", libusb_error_name(rc));
-        return std::nullopt;
-    }
-    result.resize(rc);
-    return result;
-}
-
-static void check_ms_os_desc_v1(libusb_device_handle* device_handle, const std::string& serial) {
-    auto os_desc = get_descriptor(device_handle, 0x03, 0xEE, 0x12);
-    if (!os_desc) {
-        errx(1, "failed to retrieve MS OS descriptor");
-    }
-
-    if (os_desc->size() != 0x12) {
-        errx(1, "os descriptor size mismatch");
-    }
-
-    if (memcmp(os_desc->data() + 2, u"MSFT100\0", 14) != 0) {
-        errx(1, "os descriptor signature mismatch");
-    }
-
-    uint8_t vendor_code = (*os_desc)[16];
-    uint8_t pad = (*os_desc)[17];
-
-    if (pad != 0) {
-        errx(1, "os descriptor padding non-zero");
-    }
-
-    std::vector<uint8_t> data;
-    data.resize(0x10);
-    int rc = libusb_control_transfer(device_handle, 0xC0, vendor_code, 0x00, 0x04, data.data(),
-                                     data.size(), 0);
-    if (rc != 0x10) {
-        errx(1, "failed to retrieve MS OS v1 compat descriptor header: %s", libusb_error_name(rc));
-    }
-
-    struct __attribute__((packed)) ms_os_desc_v1_header {
-        uint32_t dwLength;
-        uint16_t bcdVersion;
-        uint16_t wIndex;
-        uint8_t bCount;
-        uint8_t reserved[7];
-    };
-    static_assert(sizeof(ms_os_desc_v1_header) == 0x10);
-
-    ms_os_desc_v1_header hdr;
-    memcpy(&hdr, data.data(), data.size());
-
-    data.resize(hdr.dwLength);
-    rc = libusb_control_transfer(device_handle, 0xC0, vendor_code, 0x00, 0x04, data.data(),
-                                 data.size(), 0);
-    if (static_cast<size_t>(rc) != data.size()) {
-        errx(1, "failed to retrieve MS OS v1 compat descriptor: %s", libusb_error_name(rc));
-    }
-
-    struct __attribute__((packed)) ms_os_desc_v1_function {
-        uint8_t bFirstInterfaceNumber;
-        uint8_t reserved1;
-        uint8_t compatibleID[8];
-        uint8_t subCompatibleID[8];
-        uint8_t reserved2[6];
-    };
-
-    if (sizeof(ms_os_desc_v1_header) + hdr.bCount * sizeof(ms_os_desc_v1_function) != data.size()) {
-        errx(1, "MS OS v1 compat descriptor size mismatch");
-    }
-
-    for (int i = 0; i < hdr.bCount; ++i) {
-        ms_os_desc_v1_function function;
-        memcpy(&function,
-               data.data() + sizeof(ms_os_desc_v1_header) + i * sizeof(ms_os_desc_v1_function),
-               sizeof(function));
-        if (memcmp("WINUSB\0\0", function.compatibleID, 8) == 0) {
-            return;
-        }
-    }
-
-    errx(1, "failed to find v1 MS OS descriptor specifying WinUSB for device %s", serial.c_str());
-}
-
-static void check_ms_os_desc_v2(libusb_device_handle* device_handle, const std::string& serial) {
-    libusb_bos_descriptor* bos;
-    int rc = libusb_get_bos_descriptor(device_handle, &bos);
-
-    if (rc != 0) {
-        fprintf(stderr, "failed to get bos descriptor for device %s\n", serial.c_str());
-        return;
-    }
-
-    for (size_t i = 0; i < bos->bNumDeviceCaps; ++i) {
-        libusb_bos_dev_capability_descriptor* desc = bos->dev_capability[i];
-        if (desc->bDescriptorType != LIBUSB_DT_DEVICE_CAPABILITY) {
-            errx(1, "invalid BOS descriptor type: %d", desc->bDescriptorType);
-        }
-
-        if (desc->bDevCapabilityType != 0x05 /* PLATFORM */) {
-            fprintf(stderr, "skipping non-platform dev capability: %#02x\n",
-                    desc->bDevCapabilityType);
-            continue;
-        }
-
-        if (desc->bLength < sizeof(*desc) + 16) {
-            errx(1, "received device capability descriptor not long enough to contain a UUID?");
-        }
-
-        char uuid[16];
-        memcpy(uuid, desc->dev_capability_data, 16);
-
-        constexpr uint8_t ms_os_uuid[16] = {0xD8, 0xDD, 0x60, 0xDF, 0x45, 0x89, 0x4C, 0xC7,
-                                            0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F};
-        if (memcmp(uuid, ms_os_uuid, 16) != 0) {
-            fprintf(stderr, "skipping unknown UUID\n");
-            continue;
-        }
-
-        size_t data_length = desc->bLength - sizeof(*desc) - 16;
-        fprintf(stderr, "found MS OS 2.0 descriptor, length = %zu\n", data_length);
-
-        // Linux does not appear to support MS OS 2.0 Descriptors.
-        // TODO: If and when it does, verify that we're emitting them properly.
-    }
-}
-
-int main(int argc, char** argv) {
-    libusb_context* ctx;
-    if (libusb_init(&ctx) != 0) {
-        errx(1, "failed to initialize libusb context");
-    }
-
-    libusb_device** device_list = nullptr;
-    ssize_t device_count = libusb_get_device_list(ctx, &device_list);
-    if (device_count < 0) {
-        errx(1, "libusb_get_device_list failed");
-    }
-
-    const char* expected_serial = getenv("ANDROID_SERIAL");
-    bool found = false;
-
-    for (ssize_t i = 0; i < device_count; ++i) {
-        libusb_device* device = device_list[i];
-        if (!is_adb_device(device)) {
-            continue;
-        }
-
-        libusb_device_handle* device_handle = nullptr;
-        int rc = libusb_open(device, &device_handle);
-        if (rc != 0) {
-            fprintf(stderr, "failed to open device %u:%u: %s\n", libusb_get_bus_number(device),
-                    libusb_get_port_number(device), libusb_error_name(rc));
-            continue;
-        }
-
-        libusb_device_descriptor device_desc;
-        libusb_get_device_descriptor(device, &device_desc);
-
-        std::optional<std::string> serial =
-                get_string_descriptor(device_handle, device_desc.iSerialNumber);
-        if (!serial) {
-            errx(1, "failed to get serial for device %u:%u", libusb_get_bus_number(device),
-                 libusb_get_port_number(device));
-        }
-
-        if (expected_serial && *serial != expected_serial) {
-            fprintf(stderr, "skipping %s (wanted %s)\n", serial->c_str(), expected_serial);
-            continue;
-        }
-
-        // Check for MS OS Descriptor v1.
-        // https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeusb/c2f351f9-84d2-4a1b-9fe3-a6ca195f84d0
-        fprintf(stderr, "fetching v1 OS descriptor from device %s\n", serial->c_str());
-        check_ms_os_desc_v1(device_handle, *serial);
-        fprintf(stderr, "found v1 OS descriptor for device %s\n", serial->c_str());
-
-        // Read BOS for MS OS Descriptor 2.0 descriptors:
-        // http://download.microsoft.com/download/3/5/6/3563ED4A-F318-4B66-A181-AB1D8F6FD42D/MS_OS_2_0_desc.docx
-        fprintf(stderr, "fetching v2 OS descriptor from device %s\n", serial->c_str());
-        check_ms_os_desc_v2(device_handle, *serial);
-
-        found = true;
-    }
-
-    if (expected_serial && !found) {
-        errx(1, "failed to find device with serial %s", expected_serial);
-    }
-    return 0;
-}
diff --git a/adb/trace.sh b/adb/trace.sh
deleted file mode 100755
index 49e5026..0000000
--- a/adb/trace.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-set -e
-
-if ! [ -e $ANDROID_BUILD_TOP/external/chromium-trace/systrace.py ]; then
-    echo "error: can't find systrace.py at \$ANDROID_BUILD_TOP/external/chromium-trace/systrace.py"
-    exit 1
-fi
-
-adb shell "sleep 1; atrace -b 65536 --async_start adb sched power freq idle disk mmc load"
-adb shell killall adbd
-adb wait-for-device
-echo "press enter to finish..."
-read
-TRACE_TEMP=`mktemp /tmp/trace.XXXXXX`
-echo Saving trace to ${TRACE_TEMP}, html file to ${TRACE_TEMP}.html
-adb shell atrace --async_stop -z > ${TRACE_TEMP}
-$ANDROID_BUILD_TOP/external/chromium-trace/systrace.py --from-file=${TRACE_TEMP} -o ${TRACE_TEMP}.html
-chrome ${TRACE_TEMP}.html
diff --git a/adb/transport.cpp b/adb/transport.cpp
deleted file mode 100644
index fe286de..0000000
--- a/adb/transport.cpp
+++ /dev/null
@@ -1,1534 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG TRANSPORT
-
-#include "sysdeps.h"
-
-#include "transport.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <deque>
-#include <list>
-#include <memory>
-#include <mutex>
-#include <set>
-#include <thread>
-
-#include <adb/crypto/rsa_2048_key.h>
-#include <adb/crypto/x509_generator.h>
-#include <adb/tls/tls_connection.h>
-#include <android-base/logging.h>
-#include <android-base/parsenetaddress.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <android-base/thread_annotations.h>
-
-#include <diagnose_usb.h>
-
-#include "adb.h"
-#include "adb_auth.h"
-#include "adb_io.h"
-#include "adb_trace.h"
-#include "adb_utils.h"
-#include "fdevent/fdevent.h"
-#include "sysdeps/chrono.h"
-
-using namespace adb::crypto;
-using namespace adb::tls;
-using android::base::ScopedLockAssertion;
-using TlsError = TlsConnection::TlsError;
-
-static void remove_transport(atransport* transport);
-static void transport_destroy(atransport* transport);
-
-// TODO: unordered_map<TransportId, atransport*>
-static auto& transport_list = *new std::list<atransport*>();
-static auto& pending_list = *new std::list<atransport*>();
-
-static auto& transport_lock = *new std::recursive_mutex();
-
-const char* const kFeatureShell2 = "shell_v2";
-const char* const kFeatureCmd = "cmd";
-const char* const kFeatureStat2 = "stat_v2";
-const char* const kFeatureLs2 = "ls_v2";
-const char* const kFeatureLibusb = "libusb";
-const char* const kFeaturePushSync = "push_sync";
-const char* const kFeatureApex = "apex";
-const char* const kFeatureFixedPushMkdir = "fixed_push_mkdir";
-const char* const kFeatureAbb = "abb";
-const char* const kFeatureFixedPushSymlinkTimestamp = "fixed_push_symlink_timestamp";
-const char* const kFeatureAbbExec = "abb_exec";
-const char* const kFeatureRemountShell = "remount_shell";
-const char* const kFeatureSendRecv2 = "sendrecv_v2";
-const char* const kFeatureSendRecv2Brotli = "sendrecv_v2_brotli";
-
-namespace {
-
-#if ADB_HOST
-// Tracks and handles atransport*s that are attempting reconnection.
-class ReconnectHandler {
-  public:
-    ReconnectHandler() = default;
-    ~ReconnectHandler() = default;
-
-    // Starts the ReconnectHandler thread.
-    void Start();
-
-    // Requests the ReconnectHandler thread to stop.
-    void Stop();
-
-    // Adds the atransport* to the queue of reconnect attempts.
-    void TrackTransport(atransport* transport);
-
-    // Wake up the ReconnectHandler thread to have it check for kicked transports.
-    void CheckForKicked();
-
-  private:
-    // The main thread loop.
-    void Run();
-
-    // Tracks a reconnection attempt.
-    struct ReconnectAttempt {
-        atransport* transport;
-        std::chrono::steady_clock::time_point reconnect_time;
-        size_t attempts_left;
-
-        bool operator<(const ReconnectAttempt& rhs) const {
-            if (reconnect_time == rhs.reconnect_time) {
-                return reinterpret_cast<uintptr_t>(transport) <
-                       reinterpret_cast<uintptr_t>(rhs.transport);
-            }
-            return reconnect_time < rhs.reconnect_time;
-        }
-    };
-
-    // Only retry for up to one minute.
-    static constexpr const std::chrono::seconds kDefaultTimeout = 10s;
-    static constexpr const size_t kMaxAttempts = 6;
-
-    // Protects all members.
-    std::mutex reconnect_mutex_;
-    bool running_ GUARDED_BY(reconnect_mutex_) = true;
-    std::thread handler_thread_;
-    std::condition_variable reconnect_cv_;
-    std::set<ReconnectAttempt> reconnect_queue_ GUARDED_BY(reconnect_mutex_);
-
-    DISALLOW_COPY_AND_ASSIGN(ReconnectHandler);
-};
-
-void ReconnectHandler::Start() {
-    check_main_thread();
-    handler_thread_ = std::thread(&ReconnectHandler::Run, this);
-}
-
-void ReconnectHandler::Stop() {
-    check_main_thread();
-    {
-        std::lock_guard<std::mutex> lock(reconnect_mutex_);
-        running_ = false;
-    }
-    reconnect_cv_.notify_one();
-    handler_thread_.join();
-
-    // Drain the queue to free all resources.
-    std::lock_guard<std::mutex> lock(reconnect_mutex_);
-    while (!reconnect_queue_.empty()) {
-        ReconnectAttempt attempt = *reconnect_queue_.begin();
-        reconnect_queue_.erase(reconnect_queue_.begin());
-        remove_transport(attempt.transport);
-    }
-}
-
-void ReconnectHandler::TrackTransport(atransport* transport) {
-    check_main_thread();
-    {
-        std::lock_guard<std::mutex> lock(reconnect_mutex_);
-        if (!running_) return;
-        // Arbitrary sleep to give adbd time to get ready, if we disconnected because it exited.
-        auto reconnect_time = std::chrono::steady_clock::now() + 250ms;
-        reconnect_queue_.emplace(
-                ReconnectAttempt{transport, reconnect_time, ReconnectHandler::kMaxAttempts});
-    }
-    reconnect_cv_.notify_one();
-}
-
-void ReconnectHandler::CheckForKicked() {
-    reconnect_cv_.notify_one();
-}
-
-void ReconnectHandler::Run() {
-    while (true) {
-        ReconnectAttempt attempt;
-        {
-            std::unique_lock<std::mutex> lock(reconnect_mutex_);
-            ScopedLockAssertion assume_lock(reconnect_mutex_);
-
-            if (!reconnect_queue_.empty()) {
-                // FIXME: libstdc++ (used on Windows) implements condition_variable with
-                //        system_clock as its clock, so we're probably hosed if the clock changes,
-                //        even if we use steady_clock throughout. This problem goes away once we
-                //        switch to libc++.
-                reconnect_cv_.wait_until(lock, reconnect_queue_.begin()->reconnect_time);
-            } else {
-                reconnect_cv_.wait(lock);
-            }
-
-            if (!running_) return;
-
-            // Scan the whole list for kicked transports, so that we immediately handle an explicit
-            // disconnect request.
-            bool kicked = false;
-            for (auto it = reconnect_queue_.begin(); it != reconnect_queue_.end();) {
-                if (it->transport->kicked()) {
-                    D("transport %s was kicked. giving up on it.", it->transport->serial.c_str());
-                    remove_transport(it->transport);
-                    it = reconnect_queue_.erase(it);
-                } else {
-                    ++it;
-                }
-                kicked = true;
-            }
-
-            if (reconnect_queue_.empty()) continue;
-
-            // Go back to sleep if we either woke up spuriously, or we were woken up to remove
-            // a kicked transport, and the first transport isn't ready for reconnection yet.
-            auto now = std::chrono::steady_clock::now();
-            if (reconnect_queue_.begin()->reconnect_time > now) {
-                continue;
-            }
-
-            attempt = *reconnect_queue_.begin();
-            reconnect_queue_.erase(reconnect_queue_.begin());
-        }
-        D("attempting to reconnect %s", attempt.transport->serial.c_str());
-
-        switch (attempt.transport->Reconnect()) {
-            case ReconnectResult::Retry: {
-                D("attempting to reconnect %s failed.", attempt.transport->serial.c_str());
-                if (attempt.attempts_left == 0) {
-                    D("transport %s exceeded the number of retry attempts. giving up on it.",
-                      attempt.transport->serial.c_str());
-                    remove_transport(attempt.transport);
-                    continue;
-                }
-
-                std::lock_guard<std::mutex> lock(reconnect_mutex_);
-                reconnect_queue_.emplace(ReconnectAttempt{
-                        attempt.transport,
-                        std::chrono::steady_clock::now() + ReconnectHandler::kDefaultTimeout,
-                        attempt.attempts_left - 1});
-                continue;
-            }
-
-            case ReconnectResult::Success:
-                D("reconnection to %s succeeded.", attempt.transport->serial.c_str());
-                register_transport(attempt.transport);
-                continue;
-
-            case ReconnectResult::Abort:
-                D("cancelling reconnection attempt to %s.", attempt.transport->serial.c_str());
-                remove_transport(attempt.transport);
-                continue;
-        }
-    }
-}
-
-static auto& reconnect_handler = *new ReconnectHandler();
-
-#endif
-
-}  // namespace
-
-TransportId NextTransportId() {
-    static std::atomic<TransportId> next(1);
-    return next++;
-}
-
-void Connection::Reset() {
-    LOG(INFO) << "Connection::Reset(): stopping";
-    Stop();
-}
-
-BlockingConnectionAdapter::BlockingConnectionAdapter(std::unique_ptr<BlockingConnection> connection)
-    : underlying_(std::move(connection)) {}
-
-BlockingConnectionAdapter::~BlockingConnectionAdapter() {
-    LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_ << "): destructing";
-    Stop();
-}
-
-void BlockingConnectionAdapter::Start() {
-    std::lock_guard<std::mutex> lock(mutex_);
-    if (started_) {
-        LOG(FATAL) << "BlockingConnectionAdapter(" << this->transport_name_
-                   << "): started multiple times";
-    }
-
-    StartReadThread();
-
-    write_thread_ = std::thread([this]() {
-        LOG(INFO) << this->transport_name_ << ": write thread spawning";
-        while (true) {
-            std::unique_lock<std::mutex> lock(mutex_);
-            ScopedLockAssertion assume_locked(mutex_);
-            cv_.wait(lock, [this]() REQUIRES(mutex_) {
-                return this->stopped_ || !this->write_queue_.empty();
-            });
-
-            if (this->stopped_) {
-                return;
-            }
-
-            std::unique_ptr<apacket> packet = std::move(this->write_queue_.front());
-            this->write_queue_.pop_front();
-            lock.unlock();
-
-            if (!this->underlying_->Write(packet.get())) {
-                break;
-            }
-        }
-        std::call_once(this->error_flag_, [this]() { this->error_callback_(this, "write failed"); });
-    });
-
-    started_ = true;
-}
-
-void BlockingConnectionAdapter::StartReadThread() {
-    read_thread_ = std::thread([this]() {
-        LOG(INFO) << this->transport_name_ << ": read thread spawning";
-        while (true) {
-            auto packet = std::make_unique<apacket>();
-            if (!underlying_->Read(packet.get())) {
-                PLOG(INFO) << this->transport_name_ << ": read failed";
-                break;
-            }
-
-            bool got_stls_cmd = false;
-            if (packet->msg.command == A_STLS) {
-                got_stls_cmd = true;
-            }
-
-            read_callback_(this, std::move(packet));
-
-            // If we received the STLS packet, we are about to perform the TLS
-            // handshake. So this read thread must stop and resume after the
-            // handshake completes otherwise this will interfere in the process.
-            if (got_stls_cmd) {
-                LOG(INFO) << this->transport_name_
-                          << ": Received STLS packet. Stopping read thread.";
-                return;
-            }
-        }
-        std::call_once(this->error_flag_, [this]() { this->error_callback_(this, "read failed"); });
-    });
-}
-
-bool BlockingConnectionAdapter::DoTlsHandshake(RSA* key, std::string* auth_key) {
-    std::lock_guard<std::mutex> lock(mutex_);
-    if (read_thread_.joinable()) {
-        read_thread_.join();
-    }
-    bool success = this->underlying_->DoTlsHandshake(key, auth_key);
-    StartReadThread();
-    return success;
-}
-
-void BlockingConnectionAdapter::Reset() {
-    {
-        std::lock_guard<std::mutex> lock(mutex_);
-        if (!started_) {
-            LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_ << "): not started";
-            return;
-        }
-
-        if (stopped_) {
-            LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_
-                      << "): already stopped";
-            return;
-        }
-    }
-
-    LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_ << "): resetting";
-    this->underlying_->Reset();
-    Stop();
-}
-
-void BlockingConnectionAdapter::Stop() {
-    {
-        std::lock_guard<std::mutex> lock(mutex_);
-        if (!started_) {
-            LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_ << "): not started";
-            return;
-        }
-
-        if (stopped_) {
-            LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_
-                      << "): already stopped";
-            return;
-        }
-
-        stopped_ = true;
-    }
-
-    LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_ << "): stopping";
-
-    this->underlying_->Close();
-    this->cv_.notify_one();
-
-    // Move the threads out into locals with the lock taken, and then unlock to let them exit.
-    std::thread read_thread;
-    std::thread write_thread;
-
-    {
-        std::lock_guard<std::mutex> lock(mutex_);
-        read_thread = std::move(read_thread_);
-        write_thread = std::move(write_thread_);
-    }
-
-    read_thread.join();
-    write_thread.join();
-
-    LOG(INFO) << "BlockingConnectionAdapter(" << this->transport_name_ << "): stopped";
-    std::call_once(this->error_flag_, [this]() { this->error_callback_(this, "requested stop"); });
-}
-
-bool BlockingConnectionAdapter::Write(std::unique_ptr<apacket> packet) {
-    {
-        std::lock_guard<std::mutex> lock(this->mutex_);
-        write_queue_.emplace_back(std::move(packet));
-    }
-
-    cv_.notify_one();
-    return true;
-}
-
-FdConnection::FdConnection(unique_fd fd) : fd_(std::move(fd)) {}
-
-FdConnection::~FdConnection() {}
-
-bool FdConnection::DispatchRead(void* buf, size_t len) {
-    if (tls_ != nullptr) {
-        // The TlsConnection doesn't allow 0 byte reads
-        if (len == 0) {
-            return true;
-        }
-        return tls_->ReadFully(buf, len);
-    }
-
-    return ReadFdExactly(fd_.get(), buf, len);
-}
-
-bool FdConnection::DispatchWrite(void* buf, size_t len) {
-    if (tls_ != nullptr) {
-        // The TlsConnection doesn't allow 0 byte writes
-        if (len == 0) {
-            return true;
-        }
-        return tls_->WriteFully(std::string_view(reinterpret_cast<const char*>(buf), len));
-    }
-
-    return WriteFdExactly(fd_.get(), buf, len);
-}
-
-bool FdConnection::Read(apacket* packet) {
-    if (!DispatchRead(&packet->msg, sizeof(amessage))) {
-        D("remote local: read terminated (message)");
-        return false;
-    }
-
-    if (packet->msg.data_length > MAX_PAYLOAD) {
-        D("remote local: read overflow (data length = %" PRIu32 ")", packet->msg.data_length);
-        return false;
-    }
-
-    packet->payload.resize(packet->msg.data_length);
-
-    if (!DispatchRead(&packet->payload[0], packet->payload.size())) {
-        D("remote local: terminated (data)");
-        return false;
-    }
-
-    return true;
-}
-
-bool FdConnection::Write(apacket* packet) {
-    if (!DispatchWrite(&packet->msg, sizeof(packet->msg))) {
-        D("remote local: write terminated");
-        return false;
-    }
-
-    if (packet->msg.data_length) {
-        if (!DispatchWrite(&packet->payload[0], packet->msg.data_length)) {
-            D("remote local: write terminated");
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool FdConnection::DoTlsHandshake(RSA* key, std::string* auth_key) {
-    bssl::UniquePtr<EVP_PKEY> evp_pkey(EVP_PKEY_new());
-    if (!EVP_PKEY_set1_RSA(evp_pkey.get(), key)) {
-        LOG(ERROR) << "EVP_PKEY_set1_RSA failed";
-        return false;
-    }
-    auto x509 = GenerateX509Certificate(evp_pkey.get());
-    auto x509_str = X509ToPEMString(x509.get());
-    auto evp_str = Key::ToPEMString(evp_pkey.get());
-#ifdef _WIN32
-    int osh = cast_handle_to_int(adb_get_os_handle(fd_));
-#else
-    int osh = adb_get_os_handle(fd_);
-#endif
-
-#if ADB_HOST
-    tls_ = TlsConnection::Create(TlsConnection::Role::Client, x509_str, evp_str, osh);
-#else
-    tls_ = TlsConnection::Create(TlsConnection::Role::Server, x509_str, evp_str, osh);
-#endif
-    CHECK(tls_);
-#if ADB_HOST
-    // TLS 1.3 gives the client no message if the server rejected the
-    // certificate. This will enable a check in the tls connection to check
-    // whether the client certificate got rejected. Note that this assumes
-    // that, on handshake success, the server speaks first.
-    tls_->EnableClientPostHandshakeCheck(true);
-    // Add callback to set the certificate when server issues the
-    // CertificateRequest.
-    tls_->SetCertificateCallback(adb_tls_set_certificate);
-    // Allow any server certificate
-    tls_->SetCertVerifyCallback([](X509_STORE_CTX*) { return 1; });
-#else
-    // Add callback to check certificate against a list of known public keys
-    tls_->SetCertVerifyCallback(
-            [auth_key](X509_STORE_CTX* ctx) { return adbd_tls_verify_cert(ctx, auth_key); });
-    // Add the list of allowed client CA issuers
-    auto ca_list = adbd_tls_client_ca_list();
-    tls_->SetClientCAList(ca_list.get());
-#endif
-
-    auto err = tls_->DoHandshake();
-    if (err == TlsError::Success) {
-        return true;
-    }
-
-    tls_.reset();
-    return false;
-}
-
-void FdConnection::Close() {
-    adb_shutdown(fd_.get());
-    fd_.reset();
-}
-
-void send_packet(apacket* p, atransport* t) {
-    p->msg.magic = p->msg.command ^ 0xffffffff;
-    // compute a checksum for connection/auth packets for compatibility reasons
-    if (t->get_protocol_version() >= A_VERSION_SKIP_CHECKSUM) {
-        p->msg.data_check = 0;
-    } else {
-        p->msg.data_check = calculate_apacket_checksum(p);
-    }
-
-    VLOG(TRANSPORT) << dump_packet(t->serial.c_str(), "to remote", p);
-
-    if (t == nullptr) {
-        LOG(FATAL) << "Transport is null";
-    }
-
-    if (t->Write(p) != 0) {
-        D("%s: failed to enqueue packet, closing transport", t->serial.c_str());
-        t->Kick();
-    }
-}
-
-void kick_transport(atransport* t, bool reset) {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    // As kick_transport() can be called from threads without guarantee that t is valid,
-    // check if the transport is in transport_list first.
-    //
-    // TODO(jmgao): WTF? Is this actually true?
-    if (std::find(transport_list.begin(), transport_list.end(), t) != transport_list.end()) {
-        if (reset) {
-            t->Reset();
-        } else {
-            t->Kick();
-        }
-    }
-
-#if ADB_HOST
-    reconnect_handler.CheckForKicked();
-#endif
-}
-
-static int transport_registration_send = -1;
-static int transport_registration_recv = -1;
-static fdevent* transport_registration_fde;
-
-#if ADB_HOST
-
-/* this adds support required by the 'track-devices' service.
- * this is used to send the content of "list_transport" to any
- * number of client connections that want it through a single
- * live TCP connection
- */
-struct device_tracker {
-    asocket socket;
-    bool update_needed = false;
-    bool long_output = false;
-    device_tracker* next = nullptr;
-};
-
-/* linked list of all device trackers */
-static device_tracker* device_tracker_list;
-
-static void device_tracker_remove(device_tracker* tracker) {
-    device_tracker** pnode = &device_tracker_list;
-    device_tracker* node = *pnode;
-
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    while (node) {
-        if (node == tracker) {
-            *pnode = node->next;
-            break;
-        }
-        pnode = &node->next;
-        node = *pnode;
-    }
-}
-
-static void device_tracker_close(asocket* socket) {
-    device_tracker* tracker = (device_tracker*)socket;
-    asocket* peer = socket->peer;
-
-    D("device tracker %p removed", tracker);
-    if (peer) {
-        peer->peer = nullptr;
-        peer->close(peer);
-    }
-    device_tracker_remove(tracker);
-    delete tracker;
-}
-
-static int device_tracker_enqueue(asocket* socket, apacket::payload_type) {
-    /* you can't read from a device tracker, close immediately */
-    device_tracker_close(socket);
-    return -1;
-}
-
-static int device_tracker_send(device_tracker* tracker, const std::string& string) {
-    asocket* peer = tracker->socket.peer;
-
-    apacket::payload_type data;
-    data.resize(4 + string.size());
-    char buf[5];
-    snprintf(buf, sizeof(buf), "%04x", static_cast<int>(string.size()));
-    memcpy(&data[0], buf, 4);
-    memcpy(&data[4], string.data(), string.size());
-    return peer->enqueue(peer, std::move(data));
-}
-
-static void device_tracker_ready(asocket* socket) {
-    device_tracker* tracker = reinterpret_cast<device_tracker*>(socket);
-
-    // We want to send the device list when the tracker connects
-    // for the first time, even if no update occurred.
-    if (tracker->update_needed) {
-        tracker->update_needed = false;
-        device_tracker_send(tracker, list_transports(tracker->long_output));
-    }
-}
-
-asocket* create_device_tracker(bool long_output) {
-    device_tracker* tracker = new device_tracker();
-    if (tracker == nullptr) LOG(FATAL) << "cannot allocate device tracker";
-
-    D("device tracker %p created", tracker);
-
-    tracker->socket.enqueue = device_tracker_enqueue;
-    tracker->socket.ready = device_tracker_ready;
-    tracker->socket.close = device_tracker_close;
-    tracker->update_needed = true;
-    tracker->long_output = long_output;
-
-    tracker->next = device_tracker_list;
-    device_tracker_list = tracker;
-
-    return &tracker->socket;
-}
-
-// Check if all of the USB transports are connected.
-bool iterate_transports(std::function<bool(const atransport*)> fn) {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (const auto& t : transport_list) {
-        if (!fn(t)) {
-            return false;
-        }
-    }
-    for (const auto& t : pending_list) {
-        if (!fn(t)) {
-            return false;
-        }
-    }
-    return true;
-}
-
-// Call this function each time the transport list has changed.
-void update_transports() {
-    update_transport_status();
-
-    // Notify `adb track-devices` clients.
-    device_tracker* tracker = device_tracker_list;
-    while (tracker != nullptr) {
-        device_tracker* next = tracker->next;
-        // This may destroy the tracker if the connection is closed.
-        device_tracker_send(tracker, list_transports(tracker->long_output));
-        tracker = next;
-    }
-}
-
-#else
-
-void update_transports() {
-    // Nothing to do on the device side.
-}
-
-#endif  // ADB_HOST
-
-struct tmsg {
-    atransport* transport;
-    int action;
-};
-
-static int transport_read_action(int fd, struct tmsg* m) {
-    char* p = (char*)m;
-    int len = sizeof(*m);
-    int r;
-
-    while (len > 0) {
-        r = adb_read(fd, p, len);
-        if (r > 0) {
-            len -= r;
-            p += r;
-        } else {
-            D("transport_read_action: on fd %d: %s", fd, strerror(errno));
-            return -1;
-        }
-    }
-    return 0;
-}
-
-static int transport_write_action(int fd, struct tmsg* m) {
-    char* p = (char*)m;
-    int len = sizeof(*m);
-    int r;
-
-    while (len > 0) {
-        r = adb_write(fd, p, len);
-        if (r > 0) {
-            len -= r;
-            p += r;
-        } else {
-            D("transport_write_action: on fd %d: %s", fd, strerror(errno));
-            return -1;
-        }
-    }
-    return 0;
-}
-
-static void transport_registration_func(int _fd, unsigned ev, void*) {
-    tmsg m;
-    atransport* t;
-
-    if (!(ev & FDE_READ)) {
-        return;
-    }
-
-    if (transport_read_action(_fd, &m)) {
-        PLOG(FATAL) << "cannot read transport registration socket";
-    }
-
-    t = m.transport;
-
-    if (m.action == 0) {
-        D("transport: %s deleting", t->serial.c_str());
-
-        {
-            std::lock_guard<std::recursive_mutex> lock(transport_lock);
-            transport_list.remove(t);
-        }
-
-        delete t;
-
-        update_transports();
-        return;
-    }
-
-    /* don't create transport threads for inaccessible devices */
-    if (t->GetConnectionState() != kCsNoPerm) {
-        // The connection gets a reference to the atransport. It will release it
-        // upon a read/write error.
-        t->connection()->SetTransportName(t->serial_name());
-        t->connection()->SetReadCallback([t](Connection*, std::unique_ptr<apacket> p) {
-            if (!check_header(p.get(), t)) {
-                D("%s: remote read: bad header", t->serial.c_str());
-                return false;
-            }
-
-            VLOG(TRANSPORT) << dump_packet(t->serial.c_str(), "from remote", p.get());
-            apacket* packet = p.release();
-
-            // TODO: Does this need to run on the main thread?
-            fdevent_run_on_main_thread([packet, t]() { handle_packet(packet, t); });
-            return true;
-        });
-        t->connection()->SetErrorCallback([t](Connection*, const std::string& error) {
-            LOG(INFO) << t->serial_name() << ": connection terminated: " << error;
-            fdevent_run_on_main_thread([t]() {
-                handle_offline(t);
-                transport_destroy(t);
-            });
-        });
-
-        t->connection()->Start();
-#if ADB_HOST
-        send_connect(t);
-#endif
-    }
-
-    {
-        std::lock_guard<std::recursive_mutex> lock(transport_lock);
-        auto it = std::find(pending_list.begin(), pending_list.end(), t);
-        if (it != pending_list.end()) {
-            pending_list.remove(t);
-            transport_list.push_front(t);
-        }
-    }
-
-    update_transports();
-}
-
-#if ADB_HOST
-void init_reconnect_handler(void) {
-    reconnect_handler.Start();
-}
-#endif
-
-void init_transport_registration(void) {
-    int s[2];
-
-    if (adb_socketpair(s)) {
-        PLOG(FATAL) << "cannot open transport registration socketpair";
-    }
-    D("socketpair: (%d,%d)", s[0], s[1]);
-
-    transport_registration_send = s[0];
-    transport_registration_recv = s[1];
-
-    transport_registration_fde =
-        fdevent_create(transport_registration_recv, transport_registration_func, nullptr);
-    fdevent_set(transport_registration_fde, FDE_READ);
-}
-
-void kick_all_transports() {
-#if ADB_HOST
-    reconnect_handler.Stop();
-#endif
-    // To avoid only writing part of a packet to a transport after exit, kick all transports.
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (auto t : transport_list) {
-        t->Kick();
-    }
-}
-
-void kick_all_tcp_tls_transports() {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (auto t : transport_list) {
-        if (t->IsTcpDevice() && t->use_tls) {
-            t->Kick();
-        }
-    }
-}
-
-#if !ADB_HOST
-void kick_all_transports_by_auth_key(std::string_view auth_key) {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (auto t : transport_list) {
-        if (auth_key == t->auth_key) {
-            t->Kick();
-        }
-    }
-}
-#endif
-
-/* the fdevent select pump is single threaded */
-void register_transport(atransport* transport) {
-    tmsg m;
-    m.transport = transport;
-    m.action = 1;
-    D("transport: %s registered", transport->serial.c_str());
-    if (transport_write_action(transport_registration_send, &m)) {
-        PLOG(FATAL) << "cannot write transport registration socket";
-    }
-}
-
-static void remove_transport(atransport* transport) {
-    tmsg m;
-    m.transport = transport;
-    m.action = 0;
-    D("transport: %s removed", transport->serial.c_str());
-    if (transport_write_action(transport_registration_send, &m)) {
-        PLOG(FATAL) << "cannot write transport registration socket";
-    }
-}
-
-static void transport_destroy(atransport* t) {
-    check_main_thread();
-    CHECK(t != nullptr);
-
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    LOG(INFO) << "destroying transport " << t->serial_name();
-    t->connection()->Stop();
-#if ADB_HOST
-    if (t->IsTcpDevice() && !t->kicked()) {
-        D("transport: %s destroy (attempting reconnection)", t->serial.c_str());
-
-        // We need to clear the transport's keys, so that on the next connection, it tries
-        // again from the beginning.
-        t->ResetKeys();
-        reconnect_handler.TrackTransport(t);
-        return;
-    }
-#endif
-
-    D("transport: %s destroy (kicking and closing)", t->serial.c_str());
-    remove_transport(t);
-}
-
-static int qual_match(const std::string& to_test, const char* prefix, const std::string& qual,
-                      bool sanitize_qual) {
-    if (to_test.empty()) /* Return true if both the qual and to_test are empty strings. */
-        return qual.empty();
-
-    if (qual.empty()) return 0;
-
-    const char* ptr = to_test.c_str();
-    if (prefix) {
-        while (*prefix) {
-            if (*prefix++ != *ptr++) return 0;
-        }
-    }
-
-    for (char ch : qual) {
-        if (sanitize_qual && !isalnum(ch)) ch = '_';
-        if (ch != *ptr++) return 0;
-    }
-
-    /* Everything matched so far.  Return true if *ptr is a NUL. */
-    return !*ptr;
-}
-
-atransport* acquire_one_transport(TransportType type, const char* serial, TransportId transport_id,
-                                  bool* is_ambiguous, std::string* error_out,
-                                  bool accept_any_state) {
-    atransport* result = nullptr;
-
-    if (transport_id != 0) {
-        *error_out =
-            android::base::StringPrintf("no device with transport id '%" PRIu64 "'", transport_id);
-    } else if (serial) {
-        *error_out = android::base::StringPrintf("device '%s' not found", serial);
-    } else if (type == kTransportLocal) {
-        *error_out = "no emulators found";
-    } else if (type == kTransportAny) {
-        *error_out = "no devices/emulators found";
-    } else {
-        *error_out = "no devices found";
-    }
-
-    std::unique_lock<std::recursive_mutex> lock(transport_lock);
-    for (const auto& t : transport_list) {
-        if (t->GetConnectionState() == kCsNoPerm) {
-            *error_out = UsbNoPermissionsLongHelpText();
-            continue;
-        }
-
-        if (transport_id) {
-            if (t->id == transport_id) {
-                result = t;
-                break;
-            }
-        } else if (serial) {
-            if (t->MatchesTarget(serial)) {
-                if (result) {
-                    *error_out = "more than one device";
-                    if (is_ambiguous) *is_ambiguous = true;
-                    result = nullptr;
-                    break;
-                }
-                result = t;
-            }
-        } else {
-            if (type == kTransportUsb && t->type == kTransportUsb) {
-                if (result) {
-                    *error_out = "more than one device";
-                    if (is_ambiguous) *is_ambiguous = true;
-                    result = nullptr;
-                    break;
-                }
-                result = t;
-            } else if (type == kTransportLocal && t->type == kTransportLocal) {
-                if (result) {
-                    *error_out = "more than one emulator";
-                    if (is_ambiguous) *is_ambiguous = true;
-                    result = nullptr;
-                    break;
-                }
-                result = t;
-            } else if (type == kTransportAny) {
-                if (result) {
-                    *error_out = "more than one device/emulator";
-                    if (is_ambiguous) *is_ambiguous = true;
-                    result = nullptr;
-                    break;
-                }
-                result = t;
-            }
-        }
-    }
-    lock.unlock();
-
-    if (result && !accept_any_state) {
-        // The caller requires an active transport.
-        // Make sure that we're actually connected.
-        ConnectionState state = result->GetConnectionState();
-        switch (state) {
-            case kCsConnecting:
-                *error_out = "device still connecting";
-                result = nullptr;
-                break;
-
-            case kCsAuthorizing:
-                *error_out = "device still authorizing";
-                result = nullptr;
-                break;
-
-            case kCsUnauthorized: {
-                *error_out = "device unauthorized.\n";
-                char* ADB_VENDOR_KEYS = getenv("ADB_VENDOR_KEYS");
-                *error_out += "This adb server's $ADB_VENDOR_KEYS is ";
-                *error_out += ADB_VENDOR_KEYS ? ADB_VENDOR_KEYS : "not set";
-                *error_out += "\n";
-                *error_out += "Try 'adb kill-server' if that seems wrong.\n";
-                *error_out += "Otherwise check for a confirmation dialog on your device.";
-                result = nullptr;
-                break;
-            }
-
-            case kCsOffline:
-                *error_out = "device offline";
-                result = nullptr;
-                break;
-
-            default:
-                break;
-        }
-    }
-
-    if (result) {
-        *error_out = "success";
-    }
-
-    return result;
-}
-
-bool ConnectionWaitable::WaitForConnection(std::chrono::milliseconds timeout) {
-    std::unique_lock<std::mutex> lock(mutex_);
-    ScopedLockAssertion assume_locked(mutex_);
-    return cv_.wait_for(lock, timeout, [&]() REQUIRES(mutex_) {
-        return connection_established_ready_;
-    }) && connection_established_;
-}
-
-void ConnectionWaitable::SetConnectionEstablished(bool success) {
-    {
-        std::lock_guard<std::mutex> lock(mutex_);
-        if (connection_established_ready_) return;
-        connection_established_ready_ = true;
-        connection_established_ = success;
-        D("connection established with %d", success);
-    }
-    cv_.notify_one();
-}
-
-atransport::~atransport() {
-    // If the connection callback had not been run before, run it now.
-    SetConnectionEstablished(false);
-}
-
-int atransport::Write(apacket* p) {
-    return this->connection()->Write(std::unique_ptr<apacket>(p)) ? 0 : -1;
-}
-
-void atransport::Reset() {
-    if (!kicked_.exchange(true)) {
-        LOG(INFO) << "resetting transport " << this << " " << this->serial;
-        this->connection()->Reset();
-    }
-}
-
-void atransport::Kick() {
-    if (!kicked_.exchange(true)) {
-        LOG(INFO) << "kicking transport " << this << " " << this->serial;
-        this->connection()->Stop();
-    }
-}
-
-ConnectionState atransport::GetConnectionState() const {
-    return connection_state_;
-}
-
-void atransport::SetConnectionState(ConnectionState state) {
-    check_main_thread();
-    connection_state_ = state;
-}
-
-void atransport::SetConnection(std::unique_ptr<Connection> connection) {
-    std::lock_guard<std::mutex> lock(mutex_);
-    connection_ = std::shared_ptr<Connection>(std::move(connection));
-}
-
-std::string atransport::connection_state_name() const {
-    ConnectionState state = GetConnectionState();
-    switch (state) {
-        case kCsOffline:
-            return "offline";
-        case kCsBootloader:
-            return "bootloader";
-        case kCsDevice:
-            return "device";
-        case kCsHost:
-            return "host";
-        case kCsRecovery:
-            return "recovery";
-        case kCsRescue:
-            return "rescue";
-        case kCsNoPerm:
-            return UsbNoPermissionsShortHelpText();
-        case kCsSideload:
-            return "sideload";
-        case kCsUnauthorized:
-            return "unauthorized";
-        case kCsAuthorizing:
-            return "authorizing";
-        case kCsConnecting:
-            return "connecting";
-        default:
-            return "unknown";
-    }
-}
-
-void atransport::update_version(int version, size_t payload) {
-    protocol_version = std::min(version, A_VERSION);
-    max_payload = std::min(payload, MAX_PAYLOAD);
-}
-
-int atransport::get_protocol_version() const {
-    return protocol_version;
-}
-
-int atransport::get_tls_version() const {
-    return tls_version;
-}
-
-size_t atransport::get_max_payload() const {
-    return max_payload;
-}
-
-const FeatureSet& supported_features() {
-    // Local static allocation to avoid global non-POD variables.
-    static const FeatureSet* features = new FeatureSet{
-            kFeatureShell2,
-            kFeatureCmd,
-            kFeatureStat2,
-            kFeatureLs2,
-            kFeatureFixedPushMkdir,
-            kFeatureApex,
-            kFeatureAbb,
-            kFeatureFixedPushSymlinkTimestamp,
-            kFeatureAbbExec,
-            kFeatureRemountShell,
-            kFeatureSendRecv2,
-            kFeatureSendRecv2Brotli,
-            // Increment ADB_SERVER_VERSION when adding a feature that adbd needs
-            // to know about. Otherwise, the client can be stuck running an old
-            // version of the server even after upgrading their copy of adb.
-            // (http://b/24370690)
-    };
-
-    return *features;
-}
-
-std::string FeatureSetToString(const FeatureSet& features) {
-    return android::base::Join(features, ',');
-}
-
-FeatureSet StringToFeatureSet(const std::string& features_string) {
-    if (features_string.empty()) {
-        return FeatureSet();
-    }
-
-    auto names = android::base::Split(features_string, ",");
-    return FeatureSet(names.begin(), names.end());
-}
-
-bool CanUseFeature(const FeatureSet& feature_set, const std::string& feature) {
-    return feature_set.count(feature) > 0 && supported_features().count(feature) > 0;
-}
-
-bool atransport::has_feature(const std::string& feature) const {
-    return features_.count(feature) > 0;
-}
-
-void atransport::SetFeatures(const std::string& features_string) {
-    features_ = StringToFeatureSet(features_string);
-}
-
-void atransport::AddDisconnect(adisconnect* disconnect) {
-    disconnects_.push_back(disconnect);
-}
-
-void atransport::RemoveDisconnect(adisconnect* disconnect) {
-    disconnects_.remove(disconnect);
-}
-
-void atransport::RunDisconnects() {
-    for (const auto& disconnect : disconnects_) {
-        disconnect->func(disconnect->opaque, this);
-    }
-    disconnects_.clear();
-}
-
-bool atransport::MatchesTarget(const std::string& target) const {
-    if (!serial.empty()) {
-        if (target == serial) {
-            return true;
-        } else if (type == kTransportLocal) {
-            // Local transports can match [tcp:|udp:]<hostname>[:port].
-            const char* local_target_ptr = target.c_str();
-
-            // For fastboot compatibility, ignore protocol prefixes.
-            if (android::base::StartsWith(target, "tcp:") ||
-                android::base::StartsWith(target, "udp:")) {
-                local_target_ptr += 4;
-            }
-
-            // Parse our |serial| and the given |target| to check if the hostnames and ports match.
-            std::string serial_host, error;
-            int serial_port = -1;
-            if (android::base::ParseNetAddress(serial, &serial_host, &serial_port, nullptr, &error)) {
-                // |target| may omit the port to default to ours.
-                std::string target_host;
-                int target_port = serial_port;
-                if (android::base::ParseNetAddress(local_target_ptr, &target_host, &target_port,
-                                                   nullptr, &error) &&
-                    serial_host == target_host && serial_port == target_port) {
-                    return true;
-                }
-            }
-        }
-    }
-
-    return (target == devpath) || qual_match(target, "product:", product, false) ||
-           qual_match(target, "model:", model, true) ||
-           qual_match(target, "device:", device, false);
-}
-
-void atransport::SetConnectionEstablished(bool success) {
-    connection_waitable_->SetConnectionEstablished(success);
-}
-
-ReconnectResult atransport::Reconnect() {
-    return reconnect_(this);
-}
-
-#if ADB_HOST
-
-// We use newline as our delimiter, make sure to never output it.
-static std::string sanitize(std::string str, bool alphanumeric) {
-    auto pred = alphanumeric ? [](const char c) { return !isalnum(c); }
-                             : [](const char c) { return c == '\n'; };
-    std::replace_if(str.begin(), str.end(), pred, '_');
-    return str;
-}
-
-static void append_transport_info(std::string* result, const char* key, const std::string& value,
-                                  bool alphanumeric) {
-    if (value.empty()) {
-        return;
-    }
-
-    *result += ' ';
-    *result += key;
-    *result += sanitize(value, alphanumeric);
-}
-
-static void append_transport(const atransport* t, std::string* result, bool long_listing) {
-    std::string serial = t->serial;
-    if (serial.empty()) {
-        serial = "(no serial number)";
-    }
-
-    if (!long_listing) {
-        *result += serial;
-        *result += '\t';
-        *result += t->connection_state_name();
-    } else {
-        android::base::StringAppendF(result, "%-22s %s", serial.c_str(),
-                                     t->connection_state_name().c_str());
-
-        append_transport_info(result, "", t->devpath, false);
-        append_transport_info(result, "product:", t->product, false);
-        append_transport_info(result, "model:", t->model, true);
-        append_transport_info(result, "device:", t->device, false);
-
-        // Put id at the end, so that anyone parsing the output here can always find it by scanning
-        // backwards from newlines, even with hypothetical devices named 'transport_id:1'.
-        *result += " transport_id:";
-        *result += std::to_string(t->id);
-    }
-    *result += '\n';
-}
-
-std::string list_transports(bool long_listing) {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-
-    auto sorted_transport_list = transport_list;
-    sorted_transport_list.sort([](atransport*& x, atransport*& y) {
-        if (x->type != y->type) {
-            return x->type < y->type;
-        }
-        return x->serial < y->serial;
-    });
-
-    std::string result;
-    for (const auto& t : sorted_transport_list) {
-        append_transport(t, &result, long_listing);
-    }
-    return result;
-}
-
-void close_usb_devices(std::function<bool(const atransport*)> predicate, bool reset) {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (auto& t : transport_list) {
-        if (predicate(t)) {
-            if (reset) {
-                t->Reset();
-            } else {
-                t->Kick();
-            }
-        }
-    }
-}
-
-/* hack for osx */
-void close_usb_devices(bool reset) {
-    close_usb_devices([](const atransport*) { return true; }, reset);
-}
-#endif  // ADB_HOST
-
-bool register_socket_transport(unique_fd s, std::string serial, int port, int local,
-                               atransport::ReconnectCallback reconnect, bool use_tls, int* error) {
-    atransport* t = new atransport(std::move(reconnect), kCsOffline);
-    t->use_tls = use_tls;
-
-    D("transport: %s init'ing for socket %d, on port %d", serial.c_str(), s.get(), port);
-    if (init_socket_transport(t, std::move(s), port, local) < 0) {
-        delete t;
-        if (error) *error = errno;
-        return false;
-    }
-
-    std::unique_lock<std::recursive_mutex> lock(transport_lock);
-    for (const auto& transport : pending_list) {
-        if (serial == transport->serial) {
-            VLOG(TRANSPORT) << "socket transport " << transport->serial
-                            << " is already in pending_list and fails to register";
-            delete t;
-            if (error) *error = EALREADY;
-            return false;
-        }
-    }
-
-    for (const auto& transport : transport_list) {
-        if (serial == transport->serial) {
-            VLOG(TRANSPORT) << "socket transport " << transport->serial
-                            << " is already in transport_list and fails to register";
-            delete t;
-            if (error) *error = EALREADY;
-            return false;
-        }
-    }
-
-    t->serial = std::move(serial);
-    pending_list.push_front(t);
-
-    lock.unlock();
-
-    auto waitable = t->connection_waitable();
-    register_transport(t);
-
-    if (local == 1) {
-        // Do not wait for emulator transports.
-        return true;
-    }
-
-    if (!waitable->WaitForConnection(std::chrono::seconds(10))) {
-        if (error) *error = ETIMEDOUT;
-        return false;
-    }
-
-    if (t->GetConnectionState() == kCsUnauthorized) {
-        if (error) *error = EPERM;
-        return false;
-    }
-
-    return true;
-}
-
-#if ADB_HOST
-atransport* find_transport(const char* serial) {
-    atransport* result = nullptr;
-
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (auto& t : transport_list) {
-        if (strcmp(serial, t->serial.c_str()) == 0) {
-            result = t;
-            break;
-        }
-    }
-
-    return result;
-}
-
-void kick_all_tcp_devices() {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    for (auto& t : transport_list) {
-        if (t->IsTcpDevice()) {
-            // Kicking breaks the read_transport thread of this transport out of any read, then
-            // the read_transport thread will notify the main thread to make this transport
-            // offline. Then the main thread will notify the write_transport thread to exit.
-            // Finally, this transport will be closed and freed in the main thread.
-            t->Kick();
-        }
-    }
-#if ADB_HOST
-    reconnect_handler.CheckForKicked();
-#endif
-}
-
-#endif
-
-#if ADB_HOST
-void register_usb_transport(usb_handle* usb, const char* serial, const char* devpath,
-                            unsigned writeable) {
-    atransport* t = new atransport(writeable ? kCsOffline : kCsNoPerm);
-
-    D("transport: %p init'ing for usb_handle %p (sn='%s')", t, usb, serial ? serial : "");
-    init_usb_transport(t, usb);
-    if (serial) {
-        t->serial = serial;
-    }
-
-    if (devpath) {
-        t->devpath = devpath;
-    }
-
-    {
-        std::lock_guard<std::recursive_mutex> lock(transport_lock);
-        pending_list.push_front(t);
-    }
-
-    register_transport(t);
-}
-#endif
-
-#if ADB_HOST
-// This should only be used for transports with connection_state == kCsNoPerm.
-void unregister_usb_transport(usb_handle* usb) {
-    std::lock_guard<std::recursive_mutex> lock(transport_lock);
-    transport_list.remove_if([usb](atransport* t) {
-        return t->GetUsbHandle() == usb && t->GetConnectionState() == kCsNoPerm;
-    });
-}
-#endif
-
-bool check_header(apacket* p, atransport* t) {
-    if (p->msg.magic != (p->msg.command ^ 0xffffffff)) {
-        VLOG(RWX) << "check_header(): invalid magic command = " << std::hex << p->msg.command
-                  << ", magic = " << p->msg.magic;
-        return false;
-    }
-
-    if (p->msg.data_length > t->get_max_payload()) {
-        VLOG(RWX) << "check_header(): " << p->msg.data_length
-                  << " atransport::max_payload = " << t->get_max_payload();
-        return false;
-    }
-
-    return true;
-}
-
-#if ADB_HOST
-std::shared_ptr<RSA> atransport::Key() {
-    if (keys_.empty()) {
-        return nullptr;
-    }
-
-    std::shared_ptr<RSA> result = keys_[0];
-    return result;
-}
-
-std::shared_ptr<RSA> atransport::NextKey() {
-    if (keys_.empty()) {
-        LOG(INFO) << "fetching keys for transport " << this->serial_name();
-        keys_ = adb_auth_get_private_keys();
-
-        // We should have gotten at least one key: the one that's automatically generated.
-        CHECK(!keys_.empty());
-    } else {
-        keys_.pop_front();
-    }
-
-    std::shared_ptr<RSA> result = keys_[0];
-    return result;
-}
-
-void atransport::ResetKeys() {
-    keys_.clear();
-}
-#endif
diff --git a/adb/transport.h b/adb/transport.h
deleted file mode 100644
index 26d804b..0000000
--- a/adb/transport.h
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef __TRANSPORT_H
-#define __TRANSPORT_H
-
-#include <sys/types.h>
-
-#include <atomic>
-#include <chrono>
-#include <condition_variable>
-#include <deque>
-#include <functional>
-#include <list>
-#include <memory>
-#include <mutex>
-#include <optional>
-#include <string>
-#include <string_view>
-#include <thread>
-#include <unordered_set>
-
-#include <android-base/macros.h>
-#include <android-base/thread_annotations.h>
-#include <openssl/rsa.h>
-
-#include "adb.h"
-#include "adb_unique_fd.h"
-#include "types.h"
-
-typedef std::unordered_set<std::string> FeatureSet;
-
-namespace adb {
-namespace tls {
-
-class TlsConnection;
-
-}  // namespace tls
-}  // namespace adb
-
-const FeatureSet& supported_features();
-
-// Encodes and decodes FeatureSet objects into human-readable strings.
-std::string FeatureSetToString(const FeatureSet& features);
-FeatureSet StringToFeatureSet(const std::string& features_string);
-
-// Returns true if both local features and |feature_set| support |feature|.
-bool CanUseFeature(const FeatureSet& feature_set, const std::string& feature);
-
-// Do not use any of [:;=,] in feature strings, they have special meaning
-// in the connection banner.
-extern const char* const kFeatureShell2;
-// The 'cmd' command is available
-extern const char* const kFeatureCmd;
-extern const char* const kFeatureStat2;
-extern const char* const kFeatureLs2;
-// The server is running with libusb enabled.
-extern const char* const kFeatureLibusb;
-// adbd supports `push --sync`.
-extern const char* const kFeaturePushSync;
-// adbd supports installing .apex packages.
-extern const char* const kFeatureApex;
-// adbd has b/110953234 fixed.
-extern const char* const kFeatureFixedPushMkdir;
-// adbd supports android binder bridge (abb) in interactive mode using shell protocol.
-extern const char* const kFeatureAbb;
-// adbd supports abb using raw pipe.
-extern const char* const kFeatureAbbExec;
-// adbd properly updates symlink timestamps on push.
-extern const char* const kFeatureFixedPushSymlinkTimestamp;
-// Implement `adb remount` via shelling out to /system/bin/remount.
-extern const char* const kFeatureRemountShell;
-// adbd supports version 2 of send/recv.
-extern const char* const kFeatureSendRecv2;
-// adbd supports brotli for send/recv v2.
-extern const char* const kFeatureSendRecv2Brotli;
-
-TransportId NextTransportId();
-
-// Abstraction for a non-blocking packet transport.
-struct Connection {
-    Connection() = default;
-    virtual ~Connection() = default;
-
-    void SetTransportName(std::string transport_name) {
-        transport_name_ = std::move(transport_name);
-    }
-
-    using ReadCallback = std::function<bool(Connection*, std::unique_ptr<apacket>)>;
-    void SetReadCallback(ReadCallback callback) {
-        CHECK(!read_callback_);
-        read_callback_ = callback;
-    }
-
-    // Called after the Connection has terminated, either by an error or because Stop was called.
-    using ErrorCallback = std::function<void(Connection*, const std::string&)>;
-    void SetErrorCallback(ErrorCallback callback) {
-        CHECK(!error_callback_);
-        error_callback_ = callback;
-    }
-
-    virtual bool Write(std::unique_ptr<apacket> packet) = 0;
-
-    virtual void Start() = 0;
-    virtual void Stop() = 0;
-
-    virtual bool DoTlsHandshake(RSA* key, std::string* auth_key = nullptr) = 0;
-
-    // Stop, and reset the device if it's a USB connection.
-    virtual void Reset();
-
-    std::string transport_name_;
-    ReadCallback read_callback_;
-    ErrorCallback error_callback_;
-
-    static std::unique_ptr<Connection> FromFd(unique_fd fd);
-};
-
-// Abstraction for a blocking packet transport.
-struct BlockingConnection {
-    BlockingConnection() = default;
-    BlockingConnection(const BlockingConnection& copy) = delete;
-    BlockingConnection(BlockingConnection&& move) = delete;
-
-    // Destroy a BlockingConnection. Formerly known as 'Close' in atransport.
-    virtual ~BlockingConnection() = default;
-
-    // Read/Write a packet. These functions are concurrently called from a transport's reader/writer
-    // threads.
-    virtual bool Read(apacket* packet) = 0;
-    virtual bool Write(apacket* packet) = 0;
-
-    virtual bool DoTlsHandshake(RSA* key, std::string* auth_key = nullptr) = 0;
-
-    // Terminate a connection.
-    // This method must be thread-safe, and must cause concurrent Reads/Writes to terminate.
-    // Formerly known as 'Kick' in atransport.
-    virtual void Close() = 0;
-
-    // Terminate a connection, and reset it.
-    virtual void Reset() = 0;
-};
-
-struct BlockingConnectionAdapter : public Connection {
-    explicit BlockingConnectionAdapter(std::unique_ptr<BlockingConnection> connection);
-
-    virtual ~BlockingConnectionAdapter();
-
-    virtual bool Write(std::unique_ptr<apacket> packet) override final;
-
-    virtual void Start() override final;
-    virtual void Stop() override final;
-    virtual bool DoTlsHandshake(RSA* key, std::string* auth_key) override final;
-
-    virtual void Reset() override final;
-
-  private:
-    void StartReadThread() REQUIRES(mutex_);
-    bool started_ GUARDED_BY(mutex_) = false;
-    bool stopped_ GUARDED_BY(mutex_) = false;
-
-    std::unique_ptr<BlockingConnection> underlying_;
-    std::thread read_thread_ GUARDED_BY(mutex_);
-    std::thread write_thread_ GUARDED_BY(mutex_);
-
-    std::deque<std::unique_ptr<apacket>> write_queue_ GUARDED_BY(mutex_);
-    std::mutex mutex_;
-    std::condition_variable cv_;
-
-    std::once_flag error_flag_;
-};
-
-struct FdConnection : public BlockingConnection {
-    explicit FdConnection(unique_fd fd);
-    ~FdConnection();
-
-    bool Read(apacket* packet) override final;
-    bool Write(apacket* packet) override final;
-    bool DoTlsHandshake(RSA* key, std::string* auth_key) override final;
-
-    void Close() override;
-    virtual void Reset() override final { Close(); }
-
-  private:
-    bool DispatchRead(void* buf, size_t len);
-    bool DispatchWrite(void* buf, size_t len);
-
-    unique_fd fd_;
-    std::unique_ptr<adb::tls::TlsConnection> tls_;
-};
-
-// Waits for a transport's connection to be not pending. This is a separate
-// object so that the transport can be destroyed and another thread can be
-// notified of it in a race-free way.
-class ConnectionWaitable {
-  public:
-    ConnectionWaitable() = default;
-    ~ConnectionWaitable() = default;
-
-    // Waits until the first CNXN packet has been received by the owning
-    // atransport, or the specified timeout has elapsed. Can be called from any
-    // thread.
-    //
-    // Returns true if the CNXN packet was received in a timely fashion, false
-    // otherwise.
-    bool WaitForConnection(std::chrono::milliseconds timeout);
-
-    // Can be called from any thread when the connection stops being pending.
-    // Only the first invocation will be acknowledged, the rest will be no-ops.
-    void SetConnectionEstablished(bool success);
-
-  private:
-    bool connection_established_ GUARDED_BY(mutex_) = false;
-    bool connection_established_ready_ GUARDED_BY(mutex_) = false;
-    std::mutex mutex_;
-    std::condition_variable cv_;
-
-    DISALLOW_COPY_AND_ASSIGN(ConnectionWaitable);
-};
-
-enum class ReconnectResult {
-    Retry,
-    Success,
-    Abort,
-};
-
-#if ADB_HOST
-struct usb_handle;
-#endif
-
-class atransport : public enable_weak_from_this<atransport> {
-  public:
-    // TODO(danalbert): We expose waaaaaaay too much stuff because this was
-    // historically just a struct, but making the whole thing a more idiomatic
-    // class in one go is a very large change. Given how bad our testing is,
-    // it's better to do this piece by piece.
-
-    using ReconnectCallback = std::function<ReconnectResult(atransport*)>;
-
-    atransport(ReconnectCallback reconnect, ConnectionState state)
-        : id(NextTransportId()),
-          kicked_(false),
-          connection_state_(state),
-          connection_waitable_(std::make_shared<ConnectionWaitable>()),
-          connection_(nullptr),
-          reconnect_(std::move(reconnect)) {
-        // Initialize protocol to min version for compatibility with older versions.
-        // Version will be updated post-connect.
-        protocol_version = A_VERSION_MIN;
-        max_payload = MAX_PAYLOAD;
-    }
-    atransport(ConnectionState state = kCsOffline)
-        : atransport([](atransport*) { return ReconnectResult::Abort; }, state) {}
-    ~atransport();
-
-    int Write(apacket* p);
-    void Reset();
-    void Kick();
-    bool kicked() const { return kicked_; }
-
-    // ConnectionState can be read by all threads, but can only be written in the main thread.
-    ConnectionState GetConnectionState() const;
-    void SetConnectionState(ConnectionState state);
-
-    void SetConnection(std::unique_ptr<Connection> connection);
-    std::shared_ptr<Connection> connection() {
-        std::lock_guard<std::mutex> lock(mutex_);
-        return connection_;
-    }
-
-#if ADB_HOST
-    void SetUsbHandle(usb_handle* h) { usb_handle_ = h; }
-    usb_handle* GetUsbHandle() { return usb_handle_; }
-#endif
-
-    const TransportId id;
-
-    bool online = false;
-    TransportType type = kTransportAny;
-
-    // Used to identify transports for clients.
-    std::string serial;
-    std::string product;
-    std::string model;
-    std::string device;
-    std::string devpath;
-
-    // If this is set, the transport will initiate the connection with a
-    // START_TLS command, instead of AUTH.
-    bool use_tls = false;
-    int tls_version = A_STLS_VERSION;
-    int get_tls_version() const;
-
-#if !ADB_HOST
-    // Used to provide the key to the framework.
-    std::string auth_key;
-    std::optional<uint64_t> auth_id;
-#endif
-
-    bool IsTcpDevice() const { return type == kTransportLocal; }
-
-#if ADB_HOST
-    // The current key being authorized.
-    std::shared_ptr<RSA> Key();
-    std::shared_ptr<RSA> NextKey();
-    void ResetKeys();
-#endif
-
-    char token[TOKEN_SIZE] = {};
-    size_t failed_auth_attempts = 0;
-
-    std::string serial_name() const { return !serial.empty() ? serial : "<unknown>"; }
-    std::string connection_state_name() const;
-
-    void update_version(int version, size_t payload);
-    int get_protocol_version() const;
-    size_t get_max_payload() const;
-
-    const FeatureSet& features() const {
-        return features_;
-    }
-
-    bool has_feature(const std::string& feature) const;
-
-    // Loads the transport's feature set from the given string.
-    void SetFeatures(const std::string& features_string);
-
-    void AddDisconnect(adisconnect* disconnect);
-    void RemoveDisconnect(adisconnect* disconnect);
-    void RunDisconnects();
-
-    // Returns true if |target| matches this transport. A matching |target| can be any of:
-    //   * <serial>
-    //   * <devpath>
-    //   * product:<product>
-    //   * model:<model>
-    //   * device:<device>
-    //
-    // If this is a local transport, serial will also match [tcp:|udp:]<hostname>[:port] targets.
-    // For example, serial "100.100.100.100:5555" would match any of:
-    //   * 100.100.100.100
-    //   * tcp:100.100.100.100
-    //   * udp:100.100.100.100:5555
-    // This is to make it easier to use the same network target for both fastboot and adb.
-    bool MatchesTarget(const std::string& target) const;
-
-    // Notifies that the atransport is no longer waiting for the connection
-    // being established.
-    void SetConnectionEstablished(bool success);
-
-    // Gets a shared reference to the ConnectionWaitable.
-    std::shared_ptr<ConnectionWaitable> connection_waitable() { return connection_waitable_; }
-
-    // Attempts to reconnect with the underlying Connection.
-    ReconnectResult Reconnect();
-
-  private:
-    std::atomic<bool> kicked_;
-
-    // A set of features transmitted in the banner with the initial connection.
-    // This is stored in the banner as 'features=feature0,feature1,etc'.
-    FeatureSet features_;
-    int protocol_version;
-    size_t max_payload;
-
-    // A list of adisconnect callbacks called when the transport is kicked.
-    std::list<adisconnect*> disconnects_;
-
-    std::atomic<ConnectionState> connection_state_;
-#if ADB_HOST
-    std::deque<std::shared_ptr<RSA>> keys_;
-#endif
-
-    // A sharable object that can be used to wait for the atransport's
-    // connection to be established.
-    std::shared_ptr<ConnectionWaitable> connection_waitable_;
-
-    // The underlying connection object.
-    std::shared_ptr<Connection> connection_ GUARDED_BY(mutex_);
-
-#if ADB_HOST
-    // USB handle for the connection, if available.
-    usb_handle* usb_handle_ = nullptr;
-#endif
-
-    // A callback that will be invoked when the atransport needs to reconnect.
-    ReconnectCallback reconnect_;
-
-    std::mutex mutex_;
-
-    DISALLOW_COPY_AND_ASSIGN(atransport);
-};
-
-/*
- * Obtain a transport from the available transports.
- * If serial is non-null then only the device with that serial will be chosen.
- * If transport_id is non-zero then only the device with that transport ID will be chosen.
- * If multiple devices/emulators would match, *is_ambiguous (if non-null)
- * is set to true and nullptr returned.
- * If no suitable transport is found, error is set and nullptr returned.
- */
-atransport* acquire_one_transport(TransportType type, const char* serial, TransportId transport_id,
-                                  bool* is_ambiguous, std::string* error_out,
-                                  bool accept_any_state = false);
-void kick_transport(atransport* t, bool reset = false);
-void update_transports(void);
-
-// Iterates across all of the current and pending transports.
-// Stops iteration and returns false if fn returns false, otherwise returns true.
-bool iterate_transports(std::function<bool(const atransport*)> fn);
-
-void init_reconnect_handler(void);
-void init_transport_registration(void);
-void init_mdns_transport_discovery(void);
-std::string list_transports(bool long_listing);
-atransport* find_transport(const char* serial);
-void kick_all_tcp_devices();
-void kick_all_transports();
-void kick_all_tcp_tls_transports();
-#if !ADB_HOST
-void kick_all_transports_by_auth_key(std::string_view auth_key);
-#endif
-
-void register_transport(atransport* transport);
-
-#if ADB_HOST
-void init_usb_transport(atransport* t, usb_handle* usb);
-void register_usb_transport(usb_handle* h, const char* serial, const char* devpath,
-                            unsigned writeable);
-
-// This should only be used for transports with connection_state == kCsNoPerm.
-void unregister_usb_transport(usb_handle* usb);
-#endif
-
-/* Connect to a network address and register it as a device */
-void connect_device(const std::string& address, std::string* response);
-
-/* cause new transports to be init'd and added to the list */
-bool register_socket_transport(unique_fd s, std::string serial, int port, int local,
-                               atransport::ReconnectCallback reconnect, bool use_tls,
-                               int* error = nullptr);
-
-bool check_header(apacket* p, atransport* t);
-
-void close_usb_devices(bool reset = false);
-void close_usb_devices(std::function<bool(const atransport*)> predicate, bool reset = false);
-
-void send_packet(apacket* p, atransport* t);
-
-asocket* create_device_tracker(bool long_output);
-
-#if !ADB_HOST
-unique_fd adb_listen(std::string_view addr, std::string* error);
-void server_socket_thread(std::function<unique_fd(std::string_view, std::string*)> listen_func,
-                          std::string_view addr);
-
-#if defined(__ANDROID__)
-void qemu_socket_thread(std::string_view addr);
-bool use_qemu_goldfish();
-#endif
-
-#endif
-
-#endif   /* __TRANSPORT_H */
diff --git a/adb/transport_benchmark.cpp b/adb/transport_benchmark.cpp
deleted file mode 100644
index 022808f..0000000
--- a/adb/transport_benchmark.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <malloc.h>
-#include <stdio.h>
-
-#include <android-base/logging.h>
-#include <benchmark/benchmark.h>
-
-#include "adb_trace.h"
-#include "sysdeps.h"
-#include "transport.h"
-
-#define ADB_CONNECTION_BENCHMARK(benchmark_name, ...)                          \
-    BENCHMARK_TEMPLATE(benchmark_name, FdConnection, ##__VA_ARGS__)            \
-        ->Arg(1)                                                               \
-        ->Arg(16384)                                                           \
-        ->Arg(MAX_PAYLOAD)                                                     \
-        ->UseRealTime();                                                       \
-    BENCHMARK_TEMPLATE(benchmark_name, NonblockingFdConnection, ##__VA_ARGS__) \
-        ->Arg(1)                                                               \
-        ->Arg(16384)                                                           \
-        ->Arg(MAX_PAYLOAD)                                                     \
-        ->UseRealTime()
-
-struct NonblockingFdConnection;
-template <typename ConnectionType>
-std::unique_ptr<Connection> MakeConnection(unique_fd fd);
-
-template <>
-std::unique_ptr<Connection> MakeConnection<FdConnection>(unique_fd fd) {
-    auto fd_connection = std::make_unique<FdConnection>(std::move(fd));
-    return std::make_unique<BlockingConnectionAdapter>(std::move(fd_connection));
-}
-
-template <>
-std::unique_ptr<Connection> MakeConnection<NonblockingFdConnection>(unique_fd fd) {
-    return Connection::FromFd(std::move(fd));
-}
-
-template <typename ConnectionType>
-void BM_Connection_Unidirectional(benchmark::State& state) {
-    int fds[2];
-    if (adb_socketpair(fds) != 0) {
-        LOG(FATAL) << "failed to create socketpair";
-    }
-
-    auto client = MakeConnection<ConnectionType>(unique_fd(fds[0]));
-    auto server = MakeConnection<ConnectionType>(unique_fd(fds[1]));
-
-    std::atomic<size_t> received_bytes;
-
-    client->SetReadCallback([](Connection*, std::unique_ptr<apacket>) -> bool { return true; });
-    server->SetReadCallback([&received_bytes](Connection*, std::unique_ptr<apacket> packet) -> bool {
-        received_bytes += packet->payload.size();
-        return true;
-    });
-
-    client->SetErrorCallback(
-        [](Connection*, const std::string& error) { LOG(INFO) << "client closed: " << error; });
-    server->SetErrorCallback(
-        [](Connection*, const std::string& error) { LOG(INFO) << "server closed: " << error; });
-
-    client->Start();
-    server->Start();
-
-    for (auto _ : state) {
-        size_t data_size = state.range(0);
-        std::unique_ptr<apacket> packet = std::make_unique<apacket>();
-        memset(&packet->msg, 0, sizeof(packet->msg));
-        packet->msg.command = A_WRTE;
-        packet->msg.data_length = data_size;
-        packet->payload.resize(data_size);
-
-        memset(&packet->payload[0], 0xff, data_size);
-
-        received_bytes = 0;
-        client->Write(std::move(packet));
-        while (received_bytes < data_size) {
-            continue;
-        }
-    }
-    state.SetBytesProcessed(static_cast<int64_t>(state.iterations()) * state.range(0));
-
-    client->Stop();
-    server->Stop();
-}
-
-ADB_CONNECTION_BENCHMARK(BM_Connection_Unidirectional);
-
-enum class ThreadPolicy {
-    MainThread,
-    SameThread,
-};
-
-template <typename ConnectionType, enum ThreadPolicy Policy>
-void BM_Connection_Echo(benchmark::State& state) {
-    int fds[2];
-    if (adb_socketpair(fds) != 0) {
-        LOG(FATAL) << "failed to create socketpair";
-    }
-
-    auto client = MakeConnection<ConnectionType>(unique_fd(fds[0]));
-    auto server = MakeConnection<ConnectionType>(unique_fd(fds[1]));
-
-    std::atomic<size_t> received_bytes;
-
-    fdevent_reset();
-    std::thread fdevent_thread([]() { fdevent_loop(); });
-
-    client->SetReadCallback([&received_bytes](Connection*, std::unique_ptr<apacket> packet) -> bool {
-        received_bytes += packet->payload.size();
-        return true;
-    });
-
-    static const auto handle_packet = [](Connection* connection, std::unique_ptr<apacket> packet) {
-        connection->Write(std::move(packet));
-    };
-
-    server->SetReadCallback([](Connection* connection, std::unique_ptr<apacket> packet) -> bool {
-        if (Policy == ThreadPolicy::MainThread) {
-            auto raw_packet = packet.release();
-            fdevent_run_on_main_thread([connection, raw_packet]() {
-                std::unique_ptr<apacket> packet(raw_packet);
-                handle_packet(connection, std::move(packet));
-            });
-        } else {
-            handle_packet(connection, std::move(packet));
-        }
-        return true;
-    });
-
-    client->SetErrorCallback(
-        [](Connection*, const std::string& error) { LOG(INFO) << "client closed: " << error; });
-    server->SetErrorCallback(
-        [](Connection*, const std::string& error) { LOG(INFO) << "server closed: " << error; });
-
-    client->Start();
-    server->Start();
-
-    for (auto _ : state) {
-        size_t data_size = state.range(0);
-        std::unique_ptr<apacket> packet = std::make_unique<apacket>();
-        memset(&packet->msg, 0, sizeof(packet->msg));
-        packet->msg.command = A_WRTE;
-        packet->msg.data_length = data_size;
-        packet->payload.resize(data_size);
-
-        memset(&packet->payload[0], 0xff, data_size);
-
-        received_bytes = 0;
-        client->Write(std::move(packet));
-        while (received_bytes < data_size) {
-            continue;
-        }
-    }
-    state.SetBytesProcessed(static_cast<int64_t>(state.iterations()) * state.range(0));
-
-    client->Stop();
-    server->Stop();
-
-    // TODO: Make it so that you don't need to poke the fdevent loop to make it terminate?
-    fdevent_terminate_loop();
-    fdevent_run_on_main_thread([]() {});
-
-    fdevent_thread.join();
-}
-
-ADB_CONNECTION_BENCHMARK(BM_Connection_Echo, ThreadPolicy::SameThread);
-ADB_CONNECTION_BENCHMARK(BM_Connection_Echo, ThreadPolicy::MainThread);
-
-int main(int argc, char** argv) {
-    // Set M_DECAY_TIME so that our allocations aren't immediately purged on free.
-    mallopt(M_DECAY_TIME, 1);
-
-    android::base::SetMinimumLogSeverity(android::base::WARNING);
-    adb_trace_init(argv);
-    ::benchmark::Initialize(&argc, argv);
-    if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1;
-    ::benchmark::RunSpecifiedBenchmarks();
-}
diff --git a/adb/transport_fd.cpp b/adb/transport_fd.cpp
deleted file mode 100644
index b9b4f42..0000000
--- a/adb/transport_fd.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-
-#include <deque>
-#include <memory>
-#include <mutex>
-#include <string>
-#include <thread>
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-#include <android-base/thread_annotations.h>
-
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "sysdeps.h"
-#include "transport.h"
-#include "types.h"
-
-static void CreateWakeFds(unique_fd* read, unique_fd* write) {
-    // TODO: eventfd on linux?
-    int wake_fds[2];
-    int rc = adb_socketpair(wake_fds);
-    set_file_block_mode(wake_fds[0], false);
-    set_file_block_mode(wake_fds[1], false);
-    CHECK_EQ(0, rc);
-    *read = unique_fd(wake_fds[0]);
-    *write = unique_fd(wake_fds[1]);
-}
-
-struct NonblockingFdConnection : public Connection {
-    NonblockingFdConnection(unique_fd fd) : started_(false), fd_(std::move(fd)) {
-        set_file_block_mode(fd_.get(), false);
-        CreateWakeFds(&wake_fd_read_, &wake_fd_write_);
-    }
-
-    void SetRunning(bool value) {
-        std::lock_guard<std::mutex> lock(run_mutex_);
-        running_ = value;
-    }
-
-    bool IsRunning() {
-        std::lock_guard<std::mutex> lock(run_mutex_);
-        return running_;
-    }
-
-    void Run(std::string* error) {
-        SetRunning(true);
-        while (IsRunning()) {
-            adb_pollfd pfds[2] = {
-                {.fd = fd_.get(), .events = POLLIN},
-                {.fd = wake_fd_read_.get(), .events = POLLIN},
-            };
-
-            {
-                std::lock_guard<std::mutex> lock(this->write_mutex_);
-                if (!writable_) {
-                    pfds[0].events |= POLLOUT;
-                }
-            }
-
-            int rc = adb_poll(pfds, 2, -1);
-            if (rc == -1) {
-                *error = android::base::StringPrintf("poll failed: %s", strerror(errno));
-                return;
-            } else if (rc == 0) {
-                LOG(FATAL) << "poll timed out with an infinite timeout?";
-            }
-
-            if (pfds[0].revents) {
-                if ((pfds[0].revents & POLLOUT)) {
-                    std::lock_guard<std::mutex> lock(this->write_mutex_);
-                    if (DispatchWrites() == WriteResult::Error) {
-                        *error = "write failed";
-                        return;
-                    }
-                }
-
-                if (pfds[0].revents & POLLIN) {
-                    // TODO: Should we be getting blocks from a free list?
-                    auto block = IOVector::block_type(MAX_PAYLOAD);
-                    rc = adb_read(fd_.get(), &block[0], block.size());
-                    if (rc == -1) {
-                        *error = std::string("read failed: ") + strerror(errno);
-                        return;
-                    } else if (rc == 0) {
-                        *error = "read failed: EOF";
-                        return;
-                    }
-                    block.resize(rc);
-                    read_buffer_.append(std::move(block));
-
-                    if (!read_header_ && read_buffer_.size() >= sizeof(amessage)) {
-                        auto header_buf = read_buffer_.take_front(sizeof(amessage)).coalesce();
-                        CHECK_EQ(sizeof(amessage), header_buf.size());
-                        read_header_ = std::make_unique<amessage>();
-                        memcpy(read_header_.get(), header_buf.data(), sizeof(amessage));
-                    }
-
-                    if (read_header_ && read_buffer_.size() >= read_header_->data_length) {
-                        auto data_chain = read_buffer_.take_front(read_header_->data_length);
-
-                        // TODO: Make apacket carry around a IOVector instead of coalescing.
-                        auto payload = std::move(data_chain).coalesce();
-                        auto packet = std::make_unique<apacket>();
-                        packet->msg = *read_header_;
-                        packet->payload = std::move(payload);
-                        read_header_ = nullptr;
-                        read_callback_(this, std::move(packet));
-                    }
-                }
-            }
-
-            if (pfds[1].revents) {
-                uint64_t buf;
-                rc = adb_read(wake_fd_read_.get(), &buf, sizeof(buf));
-                CHECK_EQ(static_cast<int>(sizeof(buf)), rc);
-
-                // We were woken up either to add POLLOUT to our events, or to exit.
-                // Do nothing.
-            }
-        }
-    }
-
-    void Start() override final {
-        if (started_.exchange(true)) {
-            LOG(FATAL) << "Connection started multiple times?";
-        }
-
-        thread_ = std::thread([this]() {
-            std::string error = "connection closed";
-            Run(&error);
-            this->error_callback_(this, error);
-        });
-    }
-
-    void Stop() override final {
-        SetRunning(false);
-        WakeThread();
-        thread_.join();
-    }
-
-    bool DoTlsHandshake(RSA* key, std::string* auth_key) override final {
-        LOG(FATAL) << "Not supported yet";
-        return false;
-    }
-
-    void WakeThread() {
-        uint64_t buf = 0;
-        if (TEMP_FAILURE_RETRY(adb_write(wake_fd_write_.get(), &buf, sizeof(buf))) != sizeof(buf)) {
-            LOG(FATAL) << "failed to wake up thread";
-        }
-    }
-
-    enum class WriteResult {
-        Error,
-        Completed,
-        TryAgain,
-    };
-
-    WriteResult DispatchWrites() REQUIRES(write_mutex_) {
-        CHECK(!write_buffer_.empty());
-        auto iovs = write_buffer_.iovecs();
-        ssize_t rc = adb_writev(fd_.get(), iovs.data(), iovs.size());
-        if (rc == -1) {
-            if (errno == EAGAIN || errno == EWOULDBLOCK) {
-                writable_ = false;
-                return WriteResult::TryAgain;
-            }
-
-            return WriteResult::Error;
-        } else if (rc == 0) {
-            errno = 0;
-            return WriteResult::Error;
-        }
-
-        write_buffer_.drop_front(rc);
-        writable_ = write_buffer_.empty();
-        if (write_buffer_.empty()) {
-            return WriteResult::Completed;
-        }
-
-        // There's data left in the range, which means our write returned early.
-        return WriteResult::TryAgain;
-    }
-
-    bool Write(std::unique_ptr<apacket> packet) final {
-        std::lock_guard<std::mutex> lock(write_mutex_);
-        const char* header_begin = reinterpret_cast<const char*>(&packet->msg);
-        const char* header_end = header_begin + sizeof(packet->msg);
-        auto header_block = IOVector::block_type(header_begin, header_end);
-        write_buffer_.append(std::move(header_block));
-        if (!packet->payload.empty()) {
-            write_buffer_.append(std::move(packet->payload));
-        }
-
-        WriteResult result = DispatchWrites();
-        if (result == WriteResult::TryAgain) {
-            WakeThread();
-        }
-        return result != WriteResult::Error;
-    }
-
-    std::thread thread_;
-
-    std::atomic<bool> started_;
-    std::mutex run_mutex_;
-    bool running_ GUARDED_BY(run_mutex_);
-
-    std::unique_ptr<amessage> read_header_;
-    IOVector read_buffer_;
-
-    unique_fd fd_;
-    unique_fd wake_fd_read_;
-    unique_fd wake_fd_write_;
-
-    std::mutex write_mutex_;
-    bool writable_ GUARDED_BY(write_mutex_) = true;
-    IOVector write_buffer_ GUARDED_BY(write_mutex_);
-
-    IOVector incoming_queue_;
-};
-
-std::unique_ptr<Connection> Connection::FromFd(unique_fd fd) {
-    return std::make_unique<NonblockingFdConnection>(std::move(fd));
-}
diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp
deleted file mode 100644
index 5ec8e16..0000000
--- a/adb/transport_local.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#define TRACE_TAG TRANSPORT
-
-#include "sysdeps.h"
-#include "transport.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include <condition_variable>
-#include <functional>
-#include <memory>
-#include <mutex>
-#include <thread>
-#include <unordered_map>
-#include <vector>
-
-#include <android-base/parsenetaddress.h>
-#include <android-base/stringprintf.h>
-#include <android-base/thread_annotations.h>
-#include <cutils/sockets.h>
-
-#if !ADB_HOST
-#include <android-base/properties.h>
-#endif
-
-#include "adb.h"
-#include "adb_io.h"
-#include "adb_unique_fd.h"
-#include "adb_utils.h"
-#include "socket_spec.h"
-#include "sysdeps/chrono.h"
-
-#if ADB_HOST
-
-// Android Wear has been using port 5601 in all of its documentation/tooling,
-// but we search for emulators on ports [5554, 5555 + ADB_LOCAL_TRANSPORT_MAX].
-// Avoid stomping on their port by restricting the active scanning range.
-// Once emulators self-(re-)register, they'll have to avoid 5601 in their own way.
-static int adb_local_transport_max_port = DEFAULT_ADB_LOCAL_TRANSPORT_PORT + 16 * 2 - 1;
-
-static std::mutex& local_transports_lock = *new std::mutex();
-
-static void adb_local_transport_max_port_env_override() {
-    const char* env_max_s = getenv("ADB_LOCAL_TRANSPORT_MAX_PORT");
-    if (env_max_s != nullptr) {
-        size_t env_max;
-        if (ParseUint(&env_max, env_max_s, nullptr) && env_max < 65536) {
-            // < DEFAULT_ADB_LOCAL_TRANSPORT_PORT harmlessly mimics ADB_EMU=0
-            adb_local_transport_max_port = env_max;
-            D("transport: ADB_LOCAL_TRANSPORT_MAX_PORT read as %d", adb_local_transport_max_port);
-        } else {
-            D("transport: ADB_LOCAL_TRANSPORT_MAX_PORT '%s' invalid or >= 65536, so ignored",
-              env_max_s);
-        }
-    }
-}
-
-// We keep a map from emulator port to transport.
-// TODO: weak_ptr?
-static auto& local_transports GUARDED_BY(local_transports_lock) =
-    *new std::unordered_map<int, atransport*>();
-#endif /* ADB_HOST */
-
-bool local_connect(int port) {
-    std::string dummy;
-    return local_connect_arbitrary_ports(port - 1, port, &dummy) == 0;
-}
-
-void connect_device(const std::string& address, std::string* response) {
-    if (address.empty()) {
-        *response = "empty address";
-        return;
-    }
-
-    D("connection requested to '%s'", address.c_str());
-    unique_fd fd;
-    int port;
-    std::string serial, prefix_addr;
-
-    // If address does not match any socket type, it should default to TCP.
-    if (address.starts_with("vsock:") || address.starts_with("localfilesystem:")) {
-        prefix_addr = address;
-    } else {
-        prefix_addr = "tcp:" + address;
-    }
-
-    socket_spec_connect(&fd, prefix_addr, &port, &serial, response);
-    if (fd.get() == -1) {
-        return;
-    }
-    auto reconnect = [prefix_addr](atransport* t) {
-        std::string response;
-        unique_fd fd;
-        int port;
-        std::string serial;
-        socket_spec_connect(&fd, prefix_addr, &port, &serial, &response);
-        if (fd == -1) {
-            D("reconnect failed: %s", response.c_str());
-            return ReconnectResult::Retry;
-        }
-        // This invokes the part of register_socket_transport() that needs to be
-        // invoked if the atransport* has already been setup. This eventually
-        // calls atransport->SetConnection() with a newly created Connection*
-        // that will in turn send the CNXN packet.
-        return init_socket_transport(t, std::move(fd), port, 0) >= 0 ? ReconnectResult::Success
-                                                                     : ReconnectResult::Retry;
-    };
-
-    int error;
-    if (!register_socket_transport(std::move(fd), serial, port, 0, std::move(reconnect), false,
-                                   &error)) {
-        if (error == EALREADY) {
-            *response = android::base::StringPrintf("already connected to %s", serial.c_str());
-        } else if (error == EPERM) {
-            *response = android::base::StringPrintf("failed to authenticate to %s", serial.c_str());
-        } else {
-            *response = android::base::StringPrintf("failed to connect to %s", serial.c_str());
-        }
-    } else {
-        *response = android::base::StringPrintf("connected to %s", serial.c_str());
-    }
-}
-
-
-int local_connect_arbitrary_ports(int console_port, int adb_port, std::string* error) {
-    unique_fd fd;
-
-#if ADB_HOST
-    if (find_emulator_transport_by_adb_port(adb_port) != nullptr ||
-        find_emulator_transport_by_console_port(console_port) != nullptr) {
-        return -1;
-    }
-
-    const char *host = getenv("ADBHOST");
-    if (host) {
-        fd.reset(network_connect(host, adb_port, SOCK_STREAM, 0, error));
-    }
-#endif
-    if (fd < 0) {
-        fd.reset(network_loopback_client(adb_port, SOCK_STREAM, error));
-    }
-
-    if (fd >= 0) {
-        D("client: connected on remote on fd %d", fd.get());
-        close_on_exec(fd.get());
-        disable_tcp_nagle(fd.get());
-        std::string serial = getEmulatorSerialString(console_port);
-        if (register_socket_transport(
-                    std::move(fd), std::move(serial), adb_port, 1,
-                    [](atransport*) { return ReconnectResult::Abort; }, false)) {
-            return 0;
-        }
-    }
-    return -1;
-}
-
-#if ADB_HOST
-
-static void PollAllLocalPortsForEmulator() {
-    // Try to connect to any number of running emulator instances.
-    for (int port = DEFAULT_ADB_LOCAL_TRANSPORT_PORT; port <= adb_local_transport_max_port;
-         port += 2) {
-        local_connect(port);  // Note, uses port and port-1, so '=max_port' is OK.
-    }
-}
-
-// Retry the disconnected local port for 60 times, and sleep 1 second between two retries.
-static constexpr uint32_t LOCAL_PORT_RETRY_COUNT = 60;
-static constexpr auto LOCAL_PORT_RETRY_INTERVAL = 1s;
-
-struct RetryPort {
-    int port;
-    uint32_t retry_count;
-};
-
-// Retry emulators just kicked.
-static std::vector<RetryPort>& retry_ports = *new std::vector<RetryPort>;
-std::mutex &retry_ports_lock = *new std::mutex;
-std::condition_variable &retry_ports_cond = *new std::condition_variable;
-
-static void client_socket_thread(std::string_view) {
-    adb_thread_setname("client_socket_thread");
-    D("transport: client_socket_thread() starting");
-    PollAllLocalPortsForEmulator();
-    while (true) {
-        std::vector<RetryPort> ports;
-        // Collect retry ports.
-        {
-            std::unique_lock<std::mutex> lock(retry_ports_lock);
-            while (retry_ports.empty()) {
-                retry_ports_cond.wait(lock);
-            }
-            retry_ports.swap(ports);
-        }
-        // Sleep here instead of the end of loop, because if we immediately try to reconnect
-        // the emulator just kicked, the adbd on the emulator may not have time to remove the
-        // just kicked transport.
-        std::this_thread::sleep_for(LOCAL_PORT_RETRY_INTERVAL);
-
-        // Try connecting retry ports.
-        std::vector<RetryPort> next_ports;
-        for (auto& port : ports) {
-            VLOG(TRANSPORT) << "retry port " << port.port << ", last retry_count "
-                << port.retry_count;
-            if (local_connect(port.port)) {
-                VLOG(TRANSPORT) << "retry port " << port.port << " successfully";
-                continue;
-            }
-            if (--port.retry_count > 0) {
-                next_ports.push_back(port);
-            } else {
-                VLOG(TRANSPORT) << "stop retrying port " << port.port;
-            }
-        }
-
-        // Copy back left retry ports.
-        {
-            std::unique_lock<std::mutex> lock(retry_ports_lock);
-            retry_ports.insert(retry_ports.end(), next_ports.begin(), next_ports.end());
-        }
-    }
-}
-
-#else  // !ADB_HOST
-
-void server_socket_thread(std::function<unique_fd(std::string_view, std::string*)> listen_func,
-                          std::string_view addr) {
-    adb_thread_setname("server socket");
-
-    unique_fd serverfd;
-    std::string error;
-
-    while (serverfd == -1) {
-        errno = 0;
-        serverfd = listen_func(addr, &error);
-        if (errno == EAFNOSUPPORT || errno == EINVAL || errno == EPROTONOSUPPORT) {
-            D("unrecoverable error: '%s'", error.c_str());
-            return;
-        } else if (serverfd < 0) {
-            D("server: cannot bind socket yet: %s", error.c_str());
-            std::this_thread::sleep_for(1s);
-            continue;
-        }
-        close_on_exec(serverfd.get());
-    }
-
-    while (true) {
-        D("server: trying to get new connection from fd %d", serverfd.get());
-        unique_fd fd(adb_socket_accept(serverfd, nullptr, nullptr));
-        if (fd >= 0) {
-            D("server: new connection on fd %d", fd.get());
-            close_on_exec(fd.get());
-            disable_tcp_nagle(fd.get());
-            std::string serial = android::base::StringPrintf("host-%d", fd.get());
-            // We don't care about port value in "register_socket_transport" as it is used
-            // only from ADB_HOST. "server_socket_thread" is never called from ADB_HOST.
-            register_socket_transport(
-                    std::move(fd), std::move(serial), 0, 1,
-                    [](atransport*) { return ReconnectResult::Abort; }, false);
-        }
-    }
-    D("transport: server_socket_thread() exiting");
-}
-
-#endif
-
-#if !ADB_HOST
-unique_fd adb_listen(std::string_view addr, std::string* error) {
-    return unique_fd{socket_spec_listen(addr, error, nullptr)};
-}
-#endif
-
-void local_init(const std::string& addr) {
-#if ADB_HOST
-    D("transport: local client init");
-    std::thread(client_socket_thread, addr).detach();
-    adb_local_transport_max_port_env_override();
-#elif !defined(__ANDROID__)
-    // Host adbd.
-    D("transport: local server init");
-    std::thread(server_socket_thread, adb_listen, addr).detach();
-#else
-    D("transport: local server init");
-    // For the adbd daemon in the system image we need to distinguish
-    // between the device, and the emulator.
-    if (addr.starts_with("tcp:") && use_qemu_goldfish()) {
-        std::thread(qemu_socket_thread, addr).detach();
-    } else {
-        std::thread(server_socket_thread, adb_listen, addr).detach();
-    }
-#endif // !ADB_HOST
-}
-
-#if ADB_HOST
-struct EmulatorConnection : public FdConnection {
-    EmulatorConnection(unique_fd fd, int local_port)
-        : FdConnection(std::move(fd)), local_port_(local_port) {}
-
-    ~EmulatorConnection() {
-        VLOG(TRANSPORT) << "remote_close, local_port = " << local_port_;
-        std::unique_lock<std::mutex> lock(retry_ports_lock);
-        RetryPort port;
-        port.port = local_port_;
-        port.retry_count = LOCAL_PORT_RETRY_COUNT;
-        retry_ports.push_back(port);
-        retry_ports_cond.notify_one();
-    }
-
-    void Close() override {
-        std::lock_guard<std::mutex> lock(local_transports_lock);
-        local_transports.erase(local_port_);
-        FdConnection::Close();
-    }
-
-    int local_port_;
-};
-
-/* Only call this function if you already hold local_transports_lock. */
-static atransport* find_emulator_transport_by_adb_port_locked(int adb_port)
-    REQUIRES(local_transports_lock) {
-    auto it = local_transports.find(adb_port);
-    if (it == local_transports.end()) {
-        return nullptr;
-    }
-    return it->second;
-}
-
-atransport* find_emulator_transport_by_adb_port(int adb_port) {
-    std::lock_guard<std::mutex> lock(local_transports_lock);
-    return find_emulator_transport_by_adb_port_locked(adb_port);
-}
-
-atransport* find_emulator_transport_by_console_port(int console_port) {
-    return find_transport(getEmulatorSerialString(console_port).c_str());
-}
-#endif
-
-std::string getEmulatorSerialString(int console_port) {
-    return android::base::StringPrintf("emulator-%d", console_port);
-}
-
-int init_socket_transport(atransport* t, unique_fd fd, int adb_port, int local) {
-    int fail = 0;
-
-    t->type = kTransportLocal;
-
-#if ADB_HOST
-    // Emulator connection.
-    if (local) {
-        auto emulator_connection = std::make_unique<EmulatorConnection>(std::move(fd), adb_port);
-        t->SetConnection(
-                std::make_unique<BlockingConnectionAdapter>(std::move(emulator_connection)));
-        std::lock_guard<std::mutex> lock(local_transports_lock);
-        atransport* existing_transport = find_emulator_transport_by_adb_port_locked(adb_port);
-        if (existing_transport != nullptr) {
-            D("local transport for port %d already registered (%p)?", adb_port, existing_transport);
-            fail = -1;
-        } else {
-            local_transports[adb_port] = t;
-        }
-
-        return fail;
-    }
-#endif
-
-    // Regular tcp connection.
-    auto fd_connection = std::make_unique<FdConnection>(std::move(fd));
-    t->SetConnection(std::make_unique<BlockingConnectionAdapter>(std::move(fd_connection)));
-    return fail;
-}
diff --git a/adb/transport_test.cpp b/adb/transport_test.cpp
deleted file mode 100644
index 00beb3a..0000000
--- a/adb/transport_test.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "transport.h"
-
-#include <gtest/gtest.h>
-
-#include "adb.h"
-#include "fdevent/fdevent_test.h"
-
-struct TransportTest : public FdeventTest {};
-
-static void DisconnectFunc(void* arg, atransport*) {
-    int* count = reinterpret_cast<int*>(arg);
-    ++*count;
-}
-
-TEST_F(TransportTest, RunDisconnects) {
-    atransport t;
-    // RunDisconnects() can be called with an empty atransport.
-    t.RunDisconnects();
-
-    int count = 0;
-    adisconnect disconnect;
-    disconnect.func = DisconnectFunc;
-    disconnect.opaque = &count;
-    t.AddDisconnect(&disconnect);
-    t.RunDisconnects();
-    ASSERT_EQ(1, count);
-
-    // disconnect should have been removed automatically.
-    t.RunDisconnects();
-    ASSERT_EQ(1, count);
-
-    count = 0;
-    t.AddDisconnect(&disconnect);
-    t.RemoveDisconnect(&disconnect);
-    t.RunDisconnects();
-    ASSERT_EQ(0, count);
-}
-
-TEST_F(TransportTest, SetFeatures) {
-    atransport t;
-    ASSERT_EQ(0U, t.features().size());
-
-    t.SetFeatures(FeatureSetToString(FeatureSet{"foo"}));
-    ASSERT_EQ(1U, t.features().size());
-    ASSERT_TRUE(t.has_feature("foo"));
-
-    t.SetFeatures(FeatureSetToString(FeatureSet{"foo", "bar"}));
-    ASSERT_EQ(2U, t.features().size());
-    ASSERT_TRUE(t.has_feature("foo"));
-    ASSERT_TRUE(t.has_feature("bar"));
-
-    t.SetFeatures(FeatureSetToString(FeatureSet{"foo", "bar", "foo"}));
-    ASSERT_EQ(2U, t.features().size());
-    ASSERT_TRUE(t.has_feature("foo"));
-    ASSERT_TRUE(t.has_feature("bar"));
-
-    t.SetFeatures(FeatureSetToString(FeatureSet{"bar", "baz"}));
-    ASSERT_EQ(2U, t.features().size());
-    ASSERT_FALSE(t.has_feature("foo"));
-    ASSERT_TRUE(t.has_feature("bar"));
-    ASSERT_TRUE(t.has_feature("baz"));
-
-    t.SetFeatures("");
-    ASSERT_EQ(0U, t.features().size());
-}
-
-TEST_F(TransportTest, parse_banner_no_features) {
-    atransport t;
-
-    parse_banner("host::", &t);
-
-    ASSERT_EQ(0U, t.features().size());
-    ASSERT_EQ(kCsHost, t.GetConnectionState());
-
-    ASSERT_EQ(std::string(), t.product);
-    ASSERT_EQ(std::string(), t.model);
-    ASSERT_EQ(std::string(), t.device);
-}
-
-TEST_F(TransportTest, parse_banner_product_features) {
-    atransport t;
-
-    const char banner[] =
-        "host::ro.product.name=foo;ro.product.model=bar;ro.product.device=baz;";
-    parse_banner(banner, &t);
-
-    ASSERT_EQ(kCsHost, t.GetConnectionState());
-
-    ASSERT_EQ(0U, t.features().size());
-
-    ASSERT_EQ(std::string("foo"), t.product);
-    ASSERT_EQ(std::string("bar"), t.model);
-    ASSERT_EQ(std::string("baz"), t.device);
-}
-
-TEST_F(TransportTest, parse_banner_features) {
-    atransport t;
-    const char banner[] =
-        "host::ro.product.name=foo;ro.product.model=bar;ro.product.device=baz;"
-        "features=woodly,doodly";
-    parse_banner(banner, &t);
-
-    ASSERT_EQ(kCsHost, t.GetConnectionState());
-
-    ASSERT_EQ(2U, t.features().size());
-    ASSERT_TRUE(t.has_feature("woodly"));
-    ASSERT_TRUE(t.has_feature("doodly"));
-
-    ASSERT_EQ(std::string("foo"), t.product);
-    ASSERT_EQ(std::string("bar"), t.model);
-    ASSERT_EQ(std::string("baz"), t.device);
-}
-
-TEST_F(TransportTest, test_matches_target) {
-    std::string serial = "foo";
-    std::string devpath = "/path/to/bar";
-    std::string product = "test_product";
-    std::string model = "test_model";
-    std::string device = "test_device";
-
-    atransport t;
-    t.serial = &serial[0];
-    t.devpath = &devpath[0];
-    t.product = &product[0];
-    t.model = &model[0];
-    t.device = &device[0];
-
-    // These tests should not be affected by the transport type.
-    for (TransportType type : {kTransportAny, kTransportLocal}) {
-        t.type = type;
-
-        EXPECT_TRUE(t.MatchesTarget(serial));
-        EXPECT_TRUE(t.MatchesTarget(devpath));
-        EXPECT_TRUE(t.MatchesTarget("product:" + product));
-        EXPECT_TRUE(t.MatchesTarget("model:" + model));
-        EXPECT_TRUE(t.MatchesTarget("device:" + device));
-
-        // Product, model, and device don't match without the prefix.
-        EXPECT_FALSE(t.MatchesTarget(product));
-        EXPECT_FALSE(t.MatchesTarget(model));
-        EXPECT_FALSE(t.MatchesTarget(device));
-    }
-}
-
-TEST_F(TransportTest, test_matches_target_local) {
-    std::string serial = "100.100.100.100:5555";
-
-    atransport t;
-    t.serial = &serial[0];
-
-    // Network address matching should only be used for local transports.
-    for (TransportType type : {kTransportAny, kTransportLocal}) {
-        t.type = type;
-        bool should_match = (type == kTransportLocal);
-
-        EXPECT_EQ(should_match, t.MatchesTarget("100.100.100.100"));
-        EXPECT_EQ(should_match, t.MatchesTarget("tcp:100.100.100.100"));
-        EXPECT_EQ(should_match, t.MatchesTarget("tcp:100.100.100.100:5555"));
-        EXPECT_EQ(should_match, t.MatchesTarget("udp:100.100.100.100"));
-        EXPECT_EQ(should_match, t.MatchesTarget("udp:100.100.100.100:5555"));
-
-        // Wrong protocol, hostname, or port should never match.
-        EXPECT_FALSE(t.MatchesTarget("100.100.100"));
-        EXPECT_FALSE(t.MatchesTarget("100.100.100.100:"));
-        EXPECT_FALSE(t.MatchesTarget("100.100.100.100:-1"));
-        EXPECT_FALSE(t.MatchesTarget("100.100.100.100:5554"));
-        EXPECT_FALSE(t.MatchesTarget("abc:100.100.100.100"));
-    }
-}
diff --git a/adb/types.cpp b/adb/types.cpp
deleted file mode 100644
index 26b77ab..0000000
--- a/adb/types.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "types.h"
-
-IOVector& IOVector::operator=(IOVector&& move) noexcept {
-    chain_ = std::move(move.chain_);
-    chain_length_ = move.chain_length_;
-    begin_offset_ = move.begin_offset_;
-    start_index_ = move.start_index_;
-
-    move.clear();
-    return *this;
-}
-
-IOVector::block_type IOVector::clear() {
-    chain_length_ = 0;
-    begin_offset_ = 0;
-    start_index_ = 0;
-    block_type res;
-    if (!chain_.empty()) {
-        res = std::move(chain_.back());
-    }
-    chain_.clear();
-    return res;
-}
-
-void IOVector::drop_front(IOVector::size_type len) {
-    if (len == 0) {
-        return;
-    }
-    if (len == size()) {
-        clear();
-        return;
-    }
-    CHECK_LT(len, size());
-
-    auto dropped = 0u;
-    while (dropped < len) {
-        const auto next = chain_[start_index_].size() - begin_offset_;
-        if (dropped + next < len) {
-            pop_front_block();
-            dropped += next;
-        } else {
-            const auto taken = len - dropped;
-            begin_offset_ += taken;
-            break;
-        }
-    }
-}
-
-IOVector IOVector::take_front(IOVector::size_type len) {
-    if (len == 0) {
-        return {};
-    }
-    if (len == size()) {
-        return std::move(*this);
-    }
-
-    CHECK_GE(size(), len);
-    IOVector res;
-    // first iterate over the blocks that completely go into the other vector
-    while (chain_[start_index_].size() - begin_offset_ <= len) {
-        chain_length_ -= chain_[start_index_].size();
-        len -= chain_[start_index_].size() - begin_offset_;
-        if (chain_[start_index_].size() > begin_offset_) {
-            res.append(std::move(chain_[start_index_]));
-            if (begin_offset_) {
-                res.begin_offset_ = std::exchange(begin_offset_, 0);
-            }
-        } else {
-            begin_offset_ = 0;
-        }
-        ++start_index_;
-    }
-
-    if (len > 0) {
-        // what's left is a single buffer that needs to be split between the |res| and |this|
-        // we know that it has to be split - there was a check for the case when it has to
-        // go away as a whole.
-        if (begin_offset_ != 0 || len < chain_[start_index_].size() / 2) {
-            // let's memcpy the data out
-            block_type block(chain_[start_index_].begin() + begin_offset_,
-                             chain_[start_index_].begin() + begin_offset_ + len);
-            res.append(std::move(block));
-            begin_offset_ += len;
-        } else {
-            CHECK_EQ(begin_offset_, 0u);
-            // move out the internal buffer out and copy only the tail of it back in
-            block_type block(chain_[start_index_].begin() + len, chain_[start_index_].end());
-            chain_length_ -= chain_[start_index_].size();
-            chain_[start_index_].resize(len);
-            res.append(std::move(chain_[start_index_]));
-            chain_length_ += block.size();
-            chain_[start_index_] = std::move(block);
-        }
-    }
-    return res;
-}
-
-void IOVector::trim_front() {
-    if ((begin_offset_ == 0 && start_index_ == 0) || chain_.empty()) {
-        return;
-    }
-    block_type& first_block = chain_[start_index_];
-    if (begin_offset_ == first_block.size()) {
-        ++start_index_;
-    } else {
-        memmove(first_block.data(), first_block.data() + begin_offset_,
-                first_block.size() - begin_offset_);
-        first_block.resize(first_block.size() - begin_offset_);
-    }
-    chain_length_ -= begin_offset_;
-    begin_offset_ = 0;
-    trim_chain_front();
-}
-
-void IOVector::trim_chain_front() {
-    if (start_index_) {
-        chain_.erase(chain_.begin(), chain_.begin() + start_index_);
-        start_index_ = 0;
-    }
-}
-
-void IOVector::pop_front_block() {
-    chain_length_ -= chain_[start_index_].size();
-    begin_offset_ = 0;
-    chain_[start_index_].clear();
-    ++start_index_;
-    if (start_index_ > std::max<size_t>(4, chain_.size() / 2)) {
-        trim_chain_front();
-    }
-}
-
-IOVector::block_type IOVector::coalesce() && {
-    // Destructive coalesce() may optimize for several cases when it doesn't need to allocate
-    // new buffer, or even return one of the existing blocks as is. The only guarantee is that
-    // after this call the IOVector is in some valid state. Nothing is guaranteed about the
-    // specifics.
-    if (size() == 0) {
-        return {};
-    }
-    if (begin_offset_ == chain_[start_index_].size() && chain_.size() == start_index_ + 2) {
-        chain_length_ -= chain_.back().size();
-        auto res = std::move(chain_.back());
-        chain_.pop_back();
-        return res;
-    }
-    if (chain_.size() == start_index_ + 1) {
-        chain_length_ -= chain_.back().size();
-        auto res = std::move(chain_.back());
-        chain_.pop_back();
-        if (begin_offset_ != 0) {
-            memmove(res.data(), res.data() + begin_offset_, res.size() - begin_offset_);
-            res.resize(res.size() - begin_offset_);
-            begin_offset_ = 0;
-        }
-        return res;
-    }
-    if (auto& firstBuffer = chain_[start_index_]; firstBuffer.capacity() >= size()) {
-        auto res = std::move(chain_[start_index_]);
-        auto size = res.size();
-        chain_length_ -= size;
-        if (begin_offset_ != 0) {
-            memmove(res.data(), res.data() + begin_offset_, res.size() - begin_offset_);
-            size -= begin_offset_;
-            begin_offset_ = 0;
-        }
-        for (auto i = start_index_ + 1; i < chain_.size(); ++i) {
-            memcpy(res.data() + size, chain_[i].data(), chain_[i].size());
-            size += chain_[i].size();
-        }
-        res.resize(size);
-        ++start_index_;
-        return res;
-    }
-    return const_cast<const IOVector*>(this)->coalesce<>();
-}
-
-std::vector<adb_iovec> IOVector::iovecs() const {
-    std::vector<adb_iovec> result;
-    result.reserve(chain_.size() - start_index_);
-    iterate_blocks([&result](const char* data, size_t len) {
-        adb_iovec iov;
-        iov.iov_base = const_cast<char*>(data);
-        iov.iov_len = len;
-        result.emplace_back(iov);
-    });
-
-    return result;
-}
diff --git a/adb/types.h b/adb/types.h
deleted file mode 100644
index deca7ea..0000000
--- a/adb/types.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <string.h>
-
-#include <algorithm>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include <android-base/logging.h>
-
-#include "fdevent/fdevent.h"
-#include "sysdeps/uio.h"
-
-// Essentially std::vector<char>, except without zero initialization or reallocation.
-struct Block {
-    using iterator = char*;
-
-    Block() = default;
-
-    explicit Block(size_t size) { allocate(size); }
-
-    template <typename Iterator>
-    Block(Iterator begin, Iterator end) : Block(end - begin) {
-        std::copy(begin, end, data_.get());
-    }
-
-    Block(const Block& copy) = delete;
-    Block(Block&& move) noexcept
-        : data_(std::exchange(move.data_, nullptr)),
-          capacity_(std::exchange(move.capacity_, 0)),
-          size_(std::exchange(move.size_, 0)) {}
-
-    Block& operator=(const Block& copy) = delete;
-    Block& operator=(Block&& move) noexcept {
-        clear();
-        data_ = std::exchange(move.data_, nullptr);
-        capacity_ = std::exchange(move.capacity_, 0);
-        size_ = std::exchange(move.size_, 0);
-        return *this;
-    }
-
-    ~Block() = default;
-
-    void resize(size_t new_size) {
-        if (!data_) {
-            allocate(new_size);
-        } else {
-            CHECK_GE(capacity_, new_size);
-            size_ = new_size;
-        }
-    }
-
-    template <typename InputIt>
-    void assign(InputIt begin, InputIt end) {
-        clear();
-        allocate(end - begin);
-        std::copy(begin, end, data_.get());
-    }
-
-    void clear() {
-        data_.reset();
-        capacity_ = 0;
-        size_ = 0;
-    }
-
-    size_t capacity() const { return capacity_; }
-    size_t size() const { return size_; }
-    bool empty() const { return size() == 0; }
-
-    char* data() { return data_.get(); }
-    const char* data() const { return data_.get(); }
-
-    char* begin() { return data_.get(); }
-    const char* begin() const { return data_.get(); }
-
-    char* end() { return data() + size_; }
-    const char* end() const { return data() + size_; }
-
-    char& operator[](size_t idx) { return data()[idx]; }
-    const char& operator[](size_t idx) const { return data()[idx]; }
-
-    bool operator==(const Block& rhs) const {
-        return size() == rhs.size() && memcmp(data(), rhs.data(), size()) == 0;
-    }
-
-  private:
-    void allocate(size_t size) {
-        CHECK(data_ == nullptr);
-        CHECK_EQ(0ULL, capacity_);
-        CHECK_EQ(0ULL, size_);
-        if (size != 0) {
-            // This isn't std::make_unique because that's equivalent to `new char[size]()`, which
-            // value-initializes the array instead of leaving it uninitialized. As an optimization,
-            // call new without parentheses to avoid this costly initialization.
-            data_.reset(new char[size]);
-            capacity_ = size;
-            size_ = size;
-        }
-    }
-
-    std::unique_ptr<char[]> data_;
-    size_t capacity_ = 0;
-    size_t size_ = 0;
-};
-
-struct amessage {
-    uint32_t command;     /* command identifier constant      */
-    uint32_t arg0;        /* first argument                   */
-    uint32_t arg1;        /* second argument                  */
-    uint32_t data_length; /* length of payload (0 is allowed) */
-    uint32_t data_check;  /* checksum of data payload         */
-    uint32_t magic;       /* command ^ 0xffffffff             */
-};
-
-struct apacket {
-    using payload_type = Block;
-    amessage msg;
-    payload_type payload;
-};
-
-struct IOVector {
-    using value_type = char;
-    using block_type = Block;
-    using size_type = size_t;
-
-    IOVector() = default;
-
-    explicit IOVector(block_type&& block) { append(std::move(block)); }
-
-    IOVector(const IOVector& copy) = delete;
-    IOVector(IOVector&& move) noexcept : IOVector() { *this = std::move(move); }
-
-    IOVector& operator=(const IOVector& copy) = delete;
-    IOVector& operator=(IOVector&& move) noexcept;
-
-    const value_type* front_data() const {
-        if (chain_.empty()) {
-            return nullptr;
-        }
-
-        return chain_.front().data() + begin_offset_;
-    }
-
-    size_type front_size() const {
-        if (chain_.empty()) {
-            return 0;
-        }
-
-        return chain_.front().size() - begin_offset_;
-    }
-
-    size_type size() const { return chain_length_ - begin_offset_; }
-    bool empty() const { return size() == 0; }
-
-    // Return the last block so the caller can still reuse its allocated capacity
-    // or it can be simply ignored.
-    block_type clear();
-
-    void drop_front(size_type len);
-
-    // Split the first |len| bytes out of this chain into its own.
-    IOVector take_front(size_type len);
-
-    // Add a nonempty block to the chain.
-    void append(block_type&& block) {
-        if (block.size() == 0) {
-            return;
-        }
-        CHECK_NE(0ULL, block.size());
-        chain_length_ += block.size();
-        chain_.emplace_back(std::move(block));
-    }
-
-    void trim_front();
-
-  private:
-    void trim_chain_front();
-
-    // Drop the front block from the chain, and update chain_length_ appropriately.
-    void pop_front_block();
-
-    // Iterate over the blocks with a callback with an operator()(const char*, size_t).
-    template <typename Fn>
-    void iterate_blocks(Fn&& callback) const {
-        if (size() == 0) {
-            return;
-        }
-
-        for (size_t i = start_index_; i < chain_.size(); ++i) {
-            const auto& block = chain_[i];
-            const char* begin = block.data();
-            size_t length = block.size();
-
-            if (i == start_index_) {
-                CHECK_GE(block.size(), begin_offset_);
-                begin += begin_offset_;
-                length -= begin_offset_;
-            }
-            callback(begin, length);
-        }
-    }
-
-  public:
-    // Copy all of the blocks into a single block.
-    template <typename CollectionType = block_type>
-    CollectionType coalesce() const& {
-        CollectionType result;
-        if (size() == 0) {
-            return result;
-        }
-
-        result.resize(size());
-
-        size_t offset = 0;
-        iterate_blocks([&offset, &result](const char* data, size_t len) {
-            memcpy(&result[offset], data, len);
-            offset += len;
-        });
-
-        return result;
-    }
-
-    block_type coalesce() &&;
-
-    template <typename FunctionType>
-    auto coalesced(FunctionType&& f) const {
-        if (chain_.size() == start_index_ + 1) {
-            // If we only have one block, we can use it directly.
-            return f(chain_[start_index_].data() + begin_offset_, size());
-        } else {
-            // Otherwise, copy to a single block.
-            auto data = coalesce();
-            return f(data.data(), data.size());
-        }
-    }
-
-    // Get a list of iovecs that can be used to write out all of the blocks.
-    std::vector<adb_iovec> iovecs() const;
-
-  private:
-    // Total length of all of the blocks in the chain.
-    size_t chain_length_ = 0;
-
-    size_t begin_offset_ = 0;
-    size_t start_index_ = 0;
-    std::vector<block_type> chain_;
-};
-
-// An implementation of weak pointers tied to the fdevent run loop.
-//
-// This allows for code to submit a request for an object, and upon receiving
-// a response, know whether the object is still alive, or has been destroyed
-// because of other reasons. We keep a list of living weak_ptrs in each object,
-// and clear the weak_ptrs when the object is destroyed. This is safe, because
-// we require that both the destructor of the referent and the get method on
-// the weak_ptr are executed on the main thread.
-template <typename T>
-struct enable_weak_from_this;
-
-template <typename T>
-struct weak_ptr {
-    weak_ptr() = default;
-    explicit weak_ptr(T* ptr) { reset(ptr); }
-    weak_ptr(const weak_ptr& copy) { reset(copy.get()); }
-
-    weak_ptr(weak_ptr&& move) {
-        reset(move.get());
-        move.reset();
-    }
-
-    ~weak_ptr() { reset(); }
-
-    weak_ptr& operator=(const weak_ptr& copy) {
-        if (&copy == this) {
-            return *this;
-        }
-
-        reset(copy.get());
-        return *this;
-    }
-
-    weak_ptr& operator=(weak_ptr&& move) {
-        if (&move == this) {
-            return *this;
-        }
-
-        reset(move.get());
-        move.reset();
-        return *this;
-    }
-
-    T* get() {
-        check_main_thread();
-        return ptr_;
-    }
-
-    void reset(T* ptr = nullptr) {
-        check_main_thread();
-
-        if (ptr == ptr_) {
-            return;
-        }
-
-        if (ptr_) {
-            ptr_->weak_ptrs_.erase(
-                    std::remove(ptr_->weak_ptrs_.begin(), ptr_->weak_ptrs_.end(), this));
-        }
-
-        ptr_ = ptr;
-        if (ptr_) {
-            ptr_->weak_ptrs_.push_back(this);
-        }
-    }
-
-  private:
-    friend struct enable_weak_from_this<T>;
-    T* ptr_ = nullptr;
-};
-
-template <typename T>
-struct enable_weak_from_this {
-    ~enable_weak_from_this() {
-        if (!weak_ptrs_.empty()) {
-            check_main_thread();
-            for (auto& weak : weak_ptrs_) {
-                weak->ptr_ = nullptr;
-            }
-            weak_ptrs_.clear();
-        }
-    }
-
-    weak_ptr<T> weak() { return weak_ptr<T>(static_cast<T*>(this)); }
-
-    void schedule_deletion() {
-        fdevent_run_on_main_thread([this]() { delete this; });
-    }
-
-  private:
-    friend struct weak_ptr<T>;
-    std::vector<weak_ptr<T>*> weak_ptrs_;
-};
diff --git a/adb/types_test.cpp b/adb/types_test.cpp
deleted file mode 100644
index 2c99f95..0000000
--- a/adb/types_test.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <memory>
-#include "types.h"
-
-static IOVector::block_type create_block(const std::string& string) {
-    return IOVector::block_type(string.begin(), string.end());
-}
-
-static IOVector::block_type create_block(char value, size_t len) {
-    auto block = IOVector::block_type();
-    block.resize(len);
-    memset(&(block)[0], value, len);
-    return block;
-}
-
-template <typename T>
-static IOVector::block_type copy_block(const T& block) {
-    auto copy = IOVector::block_type();
-    copy.assign(block.begin(), block.end());
-    return copy;
-}
-
-TEST(IOVector, empty) {
-    // Empty IOVector.
-    IOVector bc;
-    CHECK_EQ(0ULL, bc.coalesce().size());
-}
-
-TEST(IOVector, single_block) {
-    // A single block.
-    auto block = create_block('x', 100);
-    IOVector bc;
-    bc.append(copy_block(block));
-    ASSERT_EQ(100ULL, bc.size());
-    auto coalesced = bc.coalesce();
-    ASSERT_EQ(block, coalesced);
-}
-
-TEST(IOVector, single_block_split) {
-    // One block split.
-    IOVector bc;
-    bc.append(create_block("foobar"));
-    IOVector foo = bc.take_front(3);
-    ASSERT_EQ(3ULL, foo.size());
-    ASSERT_EQ(3ULL, bc.size());
-    ASSERT_EQ(create_block("foo"), foo.coalesce());
-    ASSERT_EQ(create_block("bar"), bc.coalesce());
-}
-
-TEST(IOVector, aligned_split) {
-    IOVector bc;
-    bc.append(create_block("foo"));
-    bc.append(create_block("bar"));
-    bc.append(create_block("baz"));
-    ASSERT_EQ(9ULL, bc.size());
-
-    IOVector foo = bc.take_front(3);
-    ASSERT_EQ(3ULL, foo.size());
-    ASSERT_EQ(create_block("foo"), foo.coalesce());
-
-    IOVector bar = bc.take_front(3);
-    ASSERT_EQ(3ULL, bar.size());
-    ASSERT_EQ(create_block("bar"), bar.coalesce());
-
-    IOVector baz = bc.take_front(3);
-    ASSERT_EQ(3ULL, baz.size());
-    ASSERT_EQ(create_block("baz"), baz.coalesce());
-
-    ASSERT_EQ(0ULL, bc.size());
-}
-
-TEST(IOVector, misaligned_split) {
-    IOVector bc;
-    bc.append(create_block("foo"));
-    bc.append(create_block("bar"));
-    bc.append(create_block("baz"));
-    bc.append(create_block("qux"));
-    bc.append(create_block("quux"));
-
-    // Aligned left, misaligned right, across multiple blocks.
-    IOVector foob = bc.take_front(4);
-    ASSERT_EQ(4ULL, foob.size());
-    ASSERT_EQ(create_block("foob"), foob.coalesce());
-
-    // Misaligned left, misaligned right, in one block.
-    IOVector a = bc.take_front(1);
-    ASSERT_EQ(1ULL, a.size());
-    ASSERT_EQ(create_block("a"), a.coalesce());
-
-    // Misaligned left, misaligned right, across two blocks.
-    IOVector rba = bc.take_front(3);
-    ASSERT_EQ(3ULL, rba.size());
-    ASSERT_EQ(create_block("rba"), rba.coalesce());
-
-    // Misaligned left, misaligned right, across three blocks.
-    IOVector zquxquu = bc.take_front(7);
-    ASSERT_EQ(7ULL, zquxquu.size());
-    ASSERT_EQ(create_block("zquxquu"), zquxquu.coalesce());
-
-    ASSERT_EQ(1ULL, bc.size());
-    ASSERT_EQ(create_block("x"), bc.coalesce());
-}
diff --git a/base/.clang-format b/base/.clang-format
deleted file mode 120000
index fd0645f..0000000
--- a/base/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-2
\ No newline at end of file
diff --git a/base/Android.bp b/base/Android.bp
deleted file mode 100644
index 4556f9b..0000000
--- a/base/Android.bp
+++ /dev/null
@@ -1,225 +0,0 @@
-//
-// Copyright (C) 2015 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.
-//
-
-cc_defaults {
-    name: "libbase_cflags_defaults",
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-    ],
-    target: {
-        android: {
-            cflags: [
-                "-D_FILE_OFFSET_BITS=64",
-            ],
-        },
-    },
-}
-
-cc_library_headers {
-    name: "libbase_headers",
-    vendor_available: true,
-    ramdisk_available: true,
-    recovery_available: true,
-    host_supported: true,
-    native_bridge_supported: true,
-    export_include_dirs: ["include"],
-
-    target: {
-        linux_bionic: {
-            enabled: true,
-        },
-        windows: {
-            enabled: true,
-        },
-    },
-    apex_available: [
-        "//apex_available:anyapex",
-        "//apex_available:platform",
-    ],
-    min_sdk_version: "29",
-}
-
-cc_defaults {
-    name: "libbase_defaults",
-    defaults: ["libbase_cflags_defaults"],
-    srcs: [
-        "abi_compatibility.cpp",
-        "chrono_utils.cpp",
-        "cmsg.cpp",
-        "file.cpp",
-        "liblog_symbols.cpp",
-        "logging.cpp",
-        "mapped_file.cpp",
-        "parsebool.cpp",
-        "parsenetaddress.cpp",
-        "process.cpp",
-        "properties.cpp",
-        "stringprintf.cpp",
-        "strings.cpp",
-        "threads.cpp",
-        "test_utils.cpp",
-    ],
-
-    cppflags: ["-Wexit-time-destructors"],
-    shared_libs: ["liblog"],
-    target: {
-        android: {
-            sanitize: {
-                misc_undefined: ["integer"],
-            },
-
-        },
-        linux: {
-            srcs: [
-                "errors_unix.cpp",
-            ],
-        },
-        darwin: {
-            srcs: [
-                "errors_unix.cpp",
-            ],
-        },
-        linux_bionic: {
-            enabled: true,
-        },
-        windows: {
-            srcs: [
-                "errors_windows.cpp",
-                "utf8.cpp",
-            ],
-            exclude_srcs: [
-                "cmsg.cpp",
-            ],
-            enabled: true,
-        },
-    },
-}
-
-cc_library {
-    name: "libbase",
-    defaults: ["libbase_defaults"],
-    vendor_available: true,
-    ramdisk_available: true,
-    recovery_available: true,
-    host_supported: true,
-    native_bridge_supported: true,
-    vndk: {
-        enabled: true,
-        support_system_process: true,
-    },
-    header_libs: [
-        "libbase_headers",
-    ],
-    export_header_lib_headers: ["libbase_headers"],
-    static_libs: ["fmtlib"],
-    whole_static_libs: ["fmtlib"],
-    export_static_lib_headers: ["fmtlib"],
-    apex_available: [
-        "//apex_available:anyapex",
-        "//apex_available:platform",
-    ],
-    min_sdk_version: "29",
-}
-
-cc_library_static {
-    name: "libbase_ndk",
-    defaults: ["libbase_defaults"],
-    sdk_version: "current",
-    stl: "c++_static",
-    export_include_dirs: ["include"],
-    static_libs: ["fmtlib_ndk"],
-    whole_static_libs: ["fmtlib_ndk"],
-    export_static_lib_headers: ["fmtlib_ndk"],
-}
-
-// Tests
-// ------------------------------------------------------------------------------
-cc_test {
-    name: "libbase_test",
-    defaults: ["libbase_cflags_defaults"],
-    host_supported: true,
-    srcs: [
-        "cmsg_test.cpp",
-        "endian_test.cpp",
-        "errors_test.cpp",
-        "expected_test.cpp",
-        "file_test.cpp",
-        "logging_splitters_test.cpp",
-        "logging_test.cpp",
-        "macros_test.cpp",
-        "mapped_file_test.cpp",
-        "no_destructor_test.cpp",
-        "parsedouble_test.cpp",
-        "parsebool_test.cpp",
-        "parseint_test.cpp",
-        "parsenetaddress_test.cpp",
-        "process_test.cpp",
-        "properties_test.cpp",
-        "result_test.cpp",
-        "scopeguard_test.cpp",
-        "stringprintf_test.cpp",
-        "strings_test.cpp",
-        "test_main.cpp",
-        "test_utils_test.cpp",
-    ],
-    target: {
-        android: {
-            sanitize: {
-                misc_undefined: ["integer"],
-            },
-        },
-        linux: {
-            srcs: ["chrono_utils_test.cpp"],
-        },
-        windows: {
-            srcs: ["utf8_test.cpp"],
-            cflags: ["-Wno-unused-parameter"],
-            enabled: true,
-        },
-    },
-    local_include_dirs: ["."],
-    shared_libs: ["libbase"],
-    compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-    test_suites: ["device-tests"],
-}
-
-cc_benchmark {
-    name: "libbase_benchmark",
-    defaults: ["libbase_cflags_defaults"],
-
-    srcs: ["format_benchmark.cpp"],
-    shared_libs: ["libbase"],
-
-    compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-}
diff --git a/base/CPPLINT.cfg b/base/CPPLINT.cfg
deleted file mode 100644
index d94a89c..0000000
--- a/base/CPPLINT.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-set noparent
-filter=-build/header_guard,-build/include,-build/c++11,-whitespace/operators
diff --git a/base/OWNERS b/base/OWNERS
deleted file mode 100644
index 97777f7..0000000
--- a/base/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-enh@google.com
-jmgao@google.com
-tomcherry@google.com
diff --git a/base/README.md b/base/README.md
deleted file mode 100644
index 2ef5c10..0000000
--- a/base/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# libbase
-
-## Who is this library for?
-
-This library is a collection of convenience functions to make common tasks
-easier and less error-prone.
-
-In this context, "error-prone" covers both "hard to do correctly" and
-"hard to do with good performance", but as a general purpose library,
-libbase's primary focus is on making it easier to do things easily and
-correctly when a compromise has to be made between "simplest API" on the
-one hand and "fastest implementation" on the other. Though obviously
-the ideal is to have both.
-
-## Should my routine be added?
-
-The intention is to cover the 80% use cases, not be all things to all users.
-
-If you have a routine that's really useful in your project,
-congratulations. But that doesn't mean it should be here rather than
-just in your project.
-
-The question for libbase is "should everyone be doing this?"/"does this
-make everyone's code cleaner/safer?". Historically we've considered the
-bar for inclusion to be "are there at least three *unrelated* projects
-that would be cleaned up by doing so".
-
-If your routine is actually something from a future C++ standard (that
-isn't yet in libc++), or it's widely used in another library, that helps
-show that there's precedent. Being able to say "so-and-so has used this
-API for n years" is a good way to reduce concerns about API choices.
-
-## Any other restrictions?
-
-Unlike most Android code, code in libbase has to build for Mac and
-Windows too.
-
-Code here is also expected to have good test coverage.
-
-By its nature, it's difficult to change libbase API. It's often best
-to start using your routine just in your project, and let it "graduate"
-after you're certain that the API is solid.
diff --git a/base/abi_compatibility.cpp b/base/abi_compatibility.cpp
deleted file mode 100644
index 06a7801..0000000
--- a/base/abi_compatibility.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <memory>
-
-#include "android-base/cmsg.h"
-#include "android-base/file.h"
-#include "android-base/mapped_file.h"
-#include "android-base/unique_fd.h"
-
-namespace android {
-namespace base {
-
-// These ABI-compatibility shims are in a separate file for two reasons:
-//   1. If they were in the file with the actual functions, it prevents calls to
-//      those functions by other functions in the file, due to ambiguity.
-//   2. We will hopefully be able to delete these quickly.
-
-#if !defined(_WIN32)
-ssize_t SendFileDescriptorVector(int sockfd, const void* data, size_t len,
-                                 const std::vector<int>& fds) {
-  return SendFileDescriptorVector(borrowed_fd(sockfd), data, len, fds);
-}
-
-ssize_t ReceiveFileDescriptorVector(int sockfd, void* data, size_t len, size_t max_fds,
-                                    std::vector<unique_fd>* fds) {
-  return ReceiveFileDescriptorVector(borrowed_fd(sockfd), data, len, max_fds, fds);
-}
-#endif
-
-bool ReadFdToString(int fd, std::string* content) {
-  return ReadFdToString(borrowed_fd(fd), content);
-}
-
-bool WriteStringToFd(const std::string& content, int fd) {
-  return WriteStringToFd(content, borrowed_fd(fd));
-}
-
-bool ReadFully(int fd, void* data, size_t byte_count) {
-  return ReadFully(borrowed_fd(fd), data, byte_count);
-}
-
-bool ReadFullyAtOffset(int fd, void* data, size_t byte_count, off64_t offset) {
-  return ReadFullyAtOffset(borrowed_fd(fd), data, byte_count, offset);
-}
-
-bool WriteFully(int fd, const void* data, size_t byte_count) {
-  return WriteFully(borrowed_fd(fd), data, byte_count);
-}
-
-#if defined(__LP64__)
-#define MAPPEDFILE_FROMFD _ZN10MappedFile6FromFdEilmi
-#else
-#define MAPPEDFILE_FROMFD _ZN10MappedFile6FromFdEixmi
-#endif
-
-#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
-extern "C" std::unique_ptr<MappedFile> MAPPEDFILE_FROMFD(int fd, off64_t offset, size_t length,
-                                                         int prot) {
-  return MappedFile::FromFd(fd, offset, length, prot);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/chrono_utils.cpp b/base/chrono_utils.cpp
deleted file mode 100644
index 19080a5..0000000
--- a/base/chrono_utils.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "android-base/chrono_utils.h"
-
-#include <time.h>
-
-namespace android {
-namespace base {
-
-boot_clock::time_point boot_clock::now() {
-#ifdef __linux__
-  timespec ts;
-  clock_gettime(CLOCK_BOOTTIME, &ts);
-  return boot_clock::time_point(std::chrono::seconds(ts.tv_sec) +
-                                std::chrono::nanoseconds(ts.tv_nsec));
-#else
-  // Darwin and Windows do not support clock_gettime.
-  return boot_clock::time_point();
-#endif  // __linux__
-}
-
-std::ostream& operator<<(std::ostream& os, const Timer& t) {
-  os << t.duration().count() << "ms";
-  return os;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/chrono_utils_test.cpp b/base/chrono_utils_test.cpp
deleted file mode 100644
index da442f4..0000000
--- a/base/chrono_utils_test.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "android-base/chrono_utils.h"
-
-#include <time.h>
-
-#include <chrono>
-#include <sstream>
-#include <string>
-#include <thread>
-
-#include <gtest/gtest.h>
-
-namespace android {
-namespace base {
-
-std::chrono::seconds GetBootTimeSeconds() {
-  struct timespec now;
-  clock_gettime(CLOCK_BOOTTIME, &now);
-
-  auto now_tp = boot_clock::time_point(std::chrono::seconds(now.tv_sec) +
-                                       std::chrono::nanoseconds(now.tv_nsec));
-  return std::chrono::duration_cast<std::chrono::seconds>(now_tp.time_since_epoch());
-}
-
-// Tests (at least) the seconds accuracy of the boot_clock::now() method.
-TEST(ChronoUtilsTest, BootClockNowSeconds) {
-  auto now = GetBootTimeSeconds();
-  auto boot_seconds =
-      std::chrono::duration_cast<std::chrono::seconds>(boot_clock::now().time_since_epoch());
-  EXPECT_EQ(now, boot_seconds);
-}
-
-template <typename T>
-void ExpectAboutEqual(T expected, T actual) {
-  auto expected_upper_bound = expected * 1.05f;
-  auto expected_lower_bound = expected * .95;
-  EXPECT_GT(expected_upper_bound, actual);
-  EXPECT_LT(expected_lower_bound, actual);
-}
-
-TEST(ChronoUtilsTest, TimerDurationIsSane) {
-  auto start = boot_clock::now();
-  Timer t;
-  std::this_thread::sleep_for(50ms);
-  auto stop = boot_clock::now();
-  auto stop_timer = t.duration();
-
-  auto expected = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
-  ExpectAboutEqual(expected, stop_timer);
-}
-
-TEST(ChronoUtilsTest, TimerOstream) {
-  Timer t;
-  std::this_thread::sleep_for(50ms);
-  auto stop_timer = t.duration().count();
-  std::stringstream os;
-  os << t;
-  decltype(stop_timer) stop_timer_from_stream;
-  os >> stop_timer_from_stream;
-  EXPECT_NE(0, stop_timer);
-  ExpectAboutEqual(stop_timer, stop_timer_from_stream);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/cmsg.cpp b/base/cmsg.cpp
deleted file mode 100644
index 1fa873c..0000000
--- a/base/cmsg.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <android-base/cmsg.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <sys/user.h>
-
-#include <memory>
-
-#include <android-base/logging.h>
-
-namespace android {
-namespace base {
-
-ssize_t SendFileDescriptorVector(borrowed_fd sockfd, const void* data, size_t len,
-                                 const std::vector<int>& fds) {
-  size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size());
-  size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size());
-  if (cmsg_space >= PAGE_SIZE) {
-    errno = ENOMEM;
-    return -1;
-  }
-
-  alignas(struct cmsghdr) char cmsg_buf[cmsg_space];
-  iovec iov = {.iov_base = const_cast<void*>(data), .iov_len = len};
-  msghdr msg = {
-      .msg_name = nullptr,
-      .msg_namelen = 0,
-      .msg_iov = &iov,
-      .msg_iovlen = 1,
-      .msg_control = cmsg_buf,
-      // We can't cast to the actual type of the field, because it's different across platforms.
-      .msg_controllen = static_cast<unsigned int>(cmsg_space),
-      .msg_flags = 0,
-  };
-
-  struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
-  cmsg->cmsg_level = SOL_SOCKET;
-  cmsg->cmsg_type = SCM_RIGHTS;
-  cmsg->cmsg_len = cmsg_len;
-
-  int* cmsg_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
-  for (size_t i = 0; i < fds.size(); ++i) {
-    cmsg_fds[i] = fds[i];
-  }
-
-#if defined(__linux__)
-  int flags = MSG_NOSIGNAL;
-#else
-  int flags = 0;
-#endif
-
-  return TEMP_FAILURE_RETRY(sendmsg(sockfd.get(), &msg, flags));
-}
-
-ssize_t ReceiveFileDescriptorVector(borrowed_fd sockfd, void* data, size_t len, size_t max_fds,
-                                    std::vector<unique_fd>* fds) {
-  fds->clear();
-
-  size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds);
-  if (cmsg_space >= PAGE_SIZE) {
-    errno = ENOMEM;
-    return -1;
-  }
-
-  alignas(struct cmsghdr) char cmsg_buf[cmsg_space];
-  iovec iov = {.iov_base = const_cast<void*>(data), .iov_len = len};
-  msghdr msg = {
-      .msg_name = nullptr,
-      .msg_namelen = 0,
-      .msg_iov = &iov,
-      .msg_iovlen = 1,
-      .msg_control = cmsg_buf,
-      // We can't cast to the actual type of the field, because it's different across platforms.
-      .msg_controllen = static_cast<unsigned int>(cmsg_space),
-      .msg_flags = 0,
-  };
-
-  int flags = MSG_TRUNC | MSG_CTRUNC;
-#if defined(__linux__)
-  flags |= MSG_CMSG_CLOEXEC | MSG_NOSIGNAL;
-#endif
-
-  ssize_t rc = TEMP_FAILURE_RETRY(recvmsg(sockfd.get(), &msg, flags));
-
-  if (rc == -1) {
-    return -1;
-  }
-
-  int error = 0;
-  if ((msg.msg_flags & MSG_TRUNC)) {
-    LOG(ERROR) << "message was truncated when receiving file descriptors";
-    error = EMSGSIZE;
-  } else if ((msg.msg_flags & MSG_CTRUNC)) {
-    LOG(ERROR) << "control message was truncated when receiving file descriptors";
-    error = EMSGSIZE;
-  }
-
-  std::vector<unique_fd> received_fds;
-  struct cmsghdr* cmsg;
-  for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-    if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
-      LOG(ERROR) << "received unexpected cmsg: [" << cmsg->cmsg_level << ", " << cmsg->cmsg_type
-                 << "]";
-      error = EBADMSG;
-      continue;
-    }
-
-    // There isn't a macro that does the inverse of CMSG_LEN, so hack around it ourselves, with
-    // some asserts to ensure that CMSG_LEN behaves as we expect.
-#if defined(__linux__)
-#define CMSG_ASSERT static_assert
-#else
-// CMSG_LEN is somehow not constexpr on darwin.
-#define CMSG_ASSERT CHECK
-#endif
-    CMSG_ASSERT(CMSG_LEN(0) + 1 * sizeof(int) == CMSG_LEN(1 * sizeof(int)));
-    CMSG_ASSERT(CMSG_LEN(0) + 2 * sizeof(int) == CMSG_LEN(2 * sizeof(int)));
-    CMSG_ASSERT(CMSG_LEN(0) + 3 * sizeof(int) == CMSG_LEN(3 * sizeof(int)));
-    CMSG_ASSERT(CMSG_LEN(0) + 4 * sizeof(int) == CMSG_LEN(4 * sizeof(int)));
-
-    if (cmsg->cmsg_len % sizeof(int) != 0) {
-      LOG(FATAL) << "cmsg_len(" << cmsg->cmsg_len << ") not aligned to sizeof(int)";
-    } else if (cmsg->cmsg_len <= CMSG_LEN(0)) {
-      LOG(FATAL) << "cmsg_len(" << cmsg->cmsg_len << ") not long enough to hold any data";
-    }
-
-    int* cmsg_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
-    size_t cmsg_fdcount = static_cast<size_t>(cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-    for (size_t i = 0; i < cmsg_fdcount; ++i) {
-#if !defined(__linux__)
-      // Linux uses MSG_CMSG_CLOEXEC instead of doing this manually.
-      fcntl(cmsg_fds[i], F_SETFD, FD_CLOEXEC);
-#endif
-      received_fds.emplace_back(cmsg_fds[i]);
-    }
-  }
-
-  if (error != 0) {
-    errno = error;
-    return -1;
-  }
-
-  if (received_fds.size() > max_fds) {
-    LOG(ERROR) << "received too many file descriptors, expected " << fds->size() << ", received "
-               << received_fds.size();
-    errno = EMSGSIZE;
-    return -1;
-  }
-
-  *fds = std::move(received_fds);
-  return rc;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/cmsg_test.cpp b/base/cmsg_test.cpp
deleted file mode 100644
index 9ee5c82..0000000
--- a/base/cmsg_test.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <android-base/cmsg.h>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/unique_fd.h>
-#include <gtest/gtest.h>
-
-#if !defined(_WIN32)
-
-using android::base::ReceiveFileDescriptors;
-using android::base::SendFileDescriptors;
-using android::base::unique_fd;
-
-static ino_t GetInode(int fd) {
-  struct stat st;
-  if (fstat(fd, &st) != 0) {
-    PLOG(FATAL) << "fstat failed";
-  }
-
-  return st.st_ino;
-}
-
-struct CmsgTest : ::testing::TestWithParam<bool> {
-  bool Seqpacket() { return GetParam(); }
-
-  void SetUp() override {
-    ASSERT_TRUE(
-        android::base::Socketpair(Seqpacket() ? SOCK_SEQPACKET : SOCK_STREAM, &send, &recv));
-    int dup1 = dup(tmp1.fd);
-    ASSERT_NE(-1, dup1);
-    int dup2 = dup(tmp2.fd);
-    ASSERT_NE(-1, dup2);
-
-    fd1.reset(dup1);
-    fd2.reset(dup2);
-
-    ino1 = GetInode(dup1);
-    ino2 = GetInode(dup2);
-  }
-
-  unique_fd send;
-  unique_fd recv;
-
-  TemporaryFile tmp1;
-  TemporaryFile tmp2;
-
-  unique_fd fd1;
-  unique_fd fd2;
-
-  ino_t ino1;
-  ino_t ino2;
-};
-
-TEST_P(CmsgTest, smoke) {
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "x", 1, fd1.get()));
-
-  char buf[2];
-  unique_fd received;
-  ASSERT_EQ(1, ReceiveFileDescriptors(recv.get(), buf, 2, &received));
-  ASSERT_EQ('x', buf[0]);
-  ASSERT_NE(-1, received.get());
-
-  ASSERT_EQ(ino1, GetInode(received.get()));
-}
-
-TEST_P(CmsgTest, msg_trunc) {
-  ASSERT_EQ(2, SendFileDescriptors(send.get(), "ab", 2, fd1.get(), fd2.get()));
-
-  char buf[2];
-  unique_fd received1, received2;
-
-  ssize_t rc = ReceiveFileDescriptors(recv.get(), buf, 1, &received1, &received2);
-  if (Seqpacket()) {
-    ASSERT_EQ(-1, rc);
-    ASSERT_EQ(EMSGSIZE, errno);
-    ASSERT_EQ(-1, received1.get());
-    ASSERT_EQ(-1, received2.get());
-  } else {
-    ASSERT_EQ(1, rc);
-    ASSERT_NE(-1, received1.get());
-    ASSERT_NE(-1, received2.get());
-    ASSERT_EQ(ino1, GetInode(received1.get()));
-    ASSERT_EQ(ino2, GetInode(received2.get()));
-    ASSERT_EQ(1, read(recv.get(), buf, 2));
-  }
-}
-
-TEST_P(CmsgTest, msg_ctrunc) {
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "a", 1, fd1.get(), fd2.get()));
-
-  char buf[2];
-  unique_fd received;
-  ASSERT_EQ(-1, ReceiveFileDescriptors(recv.get(), buf, 1, &received));
-  ASSERT_EQ(EMSGSIZE, errno);
-  ASSERT_EQ(-1, received.get());
-}
-
-TEST_P(CmsgTest, peek) {
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "a", 1, fd1.get()));
-
-  char buf[2];
-  ASSERT_EQ(1, ::recv(recv.get(), buf, sizeof(buf), MSG_PEEK));
-  ASSERT_EQ('a', buf[0]);
-
-  unique_fd received;
-  ASSERT_EQ(1, ReceiveFileDescriptors(recv.get(), buf, 1, &received));
-  ASSERT_EQ(ino1, GetInode(received.get()));
-}
-
-TEST_P(CmsgTest, stream_fd_association) {
-  if (Seqpacket()) {
-    return;
-  }
-
-  // fds are associated with the first byte of the write.
-  ASSERT_EQ(1, TEMP_FAILURE_RETRY(write(send.get(), "a", 1)));
-  ASSERT_EQ(2, SendFileDescriptors(send.get(), "bc", 2, fd1.get()));
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "d", 1, fd2.get()));
-  char buf[2];
-  ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(recv.get(), buf, 2)));
-  ASSERT_EQ(0, memcmp(buf, "ab", 2));
-
-  std::vector<unique_fd> received1;
-  ssize_t rc = ReceiveFileDescriptorVector(recv.get(), buf, 1, 1, &received1);
-  ASSERT_EQ(1, rc);
-  ASSERT_EQ('c', buf[0]);
-  ASSERT_TRUE(received1.empty());
-
-  unique_fd received2;
-  rc = ReceiveFileDescriptors(recv.get(), buf, 1, &received2);
-  ASSERT_EQ(1, rc);
-  ASSERT_EQ('d', buf[0]);
-  ASSERT_EQ(ino2, GetInode(received2.get()));
-}
-
-TEST_P(CmsgTest, multiple_fd_ordering) {
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "a", 1, fd1.get(), fd2.get()));
-
-  char buf[2];
-  unique_fd received1, received2;
-  ASSERT_EQ(1, ReceiveFileDescriptors(recv.get(), buf, 1, &received1, &received2));
-
-  ASSERT_NE(-1, received1.get());
-  ASSERT_NE(-1, received2.get());
-
-  ASSERT_EQ(ino1, GetInode(received1.get()));
-  ASSERT_EQ(ino2, GetInode(received2.get()));
-}
-
-TEST_P(CmsgTest, separate_fd_ordering) {
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "a", 1, fd1.get()));
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "b", 1, fd2.get()));
-
-  char buf[2];
-  unique_fd received1, received2;
-  ASSERT_EQ(1, ReceiveFileDescriptors(recv.get(), buf, 1, &received1));
-  ASSERT_EQ(1, ReceiveFileDescriptors(recv.get(), buf, 1, &received2));
-
-  ASSERT_NE(-1, received1.get());
-  ASSERT_NE(-1, received2.get());
-
-  ASSERT_EQ(ino1, GetInode(received1.get()));
-  ASSERT_EQ(ino2, GetInode(received2.get()));
-}
-
-TEST_P(CmsgTest, separate_fds_no_coalescing) {
-  unique_fd sent1(dup(tmp1.fd));
-  unique_fd sent2(dup(tmp2.fd));
-
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "", 1, fd1.get()));
-  ASSERT_EQ(1, SendFileDescriptors(send.get(), "", 1, fd2.get()));
-
-  char buf[2];
-  std::vector<unique_fd> received;
-  ASSERT_EQ(1, ReceiveFileDescriptorVector(recv.get(), buf, 2, 2, &received));
-  ASSERT_EQ(1U, received.size());
-  ASSERT_EQ(ino1, GetInode(received[0].get()));
-
-  ASSERT_EQ(1, ReceiveFileDescriptorVector(recv.get(), buf, 2, 2, &received));
-  ASSERT_EQ(1U, received.size());
-  ASSERT_EQ(ino2, GetInode(received[0].get()));
-}
-
-INSTANTIATE_TEST_CASE_P(CmsgTest, CmsgTest, testing::Bool());
-
-#endif
diff --git a/base/endian_test.cpp b/base/endian_test.cpp
deleted file mode 100644
index 963ab13..0000000
--- a/base/endian_test.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "android-base/endian.h"
-
-#include <gtest/gtest.h>
-
-TEST(endian, constants) {
-  ASSERT_TRUE(__LITTLE_ENDIAN == LITTLE_ENDIAN);
-  ASSERT_TRUE(__BIG_ENDIAN == BIG_ENDIAN);
-  ASSERT_TRUE(__BYTE_ORDER == BYTE_ORDER);
-
-  ASSERT_EQ(__LITTLE_ENDIAN, __BYTE_ORDER);
-}
-
-TEST(endian, smoke) {
-  static constexpr uint16_t le16 = 0x1234;
-  static constexpr uint32_t le32 = 0x12345678;
-  static constexpr uint64_t le64 = 0x123456789abcdef0;
-
-  static constexpr uint16_t be16 = 0x3412;
-  static constexpr uint32_t be32 = 0x78563412;
-  static constexpr uint64_t be64 = 0xf0debc9a78563412;
-
-  ASSERT_EQ(be16, htons(le16));
-  ASSERT_EQ(be32, htonl(le32));
-  ASSERT_EQ(be64, htonq(le64));
-
-  ASSERT_EQ(le16, ntohs(be16));
-  ASSERT_EQ(le32, ntohl(be32));
-  ASSERT_EQ(le64, ntohq(be64));
-
-  ASSERT_EQ(be16, htobe16(le16));
-  ASSERT_EQ(be32, htobe32(le32));
-  ASSERT_EQ(be64, htobe64(le64));
-
-  ASSERT_EQ(le16, betoh16(be16));
-  ASSERT_EQ(le32, betoh32(be32));
-  ASSERT_EQ(le64, betoh64(be64));
-
-  ASSERT_EQ(le16, htole16(le16));
-  ASSERT_EQ(le32, htole32(le32));
-  ASSERT_EQ(le64, htole64(le64));
-
-  ASSERT_EQ(le16, letoh16(le16));
-  ASSERT_EQ(le32, letoh32(le32));
-  ASSERT_EQ(le64, letoh64(le64));
-
-  ASSERT_EQ(le16, be16toh(be16));
-  ASSERT_EQ(le32, be32toh(be32));
-  ASSERT_EQ(le64, be64toh(be64));
-
-  ASSERT_EQ(le16, le16toh(le16));
-  ASSERT_EQ(le32, le32toh(le32));
-  ASSERT_EQ(le64, le64toh(le64));
-}
diff --git a/base/errors_test.cpp b/base/errors_test.cpp
deleted file mode 100644
index 8e7cdd1..0000000
--- a/base/errors_test.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/errors.h"
-
-#include <gtest/gtest.h>
-
-namespace android {
-namespace base {
-
-// Error strings aren't consistent enough across systems to test the output,
-// just make sure we can compile correctly and nothing crashes even if we send
-// it possibly bogus error codes.
-TEST(ErrorsTest, TestSystemErrorString) {
-  SystemErrorCodeToString(-1);
-  SystemErrorCodeToString(0);
-  SystemErrorCodeToString(1);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
deleted file mode 100644
index 48269b6..0000000
--- a/base/errors_unix.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/errors.h"
-
-#include <errno.h>
-#include <string.h>
-
-namespace android {
-namespace base {
-
-std::string SystemErrorCodeToString(int error_code) {
-  return strerror(error_code);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/errors_windows.cpp b/base/errors_windows.cpp
deleted file mode 100644
index a5ff511..0000000
--- a/base/errors_windows.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/errors.h"
-
-#include <windows.h>
-
-#include "android-base/stringprintf.h"
-#include "android-base/strings.h"
-#include "android-base/utf8.h"
-
-// A Windows error code is a DWORD. It's simpler to use an int error code for
-// both Unix and Windows if possible, but if this fails we'll need a different
-// function signature for each.
-static_assert(sizeof(int) >= sizeof(DWORD),
-              "Windows system error codes are too large to fit in an int.");
-
-namespace android {
-namespace base {
-
-static constexpr DWORD kErrorMessageBufferSize = 256;
-
-std::string SystemErrorCodeToString(int int_error_code) {
-  WCHAR msgbuf[kErrorMessageBufferSize];
-  DWORD error_code = int_error_code;
-  DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
-  DWORD len = FormatMessageW(flags, nullptr, error_code, 0, msgbuf,
-                             kErrorMessageBufferSize, nullptr);
-  if (len == 0) {
-    return android::base::StringPrintf(
-        "Error %lu while retrieving message for error %lu", GetLastError(),
-        error_code);
-  }
-
-  // Convert UTF-16 to UTF-8.
-  std::string msg;
-  if (!android::base::WideToUTF8(msgbuf, &msg)) {
-    return android::base::StringPrintf(
-        "Error %lu while converting message for error %lu from UTF-16 to UTF-8",
-        GetLastError(), error_code);
-  }
-
-  // Messages returned by the system end with line breaks.
-  msg = android::base::Trim(msg);
-
-  // There are many Windows error messages compared to POSIX, so include the
-  // numeric error code for easier, quicker, accurate identification. Use
-  // decimal instead of hex because there are decimal ranges like 10000-11999
-  // for Winsock.
-  android::base::StringAppendF(&msg, " (%lu)", error_code);
-  return msg;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/expected_test.cpp b/base/expected_test.cpp
deleted file mode 100644
index 47e396a..0000000
--- a/base/expected_test.cpp
+++ /dev/null
@@ -1,876 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/expected.h"
-
-#include <cstdio>
-#include <memory>
-#include <string>
-
-#include <gtest/gtest.h>
-
-using android::base::expected;
-using android::base::unexpected;
-
-typedef expected<int, int> exp_int;
-typedef expected<double, double> exp_double;
-typedef expected<std::string, std::string> exp_string;
-typedef expected<std::pair<std::string, int>, int> exp_pair;
-typedef expected<void, int> exp_void;
-
-struct T {
-  int a;
-  int b;
-  T() = default;
-  T(int a, int b) noexcept : a(a), b(b) {}
-};
-bool operator==(const T& x, const T& y) {
-  return x.a == y.a && x.b == y.b;
-}
-bool operator!=(const T& x, const T& y) {
-  return x.a != y.a || x.b != y.b;
-}
-
-struct E {
-    std::string message;
-    int cause;
-    E(const std::string& message, int cause) : message(message), cause(cause) {}
-};
-
-typedef expected<T,E> exp_complex;
-
-TEST(Expected, testDefaultConstructible) {
-  exp_int e;
-  EXPECT_TRUE(e.has_value());
-  EXPECT_EQ(0, e.value());
-
-  exp_complex e2;
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(T(0,0), e2.value());
-
-  exp_void e3;
-  EXPECT_TRUE(e3.has_value());
-}
-
-TEST(Expected, testCopyConstructible) {
-  exp_int e;
-  exp_int e2 = e;
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(0, e.value());
-  EXPECT_EQ(0, e2.value());
-
-  exp_void e3;
-  exp_void e4 = e3;
-  EXPECT_TRUE(e3.has_value());
-  EXPECT_TRUE(e4.has_value());
-}
-
-TEST(Expected, testMoveConstructible) {
-  exp_int e;
-  exp_int e2 = std::move(e);
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(0, e.value());
-  EXPECT_EQ(0, e2.value());
-
-  exp_string e3(std::string("hello"));
-  exp_string e4 = std::move(e3);
-
-  EXPECT_TRUE(e3.has_value());
-  EXPECT_TRUE(e4.has_value());
-  EXPECT_EQ("", e3.value()); // e3 is moved
-  EXPECT_EQ("hello", e4.value());
-
-  exp_void e5;
-  exp_void e6 = std::move(e5);
-  EXPECT_TRUE(e5.has_value());
-  EXPECT_TRUE(e6.has_value());
-}
-
-TEST(Expected, testCopyConstructibleFromConvertibleType) {
-  exp_double e = 3.3f;
-  exp_int e2 = e;
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(3.3f, e.value());
-  EXPECT_EQ(3, e2.value());
-}
-
-TEST(Expected, testMoveConstructibleFromConvertibleType) {
-  exp_double e = 3.3f;
-  exp_int e2 = std::move(e);
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(3.3f, e.value());
-  EXPECT_EQ(3, e2.value());
-}
-
-TEST(Expected, testConstructibleFromValue) {
-  exp_int e = 3;
-  exp_double e2 = 5.5f;
-  exp_string e3 = std::string("hello");
-  exp_complex e4 = T(10, 20);
-  exp_void e5 = {};
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_TRUE(e3.has_value());
-  EXPECT_TRUE(e4.has_value());
-  EXPECT_TRUE(e5.has_value());
-  EXPECT_EQ(3, e.value());
-  EXPECT_EQ(5.5f, e2.value());
-  EXPECT_EQ("hello", e3.value());
-  EXPECT_EQ(T(10,20), e4.value());
-}
-
-TEST(Expected, testConstructibleFromMovedValue) {
-  std::string hello = "hello";
-  exp_string e = std::move(hello);
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_EQ("hello", e.value());
-  EXPECT_EQ("", hello);
-}
-
-TEST(Expected, testConstructibleFromConvertibleValue) {
-  exp_int e = 3.3f; // double to int
-  exp_string e2 = "hello"; // char* to std::string
-  EXPECT_TRUE(e.has_value());
-  EXPECT_EQ(3, e.value());
-
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ("hello", e2.value());
-}
-
-TEST(Expected, testConstructibleFromUnexpected) {
-  exp_int::unexpected_type unexp = unexpected(10);
-  exp_int e = unexp;
-
-  exp_double::unexpected_type unexp2 = unexpected(10.5f);
-  exp_double e2 = unexp2;
-
-  exp_string::unexpected_type unexp3 = unexpected(std::string("error"));
-  exp_string e3 = unexp3;
-
-  exp_void::unexpected_type unexp4 = unexpected(10);
-  exp_void e4 = unexp4;
-
-  EXPECT_FALSE(e.has_value());
-  EXPECT_FALSE(e2.has_value());
-  EXPECT_FALSE(e3.has_value());
-  EXPECT_FALSE(e4.has_value());
-  EXPECT_EQ(10, e.error());
-  EXPECT_EQ(10.5f, e2.error());
-  EXPECT_EQ("error", e3.error());
-  EXPECT_EQ(10, e4.error());
-}
-
-TEST(Expected, testMoveConstructibleFromUnexpected) {
-  exp_int e = unexpected(10);
-  exp_double e2 = unexpected(10.5f);
-  exp_string e3 = unexpected(std::string("error"));
-  exp_void e4 = unexpected(10);
-
-  EXPECT_FALSE(e.has_value());
-  EXPECT_FALSE(e2.has_value());
-  EXPECT_FALSE(e3.has_value());
-  EXPECT_FALSE(e4.has_value());
-  EXPECT_EQ(10, e.error());
-  EXPECT_EQ(10.5f, e2.error());
-  EXPECT_EQ("error", e3.error());
-  EXPECT_EQ(10, e4.error());
-}
-
-TEST(Expected, testConstructibleByForwarding) {
-  exp_string e(std::in_place, 5, 'a');
-  EXPECT_TRUE(e.has_value());
-  EXPECT_EQ("aaaaa", e.value());
-
-  exp_string e2({'a', 'b', 'c'});
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ("abc", e2.value());
-
-  exp_pair e3({"hello", 30});
-  EXPECT_TRUE(e3.has_value());
-  EXPECT_EQ("hello",e3->first);
-  EXPECT_EQ(30,e3->second);
-
-  exp_void e4({});
-  EXPECT_TRUE(e4.has_value());
-}
-
-TEST(Expected, testDestructible) {
-  bool destroyed = false;
-  struct T {
-    bool* flag_;
-    T(bool* flag) : flag_(flag) {}
-    ~T() { *flag_ = true; }
-  };
-  {
-    expected<T, int> exp = T(&destroyed);
-  }
-  EXPECT_TRUE(destroyed);
-}
-
-TEST(Expected, testAssignable) {
-  exp_int e = 10;
-  exp_int e2 = 20;
-  e = e2;
-
-  EXPECT_EQ(20, e.value());
-  EXPECT_EQ(20, e2.value());
-
-  exp_int e3 = 10;
-  exp_int e4 = 20;
-  e3 = std::move(e4);
-
-  EXPECT_EQ(20, e3.value());
-  EXPECT_EQ(20, e4.value());
-
-  exp_void e5 = unexpected(10);
-  ASSERT_FALSE(e5.has_value());
-  exp_void e6;
-  e5 = e6;
-
-  EXPECT_TRUE(e5.has_value());
-  EXPECT_TRUE(e6.has_value());
-}
-
-TEST(Expected, testAssignableFromValue) {
-  exp_int e = 10;
-  e = 20;
-  EXPECT_EQ(20, e.value());
-
-  exp_double e2 = 3.5f;
-  e2 = 10.5f;
-  EXPECT_EQ(10.5f, e2.value());
-
-  exp_string e3 = "hello";
-  e3 = "world";
-  EXPECT_EQ("world", e3.value());
-
-  exp_void e4 = unexpected(10);
-  ASSERT_FALSE(e4.has_value());
-  e4 = {};
-  EXPECT_TRUE(e4.has_value());
-}
-
-TEST(Expected, testAssignableFromUnexpected) {
-  exp_int e = 10;
-  e = unexpected(30);
-  EXPECT_FALSE(e.has_value());
-  EXPECT_EQ(30, e.error());
-
-  exp_double e2 = 3.5f;
-  e2 = unexpected(10.5f);
-  EXPECT_FALSE(e2.has_value());
-  EXPECT_EQ(10.5f, e2.error());
-
-  exp_string e3 = "hello";
-  e3 = unexpected("world");
-  EXPECT_FALSE(e3.has_value());
-  EXPECT_EQ("world", e3.error());
-
-  exp_void e4 = {};
-  e4 = unexpected(10);
-  EXPECT_FALSE(e4.has_value());
-  EXPECT_EQ(10, e4.error());
-}
-
-TEST(Expected, testAssignableFromMovedValue) {
-  std::string world = "world";
-  exp_string e = "hello";
-  e = std::move(world);
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_EQ("world", e.value());
-  EXPECT_EQ("", world);
-}
-
-TEST(Expected, testAssignableFromMovedUnexpected) {
-  std::string world = "world";
-  exp_string e = "hello";
-  e = unexpected(std::move(world));
-
-  EXPECT_FALSE(e.has_value());
-  EXPECT_EQ("world", e.error());
-  EXPECT_EQ("", world);
-}
-
-TEST(Expected, testEmplace) {
-  struct T {
-    int a;
-    double b;
-    T() {}
-    T(int a, double b) noexcept : a(a), b(b) {}
-  };
-  expected<T, int> exp;
-  T& t = exp.emplace(3, 10.5f);
-
-  EXPECT_TRUE(exp.has_value());
-  EXPECT_EQ(3, t.a);
-  EXPECT_EQ(10.5f, t.b);
-  EXPECT_EQ(3, exp.value().a);
-  EXPECT_EQ(10.5, exp.value().b);
-
-  exp_void e = unexpected(10);
-  ASSERT_FALSE(e.has_value());
-  e.emplace();
-  EXPECT_TRUE(e.has_value());
-}
-
-TEST(Expected, testSwapExpectedExpected) {
-  exp_int e = 10;
-  exp_int e2 = 20;
-  e.swap(e2);
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(20, e.value());
-  EXPECT_EQ(10, e2.value());
-
-  exp_void e3;
-  exp_void e4;
-  e3.swap(e4);
-
-  EXPECT_TRUE(e3.has_value());
-  EXPECT_TRUE(e4.has_value());
-}
-
-TEST(Expected, testSwapUnexpectedUnexpected) {
-  exp_int e = unexpected(10);
-  exp_int e2 = unexpected(20);
-  e.swap(e2);
-  EXPECT_FALSE(e.has_value());
-  EXPECT_FALSE(e2.has_value());
-  EXPECT_EQ(20, e.error());
-  EXPECT_EQ(10, e2.error());
-
-  exp_void e3 = unexpected(10);
-  exp_void e4 = unexpected(20);
-  e3.swap(e4);
-  EXPECT_FALSE(e3.has_value());
-  EXPECT_FALSE(e4.has_value());
-  EXPECT_EQ(20, e3.error());
-  EXPECT_EQ(10, e4.error());
-}
-
-TEST(Expected, testSwapExpectedUnepected) {
-  exp_int e = 10;
-  exp_int e2 = unexpected(30);
-  e.swap(e2);
-  EXPECT_FALSE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(30, e.error());
-  EXPECT_EQ(10, e2.value());
-
-  exp_void e3;
-  exp_void e4 = unexpected(10);
-  e3.swap(e4);
-  EXPECT_FALSE(e3.has_value());
-  EXPECT_TRUE(e4.has_value());
-  EXPECT_EQ(10, e3.error());
-}
-
-TEST(Expected, testDereference) {
-  struct T {
-    int a;
-    double b;
-    T() {}
-    T(int a, double b) : a(a), b(b) {}
-  };
-  expected<T, int> exp = T(3, 10.5f);
-
-  EXPECT_EQ(3, exp->a);
-  EXPECT_EQ(10.5f, exp->b);
-
-  EXPECT_EQ(3, (*exp).a);
-  EXPECT_EQ(10.5f, (*exp).b);
-}
-
-TEST(Expected, testTest) {
-  exp_int e = 10;
-  EXPECT_TRUE(e.ok());
-  EXPECT_TRUE(e.has_value());
-
-  exp_int e2 = unexpected(10);
-  EXPECT_FALSE(e2.ok());
-  EXPECT_FALSE(e2.has_value());
-}
-
-TEST(Expected, testGetValue) {
-  exp_int e = 10;
-  EXPECT_EQ(10, e.value());
-  EXPECT_EQ(10, e.value_or(20));
-
-  exp_int e2 = unexpected(10);
-  EXPECT_EQ(10, e2.error());
-  EXPECT_EQ(20, e2.value_or(20));
-}
-
-TEST(Expected, testSameValues) {
-  exp_int e = 10;
-  exp_int e2 = 10;
-  EXPECT_TRUE(e == e2);
-  EXPECT_TRUE(e2 == e);
-  EXPECT_FALSE(e != e2);
-  EXPECT_FALSE(e2 != e);
-
-  exp_void e3;
-  exp_void e4;
-  EXPECT_TRUE(e3 == e4);
-  EXPECT_TRUE(e4 == e3);
-  EXPECT_FALSE(e3 != e4);
-  EXPECT_FALSE(e4 != e3);
-}
-
-TEST(Expected, testDifferentValues) {
-  exp_int e = 10;
-  exp_int e2 = 20;
-  EXPECT_FALSE(e == e2);
-  EXPECT_FALSE(e2 == e);
-  EXPECT_TRUE(e != e2);
-  EXPECT_TRUE(e2 != e);
-}
-
-TEST(Expected, testValueWithError) {
-  exp_int e = 10;
-  exp_int e2 = unexpected(10);
-  EXPECT_FALSE(e == e2);
-  EXPECT_FALSE(e2 == e);
-  EXPECT_TRUE(e != e2);
-  EXPECT_TRUE(e2 != e);
-
-  exp_void e3;
-  exp_void e4 = unexpected(10);
-  EXPECT_FALSE(e3 == e4);
-  EXPECT_FALSE(e4 == e3);
-  EXPECT_TRUE(e3 != e4);
-  EXPECT_TRUE(e4 != e3);
-}
-
-TEST(Expected, testSameErrors) {
-  exp_int e = unexpected(10);
-  exp_int e2 = unexpected(10);
-  EXPECT_TRUE(e == e2);
-  EXPECT_TRUE(e2 == e);
-  EXPECT_FALSE(e != e2);
-  EXPECT_FALSE(e2 != e);
-
-  exp_void e3 = unexpected(10);
-  exp_void e4 = unexpected(10);
-  EXPECT_TRUE(e3 == e4);
-  EXPECT_TRUE(e4 == e3);
-  EXPECT_FALSE(e3 != e4);
-  EXPECT_FALSE(e4 != e3);
-}
-
-TEST(Expected, testDifferentErrors) {
-  exp_int e = unexpected(10);
-  exp_int e2 = unexpected(20);
-  EXPECT_FALSE(e == e2);
-  EXPECT_FALSE(e2 == e);
-  EXPECT_TRUE(e != e2);
-  EXPECT_TRUE(e2 != e);
-
-  exp_void e3 = unexpected(10);
-  exp_void e4 = unexpected(20);
-  EXPECT_FALSE(e3 == e4);
-  EXPECT_FALSE(e4 == e3);
-  EXPECT_TRUE(e3 != e4);
-  EXPECT_TRUE(e4 != e3);
-}
-
-TEST(Expected, testCompareWithSameError) {
-  exp_int e = unexpected(10);
-  exp_int::unexpected_type error = 10;
-  EXPECT_TRUE(e == error);
-  EXPECT_TRUE(error == e);
-  EXPECT_FALSE(e != error);
-  EXPECT_FALSE(error != e);
-
-  exp_void e2 = unexpected(10);
-  exp_void::unexpected_type error2 = 10;
-  EXPECT_TRUE(e2 == error2);
-  EXPECT_TRUE(error2 == e2);
-  EXPECT_FALSE(e2 != error2);
-  EXPECT_FALSE(error2 != e2);
-}
-
-TEST(Expected, testCompareWithDifferentError) {
-  exp_int e = unexpected(10);
-  exp_int::unexpected_type error = 20;
-  EXPECT_FALSE(e == error);
-  EXPECT_FALSE(error == e);
-  EXPECT_TRUE(e != error);
-  EXPECT_TRUE(error != e);
-
-  exp_void e2 = unexpected(10);
-  exp_void::unexpected_type error2 = 20;
-  EXPECT_FALSE(e2 == error2);
-  EXPECT_FALSE(error2 == e2);
-  EXPECT_TRUE(e2 != error2);
-  EXPECT_TRUE(error2 != e2);
-}
-
-TEST(Expected, testCompareDifferentType) {
-  expected<int,int> e = 10;
-  expected<int32_t, int> e2 = 10;
-  EXPECT_TRUE(e == e2);
-  e2 = 20;
-  EXPECT_FALSE(e == e2);
-
-  expected<std::string_view,int> e3 = "hello";
-  expected<std::string,int> e4 = "hello";
-  EXPECT_TRUE(e3 == e4);
-  e4 = "world";
-  EXPECT_FALSE(e3 == e4);
-
-  expected<void,int> e5;
-  expected<int,int> e6 = 10;
-  EXPECT_FALSE(e5 == e6);
-  EXPECT_FALSE(e6 == e5);
-}
-
-TEST(Expected, testDivideExample) {
-  struct QR {
-    int quotient;
-    int remainder;
-    QR(int q, int r) noexcept : quotient(q), remainder(r) {}
-    bool operator==(const QR& rhs) const {
-      return quotient == rhs.quotient && remainder == rhs.remainder;
-    }
-    bool operator!=(const QR& rhs) const {
-      return quotient != rhs.quotient || remainder == rhs.remainder;
-    }
-  };
-
-  auto divide = [](int x, int y) -> expected<QR,E> {
-    if (y == 0) {
-      return unexpected(E("divide by zero", -1));
-    } else {
-      return QR(x / y, x % y);
-    }
-  };
-
-  EXPECT_FALSE(divide(10, 0).ok());
-  EXPECT_EQ("divide by zero", divide(10, 0).error().message);
-  EXPECT_EQ(-1, divide(10, 0).error().cause);
-
-  EXPECT_TRUE(divide(10, 3).ok());
-  EXPECT_EQ(QR(3, 1), *divide(10, 3));
-}
-
-TEST(Expected, testPair) {
-  auto test = [](bool yes) -> exp_pair {
-    if (yes) {
-      return exp_pair({"yes", 42});
-    } else {
-      return unexpected(42);
-    }
-  };
-
-  auto r = test(true);
-  EXPECT_TRUE(r.ok());
-  EXPECT_EQ("yes", r->first);
-}
-
-TEST(Expected, testVoid) {
-  auto test = [](bool ok) -> exp_void {
-    if (ok) {
-      return {};
-    } else {
-      return unexpected(10);
-    }
-  };
-
-  auto r = test(true);
-  EXPECT_TRUE(r.ok());
-  r = test(false);
-  EXPECT_FALSE(r.ok());
-  EXPECT_EQ(10, r.error());
-}
-
-// copied from result_test.cpp
-struct ConstructorTracker {
-  static size_t constructor_called;
-  static size_t copy_constructor_called;
-  static size_t move_constructor_called;
-  static size_t copy_assignment_called;
-  static size_t move_assignment_called;
-
-  template <typename T,
-    typename std::enable_if_t<std::is_convertible_v<T, std::string>>* = nullptr>
-  ConstructorTracker(T&& string) : string(string) {
-    ++constructor_called;
-  }
-  ConstructorTracker(const ConstructorTracker& ct) {
-    ++copy_constructor_called;
-    string = ct.string;
-  }
-  ConstructorTracker(ConstructorTracker&& ct) noexcept {
-    ++move_constructor_called;
-    string = std::move(ct.string);
-  }
-  ConstructorTracker& operator=(const ConstructorTracker& ct) {
-    ++copy_assignment_called;
-    string = ct.string;
-    return *this;
-  }
-  ConstructorTracker& operator=(ConstructorTracker&& ct) noexcept {
-    ++move_assignment_called;
-    string = std::move(ct.string);
-    return *this;
-  }
-  static void Reset() {
-    constructor_called = 0;
-    copy_constructor_called = 0;
-    move_constructor_called = 0;
-    copy_assignment_called = 0;
-    move_assignment_called = 0;
-  }
-  std::string string;
-};
-
-size_t ConstructorTracker::constructor_called = 0;
-size_t ConstructorTracker::copy_constructor_called = 0;
-size_t ConstructorTracker::move_constructor_called = 0;
-size_t ConstructorTracker::copy_assignment_called = 0;
-size_t ConstructorTracker::move_assignment_called = 0;
-
-typedef expected<ConstructorTracker, int> exp_track;
-
-TEST(Expected, testNumberOfCopies) {
-  // default constructor
-  ConstructorTracker::Reset();
-  exp_track e("hello");
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  // copy constructor
-  ConstructorTracker::Reset();
-  exp_track e2 = e;
-  EXPECT_EQ(0U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  // move constructor
-  ConstructorTracker::Reset();
-  exp_track e3 = std::move(e);
-  EXPECT_EQ(0U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  // construct from lvalue
-  ConstructorTracker::Reset();
-  ConstructorTracker ct = "hello";
-  exp_track e4(ct);
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  // construct from rvalue
-  ConstructorTracker::Reset();
-  ConstructorTracker ct2 = "hello";
-  exp_track e5(std::move(ct2));
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  // copy assignment
-  ConstructorTracker::Reset();
-  exp_track e6 = "hello";
-  exp_track e7 = "world";
-  e7 = e6;
-  EXPECT_EQ(2U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  // move assignment
-  ConstructorTracker::Reset();
-  exp_track e8 = "hello";
-  exp_track e9 = "world";
-  e9 = std::move(e8);
-  EXPECT_EQ(2U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_assignment_called);
-
-  // swap
-  ConstructorTracker::Reset();
-  exp_track e10 = "hello";
-  exp_track e11 = "world";
-  std::swap(e10, e11);
-  EXPECT_EQ(2U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(2U, ConstructorTracker::move_assignment_called);
-}
-
-TEST(Expected, testNoCopyOnReturn) {
-  auto test = [](const std::string& in) -> exp_track {
-    if (in.empty()) {
-      return "literal string";
-    }
-    if (in == "test2") {
-      return ConstructorTracker(in + in + "2");
-    }
-    ConstructorTracker result(in + " " + in);
-    return result;
-  };
-
-  ConstructorTracker::Reset();
-  auto result1 = test("");
-  ASSERT_TRUE(result1.ok());
-  EXPECT_EQ("literal string", result1->string);
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  ConstructorTracker::Reset();
-  auto result2 = test("test2");
-  ASSERT_TRUE(result2.ok());
-  EXPECT_EQ("test2test22", result2->string);
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  ConstructorTracker::Reset();
-  auto result3 = test("test3");
-  ASSERT_TRUE(result3.ok());
-  EXPECT_EQ("test3 test3", result3->string);
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-}
-
-TEST(Expected, testNested) {
-  expected<exp_string, std::string> e = "hello";
-
-  EXPECT_TRUE(e.ok());
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e.value().has_value());
-  EXPECT_TRUE(e->ok());
-  EXPECT_EQ("hello", e.value().value());
-
-  expected<exp_string, std::string> e2 = unexpected("world");
-  EXPECT_FALSE(e2.has_value());
-  EXPECT_FALSE(e2.ok());
-  EXPECT_EQ("world", e2.error());
-
-  expected<exp_string, std::string> e3 = exp_string(unexpected("world"));
-  EXPECT_TRUE(e3.has_value());
-  EXPECT_FALSE(e3.value().has_value());
-  EXPECT_TRUE(e3.ok());
-  EXPECT_FALSE(e3->ok());
-  EXPECT_EQ("world", e3.value().error());
-}
-
-constexpr bool equals(const char* a, const char* b) {
-  return (a == nullptr && b == nullptr) ||
-      (a != nullptr && b != nullptr && *a == *b &&
-       (*a == '\0' || equals(a + 1, b + 1)));
-}
-
-TEST(Expected, testConstexpr) {
-  // Compliation error will occur if these expressions can't be
-  // evaluated at compile time
-  constexpr exp_int e(3);
-  constexpr exp_int::unexpected_type err(3);
-  constexpr int i = 4;
-
-  // default constructor
-  static_assert(exp_int().value() == 0);
-  // copy constructor
-  static_assert(exp_int(e).value() == 3);
-  // move constructor
-  static_assert(exp_int(exp_int(4)).value() == 4);
-  // copy construct from value
-  static_assert(exp_int(i).value() == 4);
-  // copy construct from unexpected
-  static_assert(exp_int(err).error() == 3);
-  // move costruct from unexpected
-  static_assert(exp_int(unexpected(3)).error() == 3);
-  // observers
-  static_assert(*exp_int(3) == 3);
-  static_assert(exp_int(3).has_value() == true);
-  static_assert(exp_int(3).value_or(4) == 3);
-
-  typedef expected<const char*, int> exp_s;
-  constexpr exp_s s("hello");
-  constexpr const char* c = "hello";
-  static_assert(equals(exp_s().value(), nullptr));
-  static_assert(equals(exp_s(s).value(), "hello"));
-  static_assert(equals(exp_s(exp_s("hello")).value(), "hello"));
-  static_assert(equals(exp_s("hello").value(), "hello"));
-  static_assert(equals(exp_s(c).value(), "hello"));
-}
-
-TEST(Expected, testWithNonConstructible) {
-   struct AssertNotConstructed {
-     AssertNotConstructed() = delete;
-   };
-
-   expected<int, AssertNotConstructed> v(42);
-   EXPECT_TRUE(v.has_value());
-   EXPECT_EQ(42, v.value());
-
-   expected<AssertNotConstructed, int> e(unexpected(42));
-   EXPECT_FALSE(e.has_value());
-   EXPECT_EQ(42, e.error());
-}
-
-TEST(Expected, testWithMoveOnlyType) {
-  typedef expected<std::unique_ptr<int>,std::unique_ptr<int>> exp_ptr;
-  exp_ptr e(std::make_unique<int>(3));
-  exp_ptr e2(unexpected(std::make_unique<int>(4)));
-
-  EXPECT_TRUE(e.has_value());
-  EXPECT_FALSE(e2.has_value());
-  EXPECT_EQ(3, *(e.value()));
-  EXPECT_EQ(4, *(e2.error()));
-
-  e2 = std::move(e);
-  EXPECT_TRUE(e.has_value());
-  EXPECT_TRUE(e2.has_value());
-  EXPECT_EQ(3, *(e2.value()));
-}
diff --git a/base/file.cpp b/base/file.cpp
deleted file mode 100644
index 97cc2b2..0000000
--- a/base/file.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "android-base/file.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <ftw.h>
-#include <libgen.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <vector>
-
-#if defined(__APPLE__)
-#include <mach-o/dyld.h>
-#endif
-#if defined(_WIN32)
-#include <direct.h>
-#include <windows.h>
-#define O_NOFOLLOW 0
-#define OS_PATH_SEPARATOR '\\'
-#else
-#define OS_PATH_SEPARATOR '/'
-#endif
-
-#include "android-base/logging.h"  // and must be after windows.h for ERROR
-#include "android-base/macros.h"   // For TEMP_FAILURE_RETRY on Darwin.
-#include "android-base/unique_fd.h"
-#include "android-base/utf8.h"
-
-namespace {
-
-#ifdef _WIN32
-static int mkstemp(char* name_template, size_t size_in_chars) {
-  std::wstring path;
-  CHECK(android::base::UTF8ToWide(name_template, &path))
-      << "path can't be converted to wchar: " << name_template;
-  if (_wmktemp_s(path.data(), path.size() + 1) != 0) {
-    return -1;
-  }
-
-  // Use open() to match the close() that TemporaryFile's destructor does.
-  // Use O_BINARY to match base file APIs.
-  int fd = _wopen(path.c_str(), O_CREAT | O_EXCL | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
-  if (fd < 0) {
-    return -1;
-  }
-
-  std::string path_utf8;
-  CHECK(android::base::WideToUTF8(path, &path_utf8)) << "path can't be converted to utf8";
-  CHECK(strcpy_s(name_template, size_in_chars, path_utf8.c_str()) == 0)
-      << "utf8 path can't be assigned back to name_template";
-
-  return fd;
-}
-
-static char* mkdtemp(char* name_template, size_t size_in_chars) {
-  std::wstring path;
-  CHECK(android::base::UTF8ToWide(name_template, &path))
-      << "path can't be converted to wchar: " << name_template;
-
-  if (_wmktemp_s(path.data(), path.size() + 1) != 0) {
-    return nullptr;
-  }
-
-  if (_wmkdir(path.c_str()) != 0) {
-    return nullptr;
-  }
-
-  std::string path_utf8;
-  CHECK(android::base::WideToUTF8(path, &path_utf8)) << "path can't be converted to utf8";
-  CHECK(strcpy_s(name_template, size_in_chars, path_utf8.c_str()) == 0)
-      << "utf8 path can't be assigned back to name_template";
-
-  return name_template;
-}
-#endif
-
-std::string GetSystemTempDir() {
-#if defined(__ANDROID__)
-  const auto* tmpdir = getenv("TMPDIR");
-  if (tmpdir == nullptr) tmpdir = "/data/local/tmp";
-  if (access(tmpdir, R_OK | W_OK | X_OK) == 0) {
-    return tmpdir;
-  }
-  // Tests running in app context can't access /data/local/tmp,
-  // so try current directory if /data/local/tmp is not accessible.
-  return ".";
-#elif defined(_WIN32)
-  wchar_t tmp_dir_w[MAX_PATH];
-  DWORD result = GetTempPathW(std::size(tmp_dir_w), tmp_dir_w);  // checks TMP env
-  CHECK_NE(result, 0ul) << "GetTempPathW failed, error: " << GetLastError();
-  CHECK_LT(result, std::size(tmp_dir_w)) << "path truncated to: " << result;
-
-  // GetTempPath() returns a path with a trailing slash, but init()
-  // does not expect that, so remove it.
-  if (tmp_dir_w[result - 1] == L'\\') {
-    tmp_dir_w[result - 1] = L'\0';
-  }
-
-  std::string tmp_dir;
-  CHECK(android::base::WideToUTF8(tmp_dir_w, &tmp_dir)) << "path can't be converted to utf8";
-
-  return tmp_dir;
-#else
-  const auto* tmpdir = getenv("TMPDIR");
-  if (tmpdir == nullptr) tmpdir = "/tmp";
-  return tmpdir;
-#endif
-}
-
-}  // namespace
-
-TemporaryFile::TemporaryFile() {
-  init(GetSystemTempDir());
-}
-
-TemporaryFile::TemporaryFile(const std::string& tmp_dir) {
-  init(tmp_dir);
-}
-
-TemporaryFile::~TemporaryFile() {
-  if (fd != -1) {
-    close(fd);
-  }
-  if (remove_file_) {
-    unlink(path);
-  }
-}
-
-int TemporaryFile::release() {
-  int result = fd;
-  fd = -1;
-  return result;
-}
-
-void TemporaryFile::init(const std::string& tmp_dir) {
-  snprintf(path, sizeof(path), "%s%cTemporaryFile-XXXXXX", tmp_dir.c_str(), OS_PATH_SEPARATOR);
-#if defined(_WIN32)
-  fd = mkstemp(path, sizeof(path));
-#else
-  fd = mkstemp(path);
-#endif
-}
-
-TemporaryDir::TemporaryDir() {
-  init(GetSystemTempDir());
-}
-
-TemporaryDir::~TemporaryDir() {
-  if (!remove_dir_and_contents_) return;
-
-  auto callback = [](const char* child, const struct stat*, int file_type, struct FTW*) -> int {
-    switch (file_type) {
-      case FTW_D:
-      case FTW_DP:
-      case FTW_DNR:
-        if (rmdir(child) == -1) {
-          PLOG(ERROR) << "rmdir " << child;
-        }
-        break;
-      case FTW_NS:
-      default:
-        if (rmdir(child) != -1) break;
-        // FALLTHRU (for gcc, lint, pcc, etc; and following for clang)
-        FALLTHROUGH_INTENDED;
-      case FTW_F:
-      case FTW_SL:
-      case FTW_SLN:
-        if (unlink(child) == -1) {
-          PLOG(ERROR) << "unlink " << child;
-        }
-        break;
-    }
-    return 0;
-  };
-
-  nftw(path, callback, 128, FTW_DEPTH | FTW_MOUNT | FTW_PHYS);
-}
-
-bool TemporaryDir::init(const std::string& tmp_dir) {
-  snprintf(path, sizeof(path), "%s%cTemporaryDir-XXXXXX", tmp_dir.c_str(), OS_PATH_SEPARATOR);
-#if defined(_WIN32)
-  return (mkdtemp(path, sizeof(path)) != nullptr);
-#else
-  return (mkdtemp(path) != nullptr);
-#endif
-}
-
-namespace android {
-namespace base {
-
-// Versions of standard library APIs that support UTF-8 strings.
-using namespace android::base::utf8;
-
-bool ReadFdToString(borrowed_fd fd, std::string* content) {
-  content->clear();
-
-  // Although original we had small files in mind, this code gets used for
-  // very large files too, where the std::string growth heuristics might not
-  // be suitable. https://code.google.com/p/android/issues/detail?id=258500.
-  struct stat sb;
-  if (fstat(fd.get(), &sb) != -1 && sb.st_size > 0) {
-    content->reserve(sb.st_size);
-  }
-
-  char buf[BUFSIZ] __attribute__((__uninitialized__));
-  ssize_t n;
-  while ((n = TEMP_FAILURE_RETRY(read(fd.get(), &buf[0], sizeof(buf)))) > 0) {
-    content->append(buf, n);
-  }
-  return (n == 0) ? true : false;
-}
-
-bool ReadFileToString(const std::string& path, std::string* content, bool follow_symlinks) {
-  content->clear();
-
-  int flags = O_RDONLY | O_CLOEXEC | O_BINARY | (follow_symlinks ? 0 : O_NOFOLLOW);
-  android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags)));
-  if (fd == -1) {
-    return false;
-  }
-  return ReadFdToString(fd, content);
-}
-
-bool WriteStringToFd(const std::string& content, borrowed_fd fd) {
-  const char* p = content.data();
-  size_t left = content.size();
-  while (left > 0) {
-    ssize_t n = TEMP_FAILURE_RETRY(write(fd.get(), p, left));
-    if (n == -1) {
-      return false;
-    }
-    p += n;
-    left -= n;
-  }
-  return true;
-}
-
-static bool CleanUpAfterFailedWrite(const std::string& path) {
-  // Something went wrong. Let's not leave a corrupt file lying around.
-  int saved_errno = errno;
-  unlink(path.c_str());
-  errno = saved_errno;
-  return false;
-}
-
-#if !defined(_WIN32)
-bool WriteStringToFile(const std::string& content, const std::string& path,
-                       mode_t mode, uid_t owner, gid_t group,
-                       bool follow_symlinks) {
-  int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_BINARY |
-              (follow_symlinks ? 0 : O_NOFOLLOW);
-  android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode)));
-  if (fd == -1) {
-    PLOG(ERROR) << "android::WriteStringToFile open failed";
-    return false;
-  }
-
-  // We do an explicit fchmod here because we assume that the caller really
-  // meant what they said and doesn't want the umask-influenced mode.
-  if (fchmod(fd, mode) == -1) {
-    PLOG(ERROR) << "android::WriteStringToFile fchmod failed";
-    return CleanUpAfterFailedWrite(path);
-  }
-  if (fchown(fd, owner, group) == -1) {
-    PLOG(ERROR) << "android::WriteStringToFile fchown failed";
-    return CleanUpAfterFailedWrite(path);
-  }
-  if (!WriteStringToFd(content, fd)) {
-    PLOG(ERROR) << "android::WriteStringToFile write failed";
-    return CleanUpAfterFailedWrite(path);
-  }
-  return true;
-}
-#endif
-
-bool WriteStringToFile(const std::string& content, const std::string& path,
-                       bool follow_symlinks) {
-  int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_BINARY |
-              (follow_symlinks ? 0 : O_NOFOLLOW);
-  android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags, 0666)));
-  if (fd == -1) {
-    return false;
-  }
-  return WriteStringToFd(content, fd) || CleanUpAfterFailedWrite(path);
-}
-
-bool ReadFully(borrowed_fd fd, void* data, size_t byte_count) {
-  uint8_t* p = reinterpret_cast<uint8_t*>(data);
-  size_t remaining = byte_count;
-  while (remaining > 0) {
-    ssize_t n = TEMP_FAILURE_RETRY(read(fd.get(), p, remaining));
-    if (n <= 0) return false;
-    p += n;
-    remaining -= n;
-  }
-  return true;
-}
-
-#if defined(_WIN32)
-// Windows implementation of pread. Note that this DOES move the file descriptors read position,
-// but it does so atomically.
-static ssize_t pread(borrowed_fd fd, void* data, size_t byte_count, off64_t offset) {
-  DWORD bytes_read;
-  OVERLAPPED overlapped;
-  memset(&overlapped, 0, sizeof(OVERLAPPED));
-  overlapped.Offset = static_cast<DWORD>(offset);
-  overlapped.OffsetHigh = static_cast<DWORD>(offset >> 32);
-  if (!ReadFile(reinterpret_cast<HANDLE>(_get_osfhandle(fd.get())), data,
-                static_cast<DWORD>(byte_count), &bytes_read, &overlapped)) {
-    // In case someone tries to read errno (since this is masquerading as a POSIX call)
-    errno = EIO;
-    return -1;
-  }
-  return static_cast<ssize_t>(bytes_read);
-}
-#endif
-
-bool ReadFullyAtOffset(borrowed_fd fd, void* data, size_t byte_count, off64_t offset) {
-  uint8_t* p = reinterpret_cast<uint8_t*>(data);
-  while (byte_count > 0) {
-    ssize_t n = TEMP_FAILURE_RETRY(pread(fd.get(), p, byte_count, offset));
-    if (n <= 0) return false;
-    p += n;
-    byte_count -= n;
-    offset += n;
-  }
-  return true;
-}
-
-bool WriteFully(borrowed_fd fd, const void* data, size_t byte_count) {
-  const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
-  size_t remaining = byte_count;
-  while (remaining > 0) {
-    ssize_t n = TEMP_FAILURE_RETRY(write(fd.get(), p, remaining));
-    if (n == -1) return false;
-    p += n;
-    remaining -= n;
-  }
-  return true;
-}
-
-bool RemoveFileIfExists(const std::string& path, std::string* err) {
-  struct stat st;
-#if defined(_WIN32)
-  // TODO: Windows version can't handle symbolic links correctly.
-  int result = stat(path.c_str(), &st);
-  bool file_type_removable = (result == 0 && S_ISREG(st.st_mode));
-#else
-  int result = lstat(path.c_str(), &st);
-  bool file_type_removable = (result == 0 && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)));
-#endif
-  if (result == -1) {
-    if (errno == ENOENT || errno == ENOTDIR) return true;
-    if (err != nullptr) *err = strerror(errno);
-    return false;
-  }
-
-  if (result == 0) {
-    if (!file_type_removable) {
-      if (err != nullptr) {
-        *err = "is not a regular file or symbolic link";
-      }
-      return false;
-    }
-    if (unlink(path.c_str()) == -1) {
-      if (err != nullptr) {
-        *err = strerror(errno);
-      }
-      return false;
-    }
-  }
-  return true;
-}
-
-#if !defined(_WIN32)
-bool Readlink(const std::string& path, std::string* result) {
-  result->clear();
-
-  // Most Linux file systems (ext2 and ext4, say) limit symbolic links to
-  // 4095 bytes. Since we'll copy out into the string anyway, it doesn't
-  // waste memory to just start there. We add 1 so that we can recognize
-  // whether it actually fit (rather than being truncated to 4095).
-  std::vector<char> buf(4095 + 1);
-  while (true) {
-    ssize_t size = readlink(path.c_str(), &buf[0], buf.size());
-    // Unrecoverable error?
-    if (size == -1) return false;
-    // It fit! (If size == buf.size(), it may have been truncated.)
-    if (static_cast<size_t>(size) < buf.size()) {
-      result->assign(&buf[0], size);
-      return true;
-    }
-    // Double our buffer and try again.
-    buf.resize(buf.size() * 2);
-  }
-}
-#endif
-
-#if !defined(_WIN32)
-bool Realpath(const std::string& path, std::string* result) {
-  result->clear();
-
-  // realpath may exit with EINTR. Retry if so.
-  char* realpath_buf = nullptr;
-  do {
-    realpath_buf = realpath(path.c_str(), nullptr);
-  } while (realpath_buf == nullptr && errno == EINTR);
-
-  if (realpath_buf == nullptr) {
-    return false;
-  }
-  result->assign(realpath_buf);
-  free(realpath_buf);
-  return true;
-}
-#endif
-
-std::string GetExecutablePath() {
-#if defined(__linux__)
-  std::string path;
-  android::base::Readlink("/proc/self/exe", &path);
-  return path;
-#elif defined(__APPLE__)
-  char path[PATH_MAX + 1];
-  uint32_t path_len = sizeof(path);
-  int rc = _NSGetExecutablePath(path, &path_len);
-  if (rc < 0) {
-    std::unique_ptr<char> path_buf(new char[path_len]);
-    _NSGetExecutablePath(path_buf.get(), &path_len);
-    return path_buf.get();
-  }
-  return path;
-#elif defined(_WIN32)
-  char path[PATH_MAX + 1];
-  DWORD result = GetModuleFileName(NULL, path, sizeof(path) - 1);
-  if (result == 0 || result == sizeof(path) - 1) return "";
-  path[PATH_MAX - 1] = 0;
-  return path;
-#else
-#error unknown OS
-#endif
-}
-
-std::string GetExecutableDirectory() {
-  return Dirname(GetExecutablePath());
-}
-
-std::string Basename(const std::string& path) {
-  // Copy path because basename may modify the string passed in.
-  std::string result(path);
-
-#if !defined(__BIONIC__)
-  // Use lock because basename() may write to a process global and return a
-  // pointer to that. Note that this locking strategy only works if all other
-  // callers to basename in the process also grab this same lock, but its
-  // better than nothing.  Bionic's basename returns a thread-local buffer.
-  static std::mutex& basename_lock = *new std::mutex();
-  std::lock_guard<std::mutex> lock(basename_lock);
-#endif
-
-  // Note that if std::string uses copy-on-write strings, &str[0] will cause
-  // the copy to be made, so there is no chance of us accidentally writing to
-  // the storage for 'path'.
-  char* name = basename(&result[0]);
-
-  // In case basename returned a pointer to a process global, copy that string
-  // before leaving the lock.
-  result.assign(name);
-
-  return result;
-}
-
-std::string Dirname(const std::string& path) {
-  // Copy path because dirname may modify the string passed in.
-  std::string result(path);
-
-#if !defined(__BIONIC__)
-  // Use lock because dirname() may write to a process global and return a
-  // pointer to that. Note that this locking strategy only works if all other
-  // callers to dirname in the process also grab this same lock, but its
-  // better than nothing.  Bionic's dirname returns a thread-local buffer.
-  static std::mutex& dirname_lock = *new std::mutex();
-  std::lock_guard<std::mutex> lock(dirname_lock);
-#endif
-
-  // Note that if std::string uses copy-on-write strings, &str[0] will cause
-  // the copy to be made, so there is no chance of us accidentally writing to
-  // the storage for 'path'.
-  char* parent = dirname(&result[0]);
-
-  // In case dirname returned a pointer to a process global, copy that string
-  // before leaving the lock.
-  result.assign(parent);
-
-  return result;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/file_test.cpp b/base/file_test.cpp
deleted file mode 100644
index 120228d..0000000
--- a/base/file_test.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include "android-base/file.h"
-
-#include "android-base/utf8.h"
-
-#include <gtest/gtest.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <wchar.h>
-
-#include <string>
-
-#if !defined(_WIN32)
-#include <pwd.h>
-#else
-#include <windows.h>
-#endif
-
-#include "android-base/logging.h"  // and must be after windows.h for ERROR
-
-TEST(file, ReadFileToString_ENOENT) {
-  std::string s("hello");
-  errno = 0;
-  ASSERT_FALSE(android::base::ReadFileToString("/proc/does-not-exist", &s));
-  EXPECT_EQ(ENOENT, errno);
-  EXPECT_EQ("", s);  // s was cleared.
-}
-
-TEST(file, ReadFileToString_WriteStringToFile) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-  ASSERT_TRUE(android::base::WriteStringToFile("abc", tf.path))
-    << strerror(errno);
-  std::string s;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s))
-    << strerror(errno);
-  EXPECT_EQ("abc", s);
-}
-
-// symlinks require elevated privileges on Windows.
-#if !defined(_WIN32)
-TEST(file, ReadFileToString_WriteStringToFile_symlink) {
-  TemporaryFile target, link;
-  ASSERT_EQ(0, unlink(link.path));
-  ASSERT_EQ(0, symlink(target.path, link.path));
-  ASSERT_FALSE(android::base::WriteStringToFile("foo", link.path, false));
-  ASSERT_EQ(ELOOP, errno);
-  ASSERT_TRUE(android::base::WriteStringToFile("foo", link.path, true));
-
-  std::string s;
-  ASSERT_FALSE(android::base::ReadFileToString(link.path, &s));
-  ASSERT_EQ(ELOOP, errno);
-  ASSERT_TRUE(android::base::ReadFileToString(link.path, &s, true));
-  ASSERT_EQ("foo", s);
-}
-#endif
-
-// WriteStringToFile2 is explicitly for setting Unix permissions, which make no
-// sense on Windows.
-#if !defined(_WIN32)
-TEST(file, WriteStringToFile2) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-  ASSERT_TRUE(android::base::WriteStringToFile("abc", tf.path, 0660,
-                                               getuid(), getgid()))
-      << strerror(errno);
-  struct stat sb;
-  ASSERT_EQ(0, stat(tf.path, &sb));
-  ASSERT_EQ(0660U, static_cast<unsigned int>(sb.st_mode & ~S_IFMT));
-  ASSERT_EQ(getuid(), sb.st_uid);
-  ASSERT_EQ(getgid(), sb.st_gid);
-  std::string s;
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s))
-    << strerror(errno);
-  EXPECT_EQ("abc", s);
-}
-#endif
-
-#if defined(_WIN32)
-TEST(file, NonUnicodeCharsWindows) {
-  constexpr auto kMaxEnvVariableValueSize = 32767;
-  std::wstring old_tmp;
-  old_tmp.resize(kMaxEnvVariableValueSize);
-  old_tmp.resize(GetEnvironmentVariableW(L"TMP", old_tmp.data(), old_tmp.size()));
-  if (old_tmp.empty()) {
-    // Can't continue with empty TMP folder.
-    return;
-  }
-
-  std::wstring new_tmp = old_tmp;
-  if (new_tmp.back() != L'\\') {
-    new_tmp.push_back(L'\\');
-  }
-
-  {
-    auto path(new_tmp + L"锦绣成都\\");
-    _wmkdir(path.c_str());
-    ASSERT_TRUE(SetEnvironmentVariableW(L"TMP", path.c_str()));
-
-    TemporaryFile tf;
-    ASSERT_NE(tf.fd, -1) << tf.path;
-    ASSERT_TRUE(android::base::WriteStringToFd("abc", tf.fd));
-
-    ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)) << strerror(errno);
-
-    std::string s;
-    ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)) << strerror(errno);
-    EXPECT_EQ("abc", s);
-  }
-  {
-    auto path(new_tmp + L"директория с длинным именем\\");
-    _wmkdir(path.c_str());
-    ASSERT_TRUE(SetEnvironmentVariableW(L"TMP", path.c_str()));
-
-    TemporaryFile tf;
-    ASSERT_NE(tf.fd, -1) << tf.path;
-    ASSERT_TRUE(android::base::WriteStringToFd("abc", tf.fd));
-
-    ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)) << strerror(errno);
-
-    std::string s;
-    ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)) << strerror(errno);
-    EXPECT_EQ("abc", s);
-  }
-  {
-    auto path(new_tmp + L"äüöß weiß\\");
-    _wmkdir(path.c_str());
-    ASSERT_TRUE(SetEnvironmentVariableW(L"TMP", path.c_str()));
-
-    TemporaryFile tf;
-    ASSERT_NE(tf.fd, -1) << tf.path;
-    ASSERT_TRUE(android::base::WriteStringToFd("abc", tf.fd));
-
-    ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)) << strerror(errno);
-
-    std::string s;
-    ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)) << strerror(errno);
-    EXPECT_EQ("abc", s);
-  }
-
-  SetEnvironmentVariableW(L"TMP", old_tmp.c_str());
-}
-
-TEST(file, RootDirectoryWindows) {
-  constexpr auto kMaxEnvVariableValueSize = 32767;
-  std::wstring old_tmp;
-  bool tmp_is_empty = false;
-  old_tmp.resize(kMaxEnvVariableValueSize);
-  old_tmp.resize(GetEnvironmentVariableW(L"TMP", old_tmp.data(), old_tmp.size()));
-  if (old_tmp.empty()) {
-    tmp_is_empty = (GetLastError() == ERROR_ENVVAR_NOT_FOUND);
-  }
-  SetEnvironmentVariableW(L"TMP", L"C:");
-
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-
-  SetEnvironmentVariableW(L"TMP", tmp_is_empty ? nullptr : old_tmp.c_str());
-}
-#endif
-
-TEST(file, WriteStringToFd) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-  ASSERT_TRUE(android::base::WriteStringToFd("abc", tf.fd));
-
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)) << strerror(errno);
-
-  std::string s;
-  ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)) << strerror(errno);
-  EXPECT_EQ("abc", s);
-}
-
-TEST(file, WriteFully) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-  ASSERT_TRUE(android::base::WriteFully(tf.fd, "abc", 3));
-
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)) << strerror(errno);
-
-  std::string s;
-  s.resize(3);
-  ASSERT_TRUE(android::base::ReadFully(tf.fd, &s[0], s.size()))
-    << strerror(errno);
-  EXPECT_EQ("abc", s);
-
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)) << strerror(errno);
-
-  s.resize(1024);
-  ASSERT_FALSE(android::base::ReadFully(tf.fd, &s[0], s.size()));
-}
-
-TEST(file, RemoveFileIfExists) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-  close(tf.fd);
-  tf.fd = -1;
-  std::string err;
-  ASSERT_TRUE(android::base::RemoveFileIfExists(tf.path, &err)) << err;
-  ASSERT_TRUE(android::base::RemoveFileIfExists(tf.path));
-  TemporaryDir td;
-  ASSERT_FALSE(android::base::RemoveFileIfExists(td.path));
-  ASSERT_FALSE(android::base::RemoveFileIfExists(td.path, &err));
-  ASSERT_EQ("is not a regular file or symbolic link", err);
-}
-
-TEST(file, RemoveFileIfExists_ENOTDIR) {
-  TemporaryFile tf;
-  close(tf.fd);
-  tf.fd = -1;
-  std::string err{"xxx"};
-  ASSERT_TRUE(android::base::RemoveFileIfExists(std::string{tf.path} + "/abc", &err));
-  ASSERT_EQ("xxx", err);
-}
-
-#if !defined(_WIN32)
-TEST(file, RemoveFileIfExists_EACCES) {
-  // EACCES -- one of the directories in the path has no search permission
-  // root can bypass permission restrictions, so drop root.
-  if (getuid() == 0) {
-    passwd* shell = getpwnam("shell");
-    setgid(shell->pw_gid);
-    setuid(shell->pw_uid);
-  }
-
-  TemporaryDir td;
-  TemporaryFile tf(td.path);
-  close(tf.fd);
-  tf.fd = -1;
-  std::string err{"xxx"};
-  // Remove dir's search permission.
-  ASSERT_TRUE(chmod(td.path, S_IRUSR | S_IWUSR) == 0);
-  ASSERT_FALSE(android::base::RemoveFileIfExists(tf.path, &err));
-  ASSERT_EQ("Permission denied", err);
-  // Set dir's search permission again.
-  ASSERT_TRUE(chmod(td.path, S_IRWXU) == 0);
-  ASSERT_TRUE(android::base::RemoveFileIfExists(tf.path, &err));
-}
-#endif
-
-TEST(file, Readlink) {
-#if !defined(_WIN32)
-  // Linux doesn't allow empty symbolic links.
-  std::string min("x");
-  // ext2 and ext4 both have PAGE_SIZE limits.
-  // If file encryption is enabled, there's extra overhead to store the
-  // size of the encrypted symlink target. There's also an off-by-one
-  // in current kernels (and marlin/sailfish where we're seeing this
-  // failure are still on 3.18, far from current). http://b/33306057.
-  std::string max(static_cast<size_t>(4096 - 2 - 1 - 1), 'x');
-
-  TemporaryDir td;
-  std::string min_path{std::string(td.path) + "/" + "min"};
-  std::string max_path{std::string(td.path) + "/" + "max"};
-
-  ASSERT_EQ(0, symlink(min.c_str(), min_path.c_str()));
-  ASSERT_EQ(0, symlink(max.c_str(), max_path.c_str()));
-
-  std::string result;
-
-  result = "wrong";
-  ASSERT_TRUE(android::base::Readlink(min_path, &result));
-  ASSERT_EQ(min, result);
-
-  result = "wrong";
-  ASSERT_TRUE(android::base::Readlink(max_path, &result));
-  ASSERT_EQ(max, result);
-#endif
-}
-
-TEST(file, Realpath) {
-#if !defined(_WIN32)
-  TemporaryDir td;
-  std::string basename = android::base::Basename(td.path);
-  std::string dir_name = android::base::Dirname(td.path);
-  std::string base_dir_name = android::base::Basename(dir_name);
-
-  {
-    std::string path = dir_name + "/../" + base_dir_name + "/" + basename;
-    std::string result;
-    ASSERT_TRUE(android::base::Realpath(path, &result));
-    ASSERT_EQ(td.path, result);
-  }
-
-  {
-    std::string path = std::string(td.path) + "/..";
-    std::string result;
-    ASSERT_TRUE(android::base::Realpath(path, &result));
-    ASSERT_EQ(dir_name, result);
-  }
-
-  {
-    errno = 0;
-    std::string path = std::string(td.path) + "/foo.noent";
-    std::string result = "wrong";
-    ASSERT_TRUE(!android::base::Realpath(path, &result));
-    ASSERT_TRUE(result.empty());
-    ASSERT_EQ(ENOENT, errno);
-  }
-#endif
-}
-
-TEST(file, GetExecutableDirectory) {
-  std::string path = android::base::GetExecutableDirectory();
-  ASSERT_NE("", path);
-  ASSERT_NE(android::base::GetExecutablePath(), path);
-  ASSERT_EQ('/', path[0]);
-  ASSERT_NE('/', path[path.size() - 1]);
-}
-
-TEST(file, GetExecutablePath) {
-  ASSERT_NE("", android::base::GetExecutablePath());
-}
-
-TEST(file, Basename) {
-  EXPECT_EQ("sh", android::base::Basename("/system/bin/sh"));
-  EXPECT_EQ("sh", android::base::Basename("sh"));
-  EXPECT_EQ("sh", android::base::Basename("/system/bin/sh/"));
-}
-
-TEST(file, Dirname) {
-  EXPECT_EQ("/system/bin", android::base::Dirname("/system/bin/sh"));
-  EXPECT_EQ(".", android::base::Dirname("sh"));
-  EXPECT_EQ("/system/bin", android::base::Dirname("/system/bin/sh/"));
-}
-
-TEST(file, ReadFileToString_capacity) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-
-  // For a huge file, the overhead should still be small.
-  std::string s;
-  size_t size = 16 * 1024 * 1024;
-  ASSERT_TRUE(android::base::WriteStringToFile(std::string(size, 'x'), tf.path));
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s));
-  EXPECT_EQ(size, s.size());
-  EXPECT_LT(s.capacity(), size + 16);
-
-  // Even for weird badly-aligned sizes.
-  size += 12345;
-  ASSERT_TRUE(android::base::WriteStringToFile(std::string(size, 'x'), tf.path));
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s));
-  EXPECT_EQ(size, s.size());
-  EXPECT_LT(s.capacity(), size + 16);
-
-  // We'll shrink an enormous string if you read a small file into it.
-  size = 64;
-  ASSERT_TRUE(android::base::WriteStringToFile(std::string(size, 'x'), tf.path));
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s));
-  EXPECT_EQ(size, s.size());
-  EXPECT_LT(s.capacity(), size + 16);
-}
-
-TEST(file, ReadFileToString_capacity_0) {
-  TemporaryFile tf;
-  ASSERT_NE(tf.fd, -1) << tf.path;
-
-  // Because /proc reports its files as zero-length, we don't actually trust
-  // any file that claims to be zero-length. Rather than add increasingly
-  // complex heuristics for shrinking the passed-in string in that case, we
-  // currently leave it alone.
-  std::string s;
-  size_t initial_capacity = s.capacity();
-  ASSERT_TRUE(android::base::WriteStringToFile("", tf.path));
-  ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s));
-  EXPECT_EQ(0U, s.size());
-  EXPECT_EQ(initial_capacity, s.capacity());
-}
diff --git a/base/format_benchmark.cpp b/base/format_benchmark.cpp
deleted file mode 100644
index 9590b23..0000000
--- a/base/format_benchmark.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/format.h"
-
-#include <limits>
-
-#include <benchmark/benchmark.h>
-
-#include "android-base/stringprintf.h"
-
-using android::base::StringPrintf;
-
-static void BenchmarkFormatInt(benchmark::State& state) {
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(fmt::format("{} {} {}", 42, std::numeric_limits<int>::min(),
-                                         std::numeric_limits<int>::max()));
-  }
-}
-
-BENCHMARK(BenchmarkFormatInt);
-
-static void BenchmarkStringPrintfInt(benchmark::State& state) {
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(StringPrintf("%d %d %d", 42, std::numeric_limits<int>::min(),
-                                          std::numeric_limits<int>::max()));
-  }
-}
-
-BENCHMARK(BenchmarkStringPrintfInt);
-
-static void BenchmarkFormatFloat(benchmark::State& state) {
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(fmt::format("{} {} {}", 42.42, std::numeric_limits<float>::min(),
-                                         std::numeric_limits<float>::max()));
-  }
-}
-
-BENCHMARK(BenchmarkFormatFloat);
-
-static void BenchmarkStringPrintfFloat(benchmark::State& state) {
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(StringPrintf("%f %f %f", 42.42, std::numeric_limits<float>::min(),
-                                          std::numeric_limits<float>::max()));
-  }
-}
-
-BENCHMARK(BenchmarkStringPrintfFloat);
-
-static void BenchmarkFormatStrings(benchmark::State& state) {
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(fmt::format("{} hello there {}", "hi,", "!!"));
-  }
-}
-
-BENCHMARK(BenchmarkFormatStrings);
-
-static void BenchmarkStringPrintfStrings(benchmark::State& state) {
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(StringPrintf("%s hello there %s", "hi,", "!!"));
-  }
-}
-
-BENCHMARK(BenchmarkStringPrintfStrings);
-
-// Run the benchmark
-BENCHMARK_MAIN();
diff --git a/base/include/android-base/chrono_utils.h b/base/include/android-base/chrono_utils.h
deleted file mode 100644
index 11fcf71..0000000
--- a/base/include/android-base/chrono_utils.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-#include <chrono>
-#include <sstream>
-
-#if __cplusplus > 201103L && !defined(__WIN32)  // C++14
-using namespace std::chrono_literals;
-#endif
-
-namespace android {
-namespace base {
-
-// A std::chrono clock based on CLOCK_BOOTTIME.
-class boot_clock {
- public:
-  typedef std::chrono::nanoseconds duration;
-  typedef std::chrono::time_point<boot_clock, duration> time_point;
-
-  static time_point now();
-};
-
-class Timer {
- public:
-  Timer() : start_(boot_clock::now()) {}
-
-  std::chrono::milliseconds duration() const {
-    return std::chrono::duration_cast<std::chrono::milliseconds>(boot_clock::now() - start_);
-  }
-
- private:
-  boot_clock::time_point start_;
-};
-
-std::ostream& operator<<(std::ostream& os, const Timer& t);
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/cmsg.h b/base/include/android-base/cmsg.h
deleted file mode 100644
index e4197b1..0000000
--- a/base/include/android-base/cmsg.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <type_traits>
-#include <vector>
-
-#include <android-base/collections.h>
-#include <android-base/macros.h>
-#include <android-base/unique_fd.h>
-
-namespace android {
-namespace base {
-
-#if !defined(_WIN32)
-
-// Helpers for sending and receiving file descriptors across Unix domain sockets.
-//
-// The cmsg(3) API is very hard to get right, with multiple landmines that can
-// lead to death. Almost all of the uses of cmsg in Android make at least one of
-// the following mistakes:
-//
-//   - not aligning the cmsg buffer
-//   - leaking fds if more fds are received than expected
-//   - blindly dereferencing CMSG_DATA without checking the header
-//   - using CMSG_SPACE instead of CMSG_LEN for .cmsg_len
-//   - using CMSG_LEN instead of CMSG_SPACE for .msg_controllen
-//   - using a length specified in number of fds instead of bytes
-//
-// These functions wrap the hard-to-use cmsg API with an easier to use abstraction.
-
-// Send file descriptors across a Unix domain socket.
-//
-// Note that the write can return short if the socket type is SOCK_STREAM. When
-// this happens, file descriptors are still sent to the other end, but with
-// truncated data. For this reason, using SOCK_SEQPACKET or SOCK_DGRAM is recommended.
-ssize_t SendFileDescriptorVector(borrowed_fd sock, const void* data, size_t len,
-                                 const std::vector<int>& fds);
-
-// Receive file descriptors from a Unix domain socket.
-//
-// If more FDs (or bytes, for datagram sockets) are received than expected,
-// -1 is returned with errno set to EMSGSIZE, and all received FDs are thrown away.
-ssize_t ReceiveFileDescriptorVector(borrowed_fd sock, void* data, size_t len, size_t max_fds,
-                                    std::vector<android::base::unique_fd>* fds);
-
-// Helper for SendFileDescriptorVector that constructs a std::vector for you, e.g.:
-//   SendFileDescriptors(sock, "foo", 3, std::move(fd1), std::move(fd2))
-template <typename... Args>
-ssize_t SendFileDescriptors(borrowed_fd sock, const void* data, size_t len, Args&&... sent_fds) {
-  // Do not allow implicit conversion to int: people might try to do something along the lines of:
-  //   SendFileDescriptors(..., std::move(a_unique_fd))
-  // and be surprised when the unique_fd isn't closed afterwards.
-  AssertType<int>(std::forward<Args>(sent_fds)...);
-  std::vector<int> fds;
-  Append(fds, std::forward<Args>(sent_fds)...);
-  return SendFileDescriptorVector(sock, data, len, fds);
-}
-
-// Helper for ReceiveFileDescriptorVector that receives an exact number of file descriptors.
-// If more file descriptors are received than requested, -1 is returned with errno set to EMSGSIZE.
-// If fewer file descriptors are received than requested, -1 is returned with errno set to ENOMSG.
-// In both cases, all arguments are cleared and any received FDs are thrown away.
-template <typename... Args>
-ssize_t ReceiveFileDescriptors(borrowed_fd sock, void* data, size_t len, Args&&... received_fds) {
-  std::vector<unique_fd*> fds;
-  Append(fds, std::forward<Args>(received_fds)...);
-
-  std::vector<unique_fd> result;
-  ssize_t rc = ReceiveFileDescriptorVector(sock, data, len, fds.size(), &result);
-  if (rc == -1 || result.size() != fds.size()) {
-    int err = rc == -1 ? errno : ENOMSG;
-    for (unique_fd* fd : fds) {
-      fd->reset();
-    }
-    errno = err;
-    return -1;
-  }
-
-  for (size_t i = 0; i < fds.size(); ++i) {
-    *fds[i] = std::move(result[i]);
-  }
-  return rc;
-}
-
-#endif
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/collections.h b/base/include/android-base/collections.h
deleted file mode 100644
index be0683a..0000000
--- a/base/include/android-base/collections.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <utility>
-
-namespace android {
-namespace base {
-
-// Helpers for converting a variadic template parameter pack to a homogeneous collection.
-// Parameters must be implictly convertible to the contained type (including via move/copy ctors).
-//
-// Use as follows:
-//
-//   template <typename... Args>
-//   std::vector<int> CreateVector(Args&&... args) {
-//     std::vector<int> result;
-//     Append(result, std::forward<Args>(args)...);
-//     return result;
-//   }
-template <typename CollectionType, typename T>
-void Append(CollectionType& collection, T&& arg) {
-  collection.push_back(std::forward<T>(arg));
-}
-
-template <typename CollectionType, typename T, typename... Args>
-void Append(CollectionType& collection, T&& arg, Args&&... args) {
-  collection.push_back(std::forward<T>(arg));
-  return Append(collection, std::forward<Args>(args)...);
-}
-
-// Assert that all of the arguments in a variadic template parameter pack are of a given type
-// after std::decay.
-template <typename T, typename Arg, typename... Args>
-void AssertType(Arg&&) {
-  static_assert(std::is_same<T, typename std::decay<Arg>::type>::value);
-}
-
-template <typename T, typename Arg, typename... Args>
-void AssertType(Arg&&, Args&&... args) {
-  static_assert(std::is_same<T, typename std::decay<Arg>::type>::value);
-  AssertType<T>(std::forward<Args>(args)...);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/endian.h b/base/include/android-base/endian.h
deleted file mode 100644
index 8fa6365..0000000
--- a/base/include/android-base/endian.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#pragma once
-
-/* A cross-platform equivalent of bionic's <sys/endian.h>. */
-
-/* For __BIONIC__ and __GLIBC__ */
-#include <sys/cdefs.h>
-
-#if defined(__BIONIC__)
-
-#include <sys/endian.h>
-
-#elif defined(__GLIBC__)
-
-/* glibc's <endian.h> is like bionic's <sys/endian.h>. */
-#include <endian.h>
-
-/* glibc keeps htons and htonl in <netinet/in.h>. */
-#include <netinet/in.h>
-
-/* glibc doesn't have the 64-bit variants. */
-#define htonq(x) htobe64(x)
-#define ntohq(x) be64toh(x)
-
-/* glibc has different names to BSD for these. */
-#define betoh16(x) be16toh(x)
-#define betoh32(x) be32toh(x)
-#define betoh64(x) be64toh(x)
-#define letoh16(x) le16toh(x)
-#define letoh32(x) le32toh(x)
-#define letoh64(x) le64toh(x)
-
-#else
-
-#if defined(__APPLE__)
-/* macOS has some of the basics. */
-#include <sys/_endian.h>
-#else
-/* Windows has some of the basics as well. */
-#include <sys/param.h>
-#include <winsock2.h>
-/* winsock2.h *must* be included before the following four macros. */
-#define htons(x) __builtin_bswap16(x)
-#define htonl(x) __builtin_bswap32(x)
-#define ntohs(x) __builtin_bswap16(x)
-#define ntohl(x) __builtin_bswap32(x)
-#endif
-
-/* Neither macOS nor Windows have the rest. */
-
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-#define __BYTE_ORDER __LITTLE_ENDIAN
-
-#define htonq(x) __builtin_bswap64(x)
-
-#define ntohq(x) __builtin_bswap64(x)
-
-#define htobe16(x) __builtin_bswap16(x)
-#define htobe32(x) __builtin_bswap32(x)
-#define htobe64(x) __builtin_bswap64(x)
-
-#define betoh16(x) __builtin_bswap16(x)
-#define betoh32(x) __builtin_bswap32(x)
-#define betoh64(x) __builtin_bswap64(x)
-
-#define htole16(x) (x)
-#define htole32(x) (x)
-#define htole64(x) (x)
-
-#define letoh16(x) (x)
-#define letoh32(x) (x)
-#define letoh64(x) (x)
-
-#define be16toh(x) __builtin_bswap16(x)
-#define be32toh(x) __builtin_bswap32(x)
-#define be64toh(x) __builtin_bswap64(x)
-
-#define le16toh(x) (x)
-#define le32toh(x) (x)
-#define le64toh(x) (x)
-
-#endif
diff --git a/base/include/android-base/errno_restorer.h b/base/include/android-base/errno_restorer.h
deleted file mode 100644
index 1c8597c..0000000
--- a/base/include/android-base/errno_restorer.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include "errno.h"
-
-#include "android-base/macros.h"
-
-namespace android {
-namespace base {
-
-class ErrnoRestorer {
- public:
-  ErrnoRestorer() : saved_errno_(errno) {}
-
-  ~ErrnoRestorer() { errno = saved_errno_; }
-
-  // Allow this object to be used as part of && operation.
-  operator bool() const { return true; }
-
- private:
-  const int saved_errno_;
-
-  DISALLOW_COPY_AND_ASSIGN(ErrnoRestorer);
-};
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/errors.h b/base/include/android-base/errors.h
deleted file mode 100644
index 06f29fc..0000000
--- a/base/include/android-base/errors.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-// Portable error handling functions. This is only necessary for host-side
-// code that needs to be cross-platform; code that is only run on Unix should
-// just use errno and strerror() for simplicity.
-//
-// There is some complexity since Windows has (at least) three different error
-// numbers, not all of which share the same type:
-//   * errno: for C runtime errors.
-//   * GetLastError(): Windows non-socket errors.
-//   * WSAGetLastError(): Windows socket errors.
-// errno can be passed to strerror() on all platforms, but the other two require
-// special handling to get the error string. Refer to Microsoft documentation
-// to determine which error code to check for each function.
-
-#pragma once
-
-#include <string>
-
-namespace android {
-namespace base {
-
-// Returns a string describing the given system error code. |error_code| must
-// be errno on Unix or GetLastError()/WSAGetLastError() on Windows. Passing
-// errno on Windows has undefined behavior.
-std::string SystemErrorCodeToString(int error_code);
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/expected.h b/base/include/android-base/expected.h
deleted file mode 100644
index 9470344..0000000
--- a/base/include/android-base/expected.h
+++ /dev/null
@@ -1,744 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <algorithm>
-#include <initializer_list>
-#include <type_traits>
-#include <utility>
-#include <variant>
-
-// android::base::expected is an Android implementation of the std::expected
-// proposal.
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0323r7.html
-//
-// Usage:
-// using android::base::expected;
-// using android::base::unexpected;
-//
-// expected<double,std::string> safe_divide(double i, double j) {
-//   if (j == 0) return unexpected("divide by zero");
-//   else return i / j;
-// }
-//
-// void test() {
-//   auto q = safe_divide(10, 0);
-//   if (q) { printf("%f\n", q.value()); }
-//   else { printf("%s\n", q.error().c_str()); }
-// }
-//
-// When the proposal becomes part of the standard and is implemented by
-// libcxx, this will be removed and android::base::expected will be
-// type alias to std::expected.
-//
-
-namespace android {
-namespace base {
-
-// Synopsis
-template<class T, class E>
-    class expected;
-
-template<class E>
-    class unexpected;
-template<class E>
-  unexpected(E) -> unexpected<E>;
-
-template<class E>
-   class bad_expected_access;
-
-template<>
-   class bad_expected_access<void>;
-
-struct unexpect_t {
-   explicit unexpect_t() = default;
-};
-inline constexpr unexpect_t unexpect{};
-
-// macros for SFINAE
-#define _ENABLE_IF(...) \
-  , std::enable_if_t<(__VA_ARGS__)>* = nullptr
-
-// Define NODISCARD_EXPECTED to prevent expected<T,E> from being
-// ignored when used as a return value. This is off by default.
-#ifdef NODISCARD_EXPECTED
-#define _NODISCARD_ [[nodiscard]]
-#else
-#define _NODISCARD_
-#endif
-
-// Class expected
-template<class T, class E>
-class _NODISCARD_ expected {
- public:
-  using value_type = T;
-  using error_type = E;
-  using unexpected_type = unexpected<E>;
-
-  template<class U>
-  using rebind = expected<U, error_type>;
-
-  // constructors
-  constexpr expected() = default;
-  constexpr expected(const expected& rhs) = default;
-  constexpr expected(expected&& rhs) noexcept = default;
-
-  template<class U, class G _ENABLE_IF(
-    std::is_constructible_v<T, const U&> &&
-    std::is_constructible_v<E, const G&> &&
-    !std::is_constructible_v<T, expected<U, G>&> &&
-    !std::is_constructible_v<T, expected<U, G>&&> &&
-    !std::is_constructible_v<T, const expected<U, G>&> &&
-    !std::is_constructible_v<T, const expected<U, G>&&> &&
-    !std::is_convertible_v<expected<U, G>&, T> &&
-    !std::is_convertible_v<expected<U, G>&&, T> &&
-    !std::is_convertible_v<const expected<U, G>&, T> &&
-    !std::is_convertible_v<const expected<U, G>&&, T> &&
-    !(!std::is_convertible_v<const U&, T> ||
-     !std::is_convertible_v<const G&, E>) /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(const expected<U, G>& rhs) {
-    if (rhs.has_value()) var_ = rhs.value();
-    else var_ = unexpected(rhs.error());
-  }
-
-  template<class U, class G _ENABLE_IF(
-    std::is_constructible_v<T, const U&> &&
-    std::is_constructible_v<E, const G&> &&
-    !std::is_constructible_v<T, expected<U, G>&> &&
-    !std::is_constructible_v<T, expected<U, G>&&> &&
-    !std::is_constructible_v<T, const expected<U, G>&> &&
-    !std::is_constructible_v<T, const expected<U, G>&&> &&
-    !std::is_convertible_v<expected<U, G>&, T> &&
-    !std::is_convertible_v<expected<U, G>&&, T> &&
-    !std::is_convertible_v<const expected<U, G>&, T> &&
-    !std::is_convertible_v<const expected<U, G>&&, T> &&
-    (!std::is_convertible_v<const U&, T> ||
-     !std::is_convertible_v<const G&, E>) /* explicit */
-  )>
-  constexpr explicit expected(const expected<U, G>& rhs) {
-    if (rhs.has_value()) var_ = rhs.value();
-    else var_ = unexpected(rhs.error());
-  }
-
-  template<class U, class G _ENABLE_IF(
-    std::is_constructible_v<T, const U&> &&
-    std::is_constructible_v<E, const G&> &&
-    !std::is_constructible_v<T, expected<U, G>&> &&
-    !std::is_constructible_v<T, expected<U, G>&&> &&
-    !std::is_constructible_v<T, const expected<U, G>&> &&
-    !std::is_constructible_v<T, const expected<U, G>&&> &&
-    !std::is_convertible_v<expected<U, G>&, T> &&
-    !std::is_convertible_v<expected<U, G>&&, T> &&
-    !std::is_convertible_v<const expected<U, G>&, T> &&
-    !std::is_convertible_v<const expected<U, G>&&, T> &&
-    !(!std::is_convertible_v<const U&, T> ||
-     !std::is_convertible_v<const G&, E>) /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(expected<U, G>&& rhs) {
-    if (rhs.has_value()) var_ = std::move(rhs.value());
-    else var_ = unexpected(std::move(rhs.error()));
-  }
-
-  template<class U, class G _ENABLE_IF(
-    std::is_constructible_v<T, const U&> &&
-    std::is_constructible_v<E, const G&> &&
-    !std::is_constructible_v<T, expected<U, G>&> &&
-    !std::is_constructible_v<T, expected<U, G>&&> &&
-    !std::is_constructible_v<T, const expected<U, G>&> &&
-    !std::is_constructible_v<T, const expected<U, G>&&> &&
-    !std::is_convertible_v<expected<U, G>&, T> &&
-    !std::is_convertible_v<expected<U, G>&&, T> &&
-    !std::is_convertible_v<const expected<U, G>&, T> &&
-    !std::is_convertible_v<const expected<U, G>&&, T> &&
-    (!std::is_convertible_v<const U&, T> ||
-     !std::is_convertible_v<const G&, E>) /* explicit */
-  )>
-  constexpr explicit expected(expected<U, G>&& rhs) {
-    if (rhs.has_value()) var_ = std::move(rhs.value());
-    else var_ = unexpected(std::move(rhs.error()));
-  }
-
-  template <class U = T _ENABLE_IF(
-                std::is_constructible_v<T, U&&> &&
-                !std::is_same_v<std::remove_cv_t<std::remove_reference_t<U>>, std::in_place_t> &&
-                !std::is_same_v<expected<T, E>, std::remove_cv_t<std::remove_reference_t<U>>> &&
-                !std::is_same_v<unexpected<E>, std::remove_cv_t<std::remove_reference_t<U>>> &&
-                std::is_convertible_v<U&&, T> /* non-explicit */
-                )>
-  // NOLINTNEXTLINE(google-explicit-constructor,bugprone-forwarding-reference-overload)
-  constexpr expected(U&& v) : var_(std::in_place_index<0>, std::forward<U>(v)) {}
-
-  template <class U = T _ENABLE_IF(
-                std::is_constructible_v<T, U&&> &&
-                !std::is_same_v<std::remove_cv_t<std::remove_reference_t<U>>, std::in_place_t> &&
-                !std::is_same_v<expected<T, E>, std::remove_cv_t<std::remove_reference_t<U>>> &&
-                !std::is_same_v<unexpected<E>, std::remove_cv_t<std::remove_reference_t<U>>> &&
-                !std::is_convertible_v<U&&, T> /* explicit */
-                )>
-  // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
-  constexpr explicit expected(U&& v) : var_(std::in_place_index<0>, T(std::forward<U>(v))) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, const G&> &&
-    std::is_convertible_v<const G&, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(const unexpected<G>& e)
-  : var_(std::in_place_index<1>, e.value()) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, const G&> &&
-    !std::is_convertible_v<const G&, E> /* explicit */
-  )>
-  constexpr explicit expected(const unexpected<G>& e)
-  : var_(std::in_place_index<1>, E(e.value())) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, G&&> &&
-    std::is_convertible_v<G&&, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(unexpected<G>&& e)
-  : var_(std::in_place_index<1>, std::move(e.value())) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, G&&> &&
-    !std::is_convertible_v<G&&, E> /* explicit */
-  )>
-  constexpr explicit expected(unexpected<G>&& e)
-  : var_(std::in_place_index<1>, E(std::move(e.value()))) {}
-
-  template<class... Args _ENABLE_IF(
-    std::is_constructible_v<T, Args&&...>
-  )>
-  constexpr explicit expected(std::in_place_t, Args&&... args)
-  : var_(std::in_place_index<0>, std::forward<Args>(args)...) {}
-
-  template<class U, class... Args _ENABLE_IF(
-    std::is_constructible_v<T, std::initializer_list<U>&, Args...>
-  )>
-  constexpr explicit expected(std::in_place_t, std::initializer_list<U> il, Args&&... args)
-  : var_(std::in_place_index<0>, il, std::forward<Args>(args)...) {}
-
-  template<class... Args _ENABLE_IF(
-    std::is_constructible_v<E, Args...>
-  )>
-  constexpr explicit expected(unexpect_t, Args&&... args)
-  : var_(unexpected_type(std::forward<Args>(args)...)) {}
-
-  template<class U, class... Args _ENABLE_IF(
-    std::is_constructible_v<E, std::initializer_list<U>&, Args...>
-  )>
-  constexpr explicit expected(unexpect_t, std::initializer_list<U> il, Args&&... args)
-  : var_(unexpected_type(il, std::forward<Args>(args)...)) {}
-
-  // destructor
-  ~expected() = default;
-
-  // assignment
-  // Note: SFNAIE doesn't work here because assignment operator should be
-  // non-template. We could workaround this by defining a templated parent class
-  // having the assignment operator. This incomplete implementation however
-  // doesn't allow us to copy assign expected<T,E> even when T is non-copy
-  // assignable. The copy assignment will fail by the underlying std::variant
-  // anyway though the error message won't be clear.
-  expected& operator=(const expected& rhs) = default;
-
-  // Note for SFNAIE above applies to here as well
-  expected& operator=(expected&& rhs) noexcept(
-      std::is_nothrow_move_assignable_v<T>&& std::is_nothrow_move_assignable_v<E>) = default;
-
-  template <class U = T _ENABLE_IF(
-                !std::is_void_v<T> &&
-                !std::is_same_v<expected<T, E>, std::remove_cv_t<std::remove_reference_t<U>>> &&
-                !std::conjunction_v<std::is_scalar<T>, std::is_same<T, std::decay_t<U>>> &&
-                std::is_constructible_v<T, U> && std::is_assignable_v<T&, U> &&
-                std::is_nothrow_move_constructible_v<E>)>
-  expected& operator=(U&& rhs) {
-    var_ = T(std::forward<U>(rhs));
-    return *this;
-  }
-
-  template<class G = E>
-  expected& operator=(const unexpected<G>& rhs) {
-    var_ = rhs;
-    return *this;
-  }
-
-  template<class G = E _ENABLE_IF(
-    std::is_nothrow_move_constructible_v<G> &&
-    std::is_move_assignable_v<G>
-  )>
-  expected& operator=(unexpected<G>&& rhs) {
-    var_ = std::move(rhs);
-    return *this;
-  }
-
-  // modifiers
-  template<class... Args _ENABLE_IF(
-    std::is_nothrow_constructible_v<T, Args...>
-  )>
-  T& emplace(Args&&... args) {
-    expected(std::in_place, std::forward<Args>(args)...).swap(*this);
-    return value();
-  }
-
-  template<class U, class... Args _ENABLE_IF(
-    std::is_nothrow_constructible_v<T, std::initializer_list<U>&, Args...>
-  )>
-  T& emplace(std::initializer_list<U> il, Args&&... args) {
-    expected(std::in_place, il, std::forward<Args>(args)...).swap(*this);
-    return value();
-  }
-
-  // swap
-  template<typename U = T, typename = std::enable_if_t<(
-    std::is_swappable_v<U> &&
-    std::is_swappable_v<E> &&
-    (std::is_move_constructible_v<U> ||
-     std::is_move_constructible_v<E>))>>
-  void swap(expected& rhs) noexcept(
-    std::is_nothrow_move_constructible_v<T> &&
-    std::is_nothrow_swappable_v<T> &&
-    std::is_nothrow_move_constructible_v<E> &&
-    std::is_nothrow_swappable_v<E>) {
-    var_.swap(rhs.var_);
-  }
-
-  // observers
-  constexpr const T* operator->() const { return std::addressof(value()); }
-  constexpr T* operator->() { return std::addressof(value()); }
-  constexpr const T& operator*() const& { return value(); }
-  constexpr T& operator*() & { return value(); }
-  constexpr const T&& operator*() const&& { return std::move(std::get<T>(var_)); }
-  constexpr T&& operator*() && { return std::move(std::get<T>(var_)); }
-
-  constexpr explicit operator bool() const noexcept { return has_value(); }
-  constexpr bool has_value() const noexcept { return var_.index() == 0; }
-  constexpr bool ok() const noexcept { return has_value(); }
-
-  constexpr const T& value() const& { return std::get<T>(var_); }
-  constexpr T& value() & { return std::get<T>(var_); }
-  constexpr const T&& value() const&& { return std::move(std::get<T>(var_)); }
-  constexpr T&& value() && { return std::move(std::get<T>(var_)); }
-
-  constexpr const E& error() const& { return std::get<unexpected_type>(var_).value(); }
-  constexpr E& error() & { return std::get<unexpected_type>(var_).value(); }
-  constexpr const E&& error() const&& { return std::move(std::get<unexpected_type>(var_)).value(); }
-  constexpr E&& error() && { return std::move(std::get<unexpected_type>(var_)).value(); }
-
-  template<class U _ENABLE_IF(
-    std::is_copy_constructible_v<T> &&
-    std::is_convertible_v<U, T>
-  )>
-  constexpr T value_or(U&& v) const& {
-    if (has_value()) return value();
-    else return static_cast<T>(std::forward<U>(v));
-  }
-
-  template<class U _ENABLE_IF(
-    std::is_move_constructible_v<T> &&
-    std::is_convertible_v<U, T>
-  )>
-  constexpr T value_or(U&& v) && {
-    if (has_value()) return std::move(value());
-    else return static_cast<T>(std::forward<U>(v));
-  }
-
-  // expected equality operators
-  template<class T1, class E1, class T2, class E2>
-  friend constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y);
-  template<class T1, class E1, class T2, class E2>
-  friend constexpr bool operator!=(const expected<T1, E1>& x, const expected<T2, E2>& y);
-
-  // Comparison with unexpected<E>
-  template<class T1, class E1, class E2>
-  friend constexpr bool operator==(const expected<T1, E1>&, const unexpected<E2>&);
-  template<class T1, class E1, class E2>
-  friend constexpr bool operator==(const unexpected<E2>&, const expected<T1, E1>&);
-  template<class T1, class E1, class E2>
-  friend constexpr bool operator!=(const expected<T1, E1>&, const unexpected<E2>&);
-  template<class T1, class E1, class E2>
-  friend constexpr bool operator!=(const unexpected<E2>&, const expected<T1, E1>&);
-
-  // Specialized algorithms
-  template<class T1, class E1>
-  friend void swap(expected<T1, E1>&, expected<T1, E1>&) noexcept;
-
- private:
-  std::variant<value_type, unexpected_type> var_;
-};
-
-template<class T1, class E1, class T2, class E2>
-constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y) {
-  if (x.has_value() != y.has_value()) return false;
-  if (!x.has_value()) return x.error() == y.error();
-  return *x == *y;
-}
-
-template<class T1, class E1, class T2, class E2>
-constexpr bool operator!=(const expected<T1, E1>& x, const expected<T2, E2>& y) {
-  return !(x == y);
-}
-
-// Comparison with unexpected<E>
-template<class T1, class E1, class E2>
-constexpr bool operator==(const expected<T1, E1>& x, const unexpected<E2>& y) {
-  return !x.has_value() && (x.error() == y.value());
-}
-template<class T1, class E1, class E2>
-constexpr bool operator==(const unexpected<E2>& x, const expected<T1, E1>& y) {
-  return !y.has_value() && (x.value() == y.error());
-}
-template<class T1, class E1, class E2>
-constexpr bool operator!=(const expected<T1, E1>& x, const unexpected<E2>& y) {
-  return x.has_value() || (x.error() != y.value());
-}
-template<class T1, class E1, class E2>
-constexpr bool operator!=(const unexpected<E2>& x, const expected<T1, E1>& y) {
-  return y.has_value() || (x.value() != y.error());
-}
-
-template<class E>
-class _NODISCARD_ expected<void, E> {
- public:
-  using value_type = void;
-  using error_type = E;
-  using unexpected_type = unexpected<E>;
-
-  // constructors
-  constexpr expected() = default;
-  constexpr expected(const expected& rhs) = default;
-  constexpr expected(expected&& rhs) noexcept = default;
-
-  template<class U, class G _ENABLE_IF(
-    std::is_void_v<U> &&
-    std::is_convertible_v<const G&, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(const expected<U, G>& rhs) {
-    if (!rhs.has_value()) var_ = unexpected(rhs.error());
-  }
-
-  template<class U, class G _ENABLE_IF(
-    std::is_void_v<U> &&
-    !std::is_convertible_v<const G&, E> /* explicit */
-  )>
-  constexpr explicit expected(const expected<U, G>& rhs) {
-    if (!rhs.has_value()) var_ = unexpected(rhs.error());
-  }
-
-  template<class U, class G _ENABLE_IF(
-    std::is_void_v<U> &&
-    std::is_convertible_v<const G&&, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(expected<U, G>&& rhs) {
-    if (!rhs.has_value()) var_ = unexpected(std::move(rhs.error()));
-  }
-
-  template<class U, class G _ENABLE_IF(
-    std::is_void_v<U> &&
-    !std::is_convertible_v<const G&&, E> /* explicit */
-  )>
-  constexpr explicit expected(expected<U, G>&& rhs) {
-    if (!rhs.has_value()) var_ = unexpected(std::move(rhs.error()));
-  }
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, const G&> &&
-    std::is_convertible_v<const G&, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(const unexpected<G>& e)
-  : var_(std::in_place_index<1>, e.value()) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, const G&> &&
-    !std::is_convertible_v<const G&, E> /* explicit */
-  )>
-  constexpr explicit expected(const unexpected<G>& e)
-  : var_(std::in_place_index<1>, E(e.value())) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, G&&> &&
-    std::is_convertible_v<G&&, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr expected(unexpected<G>&& e)
-  : var_(std::in_place_index<1>, std::move(e.value())) {}
-
-  template<class G = E _ENABLE_IF(
-    std::is_constructible_v<E, G&&> &&
-    !std::is_convertible_v<G&&, E> /* explicit */
-  )>
-  constexpr explicit expected(unexpected<G>&& e)
-  : var_(std::in_place_index<1>, E(std::move(e.value()))) {}
-
-  template<class... Args _ENABLE_IF(
-    sizeof...(Args) == 0
-  )>
-  constexpr explicit expected(std::in_place_t, Args&&...) {}
-
-  template<class... Args _ENABLE_IF(
-    std::is_constructible_v<E, Args...>
-  )>
-  constexpr explicit expected(unexpect_t, Args&&... args)
-  : var_(unexpected_type(std::forward<Args>(args)...)) {}
-
-  template<class U, class... Args _ENABLE_IF(
-    std::is_constructible_v<E, std::initializer_list<U>&, Args...>
-  )>
-  constexpr explicit expected(unexpect_t, std::initializer_list<U> il, Args&&... args)
-  : var_(unexpected_type(il, std::forward<Args>(args)...)) {}
-
-  // destructor
-  ~expected() = default;
-
-  // assignment
-  // Note: SFNAIE doesn't work here because assignment operator should be
-  // non-template. We could workaround this by defining a templated parent class
-  // having the assignment operator. This incomplete implementation however
-  // doesn't allow us to copy assign expected<T,E> even when T is non-copy
-  // assignable. The copy assignment will fail by the underlying std::variant
-  // anyway though the error message won't be clear.
-  expected& operator=(const expected& rhs) = default;
-
-  // Note for SFNAIE above applies to here as well
-  expected& operator=(expected&& rhs) noexcept(std::is_nothrow_move_assignable_v<E>) = default;
-
-  template<class G = E>
-  expected& operator=(const unexpected<G>& rhs) {
-    var_ = rhs;
-    return *this;
-  }
-
-  template<class G = E _ENABLE_IF(
-    std::is_nothrow_move_constructible_v<G> &&
-    std::is_move_assignable_v<G>
-  )>
-  expected& operator=(unexpected<G>&& rhs) {
-    var_ = std::move(rhs);
-    return *this;
-  }
-
-  // modifiers
-  void emplace() {
-    var_ = std::monostate();
-  }
-
-  // swap
-  template<typename = std::enable_if_t<
-    std::is_swappable_v<E>>
-  >
-  void swap(expected& rhs) noexcept(std::is_nothrow_move_constructible_v<E>) {
-    var_.swap(rhs.var_);
-  }
-
-  // observers
-  constexpr explicit operator bool() const noexcept { return has_value(); }
-  constexpr bool has_value() const noexcept { return var_.index() == 0; }
-  constexpr bool ok() const noexcept { return has_value(); }
-
-  constexpr void value() const& { if (!has_value()) std::get<0>(var_); }
-
-  constexpr const E& error() const& { return std::get<unexpected_type>(var_).value(); }
-  constexpr E& error() & { return std::get<unexpected_type>(var_).value(); }
-  constexpr const E&& error() const&& { return std::move(std::get<unexpected_type>(var_)).value(); }
-  constexpr E&& error() && { return std::move(std::get<unexpected_type>(var_)).value(); }
-
-  // expected equality operators
-  template<class E1, class E2>
-  friend constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y);
-
-  // Specialized algorithms
-  template<class T1, class E1>
-  friend void swap(expected<T1, E1>&, expected<T1, E1>&) noexcept;
-
- private:
-  std::variant<std::monostate, unexpected_type> var_;
-};
-
-template<class E1, class E2>
-constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y) {
-  if (x.has_value() != y.has_value()) return false;
-  if (!x.has_value()) return x.error() == y.error();
-  return true;
-}
-
-template<class T1, class E1, class E2>
-constexpr bool operator==(const expected<T1, E1>& x, const expected<void, E2>& y) {
-  if (x.has_value() != y.has_value()) return false;
-  if (!x.has_value()) return x.error() == y.error();
-  return false;
-}
-
-template<class E1, class T2, class E2>
-constexpr bool operator==(const expected<void, E1>& x, const expected<T2, E2>& y) {
-  if (x.has_value() != y.has_value()) return false;
-  if (!x.has_value()) return x.error() == y.error();
-  return false;
-}
-
-template<class E>
-class unexpected {
- public:
-  // constructors
-  constexpr unexpected(const unexpected&) = default;
-  constexpr unexpected(unexpected&&) noexcept(std::is_nothrow_move_constructible_v<E>) = default;
-
-  template <class Err = E _ENABLE_IF(
-                std::is_constructible_v<E, Err> &&
-                !std::is_same_v<std::remove_cv_t<std::remove_reference_t<E>>, std::in_place_t> &&
-                !std::is_same_v<std::remove_cv_t<std::remove_reference_t<E>>, unexpected>)>
-  // NOLINTNEXTLINE(google-explicit-constructor,bugprone-forwarding-reference-overload)
-  constexpr unexpected(Err&& e) : val_(std::forward<Err>(e)) {}
-
-  template<class U, class... Args _ENABLE_IF(
-    std::is_constructible_v<E, std::initializer_list<U>&, Args...>
-  )>
-  constexpr explicit unexpected(std::in_place_t, std::initializer_list<U> il, Args&&... args)
-  : val_(il, std::forward<Args>(args)...) {}
-
-  template<class Err _ENABLE_IF(
-    std::is_constructible_v<E, Err> &&
-    !std::is_constructible_v<E, unexpected<Err>&> &&
-    !std::is_constructible_v<E, unexpected<Err>> &&
-    !std::is_constructible_v<E, const unexpected<Err>&> &&
-    !std::is_constructible_v<E, const unexpected<Err>> &&
-    !std::is_convertible_v<unexpected<Err>&, E> &&
-    !std::is_convertible_v<unexpected<Err>, E> &&
-    !std::is_convertible_v<const unexpected<Err>&, E> &&
-    !std::is_convertible_v<const unexpected<Err>, E> &&
-    std::is_convertible_v<Err, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr unexpected(const unexpected<Err>& rhs)
-  : val_(rhs.value()) {}
-
-  template<class Err _ENABLE_IF(
-    std::is_constructible_v<E, Err> &&
-    !std::is_constructible_v<E, unexpected<Err>&> &&
-    !std::is_constructible_v<E, unexpected<Err>> &&
-    !std::is_constructible_v<E, const unexpected<Err>&> &&
-    !std::is_constructible_v<E, const unexpected<Err>> &&
-    !std::is_convertible_v<unexpected<Err>&, E> &&
-    !std::is_convertible_v<unexpected<Err>, E> &&
-    !std::is_convertible_v<const unexpected<Err>&, E> &&
-    !std::is_convertible_v<const unexpected<Err>, E> &&
-    !std::is_convertible_v<Err, E> /* explicit */
-  )>
-  constexpr explicit unexpected(const unexpected<Err>& rhs)
-  : val_(E(rhs.value())) {}
-
-  template<class Err _ENABLE_IF(
-    std::is_constructible_v<E, Err> &&
-    !std::is_constructible_v<E, unexpected<Err>&> &&
-    !std::is_constructible_v<E, unexpected<Err>> &&
-    !std::is_constructible_v<E, const unexpected<Err>&> &&
-    !std::is_constructible_v<E, const unexpected<Err>> &&
-    !std::is_convertible_v<unexpected<Err>&, E> &&
-    !std::is_convertible_v<unexpected<Err>, E> &&
-    !std::is_convertible_v<const unexpected<Err>&, E> &&
-    !std::is_convertible_v<const unexpected<Err>, E> &&
-    std::is_convertible_v<Err, E> /* non-explicit */
-  )>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  constexpr unexpected(unexpected<Err>&& rhs)
-  : val_(std::move(rhs.value())) {}
-
-  template<class Err _ENABLE_IF(
-    std::is_constructible_v<E, Err> &&
-    !std::is_constructible_v<E, unexpected<Err>&> &&
-    !std::is_constructible_v<E, unexpected<Err>> &&
-    !std::is_constructible_v<E, const unexpected<Err>&> &&
-    !std::is_constructible_v<E, const unexpected<Err>> &&
-    !std::is_convertible_v<unexpected<Err>&, E> &&
-    !std::is_convertible_v<unexpected<Err>, E> &&
-    !std::is_convertible_v<const unexpected<Err>&, E> &&
-    !std::is_convertible_v<const unexpected<Err>, E> &&
-    !std::is_convertible_v<Err, E> /* explicit */
-  )>
-  constexpr explicit unexpected(unexpected<Err>&& rhs)
-  : val_(E(std::move(rhs.value()))) {}
-
-  // assignment
-  constexpr unexpected& operator=(const unexpected&) = default;
-  constexpr unexpected& operator=(unexpected&&) noexcept(std::is_nothrow_move_assignable_v<E>) =
-      default;
-  template<class Err = E>
-  constexpr unexpected& operator=(const unexpected<Err>& rhs) {
-    val_ = rhs.value();
-    return *this;
-  }
-  template<class Err = E>
-  constexpr unexpected& operator=(unexpected<Err>&& rhs) {
-    val_ = std::forward<E>(rhs.value());
-    return *this;
-  }
-
-  // observer
-  constexpr const E& value() const& noexcept { return val_; }
-  constexpr E& value() & noexcept { return val_; }
-  constexpr const E&& value() const&& noexcept { return std::move(val_); }
-  constexpr E&& value() && noexcept { return std::move(val_); }
-
-  void swap(unexpected& other) noexcept(std::is_nothrow_swappable_v<E>) {
-    std::swap(val_, other.val_);
-  }
-
-  template<class E1, class E2>
-  friend constexpr bool
-  operator==(const unexpected<E1>& e1, const unexpected<E2>& e2);
-  template<class E1, class E2>
-  friend constexpr bool
-  operator!=(const unexpected<E1>& e1, const unexpected<E2>& e2);
-
-  template<class E1>
-  friend void swap(unexpected<E1>& x, unexpected<E1>& y) noexcept(noexcept(x.swap(y)));
-
- private:
-  E val_;
-};
-
-template<class E1, class E2>
-constexpr bool
-operator==(const unexpected<E1>& e1, const unexpected<E2>& e2) {
-  return e1.value() == e2.value();
-}
-
-template<class E1, class E2>
-constexpr bool
-operator!=(const unexpected<E1>& e1, const unexpected<E2>& e2) {
-  return e1.value() != e2.value();
-}
-
-template<class E1>
-void swap(unexpected<E1>& x, unexpected<E1>& y) noexcept(noexcept(x.swap(y))) {
-  x.swap(y);
-}
-
-// TODO: bad_expected_access class
-
-#undef _ENABLE_IF
-#undef _NODISCARD_
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/file.h b/base/include/android-base/file.h
deleted file mode 100644
index c622562..0000000
--- a/base/include/android-base/file.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <string>
-
-#include "android-base/macros.h"
-#include "android-base/off64_t.h"
-#include "android-base/unique_fd.h"
-
-#if !defined(_WIN32) && !defined(O_BINARY)
-/** Windows needs O_BINARY, but Unix never mangles line endings. */
-#define O_BINARY 0
-#endif
-
-#if defined(_WIN32) && !defined(O_CLOEXEC)
-/** Windows has O_CLOEXEC but calls it O_NOINHERIT for some reason. */
-#define O_CLOEXEC O_NOINHERIT
-#endif
-
-class TemporaryFile {
- public:
-  TemporaryFile();
-  explicit TemporaryFile(const std::string& tmp_dir);
-  ~TemporaryFile();
-
-  // Release the ownership of fd, caller is reponsible for closing the
-  // fd or stream properly.
-  int release();
-  // Don't remove the temporary file in the destructor.
-  void DoNotRemove() { remove_file_ = false; }
-
-  int fd;
-  char path[1024];
-
- private:
-  void init(const std::string& tmp_dir);
-
-  bool remove_file_ = true;
-
-  DISALLOW_COPY_AND_ASSIGN(TemporaryFile);
-};
-
-class TemporaryDir {
- public:
-  TemporaryDir();
-  ~TemporaryDir();
-  // Don't remove the temporary dir in the destructor.
-  void DoNotRemove() { remove_dir_and_contents_ = false; }
-
-  char path[1024];
-
- private:
-  bool init(const std::string& tmp_dir);
-
-  bool remove_dir_and_contents_ = true;
-
-  DISALLOW_COPY_AND_ASSIGN(TemporaryDir);
-};
-
-namespace android {
-namespace base {
-
-bool ReadFdToString(borrowed_fd fd, std::string* content);
-bool ReadFileToString(const std::string& path, std::string* content,
-                      bool follow_symlinks = false);
-
-bool WriteStringToFile(const std::string& content, const std::string& path,
-                       bool follow_symlinks = false);
-bool WriteStringToFd(const std::string& content, borrowed_fd fd);
-
-#if !defined(_WIN32)
-bool WriteStringToFile(const std::string& content, const std::string& path,
-                       mode_t mode, uid_t owner, gid_t group,
-                       bool follow_symlinks = false);
-#endif
-
-bool ReadFully(borrowed_fd fd, void* data, size_t byte_count);
-
-// Reads `byte_count` bytes from the file descriptor at the specified offset.
-// Returns false if there was an IO error or EOF was reached before reading `byte_count` bytes.
-//
-// NOTE: On Linux/Mac, this function wraps pread, which provides atomic read support without
-// modifying the read pointer of the file descriptor. On Windows, however, the read pointer does
-// get modified. This means that ReadFullyAtOffset can be used concurrently with other calls to the
-// same function, but concurrently seeking or reading incrementally can lead to unexpected
-// behavior.
-bool ReadFullyAtOffset(borrowed_fd fd, void* data, size_t byte_count, off64_t offset);
-
-bool WriteFully(borrowed_fd fd, const void* data, size_t byte_count);
-
-bool RemoveFileIfExists(const std::string& path, std::string* err = nullptr);
-
-#if !defined(_WIN32)
-bool Realpath(const std::string& path, std::string* result);
-bool Readlink(const std::string& path, std::string* result);
-#endif
-
-std::string GetExecutablePath();
-std::string GetExecutableDirectory();
-
-// Like the regular basename and dirname, but thread-safe on all
-// platforms and capable of correctly handling exotic Windows paths.
-std::string Basename(const std::string& path);
-std::string Dirname(const std::string& path);
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/format.h b/base/include/android-base/format.h
deleted file mode 100644
index 330040d..0000000
--- a/base/include/android-base/format.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-// We include fmtlib here as an alias, since libbase will have fmtlib statically linked already.
-// It is accessed through its normal fmt:: namespace.
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wshadow"
-#include <fmt/chrono.h>
-#pragma clang diagnostic pop
-#include <fmt/core.h>
-#include <fmt/format.h>
-#include <fmt/ostream.h>
-#include <fmt/printf.h>
diff --git a/base/include/android-base/logging.h b/base/include/android-base/logging.h
deleted file mode 100644
index 26827fb..0000000
--- a/base/include/android-base/logging.h
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-//
-// Google-style C++ logging.
-//
-
-// This header provides a C++ stream interface to logging.
-//
-// To log:
-//
-//   LOG(INFO) << "Some text; " << some_value;
-//
-// Replace `INFO` with any severity from `enum LogSeverity`.
-//
-// To log the result of a failed function and include the string
-// representation of `errno` at the end:
-//
-//   PLOG(ERROR) << "Write failed";
-//
-// The output will be something like `Write failed: I/O error`.
-// Remember this as 'P' as in perror(3).
-//
-// To output your own types, simply implement operator<< as normal.
-//
-// By default, output goes to logcat on Android and stderr on the host.
-// A process can use `SetLogger` to decide where all logging goes.
-// Implementations are provided for logcat, stderr, and dmesg.
-//
-// By default, the process' name is used as the log tag.
-// Code can choose a specific log tag by defining LOG_TAG
-// before including this header.
-
-// This header also provides assertions:
-//
-//   CHECK(must_be_true);
-//   CHECK_EQ(a, b) << z_is_interesting_too;
-
-// NOTE: For Windows, you must include logging.h after windows.h to allow the
-// following code to suppress the evil ERROR macro:
-#ifdef _WIN32
-// windows.h includes wingdi.h which defines an evil macro ERROR.
-#ifdef ERROR
-#undef ERROR
-#endif
-#endif
-
-#include <functional>
-#include <memory>
-#include <ostream>
-
-#include "android-base/errno_restorer.h"
-#include "android-base/macros.h"
-
-// Note: DO NOT USE DIRECTLY. Use LOG_TAG instead.
-#ifdef _LOG_TAG_INTERNAL
-#error "_LOG_TAG_INTERNAL must not be defined"
-#endif
-#ifdef LOG_TAG
-#define _LOG_TAG_INTERNAL LOG_TAG
-#else
-#define _LOG_TAG_INTERNAL nullptr
-#endif
-
-namespace android {
-namespace base {
-
-enum LogSeverity {
-  VERBOSE,
-  DEBUG,
-  INFO,
-  WARNING,
-  ERROR,
-  FATAL_WITHOUT_ABORT,  // For loggability tests, this is considered identical to FATAL.
-  FATAL,
-};
-
-enum LogId {
-  DEFAULT,
-  MAIN,
-  SYSTEM,
-  RADIO,
-  CRASH,
-};
-
-using LogFunction = std::function<void(LogId, LogSeverity, const char*, const char*,
-                                       unsigned int, const char*)>;
-using AbortFunction = std::function<void(const char*)>;
-
-// Loggers for use with InitLogging/SetLogger.
-
-// Log to the kernel log (dmesg).
-void KernelLogger(LogId, LogSeverity, const char*, const char*, unsigned int, const char*);
-// Log to stderr in the full logcat format (with pid/tid/time/tag details).
-void StderrLogger(LogId, LogSeverity, const char*, const char*, unsigned int, const char*);
-// Log just the message to stdout/stderr (without pid/tid/time/tag details).
-// The choice of stdout versus stderr is based on the severity.
-// Errors are also prefixed by the program name (as with err(3)/error(3)).
-// Useful for replacing printf(3)/perror(3)/err(3)/error(3) in command-line tools.
-void StdioLogger(LogId, LogSeverity, const char*, const char*, unsigned int, const char*);
-
-void DefaultAborter(const char* abort_message);
-
-void SetDefaultTag(const std::string& tag);
-
-// The LogdLogger sends chunks of up to ~4000 bytes at a time to logd.  It does not prevent other
-// threads from writing to logd between sending each chunk, so other threads may interleave their
-// messages.  If preventing interleaving is required, then a custom logger that takes a lock before
-// calling this logger should be provided.
-class LogdLogger {
- public:
-  explicit LogdLogger(LogId default_log_id = android::base::MAIN);
-
-  void operator()(LogId, LogSeverity, const char* tag, const char* file,
-                  unsigned int line, const char* message);
-
- private:
-  LogId default_log_id_;
-};
-
-// Configure logging based on ANDROID_LOG_TAGS environment variable.
-// We need to parse a string that looks like
-//
-//      *:v jdwp:d dalvikvm:d dalvikvm-gc:i dalvikvmi:i
-//
-// The tag (or '*' for the global level) comes first, followed by a colon and a
-// letter indicating the minimum priority level we're expected to log.  This can
-// be used to reveal or conceal logs with specific tags.
-#ifdef __ANDROID__
-#define INIT_LOGGING_DEFAULT_LOGGER LogdLogger()
-#else
-#define INIT_LOGGING_DEFAULT_LOGGER StderrLogger
-#endif
-void InitLogging(char* argv[],
-                 LogFunction&& logger = INIT_LOGGING_DEFAULT_LOGGER,
-                 AbortFunction&& aborter = DefaultAborter);
-#undef INIT_LOGGING_DEFAULT_LOGGER
-
-// Replace the current logger.
-void SetLogger(LogFunction&& logger);
-
-// Replace the current aborter.
-void SetAborter(AbortFunction&& aborter);
-
-// A helper macro that produces an expression that accepts both a qualified name and an
-// unqualified name for a LogSeverity, and returns a LogSeverity value.
-// Note: DO NOT USE DIRECTLY. This is an implementation detail.
-#define SEVERITY_LAMBDA(severity) ([&]() {    \
-  using ::android::base::VERBOSE;             \
-  using ::android::base::DEBUG;               \
-  using ::android::base::INFO;                \
-  using ::android::base::WARNING;             \
-  using ::android::base::ERROR;               \
-  using ::android::base::FATAL_WITHOUT_ABORT; \
-  using ::android::base::FATAL;               \
-  return (severity); }())
-
-#ifdef __clang_analyzer__
-// Clang's static analyzer does not see the conditional statement inside
-// LogMessage's destructor that will abort on FATAL severity.
-#define ABORT_AFTER_LOG_FATAL for (;; abort())
-
-struct LogAbortAfterFullExpr {
-  ~LogAbortAfterFullExpr() __attribute__((noreturn)) { abort(); }
-  explicit operator bool() const { return false; }
-};
-// Provides an expression that evaluates to the truthiness of `x`, automatically
-// aborting if `c` is true.
-#define ABORT_AFTER_LOG_EXPR_IF(c, x) (((c) && ::android::base::LogAbortAfterFullExpr()) || (x))
-// Note to the static analyzer that we always execute FATAL logs in practice.
-#define MUST_LOG_MESSAGE(severity) (SEVERITY_LAMBDA(severity) == ::android::base::FATAL)
-#else
-#define ABORT_AFTER_LOG_FATAL
-#define ABORT_AFTER_LOG_EXPR_IF(c, x) (x)
-#define MUST_LOG_MESSAGE(severity) false
-#endif
-#define ABORT_AFTER_LOG_FATAL_EXPR(x) ABORT_AFTER_LOG_EXPR_IF(true, x)
-
-// Defines whether the given severity will be logged or silently swallowed.
-#define WOULD_LOG(severity)                                                              \
-  (UNLIKELY(::android::base::ShouldLog(SEVERITY_LAMBDA(severity), _LOG_TAG_INTERNAL)) || \
-   MUST_LOG_MESSAGE(severity))
-
-// Get an ostream that can be used for logging at the given severity and to the default
-// destination.
-//
-// Notes:
-// 1) This will not check whether the severity is high enough. One should use WOULD_LOG to filter
-//    usage manually.
-// 2) This does not save and restore errno.
-#define LOG_STREAM(severity)                                                                    \
-  ::android::base::LogMessage(__FILE__, __LINE__, SEVERITY_LAMBDA(severity), _LOG_TAG_INTERNAL, \
-                              -1)                                                               \
-      .stream()
-
-// Logs a message to logcat on Android otherwise to stderr. If the severity is
-// FATAL it also causes an abort. For example:
-//
-//     LOG(FATAL) << "We didn't expect to reach here";
-#define LOG(severity) LOGGING_PREAMBLE(severity) && LOG_STREAM(severity)
-
-// Checks if we want to log something, and sets up appropriate RAII objects if
-// so.
-// Note: DO NOT USE DIRECTLY. This is an implementation detail.
-#define LOGGING_PREAMBLE(severity)                                                         \
-  (WOULD_LOG(severity) &&                                                                  \
-   ABORT_AFTER_LOG_EXPR_IF((SEVERITY_LAMBDA(severity)) == ::android::base::FATAL, true) && \
-   ::android::base::ErrnoRestorer())
-
-// A variant of LOG that also logs the current errno value. To be used when
-// library calls fail.
-#define PLOG(severity)                                                           \
-  LOGGING_PREAMBLE(severity) &&                                                  \
-      ::android::base::LogMessage(__FILE__, __LINE__, SEVERITY_LAMBDA(severity), \
-                                  _LOG_TAG_INTERNAL, errno)                      \
-          .stream()
-
-// Marker that code is yet to be implemented.
-#define UNIMPLEMENTED(level) \
-  LOG(level) << __PRETTY_FUNCTION__ << " unimplemented "
-
-// Check whether condition x holds and LOG(FATAL) if not. The value of the
-// expression x is only evaluated once. Extra logging can be appended using <<
-// after. For example:
-//
-//     CHECK(false == true) results in a log message of
-//       "Check failed: false == true".
-#define CHECK(x)                                                                                 \
-  LIKELY((x)) || ABORT_AFTER_LOG_FATAL_EXPR(false) ||                                            \
-      ::android::base::LogMessage(__FILE__, __LINE__, ::android::base::FATAL, _LOG_TAG_INTERNAL, \
-                                  -1)                                                            \
-              .stream()                                                                          \
-          << "Check failed: " #x << " "
-
-// clang-format off
-// Helper for CHECK_xx(x,y) macros.
-#define CHECK_OP(LHS, RHS, OP)                                                                   \
-  for (auto _values = ::android::base::MakeEagerEvaluator(LHS, RHS);                             \
-       UNLIKELY(!(_values.lhs OP _values.rhs));                                                  \
-       /* empty */)                                                                              \
-  ABORT_AFTER_LOG_FATAL                                                                          \
-  ::android::base::LogMessage(__FILE__, __LINE__, ::android::base::FATAL, _LOG_TAG_INTERNAL, -1) \
-          .stream()                                                                              \
-      << "Check failed: " << #LHS << " " << #OP << " " << #RHS << " (" #LHS "=" << _values.lhs   \
-      << ", " #RHS "=" << _values.rhs << ") "
-// clang-format on
-
-// Check whether a condition holds between x and y, LOG(FATAL) if not. The value
-// of the expressions x and y is evaluated once. Extra logging can be appended
-// using << after. For example:
-//
-//     CHECK_NE(0 == 1, false) results in
-//       "Check failed: false != false (0==1=false, false=false) ".
-#define CHECK_EQ(x, y) CHECK_OP(x, y, == )
-#define CHECK_NE(x, y) CHECK_OP(x, y, != )
-#define CHECK_LE(x, y) CHECK_OP(x, y, <= )
-#define CHECK_LT(x, y) CHECK_OP(x, y, < )
-#define CHECK_GE(x, y) CHECK_OP(x, y, >= )
-#define CHECK_GT(x, y) CHECK_OP(x, y, > )
-
-// clang-format off
-// Helper for CHECK_STRxx(s1,s2) macros.
-#define CHECK_STROP(s1, s2, sense)                                             \
-  while (UNLIKELY((strcmp(s1, s2) == 0) != (sense)))                           \
-    ABORT_AFTER_LOG_FATAL                                                      \
-    ::android::base::LogMessage(__FILE__, __LINE__,  ::android::base::FATAL,   \
-                                 _LOG_TAG_INTERNAL, -1)                        \
-        .stream()                                                              \
-        << "Check failed: " << "\"" << (s1) << "\""                            \
-        << ((sense) ? " == " : " != ") << "\"" << (s2) << "\""
-// clang-format on
-
-// Check for string (const char*) equality between s1 and s2, LOG(FATAL) if not.
-#define CHECK_STREQ(s1, s2) CHECK_STROP(s1, s2, true)
-#define CHECK_STRNE(s1, s2) CHECK_STROP(s1, s2, false)
-
-// Perform the pthread function call(args), LOG(FATAL) on error.
-#define CHECK_PTHREAD_CALL(call, args, what)                           \
-  do {                                                                 \
-    int rc = call args;                                                \
-    if (rc != 0) {                                                     \
-      errno = rc;                                                      \
-      ABORT_AFTER_LOG_FATAL                                            \
-      PLOG(FATAL) << #call << " failed for " << (what);                \
-    }                                                                  \
-  } while (false)
-
-// CHECK that can be used in a constexpr function. For example:
-//
-//    constexpr int half(int n) {
-//      return
-//          DCHECK_CONSTEXPR(n >= 0, , 0)
-//          CHECK_CONSTEXPR((n & 1) == 0),
-//              << "Extra debugging output: n = " << n, 0)
-//          n / 2;
-//    }
-#define CHECK_CONSTEXPR(x, out, dummy)                                     \
-  (UNLIKELY(!(x)))                                                         \
-      ? (LOG(FATAL) << "Check failed: " << #x out, dummy) \
-      :
-
-// DCHECKs are debug variants of CHECKs only enabled in debug builds. Generally
-// CHECK should be used unless profiling identifies a CHECK as being in
-// performance critical code.
-#if defined(NDEBUG) && !defined(__clang_analyzer__)
-static constexpr bool kEnableDChecks = false;
-#else
-static constexpr bool kEnableDChecks = true;
-#endif
-
-#define DCHECK(x) \
-  if (::android::base::kEnableDChecks) CHECK(x)
-#define DCHECK_EQ(x, y) \
-  if (::android::base::kEnableDChecks) CHECK_EQ(x, y)
-#define DCHECK_NE(x, y) \
-  if (::android::base::kEnableDChecks) CHECK_NE(x, y)
-#define DCHECK_LE(x, y) \
-  if (::android::base::kEnableDChecks) CHECK_LE(x, y)
-#define DCHECK_LT(x, y) \
-  if (::android::base::kEnableDChecks) CHECK_LT(x, y)
-#define DCHECK_GE(x, y) \
-  if (::android::base::kEnableDChecks) CHECK_GE(x, y)
-#define DCHECK_GT(x, y) \
-  if (::android::base::kEnableDChecks) CHECK_GT(x, y)
-#define DCHECK_STREQ(s1, s2) \
-  if (::android::base::kEnableDChecks) CHECK_STREQ(s1, s2)
-#define DCHECK_STRNE(s1, s2) \
-  if (::android::base::kEnableDChecks) CHECK_STRNE(s1, s2)
-#if defined(NDEBUG) && !defined(__clang_analyzer__)
-#define DCHECK_CONSTEXPR(x, out, dummy)
-#else
-#define DCHECK_CONSTEXPR(x, out, dummy) CHECK_CONSTEXPR(x, out, dummy)
-#endif
-
-// Temporary class created to evaluate the LHS and RHS, used with
-// MakeEagerEvaluator to infer the types of LHS and RHS.
-template <typename LHS, typename RHS>
-struct EagerEvaluator {
-  constexpr EagerEvaluator(LHS l, RHS r) : lhs(l), rhs(r) {
-  }
-  LHS lhs;
-  RHS rhs;
-};
-
-// Helper function for CHECK_xx.
-template <typename LHS, typename RHS>
-constexpr EagerEvaluator<LHS, RHS> MakeEagerEvaluator(LHS lhs, RHS rhs) {
-  return EagerEvaluator<LHS, RHS>(lhs, rhs);
-}
-
-// Explicitly instantiate EagerEvalue for pointers so that char*s aren't treated
-// as strings. To compare strings use CHECK_STREQ and CHECK_STRNE. We rely on
-// signed/unsigned warnings to protect you against combinations not explicitly
-// listed below.
-#define EAGER_PTR_EVALUATOR(T1, T2)               \
-  template <>                                     \
-  struct EagerEvaluator<T1, T2> {                 \
-    EagerEvaluator(T1 l, T2 r)                    \
-        : lhs(reinterpret_cast<const void*>(l)),  \
-          rhs(reinterpret_cast<const void*>(r)) { \
-    }                                             \
-    const void* lhs;                              \
-    const void* rhs;                              \
-  }
-EAGER_PTR_EVALUATOR(const char*, const char*);
-EAGER_PTR_EVALUATOR(const char*, char*);
-EAGER_PTR_EVALUATOR(char*, const char*);
-EAGER_PTR_EVALUATOR(char*, char*);
-EAGER_PTR_EVALUATOR(const unsigned char*, const unsigned char*);
-EAGER_PTR_EVALUATOR(const unsigned char*, unsigned char*);
-EAGER_PTR_EVALUATOR(unsigned char*, const unsigned char*);
-EAGER_PTR_EVALUATOR(unsigned char*, unsigned char*);
-EAGER_PTR_EVALUATOR(const signed char*, const signed char*);
-EAGER_PTR_EVALUATOR(const signed char*, signed char*);
-EAGER_PTR_EVALUATOR(signed char*, const signed char*);
-EAGER_PTR_EVALUATOR(signed char*, signed char*);
-
-// Data for the log message, not stored in LogMessage to avoid increasing the
-// stack size.
-class LogMessageData;
-
-// A LogMessage is a temporarily scoped object used by LOG and the unlikely part
-// of a CHECK. The destructor will abort if the severity is FATAL.
-class LogMessage {
- public:
-  // LogId has been deprecated, but this constructor must exist for prebuilts.
-  LogMessage(const char* file, unsigned int line, LogId, LogSeverity severity, const char* tag,
-             int error);
-  LogMessage(const char* file, unsigned int line, LogSeverity severity, const char* tag, int error);
-
-  ~LogMessage();
-
-  // Returns the stream associated with the message, the LogMessage performs
-  // output when it goes out of scope.
-  std::ostream& stream();
-
-  // The routine that performs the actual logging.
-  static void LogLine(const char* file, unsigned int line, LogSeverity severity, const char* tag,
-                      const char* msg);
-
- private:
-  const std::unique_ptr<LogMessageData> data_;
-
-  DISALLOW_COPY_AND_ASSIGN(LogMessage);
-};
-
-// Get the minimum severity level for logging.
-LogSeverity GetMinimumLogSeverity();
-
-// Set the minimum severity level for logging, returning the old severity.
-LogSeverity SetMinimumLogSeverity(LogSeverity new_severity);
-
-// Return whether or not a log message with the associated tag should be logged.
-bool ShouldLog(LogSeverity severity, const char* tag);
-
-// Allows to temporarily change the minimum severity level for logging.
-class ScopedLogSeverity {
- public:
-  explicit ScopedLogSeverity(LogSeverity level);
-  ~ScopedLogSeverity();
-
- private:
-  LogSeverity old_;
-};
-
-}  // namespace base
-}  // namespace android
-
-namespace std {  // NOLINT(cert-dcl58-cpp)
-
-// Emit a warning of ostream<< with std::string*. The intention was most likely to print *string.
-//
-// Note: for this to work, we need to have this in a namespace.
-// Note: using a pragma because "-Wgcc-compat" (included in "-Weverything") complains about
-//       diagnose_if.
-// Note: to print the pointer, use "<< static_cast<const void*>(string_pointer)" instead.
-// Note: a not-recommended alternative is to let Clang ignore the warning by adding
-//       -Wno-user-defined-warnings to CPPFLAGS.
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgcc-compat"
-#define OSTREAM_STRING_POINTER_USAGE_WARNING \
-    __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning")))
-inline OSTREAM_STRING_POINTER_USAGE_WARNING
-std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) {
-  return stream << static_cast<const void*>(string_pointer);
-}
-#pragma clang diagnostic pop
-
-}  // namespace std
diff --git a/base/include/android-base/macros.h b/base/include/android-base/macros.h
deleted file mode 100644
index 5abf514..0000000
--- a/base/include/android-base/macros.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <stddef.h>  // for size_t
-#include <unistd.h>  // for TEMP_FAILURE_RETRY
-
-#include <utility>
-
-// bionic and glibc both have TEMP_FAILURE_RETRY, but eg Mac OS' libc doesn't.
-#ifndef TEMP_FAILURE_RETRY
-#define TEMP_FAILURE_RETRY(exp)            \
-  ({                                       \
-    decltype(exp) _rc;                     \
-    do {                                   \
-      _rc = (exp);                         \
-    } while (_rc == -1 && errno == EINTR); \
-    _rc;                                   \
-  })
-#endif
-
-// A macro to disallow the copy constructor and operator= functions
-// This must be placed in the private: declarations for a class.
-//
-// For disallowing only assign or copy, delete the relevant operator or
-// constructor, for example:
-// void operator=(const TypeName&) = delete;
-// Note, that most uses of DISALLOW_ASSIGN and DISALLOW_COPY are broken
-// semantically, one should either use disallow both or neither. Try to
-// avoid these in new code.
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&) = delete;      \
-  void operator=(const TypeName&) = delete
-
-// A macro to disallow all the implicit constructors, namely the
-// default constructor, copy constructor and operator= functions.
-//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
-#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
-  TypeName() = delete;                           \
-  DISALLOW_COPY_AND_ASSIGN(TypeName)
-
-// The arraysize(arr) macro returns the # of elements in an array arr.
-// The expression is a compile-time constant, and therefore can be
-// used in defining new arrays, for example.  If you use arraysize on
-// a pointer by mistake, you will get a compile-time error.
-//
-// One caveat is that arraysize() doesn't accept any array of an
-// anonymous type or a type defined inside a function.  In these rare
-// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below.  This is
-// due to a limitation in C++'s template system.  The limitation might
-// eventually be removed, but it hasn't happened yet.
-
-// This template function declaration is used in defining arraysize.
-// Note that the function doesn't need an implementation, as we only
-// use its type.
-template <typename T, size_t N>
-char(&ArraySizeHelper(T(&array)[N]))[N];  // NOLINT(readability/casting)
-
-#define arraysize(array) (sizeof(ArraySizeHelper(array)))
-
-#define SIZEOF_MEMBER(t, f) sizeof(std::declval<t>().f)
-
-// Changing this definition will cause you a lot of pain.  A majority of
-// vendor code defines LIKELY and UNLIKELY this way, and includes
-// this header through an indirect path.
-#define LIKELY( exp )       (__builtin_expect( (exp) != 0, true  ))
-#define UNLIKELY( exp )     (__builtin_expect( (exp) != 0, false ))
-
-#define WARN_UNUSED __attribute__((warn_unused_result))
-
-// A deprecated function to call to create a false use of the parameter, for
-// example:
-//   int foo(int x) { UNUSED(x); return 10; }
-// to avoid compiler warnings. Going forward we prefer ATTRIBUTE_UNUSED.
-template <typename... T>
-void UNUSED(const T&...) {
-}
-
-// An attribute to place on a parameter to a function, for example:
-//   int foo(int x ATTRIBUTE_UNUSED) { return 10; }
-// to avoid compiler warnings.
-#define ATTRIBUTE_UNUSED __attribute__((__unused__))
-
-// The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through
-// between switch labels:
-//  switch (x) {
-//    case 40:
-//    case 41:
-//      if (truth_is_out_there) {
-//        ++x;
-//        FALLTHROUGH_INTENDED;  // Use instead of/along with annotations in
-//                               // comments.
-//      } else {
-//        return x;
-//      }
-//    case 42:
-//      ...
-//
-// As shown in the example above, the FALLTHROUGH_INTENDED macro should be
-// followed by a semicolon. It is designed to mimic control-flow statements
-// like 'break;', so it can be placed in most places where 'break;' can, but
-// only if there are no statements on the execution path between it and the
-// next switch label.
-//
-// When compiled with clang, the FALLTHROUGH_INTENDED macro is expanded to
-// [[clang::fallthrough]] attribute, which is analysed when performing switch
-// labels fall-through diagnostic ('-Wimplicit-fallthrough'). See clang
-// documentation on language extensions for details:
-// http://clang.llvm.org/docs/LanguageExtensions.html#clang__fallthrough
-//
-// When used with unsupported compilers, the FALLTHROUGH_INTENDED macro has no
-// effect on diagnostics.
-//
-// In either case this macro has no effect on runtime behavior and performance
-// of code.
-#ifndef FALLTHROUGH_INTENDED
-#define FALLTHROUGH_INTENDED [[clang::fallthrough]]  // NOLINT
-#endif
-
-// Current ABI string
-#if defined(__arm__)
-#define ABI_STRING "arm"
-#elif defined(__aarch64__)
-#define ABI_STRING "arm64"
-#elif defined(__i386__)
-#define ABI_STRING "x86"
-#elif defined(__x86_64__)
-#define ABI_STRING "x86_64"
-#elif defined(__mips__) && !defined(__LP64__)
-#define ABI_STRING "mips"
-#elif defined(__mips__) && defined(__LP64__)
-#define ABI_STRING "mips64"
-#endif
diff --git a/base/include/android-base/mapped_file.h b/base/include/android-base/mapped_file.h
deleted file mode 100644
index 8c37f43..0000000
--- a/base/include/android-base/mapped_file.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <sys/types.h>
-
-#include <memory>
-
-#include "android-base/macros.h"
-#include "android-base/off64_t.h"
-#include "android-base/unique_fd.h"
-
-#if defined(_WIN32)
-#include <windows.h>
-#define PROT_READ 1
-#define PROT_WRITE 2
-using os_handle = HANDLE;
-#else
-#include <sys/mman.h>
-using os_handle = int;
-#endif
-
-namespace android {
-namespace base {
-
-/**
- * A region of a file mapped into memory (for grepping: also known as MmapFile or file mapping).
- */
-class MappedFile {
- public:
-  /**
-   * Creates a new mapping of the file pointed to by `fd`. Unlike the underlying OS primitives,
-   * `offset` does not need to be page-aligned. If `PROT_WRITE` is set in `prot`, the mapping
-   * will be writable, otherwise it will be read-only. Mappings are always `MAP_SHARED`.
-   */
-  static std::unique_ptr<MappedFile> FromFd(borrowed_fd fd, off64_t offset, size_t length,
-                                            int prot);
-
-  /**
-   * Same thing, but using the raw OS file handle instead of a CRT wrapper.
-   */
-  static std::unique_ptr<MappedFile> FromOsHandle(os_handle h, off64_t offset, size_t length,
-                                                  int prot);
-
-  /**
-   * Removes the mapping.
-   */
-  ~MappedFile();
-
-  /**
-   * Not copyable but movable.
-   */
-  MappedFile(MappedFile&& other);
-  MappedFile& operator=(MappedFile&& other);
-
-  char* data() const { return base_ + offset_; }
-  size_t size() const { return size_; }
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(MappedFile);
-
-  void Close();
-
-  char* base_;
-  size_t size_;
-
-  size_t offset_;
-
-#if defined(_WIN32)
-  MappedFile(char* base, size_t size, size_t offset, HANDLE handle)
-      : base_(base), size_(size), offset_(offset), handle_(handle) {}
-  HANDLE handle_;
-#else
-  MappedFile(char* base, size_t size, size_t offset) : base_(base), size_(size), offset_(offset) {}
-#endif
-};
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/memory.h b/base/include/android-base/memory.h
deleted file mode 100644
index 0277a03..0000000
--- a/base/include/android-base/memory.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-namespace android {
-namespace base {
-
-// Use memcpy for access to unaligned data on targets with alignment
-// restrictions.  The compiler will generate appropriate code to access these
-// structures without generating alignment exceptions.
-template <typename T>
-static inline T get_unaligned(const void* address) {
-  T result;
-  memcpy(&result, address, sizeof(T));
-  return result;
-}
-
-template <typename T>
-static inline void put_unaligned(void* address, T v) {
-  memcpy(address, &v, sizeof(T));
-}
-
-} // namespace base
-} // namespace android
diff --git a/base/include/android-base/no_destructor.h b/base/include/android-base/no_destructor.h
deleted file mode 100644
index ce0dc9f..0000000
--- a/base/include/android-base/no_destructor.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <utility>
-
-#include "android-base/macros.h"
-
-namespace android {
-namespace base {
-
-// A wrapper that makes it easy to create an object of type T with static
-// storage duration that:
-// - is only constructed on first access
-// - never invokes the destructor
-// in order to satisfy the styleguide ban on global constructors and
-// destructors.
-//
-// Runtime constant example:
-// const std::string& GetLineSeparator() {
-//  // Forwards to std::string(size_t, char, const Allocator&) constructor.
-//   static const base::NoDestructor<std::string> s(5, '-');
-//   return *s;
-// }
-//
-// More complex initialization with a lambda:
-// const std::string& GetSessionNonce() {
-//   static const base::NoDestructor<std::string> nonce([] {
-//     std::string s(16);
-//     crypto::RandString(s.data(), s.size());
-//     return s;
-//   }());
-//   return *nonce;
-// }
-//
-// NoDestructor<T> stores the object inline, so it also avoids a pointer
-// indirection and a malloc. Also note that since C++11 static local variable
-// initialization is thread-safe and so is this pattern. Code should prefer to
-// use NoDestructor<T> over:
-// - A function scoped static T* or T& that is dynamically initialized.
-// - A global base::LazyInstance<T>.
-//
-// Note that since the destructor is never run, this *will* leak memory if used
-// as a stack or member variable. Furthermore, a NoDestructor<T> should never
-// have global scope as that may require a static initializer.
-template <typename T>
-class NoDestructor {
- public:
-  // Not constexpr; just write static constexpr T x = ...; if the value should
-  // be a constexpr.
-  template <typename... Args>
-  explicit NoDestructor(Args&&... args) {
-    new (storage_) T(std::forward<Args>(args)...);
-  }
-
-  // Allows copy and move construction of the contained type, to allow
-  // construction from an initializer list, e.g. for std::vector.
-  explicit NoDestructor(const T& x) { new (storage_) T(x); }
-  explicit NoDestructor(T&& x) { new (storage_) T(std::move(x)); }
-
-  NoDestructor(const NoDestructor&) = delete;
-  NoDestructor& operator=(const NoDestructor&) = delete;
-
-  ~NoDestructor() = default;
-
-  const T& operator*() const { return *get(); }
-  T& operator*() { return *get(); }
-
-  const T* operator->() const { return get(); }
-  T* operator->() { return get(); }
-
-  const T* get() const { return reinterpret_cast<const T*>(storage_); }
-  T* get() { return reinterpret_cast<T*>(storage_); }
-
- private:
-  alignas(T) char storage_[sizeof(T)];
-};
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/off64_t.h b/base/include/android-base/off64_t.h
deleted file mode 100644
index e6b71b8..0000000
--- a/base/include/android-base/off64_t.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#if defined(__APPLE__)
-/** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
-typedef off_t off64_t;
-#endif
diff --git a/base/include/android-base/parsebool.h b/base/include/android-base/parsebool.h
deleted file mode 100644
index b2bd021..0000000
--- a/base/include/android-base/parsebool.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <string_view>
-
-namespace android {
-namespace base {
-
-// Parse the given string as yes or no inactivation of some sort. Return one of the
-// ParseBoolResult enumeration values.
-//
-// The following values parse as true:
-//
-//   1
-//   on
-//   true
-//   y
-//   yes
-//
-//
-// The following values parse as false:
-//
-//   0
-//   false
-//   n
-//   no
-//   off
-//
-// Anything else is a parse error.
-//
-// The purpose of this function is to have a single canonical parser for yes-or-no indications
-// throughout the system.
-
-enum class ParseBoolResult {
-  kError,
-  kFalse,
-  kTrue,
-};
-
-ParseBoolResult ParseBool(std::string_view s);
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/parsedouble.h b/base/include/android-base/parsedouble.h
deleted file mode 100644
index ccffba2..0000000
--- a/base/include/android-base/parsedouble.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <limits>
-#include <string>
-
-namespace android {
-namespace base {
-
-// Parse floating value in the string 's' and sets 'out' to that value if it exists.
-// Optionally allows the caller to define a 'min' and 'max' beyond which
-// otherwise valid values will be rejected. Returns boolean success.
-template <typename T, T (*strtox)(const char* str, char** endptr)>
-static inline bool ParseFloatingPoint(const char* s, T* out, T min, T max) {
-  errno = 0;
-  char* end;
-  T result = strtox(s, &end);
-  if (errno != 0 || s == end || *end != '\0') {
-    return false;
-  }
-  if (result < min || max < result) {
-    return false;
-  }
-  if (out != nullptr) {
-    *out = result;
-  }
-  return true;
-}
-
-// Parse double value in the string 's' and sets 'out' to that value if it exists.
-// Optionally allows the caller to define a 'min' and 'max' beyond which
-// otherwise valid values will be rejected. Returns boolean success.
-static inline bool ParseDouble(const char* s, double* out,
-                               double min = std::numeric_limits<double>::lowest(),
-                               double max = std::numeric_limits<double>::max()) {
-  return ParseFloatingPoint<double, strtod>(s, out, min, max);
-}
-static inline bool ParseDouble(const std::string& s, double* out,
-                               double min = std::numeric_limits<double>::lowest(),
-                               double max = std::numeric_limits<double>::max()) {
-  return ParseFloatingPoint<double, strtod>(s.c_str(), out, min, max);
-}
-
-// Parse float value in the string 's' and sets 'out' to that value if it exists.
-// Optionally allows the caller to define a 'min' and 'max' beyond which
-// otherwise valid values will be rejected. Returns boolean success.
-static inline bool ParseFloat(const char* s, float* out,
-                              float min = std::numeric_limits<float>::lowest(),
-                              float max = std::numeric_limits<float>::max()) {
-  return ParseFloatingPoint<float, strtof>(s, out, min, max);
-}
-static inline bool ParseFloat(const std::string& s, float* out,
-                              float min = std::numeric_limits<float>::lowest(),
-                              float max = std::numeric_limits<float>::max()) {
-  return ParseFloatingPoint<float, strtof>(s.c_str(), out, min, max);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/parseint.h b/base/include/android-base/parseint.h
deleted file mode 100644
index be8b97b..0000000
--- a/base/include/android-base/parseint.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <limits>
-#include <string>
-#include <type_traits>
-
-namespace android {
-namespace base {
-
-// Parses the unsigned decimal or hexadecimal integer in the string 's' and sets
-// 'out' to that value if it is specified. Optionally allows the caller to define
-// a 'max' beyond which otherwise valid values will be rejected. Returns boolean
-// success; 'out' is untouched if parsing fails.
-template <typename T>
-bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(),
-               bool allow_suffixes = false) {
-  static_assert(std::is_unsigned<T>::value, "ParseUint can only be used with unsigned types");
-  while (isspace(*s)) {
-    s++;
-  }
-
-  if (s[0] == '-') {
-    errno = EINVAL;
-    return false;
-  }
-
-  int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
-  errno = 0;
-  char* end;
-  unsigned long long int result = strtoull(s, &end, base);
-  if (errno != 0) return false;
-  if (end == s) {
-    errno = EINVAL;
-    return false;
-  }
-  if (*end != '\0') {
-    const char* suffixes = "bkmgtpe";
-    const char* suffix;
-    if ((!allow_suffixes || (suffix = strchr(suffixes, tolower(*end))) == nullptr) ||
-        __builtin_mul_overflow(result, 1ULL << (10 * (suffix - suffixes)), &result)) {
-      errno = EINVAL;
-      return false;
-    }
-  }
-  if (max < result) {
-    errno = ERANGE;
-    return false;
-  }
-  if (out != nullptr) {
-    *out = static_cast<T>(result);
-  }
-  return true;
-}
-
-// TODO: string_view
-template <typename T>
-bool ParseUint(const std::string& s, T* out, T max = std::numeric_limits<T>::max(),
-               bool allow_suffixes = false) {
-  return ParseUint(s.c_str(), out, max, allow_suffixes);
-}
-
-template <typename T>
-bool ParseByteCount(const char* s, T* out, T max = std::numeric_limits<T>::max()) {
-  return ParseUint(s, out, max, true);
-}
-
-// TODO: string_view
-template <typename T>
-bool ParseByteCount(const std::string& s, T* out, T max = std::numeric_limits<T>::max()) {
-  return ParseByteCount(s.c_str(), out, max);
-}
-
-// Parses the signed decimal or hexadecimal integer in the string 's' and sets
-// 'out' to that value if it is specified. Optionally allows the caller to define
-// a 'min' and 'max' beyond which otherwise valid values will be rejected. Returns
-// boolean success; 'out' is untouched if parsing fails.
-template <typename T>
-bool ParseInt(const char* s, T* out,
-              T min = std::numeric_limits<T>::min(),
-              T max = std::numeric_limits<T>::max()) {
-  static_assert(std::is_signed<T>::value, "ParseInt can only be used with signed types");
-  while (isspace(*s)) {
-    s++;
-  }
-
-  int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
-  errno = 0;
-  char* end;
-  long long int result = strtoll(s, &end, base);
-  if (errno != 0) {
-    return false;
-  }
-  if (s == end || *end != '\0') {
-    errno = EINVAL;
-    return false;
-  }
-  if (result < min || max < result) {
-    errno = ERANGE;
-    return false;
-  }
-  if (out != nullptr) {
-    *out = static_cast<T>(result);
-  }
-  return true;
-}
-
-// TODO: string_view
-template <typename T>
-bool ParseInt(const std::string& s, T* out,
-              T min = std::numeric_limits<T>::min(),
-              T max = std::numeric_limits<T>::max()) {
-  return ParseInt(s.c_str(), out, min, max);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/parsenetaddress.h b/base/include/android-base/parsenetaddress.h
deleted file mode 100644
index 47f8b5f..0000000
--- a/base/include/android-base/parsenetaddress.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <string>
-
-namespace android {
-namespace base {
-
-// Parses |address| into |host| and |port|.
-//
-// If |address| doesn't contain a port number, the default value is taken from
-// |port|. If |canonical_address| is non-null it will be set to "host:port" or
-// "[host]:port" as appropriate.
-//
-// On failure, returns false and fills |error|.
-bool ParseNetAddress(const std::string& address, std::string* host, int* port,
-                     std::string* canonical_address, std::string* error);
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/process.h b/base/include/android-base/process.h
deleted file mode 100644
index 69ed3fb..0000000
--- a/base/include/android-base/process.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <dirent.h>
-#include <sys/types.h>
-
-#include <iterator>
-#include <memory>
-#include <vector>
-
-namespace android {
-namespace base {
-
-class AllPids {
-  class PidIterator {
-   public:
-    PidIterator(DIR* dir) : dir_(dir, closedir) { Increment(); }
-    PidIterator& operator++() {
-      Increment();
-      return *this;
-    }
-    bool operator==(const PidIterator& other) const { return pid_ == other.pid_; }
-    bool operator!=(const PidIterator& other) const { return !(*this == other); }
-    long operator*() const { return pid_; }
-    // iterator traits
-    using difference_type = pid_t;
-    using value_type = pid_t;
-    using pointer = const pid_t*;
-    using reference = const pid_t&;
-    using iterator_category = std::input_iterator_tag;
-
-   private:
-    void Increment();
-
-    pid_t pid_ = -1;
-    std::unique_ptr<DIR, decltype(&closedir)> dir_;
-  };
-
- public:
-  PidIterator begin() { return opendir("/proc"); }
-  PidIterator end() { return nullptr; }
-};
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/properties.h b/base/include/android-base/properties.h
deleted file mode 100644
index 49f1f31..0000000
--- a/base/include/android-base/properties.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-
-#include <chrono>
-#include <limits>
-#include <optional>
-#include <string>
-
-struct prop_info;
-
-namespace android {
-namespace base {
-
-// Returns the current value of the system property `key`,
-// or `default_value` if the property is empty or doesn't exist.
-std::string GetProperty(const std::string& key, const std::string& default_value);
-
-// Returns true if the system property `key` has the value "1", "y", "yes", "on", or "true",
-// false for "0", "n", "no", "off", or "false", or `default_value` otherwise.
-bool GetBoolProperty(const std::string& key, bool default_value);
-
-// Returns the signed integer corresponding to the system property `key`.
-// If the property is empty, doesn't exist, doesn't have an integer value, or is outside
-// the optional bounds, returns `default_value`.
-template <typename T> T GetIntProperty(const std::string& key,
-                                       T default_value,
-                                       T min = std::numeric_limits<T>::min(),
-                                       T max = std::numeric_limits<T>::max());
-
-// Returns the unsigned integer corresponding to the system property `key`.
-// If the property is empty, doesn't exist, doesn't have an integer value, or is outside
-// the optional bound, returns `default_value`.
-template <typename T> T GetUintProperty(const std::string& key,
-                                        T default_value,
-                                        T max = std::numeric_limits<T>::max());
-
-// Sets the system property `key` to `value`.
-bool SetProperty(const std::string& key, const std::string& value);
-
-// Waits for the system property `key` to have the value `expected_value`.
-// Times out after `relative_timeout`.
-// Returns true on success, false on timeout.
-#if defined(__BIONIC__)
-bool WaitForProperty(const std::string& key, const std::string& expected_value,
-                     std::chrono::milliseconds relative_timeout = std::chrono::milliseconds::max());
-#endif
-
-// Waits for the system property `key` to be created.
-// Times out after `relative_timeout`.
-// Returns true on success, false on timeout.
-#if defined(__BIONIC__)
-bool WaitForPropertyCreation(const std::string& key, std::chrono::milliseconds relative_timeout =
-                                                         std::chrono::milliseconds::max());
-#endif
-
-#if defined(__BIONIC__) && __cplusplus >= 201703L
-// Cached system property lookup. For code that needs to read the same property multiple times,
-// this class helps optimize those lookups.
-class CachedProperty {
- public:
-  explicit CachedProperty(const char* property_name);
-
-  // Returns the current value of the underlying system property as cheaply as possible.
-  // The returned pointer is valid until the next call to Get. Because most callers are going
-  // to want to parse the string returned here and cached that as well, this function performs
-  // no locking, and is completely thread unsafe. It is the caller's responsibility to provide a
-  // lock for thread-safety.
-  //
-  // Note: *changed can be set to true even if the contents of the property remain the same.
-  const char* Get(bool* changed = nullptr);
-
- private:
-  std::string property_name_;
-  const prop_info* prop_info_;
-  std::optional<uint32_t> cached_area_serial_;
-  std::optional<uint32_t> cached_property_serial_;
-  char cached_value_[92];
-  bool is_read_only_;
-  const char* read_only_property_;
-};
-#endif
-
-} // namespace base
-} // namespace android
diff --git a/base/include/android-base/result.h b/base/include/android-base/result.h
deleted file mode 100644
index 56a4f3e..0000000
--- a/base/include/android-base/result.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-// This file contains classes for returning a successful result along with an optional
-// arbitrarily typed return value or for returning a failure result along with an optional string
-// indicating why the function failed.
-
-// There are 3 classes that implement this functionality and one additional helper type.
-//
-// Result<T> either contains a member of type T that can be accessed using similar semantics as
-// std::optional<T> or it contains a ResultError describing an error, which can be accessed via
-// Result<T>::error().
-//
-// ResultError is a type that contains both a std::string describing the error and a copy of errno
-// from when the error occurred.  ResultError can be used in an ostream directly to print its
-// string value.
-//
-// Result<void> is the correct return type for a function that either returns successfully or
-// returns an error value.  Returning {} from a function that returns Result<void> is the
-// correct way to indicate that a function without a return type has completed successfully.
-//
-// A successful Result<T> is constructed implicitly from any type that can be implicitly converted
-// to T or from the constructor arguments for T.  This allows you to return a type T directly from
-// a function that returns Result<T>.
-//
-// Error and ErrnoError are used to construct a Result<T> that has failed.  The Error class takes
-// an ostream as an input and are implicitly cast to a Result<T> containing that failure.
-// ErrnoError() is a helper function to create an Error class that appends ": " + strerror(errno)
-// to the end of the failure string to aid in interacting with C APIs.  Alternatively, an errno
-// value can be directly specified via the Error() constructor.
-//
-// Errorf and ErrnoErrorf accept the format string syntax of the fmblib (https://fmt.dev).
-// Errorf("{} errors", num) is equivalent to Error() << num << " errors".
-//
-// ResultError can be used in the ostream and when using Error/Errorf to construct a Result<T>.
-// In this case, the string that the ResultError takes is passed through the stream normally, but
-// the errno is passed to the Result<T>. This can be used to pass errno from a failing C function up
-// multiple callers. Note that when the outer Result<T> is created with ErrnoError/ErrnoErrorf then
-// the errno from the inner ResultError is not passed. Also when multiple ResultError objects are
-// used, the errno of the last one is respected.
-//
-// ResultError can also directly construct a Result<T>.  This is particularly useful if you have a
-// function that return Result<T> but you have a Result<U> and want to return its error.  In this
-// case, you can return the .error() from the Result<U> to construct the Result<T>.
-
-// An example of how to use these is below:
-// Result<U> CalculateResult(const T& input) {
-//   U output;
-//   if (!SomeOtherCppFunction(input, &output)) {
-//     return Errorf("SomeOtherCppFunction {} failed", input);
-//   }
-//   if (!c_api_function(output)) {
-//     return ErrnoErrorf("c_api_function {} failed", output);
-//   }
-//   return output;
-// }
-//
-// auto output = CalculateResult(input);
-// if (!output) return Error() << "CalculateResult failed: " << output.error();
-// UseOutput(*output);
-
-#pragma once
-
-#include <errno.h>
-
-#include <sstream>
-#include <string>
-
-#include "android-base/expected.h"
-#include "android-base/format.h"
-
-namespace android {
-namespace base {
-
-struct ResultError {
-  template <typename T>
-  ResultError(T&& message, int code) : message_(std::forward<T>(message)), code_(code) {}
-
-  template <typename T>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  operator android::base::expected<T, ResultError>() {
-    return android::base::unexpected(ResultError(message_, code_));
-  }
-
-  std::string message() const { return message_; }
-  int code() const { return code_; }
-
- private:
-  std::string message_;
-  int code_;
-};
-
-inline bool operator==(const ResultError& lhs, const ResultError& rhs) {
-  return lhs.message() == rhs.message() && lhs.code() == rhs.code();
-}
-
-inline bool operator!=(const ResultError& lhs, const ResultError& rhs) {
-  return !(lhs == rhs);
-}
-
-inline std::ostream& operator<<(std::ostream& os, const ResultError& t) {
-  os << t.message();
-  return os;
-}
-
-class Error {
- public:
-  Error() : errno_(0), append_errno_(false) {}
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  Error(int errno_to_append) : errno_(errno_to_append), append_errno_(true) {}
-
-  template <typename T>
-  // NOLINTNEXTLINE(google-explicit-constructor)
-  operator android::base::expected<T, ResultError>() {
-    return android::base::unexpected(ResultError(str(), errno_));
-  }
-
-  template <typename T>
-  Error& operator<<(T&& t) {
-    // NOLINTNEXTLINE(bugprone-suspicious-semicolon)
-    if constexpr (std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, ResultError>) {
-      errno_ = t.code();
-      return (*this) << t.message();
-    }
-    int saved = errno;
-    ss_ << t;
-    errno = saved;
-    return *this;
-  }
-
-  const std::string str() const {
-    std::string str = ss_.str();
-    if (append_errno_) {
-      if (str.empty()) {
-        return strerror(errno_);
-      }
-      return std::move(str) + ": " + strerror(errno_);
-    }
-    return str;
-  }
-
-  Error(const Error&) = delete;
-  Error(Error&&) = delete;
-  Error& operator=(const Error&) = delete;
-  Error& operator=(Error&&) = delete;
-
-  template <typename T, typename... Args>
-  friend Error ErrorfImpl(const T&& fmt, const Args&... args);
-
-  template <typename T, typename... Args>
-  friend Error ErrnoErrorfImpl(const T&& fmt, const Args&... args);
-
- private:
-  Error(bool append_errno, int errno_to_append, const std::string& message)
-      : errno_(errno_to_append), append_errno_(append_errno) {
-    (*this) << message;
-  }
-
-  std::stringstream ss_;
-  int errno_;
-  const bool append_errno_;
-};
-
-inline Error ErrnoError() {
-  return Error(errno);
-}
-
-inline int ErrorCode(int code) {
-  return code;
-}
-
-// Return the error code of the last ResultError object, if any.
-// Otherwise, return `code` as it is.
-template <typename T, typename... Args>
-inline int ErrorCode(int code, T&& t, const Args&... args) {
-  if constexpr (std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, ResultError>) {
-    return ErrorCode(t.code(), args...);
-  }
-  return ErrorCode(code, args...);
-}
-
-template <typename T, typename... Args>
-inline Error ErrorfImpl(const T&& fmt, const Args&... args) {
-  return Error(false, ErrorCode(0, args...), fmt::format(fmt, args...));
-}
-
-template <typename T, typename... Args>
-inline Error ErrnoErrorfImpl(const T&& fmt, const Args&... args) {
-  return Error(true, errno, fmt::format(fmt, args...));
-}
-
-#define Errorf(fmt, ...) android::base::ErrorfImpl(FMT_STRING(fmt), ##__VA_ARGS__)
-#define ErrnoErrorf(fmt, ...) android::base::ErrnoErrorfImpl(FMT_STRING(fmt), ##__VA_ARGS__)
-
-template <typename T>
-using Result = android::base::expected<T, ResultError>;
-
-// Macros for testing the results of functions that return android::base::Result.
-// These also work with base::android::expected.
-
-#define CHECK_RESULT_OK(stmt)       \
-  do {                              \
-    const auto& tmp = (stmt);       \
-    CHECK(tmp.ok()) << tmp.error(); \
-  } while (0)
-
-#define ASSERT_RESULT_OK(stmt)            \
-  do {                                    \
-    const auto& tmp = (stmt);             \
-    ASSERT_TRUE(tmp.ok()) << tmp.error(); \
-  } while (0)
-
-#define EXPECT_RESULT_OK(stmt)            \
-  do {                                    \
-    auto tmp = (stmt);                    \
-    EXPECT_TRUE(tmp.ok()) << tmp.error(); \
-  } while (0)
-
-// TODO: Maybe add RETURN_IF_ERROR() and ASSIGN_OR_RETURN()
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/scopeguard.h b/base/include/android-base/scopeguard.h
deleted file mode 100644
index 5a224d6..0000000
--- a/base/include/android-base/scopeguard.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#pragma once
-
-#include <utility>  // for std::move, std::forward
-
-namespace android {
-namespace base {
-
-// ScopeGuard ensures that the specified functor is executed no matter how the
-// current scope exits.
-template <typename F>
-class ScopeGuard {
- public:
-  ScopeGuard(F&& f) : f_(std::forward<F>(f)), active_(true) {}
-
-  ScopeGuard(ScopeGuard&& that) noexcept : f_(std::move(that.f_)), active_(that.active_) {
-    that.active_ = false;
-  }
-
-  template <typename Functor>
-  ScopeGuard(ScopeGuard<Functor>&& that) : f_(std::move(that.f_)), active_(that.active_) {
-    that.active_ = false;
-  }
-
-  ~ScopeGuard() {
-    if (active_) f_();
-  }
-
-  ScopeGuard() = delete;
-  ScopeGuard(const ScopeGuard&) = delete;
-  void operator=(const ScopeGuard&) = delete;
-  void operator=(ScopeGuard&& that) = delete;
-
-  void Disable() { active_ = false; }
-
-  bool active() const { return active_; }
-
- private:
-  template <typename Functor>
-  friend class ScopeGuard;
-
-  F f_;
-  bool active_;
-};
-
-template <typename F>
-ScopeGuard<F> make_scope_guard(F&& f) {
-  return ScopeGuard<F>(std::forward<F>(f));
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/stringprintf.h b/base/include/android-base/stringprintf.h
deleted file mode 100644
index 93c56af..0000000
--- a/base/include/android-base/stringprintf.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#pragma once
-
-#include <stdarg.h>
-#include <string>
-
-namespace android {
-namespace base {
-
-// These printf-like functions are implemented in terms of vsnprintf, so they
-// use the same attribute for compile-time format string checking.
-
-// Returns a string corresponding to printf-like formatting of the arguments.
-std::string StringPrintf(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
-
-// Appends a printf-like formatting of the arguments to 'dst'.
-void StringAppendF(std::string* dst, const char* fmt, ...)
-    __attribute__((__format__(__printf__, 2, 3)));
-
-// Appends a printf-like formatting of the arguments to 'dst'.
-void StringAppendV(std::string* dst, const char* format, va_list ap)
-    __attribute__((__format__(__printf__, 2, 0)));
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/strings.h b/base/include/android-base/strings.h
deleted file mode 100644
index 14d534a..0000000
--- a/base/include/android-base/strings.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <sstream>
-#include <string>
-#include <string_view>
-#include <vector>
-
-namespace android {
-namespace base {
-
-// Splits a string into a vector of strings.
-//
-// The string is split at each occurrence of a character in delimiters.
-//
-// The empty string is not a valid delimiter list.
-std::vector<std::string> Split(const std::string& s,
-                               const std::string& delimiters);
-
-// Trims whitespace off both ends of the given string.
-std::string Trim(const std::string& s);
-
-// Joins a container of things into a single string, using the given separator.
-template <typename ContainerT, typename SeparatorT>
-std::string Join(const ContainerT& things, SeparatorT separator) {
-  if (things.empty()) {
-    return "";
-  }
-
-  std::ostringstream result;
-  result << *things.begin();
-  for (auto it = std::next(things.begin()); it != things.end(); ++it) {
-    result << separator << *it;
-  }
-  return result.str();
-}
-
-// We instantiate the common cases in strings.cpp.
-extern template std::string Join(const std::vector<std::string>&, char);
-extern template std::string Join(const std::vector<const char*>&, char);
-extern template std::string Join(const std::vector<std::string>&, const std::string&);
-extern template std::string Join(const std::vector<const char*>&, const std::string&);
-
-// Tests whether 's' starts with 'prefix'.
-bool StartsWith(std::string_view s, std::string_view prefix);
-bool StartsWith(std::string_view s, char prefix);
-bool StartsWithIgnoreCase(std::string_view s, std::string_view prefix);
-
-// Tests whether 's' ends with 'suffix'.
-bool EndsWith(std::string_view s, std::string_view suffix);
-bool EndsWith(std::string_view s, char suffix);
-bool EndsWithIgnoreCase(std::string_view s, std::string_view suffix);
-
-// Tests whether 'lhs' equals 'rhs', ignoring case.
-bool EqualsIgnoreCase(std::string_view lhs, std::string_view rhs);
-
-// Removes `prefix` from the start of the given string and returns true (if
-// it was present), false otherwise.
-inline bool ConsumePrefix(std::string_view* s, std::string_view prefix) {
-  if (!StartsWith(*s, prefix)) return false;
-  s->remove_prefix(prefix.size());
-  return true;
-}
-
-// Removes `suffix` from the end of the given string and returns true (if
-// it was present), false otherwise.
-inline bool ConsumeSuffix(std::string_view* s, std::string_view suffix) {
-  if (!EndsWith(*s, suffix)) return false;
-  s->remove_suffix(suffix.size());
-  return true;
-}
-
-// Replaces `from` with `to` in `s`, once if `all == false`, or as many times as
-// there are matches if `all == true`.
-[[nodiscard]] std::string StringReplace(std::string_view s, std::string_view from,
-                                        std::string_view to, bool all);
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/test_utils.h b/base/include/android-base/test_utils.h
deleted file mode 100644
index f3d7cb0..0000000
--- a/base/include/android-base/test_utils.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <regex>
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-
-class CapturedStdFd {
- public:
-  CapturedStdFd(int std_fd);
-  ~CapturedStdFd();
-
-  std::string str();
-
-  void Start();
-  void Stop();
-  void Reset();
-
- private:
-  int fd() const;
-
-  TemporaryFile temp_file_;
-  int std_fd_;
-  int old_fd_ = -1;
-
-  DISALLOW_COPY_AND_ASSIGN(CapturedStdFd);
-};
-
-class CapturedStderr : public CapturedStdFd {
- public:
-  CapturedStderr() : CapturedStdFd(STDERR_FILENO) {}
-};
-
-class CapturedStdout : public CapturedStdFd {
- public:
-  CapturedStdout() : CapturedStdFd(STDOUT_FILENO) {}
-};
-
-#define ASSERT_MATCH(str, pattern)                                           \
-  do {                                                                       \
-    auto __s = (str);                                                        \
-    if (!std::regex_search(__s, std::regex((pattern)))) {                    \
-      FAIL() << "regex mismatch: expected " << (pattern) << " in:\n" << __s; \
-    }                                                                        \
-  } while (0)
-
-#define ASSERT_NOT_MATCH(str, pattern)                                                   \
-  do {                                                                                   \
-    auto __s = (str);                                                                    \
-    if (std::regex_search(__s, std::regex((pattern)))) {                                 \
-      FAIL() << "regex mismatch: expected to not find " << (pattern) << " in:\n" << __s; \
-    }                                                                                    \
-  } while (0)
-
-#define EXPECT_MATCH(str, pattern)                                                  \
-  do {                                                                              \
-    auto __s = (str);                                                               \
-    if (!std::regex_search(__s, std::regex((pattern)))) {                           \
-      ADD_FAILURE() << "regex mismatch: expected " << (pattern) << " in:\n" << __s; \
-    }                                                                               \
-  } while (0)
-
-#define EXPECT_NOT_MATCH(str, pattern)                                                          \
-  do {                                                                                          \
-    auto __s = (str);                                                                           \
-    if (std::regex_search(__s, std::regex((pattern)))) {                                        \
-      ADD_FAILURE() << "regex mismatch: expected to not find " << (pattern) << " in:\n" << __s; \
-    }                                                                                           \
-  } while (0)
diff --git a/base/include/android-base/thread_annotations.h b/base/include/android-base/thread_annotations.h
deleted file mode 100644
index 53fe6da..0000000
--- a/base/include/android-base/thread_annotations.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <mutex>
-
-#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
-
-#define CAPABILITY(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(capability(x))
-
-#define SCOPED_CAPABILITY \
-      THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
-
-#define SHARED_CAPABILITY(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(shared_capability(__VA_ARGS__))
-
-#define GUARDED_BY(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
-
-#define PT_GUARDED_BY(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
-
-#define EXCLUSIVE_LOCKS_REQUIRED(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
-
-#define SHARED_LOCKS_REQUIRED(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
-
-#define ACQUIRED_BEFORE(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
-
-#define ACQUIRED_AFTER(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
-
-#define REQUIRES(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__))
-
-#define REQUIRES_SHARED(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__))
-
-#define ACQUIRE(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__))
-
-#define ACQUIRE_SHARED(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__))
-
-#define RELEASE(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__))
-
-#define RELEASE_SHARED(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__))
-
-#define TRY_ACQUIRE(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__))
-
-#define TRY_ACQUIRE_SHARED(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__))
-
-#define EXCLUDES(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__))
-
-#define ASSERT_CAPABILITY(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x))
-
-#define ASSERT_SHARED_CAPABILITY(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x))
-
-#define RETURN_CAPABILITY(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
-
-#define EXCLUSIVE_LOCK_FUNCTION(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__))
-
-#define EXCLUSIVE_TRYLOCK_FUNCTION(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__))
-
-#define SHARED_LOCK_FUNCTION(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__))
-
-#define SHARED_TRYLOCK_FUNCTION(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__))
-
-#define UNLOCK_FUNCTION(...) \
-      THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__))
-
-#define SCOPED_LOCKABLE \
-      THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
-
-#define LOCK_RETURNED(x) \
-      THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
-
-#define NO_THREAD_SAFETY_ANALYSIS \
-      THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
-
-namespace android {
-namespace base {
-
-// A class to help thread safety analysis deal with std::unique_lock and condition_variable.
-//
-// Clang's thread safety analysis currently doesn't perform alias analysis, so movable types
-// like std::unique_lock can't be marked with thread safety annotations. This helper allows
-// for manual assertion of lock state in a scope.
-//
-// For example:
-//
-//   std::mutex mutex;
-//   std::condition_variable cv;
-//   std::vector<int> vec GUARDED_BY(mutex);
-//
-//   int pop() {
-//     std::unique_lock lock(mutex);
-//     ScopedLockAssertion lock_assertion(mutex);
-//     cv.wait(lock, []() {
-//       ScopedLockAssertion lock_assertion(mutex);
-//       return !vec.empty();
-//     });
-//
-//     int result = vec.back();
-//     vec.pop_back();
-//     return result;
-//   }
-class SCOPED_CAPABILITY ScopedLockAssertion {
- public:
-  ScopedLockAssertion(std::mutex& mutex) ACQUIRE(mutex) {}
-  ~ScopedLockAssertion() RELEASE() {}
-};
-
-}  // namespace base
-}  // namespace android
diff --git a/base/include/android-base/threads.h b/base/include/android-base/threads.h
deleted file mode 100644
index dba1fc6..0000000
--- a/base/include/android-base/threads.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-namespace android {
-namespace base {
-uint64_t GetThreadId();
-}
-}  // namespace android
-
-#if defined(__GLIBC__)
-// bionic has this Linux-specifix call, but glibc doesn't.
-extern "C" int tgkill(int tgid, int tid, int sig);
-#endif
diff --git a/base/include/android-base/unique_fd.h b/base/include/android-base/unique_fd.h
deleted file mode 100644
index c4a0aad..0000000
--- a/base/include/android-base/unique_fd.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#if !defined(_WIN32)
-#include <sys/socket.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-// DO NOT INCLUDE OTHER LIBBASE HEADERS!
-// This file gets used in libbinder, and libbinder is used everywhere.
-// Including other headers from libbase frequently results in inclusion of
-// android-base/macros.h, which causes macro collisions.
-
-// Container for a file descriptor that automatically closes the descriptor as
-// it goes out of scope.
-//
-//      unique_fd ufd(open("/some/path", "r"));
-//      if (ufd.get() == -1) return error;
-//
-//      // Do something useful, possibly including 'return'.
-//
-//      return 0; // Descriptor is closed for you.
-//
-// unique_fd is also known as ScopedFd/ScopedFD/scoped_fd; mentioned here to help
-// you find this class if you're searching for one of those names.
-
-#if defined(__BIONIC__)
-#include <android/fdsan.h>
-#endif
-
-namespace android {
-namespace base {
-
-struct DefaultCloser {
-#if defined(__BIONIC__)
-  static void Tag(int fd, void* old_addr, void* new_addr) {
-    if (android_fdsan_exchange_owner_tag) {
-      uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
-                                                        reinterpret_cast<uint64_t>(old_addr));
-      uint64_t new_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
-                                                        reinterpret_cast<uint64_t>(new_addr));
-      android_fdsan_exchange_owner_tag(fd, old_tag, new_tag);
-    }
-  }
-  static void Close(int fd, void* addr) {
-    if (android_fdsan_close_with_tag) {
-      uint64_t tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
-                                                    reinterpret_cast<uint64_t>(addr));
-      android_fdsan_close_with_tag(fd, tag);
-    } else {
-      close(fd);
-    }
-  }
-#else
-  static void Close(int fd) {
-    // Even if close(2) fails with EINTR, the fd will have been closed.
-    // Using TEMP_FAILURE_RETRY will either lead to EBADF or closing someone
-    // else's fd.
-    // http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
-    ::close(fd);
-  }
-#endif
-};
-
-template <typename Closer>
-class unique_fd_impl final {
- public:
-  unique_fd_impl() {}
-
-  explicit unique_fd_impl(int fd) { reset(fd); }
-  ~unique_fd_impl() { reset(); }
-
-  unique_fd_impl(const unique_fd_impl&) = delete;
-  void operator=(const unique_fd_impl&) = delete;
-  unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); }
-  unique_fd_impl& operator=(unique_fd_impl&& s) noexcept {
-    int fd = s.fd_;
-    s.fd_ = -1;
-    reset(fd, &s);
-    return *this;
-  }
-
-  void reset(int new_value = -1) { reset(new_value, nullptr); }
-
-  int get() const { return fd_; }
-
-#if !defined(ANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION)
-  // unique_fd's operator int is dangerous, but we have way too much code that
-  // depends on it, so make this opt-in at first.
-  operator int() const { return get(); }  // NOLINT
-#endif
-
-  bool operator>=(int rhs) const { return get() >= rhs; }
-  bool operator<(int rhs) const { return get() < rhs; }
-  bool operator==(int rhs) const { return get() == rhs; }
-  bool operator!=(int rhs) const { return get() != rhs; }
-  bool operator==(const unique_fd_impl& rhs) const { return get() == rhs.get(); }
-  bool operator!=(const unique_fd_impl& rhs) const { return get() != rhs.get(); }
-
-  // Catch bogus error checks (i.e.: "!fd" instead of "fd != -1").
-  bool operator!() const = delete;
-
-  bool ok() const { return get() >= 0; }
-
-  int release() __attribute__((warn_unused_result)) {
-    tag(fd_, this, nullptr);
-    int ret = fd_;
-    fd_ = -1;
-    return ret;
-  }
-
- private:
-  void reset(int new_value, void* previous_tag) {
-    int previous_errno = errno;
-
-    if (fd_ != -1) {
-      close(fd_, this);
-    }
-
-    fd_ = new_value;
-    if (new_value != -1) {
-      tag(new_value, previous_tag, this);
-    }
-
-    errno = previous_errno;
-  }
-
-  int fd_ = -1;
-
-  // Template magic to use Closer::Tag if available, and do nothing if not.
-  // If Closer::Tag exists, this implementation is preferred, because int is a better match.
-  // If not, this implementation is SFINAEd away, and the no-op below is the only one that exists.
-  template <typename T = Closer>
-  static auto tag(int fd, void* old_tag, void* new_tag)
-      -> decltype(T::Tag(fd, old_tag, new_tag), void()) {
-    T::Tag(fd, old_tag, new_tag);
-  }
-
-  template <typename T = Closer>
-  static void tag(long, void*, void*) {
-    // No-op.
-  }
-
-  // Same as above, to select between Closer::Close(int) and Closer::Close(int, void*).
-  template <typename T = Closer>
-  static auto close(int fd, void* tag_value) -> decltype(T::Close(fd, tag_value), void()) {
-    T::Close(fd, tag_value);
-  }
-
-  template <typename T = Closer>
-  static auto close(int fd, void*) -> decltype(T::Close(fd), void()) {
-    T::Close(fd);
-  }
-};
-
-using unique_fd = unique_fd_impl<DefaultCloser>;
-
-#if !defined(_WIN32)
-
-// Inline functions, so that they can be used header-only.
-template <typename Closer>
-inline bool Pipe(unique_fd_impl<Closer>* read, unique_fd_impl<Closer>* write,
-                 int flags = O_CLOEXEC) {
-  int pipefd[2];
-
-#if defined(__linux__)
-  if (pipe2(pipefd, flags) != 0) {
-    return false;
-  }
-#else  // defined(__APPLE__)
-  if (flags & ~(O_CLOEXEC | O_NONBLOCK)) {
-    return false;
-  }
-  if (pipe(pipefd) != 0) {
-    return false;
-  }
-
-  if (flags & O_CLOEXEC) {
-    if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) {
-      close(pipefd[0]);
-      close(pipefd[1]);
-      return false;
-    }
-  }
-  if (flags & O_NONBLOCK) {
-    if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) {
-      close(pipefd[0]);
-      close(pipefd[1]);
-      return false;
-    }
-  }
-#endif
-
-  read->reset(pipefd[0]);
-  write->reset(pipefd[1]);
-  return true;
-}
-
-template <typename Closer>
-inline bool Socketpair(int domain, int type, int protocol, unique_fd_impl<Closer>* left,
-                       unique_fd_impl<Closer>* right) {
-  int sockfd[2];
-  if (socketpair(domain, type, protocol, sockfd) != 0) {
-    return false;
-  }
-  left->reset(sockfd[0]);
-  right->reset(sockfd[1]);
-  return true;
-}
-
-template <typename Closer>
-inline bool Socketpair(int type, unique_fd_impl<Closer>* left, unique_fd_impl<Closer>* right) {
-  return Socketpair(AF_UNIX, type, 0, left, right);
-}
-
-// Using fdopen with unique_fd correctly is more annoying than it should be,
-// because fdopen doesn't close the file descriptor received upon failure.
-inline FILE* Fdopen(unique_fd&& ufd, const char* mode) {
-  int fd = ufd.release();
-  FILE* file = fdopen(fd, mode);
-  if (!file) {
-    close(fd);
-  }
-  return file;
-}
-
-// Using fdopendir with unique_fd correctly is more annoying than it should be,
-// because fdopen doesn't close the file descriptor received upon failure.
-inline DIR* Fdopendir(unique_fd&& ufd) {
-  int fd = ufd.release();
-  DIR* dir = fdopendir(fd);
-  if (dir == nullptr) {
-    close(fd);
-  }
-  return dir;
-}
-
-#endif  // !defined(_WIN32)
-
-// A wrapper type that can be implicitly constructed from either int or unique_fd.
-struct borrowed_fd {
-  /* implicit */ borrowed_fd(int fd) : fd_(fd) {}  // NOLINT
-  template <typename T>
-  /* implicit */ borrowed_fd(const unique_fd_impl<T>& ufd) : fd_(ufd.get()) {}  // NOLINT
-
-  int get() const { return fd_; }
-
-  bool operator>=(int rhs) const { return get() >= rhs; }
-  bool operator<(int rhs) const { return get() < rhs; }
-  bool operator==(int rhs) const { return get() == rhs; }
-  bool operator!=(int rhs) const { return get() != rhs; }
-
- private:
-  int fd_ = -1;
-};
-}  // namespace base
-}  // namespace android
-
-template <typename T>
-int close(const android::base::unique_fd_impl<T>&)
-    __attribute__((__unavailable__("close called on unique_fd")));
-
-template <typename T>
-FILE* fdopen(const android::base::unique_fd_impl<T>&, const char* mode)
-    __attribute__((__unavailable__("fdopen takes ownership of the fd passed in; either dup the "
-                                   "unique_fd, or use android::base::Fdopen to pass ownership")));
-
-template <typename T>
-DIR* fdopendir(const android::base::unique_fd_impl<T>&) __attribute__((
-    __unavailable__("fdopendir takes ownership of the fd passed in; either dup the "
-                    "unique_fd, or use android::base::Fdopendir to pass ownership")));
diff --git a/base/include/android-base/utf8.h b/base/include/android-base/utf8.h
deleted file mode 100644
index 1a414ec..0000000
--- a/base/include/android-base/utf8.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#ifdef _WIN32
-#include <sys/types.h>
-#include <string>
-#else
-// Bring in prototypes for standard APIs so that we can import them into the utf8 namespace.
-#include <fcntl.h>      // open
-#include <stdio.h>      // fopen
-#include <sys/stat.h>   // mkdir
-#include <unistd.h>     // unlink
-#endif
-
-namespace android {
-namespace base {
-
-// Only available on Windows because this is only needed on Windows.
-#ifdef _WIN32
-// Convert size number of UTF-16 wchar_t's to UTF-8. Returns whether the
-// conversion was done successfully.
-bool WideToUTF8(const wchar_t* utf16, const size_t size, std::string* utf8);
-
-// Convert a NULL-terminated string of UTF-16 characters to UTF-8. Returns
-// whether the conversion was done successfully.
-bool WideToUTF8(const wchar_t* utf16, std::string* utf8);
-
-// Convert a UTF-16 std::wstring (including any embedded NULL characters) to
-// UTF-8. Returns whether the conversion was done successfully.
-bool WideToUTF8(const std::wstring& utf16, std::string* utf8);
-
-// Convert size number of UTF-8 char's to UTF-16. Returns whether the conversion
-// was done successfully.
-bool UTF8ToWide(const char* utf8, const size_t size, std::wstring* utf16);
-
-// Convert a NULL-terminated string of UTF-8 characters to UTF-16. Returns
-// whether the conversion was done successfully.
-bool UTF8ToWide(const char* utf8, std::wstring* utf16);
-
-// Convert a UTF-8 std::string (including any embedded NULL characters) to
-// UTF-16. Returns whether the conversion was done successfully.
-bool UTF8ToWide(const std::string& utf8, std::wstring* utf16);
-
-// Convert a file system path, represented as a NULL-terminated string of
-// UTF-8 characters, to a UTF-16 string representing the same file system
-// path using the Windows extended-lengh path representation.
-//
-// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#MAXPATH:
-//   ```The Windows API has many functions that also have Unicode versions to
-//   permit an extended-length path for a maximum total path length of 32,767
-//   characters. To specify an extended-length path, use the "\\?\" prefix.
-//   For example, "\\?\D:\very long path".```
-//
-// Returns whether the conversion was done successfully.
-bool UTF8PathToWindowsLongPath(const char* utf8, std::wstring* utf16);
-#endif
-
-// The functions in the utf8 namespace take UTF-8 strings. For Windows, these
-// are wrappers, for non-Windows these just expose existing APIs. To call these
-// functions, use:
-//
-// // anonymous namespace to avoid conflict with existing open(), unlink(), etc.
-// namespace {
-//   // Import functions into anonymous namespace.
-//   using namespace android::base::utf8;
-//
-//   void SomeFunction(const char* name) {
-//     int fd = open(name, ...);  // Calls android::base::utf8::open().
-//     ...
-//     unlink(name);              // Calls android::base::utf8::unlink().
-//   }
-// }
-namespace utf8 {
-
-#ifdef _WIN32
-FILE* fopen(const char* name, const char* mode);
-int mkdir(const char* name, mode_t mode);
-int open(const char* name, int flags, ...);
-int unlink(const char* name);
-#else
-using ::fopen;
-using ::mkdir;
-using ::open;
-using ::unlink;
-#endif
-
-}  // namespace utf8
-}  // namespace base
-}  // namespace android
diff --git a/base/liblog_symbols.cpp b/base/liblog_symbols.cpp
deleted file mode 100644
index 1f4b69b..0000000
--- a/base/liblog_symbols.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "liblog_symbols.h"
-
-#if defined(__ANDROID_SDK_VERSION__) && (__ANDROID_SDK_VERSION__ <= 29)
-#define USE_DLSYM
-#endif
-
-#ifdef USE_DLSYM
-#include <dlfcn.h>
-#endif
-
-namespace android {
-namespace base {
-
-#ifdef USE_DLSYM
-
-const std::optional<LibLogFunctions>& GetLibLogFunctions() {
-  static std::optional<LibLogFunctions> liblog_functions = []() -> std::optional<LibLogFunctions> {
-    void* liblog_handle = dlopen("liblog.so", RTLD_NOW);
-    if (liblog_handle == nullptr) {
-      return {};
-    }
-
-    LibLogFunctions real_liblog_functions = {};
-
-#define DLSYM(name)                                                                   \
-  real_liblog_functions.name =                                                        \
-      reinterpret_cast<decltype(LibLogFunctions::name)>(dlsym(liblog_handle, #name)); \
-  if (real_liblog_functions.name == nullptr) {                                        \
-    return {};                                                                        \
-  }
-
-    DLSYM(__android_log_set_logger)
-    DLSYM(__android_log_write_log_message)
-    DLSYM(__android_log_logd_logger)
-    DLSYM(__android_log_stderr_logger)
-    DLSYM(__android_log_set_aborter)
-    DLSYM(__android_log_call_aborter)
-    DLSYM(__android_log_default_aborter)
-    DLSYM(__android_log_set_minimum_priority);
-    DLSYM(__android_log_get_minimum_priority);
-    DLSYM(__android_log_set_default_tag);
-#undef DLSYM
-
-    return real_liblog_functions;
-  }();
-
-  return liblog_functions;
-}
-
-#else
-
-const std::optional<LibLogFunctions>& GetLibLogFunctions() {
-  static std::optional<LibLogFunctions> liblog_functions = []() -> std::optional<LibLogFunctions> {
-    return LibLogFunctions{
-        .__android_log_set_logger = __android_log_set_logger,
-        .__android_log_write_log_message = __android_log_write_log_message,
-        .__android_log_logd_logger = __android_log_logd_logger,
-        .__android_log_stderr_logger = __android_log_stderr_logger,
-        .__android_log_set_aborter = __android_log_set_aborter,
-        .__android_log_call_aborter = __android_log_call_aborter,
-        .__android_log_default_aborter = __android_log_default_aborter,
-        .__android_log_set_minimum_priority = __android_log_set_minimum_priority,
-        .__android_log_get_minimum_priority = __android_log_get_minimum_priority,
-        .__android_log_set_default_tag = __android_log_set_default_tag,
-    };
-  }();
-  return liblog_functions;
-}
-
-#endif
-
-}  // namespace base
-}  // namespace android
diff --git a/base/liblog_symbols.h b/base/liblog_symbols.h
deleted file mode 100644
index 2e6b47f..0000000
--- a/base/liblog_symbols.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <optional>
-
-#include <android/log.h>
-
-namespace android {
-namespace base {
-
-struct LibLogFunctions {
-  void (*__android_log_set_logger)(__android_logger_function logger);
-  void (*__android_log_write_log_message)(struct __android_log_message* log_message);
-
-  void (*__android_log_logd_logger)(const struct __android_log_message* log_message);
-  void (*__android_log_stderr_logger)(const struct __android_log_message* log_message);
-
-  void (*__android_log_set_aborter)(__android_aborter_function aborter);
-  void (*__android_log_call_aborter)(const char* abort_message);
-  void (*__android_log_default_aborter)(const char* abort_message);
-  int32_t (*__android_log_set_minimum_priority)(int32_t priority);
-  int32_t (*__android_log_get_minimum_priority)();
-  void (*__android_log_set_default_tag)(const char* tag);
-};
-
-const std::optional<LibLogFunctions>& GetLibLogFunctions();
-
-}  // namespace base
-}  // namespace android
diff --git a/base/logging.cpp b/base/logging.cpp
deleted file mode 100644
index 5bd21da..0000000
--- a/base/logging.cpp
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#if defined(_WIN32)
-#include <windows.h>
-#endif
-
-#include "android-base/logging.h"
-
-#include <fcntl.h>
-#include <inttypes.h>
-#include <libgen.h>
-#include <time.h>
-
-// For getprogname(3) or program_invocation_short_name.
-#if defined(__ANDROID__) || defined(__APPLE__)
-#include <stdlib.h>
-#elif defined(__GLIBC__)
-#include <errno.h>
-#endif
-
-#if defined(__linux__)
-#include <sys/uio.h>
-#endif
-
-#include <atomic>
-#include <iostream>
-#include <limits>
-#include <mutex>
-#include <optional>
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <android/log.h>
-#ifdef __ANDROID__
-#include <android/set_abort_message.h>
-#else
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/parseint.h>
-#include <android-base/strings.h>
-#include <android-base/threads.h>
-
-#include "liblog_symbols.h"
-#include "logging_splitters.h"
-
-namespace android {
-namespace base {
-
-// BSD-based systems like Android/macOS have getprogname(). Others need us to provide one.
-#if defined(__GLIBC__) || defined(_WIN32)
-static const char* getprogname() {
-#if defined(__GLIBC__)
-  return program_invocation_short_name;
-#elif defined(_WIN32)
-  static bool first = true;
-  static char progname[MAX_PATH] = {};
-
-  if (first) {
-    snprintf(progname, sizeof(progname), "%s",
-             android::base::Basename(android::base::GetExecutablePath()).c_str());
-    first = false;
-  }
-
-  return progname;
-#endif
-}
-#endif
-
-static const char* GetFileBasename(const char* file) {
-  // We can't use basename(3) even on Unix because the Mac doesn't
-  // have a non-modifying basename.
-  const char* last_slash = strrchr(file, '/');
-  if (last_slash != nullptr) {
-    return last_slash + 1;
-  }
-#if defined(_WIN32)
-  const char* last_backslash = strrchr(file, '\\');
-  if (last_backslash != nullptr) {
-    return last_backslash + 1;
-  }
-#endif
-  return file;
-}
-
-#if defined(__linux__)
-static int OpenKmsg() {
-#if defined(__ANDROID__)
-  // pick up 'file w /dev/kmsg' environment from daemon's init rc file
-  const auto val = getenv("ANDROID_FILE__dev_kmsg");
-  if (val != nullptr) {
-    int fd;
-    if (android::base::ParseInt(val, &fd, 0)) {
-      auto flags = fcntl(fd, F_GETFL);
-      if ((flags != -1) && ((flags & O_ACCMODE) == O_WRONLY)) return fd;
-    }
-  }
-#endif
-  return TEMP_FAILURE_RETRY(open("/dev/kmsg", O_WRONLY | O_CLOEXEC));
-}
-#endif
-
-static LogId log_id_tToLogId(int32_t buffer_id) {
-  switch (buffer_id) {
-    case LOG_ID_MAIN:
-      return MAIN;
-    case LOG_ID_SYSTEM:
-      return SYSTEM;
-    case LOG_ID_RADIO:
-      return RADIO;
-    case LOG_ID_CRASH:
-      return CRASH;
-    case LOG_ID_DEFAULT:
-    default:
-      return DEFAULT;
-  }
-}
-
-static int32_t LogIdTolog_id_t(LogId log_id) {
-  switch (log_id) {
-    case MAIN:
-      return LOG_ID_MAIN;
-    case SYSTEM:
-      return LOG_ID_SYSTEM;
-    case RADIO:
-      return LOG_ID_RADIO;
-    case CRASH:
-      return LOG_ID_CRASH;
-    case DEFAULT:
-    default:
-      return LOG_ID_DEFAULT;
-  }
-}
-
-static LogSeverity PriorityToLogSeverity(int priority) {
-  switch (priority) {
-    case ANDROID_LOG_DEFAULT:
-      return INFO;
-    case ANDROID_LOG_VERBOSE:
-      return VERBOSE;
-    case ANDROID_LOG_DEBUG:
-      return DEBUG;
-    case ANDROID_LOG_INFO:
-      return INFO;
-    case ANDROID_LOG_WARN:
-      return WARNING;
-    case ANDROID_LOG_ERROR:
-      return ERROR;
-    case ANDROID_LOG_FATAL:
-      return FATAL;
-    default:
-      return FATAL;
-  }
-}
-
-static int32_t LogSeverityToPriority(LogSeverity severity) {
-  switch (severity) {
-    case VERBOSE:
-      return ANDROID_LOG_VERBOSE;
-    case DEBUG:
-      return ANDROID_LOG_DEBUG;
-    case INFO:
-      return ANDROID_LOG_INFO;
-    case WARNING:
-      return ANDROID_LOG_WARN;
-    case ERROR:
-      return ANDROID_LOG_ERROR;
-    case FATAL_WITHOUT_ABORT:
-    case FATAL:
-    default:
-      return ANDROID_LOG_FATAL;
-  }
-}
-
-static LogFunction& Logger() {
-#ifdef __ANDROID__
-  static auto& logger = *new LogFunction(LogdLogger());
-#else
-  static auto& logger = *new LogFunction(StderrLogger);
-#endif
-  return logger;
-}
-
-static AbortFunction& Aborter() {
-  static auto& aborter = *new AbortFunction(DefaultAborter);
-  return aborter;
-}
-
-// Only used for Q fallback.
-static std::recursive_mutex& TagLock() {
-  static auto& tag_lock = *new std::recursive_mutex();
-  return tag_lock;
-}
-// Only used for Q fallback.
-static std::string* gDefaultTag;
-
-void SetDefaultTag(const std::string& tag) {
-  static auto& liblog_functions = GetLibLogFunctions();
-  if (liblog_functions) {
-    liblog_functions->__android_log_set_default_tag(tag.c_str());
-  } else {
-    std::lock_guard<std::recursive_mutex> lock(TagLock());
-    if (gDefaultTag != nullptr) {
-      delete gDefaultTag;
-      gDefaultTag = nullptr;
-    }
-    if (!tag.empty()) {
-      gDefaultTag = new std::string(tag);
-    }
-  }
-}
-
-static bool gInitialized = false;
-
-// Only used for Q fallback.
-static LogSeverity gMinimumLogSeverity = INFO;
-
-#if defined(__linux__)
-static void KernelLogLine(const char* msg, int length, android::base::LogSeverity severity,
-                          const char* tag) {
-  // clang-format off
-  static constexpr int kLogSeverityToKernelLogLevel[] = {
-      [android::base::VERBOSE] = 7,              // KERN_DEBUG (there is no verbose kernel log
-                                                 //             level)
-      [android::base::DEBUG] = 7,                // KERN_DEBUG
-      [android::base::INFO] = 6,                 // KERN_INFO
-      [android::base::WARNING] = 4,              // KERN_WARNING
-      [android::base::ERROR] = 3,                // KERN_ERROR
-      [android::base::FATAL_WITHOUT_ABORT] = 2,  // KERN_CRIT
-      [android::base::FATAL] = 2,                // KERN_CRIT
-  };
-  // clang-format on
-  static_assert(arraysize(kLogSeverityToKernelLogLevel) == android::base::FATAL + 1,
-                "Mismatch in size of kLogSeverityToKernelLogLevel and values in LogSeverity");
-
-  static int klog_fd = OpenKmsg();
-  if (klog_fd == -1) return;
-
-  int level = kLogSeverityToKernelLogLevel[severity];
-
-  // The kernel's printk buffer is only 1024 bytes.
-  // TODO: should we automatically break up long lines into multiple lines?
-  // Or we could log but with something like "..." at the end?
-  char buf[1024] __attribute__((__uninitialized__));
-  size_t size = snprintf(buf, sizeof(buf), "<%d>%s: %.*s\n", level, tag, length, msg);
-  if (size > sizeof(buf)) {
-    size = snprintf(buf, sizeof(buf), "<%d>%s: %zu-byte message too long for printk\n",
-                    level, tag, size);
-  }
-
-  iovec iov[1];
-  iov[0].iov_base = buf;
-  iov[0].iov_len = size;
-  TEMP_FAILURE_RETRY(writev(klog_fd, iov, 1));
-}
-
-void KernelLogger(android::base::LogId, android::base::LogSeverity severity, const char* tag,
-                  const char*, unsigned int, const char* full_message) {
-  SplitByLines(full_message, KernelLogLine, severity, tag);
-}
-#endif
-
-void StderrLogger(LogId, LogSeverity severity, const char* tag, const char* file, unsigned int line,
-                  const char* message) {
-  struct tm now;
-  time_t t = time(nullptr);
-
-#if defined(_WIN32)
-  localtime_s(&now, &t);
-#else
-  localtime_r(&t, &now);
-#endif
-  auto output_string =
-      StderrOutputGenerator(now, getpid(), GetThreadId(), severity, tag, file, line, message);
-
-  fputs(output_string.c_str(), stderr);
-}
-
-void StdioLogger(LogId, LogSeverity severity, const char* /*tag*/, const char* /*file*/,
-                 unsigned int /*line*/, const char* message) {
-  if (severity >= WARNING) {
-    fflush(stdout);
-    fprintf(stderr, "%s: %s\n", GetFileBasename(getprogname()), message);
-  } else {
-    fprintf(stdout, "%s\n", message);
-  }
-}
-
-void DefaultAborter(const char* abort_message) {
-#ifdef __ANDROID__
-  android_set_abort_message(abort_message);
-#else
-  UNUSED(abort_message);
-#endif
-  abort();
-}
-
-static void LogdLogChunk(LogId id, LogSeverity severity, const char* tag, const char* message) {
-  int32_t lg_id = LogIdTolog_id_t(id);
-  int32_t priority = LogSeverityToPriority(severity);
-
-  static auto& liblog_functions = GetLibLogFunctions();
-  if (liblog_functions) {
-    __android_log_message log_message = {sizeof(__android_log_message),     lg_id, priority, tag,
-                                         static_cast<const char*>(nullptr), 0,     message};
-    liblog_functions->__android_log_logd_logger(&log_message);
-  } else {
-    __android_log_buf_print(lg_id, priority, tag, "%s", message);
-  }
-}
-
-LogdLogger::LogdLogger(LogId default_log_id) : default_log_id_(default_log_id) {}
-
-void LogdLogger::operator()(LogId id, LogSeverity severity, const char* tag, const char* file,
-                            unsigned int line, const char* message) {
-  if (id == DEFAULT) {
-    id = default_log_id_;
-  }
-
-  SplitByLogdChunks(id, severity, tag, file, line, message, LogdLogChunk);
-}
-
-void InitLogging(char* argv[], LogFunction&& logger, AbortFunction&& aborter) {
-  SetLogger(std::forward<LogFunction>(logger));
-  SetAborter(std::forward<AbortFunction>(aborter));
-
-  if (gInitialized) {
-    return;
-  }
-
-  gInitialized = true;
-
-  // Stash the command line for later use. We can use /proc/self/cmdline on
-  // Linux to recover this, but we don't have that luxury on the Mac/Windows,
-  // and there are a couple of argv[0] variants that are commonly used.
-  if (argv != nullptr) {
-    SetDefaultTag(basename(argv[0]));
-  }
-
-  const char* tags = getenv("ANDROID_LOG_TAGS");
-  if (tags == nullptr) {
-    return;
-  }
-
-  std::vector<std::string> specs = Split(tags, " ");
-  for (size_t i = 0; i < specs.size(); ++i) {
-    // "tag-pattern:[vdiwefs]"
-    std::string spec(specs[i]);
-    if (spec.size() == 3 && StartsWith(spec, "*:")) {
-      switch (spec[2]) {
-        case 'v':
-          SetMinimumLogSeverity(VERBOSE);
-          continue;
-        case 'd':
-          SetMinimumLogSeverity(DEBUG);
-          continue;
-        case 'i':
-          SetMinimumLogSeverity(INFO);
-          continue;
-        case 'w':
-          SetMinimumLogSeverity(WARNING);
-          continue;
-        case 'e':
-          SetMinimumLogSeverity(ERROR);
-          continue;
-        case 'f':
-          SetMinimumLogSeverity(FATAL_WITHOUT_ABORT);
-          continue;
-        // liblog will even suppress FATAL if you say 's' for silent, but that's
-        // crazy!
-        case 's':
-          SetMinimumLogSeverity(FATAL_WITHOUT_ABORT);
-          continue;
-      }
-    }
-    LOG(FATAL) << "unsupported '" << spec << "' in ANDROID_LOG_TAGS (" << tags
-               << ")";
-  }
-}
-
-void SetLogger(LogFunction&& logger) {
-  Logger() = std::move(logger);
-
-  static auto& liblog_functions = GetLibLogFunctions();
-  if (liblog_functions) {
-    liblog_functions->__android_log_set_logger([](const struct __android_log_message* log_message) {
-      auto log_id = log_id_tToLogId(log_message->buffer_id);
-      auto severity = PriorityToLogSeverity(log_message->priority);
-
-      Logger()(log_id, severity, log_message->tag, log_message->file, log_message->line,
-               log_message->message);
-    });
-  }
-}
-
-void SetAborter(AbortFunction&& aborter) {
-  Aborter() = std::move(aborter);
-
-  static auto& liblog_functions = GetLibLogFunctions();
-  if (liblog_functions) {
-    liblog_functions->__android_log_set_aborter(
-        [](const char* abort_message) { Aborter()(abort_message); });
-  }
-}
-
-// This indirection greatly reduces the stack impact of having lots of
-// checks/logging in a function.
-class LogMessageData {
- public:
-  LogMessageData(const char* file, unsigned int line, LogSeverity severity, const char* tag,
-                 int error)
-      : file_(GetFileBasename(file)),
-        line_number_(line),
-        severity_(severity),
-        tag_(tag),
-        error_(error) {}
-
-  const char* GetFile() const {
-    return file_;
-  }
-
-  unsigned int GetLineNumber() const {
-    return line_number_;
-  }
-
-  LogSeverity GetSeverity() const {
-    return severity_;
-  }
-
-  const char* GetTag() const { return tag_; }
-
-  int GetError() const {
-    return error_;
-  }
-
-  std::ostream& GetBuffer() {
-    return buffer_;
-  }
-
-  std::string ToString() const {
-    return buffer_.str();
-  }
-
- private:
-  std::ostringstream buffer_;
-  const char* const file_;
-  const unsigned int line_number_;
-  const LogSeverity severity_;
-  const char* const tag_;
-  const int error_;
-
-  DISALLOW_COPY_AND_ASSIGN(LogMessageData);
-};
-
-LogMessage::LogMessage(const char* file, unsigned int line, LogId, LogSeverity severity,
-                       const char* tag, int error)
-    : LogMessage(file, line, severity, tag, error) {}
-
-LogMessage::LogMessage(const char* file, unsigned int line, LogSeverity severity, const char* tag,
-                       int error)
-    : data_(new LogMessageData(file, line, severity, tag, error)) {}
-
-LogMessage::~LogMessage() {
-  // Check severity again. This is duplicate work wrt/ LOG macros, but not LOG_STREAM.
-  if (!WOULD_LOG(data_->GetSeverity())) {
-    return;
-  }
-
-  // Finish constructing the message.
-  if (data_->GetError() != -1) {
-    data_->GetBuffer() << ": " << strerror(data_->GetError());
-  }
-  std::string msg(data_->ToString());
-
-  if (data_->GetSeverity() == FATAL) {
-#ifdef __ANDROID__
-    // Set the bionic abort message early to avoid liblog doing it
-    // with the individual lines, so that we get the whole message.
-    android_set_abort_message(msg.c_str());
-#endif
-  }
-
-  LogLine(data_->GetFile(), data_->GetLineNumber(), data_->GetSeverity(), data_->GetTag(),
-          msg.c_str());
-
-  // Abort if necessary.
-  if (data_->GetSeverity() == FATAL) {
-    static auto& liblog_functions = GetLibLogFunctions();
-    if (liblog_functions) {
-      liblog_functions->__android_log_call_aborter(msg.c_str());
-    } else {
-      Aborter()(msg.c_str());
-    }
-  }
-}
-
-std::ostream& LogMessage::stream() {
-  return data_->GetBuffer();
-}
-
-void LogMessage::LogLine(const char* file, unsigned int line, LogSeverity severity, const char* tag,
-                         const char* message) {
-  static auto& liblog_functions = GetLibLogFunctions();
-  int32_t priority = LogSeverityToPriority(severity);
-  if (liblog_functions) {
-    __android_log_message log_message = {
-        sizeof(__android_log_message), LOG_ID_DEFAULT, priority, tag, file, line, message};
-    liblog_functions->__android_log_write_log_message(&log_message);
-  } else {
-    if (tag == nullptr) {
-      std::lock_guard<std::recursive_mutex> lock(TagLock());
-      if (gDefaultTag == nullptr) {
-        gDefaultTag = new std::string(getprogname());
-      }
-
-      Logger()(DEFAULT, severity, gDefaultTag->c_str(), file, line, message);
-    } else {
-      Logger()(DEFAULT, severity, tag, file, line, message);
-    }
-  }
-}
-
-LogSeverity GetMinimumLogSeverity() {
-  static auto& liblog_functions = GetLibLogFunctions();
-  if (liblog_functions) {
-    return PriorityToLogSeverity(liblog_functions->__android_log_get_minimum_priority());
-  } else {
-    return gMinimumLogSeverity;
-  }
-}
-
-bool ShouldLog(LogSeverity severity, const char* tag) {
-  static auto& liblog_functions = GetLibLogFunctions();
-  // Even though we're not using the R liblog functions in this function, if we're running on Q,
-  // we need to fall back to using gMinimumLogSeverity, since __android_log_is_loggable() will not
-  // take into consideration the value from SetMinimumLogSeverity().
-  if (liblog_functions) {
-    int32_t priority = LogSeverityToPriority(severity);
-    return __android_log_is_loggable(priority, tag, ANDROID_LOG_INFO);
-  } else {
-    return severity >= gMinimumLogSeverity;
-  }
-}
-
-LogSeverity SetMinimumLogSeverity(LogSeverity new_severity) {
-  static auto& liblog_functions = GetLibLogFunctions();
-  if (liblog_functions) {
-    int32_t priority = LogSeverityToPriority(new_severity);
-    return PriorityToLogSeverity(liblog_functions->__android_log_set_minimum_priority(priority));
-  } else {
-    LogSeverity old_severity = gMinimumLogSeverity;
-    gMinimumLogSeverity = new_severity;
-    return old_severity;
-  }
-}
-
-ScopedLogSeverity::ScopedLogSeverity(LogSeverity new_severity) {
-  old_ = SetMinimumLogSeverity(new_severity);
-}
-
-ScopedLogSeverity::~ScopedLogSeverity() {
-  SetMinimumLogSeverity(old_);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/logging_splitters.h b/base/logging_splitters.h
deleted file mode 100644
index 2ec2b20..0000000
--- a/base/logging_splitters.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <inttypes.h>
-
-#include <android-base/logging.h>
-#include <android-base/stringprintf.h>
-
-#define LOGGER_ENTRY_MAX_PAYLOAD 4068  // This constant is not in the NDK.
-
-namespace android {
-namespace base {
-
-// This splits the message up line by line, by calling log_function with a pointer to the start of
-// each line and the size up to the newline character.  It sends size = -1 for the final line.
-template <typename F, typename... Args>
-static void SplitByLines(const char* msg, const F& log_function, Args&&... args) {
-  const char* newline = strchr(msg, '\n');
-  while (newline != nullptr) {
-    log_function(msg, newline - msg, args...);
-    msg = newline + 1;
-    newline = strchr(msg, '\n');
-  }
-
-  log_function(msg, -1, args...);
-}
-
-// This splits the message up into chunks that logs can process delimited by new lines.  It calls
-// log_function with the exact null terminated message that should be sent to logd.
-// Note, despite the loops and snprintf's, if severity is not fatal and there are no new lines,
-// this function simply calls log_function with msg without any extra overhead.
-template <typename F>
-static void SplitByLogdChunks(LogId log_id, LogSeverity severity, const char* tag, const char* file,
-                              unsigned int line, const char* msg, const F& log_function) {
-  // The maximum size of a payload, after the log header that logd will accept is
-  // LOGGER_ENTRY_MAX_PAYLOAD, so subtract the other elements in the payload to find the size of
-  // the string that we can log in each pass.
-  // The protocol is documented in liblog/README.protocol.md.
-  // Specifically we subtract a byte for the priority, the length of the tag + its null terminator,
-  // and an additional byte for the null terminator on the payload.  We subtract an additional 32
-  // bytes for slack, similar to java/android/util/Log.java.
-  ptrdiff_t max_size = LOGGER_ENTRY_MAX_PAYLOAD - strlen(tag) - 35;
-  if (max_size <= 0) {
-    abort();
-  }
-  // If we're logging a fatal message, we'll append the file and line numbers.
-  bool add_file = file != nullptr && (severity == FATAL || severity == FATAL_WITHOUT_ABORT);
-
-  std::string file_header;
-  if (add_file) {
-    file_header = StringPrintf("%s:%u] ", file, line);
-  }
-  int file_header_size = file_header.size();
-
-  __attribute__((uninitialized)) char logd_chunk[max_size + 1];
-  ptrdiff_t chunk_position = 0;
-
-  auto call_log_function = [&]() {
-    log_function(log_id, severity, tag, logd_chunk);
-    chunk_position = 0;
-  };
-
-  auto write_to_logd_chunk = [&](const char* message, int length) {
-    int size_written = 0;
-    const char* new_line = chunk_position > 0 ? "\n" : "";
-    if (add_file) {
-      size_written = snprintf(logd_chunk + chunk_position, sizeof(logd_chunk) - chunk_position,
-                              "%s%s%.*s", new_line, file_header.c_str(), length, message);
-    } else {
-      size_written = snprintf(logd_chunk + chunk_position, sizeof(logd_chunk) - chunk_position,
-                              "%s%.*s", new_line, length, message);
-    }
-
-    // This should never fail, if it does and we set size_written to 0, which will skip this line
-    // and move to the next one.
-    if (size_written < 0) {
-      size_written = 0;
-    }
-    chunk_position += size_written;
-  };
-
-  const char* newline = strchr(msg, '\n');
-  while (newline != nullptr) {
-    // If we have data in the buffer and this next line doesn't fit, write the buffer.
-    if (chunk_position != 0 && chunk_position + (newline - msg) + 1 + file_header_size > max_size) {
-      call_log_function();
-    }
-
-    // Otherwise, either the next line fits or we have any empty buffer and too large of a line to
-    // ever fit, in both cases, we add it to the buffer and continue.
-    write_to_logd_chunk(msg, newline - msg);
-
-    msg = newline + 1;
-    newline = strchr(msg, '\n');
-  }
-
-  // If we have left over data in the buffer and we can fit the rest of msg, add it to the buffer
-  // then write the buffer.
-  if (chunk_position != 0 &&
-      chunk_position + static_cast<int>(strlen(msg)) + 1 + file_header_size <= max_size) {
-    write_to_logd_chunk(msg, -1);
-    call_log_function();
-  } else {
-    // If the buffer is not empty and we can't fit the rest of msg into it, write its contents.
-    if (chunk_position != 0) {
-      call_log_function();
-    }
-    // Then write the rest of the msg.
-    if (add_file) {
-      snprintf(logd_chunk, sizeof(logd_chunk), "%s%s", file_header.c_str(), msg);
-      log_function(log_id, severity, tag, logd_chunk);
-    } else {
-      log_function(log_id, severity, tag, msg);
-    }
-  }
-}
-
-static std::pair<int, int> CountSizeAndNewLines(const char* message) {
-  int size = 0;
-  int new_lines = 0;
-  while (*message != '\0') {
-    size++;
-    if (*message == '\n') {
-      ++new_lines;
-    }
-    ++message;
-  }
-  return {size, new_lines};
-}
-
-// This adds the log header to each line of message and returns it as a string intended to be
-// written to stderr.
-static std::string StderrOutputGenerator(const struct tm& now, int pid, uint64_t tid,
-                                         LogSeverity severity, const char* tag, const char* file,
-                                         unsigned int line, const char* message) {
-  char timestamp[32];
-  strftime(timestamp, sizeof(timestamp), "%m-%d %H:%M:%S", &now);
-
-  static const char log_characters[] = "VDIWEFF";
-  static_assert(arraysize(log_characters) - 1 == FATAL + 1,
-                "Mismatch in size of log_characters and values in LogSeverity");
-  char severity_char = log_characters[severity];
-  std::string line_prefix;
-  if (file != nullptr) {
-    line_prefix = StringPrintf("%s %c %s %5d %5" PRIu64 " %s:%u] ", tag ? tag : "nullptr",
-                               severity_char, timestamp, pid, tid, file, line);
-  } else {
-    line_prefix = StringPrintf("%s %c %s %5d %5" PRIu64 " ", tag ? tag : "nullptr", severity_char,
-                               timestamp, pid, tid);
-  }
-
-  auto [size, new_lines] = CountSizeAndNewLines(message);
-  std::string output_string;
-  output_string.reserve(size + new_lines * line_prefix.size() + 1);
-
-  auto concat_lines = [&](const char* message, int size) {
-    output_string.append(line_prefix);
-    if (size == -1) {
-      output_string.append(message);
-    } else {
-      output_string.append(message, size);
-    }
-    output_string.append("\n");
-  };
-  SplitByLines(message, concat_lines);
-  return output_string;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/logging_splitters_test.cpp b/base/logging_splitters_test.cpp
deleted file mode 100644
index 679d19e..0000000
--- a/base/logging_splitters_test.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "logging_splitters.h"
-
-#include <string>
-#include <vector>
-
-#include <android-base/strings.h>
-#include <gtest/gtest.h>
-
-namespace android {
-namespace base {
-
-void TestNewlineSplitter(const std::string& input,
-                         const std::vector<std::string>& expected_output) {
-  std::vector<std::string> output;
-  auto logger_function = [&](const char* msg, int length) {
-    if (length == -1) {
-      output.push_back(msg);
-    } else {
-      output.push_back(std::string(msg, length));
-    }
-  };
-  SplitByLines(input.c_str(), logger_function);
-
-  EXPECT_EQ(expected_output, output);
-}
-
-TEST(logging_splitters, NewlineSplitter_EmptyString) {
-  TestNewlineSplitter("", std::vector<std::string>{""});
-}
-
-TEST(logging_splitters, NewlineSplitter_BasicString) {
-  TestNewlineSplitter("normal string", std::vector<std::string>{"normal string"});
-}
-
-TEST(logging_splitters, NewlineSplitter_ormalBasicStringTrailingNewline) {
-  TestNewlineSplitter("normal string\n", std::vector<std::string>{"normal string", ""});
-}
-
-TEST(logging_splitters, NewlineSplitter_MultilineTrailing) {
-  TestNewlineSplitter("normal string\nsecond string\nthirdstring",
-                      std::vector<std::string>{"normal string", "second string", "thirdstring"});
-}
-
-TEST(logging_splitters, NewlineSplitter_MultilineTrailingNewline) {
-  TestNewlineSplitter(
-      "normal string\nsecond string\nthirdstring\n",
-      std::vector<std::string>{"normal string", "second string", "thirdstring", ""});
-}
-
-TEST(logging_splitters, NewlineSplitter_MultilineEmbeddedNewlines) {
-  TestNewlineSplitter(
-      "normal string\n\n\nsecond string\n\nthirdstring\n",
-      std::vector<std::string>{"normal string", "", "", "second string", "", "thirdstring", ""});
-}
-
-void TestLogdChunkSplitter(const std::string& tag, const std::string& file,
-                           const std::string& input,
-                           const std::vector<std::string>& expected_output) {
-  std::vector<std::string> output;
-  auto logger_function = [&](LogId, LogSeverity, const char*, const char* msg) {
-    output.push_back(msg);
-  };
-
-  SplitByLogdChunks(MAIN, FATAL, tag.c_str(), file.empty() ? nullptr : file.c_str(), 1000,
-                    input.c_str(), logger_function);
-
-  auto return_lengths = [&] {
-    std::string sizes;
-    sizes += "expected_output sizes:";
-    for (const auto& string : expected_output) {
-      sizes += " " + std::to_string(string.size());
-    }
-    sizes += "\noutput sizes:";
-    for (const auto& string : output) {
-      sizes += " " + std::to_string(string.size());
-    }
-    return sizes;
-  };
-
-  EXPECT_EQ(expected_output, output) << return_lengths();
-}
-
-TEST(logging_splitters, LogdChunkSplitter_EmptyString) {
-  TestLogdChunkSplitter("tag", "", "", std::vector<std::string>{""});
-}
-
-TEST(logging_splitters, LogdChunkSplitter_BasicString) {
-  TestLogdChunkSplitter("tag", "", "normal string", std::vector<std::string>{"normal string"});
-}
-
-TEST(logging_splitters, LogdChunkSplitter_NormalBasicStringTrailingNewline) {
-  TestLogdChunkSplitter("tag", "", "normal string\n", std::vector<std::string>{"normal string\n"});
-}
-
-TEST(logging_splitters, LogdChunkSplitter_MultilineTrailing) {
-  TestLogdChunkSplitter("tag", "", "normal string\nsecond string\nthirdstring",
-                        std::vector<std::string>{"normal string\nsecond string\nthirdstring"});
-}
-
-TEST(logging_splitters, LogdChunkSplitter_MultilineTrailingNewline) {
-  TestLogdChunkSplitter("tag", "", "normal string\nsecond string\nthirdstring\n",
-                        std::vector<std::string>{"normal string\nsecond string\nthirdstring\n"});
-}
-
-TEST(logging_splitters, LogdChunkSplitter_MultilineEmbeddedNewlines) {
-  TestLogdChunkSplitter(
-      "tag", "", "normal string\n\n\nsecond string\n\nthirdstring\n",
-      std::vector<std::string>{"normal string\n\n\nsecond string\n\nthirdstring\n"});
-}
-
-// This test should return the same string, the logd logger itself will truncate down to size.
-// This has historically been the behavior both in libbase and liblog.
-TEST(logging_splitters, LogdChunkSplitter_HugeLineNoNewline) {
-  auto long_string = std::string(LOGGER_ENTRY_MAX_PAYLOAD, 'x');
-  ASSERT_EQ(LOGGER_ENTRY_MAX_PAYLOAD, static_cast<int>(long_string.size()));
-
-  TestLogdChunkSplitter("tag", "", long_string, std::vector{long_string});
-}
-
-std::string ReduceToMaxSize(const std::string& tag, const std::string& string) {
-  return string.substr(0, LOGGER_ENTRY_MAX_PAYLOAD - tag.size() - 35);
-}
-
-TEST(logging_splitters, LogdChunkSplitter_MultipleHugeLineNoNewline) {
-  auto long_string_x = std::string(LOGGER_ENTRY_MAX_PAYLOAD, 'x');
-  auto long_string_y = std::string(LOGGER_ENTRY_MAX_PAYLOAD, 'y');
-  auto long_string_z = std::string(LOGGER_ENTRY_MAX_PAYLOAD, 'z');
-
-  auto long_strings = long_string_x + '\n' + long_string_y + '\n' + long_string_z;
-
-  std::string tag = "tag";
-  std::vector expected = {ReduceToMaxSize(tag, long_string_x), ReduceToMaxSize(tag, long_string_y),
-                          long_string_z};
-
-  TestLogdChunkSplitter(tag, "", long_strings, expected);
-}
-
-// With a ~4k buffer, we should print 2 long strings per logger call.
-TEST(logging_splitters, LogdChunkSplitter_Multiple2kLines) {
-  std::vector expected = {
-      std::string(2000, 'a') + '\n' + std::string(2000, 'b'),
-      std::string(2000, 'c') + '\n' + std::string(2000, 'd'),
-      std::string(2000, 'e') + '\n' + std::string(2000, 'f'),
-  };
-
-  auto long_strings = Join(expected, '\n');
-
-  TestLogdChunkSplitter("tag", "", long_strings, expected);
-}
-
-TEST(logging_splitters, LogdChunkSplitter_ExactSizedLines) {
-  const char* tag = "tag";
-  ptrdiff_t max_size = LOGGER_ENTRY_MAX_PAYLOAD - strlen(tag) - 35;
-  auto long_string_a = std::string(max_size, 'a');
-  auto long_string_b = std::string(max_size, 'b');
-  auto long_string_c = std::string(max_size, 'c');
-
-  auto long_strings = long_string_a + '\n' + long_string_b + '\n' + long_string_c;
-
-  TestLogdChunkSplitter(tag, "", long_strings,
-                        std::vector{long_string_a, long_string_b, long_string_c});
-}
-
-TEST(logging_splitters, LogdChunkSplitter_UnderEqualOver) {
-  std::string tag = "tag";
-  ptrdiff_t max_size = LOGGER_ENTRY_MAX_PAYLOAD - tag.size() - 35;
-
-  auto first_string_size = 1000;
-  auto first_string = std::string(first_string_size, 'a');
-  auto second_string_size = max_size - first_string_size - 1;
-  auto second_string = std::string(second_string_size, 'b');
-
-  auto exact_string = std::string(max_size, 'c');
-
-  auto large_string = std::string(max_size + 50, 'd');
-
-  auto final_string = std::string("final string!\n\nfinal \n \n final \n");
-
-  std::vector expected = {first_string + '\n' + second_string, exact_string,
-                          ReduceToMaxSize(tag, large_string), final_string};
-
-  std::vector input_strings = {first_string + '\n' + second_string, exact_string, large_string,
-                               final_string};
-  auto long_strings = Join(input_strings, '\n');
-
-  TestLogdChunkSplitter(tag, "", long_strings, expected);
-}
-
-TEST(logging_splitters, LogdChunkSplitter_WithFile) {
-  std::string tag = "tag";
-  std::string file = "/path/to/myfile.cpp";
-  int line = 1000;
-  auto file_header = StringPrintf("%s:%d] ", file.c_str(), line);
-  ptrdiff_t max_size = LOGGER_ENTRY_MAX_PAYLOAD - tag.size() - 35;
-
-  auto first_string_size = 1000;
-  auto first_string = std::string(first_string_size, 'a');
-  auto second_string_size = max_size - first_string_size - 1 - 2 * file_header.size();
-  auto second_string = std::string(second_string_size, 'b');
-
-  auto exact_string = std::string(max_size - file_header.size(), 'c');
-
-  auto large_string = std::string(max_size + 50, 'd');
-
-  auto final_string = std::string("final string!");
-
-  std::vector expected = {
-      file_header + first_string + '\n' + file_header + second_string, file_header + exact_string,
-      file_header + ReduceToMaxSize(file_header + tag, large_string), file_header + final_string};
-
-  std::vector input_strings = {first_string + '\n' + second_string, exact_string, large_string,
-                               final_string};
-  auto long_strings = Join(input_strings, '\n');
-
-  TestLogdChunkSplitter(tag, file, long_strings, expected);
-}
-
-// We set max_size based off of tag, so if it's too large, the buffer will be sized wrong.
-// We could recover from this, but it's certainly an error for someone to attempt to use a tag this
-// large, so we abort instead.
-TEST(logging_splitters, LogdChunkSplitter_TooLongTag) {
-  auto long_tag = std::string(5000, 'x');
-  auto logger_function = [](LogId, LogSeverity, const char*, const char*) {};
-  ASSERT_DEATH(
-      SplitByLogdChunks(MAIN, ERROR, long_tag.c_str(), nullptr, 0, "message", logger_function), "");
-}
-
-// We do handle excessively large file names correctly however.
-TEST(logging_splitters, LogdChunkSplitter_TooLongFile) {
-  auto long_file = std::string(5000, 'x');
-  std::string tag = "tag";
-
-  std::vector expected = {ReduceToMaxSize(tag, long_file), ReduceToMaxSize(tag, long_file)};
-
-  TestLogdChunkSplitter(tag, long_file, "can't see me\nor me", expected);
-}
-
-void TestStderrOutputGenerator(const char* tag, const char* file, int line, const char* message,
-                               const std::string& expected) {
-  // All log messages will show "01-01 00:00:00"
-  struct tm now = {
-      .tm_sec = 0,
-      .tm_min = 0,
-      .tm_hour = 0,
-      .tm_mday = 1,
-      .tm_mon = 0,
-      .tm_year = 1970,
-  };
-
-  int pid = 1234;       // All log messages will have 1234 for their PID.
-  uint64_t tid = 4321;  // All log messages will have 4321 for their TID.
-
-  auto result = StderrOutputGenerator(now, pid, tid, ERROR, tag, file, line, message);
-  EXPECT_EQ(expected, result);
-}
-
-TEST(logging_splitters, StderrOutputGenerator_Basic) {
-  TestStderrOutputGenerator(nullptr, nullptr, 0, "simple message",
-                            "nullptr E 01-01 00:00:00  1234  4321 simple message\n");
-  TestStderrOutputGenerator("tag", nullptr, 0, "simple message",
-                            "tag E 01-01 00:00:00  1234  4321 simple message\n");
-  TestStderrOutputGenerator(
-      "tag", "/path/to/some/file", 0, "simple message",
-      "tag E 01-01 00:00:00  1234  4321 /path/to/some/file:0] simple message\n");
-}
-
-TEST(logging_splitters, StderrOutputGenerator_NewlineTagAndFile) {
-  TestStderrOutputGenerator("tag\n\n", nullptr, 0, "simple message",
-                            "tag\n\n E 01-01 00:00:00  1234  4321 simple message\n");
-  TestStderrOutputGenerator(
-      "tag", "/path/to/some/file\n\n", 0, "simple message",
-      "tag E 01-01 00:00:00  1234  4321 /path/to/some/file\n\n:0] simple message\n");
-}
-
-TEST(logging_splitters, StderrOutputGenerator_TrailingNewLine) {
-  TestStderrOutputGenerator(
-      "tag", nullptr, 0, "simple message\n",
-      "tag E 01-01 00:00:00  1234  4321 simple message\ntag E 01-01 00:00:00  1234  4321 \n");
-}
-
-TEST(logging_splitters, StderrOutputGenerator_MultiLine) {
-  const char* expected_result =
-      "tag E 01-01 00:00:00  1234  4321 simple message\n"
-      "tag E 01-01 00:00:00  1234  4321 \n"
-      "tag E 01-01 00:00:00  1234  4321 \n"
-      "tag E 01-01 00:00:00  1234  4321 another message \n"
-      "tag E 01-01 00:00:00  1234  4321 \n"
-      "tag E 01-01 00:00:00  1234  4321  final message \n"
-      "tag E 01-01 00:00:00  1234  4321 \n"
-      "tag E 01-01 00:00:00  1234  4321 \n"
-      "tag E 01-01 00:00:00  1234  4321 \n";
-
-  TestStderrOutputGenerator("tag", nullptr, 0,
-                            "simple message\n\n\nanother message \n\n final message \n\n\n",
-                            expected_result);
-}
-
-TEST(logging_splitters, StderrOutputGenerator_MultiLineLong) {
-  auto long_string_a = std::string(4000, 'a');
-  auto long_string_b = std::string(4000, 'b');
-
-  auto message = long_string_a + '\n' + long_string_b;
-  auto expected_result = "tag E 01-01 00:00:00  1234  4321 " + long_string_a + '\n' +
-                         "tag E 01-01 00:00:00  1234  4321 " + long_string_b + '\n';
-  TestStderrOutputGenerator("tag", nullptr, 0, message.c_str(), expected_result);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/logging_test.cpp b/base/logging_test.cpp
deleted file mode 100644
index 593e2c1..0000000
--- a/base/logging_test.cpp
+++ /dev/null
@@ -1,673 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "android-base/logging.h"
-
-#include <libgen.h>
-
-#if defined(_WIN32)
-#include <signal.h>
-#endif
-
-#include <regex>
-#include <string>
-#include <thread>
-
-#include "android-base/file.h"
-#include "android-base/scopeguard.h"
-#include "android-base/stringprintf.h"
-#include "android-base/test_utils.h"
-
-#include <gtest/gtest.h>
-
-#ifdef __ANDROID__
-#define HOST_TEST(suite, name) TEST(suite, DISABLED_ ## name)
-#else
-#define HOST_TEST(suite, name) TEST(suite, name)
-#endif
-
-#if defined(_WIN32)
-static void ExitSignalAbortHandler(int) {
-  _exit(3);
-}
-#endif
-
-static void SuppressAbortUI() {
-#if defined(_WIN32)
-  // We really just want to call _set_abort_behavior(0, _CALL_REPORTFAULT) to
-  // suppress the Windows Error Reporting dialog box, but that API is not
-  // available in the OS-supplied C Runtime, msvcrt.dll, that we currently
-  // use (it is available in the Visual Studio C runtime).
-  //
-  // Instead, we setup a SIGABRT handler, which is called in abort() right
-  // before calling Windows Error Reporting. In the handler, we exit the
-  // process just like abort() does.
-  ASSERT_NE(SIG_ERR, signal(SIGABRT, ExitSignalAbortHandler));
-#endif
-}
-
-TEST(logging, CHECK) {
-  ASSERT_DEATH({SuppressAbortUI(); CHECK(false);}, "Check failed: false ");
-  CHECK(true);
-
-  ASSERT_DEATH({SuppressAbortUI(); CHECK_EQ(0, 1);}, "Check failed: 0 == 1 ");
-  CHECK_EQ(0, 0);
-
-  ASSERT_DEATH({SuppressAbortUI(); CHECK_STREQ("foo", "bar");},
-               R"(Check failed: "foo" == "bar")");
-  CHECK_STREQ("foo", "foo");
-
-  // Test whether CHECK() and CHECK_STREQ() have a dangling if with no else.
-  bool flag = false;
-  if (true)
-    CHECK(true);
-  else
-    flag = true;
-  EXPECT_FALSE(flag) << "CHECK macro probably has a dangling if with no else";
-
-  flag = false;
-  if (true)
-    CHECK_STREQ("foo", "foo");
-  else
-    flag = true;
-  EXPECT_FALSE(flag) << "CHECK_STREQ probably has a dangling if with no else";
-}
-
-TEST(logging, DCHECK) {
-  if (android::base::kEnableDChecks) {
-    ASSERT_DEATH({SuppressAbortUI(); DCHECK(false);}, "DCheck failed: false ");
-  }
-  DCHECK(true);
-
-  if (android::base::kEnableDChecks) {
-    ASSERT_DEATH({SuppressAbortUI(); DCHECK_EQ(0, 1);}, "DCheck failed: 0 == 1 ");
-  }
-  DCHECK_EQ(0, 0);
-
-  if (android::base::kEnableDChecks) {
-    ASSERT_DEATH({SuppressAbortUI(); DCHECK_STREQ("foo", "bar");},
-                 R"(DCheck failed: "foo" == "bar")");
-  }
-  DCHECK_STREQ("foo", "foo");
-
-  // No testing whether we have a dangling else, possibly. That's inherent to the if (constexpr)
-  // setup we intentionally chose to force type-checks of debug code even in release builds (so
-  // we don't get more bit-rot).
-}
-
-
-#define CHECK_WOULD_LOG_DISABLED(severity)                                               \
-  static_assert(android::base::severity < android::base::FATAL, "Bad input");            \
-  for (size_t i = static_cast<size_t>(android::base::severity) + 1;                      \
-       i <= static_cast<size_t>(android::base::FATAL);                                   \
-       ++i) {                                                                            \
-    {                                                                                    \
-      android::base::ScopedLogSeverity sls2(static_cast<android::base::LogSeverity>(i)); \
-      EXPECT_FALSE(WOULD_LOG(severity)) << i;                                            \
-    }                                                                                    \
-    {                                                                                    \
-      android::base::ScopedLogSeverity sls2(static_cast<android::base::LogSeverity>(i)); \
-      EXPECT_FALSE(WOULD_LOG(::android::base::severity)) << i;                           \
-    }                                                                                    \
-  }                                                                                      \
-
-#define CHECK_WOULD_LOG_ENABLED(severity)                                                \
-  for (size_t i = static_cast<size_t>(android::base::VERBOSE);                           \
-       i <= static_cast<size_t>(android::base::severity);                                \
-       ++i) {                                                                            \
-    {                                                                                    \
-      android::base::ScopedLogSeverity sls2(static_cast<android::base::LogSeverity>(i)); \
-      EXPECT_TRUE(WOULD_LOG(severity)) << i;                                             \
-    }                                                                                    \
-    {                                                                                    \
-      android::base::ScopedLogSeverity sls2(static_cast<android::base::LogSeverity>(i)); \
-      EXPECT_TRUE(WOULD_LOG(::android::base::severity)) << i;                            \
-    }                                                                                    \
-  }                                                                                      \
-
-TEST(logging, WOULD_LOG_FATAL) {
-  CHECK_WOULD_LOG_ENABLED(FATAL);
-}
-
-TEST(logging, WOULD_LOG_FATAL_WITHOUT_ABORT_enabled) {
-  CHECK_WOULD_LOG_ENABLED(FATAL_WITHOUT_ABORT);
-}
-
-TEST(logging, WOULD_LOG_ERROR_disabled) {
-  CHECK_WOULD_LOG_DISABLED(ERROR);
-}
-
-TEST(logging, WOULD_LOG_ERROR_enabled) {
-  CHECK_WOULD_LOG_ENABLED(ERROR);
-}
-
-TEST(logging, WOULD_LOG_WARNING_disabled) {
-  CHECK_WOULD_LOG_DISABLED(WARNING);
-}
-
-TEST(logging, WOULD_LOG_WARNING_enabled) {
-  CHECK_WOULD_LOG_ENABLED(WARNING);
-}
-
-TEST(logging, WOULD_LOG_INFO_disabled) {
-  CHECK_WOULD_LOG_DISABLED(INFO);
-}
-
-TEST(logging, WOULD_LOG_INFO_enabled) {
-  CHECK_WOULD_LOG_ENABLED(INFO);
-}
-
-TEST(logging, WOULD_LOG_DEBUG_disabled) {
-  CHECK_WOULD_LOG_DISABLED(DEBUG);
-}
-
-TEST(logging, WOULD_LOG_DEBUG_enabled) {
-  CHECK_WOULD_LOG_ENABLED(DEBUG);
-}
-
-TEST(logging, WOULD_LOG_VERBOSE_disabled) {
-  CHECK_WOULD_LOG_DISABLED(VERBOSE);
-}
-
-TEST(logging, WOULD_LOG_VERBOSE_enabled) {
-  CHECK_WOULD_LOG_ENABLED(VERBOSE);
-}
-
-#undef CHECK_WOULD_LOG_DISABLED
-#undef CHECK_WOULD_LOG_ENABLED
-
-
-#if !defined(_WIN32)
-static std::string make_log_pattern(android::base::LogSeverity severity,
-                                    const char* message) {
-  static const char log_characters[] = "VDIWEFF";
-  static_assert(arraysize(log_characters) - 1 == android::base::FATAL + 1,
-                "Mismatch in size of log_characters and values in LogSeverity");
-  char log_char = log_characters[severity];
-  std::string holder(__FILE__);
-  return android::base::StringPrintf(
-      "%c \\d+-\\d+ \\d+:\\d+:\\d+ \\s*\\d+ \\s*\\d+ %s:\\d+] %s",
-      log_char, basename(&holder[0]), message);
-}
-#endif
-
-static void CheckMessage(const std::string& output, android::base::LogSeverity severity,
-                         const char* expected, const char* expected_tag = nullptr) {
-  // We can't usefully check the output of any of these on Windows because we
-  // don't have std::regex, but we can at least make sure we printed at least as
-  // many characters are in the log message.
-  ASSERT_GT(output.length(), strlen(expected));
-  ASSERT_NE(nullptr, strstr(output.c_str(), expected)) << output;
-  if (expected_tag != nullptr) {
-    ASSERT_NE(nullptr, strstr(output.c_str(), expected_tag)) << output;
-  }
-
-#if !defined(_WIN32)
-  std::string regex_str;
-  if (expected_tag != nullptr) {
-    regex_str.append(expected_tag);
-    regex_str.append(" ");
-  }
-  regex_str.append(make_log_pattern(severity, expected));
-  std::regex message_regex(regex_str);
-  ASSERT_TRUE(std::regex_search(output, message_regex)) << output;
-#endif
-}
-
-static void CheckMessage(CapturedStderr& cap, android::base::LogSeverity severity,
-                         const char* expected, const char* expected_tag = nullptr) {
-  cap.Stop();
-  std::string output = cap.str();
-  return CheckMessage(output, severity, expected, expected_tag);
-}
-
-#define CHECK_LOG_STREAM_DISABLED(severity)                      \
-  {                                                              \
-    android::base::ScopedLogSeverity sls1(android::base::FATAL); \
-    CapturedStderr cap1;                                         \
-    LOG_STREAM(severity) << "foo bar";                           \
-    cap1.Stop();                                                 \
-    ASSERT_EQ("", cap1.str());                                   \
-  }                                                              \
-  {                                                              \
-    android::base::ScopedLogSeverity sls1(android::base::FATAL); \
-    CapturedStderr cap1;                                         \
-    LOG_STREAM(::android::base::severity) << "foo bar";          \
-    cap1.Stop();                                                 \
-    ASSERT_EQ("", cap1.str());                                   \
-  }
-
-#define CHECK_LOG_STREAM_ENABLED(severity) \
-  { \
-    android::base::ScopedLogSeverity sls2(android::base::severity); \
-    CapturedStderr cap2; \
-    LOG_STREAM(severity) << "foobar"; \
-    CheckMessage(cap2, android::base::severity, "foobar"); \
-  } \
-  { \
-    android::base::ScopedLogSeverity sls2(android::base::severity); \
-    CapturedStderr cap2; \
-    LOG_STREAM(::android::base::severity) << "foobar"; \
-    CheckMessage(cap2, android::base::severity, "foobar"); \
-  } \
-
-TEST(logging, LOG_STREAM_FATAL_WITHOUT_ABORT_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_STREAM_ENABLED(FATAL_WITHOUT_ABORT));
-}
-
-TEST(logging, LOG_STREAM_ERROR_disabled) {
-  CHECK_LOG_STREAM_DISABLED(ERROR);
-}
-
-TEST(logging, LOG_STREAM_ERROR_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_STREAM_ENABLED(ERROR));
-}
-
-TEST(logging, LOG_STREAM_WARNING_disabled) {
-  CHECK_LOG_STREAM_DISABLED(WARNING);
-}
-
-TEST(logging, LOG_STREAM_WARNING_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_STREAM_ENABLED(WARNING));
-}
-
-TEST(logging, LOG_STREAM_INFO_disabled) {
-  CHECK_LOG_STREAM_DISABLED(INFO);
-}
-
-TEST(logging, LOG_STREAM_INFO_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_STREAM_ENABLED(INFO));
-}
-
-TEST(logging, LOG_STREAM_DEBUG_disabled) {
-  CHECK_LOG_STREAM_DISABLED(DEBUG);
-}
-
-TEST(logging, LOG_STREAM_DEBUG_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_STREAM_ENABLED(DEBUG));
-}
-
-TEST(logging, LOG_STREAM_VERBOSE_disabled) {
-  CHECK_LOG_STREAM_DISABLED(VERBOSE);
-}
-
-TEST(logging, LOG_STREAM_VERBOSE_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_STREAM_ENABLED(VERBOSE));
-}
-
-#undef CHECK_LOG_STREAM_DISABLED
-#undef CHECK_LOG_STREAM_ENABLED
-
-#define CHECK_LOG_DISABLED(severity)                             \
-  {                                                              \
-    android::base::ScopedLogSeverity sls1(android::base::FATAL); \
-    CapturedStderr cap1;                                         \
-    LOG(severity) << "foo bar";                                  \
-    cap1.Stop();                                                 \
-    ASSERT_EQ("", cap1.str());                                   \
-  }                                                              \
-  {                                                              \
-    android::base::ScopedLogSeverity sls1(android::base::FATAL); \
-    CapturedStderr cap1;                                         \
-    LOG(::android::base::severity) << "foo bar";                 \
-    cap1.Stop();                                                 \
-    ASSERT_EQ("", cap1.str());                                   \
-  }
-
-#define CHECK_LOG_ENABLED(severity) \
-  { \
-    android::base::ScopedLogSeverity sls2(android::base::severity); \
-    CapturedStderr cap2; \
-    LOG(severity) << "foobar"; \
-    CheckMessage(cap2, android::base::severity, "foobar"); \
-  } \
-  { \
-    android::base::ScopedLogSeverity sls2(android::base::severity); \
-    CapturedStderr cap2; \
-    LOG(::android::base::severity) << "foobar"; \
-    CheckMessage(cap2, android::base::severity, "foobar"); \
-  } \
-
-TEST(logging, LOG_FATAL) {
-  ASSERT_DEATH({SuppressAbortUI(); LOG(FATAL) << "foobar";}, "foobar");
-  ASSERT_DEATH({SuppressAbortUI(); LOG(::android::base::FATAL) << "foobar";}, "foobar");
-}
-
-TEST(logging, LOG_FATAL_WITHOUT_ABORT_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_ENABLED(FATAL_WITHOUT_ABORT));
-}
-
-TEST(logging, LOG_ERROR_disabled) {
-  CHECK_LOG_DISABLED(ERROR);
-}
-
-TEST(logging, LOG_ERROR_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_ENABLED(ERROR));
-}
-
-TEST(logging, LOG_WARNING_disabled) {
-  CHECK_LOG_DISABLED(WARNING);
-}
-
-TEST(logging, LOG_WARNING_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_ENABLED(WARNING));
-}
-
-TEST(logging, LOG_INFO_disabled) {
-  CHECK_LOG_DISABLED(INFO);
-}
-
-TEST(logging, LOG_INFO_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_ENABLED(INFO));
-}
-
-TEST(logging, LOG_DEBUG_disabled) {
-  CHECK_LOG_DISABLED(DEBUG);
-}
-
-TEST(logging, LOG_DEBUG_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_ENABLED(DEBUG));
-}
-
-TEST(logging, LOG_VERBOSE_disabled) {
-  CHECK_LOG_DISABLED(VERBOSE);
-}
-
-TEST(logging, LOG_VERBOSE_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_LOG_ENABLED(VERBOSE));
-}
-
-#undef CHECK_LOG_DISABLED
-#undef CHECK_LOG_ENABLED
-
-TEST(logging, LOG_complex_param) {
-#define CHECK_LOG_COMBINATION(use_scoped_log_severity_info, use_logging_severity_info)         \
-  {                                                                                            \
-    android::base::ScopedLogSeverity sls(                                                      \
-        (use_scoped_log_severity_info) ? ::android::base::INFO : ::android::base::WARNING);    \
-    CapturedStderr cap;                                                                        \
-    LOG((use_logging_severity_info) ? ::android::base::INFO : ::android::base::WARNING)        \
-        << "foobar";                                                                           \
-    if ((use_scoped_log_severity_info) || !(use_logging_severity_info)) {                      \
-      ASSERT_NO_FATAL_FAILURE(CheckMessage(                                                    \
-          cap, (use_logging_severity_info) ? ::android::base::INFO : ::android::base::WARNING, \
-          "foobar"));                                                                          \
-    } else {                                                                                   \
-      cap.Stop();                                                                              \
-      ASSERT_EQ("", cap.str());                                                                \
-    }                                                                                          \
-  }
-
-  CHECK_LOG_COMBINATION(false,false);
-  CHECK_LOG_COMBINATION(false,true);
-  CHECK_LOG_COMBINATION(true,false);
-  CHECK_LOG_COMBINATION(true,true);
-
-#undef CHECK_LOG_COMBINATION
-}
-
-
-TEST(logging, LOG_does_not_clobber_errno) {
-  CapturedStderr cap;
-  errno = 12345;
-  LOG(INFO) << (errno = 67890);
-  EXPECT_EQ(12345, errno) << "errno was not restored";
-
-  ASSERT_NO_FATAL_FAILURE(CheckMessage(cap, android::base::INFO, "67890"));
-}
-
-TEST(logging, PLOG_does_not_clobber_errno) {
-  CapturedStderr cap;
-  errno = 12345;
-  PLOG(INFO) << (errno = 67890);
-  EXPECT_EQ(12345, errno) << "errno was not restored";
-
-  ASSERT_NO_FATAL_FAILURE(CheckMessage(cap, android::base::INFO, "67890"));
-}
-
-TEST(logging, LOG_does_not_have_dangling_if) {
-  CapturedStderr cap; // So the logging below has no side-effects.
-
-  // Do the test two ways: once where we hypothesize that LOG()'s if
-  // will evaluate to true (when severity is high enough) and once when we
-  // expect it to evaluate to false (when severity is not high enough).
-  bool flag = false;
-  if (true)
-    LOG(INFO) << "foobar";
-  else
-    flag = true;
-
-  EXPECT_FALSE(flag) << "LOG macro probably has a dangling if with no else";
-
-  flag = false;
-  if (true)
-    LOG(VERBOSE) << "foobar";
-  else
-    flag = true;
-
-  EXPECT_FALSE(flag) << "LOG macro probably has a dangling if with no else";
-}
-
-#define CHECK_PLOG_DISABLED(severity)                            \
-  {                                                              \
-    android::base::ScopedLogSeverity sls1(android::base::FATAL); \
-    CapturedStderr cap1;                                         \
-    PLOG(severity) << "foo bar";                                 \
-    cap1.Stop();                                                 \
-    ASSERT_EQ("", cap1.str());                                   \
-  }                                                              \
-  {                                                              \
-    android::base::ScopedLogSeverity sls1(android::base::FATAL); \
-    CapturedStderr cap1;                                         \
-    PLOG(severity) << "foo bar";                                 \
-    cap1.Stop();                                                 \
-    ASSERT_EQ("", cap1.str());                                   \
-  }
-
-#define CHECK_PLOG_ENABLED(severity) \
-  { \
-    android::base::ScopedLogSeverity sls2(android::base::severity); \
-    CapturedStderr cap2; \
-    errno = ENOENT; \
-    PLOG(severity) << "foobar"; \
-    CheckMessage(cap2, android::base::severity, "foobar: No such file or directory"); \
-  } \
-  { \
-    android::base::ScopedLogSeverity sls2(android::base::severity); \
-    CapturedStderr cap2; \
-    errno = ENOENT; \
-    PLOG(severity) << "foobar"; \
-    CheckMessage(cap2, android::base::severity, "foobar: No such file or directory"); \
-  } \
-
-TEST(logging, PLOG_FATAL) {
-  ASSERT_DEATH({SuppressAbortUI(); PLOG(FATAL) << "foobar";}, "foobar");
-  ASSERT_DEATH({SuppressAbortUI(); PLOG(::android::base::FATAL) << "foobar";}, "foobar");
-}
-
-TEST(logging, PLOG_FATAL_WITHOUT_ABORT_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_PLOG_ENABLED(FATAL_WITHOUT_ABORT));
-}
-
-TEST(logging, PLOG_ERROR_disabled) {
-  CHECK_PLOG_DISABLED(ERROR);
-}
-
-TEST(logging, PLOG_ERROR_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_PLOG_ENABLED(ERROR));
-}
-
-TEST(logging, PLOG_WARNING_disabled) {
-  CHECK_PLOG_DISABLED(WARNING);
-}
-
-TEST(logging, PLOG_WARNING_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_PLOG_ENABLED(WARNING));
-}
-
-TEST(logging, PLOG_INFO_disabled) {
-  CHECK_PLOG_DISABLED(INFO);
-}
-
-TEST(logging, PLOG_INFO_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_PLOG_ENABLED(INFO));
-}
-
-TEST(logging, PLOG_DEBUG_disabled) {
-  CHECK_PLOG_DISABLED(DEBUG);
-}
-
-TEST(logging, PLOG_DEBUG_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_PLOG_ENABLED(DEBUG));
-}
-
-TEST(logging, PLOG_VERBOSE_disabled) {
-  CHECK_PLOG_DISABLED(VERBOSE);
-}
-
-TEST(logging, PLOG_VERBOSE_enabled) {
-  ASSERT_NO_FATAL_FAILURE(CHECK_PLOG_ENABLED(VERBOSE));
-}
-
-#undef CHECK_PLOG_DISABLED
-#undef CHECK_PLOG_ENABLED
-
-
-TEST(logging, UNIMPLEMENTED) {
-  std::string expected = android::base::StringPrintf("%s unimplemented ", __PRETTY_FUNCTION__);
-
-  CapturedStderr cap;
-  errno = ENOENT;
-  UNIMPLEMENTED(ERROR);
-  ASSERT_NO_FATAL_FAILURE(CheckMessage(cap, android::base::ERROR, expected.c_str()));
-}
-
-static void NoopAborter(const char* msg ATTRIBUTE_UNUSED) {
-  LOG(ERROR) << "called noop";
-}
-
-TEST(logging, LOG_FATAL_NOOP_ABORTER) {
-  CapturedStderr cap;
-  {
-    android::base::SetAborter(NoopAborter);
-
-    android::base::ScopedLogSeverity sls(android::base::ERROR);
-    LOG(FATAL) << "foobar";
-    cap.Stop();
-
-    android::base::SetAborter(android::base::DefaultAborter);
-  }
-  std::string output = cap.str();
-  ASSERT_NO_FATAL_FAILURE(CheckMessage(output, android::base::FATAL, "foobar"));
-  ASSERT_NO_FATAL_FAILURE(CheckMessage(output, android::base::ERROR, "called noop"));
-
-  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);
-}
-
-__attribute__((constructor)) void TestLoggingInConstructor() {
-  LOG(ERROR) << "foobar";
-}
-
-TEST(logging, StdioLogger) {
-  CapturedStderr cap_err;
-  CapturedStdout cap_out;
-  android::base::SetLogger(android::base::StdioLogger);
-  LOG(INFO) << "out";
-  LOG(ERROR) << "err";
-  cap_err.Stop();
-  cap_out.Stop();
-
-  // For INFO we expect just the literal "out\n".
-  ASSERT_EQ("out\n", cap_out.str());
-  // Whereas ERROR logging includes the program name.
-  ASSERT_EQ(android::base::Basename(android::base::GetExecutablePath()) + ": err\n", cap_err.str());
-}
-
-TEST(logging, ForkSafe) {
-#if !defined(_WIN32)
-  using namespace android::base;
-  SetLogger(
-      [&](LogId, LogSeverity, const char*, const char*, unsigned int, const char*) { sleep(3); });
-
-  auto guard = make_scope_guard([&] {
-#ifdef __ANDROID__
-    SetLogger(LogdLogger());
-#else
-    SetLogger(StderrLogger);
-#endif
-  });
-
-  auto thread = std::thread([] {
-    LOG(ERROR) << "This should sleep for 3 seconds, long enough to fork another process, if there "
-                  "is no intervention";
-  });
-  thread.detach();
-
-  auto pid = fork();
-  ASSERT_NE(-1, pid);
-
-  if (pid == 0) {
-    // Reset the logger, so the next message doesn't sleep().
-    SetLogger([](LogId, LogSeverity, const char*, const char*, unsigned int, const char*) {});
-    LOG(ERROR) << "This should succeed in the child, only if libbase is forksafe.";
-    _exit(EXIT_SUCCESS);
-  }
-
-  // Wait for up to 3 seconds for the child to exit.
-  int tries = 3;
-  bool found_child = false;
-  while (tries-- > 0) {
-    auto result = waitpid(pid, nullptr, WNOHANG);
-    EXPECT_NE(-1, result);
-    if (result == pid) {
-      found_child = true;
-      break;
-    }
-    sleep(1);
-  }
-
-  EXPECT_TRUE(found_child);
-
-  // Kill the child if it did not exit.
-  if (!found_child) {
-    kill(pid, SIGKILL);
-  }
-#endif
-}
diff --git a/base/macros_test.cpp b/base/macros_test.cpp
deleted file mode 100644
index 2b522db..0000000
--- a/base/macros_test.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "android-base/macros.h"
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-TEST(macros, SIZEOF_MEMBER_macro) {
-  struct S {
-    int32_t i32;
-    double d;
-  };
-  ASSERT_EQ(4U, SIZEOF_MEMBER(S, i32));
-  ASSERT_EQ(8U, SIZEOF_MEMBER(S, d));
-}
diff --git a/base/mapped_file.cpp b/base/mapped_file.cpp
deleted file mode 100644
index fff3453..0000000
--- a/base/mapped_file.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "android-base/mapped_file.h"
-
-#include <utility>
-
-#include <errno.h>
-
-namespace android {
-namespace base {
-
-static constexpr char kEmptyBuffer[] = {'0'};
-
-static off64_t InitPageSize() {
-#if defined(_WIN32)
-  SYSTEM_INFO si;
-  GetSystemInfo(&si);
-  return si.dwAllocationGranularity;
-#else
-  return sysconf(_SC_PAGE_SIZE);
-#endif
-}
-
-std::unique_ptr<MappedFile> MappedFile::FromFd(borrowed_fd fd, off64_t offset, size_t length,
-                                               int prot) {
-#if defined(_WIN32)
-  return FromOsHandle(reinterpret_cast<HANDLE>(_get_osfhandle(fd.get())), offset, length, prot);
-#else
-  return FromOsHandle(fd.get(), offset, length, prot);
-#endif
-}
-
-std::unique_ptr<MappedFile> MappedFile::FromOsHandle(os_handle h, off64_t offset, size_t length,
-                                                     int prot) {
-  static const off64_t page_size = InitPageSize();
-  size_t slop = offset % page_size;
-  off64_t file_offset = offset - slop;
-  off64_t file_length = length + slop;
-
-#if defined(_WIN32)
-  HANDLE handle = CreateFileMappingW(
-      h, nullptr, (prot & PROT_WRITE) ? PAGE_READWRITE : PAGE_READONLY, 0, 0, nullptr);
-  if (handle == nullptr) {
-    // http://b/119818070 "app crashes when reading asset of zero length".
-    // Return a MappedFile that's only valid for reading the size.
-    if (length == 0 && ::GetLastError() == ERROR_FILE_INVALID) {
-      return std::unique_ptr<MappedFile>(
-          new MappedFile(const_cast<char*>(kEmptyBuffer), 0, 0, nullptr));
-    }
-    return nullptr;
-  }
-  void* base = MapViewOfFile(handle, (prot & PROT_WRITE) ? FILE_MAP_ALL_ACCESS : FILE_MAP_READ, 0,
-                             file_offset, file_length);
-  if (base == nullptr) {
-    CloseHandle(handle);
-    return nullptr;
-  }
-  return std::unique_ptr<MappedFile>(
-      new MappedFile(static_cast<char*>(base), length, slop, handle));
-#else
-  void* base = mmap(nullptr, file_length, prot, MAP_SHARED, h, file_offset);
-  if (base == MAP_FAILED) {
-    // http://b/119818070 "app crashes when reading asset of zero length".
-    // mmap fails with EINVAL for a zero length region.
-    if (errno == EINVAL && length == 0) {
-      return std::unique_ptr<MappedFile>(new MappedFile(const_cast<char*>(kEmptyBuffer), 0, 0));
-    }
-    return nullptr;
-  }
-  return std::unique_ptr<MappedFile>(new MappedFile(static_cast<char*>(base), length, slop));
-#endif
-}
-
-MappedFile::MappedFile(MappedFile&& other)
-    : base_(std::exchange(other.base_, nullptr)),
-      size_(std::exchange(other.size_, 0)),
-      offset_(std::exchange(other.offset_, 0))
-#ifdef _WIN32
-      ,
-      handle_(std::exchange(other.handle_, nullptr))
-#endif
-{
-}
-
-MappedFile& MappedFile::operator=(MappedFile&& other) {
-  Close();
-  base_ = std::exchange(other.base_, nullptr);
-  size_ = std::exchange(other.size_, 0);
-  offset_ = std::exchange(other.offset_, 0);
-#ifdef _WIN32
-  handle_ = std::exchange(other.handle_, nullptr);
-#endif
-  return *this;
-}
-
-MappedFile::~MappedFile() {
-  Close();
-}
-
-void MappedFile::Close() {
-#if defined(_WIN32)
-  if (base_ != nullptr && size_ != 0) UnmapViewOfFile(base_);
-  if (handle_ != nullptr) CloseHandle(handle_);
-  handle_ = nullptr;
-#else
-  if (base_ != nullptr && size_ != 0) munmap(base_, size_ + offset_);
-#endif
-
-  base_ = nullptr;
-  offset_ = size_ = 0;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/mapped_file_test.cpp b/base/mapped_file_test.cpp
deleted file mode 100644
index d21703c..0000000
--- a/base/mapped_file_test.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "android-base/mapped_file.h"
-
-#include <gtest/gtest.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <string>
-
-#include "android-base/file.h"
-
-TEST(mapped_file, smoke) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  ASSERT_TRUE(android::base::WriteStringToFd("hello world", tf.fd));
-
-  auto m = android::base::MappedFile::FromFd(tf.fd, 3, 2, PROT_READ);
-  ASSERT_EQ(2u, m->size());
-  ASSERT_EQ('l', m->data()[0]);
-  ASSERT_EQ('o', m->data()[1]);
-}
-
-TEST(mapped_file, zero_length_mapping) {
-  // http://b/119818070 "app crashes when reading asset of zero length".
-  // mmap fails with EINVAL for a zero length region.
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  auto m = android::base::MappedFile::FromFd(tf.fd, 4096, 0, PROT_READ);
-  EXPECT_EQ(0u, m->size());
-  EXPECT_NE(nullptr, m->data());
-}
diff --git a/base/no_destructor_test.cpp b/base/no_destructor_test.cpp
deleted file mode 100644
index f19468a..0000000
--- a/base/no_destructor_test.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/no_destructor.h"
-
-#include <gtest/gtest.h>
-
-struct __attribute__((packed)) Bomb {
-  Bomb() : magic_(123) {}
-
-  ~Bomb() { exit(42); }
-
-  int get() const { return magic_; }
-
- private:
-  [[maybe_unused]] char padding_;
-  int magic_;
-};
-
-TEST(no_destructor, bomb) {
-  ASSERT_EXIT(({
-                {
-                  Bomb b;
-                  if (b.get() != 123) exit(1);
-                }
-
-                exit(0);
-              }),
-              ::testing::ExitedWithCode(42), "");
-}
-
-TEST(no_destructor, defused) {
-  ASSERT_EXIT(({
-                {
-                  android::base::NoDestructor<Bomb> b;
-                  if (b->get() != 123) exit(1);
-                }
-
-                exit(0);
-              }),
-              ::testing::ExitedWithCode(0), "");
-}
-
-TEST(no_destructor, operators) {
-  android::base::NoDestructor<Bomb> b;
-  const android::base::NoDestructor<Bomb>& c = b;
-  ASSERT_EQ(123, b.get()->get());
-  ASSERT_EQ(123, b->get());
-  ASSERT_EQ(123, (*b).get());
-  ASSERT_EQ(123, c.get()->get());
-  ASSERT_EQ(123, c->get());
-  ASSERT_EQ(123, (*c).get());
-}
diff --git a/base/parsebool.cpp b/base/parsebool.cpp
deleted file mode 100644
index ff96fe9..0000000
--- a/base/parsebool.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/parsebool.h"
-#include <errno.h>
-
-namespace android {
-namespace base {
-
-ParseBoolResult ParseBool(std::string_view s) {
-  if (s == "1" || s == "y" || s == "yes" || s == "on" || s == "true") {
-    return ParseBoolResult::kTrue;
-  }
-  if (s == "0" || s == "n" || s == "no" || s == "off" || s == "false") {
-    return ParseBoolResult::kFalse;
-  }
-  return ParseBoolResult::kError;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/parsebool_test.cpp b/base/parsebool_test.cpp
deleted file mode 100644
index a081994..0000000
--- a/base/parsebool_test.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/parsebool.h"
-
-#include <errno.h>
-
-#include <gtest/gtest.h>
-#include <string_view>
-
-using android::base::ParseBool;
-using android::base::ParseBoolResult;
-
-TEST(parsebool, true_) {
-  static const char* yes[] = {
-      "1", "on", "true", "y", "yes",
-  };
-  for (const char* s : yes) {
-    ASSERT_EQ(ParseBoolResult::kTrue, ParseBool(s));
-  }
-}
-
-TEST(parsebool, false_) {
-  static const char* no[] = {
-      "0", "false", "n", "no", "off",
-  };
-  for (const char* s : no) {
-    ASSERT_EQ(ParseBoolResult::kFalse, ParseBool(s));
-  }
-}
-
-TEST(parsebool, invalid) {
-  ASSERT_EQ(ParseBoolResult::kError, ParseBool("blarg"));
-  ASSERT_EQ(ParseBoolResult::kError, ParseBool(""));
-}
diff --git a/base/parsedouble_test.cpp b/base/parsedouble_test.cpp
deleted file mode 100644
index ec3c10c..0000000
--- a/base/parsedouble_test.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/parsedouble.h"
-
-#include <gtest/gtest.h>
-
-TEST(parsedouble, double_smoke) {
-  double d;
-  ASSERT_FALSE(android::base::ParseDouble("", &d));
-  ASSERT_FALSE(android::base::ParseDouble("x", &d));
-  ASSERT_FALSE(android::base::ParseDouble("123.4x", &d));
-
-  ASSERT_TRUE(android::base::ParseDouble("123.4", &d));
-  ASSERT_DOUBLE_EQ(123.4, d);
-  ASSERT_TRUE(android::base::ParseDouble("-123.4", &d));
-  ASSERT_DOUBLE_EQ(-123.4, d);
-
-  ASSERT_TRUE(android::base::ParseDouble("0", &d, 0.0));
-  ASSERT_DOUBLE_EQ(0.0, d);
-  ASSERT_FALSE(android::base::ParseDouble("0", &d, 1e-9));
-  ASSERT_FALSE(android::base::ParseDouble("3.0", &d, -1.0, 2.0));
-  ASSERT_TRUE(android::base::ParseDouble("1.0", &d, 0.0, 2.0));
-  ASSERT_DOUBLE_EQ(1.0, d);
-
-  ASSERT_FALSE(android::base::ParseDouble("123.4x", nullptr));
-  ASSERT_TRUE(android::base::ParseDouble("-123.4", nullptr));
-  ASSERT_FALSE(android::base::ParseDouble("3.0", nullptr, -1.0, 2.0));
-  ASSERT_TRUE(android::base::ParseDouble("1.0", nullptr, 0.0, 2.0));
-}
-
-TEST(parsedouble, float_smoke) {
-  float f;
-  ASSERT_FALSE(android::base::ParseFloat("", &f));
-  ASSERT_FALSE(android::base::ParseFloat("x", &f));
-  ASSERT_FALSE(android::base::ParseFloat("123.4x", &f));
-
-  ASSERT_TRUE(android::base::ParseFloat("123.4", &f));
-  ASSERT_FLOAT_EQ(123.4, f);
-  ASSERT_TRUE(android::base::ParseFloat("-123.4", &f));
-  ASSERT_FLOAT_EQ(-123.4, f);
-
-  ASSERT_TRUE(android::base::ParseFloat("0", &f, 0.0));
-  ASSERT_FLOAT_EQ(0.0, f);
-  ASSERT_FALSE(android::base::ParseFloat("0", &f, 1e-9));
-  ASSERT_FALSE(android::base::ParseFloat("3.0", &f, -1.0, 2.0));
-  ASSERT_TRUE(android::base::ParseFloat("1.0", &f, 0.0, 2.0));
-  ASSERT_FLOAT_EQ(1.0, f);
-
-  ASSERT_FALSE(android::base::ParseFloat("123.4x", nullptr));
-  ASSERT_TRUE(android::base::ParseFloat("-123.4", nullptr));
-  ASSERT_FALSE(android::base::ParseFloat("3.0", nullptr, -1.0, 2.0));
-  ASSERT_TRUE(android::base::ParseFloat("1.0", nullptr, 0.0, 2.0));
-}
diff --git a/base/parseint_test.cpp b/base/parseint_test.cpp
deleted file mode 100644
index e449c33..0000000
--- a/base/parseint_test.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "android-base/parseint.h"
-
-#include <errno.h>
-
-#include <gtest/gtest.h>
-
-TEST(parseint, signed_smoke) {
-  errno = 0;
-  int i = 0;
-  ASSERT_FALSE(android::base::ParseInt("x", &i));
-  ASSERT_EQ(EINVAL, errno);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseInt("123x", &i));
-  ASSERT_EQ(EINVAL, errno);
-
-  ASSERT_TRUE(android::base::ParseInt("123", &i));
-  ASSERT_EQ(123, i);
-  ASSERT_EQ(0, errno);
-  i = 0;
-  EXPECT_TRUE(android::base::ParseInt("  123", &i));
-  EXPECT_EQ(123, i);
-  ASSERT_TRUE(android::base::ParseInt("-123", &i));
-  ASSERT_EQ(-123, i);
-  i = 0;
-  EXPECT_TRUE(android::base::ParseInt("  -123", &i));
-  EXPECT_EQ(-123, i);
-
-  short s = 0;
-  ASSERT_TRUE(android::base::ParseInt("1234", &s));
-  ASSERT_EQ(1234, s);
-
-  ASSERT_TRUE(android::base::ParseInt("12", &i, 0, 15));
-  ASSERT_EQ(12, i);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseInt("-12", &i, 0, 15));
-  ASSERT_EQ(ERANGE, errno);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseInt("16", &i, 0, 15));
-  ASSERT_EQ(ERANGE, errno);
-
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseInt<int>("x", nullptr));
-  ASSERT_EQ(EINVAL, errno);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseInt<int>("123x", nullptr));
-  ASSERT_EQ(EINVAL, errno);
-  ASSERT_TRUE(android::base::ParseInt<int>("1234", nullptr));
-}
-
-TEST(parseint, unsigned_smoke) {
-  errno = 0;
-  unsigned int i = 0u;
-  ASSERT_FALSE(android::base::ParseUint("x", &i));
-  ASSERT_EQ(EINVAL, errno);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseUint("123x", &i));
-  ASSERT_EQ(EINVAL, errno);
-
-  ASSERT_TRUE(android::base::ParseUint("123", &i));
-  ASSERT_EQ(123u, i);
-  ASSERT_EQ(0, errno);
-  i = 0u;
-  EXPECT_TRUE(android::base::ParseUint("  123", &i));
-  EXPECT_EQ(123u, i);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseUint("-123", &i));
-  EXPECT_EQ(EINVAL, errno);
-  errno = 0;
-  EXPECT_FALSE(android::base::ParseUint("  -123", &i));
-  EXPECT_EQ(EINVAL, errno);
-
-  unsigned short s = 0u;
-  ASSERT_TRUE(android::base::ParseUint("1234", &s));
-  ASSERT_EQ(1234u, s);
-
-  ASSERT_TRUE(android::base::ParseUint("12", &i, 15u));
-  ASSERT_EQ(12u, i);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseUint("-12", &i, 15u));
-  ASSERT_EQ(EINVAL, errno);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseUint("16", &i, 15u));
-  ASSERT_EQ(ERANGE, errno);
-
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseUint<unsigned short>("x", nullptr));
-  ASSERT_EQ(EINVAL, errno);
-  errno = 0;
-  ASSERT_FALSE(android::base::ParseUint<unsigned short>("123x", nullptr));
-  ASSERT_EQ(EINVAL, errno);
-  ASSERT_TRUE(android::base::ParseUint<unsigned short>("1234", nullptr));
-
-  errno = 0;
-  unsigned long long int lli;
-  EXPECT_FALSE(android::base::ParseUint("-123", &lli));
-  EXPECT_EQ(EINVAL, errno);
-  errno = 0;
-  EXPECT_FALSE(android::base::ParseUint("  -123", &lli));
-  EXPECT_EQ(EINVAL, errno);
-}
-
-TEST(parseint, no_implicit_octal) {
-  int i = 0;
-  ASSERT_TRUE(android::base::ParseInt("0123", &i));
-  ASSERT_EQ(123, i);
-
-  unsigned int u = 0u;
-  ASSERT_TRUE(android::base::ParseUint("0123", &u));
-  ASSERT_EQ(123u, u);
-}
-
-TEST(parseint, explicit_hex) {
-  int i = 0;
-  ASSERT_TRUE(android::base::ParseInt("0x123", &i));
-  ASSERT_EQ(0x123, i);
-  i = 0;
-  EXPECT_TRUE(android::base::ParseInt("  0x123", &i));
-  EXPECT_EQ(0x123, i);
-
-  unsigned int u = 0u;
-  ASSERT_TRUE(android::base::ParseUint("0x123", &u));
-  ASSERT_EQ(0x123u, u);
-  u = 0u;
-  EXPECT_TRUE(android::base::ParseUint("  0x123", &u));
-  EXPECT_EQ(0x123u, u);
-}
-
-TEST(parseint, string) {
-  int i = 0;
-  ASSERT_TRUE(android::base::ParseInt(std::string("123"), &i));
-  ASSERT_EQ(123, i);
-
-  unsigned int u = 0u;
-  ASSERT_TRUE(android::base::ParseUint(std::string("123"), &u));
-  ASSERT_EQ(123u, u);
-}
-
-TEST(parseint, untouched_on_failure) {
-  int i = 123;
-  ASSERT_FALSE(android::base::ParseInt("456x", &i));
-  ASSERT_EQ(123, i);
-
-  unsigned int u = 123u;
-  ASSERT_FALSE(android::base::ParseUint("456x", &u));
-  ASSERT_EQ(123u, u);
-}
-
-TEST(parseint, ParseByteCount) {
-  uint64_t i = 0;
-  ASSERT_TRUE(android::base::ParseByteCount("123b", &i));
-  ASSERT_EQ(123ULL, i);
-
-  ASSERT_TRUE(android::base::ParseByteCount("8k", &i));
-  ASSERT_EQ(8ULL * 1024, i);
-
-  ASSERT_TRUE(android::base::ParseByteCount("8M", &i));
-  ASSERT_EQ(8ULL * 1024 * 1024, i);
-
-  ASSERT_TRUE(android::base::ParseByteCount("6g", &i));
-  ASSERT_EQ(6ULL * 1024 * 1024 * 1024, i);
-
-  ASSERT_TRUE(android::base::ParseByteCount("1T", &i));
-  ASSERT_EQ(1ULL * 1024 * 1024 * 1024 * 1024, i);
-
-  ASSERT_TRUE(android::base::ParseByteCount("2p", &i));
-  ASSERT_EQ(2ULL * 1024 * 1024 * 1024 * 1024 * 1024, i);
-
-  ASSERT_TRUE(android::base::ParseByteCount("4e", &i));
-  ASSERT_EQ(4ULL * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, i);
-}
-
-TEST(parseint, ParseByteCount_invalid_suffix) {
-  unsigned u;
-  ASSERT_FALSE(android::base::ParseByteCount("1x", &u));
-}
-
-TEST(parseint, ParseByteCount_overflow) {
-  uint64_t u64;
-  ASSERT_FALSE(android::base::ParseByteCount("4294967295E", &u64));
-
-  uint16_t u16;
-  ASSERT_TRUE(android::base::ParseByteCount("63k", &u16));
-  ASSERT_EQ(63U * 1024, u16);
-  ASSERT_TRUE(android::base::ParseByteCount("65535b", &u16));
-  ASSERT_EQ(65535U, u16);
-  ASSERT_FALSE(android::base::ParseByteCount("65k", &u16));
-}
diff --git a/base/parsenetaddress.cpp b/base/parsenetaddress.cpp
deleted file mode 100644
index dd80f6d..0000000
--- a/base/parsenetaddress.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/parsenetaddress.h"
-
-#include <algorithm>
-
-#include "android-base/stringprintf.h"
-#include "android-base/strings.h"
-
-namespace android {
-namespace base {
-
-bool ParseNetAddress(const std::string& address, std::string* host, int* port,
-                     std::string* canonical_address, std::string* error) {
-  host->clear();
-
-  bool ipv6 = true;
-  bool saw_port = false;
-  size_t colons = std::count(address.begin(), address.end(), ':');
-  size_t dots = std::count(address.begin(), address.end(), '.');
-  std::string port_str;
-  if (address[0] == '[') {
-    // [::1]:123
-    if (address.rfind("]:") == std::string::npos) {
-      *error = StringPrintf("bad IPv6 address '%s'", address.c_str());
-      return false;
-    }
-    *host = address.substr(1, (address.find("]:") - 1));
-    port_str = address.substr(address.rfind("]:") + 2);
-    saw_port = true;
-  } else if (dots == 0 && colons >= 2 && colons <= 7) {
-    // ::1
-    *host = address;
-  } else if (colons <= 1) {
-    // 1.2.3.4 or some.accidental.domain.com
-    ipv6 = false;
-    std::vector<std::string> pieces = Split(address, ":");
-    *host = pieces[0];
-    if (pieces.size() > 1) {
-      port_str = pieces[1];
-      saw_port = true;
-    }
-  }
-
-  if (host->empty()) {
-    *error = StringPrintf("no host in '%s'", address.c_str());
-    return false;
-  }
-
-  if (saw_port) {
-    if (sscanf(port_str.c_str(), "%d", port) != 1 || *port <= 0 ||
-        *port > 65535) {
-      *error = StringPrintf("bad port number '%s' in '%s'", port_str.c_str(),
-                            address.c_str());
-      return false;
-    }
-  }
-
-  if (canonical_address != nullptr) {
-    *canonical_address =
-        StringPrintf(ipv6 ? "[%s]:%d" : "%s:%d", host->c_str(), *port);
-  }
-
-  return true;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/parsenetaddress_test.cpp b/base/parsenetaddress_test.cpp
deleted file mode 100644
index a3bfac8..0000000
--- a/base/parsenetaddress_test.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/parsenetaddress.h"
-
-#include <gtest/gtest.h>
-
-using android::base::ParseNetAddress;
-
-TEST(ParseNetAddressTest, TestUrl) {
-  std::string canonical, host, error;
-  int port = 123;
-
-  EXPECT_TRUE(
-      ParseNetAddress("www.google.com", &host, &port, &canonical, &error));
-  EXPECT_EQ("www.google.com:123", canonical);
-  EXPECT_EQ("www.google.com", host);
-  EXPECT_EQ(123, port);
-
-  EXPECT_TRUE(
-      ParseNetAddress("www.google.com:666", &host, &port, &canonical, &error));
-  EXPECT_EQ("www.google.com:666", canonical);
-  EXPECT_EQ("www.google.com", host);
-  EXPECT_EQ(666, port);
-}
-
-TEST(ParseNetAddressTest, TestIpv4) {
-  std::string canonical, host, error;
-  int port = 123;
-
-  EXPECT_TRUE(ParseNetAddress("1.2.3.4", &host, &port, &canonical, &error));
-  EXPECT_EQ("1.2.3.4:123", canonical);
-  EXPECT_EQ("1.2.3.4", host);
-  EXPECT_EQ(123, port);
-
-  EXPECT_TRUE(ParseNetAddress("1.2.3.4:666", &host, &port, &canonical, &error));
-  EXPECT_EQ("1.2.3.4:666", canonical);
-  EXPECT_EQ("1.2.3.4", host);
-  EXPECT_EQ(666, port);
-}
-
-TEST(ParseNetAddressTest, TestIpv6) {
-  std::string canonical, host, error;
-  int port = 123;
-
-  EXPECT_TRUE(ParseNetAddress("::1", &host, &port, &canonical, &error));
-  EXPECT_EQ("[::1]:123", canonical);
-  EXPECT_EQ("::1", host);
-  EXPECT_EQ(123, port);
-
-  EXPECT_TRUE(ParseNetAddress("fe80::200:5aee:feaa:20a2", &host, &port,
-                              &canonical, &error));
-  EXPECT_EQ("[fe80::200:5aee:feaa:20a2]:123", canonical);
-  EXPECT_EQ("fe80::200:5aee:feaa:20a2", host);
-  EXPECT_EQ(123, port);
-
-  EXPECT_TRUE(ParseNetAddress("[::1]:666", &host, &port, &canonical, &error));
-  EXPECT_EQ("[::1]:666", canonical);
-  EXPECT_EQ("::1", host);
-  EXPECT_EQ(666, port);
-
-  EXPECT_TRUE(ParseNetAddress("[fe80::200:5aee:feaa:20a2]:666", &host, &port,
-                              &canonical, &error));
-  EXPECT_EQ("[fe80::200:5aee:feaa:20a2]:666", canonical);
-  EXPECT_EQ("fe80::200:5aee:feaa:20a2", host);
-  EXPECT_EQ(666, port);
-}
-
-TEST(ParseNetAddressTest, TestInvalidAddress) {
-  std::string canonical, host;
-  int port;
-
-  std::string failure_cases[] = {
-      // Invalid IPv4.
-      "1.2.3.4:",
-      "1.2.3.4::",
-      ":123",
-
-      // Invalid IPv6.
-      ":1",
-      "::::::::1",
-      "[::1",
-      "[::1]",
-      "[::1]:",
-      "[::1]::",
-
-      // Invalid port.
-      "1.2.3.4:-1",
-      "1.2.3.4:0",
-      "1.2.3.4:65536"
-      "1.2.3.4:hello",
-      "[::1]:-1",
-      "[::1]:0",
-      "[::1]:65536",
-      "[::1]:hello",
-  };
-
-  for (const auto& address : failure_cases) {
-    // Failure should give some non-empty error string.
-    std::string error;
-    EXPECT_FALSE(ParseNetAddress(address, &host, &port, &canonical, &error));
-    EXPECT_NE("", error);
-  }
-}
-
-// Null canonical address argument.
-TEST(ParseNetAddressTest, TestNullCanonicalAddress) {
-  std::string host, error;
-  int port = 42;
-
-  EXPECT_TRUE(ParseNetAddress("www.google.com", &host, &port, nullptr, &error));
-  EXPECT_TRUE(ParseNetAddress("1.2.3.4", &host, &port, nullptr, &error));
-  EXPECT_TRUE(ParseNetAddress("::1", &host, &port, nullptr, &error));
-}
diff --git a/base/process.cpp b/base/process.cpp
deleted file mode 100644
index b8cabf6..0000000
--- a/base/process.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/process.h"
-
-namespace android {
-namespace base {
-
-void AllPids::PidIterator::Increment() {
-  if (!dir_) {
-    return;
-  }
-
-  dirent* de;
-  while ((de = readdir(dir_.get())) != nullptr) {
-    pid_t pid = atoi(de->d_name);
-    if (pid != 0) {
-      pid_ = pid;
-      return;
-    }
-  }
-  pid_ = -1;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/process_test.cpp b/base/process_test.cpp
deleted file mode 100644
index 056f667..0000000
--- a/base/process_test.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "android-base/process.h"
-
-#include <unistd.h>
-
-#include <gtest/gtest.h>
-
-TEST(process, find_ourselves) {
-#if defined(__linux__)
-  bool found_our_pid = false;
-  for (const auto& pid : android::base::AllPids{}) {
-    if (pid == getpid()) {
-      found_our_pid = true;
-    }
-  }
-
-  EXPECT_TRUE(found_our_pid);
-
-#endif
-}
diff --git a/base/properties.cpp b/base/properties.cpp
deleted file mode 100644
index 35e41a8..0000000
--- a/base/properties.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/properties.h"
-
-#if defined(__BIONIC__)
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/system_properties.h>
-#include <sys/_system_properties.h>
-#endif
-
-#include <algorithm>
-#include <chrono>
-#include <limits>
-#include <map>
-#include <string>
-
-#include <android-base/parsebool.h>
-#include <android-base/parseint.h>
-#include <android-base/strings.h>
-
-namespace android {
-namespace base {
-
-bool GetBoolProperty(const std::string& key, bool default_value) {
-  switch (ParseBool(GetProperty(key, ""))) {
-    case ParseBoolResult::kError:
-      return default_value;
-    case ParseBoolResult::kFalse:
-      return false;
-    case ParseBoolResult::kTrue:
-      return true;
-  }
-  __builtin_unreachable();
-}
-
-template <typename T>
-T GetIntProperty(const std::string& key, T default_value, T min, T max) {
-  T result;
-  std::string value = GetProperty(key, "");
-  if (!value.empty() && android::base::ParseInt(value, &result, min, max)) return result;
-  return default_value;
-}
-
-template <typename T>
-T GetUintProperty(const std::string& key, T default_value, T max) {
-  T result;
-  std::string value = GetProperty(key, "");
-  if (!value.empty() && android::base::ParseUint(value, &result, max)) return result;
-  return default_value;
-}
-
-template int8_t GetIntProperty(const std::string&, int8_t, int8_t, int8_t);
-template int16_t GetIntProperty(const std::string&, int16_t, int16_t, int16_t);
-template int32_t GetIntProperty(const std::string&, int32_t, int32_t, int32_t);
-template int64_t GetIntProperty(const std::string&, int64_t, int64_t, int64_t);
-
-template uint8_t GetUintProperty(const std::string&, uint8_t, uint8_t);
-template uint16_t GetUintProperty(const std::string&, uint16_t, uint16_t);
-template uint32_t GetUintProperty(const std::string&, uint32_t, uint32_t);
-template uint64_t GetUintProperty(const std::string&, uint64_t, uint64_t);
-
-#if !defined(__BIONIC__)
-static std::map<std::string, std::string>& g_properties = *new std::map<std::string, std::string>;
-static int __system_property_set(const char* key, const char* value) {
-  g_properties[key] = value;
-  return 0;
-}
-#endif
-
-std::string GetProperty(const std::string& key, const std::string& default_value) {
-  std::string property_value;
-#if defined(__BIONIC__)
-  const prop_info* pi = __system_property_find(key.c_str());
-  if (pi == nullptr) return default_value;
-
-  __system_property_read_callback(pi,
-                                  [](void* cookie, const char*, const char* value, unsigned) {
-                                    auto property_value = reinterpret_cast<std::string*>(cookie);
-                                    *property_value = value;
-                                  },
-                                  &property_value);
-#else
-  auto it = g_properties.find(key);
-  if (it == g_properties.end()) return default_value;
-  property_value = it->second;
-#endif
-  // If the property exists but is empty, also return the default value.
-  // Since we can't remove system properties, "empty" is traditionally
-  // the same as "missing" (this was true for cutils' property_get).
-  return property_value.empty() ? default_value : property_value;
-}
-
-bool SetProperty(const std::string& key, const std::string& value) {
-  return (__system_property_set(key.c_str(), value.c_str()) == 0);
-}
-
-#if defined(__BIONIC__)
-
-struct WaitForPropertyData {
-  bool done;
-  const std::string* expected_value;
-  unsigned last_read_serial;
-};
-
-static void WaitForPropertyCallback(void* data_ptr, const char*, const char* value, unsigned serial) {
-  WaitForPropertyData* data = reinterpret_cast<WaitForPropertyData*>(data_ptr);
-  if (*data->expected_value == value) {
-    data->done = true;
-  } else {
-    data->last_read_serial = serial;
-  }
-}
-
-// TODO: chrono_utils?
-static void DurationToTimeSpec(timespec& ts, const std::chrono::milliseconds d) {
-  auto s = std::chrono::duration_cast<std::chrono::seconds>(d);
-  auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(d - s);
-  ts.tv_sec = std::min<std::chrono::seconds::rep>(s.count(), std::numeric_limits<time_t>::max());
-  ts.tv_nsec = ns.count();
-}
-
-// TODO: boot_clock?
-using AbsTime = std::chrono::time_point<std::chrono::steady_clock>;
-
-static void UpdateTimeSpec(timespec& ts, std::chrono::milliseconds relative_timeout,
-                           const AbsTime& start_time) {
-  auto now = std::chrono::steady_clock::now();
-  auto time_elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(now - start_time);
-  if (time_elapsed >= relative_timeout) {
-    ts = { 0, 0 };
-  } else {
-    auto remaining_timeout = relative_timeout - time_elapsed;
-    DurationToTimeSpec(ts, remaining_timeout);
-  }
-}
-
-// Waits for the system property `key` to be created.
-// Times out after `relative_timeout`.
-// Sets absolute_timeout which represents absolute time for the timeout.
-// Returns nullptr on timeout.
-static const prop_info* WaitForPropertyCreation(const std::string& key,
-                                                const std::chrono::milliseconds& relative_timeout,
-                                                const AbsTime& start_time) {
-  // Find the property's prop_info*.
-  const prop_info* pi;
-  unsigned global_serial = 0;
-  while ((pi = __system_property_find(key.c_str())) == nullptr) {
-    // The property doesn't even exist yet.
-    // Wait for a global change and then look again.
-    timespec ts;
-    UpdateTimeSpec(ts, relative_timeout, start_time);
-    if (!__system_property_wait(nullptr, global_serial, &global_serial, &ts)) return nullptr;
-  }
-  return pi;
-}
-
-bool WaitForProperty(const std::string& key, const std::string& expected_value,
-                     std::chrono::milliseconds relative_timeout) {
-  auto start_time = std::chrono::steady_clock::now();
-  const prop_info* pi = WaitForPropertyCreation(key, relative_timeout, start_time);
-  if (pi == nullptr) return false;
-
-  WaitForPropertyData data;
-  data.expected_value = &expected_value;
-  data.done = false;
-  while (true) {
-    timespec ts;
-    // Check whether the property has the value we're looking for?
-    __system_property_read_callback(pi, WaitForPropertyCallback, &data);
-    if (data.done) return true;
-
-    // It didn't, so wait for the property to change before checking again.
-    UpdateTimeSpec(ts, relative_timeout, start_time);
-    uint32_t unused;
-    if (!__system_property_wait(pi, data.last_read_serial, &unused, &ts)) return false;
-  }
-}
-
-bool WaitForPropertyCreation(const std::string& key,
-                             std::chrono::milliseconds relative_timeout) {
-  auto start_time = std::chrono::steady_clock::now();
-  return (WaitForPropertyCreation(key, relative_timeout, start_time) != nullptr);
-}
-
-CachedProperty::CachedProperty(const char* property_name)
-    : property_name_(property_name),
-      prop_info_(nullptr),
-      cached_area_serial_(0),
-      cached_property_serial_(0),
-      is_read_only_(android::base::StartsWith(property_name, "ro.")),
-      read_only_property_(nullptr) {
-  static_assert(sizeof(cached_value_) == PROP_VALUE_MAX);
-}
-
-const char* CachedProperty::Get(bool* changed) {
-  std::optional<uint32_t> initial_property_serial_ = cached_property_serial_;
-
-  // Do we have a `struct prop_info` yet?
-  if (prop_info_ == nullptr) {
-    // `__system_property_find` is expensive, so only retry if a property
-    // has been created since last time we checked.
-    uint32_t property_area_serial = __system_property_area_serial();
-    if (property_area_serial != cached_area_serial_) {
-      prop_info_ = __system_property_find(property_name_.c_str());
-      cached_area_serial_ = property_area_serial;
-    }
-  }
-
-  if (prop_info_ != nullptr) {
-    // Only bother re-reading the property if it's actually changed since last time.
-    uint32_t property_serial = __system_property_serial(prop_info_);
-    if (property_serial != cached_property_serial_) {
-      __system_property_read_callback(
-          prop_info_,
-          [](void* data, const char*, const char* value, uint32_t serial) {
-            CachedProperty* instance = reinterpret_cast<CachedProperty*>(data);
-            instance->cached_property_serial_ = serial;
-            // Read only properties can be larger than PROP_VALUE_MAX, but also never change value
-            // or location, thus we return the pointer from the shared memory directly.
-            if (instance->is_read_only_) {
-              instance->read_only_property_ = value;
-            } else {
-              strlcpy(instance->cached_value_, value, PROP_VALUE_MAX);
-            }
-          },
-          this);
-    }
-  }
-
-  if (changed) {
-    *changed = cached_property_serial_ != initial_property_serial_;
-  }
-
-  if (is_read_only_) {
-    return read_only_property_;
-  } else {
-    return cached_value_;
-  }
-}
-
-#endif
-
-}  // namespace base
-}  // namespace android
diff --git a/base/properties_test.cpp b/base/properties_test.cpp
deleted file mode 100644
index c30c41e..0000000
--- a/base/properties_test.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include "android-base/properties.h"
-
-#include <gtest/gtest.h>
-
-#include <atomic>
-#include <chrono>
-#include <string>
-#include <thread>
-
-#if !defined(_WIN32)
-using namespace std::literals;
-#endif
-
-TEST(properties, smoke) {
-  android::base::SetProperty("debug.libbase.property_test", "hello");
-
-  std::string s = android::base::GetProperty("debug.libbase.property_test", "");
-  ASSERT_EQ("hello", s);
-
-  android::base::SetProperty("debug.libbase.property_test", "world");
-  s = android::base::GetProperty("debug.libbase.property_test", "");
-  ASSERT_EQ("world", s);
-
-  s = android::base::GetProperty("this.property.does.not.exist", "");
-  ASSERT_EQ("", s);
-
-  s = android::base::GetProperty("this.property.does.not.exist", "default");
-  ASSERT_EQ("default", s);
-}
-
-TEST(properties, empty) {
-  // Because you can't delete a property, people "delete" them by
-  // setting them to the empty string. In that case we'd want to
-  // keep the default value (like cutils' property_get did).
-  android::base::SetProperty("debug.libbase.property_test", "");
-  std::string s = android::base::GetProperty("debug.libbase.property_test", "default");
-  ASSERT_EQ("default", s);
-}
-
-static void CheckGetBoolProperty(bool expected, const std::string& value, bool default_value) {
-  android::base::SetProperty("debug.libbase.property_test", value.c_str());
-  ASSERT_EQ(expected, android::base::GetBoolProperty("debug.libbase.property_test", default_value));
-}
-
-TEST(properties, GetBoolProperty_true) {
-  CheckGetBoolProperty(true, "1", false);
-  CheckGetBoolProperty(true, "y", false);
-  CheckGetBoolProperty(true, "yes", false);
-  CheckGetBoolProperty(true, "on", false);
-  CheckGetBoolProperty(true, "true", false);
-}
-
-TEST(properties, GetBoolProperty_false) {
-  CheckGetBoolProperty(false, "0", true);
-  CheckGetBoolProperty(false, "n", true);
-  CheckGetBoolProperty(false, "no", true);
-  CheckGetBoolProperty(false, "off", true);
-  CheckGetBoolProperty(false, "false", true);
-}
-
-TEST(properties, GetBoolProperty_default) {
-  CheckGetBoolProperty(true, "burp", true);
-  CheckGetBoolProperty(false, "burp", false);
-}
-
-template <typename T> void CheckGetIntProperty() {
-  // Positive and negative.
-  android::base::SetProperty("debug.libbase.property_test", "-12");
-  EXPECT_EQ(T(-12), android::base::GetIntProperty<T>("debug.libbase.property_test", 45));
-  android::base::SetProperty("debug.libbase.property_test", "12");
-  EXPECT_EQ(T(12), android::base::GetIntProperty<T>("debug.libbase.property_test", 45));
-
-  // Default value.
-  android::base::SetProperty("debug.libbase.property_test", "");
-  EXPECT_EQ(T(45), android::base::GetIntProperty<T>("debug.libbase.property_test", 45));
-
-  // Bounds checks.
-  android::base::SetProperty("debug.libbase.property_test", "0");
-  EXPECT_EQ(T(45), android::base::GetIntProperty<T>("debug.libbase.property_test", 45, 1, 2));
-  android::base::SetProperty("debug.libbase.property_test", "1");
-  EXPECT_EQ(T(1), android::base::GetIntProperty<T>("debug.libbase.property_test", 45, 1, 2));
-  android::base::SetProperty("debug.libbase.property_test", "2");
-  EXPECT_EQ(T(2), android::base::GetIntProperty<T>("debug.libbase.property_test", 45, 1, 2));
-  android::base::SetProperty("debug.libbase.property_test", "3");
-  EXPECT_EQ(T(45), android::base::GetIntProperty<T>("debug.libbase.property_test", 45, 1, 2));
-}
-
-template <typename T> void CheckGetUintProperty() {
-  // Positive.
-  android::base::SetProperty("debug.libbase.property_test", "12");
-  EXPECT_EQ(T(12), android::base::GetUintProperty<T>("debug.libbase.property_test", 45));
-
-  // Default value.
-  android::base::SetProperty("debug.libbase.property_test", "");
-  EXPECT_EQ(T(45), android::base::GetUintProperty<T>("debug.libbase.property_test", 45));
-
-  // Bounds checks.
-  android::base::SetProperty("debug.libbase.property_test", "12");
-  EXPECT_EQ(T(12), android::base::GetUintProperty<T>("debug.libbase.property_test", 33, 22));
-  android::base::SetProperty("debug.libbase.property_test", "12");
-  EXPECT_EQ(T(5), android::base::GetUintProperty<T>("debug.libbase.property_test", 5, 10));
-}
-
-TEST(properties, GetIntProperty_int8_t) { CheckGetIntProperty<int8_t>(); }
-TEST(properties, GetIntProperty_int16_t) { CheckGetIntProperty<int16_t>(); }
-TEST(properties, GetIntProperty_int32_t) { CheckGetIntProperty<int32_t>(); }
-TEST(properties, GetIntProperty_int64_t) { CheckGetIntProperty<int64_t>(); }
-
-TEST(properties, GetUintProperty_uint8_t) { CheckGetUintProperty<uint8_t>(); }
-TEST(properties, GetUintProperty_uint16_t) { CheckGetUintProperty<uint16_t>(); }
-TEST(properties, GetUintProperty_uint32_t) { CheckGetUintProperty<uint32_t>(); }
-TEST(properties, GetUintProperty_uint64_t) { CheckGetUintProperty<uint64_t>(); }
-
-TEST(properties, WaitForProperty) {
-#if defined(__BIONIC__)
-  std::atomic<bool> flag{false};
-  std::thread thread([&]() {
-    std::this_thread::sleep_for(100ms);
-    android::base::SetProperty("debug.libbase.WaitForProperty_test", "a");
-    while (!flag) std::this_thread::yield();
-    android::base::SetProperty("debug.libbase.WaitForProperty_test", "b");
-  });
-
-  ASSERT_TRUE(android::base::WaitForProperty("debug.libbase.WaitForProperty_test", "a", 1s));
-  flag = true;
-  ASSERT_TRUE(android::base::WaitForProperty("debug.libbase.WaitForProperty_test", "b", 1s));
-  thread.join();
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
-
-TEST(properties, WaitForProperty_timeout) {
-#if defined(__BIONIC__)
-  auto t0 = std::chrono::steady_clock::now();
-  ASSERT_FALSE(android::base::WaitForProperty("debug.libbase.WaitForProperty_timeout_test", "a",
-                                              200ms));
-  auto t1 = std::chrono::steady_clock::now();
-
-  ASSERT_GE(std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0), 200ms);
-  // Upper bounds on timing are inherently flaky, but let's try...
-  ASSERT_LT(std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0), 600ms);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
-
-TEST(properties, WaitForProperty_MaxTimeout) {
-#if defined(__BIONIC__)
-  std::atomic<bool> flag{false};
-  std::thread thread([&]() {
-    android::base::SetProperty("debug.libbase.WaitForProperty_test", "a");
-    while (!flag) std::this_thread::yield();
-    std::this_thread::sleep_for(500ms);
-    android::base::SetProperty("debug.libbase.WaitForProperty_test", "b");
-  });
-
-  ASSERT_TRUE(android::base::WaitForProperty("debug.libbase.WaitForProperty_test", "a", 1s));
-  flag = true;
-  // Test that this does not immediately return false due to overflow issues with the timeout.
-  ASSERT_TRUE(android::base::WaitForProperty("debug.libbase.WaitForProperty_test", "b"));
-  thread.join();
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
-
-TEST(properties, WaitForProperty_NegativeTimeout) {
-#if defined(__BIONIC__)
-  std::atomic<bool> flag{false};
-  std::thread thread([&]() {
-    android::base::SetProperty("debug.libbase.WaitForProperty_test", "a");
-    while (!flag) std::this_thread::yield();
-    std::this_thread::sleep_for(500ms);
-    android::base::SetProperty("debug.libbase.WaitForProperty_test", "b");
-  });
-
-  ASSERT_TRUE(android::base::WaitForProperty("debug.libbase.WaitForProperty_test", "a", 1s));
-  flag = true;
-  // Assert that this immediately returns with a negative timeout
-  ASSERT_FALSE(android::base::WaitForProperty("debug.libbase.WaitForProperty_test", "b", -100ms));
-  thread.join();
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
-
-TEST(properties, WaitForPropertyCreation) {
-#if defined(__BIONIC__)
-  std::thread thread([&]() {
-    std::this_thread::sleep_for(100ms);
-    android::base::SetProperty("debug.libbase.WaitForPropertyCreation_test", "a");
-  });
-
-  ASSERT_TRUE(android::base::WaitForPropertyCreation(
-          "debug.libbase.WaitForPropertyCreation_test", 1s));
-  thread.join();
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
-
-TEST(properties, WaitForPropertyCreation_timeout) {
-#if defined(__BIONIC__)
-  auto t0 = std::chrono::steady_clock::now();
-  ASSERT_FALSE(android::base::WaitForPropertyCreation(
-          "debug.libbase.WaitForPropertyCreation_timeout_test", 200ms));
-  auto t1 = std::chrono::steady_clock::now();
-
-  ASSERT_GE(std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0), 200ms);
-  // Upper bounds on timing are inherently flaky, but let's try...
-  ASSERT_LT(std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0), 600ms);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
-
-TEST(properties, CachedProperty) {
-#if defined(__BIONIC__)
-  android::base::CachedProperty cached_property("debug.libbase.CachedProperty_test");
-  bool changed;
-  cached_property.Get(&changed);
-
-  android::base::SetProperty("debug.libbase.CachedProperty_test", "foo");
-  ASSERT_STREQ("foo", cached_property.Get(&changed));
-  ASSERT_TRUE(changed);
-
-  ASSERT_STREQ("foo", cached_property.Get(&changed));
-  ASSERT_FALSE(changed);
-
-  android::base::SetProperty("debug.libbase.CachedProperty_test", "bar");
-  ASSERT_STREQ("bar", cached_property.Get(&changed));
-  ASSERT_TRUE(changed);
-
-  ASSERT_STREQ("bar", cached_property.Get(&changed));
-  ASSERT_FALSE(changed);
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing on the host.\n";
-#endif
-}
diff --git a/base/result_test.cpp b/base/result_test.cpp
deleted file mode 100644
index c0ac0fd..0000000
--- a/base/result_test.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "android-base/result.h"
-
-#include "errno.h"
-
-#include <istream>
-#include <string>
-
-#include <gtest/gtest.h>
-
-using namespace std::string_literals;
-
-namespace android {
-namespace base {
-
-TEST(result, result_accessors) {
-  Result<std::string> result = "success";
-  ASSERT_RESULT_OK(result);
-  ASSERT_TRUE(result.has_value());
-
-  EXPECT_EQ("success", *result);
-  EXPECT_EQ("success", result.value());
-
-  EXPECT_EQ('s', result->data()[0]);
-}
-
-TEST(result, result_accessors_rvalue) {
-  ASSERT_TRUE(Result<std::string>("success").ok());
-  ASSERT_TRUE(Result<std::string>("success").has_value());
-
-  EXPECT_EQ("success", *Result<std::string>("success"));
-  EXPECT_EQ("success", Result<std::string>("success").value());
-
-  EXPECT_EQ('s', Result<std::string>("success")->data()[0]);
-}
-
-TEST(result, result_void) {
-  Result<void> ok = {};
-  EXPECT_RESULT_OK(ok);
-  ok.value();  // should not crash
-  ASSERT_DEATH(ok.error(), "");
-
-  Result<void> fail = Error() << "failure" << 1;
-  EXPECT_FALSE(fail.ok());
-  EXPECT_EQ("failure1", fail.error().message());
-  EXPECT_EQ(0, fail.error().code());
-  EXPECT_TRUE(ok != fail);
-  ASSERT_DEATH(fail.value(), "");
-
-  auto test = [](bool ok) -> Result<void> {
-    if (ok) return {};
-    else return Error() << "failure" << 1;
-  };
-  EXPECT_TRUE(test(true).ok());
-  EXPECT_FALSE(test(false).ok());
-  test(true).value();  // should not crash
-  ASSERT_DEATH(test(true).error(), "");
-  ASSERT_DEATH(test(false).value(), "");
-  EXPECT_EQ("failure1", test(false).error().message());
-}
-
-TEST(result, result_error) {
-  Result<void> result = Error() << "failure" << 1;
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  EXPECT_EQ(0, result.error().code());
-  EXPECT_EQ("failure1", result.error().message());
-}
-
-TEST(result, result_error_empty) {
-  Result<void> result = Error();
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  EXPECT_EQ(0, result.error().code());
-  EXPECT_EQ("", result.error().message());
-}
-
-TEST(result, result_error_rvalue) {
-  // Error() and ErrnoError() aren't actually used to create a Result<T> object.
-  // Under the hood, they are an intermediate class that can be implicitly constructed into a
-  // Result<T>.  This is needed both to create the ostream and because Error() itself, by
-  // definition will not know what the type, T, of the underlying Result<T> object that it would
-  // create is.
-
-  auto MakeRvalueErrorResult = []() -> Result<void> { return Error() << "failure" << 1; };
-  ASSERT_FALSE(MakeRvalueErrorResult().ok());
-  ASSERT_FALSE(MakeRvalueErrorResult().has_value());
-
-  EXPECT_EQ(0, MakeRvalueErrorResult().error().code());
-  EXPECT_EQ("failure1", MakeRvalueErrorResult().error().message());
-}
-
-TEST(result, result_errno_error) {
-  constexpr int test_errno = 6;
-  errno = test_errno;
-  Result<void> result = ErrnoError() << "failure" << 1;
-
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  EXPECT_EQ(test_errno, result.error().code());
-  EXPECT_EQ("failure1: "s + strerror(test_errno), result.error().message());
-}
-
-TEST(result, result_errno_error_no_text) {
-  constexpr int test_errno = 6;
-  errno = test_errno;
-  Result<void> result = ErrnoError();
-
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  EXPECT_EQ(test_errno, result.error().code());
-  EXPECT_EQ(strerror(test_errno), result.error().message());
-}
-
-TEST(result, result_error_from_other_result) {
-  auto error_text = "test error"s;
-  Result<void> result = Error() << error_text;
-
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  Result<std::string> result2 = result.error();
-
-  ASSERT_FALSE(result2.ok());
-  ASSERT_FALSE(result2.has_value());
-
-  EXPECT_EQ(0, result2.error().code());
-  EXPECT_EQ(error_text, result2.error().message());
-}
-
-TEST(result, result_error_through_ostream) {
-  auto error_text = "test error"s;
-  Result<void> result = Error() << error_text;
-
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  Result<std::string> result2 = Error() << result.error();
-
-  ASSERT_FALSE(result2.ok());
-  ASSERT_FALSE(result2.has_value());
-
-  EXPECT_EQ(0, result2.error().code());
-  EXPECT_EQ(error_text, result2.error().message());
-}
-
-TEST(result, result_errno_error_through_ostream) {
-  auto error_text = "test error"s;
-  constexpr int test_errno = 6;
-  errno = 6;
-  Result<void> result = ErrnoError() << error_text;
-
-  errno = 0;
-
-  ASSERT_FALSE(result.ok());
-  ASSERT_FALSE(result.has_value());
-
-  Result<std::string> result2 = Error() << result.error();
-
-  ASSERT_FALSE(result2.ok());
-  ASSERT_FALSE(result2.has_value());
-
-  EXPECT_EQ(test_errno, result2.error().code());
-  EXPECT_EQ(error_text + ": " + strerror(test_errno), result2.error().message());
-}
-
-TEST(result, constructor_forwarding) {
-  auto result = Result<std::string>(std::in_place, 5, 'a');
-
-  ASSERT_RESULT_OK(result);
-  ASSERT_TRUE(result.has_value());
-
-  EXPECT_EQ("aaaaa", *result);
-}
-
-struct ConstructorTracker {
-  static size_t constructor_called;
-  static size_t copy_constructor_called;
-  static size_t move_constructor_called;
-  static size_t copy_assignment_called;
-  static size_t move_assignment_called;
-
-  template <typename T>
-  ConstructorTracker(T&& string) : string(string) {
-    ++constructor_called;
-  }
-
-  ConstructorTracker(const ConstructorTracker& ct) {
-    ++copy_constructor_called;
-    string = ct.string;
-  }
-  ConstructorTracker(ConstructorTracker&& ct) noexcept {
-    ++move_constructor_called;
-    string = std::move(ct.string);
-  }
-  ConstructorTracker& operator=(const ConstructorTracker& ct) {
-    ++copy_assignment_called;
-    string = ct.string;
-    return *this;
-  }
-  ConstructorTracker& operator=(ConstructorTracker&& ct) noexcept {
-    ++move_assignment_called;
-    string = std::move(ct.string);
-    return *this;
-  }
-
-  std::string string;
-};
-
-size_t ConstructorTracker::constructor_called = 0;
-size_t ConstructorTracker::copy_constructor_called = 0;
-size_t ConstructorTracker::move_constructor_called = 0;
-size_t ConstructorTracker::copy_assignment_called = 0;
-size_t ConstructorTracker::move_assignment_called = 0;
-
-Result<ConstructorTracker> ReturnConstructorTracker(const std::string& in) {
-  if (in.empty()) {
-    return "literal string";
-  }
-  if (in == "test2") {
-    return ConstructorTracker(in + in + "2");
-  }
-  ConstructorTracker result(in + " " + in);
-  return result;
-};
-
-TEST(result, no_copy_on_return) {
-  // If returning parameters that may be used to implicitly construct the type T of Result<T>,
-  // then those parameters are forwarded to the construction of Result<T>.
-
-  // If returning an prvalue or xvalue, it will be move constructed during the construction of
-  // Result<T>.
-
-  // This check ensures that that is the case, and particularly that no copy constructors
-  // are called.
-
-  auto result1 = ReturnConstructorTracker("");
-  ASSERT_RESULT_OK(result1);
-  EXPECT_EQ("literal string", result1->string);
-  EXPECT_EQ(1U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  auto result2 = ReturnConstructorTracker("test2");
-  ASSERT_RESULT_OK(result2);
-  EXPECT_EQ("test2test22", result2->string);
-  EXPECT_EQ(2U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(1U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-
-  auto result3 = ReturnConstructorTracker("test3");
-  ASSERT_RESULT_OK(result3);
-  EXPECT_EQ("test3 test3", result3->string);
-  EXPECT_EQ(3U, ConstructorTracker::constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_constructor_called);
-  EXPECT_EQ(2U, ConstructorTracker::move_constructor_called);
-  EXPECT_EQ(0U, ConstructorTracker::copy_assignment_called);
-  EXPECT_EQ(0U, ConstructorTracker::move_assignment_called);
-}
-
-// Below two tests require that we do not hide the move constructor with our forwarding reference
-// constructor.  This is done with by disabling the forwarding reference constructor if its first
-// and only type is Result<T>.
-TEST(result, result_result_with_success) {
-  auto return_result_result_with_success = []() -> Result<Result<void>> { return Result<void>(); };
-  auto result = return_result_result_with_success();
-  ASSERT_RESULT_OK(result);
-  ASSERT_RESULT_OK(*result);
-
-  auto inner_result = result.value();
-  ASSERT_RESULT_OK(inner_result);
-}
-
-TEST(result, result_result_with_failure) {
-  auto return_result_result_with_error = []() -> Result<Result<void>> {
-    return Result<void>(ResultError("failure string", 6));
-  };
-  auto result = return_result_result_with_error();
-  ASSERT_RESULT_OK(result);
-  ASSERT_FALSE(result->ok());
-  EXPECT_EQ("failure string", (*result).error().message());
-  EXPECT_EQ(6, (*result).error().code());
-}
-
-// This test requires that we disable the forwarding reference constructor if Result<T> is the
-// *only* type that we are forwarding.  In otherwords, if we are forwarding Result<T>, int to
-// construct a Result<T>, then we still need the constructor.
-TEST(result, result_two_parameter_constructor_same_type) {
-  struct TestStruct {
-    TestStruct(int value) : value_(value) {}
-    TestStruct(Result<TestStruct> result, int value) : value_(result->value_ * value) {}
-    int value_;
-  };
-
-  auto return_test_struct = []() -> Result<TestStruct> {
-    return Result<TestStruct>(std::in_place, Result<TestStruct>(std::in_place, 6), 6);
-  };
-
-  auto result = return_test_struct();
-  ASSERT_RESULT_OK(result);
-  EXPECT_EQ(36, result->value_);
-}
-
-TEST(result, die_on_access_failed_result) {
-  Result<std::string> result = Error();
-  ASSERT_DEATH(*result, "");
-}
-
-TEST(result, die_on_get_error_succesful_result) {
-  Result<std::string> result = "success";
-  ASSERT_DEATH(result.error(), "");
-}
-
-template <class CharT>
-std::basic_ostream<CharT>& SetErrnoToTwo(std::basic_ostream<CharT>& ss) {
-  errno = 2;
-  return ss;
-}
-
-TEST(result, preserve_errno) {
-  errno = 1;
-  int old_errno = errno;
-  Result<int> result = Error() << "Failed" << SetErrnoToTwo<char>;
-  ASSERT_FALSE(result.ok());
-  EXPECT_EQ(old_errno, errno);
-
-  errno = 1;
-  old_errno = errno;
-  Result<int> result2 = ErrnoError() << "Failed" << SetErrnoToTwo<char>;
-  ASSERT_FALSE(result2.ok());
-  EXPECT_EQ(old_errno, errno);
-  EXPECT_EQ(old_errno, result2.error().code());
-}
-
-TEST(result, error_with_fmt) {
-  Result<int> result = Errorf("{} {}!", "hello", "world");
-  EXPECT_EQ("hello world!", result.error().message());
-
-  result = Errorf("{} {}!", std::string("hello"), std::string("world"));
-  EXPECT_EQ("hello world!", result.error().message());
-
-  result = Errorf("{1} {0}!", "world", "hello");
-  EXPECT_EQ("hello world!", result.error().message());
-
-  result = Errorf("hello world!");
-  EXPECT_EQ("hello world!", result.error().message());
-
-  Result<int> result2 = Errorf("error occurred with {}", result.error());
-  EXPECT_EQ("error occurred with hello world!", result2.error().message());
-
-  constexpr int test_errno = 6;
-  errno = test_errno;
-  result = ErrnoErrorf("{} {}!", "hello", "world");
-  EXPECT_EQ(test_errno, result.error().code());
-  EXPECT_EQ("hello world!: "s + strerror(test_errno), result.error().message());
-}
-
-TEST(result, error_with_fmt_carries_errno) {
-  constexpr int inner_errno = 6;
-  errno = inner_errno;
-  Result<int> inner_result = ErrnoErrorf("inner failure");
-  errno = 0;
-  EXPECT_EQ(inner_errno, inner_result.error().code());
-
-  // outer_result is created with Errorf, but its error code is got from inner_result.
-  Result<int> outer_result = Errorf("outer failure caused by {}", inner_result.error());
-  EXPECT_EQ(inner_errno, outer_result.error().code());
-  EXPECT_EQ("outer failure caused by inner failure: "s + strerror(inner_errno),
-            outer_result.error().message());
-
-  // now both result objects are created with ErrnoErrorf. errno from the inner_result
-  // is not passed to outer_result.
-  constexpr int outer_errno = 10;
-  errno = outer_errno;
-  outer_result = ErrnoErrorf("outer failure caused by {}", inner_result.error());
-  EXPECT_EQ(outer_errno, outer_result.error().code());
-  EXPECT_EQ("outer failure caused by inner failure: "s + strerror(inner_errno) + ": "s +
-                strerror(outer_errno),
-            outer_result.error().message());
-}
-
-TEST(result, errno_chaining_multiple) {
-  constexpr int errno1 = 6;
-  errno = errno1;
-  Result<int> inner1 = ErrnoErrorf("error1");
-
-  constexpr int errno2 = 10;
-  errno = errno2;
-  Result<int> inner2 = ErrnoErrorf("error2");
-
-  // takes the error code of inner2 since its the last one.
-  Result<int> outer = Errorf("two errors: {}, {}", inner1.error(), inner2.error());
-  EXPECT_EQ(errno2, outer.error().code());
-  EXPECT_EQ("two errors: error1: "s + strerror(errno1) + ", error2: "s + strerror(errno2),
-            outer.error().message());
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/scopeguard_test.cpp b/base/scopeguard_test.cpp
deleted file mode 100644
index 9236d7b..0000000
--- a/base/scopeguard_test.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "android-base/scopeguard.h"
-
-#include <utility>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-TEST(scopeguard, normal) {
-  bool guarded_var = true;
-  {
-    auto scopeguard = android::base::make_scope_guard([&guarded_var] { guarded_var = false; });
-  }
-  ASSERT_FALSE(guarded_var);
-}
-
-TEST(scopeguard, disabled) {
-  bool guarded_var = true;
-  {
-    auto scopeguard = android::base::make_scope_guard([&guarded_var] { guarded_var = false; });
-    scopeguard.Disable();
-  }
-  ASSERT_TRUE(guarded_var);
-}
-
-TEST(scopeguard, moved) {
-  int guarded_var = true;
-  auto scopeguard = android::base::make_scope_guard([&guarded_var] { guarded_var = false; });
-  { decltype(scopeguard) new_guard(std::move(scopeguard)); }
-  EXPECT_FALSE(scopeguard.active());
-  ASSERT_FALSE(guarded_var);
-}
-
-TEST(scopeguard, vector) {
-  int guarded_var = 0;
-  {
-    std::vector<android::base::ScopeGuard<std::function<void()>>> scopeguards;
-    scopeguards.emplace_back(android::base::make_scope_guard(
-        std::bind([](int& guarded_var) { guarded_var++; }, std::ref(guarded_var))));
-    scopeguards.emplace_back(android::base::make_scope_guard(
-        std::bind([](int& guarded_var) { guarded_var++; }, std::ref(guarded_var))));
-  }
-  ASSERT_EQ(guarded_var, 2);
-}
diff --git a/base/stringprintf.cpp b/base/stringprintf.cpp
deleted file mode 100644
index e83ab13..0000000
--- a/base/stringprintf.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#include "android-base/stringprintf.h"
-
-#include <stdio.h>
-
-#include <string>
-
-namespace android {
-namespace base {
-
-void StringAppendV(std::string* dst, const char* format, va_list ap) {
-  // First try with a small fixed size buffer
-  char space[1024] __attribute__((__uninitialized__));
-
-  // It's possible for methods that use a va_list to invalidate
-  // the data in it upon use.  The fix is to make a copy
-  // of the structure before using it and use that copy instead.
-  va_list backup_ap;
-  va_copy(backup_ap, ap);
-  int result = vsnprintf(space, sizeof(space), format, backup_ap);
-  va_end(backup_ap);
-
-  if (result < static_cast<int>(sizeof(space))) {
-    if (result >= 0) {
-      // Normal case -- everything fit.
-      dst->append(space, result);
-      return;
-    }
-
-    if (result < 0) {
-      // Just an error.
-      return;
-    }
-  }
-
-  // Increase the buffer size to the size requested by vsnprintf,
-  // plus one for the closing \0.
-  int length = result + 1;
-  char* buf = new char[length];
-
-  // Restore the va_list before we use it again
-  va_copy(backup_ap, ap);
-  result = vsnprintf(buf, length, format, backup_ap);
-  va_end(backup_ap);
-
-  if (result >= 0 && result < length) {
-    // It fit
-    dst->append(buf, result);
-  }
-  delete[] buf;
-}
-
-std::string StringPrintf(const char* fmt, ...) {
-  va_list ap;
-  va_start(ap, fmt);
-  std::string result;
-  StringAppendV(&result, fmt, ap);
-  va_end(ap);
-  return result;
-}
-
-void StringAppendF(std::string* dst, const char* format, ...) {
-  va_list ap;
-  va_start(ap, format);
-  StringAppendV(dst, format, ap);
-  va_end(ap);
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/stringprintf_test.cpp b/base/stringprintf_test.cpp
deleted file mode 100644
index fc009b1..0000000
--- a/base/stringprintf_test.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#include "android-base/stringprintf.h"
-
-#include <gtest/gtest.h>
-
-#include <string>
-
-TEST(StringPrintfTest, HexSizeT) {
-  size_t size = 0x00107e59;
-  EXPECT_EQ("00107e59", android::base::StringPrintf("%08zx", size));
-  EXPECT_EQ("0x00107e59", android::base::StringPrintf("0x%08zx", size));
-}
-
-TEST(StringPrintfTest, StringAppendF) {
-  std::string s("a");
-  android::base::StringAppendF(&s, "b");
-  EXPECT_EQ("ab", s);
-}
-
-TEST(StringPrintfTest, Errno) {
-  errno = 123;
-  android::base::StringPrintf("hello %s", "world");
-  EXPECT_EQ(123, errno);
-}
-
-void TestN(size_t n) {
-  char* buf = new char[n + 1];
-  memset(buf, 'x', n);
-  buf[n] = '\0';
-  std::string s(android::base::StringPrintf("%s", buf));
-  EXPECT_EQ(buf, s);
-  delete[] buf;
-}
-
-TEST(StringPrintfTest, At1023) {
-  TestN(1023);
-}
-
-TEST(StringPrintfTest, At1024) {
-  TestN(1024);
-}
-
-TEST(StringPrintfTest, At1025) {
-  TestN(1025);
-}
diff --git a/base/strings.cpp b/base/strings.cpp
deleted file mode 100644
index 40b2bf2..0000000
--- a/base/strings.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "android-base/strings.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <string>
-#include <vector>
-
-namespace android {
-namespace base {
-
-#define CHECK_NE(a, b) \
-  if ((a) == (b)) abort();
-
-std::vector<std::string> Split(const std::string& s,
-                               const std::string& delimiters) {
-  CHECK_NE(delimiters.size(), 0U);
-
-  std::vector<std::string> result;
-
-  size_t base = 0;
-  size_t found;
-  while (true) {
-    found = s.find_first_of(delimiters, base);
-    result.push_back(s.substr(base, found - base));
-    if (found == s.npos) break;
-    base = found + 1;
-  }
-
-  return result;
-}
-
-std::string Trim(const std::string& s) {
-  std::string result;
-
-  if (s.size() == 0) {
-    return result;
-  }
-
-  size_t start_index = 0;
-  size_t end_index = s.size() - 1;
-
-  // Skip initial whitespace.
-  while (start_index < s.size()) {
-    if (!isspace(s[start_index])) {
-      break;
-    }
-    start_index++;
-  }
-
-  // Skip terminating whitespace.
-  while (end_index >= start_index) {
-    if (!isspace(s[end_index])) {
-      break;
-    }
-    end_index--;
-  }
-
-  // All spaces, no beef.
-  if (end_index < start_index) {
-    return "";
-  }
-  // Start_index is the first non-space, end_index is the last one.
-  return s.substr(start_index, end_index - start_index + 1);
-}
-
-// These cases are probably the norm, so we mark them extern in the header to
-// aid compile time and binary size.
-template std::string Join(const std::vector<std::string>&, char);
-template std::string Join(const std::vector<const char*>&, char);
-template std::string Join(const std::vector<std::string>&, const std::string&);
-template std::string Join(const std::vector<const char*>&, const std::string&);
-
-bool StartsWith(std::string_view s, std::string_view prefix) {
-  return s.substr(0, prefix.size()) == prefix;
-}
-
-bool StartsWith(std::string_view s, char prefix) {
-  return !s.empty() && s.front() == prefix;
-}
-
-bool StartsWithIgnoreCase(std::string_view s, std::string_view prefix) {
-  return s.size() >= prefix.size() && strncasecmp(s.data(), prefix.data(), prefix.size()) == 0;
-}
-
-bool EndsWith(std::string_view s, std::string_view suffix) {
-  return s.size() >= suffix.size() && s.substr(s.size() - suffix.size(), suffix.size()) == suffix;
-}
-
-bool EndsWith(std::string_view s, char suffix) {
-  return !s.empty() && s.back() == suffix;
-}
-
-bool EndsWithIgnoreCase(std::string_view s, std::string_view suffix) {
-  return s.size() >= suffix.size() &&
-         strncasecmp(s.data() + (s.size() - suffix.size()), suffix.data(), suffix.size()) == 0;
-}
-
-bool EqualsIgnoreCase(std::string_view lhs, std::string_view rhs) {
-  return lhs.size() == rhs.size() && strncasecmp(lhs.data(), rhs.data(), lhs.size()) == 0;
-}
-
-std::string StringReplace(std::string_view s, std::string_view from, std::string_view to,
-                          bool all) {
-  if (from.empty()) return std::string(s);
-
-  std::string result;
-  std::string_view::size_type start_pos = 0;
-  do {
-    std::string_view::size_type pos = s.find(from, start_pos);
-    if (pos == std::string_view::npos) break;
-
-    result.append(s.data() + start_pos, pos - start_pos);
-    result.append(to.data(), to.size());
-
-    start_pos = pos + from.size();
-  } while (all);
-  result.append(s.data() + start_pos, s.size() - start_pos);
-  return result;
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/strings_test.cpp b/base/strings_test.cpp
deleted file mode 100644
index 5ae3094..0000000
--- a/base/strings_test.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "android-base/strings.h"
-
-#include <gtest/gtest.h>
-
-#include <string>
-#include <vector>
-#include <set>
-#include <unordered_set>
-
-TEST(strings, split_empty) {
-  std::vector<std::string> parts = android::base::Split("", ",");
-  ASSERT_EQ(1U, parts.size());
-  ASSERT_EQ("", parts[0]);
-}
-
-TEST(strings, split_single) {
-  std::vector<std::string> parts = android::base::Split("foo", ",");
-  ASSERT_EQ(1U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-}
-
-TEST(strings, split_simple) {
-  std::vector<std::string> parts = android::base::Split("foo,bar,baz", ",");
-  ASSERT_EQ(3U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-  ASSERT_EQ("bar", parts[1]);
-  ASSERT_EQ("baz", parts[2]);
-}
-
-TEST(strings, split_with_empty_part) {
-  std::vector<std::string> parts = android::base::Split("foo,,bar", ",");
-  ASSERT_EQ(3U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-  ASSERT_EQ("", parts[1]);
-  ASSERT_EQ("bar", parts[2]);
-}
-
-TEST(strings, split_with_trailing_empty_part) {
-  std::vector<std::string> parts = android::base::Split("foo,bar,", ",");
-  ASSERT_EQ(3U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-  ASSERT_EQ("bar", parts[1]);
-  ASSERT_EQ("", parts[2]);
-}
-
-TEST(strings, split_null_char) {
-  std::vector<std::string> parts =
-      android::base::Split(std::string("foo\0bar", 7), std::string("\0", 1));
-  ASSERT_EQ(2U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-  ASSERT_EQ("bar", parts[1]);
-}
-
-TEST(strings, split_any) {
-  std::vector<std::string> parts = android::base::Split("foo:bar,baz", ",:");
-  ASSERT_EQ(3U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-  ASSERT_EQ("bar", parts[1]);
-  ASSERT_EQ("baz", parts[2]);
-}
-
-TEST(strings, split_any_with_empty_part) {
-  std::vector<std::string> parts = android::base::Split("foo:,bar", ",:");
-  ASSERT_EQ(3U, parts.size());
-  ASSERT_EQ("foo", parts[0]);
-  ASSERT_EQ("", parts[1]);
-  ASSERT_EQ("bar", parts[2]);
-}
-
-TEST(strings, trim_empty) {
-  ASSERT_EQ("", android::base::Trim(""));
-}
-
-TEST(strings, trim_already_trimmed) {
-  ASSERT_EQ("foo", android::base::Trim("foo"));
-}
-
-TEST(strings, trim_left) {
-  ASSERT_EQ("foo", android::base::Trim(" foo"));
-}
-
-TEST(strings, trim_right) {
-  ASSERT_EQ("foo", android::base::Trim("foo "));
-}
-
-TEST(strings, trim_both) {
-  ASSERT_EQ("foo", android::base::Trim(" foo "));
-}
-
-TEST(strings, trim_no_trim_middle) {
-  ASSERT_EQ("foo bar", android::base::Trim("foo bar"));
-}
-
-TEST(strings, trim_other_whitespace) {
-  ASSERT_EQ("foo", android::base::Trim("\v\tfoo\n\f"));
-}
-
-TEST(strings, join_nothing) {
-  std::vector<std::string> list = {};
-  ASSERT_EQ("", android::base::Join(list, ','));
-}
-
-TEST(strings, join_single) {
-  std::vector<std::string> list = {"foo"};
-  ASSERT_EQ("foo", android::base::Join(list, ','));
-}
-
-TEST(strings, join_simple) {
-  std::vector<std::string> list = {"foo", "bar", "baz"};
-  ASSERT_EQ("foo,bar,baz", android::base::Join(list, ','));
-}
-
-TEST(strings, join_separator_in_vector) {
-  std::vector<std::string> list = {",", ","};
-  ASSERT_EQ(",,,", android::base::Join(list, ','));
-}
-
-TEST(strings, join_simple_ints) {
-  std::set<int> list = {1, 2, 3};
-  ASSERT_EQ("1,2,3", android::base::Join(list, ','));
-}
-
-TEST(strings, join_unordered_set) {
-  std::unordered_set<int> list = {1, 2};
-  ASSERT_TRUE("1,2" == android::base::Join(list, ',') ||
-              "2,1" == android::base::Join(list, ','));
-}
-
-TEST(strings, StartsWith_empty) {
-  ASSERT_FALSE(android::base::StartsWith("", "foo"));
-  ASSERT_TRUE(android::base::StartsWith("", ""));
-}
-
-TEST(strings, StartsWithIgnoreCase_empty) {
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("", "foo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("", ""));
-}
-
-TEST(strings, StartsWith_simple) {
-  ASSERT_TRUE(android::base::StartsWith("foo", ""));
-  ASSERT_TRUE(android::base::StartsWith("foo", "f"));
-  ASSERT_TRUE(android::base::StartsWith("foo", "fo"));
-  ASSERT_TRUE(android::base::StartsWith("foo", "foo"));
-}
-
-TEST(strings, StartsWithIgnoreCase_simple) {
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", ""));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "f"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "F"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "fo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "fO"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "Fo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "FO"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "foo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "foO"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "fOo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "fOO"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "Foo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "FoO"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "FOo"));
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("foo", "FOO"));
-}
-
-TEST(strings, StartsWith_prefix_too_long) {
-  ASSERT_FALSE(android::base::StartsWith("foo", "foobar"));
-}
-
-TEST(strings, StartsWithIgnoreCase_prefix_too_long) {
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("foo", "foobar"));
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("foo", "FOOBAR"));
-}
-
-TEST(strings, StartsWith_contains_prefix) {
-  ASSERT_FALSE(android::base::StartsWith("foobar", "oba"));
-  ASSERT_FALSE(android::base::StartsWith("foobar", "bar"));
-}
-
-TEST(strings, StartsWithIgnoreCase_contains_prefix) {
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("foobar", "oba"));
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("foobar", "OBA"));
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("foobar", "bar"));
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("foobar", "BAR"));
-}
-
-TEST(strings, StartsWith_char) {
-  ASSERT_FALSE(android::base::StartsWith("", 'f'));
-  ASSERT_TRUE(android::base::StartsWith("foo", 'f'));
-  ASSERT_FALSE(android::base::StartsWith("foo", 'o'));
-}
-
-TEST(strings, EndsWith_empty) {
-  ASSERT_FALSE(android::base::EndsWith("", "foo"));
-  ASSERT_TRUE(android::base::EndsWith("", ""));
-}
-
-TEST(strings, EndsWithIgnoreCase_empty) {
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("", "foo"));
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("", "FOO"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("", ""));
-}
-
-TEST(strings, EndsWith_simple) {
-  ASSERT_TRUE(android::base::EndsWith("foo", ""));
-  ASSERT_TRUE(android::base::EndsWith("foo", "o"));
-  ASSERT_TRUE(android::base::EndsWith("foo", "oo"));
-  ASSERT_TRUE(android::base::EndsWith("foo", "foo"));
-}
-
-TEST(strings, EndsWithIgnoreCase_simple) {
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", ""));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "o"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "O"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "oo"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "oO"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "Oo"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "OO"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "foo"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "foO"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "fOo"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "fOO"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "Foo"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "FoO"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "FOo"));
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("foo", "FOO"));
-}
-
-TEST(strings, EndsWith_prefix_too_long) {
-  ASSERT_FALSE(android::base::EndsWith("foo", "foobar"));
-}
-
-TEST(strings, EndsWithIgnoreCase_prefix_too_long) {
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("foo", "foobar"));
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("foo", "FOOBAR"));
-}
-
-TEST(strings, EndsWith_contains_prefix) {
-  ASSERT_FALSE(android::base::EndsWith("foobar", "oba"));
-  ASSERT_FALSE(android::base::EndsWith("foobar", "foo"));
-}
-
-TEST(strings, EndsWithIgnoreCase_contains_prefix) {
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("foobar", "OBA"));
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("foobar", "FOO"));
-}
-
-TEST(strings, StartsWith_std_string) {
-  ASSERT_TRUE(android::base::StartsWith("hello", std::string{"hell"}));
-  ASSERT_FALSE(android::base::StartsWith("goodbye", std::string{"hell"}));
-}
-
-TEST(strings, StartsWithIgnoreCase_std_string) {
-  ASSERT_TRUE(android::base::StartsWithIgnoreCase("HeLlO", std::string{"hell"}));
-  ASSERT_FALSE(android::base::StartsWithIgnoreCase("GoOdByE", std::string{"hell"}));
-}
-
-TEST(strings, EndsWith_std_string) {
-  ASSERT_TRUE(android::base::EndsWith("hello", std::string{"lo"}));
-  ASSERT_FALSE(android::base::EndsWith("goodbye", std::string{"lo"}));
-}
-
-TEST(strings, EndsWithIgnoreCase_std_string) {
-  ASSERT_TRUE(android::base::EndsWithIgnoreCase("HeLlO", std::string{"lo"}));
-  ASSERT_FALSE(android::base::EndsWithIgnoreCase("GoOdByE", std::string{"lo"}));
-}
-
-TEST(strings, EndsWith_char) {
-  ASSERT_FALSE(android::base::EndsWith("", 'o'));
-  ASSERT_TRUE(android::base::EndsWith("foo", 'o'));
-  ASSERT_FALSE(android::base::EndsWith("foo", "f"));
-}
-
-TEST(strings, EqualsIgnoreCase) {
-  ASSERT_TRUE(android::base::EqualsIgnoreCase("foo", "FOO"));
-  ASSERT_TRUE(android::base::EqualsIgnoreCase("FOO", "foo"));
-  ASSERT_FALSE(android::base::EqualsIgnoreCase("foo", "bar"));
-  ASSERT_FALSE(android::base::EqualsIgnoreCase("foo", "fool"));
-}
-
-TEST(strings, ubsan_28729303) {
-  android::base::Split("/dev/null", ":");
-}
-
-TEST(strings, ConsumePrefix) {
-  std::string_view s{"foo.bar"};
-  ASSERT_FALSE(android::base::ConsumePrefix(&s, "bar."));
-  ASSERT_EQ("foo.bar", s);
-  ASSERT_TRUE(android::base::ConsumePrefix(&s, "foo."));
-  ASSERT_EQ("bar", s);
-}
-
-TEST(strings, ConsumeSuffix) {
-  std::string_view s{"foo.bar"};
-  ASSERT_FALSE(android::base::ConsumeSuffix(&s, ".foo"));
-  ASSERT_EQ("foo.bar", s);
-  ASSERT_TRUE(android::base::ConsumeSuffix(&s, ".bar"));
-  ASSERT_EQ("foo", s);
-}
-
-TEST(strings, StringReplace_false) {
-  // No change.
-  ASSERT_EQ("abcabc", android::base::StringReplace("abcabc", "z", "Z", false));
-  ASSERT_EQ("", android::base::StringReplace("", "z", "Z", false));
-  ASSERT_EQ("abcabc", android::base::StringReplace("abcabc", "", "Z", false));
-
-  // Equal lengths.
-  ASSERT_EQ("Abcabc", android::base::StringReplace("abcabc", "a", "A", false));
-  ASSERT_EQ("aBcabc", android::base::StringReplace("abcabc", "b", "B", false));
-  ASSERT_EQ("abCabc", android::base::StringReplace("abcabc", "c", "C", false));
-
-  // Longer replacement.
-  ASSERT_EQ("foobcabc", android::base::StringReplace("abcabc", "a", "foo", false));
-  ASSERT_EQ("afoocabc", android::base::StringReplace("abcabc", "b", "foo", false));
-  ASSERT_EQ("abfooabc", android::base::StringReplace("abcabc", "c", "foo", false));
-
-  // Shorter replacement.
-  ASSERT_EQ("xxyz", android::base::StringReplace("abcxyz", "abc", "x", false));
-  ASSERT_EQ("axyz", android::base::StringReplace("abcxyz", "bcx", "x", false));
-  ASSERT_EQ("abcx", android::base::StringReplace("abcxyz", "xyz", "x", false));
-}
-
-TEST(strings, StringReplace_true) {
-  // No change.
-  ASSERT_EQ("abcabc", android::base::StringReplace("abcabc", "z", "Z", true));
-  ASSERT_EQ("", android::base::StringReplace("", "z", "Z", true));
-  ASSERT_EQ("abcabc", android::base::StringReplace("abcabc", "", "Z", true));
-
-  // Equal lengths.
-  ASSERT_EQ("AbcAbc", android::base::StringReplace("abcabc", "a", "A", true));
-  ASSERT_EQ("aBcaBc", android::base::StringReplace("abcabc", "b", "B", true));
-  ASSERT_EQ("abCabC", android::base::StringReplace("abcabc", "c", "C", true));
-
-  // Longer replacement.
-  ASSERT_EQ("foobcfoobc", android::base::StringReplace("abcabc", "a", "foo", true));
-  ASSERT_EQ("afoocafooc", android::base::StringReplace("abcabc", "b", "foo", true));
-  ASSERT_EQ("abfooabfoo", android::base::StringReplace("abcabc", "c", "foo", true));
-
-  // Shorter replacement.
-  ASSERT_EQ("xxyzx", android::base::StringReplace("abcxyzabc", "abc", "x", true));
-  ASSERT_EQ("<xx>", android::base::StringReplace("<abcabc>", "abc", "x", true));
-}
diff --git a/base/test_main.cpp b/base/test_main.cpp
deleted file mode 100644
index 7fa6a84..0000000
--- a/base/test_main.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <gtest/gtest.h>
-
-#include "android-base/logging.h"
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  android::base::InitLogging(argv, android::base::StderrLogger);
-  return RUN_ALL_TESTS();
-}
diff --git a/base/test_utils.cpp b/base/test_utils.cpp
deleted file mode 100644
index 36b4cdf..0000000
--- a/base/test_utils.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "android-base/test_utils.h"
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-
-CapturedStdFd::CapturedStdFd(int std_fd) : std_fd_(std_fd), old_fd_(-1) {
-  Start();
-}
-
-CapturedStdFd::~CapturedStdFd() {
-  if (old_fd_ != -1) {
-    Stop();
-  }
-}
-
-int CapturedStdFd::fd() const {
-  return temp_file_.fd;
-}
-
-std::string CapturedStdFd::str() {
-  std::string result;
-  CHECK_EQ(0, TEMP_FAILURE_RETRY(lseek(fd(), 0, SEEK_SET)));
-  android::base::ReadFdToString(fd(), &result);
-  return result;
-}
-
-void CapturedStdFd::Reset() {
-  // Do not reset while capturing.
-  CHECK_EQ(-1, old_fd_);
-  CHECK_EQ(0, TEMP_FAILURE_RETRY(lseek(fd(), 0, SEEK_SET)));
-  CHECK_EQ(0, ftruncate(fd(), 0));
-}
-
-void CapturedStdFd::Start() {
-#if defined(_WIN32)
-  // On Windows, stderr is often buffered, so make sure it is unbuffered so
-  // that we can immediately read back what was written to stderr.
-  if (std_fd_ == STDERR_FILENO) CHECK_EQ(0, setvbuf(stderr, nullptr, _IONBF, 0));
-#endif
-  old_fd_ = dup(std_fd_);
-  CHECK_NE(-1, old_fd_);
-  CHECK_NE(-1, dup2(fd(), std_fd_));
-}
-
-void CapturedStdFd::Stop() {
-  CHECK_NE(-1, old_fd_);
-  CHECK_NE(-1, dup2(old_fd_, std_fd_));
-  close(old_fd_);
-  old_fd_ = -1;
-  // Note: cannot restore prior setvbuf() setting.
-}
diff --git a/base/test_utils_test.cpp b/base/test_utils_test.cpp
deleted file mode 100644
index 15a79dd..0000000
--- a/base/test_utils_test.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdio.h>
-
-#include "android-base/test_utils.h"
-
-#include <gtest/gtest-spi.h>
-#include <gtest/gtest.h>
-
-namespace android {
-namespace base {
-
-TEST(TestUtilsTest, AssertMatch) {
-  ASSERT_MATCH("foobar", R"(fo+baz?r)");
-  EXPECT_FATAL_FAILURE(ASSERT_MATCH("foobar", R"(foobaz)"), "regex mismatch");
-}
-
-TEST(TestUtilsTest, AssertNotMatch) {
-  ASSERT_NOT_MATCH("foobar", R"(foobaz)");
-  EXPECT_FATAL_FAILURE(ASSERT_NOT_MATCH("foobar", R"(foobar)"), "regex mismatch");
-}
-
-TEST(TestUtilsTest, ExpectMatch) {
-  EXPECT_MATCH("foobar", R"(fo+baz?r)");
-  EXPECT_NONFATAL_FAILURE(EXPECT_MATCH("foobar", R"(foobaz)"), "regex mismatch");
-}
-
-TEST(TestUtilsTest, ExpectNotMatch) {
-  EXPECT_NOT_MATCH("foobar", R"(foobaz)");
-  EXPECT_NONFATAL_FAILURE(EXPECT_NOT_MATCH("foobar", R"(foobar)"), "regex mismatch");
-}
-
-TEST(TestUtilsTest, CaptureStdout_smoke) {
-  CapturedStdout cap;
-  printf("This should be captured.\n");
-  cap.Stop();
-  printf("This will not be captured.\n");
-  ASSERT_EQ("This should be captured.\n", cap.str());
-
-  cap.Start();
-  printf("And this text should be captured too.\n");
-  cap.Stop();
-  ASSERT_EQ("This should be captured.\nAnd this text should be captured too.\n", cap.str());
-
-  printf("Still not going to be captured.\n");
-  cap.Reset();
-  cap.Start();
-  printf("Only this will be captured.\n");
-  ASSERT_EQ("Only this will be captured.\n", cap.str());
-}
-
-TEST(TestUtilsTest, CaptureStderr_smoke) {
-  CapturedStderr cap;
-  fprintf(stderr, "This should be captured.\n");
-  cap.Stop();
-  fprintf(stderr, "This will not be captured.\n");
-  ASSERT_EQ("This should be captured.\n", cap.str());
-
-  cap.Start();
-  fprintf(stderr, "And this text should be captured too.\n");
-  cap.Stop();
-  ASSERT_EQ("This should be captured.\nAnd this text should be captured too.\n", cap.str());
-
-  fprintf(stderr, "Still not going to be captured.\n");
-  cap.Reset();
-  cap.Start();
-  fprintf(stderr, "Only this will be captured.\n");
-  ASSERT_EQ("Only this will be captured.\n", cap.str());
-}
-
-}  // namespace base
-}  // namespace android
diff --git a/base/threads.cpp b/base/threads.cpp
deleted file mode 100644
index 48f6197..0000000
--- a/base/threads.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <android-base/threads.h>
-
-#include <stdint.h>
-#include <unistd.h>
-
-#if defined(__APPLE__)
-#include <pthread.h>
-#elif defined(__linux__) && !defined(__ANDROID__)
-#include <syscall.h>
-#elif defined(_WIN32)
-#include <windows.h>
-#endif
-
-namespace android {
-namespace base {
-
-uint64_t GetThreadId() {
-#if defined(__BIONIC__)
-  return gettid();
-#elif defined(__APPLE__)
-  uint64_t tid;
-  pthread_threadid_np(NULL, &tid);
-  return tid;
-#elif defined(__linux__)
-  return syscall(__NR_gettid);
-#elif defined(_WIN32)
-  return GetCurrentThreadId();
-#endif
-}
-
-}  // namespace base
-}  // namespace android
-
-#if defined(__GLIBC__)
-int tgkill(int tgid, int tid, int sig) {
-  return syscall(__NR_tgkill, tgid, tid, sig);
-}
-#endif
diff --git a/base/utf8.cpp b/base/utf8.cpp
deleted file mode 100644
index adb46d0..0000000
--- a/base/utf8.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <windows.h>
-
-#include "android-base/utf8.h"
-
-#include <fcntl.h>
-#include <stdio.h>
-
-#include <algorithm>
-#include <string>
-
-#include "android-base/logging.h"
-
-namespace android {
-namespace base {
-
-// Helper to set errno based on GetLastError() after WideCharToMultiByte()/MultiByteToWideChar().
-static void SetErrnoFromLastError() {
-  switch (GetLastError()) {
-    case ERROR_NO_UNICODE_TRANSLATION:
-      errno = EILSEQ;
-      break;
-    default:
-      errno = EINVAL;
-      break;
-  }
-}
-
-bool WideToUTF8(const wchar_t* utf16, const size_t size, std::string* utf8) {
-  utf8->clear();
-
-  if (size == 0) {
-    return true;
-  }
-
-  // TODO: Consider using std::wstring_convert once libcxx is supported on
-  // Windows.
-
-  // Only Vista or later has this flag that causes WideCharToMultiByte() to
-  // return an error on invalid characters.
-  const DWORD flags =
-#if (WINVER >= 0x0600)
-    WC_ERR_INVALID_CHARS;
-#else
-    0;
-#endif
-
-  const int chars_required = WideCharToMultiByte(CP_UTF8, flags, utf16, size,
-                                                 NULL, 0, NULL, NULL);
-  if (chars_required <= 0) {
-    SetErrnoFromLastError();
-    return false;
-  }
-
-  // This could potentially throw a std::bad_alloc exception.
-  utf8->resize(chars_required);
-
-  const int result = WideCharToMultiByte(CP_UTF8, flags, utf16, size,
-                                         &(*utf8)[0], chars_required, NULL,
-                                         NULL);
-  if (result != chars_required) {
-    SetErrnoFromLastError();
-    CHECK_LE(result, chars_required) << "WideCharToMultiByte wrote " << result
-        << " chars to buffer of " << chars_required << " chars";
-    utf8->clear();
-    return false;
-  }
-
-  return true;
-}
-
-bool WideToUTF8(const wchar_t* utf16, std::string* utf8) {
-  // Compute string length of NULL-terminated string with wcslen().
-  return WideToUTF8(utf16, wcslen(utf16), utf8);
-}
-
-bool WideToUTF8(const std::wstring& utf16, std::string* utf8) {
-  // Use the stored length of the string which allows embedded NULL characters
-  // to be converted.
-  return WideToUTF8(utf16.c_str(), utf16.length(), utf8);
-}
-
-// Internal helper function that takes MultiByteToWideChar() flags.
-static bool UTF8ToWideWithFlags(const char* utf8, const size_t size, std::wstring* utf16,
-                                const DWORD flags) {
-  utf16->clear();
-
-  if (size == 0) {
-    return true;
-  }
-
-  // TODO: Consider using std::wstring_convert once libcxx is supported on
-  // Windows.
-  const int chars_required = MultiByteToWideChar(CP_UTF8, flags, utf8, size,
-                                                 NULL, 0);
-  if (chars_required <= 0) {
-    SetErrnoFromLastError();
-    return false;
-  }
-
-  // This could potentially throw a std::bad_alloc exception.
-  utf16->resize(chars_required);
-
-  const int result = MultiByteToWideChar(CP_UTF8, flags, utf8, size,
-                                         &(*utf16)[0], chars_required);
-  if (result != chars_required) {
-    SetErrnoFromLastError();
-    CHECK_LE(result, chars_required) << "MultiByteToWideChar wrote " << result
-        << " chars to buffer of " << chars_required << " chars";
-    utf16->clear();
-    return false;
-  }
-
-  return true;
-}
-
-bool UTF8ToWide(const char* utf8, const size_t size, std::wstring* utf16) {
-  // If strictly interpreting as UTF-8 succeeds, return success.
-  if (UTF8ToWideWithFlags(utf8, size, utf16, MB_ERR_INVALID_CHARS)) {
-    return true;
-  }
-
-  const int saved_errno = errno;
-
-  // Fallback to non-strict interpretation, allowing invalid characters and
-  // converting as best as possible, and return false to signify a problem.
-  (void)UTF8ToWideWithFlags(utf8, size, utf16, 0);
-  errno = saved_errno;
-  return false;
-}
-
-bool UTF8ToWide(const char* utf8, std::wstring* utf16) {
-  // Compute string length of NULL-terminated string with strlen().
-  return UTF8ToWide(utf8, strlen(utf8), utf16);
-}
-
-bool UTF8ToWide(const std::string& utf8, std::wstring* utf16) {
-  // Use the stored length of the string which allows embedded NULL characters
-  // to be converted.
-  return UTF8ToWide(utf8.c_str(), utf8.length(), utf16);
-}
-
-static bool isDriveLetter(wchar_t c) {
-  return (c >= L'a' && c <= L'z') || (c >= L'A' && c <= L'Z');
-}
-
-bool UTF8PathToWindowsLongPath(const char* utf8, std::wstring* utf16) {
-  if (!UTF8ToWide(utf8, utf16)) {
-    return false;
-  }
-  // Note: Although most Win32 File I/O API are limited to MAX_PATH (260
-  //       characters), the CreateDirectory API is limited to 248 characters.
-  if (utf16->length() >= 248) {
-    // If path is of the form "x:\" or "x:/"
-    if (isDriveLetter((*utf16)[0]) && (*utf16)[1] == L':' &&
-        ((*utf16)[2] == L'\\' || (*utf16)[2] == L'/')) {
-      // Append long path prefix, and make sure there are no unix-style
-      // separators to ensure a fully compliant Win32 long path string.
-      utf16->insert(0, LR"(\\?\)");
-      std::replace(utf16->begin(), utf16->end(), L'/', L'\\');
-    }
-  }
-  return true;
-}
-
-// Versions of standard library APIs that support UTF-8 strings.
-namespace utf8 {
-
-FILE* fopen(const char* name, const char* mode) {
-  std::wstring name_utf16;
-  if (!UTF8PathToWindowsLongPath(name, &name_utf16)) {
-    return nullptr;
-  }
-
-  std::wstring mode_utf16;
-  if (!UTF8ToWide(mode, &mode_utf16)) {
-    return nullptr;
-  }
-
-  return _wfopen(name_utf16.c_str(), mode_utf16.c_str());
-}
-
-int mkdir(const char* name, mode_t) {
-  std::wstring name_utf16;
-  if (!UTF8PathToWindowsLongPath(name, &name_utf16)) {
-    return -1;
-  }
-
-  return _wmkdir(name_utf16.c_str());
-}
-
-int open(const char* name, int flags, ...) {
-  std::wstring name_utf16;
-  if (!UTF8PathToWindowsLongPath(name, &name_utf16)) {
-    return -1;
-  }
-
-  int mode = 0;
-  if ((flags & O_CREAT) != 0) {
-    va_list args;
-    va_start(args, flags);
-    mode = va_arg(args, int);
-    va_end(args);
-  }
-
-  return _wopen(name_utf16.c_str(), flags, mode);
-}
-
-int unlink(const char* name) {
-  std::wstring name_utf16;
-  if (!UTF8PathToWindowsLongPath(name, &name_utf16)) {
-    return -1;
-  }
-
-  return _wunlink(name_utf16.c_str());
-}
-
-}  // namespace utf8
-}  // namespace base
-}  // namespace android
diff --git a/base/utf8_test.cpp b/base/utf8_test.cpp
deleted file mode 100644
index 472e82c..0000000
--- a/base/utf8_test.cpp
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
-* Copyright (C) 2015 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.
-*/
-
-#include "android-base/utf8.h"
-
-#include <gtest/gtest.h>
-
-#include <fcntl.h>
-#include <stdlib.h>
-
-#include "android-base/file.h"
-#include "android-base/macros.h"
-#include "android-base/unique_fd.h"
-
-namespace android {
-namespace base {
-
-TEST(UTFStringConversionsTest, ConvertInvalidUTF8) {
-  std::wstring wide;
-
-  errno = 0;
-
-  // Standalone \xa2 is an invalid UTF-8 sequence, so this should return an
-  // error. Concatenate two C/C++ literal string constants to prevent the
-  // compiler from giving an error about "\xa2af" containing a "hex escape
-  // sequence out of range".
-  EXPECT_FALSE(android::base::UTF8ToWide("before\xa2" "after", &wide));
-
-  EXPECT_EQ(EILSEQ, errno);
-
-  // Even if an invalid character is encountered, UTF8ToWide() should still do
-  // its best to convert the rest of the string. sysdeps_win32.cpp:
-  // _console_write_utf8() depends on this behavior.
-  //
-  // Thus, we verify that the valid characters are converted, but we ignore the
-  // specific replacement character that UTF8ToWide() may replace the invalid
-  // UTF-8 characters with because we want to allow that to change if the
-  // implementation changes.
-  EXPECT_EQ(0U, wide.find(L"before"));
-  const wchar_t after_wide[] = L"after";
-  EXPECT_EQ(wide.length() - (arraysize(after_wide) - 1), wide.find(after_wide));
-}
-
-// Below is adapted from https://chromium.googlesource.com/chromium/src/+/master/base/strings/utf_string_conversions_unittest.cc
-
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// The tests below from utf_string_conversions_unittest.cc check for this
-// preprocessor symbol, so define it, as it is appropriate for Windows.
-#define WCHAR_T_IS_UTF16
-static_assert(sizeof(wchar_t) == 2, "wchar_t is not 2 bytes");
-
-// The tests below from utf_string_conversions_unittest.cc call versions of
-// UTF8ToWide() and WideToUTF8() that don't return success/failure, so these are
-// stub implementations with that signature. These are just for testing and
-// should not be moved to base because they assert/expect no errors which is
-// probably not a good idea (or at least it is something that should be left
-// up to the caller, not a base library).
-
-static std::wstring UTF8ToWide(const std::string& utf8) {
-  std::wstring utf16;
-  EXPECT_TRUE(UTF8ToWide(utf8, &utf16));
-  return utf16;
-}
-
-static std::string WideToUTF8(const std::wstring& utf16) {
-  std::string utf8;
-  EXPECT_TRUE(WideToUTF8(utf16, &utf8));
-  return utf8;
-}
-
-namespace {
-
-const wchar_t* const kConvertRoundtripCases[] = {
-  L"Google Video",
-  // "网页 图片 资讯更多 »"
-  L"\x7f51\x9875\x0020\x56fe\x7247\x0020\x8d44\x8baf\x66f4\x591a\x0020\x00bb",
-  //  "Παγκόσμιος Ιστός"
-  L"\x03a0\x03b1\x03b3\x03ba\x03cc\x03c3\x03bc\x03b9"
-  L"\x03bf\x03c2\x0020\x0399\x03c3\x03c4\x03cc\x03c2",
-  // "Поиск страниц на русском"
-  L"\x041f\x043e\x0438\x0441\x043a\x0020\x0441\x0442"
-  L"\x0440\x0430\x043d\x0438\x0446\x0020\x043d\x0430"
-  L"\x0020\x0440\x0443\x0441\x0441\x043a\x043e\x043c",
-  // "전체서비스"
-  L"\xc804\xccb4\xc11c\xbe44\xc2a4",
-
-  // Test characters that take more than 16 bits. This will depend on whether
-  // wchar_t is 16 or 32 bits.
-#if defined(WCHAR_T_IS_UTF16)
-  L"\xd800\xdf00",
-  // ?????  (Mathematical Alphanumeric Symbols (U+011d40 - U+011d44 : A,B,C,D,E)
-  L"\xd807\xdd40\xd807\xdd41\xd807\xdd42\xd807\xdd43\xd807\xdd44",
-#elif defined(WCHAR_T_IS_UTF32)
-  L"\x10300",
-  // ?????  (Mathematical Alphanumeric Symbols (U+011d40 - U+011d44 : A,B,C,D,E)
-  L"\x11d40\x11d41\x11d42\x11d43\x11d44",
-#endif
-};
-
-}  // namespace
-
-TEST(UTFStringConversionsTest, ConvertUTF8AndWide) {
-  // we round-trip all the wide strings through UTF-8 to make sure everything
-  // agrees on the conversion. This uses the stream operators to test them
-  // simultaneously.
-  for (size_t i = 0; i < arraysize(kConvertRoundtripCases); ++i) {
-    std::ostringstream utf8;
-    utf8 << WideToUTF8(kConvertRoundtripCases[i]);
-    std::wostringstream wide;
-    wide << UTF8ToWide(utf8.str());
-
-    EXPECT_EQ(kConvertRoundtripCases[i], wide.str());
-  }
-}
-
-TEST(UTFStringConversionsTest, ConvertUTF8AndWideEmptyString) {
-  // An empty std::wstring should be converted to an empty std::string,
-  // and vice versa.
-  std::wstring wempty;
-  std::string empty;
-  EXPECT_EQ(empty, WideToUTF8(wempty));
-  EXPECT_EQ(wempty, UTF8ToWide(empty));
-}
-
-TEST(UTFStringConversionsTest, ConvertUTF8ToWide) {
-  struct UTF8ToWideCase {
-    const char* utf8;
-    const wchar_t* wide;
-    bool success;
-  } convert_cases[] = {
-    // Regular UTF-8 input.
-    {"\xe4\xbd\xa0\xe5\xa5\xbd", L"\x4f60\x597d", true},
-    // Non-character is passed through.
-    {"\xef\xbf\xbfHello", L"\xffffHello", true},
-    // Truncated UTF-8 sequence.
-    {"\xe4\xa0\xe5\xa5\xbd", L"\xfffd\x597d", false},
-    // Truncated off the end.
-    {"\xe5\xa5\xbd\xe4\xa0", L"\x597d\xfffd", false},
-    // Non-shortest-form UTF-8.
-    {"\xf0\x84\xbd\xa0\xe5\xa5\xbd", L"\xfffd\x597d", false},
-    // This UTF-8 character decodes to a UTF-16 surrogate, which is illegal.
-    // Note that for whatever reason, this test fails on Windows XP.
-    {"\xed\xb0\x80", L"\xfffd", false},
-    // Non-BMP characters. The second is a non-character regarded as valid.
-    // The result will either be in UTF-16 or UTF-32.
-#if defined(WCHAR_T_IS_UTF16)
-    {"A\xF0\x90\x8C\x80z", L"A\xd800\xdf00z", true},
-    {"A\xF4\x8F\xBF\xBEz", L"A\xdbff\xdffez", true},
-#elif defined(WCHAR_T_IS_UTF32)
-    {"A\xF0\x90\x8C\x80z", L"A\x10300z", true},
-    {"A\xF4\x8F\xBF\xBEz", L"A\x10fffez", true},
-#endif
-  };
-
-  for (size_t i = 0; i < arraysize(convert_cases); i++) {
-    std::wstring converted;
-    errno = 0;
-    const bool success = UTF8ToWide(convert_cases[i].utf8,
-                                    strlen(convert_cases[i].utf8),
-                                    &converted);
-    EXPECT_EQ(convert_cases[i].success, success);
-    // The original test always compared expected and converted, but don't do
-    // that because our implementation of UTF8ToWide() does not guarantee to
-    // produce the same output in error situations.
-    if (success) {
-      std::wstring expected(convert_cases[i].wide);
-      EXPECT_EQ(expected, converted);
-    } else {
-      EXPECT_EQ(EILSEQ, errno);
-    }
-  }
-
-  // Manually test an embedded NULL.
-  std::wstring converted;
-  EXPECT_TRUE(UTF8ToWide("\00Z\t", 3, &converted));
-  ASSERT_EQ(3U, converted.length());
-  EXPECT_EQ(static_cast<wchar_t>(0), converted[0]);
-  EXPECT_EQ('Z', converted[1]);
-  EXPECT_EQ('\t', converted[2]);
-
-  // Make sure that conversion replaces, not appends.
-  EXPECT_TRUE(UTF8ToWide("B", 1, &converted));
-  ASSERT_EQ(1U, converted.length());
-  EXPECT_EQ('B', converted[0]);
-}
-
-#if defined(WCHAR_T_IS_UTF16)
-// This test is only valid when wchar_t == UTF-16.
-TEST(UTFStringConversionsTest, ConvertUTF16ToUTF8) {
-  struct WideToUTF8Case {
-    const wchar_t* utf16;
-    const char* utf8;
-    bool success;
-  } convert_cases[] = {
-    // Regular UTF-16 input.
-    {L"\x4f60\x597d", "\xe4\xbd\xa0\xe5\xa5\xbd", true},
-    // Test a non-BMP character.
-    {L"\xd800\xdf00", "\xF0\x90\x8C\x80", true},
-    // Non-characters are passed through.
-    {L"\xffffHello", "\xEF\xBF\xBFHello", true},
-    {L"\xdbff\xdffeHello", "\xF4\x8F\xBF\xBEHello", true},
-    // The first character is a truncated UTF-16 character.
-    // Note that for whatever reason, this test fails on Windows XP.
-    {L"\xd800\x597d", "\xef\xbf\xbd\xe5\xa5\xbd",
-#if (WINVER >= 0x0600)
-    // Only Vista and later has a new API/flag that correctly returns false.
-    false
-#else
-    true
-#endif
-    },
-    // Truncated at the end.
-    // Note that for whatever reason, this test fails on Windows XP.
-    {L"\x597d\xd800", "\xe5\xa5\xbd\xef\xbf\xbd",
-#if (WINVER >= 0x0600)
-    // Only Vista and later has a new API/flag that correctly returns false.
-    false
-#else
-    true
-#endif
-    },
-  };
-
-  for (size_t i = 0; i < arraysize(convert_cases); i++) {
-    std::string converted;
-    errno = 0;
-    const bool success = WideToUTF8(convert_cases[i].utf16,
-                                    wcslen(convert_cases[i].utf16),
-                                    &converted);
-    EXPECT_EQ(convert_cases[i].success, success);
-    // The original test always compared expected and converted, but don't do
-    // that because our implementation of WideToUTF8() does not guarantee to
-    // produce the same output in error situations.
-    if (success) {
-      std::string expected(convert_cases[i].utf8);
-      EXPECT_EQ(expected, converted);
-    } else {
-      EXPECT_EQ(EILSEQ, errno);
-    }
-  }
-}
-
-#elif defined(WCHAR_T_IS_UTF32)
-// This test is only valid when wchar_t == UTF-32.
-TEST(UTFStringConversionsTest, ConvertUTF32ToUTF8) {
-  struct WideToUTF8Case {
-    const wchar_t* utf32;
-    const char* utf8;
-    bool success;
-  } convert_cases[] = {
-    // Regular 16-bit input.
-    {L"\x4f60\x597d", "\xe4\xbd\xa0\xe5\xa5\xbd", true},
-    // Test a non-BMP character.
-    {L"A\x10300z", "A\xF0\x90\x8C\x80z", true},
-    // Non-characters are passed through.
-    {L"\xffffHello", "\xEF\xBF\xBFHello", true},
-    {L"\x10fffeHello", "\xF4\x8F\xBF\xBEHello", true},
-    // Invalid Unicode code points.
-    {L"\xfffffffHello", "\xEF\xBF\xBDHello", false},
-    // The first character is a truncated UTF-16 character.
-    {L"\xd800\x597d", "\xef\xbf\xbd\xe5\xa5\xbd", false},
-    {L"\xdc01Hello", "\xef\xbf\xbdHello", false},
-  };
-
-  for (size_t i = 0; i < arraysize(convert_cases); i++) {
-    std::string converted;
-    EXPECT_EQ(convert_cases[i].success,
-              WideToUTF8(convert_cases[i].utf32,
-                         wcslen(convert_cases[i].utf32),
-                         &converted));
-    std::string expected(convert_cases[i].utf8);
-    EXPECT_EQ(expected, converted);
-  }
-}
-#endif  // defined(WCHAR_T_IS_UTF32)
-
-// The test below uses these types and functions, so just do enough to get the
-// test running.
-typedef wchar_t char16;
-typedef std::wstring string16;
-
-template<typename T>
-static void* WriteInto(T* t, size_t size) {
-  // std::(w)string::resize() already includes space for a NULL terminator.
-  t->resize(size - 1);
-  return &(*t)[0];
-}
-
-// A stub implementation that calls a helper from above, just to get the test
-// below working. This is just for testing and should not be moved to base
-// because this ignores errors which is probably not a good idea, plus it takes
-// a string16 type which we don't really have.
-static std::string UTF16ToUTF8(const string16& utf16) {
-  return WideToUTF8(utf16);
-}
-
-TEST(UTFStringConversionsTest, ConvertMultiString) {
-  static char16 multi16[] = {
-    'f', 'o', 'o', '\0',
-    'b', 'a', 'r', '\0',
-    'b', 'a', 'z', '\0',
-    '\0'
-  };
-  static char multi[] = {
-    'f', 'o', 'o', '\0',
-    'b', 'a', 'r', '\0',
-    'b', 'a', 'z', '\0',
-    '\0'
-  };
-  string16 multistring16;
-  memcpy(WriteInto(&multistring16, arraysize(multi16)), multi16,
-                   sizeof(multi16));
-  EXPECT_EQ(arraysize(multi16) - 1, multistring16.length());
-  std::string expected;
-  memcpy(WriteInto(&expected, arraysize(multi)), multi, sizeof(multi));
-  EXPECT_EQ(arraysize(multi) - 1, expected.length());
-  const std::string& converted = UTF16ToUTF8(multistring16);
-  EXPECT_EQ(arraysize(multi) - 1, converted.length());
-  EXPECT_EQ(expected, converted);
-}
-
-// The tests below from sys_string_conversions_unittest.cc call SysWideToUTF8()
-// and SysUTF8ToWide(), so these are stub implementations that call the helpers
-// above. These are just for testing and should not be moved to base because
-// they ignore errors which is probably not a good idea.
-
-static std::string SysWideToUTF8(const std::wstring& utf16) {
-  return WideToUTF8(utf16);
-}
-
-static std::wstring SysUTF8ToWide(const std::string& utf8) {
-  return UTF8ToWide(utf8);
-}
-
-// Below is adapted from https://chromium.googlesource.com/chromium/src/+/master/base/strings/sys_string_conversions_unittest.cc
-
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifdef WCHAR_T_IS_UTF32
-static const std::wstring kSysWideOldItalicLetterA = L"\x10300";
-#else
-static const std::wstring kSysWideOldItalicLetterA = L"\xd800\xdf00";
-#endif
-
-TEST(SysStrings, SysWideToUTF8) {
-  EXPECT_EQ("Hello, world", SysWideToUTF8(L"Hello, world"));
-  EXPECT_EQ("\xe4\xbd\xa0\xe5\xa5\xbd", SysWideToUTF8(L"\x4f60\x597d"));
-
-  // >16 bits
-  EXPECT_EQ("\xF0\x90\x8C\x80", SysWideToUTF8(kSysWideOldItalicLetterA));
-
-  // Error case. When Windows finds a UTF-16 character going off the end of
-  // a string, it just converts that literal value to UTF-8, even though this
-  // is invalid.
-  //
-  // This is what XP does, but Vista has different behavior, so we don't bother
-  // verifying it:
-  // EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw",
-  //           SysWideToUTF8(L"\x4f60\xd800zyxw"));
-
-  // Test embedded NULLs.
-  std::wstring wide_null(L"a");
-  wide_null.push_back(0);
-  wide_null.push_back('b');
-
-  std::string expected_null("a");
-  expected_null.push_back(0);
-  expected_null.push_back('b');
-
-  EXPECT_EQ(expected_null, SysWideToUTF8(wide_null));
-}
-
-TEST(SysStrings, SysUTF8ToWide) {
-  EXPECT_EQ(L"Hello, world", SysUTF8ToWide("Hello, world"));
-  EXPECT_EQ(L"\x4f60\x597d", SysUTF8ToWide("\xe4\xbd\xa0\xe5\xa5\xbd"));
-  // >16 bits
-  EXPECT_EQ(kSysWideOldItalicLetterA, SysUTF8ToWide("\xF0\x90\x8C\x80"));
-
-  // Error case. When Windows finds an invalid UTF-8 character, it just skips
-  // it. This seems weird because it's inconsistent with the reverse conversion.
-  //
-  // This is what XP does, but Vista has different behavior, so we don't bother
-  // verifying it:
-  // EXPECT_EQ(L"\x4f60zyxw", SysUTF8ToWide("\xe4\xbd\xa0\xe5\xa5zyxw"));
-
-  // Test embedded NULLs.
-  std::string utf8_null("a");
-  utf8_null.push_back(0);
-  utf8_null.push_back('b');
-
-  std::wstring expected_null(L"a");
-  expected_null.push_back(0);
-  expected_null.push_back('b');
-
-  EXPECT_EQ(expected_null, SysUTF8ToWide(utf8_null));
-}
-
-TEST(UTF8PathToWindowsLongPathTest, DontAddPrefixIfShorterThanMaxPath) {
-  std::string utf8 = "c:\\mypath\\myfile.txt";
-
-  std::wstring wide;
-  EXPECT_TRUE(UTF8PathToWindowsLongPath(utf8.c_str(), &wide));
-
-  EXPECT_EQ(std::string::npos, wide.find(LR"(\\?\)"));
-}
-
-TEST(UTF8PathToWindowsLongPathTest, AddPrefixIfLongerThanMaxPath) {
-  std::string utf8 = "c:\\mypath";
-  while (utf8.length() < 300 /* MAX_PATH is 260 */) {
-    utf8 += "\\mypathsegment";
-  }
-
-  std::wstring wide;
-  EXPECT_TRUE(UTF8PathToWindowsLongPath(utf8.c_str(), &wide));
-
-  EXPECT_EQ(0U, wide.find(LR"(\\?\)"));
-  EXPECT_EQ(std::string::npos, wide.find(L"/"));
-}
-
-TEST(UTF8PathToWindowsLongPathTest, AddPrefixAndFixSeparatorsIfLongerThanMaxPath) {
-  std::string utf8 = "c:/mypath";
-  while (utf8.length() < 300 /* MAX_PATH is 260 */) {
-    utf8 += "/mypathsegment";
-  }
-
-  std::wstring wide;
-  EXPECT_TRUE(UTF8PathToWindowsLongPath(utf8.c_str(), &wide));
-
-  EXPECT_EQ(0U, wide.find(LR"(\\?\)"));
-  EXPECT_EQ(std::string::npos, wide.find(L"/"));
-}
-
-namespace utf8 {
-
-TEST(Utf8FilesTest, CanCreateOpenAndDeleteFileWithLongPath) {
-  TemporaryDir td;
-
-  // Create long directory path
-  std::string utf8 = td.path;
-  while (utf8.length() < 300 /* MAX_PATH is 260 */) {
-    utf8 += "\\mypathsegment";
-    EXPECT_EQ(0, mkdir(utf8.c_str(), 0));
-  }
-
-  // Create file
-  utf8 += "\\test-file.bin";
-  int flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
-  int mode = 0666;
-  android::base::unique_fd fd(open(utf8.c_str(), flags, mode));
-  EXPECT_NE(-1, fd.get());
-
-  // Close file
-  fd.reset();
-  EXPECT_EQ(-1, fd.get());
-
-  // Open file with fopen
-  FILE* file = fopen(utf8.c_str(), "rb");
-  EXPECT_NE(nullptr, file);
-
-  if (file) {
-    fclose(file);
-  }
-
-  // Delete file
-  EXPECT_EQ(0, unlink(utf8.c_str()));
-}
-
-}  // namespace utf8
-}  // namespace base
-}  // namespace android
diff --git a/bootstat/OWNERS b/bootstat/OWNERS
index 50b2097..f66b309 100644
--- a/bootstat/OWNERS
+++ b/bootstat/OWNERS
@@ -1,2 +1,2 @@
 jhawkins@google.com
-salyzyn@google.com
+dvander@google.com
diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh
index 2f2919f..7cff7dc 100755
--- a/bootstat/boot_reason_test.sh
+++ b/bootstat/boot_reason_test.sh
@@ -1331,7 +1331,7 @@
     shift
   fi
 
-  # Check if all conditions for the script are sane
+  # Check if all conditions for the script are valid
 
   if [ -z "${ANDROID_SERIAL}" ]; then
     ndev=`(
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 5d6cee4..8979e9a 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -436,6 +436,8 @@
     {"reboot,userspace_failed,watchdog_fork", 188},
     {"reboot,userspace_failed,*", 189},
     {"reboot,mount_userdata_failed", 190},
+    {"reboot,forcedsilent", 191},
+    {"reboot,forcednonsilent", 192},
 };
 
 // Converts a string value representing the reason the system booted to an
diff --git a/cli-test/cli-test.cpp b/cli-test/cli-test.cpp
index d6e27ee..d1ef1b4 100644
--- a/cli-test/cli-test.cpp
+++ b/cli-test/cli-test.cpp
@@ -146,6 +146,13 @@
       test->befores.push_back(line);
     } else if (Match(&line, "after:")) {
       test->afters.push_back(line);
+    } else if (Match(&line, "expected-exit-status:")) {
+      char* end_p;
+      errno = 0;
+      test->exit_status = strtol(line.c_str(), &end_p, 10);
+      if (errno != 0 || *end_p != '\0') {
+        Die(0, "%s:%zu: bad exit status: \"%s\"", g_file, g_line, line.c_str());
+      }
     } else if (Match(&line, "expected-stdout:")) {
       // Collect tab-indented lines.
       std::string text;
@@ -231,15 +238,15 @@
       V("running command \"%s\"", test.command.c_str());
       CapturedStdout test_stdout;
       CapturedStderr test_stderr;
-      int exit_status = system(test.command.c_str());
+      int status = system(test.command.c_str());
       test_stdout.Stop();
       test_stderr.Stop();
 
-      V("exit status %d", exit_status);
-      if (exit_status != test.exit_status) {
+      V("system() returned status %d", status);
+      if (WEXITSTATUS(status) != test.exit_status) {
         failed = true;
         fprintf(stderr, "Incorrect exit status: expected %d but %s\n", test.exit_status,
-                ExitStatusToString(exit_status).c_str());
+                ExitStatusToString(status).c_str());
       }
 
       if (!CheckOutput("stdout", test_stdout.str(), test.expected_stdout, FILES)) failed = true;
diff --git a/code_coverage/seccomp_policy/code_coverage.arm.policy b/code_coverage/seccomp_policy/code_coverage.arm.policy
index b80910f..3589379 100644
--- a/code_coverage/seccomp_policy/code_coverage.arm.policy
+++ b/code_coverage/seccomp_policy/code_coverage.arm.policy
@@ -1,4 +1,5 @@
 close: 1
+fchmod: 1
 mkdirat: 1
 msync: 1
 munmap: 1
diff --git a/code_coverage/seccomp_policy/code_coverage.arm64.policy b/code_coverage/seccomp_policy/code_coverage.arm64.policy
index 7040ea2..fdb4d1e 100644
--- a/code_coverage/seccomp_policy/code_coverage.arm64.policy
+++ b/code_coverage/seccomp_policy/code_coverage.arm64.policy
@@ -1,4 +1,5 @@
 close: 1
+fchmod: 1
 mkdirat: 1
 msync: 1
 munmap: 1
diff --git a/code_coverage/seccomp_policy/code_coverage.policy.def b/code_coverage/seccomp_policy/code_coverage.policy.def
index 599c4a4..b6a4c6d 100644
--- a/code_coverage/seccomp_policy/code_coverage.policy.def
+++ b/code_coverage/seccomp_policy/code_coverage.policy.def
@@ -13,6 +13,9 @@
 // 2nd-Nth: uses mmap() to update in place
 
 close: 1
+// fchmod allowed to set libprofile-clang-extras, which wraps `open` calls, to
+// set correct permission for coverage files.
+fchmod: 1
 mkdirat: 1
 msync: 1
 munmap: 1
diff --git a/code_coverage/seccomp_policy/code_coverage.x86.policy b/code_coverage/seccomp_policy/code_coverage.x86.policy
index f8e0cc0..145d3a3 100644
--- a/code_coverage/seccomp_policy/code_coverage.x86.policy
+++ b/code_coverage/seccomp_policy/code_coverage.x86.policy
@@ -1,4 +1,5 @@
 close: 1
+fchmod: 1
 mkdirat: 1
 msync: 1
 munmap: 1
diff --git a/code_coverage/seccomp_policy/code_coverage.x86_64.policy b/code_coverage/seccomp_policy/code_coverage.x86_64.policy
index dcf2f9a..11c8075 100644
--- a/code_coverage/seccomp_policy/code_coverage.x86_64.policy
+++ b/code_coverage/seccomp_policy/code_coverage.x86_64.policy
@@ -1,4 +1,5 @@
 close: 1
+fchmod: 1
 mkdirat: 1
 msync: 1
 munmap: 1
diff --git a/cpio/mkbootfs.c b/cpio/mkbootfs.c
index e52762e..58153f3 100644
--- a/cpio/mkbootfs.c
+++ b/cpio/mkbootfs.c
@@ -13,6 +13,7 @@
 #include <fcntl.h>
 
 #include <private/android_filesystem_config.h>
+#include <private/fs_config.h>
 
 /* NOTES
 **
diff --git a/debuggerd/Android.bp b/debuggerd/Android.bp
index c7bd1a8..53f85bf 100644
--- a/debuggerd/Android.bp
+++ b/debuggerd/Android.bp
@@ -17,6 +17,7 @@
     name: "libdebuggerd_common_headers",
     export_include_dirs: ["common/include"],
     recovery_available: true,
+    vendor_ramdisk_available: true,
 }
 
 cc_library_shared {
@@ -47,6 +48,7 @@
     name: "libtombstoned_client_static",
     defaults: ["debuggerd_defaults"],
     recovery_available: true,
+    vendor_ramdisk_available: true,
     srcs: [
         "tombstoned/tombstoned_client.cpp",
         "util.cpp",
@@ -69,6 +71,7 @@
     name: "libdebuggerd_handler_core",
     defaults: ["debuggerd_defaults"],
     recovery_available: true,
+    vendor_ramdisk_available: true,
     srcs: ["handler/debuggerd_handler.cpp"],
 
     header_libs: [
@@ -113,6 +116,7 @@
     ],
     defaults: ["debuggerd_defaults"],
     recovery_available: true,
+    vendor_ramdisk_available: true,
     srcs: [
         "handler/debuggerd_fallback.cpp",
     ],
@@ -164,20 +168,29 @@
     name: "libdebuggerd",
     defaults: ["debuggerd_defaults"],
     recovery_available: true,
+    vendor_ramdisk_available: true,
 
     srcs: [
         "libdebuggerd/backtrace.cpp",
         "libdebuggerd/gwp_asan.cpp",
         "libdebuggerd/open_files_list.cpp",
+        "libdebuggerd/scudo.cpp",
         "libdebuggerd/tombstone.cpp",
+        "libdebuggerd/tombstone_proto.cpp",
+        "libdebuggerd/tombstone_proto_to_text.cpp",
         "libdebuggerd/utility.cpp",
     ],
 
     local_include_dirs: ["libdebuggerd/include"],
     export_include_dirs: ["libdebuggerd/include"],
 
-    // Needed for private/bionic_fdsan.h
-    include_dirs: ["bionic/libc"],
+    include_dirs: [
+        // Needed for private/bionic_fdsan.h
+        "bionic/libc",
+
+        // Needed for scudo/interface.h
+        "external/scudo/standalone/include",
+    ],
     header_libs: [
         "bionic_libc_platform_headers",
         "gwp_asan_headers",
@@ -192,7 +205,13 @@
         "liblog",
     ],
 
-    whole_static_libs: ["gwp_asan_crash_handler"],
+    whole_static_libs: [
+        "libasync_safe",
+        "gwp_asan_crash_handler",
+        "libscudo",
+        "libtombstone_proto",
+        "libprotobuf-cpp-lite",
+    ],
 
     target: {
         recovery: {
@@ -200,6 +219,11 @@
                 "libdexfile_support",
             ],
         },
+        vendor_ramdisk: {
+            exclude_static_libs: [
+                "libdexfile_support",
+            ],
+        },
     },
 
     product_variables: {
@@ -209,6 +233,20 @@
     },
 }
 
+cc_binary {
+    name: "pbtombstone",
+    defaults: ["debuggerd_defaults"],
+    srcs: ["pbtombstone.cpp"],
+    static_libs: [
+        "libbase",
+        "libdebuggerd",
+        "liblog",
+        "libprotobuf-cpp-lite",
+        "libtombstone_proto",
+        "libunwindstack",
+    ],
+}
+
 cc_test {
     name: "debuggerd_test",
     defaults: ["debuggerd_defaults"],
@@ -241,7 +279,6 @@
         "libcutils",
         "libdebuggerd_client",
         "liblog",
-        "libminijail",
         "libnativehelper",
         "libunwindstack",
     ],
@@ -249,6 +286,7 @@
     static_libs: [
         "libdebuggerd",
         "libgmock",
+        "libminijail",
     ],
 
     header_libs: [
@@ -256,6 +294,10 @@
         "gwp_asan_headers",
     ],
 
+    include_dirs: [
+        "external/scudo/standalone/include",
+    ],
+
     local_include_dirs: [
         "libdebuggerd",
     ],
@@ -309,6 +351,9 @@
         "libtombstoned_client_static",
         "libdebuggerd",
         "libcutils",
+
+        "libtombstone_proto",
+        "libprotobuf-cpp-lite",
     ],
 
     shared_libs: [
@@ -317,6 +362,10 @@
         "libprocinfo",
         "libunwindstack",
     ],
+
+    apex_available: [
+        "com.android.runtime",
+    ],
 }
 
 cc_binary {
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp
index 5c02738..6bfb5f2 100644
--- a/debuggerd/client/debuggerd_client.cpp
+++ b/debuggerd/client/debuggerd_client.cpp
@@ -70,36 +70,6 @@
   tv->tv_usec = static_cast<long>(microseconds.count());
 }
 
-static void get_wchan_header(pid_t pid, std::stringstream& buffer) {
-  struct tm now;
-  time_t t = time(nullptr);
-  localtime_r(&t, &now);
-  char timestamp[32];
-  strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", &now);
-  std::string time_now(timestamp);
-
-  std::string path = "/proc/" + std::to_string(pid) + "/cmdline";
-
-  char proc_name_buf[1024];
-  const char* proc_name = nullptr;
-  std::unique_ptr<FILE, decltype(&fclose)> fp(fopen(path.c_str(), "r"), &fclose);
-
-  if (fp) {
-    proc_name = fgets(proc_name_buf, sizeof(proc_name_buf), fp.get());
-  }
-
-  if (!proc_name) {
-    proc_name = "<unknown>";
-  }
-
-  buffer << "\n----- Waiting Channels: pid " << pid << " at " << time_now << " -----\n"
-         << "Cmd line: " << proc_name << "\n";
-}
-
-static void get_wchan_footer(pid_t pid, std::stringstream& buffer) {
-  buffer << "----- end " << std::to_string(pid) << " -----\n";
-}
-
 /**
  * Returns the wchan data for each thread in the process,
  * or empty string if unable to obtain any data.
@@ -125,9 +95,10 @@
   }
 
   if (std::string str = data.str(); !str.empty()) {
-    get_wchan_header(pid, buffer);
+    buffer << "\n----- Waiting Channels: pid " << pid << " at " << get_timestamp() << " -----\n"
+           << "Cmd line: " << get_process_name(pid) << "\n";
     buffer << "\n" << str << "\n";
-    get_wchan_footer(pid, buffer);
+    buffer << "----- end " << std::to_string(pid) << " -----\n";
     buffer << "\n";
   }
 
diff --git a/debuggerd/common/include/dump_type.h b/debuggerd/common/include/dump_type.h
index 203269e..a3e171b 100644
--- a/debuggerd/common/include/dump_type.h
+++ b/debuggerd/common/include/dump_type.h
@@ -24,7 +24,8 @@
   kDebuggerdNativeBacktrace,
   kDebuggerdTombstone,
   kDebuggerdJavaBacktrace,
-  kDebuggerdAnyIntercept
+  kDebuggerdAnyIntercept,
+  kDebuggerdTombstoneProto,
 };
 
 inline std::ostream& operator<<(std::ostream& stream, const DebuggerdDumpType& rhs) {
@@ -41,6 +42,9 @@
     case kDebuggerdAnyIntercept:
       stream << "kDebuggerdAnyIntercept";
       break;
+    case kDebuggerdTombstoneProto:
+      stream << "kDebuggerdTombstoneProto";
+      break;
     default:
       stream << "[unknown]";
   }
diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp
index 3e99880..68a43cf 100644
--- a/debuggerd/crash_dump.cpp
+++ b/debuggerd/crash_dump.cpp
@@ -40,6 +40,7 @@
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
+#include <bionic/macros.h>
 #include <bionic/reserved_signals.h>
 #include <cutils/sockets.h>
 #include <log/log.h>
@@ -152,14 +153,14 @@
   }
 
   struct timeval tv = {
-    .tv_sec = 1,
-    .tv_usec = 0,
+      .tv_sec = 1 * android::base::TimeoutMultiplier(),
+      .tv_usec = 0,
   };
   if (setsockopt(amfd.get(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) {
     PLOG(ERROR) << "failed to set send timeout on activity manager socket";
     return false;
   }
-  tv.tv_sec = 3;  // 3 seconds on handshake read
+  tv.tv_sec = 3 * android::base::TimeoutMultiplier();  // 3 seconds on handshake read
   if (setsockopt(amfd.get(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) {
     PLOG(ERROR) << "failed to set receive timeout on activity manager socket";
     return false;
@@ -194,6 +195,7 @@
 static bool g_tombstoned_connected = false;
 static unique_fd g_tombstoned_socket;
 static unique_fd g_output_fd;
+static unique_fd g_proto_fd;
 
 static void DefuseSignalHandlers() {
   // Don't try to dump ourselves.
@@ -214,7 +216,7 @@
     // If we abort before we get an output fd, contact tombstoned to let any
     // potential listeners know that we failed.
     if (!g_tombstoned_connected) {
-      if (!tombstoned_connect(g_target_thread, &g_tombstoned_socket, &g_output_fd,
+      if (!tombstoned_connect(g_target_thread, &g_tombstoned_socket, &g_output_fd, &g_proto_fd,
                               kDebuggerdAnyIntercept)) {
         // We failed to connect, not much we can do.
         LOG(ERROR) << "failed to connected to tombstoned to report failure";
@@ -247,16 +249,24 @@
   }
 
   int dump_type_int;
-  if (!android::base::ParseInt(argv[3], &dump_type_int, 0, 1)) {
+  if (!android::base::ParseInt(argv[3], &dump_type_int, 0)) {
     LOG(FATAL) << "invalid requested dump type: " << argv[3];
   }
+
   *dump_type = static_cast<DebuggerdDumpType>(dump_type_int);
+  switch (*dump_type) {
+    case kDebuggerdNativeBacktrace:
+    case kDebuggerdTombstone:
+    case kDebuggerdTombstoneProto:
+      break;
+
+    default:
+      LOG(FATAL) << "invalid requested dump type: " << dump_type_int;
+  }
 }
 
 static void ReadCrashInfo(unique_fd& fd, siginfo_t* siginfo,
-                          std::unique_ptr<unwindstack::Regs>* regs, uintptr_t* abort_msg_address,
-                          uintptr_t* fdsan_table_address, uintptr_t* gwp_asan_state,
-                          uintptr_t* gwp_asan_metadata) {
+                          std::unique_ptr<unwindstack::Regs>* regs, ProcessInfo* process_info) {
   std::aligned_storage<sizeof(CrashInfo) + 1, alignof(CrashInfo)>::type buf;
   CrashInfo* crash_info = reinterpret_cast<CrashInfo*>(&buf);
   ssize_t rc = TEMP_FAILURE_RETRY(read(fd.get(), &buf, sizeof(buf)));
@@ -266,15 +276,13 @@
     ssize_t expected_size = 0;
     switch (crash_info->header.version) {
       case 1:
-        expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataV1);
-        break;
-
       case 2:
-        expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataV2);
+      case 3:
+        expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataStatic);
         break;
 
-      case 3:
-        expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataV3);
+      case 4:
+        expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataDynamic);
         break;
 
       default:
@@ -282,28 +290,33 @@
         break;
     };
 
-    if (rc != expected_size) {
+    if (rc < expected_size) {
       LOG(FATAL) << "read " << rc << " bytes when reading target crash information, expected "
                  << expected_size;
     }
   }
 
-  *fdsan_table_address = 0;
-  *gwp_asan_state = 0;
-  *gwp_asan_metadata = 0;
   switch (crash_info->header.version) {
-    case 3:
-      *gwp_asan_state = crash_info->data.v3.gwp_asan_state;
-      *gwp_asan_metadata = crash_info->data.v3.gwp_asan_metadata;
-      FALLTHROUGH_INTENDED;
-    case 2:
-      *fdsan_table_address = crash_info->data.v2.fdsan_table_address;
+    case 4:
+      process_info->fdsan_table_address = crash_info->data.d.fdsan_table_address;
+      process_info->gwp_asan_state = crash_info->data.d.gwp_asan_state;
+      process_info->gwp_asan_metadata = crash_info->data.d.gwp_asan_metadata;
+      process_info->scudo_stack_depot = crash_info->data.d.scudo_stack_depot;
+      process_info->scudo_region_info = crash_info->data.d.scudo_region_info;
       FALLTHROUGH_INTENDED;
     case 1:
-      *abort_msg_address = crash_info->data.v1.abort_msg_address;
-      *siginfo = crash_info->data.v1.siginfo;
+    case 2:
+    case 3:
+      process_info->abort_msg_address = crash_info->data.s.abort_msg_address;
+      *siginfo = crash_info->data.s.siginfo;
+      if (signal_has_si_addr(siginfo)) {
+        process_info->has_fault_address = true;
+        process_info->maybe_tagged_fault_address = reinterpret_cast<uintptr_t>(siginfo->si_addr);
+        process_info->untagged_fault_address =
+            untag_address(reinterpret_cast<uintptr_t>(siginfo->si_addr));
+      }
       regs->reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(),
-                                                        &crash_info->data.v1.ucontext));
+                                                        &crash_info->data.s.ucontext));
       break;
 
     default:
@@ -425,10 +438,7 @@
   ATRACE_NAME("after reparent");
   pid_t pseudothread_tid;
   DebuggerdDumpType dump_type;
-  uintptr_t abort_msg_address = 0;
-  uintptr_t fdsan_table_address = 0;
-  uintptr_t gwp_asan_state = 0;
-  uintptr_t gwp_asan_metadata = 0;
+  ProcessInfo process_info;
 
   Initialize(argv);
   ParseArgs(argc, argv, &pseudothread_tid, &dump_type);
@@ -437,7 +447,7 @@
   //
   // Note: processes with many threads and minidebug-info can take a bit to
   //       unwind, do not make this too small. b/62828735
-  alarm(30);
+  alarm(30 * android::base::TimeoutMultiplier());
 
   // Get the process name (aka cmdline).
   std::string process_name = get_process_name(g_target_thread);
@@ -481,16 +491,29 @@
       info.process_name = process_name;
       info.thread_name = get_thread_name(thread);
 
+      unique_fd attr_fd(openat(target_proc_fd, "attr/current", O_RDONLY | O_CLOEXEC));
+      if (!android::base::ReadFdToString(attr_fd, &info.selinux_label)) {
+        PLOG(WARNING) << "failed to read selinux label";
+      }
+
       if (!ptrace_interrupt(thread, &info.signo)) {
         PLOG(WARNING) << "failed to ptrace interrupt thread " << thread;
         ptrace(PTRACE_DETACH, thread, 0, 0);
         continue;
       }
 
+      struct iovec iov = {
+          &info.tagged_addr_ctrl,
+          sizeof(info.tagged_addr_ctrl),
+      };
+      if (ptrace(PTRACE_GETREGSET, thread, NT_ARM_TAGGED_ADDR_CTRL,
+                 reinterpret_cast<void*>(&iov)) == -1) {
+        info.tagged_addr_ctrl = -1;
+      }
+
       if (thread == g_target_thread) {
         // Read the thread's registers along with the rest of the crash info out of the pipe.
-        ReadCrashInfo(input_pipe, &siginfo, &info.registers, &abort_msg_address,
-                      &fdsan_table_address, &gwp_asan_state, &gwp_asan_metadata);
+        ReadCrashInfo(input_pipe, &siginfo, &info.registers, &process_info);
         info.siginfo = &siginfo;
         info.signo = info.siginfo->si_signo;
       } else {
@@ -551,8 +574,8 @@
   {
     ATRACE_NAME("tombstoned_connect");
     LOG(INFO) << "obtaining output fd from tombstoned, type: " << dump_type;
-    g_tombstoned_connected =
-        tombstoned_connect(g_target_thread, &g_tombstoned_socket, &g_output_fd, dump_type);
+    g_tombstoned_connected = tombstoned_connect(g_target_thread, &g_tombstoned_socket, &g_output_fd,
+                                                &g_proto_fd, dump_type);
   }
 
   if (g_tombstoned_connected) {
@@ -587,8 +610,8 @@
   }
 
   // TODO: Use seccomp to lock ourselves down.
-  unwindstack::UnwinderFromPid unwinder(256, vm_pid);
-  if (!unwinder.Init(unwindstack::Regs::CurrentArch())) {
+  unwindstack::UnwinderFromPid unwinder(256, vm_pid, unwindstack::Regs::CurrentArch());
+  if (!unwinder.Init()) {
     LOG(FATAL) << "Failed to init unwinder object.";
   }
 
@@ -599,14 +622,14 @@
   } else {
     {
       ATRACE_NAME("fdsan table dump");
-      populate_fdsan_table(&open_files, unwinder.GetProcessMemory(), fdsan_table_address);
+      populate_fdsan_table(&open_files, unwinder.GetProcessMemory(),
+                           process_info.fdsan_table_address);
     }
 
     {
       ATRACE_NAME("engrave_tombstone");
-      engrave_tombstone(std::move(g_output_fd), &unwinder, thread_info, g_target_thread,
-                        abort_msg_address, &open_files, &amfd_data, gwp_asan_state,
-                        gwp_asan_metadata);
+      engrave_tombstone(std::move(g_output_fd), std::move(g_proto_fd), &unwinder, thread_info,
+                        g_target_thread, process_info, &open_files, &amfd_data);
     }
   }
 
diff --git a/debuggerd/crasher/Android.bp b/debuggerd/crasher/Android.bp
index e86f499..61c5395 100644
--- a/debuggerd/crasher/Android.bp
+++ b/debuggerd/crasher/Android.bp
@@ -24,12 +24,6 @@
         arm64: {
             srcs: ["arm64/crashglue.S"],
         },
-        mips: {
-            srcs: ["mips/crashglue.S"],
-        },
-        mips64: {
-            srcs: ["mips64/crashglue.S"],
-        },
         x86: {
             srcs: ["x86/crashglue.S"],
         },
diff --git a/debuggerd/crasher/crasher.cpp b/debuggerd/crasher/crasher.cpp
index 3041664..a2b13a3 100644
--- a/debuggerd/crasher/crasher.cpp
+++ b/debuggerd/crasher/crasher.cpp
@@ -349,7 +349,7 @@
 int main(int argc, char** argv) {
 #if defined(STATIC_CRASHER)
     debuggerd_callbacks_t callbacks = {
-      .get_abort_message = []() {
+      .get_process_info = []() {
         static struct {
           size_t size;
           char msg[32];
@@ -357,7 +357,9 @@
 
         msg.size = strlen("dummy abort message");
         memcpy(msg.msg, "dummy abort message", strlen("dummy abort message"));
-        return reinterpret_cast<abort_msg_t*>(&msg);
+        return debugger_process_info{
+            .abort_msg = reinterpret_cast<void*>(&msg),
+        };
       },
       .post_dump = nullptr
     };
diff --git a/debuggerd/crasher/mips/crashglue.S b/debuggerd/crasher/mips/crashglue.S
deleted file mode 100644
index 70a6641..0000000
--- a/debuggerd/crasher/mips/crashglue.S
+++ /dev/null
@@ -1,48 +0,0 @@
-	.set	noat
-
-	.globl crash1
-	.globl crashnostack
-
-crash1:
-	li	$0,0xdead0000+0
-	li	$1,0xdead0000+1
-	li	$2,0xdead0000+2
-	li	$3,0xdead0000+3
-	li	$4,0xdead0000+4
-	li	$5,0xdead0000+5
-	li	$6,0xdead0000+6
-	li	$7,0xdead0000+7
-	li	$8,0xdead0000+8
-	li	$9,0xdead0000+9
-	li	$10,0xdead0000+10
-	li	$11,0xdead0000+11
-	li	$12,0xdead0000+12
-	li	$13,0xdead0000+13
-	li	$14,0xdead0000+14
-	li	$15,0xdead0000+15
-	li	$16,0xdead0000+16
-	li	$17,0xdead0000+17
-	li	$18,0xdead0000+18
-	li	$19,0xdead0000+19
-	li	$20,0xdead0000+20
-	li	$21,0xdead0000+21
-	li	$22,0xdead0000+22
-	li	$23,0xdead0000+23
-	li	$24,0xdead0000+24
-	li	$25,0xdead0000+25
-	li	$26,0xdead0000+26
-	li	$27,0xdead0000+27
-	li	$28,0xdead0000+28
-	# don't trash the stack otherwise the signal handler won't run
-	#li	$29,0xdead0000+29
-	li	$30,0xdead0000+30
-	li	$31,0xdead0000+31
-
-	lw	$zero,($0)
-	b .
-
-
-crashnostack:
-	li	$sp, 0
-	lw	$zero,($0)
-	b .
diff --git a/debuggerd/crasher/mips64/crashglue.S b/debuggerd/crasher/mips64/crashglue.S
deleted file mode 100644
index 70a6641..0000000
--- a/debuggerd/crasher/mips64/crashglue.S
+++ /dev/null
@@ -1,48 +0,0 @@
-	.set	noat
-
-	.globl crash1
-	.globl crashnostack
-
-crash1:
-	li	$0,0xdead0000+0
-	li	$1,0xdead0000+1
-	li	$2,0xdead0000+2
-	li	$3,0xdead0000+3
-	li	$4,0xdead0000+4
-	li	$5,0xdead0000+5
-	li	$6,0xdead0000+6
-	li	$7,0xdead0000+7
-	li	$8,0xdead0000+8
-	li	$9,0xdead0000+9
-	li	$10,0xdead0000+10
-	li	$11,0xdead0000+11
-	li	$12,0xdead0000+12
-	li	$13,0xdead0000+13
-	li	$14,0xdead0000+14
-	li	$15,0xdead0000+15
-	li	$16,0xdead0000+16
-	li	$17,0xdead0000+17
-	li	$18,0xdead0000+18
-	li	$19,0xdead0000+19
-	li	$20,0xdead0000+20
-	li	$21,0xdead0000+21
-	li	$22,0xdead0000+22
-	li	$23,0xdead0000+23
-	li	$24,0xdead0000+24
-	li	$25,0xdead0000+25
-	li	$26,0xdead0000+26
-	li	$27,0xdead0000+27
-	li	$28,0xdead0000+28
-	# don't trash the stack otherwise the signal handler won't run
-	#li	$29,0xdead0000+29
-	li	$30,0xdead0000+30
-	li	$31,0xdead0000+31
-
-	lw	$zero,($0)
-	b .
-
-
-crashnostack:
-	li	$sp, 0
-	lw	$zero,($0)
-	b .
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index 6a8cc56..65820bd 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -16,8 +16,10 @@
 
 #include <err.h>
 #include <fcntl.h>
+#include <malloc.h>
 #include <stdlib.h>
 #include <sys/capability.h>
+#include <sys/mman.h>
 #include <sys/prctl.h>
 #include <sys/ptrace.h>
 #include <sys/resource.h>
@@ -31,6 +33,7 @@
 
 #include <android/fdsan.h>
 #include <android/set_abort_message.h>
+#include <bionic/mte.h>
 #include <bionic/reserved_signals.h>
 
 #include <android-base/cmsg.h>
@@ -169,6 +172,8 @@
   void StartCrasher(const std::string& crash_type);
   void FinishCrasher();
   void AssertDeath(int signo);
+
+  static void Trap(void* ptr);
 };
 
 CrasherTest::CrasherTest() {
@@ -303,6 +308,295 @@
   std::string result;
   ConsumeFd(std::move(output_fd), &result);
   ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr 0xdead)");
+
+  if (mte_supported()) {
+    // Test that the default TAGGED_ADDR_CTRL value is set.
+    ASSERT_MATCH(result, R"(tagged_addr_ctrl: 000000000007fff3)");
+  }
+}
+
+TEST_F(CrasherTest, tagged_fault_addr) {
+#if !defined(__aarch64__)
+  GTEST_SKIP() << "Requires aarch64";
+#endif
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([]() {
+    *reinterpret_cast<volatile char*>(0x100000000000dead) = '1';
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  AssertDeath(SIGSEGV);
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+  // The address can either be tagged (new kernels) or untagged (old kernels).
+  ASSERT_MATCH(
+      result,
+      R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr (0x100000000000dead|0xdead))");
+}
+
+// Marked as weak to prevent the compiler from removing the malloc in the caller. In theory, the
+// compiler could still clobber the argument register before trapping, but that's unlikely.
+__attribute__((weak)) void CrasherTest::Trap(void* ptr ATTRIBUTE_UNUSED) {
+  __builtin_trap();
+}
+
+TEST_F(CrasherTest, heap_addr_in_register) {
+#if defined(__i386__)
+  GTEST_SKIP() << "architecture does not pass arguments in registers";
+#endif
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([]() {
+    // Crash with a heap pointer in the first argument register.
+    Trap(malloc(1));
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  int status;
+  ASSERT_EQ(crasher_pid, TIMEOUT(30, waitpid(crasher_pid, &status, 0)));
+  ASSERT_TRUE(WIFSIGNALED(status)) << "crasher didn't terminate via a signal";
+  // Don't test the signal number because different architectures use different signals for
+  // __builtin_trap().
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+#if defined(__aarch64__)
+  ASSERT_MATCH(result, "memory near x0");
+#elif defined(__arm__)
+  ASSERT_MATCH(result, "memory near r0");
+#elif defined(__x86_64__)
+  ASSERT_MATCH(result, "memory near rdi");
+#else
+  ASSERT_TRUE(false) << "unsupported architecture";
+#endif
+}
+
+#if defined(__aarch64__)
+static void SetTagCheckingLevelSync() {
+  if (mallopt(M_BIONIC_SET_HEAP_TAGGING_LEVEL, M_HEAP_TAGGING_LEVEL_SYNC) == 0) {
+    abort();
+  }
+}
+#endif
+
+TEST_F(CrasherTest, mte_uaf) {
+#if defined(__aarch64__)
+  if (!mte_supported()) {
+    GTEST_SKIP() << "Requires MTE";
+  }
+
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([]() {
+    SetTagCheckingLevelSync();
+    volatile int* p = (volatile int*)malloc(16);
+    free((void *)p);
+    p[0] = 42;
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  AssertDeath(SIGSEGV);
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+  ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 9 \(SEGV_MTESERR\))");
+  ASSERT_MATCH(result, R"(Cause: \[MTE\]: Use After Free, 0 bytes into a 16-byte allocation.*
+
+allocated by thread .*
+      #00 pc)");
+  ASSERT_MATCH(result, R"(deallocated by thread .*
+      #00 pc)");
+#else
+  GTEST_SKIP() << "Requires aarch64";
+#endif
+}
+
+TEST_F(CrasherTest, mte_overflow) {
+#if defined(__aarch64__)
+  if (!mte_supported()) {
+    GTEST_SKIP() << "Requires MTE";
+  }
+
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([]() {
+    SetTagCheckingLevelSync();
+    volatile int* p = (volatile int*)malloc(16);
+    p[4] = 42;
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  AssertDeath(SIGSEGV);
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+  ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\))");
+  ASSERT_MATCH(result, R"(Cause: \[MTE\]: Buffer Overflow, 0 bytes right of a 16-byte allocation.*
+
+allocated by thread .*
+      #00 pc)");
+#else
+  GTEST_SKIP() << "Requires aarch64";
+#endif
+}
+
+TEST_F(CrasherTest, mte_underflow) {
+#if defined(__aarch64__)
+  if (!mte_supported()) {
+    GTEST_SKIP() << "Requires MTE";
+  }
+
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([]() {
+    SetTagCheckingLevelSync();
+    volatile int* p = (volatile int*)malloc(16);
+    p[-1] = 42;
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  AssertDeath(SIGSEGV);
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+  ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 9 \(SEGV_MTESERR\))");
+  ASSERT_MATCH(result, R"(Cause: \[MTE\]: Buffer Underflow, 4 bytes left of a 16-byte allocation.*
+
+allocated by thread .*
+      #00 pc)");
+#else
+  GTEST_SKIP() << "Requires aarch64";
+#endif
+}
+
+TEST_F(CrasherTest, mte_multiple_causes) {
+#if defined(__aarch64__)
+  if (!mte_supported()) {
+    GTEST_SKIP() << "Requires MTE";
+  }
+
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([]() {
+    SetTagCheckingLevelSync();
+
+    // Make two allocations with the same tag and close to one another. Check for both properties
+    // with a bounds check -- this relies on the fact that only if the allocations have the same tag
+    // would they be measured as closer than 128 bytes to each other. Otherwise they would be about
+    // (some non-zero value << 56) apart.
+    //
+    // The out-of-bounds access will be considered either an overflow of one or an underflow of the
+    // other.
+    std::set<uintptr_t> allocs;
+    for (int i = 0; i != 4096; ++i) {
+      uintptr_t alloc = reinterpret_cast<uintptr_t>(malloc(16));
+      auto it = allocs.insert(alloc).first;
+      if (it != allocs.begin() && *std::prev(it) + 128 > alloc) {
+        *reinterpret_cast<int*>(*std::prev(it) + 16) = 42;
+      }
+      if (std::next(it) != allocs.end() && alloc + 128 > *std::next(it)) {
+        *reinterpret_cast<int*>(alloc + 16) = 42;
+      }
+    }
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  AssertDeath(SIGSEGV);
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+  ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\))");
+  ASSERT_MATCH(
+      result,
+      R"(Note: multiple potential causes for this crash were detected, listing them in decreasing order of probability.)");
+
+  // Adjacent untracked allocations may cause us to see the wrong underflow here (or only
+  // overflows), so we can't match explicitly for an underflow message.
+  ASSERT_MATCH(result, R"(Cause: \[MTE\]: Buffer Overflow, 0 bytes right of a 16-byte allocation)");
+#else
+  GTEST_SKIP() << "Requires aarch64";
+#endif
+}
+
+#if defined(__aarch64__)
+static uintptr_t CreateTagMapping() {
+  uintptr_t mapping =
+      reinterpret_cast<uintptr_t>(mmap(nullptr, getpagesize(), PROT_READ | PROT_WRITE | PROT_MTE,
+                                       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
+  if (reinterpret_cast<void*>(mapping) == MAP_FAILED) {
+    return 0;
+  }
+  __asm__ __volatile__(".arch_extension mte; stg %0, [%0]"
+                       :
+                       : "r"(mapping + (1ULL << 56))
+                       : "memory");
+  return mapping;
+}
+#endif
+
+TEST_F(CrasherTest, mte_tag_dump) {
+#if defined(__aarch64__)
+  if (!mte_supported()) {
+    GTEST_SKIP() << "Requires MTE";
+  }
+
+  int intercept_result;
+  unique_fd output_fd;
+  StartProcess([&]() {
+    SetTagCheckingLevelSync();
+    Trap(reinterpret_cast<void *>(CreateTagMapping()));
+  });
+
+  StartIntercept(&output_fd);
+  FinishCrasher();
+  AssertDeath(SIGTRAP);
+  FinishIntercept(&intercept_result);
+
+  ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
+
+  std::string result;
+  ConsumeFd(std::move(output_fd), &result);
+
+  ASSERT_MATCH(result, R"(memory near x0:
+.*
+.*
+    01.............0 0000000000000000 0000000000000000  ................
+    00.............0)");
+#else
+  GTEST_SKIP() << "Requires aarch64";
+#endif
 }
 
 TEST_F(CrasherTest, LD_PRELOAD) {
@@ -1015,11 +1309,11 @@
   tombstoned_intercept(self, &intercept_fd, &output_fd, &status, kDebuggerdJavaBacktrace);
   ASSERT_EQ(InterceptStatus::kRegistered, status);
 
-  // First connect to tombstoned requesting a native backtrace. This
+  // First connect to tombstoned requesting a native tombstone. This
   // should result in a "regular" FD and not the installed intercept.
   const char native[] = "native";
   unique_fd tombstoned_socket, input_fd;
-  ASSERT_TRUE(tombstoned_connect(self, &tombstoned_socket, &input_fd, kDebuggerdNativeBacktrace));
+  ASSERT_TRUE(tombstoned_connect(self, &tombstoned_socket, &input_fd, kDebuggerdTombstone));
   ASSERT_TRUE(android::base::WriteFully(input_fd.get(), native, sizeof(native)));
   tombstoned_notify_completion(tombstoned_socket.get());
 
@@ -1131,3 +1425,70 @@
   ConsumeFd(std::move(output_fd), &result);
   ASSERT_MATCH(result, R"(Cause: stack pointer[^\n]*stack overflow.\n)");
 }
+
+TEST(tombstoned, proto) {
+  const pid_t self = getpid();
+  unique_fd tombstoned_socket, text_fd, proto_fd;
+  ASSERT_TRUE(
+      tombstoned_connect(self, &tombstoned_socket, &text_fd, &proto_fd, kDebuggerdTombstoneProto));
+
+  tombstoned_notify_completion(tombstoned_socket.get());
+
+  ASSERT_NE(-1, text_fd.get());
+  ASSERT_NE(-1, proto_fd.get());
+
+  struct stat text_st;
+  ASSERT_EQ(0, fstat(text_fd.get(), &text_st));
+
+  // Give tombstoned some time to link the files into place.
+  std::this_thread::sleep_for(100ms);
+
+  // Find the tombstone.
+  std::optional<int> tombstone_index;
+  for (int i = 0; i < 50; ++i) {
+    std::string path = android::base::StringPrintf("/data/tombstones/tombstone_%02d", i);
+
+    struct stat st;
+    if (TEMP_FAILURE_RETRY(stat(path.c_str(), &st)) != 0) {
+      continue;
+    }
+
+    if (st.st_dev == text_st.st_dev && st.st_ino == text_st.st_ino) {
+      tombstone_index = i;
+      break;
+    }
+  }
+
+  ASSERT_TRUE(tombstone_index);
+  std::string proto_path =
+      android::base::StringPrintf("/data/tombstones/tombstone_%02d.pb", *tombstone_index);
+
+  struct stat proto_fd_st;
+  struct stat proto_file_st;
+  ASSERT_EQ(0, fstat(proto_fd.get(), &proto_fd_st));
+  ASSERT_EQ(0, stat(proto_path.c_str(), &proto_file_st));
+
+  ASSERT_EQ(proto_fd_st.st_dev, proto_file_st.st_dev);
+  ASSERT_EQ(proto_fd_st.st_ino, proto_file_st.st_ino);
+}
+
+TEST(tombstoned, proto_intercept) {
+  const pid_t self = getpid();
+  unique_fd intercept_fd, output_fd;
+  InterceptStatus status;
+
+  tombstoned_intercept(self, &intercept_fd, &output_fd, &status, kDebuggerdTombstone);
+  ASSERT_EQ(InterceptStatus::kRegistered, status);
+
+  unique_fd tombstoned_socket, text_fd, proto_fd;
+  ASSERT_TRUE(
+      tombstoned_connect(self, &tombstoned_socket, &text_fd, &proto_fd, kDebuggerdTombstoneProto));
+  ASSERT_TRUE(android::base::WriteStringToFd("foo", text_fd.get()));
+  tombstoned_notify_completion(tombstoned_socket.get());
+
+  text_fd.reset();
+
+  std::string output;
+  ASSERT_TRUE(android::base::ReadFdToString(output_fd, &output));
+  ASSERT_EQ("foo", output);
+}
diff --git a/debuggerd/handler/debuggerd_fallback.cpp b/debuggerd/handler/debuggerd_fallback.cpp
index 9bcbdb3..feafa73 100644
--- a/debuggerd/handler/debuggerd_fallback.cpp
+++ b/debuggerd/handler/debuggerd_fallback.cpp
@@ -82,29 +82,25 @@
     thread.pid = getpid();
     thread.tid = gettid();
     thread.thread_name = get_thread_name(gettid());
-    unwindstack::ArchEnum arch = unwindstack::Regs::CurrentArch();
-    thread.registers.reset(unwindstack::Regs::CreateFromUcontext(arch, ucontext));
+    thread.registers.reset(
+        unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), ucontext));
 
     // TODO: Create this once and store it in a global?
     unwindstack::UnwinderFromPid unwinder(kMaxFrames, getpid());
-    if (unwinder.Init(arch)) {
-      dump_backtrace_thread(output_fd, &unwinder, thread);
-    } else {
-      async_safe_format_log(ANDROID_LOG_ERROR, "libc", "Unable to init unwinder.");
-    }
+    dump_backtrace_thread(output_fd, &unwinder, thread);
   }
   __linker_disable_fallback_allocator();
 }
 
-static void debuggerd_fallback_tombstone(int output_fd, ucontext_t* ucontext, siginfo_t* siginfo,
-                                         void* abort_message) {
+static void debuggerd_fallback_tombstone(int output_fd, int proto_fd, ucontext_t* ucontext,
+                                         siginfo_t* siginfo, void* abort_message) {
   if (!__linker_enable_fallback_allocator()) {
     async_safe_format_log(ANDROID_LOG_ERROR, "libc", "fallback allocator already in use");
     return;
   }
 
-  engrave_tombstone_ucontext(output_fd, reinterpret_cast<uintptr_t>(abort_message), siginfo,
-                             ucontext);
+  engrave_tombstone_ucontext(output_fd, proto_fd, reinterpret_cast<uintptr_t>(abort_message),
+                             siginfo, ucontext);
   __linker_disable_fallback_allocator();
 }
 
@@ -236,7 +232,10 @@
 
   // Fetch output fd from tombstoned.
   unique_fd tombstone_socket, output_fd;
-  if (!tombstoned_connect(getpid(), &tombstone_socket, &output_fd, kDebuggerdNativeBacktrace)) {
+  if (!tombstoned_connect(getpid(), &tombstone_socket, &output_fd, nullptr,
+                          kDebuggerdNativeBacktrace)) {
+    async_safe_format_log(ANDROID_LOG_ERROR, "libc",
+                          "missing crash_dump_fallback() in selinux policy?");
     goto exit;
   }
 
@@ -327,10 +326,10 @@
     _exit(1);
   }
 
-  unique_fd tombstone_socket, output_fd;
-  bool tombstoned_connected =
-      tombstoned_connect(getpid(), &tombstone_socket, &output_fd, kDebuggerdTombstone);
-  debuggerd_fallback_tombstone(output_fd.get(), ucontext, info, abort_message);
+  unique_fd tombstone_socket, output_fd, proto_fd;
+  bool tombstoned_connected = tombstoned_connect(getpid(), &tombstone_socket, &output_fd, &proto_fd,
+                                                 kDebuggerdTombstoneProto);
+  debuggerd_fallback_tombstone(output_fd.get(), proto_fd.get(), ucontext, info, abort_message);
   if (tombstoned_connected) {
     tombstoned_notify_completion(tombstone_socket.get());
   }
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 8b4b630..ca809e4 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -53,7 +53,6 @@
 #include <android-base/unique_fd.h>
 #include <async_safe/log.h>
 #include <bionic/reserved_signals.h>
-#include <cutils/properties.h>
 
 #include <libdebuggerd/utility.h>
 
@@ -83,7 +82,7 @@
 #define CRASH_DUMP_NAME "crash_dump32"
 #endif
 
-#define CRASH_DUMP_PATH "/system/bin/" CRASH_DUMP_NAME
+#define CRASH_DUMP_PATH "/apex/com.android.runtime/bin/" CRASH_DUMP_NAME
 
 // Wrappers that directly invoke the respective syscalls, in case the cached values are invalid.
 #pragma GCC poison getpid gettid
@@ -297,10 +296,7 @@
   pid_t pseudothread_tid;
   siginfo_t* siginfo;
   void* ucontext;
-  uintptr_t abort_msg;
-  uintptr_t fdsan_table;
-  uintptr_t gwp_asan_state;
-  uintptr_t gwp_asan_metadata;
+  debugger_process_info process_info;
 };
 
 // Logging and contacting debuggerd requires free file descriptors, which we might not have.
@@ -316,7 +312,7 @@
     return kDebuggerdNativeBacktrace;
   }
 
-  return kDebuggerdTombstone;
+  return kDebuggerdTombstoneProto;
 }
 
 static int debuggerd_dispatch_pseudothread(void* arg) {
@@ -344,25 +340,36 @@
     fatal_errno("failed to create pipe");
   }
 
-  // ucontext_t is absurdly large on AArch64, so piece it together manually with writev.
-  uint32_t version = 3;
-  constexpr size_t expected = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataV3);
+  uint32_t version;
+  ssize_t expected;
 
+  // ucontext_t is absurdly large on AArch64, so piece it together manually with writev.
+  struct iovec iovs[4] = {
+      {.iov_base = &version, .iov_len = sizeof(version)},
+      {.iov_base = thread_info->siginfo, .iov_len = sizeof(siginfo_t)},
+      {.iov_base = thread_info->ucontext, .iov_len = sizeof(ucontext_t)},
+  };
+
+  if (thread_info->process_info.fdsan_table) {
+    // Dynamic executables always use version 4. There is no need to increment the version number if
+    // the format changes, because the sender (linker) and receiver (crash_dump) are version locked.
+    version = 4;
+    expected = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataDynamic);
+
+    iovs[3] = {.iov_base = &thread_info->process_info,
+               .iov_len = sizeof(thread_info->process_info)};
+  } else {
+    // Static executables always use version 1.
+    version = 1;
+    expected = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataStatic);
+
+    iovs[3] = {.iov_base = &thread_info->process_info.abort_msg, .iov_len = sizeof(uintptr_t)};
+  }
   errno = 0;
   if (fcntl(output_write.get(), F_SETPIPE_SZ, expected) < static_cast<int>(expected)) {
     fatal_errno("failed to set pipe buffer size");
   }
 
-  struct iovec iovs[] = {
-      {.iov_base = &version, .iov_len = sizeof(version)},
-      {.iov_base = thread_info->siginfo, .iov_len = sizeof(siginfo_t)},
-      {.iov_base = thread_info->ucontext, .iov_len = sizeof(ucontext_t)},
-      {.iov_base = &thread_info->abort_msg, .iov_len = sizeof(uintptr_t)},
-      {.iov_base = &thread_info->fdsan_table, .iov_len = sizeof(uintptr_t)},
-      {.iov_base = &thread_info->gwp_asan_state, .iov_len = sizeof(uintptr_t)},
-      {.iov_base = &thread_info->gwp_asan_metadata, .iov_len = sizeof(uintptr_t)},
-  };
-
   ssize_t rc = TEMP_FAILURE_RETRY(writev(output_write.get(), iovs, arraysize(iovs)));
   if (rc == -1) {
     fatal_errno("failed to write crash info");
@@ -408,23 +415,28 @@
   // us to fork off a process to read memory from.
   char buf[4];
   rc = TEMP_FAILURE_RETRY(read(input_read.get(), &buf, sizeof(buf)));
-  if (rc == -1) {
-    async_safe_format_log(ANDROID_LOG_FATAL, "libc", "read of IPC pipe failed: %s", strerror(errno));
-    return 1;
-  } else if (rc == 0) {
-    async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper failed to exec");
-    return 1;
-  } else if (rc != 1) {
-    async_safe_format_log(ANDROID_LOG_FATAL, "libc",
-                          "read of IPC pipe returned unexpected value: %zd", rc);
-    return 1;
-  } else if (buf[0] != '\1') {
-    async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper reported failure");
-    return 1;
-  }
 
-  // crash_dump is ptracing us, fork off a copy of our address space for it to use.
-  create_vm_process();
+  bool success = false;
+  if (rc == 1 && buf[0] == '\1') {
+    // crash_dump successfully started, and is ptracing us.
+    // Fork off a copy of our address space for it to use.
+    create_vm_process();
+    success = true;
+  } else {
+    // Something went wrong, log it.
+    if (rc == -1) {
+      async_safe_format_log(ANDROID_LOG_FATAL, "libc", "read of IPC pipe failed: %s",
+                            strerror(errno));
+    } else if (rc == 0) {
+      async_safe_format_log(ANDROID_LOG_FATAL, "libc",
+                            "crash_dump helper failed to exec, or was killed");
+    } else if (rc != 1) {
+      async_safe_format_log(ANDROID_LOG_FATAL, "libc",
+                            "read of IPC pipe returned unexpected value: %zd", rc);
+    } else if (buf[0] != '\1') {
+      async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper reported failure");
+    }
+  }
 
   // Don't leave a zombie child.
   int status;
@@ -435,14 +447,16 @@
     async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped");
   }
 
-  if (thread_info->siginfo->si_signo != BIONIC_SIGNAL_DEBUGGER) {
-    // For crashes, we don't need to minimize pause latency.
-    // Wait for the dump to complete before having the process exit, to avoid being murdered by
-    // ActivityManager or init.
-    TEMP_FAILURE_RETRY(read(input_read, &buf, sizeof(buf)));
+  if (success) {
+    if (thread_info->siginfo->si_signo != BIONIC_SIGNAL_DEBUGGER) {
+      // For crashes, we don't need to minimize pause latency.
+      // Wait for the dump to complete before having the process exit, to avoid being murdered by
+      // ActivityManager or init.
+      TEMP_FAILURE_RETRY(read(input_read, &buf, sizeof(buf)));
+    }
   }
 
-  return 0;
+  return success ? 0 : 1;
 }
 
 static void resend_signal(siginfo_t* info) {
@@ -468,6 +482,8 @@
   // making a syscall and checking errno.
   ErrnoRestorer restorer;
 
+  auto *ucontext = static_cast<ucontext_t*>(context);
+
   // It's possible somebody cleared the SA_SIGINFO flag, which would mean
   // our "info" arg holds an undefined value.
   if (!have_siginfo(signal_number)) {
@@ -489,29 +505,19 @@
     // check to allow all si_code values in calls coming from inside the house.
   }
 
-  void* abort_message = nullptr;
-  const gwp_asan::AllocatorState* gwp_asan_state = nullptr;
-  const gwp_asan::AllocationMetadata* gwp_asan_metadata = nullptr;
+  debugger_process_info process_info = {};
   uintptr_t si_val = reinterpret_cast<uintptr_t>(info->si_ptr);
   if (signal_number == BIONIC_SIGNAL_DEBUGGER) {
     if (info->si_code == SI_QUEUE && info->si_pid == __getpid()) {
       // Allow for the abort message to be explicitly specified via the sigqueue value.
       // Keep the bottom bit intact for representing whether we want a backtrace or a tombstone.
       if (si_val != kDebuggerdFallbackSivalUintptrRequestDump) {
-        abort_message = reinterpret_cast<void*>(si_val & ~1);
+        process_info.abort_msg = reinterpret_cast<void*>(si_val & ~1);
         info->si_ptr = reinterpret_cast<void*>(si_val & 1);
       }
     }
-  } else {
-    if (g_callbacks.get_abort_message) {
-      abort_message = g_callbacks.get_abort_message();
-    }
-    if (g_callbacks.get_gwp_asan_state) {
-      gwp_asan_state = g_callbacks.get_gwp_asan_state();
-    }
-    if (g_callbacks.get_gwp_asan_metadata) {
-      gwp_asan_metadata = g_callbacks.get_gwp_asan_metadata();
-    }
+  } else if (g_callbacks.get_process_info) {
+    process_info = g_callbacks.get_process_info();
   }
 
   // If sival_int is ~0, it means that the fallback handler has been called
@@ -524,7 +530,7 @@
     // This check might be racy if another thread sets NO_NEW_PRIVS, but this should be unlikely,
     // you can only set NO_NEW_PRIVS to 1, and the effect should be at worst a single missing
     // ANR trace.
-    debuggerd_fallback_handler(info, static_cast<ucontext_t*>(context), abort_message);
+    debuggerd_fallback_handler(info, ucontext, process_info.abort_msg);
     resend_signal(info);
     return;
   }
@@ -543,10 +549,7 @@
       .pseudothread_tid = -1,
       .siginfo = info,
       .ucontext = context,
-      .abort_msg = reinterpret_cast<uintptr_t>(abort_message),
-      .fdsan_table = reinterpret_cast<uintptr_t>(android_fdsan_get_fd_table()),
-      .gwp_asan_state = reinterpret_cast<uintptr_t>(gwp_asan_state),
-      .gwp_asan_metadata = reinterpret_cast<uintptr_t>(gwp_asan_metadata),
+      .process_info = process_info,
   };
 
   // Set PR_SET_DUMPABLE to 1, so that crash_dump can ptrace us.
@@ -633,5 +636,11 @@
 
   // Use the alternate signal stack if available so we can catch stack overflows.
   action.sa_flags |= SA_ONSTACK;
+
+#define SA_EXPOSE_TAGBITS 0x00000800
+  // Request that the kernel set tag bits in the fault address. This is necessary for diagnosing MTE
+  // faults.
+  action.sa_flags |= SA_EXPOSE_TAGBITS;
+
   debuggerd_register_handlers(&action);
 }
diff --git a/debuggerd/include/debuggerd/handler.h b/debuggerd/include/debuggerd/handler.h
index 665d24a..254ed4f 100644
--- a/debuggerd/include/debuggerd/handler.h
+++ b/debuggerd/include/debuggerd/handler.h
@@ -33,13 +33,22 @@
 struct AllocationMetadata;
 };  // namespace gwp_asan
 
+// When updating this data structure, CrashInfoDataDynamic and the code in
+// ReadCrashInfo() must also be updated.
+struct debugger_process_info {
+  void* abort_msg;
+  void* fdsan_table;
+  const gwp_asan::AllocatorState* gwp_asan_state;
+  const gwp_asan::AllocationMetadata* gwp_asan_metadata;
+  const char* scudo_stack_depot;
+  const char* scudo_region_info;
+};
+
 // These callbacks are called in a signal handler, and thus must be async signal safe.
 // If null, the callbacks will not be called.
 typedef struct {
-  struct abort_msg_t* (*get_abort_message)();
+  debugger_process_info (*get_process_info)();
   void (*post_dump)();
-  const struct gwp_asan::AllocatorState* (*get_gwp_asan_state)();
-  const struct gwp_asan::AllocationMetadata* (*get_gwp_asan_metadata)();
 } debuggerd_callbacks_t;
 
 void debuggerd_init(debuggerd_callbacks_t* callbacks);
diff --git a/debuggerd/libdebuggerd/backtrace.cpp b/debuggerd/libdebuggerd/backtrace.cpp
index c606970..c543a83 100644
--- a/debuggerd/libdebuggerd/backtrace.cpp
+++ b/debuggerd/libdebuggerd/backtrace.cpp
@@ -18,8 +18,9 @@
 
 #include "libdebuggerd/backtrace.h"
 
-#include <errno.h>
 #include <dirent.h>
+#include <errno.h>
+#include <inttypes.h>
 #include <limits.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -27,7 +28,6 @@
 #include <string.h>
 #include <sys/ptrace.h>
 #include <sys/types.h>
-#include <time.h>
 #include <unistd.h>
 
 #include <map>
@@ -40,14 +40,10 @@
 
 #include "libdebuggerd/types.h"
 #include "libdebuggerd/utility.h"
+#include "util.h"
 
 static void dump_process_header(log_t* log, pid_t pid, const char* process_name) {
-  time_t t = time(NULL);
-  struct tm tm;
-  localtime_r(&t, &tm);
-  char timestr[64];
-  strftime(timestr, sizeof(timestr), "%F %T", &tm);
-  _LOG(log, logtype::BACKTRACE, "\n\n----- pid %d at %s -----\n", pid, timestr);
+  _LOG(log, logtype::BACKTRACE, "\n\n----- pid %d at %s -----\n", pid, get_timestamp().c_str());
 
   if (process_name) {
     _LOG(log, logtype::BACKTRACE, "Cmd line: %s\n", process_name);
@@ -70,7 +66,11 @@
   unwinder->SetRegs(thread.registers.get());
   unwinder->Unwind();
   if (unwinder->NumFrames() == 0) {
-    _LOG(&log, logtype::THREAD, "Unwind failed: tid = %d", thread.tid);
+    _LOG(&log, logtype::THREAD, "Unwind failed: tid = %d\n", thread.tid);
+    if (unwinder->LastErrorCode() != unwindstack::ERROR_NONE) {
+      _LOG(&log, logtype::THREAD, "  Error code: %s\n", unwinder->LastErrorCodeString());
+      _LOG(&log, logtype::THREAD, "  Error address: 0x%" PRIx64 "\n", unwinder->LastErrorAddress());
+    }
     return;
   }
 
@@ -106,9 +106,8 @@
   log.tfd = output_fd;
   log.amfd_data = nullptr;
 
-  char process_name[128];
-  read_with_default("/proc/self/cmdline", process_name, sizeof(process_name), "<unknown>");
-  dump_process_header(&log, getpid(), process_name);
+  pid_t pid = getpid();
+  dump_process_header(&log, pid, get_process_name(pid).c_str());
 }
 
 void dump_backtrace_footer(int output_fd) {
diff --git a/debuggerd/libdebuggerd/gwp_asan.cpp b/debuggerd/libdebuggerd/gwp_asan.cpp
index 53df783..9750fc4 100644
--- a/debuggerd/libdebuggerd/gwp_asan.cpp
+++ b/debuggerd/libdebuggerd/gwp_asan.cpp
@@ -63,18 +63,17 @@
 }
 
 GwpAsanCrashData::GwpAsanCrashData(unwindstack::Memory* process_memory,
-                                   uintptr_t gwp_asan_state_ptr, uintptr_t gwp_asan_metadata_ptr,
-                                   const ThreadInfo& thread_info) {
-  if (!process_memory || !gwp_asan_metadata_ptr || !gwp_asan_state_ptr) return;
+                                   const ProcessInfo& process_info, const ThreadInfo& thread_info) {
+  if (!process_memory || !process_info.gwp_asan_metadata || !process_info.gwp_asan_state) return;
   // Extract the GWP-ASan regions from the dead process.
-  if (!retrieve_gwp_asan_state(process_memory, gwp_asan_state_ptr, &state_)) return;
-  metadata_.reset(retrieve_gwp_asan_metadata(process_memory, state_, gwp_asan_metadata_ptr));
+  if (!retrieve_gwp_asan_state(process_memory, process_info.gwp_asan_state, &state_)) return;
+  metadata_.reset(retrieve_gwp_asan_metadata(process_memory, state_, process_info.gwp_asan_metadata));
   if (!metadata_.get()) return;
 
   // Get the external crash address from the thread info.
   crash_address_ = 0u;
-  if (signal_has_si_addr(thread_info.siginfo)) {
-    crash_address_ = reinterpret_cast<uintptr_t>(thread_info.siginfo->si_addr);
+  if (process_info.has_fault_address) {
+    crash_address_ = process_info.untagged_fault_address;
   }
 
   // Ensure the error belongs to GWP-ASan.
@@ -158,63 +157,6 @@
        error_string_, diff, byte_suffix, location_str, alloc_size, alloc_address);
 }
 
-// Build a frame for symbolization using the maps from the provided unwinder.
-// The constructed frame contains just enough information to be used to
-// symbolize a GWP-ASan stack trace.
-static unwindstack::FrameData BuildFrame(unwindstack::Unwinder* unwinder, uintptr_t pc,
-                                         size_t frame_num) {
-  unwindstack::FrameData frame;
-  frame.num = frame_num;
-
-  unwindstack::Maps* maps = unwinder->GetMaps();
-  unwindstack::MapInfo* map_info = maps->Find(pc);
-  if (!map_info) {
-    frame.rel_pc = pc;
-    return frame;
-  }
-
-  unwindstack::Elf* elf =
-      map_info->GetElf(unwinder->GetProcessMemory(), unwindstack::Regs::CurrentArch());
-
-  uint64_t relative_pc = elf->GetRelPc(pc, map_info);
-
-  // Create registers just to get PC adjustment. Doesn't matter what they point
-  // to.
-  unwindstack::Regs* regs = unwindstack::Regs::CreateFromLocal();
-  uint64_t pc_adjustment = regs->GetPcAdjustment(relative_pc, elf);
-  relative_pc -= pc_adjustment;
-  // The debug PC may be different if the PC comes from the JIT.
-  uint64_t debug_pc = relative_pc;
-
-  // If we don't have a valid ELF file, check the JIT.
-  if (!elf->valid()) {
-    unwindstack::JitDebug jit_debug(unwinder->GetProcessMemory());
-    uint64_t jit_pc = pc - pc_adjustment;
-    unwindstack::Elf* jit_elf = jit_debug.GetElf(maps, jit_pc);
-    if (jit_elf != nullptr) {
-      debug_pc = jit_pc;
-      elf = jit_elf;
-    }
-  }
-
-  // Copy all the things we need into the frame for symbolization.
-  frame.rel_pc = relative_pc;
-  frame.pc = pc - pc_adjustment;
-  frame.map_name = map_info->name;
-  frame.map_elf_start_offset = map_info->elf_start_offset;
-  frame.map_exact_offset = map_info->offset;
-  frame.map_start = map_info->start;
-  frame.map_end = map_info->end;
-  frame.map_flags = map_info->flags;
-  frame.map_load_bias = elf->GetLoadBias();
-
-  if (!elf->GetFunctionName(relative_pc, &frame.function_name, &frame.function_offset)) {
-    frame.function_name = "";
-    frame.function_offset = 0;
-  }
-  return frame;
-}
-
 constexpr size_t kMaxTraceLength = gwp_asan::AllocationMetadata::kMaxTraceLengthToCollect;
 
 bool GwpAsanCrashData::HasDeallocationTrace() const {
@@ -241,7 +183,8 @@
 
   unwinder->SetDisplayBuildID(true);
   for (size_t i = 0; i < num_frames; ++i) {
-    unwindstack::FrameData frame_data = BuildFrame(unwinder, frames.get()[i], i);
+    unwindstack::FrameData frame_data = unwinder->BuildFrameFromPcOnly(frames.get()[i]);
+    frame_data.num = i;
     _LOG(log, logtype::BACKTRACE, "    %s\n", unwinder->FormatFrame(frame_data).c_str());
   }
 }
@@ -267,7 +210,8 @@
 
   unwinder->SetDisplayBuildID(true);
   for (size_t i = 0; i < num_frames; ++i) {
-    unwindstack::FrameData frame_data = BuildFrame(unwinder, frames.get()[i], i);
+    unwindstack::FrameData frame_data = unwinder->BuildFrameFromPcOnly(frames.get()[i]);
+    frame_data.num = i;
     _LOG(log, logtype::BACKTRACE, "    %s\n", unwinder->FormatFrame(frame_data).c_str());
   }
 }
diff --git a/debuggerd/libdebuggerd/include/libdebuggerd/gwp_asan.h b/debuggerd/libdebuggerd/include/libdebuggerd/gwp_asan.h
index aef4c62..6c88733 100644
--- a/debuggerd/libdebuggerd/include/libdebuggerd/gwp_asan.h
+++ b/debuggerd/libdebuggerd/include/libdebuggerd/gwp_asan.h
@@ -38,8 +38,8 @@
   // still be responsible, as it terminates when it detects an internal error
   // (double free, invalid free). In these cases, we will retrieve the fault
   // address from the GWP-ASan allocator's state.
-  GwpAsanCrashData(unwindstack::Memory* process_memory, uintptr_t gwp_asan_state_ptr,
-                   uintptr_t gwp_asan_metadata_ptr, const ThreadInfo& thread_info);
+  GwpAsanCrashData(unwindstack::Memory* process_memory, const ProcessInfo& process_info,
+                   const ThreadInfo& thread_info);
 
   // Is GWP-ASan responsible for this crash.
   bool CrashIsMine() const;
diff --git a/debuggerd/libdebuggerd/include/libdebuggerd/scudo.h b/debuggerd/libdebuggerd/include/libdebuggerd/scudo.h
new file mode 100644
index 0000000..4d00ece
--- /dev/null
+++ b/debuggerd/libdebuggerd/include/libdebuggerd/scudo.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include "types.h"
+#include "utility.h"
+
+#include <memory.h>
+
+#include "scudo/interface.h"
+
+class ScudoCrashData {
+ public:
+  ScudoCrashData() = delete;
+  ~ScudoCrashData() = default;
+  ScudoCrashData(unwindstack::Memory* process_memory, const ProcessInfo& process_info);
+
+  bool CrashIsMine() const;
+
+  void DumpCause(log_t* log, unwindstack::Unwinder* unwinder) const;
+
+ private:
+  scudo_error_info error_info_ = {};
+  uintptr_t untagged_fault_addr_;
+
+  void DumpReport(const scudo_error_report* report, log_t* log,
+                  unwindstack::Unwinder* unwinder) const;
+};
diff --git a/debuggerd/libdebuggerd/include/libdebuggerd/tombstone.h b/debuggerd/libdebuggerd/include/libdebuggerd/tombstone.h
index 291d994..bf2cbb3 100644
--- a/debuggerd/libdebuggerd/include/libdebuggerd/tombstone.h
+++ b/debuggerd/libdebuggerd/include/libdebuggerd/tombstone.h
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <sys/types.h>
 
+#include <functional>
 #include <map>
 #include <string>
 
@@ -30,6 +31,8 @@
 #include "types.h"
 
 // Forward declarations
+class Tombstone;
+
 namespace unwindstack {
 class Unwinder;
 }
@@ -44,18 +47,21 @@
 int open_tombstone(std::string* path);
 
 /* Creates a tombstone file and writes the crash dump to it. */
-void engrave_tombstone(int tombstone_fd, unwindstack::Unwinder* unwinder,
-                       const OpenFilesList* open_files, pid_t pid, pid_t tid,
-                       const std::string& process_name, const std::map<pid_t, std::string>& threads,
-                       uint64_t abort_msg_address, std::string* amfd_data);
-
-void engrave_tombstone_ucontext(int tombstone_fd, uint64_t abort_msg_address, siginfo_t* siginfo,
-                                ucontext_t* ucontext);
-
-void engrave_tombstone(android::base::unique_fd output_fd, unwindstack::Unwinder* unwinder,
+void engrave_tombstone(android::base::unique_fd output_fd, android::base::unique_fd proto_fd,
+                       unwindstack::Unwinder* unwinder,
                        const std::map<pid_t, ThreadInfo>& thread_info, pid_t target_thread,
-                       uint64_t abort_msg_address, OpenFilesList* open_files,
-                       std::string* amfd_data, uintptr_t gwp_asan_state,
-                       uintptr_t gwp_asan_metadata);
+                       const ProcessInfo& process_info, OpenFilesList* open_files,
+                       std::string* amfd_data);
+
+void engrave_tombstone_ucontext(int tombstone_fd, int proto_fd, uint64_t abort_msg_address,
+                                siginfo_t* siginfo, ucontext_t* ucontext);
+
+void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
+                             const std::map<pid_t, ThreadInfo>& threads, pid_t target_thread,
+                             const ProcessInfo& process_info, const OpenFilesList* open_files);
+
+bool tombstone_proto_to_text(
+    const Tombstone& tombstone,
+    std::function<void(const std::string& line, bool should_log)> callback);
 
 #endif  // _DEBUGGERD_TOMBSTONE_H
diff --git a/debuggerd/libdebuggerd/include/libdebuggerd/types.h b/debuggerd/libdebuggerd/include/libdebuggerd/types.h
index eb4b1b8..d5b0735 100644
--- a/debuggerd/libdebuggerd/include/libdebuggerd/types.h
+++ b/debuggerd/libdebuggerd/include/libdebuggerd/types.h
@@ -23,6 +23,7 @@
 
 struct ThreadInfo {
   std::unique_ptr<unwindstack::Regs> registers;
+  long tagged_addr_ctrl = -1;
 
   pid_t uid;
 
@@ -30,8 +31,23 @@
   std::string thread_name;
 
   pid_t pid;
+
   std::string process_name;
+  std::string selinux_label;
 
   int signo = 0;
   siginfo_t* siginfo = nullptr;
 };
+
+struct ProcessInfo {
+  uintptr_t abort_msg_address = 0;
+  uintptr_t fdsan_table_address = 0;
+  uintptr_t gwp_asan_state = 0;
+  uintptr_t gwp_asan_metadata = 0;
+  uintptr_t scudo_stack_depot = 0;
+  uintptr_t scudo_region_info = 0;
+
+  bool has_fault_address = false;
+  uintptr_t untagged_fault_address = 0;
+  uintptr_t maybe_tagged_fault_address = 0;
+};
diff --git a/debuggerd/libdebuggerd/include/libdebuggerd/utility.h b/debuggerd/libdebuggerd/include/libdebuggerd/utility.h
index 75bac87..d71b76f 100644
--- a/debuggerd/libdebuggerd/include/libdebuggerd/utility.h
+++ b/debuggerd/libdebuggerd/include/libdebuggerd/utility.h
@@ -81,10 +81,10 @@
 
 void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix);
 
+ssize_t dump_memory(void* out, size_t len, size_t* start_offset, uint64_t* addr,
+                    unwindstack::Memory* memory);
 void dump_memory(log_t* log, unwindstack::Memory* backtrace, uint64_t addr, const std::string&);
 
-void read_with_default(const char* path, char* buf, size_t len, const char* default_value);
-
 void drop_capabilities();
 
 bool signal_has_sender(const siginfo_t*, pid_t caller_pid);
diff --git a/debuggerd/libdebuggerd/scudo.cpp b/debuggerd/libdebuggerd/scudo.cpp
new file mode 100644
index 0000000..141c3bd
--- /dev/null
+++ b/debuggerd/libdebuggerd/scudo.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "libdebuggerd/scudo.h"
+#include "libdebuggerd/gwp_asan.h"
+
+#include "unwindstack/Memory.h"
+#include "unwindstack/Unwinder.h"
+
+#include <bionic/macros.h>
+
+std::unique_ptr<char[]> AllocAndReadFully(unwindstack::Memory* process_memory, uint64_t addr,
+                                          size_t size) {
+  auto buf = std::make_unique<char[]>(size);
+  if (!process_memory->ReadFully(addr, buf.get(), size)) {
+    return std::unique_ptr<char[]>();
+  }
+  return buf;
+}
+
+static const uintptr_t kTagGranuleSize = 16;
+
+ScudoCrashData::ScudoCrashData(unwindstack::Memory* process_memory,
+                               const ProcessInfo& process_info) {
+  if (!process_info.has_fault_address) {
+    return;
+  }
+
+  auto stack_depot = AllocAndReadFully(process_memory, process_info.scudo_stack_depot,
+                                       __scudo_get_stack_depot_size());
+  auto region_info = AllocAndReadFully(process_memory, process_info.scudo_region_info,
+                                       __scudo_get_region_info_size());
+
+  untagged_fault_addr_ = process_info.untagged_fault_address;
+  uintptr_t fault_page = untagged_fault_addr_ & ~(PAGE_SIZE - 1);
+
+  uintptr_t memory_begin = fault_page - PAGE_SIZE * 16;
+  if (memory_begin > fault_page) {
+    return;
+  }
+
+  uintptr_t memory_end = fault_page + PAGE_SIZE * 16;
+  if (memory_end < fault_page) {
+    return;
+  }
+
+  auto memory = std::make_unique<char[]>(memory_end - memory_begin);
+  for (auto i = memory_begin; i != memory_end; i += PAGE_SIZE) {
+    process_memory->ReadFully(i, memory.get() + i - memory_begin, PAGE_SIZE);
+  }
+
+  auto memory_tags = std::make_unique<char[]>((memory_end - memory_begin) / kTagGranuleSize);
+  for (auto i = memory_begin; i != memory_end; i += kTagGranuleSize) {
+    memory_tags[(i - memory_begin) / kTagGranuleSize] = process_memory->ReadTag(i);
+  }
+
+  __scudo_get_error_info(&error_info_, process_info.maybe_tagged_fault_address, stack_depot.get(),
+                         region_info.get(), memory.get(), memory_tags.get(), memory_begin,
+                         memory_end - memory_begin);
+}
+
+bool ScudoCrashData::CrashIsMine() const {
+  return error_info_.reports[0].error_type != UNKNOWN;
+}
+
+void ScudoCrashData::DumpCause(log_t* log, unwindstack::Unwinder* unwinder) const {
+  if (error_info_.reports[1].error_type != UNKNOWN) {
+    _LOG(log, logtype::HEADER,
+         "\nNote: multiple potential causes for this crash were detected, listing them in "
+         "decreasing order of probability.\n");
+  }
+
+  size_t report_num = 0;
+  while (report_num < sizeof(error_info_.reports) / sizeof(error_info_.reports[0]) &&
+         error_info_.reports[report_num].error_type != UNKNOWN) {
+    DumpReport(&error_info_.reports[report_num++], log, unwinder);
+  }
+}
+
+void ScudoCrashData::DumpReport(const scudo_error_report* report, log_t* log,
+                                unwindstack::Unwinder* unwinder) const {
+  const char *error_type_str;
+  switch (report->error_type) {
+    case USE_AFTER_FREE:
+      error_type_str = "Use After Free";
+      break;
+    case BUFFER_OVERFLOW:
+      error_type_str = "Buffer Overflow";
+      break;
+    case BUFFER_UNDERFLOW:
+      error_type_str = "Buffer Underflow";
+      break;
+    default:
+      error_type_str = "Unknown";
+      break;
+  }
+
+  uintptr_t diff;
+  const char* location_str;
+
+  if (untagged_fault_addr_ < report->allocation_address) {
+    // Buffer Underflow, 6 bytes left of a 41-byte allocation at 0xdeadbeef.
+    location_str = "left of";
+    diff = report->allocation_address - untagged_fault_addr_;
+  } else if (untagged_fault_addr_ - report->allocation_address < report->allocation_size) {
+    // Use After Free, 40 bytes into a 41-byte allocation at 0xdeadbeef.
+    location_str = "into";
+    diff = untagged_fault_addr_ - report->allocation_address;
+  } else {
+    // Buffer Overflow, 6 bytes right of a 41-byte allocation at 0xdeadbeef.
+    location_str = "right of";
+    diff = untagged_fault_addr_ - report->allocation_address - report->allocation_size;
+  }
+
+  // Suffix of 'bytes', i.e. 4 bytes' vs. '1 byte'.
+  const char* byte_suffix = "s";
+  if (diff == 1) {
+    byte_suffix = "";
+  }
+  _LOG(log, logtype::HEADER,
+       "\nCause: [MTE]: %s, %" PRIuPTR " byte%s %s a %zu-byte allocation at 0x%" PRIxPTR "\n",
+       error_type_str, diff, byte_suffix, location_str, report->allocation_size,
+       report->allocation_address);
+
+  if (report->allocation_trace[0]) {
+    _LOG(log, logtype::BACKTRACE, "\nallocated by thread %u:\n", report->allocation_tid);
+    unwinder->SetDisplayBuildID(true);
+    for (size_t i = 0; i < 64 && report->allocation_trace[i]; ++i) {
+      unwindstack::FrameData frame_data =
+          unwinder->BuildFrameFromPcOnly(report->allocation_trace[i]);
+      frame_data.num = i;
+      _LOG(log, logtype::BACKTRACE, "    %s\n", unwinder->FormatFrame(frame_data).c_str());
+    }
+  }
+
+  if (report->deallocation_trace[0]) {
+    _LOG(log, logtype::BACKTRACE, "\ndeallocated by thread %u:\n", report->deallocation_tid);
+    unwinder->SetDisplayBuildID(true);
+    for (size_t i = 0; i < 64 && report->deallocation_trace[i]; ++i) {
+      unwindstack::FrameData frame_data =
+          unwinder->BuildFrameFromPcOnly(report->deallocation_trace[i]);
+      frame_data.num = i;
+      _LOG(log, logtype::BACKTRACE, "    %s\n", unwinder->FormatFrame(frame_data).c_str());
+    }
+  }
+}
diff --git a/debuggerd/libdebuggerd/test/UnwinderMock.h b/debuggerd/libdebuggerd/test/UnwinderMock.h
index 023a578..44a9214 100644
--- a/debuggerd/libdebuggerd/test/UnwinderMock.h
+++ b/debuggerd/libdebuggerd/test/UnwinderMock.h
@@ -34,7 +34,7 @@
     unwindstack::MapInfo* map_info = GetMaps()->Find(offset);
     if (map_info != nullptr) {
       std::string* new_build_id = new std::string(build_id);
-      map_info->build_id = reinterpret_cast<uintptr_t>(new_build_id);
+      map_info->build_id = new_build_id;
     }
   }
 };
diff --git a/debuggerd/libdebuggerd/test/dump_memory_test.cpp b/debuggerd/libdebuggerd/test/dump_memory_test.cpp
index be39582..f16f578 100644
--- a/debuggerd/libdebuggerd/test/dump_memory_test.cpp
+++ b/debuggerd/libdebuggerd/test/dump_memory_test.cpp
@@ -30,39 +30,39 @@
 const char g_expected_full_dump[] =
 "\nmemory near r1:\n"
 #if defined(__LP64__)
-"    0000000012345658 0706050403020100 0f0e0d0c0b0a0908  ................\n"
-"    0000000012345668 1716151413121110 1f1e1d1c1b1a1918  ................\n"
-"    0000000012345678 2726252423222120 2f2e2d2c2b2a2928   !\"#$%&'()*+,-./\n"
-"    0000000012345688 3736353433323130 3f3e3d3c3b3a3938  0123456789:;<=>?\n"
-"    0000000012345698 4746454443424140 4f4e4d4c4b4a4948  @ABCDEFGHIJKLMNO\n"
-"    00000000123456a8 5756555453525150 5f5e5d5c5b5a5958  PQRSTUVWXYZ[\\]^_\n"
-"    00000000123456b8 6766656463626160 6f6e6d6c6b6a6968  `abcdefghijklmno\n"
-"    00000000123456c8 7776757473727170 7f7e7d7c7b7a7978  pqrstuvwxyz{|}~.\n"
-"    00000000123456d8 8786858483828180 8f8e8d8c8b8a8988  ................\n"
-"    00000000123456e8 9796959493929190 9f9e9d9c9b9a9998  ................\n"
-"    00000000123456f8 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................\n"
-"    0000000012345708 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................\n"
-"    0000000012345718 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................\n"
-"    0000000012345728 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................\n"
-"    0000000012345738 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................\n"
-"    0000000012345748 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................\n";
+"    0000000012345650 0706050403020100 0f0e0d0c0b0a0908  ................\n"
+"    0000000012345660 1716151413121110 1f1e1d1c1b1a1918  ................\n"
+"    0000000012345670 2726252423222120 2f2e2d2c2b2a2928   !\"#$%&'()*+,-./\n"
+"    0000000012345680 3736353433323130 3f3e3d3c3b3a3938  0123456789:;<=>?\n"
+"    0000000012345690 4746454443424140 4f4e4d4c4b4a4948  @ABCDEFGHIJKLMNO\n"
+"    00000000123456a0 5756555453525150 5f5e5d5c5b5a5958  PQRSTUVWXYZ[\\]^_\n"
+"    00000000123456b0 6766656463626160 6f6e6d6c6b6a6968  `abcdefghijklmno\n"
+"    00000000123456c0 7776757473727170 7f7e7d7c7b7a7978  pqrstuvwxyz{|}~.\n"
+"    00000000123456d0 8786858483828180 8f8e8d8c8b8a8988  ................\n"
+"    00000000123456e0 9796959493929190 9f9e9d9c9b9a9998  ................\n"
+"    00000000123456f0 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................\n"
+"    0000000012345700 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................\n"
+"    0000000012345710 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................\n"
+"    0000000012345720 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................\n"
+"    0000000012345730 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................\n"
+"    0000000012345740 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................\n";
 #else
-"    12345658 03020100 07060504 0b0a0908 0f0e0d0c  ................\n"
-"    12345668 13121110 17161514 1b1a1918 1f1e1d1c  ................\n"
-"    12345678 23222120 27262524 2b2a2928 2f2e2d2c   !\"#$%&'()*+,-./\n"
-"    12345688 33323130 37363534 3b3a3938 3f3e3d3c  0123456789:;<=>?\n"
-"    12345698 43424140 47464544 4b4a4948 4f4e4d4c  @ABCDEFGHIJKLMNO\n"
-"    123456a8 53525150 57565554 5b5a5958 5f5e5d5c  PQRSTUVWXYZ[\\]^_\n"
-"    123456b8 63626160 67666564 6b6a6968 6f6e6d6c  `abcdefghijklmno\n"
-"    123456c8 73727170 77767574 7b7a7978 7f7e7d7c  pqrstuvwxyz{|}~.\n"
-"    123456d8 83828180 87868584 8b8a8988 8f8e8d8c  ................\n"
-"    123456e8 93929190 97969594 9b9a9998 9f9e9d9c  ................\n"
-"    123456f8 a3a2a1a0 a7a6a5a4 abaaa9a8 afaeadac  ................\n"
-"    12345708 b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc  ................\n"
-"    12345718 c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc  ................\n"
-"    12345728 d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc  ................\n"
-"    12345738 e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec  ................\n"
-"    12345748 f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc  ................\n";
+"    12345650 03020100 07060504 0b0a0908 0f0e0d0c  ................\n"
+"    12345660 13121110 17161514 1b1a1918 1f1e1d1c  ................\n"
+"    12345670 23222120 27262524 2b2a2928 2f2e2d2c   !\"#$%&'()*+,-./\n"
+"    12345680 33323130 37363534 3b3a3938 3f3e3d3c  0123456789:;<=>?\n"
+"    12345690 43424140 47464544 4b4a4948 4f4e4d4c  @ABCDEFGHIJKLMNO\n"
+"    123456a0 53525150 57565554 5b5a5958 5f5e5d5c  PQRSTUVWXYZ[\\]^_\n"
+"    123456b0 63626160 67666564 6b6a6968 6f6e6d6c  `abcdefghijklmno\n"
+"    123456c0 73727170 77767574 7b7a7978 7f7e7d7c  pqrstuvwxyz{|}~.\n"
+"    123456d0 83828180 87868584 8b8a8988 8f8e8d8c  ................\n"
+"    123456e0 93929190 97969594 9b9a9998 9f9e9d9c  ................\n"
+"    123456f0 a3a2a1a0 a7a6a5a4 abaaa9a8 afaeadac  ................\n"
+"    12345700 b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc  ................\n"
+"    12345710 c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc  ................\n"
+"    12345720 d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc  ................\n"
+"    12345730 e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec  ................\n"
+"    12345740 f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc  ................\n";
 #endif
 
 const char g_expected_partial_dump[] = \
@@ -112,7 +112,10 @@
     if (last_read_addr_ > 0) {
       offset = addr - last_read_addr_;
     }
-    size_t bytes_available = buffer_.size() - offset;
+    size_t bytes_available = 0;
+    if (offset < buffer_.size()) {
+      bytes_available = buffer_.size() - offset;
+    }
 
     if (partial_read_) {
       bytes = std::min(bytes, bytes_partial_read_);
@@ -258,44 +261,7 @@
   std::string tombstone_contents;
   ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
   ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
-  const char* expected_dump = \
-"\nmemory near pc:\n"
-#if defined(__LP64__)
-"    00000000a2345658 ---------------- ----------------  ................\n"
-"    00000000a2345668 ---------------- ----------------  ................\n"
-"    00000000a2345678 ---------------- ----------------  ................\n"
-"    00000000a2345688 ---------------- ----------------  ................\n"
-"    00000000a2345698 ---------------- ----------------  ................\n"
-"    00000000a23456a8 ---------------- ----------------  ................\n"
-"    00000000a23456b8 ---------------- ----------------  ................\n"
-"    00000000a23456c8 ---------------- ----------------  ................\n"
-"    00000000a23456d8 ---------------- ----------------  ................\n"
-"    00000000a23456e8 ---------------- ----------------  ................\n"
-"    00000000a23456f8 ---------------- ----------------  ................\n"
-"    00000000a2345708 ---------------- ----------------  ................\n"
-"    00000000a2345718 ---------------- ----------------  ................\n"
-"    00000000a2345728 ---------------- ----------------  ................\n"
-"    00000000a2345738 ---------------- ----------------  ................\n"
-"    00000000a2345748 ---------------- ----------------  ................\n";
-#else
-"    a2345658 -------- -------- -------- --------  ................\n"
-"    a2345668 -------- -------- -------- --------  ................\n"
-"    a2345678 -------- -------- -------- --------  ................\n"
-"    a2345688 -------- -------- -------- --------  ................\n"
-"    a2345698 -------- -------- -------- --------  ................\n"
-"    a23456a8 -------- -------- -------- --------  ................\n"
-"    a23456b8 -------- -------- -------- --------  ................\n"
-"    a23456c8 -------- -------- -------- --------  ................\n"
-"    a23456d8 -------- -------- -------- --------  ................\n"
-"    a23456e8 -------- -------- -------- --------  ................\n"
-"    a23456f8 -------- -------- -------- --------  ................\n"
-"    a2345708 -------- -------- -------- --------  ................\n"
-"    a2345718 -------- -------- -------- --------  ................\n"
-"    a2345728 -------- -------- -------- --------  ................\n"
-"    a2345738 -------- -------- -------- --------  ................\n"
-"    a2345748 -------- -------- -------- --------  ................\n";
-#endif
-  ASSERT_STREQ(expected_dump, tombstone_contents.c_str());
+  ASSERT_STREQ("", tombstone_contents.c_str());
 
   // Verify that the log buf is empty, and no error messages.
   ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -429,57 +395,17 @@
   ASSERT_STREQ("", getFakeLogPrint().c_str());
 }
 
-TEST_F(DumpMemoryTest, memory_address_too_low) {
-  uint8_t buffer[256];
-  memset(buffer, 0, sizeof(buffer));
-  memory_mock_->SetReadData(buffer, sizeof(buffer));
-
-  dump_memory(&log_, memory_mock_.get(), 0, "memory near r1");
-
-  std::string tombstone_contents;
-  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
-  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
-  ASSERT_STREQ("", tombstone_contents.c_str());
-
-  // Verify that the log buf is empty, and no error messages.
-  ASSERT_STREQ("", getFakeLogBuf().c_str());
-  ASSERT_STREQ("", getFakeLogPrint().c_str());
-}
-
 TEST_F(DumpMemoryTest, memory_address_too_high) {
   uint8_t buffer[256];
   memset(buffer, 0, sizeof(buffer));
   memory_mock_->SetReadData(buffer, sizeof(buffer));
 
 #if defined(__LP64__)
-  dump_memory(&log_, memory_mock_.get(), 0x4000000000000000UL, "memory near r1");
-  dump_memory(&log_, memory_mock_.get(), 0x4000000000000000UL - 32, "memory near r1");
-  dump_memory(&log_, memory_mock_.get(), 0x4000000000000000UL - 216, "memory near r1");
+  dump_memory(&log_, memory_mock_.get(), -32, "memory near r1");
+  dump_memory(&log_, memory_mock_.get(), -208, "memory near r1");
 #else
-  dump_memory(&log_, memory_mock_.get(), 0xffff0000, "memory near r1");
-  dump_memory(&log_, memory_mock_.get(), 0xffff0000 - 32, "memory near r1");
-  dump_memory(&log_, memory_mock_.get(), 0xffff0000 - 220, "memory near r1");
-#endif
-
-  std::string tombstone_contents;
-  ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
-  ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
-  ASSERT_STREQ("", tombstone_contents.c_str());
-
-  // Verify that the log buf is empty, and no error messages.
-  ASSERT_STREQ("", getFakeLogBuf().c_str());
-  ASSERT_STREQ("", getFakeLogPrint().c_str());
-}
-
-TEST_F(DumpMemoryTest, memory_address_would_overflow) {
-  uint8_t buffer[256];
-  memset(buffer, 0, sizeof(buffer));
-  memory_mock_->SetReadData(buffer, sizeof(buffer));
-
-#if defined(__LP64__)
-  dump_memory(&log_, memory_mock_.get(), 0xfffffffffffffff0, "memory near r1");
-#else
-  dump_memory(&log_, memory_mock_.get(), 0xfffffff0, "memory near r1");
+  dump_memory(&log_, memory_mock_.get(), 0x100000000 - 32, "memory near r1");
+  dump_memory(&log_, memory_mock_.get(), 0x100000000 - 208, "memory near r1");
 #endif
 
   std::string tombstone_contents;
@@ -500,9 +426,9 @@
   memory_mock_->SetReadData(buffer, sizeof(buffer));
 
 #if defined(__LP64__)
-  dump_memory(&log_, memory_mock_.get(), 0x4000000000000000UL - 224, "memory near r4");
+  dump_memory(&log_, memory_mock_.get(), -224, "memory near r4");
 #else
-  dump_memory(&log_, memory_mock_.get(), 0xffff0000 - 224, "memory near r4");
+  dump_memory(&log_, memory_mock_.get(), 0x100000000 - 224, "memory near r4");
 #endif
 
   std::string tombstone_contents;
@@ -510,40 +436,57 @@
   ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
   const char* expected_dump = \
 "\nmemory near r4:\n"
-#if defined(__LP64__)
-"    3fffffffffffff00 0706050403020100 0f0e0d0c0b0a0908  ................\n"
-"    3fffffffffffff10 1716151413121110 1f1e1d1c1b1a1918  ................\n"
-"    3fffffffffffff20 2726252423222120 2f2e2d2c2b2a2928   !\"#$%&'()*+,-./\n"
-"    3fffffffffffff30 3736353433323130 3f3e3d3c3b3a3938  0123456789:;<=>?\n"
-"    3fffffffffffff40 4746454443424140 4f4e4d4c4b4a4948  @ABCDEFGHIJKLMNO\n"
-"    3fffffffffffff50 5756555453525150 5f5e5d5c5b5a5958  PQRSTUVWXYZ[\\]^_\n"
-"    3fffffffffffff60 6766656463626160 6f6e6d6c6b6a6968  `abcdefghijklmno\n"
-"    3fffffffffffff70 7776757473727170 7f7e7d7c7b7a7978  pqrstuvwxyz{|}~.\n"
-"    3fffffffffffff80 8786858483828180 8f8e8d8c8b8a8988  ................\n"
-"    3fffffffffffff90 9796959493929190 9f9e9d9c9b9a9998  ................\n"
-"    3fffffffffffffa0 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................\n"
-"    3fffffffffffffb0 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................\n"
-"    3fffffffffffffc0 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................\n"
-"    3fffffffffffffd0 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................\n"
-"    3fffffffffffffe0 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................\n"
-"    3ffffffffffffff0 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................\n";
+#if defined(__aarch64__)
+"    00ffffffffffff00 0706050403020100 0f0e0d0c0b0a0908  ................\n"
+"    00ffffffffffff10 1716151413121110 1f1e1d1c1b1a1918  ................\n"
+"    00ffffffffffff20 2726252423222120 2f2e2d2c2b2a2928   !\"#$%&'()*+,-./\n"
+"    00ffffffffffff30 3736353433323130 3f3e3d3c3b3a3938  0123456789:;<=>?\n"
+"    00ffffffffffff40 4746454443424140 4f4e4d4c4b4a4948  @ABCDEFGHIJKLMNO\n"
+"    00ffffffffffff50 5756555453525150 5f5e5d5c5b5a5958  PQRSTUVWXYZ[\\]^_\n"
+"    00ffffffffffff60 6766656463626160 6f6e6d6c6b6a6968  `abcdefghijklmno\n"
+"    00ffffffffffff70 7776757473727170 7f7e7d7c7b7a7978  pqrstuvwxyz{|}~.\n"
+"    00ffffffffffff80 8786858483828180 8f8e8d8c8b8a8988  ................\n"
+"    00ffffffffffff90 9796959493929190 9f9e9d9c9b9a9998  ................\n"
+"    00ffffffffffffa0 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................\n"
+"    00ffffffffffffb0 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................\n"
+"    00ffffffffffffc0 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................\n"
+"    00ffffffffffffd0 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................\n"
+"    00ffffffffffffe0 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................\n"
+"    00fffffffffffff0 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................\n";
+#elif defined(__LP64__)
+"    ffffffffffffff00 0706050403020100 0f0e0d0c0b0a0908  ................\n"
+"    ffffffffffffff10 1716151413121110 1f1e1d1c1b1a1918  ................\n"
+"    ffffffffffffff20 2726252423222120 2f2e2d2c2b2a2928   !\"#$%&'()*+,-./\n"
+"    ffffffffffffff30 3736353433323130 3f3e3d3c3b3a3938  0123456789:;<=>?\n"
+"    ffffffffffffff40 4746454443424140 4f4e4d4c4b4a4948  @ABCDEFGHIJKLMNO\n"
+"    ffffffffffffff50 5756555453525150 5f5e5d5c5b5a5958  PQRSTUVWXYZ[\\]^_\n"
+"    ffffffffffffff60 6766656463626160 6f6e6d6c6b6a6968  `abcdefghijklmno\n"
+"    ffffffffffffff70 7776757473727170 7f7e7d7c7b7a7978  pqrstuvwxyz{|}~.\n"
+"    ffffffffffffff80 8786858483828180 8f8e8d8c8b8a8988  ................\n"
+"    ffffffffffffff90 9796959493929190 9f9e9d9c9b9a9998  ................\n"
+"    ffffffffffffffa0 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................\n"
+"    ffffffffffffffb0 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................\n"
+"    ffffffffffffffc0 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................\n"
+"    ffffffffffffffd0 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................\n"
+"    ffffffffffffffe0 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................\n"
+"    fffffffffffffff0 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................\n";
 #else
-"    fffeff00 03020100 07060504 0b0a0908 0f0e0d0c  ................\n"
-"    fffeff10 13121110 17161514 1b1a1918 1f1e1d1c  ................\n"
-"    fffeff20 23222120 27262524 2b2a2928 2f2e2d2c   !\"#$%&'()*+,-./\n"
-"    fffeff30 33323130 37363534 3b3a3938 3f3e3d3c  0123456789:;<=>?\n"
-"    fffeff40 43424140 47464544 4b4a4948 4f4e4d4c  @ABCDEFGHIJKLMNO\n"
-"    fffeff50 53525150 57565554 5b5a5958 5f5e5d5c  PQRSTUVWXYZ[\\]^_\n"
-"    fffeff60 63626160 67666564 6b6a6968 6f6e6d6c  `abcdefghijklmno\n"
-"    fffeff70 73727170 77767574 7b7a7978 7f7e7d7c  pqrstuvwxyz{|}~.\n"
-"    fffeff80 83828180 87868584 8b8a8988 8f8e8d8c  ................\n"
-"    fffeff90 93929190 97969594 9b9a9998 9f9e9d9c  ................\n"
-"    fffeffa0 a3a2a1a0 a7a6a5a4 abaaa9a8 afaeadac  ................\n"
-"    fffeffb0 b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc  ................\n"
-"    fffeffc0 c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc  ................\n"
-"    fffeffd0 d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc  ................\n"
-"    fffeffe0 e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec  ................\n"
-"    fffefff0 f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc  ................\n";
+"    ffffff00 03020100 07060504 0b0a0908 0f0e0d0c  ................\n"
+"    ffffff10 13121110 17161514 1b1a1918 1f1e1d1c  ................\n"
+"    ffffff20 23222120 27262524 2b2a2928 2f2e2d2c   !\"#$%&'()*+,-./\n"
+"    ffffff30 33323130 37363534 3b3a3938 3f3e3d3c  0123456789:;<=>?\n"
+"    ffffff40 43424140 47464544 4b4a4948 4f4e4d4c  @ABCDEFGHIJKLMNO\n"
+"    ffffff50 53525150 57565554 5b5a5958 5f5e5d5c  PQRSTUVWXYZ[\\]^_\n"
+"    ffffff60 63626160 67666564 6b6a6968 6f6e6d6c  `abcdefghijklmno\n"
+"    ffffff70 73727170 77767574 7b7a7978 7f7e7d7c  pqrstuvwxyz{|}~.\n"
+"    ffffff80 83828180 87868584 8b8a8988 8f8e8d8c  ................\n"
+"    ffffff90 93929190 97969594 9b9a9998 9f9e9d9c  ................\n"
+"    ffffffa0 a3a2a1a0 a7a6a5a4 abaaa9a8 afaeadac  ................\n"
+"    ffffffb0 b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc  ................\n"
+"    ffffffc0 c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc  ................\n"
+"    ffffffd0 d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc  ................\n"
+"    ffffffe0 e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec  ................\n"
+"    fffffff0 f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc  ................\n";
 #endif
   ASSERT_STREQ(expected_dump, tombstone_contents.c_str());
 
@@ -570,39 +513,41 @@
   const char* expected_dump = \
 "\nmemory near r4:\n"
 #if defined(__LP64__)
-"    0000000010000f88 ---------------- ----------------  ................\n"
-"    0000000010000f98 ---------------- ----------------  ................\n"
-"    0000000010000fa8 ---------------- ----------------  ................\n"
-"    0000000010000fb8 ---------------- ----------------  ................\n"
-"    0000000010000fc8 ---------------- ----------------  ................\n"
-"    0000000010000fd8 ---------------- ----------------  ................\n"
-"    0000000010000fe8 ---------------- ----------------  ................\n"
-"    0000000010000ff8 ---------------- 7f7e7d7c7b7a7978  ........xyz{|}~.\n"
-"    0000000010001008 8786858483828180 8f8e8d8c8b8a8988  ................\n"
-"    0000000010001018 9796959493929190 9f9e9d9c9b9a9998  ................\n"
-"    0000000010001028 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................\n"
-"    0000000010001038 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................\n"
-"    0000000010001048 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................\n"
-"    0000000010001058 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................\n"
-"    0000000010001068 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................\n"
-"    0000000010001078 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................\n";
+R"(    0000000010000f80 ---------------- ----------------  ................
+    0000000010000f90 ---------------- ----------------  ................
+    0000000010000fa0 ---------------- ----------------  ................
+    0000000010000fb0 ---------------- ----------------  ................
+    0000000010000fc0 ---------------- ----------------  ................
+    0000000010000fd0 ---------------- ----------------  ................
+    0000000010000fe0 ---------------- ----------------  ................
+    0000000010000ff0 ---------------- ----------------  ................
+    0000000010001000 8786858483828180 8f8e8d8c8b8a8988  ................
+    0000000010001010 9796959493929190 9f9e9d9c9b9a9998  ................
+    0000000010001020 a7a6a5a4a3a2a1a0 afaeadacabaaa9a8  ................
+    0000000010001030 b7b6b5b4b3b2b1b0 bfbebdbcbbbab9b8  ................
+    0000000010001040 c7c6c5c4c3c2c1c0 cfcecdcccbcac9c8  ................
+    0000000010001050 d7d6d5d4d3d2d1d0 dfdedddcdbdad9d8  ................
+    0000000010001060 e7e6e5e4e3e2e1e0 efeeedecebeae9e8  ................
+    0000000010001070 f7f6f5f4f3f2f1f0 fffefdfcfbfaf9f8  ................
+)";
 #else
-"    10000f88 -------- -------- -------- --------  ................\n"
-"    10000f98 -------- -------- -------- --------  ................\n"
-"    10000fa8 -------- -------- -------- --------  ................\n"
-"    10000fb8 -------- -------- -------- --------  ................\n"
-"    10000fc8 -------- -------- -------- --------  ................\n"
-"    10000fd8 -------- -------- -------- --------  ................\n"
-"    10000fe8 -------- -------- -------- --------  ................\n"
-"    10000ff8 -------- -------- 7b7a7978 7f7e7d7c  ........xyz{|}~.\n"
-"    10001008 83828180 87868584 8b8a8988 8f8e8d8c  ................\n"
-"    10001018 93929190 97969594 9b9a9998 9f9e9d9c  ................\n"
-"    10001028 a3a2a1a0 a7a6a5a4 abaaa9a8 afaeadac  ................\n"
-"    10001038 b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc  ................\n"
-"    10001048 c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc  ................\n"
-"    10001058 d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc  ................\n"
-"    10001068 e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec  ................\n"
-"    10001078 f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc  ................\n";
+R"(    10000f80 -------- -------- -------- --------  ................
+    10000f90 -------- -------- -------- --------  ................
+    10000fa0 -------- -------- -------- --------  ................
+    10000fb0 -------- -------- -------- --------  ................
+    10000fc0 -------- -------- -------- --------  ................
+    10000fd0 -------- -------- -------- --------  ................
+    10000fe0 -------- -------- -------- --------  ................
+    10000ff0 -------- -------- -------- --------  ................
+    10001000 83828180 87868584 8b8a8988 8f8e8d8c  ................
+    10001010 93929190 97969594 9b9a9998 9f9e9d9c  ................
+    10001020 a3a2a1a0 a7a6a5a4 abaaa9a8 afaeadac  ................
+    10001030 b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc  ................
+    10001040 c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc  ................
+    10001050 d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc  ................
+    10001060 e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec  ................
+    10001070 f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc  ................
+)";
 #endif
   ASSERT_STREQ(expected_dump, tombstone_contents.c_str());
 
@@ -684,44 +629,7 @@
   std::string tombstone_contents;
   ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
   ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
-  const char* expected_dump = \
-"\nmemory near r4:\n"
-#if defined(__LP64__)
-"    0000000010000000 ---------------- ----------------  ................\n"
-"    0000000010000010 ---------------- ----------------  ................\n"
-"    0000000010000020 ---------------- ----------------  ................\n"
-"    0000000010000030 ---------------- ----------------  ................\n"
-"    0000000010000040 ---------------- ----------------  ................\n"
-"    0000000010000050 ---------------- ----------------  ................\n"
-"    0000000010000060 ---------------- ----------------  ................\n"
-"    0000000010000070 ---------------- ----------------  ................\n"
-"    0000000010000080 ---------------- ----------------  ................\n"
-"    0000000010000090 ---------------- ----------------  ................\n"
-"    00000000100000a0 ---------------- ----------------  ................\n"
-"    00000000100000b0 ---------------- ----------------  ................\n"
-"    00000000100000c0 ---------------- ----------------  ................\n"
-"    00000000100000d0 ---------------- ----------------  ................\n"
-"    00000000100000e0 ---------------- ----------------  ................\n"
-"    00000000100000f0 ---------------- ----------------  ................\n";
-#else
-"    10000000 -------- -------- -------- --------  ................\n"
-"    10000010 -------- -------- -------- --------  ................\n"
-"    10000020 -------- -------- -------- --------  ................\n"
-"    10000030 -------- -------- -------- --------  ................\n"
-"    10000040 -------- -------- -------- --------  ................\n"
-"    10000050 -------- -------- -------- --------  ................\n"
-"    10000060 -------- -------- -------- --------  ................\n"
-"    10000070 -------- -------- -------- --------  ................\n"
-"    10000080 -------- -------- -------- --------  ................\n"
-"    10000090 -------- -------- -------- --------  ................\n"
-"    100000a0 -------- -------- -------- --------  ................\n"
-"    100000b0 -------- -------- -------- --------  ................\n"
-"    100000c0 -------- -------- -------- --------  ................\n"
-"    100000d0 -------- -------- -------- --------  ................\n"
-"    100000e0 -------- -------- -------- --------  ................\n"
-"    100000f0 -------- -------- -------- --------  ................\n";
-#endif
-  ASSERT_STREQ(expected_dump, tombstone_contents.c_str());
+  ASSERT_STREQ("", tombstone_contents.c_str());
 
   // Verify that the log buf is empty, and no error messages.
   ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -744,44 +652,7 @@
   std::string tombstone_contents;
   ASSERT_TRUE(lseek(log_.tfd, 0, SEEK_SET) == 0);
   ASSERT_TRUE(android::base::ReadFdToString(log_.tfd, &tombstone_contents));
-  const char* expected_dump = \
-"\nmemory near r4:\n"
-#if defined(__LP64__)
-"    0000000010000f00 ---------------- ----------------  ................\n"
-"    0000000010000f10 ---------------- ----------------  ................\n"
-"    0000000010000f20 ---------------- ----------------  ................\n"
-"    0000000010000f30 ---------------- ----------------  ................\n"
-"    0000000010000f40 ---------------- ----------------  ................\n"
-"    0000000010000f50 ---------------- ----------------  ................\n"
-"    0000000010000f60 ---------------- ----------------  ................\n"
-"    0000000010000f70 ---------------- ----------------  ................\n"
-"    0000000010000f80 ---------------- ----------------  ................\n"
-"    0000000010000f90 ---------------- ----------------  ................\n"
-"    0000000010000fa0 ---------------- ----------------  ................\n"
-"    0000000010000fb0 ---------------- ----------------  ................\n"
-"    0000000010000fc0 ---------------- ----------------  ................\n"
-"    0000000010000fd0 ---------------- ----------------  ................\n"
-"    0000000010000fe0 ---------------- ----------------  ................\n"
-"    0000000010000ff0 ---------------- ----------------  ................\n";
-#else
-"    10000f00 -------- -------- -------- --------  ................\n"
-"    10000f10 -------- -------- -------- --------  ................\n"
-"    10000f20 -------- -------- -------- --------  ................\n"
-"    10000f30 -------- -------- -------- --------  ................\n"
-"    10000f40 -------- -------- -------- --------  ................\n"
-"    10000f50 -------- -------- -------- --------  ................\n"
-"    10000f60 -------- -------- -------- --------  ................\n"
-"    10000f70 -------- -------- -------- --------  ................\n"
-"    10000f80 -------- -------- -------- --------  ................\n"
-"    10000f90 -------- -------- -------- --------  ................\n"
-"    10000fa0 -------- -------- -------- --------  ................\n"
-"    10000fb0 -------- -------- -------- --------  ................\n"
-"    10000fc0 -------- -------- -------- --------  ................\n"
-"    10000fd0 -------- -------- -------- --------  ................\n"
-"    10000fe0 -------- -------- -------- --------  ................\n"
-"    10000ff0 -------- -------- -------- --------  ................\n";
-#endif
-  ASSERT_STREQ(expected_dump, tombstone_contents.c_str());
+  ASSERT_STREQ("", tombstone_contents.c_str());
 
   // Verify that the log buf is empty, and no error messages.
   ASSERT_STREQ("", getFakeLogBuf().c_str());
diff --git a/debuggerd/libdebuggerd/test/tombstone_test.cpp b/debuggerd/libdebuggerd/test/tombstone_test.cpp
index eed95bc..b42d70c 100644
--- a/debuggerd/libdebuggerd/test/tombstone_test.cpp
+++ b/debuggerd/libdebuggerd/test/tombstone_test.cpp
@@ -359,19 +359,12 @@
   ASSERT_STREQ(expected.c_str(), amfd_data_.c_str());
 }
 
-TEST_F(TombstoneTest, dump_timestamp) {
-  setenv("TZ", "UTC", 1);
-  tzset();
-  dump_timestamp(&log_, 0);
-  ASSERT_STREQ("Timestamp: 1970-01-01 00:00:00+0000\n", amfd_data_.c_str());
-}
-
 class GwpAsanCrashDataTest : public GwpAsanCrashData {
 public:
   GwpAsanCrashDataTest(
       gwp_asan::Error error,
       const gwp_asan::AllocationMetadata *responsible_allocation) :
-      GwpAsanCrashData(nullptr, 0u, 0u, ThreadInfo{}) {
+      GwpAsanCrashData(nullptr, ProcessInfo{}, ThreadInfo{}) {
     is_gwp_asan_responsible_ = true;
     error_ = error;
     responsible_allocation_ = responsible_allocation;
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index fd52e81..185bd6e 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -36,13 +36,14 @@
 #include <string>
 
 #include <android-base/file.h>
-#include <android-base/logging.h>
 #include <android-base/properties.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
 #include <android/log.h>
+#include <async_safe/log.h>
 #include <log/log.h>
+#include <log/log_read.h>
 #include <log/logprint.h>
 #include <private/android_filesystem_config.h>
 #include <unwindstack/DexFiles.h>
@@ -55,11 +56,15 @@
 #include "libdebuggerd/backtrace.h"
 #include "libdebuggerd/gwp_asan.h"
 #include "libdebuggerd/open_files_list.h"
+#include "libdebuggerd/scudo.h"
 #include "libdebuggerd/utility.h"
+#include "util.h"
 
 #include "gwp_asan/common.h"
 #include "gwp_asan/crash_handler.h"
 
+#include "tombstone.pb.h"
+
 using android::base::GetBoolProperty;
 using android::base::GetProperty;
 using android::base::StringPrintf;
@@ -78,15 +83,6 @@
   _LOG(log, logtype::HEADER, "ABI: '%s'\n", ABI_STRING);
 }
 
-static void dump_timestamp(log_t* log, time_t time) {
-  struct tm tm;
-  localtime_r(&time, &tm);
-
-  char buf[strlen("1970-01-01 00:00:00+0830") + 1];
-  strftime(buf, sizeof(buf), "%F %T%z", &tm);
-  _LOG(log, logtype::HEADER, "Timestamp: %s\n", buf);
-}
-
 static std::string get_stack_overflow_cause(uint64_t fault_addr, uint64_t sp,
                                             unwindstack::Maps* maps) {
   static constexpr uint64_t kMaxDifferenceBytes = 256;
@@ -154,16 +150,18 @@
 }
 
 static void dump_signal_info(log_t* log, const ThreadInfo& thread_info,
-                             unwindstack::Memory* process_memory) {
+                             const ProcessInfo& process_info, unwindstack::Memory* process_memory) {
   char addr_desc[64];  // ", fault addr 0x1234"
-  if (signal_has_si_addr(thread_info.siginfo)) {
-    void* addr = thread_info.siginfo->si_addr;
+  if (process_info.has_fault_address) {
+    // SIGILL faults will never have tagged addresses, so okay to
+    // indiscriminately use the tagged address here.
+    size_t addr = process_info.maybe_tagged_fault_address;
     if (thread_info.siginfo->si_signo == SIGILL) {
       uint32_t instruction = {};
-      process_memory->Read(reinterpret_cast<uint64_t>(addr), &instruction, sizeof(instruction));
-      snprintf(addr_desc, sizeof(addr_desc), "%p (*pc=%#08x)", addr, instruction);
+      process_memory->Read(addr, &instruction, sizeof(instruction));
+      snprintf(addr_desc, sizeof(addr_desc), "0x%zx (*pc=%#08x)", addr, instruction);
     } else {
-      snprintf(addr_desc, sizeof(addr_desc), "%p", addr);
+      snprintf(addr_desc, sizeof(addr_desc), "0x%zx", addr);
     }
   } else {
     snprintf(addr_desc, sizeof(addr_desc), "--------");
@@ -180,23 +178,21 @@
 }
 
 static void dump_thread_info(log_t* log, const ThreadInfo& thread_info) {
-  // Blacklist logd, logd.reader, logd.writer, logd.auditd, logd.control ...
-  // TODO: Why is this controlled by thread name?
-  if (thread_info.thread_name == "logd" ||
-      android::base::StartsWith(thread_info.thread_name, "logd.")) {
-    log->should_retrieve_logcat = false;
-  }
+  // Don't try to collect logs from the threads that implement the logging system itself.
+  if (thread_info.uid == AID_LOGD) log->should_retrieve_logcat = false;
 
   _LOG(log, logtype::HEADER, "pid: %d, tid: %d, name: %s  >>> %s <<<\n", thread_info.pid,
        thread_info.tid, thread_info.thread_name.c_str(), thread_info.process_name.c_str());
   _LOG(log, logtype::HEADER, "uid: %d\n", thread_info.uid);
+  if (thread_info.tagged_addr_ctrl != -1) {
+    _LOG(log, logtype::HEADER, "tagged_addr_ctrl: %016lx\n", thread_info.tagged_addr_ctrl);
+  }
 }
 
 static std::string get_addr_string(uint64_t addr) {
   std::string addr_str;
 #if defined(__LP64__)
-  addr_str = StringPrintf("%08x'%08x",
-                          static_cast<uint32_t>(addr >> 32),
+  addr_str = StringPrintf("%08x'%08x", static_cast<uint32_t>(addr >> 32),
                           static_cast<uint32_t>(addr & 0xffffffff));
 #else
   addr_str = StringPrintf("%08x", static_cast<uint32_t>(addr));
@@ -376,8 +372,7 @@
 }
 
 static bool dump_thread(log_t* log, unwindstack::Unwinder* unwinder, const ThreadInfo& thread_info,
-                        uint64_t abort_msg_address, bool primary_thread,
-                        const GwpAsanCrashData& gwp_asan_crash_data) {
+                        const ProcessInfo& process_info, bool primary_thread) {
   log->current_tid = thread_info.tid;
   if (!primary_thread) {
     _LOG(log, logtype::THREAD, "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n");
@@ -385,18 +380,26 @@
   dump_thread_info(log, thread_info);
 
   if (thread_info.siginfo) {
-    dump_signal_info(log, thread_info, unwinder->GetProcessMemory().get());
+    dump_signal_info(log, thread_info, process_info, unwinder->GetProcessMemory().get());
   }
 
-  if (primary_thread && gwp_asan_crash_data.CrashIsMine()) {
-    gwp_asan_crash_data.DumpCause(log);
-  } else if (thread_info.siginfo) {
-    dump_probable_cause(log, thread_info.siginfo, unwinder->GetMaps(),
-                        thread_info.registers.get());
+  std::unique_ptr<GwpAsanCrashData> gwp_asan_crash_data;
+  std::unique_ptr<ScudoCrashData> scudo_crash_data;
+  if (primary_thread) {
+    gwp_asan_crash_data = std::make_unique<GwpAsanCrashData>(unwinder->GetProcessMemory().get(),
+                                                             process_info, thread_info);
+    scudo_crash_data =
+        std::make_unique<ScudoCrashData>(unwinder->GetProcessMemory().get(), process_info);
+  }
+
+  if (primary_thread && gwp_asan_crash_data->CrashIsMine()) {
+    gwp_asan_crash_data->DumpCause(log);
+  } else if (thread_info.siginfo && !(primary_thread && scudo_crash_data->CrashIsMine())) {
+    dump_probable_cause(log, thread_info.siginfo, unwinder->GetMaps(), thread_info.registers.get());
   }
 
   if (primary_thread) {
-    dump_abort_message(log, unwinder->GetProcessMemory().get(), abort_msg_address);
+    dump_abort_message(log, unwinder->GetProcessMemory().get(), process_info.abort_msg_address);
   }
 
   dump_registers(log, thread_info.registers.get());
@@ -406,29 +409,34 @@
   unwinder->SetRegs(regs_copy.get());
   unwinder->Unwind();
   if (unwinder->NumFrames() == 0) {
-    _LOG(log, logtype::THREAD, "Failed to unwind");
+    _LOG(log, logtype::THREAD, "Failed to unwind\n");
+    if (unwinder->LastErrorCode() != unwindstack::ERROR_NONE) {
+      _LOG(log, logtype::THREAD, "  Error code: %s\n", unwinder->LastErrorCodeString());
+      _LOG(log, logtype::THREAD, "  Error address: 0x%" PRIx64 "\n", unwinder->LastErrorAddress());
+    }
   } else {
     _LOG(log, logtype::BACKTRACE, "\nbacktrace:\n");
     log_backtrace(log, unwinder, "    ");
   }
 
   if (primary_thread) {
-    if (gwp_asan_crash_data.HasDeallocationTrace()) {
-      gwp_asan_crash_data.DumpDeallocationTrace(log, unwinder);
+    if (gwp_asan_crash_data->HasDeallocationTrace()) {
+      gwp_asan_crash_data->DumpDeallocationTrace(log, unwinder);
     }
 
-    if (gwp_asan_crash_data.HasAllocationTrace()) {
-      gwp_asan_crash_data.DumpAllocationTrace(log, unwinder);
+    if (gwp_asan_crash_data->HasAllocationTrace()) {
+      gwp_asan_crash_data->DumpAllocationTrace(log, unwinder);
     }
 
+    scudo_crash_data->DumpCause(log, unwinder);
+
     unwindstack::Maps* maps = unwinder->GetMaps();
     dump_memory_and_code(log, maps, unwinder->GetProcessMemory().get(),
                          thread_info.registers.get());
     if (maps != nullptr) {
       uint64_t addr = 0;
-      siginfo_t* si = thread_info.siginfo;
-      if (signal_has_si_addr(si)) {
-        addr = reinterpret_cast<uint64_t>(si->si_addr);
+      if (process_info.has_fault_address) {
+        addr = process_info.untagged_fault_address;
       }
       dump_all_maps(log, unwinder, addr);
     }
@@ -442,8 +450,6 @@
 // that don't match the specified pid, and writes them to the tombstone file.
 //
 // If "tail" is non-zero, log the last "tail" number of lines.
-static EventTagMap* g_eventTagMap = NULL;
-
 static void dump_log_file(log_t* log, pid_t pid, const char* filename, unsigned int tail) {
   bool first = true;
   logger_list* logger_list;
@@ -452,8 +458,8 @@
     return;
   }
 
-  logger_list = android_logger_list_open(
-      android_name_to_log_id(filename), ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, tail, pid);
+  logger_list =
+      android_logger_list_open(android_name_to_log_id(filename), ANDROID_LOG_NONBLOCK, tail, pid);
 
   if (!logger_list) {
     ALOGE("Unable to open %s: %s\n", filename, strerror(errno));
@@ -486,8 +492,7 @@
     // the tombstone file.
 
     if (first) {
-      _LOG(log, logtype::LOGS, "--------- %slog %s\n",
-        tail ? "tail end of " : "", filename);
+      _LOG(log, logtype::LOGS, "--------- %slog %s\n", tail ? "tail end of " : "", filename);
       first = false;
     }
 
@@ -497,25 +502,9 @@
     // (although in this case the pid is redundant).
     char timeBuf[32];
     time_t sec = static_cast<time_t>(log_entry.entry.sec);
-    struct tm tmBuf;
-    struct tm* ptm;
-    ptm = localtime_r(&sec, &tmBuf);
-    strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", ptm);
-
-    if (log_entry.id() == LOG_ID_EVENTS) {
-      if (!g_eventTagMap) {
-        g_eventTagMap = android_openEventTagMap(nullptr);
-      }
-      AndroidLogEntry e;
-      char buf[512];
-      if (android_log_processBinaryLogBuffer(&log_entry.entry, &e, g_eventTagMap, buf,
-                                             sizeof(buf)) == 0) {
-        _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8.*s: %s\n", timeBuf,
-             log_entry.entry.nsec / 1000000, log_entry.entry.pid, log_entry.entry.tid, 'I',
-             (int)e.tagLen, e.tag, e.message);
-      }
-      continue;
-    }
+    tm tm;
+    localtime_r(&sec, &tm);
+    strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", &tm);
 
     char* msg = log_entry.msg();
     if (msg == nullptr) {
@@ -564,8 +553,8 @@
   dump_log_file(log, pid, "main", tail);
 }
 
-void engrave_tombstone_ucontext(int tombstone_fd, uint64_t abort_msg_address, siginfo_t* siginfo,
-                                ucontext_t* ucontext) {
+void engrave_tombstone_ucontext(int tombstone_fd, int proto_fd, uint64_t abort_msg_address,
+                                siginfo_t* siginfo, ucontext_t* ucontext) {
   pid_t uid = getuid();
   pid_t pid = getpid();
   pid_t tid = gettid();
@@ -576,42 +565,53 @@
   log.tfd = tombstone_fd;
   log.amfd_data = nullptr;
 
-  char thread_name[16];
-  char process_name[128];
-
-  read_with_default("/proc/self/comm", thread_name, sizeof(thread_name), "<unknown>");
-  read_with_default("/proc/self/cmdline", process_name, sizeof(process_name), "<unknown>");
+  std::string thread_name = get_thread_name(tid);
+  std::string process_name = get_process_name(pid);
 
   std::unique_ptr<unwindstack::Regs> regs(
       unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), ucontext));
 
+  std::string selinux_label;
+  android::base::ReadFileToString("/proc/self/attr/current", &selinux_label);
+
   std::map<pid_t, ThreadInfo> threads;
-  threads[gettid()] = ThreadInfo{
+  threads[tid] = ThreadInfo{
       .registers = std::move(regs),
       .uid = uid,
       .tid = tid,
-      .thread_name = thread_name,
+      .thread_name = std::move(thread_name),
       .pid = pid,
-      .process_name = process_name,
+      .process_name = std::move(process_name),
+      .selinux_label = std::move(selinux_label),
       .siginfo = siginfo,
   };
 
-  unwindstack::UnwinderFromPid unwinder(kMaxFrames, pid);
-  if (!unwinder.Init(unwindstack::Regs::CurrentArch())) {
-    LOG(FATAL) << "Failed to init unwinder object.";
+  unwindstack::UnwinderFromPid unwinder(kMaxFrames, pid, unwindstack::Regs::CurrentArch());
+  if (!unwinder.Init()) {
+    async_safe_fatal("failed to init unwinder object");
   }
 
-  engrave_tombstone(unique_fd(dup(tombstone_fd)), &unwinder, threads, tid, abort_msg_address,
-                    nullptr, nullptr, 0u, 0u);
+  ProcessInfo process_info;
+  unique_fd attr_fd(open("/proc/self/attr/current", O_RDONLY | O_CLOEXEC));
+  process_info.abort_msg_address = abort_msg_address;
+  engrave_tombstone(unique_fd(dup(tombstone_fd)), unique_fd(dup(proto_fd)), &unwinder, threads, tid,
+                    process_info, nullptr, nullptr);
 }
 
-void engrave_tombstone(unique_fd output_fd, unwindstack::Unwinder* unwinder,
+void engrave_tombstone(unique_fd output_fd, unique_fd proto_fd, unwindstack::Unwinder* unwinder,
                        const std::map<pid_t, ThreadInfo>& threads, pid_t target_thread,
-                       uint64_t abort_msg_address, OpenFilesList* open_files,
-                       std::string* amfd_data, uintptr_t gwp_asan_state_ptr,
-                       uintptr_t gwp_asan_metadata_ptr) {
-  // don't copy log messages to tombstone unless this is a dev device
-  bool want_logs = android::base::GetBoolProperty("ro.debuggable", false);
+                       const ProcessInfo& process_info, OpenFilesList* open_files,
+                       std::string* amfd_data) {
+  // Don't copy log messages to tombstone unless this is a development device.
+  Tombstone tombstone;
+  engrave_tombstone_proto(&tombstone, unwinder, threads, target_thread, process_info, open_files);
+
+  if (proto_fd != -1) {
+    if (!tombstone.SerializeToFileDescriptor(proto_fd.get())) {
+      async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to write proto tombstone: %s",
+                            strerror(errno));
+    }
+  }
 
   log_t log;
   log.current_tid = target_thread;
@@ -619,40 +619,45 @@
   log.tfd = output_fd.get();
   log.amfd_data = amfd_data;
 
-  _LOG(&log, logtype::HEADER, "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
-  dump_header_info(&log);
-  dump_timestamp(&log, time(nullptr));
+  bool translate_proto = GetBoolProperty("debug.debuggerd.translate_proto_to_text", false);
+  if (translate_proto) {
+    tombstone_proto_to_text(tombstone, [&log](const std::string& line, bool should_log) {
+      _LOG(&log, should_log ? logtype::HEADER : logtype::LOGS, "%s\n", line.c_str());
+    });
+  } else {
+    bool want_logs = GetBoolProperty("ro.debuggable", false);
 
-  auto it = threads.find(target_thread);
-  if (it == threads.end()) {
-    LOG(FATAL) << "failed to find target thread";
-  }
+    _LOG(&log, logtype::HEADER,
+         "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
+    dump_header_info(&log);
+    _LOG(&log, logtype::HEADER, "Timestamp: %s\n", get_timestamp().c_str());
 
-  GwpAsanCrashData gwp_asan_crash_data(unwinder->GetProcessMemory().get(),
-                                       gwp_asan_state_ptr,
-                                       gwp_asan_metadata_ptr, it->second);
-
-  dump_thread(&log, unwinder, it->second, abort_msg_address, true,
-              gwp_asan_crash_data);
-
-  if (want_logs) {
-    dump_logs(&log, it->second.pid, 50);
-  }
-
-  for (auto& [tid, thread_info] : threads) {
-    if (tid == target_thread) {
-      continue;
+    auto it = threads.find(target_thread);
+    if (it == threads.end()) {
+      async_safe_fatal("failed to find target thread");
     }
 
-    dump_thread(&log, unwinder, thread_info, 0, false, gwp_asan_crash_data);
-  }
+    dump_thread(&log, unwinder, it->second, process_info, true);
 
-  if (open_files) {
-    _LOG(&log, logtype::OPEN_FILES, "\nopen files:\n");
-    dump_open_files_list(&log, *open_files, "    ");
-  }
+    if (want_logs) {
+      dump_logs(&log, it->second.pid, 50);
+    }
 
-  if (want_logs) {
-    dump_logs(&log, it->second.pid, 0);
+    for (auto& [tid, thread_info] : threads) {
+      if (tid == target_thread) {
+        continue;
+      }
+
+      dump_thread(&log, unwinder, thread_info, process_info, false);
+    }
+
+    if (open_files) {
+      _LOG(&log, logtype::OPEN_FILES, "\nopen files:\n");
+      dump_open_files_list(&log, *open_files, "    ");
+    }
+
+    if (want_logs) {
+      dump_logs(&log, it->second.pid, 0);
+    }
   }
 }
diff --git a/debuggerd/libdebuggerd/tombstone_proto.cpp b/debuggerd/libdebuggerd/tombstone_proto.cpp
new file mode 100644
index 0000000..bb3c7ea
--- /dev/null
+++ b/debuggerd/libdebuggerd/tombstone_proto.cpp
@@ -0,0 +1,488 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#define LOG_TAG "DEBUG"
+
+#include "libdebuggerd/tombstone.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <time.h>
+
+#include <memory>
+#include <string>
+
+#include <async_safe/log.h>
+
+#include <android-base/properties.h>
+#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
+#include <android-base/unique_fd.h>
+
+#include <android/log.h>
+#include <log/log.h>
+#include <log/log_read.h>
+#include <log/logprint.h>
+#include <private/android_filesystem_config.h>
+
+#include <unwindstack/Maps.h>
+#include <unwindstack/Memory.h>
+#include <unwindstack/Regs.h>
+#include <unwindstack/Unwinder.h>
+
+#include "libdebuggerd/open_files_list.h"
+#include "libdebuggerd/utility.h"
+#include "util.h"
+
+#include "tombstone.pb.h"
+
+using android::base::StringPrintf;
+
+// Use the demangler from libc++.
+extern "C" char* __cxa_demangle(const char*, char*, size_t*, int* status);
+
+static Architecture get_arch() {
+#if defined(__arm__)
+  return Architecture::ARM32;
+#elif defined(__aarch64__)
+  return Architecture::ARM64;
+#elif defined(__i386__)
+  return Architecture::X86;
+#elif defined(__x86_64__)
+  return Architecture::X86_64;
+#else
+#error Unknown architecture!
+#endif
+}
+
+static std::optional<std::string> get_stack_overflow_cause(uint64_t fault_addr, uint64_t sp,
+                                                           unwindstack::Maps* maps) {
+  static constexpr uint64_t kMaxDifferenceBytes = 256;
+  uint64_t difference;
+  if (sp >= fault_addr) {
+    difference = sp - fault_addr;
+  } else {
+    difference = fault_addr - sp;
+  }
+  if (difference <= kMaxDifferenceBytes) {
+    // The faulting address is close to the current sp, check if the sp
+    // indicates a stack overflow.
+    // On arm, the sp does not get updated when the instruction faults.
+    // In this case, the sp will still be in a valid map, which is the
+    // last case below.
+    // On aarch64, the sp does get updated when the instruction faults.
+    // In this case, the sp will be in either an invalid map if triggered
+    // on the main thread, or in a guard map if in another thread, which
+    // will be the first case or second case from below.
+    unwindstack::MapInfo* map_info = maps->Find(sp);
+    if (map_info == nullptr) {
+      return "stack pointer is in a non-existent map; likely due to stack overflow.";
+    } else if ((map_info->flags & (PROT_READ | PROT_WRITE)) != (PROT_READ | PROT_WRITE)) {
+      return "stack pointer is not in a rw map; likely due to stack overflow.";
+    } else if ((sp - map_info->start) <= kMaxDifferenceBytes) {
+      return "stack pointer is close to top of stack; likely stack overflow.";
+    }
+  }
+  return {};
+}
+
+static void dump_probable_cause(Tombstone* tombstone, const siginfo_t* si, unwindstack::Maps* maps,
+                                unwindstack::Regs* regs) {
+  std::optional<std::string> cause;
+  if (si->si_signo == SIGSEGV && si->si_code == SEGV_MAPERR) {
+    if (si->si_addr < reinterpret_cast<void*>(4096)) {
+      cause = "null pointer dereference";
+    } else if (si->si_addr == reinterpret_cast<void*>(0xffff0ffc)) {
+      cause = "call to kuser_helper_version";
+    } else if (si->si_addr == reinterpret_cast<void*>(0xffff0fe0)) {
+      cause = "call to kuser_get_tls";
+    } else if (si->si_addr == reinterpret_cast<void*>(0xffff0fc0)) {
+      cause = "call to kuser_cmpxchg";
+    } else if (si->si_addr == reinterpret_cast<void*>(0xffff0fa0)) {
+      cause = "call to kuser_memory_barrier";
+    } else if (si->si_addr == reinterpret_cast<void*>(0xffff0f60)) {
+      cause = "call to kuser_cmpxchg64";
+    } else {
+      cause = get_stack_overflow_cause(reinterpret_cast<uint64_t>(si->si_addr), regs->sp(), maps);
+    }
+  } else if (si->si_signo == SIGSEGV && si->si_code == SEGV_ACCERR) {
+    uint64_t fault_addr = reinterpret_cast<uint64_t>(si->si_addr);
+    unwindstack::MapInfo* map_info = maps->Find(fault_addr);
+    if (map_info != nullptr && map_info->flags == PROT_EXEC) {
+      cause = "execute-only (no-read) memory access error; likely due to data in .text.";
+    } else {
+      cause = get_stack_overflow_cause(fault_addr, regs->sp(), maps);
+    }
+  } else if (si->si_signo == SIGSYS && si->si_code == SYS_SECCOMP) {
+    cause = StringPrintf("seccomp prevented call to disallowed %s system call %d", ABI_STRING,
+                         si->si_syscall);
+  }
+
+  if (cause) {
+    tombstone->mutable_cause()->set_human_readable(*cause);
+  }
+}
+
+static void dump_abort_message(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
+                               const ProcessInfo& process_info) {
+  std::shared_ptr<unwindstack::Memory> process_memory = unwinder->GetProcessMemory();
+  uintptr_t address = process_info.abort_msg_address;
+  if (address == 0) {
+    return;
+  }
+
+  size_t length;
+  if (!process_memory->ReadFully(address, &length, sizeof(length))) {
+    async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to read abort message header: %s",
+                          strerror(errno));
+    return;
+  }
+
+  // The length field includes the length of the length field itself.
+  if (length < sizeof(size_t)) {
+    async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG,
+                          "abort message header malformed: claimed length = %zu", length);
+    return;
+  }
+
+  length -= sizeof(size_t);
+
+  // The abort message should be null terminated already, but reserve a spot for NUL just in case.
+  std::string msg;
+  msg.resize(length);
+
+  if (!process_memory->ReadFully(address + sizeof(length), &msg[0], length)) {
+    async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to read abort message header: %s",
+                          strerror(errno));
+    return;
+  }
+
+  tombstone->set_abort_message(msg);
+}
+
+static void dump_open_fds(Tombstone* tombstone, const OpenFilesList* open_files) {
+  if (open_files) {
+    for (auto& [fd, entry] : *open_files) {
+      FD f;
+
+      f.set_fd(fd);
+
+      const std::optional<std::string>& path = entry.path;
+      if (path) {
+        f.set_path(*path);
+      }
+
+      const std::optional<uint64_t>& fdsan_owner = entry.fdsan_owner;
+      if (fdsan_owner) {
+        const char* type = android_fdsan_get_tag_type(*fdsan_owner);
+        uint64_t value = android_fdsan_get_tag_value(*fdsan_owner);
+        f.set_owner(type);
+        f.set_tag(value);
+      }
+
+      *tombstone->add_open_fds() = f;
+    }
+  }
+}
+
+static void dump_thread(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
+                        const ThreadInfo& thread_info, bool memory_dump = false) {
+  Thread thread;
+
+  thread.set_id(thread_info.tid);
+  thread.set_name(thread_info.thread_name);
+
+  unwindstack::Maps* maps = unwinder->GetMaps();
+  unwindstack::Memory* memory = unwinder->GetProcessMemory().get();
+
+  thread_info.registers->IterateRegisters(
+      [&thread, memory_dump, maps, memory](const char* name, uint64_t value) {
+        Register r;
+        r.set_name(name);
+        r.set_u64(value);
+        *thread.add_registers() = r;
+
+        if (memory_dump) {
+          MemoryDump dump;
+
+          char buf[256];
+          size_t start_offset = 0;
+          ssize_t bytes = dump_memory(buf, sizeof(buf), &start_offset, &value, memory);
+          if (bytes == -1) {
+            return;
+          }
+
+          dump.set_register_name(name);
+
+          unwindstack::MapInfo* map_info = maps->Find(value);
+          if (map_info) {
+            dump.set_mapping_name(map_info->name);
+          }
+
+          dump.set_begin_address(value);
+
+          if (start_offset + bytes > sizeof(buf)) {
+            async_safe_fatal("dump_memory overflowed? start offset = %zu, bytes read = %zd",
+                             start_offset, bytes);
+          }
+
+          dump.set_memory(buf, start_offset + bytes);
+
+          *thread.add_memory_dump() = std::move(dump);
+        }
+      });
+
+  std::unique_ptr<unwindstack::Regs> regs_copy(thread_info.registers->Clone());
+  unwinder->SetRegs(regs_copy.get());
+  unwinder->Unwind();
+  if (unwinder->NumFrames() == 0) {
+    async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "failed to unwind");
+    if (unwinder->LastErrorCode() != unwindstack::ERROR_NONE) {
+      async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "  error code: %s",
+                            unwinder->LastErrorCodeString());
+      async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG, "  error address: 0x%" PRIx64,
+                            unwinder->LastErrorAddress());
+    }
+  } else {
+    unwinder->SetDisplayBuildID(true);
+    for (const auto& frame : unwinder->frames()) {
+      BacktraceFrame* f = thread.add_current_backtrace();
+      f->set_rel_pc(frame.rel_pc);
+      f->set_pc(frame.pc);
+      f->set_sp(frame.sp);
+
+      if (!frame.function_name.empty()) {
+        // TODO: Should this happen here, or on the display side?
+        char* demangled_name =
+            __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, nullptr);
+        if (demangled_name) {
+          f->set_function_name(demangled_name);
+          free(demangled_name);
+        } else {
+          f->set_function_name(frame.function_name);
+        }
+      }
+
+      f->set_function_offset(frame.function_offset);
+
+      if (frame.map_start == frame.map_end) {
+        // No valid map associated with this frame.
+        f->set_file_name("<unknown>");
+      } else if (!frame.map_name.empty()) {
+        f->set_file_name(frame.map_name);
+      } else {
+        f->set_file_name(StringPrintf("<anonymous:%" PRIx64 ">", frame.map_start));
+      }
+
+      f->set_file_map_offset(frame.map_elf_start_offset);
+
+      unwindstack::MapInfo* map_info = maps->Find(frame.map_start);
+      if (map_info) {
+        f->set_build_id(map_info->GetPrintableBuildID());
+      }
+    }
+  }
+
+  auto& threads = *tombstone->mutable_threads();
+  threads[thread_info.tid] = thread;
+}
+
+static void dump_main_thread(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
+                             const ThreadInfo& thread_info) {
+  dump_thread(tombstone, unwinder, thread_info, true);
+}
+
+static void dump_mappings(Tombstone* tombstone, unwindstack::Unwinder* unwinder) {
+  unwindstack::Maps* maps = unwinder->GetMaps();
+  std::shared_ptr<unwindstack::Memory> process_memory = unwinder->GetProcessMemory();
+
+  for (const auto& map_info : *maps) {
+    auto* map = tombstone->add_memory_mappings();
+    map->set_begin_address(map_info->start);
+    map->set_end_address(map_info->end);
+    map->set_offset(map_info->offset);
+
+    if (map_info->flags & PROT_READ) {
+      map->set_read(true);
+    }
+    if (map_info->flags & PROT_WRITE) {
+      map->set_write(true);
+    }
+    if (map_info->flags & PROT_EXEC) {
+      map->set_execute(true);
+    }
+
+    map->set_mapping_name(map_info->name);
+
+    std::string build_id = map_info->GetPrintableBuildID();
+    if (!build_id.empty()) {
+      map->set_build_id(build_id);
+    }
+
+    map->set_load_bias(map_info->GetLoadBias(process_memory));
+  }
+}
+
+static void dump_log_file(Tombstone* tombstone, const char* logger, pid_t pid) {
+  logger_list* logger_list =
+      android_logger_list_open(android_name_to_log_id(logger), ANDROID_LOG_NONBLOCK, 0, pid);
+
+  LogBuffer buffer;
+
+  while (true) {
+    log_msg log_entry;
+    ssize_t actual = android_logger_list_read(logger_list, &log_entry);
+
+    if (actual < 0) {
+      if (actual == -EINTR) {
+        // interrupted by signal, retry
+        continue;
+      }
+      if (actual == -EAGAIN) {
+        // non-blocking EOF; we're done
+        break;
+      } else {
+        break;
+      }
+    } else if (actual == 0) {
+      break;
+    }
+
+    char timestamp_secs[32];
+    time_t sec = static_cast<time_t>(log_entry.entry.sec);
+    tm tm;
+    localtime_r(&sec, &tm);
+    strftime(timestamp_secs, sizeof(timestamp_secs), "%m-%d %H:%M:%S", &tm);
+    std::string timestamp =
+        StringPrintf("%s.%03d", timestamp_secs, log_entry.entry.nsec / 1'000'000);
+
+    // Msg format is: <priority:1><tag:N>\0<message:N>\0
+    char* msg = log_entry.msg();
+    if (msg == nullptr) {
+      continue;
+    }
+
+    unsigned char prio = msg[0];
+    char* tag = msg + 1;
+    msg = tag + strlen(tag) + 1;
+
+    // consume any trailing newlines
+    char* nl = msg + strlen(msg) - 1;
+    while (nl >= msg && *nl == '\n') {
+      *nl-- = '\0';
+    }
+
+    // Look for line breaks ('\n') and display each text line
+    // on a separate line, prefixed with the header, like logcat does.
+    do {
+      nl = strchr(msg, '\n');
+      if (nl != nullptr) {
+        *nl = '\0';
+        ++nl;
+      }
+
+      LogMessage* log_msg = buffer.add_logs();
+      log_msg->set_timestamp(timestamp);
+      log_msg->set_pid(log_entry.entry.pid);
+      log_msg->set_tid(log_entry.entry.tid);
+      log_msg->set_priority(prio);
+      log_msg->set_tag(tag);
+      log_msg->set_message(msg);
+    } while ((msg = nl));
+  }
+  android_logger_list_free(logger_list);
+
+  if (!buffer.logs().empty()) {
+    buffer.set_name(logger);
+    *tombstone->add_log_buffers() = std::move(buffer);
+  }
+}
+
+static void dump_logcat(Tombstone* tombstone, pid_t pid) {
+  dump_log_file(tombstone, "system", pid);
+  dump_log_file(tombstone, "main", pid);
+}
+
+void engrave_tombstone_proto(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
+                             const std::map<pid_t, ThreadInfo>& threads, pid_t target_thread,
+                             const ProcessInfo& process_info, const OpenFilesList* open_files) {
+  Tombstone result;
+
+  result.set_arch(get_arch());
+  result.set_build_fingerprint(android::base::GetProperty("ro.build.fingerprint", "unknown"));
+  result.set_revision(android::base::GetProperty("ro.revision", "unknown"));
+  result.set_timestamp(get_timestamp());
+
+  const ThreadInfo& main_thread = threads.at(target_thread);
+  result.set_pid(main_thread.pid);
+  result.set_tid(main_thread.tid);
+  result.set_uid(main_thread.uid);
+  result.set_selinux_label(main_thread.selinux_label);
+
+  result.set_process_name(main_thread.process_name);
+  if (!main_thread.siginfo) {
+    async_safe_fatal("siginfo missing");
+  }
+
+  Signal sig;
+  sig.set_number(main_thread.signo);
+  sig.set_name(get_signame(main_thread.siginfo));
+  sig.set_code(main_thread.siginfo->si_code);
+  sig.set_code_name(get_sigcode(main_thread.siginfo));
+
+  if (signal_has_sender(main_thread.siginfo, main_thread.pid)) {
+    sig.set_has_sender(true);
+    sig.set_sender_uid(main_thread.siginfo->si_uid);
+    sig.set_sender_pid(main_thread.siginfo->si_pid);
+  }
+
+  if (process_info.has_fault_address) {
+    sig.set_has_fault_address(true);
+    sig.set_fault_address(process_info.untagged_fault_address);
+  }
+
+  *result.mutable_signal_info() = sig;
+
+  dump_abort_message(&result, unwinder, process_info);
+
+  dump_main_thread(&result, unwinder, main_thread);
+
+  for (const auto& [tid, thread_info] : threads) {
+    if (tid != target_thread) {
+      dump_thread(&result, unwinder, thread_info);
+    }
+  }
+
+  dump_probable_cause(&result, main_thread.siginfo, unwinder->GetMaps(),
+                      main_thread.registers.get());
+
+  dump_mappings(&result, unwinder);
+
+  // Only dump logs on debuggable devices.
+  if (android::base::GetBoolProperty("ro.debuggable", false)) {
+    dump_logcat(&result, main_thread.pid);
+  }
+
+  dump_open_fds(&result, open_files);
+
+  *tombstone = std::move(result);
+}
diff --git a/debuggerd/libdebuggerd/tombstone_proto_to_text.cpp b/debuggerd/libdebuggerd/tombstone_proto_to_text.cpp
new file mode 100644
index 0000000..187379d
--- /dev/null
+++ b/debuggerd/libdebuggerd/tombstone_proto_to_text.cpp
@@ -0,0 +1,360 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <libdebuggerd/tombstone.h>
+
+#include <inttypes.h>
+
+#include <functional>
+#include <set>
+#include <string>
+#include <unordered_set>
+#include <utility>
+#include <vector>
+
+#include <android-base/stringprintf.h>
+#include <android-base/unique_fd.h>
+#include <async_safe/log.h>
+
+#include "tombstone.pb.h"
+
+using android::base::StringAppendF;
+using android::base::StringPrintf;
+
+#define CB(log, ...) callback(StringPrintf(__VA_ARGS__), log)
+#define CBL(...) CB(true, __VA_ARGS__)
+#define CBS(...) CB(false, __VA_ARGS__)
+using CallbackType = std::function<void(const std::string& line, bool should_log)>;
+
+static const char* abi_string(const Tombstone& tombstone) {
+  switch (tombstone.arch()) {
+    case Architecture::ARM32:
+      return "arm";
+    case Architecture::ARM64:
+      return "arm64";
+    case Architecture::X86:
+      return "x86";
+    case Architecture::X86_64:
+      return "x86_64";
+    default:
+      return "<unknown>";
+  }
+}
+
+static int pointer_width(const Tombstone& tombstone) {
+  switch (tombstone.arch()) {
+    case Architecture::ARM32:
+      return 4;
+    case Architecture::ARM64:
+      return 8;
+    case Architecture::X86:
+      return 4;
+    case Architecture::X86_64:
+      return 8;
+    default:
+      return 8;
+  }
+}
+
+static void print_thread_header(CallbackType callback, const Tombstone& tombstone,
+                                const Thread& thread, bool should_log) {
+  CB(should_log, "pid: %d, tid: %d, name: %s  >>> %s <<<", tombstone.pid(), thread.id(),
+     thread.name().c_str(), tombstone.process_name().c_str());
+  CB(should_log, "uid: %d", tombstone.uid());
+}
+
+static void print_register_row(CallbackType callback, int word_size,
+                               std::vector<std::pair<std::string, uint64_t>> row, bool should_log) {
+  std::string output = "  ";
+  for (const auto& [name, value] : row) {
+    output += android::base::StringPrintf("  %-3s %0*" PRIx64, name.c_str(), 2 * word_size,
+                                          static_cast<uint64_t>(value));
+  }
+  callback(output, should_log);
+}
+
+static void print_thread_registers(CallbackType callback, const Tombstone& tombstone,
+                                   const Thread& thread, bool should_log) {
+  static constexpr size_t column_count = 4;
+  std::vector<std::pair<std::string, uint64_t>> current_row;
+  std::vector<std::pair<std::string, uint64_t>> special_row;
+  std::unordered_set<std::string> special_registers;
+
+  int word_size = pointer_width(tombstone);
+
+  switch (tombstone.arch()) {
+    case Architecture::ARM32:
+      special_registers = {"ip", "lr", "sp", "pc", "pst"};
+      break;
+
+    case Architecture::ARM64:
+      special_registers = {"ip", "lr", "sp", "pc", "pst"};
+      break;
+
+    case Architecture::X86:
+      special_registers = {"ebp", "esp", "eip"};
+      break;
+
+    case Architecture::X86_64:
+      special_registers = {"rbp", "rsp", "rip"};
+      break;
+
+    default:
+      async_safe_fatal("unknown architecture");
+  }
+
+  for (const auto& reg : thread.registers()) {
+    auto row = &current_row;
+    if (special_registers.count(reg.name()) == 1) {
+      row = &special_row;
+    }
+
+    row->emplace_back(reg.name(), reg.u64());
+    if (current_row.size() == column_count) {
+      print_register_row(callback, word_size, current_row, should_log);
+      current_row.clear();
+    }
+  }
+
+  if (!current_row.empty()) {
+    print_register_row(callback, word_size, current_row, should_log);
+  }
+
+  print_register_row(callback, word_size, special_row, should_log);
+}
+
+static void print_thread_backtrace(CallbackType callback, const Tombstone& tombstone,
+                                   const Thread& thread, bool should_log) {
+  CBS("");
+  CB(should_log, "backtrace:");
+  int index = 0;
+  for (const auto& frame : thread.current_backtrace()) {
+    std::string function;
+
+    if (!frame.function_name().empty()) {
+      function =
+          StringPrintf(" (%s+%" PRId64 ")", frame.function_name().c_str(), frame.function_offset());
+    }
+
+    std::string build_id;
+    if (!frame.build_id().empty()) {
+      build_id = StringPrintf(" (BuildId: %s)", frame.build_id().c_str());
+    }
+
+    CB(should_log, "      #%02d pc %0*" PRIx64 "  %s%s%s", index++, pointer_width(tombstone) * 2,
+       frame.rel_pc(), frame.file_name().c_str(), function.c_str(), build_id.c_str());
+  }
+}
+
+static void print_thread_memory_dump(CallbackType callback, const Tombstone& tombstone,
+                                     const Thread& thread) {
+  static constexpr size_t bytes_per_line = 16;
+  int word_size = pointer_width(tombstone);
+  for (const auto& mem : thread.memory_dump()) {
+    CBS("");
+    CBS("memory near %s (%s):", mem.register_name().c_str(), mem.mapping_name().c_str());
+    uint64_t addr = mem.begin_address();
+    for (size_t offset = 0; offset < mem.memory().size(); offset += bytes_per_line) {
+      std::string line = StringPrintf("    %0*" PRIx64, word_size * 2, addr + offset);
+
+      size_t bytes = std::min(bytes_per_line, mem.memory().size() - offset);
+      for (size_t i = 0; i < bytes; i += word_size) {
+        uint64_t word = 0;
+
+        // Assumes little-endian, but what doesn't?
+        memcpy(&word, mem.memory().data() + offset + i, word_size);
+
+        StringAppendF(&line, " %0*" PRIx64, word_size * 2, word);
+      }
+
+      char ascii[bytes_per_line + 1];
+
+      memset(ascii, '.', sizeof(ascii));
+      ascii[bytes_per_line] = '\0';
+
+      for (size_t i = 0; i < bytes; ++i) {
+        uint8_t byte = mem.memory()[offset + i];
+        if (byte >= 0x20 && byte < 0x7f) {
+          ascii[i] = byte;
+        }
+      }
+
+      CBS("%s  %s", line.c_str(), ascii);
+    }
+  }
+}
+
+static void print_thread(CallbackType callback, const Tombstone& tombstone, const Thread& thread) {
+  print_thread_header(callback, tombstone, thread, false);
+  print_thread_registers(callback, tombstone, thread, false);
+  print_thread_backtrace(callback, tombstone, thread, false);
+  print_thread_memory_dump(callback, tombstone, thread);
+}
+
+static void print_main_thread(CallbackType callback, const Tombstone& tombstone,
+                              const Thread& thread) {
+  print_thread_header(callback, tombstone, thread, true);
+
+  const Signal& signal_info = tombstone.signal_info();
+  std::string sender_desc;
+
+  if (signal_info.has_sender()) {
+    sender_desc =
+        StringPrintf(" from pid %d, uid %d", signal_info.sender_pid(), signal_info.sender_uid());
+  }
+
+  if (!tombstone.has_signal_info()) {
+    CBL("signal information missing");
+  } else {
+    std::string fault_addr_desc;
+    if (signal_info.has_fault_address()) {
+      fault_addr_desc = StringPrintf("0x%" PRIx64, signal_info.fault_address());
+    } else {
+      fault_addr_desc = "--------";
+    }
+
+    CBL("signal %d (%s), code %d (%s%s), fault addr %s", signal_info.number(),
+        signal_info.name().c_str(), signal_info.code(), signal_info.code_name().c_str(),
+        sender_desc.c_str(), fault_addr_desc.c_str());
+  }
+
+  if (tombstone.has_cause()) {
+    const Cause& cause = tombstone.cause();
+    CBL("Cause: %s", cause.human_readable().c_str());
+  }
+
+  if (!tombstone.abort_message().empty()) {
+    CBL("Abort message: '%s'", tombstone.abort_message().c_str());
+  }
+
+  print_thread_registers(callback, tombstone, thread, true);
+  print_thread_backtrace(callback, tombstone, thread, true);
+  print_thread_memory_dump(callback, tombstone, thread);
+
+  CBS("");
+  CBS("memory map (%d %s):", tombstone.memory_mappings().size(),
+      tombstone.memory_mappings().size() == 1 ? "entry" : "entries");
+  int word_size = pointer_width(tombstone);
+  const auto format_pointer = [word_size](uint64_t ptr) -> std::string {
+    if (word_size == 8) {
+      uint64_t top = ptr >> 32;
+      uint64_t bottom = ptr & 0xFFFFFFFF;
+      return StringPrintf("%08" PRIx64 "'%08" PRIx64, top, bottom);
+    }
+
+    return StringPrintf("%0*" PRIx64, word_size * 2, ptr);
+  };
+
+  for (const auto& map : tombstone.memory_mappings()) {
+    std::string line = "    ";
+    StringAppendF(&line, "%s-%s", format_pointer(map.begin_address()).c_str(),
+                  format_pointer(map.end_address() - 1).c_str());
+    StringAppendF(&line, " %s%s%s", map.read() ? "r" : "-", map.write() ? "w" : "-",
+                  map.execute() ? "x" : "-");
+    StringAppendF(&line, "  %8" PRIx64 "  %8" PRIx64, map.offset(),
+                  map.end_address() - map.begin_address());
+
+    if (!map.mapping_name().empty()) {
+      StringAppendF(&line, "  %s", map.mapping_name().c_str());
+
+      if (!map.build_id().empty()) {
+        StringAppendF(&line, " (BuildId: %s)", map.build_id().c_str());
+      }
+
+      if (map.load_bias() != 0) {
+        StringAppendF(&line, " (load bias 0x%" PRIx64 ")", map.load_bias());
+      }
+    }
+
+    CBS("%s", line.c_str());
+  }
+}
+
+void print_logs(CallbackType callback, const Tombstone& tombstone, int tail) {
+  for (const auto& buffer : tombstone.log_buffers()) {
+    if (tail) {
+      CBS("--------- tail end of log %s", buffer.name().c_str());
+    } else {
+      CBS("--------- log %s", buffer.name().c_str());
+    }
+
+    int begin = 0;
+    if (tail != 0) {
+      begin = std::max(0, buffer.logs().size() - tail);
+    }
+
+    for (int i = begin; i < buffer.logs().size(); ++i) {
+      const LogMessage& msg = buffer.logs(i);
+
+      static const char* kPrioChars = "!.VDIWEFS";
+      char priority = (msg.priority() < strlen(kPrioChars) ? kPrioChars[msg.priority()] : '?');
+      CBS("%s %5u %5u %c %-8s: %s", msg.timestamp().c_str(), msg.pid(), msg.tid(), priority,
+          msg.tag().c_str(), msg.message().c_str());
+    }
+  }
+}
+
+bool tombstone_proto_to_text(const Tombstone& tombstone, CallbackType callback) {
+  CBL("*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***");
+  CBL("Build fingerprint: '%s'", tombstone.build_fingerprint().c_str());
+  CBL("Revision: '%s'", tombstone.revision().c_str());
+  CBL("ABI: '%s'", abi_string(tombstone));
+  CBL("Timestamp: %s", tombstone.timestamp().c_str());
+
+  // Process header
+  const auto& threads = tombstone.threads();
+  auto main_thread_it = threads.find(tombstone.tid());
+  if (main_thread_it == threads.end()) {
+    CBL("failed to find entry for main thread in tombstone");
+    return false;
+  }
+
+  const auto& main_thread = main_thread_it->second;
+
+  print_main_thread(callback, tombstone, main_thread);
+
+  print_logs(callback, tombstone, 50);
+
+  // protobuf's map is unordered, so sort the keys first.
+  std::set<int> thread_ids;
+  for (const auto& [tid, _] : threads) {
+    if (tid != tombstone.tid()) {
+      thread_ids.insert(tid);
+    }
+  }
+
+  for (const auto& tid : thread_ids) {
+    CBS("--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---");
+    print_thread(callback, tombstone, threads.find(tid)->second);
+  }
+
+  if (tombstone.open_fds().size() > 0) {
+    CBS("");
+    CBS("open files:");
+    for (const auto& fd : tombstone.open_fds()) {
+      std::optional<std::string> owner;
+      if (!fd.owner().empty()) {
+        owner = StringPrintf("owned by %s 0x%" PRIx64, fd.owner().c_str(), fd.tag());
+      }
+
+      CBS("    fd %d: %s (%s)", fd.fd(), fd.path().c_str(), owner ? owner->c_str() : "unowned");
+    }
+  }
+
+  print_logs(callback, tombstone, 0);
+
+  return true;
+}
diff --git a/debuggerd/libdebuggerd/utility.cpp b/debuggerd/libdebuggerd/utility.cpp
index 0a1d2a4..f941990 100644
--- a/debuggerd/libdebuggerd/utility.cpp
+++ b/debuggerd/libdebuggerd/utility.cpp
@@ -30,11 +30,11 @@
 
 #include <string>
 
-#include <android-base/logging.h>
 #include <android-base/properties.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
+#include <async_safe/log.h>
 #include <bionic/reserved_signals.h>
 #include <debuggerd/handler.h>
 #include <log/log.h>
@@ -43,7 +43,6 @@
 
 using android::base::unique_fd;
 
-// Whitelist output desired in the logcat output.
 bool is_allowed_in_logcat(enum logtype ltype) {
   if ((ltype == HEADER)
    || (ltype == REGISTERS)
@@ -127,57 +126,56 @@
 #define MEMORY_BYTES_TO_DUMP 256
 #define MEMORY_BYTES_PER_LINE 16
 
-void dump_memory(log_t* log, unwindstack::Memory* memory, uint64_t addr, const std::string& label) {
-  // Align the address to sizeof(long) and start 32 bytes before the address.
-  addr &= ~(sizeof(long) - 1);
-  if (addr >= 4128) {
-    addr -= 32;
+ssize_t dump_memory(void* out, size_t len, size_t* start_offset, uint64_t* addr,
+                    unwindstack::Memory* memory) {
+  // Align the address to the number of bytes per line to avoid confusing memory tag output if
+  // memory is tagged and we start from a misaligned address. Start 32 bytes before the address.
+  *addr &= ~(MEMORY_BYTES_PER_LINE - 1);
+  if (*addr >= 4128) {
+    *addr -= 32;
   }
 
-  // Don't bother if the address looks too low, or looks too high.
-  if (addr < 4096 ||
-#if defined(__LP64__)
-      addr > 0x4000000000000000UL - MEMORY_BYTES_TO_DUMP) {
-#else
-      addr > 0xffff0000 - MEMORY_BYTES_TO_DUMP) {
-#endif
-    return;
+  // We don't want the address tag to appear in the addresses in the memory dump.
+  *addr = untag_address(*addr);
+
+  // Don't bother if the address would overflow, taking tag bits into account. Note that
+  // untag_address truncates to 32 bits on 32-bit platforms as a side effect of returning a
+  // uintptr_t, so this also checks for 32-bit overflow.
+  if (untag_address(*addr + MEMORY_BYTES_TO_DUMP - 1) < *addr) {
+    return -1;
   }
 
-  _LOG(log, logtype::MEMORY, "\n%s:\n", label.c_str());
+  memset(out, 0, len);
 
-  // Dump 256 bytes
-  uintptr_t data[MEMORY_BYTES_TO_DUMP/sizeof(uintptr_t)];
-  memset(data, 0, MEMORY_BYTES_TO_DUMP);
-  size_t bytes = memory->Read(addr, reinterpret_cast<uint8_t*>(data), sizeof(data));
+  size_t bytes = memory->Read(*addr, reinterpret_cast<uint8_t*>(out), len);
   if (bytes % sizeof(uintptr_t) != 0) {
     // This should never happen, but just in case.
     ALOGE("Bytes read %zu, is not a multiple of %zu", bytes, sizeof(uintptr_t));
     bytes &= ~(sizeof(uintptr_t) - 1);
   }
 
-  uint64_t start = 0;
+  *start_offset = 0;
   bool skip_2nd_read = false;
   if (bytes == 0) {
     // In this case, we might want to try another read at the beginning of
     // the next page only if it's within the amount of memory we would have
     // read.
     size_t page_size = sysconf(_SC_PAGE_SIZE);
-    start = ((addr + (page_size - 1)) & ~(page_size - 1)) - addr;
-    if (start == 0 || start >= MEMORY_BYTES_TO_DUMP) {
+    *start_offset = ((*addr + (page_size - 1)) & ~(page_size - 1)) - *addr;
+    if (*start_offset == 0 || *start_offset >= len) {
       skip_2nd_read = true;
     }
   }
 
-  if (bytes < MEMORY_BYTES_TO_DUMP && !skip_2nd_read) {
+  if (bytes < len && !skip_2nd_read) {
     // Try to do one more read. This could happen if a read crosses a map,
     // but the maps do not have any break between them. Or it could happen
     // if reading from an unreadable map, but the read would cross back
     // into a readable map. Only requires one extra read because a map has
     // to contain at least one page, and the total number of bytes to dump
     // is smaller than a page.
-    size_t bytes2 = memory->Read(addr + start + bytes, reinterpret_cast<uint8_t*>(data) + bytes,
-                                 sizeof(data) - bytes - start);
+    size_t bytes2 = memory->Read(*addr + *start_offset + bytes, static_cast<uint8_t*>(out) + bytes,
+                                 len - bytes - *start_offset);
     bytes += bytes2;
     if (bytes2 > 0 && bytes % sizeof(uintptr_t) != 0) {
       // This should never happen, but we'll try and continue any way.
@@ -186,6 +184,27 @@
     }
   }
 
+  // If we were unable to read anything, it probably means that the register doesn't contain a
+  // valid pointer.
+  if (bytes == 0) {
+    return -1;
+  }
+
+  return bytes;
+}
+
+void dump_memory(log_t* log, unwindstack::Memory* memory, uint64_t addr, const std::string& label) {
+  // Dump 256 bytes
+  uintptr_t data[MEMORY_BYTES_TO_DUMP / sizeof(uintptr_t)];
+  size_t start_offset = 0;
+
+  ssize_t bytes = dump_memory(data, sizeof(data), &start_offset, &addr, memory);
+  if (bytes == -1) {
+    return;
+  }
+
+  _LOG(log, logtype::MEMORY, "\n%s:\n", label.c_str());
+
   // Dump the code around memory as:
   //  addr             contents                           ascii
   //  0000000000008d34 ef000000e8bd0090 e1b00000512fff1e  ............../Q
@@ -194,15 +213,20 @@
   // words are of course presented differently.
   uintptr_t* data_ptr = data;
   size_t current = 0;
-  size_t total_bytes = start + bytes;
+  size_t total_bytes = start_offset + bytes;
   for (size_t line = 0; line < MEMORY_BYTES_TO_DUMP / MEMORY_BYTES_PER_LINE; line++) {
+    uint64_t tagged_addr = addr;
+    long tag = memory->ReadTag(addr);
+    if (tag >= 0) {
+      tagged_addr |= static_cast<uint64_t>(tag) << 56;
+    }
     std::string logline;
-    android::base::StringAppendF(&logline, "    %" PRIPTR, addr);
+    android::base::StringAppendF(&logline, "    %" PRIPTR, tagged_addr);
 
     addr += MEMORY_BYTES_PER_LINE;
     std::string ascii;
     for (size_t i = 0; i < MEMORY_BYTES_PER_LINE / sizeof(uintptr_t); i++) {
-      if (current >= start && current + sizeof(uintptr_t) <= total_bytes) {
+      if (current >= start_offset && current + sizeof(uintptr_t) <= total_bytes) {
         android::base::StringAppendF(&logline, " %" PRIPTR, static_cast<uint64_t>(*data_ptr));
 
         // Fill out the ascii string from the data.
@@ -225,23 +249,6 @@
   }
 }
 
-void read_with_default(const char* path, char* buf, size_t len, const char* default_value) {
-  unique_fd fd(open(path, O_RDONLY | O_CLOEXEC));
-  if (fd != -1) {
-    int rc = TEMP_FAILURE_RETRY(read(fd.get(), buf, len - 1));
-    if (rc != -1) {
-      buf[rc] = '\0';
-
-      // Trim trailing newlines.
-      if (rc > 0 && buf[rc - 1] == '\n') {
-        buf[rc - 1] = '\0';
-      }
-      return;
-    }
-  }
-  strcpy(buf, default_value);
-}
-
 void drop_capabilities() {
   __user_cap_header_struct capheader;
   memset(&capheader, 0, sizeof(capheader));
@@ -252,11 +259,11 @@
   memset(&capdata, 0, sizeof(capdata));
 
   if (capset(&capheader, &capdata[0]) == -1) {
-    PLOG(FATAL) << "failed to drop capabilities";
+    async_safe_fatal("failed to drop capabilities: %s", strerror(errno));
   }
 
   if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) != 0) {
-    PLOG(FATAL) << "failed to set PR_SET_NO_NEW_PRIVS";
+    async_safe_fatal("failed to set PR_SET_NO_NEW_PRIVS: %s", strerror(errno));
   }
 }
 
@@ -374,8 +381,12 @@
           return "SEGV_ADIDERR";
         case SEGV_ADIPERR:
           return "SEGV_ADIPERR";
+        case SEGV_MTEAERR:
+          return "SEGV_MTEAERR";
+        case SEGV_MTESERR:
+          return "SEGV_MTESERR";
       }
-      static_assert(NSIGSEGV == SEGV_ADIPERR, "missing SEGV_* si_code");
+      static_assert(NSIGSEGV == SEGV_MTESERR, "missing SEGV_* si_code");
       break;
     case SIGSYS:
       switch (si->si_code) {
diff --git a/debuggerd/pbtombstone.cpp b/debuggerd/pbtombstone.cpp
new file mode 100644
index 0000000..7527e31
--- /dev/null
+++ b/debuggerd/pbtombstone.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <android-base/unique_fd.h>
+#include <libdebuggerd/tombstone.h>
+
+#include "tombstone.pb.h"
+
+using android::base::unique_fd;
+
+[[noreturn]] void usage(bool error) {
+  fprintf(stderr, "usage: pbtombstone TOMBSTONE.PB\n");
+  fprintf(stderr, "Convert a protobuf tombstone to text.\n");
+  exit(error);
+}
+
+int main(int argc, const char* argv[]) {
+  if (argc != 2) {
+    usage(true);
+  }
+
+  if (strcmp("-h", argv[1]) == 0 || strcmp("--help", argv[1]) == 0) {
+    usage(false);
+  }
+
+  unique_fd fd(open(argv[1], O_RDONLY | O_CLOEXEC));
+  if (fd == -1) {
+    err(1, "failed to open tombstone '%s'", argv[1]);
+  }
+
+  Tombstone tombstone;
+  if (!tombstone.ParseFromFileDescriptor(fd.get())) {
+    err(1, "failed to parse tombstone");
+  }
+
+  bool result = tombstone_proto_to_text(
+      tombstone, [](const std::string& line, bool) { printf("%s\n", line.c_str()); });
+
+  if (!result) {
+    errx(1, "tombstone was malformed");
+  }
+
+  return 0;
+}
diff --git a/debuggerd/proto/Android.bp b/debuggerd/proto/Android.bp
new file mode 100644
index 0000000..5307d50
--- /dev/null
+++ b/debuggerd/proto/Android.bp
@@ -0,0 +1,28 @@
+cc_library {
+    name: "libtombstone_proto",
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Wthread-safety",
+        "-Werror",
+    ],
+
+    compile_multilib: "both",
+
+    proto: {
+        export_proto_headers: true,
+        type: "lite",
+    },
+
+    srcs: [
+        "tombstone.proto",
+    ],
+
+    stl: "libc++_static",
+    apex_available: [
+        "com.android.runtime",
+    ],
+
+    recovery_available: true,
+    vendor_ramdisk_available: true,
+}
diff --git a/debuggerd/proto/tombstone.proto b/debuggerd/proto/tombstone.proto
new file mode 100644
index 0000000..aff50bd
--- /dev/null
+++ b/debuggerd/proto/tombstone.proto
@@ -0,0 +1,118 @@
+syntax = "proto3";
+
+message Tombstone {
+  Architecture arch = 1;
+  string build_fingerprint = 2;
+  string revision = 3;
+  string timestamp = 4;
+
+  uint32 pid = 5;
+  uint32 tid = 6;
+  uint32 uid = 7;
+  string selinux_label = 8;
+
+  string process_name = 9;
+
+  Signal signal_info = 10;
+  string abort_message = 14;
+  Cause cause = 15;
+
+  map<uint32, Thread> threads = 16;
+  repeated MemoryMapping memory_mappings = 17;
+  repeated LogBuffer log_buffers = 18;
+  repeated FD open_fds = 19;
+}
+
+enum Architecture {
+  ARM32 = 0;
+  ARM64 = 1;
+  X86 = 2;
+  X86_64 = 3;
+}
+
+message Signal {
+  int32 number = 1;
+  string name = 2;
+
+  int32 code = 3;
+  string code_name = 4;
+
+  bool has_sender = 5;
+  int32 sender_uid = 6;
+  int32 sender_pid = 7;
+
+  bool has_fault_address = 8;
+  uint64 fault_address = 9;
+}
+
+message Cause {
+  string human_readable = 1;
+}
+
+message Register {
+  string name = 1;
+  uint64 u64 = 2;
+}
+
+message Thread {
+  int32 id = 1;
+  string name = 2;
+  repeated Register registers = 3;
+  repeated BacktraceFrame current_backtrace = 4;
+  repeated MemoryDump memory_dump = 5;
+}
+
+message BacktraceFrame {
+  uint64 rel_pc = 1;
+  uint64 pc = 2;
+  uint64 sp = 3;
+
+  string function_name = 4;
+  uint64 function_offset = 5;
+
+  string file_name = 6;
+  uint64 file_map_offset = 7;
+  string build_id = 8;
+}
+
+message MemoryDump {
+  string register_name = 1;
+  string mapping_name = 2;
+  uint64 begin_address = 3;
+  bytes memory = 4;
+}
+
+message MemoryMapping {
+  uint64 begin_address = 1;
+  uint64 end_address = 2;
+  uint64 offset = 3;
+
+  bool read = 4;
+  bool write = 5;
+  bool execute = 6;
+
+  string mapping_name = 7;
+  string build_id = 8;
+  uint64 load_bias = 9;
+}
+
+message FD {
+  int32 fd = 1;
+  string path = 2;
+  string owner = 3;
+  uint64 tag = 4;
+}
+
+message LogBuffer {
+  string name = 1;
+  repeated LogMessage logs = 2;
+}
+
+message LogMessage {
+  string timestamp = 1;
+  uint32 pid = 2;
+  uint32 tid = 3;
+  uint32 priority = 4;
+  string tag = 5;
+  string message = 6;
+}
diff --git a/debuggerd/protocol.h b/debuggerd/protocol.h
index bf53864..53a76ea 100644
--- a/debuggerd/protocol.h
+++ b/debuggerd/protocol.h
@@ -85,26 +85,24 @@
   uint32_t version;
 };
 
-struct __attribute__((__packed__)) CrashInfoDataV1 {
+struct __attribute__((__packed__)) CrashInfoDataStatic {
   siginfo_t siginfo;
   ucontext_t ucontext;
   uintptr_t abort_msg_address;
 };
 
-struct __attribute__((__packed__)) CrashInfoDataV2 : public CrashInfoDataV1 {
+struct __attribute__((__packed__)) CrashInfoDataDynamic : public CrashInfoDataStatic {
   uintptr_t fdsan_table_address;
-};
-
-struct __attribute__((__packed__)) CrashInfoDataV3 : public CrashInfoDataV2 {
   uintptr_t gwp_asan_state;
   uintptr_t gwp_asan_metadata;
+  uintptr_t scudo_stack_depot;
+  uintptr_t scudo_region_info;
 };
 
 struct __attribute__((__packed__)) CrashInfo {
   CrashInfoHeader header;
   union {
-    CrashInfoDataV1 v1;
-    CrashInfoDataV2 v2;
-    CrashInfoDataV3 v3;
+    CrashInfoDataStatic s;
+    CrashInfoDataDynamic d;
   } data;
 };
diff --git a/debuggerd/seccomp_policy/crash_dump.arm.policy b/debuggerd/seccomp_policy/crash_dump.arm.policy
index 254330d..4eac0e9 100644
--- a/debuggerd/seccomp_policy/crash_dump.arm.policy
+++ b/debuggerd/seccomp_policy/crash_dump.arm.policy
@@ -19,6 +19,7 @@
 getdents64: 1
 faccessat: 1
 recvmsg: 1
+recvfrom: 1
 process_vm_readv: 1
 tgkill: 1
 rt_sigprocmask: 1
diff --git a/debuggerd/seccomp_policy/crash_dump.arm64.policy b/debuggerd/seccomp_policy/crash_dump.arm64.policy
index 9b3ef09..1585cc6 100644
--- a/debuggerd/seccomp_policy/crash_dump.arm64.policy
+++ b/debuggerd/seccomp_policy/crash_dump.arm64.policy
@@ -18,6 +18,7 @@
 getdents64: 1
 faccessat: 1
 recvmsg: 1
+recvfrom: 1
 process_vm_readv: 1
 tgkill: 1
 rt_sigprocmask: 1
diff --git a/debuggerd/seccomp_policy/crash_dump.policy.def b/debuggerd/seccomp_policy/crash_dump.policy.def
index 2ef31b0..cd5aad4 100644
--- a/debuggerd/seccomp_policy/crash_dump.policy.def
+++ b/debuggerd/seccomp_policy/crash_dump.policy.def
@@ -24,6 +24,7 @@
 getdents64: 1
 faccessat: 1
 recvmsg: 1
+recvfrom: 1
 
 process_vm_readv: 1
 
diff --git a/debuggerd/seccomp_policy/crash_dump.x86.policy b/debuggerd/seccomp_policy/crash_dump.x86.policy
index 254330d..4eac0e9 100644
--- a/debuggerd/seccomp_policy/crash_dump.x86.policy
+++ b/debuggerd/seccomp_policy/crash_dump.x86.policy
@@ -19,6 +19,7 @@
 getdents64: 1
 faccessat: 1
 recvmsg: 1
+recvfrom: 1
 process_vm_readv: 1
 tgkill: 1
 rt_sigprocmask: 1
diff --git a/debuggerd/seccomp_policy/crash_dump.x86_64.policy b/debuggerd/seccomp_policy/crash_dump.x86_64.policy
index 9b3ef09..1585cc6 100644
--- a/debuggerd/seccomp_policy/crash_dump.x86_64.policy
+++ b/debuggerd/seccomp_policy/crash_dump.x86_64.policy
@@ -18,6 +18,7 @@
 getdents64: 1
 faccessat: 1
 recvmsg: 1
+recvfrom: 1
 process_vm_readv: 1
 tgkill: 1
 rt_sigprocmask: 1
diff --git a/debuggerd/tombstoned/include/tombstoned/tombstoned.h b/debuggerd/tombstoned/include/tombstoned/tombstoned.h
index 6403dbe..bff216c 100644
--- a/debuggerd/tombstoned/include/tombstoned/tombstoned.h
+++ b/debuggerd/tombstoned/include/tombstoned/tombstoned.h
@@ -23,6 +23,10 @@
 #include "dump_type.h"
 
 bool tombstoned_connect(pid_t pid, android::base::unique_fd* tombstoned_socket,
-                        android::base::unique_fd* output_fd, DebuggerdDumpType dump_type);
+                        android::base::unique_fd* text_output_fd,
+                        android::base::unique_fd* proto_output_fd, DebuggerdDumpType dump_type);
+
+bool tombstoned_connect(pid_t pid, android::base::unique_fd* tombstoned_socket,
+                        android::base::unique_fd* text_output_fd, DebuggerdDumpType dump_type);
 
 bool tombstoned_notify_completion(int tombstoned_socket);
diff --git a/debuggerd/tombstoned/intercept_manager.cpp b/debuggerd/tombstoned/intercept_manager.cpp
index 7d25c50..4d4646a 100644
--- a/debuggerd/tombstoned/intercept_manager.cpp
+++ b/debuggerd/tombstoned/intercept_manager.cpp
@@ -26,8 +26,8 @@
 
 #include <android-base/cmsg.h>
 #include <android-base/logging.h>
+#include <android-base/properties.h>
 #include <android-base/unique_fd.h>
-#include <cutils/sockets.h>
 
 #include "protocol.h"
 #include "util.h"
@@ -163,7 +163,7 @@
     event_assign(intercept->intercept_event, intercept_manager->base, sockfd, EV_READ | EV_TIMEOUT,
                  intercept_close_cb, arg);
 
-    struct timeval timeout = { .tv_sec = 10, .tv_usec = 0 };
+    struct timeval timeout = {.tv_sec = 10 * android::base::TimeoutMultiplier(), .tv_usec = 0};
     event_add(intercept->intercept_event, &timeout);
   }
 
@@ -179,7 +179,7 @@
   intercept->intercept_manager = static_cast<InterceptManager*>(arg);
   intercept->sockfd.reset(sockfd);
 
-  struct timeval timeout = { 1, 0 };
+  struct timeval timeout = {1 * android::base::TimeoutMultiplier(), 0};
   event_base* base = evconnlistener_get_base(listener);
   event* intercept_event =
     event_new(base, sockfd, EV_TIMEOUT | EV_READ, intercept_request_cb, intercept);
@@ -192,6 +192,18 @@
                                       /* backlog */ -1, intercept_socket);
 }
 
+bool dump_types_compatible(DebuggerdDumpType interceptor, DebuggerdDumpType dump) {
+  if (interceptor == dump) {
+    return true;
+  }
+
+  if (interceptor == kDebuggerdTombstone && dump == kDebuggerdTombstoneProto) {
+    return true;
+  }
+
+  return false;
+}
+
 bool InterceptManager::GetIntercept(pid_t pid, DebuggerdDumpType dump_type,
                                     android::base::unique_fd* out_fd) {
   auto it = this->intercepts.find(pid);
@@ -202,7 +214,7 @@
   if (dump_type == kDebuggerdAnyIntercept) {
     LOG(INFO) << "found registered intercept of type " << it->second->dump_type
               << " for requested type kDebuggerdAnyIntercept";
-  } else if (it->second->dump_type != dump_type) {
+  } else if (!dump_types_compatible(it->second->dump_type, dump_type)) {
     LOG(WARNING) << "found non-matching intercept of type " << it->second->dump_type
                  << " for requested type: " << dump_type;
     return false;
diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp
index d09b8e8..3e0c47c 100644
--- a/debuggerd/tombstoned/tombstoned.cpp
+++ b/debuggerd/tombstoned/tombstoned.cpp
@@ -48,6 +48,8 @@
 using android::base::GetIntProperty;
 using android::base::SendFileDescriptors;
 using android::base::StringPrintf;
+
+using android::base::borrowed_fd;
 using android::base::unique_fd;
 
 static InterceptManager* intercept_manager;
@@ -57,14 +59,34 @@
   kCrashStatusQueued,
 };
 
+struct CrashArtifact {
+  unique_fd fd;
+  std::optional<std::string> temporary_path;
+
+  static CrashArtifact devnull() {
+    CrashArtifact result;
+    result.fd.reset(open("/dev/null", O_WRONLY | O_CLOEXEC));
+    return result;
+  }
+};
+
+struct CrashArtifactPaths {
+  std::string text;
+  std::optional<std::string> proto;
+};
+
+struct CrashOutput {
+  CrashArtifact text;
+  std::optional<CrashArtifact> proto;
+};
+
 // Ownership of Crash is a bit messy.
 // It's either owned by an active event that must have a timeout, or owned by
 // queued_requests, in the case that multiple crashes come in at the same time.
 struct Crash {
   ~Crash() { event_free(crash_event); }
 
-  std::string crash_tombstone_path;
-  unique_fd crash_tombstone_fd;
+  CrashOutput output;
   unique_fd crash_socket_fd;
   pid_t crash_pid;
   event* crash_event = nullptr;
@@ -75,14 +97,15 @@
 class CrashQueue {
  public:
   CrashQueue(const std::string& dir_path, const std::string& file_name_prefix, size_t max_artifacts,
-             size_t max_concurrent_dumps)
+             size_t max_concurrent_dumps, bool supports_proto)
       : file_name_prefix_(file_name_prefix),
         dir_path_(dir_path),
         dir_fd_(open(dir_path.c_str(), O_DIRECTORY | O_RDONLY | O_CLOEXEC)),
         max_artifacts_(max_artifacts),
         next_artifact_(0),
         max_concurrent_dumps_(max_concurrent_dumps),
-        num_concurrent_dumps_(0) {
+        num_concurrent_dumps_(0),
+        supports_proto_(supports_proto) {
     if (dir_fd_ == -1) {
       PLOG(FATAL) << "failed to open directory: " << dir_path;
     }
@@ -98,59 +121,104 @@
     return (crash->crash_type == kDebuggerdJavaBacktrace) ? for_anrs() : for_tombstones();
   }
 
+  static CrashQueue* for_crash(const std::unique_ptr<Crash>& crash) {
+    return for_crash(crash.get());
+  }
+
   static CrashQueue* for_tombstones() {
     static CrashQueue queue("/data/tombstones", "tombstone_" /* file_name_prefix */,
                             GetIntProperty("tombstoned.max_tombstone_count", 32),
-                            1 /* max_concurrent_dumps */);
+                            1 /* max_concurrent_dumps */, true /* supports_proto */);
     return &queue;
   }
 
   static CrashQueue* for_anrs() {
     static CrashQueue queue("/data/anr", "trace_" /* file_name_prefix */,
                             GetIntProperty("tombstoned.max_anr_count", 64),
-                            4 /* max_concurrent_dumps */);
+                            4 /* max_concurrent_dumps */, false /* supports_proto */);
     return &queue;
   }
 
-  std::pair<std::string, unique_fd> get_output() {
-    std::string path;
-    unique_fd result(openat(dir_fd_, ".", O_WRONLY | O_APPEND | O_TMPFILE | O_CLOEXEC, 0640));
-    if (result == -1) {
+  CrashArtifact create_temporary_file() const {
+    CrashArtifact result;
+
+    std::optional<std::string> path;
+    result.fd.reset(openat(dir_fd_, ".", O_WRONLY | O_APPEND | O_TMPFILE | O_CLOEXEC, 0640));
+    if (result.fd == -1) {
       // We might not have O_TMPFILE. Try creating with an arbitrary filename instead.
       static size_t counter = 0;
       std::string tmp_filename = StringPrintf(".temporary%zu", counter++);
-      result.reset(openat(dir_fd_, tmp_filename.c_str(),
-                          O_WRONLY | O_APPEND | O_CREAT | O_TRUNC | O_CLOEXEC, 0640));
-      if (result == -1) {
+      result.fd.reset(openat(dir_fd_, tmp_filename.c_str(),
+                             O_WRONLY | O_APPEND | O_CREAT | O_TRUNC | O_CLOEXEC, 0640));
+      if (result.fd == -1) {
         PLOG(FATAL) << "failed to create temporary tombstone in " << dir_path_;
       }
 
-      path = StringPrintf("%s/%s", dir_path_.c_str(), tmp_filename.c_str());
+      result.temporary_path = std::move(tmp_filename);
     }
-    return std::make_pair(std::move(path), std::move(result));
+
+    return std::move(result);
   }
 
-  std::string get_next_artifact_path() {
-    std::string file_name =
-        StringPrintf("%s/%s%02d", dir_path_.c_str(), file_name_prefix_.c_str(), next_artifact_);
+  std::optional<CrashOutput> get_output(DebuggerdDumpType dump_type) {
+    CrashOutput result;
+
+    switch (dump_type) {
+      case kDebuggerdNativeBacktrace:
+      case kDebuggerdJavaBacktrace:
+        // Don't generate tombstones for backtrace requests.
+        return {};
+
+      case kDebuggerdTombstoneProto:
+        if (!supports_proto_) {
+          LOG(ERROR) << "received kDebuggerdTombstoneProto on a queue that doesn't support proto";
+          return {};
+        }
+        result.proto = create_temporary_file();
+        result.text = create_temporary_file();
+        break;
+
+      case kDebuggerdTombstone:
+        result.text = create_temporary_file();
+        break;
+
+      default:
+        LOG(ERROR) << "unexpected dump type: " << dump_type;
+        return {};
+    }
+
+    return result;
+  }
+
+  borrowed_fd dir_fd() { return dir_fd_; }
+
+  CrashArtifactPaths get_next_artifact_paths() {
+    CrashArtifactPaths result;
+    result.text = StringPrintf("%s%02d", file_name_prefix_.c_str(), next_artifact_);
+
+    if (supports_proto_) {
+      result.proto = StringPrintf("%s%02d.pb", file_name_prefix_.c_str(), next_artifact_);
+    }
+
     next_artifact_ = (next_artifact_ + 1) % max_artifacts_;
-    return file_name;
+    return result;
   }
 
-  bool maybe_enqueue_crash(Crash* crash) {
+  // Consumes crash if it returns true, otherwise leaves it untouched.
+  bool maybe_enqueue_crash(std::unique_ptr<Crash>&& crash) {
     if (num_concurrent_dumps_ == max_concurrent_dumps_) {
-      queued_requests_.push_back(crash);
+      queued_requests_.emplace_back(std::move(crash));
       return true;
     }
 
     return false;
   }
 
-  void maybe_dequeue_crashes(void (*handler)(Crash* crash)) {
+  void maybe_dequeue_crashes(void (*handler)(std::unique_ptr<Crash> crash)) {
     while (!queued_requests_.empty() && num_concurrent_dumps_ < max_concurrent_dumps_) {
-      Crash* next_crash = queued_requests_.front();
+      std::unique_ptr<Crash> next_crash = std::move(queued_requests_.front());
       queued_requests_.pop_front();
-      handler(next_crash);
+      handler(std::move(next_crash));
     }
   }
 
@@ -164,7 +232,8 @@
     time_t oldest_time = std::numeric_limits<time_t>::max();
 
     for (size_t i = 0; i < max_artifacts_; ++i) {
-      std::string path = StringPrintf("%s/%s%02zu", dir_path_.c_str(), file_name_prefix_.c_str(), i);
+      std::string path =
+          StringPrintf("%s/%s%02zu", dir_path_.c_str(), file_name_prefix_.c_str(), i);
       struct stat st;
       if (stat(path.c_str(), &st) != 0) {
         if (errno == ENOENT) {
@@ -196,7 +265,9 @@
   const size_t max_concurrent_dumps_;
   size_t num_concurrent_dumps_;
 
-  std::deque<Crash*> queued_requests_;
+  bool supports_proto_;
+
+  std::deque<std::unique_ptr<Crash>> queued_requests_;
 
   DISALLOW_COPY_AND_ASSIGN(CrashQueue);
 };
@@ -205,52 +276,61 @@
 static constexpr bool kJavaTraceDumpsEnabled = true;
 
 // Forward declare the callbacks so they can be placed in a sensible order.
-static void crash_accept_cb(evconnlistener* listener, evutil_socket_t sockfd, sockaddr*, int, void*);
+static void crash_accept_cb(evconnlistener* listener, evutil_socket_t sockfd, sockaddr*, int,
+                            void*);
 static void crash_request_cb(evutil_socket_t sockfd, short ev, void* arg);
 static void crash_completed_cb(evutil_socket_t sockfd, short ev, void* arg);
 
-static void perform_request(Crash* crash) {
+static void perform_request(std::unique_ptr<Crash> crash) {
   unique_fd output_fd;
   bool intercepted =
       intercept_manager->GetIntercept(crash->crash_pid, crash->crash_type, &output_fd);
-  if (!intercepted) {
-    if (crash->crash_type == kDebuggerdNativeBacktrace) {
-      // Don't generate tombstones for native backtrace requests.
-      output_fd.reset(open("/dev/null", O_WRONLY | O_CLOEXEC));
+  if (intercepted) {
+    if (crash->crash_type == kDebuggerdTombstoneProto) {
+      crash->output.proto = CrashArtifact::devnull();
+    }
+  } else {
+    if (auto o = CrashQueue::for_crash(crash.get())->get_output(crash->crash_type); o) {
+      crash->output = std::move(*o);
+      output_fd.reset(dup(crash->output.text.fd));
     } else {
-      std::tie(crash->crash_tombstone_path, output_fd) = CrashQueue::for_crash(crash)->get_output();
-      crash->crash_tombstone_fd.reset(dup(output_fd.get()));
+      LOG(ERROR) << "failed to get crash output for type " << crash->crash_type;
+      return;
     }
   }
 
-  TombstonedCrashPacket response = {
-    .packet_type = CrashPacketType::kPerformDump
-  };
-  ssize_t rc =
-      SendFileDescriptors(crash->crash_socket_fd, &response, sizeof(response), output_fd.get());
+  TombstonedCrashPacket response = {.packet_type = CrashPacketType::kPerformDump};
+
+  ssize_t rc = -1;
+  if (crash->output.proto) {
+    rc = SendFileDescriptors(crash->crash_socket_fd, &response, sizeof(response), output_fd.get(),
+                             crash->output.proto->fd.get());
+  } else {
+    rc = SendFileDescriptors(crash->crash_socket_fd, &response, sizeof(response), output_fd.get());
+  }
+
   output_fd.reset();
 
   if (rc == -1) {
     PLOG(WARNING) << "failed to send response to CrashRequest";
-    goto fail;
+    return;
   } else if (rc != sizeof(response)) {
     PLOG(WARNING) << "crash socket write returned short";
-    goto fail;
-  } else {
-    // TODO: Make this configurable by the interceptor?
-    struct timeval timeout = { 10, 0 };
-
-    event_base* base = event_get_base(crash->crash_event);
-    event_assign(crash->crash_event, base, crash->crash_socket_fd, EV_TIMEOUT | EV_READ,
-                 crash_completed_cb, crash);
-    event_add(crash->crash_event, &timeout);
+    return;
   }
 
-  CrashQueue::for_crash(crash)->on_crash_started();
-  return;
+  // TODO: Make this configurable by the interceptor?
+  struct timeval timeout = {10 * android::base::TimeoutMultiplier(), 0};
 
-fail:
-  delete crash;
+  event_base* base = event_get_base(crash->crash_event);
+
+  event_assign(crash->crash_event, base, crash->crash_socket_fd, EV_TIMEOUT | EV_READ,
+               crash_completed_cb, crash.get());
+  event_add(crash->crash_event, &timeout);
+  CrashQueue::for_crash(crash)->on_crash_started();
+
+  // The crash is now owned by the event loop.
+  crash.release();
 }
 
 static void crash_accept_cb(evconnlistener* listener, evutil_socket_t sockfd, sockaddr*, int,
@@ -260,7 +340,7 @@
 
   // TODO: Make sure that only java crashes come in on the java socket
   // and only native crashes on the native socket.
-  struct timeval timeout = { 1, 0 };
+  struct timeval timeout = {1 * android::base::TimeoutMultiplier(), 0};
   event* crash_event = event_new(base, sockfd, EV_TIMEOUT | EV_READ, crash_request_cb, crash);
   crash->crash_socket_fd.reset(sockfd);
   crash->crash_event = crash_event;
@@ -268,39 +348,37 @@
 }
 
 static void crash_request_cb(evutil_socket_t sockfd, short ev, void* arg) {
-  ssize_t rc;
-  Crash* crash = static_cast<Crash*>(arg);
-
+  std::unique_ptr<Crash> crash(static_cast<Crash*>(arg));
   TombstonedCrashPacket request = {};
 
   if ((ev & EV_TIMEOUT) != 0) {
     LOG(WARNING) << "crash request timed out";
-    goto fail;
+    return;
   } else if ((ev & EV_READ) == 0) {
     LOG(WARNING) << "tombstoned received unexpected event from crash socket";
-    goto fail;
+    return;
   }
 
-  rc = TEMP_FAILURE_RETRY(read(sockfd, &request, sizeof(request)));
+  ssize_t rc = TEMP_FAILURE_RETRY(read(sockfd, &request, sizeof(request)));
   if (rc == -1) {
     PLOG(WARNING) << "failed to read from crash socket";
-    goto fail;
+    return;
   } else if (rc != sizeof(request)) {
     LOG(WARNING) << "crash socket received short read of length " << rc << " (expected "
                  << sizeof(request) << ")";
-    goto fail;
+    return;
   }
 
   if (request.packet_type != CrashPacketType::kDumpRequest) {
     LOG(WARNING) << "unexpected crash packet type, expected kDumpRequest, received  "
                  << StringPrintf("%#2hhX", request.packet_type);
-    goto fail;
+    return;
   }
 
   crash->crash_type = request.packet.dump_request.dump_type;
-  if (crash->crash_type < 0 || crash->crash_type > kDebuggerdAnyIntercept) {
+  if (crash->crash_type < 0 || crash->crash_type > kDebuggerdTombstoneProto) {
     LOG(WARNING) << "unexpected crash dump type: " << crash->crash_type;
-    goto fail;
+    return;
   }
 
   if (crash->crash_type != kDebuggerdJavaBacktrace) {
@@ -314,90 +392,117 @@
     int ret = getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &cr, &len);
     if (ret != 0) {
       PLOG(ERROR) << "Failed to getsockopt(..SO_PEERCRED)";
-      goto fail;
+      return;
     }
 
     crash->crash_pid = cr.pid;
   }
 
-  LOG(INFO) << "received crash request for pid " << crash->crash_pid;
+  pid_t crash_pid = crash->crash_pid;
+  LOG(INFO) << "received crash request for pid " << crash_pid;
 
-  if (CrashQueue::for_crash(crash)->maybe_enqueue_crash(crash)) {
-    LOG(INFO) << "enqueueing crash request for pid " << crash->crash_pid;
+  if (CrashQueue::for_crash(crash)->maybe_enqueue_crash(std::move(crash))) {
+    LOG(INFO) << "enqueueing crash request for pid " << crash_pid;
   } else {
-    perform_request(crash);
+    perform_request(std::move(crash));
   }
-
-  return;
-
-fail:
-  delete crash;
 }
 
-static void crash_completed_cb(evutil_socket_t sockfd, short ev, void* arg) {
-  ssize_t rc;
-  Crash* crash = static_cast<Crash*>(arg);
-  TombstonedCrashPacket request = {};
+static bool link_fd(borrowed_fd fd, borrowed_fd dirfd, const std::string& path) {
+  std::string fd_path = StringPrintf("/proc/self/fd/%d", fd.get());
 
-  CrashQueue::for_crash(crash)->on_crash_completed();
-
-  if ((ev & EV_READ) == 0) {
-    goto fail;
+  int rc = linkat(AT_FDCWD, fd_path.c_str(), dirfd.get(), path.c_str(), AT_SYMLINK_FOLLOW);
+  if (rc != 0) {
+    PLOG(ERROR) << "failed to link file descriptor";
+    return false;
   }
+  return true;
+}
 
-  rc = TEMP_FAILURE_RETRY(read(sockfd, &request, sizeof(request)));
+static void crash_completed(borrowed_fd sockfd, std::unique_ptr<Crash> crash) {
+  TombstonedCrashPacket request = {};
+  CrashQueue* queue = CrashQueue::for_crash(crash);
+
+  ssize_t rc = TEMP_FAILURE_RETRY(read(sockfd.get(), &request, sizeof(request)));
   if (rc == -1) {
     PLOG(WARNING) << "failed to read from crash socket";
-    goto fail;
+    return;
   } else if (rc != sizeof(request)) {
     LOG(WARNING) << "crash socket received short read of length " << rc << " (expected "
                  << sizeof(request) << ")";
-    goto fail;
+    return;
   }
 
   if (request.packet_type != CrashPacketType::kCompletedDump) {
     LOG(WARNING) << "unexpected crash packet type, expected kCompletedDump, received "
                  << uint32_t(request.packet_type);
-    goto fail;
+    return;
   }
 
-  if (crash->crash_tombstone_fd != -1) {
-    std::string fd_path = StringPrintf("/proc/self/fd/%d", crash->crash_tombstone_fd.get());
-    std::string tombstone_path = CrashQueue::for_crash(crash)->get_next_artifact_path();
+  if (crash->output.text.fd == -1) {
+    LOG(WARNING) << "missing output fd";
+    return;
+  }
 
-    // linkat doesn't let us replace a file, so we need to unlink first.
-    int rc = unlink(tombstone_path.c_str());
-    if (rc != 0 && errno != ENOENT) {
-      PLOG(ERROR) << "failed to unlink tombstone at " << tombstone_path;
-      goto fail;
-    }
+  CrashArtifactPaths paths = queue->get_next_artifact_paths();
 
-    rc = linkat(AT_FDCWD, fd_path.c_str(), AT_FDCWD, tombstone_path.c_str(), AT_SYMLINK_FOLLOW);
-    if (rc != 0) {
-      PLOG(ERROR) << "failed to link tombstone";
+  // Always try to unlink the tombstone file.
+  // linkat doesn't let us replace a file, so we need to unlink before linking
+  // our results onto disk, and if we fail for some reason, we should delete
+  // stale tombstones to avoid confusing inconsistency.
+  rc = unlinkat(queue->dir_fd().get(), paths.text.c_str(), 0);
+  if (rc != 0 && errno != ENOENT) {
+    PLOG(ERROR) << "failed to unlink tombstone at " << paths.text;
+    return;
+  }
+
+  if (crash->output.text.fd != -1) {
+    if (!link_fd(crash->output.text.fd, queue->dir_fd(), paths.text)) {
+      LOG(ERROR) << "failed to link tombstone";
     } else {
       if (crash->crash_type == kDebuggerdJavaBacktrace) {
-        LOG(ERROR) << "Traces for pid " << crash->crash_pid << " written to: " << tombstone_path;
+        LOG(ERROR) << "Traces for pid " << crash->crash_pid << " written to: " << paths.text;
       } else {
         // NOTE: Several tools parse this log message to figure out where the
         // tombstone associated with a given native crash was written. Any changes
         // to this message must be carefully considered.
-        LOG(ERROR) << "Tombstone written to: " << tombstone_path;
-      }
-    }
-
-    // If we don't have O_TMPFILE, we need to clean up after ourselves.
-    if (!crash->crash_tombstone_path.empty()) {
-      rc = unlink(crash->crash_tombstone_path.c_str());
-      if (rc != 0) {
-        PLOG(ERROR) << "failed to unlink temporary tombstone at " << crash->crash_tombstone_path;
+        LOG(ERROR) << "Tombstone written to: " << paths.text;
       }
     }
   }
 
-fail:
+  if (crash->output.proto && crash->output.proto->fd != -1) {
+    if (!paths.proto) {
+      LOG(ERROR) << "missing path for proto tombstone";
+    } else if (!link_fd(crash->output.proto->fd, queue->dir_fd(), *paths.proto)) {
+      LOG(ERROR) << "failed to link proto tombstone";
+    }
+  }
+
+  // If we don't have O_TMPFILE, we need to clean up after ourselves.
+  if (crash->output.text.temporary_path) {
+    rc = unlinkat(queue->dir_fd().get(), crash->output.text.temporary_path->c_str(), 0);
+    if (rc != 0) {
+      PLOG(ERROR) << "failed to unlink temporary tombstone at " << paths.text;
+    }
+  }
+  if (crash->output.proto && crash->output.proto->temporary_path) {
+    rc = unlinkat(queue->dir_fd().get(), crash->output.proto->temporary_path->c_str(), 0);
+    if (rc != 0) {
+      PLOG(ERROR) << "failed to unlink temporary proto tombstone";
+    }
+  }
+}
+
+static void crash_completed_cb(evutil_socket_t sockfd, short ev, void* arg) {
+  std::unique_ptr<Crash> crash(static_cast<Crash*>(arg));
   CrashQueue* queue = CrashQueue::for_crash(crash);
-  delete crash;
+
+  queue->on_crash_completed();
+
+  if ((ev & EV_READ) == EV_READ) {
+    crash_completed(sockfd, std::move(crash));
+  }
 
   // If there's something queued up, let them proceed.
   queue->maybe_dequeue_crashes(perform_request);
diff --git a/debuggerd/tombstoned/tombstoned.rc b/debuggerd/tombstoned/tombstoned.rc
index b4a1e71..c39f4e4 100644
--- a/debuggerd/tombstoned/tombstoned.rc
+++ b/debuggerd/tombstoned/tombstoned.rc
@@ -6,6 +6,3 @@
     socket tombstoned_intercept seqpacket 0666 system system
     socket tombstoned_java_trace seqpacket 0666 system system
     writepid /dev/cpuset/system-background/tasks
-
-on post-fs-data
-    start tombstoned
diff --git a/debuggerd/tombstoned/tombstoned_client.cpp b/debuggerd/tombstoned/tombstoned_client.cpp
index 2c23c98..abfafb1 100644
--- a/debuggerd/tombstoned/tombstoned_client.cpp
+++ b/debuggerd/tombstoned/tombstoned_client.cpp
@@ -32,8 +32,13 @@
 using android::base::ReceiveFileDescriptors;
 using android::base::unique_fd;
 
-bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* output_fd,
+bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* text_output_fd,
                         DebuggerdDumpType dump_type) {
+  return tombstoned_connect(pid, tombstoned_socket, text_output_fd, nullptr, dump_type);
+}
+
+bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* text_output_fd,
+                        unique_fd* proto_output_fd, DebuggerdDumpType dump_type) {
   unique_fd sockfd(
       socket_local_client((dump_type != kDebuggerdJavaBacktrace ? kTombstonedCrashSocketName
                                                                 : kTombstonedJavaTraceSocketName),
@@ -54,8 +59,15 @@
     return false;
   }
 
-  unique_fd tmp_output_fd;
-  ssize_t rc = ReceiveFileDescriptors(sockfd, &packet, sizeof(packet), &tmp_output_fd);
+  unique_fd tmp_output_fd, tmp_proto_fd;
+  ssize_t rc = -1;
+
+  if (dump_type == kDebuggerdTombstoneProto) {
+    rc = ReceiveFileDescriptors(sockfd, &packet, sizeof(packet), &tmp_output_fd, &tmp_proto_fd);
+  } else {
+    rc = ReceiveFileDescriptors(sockfd, &packet, sizeof(packet), &tmp_output_fd);
+  }
+
   if (rc == -1) {
     async_safe_format_log(ANDROID_LOG_ERROR, "libc",
                           "failed to read response to DumpRequest packet: %s", strerror(errno));
@@ -78,7 +90,10 @@
   }
 
   *tombstoned_socket = std::move(sockfd);
-  *output_fd = std::move(tmp_output_fd);
+  *text_output_fd = std::move(tmp_output_fd);
+  if (proto_output_fd) {
+    *proto_output_fd = std::move(tmp_proto_fd);
+  }
   return true;
 }
 
diff --git a/debuggerd/util.cpp b/debuggerd/util.cpp
index a37b3b9..f3bff8c 100644
--- a/debuggerd/util.cpp
+++ b/debuggerd/util.cpp
@@ -16,7 +16,7 @@
 
 #include "util.h"
 
-#include <sys/socket.h>
+#include <time.h>
 
 #include <string>
 #include <utility>
@@ -24,7 +24,6 @@
 #include <android-base/file.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
-#include <cutils/sockets.h>
 #include "protocol.h"
 
 std::string get_process_name(pid_t pid) {
@@ -38,3 +37,19 @@
   android::base::ReadFileToString(android::base::StringPrintf("/proc/%d/comm", tid), &result);
   return android::base::Trim(result);
 }
+
+std::string get_timestamp() {
+  timespec ts;
+  clock_gettime(CLOCK_REALTIME, &ts);
+
+  tm tm;
+  localtime_r(&ts.tv_sec, &tm);
+
+  char buf[strlen("1970-01-01 00:00:00.123456789+0830") + 1];
+  char* s = buf;
+  size_t sz = sizeof(buf), n;
+  n = strftime(s, sz, "%F %H:%M", &tm), s += n, sz -= n;
+  n = snprintf(s, sz, ":%02d.%09ld", tm.tm_sec, ts.tv_nsec), s += n, sz -= n;
+  n = strftime(s, sz, "%z", &tm), s += n, sz -= n;
+  return buf;
+}
diff --git a/debuggerd/util.h b/debuggerd/util.h
index e964423..07e7e99 100644
--- a/debuggerd/util.h
+++ b/debuggerd/util.h
@@ -23,3 +23,5 @@
 
 std::string get_process_name(pid_t pid);
 std::string get_thread_name(pid_t tid);
+
+std::string get_timestamp();
diff --git a/deprecated-adf/OWNERS b/deprecated-adf/OWNERS
deleted file mode 100644
index 72b8b5a..0000000
--- a/deprecated-adf/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-ghackmann@google.com
-marissaw@google.com
diff --git a/deprecated-adf/libadf/Android.bp b/deprecated-adf/libadf/Android.bp
deleted file mode 100644
index 70f0a3b..0000000
--- a/deprecated-adf/libadf/Android.bp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2013 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.
-
-cc_library {
-    name: "libadf",
-    recovery_available: true,
-    vendor_available: true,
-    vndk: {
-        enabled: true,
-    },
-    srcs: ["adf.cpp"],
-    cflags: ["-Werror"],
-    local_include_dirs: ["include"],
-    export_include_dirs: ["include"],
-}
diff --git a/deprecated-adf/libadf/adf.cpp b/deprecated-adf/libadf/adf.cpp
deleted file mode 100644
index fd9c208..0000000
--- a/deprecated-adf/libadf/adf.cpp
+++ /dev/null
@@ -1,746 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <malloc.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <memory>
-#include <vector>
-
-#include <linux/limits.h>
-
-#include <sys/ioctl.h>
-
-#include <adf/adf.h>
-
-#define ADF_BASE_PATH "/dev/"
-
-static ssize_t adf_id_vector_to_array(const std::vector<adf_id_t> &in,
-        adf_id_t **out)
-{
-    auto size = sizeof(in[0]) * in.size();
-    // We can't use new[] since the existing API says the caller should free()
-    // the returned array
-    auto ret = static_cast<adf_id_t *>(malloc(size));
-    if (!ret)
-        return -ENOMEM;
-
-    std::copy(in.begin(), in.end(), ret);
-    *out = ret;
-    return in.size();
-}
-
-static ssize_t adf_find_nodes(const char *pattern, adf_id_t **ids_out)
-{
-    struct dirent *dirent;
-    std::unique_ptr<DIR, decltype(&closedir)>
-        dir{opendir(ADF_BASE_PATH), closedir};
-    if (!dir)
-        return -errno;
-
-    std::vector<adf_id_t> ids;
-    errno = 0;
-    while ((dirent = readdir(dir.get()))) {
-        adf_id_t id;
-        int matched = sscanf(dirent->d_name, pattern, &id);
-
-        if (matched < 0)
-            return -errno;
-        else if (matched == 1)
-            ids.push_back(id);
-    }
-    if (errno)
-        return -errno;
-
-    return adf_id_vector_to_array(ids, ids_out);
-}
-
-ssize_t adf_devices(adf_id_t **ids)
-{
-    return adf_find_nodes("adf%u", ids);
-}
-
-int adf_device_open(adf_id_t id, int flags, struct adf_device *dev)
-{
-    char filename[64];
-
-    dev->id = id;
-
-    snprintf(filename, sizeof(filename), ADF_BASE_PATH "adf%u", id);
-    dev->fd = open(filename, flags);
-    if (dev->fd < 0)
-        return -errno;
-
-    return 0;
-}
-
-void adf_device_close(struct adf_device *dev)
-{
-    if (dev->fd >= 0)
-        close(dev->fd);
-}
-
-int adf_get_device_data(struct adf_device *dev, struct adf_device_data *data)
-{
-    int err;
-    int ret = 0;
-
-    memset(data, 0, sizeof(*data));
-
-    err = ioctl(dev->fd, ADF_GET_DEVICE_DATA, data);
-    if (err < 0)
-        return -ENOMEM;
-
-    if (data->n_attachments)
-        data->attachments = new adf_attachment_config[data->n_attachments];
-
-    if (data->n_allowed_attachments)
-        data->allowed_attachments =
-                new adf_attachment_config[data->n_allowed_attachments];
-
-    if (data->custom_data_size)
-        data->custom_data = new char[data->custom_data_size];
-
-    err = ioctl(dev->fd, ADF_GET_DEVICE_DATA, data);
-    if (err < 0) {
-        ret = -errno;
-        adf_free_device_data(data);
-    }
-    return ret;
-}
-
-void adf_free_device_data(struct adf_device_data *data)
-{
-    delete [] data->attachments;
-    data->attachments = nullptr;
-    delete [] data->allowed_attachments;
-    data->allowed_attachments = nullptr;
-    delete [] static_cast<char *>(data->custom_data);
-    data->custom_data = nullptr;
-}
-
-int adf_device_post(struct adf_device *dev,
-        adf_id_t *interfaces, size_t n_interfaces,
-        struct adf_buffer_config *bufs, size_t n_bufs,
-        void *custom_data, size_t custom_data_size)
-{
-    int err;
-    struct adf_post_config data;
-
-    memset(&data, 0, sizeof(data));
-    data.interfaces = interfaces;
-    data.n_interfaces = n_interfaces;
-    data.bufs = bufs;
-    data.n_bufs = n_bufs;
-    data.custom_data = custom_data;
-    data.custom_data_size = custom_data_size;
-
-    err = ioctl(dev->fd, ADF_POST_CONFIG, &data);
-    if (err < 0)
-        return -errno;
-
-    return (int)data.complete_fence;
-}
-
-int adf_device_post_v2(struct adf_device *dev,
-        adf_id_t *interfaces, __u32 n_interfaces,
-        struct adf_buffer_config *bufs, __u32 n_bufs,
-        void *custom_data, __u64 custom_data_size,
-        enum adf_complete_fence_type complete_fence_type,
-        int *complete_fence)
-{
-    int err;
-    struct adf_post_config_v2 data;
-
-    memset(&data, 0, sizeof(data));
-    data.interfaces = (uintptr_t)interfaces;
-    data.n_interfaces = n_interfaces;
-    data.bufs = (uintptr_t)bufs;
-    data.n_bufs = n_bufs;
-    data.custom_data = (uintptr_t)custom_data;
-    data.custom_data_size = custom_data_size;
-    data.complete_fence_type = complete_fence_type;
-
-    err = ioctl(dev->fd, ADF_POST_CONFIG_V2, &data);
-    if (err < 0)
-        return -errno;
-
-    if (complete_fence)
-        *complete_fence = data.complete_fence;
-    else if (data.complete_fence >= 0)
-        close(data.complete_fence);
-
-    return 0;
-}
-
-static int adf_device_attachment(struct adf_device *dev,
-        adf_id_t overlay_engine, adf_id_t interface, bool attach)
-{
-    int err;
-    struct adf_attachment_config data;
-
-    memset(&data, 0, sizeof(data));
-    data.overlay_engine = overlay_engine;
-    data.interface = interface;
-
-    err = ioctl(dev->fd, attach ? ADF_ATTACH : ADF_DETACH, &data);
-    if (err < 0)
-        return -errno;
-
-    return 0;
-}
-
-int adf_device_attach(struct adf_device *dev, adf_id_t overlay_engine,
-                      adf_id_t interface)
-{
-   return adf_device_attachment(dev, overlay_engine, interface, true);
-}
-
-int adf_device_detach(struct adf_device *dev, adf_id_t overlay_engine,
-                      adf_id_t interface)
-{
-   return adf_device_attachment(dev, overlay_engine, interface, false);
-}
-
-ssize_t adf_interfaces(struct adf_device *dev, adf_id_t **interfaces)
-{
-    char pattern[64];
-
-    snprintf(pattern, sizeof(pattern), "adf-interface%u.%%u", dev->id);
-    return adf_find_nodes(pattern, interfaces);
-}
-
-ssize_t adf_interfaces_for_overlay_engine(struct adf_device *dev,
-        adf_id_t overlay_engine, adf_id_t **interfaces)
-{
-    struct adf_device_data data;
-    auto err = adf_get_device_data(dev, &data);
-    if (err < 0)
-        return err;
-
-    std::vector<adf_id_t> ids;
-    if (data.allowed_attachments != nullptr)
-        for (size_t i = 0; i < data.n_allowed_attachments; i++)
-            if (data.allowed_attachments[i].overlay_engine == overlay_engine)
-              ids.push_back(data.allowed_attachments[i].interface);
-
-    adf_free_device_data(&data);
-    return adf_id_vector_to_array(ids, interfaces);
-}
-
-static ssize_t adf_interfaces_filter(struct adf_device *dev,
-        adf_id_t *in, size_t n_in, adf_id_t **out,
-        bool (*filter)(struct adf_interface_data *data, __u32 match),
-        __u32 match)
-{
-    std::vector<adf_id_t> ids;
-    for (size_t i = 0; i < n_in; i++) {
-        int fd = adf_interface_open(dev, in[i], O_RDONLY);
-        if (fd < 0)
-            return fd;
-
-        struct adf_interface_data data;
-        auto ret = adf_get_interface_data(fd, &data);
-        close(fd);
-        if (ret < 0)
-            return ret;
-
-        if (filter(&data, match))
-            ids.push_back(in[i]);
-    }
-
-    return adf_id_vector_to_array(ids, out);
-}
-
-static bool adf_interface_type_filter(struct adf_interface_data *data,
-        __u32 type)
-{
-    return data->type == (enum adf_interface_type)type;
-}
-
-ssize_t adf_interfaces_filter_by_type(struct adf_device *dev,
-        enum adf_interface_type type,
-        adf_id_t *in, size_t n_in, adf_id_t **out)
-{
-    return adf_interfaces_filter(dev, in, n_in, out, adf_interface_type_filter,
-            type);
-}
-
-static bool adf_interface_flags_filter(struct adf_interface_data *data,
-        __u32 flag)
-{
-    return !!(data->flags & flag);
-}
-
-ssize_t adf_interfaces_filter_by_flag(struct adf_device *dev, __u32 flag,
-        adf_id_t *in, size_t n_in, adf_id_t **out)
-{
-    return adf_interfaces_filter(dev, in, n_in, out, adf_interface_flags_filter,
-            flag);
-}
-
-int adf_interface_open(struct adf_device *dev, adf_id_t id, int flags)
-{
-    char filename[64];
-
-    snprintf(filename, sizeof(filename), ADF_BASE_PATH "adf-interface%u.%u",
-            dev->id, id);
-
-    int fd = open(filename, flags);
-    if (fd < 0)
-        return -errno;
-    return fd;
-}
-
-int adf_get_interface_data(int fd, struct adf_interface_data *data)
-{
-    int err;
-    int ret = 0;
-
-    memset(data, 0, sizeof(*data));
-
-    err = ioctl(fd, ADF_GET_INTERFACE_DATA, data);
-    if (err < 0)
-        return -errno;
-
-    if (data->n_available_modes)
-        data->available_modes = new drm_mode_modeinfo[data->n_available_modes];
-
-    if (data->custom_data_size)
-        data->custom_data = new char[data->custom_data_size];
-
-    err = ioctl(fd, ADF_GET_INTERFACE_DATA, data);
-    if (err < 0) {
-        ret = -errno;
-        adf_free_interface_data(data);
-    }
-    return ret;
-}
-
-void adf_free_interface_data(struct adf_interface_data *data)
-{
-    delete [] data->available_modes;
-    delete [] static_cast<char *>(data->custom_data);
-}
-
-int adf_interface_blank(int fd, __u8 mode)
-{
-    int err = ioctl(fd, ADF_BLANK, mode);
-    if (err < 0)
-        return -errno;
-    return 0;
-}
-
-int adf_interface_set_mode(int fd, struct drm_mode_modeinfo *mode)
-{
-    int err = ioctl(fd, ADF_SET_MODE, mode);
-    if (err < 0)
-        return -errno;
-    return 0;
-}
-
-int adf_interface_simple_buffer_alloc(int fd, __u32 w, __u32 h,
-        __u32 format, __u32 *offset, __u32 *pitch)
-{
-    int err;
-    struct adf_simple_buffer_alloc data;
-
-    memset(&data, 0, sizeof(data));
-    data.w = w;
-    data.h = h;
-    data.format = format;
-
-    err = ioctl(fd, ADF_SIMPLE_BUFFER_ALLOC, &data);
-    if (err < 0)
-        return -errno;
-
-    *offset = data.offset;
-    *pitch = data.pitch;
-    return (int)data.fd;
-}
-
-static void adf_interface_simple_post_config_buf(struct adf_buffer_config *buf,
-        __u32 overlay_engine, __u32 w, __u32 h, __u32 format, int buf_fd,
-        __u32 offset, __u32 pitch, int acquire_fence)
-{
-    buf->overlay_engine = overlay_engine;
-    buf->w = w;
-    buf->h = h;
-    buf->format = format;
-    buf->fd[0] = buf_fd;
-    buf->offset[0] = offset;
-    buf->pitch[0] = pitch;
-    buf->n_planes = 1;
-    buf->acquire_fence = acquire_fence;
-}
-
-int adf_interface_simple_post(int fd, __u32 overlay_engine,
-        __u32 w, __u32 h, __u32 format, int buf_fd, __u32 offset,
-        __u32 pitch, int acquire_fence)
-{
-    int ret;
-    struct adf_simple_post_config data;
-
-    memset(&data, 0, sizeof(data));
-    adf_interface_simple_post_config_buf(&data.buf, overlay_engine, w, h, format,
-            buf_fd, offset, pitch, acquire_fence);
-    ret = ioctl(fd, ADF_SIMPLE_POST_CONFIG, &data);
-    if (ret < 0)
-        return -errno;
-
-    return (int)data.complete_fence;
-}
-
-int adf_interface_simple_post_v2(int fd, adf_id_t overlay_engine,
-        __u32 w, __u32 h, __u32 format, int buf_fd, __u32 offset,
-        __u32 pitch, int acquire_fence,
-        enum adf_complete_fence_type complete_fence_type,
-        int *complete_fence)
-{
-    int ret;
-    struct adf_simple_post_config_v2 data;
-
-    memset(&data, 0, sizeof(data));
-    adf_interface_simple_post_config_buf(&data.buf, overlay_engine, w, h, format,
-            buf_fd, offset, pitch, acquire_fence);
-    data.complete_fence_type = complete_fence_type;
-
-    ret = ioctl(fd, ADF_SIMPLE_POST_CONFIG_V2, &data);
-    if (ret < 0)
-        return -errno;
-
-    if (complete_fence)
-        *complete_fence = data.complete_fence;
-    else if (data.complete_fence >= 0)
-        close(data.complete_fence);
-
-    return 0;
-}
-
-ssize_t adf_overlay_engines(struct adf_device *dev, adf_id_t **overlay_engines)
-{
-    char pattern[64];
-
-    snprintf(pattern, sizeof(pattern), "adf-overlay-engine%u.%%u", dev->id);
-    return adf_find_nodes(pattern, overlay_engines);
-}
-
-ssize_t adf_overlay_engines_for_interface(struct adf_device *dev,
-        adf_id_t interface, adf_id_t **overlay_engines)
-{
-    struct adf_device_data data;
-    auto err = adf_get_device_data(dev, &data);
-    if (err < 0)
-        return err;
-
-    std::vector<adf_id_t> ids;
-    if (data.allowed_attachments != nullptr)
-        for (size_t i = 0; i < data.n_allowed_attachments; i++)
-            if (data.allowed_attachments[i].interface == interface)
-                ids.push_back(data.allowed_attachments[i].overlay_engine);
-
-    return adf_id_vector_to_array(ids, overlay_engines);
-}
-
-static ssize_t adf_overlay_engines_filter(struct adf_device *dev,
-        adf_id_t *in, size_t n_in, adf_id_t **out,
-        bool (*filter)(struct adf_overlay_engine_data *data, void *cookie),
-        void *cookie)
-{
-    std::vector<adf_id_t> ids;
-    size_t i;
-    for (i = 0; i < n_in; i++) {
-        int fd = adf_overlay_engine_open(dev, in[i], O_RDONLY);
-        if (fd < 0)
-            return fd;
-
-        struct adf_overlay_engine_data data;
-        auto ret = adf_get_overlay_engine_data(fd, &data);
-        close(fd);
-        if (ret < 0)
-            return ret;
-
-        if (filter(&data, cookie))
-            ids.push_back(in[i]);
-    }
-
-    return adf_id_vector_to_array(ids, out);
-}
-
-struct format_filter_cookie {
-    const __u32 *formats;
-    size_t n_formats;
-};
-
-static bool adf_overlay_engine_format_filter(
-        struct adf_overlay_engine_data *data, void *cookie)
-{
-    auto c = static_cast<format_filter_cookie *>(cookie);
-    size_t i;
-    for (i = 0; i < data->n_supported_formats; i++) {
-        size_t j;
-        for (j = 0; j < c->n_formats; j++)
-            if (data->supported_formats[i] == c->formats[j])
-                return true;
-    }
-    return false;
-}
-
-ssize_t adf_overlay_engines_filter_by_format(struct adf_device *dev,
-        const __u32 *formats, size_t n_formats, adf_id_t *in, size_t n_in,
-        adf_id_t **out)
-{
-    struct format_filter_cookie cookie = { formats, n_formats };
-    return adf_overlay_engines_filter(dev, in, n_in, out,
-            adf_overlay_engine_format_filter, &cookie);
-}
-
-int adf_overlay_engine_open(struct adf_device *dev, adf_id_t id, int flags)
-{
-    char filename[64];
-
-    snprintf(filename, sizeof(filename),
-            ADF_BASE_PATH "adf-overlay-engine%u.%u", dev->id, id);
-
-    int fd = open(filename, flags);
-    if (fd < 0)
-        return -errno;
-    return fd;
-}
-
-int adf_get_overlay_engine_data(int fd, struct adf_overlay_engine_data *data)
-{
-    int err;
-    int ret = 0;
-
-    memset(data, 0, sizeof(*data));
-
-    err = ioctl(fd, ADF_GET_OVERLAY_ENGINE_DATA, data);
-    if (err < 0)
-        return -errno;
-
-    if (data->n_supported_formats)
-        data->supported_formats = new __u32[data->n_supported_formats];
-
-    if (data->custom_data_size)
-      data->custom_data = new char[data->custom_data_size];
-
-    err = ioctl(fd, ADF_GET_OVERLAY_ENGINE_DATA, data);
-    if (err < 0) {
-        ret = -errno;
-        adf_free_overlay_engine_data(data);
-    }
-    return ret;
-}
-
-void adf_free_overlay_engine_data(struct adf_overlay_engine_data *data)
-{
-    delete [] data->supported_formats;
-    data->supported_formats = nullptr;
-    delete [] static_cast<char *>(data->custom_data);
-    data->custom_data = nullptr;
-}
-
-bool adf_overlay_engine_supports_format(int fd, __u32 format)
-{
-    struct adf_overlay_engine_data data;
-    bool ret = false;
-    size_t i;
-
-    int err = adf_get_overlay_engine_data(fd, &data);
-    if (err < 0)
-        return false;
-
-    if (data.supported_formats != nullptr) {
-        for (i = 0; i < data.n_supported_formats; i++) {
-            if (data.supported_formats[i] == format) {
-                ret = true;
-                break;
-            }
-        }
-    }
-
-    adf_free_overlay_engine_data(&data);
-    return ret;
-}
-
-int adf_set_event(int fd, enum adf_event_type type, bool enabled)
-{
-    struct adf_set_event data;
-
-    data.type = type;
-    data.enabled = enabled;
-
-    int err = ioctl(fd, ADF_SET_EVENT, &data);
-    if (err < 0)
-        return -errno;
-    return 0;
-}
-
-int adf_read_event(int fd, struct adf_event **event)
-{
-    struct adf_event header;
-    struct event_with_data {
-        struct adf_event base;
-        uint8_t data[0];
-    };
-    using unique_event = std::unique_ptr<event_with_data, decltype(&free)>;
-    size_t data_size;
-
-    int err = read(fd, &header, sizeof(header));
-    if (err < 0)
-        return -errno;
-    if ((size_t)err < sizeof(header))
-        return -EIO;
-    if (header.length < sizeof(header))
-        return -EIO;
-
-    // Again, we can't use new[] since the existing API says the caller should
-    // free() the returned event
-    auto event_ptr = static_cast<event_with_data *>(malloc(header.length));
-    unique_event event_ret{event_ptr, free};
-    if (!event_ret)
-        return -ENOMEM;
-    data_size = header.length - sizeof(header);
-
-    memcpy(event_ret.get(), &header, sizeof(header));
-    ssize_t read_size = read(fd, &event_ret->data, data_size);
-    if (read_size < 0)
-        return -errno;
-    if ((size_t)read_size < data_size)
-        return -EIO;
-
-    *event = &event_ret.release()->base;
-    return 0;
-}
-
-void adf_format_str(__u32 format, char buf[ADF_FORMAT_STR_SIZE])
-{
-    buf[0] = format & 0xFF;
-    buf[1] = (format >> 8) & 0xFF;
-    buf[2] = (format >> 16) & 0xFF;
-    buf[3] = (format >> 24) & 0xFF;
-    buf[4] = '\0';
-}
-
-static bool adf_find_simple_post_overlay_engine(struct adf_device *dev,
-        const __u32 *formats, size_t n_formats,
-        adf_id_t interface, adf_id_t *overlay_engine)
-{
-    adf_id_t *engs = nullptr;
-    ssize_t n_engs = adf_overlay_engines_for_interface(dev, interface, &engs);
-
-    if (engs == nullptr)
-        return false;
-
-    adf_id_t *filtered_engs = nullptr;
-    ssize_t n_filtered_engs = adf_overlay_engines_filter_by_format(dev,
-            formats, n_formats, engs, n_engs, &filtered_engs);
-    free(engs);
-
-    if (filtered_engs == nullptr)
-        return false;
-
-    *overlay_engine = filtered_engs[0];
-    free(filtered_engs);
-    return true;
-}
-
-static const __u32 any_rgb_format[] = {
-    DRM_FORMAT_C8,
-    DRM_FORMAT_RGB332,
-    DRM_FORMAT_BGR233,
-    DRM_FORMAT_XRGB1555,
-    DRM_FORMAT_XBGR1555,
-    DRM_FORMAT_RGBX5551,
-    DRM_FORMAT_BGRX5551,
-    DRM_FORMAT_ARGB1555,
-    DRM_FORMAT_ABGR1555,
-    DRM_FORMAT_RGBA5551,
-    DRM_FORMAT_BGRA5551,
-    DRM_FORMAT_RGB565,
-    DRM_FORMAT_BGR565,
-    DRM_FORMAT_RGB888,
-    DRM_FORMAT_BGR888,
-    DRM_FORMAT_XRGB8888,
-    DRM_FORMAT_XBGR8888,
-    DRM_FORMAT_RGBX8888,
-    DRM_FORMAT_BGRX8888,
-    DRM_FORMAT_XRGB2101010,
-    DRM_FORMAT_XBGR2101010,
-    DRM_FORMAT_RGBX1010102,
-    DRM_FORMAT_BGRX1010102,
-    DRM_FORMAT_ARGB2101010,
-    DRM_FORMAT_ABGR2101010,
-    DRM_FORMAT_RGBA1010102,
-    DRM_FORMAT_BGRA1010102,
-    DRM_FORMAT_ARGB8888,
-    DRM_FORMAT_ABGR8888,
-    DRM_FORMAT_RGBA8888,
-    DRM_FORMAT_BGRA8888,
-};
-
-int adf_find_simple_post_configuration(struct adf_device *dev,
-        const __u32 *formats, size_t n_formats,
-        adf_id_t *interface, adf_id_t *overlay_engine)
-{
-    adf_id_t *intfs = NULL;
-    ssize_t n_intfs = adf_interfaces(dev, &intfs);
-
-    if (n_intfs < 0)
-        return n_intfs;
-    else if (!intfs)
-        return -ENODEV;
-
-    adf_id_t *primary_intfs = nullptr;
-    ssize_t n_primary_intfs = adf_interfaces_filter_by_flag(dev,
-            ADF_INTF_FLAG_PRIMARY, intfs, n_intfs, &primary_intfs);
-    free(intfs);
-
-    if (n_primary_intfs < 0)
-        return n_primary_intfs;
-    else if (!primary_intfs)
-        return -ENODEV;
-
-    if (!formats) {
-        formats = any_rgb_format;
-        n_formats = sizeof(any_rgb_format) / sizeof(any_rgb_format[0]);
-    }
-
-    bool found = false;
-    ssize_t i = 0;
-    for (i = 0; i < n_primary_intfs; i++) {
-        found = adf_find_simple_post_overlay_engine(dev, formats, n_formats,
-                primary_intfs[i], overlay_engine);
-        if (found) {
-            *interface = primary_intfs[i];
-            break;
-        }
-    }
-    free(primary_intfs);
-
-    if (!found)
-        return -ENODEV;
-
-    return 0;
-}
diff --git a/deprecated-adf/libadf/include/adf/adf.h b/deprecated-adf/libadf/include/adf/adf.h
deleted file mode 100644
index e4c7b28..0000000
--- a/deprecated-adf/libadf/include/adf/adf.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _LIBADF_ADF_H_
-#define _LIBADF_ADF_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <video/adf.h>
-
-typedef __u32 adf_id_t;
-
-struct adf_device {
-    adf_id_t id;
-    int fd;
-};
-
-__BEGIN_DECLS
-
-/**
- * Enumerates all ADF devices.
- *
- * Returns the number of ADF devices, and sets ids to a list of device IDs.
- * The caller must free() the returned list of device IDs.
- *
- * On error, returns -errno.
- */
-ssize_t adf_devices(adf_id_t **ids);
-
-/**
- * Opens an ADF device.
- *
- * On error, returns -errno.
- */
-int adf_device_open(adf_id_t id, int flags, struct adf_device *dev);
-/**
- * Closes an ADF device.
- */
-void adf_device_close(struct adf_device *dev);
-/**
- * Reads the ADF device data.
- *
- * adf_get_device_data() allocates buffers inside data, which the caller
- * must free by calling adf_free_device_data().  On error, returns -errno.
- */
-int adf_get_device_data(struct adf_device *dev, struct adf_device_data *data);
-/**
- * Frees the device data returned by adf_get_device_data().
- */
-void adf_free_device_data(struct adf_device_data *data);
-
-/**
- * Atomically posts a new display configuration to the specified interfaces.
- *
- * Returns a sync fence fd that will fire when the configuration is removed
- * from the screen.  On error, returns -errno.
- */
-int adf_device_post(struct adf_device *dev,
-        adf_id_t *interfaces, size_t n_interfaces,
-        struct adf_buffer_config *bufs, size_t n_bufs,
-        void *custom_data, size_t custom_data_size);
-/**
- * Atomically posts a new display configuration to the specified interfaces.
- *
- * Compared to adf_device_post(), adf_device_post_v2():
- *
- *  (*) allows the client to choose the kind of sync fence returned
- *      (through complete_fence_type)
- *
- *  (*) stores the returned sync fence fd in a provided buffer, so the client
- *      can distinguish between a permission error (ret = -1) and a successful
- *      call that returns no fence (*complete_fence = -1)
- *
- * On error, returns -errno.
- *
- * On devices without the corresponding kernel support, returns -ENOTTY.
- */
-int adf_device_post_v2(struct adf_device *dev,
-        adf_id_t *interfaces, __u32 n_interfaces,
-        struct adf_buffer_config *bufs, __u32 n_bufs,
-        void *custom_data, __u64 custom_data_size,
-        enum adf_complete_fence_type complete_fence_type,
-        int *complete_fence);
-
-/**
- * Attaches the specified interface and overlay engine.
- */
-int adf_device_attach(struct adf_device *dev, adf_id_t overlay_engine,
-                      adf_id_t interface);
-/**
- * Detaches the specified interface and overlay engine.
- */
-int adf_device_detach(struct adf_device *dev, adf_id_t overlay_engine,
-                      adf_id_t interface);
-
-/**
- * Enumerates all interfaces belonging to an ADF device.
- *
- * The caller must free() the returned list of interface IDs.
- */
-ssize_t adf_interfaces(struct adf_device *dev, adf_id_t **interfaces);
-
-/**
- * Enumerates all interfaces which can be attached to the specified overlay
- * engine.
- *
- * The caller must free() the returned list of interface IDs.
- */
-ssize_t adf_interfaces_for_overlay_engine(struct adf_device *dev,
-        adf_id_t overlay_engine, adf_id_t **interfaces);
-/**
- * Filters a list of interfaces by type.
- *
- * Returns the number of matching interfaces, and sets out to a list of matching
- * interface IDs.  The caller must free() the returned list of interface IDs.
- *
- * On error, returns -errno.
- */
-ssize_t adf_interfaces_filter_by_type(struct adf_device *dev,
-        enum adf_interface_type type,
-        adf_id_t *in, size_t n_in, adf_id_t **out);
-/**
- * Filters a list of interfaces by flag.
- *
- * The caller must free() the returned list of interface IDs.
- */
-ssize_t adf_interfaces_filter_by_flag(struct adf_device *dev, __u32 flag,
-        adf_id_t *in, size_t n_in, adf_id_t **out);
-
-/**
- * Opens an ADF interface.
- *
- * Returns a file descriptor.  The caller must close() the fd when done.
- * On error, returns -errno.
- */
-int adf_interface_open(struct adf_device *dev, adf_id_t id, int flags);
-/**
- * Reads the interface data.
- *
- * adf_get_interface_data() allocates buffers inside data, which the caller
- * must free by calling adf_free_interface_data().  On error, returns -errno.
- */
-int adf_get_interface_data(int fd, struct adf_interface_data *data);
-/**
- * Frees the interface data returned by adf_get_interface_data().
- */
-void adf_free_interface_data(struct adf_interface_data *data);
-
-/**
- * Sets the interface's DPMS mode.
- */
-int adf_interface_blank(int fd, __u8 mode);
-/**
- * Sets the interface's display mode.
- */
-int adf_interface_set_mode(int fd, struct drm_mode_modeinfo *mode);
-/**
- * Allocates a single-plane RGB buffer of the specified size and format.
- *
- * Returns a dma-buf fd.  On error, returns -errno.
- */
-int adf_interface_simple_buffer_alloc(int fd, __u32 w, __u32 h,
-        __u32 format, __u32 *offset, __u32 *pitch);
-/**
- * Posts a single-plane RGB buffer to the display using the specified
- * overlay engine.
- *
- * Returns a sync fence fd that will fire when the buffer is removed
- * from the screen.  On error, returns -errno.
- */
-int adf_interface_simple_post(int fd, adf_id_t overlay_engine,
-        __u32 w, __u32 h, __u32 format, int buf_fd, __u32 offset,
-        __u32 pitch, int acquire_fence);
-/**
- * Posts a single-plane RGB buffer to the display using the specified
- * overlay engine.
- *
- * Compared to adf_interface_simple_post(), adf_interface_simple_post_v2():
- *
- *  (*) allows the client to choose the kind of sync fence returned
- *      (through complete_fence_type)
- *
- *  (*) stores the returned sync fence fd in a provided buffer, so the client
- *      can distinguish between a permission error (ret = -1) and a successful
- *      call that returns no fence (*complete_fence = -1)
- *
- * On error, returns -errno.
- *
- * On devices without the corresponding kernel support, returns -ENOTTY.
- */
-int adf_interface_simple_post_v2(int fd, adf_id_t overlay_engine,
-        __u32 w, __u32 h, __u32 format, int buf_fd, __u32 offset,
-        __u32 pitch, int acquire_fence,
-        enum adf_complete_fence_type complete_fence_type,
-        int *complete_fence);
-
-/**
- * Enumerates all overlay engines belonging to an ADF device.
- *
- * The caller must free() the returned list of overlay engine IDs.
- */
-ssize_t adf_overlay_engines(struct adf_device *dev, adf_id_t **overlay_engines);
-
-/**
- * Enumerates all overlay engines which can be attached to the specified
- * interface.
- *
- * The caller must free() the returned list of overlay engine IDs.
- */
-ssize_t adf_overlay_engines_for_interface(struct adf_device *dev,
-        adf_id_t interface, adf_id_t **overlay_engines);
-/**
- * Filters a list of overlay engines by supported buffer format.
- *
- * Returns the overlay engines which support at least one of the specified
- * formats.  The caller must free() the returned list of overlay engine IDs.
- */
-ssize_t adf_overlay_engines_filter_by_format(struct adf_device *dev,
-        const __u32 *formats, size_t n_formats, adf_id_t *in, size_t n_in,
-        adf_id_t **out);
-
-/**
- * Opens an ADF overlay engine.
- *
- * Returns a file descriptor.  The caller must close() the fd when done.
- * On error, returns -errno.
- */
-int adf_overlay_engine_open(struct adf_device *dev, adf_id_t id, int flags);
-/**
- * Reads the overlay engine data.
- *
- * adf_get_overlay_engine_data() allocates buffers inside data, which the caller
- * must free by calling adf_free_overlay_engine_data().  On error, returns
- * -errno.
- */
-int adf_get_overlay_engine_data(int fd, struct adf_overlay_engine_data *data);
-/**
- * Frees the overlay engine data returned by adf_get_overlay_engine_data().
- */
-void adf_free_overlay_engine_data(struct adf_overlay_engine_data *data);
-
-/**
- * Returns whether the overlay engine supports the specified format.
- */
-bool adf_overlay_engine_supports_format(int fd, __u32 format);
-
-/**
- * Subscribes or unsubscribes from the specified hardware event.
- */
-int adf_set_event(int fd, enum adf_event_type type, bool enabled);
-/**
- * Reads one event from the fd, blocking if needed.
- *
- * The caller must free() the returned buffer.  On error, returns -errno.
- */
-int adf_read_event(int fd, struct adf_event **event);
-
-#define ADF_FORMAT_STR_SIZE 5
-/**
- * Converts an ADF/DRM fourcc format to its string representation.
- */
-void adf_format_str(__u32 format, char buf[ADF_FORMAT_STR_SIZE]);
-
-/**
- * Finds an appropriate interface and overlay engine for a simple post.
- *
- * Specifically, finds the primary interface, and an overlay engine
- * that can be attached to the primary interface and supports one of the
- * specified formats.  The caller may pass a NULL formats list, to indicate that
- * any RGB format is acceptable.
- *
- * On error, returns -errno.
- */
-int adf_find_simple_post_configuration(struct adf_device *dev,
-        const __u32 *formats, size_t n_formats,
-        adf_id_t *interface, adf_id_t *overlay_engine);
-
-__END_DECLS
-
-#endif /* _LIBADF_ADF_H_ */
diff --git a/deprecated-adf/libadf/include/video/adf.h b/deprecated-adf/libadf/include/video/adf.h
deleted file mode 100644
index 692a425..0000000
--- a/deprecated-adf/libadf/include/video/adf.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_VIDEO_ADF_H_
-#define _UAPI_VIDEO_ADF_H_
-#include <linux/ioctl.h>
-#include <linux/types.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#include <drm/drm_fourcc.h>
-#include <drm/drm_mode.h>
-#define ADF_NAME_LEN 32
-#define ADF_MAX_CUSTOM_DATA_SIZE 4096
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum adf_interface_type {
-  ADF_INTF_DSI = 0,
-  ADF_INTF_eDP = 1,
-  ADF_INTF_DPI = 2,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  ADF_INTF_VGA = 3,
-  ADF_INTF_DVI = 4,
-  ADF_INTF_HDMI = 5,
-  ADF_INTF_MEMORY = 6,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  ADF_INTF_TYPE_DEVICE_CUSTOM = 128,
-  ADF_INTF_TYPE_MAX = (~(__u32) 0),
-};
-#define ADF_INTF_FLAG_PRIMARY (1 << 0)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_INTF_FLAG_EXTERNAL (1 << 1)
-enum adf_event_type {
-  ADF_EVENT_VSYNC = 0,
-  ADF_EVENT_HOTPLUG = 1,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  ADF_EVENT_DEVICE_CUSTOM = 128,
-  ADF_EVENT_TYPE_MAX = 255,
-};
-enum adf_complete_fence_type {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  ADF_COMPLETE_FENCE_NONE = 0,
-  ADF_COMPLETE_FENCE_PRESENT = 1,
-  ADF_COMPLETE_FENCE_RELEASE = 2,
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct adf_set_event {
-  __u8 type;
-  __u8 enabled;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct adf_event {
-  __u8 type;
-  __u32 length;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct adf_vsync_event {
-  struct adf_event base;
-  __aligned_u64 timestamp;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct adf_hotplug_event {
-  struct adf_event base;
-  __u8 connected;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_MAX_PLANES 4
-struct adf_buffer_config {
-  __u32 overlay_engine;
-  __u32 w;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u32 h;
-  __u32 format;
-  __s32 fd[ADF_MAX_PLANES];
-  __u32 offset[ADF_MAX_PLANES];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u32 pitch[ADF_MAX_PLANES];
-  __u8 n_planes;
-  __s32 acquire_fence;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_MAX_BUFFERS (4096 / sizeof(struct adf_buffer_config))
-struct adf_post_config {
-  size_t n_interfaces;
-  __u32 __user * interfaces;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  size_t n_bufs;
-  struct adf_buffer_config __user * bufs;
-  size_t custom_data_size;
-  void __user * custom_data;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __s32 complete_fence;
-};
-struct adf_post_config_v2 {
-  __u32 n_interfaces;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u64 interfaces;
-  __u32 n_bufs;
-  __u64 bufs;
-  __u64 custom_data_size;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u64 custom_data;
-  __s32 complete_fence;
-  __u8 complete_fence_type;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_MAX_INTERFACES (4096 / sizeof(__u32))
-struct adf_simple_buffer_alloc {
-  __u16 w;
-  __u16 h;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u32 format;
-  __s32 fd;
-  __u32 offset;
-  __u32 pitch;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct adf_simple_post_config {
-  struct adf_buffer_config buf;
-  __s32 complete_fence;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct adf_simple_post_config_v2 {
-  struct adf_buffer_config buf;
-  __s32 complete_fence;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u8 complete_fence_type;
-};
-struct adf_attachment_config {
-  __u32 overlay_engine;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u32 interface;
-};
-struct adf_device_data {
-  char name[ADF_NAME_LEN];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  size_t n_attachments;
-  struct adf_attachment_config __user * attachments;
-  size_t n_allowed_attachments;
-  struct adf_attachment_config __user * allowed_attachments;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  size_t custom_data_size;
-  void __user * custom_data;
-};
-#define ADF_MAX_ATTACHMENTS (4096 / sizeof(struct adf_attachment_config))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct adf_interface_data {
-  char name[ADF_NAME_LEN];
-  __u32 type;
-  __u32 id;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u32 flags;
-  __u8 dpms_state;
-  __u8 hotplug_detect;
-  __u16 width_mm;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  __u16 height_mm;
-  struct drm_mode_modeinfo current_mode;
-  size_t n_available_modes;
-  struct drm_mode_modeinfo __user * available_modes;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  size_t custom_data_size;
-  void __user * custom_data;
-};
-#define ADF_MAX_MODES (4096 / sizeof(struct drm_mode_modeinfo))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct adf_overlay_engine_data {
-  char name[ADF_NAME_LEN];
-  size_t n_supported_formats;
-  __u32 __user * supported_formats;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-  size_t custom_data_size;
-  void __user * custom_data;
-};
-#define ADF_MAX_SUPPORTED_FORMATS (4096 / sizeof(__u32))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_IOCTL_TYPE 'D'
-#define ADF_IOCTL_NR_CUSTOM 128
-#define ADF_SET_EVENT _IOW(ADF_IOCTL_TYPE, 0, struct adf_set_event)
-#define ADF_BLANK _IOW(ADF_IOCTL_TYPE, 1, __u8)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_POST_CONFIG _IOW(ADF_IOCTL_TYPE, 2, struct adf_post_config)
-#define ADF_SET_MODE _IOW(ADF_IOCTL_TYPE, 3, struct drm_mode_modeinfo)
-#define ADF_GET_DEVICE_DATA _IOR(ADF_IOCTL_TYPE, 4, struct adf_device_data)
-#define ADF_GET_INTERFACE_DATA _IOR(ADF_IOCTL_TYPE, 5, struct adf_interface_data)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_GET_OVERLAY_ENGINE_DATA _IOR(ADF_IOCTL_TYPE, 6, struct adf_overlay_engine_data)
-#define ADF_SIMPLE_POST_CONFIG _IOW(ADF_IOCTL_TYPE, 7, struct adf_simple_post_config)
-#define ADF_SIMPLE_BUFFER_ALLOC _IOW(ADF_IOCTL_TYPE, 8, struct adf_simple_buffer_alloc)
-#define ADF_ATTACH _IOW(ADF_IOCTL_TYPE, 9, struct adf_attachment_config)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ADF_DETACH _IOW(ADF_IOCTL_TYPE, 10, struct adf_attachment_config)
-#define ADF_POST_CONFIG_V2 _IOW(ADF_IOCTL_TYPE, 11, struct adf_post_config_v2)
-#define ADF_SIMPLE_POST_CONFIG_V2 _IOW(ADF_IOCTL_TYPE, 12, struct adf_simple_post_config_v2)
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-
diff --git a/deprecated-adf/libadf/original-kernel-headers/video/adf.h b/deprecated-adf/libadf/original-kernel-headers/video/adf.h
deleted file mode 100644
index 8293c1d..0000000
--- a/deprecated-adf/libadf/original-kernel-headers/video/adf.h
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (C) 2013 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _UAPI_VIDEO_ADF_H_
-#define _UAPI_VIDEO_ADF_H_
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-#include <drm/drm_fourcc.h>
-#include <drm/drm_mode.h>
-
-#define ADF_NAME_LEN 32
-#define ADF_MAX_CUSTOM_DATA_SIZE 4096
-
-enum adf_interface_type {
-	ADF_INTF_DSI = 0,
-	ADF_INTF_eDP = 1,
-	ADF_INTF_DPI = 2,
-	ADF_INTF_VGA = 3,
-	ADF_INTF_DVI = 4,
-	ADF_INTF_HDMI = 5,
-	ADF_INTF_MEMORY = 6,
-	ADF_INTF_TYPE_DEVICE_CUSTOM = 128,
-	ADF_INTF_TYPE_MAX = (~(__u32)0),
-};
-
-#define ADF_INTF_FLAG_PRIMARY (1 << 0)
-#define ADF_INTF_FLAG_EXTERNAL (1 << 1)
-
-enum adf_event_type {
-	ADF_EVENT_VSYNC = 0,
-	ADF_EVENT_HOTPLUG = 1,
-	ADF_EVENT_DEVICE_CUSTOM = 128,
-	ADF_EVENT_TYPE_MAX = 255,
-};
-
-enum adf_complete_fence_type {
-	/* no fence */
-	ADF_COMPLETE_FENCE_NONE = 0,
-	/* fence fires when the configuration appears on the screen */
-	ADF_COMPLETE_FENCE_PRESENT = 1,
-	/* fence fires when the configuration leaves the screen */
-	ADF_COMPLETE_FENCE_RELEASE = 2,
-};
-
-/**
- * struct adf_set_event - start or stop subscribing to ADF events
- *
- * @type: the type of event to (un)subscribe
- * @enabled: subscribe or unsubscribe
- *
- * After subscribing to an event, userspace may poll() the ADF object's fd
- * to wait for events or read() to consume the event's data.
- *
- * ADF reserves event types 0 to %ADF_EVENT_DEVICE_CUSTOM-1 for its own events.
- * Devices may use event types %ADF_EVENT_DEVICE_CUSTOM to %ADF_EVENT_TYPE_MAX-1
- * for driver-private events.
- */
-struct adf_set_event {
-	__u8 type;
-	__u8 enabled;
-};
-
-/**
- * struct adf_event - common header for ADF event data
- *
- * @type: event type
- * @length: total size of event data, header inclusive
- */
-struct adf_event {
-	__u8 type;
-	__u32 length;
-};
-
-/**
- * struct adf_vsync_event - ADF vsync event
- *
- * @base: event header (see &struct adf_event)
- * @timestamp: time of vsync event, in nanoseconds
- */
-struct adf_vsync_event {
-	struct adf_event base;
-	__aligned_u64 timestamp;
-};
-
-/**
- * struct adf_vsync_event - ADF display hotplug event
- *
- * @base: event header (see &struct adf_event)
- * @connected: whether a display is now connected to the interface
- */
-struct adf_hotplug_event {
-	struct adf_event base;
-	__u8 connected;
-};
-
-#define ADF_MAX_PLANES 4
-/**
- * struct adf_buffer_config - description of buffer displayed by adf_post_config
- *
- * @overlay_engine: id of the target overlay engine
- * @w: width of display region in pixels
- * @h: height of display region in pixels
- * @format: DRM-style fourcc, see drm_fourcc.h for standard formats
- * @fd: dma_buf fd for each plane
- * @offset: location of first pixel to scan out, in bytes
- * @pitch: stride (i.e. length of a scanline including padding) in bytes
- * @n_planes: number of planes in buffer
- * @acquire_fence: sync_fence fd which will clear when the buffer is
- *	ready for display, or <0 if the buffer is already ready
- */
-struct adf_buffer_config {
-	__u32 overlay_engine;
-
-	__u32 w;
-	__u32 h;
-	__u32 format;
-
-	__s32 fd[ADF_MAX_PLANES];
-	__u32 offset[ADF_MAX_PLANES];
-	__u32 pitch[ADF_MAX_PLANES];
-	__u8 n_planes;
-
-	__s32 acquire_fence;
-};
-#define ADF_MAX_BUFFERS (4096 / sizeof(struct adf_buffer_config))
-
-/**
- * struct adf_post_config - request to flip to a new set of buffers
- *
- * This request is equivalent to &struct adf_post_config_v2 with
- * @complete_fence_type = %ADF_COMPLETE_FENCE_RELEASE.
- *
- * @n_interfaces: number of interfaces targeted by the flip (input)
- * @interfaces: ids of interfaces targeted by the flip (input)
- * @n_bufs: number of buffers displayed (input)
- * @bufs: description of buffers displayed (input)
- * @custom_data_size: size of driver-private data (input)
- * @custom_data: driver-private data (input)
- * @complete_fence: sync_fence fd which will clear when this
- *	configuration has left the screen (output)
- */
-struct adf_post_config {
-	size_t n_interfaces;
-	__u32 __user *interfaces;
-
-	size_t n_bufs;
-	struct adf_buffer_config __user *bufs;
-
-	size_t custom_data_size;
-	void __user *custom_data;
-
-	__s32 complete_fence;
-};
-
-/**
- * struct adf_post_config_v2 - request to flip to a new set of buffers
- *
- * @n_interfaces: number of interfaces targeted by the flip (input)
- * @interfaces: ids of interfaces targeted by the flip (input)
- * @n_bufs: number of buffers displayed (input)
- * @bufs: description of buffers displayed (input)
- * @custom_data_size: size of driver-private data (input)
- * @custom_data: driver-private data (input)
- * @complete_fence_type: one of &enum adf_complete_fence_type describing what
- * 	fence to return (input)
- * @complete_fence: sync_fence fd which will fire at the time
- * 	requested by @complete_fence_type (output)
- */
-struct adf_post_config_v2 {
-	__u32 n_interfaces;
-	__u64 interfaces; /* __u32 * packed into __u64 */
-
-	__u32 n_bufs;
-	__u64 bufs; /* struct adf_buffer_config * packed into __u64 */
-
-	__u64 custom_data_size;
-	__u64 custom_data; /* void * packed into __u64 */
-
-	__s32 complete_fence;
-	__u8 complete_fence_type;
-};
-#define ADF_MAX_INTERFACES (4096 / sizeof(__u32))
-
-/**
- * struct adf_simple_buffer_allocate - request to allocate a "simple" buffer
- *
- * @w: width of buffer in pixels (input)
- * @h: height of buffer in pixels (input)
- * @format: DRM-style fourcc (input)
- *
- * @fd: dma_buf fd (output)
- * @offset: location of first pixel, in bytes (output)
- * @pitch: length of a scanline including padding, in bytes (output)
- *
- * Simple buffers are analogous to DRM's "dumb" buffers.  They have a single
- * plane of linear RGB data which can be allocated and scanned out without
- * any driver-private ioctls or data.
- *
- * @format must be a standard RGB format defined in drm_fourcc.h.
- *
- * ADF clients must NOT assume that an interface can scan out a simple buffer
- * allocated by a different ADF interface, even if the two interfaces belong to
- * the same ADF device.
- */
-struct adf_simple_buffer_alloc {
-	__u16 w;
-	__u16 h;
-	__u32 format;
-
-	__s32 fd;
-	__u32 offset;
-	__u32 pitch;
-};
-
-/**
- * struct adf_simple_post_config - request to flip to a single buffer without
- * driver-private data
- *
- * This request is equivalent to &struct adf_simple_post_config_v2 with
- * @complete_fence_type = %ADF_COMPLETE_FENCE_RELEASE.
- *
- * @buf: description of buffer displayed (input)
- * @complete_fence: sync_fence fd which will clear when this buffer has left the
- * screen (output)
- */
-struct adf_simple_post_config {
-	struct adf_buffer_config buf;
-	__s32 complete_fence;
-};
-
-/**
- * struct adf_simple_post_config_v2 - request to flip to a single buffer without
- * driver-private data
- *
- * @buf: description of buffer displayed (input)
- * @complete_fence_type: one of &enum adf_complete_fence_type describing what
- * 	fence to return (input)
- * @complete_fence: sync_fence fd which will fire at the time
- * 	requested by @complete_fence_type (output)
- */
-struct adf_simple_post_config_v2 {
-	struct adf_buffer_config buf;
-	__s32 complete_fence;
-	__u8 complete_fence_type;
-};
-
-/**
- * struct adf_attachment_config - description of attachment between an overlay
- * engine and an interface
- *
- * @overlay_engine: id of the overlay engine
- * @interface: id of the interface
- */
-struct adf_attachment_config {
-	__u32 overlay_engine;
-	__u32 interface;
-};
-
-/**
- * struct adf_device_data - describes a display device
- *
- * @name: display device's name
- * @n_attachments: the number of current attachments
- * @attachments: list of current attachments
- * @n_allowed_attachments: the number of allowed attachments
- * @allowed_attachments: list of allowed attachments
- * @custom_data_size: size of driver-private data
- * @custom_data: driver-private data
- */
-struct adf_device_data {
-	char name[ADF_NAME_LEN];
-
-	size_t n_attachments;
-	struct adf_attachment_config __user *attachments;
-
-	size_t n_allowed_attachments;
-	struct adf_attachment_config __user *allowed_attachments;
-
-	size_t custom_data_size;
-	void __user *custom_data;
-};
-#define ADF_MAX_ATTACHMENTS (4096 / sizeof(struct adf_attachment_config))
-
-/**
- * struct adf_device_data - describes a display interface
- *
- * @name: display interface's name
- * @type: interface type (see enum @adf_interface_type)
- * @id: which interface of type @type;
- *	e.g. interface DSI.1 -> @type=@ADF_INTF_TYPE_DSI, @id=1
- * @flags: informational flags (bitmask of %ADF_INTF_FLAG_* values)
- * @dpms_state: DPMS state (one of @DRM_MODE_DPMS_* defined in drm_mode.h)
- * @hotplug_detect: whether a display is plugged in
- * @width_mm: screen width in millimeters, or 0 if unknown
- * @height_mm: screen height in millimeters, or 0 if unknown
- * @current_mode: current display mode
- * @n_available_modes: the number of hardware display modes
- * @available_modes: list of hardware display modes
- * @custom_data_size: size of driver-private data
- * @custom_data: driver-private data
- */
-struct adf_interface_data {
-	char name[ADF_NAME_LEN];
-
-	__u32 type;
-	__u32 id;
-	/* e.g. type=ADF_INTF_TYPE_DSI, id=1 => DSI.1 */
-	__u32 flags;
-
-	__u8 dpms_state;
-	__u8 hotplug_detect;
-	__u16 width_mm;
-	__u16 height_mm;
-
-	struct drm_mode_modeinfo current_mode;
-	size_t n_available_modes;
-	struct drm_mode_modeinfo __user *available_modes;
-
-	size_t custom_data_size;
-	void __user *custom_data;
-};
-#define ADF_MAX_MODES (4096 / sizeof(struct drm_mode_modeinfo))
-
-/**
- * struct adf_overlay_engine_data - describes an overlay engine
- *
- * @name: overlay engine's name
- * @n_supported_formats: number of supported formats
- * @supported_formats: list of supported formats
- * @custom_data_size: size of driver-private data
- * @custom_data: driver-private data
- */
-struct adf_overlay_engine_data {
-	char name[ADF_NAME_LEN];
-
-	size_t n_supported_formats;
-	__u32 __user *supported_formats;
-
-	size_t custom_data_size;
-	void __user *custom_data;
-};
-#define ADF_MAX_SUPPORTED_FORMATS (4096 / sizeof(__u32))
-
-#define ADF_IOCTL_TYPE		'D'
-#define ADF_IOCTL_NR_CUSTOM	128
-
-#define ADF_SET_EVENT		_IOW(ADF_IOCTL_TYPE, 0, struct adf_set_event)
-#define ADF_BLANK		_IOW(ADF_IOCTL_TYPE, 1, __u8)
-#define ADF_POST_CONFIG		_IOW(ADF_IOCTL_TYPE, 2, struct adf_post_config)
-#define ADF_SET_MODE		_IOW(ADF_IOCTL_TYPE, 3, \
-					struct drm_mode_modeinfo)
-#define ADF_GET_DEVICE_DATA	_IOR(ADF_IOCTL_TYPE, 4, struct adf_device_data)
-#define ADF_GET_INTERFACE_DATA	_IOR(ADF_IOCTL_TYPE, 5, \
-					struct adf_interface_data)
-#define ADF_GET_OVERLAY_ENGINE_DATA \
-				_IOR(ADF_IOCTL_TYPE, 6, \
-					struct adf_overlay_engine_data)
-#define ADF_SIMPLE_POST_CONFIG	_IOW(ADF_IOCTL_TYPE, 7, \
-					struct adf_simple_post_config)
-#define ADF_SIMPLE_BUFFER_ALLOC	_IOW(ADF_IOCTL_TYPE, 8, \
-					struct adf_simple_buffer_alloc)
-#define ADF_ATTACH		_IOW(ADF_IOCTL_TYPE, 9, \
-					struct adf_attachment_config)
-#define ADF_DETACH		_IOW(ADF_IOCTL_TYPE, 10, \
-					struct adf_attachment_config)
-
-#define ADF_POST_CONFIG_V2	_IOW(ADF_IOCTL_TYPE, 11, \
-					struct adf_post_config_v2)
-#define ADF_SIMPLE_POST_CONFIG_V2 \
-				_IOW(ADF_IOCTL_TYPE, 12, \
-					struct adf_simple_post_config_v2)
-
-#endif /* _UAPI_VIDEO_ADF_H_ */
diff --git a/deprecated-adf/libadf/tests/Android.bp b/deprecated-adf/libadf/tests/Android.bp
deleted file mode 100644
index 9b3430e..0000000
--- a/deprecated-adf/libadf/tests/Android.bp
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// Copyright (C) 2013 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.
-//
-
-cc_test {
-    name: "adf-unit-tests",
-    srcs: ["adf_test.cpp"],
-    shared_libs: ["libsync"],
-    static_libs: ["libadf"],
-    cflags: ["-Werror"],
-}
diff --git a/deprecated-adf/libadf/tests/adf_test.cpp b/deprecated-adf/libadf/tests/adf_test.cpp
deleted file mode 100644
index 82a91f4..0000000
--- a/deprecated-adf/libadf/tests/adf_test.cpp
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-
-#include <adf/adf.h>
-#include <gtest/gtest.h>
-#include <sys/mman.h>
-#include <sync/sync.h>
-
-class AdfTest : public testing::Test {
-public:
-    AdfTest() : intf_id(0), intf(-1), eng_id(0), eng(-1) { }
-
-    virtual void SetUp() {
-        int err = adf_device_open(dev_id, O_RDWR, &dev);
-        ASSERT_GE(err, 0) << "opening ADF device " << dev_id <<
-                " failed: " << strerror(-err);
-
-        err = adf_find_simple_post_configuration(&dev, fmt8888, n_fmt8888,
-                &intf_id, &eng_id);
-        ASSERT_GE(err, 0) << "finding ADF configuration failed: " <<
-                strerror(-err);
-
-        intf = adf_interface_open(&dev, intf_id, O_RDWR);
-        ASSERT_GE(intf, 0) << "opening ADF interface " << dev_id << "." <<
-                intf_id << " failed: " << strerror(-intf);
-
-        eng = adf_overlay_engine_open(&dev, eng_id, O_RDWR);
-        ASSERT_GE(eng, 0) << "opening ADF overlay engine " << dev_id << "." <<
-                eng_id << " failed: " << strerror(-eng);
-    }
-
-    virtual void TearDown() {
-        if (eng >= 0)
-            close(eng);
-        if (intf >= 0)
-            close(intf);
-        adf_device_close(&dev);
-    }
-
-    void get8888Format(uint32_t &fmt, char fmt_str[ADF_FORMAT_STR_SIZE]) {
-        adf_overlay_engine_data data;
-        int err = adf_get_overlay_engine_data(eng, &data);
-        ASSERT_GE(err, 0) << "getting ADF overlay engine data failed: " <<
-                strerror(-err);
-
-        for (size_t i = 0; i < data.n_supported_formats; i++) {
-            for (size_t j = 0; j < n_fmt8888; j++) {
-                if (data.supported_formats[i] == fmt8888[j]) {
-                    fmt = data.supported_formats[i];
-                    adf_format_str(fmt, fmt_str);
-                    adf_free_overlay_engine_data(&data);
-                    return;
-                }
-            }
-        }
-
-        adf_free_overlay_engine_data(&data);
-        FAIL(); /* this should never happen */
-    }
-
-    /* various helpers to call ADF and die on failure */
-
-    void getInterfaceData(adf_interface_data &data) {
-         int err = adf_get_interface_data(intf, &data);
-         ASSERT_GE(err, 0) << "getting ADF interface data failed: " <<
-                 strerror(-err);
-    }
-
-    void getCurrentMode(uint32_t &w, uint32_t &h) {
-        adf_interface_data data;
-        ASSERT_NO_FATAL_FAILURE(getInterfaceData(data));
-        w = data.current_mode.hdisplay;
-        h = data.current_mode.vdisplay;
-        adf_free_interface_data(&data);
-    }
-
-    void blank(uint8_t mode) {
-        int err = adf_interface_blank(intf, mode);
-        ASSERT_FALSE(err < 0 && err != -EBUSY) <<
-                "unblanking interface failed: " << strerror(-err);
-    }
-
-    void attach() {
-        int err = adf_device_attach(&dev, eng_id, intf_id);
-        ASSERT_FALSE(err < 0 && err != -EALREADY) <<
-                "attaching overlay engine " << eng_id << " to interface " <<
-                intf_id << " failed: " << strerror(-err);
-    }
-
-    void detach() {
-        int err = adf_device_detach(&dev, eng_id, intf_id);
-        ASSERT_FALSE(err < 0 && err != -EINVAL) <<
-                "detaching overlay engine " << eng_id << " from interface " <<
-                intf_id << " failed: " << strerror(-err);
-    }
-
-    void readVsyncTimestamp(uint64_t &timestamp) {
-        adf_event *event;
-        int err = adf_read_event(intf, &event);
-        ASSERT_GE(err, 0) << "reading ADF event failed: " << strerror(-err);
-
-        ASSERT_EQ(ADF_EVENT_VSYNC, event->type);
-        ASSERT_EQ(sizeof(adf_vsync_event), event->length);
-
-        adf_vsync_event *vsync_event =
-                reinterpret_cast<adf_vsync_event *>(event);
-        timestamp = vsync_event->timestamp;
-        free(event);
-    }
-
-    void drawCheckerboard(uint32_t &w, uint32_t &h, uint32_t &format,
-            char format_str[ADF_FORMAT_STR_SIZE], int &buf_fd, uint32_t &offset,
-            uint32_t &pitch) {
-        ASSERT_NO_FATAL_FAILURE(getCurrentMode(w, h));
-        ASSERT_NO_FATAL_FAILURE(get8888Format(format, format_str));
-
-        buf_fd = adf_interface_simple_buffer_alloc(intf, w, h, format, &offset,
-                &pitch);
-        ASSERT_GE(buf_fd, 0) << "allocating " << w << "x" << h << " " <<
-                format_str << " buffer failed: " << strerror(-buf_fd);
-        EXPECT_GE(pitch, w * 4);
-
-        void *mapped = mmap(NULL, pitch * h, PROT_WRITE, MAP_SHARED, buf_fd,
-                offset);
-        ASSERT_NE(mapped, MAP_FAILED) << "mapping " << w << "x" << h << " " <<
-                format_str << " buffer failed: " << strerror(-errno);
-
-        uint8_t *buf8 = static_cast<uint8_t *>(mapped);
-        for (uint32_t y = 0; y < h / 2; y++) {
-            uint32_t *scanline = reinterpret_cast<uint32_t *>(buf8 + y * pitch);
-            for (uint32_t x = 0; x < w / 2; x++)
-                scanline[x] = 0xFF0000FF;
-            for (uint32_t x = w / 2; x < w; x++)
-                scanline[x] = 0xFF00FFFF;
-        }
-        for (uint32_t y = h / 2; y < h; y++) {
-            uint32_t *scanline = reinterpret_cast<uint32_t *>(buf8 + y * pitch);
-            for (uint32_t x = 0; x < w / 2; x++)
-                scanline[x] = 0xFFFF00FF;
-            for (uint32_t x = w / 2; x < w; x++)
-                scanline[x] = 0xFFFFFFFF;
-        }
-
-        munmap(mapped, pitch * h);
-    }
-
-protected:
-    adf_device dev;
-    adf_id_t intf_id;
-    int intf;
-    adf_id_t eng_id;
-    int eng;
-
-private:
-    const static adf_id_t dev_id;
-    const static __u32 fmt8888[];
-    const static size_t n_fmt8888;
-};
-
-const adf_id_t AdfTest::dev_id = 0;
-
-const __u32 AdfTest::fmt8888[] = {
-   DRM_FORMAT_XRGB8888,
-   DRM_FORMAT_XBGR8888,
-   DRM_FORMAT_RGBX8888,
-   DRM_FORMAT_BGRX8888,
-   DRM_FORMAT_ARGB8888,
-   DRM_FORMAT_ABGR8888,
-   DRM_FORMAT_RGBA8888,
-   DRM_FORMAT_BGRA8888
-};
-const size_t AdfTest::n_fmt8888 = sizeof(fmt8888) / sizeof(fmt8888[0]);
-
-TEST(adf, devices) {
-    adf_id_t *devs = nullptr;
-    ssize_t n_devs = adf_devices(&devs);
-    free(devs);
-
-    ASSERT_GE(n_devs, 0) << "enumerating ADF devices failed: " <<
-            strerror(-n_devs);
-    ASSERT_TRUE(devs != NULL);
-}
-
-TEST_F(AdfTest, device_data) {
-    adf_device_data data;
-    int err = adf_get_device_data(&dev, &data);
-    ASSERT_GE(err, 0) << "getting ADF device data failed: " << strerror(-err);
-
-    EXPECT_LT(data.n_attachments, ADF_MAX_ATTACHMENTS);
-    EXPECT_GT(data.n_allowed_attachments, 0U);
-    EXPECT_LT(data.n_allowed_attachments, ADF_MAX_ATTACHMENTS);
-    EXPECT_LT(data.custom_data_size, (size_t)ADF_MAX_CUSTOM_DATA_SIZE);
-    adf_free_device_data(&data);
-}
-
-TEST_F(AdfTest, interface_data) {
-    adf_interface_data data;
-    ASSERT_NO_FATAL_FAILURE(getInterfaceData(data));
-
-    EXPECT_LT(data.type, ADF_INTF_TYPE_MAX);
-    EXPECT_LE(data.dpms_state, DRM_MODE_DPMS_OFF);
-    EXPECT_EQ(1, data.hotplug_detect);
-    EXPECT_GT(data.n_available_modes, 0U);
-    EXPECT_LT(data.custom_data_size, (size_t)ADF_MAX_CUSTOM_DATA_SIZE);
-    adf_free_interface_data(&data);
-}
-
-TEST_F(AdfTest, overlay_engine_data) {
-    adf_overlay_engine_data data;
-    int err = adf_get_overlay_engine_data(eng, &data);
-    ASSERT_GE(err, 0) << "getting ADF overlay engine failed: " <<
-            strerror(-err);
-
-    EXPECT_GT(data.n_supported_formats, 0U);
-    EXPECT_LT(data.n_supported_formats, ADF_MAX_SUPPORTED_FORMATS);
-    EXPECT_LT(data.custom_data_size, (size_t)ADF_MAX_CUSTOM_DATA_SIZE);
-    adf_free_overlay_engine_data(&data);
-}
-
-TEST_F(AdfTest, blank) {
-    int err = adf_interface_blank(intf, (uint8_t)-1);
-    EXPECT_EQ(-EINVAL, err) << "setting bogus DPMS mode should have failed";
-
-    err = adf_interface_blank(eng, DRM_MODE_DPMS_OFF);
-    EXPECT_EQ(-EINVAL, err) << "blanking overlay engine should have failed";
-
-    ASSERT_NO_FATAL_FAILURE(blank(DRM_MODE_DPMS_OFF));
-    err = adf_interface_blank(intf, DRM_MODE_DPMS_OFF);
-    EXPECT_EQ(-EBUSY, err) << "blanking interface twice should have failed";
-
-    ASSERT_NO_FATAL_FAILURE(blank(DRM_MODE_DPMS_ON));
-    err = adf_interface_blank(intf, DRM_MODE_DPMS_ON);
-    EXPECT_EQ(-EBUSY, err) << "unblanking interface twice should have failed";
-
-    adf_interface_data data;
-    ASSERT_NO_FATAL_FAILURE(getInterfaceData(data));
-    EXPECT_EQ(DRM_MODE_DPMS_ON, data.dpms_state);
-    adf_free_interface_data(&data);
-}
-
-TEST_F(AdfTest, event) {
-    int err = adf_set_event(intf, ADF_EVENT_TYPE_MAX, true);
-    EXPECT_EQ(-EINVAL, err) << "enabling bogus ADF event should have failed";
-
-    err = adf_set_event(intf, ADF_EVENT_TYPE_MAX, false);
-    EXPECT_EQ(-EINVAL, err) << "disabling bogus ADF event should have failed";
-
-    err = adf_set_event(intf, ADF_EVENT_VSYNC, true);
-    ASSERT_GE(err, 0) << "enabling vsync event failed: " << strerror(-err);
-
-    err = adf_set_event(intf, ADF_EVENT_VSYNC, true);
-    EXPECT_EQ(-EALREADY, err) <<
-            "enabling vsync event twice should have failed";
-
-    ASSERT_NO_FATAL_FAILURE(blank(DRM_MODE_DPMS_ON));
-
-    uint64_t timestamp1, timestamp2;
-    ASSERT_NO_FATAL_FAILURE(readVsyncTimestamp(timestamp1));
-    ASSERT_NO_FATAL_FAILURE(readVsyncTimestamp(timestamp2));
-    EXPECT_GT(timestamp2, timestamp1);
-
-    err = adf_set_event(intf, ADF_EVENT_VSYNC, false);
-    EXPECT_GE(err, 0) << "disabling vsync event failed: " << strerror(-err);
-
-    err = adf_set_event(intf, ADF_EVENT_VSYNC, false);
-    EXPECT_EQ(-EALREADY, err) <<
-            "disabling vsync event twice should have failed";
-}
-
-TEST_F(AdfTest, attach) {
-    ASSERT_NO_FATAL_FAILURE(attach());
-    int err = adf_device_attach(&dev, eng_id, intf_id);
-    EXPECT_EQ(-EALREADY, err) << "attaching overlay engine " << eng_id <<
-            " to interface " << intf_id << " twice should have failed";
-
-    ASSERT_NO_FATAL_FAILURE(detach());
-    err = adf_device_detach(&dev, eng_id, intf_id);
-    EXPECT_EQ(-EINVAL, err) << "detaching overlay engine " << eng_id <<
-            " from interface " << intf_id << " twice should have failed";
-
-    err = adf_device_attach(&dev, eng_id, ADF_MAX_INTERFACES);
-    EXPECT_EQ(-EINVAL, err) << "attaching overlay engine " << eng_id <<
-            " to bogus interface should have failed";
-
-    err = adf_device_detach(&dev, eng_id, ADF_MAX_INTERFACES);
-    EXPECT_EQ(-EINVAL, err) << "detaching overlay engine " << eng_id <<
-            " from bogus interface should have failed";
-}
-
-TEST_F(AdfTest, simple_buffer_alloc) {
-    uint32_t w = 0, h = 0;
-    ASSERT_NO_FATAL_FAILURE(getCurrentMode(w, h));
-
-    uint32_t format;
-    char format_str[ADF_FORMAT_STR_SIZE];
-    ASSERT_NO_FATAL_FAILURE(get8888Format(format, format_str));
-
-    uint32_t offset;
-    uint32_t pitch;
-    int buf_fd = adf_interface_simple_buffer_alloc(intf, w, h, format, &offset,
-            &pitch);
-    EXPECT_GE(buf_fd, 0) << "allocating " << w << "x" << h << " " <<
-            format_str << " buffer failed: " << strerror(-buf_fd);
-    EXPECT_GE(pitch, w * 4);
-    close(buf_fd);
-
-    buf_fd = adf_interface_simple_buffer_alloc(intf, w, h, 0xDEADBEEF, &offset,
-            &pitch);
-    /* n.b.: ADF only allows simple buffers with built-in RGB formats,
-       so this should fail even if a driver supports custom format 0xDEADBEEF */
-    EXPECT_EQ(-EINVAL, buf_fd) <<
-            "allocating buffer with bogus format should have failed";
-}
-
-TEST_F(AdfTest, simple_buffer) {
-    int buf_fd;
-    uint32_t w, h, format, offset, pitch;
-    char format_str[ADF_FORMAT_STR_SIZE];
-    ASSERT_NO_FATAL_FAILURE(drawCheckerboard(w, h, format, format_str,
-            buf_fd, offset, pitch));
-
-    ASSERT_NO_FATAL_FAILURE(attach());
-    ASSERT_NO_FATAL_FAILURE(blank(DRM_MODE_DPMS_ON));
-
-    int release_fence = adf_interface_simple_post(intf, eng_id, w, h, format,
-            buf_fd, offset, pitch, -1);
-    close(buf_fd);
-    ASSERT_GE(release_fence, 0) << "posting " << w << "x" << h << " " <<
-            format_str << " buffer failed: " << strerror(-release_fence);
-    close(release_fence);
-}
-
-TEST_F(AdfTest, simple_buffer_v2) {
-    int buf_fd;
-    uint32_t w, h, format, offset, pitch;
-    char format_str[ADF_FORMAT_STR_SIZE];
-    ASSERT_NO_FATAL_FAILURE(drawCheckerboard(w, h, format, format_str,
-            buf_fd, offset, pitch));
-
-    ASSERT_NO_FATAL_FAILURE(attach());
-    ASSERT_NO_FATAL_FAILURE(blank(DRM_MODE_DPMS_ON));
-
-    int config_1_release;
-    int err = adf_interface_simple_post_v2(intf, eng_id, w, h,
-            format, buf_fd, offset, pitch, -1, ADF_COMPLETE_FENCE_RELEASE,
-            &config_1_release);
-    if (err == -ENOTTY) {
-        GTEST_LOG_(INFO) << "ADF_SIMPLE_POST_CONFIG_V2 not supported on this kernel";
-        return;
-    }
-    ASSERT_GE(err, 0) << "posting " << w << "x" << h << " " <<
-            format_str << " buffer failed: " << strerror(-err);
-
-    err = sync_wait(config_1_release, 1000);
-    ASSERT_EQ(-1, err) <<
-            "waiting for config 1's release fence should not have suceeded";
-    ASSERT_EQ(ETIME, errno) <<
-            "config 1's release fence should have timed out, but failed instead: " <<
-            strerror(errno);
-
-    int config_2_present;
-    err = adf_interface_simple_post_v2(intf, eng_id, w, h,
-            format, buf_fd, offset, pitch, -1, ADF_COMPLETE_FENCE_PRESENT,
-            &config_2_present);
-    ASSERT_GE(err, 0) << "posting " << w << "x" << h << " " <<
-            format_str << " buffer failed: " << strerror(-err);
-
-    err = sync_wait(config_2_present, 1000);
-    ASSERT_EQ(0, err) <<
-            "waiting for config 2's present fence failed: " << strerror(errno);
-    err = sync_wait(config_1_release, 0);
-    ASSERT_EQ(0, err) <<
-            "waiting for config 1's release fence failed: " << strerror(errno);
-    close(config_1_release);
-    close(config_2_present);
-
-    int config_3_no_fence;
-    err = adf_interface_simple_post_v2(intf, eng_id, w, h,
-            format, buf_fd, offset, pitch, -1, ADF_COMPLETE_FENCE_NONE,
-            &config_3_no_fence);
-    ASSERT_GE(err, 0) << "posting " << w << "x" << h << " " <<
-            format_str << " buffer failed: " << strerror(-err);
-    ASSERT_EQ(-1, config_3_no_fence) <<
-            "fence returned even though the fence type was ADF_COMPLETE_FENCE_NONE";
-
-    close(buf_fd);
-}
diff --git a/deprecated-adf/libadfhwc/Android.bp b/deprecated-adf/libadfhwc/Android.bp
deleted file mode 100644
index 57a8d76..0000000
--- a/deprecated-adf/libadfhwc/Android.bp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2013 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.
-
-cc_library_static {
-    name: "libadfhwc",
-    srcs: ["adfhwc.cpp"],
-    static_libs: [
-        "libadf",
-        "liblog",
-        "libutils",
-    ],
-    cflags: [
-        "-DLOG_TAG=\"adfhwc\"",
-        "-Werror",
-    ],
-    local_include_dirs: ["include"],
-    export_include_dirs: ["include"],
-}
diff --git a/deprecated-adf/libadfhwc/adfhwc.cpp b/deprecated-adf/libadfhwc/adfhwc.cpp
deleted file mode 100644
index 63c0f75..0000000
--- a/deprecated-adf/libadfhwc/adfhwc.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include <fcntl.h>
-#include <malloc.h>
-#include <poll.h>
-#include <pthread.h>
-#include <sys/resource.h>
-
-#include <log/log.h>
-#include <utils/Vector.h>
-
-#include <adf/adf.h>
-#include <adfhwc/adfhwc.h>
-
-struct adf_hwc_helper {
-    adf_hwc_event_callbacks const *event_cb;
-    void *event_cb_data;
-
-    pthread_t event_thread;
-
-    android::Vector<int> intf_fds;
-    android::Vector<drm_mode_modeinfo> display_configs;
-};
-
-template<typename T> inline T min(T a, T b) { return (a < b) ? a : b; }
-
-int adf_eventControl(struct adf_hwc_helper *dev, int disp, int event,
-        int enabled)
-{
-    if (enabled != !!enabled)
-        return -EINVAL;
-
-    if ((size_t)disp >= dev->intf_fds.size())
-        return -EINVAL;
-
-    switch (event) {
-    case HWC_EVENT_VSYNC:
-        return adf_set_event(dev->intf_fds[disp], ADF_EVENT_VSYNC, enabled);
-    }
-
-    return -EINVAL;
-}
-
-static inline int32_t dpi(uint16_t res, uint16_t size_mm)
-{
-    if (size_mm)
-        return 1000 * (res * 25.4f) / size_mm;
-    return 0;
-}
-
-int adf_blank(struct adf_hwc_helper *dev, int disp, int blank)
-{
-    if ((size_t)disp >= dev->intf_fds.size())
-        return -EINVAL;
-
-    uint8_t dpms_mode = blank ? DRM_MODE_DPMS_OFF : DRM_MODE_DPMS_ON;
-    return adf_interface_blank(dev->intf_fds[disp], dpms_mode);
-}
-
-int adf_query_display_types_supported(struct adf_hwc_helper *dev, int *value)
-{
-    *value = 0;
-    if (dev->intf_fds.size() > 0)
-        *value |= HWC_DISPLAY_PRIMARY_BIT;
-    if (dev->intf_fds.size() > 1)
-        *value |= HWC_DISPLAY_EXTERNAL_BIT;
-
-    return 0;
-}
-
-int adf_getDisplayConfigs(struct adf_hwc_helper *dev, int disp,
-        uint32_t *configs, size_t *numConfigs)
-{
-    if ((size_t)disp >= dev->intf_fds.size())
-        return -EINVAL;
-
-    adf_interface_data data;
-    int err = adf_get_interface_data(dev->intf_fds[disp], &data);
-    if (err < 0) {
-        ALOGE("failed to get ADF interface data: %s", strerror(err));
-        return err;
-    }
-
-    if (!data.hotplug_detect)
-        return -ENODEV;
-
-    android::Vector<drm_mode_modeinfo *> unique_configs;
-    unique_configs.push_back(&data.current_mode);
-    for (size_t i = 0; i < data.n_available_modes; i++)
-        if (memcmp(&data.available_modes[i], &data.current_mode,
-                sizeof(data.current_mode)))
-            unique_configs.push_back(&data.available_modes[i]);
-
-    for (size_t i = 0; i < min(*numConfigs, unique_configs.size()); i++) {
-        configs[i] = dev->display_configs.size();
-        dev->display_configs.push_back(*unique_configs[i]);
-    }
-    *numConfigs = unique_configs.size();
-
-    adf_free_interface_data(&data);
-    return 0;
-}
-
-static int32_t adf_display_attribute(const adf_interface_data &data,
-        const drm_mode_modeinfo &mode, const uint32_t attribute)
-{
-    switch (attribute) {
-    case HWC_DISPLAY_VSYNC_PERIOD:
-        if (mode.vrefresh)
-            return 1000000000 / mode.vrefresh;
-        return 0;
-
-    case HWC_DISPLAY_WIDTH:
-        return mode.hdisplay;
-
-    case HWC_DISPLAY_HEIGHT:
-        return mode.vdisplay;
-
-    case HWC_DISPLAY_DPI_X:
-        return dpi(mode.hdisplay, data.width_mm);
-
-    case HWC_DISPLAY_DPI_Y:
-        return dpi(mode.vdisplay, data.height_mm);
-
-    default:
-        ALOGE("unknown display attribute %u", attribute);
-        return -EINVAL;
-    }
-}
-
-int adf_getDisplayAttributes(struct adf_hwc_helper *dev, int disp,
-        uint32_t config, const uint32_t *attributes, int32_t *values)
-{
-    if ((size_t)disp >= dev->intf_fds.size())
-        return -EINVAL;
-
-    if (config >= dev->display_configs.size())
-        return -EINVAL;
-
-    adf_interface_data data;
-    int err = adf_get_interface_data(dev->intf_fds[disp], &data);
-    if (err < 0) {
-        ALOGE("failed to get ADF interface data: %s", strerror(err));
-        return err;
-    }
-
-    for (int i = 0; attributes[i] != HWC_DISPLAY_NO_ATTRIBUTE; i++)
-        values[i] = adf_display_attribute(data, dev->display_configs[config],
-                attributes[i]);
-
-    adf_free_interface_data(&data);
-    return 0;
-}
-
-static int32_t adf_display_attribute_hwc2(const adf_interface_data &data,
-        const drm_mode_modeinfo &mode, const uint32_t attribute)
-{
-    switch (attribute) {
-    case HWC2_ATTRIBUTE_VSYNC_PERIOD:
-        if (mode.vrefresh)
-            return 1000000000 / mode.vrefresh;
-        return 0;
-
-    case HWC2_ATTRIBUTE_WIDTH:
-        return mode.hdisplay;
-
-    case HWC2_ATTRIBUTE_HEIGHT:
-        return mode.vdisplay;
-
-    case HWC2_ATTRIBUTE_DPI_X:
-        return dpi(mode.hdisplay, data.width_mm);
-
-    case HWC2_ATTRIBUTE_DPI_Y:
-        return dpi(mode.vdisplay, data.height_mm);
-
-    default:
-        ALOGE("unknown display attribute %u", attribute);
-        return -EINVAL;
-    }
-}
-
-int adf_getDisplayAttributes_hwc2(struct adf_hwc_helper *dev, int disp,
-        uint32_t config, const uint32_t *attributes, int32_t *values)
-{
-    if ((size_t)disp >= dev->intf_fds.size())
-        return -EINVAL;
-
-    if (config >= dev->display_configs.size())
-        return -EINVAL;
-
-    adf_interface_data data;
-    int err = adf_get_interface_data(dev->intf_fds[disp], &data);
-    if (err < 0) {
-        ALOGE("failed to get ADF interface data: %s", strerror(err));
-        return err;
-    }
-
-    for (int i = 0; attributes[i] != HWC2_ATTRIBUTE_INVALID; i++)
-        values[i] = adf_display_attribute_hwc2(data,
-                dev->display_configs[config], attributes[i]);
-
-    adf_free_interface_data(&data);
-    return 0;
-}
-
-int adf_set_active_config_hwc2(struct adf_hwc_helper *dev, int disp,
-        uint32_t config)
-{
-    if ((size_t)disp >= dev->intf_fds.size())
-        return -EINVAL;
-
-    if (config >= dev->display_configs.size())
-        return -EINVAL;
-
-    struct drm_mode_modeinfo mode = dev->display_configs[config];
-
-    return adf_interface_set_mode(dev->intf_fds[disp], &mode);
-}
-
-static void handle_adf_event(struct adf_hwc_helper *dev, int disp)
-{
-    adf_event *event;
-    int err = adf_read_event(dev->intf_fds[disp], &event);
-    if (err < 0) {
-        ALOGE("error reading event from display %d: %s", disp, strerror(err));
-        return;
-    }
-
-    void *vsync_temp;
-    adf_vsync_event *vsync;
-    adf_hotplug_event *hotplug;
-
-    switch (event->type) {
-    case ADF_EVENT_VSYNC:
-        vsync_temp = event;
-        vsync = static_cast<adf_vsync_event *>(vsync_temp);
-        // casting directly to adf_vsync_event * makes g++ warn about
-        // potential alignment issues that don't apply here
-        dev->event_cb->vsync(dev->event_cb_data, disp, vsync->timestamp);
-        break;
-    case ADF_EVENT_HOTPLUG:
-        hotplug = reinterpret_cast<adf_hotplug_event *>(event);
-        dev->event_cb->hotplug(dev->event_cb_data, disp, hotplug->connected);
-        break;
-    default:
-        if (event->type < ADF_EVENT_DEVICE_CUSTOM)
-            ALOGW("unrecognized event type %u", event->type);
-        else if (!dev->event_cb || !dev->event_cb->custom_event)
-            ALOGW("unhandled event type %u", event->type);
-        else
-            dev->event_cb->custom_event(dev->event_cb_data, disp, event);
-    }
-    free(event);
-}
-
-static void *adf_event_thread(void *data)
-{
-    adf_hwc_helper *dev = static_cast<adf_hwc_helper *>(data);
-
-    setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
-
-    struct sigaction action = { };
-    sigemptyset(&action.sa_mask);
-    action.sa_flags = 0;
-    action.sa_handler = [](int) { pthread_exit(0); };
-
-    if (sigaction(SIGUSR2, &action, NULL) < 0) {
-        ALOGE("failed to set thread exit action %s", strerror(errno));
-        return NULL;
-    }
-
-    sigset_t signal_set;
-    sigemptyset(&signal_set);
-    sigaddset(&signal_set, SIGUSR2);
-
-    pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL);
-
-    pollfd fds[dev->intf_fds.size()];
-    for (size_t i = 0; i < dev->intf_fds.size(); i++) {
-        fds[i].fd = dev->intf_fds[i];
-        fds[i].events = POLLIN | POLLPRI;
-    }
-
-    while (true) {
-        if (TEMP_FAILURE_RETRY(poll(fds, dev->intf_fds.size(), -1)) < 0) {
-            ALOGE("error in event thread: %s", strerror(errno));
-            break;
-        }
-
-        for (size_t i = 0; i < dev->intf_fds.size(); i++)
-            if (fds[i].revents & (POLLIN | POLLPRI))
-                handle_adf_event(dev, i);
-    }
-
-    return NULL;
-}
-
-int adf_hwc_open(int *intf_fds, size_t n_intfs,
-        const struct adf_hwc_event_callbacks *event_cb, void *event_cb_data,
-        struct adf_hwc_helper **dev)
-{
-    if (!n_intfs)
-        return -EINVAL;
-
-    adf_hwc_helper *dev_ret = new adf_hwc_helper;
-    dev_ret->event_cb = event_cb;
-    dev_ret->event_cb_data = event_cb_data;
-
-    int ret;
-
-    for (size_t i = 0; i < n_intfs; i++) {
-        int dup_intf_fd = dup(intf_fds[i]);
-        if (dup_intf_fd < 0) {
-            ALOGE("failed to dup interface fd: %s", strerror(errno));
-            ret = -errno;
-            goto err;
-        }
-
-        dev_ret->intf_fds.push_back(dup_intf_fd);
-
-        ret = adf_set_event(dup_intf_fd, ADF_EVENT_HOTPLUG, 1);
-        if (ret < 0 && ret != -EINVAL) {
-            ALOGE("failed to enable hotplug event on display %zu: %s",
-                    i, strerror(errno));
-            goto err;
-        }
-    }
-
-    sigset_t signal_set;
-    sigemptyset(&signal_set);
-    sigaddset(&signal_set, SIGUSR2);
-
-    pthread_sigmask(SIG_BLOCK, &signal_set, NULL);
-
-    ret = pthread_create(&dev_ret->event_thread, NULL, adf_event_thread,
-            dev_ret);
-    if (ret) {
-        ALOGE("failed to create event thread: %s", strerror(ret));
-        goto err;
-    }
-
-    *dev = dev_ret;
-    return 0;
-
-err:
-    for (size_t i = 0; i < dev_ret->intf_fds.size(); i++)
-        close(dev_ret->intf_fds[i]);
-
-    delete dev_ret;
-    return ret;
-}
-
-void adf_hwc_close(struct adf_hwc_helper *dev)
-{
-    pthread_kill(dev->event_thread, SIGUSR2);
-    pthread_join(dev->event_thread, NULL);
-
-    for (size_t i = 0; i < dev->intf_fds.size(); i++)
-        close(dev->intf_fds[i]);
-
-    delete dev;
-}
diff --git a/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h b/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h
deleted file mode 100644
index 4f70925..0000000
--- a/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _LIBADFHWC_ADFHWC_H_
-#define _LIBADFHWC_ADFHWC_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <video/adf.h>
-
-#include <hardware/hwcomposer.h>
-#include <hardware/hwcomposer2.h>
-
-struct adf_hwc_helper;
-
-struct adf_hwc_event_callbacks {
-    /**
-     * Called on vsync (required)
-     */
-    void (*vsync)(void *data, int disp, uint64_t timestamp);
-    /**
-     * Called on hotplug (required)
-     */
-    void (*hotplug)(void *data, int disp, bool connected);
-    /**
-     * Called on hardware-custom ADF events (optional)
-     */
-    void (*custom_event)(void *data, int disp, struct adf_event *event);
-};
-
-/**
- * Converts HAL pixel formats to equivalent ADF/DRM format FourCCs.
- */
-static inline uint32_t adf_fourcc_for_hal_pixel_format(int format)
-{
-    switch (format) {
-    case HAL_PIXEL_FORMAT_RGBA_8888:
-        return DRM_FORMAT_RGBA8888;
-    case HAL_PIXEL_FORMAT_RGBX_8888:
-        return DRM_FORMAT_RGBX8888;
-    case HAL_PIXEL_FORMAT_RGB_888:
-        return DRM_FORMAT_RGB888;
-    case HAL_PIXEL_FORMAT_RGB_565:
-        return DRM_FORMAT_RGB565;
-    case HAL_PIXEL_FORMAT_BGRA_8888:
-        return DRM_FORMAT_BGRA8888;
-    case HAL_PIXEL_FORMAT_YV12:
-        return DRM_FORMAT_YVU420;
-    case HAL_PIXEL_FORMAT_YCbCr_422_SP:
-        return DRM_FORMAT_NV16;
-    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
-        return DRM_FORMAT_NV21;
-    case HAL_PIXEL_FORMAT_YCbCr_422_I:
-        return DRM_FORMAT_YUYV;
-    default:
-        return 0;
-    }
-}
-
-/**
- * Converts HAL display types to equivalent ADF interface flags.
- */
-static inline uint32_t adf_hwc_interface_flag_for_disp(int disp)
-{
-    switch (disp) {
-    case HWC_DISPLAY_PRIMARY:
-        return ADF_INTF_FLAG_PRIMARY;
-    case HWC_DISPLAY_EXTERNAL:
-        return ADF_INTF_FLAG_EXTERNAL;
-    default:
-        return 0;
-    }
-}
-
-__BEGIN_DECLS
-
-/**
- * Create a HWC helper for the specified ADF interfaces.
- *
- * intf_fds must be indexed by HWC display type: e.g.,
- * intf_fds[HWC_DISPLAY_PRIMARY] is the fd for the primary display
- * interface.  n_intfs must be >= 1.
- *
- * The caller retains ownership of the fds in intf_fds and must close()
- * them when they are no longer needed.
- *
- * On error, returns -errno.
- */
-int adf_hwc_open(int *intf_fds, size_t n_intfs,
-        const struct adf_hwc_event_callbacks *event_cb, void *event_cb_data,
-        struct adf_hwc_helper **dev);
-
-/**
- * Destroys a HWC helper.
- */
-void adf_hwc_close(struct adf_hwc_helper *dev);
-
-/**
- * Generic implementations of common HWC ops.
- *
- * The HWC should not point its ops directly at these helpers.  Instead, the HWC
- * should provide stub ops which call these helpers after converting the
- * hwc_composer_device_1* to a struct adf_hwc_helper*.
- */
-int adf_eventControl(struct adf_hwc_helper *dev, int disp, int event,
-        int enabled);
-int adf_blank(struct adf_hwc_helper *dev, int disp, int blank);
-int adf_query_display_types_supported(struct adf_hwc_helper *dev, int *value);
-int adf_getDisplayConfigs(struct adf_hwc_helper *dev, int disp,
-        uint32_t *configs, size_t *numConfigs);
-int adf_getDisplayAttributes(struct adf_hwc_helper *dev, int disp,
-        uint32_t config, const uint32_t *attributes, int32_t *values);
-/**
- * Generic implementation of common HWC2 functions.
- *
- * The HWC2 should not return these functions directly through getFunction.
- * Instead, the HWC2 should return stub functions which call these helpers.
- */
-int adf_getDisplayAttributes_hwc2(struct adf_hwc_helper *dev, int disp,
-        uint32_t config, const uint32_t *attributes, int32_t *values);
-int adf_set_active_config_hwc2(struct adf_hwc_helper *dev, int disp,
-        uint32_t config);
-
-__END_DECLS
-
-#endif /* _LIBADFHWC_ADFHWC_H_ */
diff --git a/diagnose_usb/diagnose_usb.cpp b/diagnose_usb/diagnose_usb.cpp
index 5695ece..35edb5e 100644
--- a/diagnose_usb/diagnose_usb.cpp
+++ b/diagnose_usb/diagnose_usb.cpp
@@ -49,7 +49,7 @@
     // additionally just to be sure.
     if (group_member(plugdev_group->gr_gid) || getegid() == plugdev_group->gr_gid) {
         // The user is in plugdev so the problem is likely with the udev rules.
-        return "user in plugdev group; are your udev rules wrong?";
+        return "missing udev rules? user is in the plugdev group";
     }
     passwd* pwd = getpwuid(getuid());
     return android::base::StringPrintf("user %s is not in the plugdev group",
diff --git a/fastboot/Android.bp b/fastboot/Android.bp
index cf0f1ac..85a19e5 100644
--- a/fastboot/Android.bp
+++ b/fastboot/Android.bp
@@ -126,7 +126,7 @@
     shared_libs: [
         "android.hardware.boot@1.0",
         "android.hardware.boot@1.1",
-        "android.hardware.fastboot@1.0",
+        "android.hardware.fastboot@1.1",
         "android.hardware.health@2.0",
         "libasyncio",
         "libbase",
@@ -147,7 +147,9 @@
     static_libs: [
         "libgtest_prod",
         "libhealthhalutils",
+        "libsnapshot_cow",
         "libsnapshot_nobinder",
+        "update_metadata-protos",
     ],
 
     header_libs: [
@@ -250,7 +252,7 @@
         darwin: {
             srcs: ["usb_osx.cpp"],
         },
-        linux_glibc: {
+        linux: {
             srcs: ["usb_linux.cpp"],
         },
     },
@@ -270,6 +272,7 @@
     required: [
         "mke2fs",
         "make_f2fs",
+        "make_f2fs_casefold",
     ],
     dist: {
         targets: [
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
index fd009e7..0e918a3 100644
--- a/fastboot/Android.mk
+++ b/fastboot/Android.mk
@@ -21,6 +21,7 @@
 my_dist_files := $(SOONG_HOST_OUT_EXECUTABLES)/mke2fs
 my_dist_files += $(SOONG_HOST_OUT_EXECUTABLES)/e2fsdroid
 my_dist_files += $(SOONG_HOST_OUT_EXECUTABLES)/make_f2fs
+my_dist_files += $(SOONG_HOST_OUT_EXECUTABLES)/make_f2fs_casefold
 my_dist_files += $(SOONG_HOST_OUT_EXECUTABLES)/sload_f2fs
 $(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files))
 my_dist_files :=
diff --git a/fastboot/OWNERS b/fastboot/OWNERS
index 2088ae3..a72ee07 100644
--- a/fastboot/OWNERS
+++ b/fastboot/OWNERS
@@ -1,4 +1,4 @@
-dpursell@google.com
+dvander@google.com
+hridya@google.com
 enh@google.com
 jmgao@google.com
-tomcherry@google.com
diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp
index efa5ed1..2b2a0bf 100644
--- a/fastboot/device/commands.cpp
+++ b/fastboot/device/commands.cpp
@@ -171,24 +171,13 @@
     }
 
     Result ret;
-    // Check whether fastboot_hal support "oem postwipedata" API or not.
-    const std::string checkPostWipeDataCmd("oem postwipedata support");
-    auto check_cmd_ret_val = fastboot_hal->doOemCommand(checkPostWipeDataCmd,
-                                        [&](Result result) { ret = result; });
-    if (!check_cmd_ret_val.isOk()) {
-        return false;
-    }
-    if (ret.status != Status::SUCCESS) {
-        return false;
-    }
-
-    const std::string postWipeDataCmd("oem postwipedata userdata");
-    auto ret_val = fastboot_hal->doOemCommand(postWipeDataCmd,
-                                        [&](Result result) { ret = result; });
+    auto ret_val = fastboot_hal->doOemSpecificErase([&](Result result) { ret = result; });
     if (!ret_val.isOk()) {
         return false;
     }
-    if (ret.status != Status::SUCCESS) {
+    if (ret.status == Status::NOT_SUPPORTED) {
+        return false;
+    } else if (ret.status != Status::SUCCESS) {
         device->WriteStatus(FastbootResult::FAIL, ret.message);
     } else {
         device->WriteStatus(FastbootResult::OKAY, "Erasing succeeded");
diff --git a/fastboot/device/fastboot_device.cpp b/fastboot/device/fastboot_device.cpp
index 1b0859f..35f3de0 100644
--- a/fastboot/device/fastboot_device.cpp
+++ b/fastboot/device/fastboot_device.cpp
@@ -22,7 +22,7 @@
 #include <android-base/properties.h>
 #include <android-base/strings.h>
 #include <android/hardware/boot/1.0/IBootControl.h>
-#include <android/hardware/fastboot/1.0/IFastboot.h>
+#include <android/hardware/fastboot/1.1/IFastboot.h>
 #include <fs_mgr.h>
 #include <fs_mgr/roots.h>
 #include <healthhalutils/HealthHalUtils.h>
@@ -37,7 +37,7 @@
 using ::android::hardware::hidl_string;
 using ::android::hardware::boot::V1_0::IBootControl;
 using ::android::hardware::boot::V1_0::Slot;
-using ::android::hardware::fastboot::V1_0::IFastboot;
+using ::android::hardware::fastboot::V1_1::IFastboot;
 using ::android::hardware::health::V2_0::get_health_service;
 
 namespace sph = std::placeholders;
@@ -139,7 +139,13 @@
 bool FastbootDevice::HandleData(bool read, std::vector<char>* data) {
     auto read_write_data_size = read ? this->get_transport()->Read(data->data(), data->size())
                                      : this->get_transport()->Write(data->data(), data->size());
-    if (read_write_data_size == -1 || static_cast<size_t>(read_write_data_size) != data->size()) {
+    if (read_write_data_size == -1) {
+        LOG(ERROR) << (read ? "read from" : "write to") << " transport failed";
+        return false;
+    }
+    if (static_cast<size_t>(read_write_data_size) != data->size()) {
+        LOG(ERROR) << (read ? "read" : "write") << " expected " << data->size() << " bytes, got "
+                   << read_write_data_size;
         return false;
     }
     return true;
diff --git a/fastboot/device/fastboot_device.h b/fastboot/device/fastboot_device.h
index bbe8172..23be721 100644
--- a/fastboot/device/fastboot_device.h
+++ b/fastboot/device/fastboot_device.h
@@ -24,7 +24,7 @@
 
 #include <android/hardware/boot/1.0/IBootControl.h>
 #include <android/hardware/boot/1.1/IBootControl.h>
-#include <android/hardware/fastboot/1.0/IFastboot.h>
+#include <android/hardware/fastboot/1.1/IFastboot.h>
 #include <android/hardware/health/2.0/IHealth.h>
 
 #include "commands.h"
@@ -53,7 +53,7 @@
         return boot_control_hal_;
     }
     android::sp<android::hardware::boot::V1_1::IBootControl> boot1_1() { return boot1_1_; }
-    android::sp<android::hardware::fastboot::V1_0::IFastboot> fastboot_hal() {
+    android::sp<android::hardware::fastboot::V1_1::IFastboot> fastboot_hal() {
         return fastboot_hal_;
     }
     android::sp<android::hardware::health::V2_0::IHealth> health_hal() { return health_hal_; }
@@ -67,7 +67,7 @@
     android::sp<android::hardware::boot::V1_0::IBootControl> boot_control_hal_;
     android::sp<android::hardware::boot::V1_1::IBootControl> boot1_1_;
     android::sp<android::hardware::health::V2_0::IHealth> health_hal_;
-    android::sp<android::hardware::fastboot::V1_0::IFastboot> fastboot_hal_;
+    android::sp<android::hardware::fastboot::V1_1::IFastboot> fastboot_hal_;
     std::vector<char> download_data_;
     std::string active_slot_;
 };
diff --git a/fastboot/device/flashing.cpp b/fastboot/device/flashing.cpp
index a5f1223..333ca50 100644
--- a/fastboot/device/flashing.cpp
+++ b/fastboot/device/flashing.cpp
@@ -67,7 +67,7 @@
 
         if ((partition + device->GetCurrentSlot()) == partition_name) {
             mount_metadata.emplace();
-            fs_mgr_overlayfs_teardown(entry.mount_point.c_str());
+            android::fs_mgr::TeardownAllOverlayForMountPoint(entry.mount_point);
         }
     }
 }
@@ -163,7 +163,9 @@
         CopyAVBFooter(&data, block_device_size);
     }
     WipeOverlayfsForPartition(device, partition_name);
-    return FlashBlockDevice(handle.fd(), data);
+    int result = FlashBlockDevice(handle.fd(), data);
+    sync();
+    return result;
 }
 
 bool UpdateSuper(FastbootDevice* device, const std::string& super_name, bool wipe) {
@@ -192,7 +194,8 @@
         if (!FlashPartitionTable(super_name, *new_metadata.get())) {
             return device->WriteFail("Unable to flash new partition table");
         }
-        fs_mgr_overlayfs_teardown();
+        android::fs_mgr::TeardownAllOverlayForMountPoint();
+        sync();
         return device->WriteOkay("Successfully flashed partition table");
     }
 
@@ -231,6 +234,7 @@
     if (!UpdateAllPartitionMetadata(device, super_name, *new_metadata.get())) {
         return device->WriteFail("Unable to write new partition table");
     }
-    fs_mgr_overlayfs_teardown();
+    android::fs_mgr::TeardownAllOverlayForMountPoint();
+    sync();
     return device->WriteOkay("Successfully updated partition table");
 }
diff --git a/fastboot/device/usb_client.cpp b/fastboot/device/usb_client.cpp
index 9c80765..2caced4 100644
--- a/fastboot/device/usb_client.cpp
+++ b/fastboot/device/usb_client.cpp
@@ -146,7 +146,7 @@
                 },
 };
 
-#define STR_INTERFACE_ "fastboot"
+#define STR_INTERFACE_ "fastbootd"
 
 static const struct {
     struct usb_functionfs_strings_head header;
@@ -248,7 +248,12 @@
 }
 
 ssize_t ClientUsbTransport::Read(void* data, size_t len) {
-    if (handle_ == nullptr || len > SSIZE_MAX) {
+    if (handle_ == nullptr) {
+        LOG(ERROR) << "ClientUsbTransport: no handle";
+        return -1;
+    }
+    if (len > SSIZE_MAX) {
+        LOG(ERROR) << "ClientUsbTransport: maximum length exceeds bounds";
         return -1;
     }
     char* char_data = static_cast<char*>(data);
@@ -258,6 +263,7 @@
         auto bytes_read_now =
                 handle_->read(handle_.get(), char_data, bytes_to_read, true /* allow_partial */);
         if (bytes_read_now < 0) {
+            PLOG(ERROR) << "ClientUsbTransport: read failed";
             return bytes_read_total == 0 ? -1 : bytes_read_total;
         }
         bytes_read_total += bytes_read_now;
diff --git a/fastboot/fastboot.bash b/fastboot/fastboot.bash
index cb1d354..f5a3384 100644
--- a/fastboot/fastboot.bash
+++ b/fastboot/fastboot.bash
@@ -109,7 +109,7 @@
 
     cur="${COMP_WORDS[COMP_CWORD]}"
     if [[ $i -eq $COMP_CWORD ]]; then
-        partitions="boot bootloader dtbo modem odm oem product radio recovery system vbmeta vendor"
+        partitions="boot bootloader dtbo modem odm odm_dlkm oem product pvmfw radio recovery system vbmeta vendor vendor_dlkm"
         COMPREPLY=( $(compgen -W "$partitions" -- $cur) )
     else
         _fastboot_util_complete_local_file "${cur}" '!*.img'
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 5307a00..f7edf8e 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -145,7 +145,9 @@
     { "dtbo",     "dtbo.img",         "dtbo.sig",     "dtbo",     true,  ImageType::BootCritical },
     { "dts",      "dt.img",           "dt.sig",       "dts",      true,  ImageType::BootCritical },
     { "odm",      "odm.img",          "odm.sig",      "odm",      true,  ImageType::Normal },
+    { "odm_dlkm", "odm_dlkm.img",     "odm_dlkm.sig", "odm_dlkm", true,  ImageType::Normal },
     { "product",  "product.img",      "product.sig",  "product",  true,  ImageType::Normal },
+    { "pvmfw",    "pvmfw.img",        "pvmfw.sig",    "pvmfw",    true,  ImageType::BootCritical },
     { "recovery", "recovery.img",     "recovery.sig", "recovery", true,  ImageType::BootCritical },
     { "super",    "super.img",        "super.sig",    "super",    true,  ImageType::Extra },
     { "system",   "system.img",       "system.sig",   "system",   false, ImageType::Normal },
@@ -166,6 +168,10 @@
                   "vendor_boot.img",  "vendor_boot.sig",
                                                       "vendor_boot",
                                                                   true,  ImageType::BootCritical },
+    { "vendor_dlkm",
+                  "vendor_dlkm.img",  "vendor_dlkm.sig",
+                                                      "vendor_dlkm",
+                                                                  true,  ImageType::Normal },
     { nullptr,    "vendor_other.img", "vendor.sig",   "vendor",   true,  ImageType::Normal },
         // clang-format on
 };
@@ -200,8 +206,10 @@
 double last_start_time;
 
 static void Status(const std::string& message) {
-    static constexpr char kStatusFormat[] = "%-50s ";
-    fprintf(stderr, kStatusFormat, message.c_str());
+    if (!message.empty()) {
+        static constexpr char kStatusFormat[] = "%-50s ";
+        fprintf(stderr, kStatusFormat, message.c_str());
+    }
     last_start_time = now();
 }
 
@@ -258,6 +266,10 @@
 static int list_devices_callback(usb_ifc_info* info) {
     if (match_fastboot_with_serial(info, nullptr) == 0) {
         std::string serial = info->serial_number;
+        std::string interface = info->interface;
+        if (interface.empty()) {
+            interface = "fastboot";
+        }
         if (!info->writable) {
             serial = UsbNoPermissionsShortHelpText();
         }
@@ -266,9 +278,9 @@
         }
         // output compatible with "adb devices"
         if (!g_long_listing) {
-            printf("%s\tfastboot", serial.c_str());
+            printf("%s\t%s", serial.c_str(), interface.c_str());
         } else {
-            printf("%-22s fastboot", serial.c_str());
+            printf("%-22s %s", serial.c_str(), interface.c_str());
             if (strlen(info->device_path) > 0) printf(" %s", info->device_path);
         }
         putchar('\n');
@@ -443,6 +455,8 @@
             " --skip-reboot              Don't reboot device after flashing.\n"
             " --disable-verity           Sets disable-verity when flashing vbmeta.\n"
             " --disable-verification     Sets disable-verification when flashing vbmeta.\n"
+            " --fs-options=OPTION[,OPTION]\n"
+            "                            Enable filesystem features. OPTION supports casefold, projid, compress\n"
 #if !defined(_WIN32)
             " --wipe-and-use-fbe         Enable file-based encryption, wiping userdata.\n"
 #endif
@@ -515,12 +529,15 @@
 
 static bool UnzipToMemory(ZipArchiveHandle zip, const std::string& entry_name,
                           std::vector<char>* out) {
-    ZipEntry zip_entry;
+    ZipEntry64 zip_entry;
     if (FindEntry(zip, entry_name, &zip_entry) != 0) {
         fprintf(stderr, "archive does not contain '%s'\n", entry_name.c_str());
         return false;
     }
 
+    if (zip_entry.uncompressed_length > std::numeric_limits<size_t>::max()) {
+      die("entry '%s' is too large: %" PRIu64, entry_name.c_str(), zip_entry.uncompressed_length);
+    }
     out->resize(zip_entry.uncompressed_length);
 
     fprintf(stderr, "extracting %s (%zu MB) to RAM...\n", entry_name.c_str(),
@@ -626,14 +643,14 @@
 static int unzip_to_file(ZipArchiveHandle zip, const char* entry_name) {
     unique_fd fd(make_temporary_fd(entry_name));
 
-    ZipEntry zip_entry;
+    ZipEntry64 zip_entry;
     if (FindEntry(zip, entry_name, &zip_entry) != 0) {
         fprintf(stderr, "archive does not contain '%s'\n", entry_name);
         errno = ENOENT;
         return -1;
     }
 
-    fprintf(stderr, "extracting %s (%" PRIu32 " MB) to disk...", entry_name,
+    fprintf(stderr, "extracting %s (%" PRIu64 " MB) to disk...", entry_name,
             zip_entry.uncompressed_length / 1024 / 1024);
     double start = now();
     int error = ExtractEntryToFile(zip, &zip_entry, fd);
@@ -1284,7 +1301,7 @@
 static void CancelSnapshotIfNeeded() {
     std::string merge_status = "none";
     if (fb->GetVar(FB_VAR_SNAPSHOT_UPDATE_STATUS, &merge_status) == fastboot::SUCCESS &&
-        merge_status != "none") {
+        !merge_status.empty() && merge_status != "none") {
         fb->SnapshotUpdateCommand("cancel");
     }
 }
@@ -1567,7 +1584,7 @@
 static void fb_perform_format(
                               const std::string& partition, int skip_if_not_supported,
                               const std::string& type_override, const std::string& size_override,
-                              const std::string& initial_dir) {
+                              const std::string& initial_dir, const unsigned fs_options) {
     std::string partition_type, partition_size;
 
     struct fastboot_buffer buf;
@@ -1630,7 +1647,7 @@
     logicalBlkSize = fb_get_flash_block_size("logical-block-size");
 
     if (fs_generator_generate(gen, output.path, size, initial_dir,
-            eraseBlkSize, logicalBlkSize)) {
+            eraseBlkSize, logicalBlkSize, fs_options)) {
         die("Cannot generate image for %s", partition.c_str());
     }
 
@@ -1764,6 +1781,7 @@
     bool skip_secondary = false;
     bool set_fbe_marker = false;
     bool force_flash = false;
+    unsigned fs_options = 0;
     int longindex;
     std::string slot_override;
     std::string next_active;
@@ -1781,6 +1799,7 @@
         {"disable-verification", no_argument, 0, 0},
         {"disable-verity", no_argument, 0, 0},
         {"force", no_argument, 0, 0},
+        {"fs-options", required_argument, 0, 0},
         {"header-version", required_argument, 0, 0},
         {"help", no_argument, 0, 'h'},
         {"kernel-offset", required_argument, 0, 0},
@@ -1820,6 +1839,8 @@
                 g_disable_verity = true;
             } else if (name == "force") {
                 force_flash = true;
+            } else if (name == "fs-options") {
+                fs_options = ParseFsOption(optarg);
             } else if (name == "header-version") {
                 g_boot_img_hdr.header_version = strtoul(optarg, nullptr, 0);
             } else if (name == "dtb") {
@@ -1976,7 +1997,7 @@
             std::string partition = next_arg(&args);
 
             auto format = [&](const std::string& partition) {
-                fb_perform_format(partition, 0, type_override, size_override, "");
+                fb_perform_format(partition, 0, type_override, size_override, "", fs_options);
             };
             do_for_partitions(partition, slot_override, format, true);
         } else if (command == "signature") {
@@ -2166,10 +2187,10 @@
             if (partition == "userdata" && set_fbe_marker) {
                 fprintf(stderr, "setting FBE marker on initial userdata...\n");
                 std::string initial_userdata_dir = create_fbemarker_tmpdir();
-                fb_perform_format(partition, 1, partition_type, "", initial_userdata_dir);
+                fb_perform_format(partition, 1, partition_type, "", initial_userdata_dir, fs_options);
                 delete_fbemarker_tmpdir(initial_userdata_dir);
             } else {
-                fb_perform_format(partition, 1, partition_type, "", "");
+                fb_perform_format(partition, 1, partition_type, "", "", fs_options);
             }
         }
     }
@@ -2219,3 +2240,23 @@
     }
     hdr->SetOsVersion(major, minor, patch);
 }
+
+unsigned FastBootTool::ParseFsOption(const char* arg) {
+    unsigned fsOptions = 0;
+
+    std::vector<std::string> options = android::base::Split(arg, ",");
+    if (options.size() < 1)
+        syntax_error("bad options: %s", arg);
+
+    for (size_t i = 0; i < options.size(); ++i) {
+        if (options[i] == "casefold")
+            fsOptions |= (1 << FS_OPT_CASEFOLD);
+        else if (options[i] == "projid")
+            fsOptions |= (1 << FS_OPT_PROJID);
+        else if (options[i] == "compress")
+            fsOptions |= (1 << FS_OPT_COMPRESS);
+        else
+            syntax_error("unsupported options: %s", options[i].c_str());
+    }
+    return fsOptions;
+}
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index 9f18253..c23793a 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -34,4 +34,5 @@
 
     void ParseOsPatchLevel(boot_img_hdr_v1*, const char*);
     void ParseOsVersion(boot_img_hdr_v1*, const char*);
+    unsigned ParseFsOption(const char*);
 };
diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
index 8c0aa6b..458a7a1 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -113,7 +113,7 @@
 
 static int generate_ext4_image(const char* fileName, long long partSize,
                                const std::string& initial_dir, unsigned eraseBlkSize,
-                               unsigned logicalBlkSize) {
+                               unsigned logicalBlkSize, const unsigned fsOptions) {
     static constexpr int block_size = 4096;
     const std::string exec_dir = android::base::GetExecutableDirectory();
 
@@ -137,6 +137,12 @@
     mke2fs_args.push_back(ext_attr.c_str());
     mke2fs_args.push_back("-O");
     mke2fs_args.push_back("uninit_bg");
+
+    if (fsOptions & (1 << FS_OPT_PROJID)) {
+        mke2fs_args.push_back("-I");
+        mke2fs_args.push_back("512");
+    }
+
     mke2fs_args.push_back(fileName);
 
     std::string size_str = std::to_string(partSize / block_size);
@@ -162,9 +168,22 @@
     return exec_cmd(e2fsdroid_args[0], e2fsdroid_args.data(), nullptr);
 }
 
-static int generate_f2fs_image(const char* fileName, long long partSize, const std::string& initial_dir,
-                               unsigned /* unused */, unsigned /* unused */)
-{
+enum {
+    // clang-format off
+    FSCK_SUCCESS                 = 0,
+    FSCK_ERROR_CORRECTED         = 1 << 0,
+    FSCK_SYSTEM_SHOULD_REBOOT    = 1 << 1,
+    FSCK_ERRORS_LEFT_UNCORRECTED = 1 << 2,
+    FSCK_OPERATIONAL_ERROR       = 1 << 3,
+    FSCK_USAGE_OR_SYNTAX_ERROR   = 1 << 4,
+    FSCK_USER_CANCELLED          = 1 << 5,
+    FSCK_SHARED_LIB_ERROR        = 1 << 7,
+    // clang-format on
+};
+
+static int generate_f2fs_image(const char* fileName, long long partSize,
+                               const std::string& initial_dir, unsigned /* unused */,
+                               unsigned /* unused */, const unsigned fsOptions) {
     const std::string exec_dir = android::base::GetExecutableDirectory();
     const std::string mkf2fs_path = exec_dir + "/make_f2fs";
     std::vector<const char*> mkf2fs_args = {mkf2fs_path.c_str()};
@@ -174,6 +193,26 @@
     mkf2fs_args.push_back(size_str.c_str());
     mkf2fs_args.push_back("-g");
     mkf2fs_args.push_back("android");
+
+    if (fsOptions & (1 << FS_OPT_PROJID)) {
+        mkf2fs_args.push_back("-O");
+        mkf2fs_args.push_back("project_quota,extra_attr");
+    }
+
+    if (fsOptions & (1 << FS_OPT_CASEFOLD)) {
+        mkf2fs_args.push_back("-O");
+        mkf2fs_args.push_back("casefold");
+        mkf2fs_args.push_back("-C");
+        mkf2fs_args.push_back("utf8");
+    }
+
+    if (fsOptions & (1 << FS_OPT_COMPRESS)) {
+        mkf2fs_args.push_back("-O");
+        mkf2fs_args.push_back("compression");
+        mkf2fs_args.push_back("-O");
+        mkf2fs_args.push_back("extra_attr");
+    }
+
     mkf2fs_args.push_back(fileName);
     mkf2fs_args.push_back(nullptr);
 
@@ -190,7 +229,11 @@
     std::vector<const char*> sload_args = {sload_path.c_str(), "-S",
                                        "-f", initial_dir.c_str(), fileName, nullptr};
 
-    return exec_cmd(sload_args[0], sload_args.data(), nullptr);
+    ret = exec_cmd(sload_args[0], sload_args.data(), nullptr);
+    if (ret != 0 && ret != FSCK_ERROR_CORRECTED) {
+        return -1;
+    }
+    return 0;
 }
 
 static const struct fs_generator {
@@ -198,7 +241,7 @@
 
     //returns 0 or error value
     int (*generate)(const char* fileName, long long partSize, const std::string& initial_dir,
-                    unsigned eraseBlkSize, unsigned logicalBlkSize);
+                    unsigned eraseBlkSize, unsigned logicalBlkSize, const unsigned fsOptions);
 
 } generators[] = {
     { "ext4", generate_ext4_image},
@@ -215,7 +258,7 @@
 }
 
 int fs_generator_generate(const struct fs_generator* gen, const char* fileName, long long partSize,
-    const std::string& initial_dir, unsigned eraseBlkSize, unsigned logicalBlkSize)
-{
-    return gen->generate(fileName, partSize, initial_dir, eraseBlkSize, logicalBlkSize);
+                          const std::string& initial_dir, unsigned eraseBlkSize,
+                          unsigned logicalBlkSize, const unsigned fsOptions) {
+    return gen->generate(fileName, partSize, initial_dir, eraseBlkSize, logicalBlkSize, fsOptions);
 }
diff --git a/fastboot/fs.h b/fastboot/fs.h
index 331100d..f832938 100644
--- a/fastboot/fs.h
+++ b/fastboot/fs.h
@@ -5,6 +5,13 @@
 
 struct fs_generator;
 
+enum FS_OPTION {
+    FS_OPT_CASEFOLD,
+    FS_OPT_PROJID,
+    FS_OPT_COMPRESS,
+};
+
 const struct fs_generator* fs_get_generator(const std::string& fs_type);
 int fs_generator_generate(const struct fs_generator* gen, const char* fileName, long long partSize,
-    const std::string& initial_dir, unsigned eraseBlkSize = 0, unsigned logicalBlkSize = 0);
+                          const std::string& initial_dir, unsigned eraseBlkSize = 0,
+                          unsigned logicalBlkSize = 0, unsigned fsOptions = 0);
diff --git a/fastboot/fuzzy_fastboot/main.cpp b/fastboot/fuzzy_fastboot/main.cpp
index e7f785b..34ab32c 100644
--- a/fastboot/fuzzy_fastboot/main.cpp
+++ b/fastboot/fuzzy_fastboot/main.cpp
@@ -1286,7 +1286,7 @@
     ASSERT_TRUE(PartitionHash(fb.get(), "userdata", &hash_buf, &retcode, &err_msg)) << err_msg;
     ASSERT_EQ(retcode, 0) << err_msg;
 
-    // Sanity check of hash
+    // Validity check of hash
     EXPECT_NE(hash_before, hash_buf)
             << "Writing a random buffer to 'userdata' had the same hash as after erasing it";
     SetLockState(true);  // Lock the device
diff --git a/fastboot/usb.h b/fastboot/usb.h
index 7ca44c4..e5f56e2 100644
--- a/fastboot/usb.h
+++ b/fastboot/usb.h
@@ -50,6 +50,8 @@
 
     char serial_number[256];
     char device_path[256];
+
+    char interface[256];
 };
 
 class UsbTransport : public Transport {
diff --git a/fastboot/usb_linux.cpp b/fastboot/usb_linux.cpp
index 6363aa5..964488c 100644
--- a/fastboot/usb_linux.cpp
+++ b/fastboot/usb_linux.cpp
@@ -43,6 +43,8 @@
 #include <linux/version.h>
 #include <linux/usb/ch9.h>
 
+#include <android-base/file.h>
+#include <android-base/stringprintf.h>
 #include <chrono>
 #include <memory>
 #include <thread>
@@ -263,6 +265,13 @@
         info.has_bulk_in = (in != -1);
         info.has_bulk_out = (out != -1);
 
+        std::string interface;
+        auto path = android::base::StringPrintf("/sys/bus/usb/devices/%s/%s:1.%d/interface",
+                                                sysfs_name, sysfs_name, ifc->bInterfaceNumber);
+        if (android::base::ReadFileToString(path, &interface)) {
+            snprintf(info.interface, sizeof(info.interface), "%s", interface.c_str());
+        }
+
         if(callback(&info) == 0) {
             *ept_in_id = in;
             *ept_out_id = out;
diff --git a/fastboot/usb_osx.cpp b/fastboot/usb_osx.cpp
index 8a3c213..610eebf 100644
--- a/fastboot/usb_osx.cpp
+++ b/fastboot/usb_osx.cpp
@@ -368,6 +368,7 @@
         // device has no serial number
         handle->info.serial_number[0] = 0;
     }
+    handle->info.interface[0] = 0;
     handle->info.writable = 1;
 
     if (try_interfaces(dev, handle)) {
diff --git a/fastboot/usb_windows.cpp b/fastboot/usb_windows.cpp
index bf840f8..67bf8a3 100644
--- a/fastboot/usb_windows.cpp
+++ b/fastboot/usb_windows.cpp
@@ -319,6 +319,7 @@
                     &serial_number_len, true)) {
         info.serial_number[0] = 0;
     }
+    info.interface[0] = 0;
 
     info.device_path[0] = 0;
 
diff --git a/fs_mgr/Android.bp b/fs_mgr/Android.bp
index ac784b2..96cc5c8 100644
--- a/fs_mgr/Android.bp
+++ b/fs_mgr/Android.bp
@@ -170,6 +170,7 @@
     defaults: ["fs_mgr_defaults"],
     static_libs: [
         "libavb_user",
+        "libgsid",
         "libutils",
         "libvold_binder",
     ],
diff --git a/fs_mgr/OWNERS b/fs_mgr/OWNERS
index cbbd3bc..cf353a1 100644
--- a/fs_mgr/OWNERS
+++ b/fs_mgr/OWNERS
@@ -1,3 +1,2 @@
 bowgotsai@google.com
 dvander@google.com
-tomcherry@google.com
diff --git a/fs_mgr/README.overlayfs.md b/fs_mgr/README.overlayfs.md
index f579078..94b2f8c 100644
--- a/fs_mgr/README.overlayfs.md
+++ b/fs_mgr/README.overlayfs.md
@@ -8,8 +8,8 @@
 system partition as read-write and then add or modify any number of files
 without reflashing the system image, which is efficient for a development cycle.
 
-Limited memory systems use read-only types of file systems or logical resizable
-Android partitions (LRAPs). These file systems land system partition images
+Limited memory systems use read-only types of file systems or dynamic
+Android partitions (DAPs). These file systems land system partition images
 right-sized, and have been deduped at the block level to compress the content.
 This means that a remount either isn’t possible, or isn't useful because of
 space limitations or support logistics.
@@ -42,7 +42,7 @@
     $ adb push <source> <destination>
     $ adb reboot
 
-Note that you can replace these two lines:
+Note that you can replace these two lines in the above sequence:
 
     $ adb disable-verity
     $ adb reboot
@@ -51,7 +51,7 @@
 
     $ adb remount -R
 
-**Note:** _adb reboot -R_ won’t reboot if the device is already in the adb remount state.
+**Note:** _adb remount -R_ won’t reboot if the device is already in the adb remount state.
 
 None of this changes if OverlayFS needs to be engaged.
 The decisions whether to use traditional direct file-system remount,
diff --git a/fs_mgr/TEST_MAPPING b/fs_mgr/TEST_MAPPING
index 676f446..a349408 100644
--- a/fs_mgr/TEST_MAPPING
+++ b/fs_mgr/TEST_MAPPING
@@ -7,13 +7,16 @@
       "name": "liblp_test"
     },
     {
-      "name": "fiemap_image_test_presubmit"
+      "name": "fiemap_image_test"
     },
     {
       "name": "fiemap_writer_test"
     },
     {
       "name": "vts_libsnapshot_test"
+    },
+    {
+      "name": "libsnapshot_fuzzer_test"
     }
   ]
 }
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 30db652..1efe793 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -521,13 +521,13 @@
 }
 
 // Enable casefold if needed.
-static void tune_casefold(const std::string& blk_device, const struct ext4_super_block* sb,
-                          int* fs_stat) {
+static void tune_casefold(const std::string& blk_device, const FstabEntry& entry,
+                          const struct ext4_super_block* sb, int* fs_stat) {
     bool has_casefold = (sb->s_feature_incompat & cpu_to_le32(EXT4_FEATURE_INCOMPAT_CASEFOLD)) != 0;
     bool wants_casefold =
             android::base::GetBoolProperty("external_storage.casefold.enabled", false);
 
-    if (!wants_casefold || has_casefold) return;
+    if (entry.mount_point != "/data" || !wants_casefold || has_casefold) return;
 
     std::string casefold_support;
     if (!android::base::ReadFileToString(SYSFS_EXT4_CASEFOLD, &casefold_support)) {
@@ -582,11 +582,10 @@
 
     LINFO << "Enabling ext4 metadata_csum on " << blk_device;
 
-    // requires to give last_fsck_time to current to avoid insane time.
+    // Must give `-T now` to prevent last_fsck_time from growing too large,
     // otherwise, tune2fs won't enable metadata_csum.
-    std::string now = std::to_string(time(0));
     const char* tune2fs_args[] = {TUNE2FS_BIN, "-O",        "metadata_csum,64bit,extent",
-                                  "-T",        now.c_str(), blk_device.c_str()};
+                                  "-T",        "now", blk_device.c_str()};
     const char* resize2fs_args[] = {RESIZE2FS_BIN, "-b", blk_device.c_str()};
 
     if (!run_command(tune2fs_args, ARRAY_SIZE(tune2fs_args))) {
@@ -657,7 +656,17 @@
 // If needed, we'll also enable (or disable) filesystem features as specified by
 // the fstab record.
 //
-static int prepare_fs_for_mount(const std::string& blk_device, const FstabEntry& entry) {
+static int prepare_fs_for_mount(const std::string& blk_device, const FstabEntry& entry,
+                                const std::string& alt_mount_point = "") {
+    auto& mount_point = alt_mount_point.empty() ? entry.mount_point : alt_mount_point;
+    // We need this because sometimes we have legacy symlinks that are
+    // lingering around and need cleaning up.
+    struct stat info;
+    if (lstat(mount_point.c_str(), &info) == 0 && (info.st_mode & S_IFMT) == S_IFLNK) {
+        unlink(mount_point.c_str());
+    }
+    mkdir(mount_point.c_str(), 0755);
+
     int fs_stat = 0;
 
     if (is_extfs(entry.fs_type)) {
@@ -685,7 +694,7 @@
 
     if (entry.fs_mgr_flags.check ||
         (fs_stat & (FS_STAT_UNCLEAN_SHUTDOWN | FS_STAT_QUOTA_ENABLED))) {
-        check_fs(blk_device, entry.fs_type, entry.mount_point, &fs_stat);
+        check_fs(blk_device, entry.fs_type, mount_point, &fs_stat);
     }
 
     if (is_extfs(entry.fs_type) &&
@@ -697,7 +706,7 @@
             tune_reserved_size(blk_device, entry, &sb, &fs_stat);
             tune_encrypt(blk_device, entry, &sb, &fs_stat);
             tune_verity(blk_device, entry, &sb, &fs_stat);
-            tune_casefold(blk_device, &sb, &fs_stat);
+            tune_casefold(blk_device, entry, &sb, &fs_stat);
             tune_metadata_csum(blk_device, entry, &sb, &fs_stat);
         }
     }
@@ -730,13 +739,6 @@
 // sets the underlying block device to read-only if the mount is read-only.
 // See "man 2 mount" for return values.
 static int __mount(const std::string& source, const std::string& target, const FstabEntry& entry) {
-    // We need this because sometimes we have legacy symlinks that are
-    // lingering around and need cleaning up.
-    struct stat info;
-    if (lstat(target.c_str(), &info) == 0 && (info.st_mode & S_IFMT) == S_IFLNK) {
-        unlink(target.c_str());
-    }
-    mkdir(target.c_str(), 0755);
     errno = 0;
     unsigned long mountflags = entry.flags;
     int ret = 0;
@@ -997,6 +999,19 @@
     }
 }
 
+static void set_type_property(int status) {
+    switch (status) {
+        case FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED:
+            SetProperty("ro.crypto.type", "block");
+            break;
+        case FS_MGR_MNTALL_DEV_FILE_ENCRYPTED:
+        case FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED:
+        case FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION:
+            SetProperty("ro.crypto.type", "file");
+            break;
+    }
+}
+
 static bool call_vdc(const std::vector<std::string>& args, int* ret) {
     std::vector<char const*> argv;
     argv.emplace_back("/system/bin/vdc");
@@ -1134,10 +1149,9 @@
                 // metadata-encrypted device with smaller blocks, we must not change this for
                 // devices shipped with Q or earlier unless they explicitly selected dm-default-key
                 // v2
-                constexpr unsigned int pre_gki_level = __ANDROID_API_Q__;
                 unsigned int options_format_version = android::base::GetUintProperty<unsigned int>(
                         "ro.crypto.dm_default_key.options_format.version",
-                        (android::fscrypt::GetFirstApiLevel() <= pre_gki_level ? 1 : 2));
+                        (android::fscrypt::GetFirstApiLevel() <= __ANDROID_API_Q__ ? 1 : 2));
                 if (options_format_version > 1) {
                     bowTarget->SetBlockSize(4096);
                 }
@@ -1305,14 +1319,16 @@
 // When multiple fstab records share the same mount_point, it will try to mount each
 // one in turn, and ignore any duplicates after a first successful mount.
 // Returns -1 on error, and  FS_MGR_MNTALL_* otherwise.
-int fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
+MountAllResult fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
     int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE;
     int error_count = 0;
     CheckpointManager checkpoint_manager;
     AvbUniquePtr avb_handle(nullptr);
+    bool wiped = false;
 
+    bool userdata_mounted = false;
     if (fstab->empty()) {
-        return FS_MGR_MNTALL_FAIL;
+        return {FS_MGR_MNTALL_FAIL, userdata_mounted};
     }
 
     // Keep i int to prevent unsigned integer overflow from (i = top_idx - 1),
@@ -1352,7 +1368,7 @@
         }
 
         // Terrible hack to make it possible to remount /data.
-        // TODO: refact fs_mgr_mount_all and get rid of this.
+        // TODO: refactor fs_mgr_mount_all and get rid of this.
         if (mount_mode == MOUNT_MODE_ONLY_USERDATA && current_entry.mount_point != "/data") {
             continue;
         }
@@ -1388,7 +1404,8 @@
                 avb_handle = AvbHandle::Open();
                 if (!avb_handle) {
                     LERROR << "Failed to open AvbHandle";
-                    return FS_MGR_MNTALL_FAIL;
+                    set_type_property(encryptable);
+                    return {FS_MGR_MNTALL_FAIL, userdata_mounted};
                 }
             }
             if (avb_handle->SetUpAvbHashtree(&current_entry, true /* wait_for_verity_dev */) ==
@@ -1430,7 +1447,7 @@
 
             if (status == FS_MGR_MNTALL_FAIL) {
                 // Fatal error - no point continuing.
-                return status;
+                return {status, userdata_mounted};
             }
 
             if (status != FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE) {
@@ -1441,20 +1458,25 @@
                 encryptable = status;
                 if (status == FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION) {
                     if (!call_vdc({"cryptfs", "encryptFstab", attempted_entry.blk_device,
-                                   attempted_entry.mount_point},
+                                   attempted_entry.mount_point, wiped ? "true" : "false",
+                                   attempted_entry.fs_type},
                                   nullptr)) {
                         LERROR << "Encryption failed";
-                        return FS_MGR_MNTALL_FAIL;
+                        set_type_property(encryptable);
+                        return {FS_MGR_MNTALL_FAIL, userdata_mounted};
                     }
                 }
             }
 
+            if (current_entry.mount_point == "/data") {
+                userdata_mounted = true;
+            }
             // Success!  Go get the next one.
             continue;
         }
 
         // Mounting failed, understand why and retry.
-        bool wiped = partition_wiped(current_entry.blk_device.c_str());
+        wiped = partition_wiped(current_entry.blk_device.c_str());
         bool crypt_footer = false;
         if (mount_errno != EBUSY && mount_errno != EACCES &&
             current_entry.fs_mgr_flags.formattable && wiped) {
@@ -1479,6 +1501,27 @@
             } else if (current_entry.is_encryptable() && current_entry.key_loc == KEY_IN_FOOTER) {
                 crypt_footer = true;
             }
+
+            // EncryptInplace will be used when vdc gives an error or needs to format partitions
+            // other than /data
+            if (should_use_metadata_encryption(current_entry) &&
+                current_entry.mount_point == "/data") {
+
+                // vdc->Format requires "ro.crypto.type" to set an encryption flag
+                encryptable = FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED;
+                set_type_property(encryptable);
+
+                if (!call_vdc({"cryptfs", "encryptFstab", current_entry.blk_device,
+                               current_entry.mount_point, "true" /* shouldFormat */,
+                               current_entry.fs_type},
+                              nullptr)) {
+                    LERROR << "Encryption failed";
+                } else {
+                    userdata_mounted = true;
+                    continue;
+                }
+            }
+
             if (fs_mgr_do_format(current_entry, crypt_footer) == 0) {
                 // Let's replay the mount actions.
                 i = top_idx - 1;
@@ -1517,6 +1560,8 @@
                            attempted_entry.mount_point},
                           nullptr)) {
                 ++error_count;
+            } else if (current_entry.mount_point == "/data") {
+                userdata_mounted = true;
             }
             encryptable = FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED;
             continue;
@@ -1541,14 +1586,16 @@
         }
     }
 
+    set_type_property(encryptable);
+
 #if ALLOW_ADBD_DISABLE_VERITY == 1  // "userdebug" build
     fs_mgr_overlayfs_mount_all(fstab);
 #endif
 
     if (error_count) {
-        return FS_MGR_MNTALL_FAIL;
+        return {FS_MGR_MNTALL_FAIL, userdata_mounted};
     } else {
-        return encryptable;
+        return {encryptable, userdata_mounted};
     }
 }
 
@@ -1770,25 +1817,26 @@
         }
         LINFO << "Remounting /data";
         // TODO(b/143970043): remove this hack after fs_mgr_mount_all is refactored.
-        int result = fs_mgr_mount_all(fstab, MOUNT_MODE_ONLY_USERDATA);
-        return result == FS_MGR_MNTALL_FAIL ? -1 : 0;
+        auto result = fs_mgr_mount_all(fstab, MOUNT_MODE_ONLY_USERDATA);
+        return result.code == FS_MGR_MNTALL_FAIL ? -1 : 0;
     }
     return 0;
 }
 
 // wrapper to __mount() and expects a fully prepared fstab_rec,
 // unlike fs_mgr_do_mount which does more things with avb / verity etc.
-int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& mount_point) {
+int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& alt_mount_point) {
     // First check the filesystem if requested.
     if (entry.fs_mgr_flags.wait && !WaitForFile(entry.blk_device, 20s)) {
         LERROR << "Skipping mounting '" << entry.blk_device << "'";
     }
 
-    // Run fsck if needed
-    prepare_fs_for_mount(entry.blk_device, entry);
+    auto& mount_point = alt_mount_point.empty() ? entry.mount_point : alt_mount_point;
 
-    int ret =
-            __mount(entry.blk_device, mount_point.empty() ? entry.mount_point : mount_point, entry);
+    // Run fsck if needed
+    prepare_fs_for_mount(entry.blk_device, entry, mount_point);
+
+    int ret = __mount(entry.blk_device, mount_point, entry);
     if (ret) {
       ret = (errno == EBUSY) ? FS_MGR_DOMNT_BUSY : FS_MGR_DOMNT_FAILED;
     }
@@ -1847,7 +1895,14 @@
             continue;
         }
 
-        int fs_stat = prepare_fs_for_mount(n_blk_device, fstab_entry);
+        // Now mount it where requested */
+        if (tmp_mount_point) {
+            mount_point = tmp_mount_point;
+        } else {
+            mount_point = fstab_entry.mount_point;
+        }
+
+        int fs_stat = prepare_fs_for_mount(n_blk_device, fstab_entry, mount_point);
 
         if (fstab_entry.fs_mgr_flags.avb) {
             if (!avb_handle) {
@@ -1881,12 +1936,6 @@
             }
         }
 
-        // Now mount it where requested */
-        if (tmp_mount_point) {
-            mount_point = tmp_mount_point;
-        } else {
-            mount_point = fstab_entry.mount_point;
-        }
         int retry_count = 2;
         while (retry_count-- > 0) {
             if (!__mount(n_blk_device, mount_point, fstab_entry)) {
@@ -1898,7 +1947,7 @@
                 mount_errors++;
                 fs_stat |= FS_STAT_FULL_MOUNT_FAILED;
                 // try again after fsck
-                check_fs(n_blk_device, fstab_entry.fs_type, fstab_entry.mount_point, &fs_stat);
+                check_fs(n_blk_device, fstab_entry.fs_type, mount_point, &fs_stat);
             }
         }
         log_fs_stat(fstab_entry.blk_device, fs_stat);
@@ -2094,6 +2143,41 @@
     return false;
 }
 
+std::string fs_mgr_get_hashtree_algorithm(const android::fs_mgr::FstabEntry& entry) {
+    if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) {
+        return "";
+    }
+    DeviceMapper& dm = DeviceMapper::Instance();
+    std::string device = GetVerityDeviceName(entry);
+
+    std::vector<DeviceMapper::TargetInfo> table;
+    if (dm.GetState(device) == DmDeviceState::INVALID || !dm.GetTableInfo(device, &table)) {
+        return "";
+    }
+    for (const auto& target : table) {
+        if (strcmp(target.spec.target_type, "verity") != 0) {
+            continue;
+        }
+
+        // The format is stable for dm-verity version 0 & 1. And the data is expected to have
+        // the fixed format:
+        // <version> <dev> <hash_dev> <data_block_size> <hash_block_size> <num_data_blocks>
+        // <hash_start_block> <algorithm> <digest> <salt>
+        // Details in https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/verity.html
+
+        std::vector<std::string> tokens = android::base::Split(target.data, " \t\r\n");
+        if (tokens[0] != "0" && tokens[0] != "1") {
+            LOG(WARNING) << "Unrecognized device mapper version in " << target.data;
+            return "";
+        }
+
+        // Hashtree algorithm is the 8th token in the output
+        return android::base::Trim(tokens[7]);
+    }
+
+    return "";
+}
+
 bool fs_mgr_verity_is_check_at_most_once(const android::fs_mgr::FstabEntry& entry) {
     if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) {
         return false;
diff --git a/fs_mgr/fs_mgr_format.cpp b/fs_mgr/fs_mgr_format.cpp
index fd7386d..301c907 100644
--- a/fs_mgr/fs_mgr_format.cpp
+++ b/fs_mgr/fs_mgr_format.cpp
@@ -121,7 +121,7 @@
 }
 
 static int format_f2fs(const std::string& fs_blkdev, uint64_t dev_sz, bool crypt_footer,
-                       bool needs_projid, bool needs_casefold) {
+                       bool needs_projid, bool needs_casefold, bool fs_compress) {
     if (!dev_sz) {
         int rc = get_dev_sz(fs_blkdev, &dev_sz);
         if (rc) {
@@ -147,6 +147,12 @@
         args.push_back("-C");
         args.push_back("utf8");
     }
+    if (fs_compress) {
+        args.push_back("-O");
+        args.push_back("compression");
+        args.push_back("-O");
+        args.push_back("extra_attr");
+    }
     args.push_back(fs_blkdev.c_str());
     args.push_back(size_str.c_str());
 
@@ -166,7 +172,7 @@
 
     if (entry.fs_type == "f2fs") {
         return format_f2fs(entry.blk_device, entry.length, crypt_footer, needs_projid,
-                           needs_casefold);
+                           needs_casefold, entry.fs_mgr_flags.fs_compress);
     } else if (entry.fs_type == "ext4") {
         return format_ext4(entry.blk_device, entry.mount_point, crypt_footer, needs_projid,
                            entry.fs_mgr_flags.ext_meta_csum);
diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp
index 8a22078..42459ec 100644
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -178,6 +178,7 @@
         CheckFlag("slotselect_other", slot_select_other);
         CheckFlag("fsverity", fs_verity);
         CheckFlag("metadata_csum", ext_meta_csum);
+        CheckFlag("fscompress", fs_compress);
 
 #undef CheckFlag
 
@@ -582,18 +583,19 @@
 
 }  // namespace
 
-void TransformFstabForDsu(Fstab* fstab, const std::vector<std::string>& dsu_partitions) {
+void TransformFstabForDsu(Fstab* fstab, const std::string& dsu_slot,
+                          const std::vector<std::string>& dsu_partitions) {
     static constexpr char kDsuKeysDir[] = "/avb";
     // Convert userdata
     // Inherit fstab properties for userdata.
     FstabEntry userdata;
     if (FstabEntry* entry = GetEntryForMountPoint(fstab, "/data")) {
         userdata = *entry;
-        userdata.blk_device = "userdata_gsi";
+        userdata.blk_device = android::gsi::kDsuUserdata;
         userdata.fs_mgr_flags.logical = true;
         userdata.fs_mgr_flags.formattable = true;
         if (!userdata.metadata_key_dir.empty()) {
-            userdata.metadata_key_dir += "/gsi";
+            userdata.metadata_key_dir = android::gsi::GetDsuMetadataKeyDir(dsu_slot);
         }
     } else {
         userdata = BuildDsuUserdataFstabEntry();
@@ -609,7 +611,11 @@
             continue;
         }
         // userdata has been handled
-        if (StartsWith(partition, "user")) {
+        if (partition == android::gsi::kDsuUserdata) {
+            continue;
+        }
+        // scratch is handled by fs_mgr_overlayfs
+        if (partition == android::gsi::kDsuScratch) {
             continue;
         }
         // dsu_partition_name = corresponding_partition_name + kDsuPostfix
@@ -634,13 +640,14 @@
             entry.fs_mgr_flags.wait = true;
             entry.fs_mgr_flags.logical = true;
             entry.fs_mgr_flags.first_stage_mount = true;
+            fstab->emplace_back(entry);
         } else {
             // If the corresponding partition exists, transform all its Fstab
             // by pointing .blk_device to the DSU partition.
             for (auto&& entry : entries) {
                 entry->blk_device = partition;
                 // AVB keys for DSU should always be under kDsuKeysDir.
-                entry->avb_keys += kDsuKeysDir;
+                entry->avb_keys = kDsuKeysDir;
             }
             // Make sure the ext4 is included to support GSI.
             auto partition_ext4 =
@@ -685,9 +692,21 @@
         return false;
     }
     if (!is_proc_mounts && !access(android::gsi::kGsiBootedIndicatorFile, F_OK)) {
+        // This is expected to fail if host is android Q, since Q doesn't
+        // support DSU slotting. The DSU "active" indicator file would be
+        // non-existent or empty if DSU is enabled within the guest system.
+        // In that case, just use the default slot name "dsu".
+        std::string dsu_slot;
+        if (!android::gsi::GetActiveDsu(&dsu_slot)) {
+            PWARNING << __FUNCTION__ << "(): failed to get active dsu slot";
+        }
+        if (dsu_slot.empty()) {
+            dsu_slot = "dsu";
+        }
+
         std::string lp_names;
         ReadFileToString(gsi::kGsiLpNamesFile, &lp_names);
-        TransformFstabForDsu(fstab, Split(lp_names, ","));
+        TransformFstabForDsu(fstab, dsu_slot, Split(lp_names, ","));
     }
 
 #ifndef NO_SKIP_MOUNT
@@ -831,6 +850,20 @@
         return std::set<std::string>(boot_devices.begin(), boot_devices.end());
     }
 
+    std::string cmdline;
+    if (android::base::ReadFileToString("/proc/cmdline", &cmdline)) {
+        std::set<std::string> boot_devices;
+        const std::string cmdline_key = "androidboot.boot_device";
+        for (const auto& [key, value] : fs_mgr_parse_boot_config(cmdline)) {
+            if (key == cmdline_key) {
+                boot_devices.emplace(value);
+            }
+        }
+        if (!boot_devices.empty()) {
+            return boot_devices;
+        }
+    }
+
     // Fallback to extract boot devices from fstab.
     Fstab fstab;
     if (!ReadDefaultFstab(&fstab)) {
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index 1fa1aa1..388c296 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -113,8 +113,11 @@
 namespace android {
 namespace fs_mgr {
 
-void MapScratchPartitionIfNeeded(Fstab*,
-                                 const std::function<bool(const std::set<std::string>&)>&) {}
+void MapScratchPartitionIfNeeded(Fstab*, const std::function<bool(const std::set<std::string>&)>&) {
+}
+
+void TeardownAllOverlayForMountPoint(const std::string&) {}
+
 }  // namespace fs_mgr
 }  // namespace android
 
@@ -166,11 +169,34 @@
            (vst.f_bfree * vst.f_bsize) >= kSizeThreshold;
 }
 
+bool fs_mgr_in_recovery() {
+    // Check the existence of recovery binary instead of using the compile time
+    // macro, because first-stage-init is compiled with __ANDROID_RECOVERY__
+    // defined, albeit not in recovery. More details: system/core/init/README.md
+    return fs_mgr_access("/system/bin/recovery");
+}
+
+bool fs_mgr_is_dsu_running() {
+    // Since android::gsi::CanBootIntoGsi() or android::gsi::MarkSystemAsGsi() is
+    // never called in recovery, the return value of android::gsi::IsGsiRunning()
+    // is not well-defined. In this case, just return false as being in recovery
+    // implies not running a DSU system.
+    if (fs_mgr_in_recovery()) return false;
+    auto saved_errno = errno;
+    auto ret = android::gsi::IsGsiRunning();
+    errno = saved_errno;
+    return ret;
+}
+
 const auto kPhysicalDevice = "/dev/block/by-name/"s;
 constexpr char kScratchImageMetadata[] = "/metadata/gsi/remount/lp_metadata";
 
 // Note: this is meant only for recovery/first-stage init.
 bool ScratchIsOnData() {
+    // The scratch partition of DSU is managed by gsid.
+    if (fs_mgr_is_dsu_running()) {
+        return false;
+    }
     return fs_mgr_access(kScratchImageMetadata);
 }
 
@@ -464,6 +490,12 @@
     // umount and delete kScratchMountPoint storage if we have logical partitions
     if (overlay != kScratchMountPoint) return true;
 
+    // Validation check.
+    if (fs_mgr_is_dsu_running()) {
+        LERROR << "Destroying DSU scratch is not allowed.";
+        return false;
+    }
+
     auto save_errno = errno;
     if (fs_mgr_overlayfs_already_mounted(kScratchMountPoint, false)) {
         fs_mgr_overlayfs_umount_scratch();
@@ -512,10 +544,13 @@
 }
 
 bool fs_mgr_overlayfs_teardown_one(const std::string& overlay, const std::string& mount_point,
-                                   bool* change) {
+                                   bool* change, bool* should_destroy_scratch = nullptr) {
     const auto top = overlay + kOverlayTopDir;
 
-    if (!fs_mgr_access(top)) return fs_mgr_overlayfs_teardown_scratch(overlay, change);
+    if (!fs_mgr_access(top)) {
+        if (should_destroy_scratch) *should_destroy_scratch = true;
+        return true;
+    }
 
     auto cleanup_all = mount_point.empty();
     const auto partition_name = android::base::Basename(mount_point);
@@ -571,7 +606,7 @@
             PERROR << "rmdir " << top;
         }
     }
-    if (cleanup_all) ret &= fs_mgr_overlayfs_teardown_scratch(overlay, change);
+    if (should_destroy_scratch) *should_destroy_scratch = cleanup_all;
     return ret;
 }
 
@@ -809,15 +844,26 @@
     entry.fs_type = mnt_type;
     if ((mnt_type == "f2fs") && !f2fs) entry.fs_type = "ext4";
     if ((mnt_type == "ext4") && !ext4) entry.fs_type = "f2fs";
-    entry.flags = MS_NOATIME;
-    if (readonly) {
-        entry.flags |= MS_RDONLY;
-    } else {
+    entry.flags = MS_NOATIME | MS_RDONLY;
+    auto mounted = true;
+    if (!readonly) {
+        if (entry.fs_type == "ext4") {
+            // check if ext4 de-dupe
+            entry.flags |= MS_RDONLY;
+            auto save_errno = errno;
+            mounted = fs_mgr_do_mount_one(entry) == 0;
+            if (mounted) {
+                mounted = !fs_mgr_has_shared_blocks(entry.mount_point, entry.blk_device);
+                fs_mgr_overlayfs_umount_scratch();
+            }
+            errno = save_errno;
+        }
+        entry.flags &= ~MS_RDONLY;
         fs_mgr_set_blk_ro(device_path, false);
     }
     entry.fs_mgr_flags.check = true;
     auto save_errno = errno;
-    auto mounted = fs_mgr_do_mount_one(entry) == 0;
+    if (mounted) mounted = fs_mgr_do_mount_one(entry) == 0;
     if (!mounted) {
         if ((entry.fs_type == "f2fs") && ext4) {
             entry.fs_type = "ext4";
@@ -870,12 +916,29 @@
     return "";
 }
 
+// Note: The scratch partition of DSU is managed by gsid, and should be initialized during
+// first-stage-mount. Just check if the DM device for DSU scratch partition is created or not.
+static std::string GetDsuScratchDevice() {
+    auto& dm = DeviceMapper::Instance();
+    std::string device;
+    if (dm.GetState(android::gsi::kDsuScratch) != DmDeviceState::INVALID &&
+        dm.GetDmDevicePathByName(android::gsi::kDsuScratch, &device)) {
+        return device;
+    }
+    return "";
+}
+
 // This returns the scratch device that was detected during early boot (first-
 // stage init). If the device was created later, for example during setup for
 // the adb remount command, it can return an empty string since it does not
 // query ImageManager. (Note that ImageManager in first-stage init will always
 // use device-mapper, since /data is not available to use loop devices.)
 static std::string GetBootScratchDevice() {
+    // Note: fs_mgr_is_dsu_running() always returns false in recovery or fastbootd.
+    if (fs_mgr_is_dsu_running()) {
+        return GetDsuScratchDevice();
+    }
+
     auto& dm = DeviceMapper::Instance();
 
     // If there is a scratch partition allocated in /data or on super, we
@@ -1034,7 +1097,7 @@
 
 static bool CreateScratchOnData(std::string* scratch_device, bool* partition_exists, bool* change) {
     *partition_exists = false;
-    *change = false;
+    if (change) *change = false;
 
     auto images = IImageManager::Open("remount", 10s);
     if (!images) {
@@ -1054,7 +1117,7 @@
         return false;
     }
 
-    *change = true;
+    if (change) *change = true;
 
     // Note: calling RemoveDisabledImages here ensures that we do not race with
     // clean_scratch_files and accidentally try to map an image that will be
@@ -1097,6 +1160,14 @@
 
 bool fs_mgr_overlayfs_create_scratch(const Fstab& fstab, std::string* scratch_device,
                                      bool* partition_exists, bool* change) {
+    // Use the DSU scratch device managed by gsid if within a DSU system.
+    if (fs_mgr_is_dsu_running()) {
+        *scratch_device = GetDsuScratchDevice();
+        *partition_exists = !scratch_device->empty();
+        *change = false;
+        return *partition_exists;
+    }
+
     // Try a physical partition first.
     *scratch_device = GetPhysicalScratchDevice();
     if (!scratch_device->empty() && fs_mgr_rw_access(*scratch_device)) {
@@ -1155,12 +1226,8 @@
 bool fs_mgr_overlayfs_invalid() {
     if (fs_mgr_overlayfs_valid() == OverlayfsValidResult::kNotSupported) return true;
 
-    // in recovery, fastbootd, or gsi mode, not allowed!
-    if (fs_mgr_access("/system/bin/recovery")) return true;
-    auto save_errno = errno;
-    auto ret = android::gsi::IsGsiRunning();
-    errno = save_errno;
-    return ret;
+    // in recovery or fastbootd, not allowed!
+    return fs_mgr_in_recovery();
 }
 
 }  // namespace
@@ -1303,6 +1370,8 @@
     return ret;
 }
 
+// Note: This function never returns the DSU scratch device in recovery or fastbootd,
+// because the DSU scratch is created in the first-stage-mount, which is not run in recovery.
 static bool EnsureScratchMapped(std::string* device, bool* mapped) {
     *mapped = false;
     *device = GetBootScratchDevice();
@@ -1310,6 +1379,11 @@
         return true;
     }
 
+    if (!fs_mgr_in_recovery()) {
+        errno = EINVAL;
+        return false;
+    }
+
     auto partition_name = android::base::Basename(kScratchMountPoint);
 
     // Check for scratch on /data first, before looking for a modified super
@@ -1351,10 +1425,27 @@
     return true;
 }
 
-static void UnmapScratchDevice() {
-    // This should only be reachable in recovery, where scratch is not
-    // automatically mapped and therefore can be unmapped.
-    DestroyLogicalPartition(android::base::Basename(kScratchMountPoint));
+// This should only be reachable in recovery, where DSU scratch is not
+// automatically mapped.
+static bool MapDsuScratchDevice(std::string* device) {
+    std::string dsu_slot;
+    if (!android::gsi::IsGsiInstalled() || !android::gsi::GetActiveDsu(&dsu_slot) ||
+        dsu_slot.empty()) {
+        // Nothing to do if no DSU installation present.
+        return false;
+    }
+
+    auto images = IImageManager::Open("dsu/" + dsu_slot, 10s);
+    if (!images || !images->BackingImageExists(android::gsi::kDsuScratch)) {
+        // Nothing to do if DSU scratch device doesn't exist.
+        return false;
+    }
+
+    images->UnmapImageDevice(android::gsi::kDsuScratch);
+    if (!images->MapImageDevice(android::gsi::kDsuScratch, 10s, device)) {
+        return false;
+    }
+    return true;
 }
 
 // Returns false if teardown not permitted, errno set to last error.
@@ -1366,21 +1457,27 @@
     // If scratch exists, but is not mounted, lets gain access to clean
     // specific override entries.
     auto mount_scratch = false;
-    bool unmap = false;
     if ((mount_point != nullptr) && !fs_mgr_overlayfs_already_mounted(kScratchMountPoint, false)) {
-        std::string scratch_device;
-        if (EnsureScratchMapped(&scratch_device, &unmap)) {
+        std::string scratch_device = GetBootScratchDevice();
+        if (!scratch_device.empty()) {
             mount_scratch = fs_mgr_overlayfs_mount_scratch(scratch_device,
                                                            fs_mgr_overlayfs_scratch_mount_type());
         }
     }
+    bool should_destroy_scratch = false;
     for (const auto& overlay_mount_point : kOverlayMountPoints) {
         ret &= fs_mgr_overlayfs_teardown_one(
-                overlay_mount_point, mount_point ? fs_mgr_mount_point(mount_point) : "", change);
+                overlay_mount_point, mount_point ? fs_mgr_mount_point(mount_point) : "", change,
+                overlay_mount_point == kScratchMountPoint ? &should_destroy_scratch : nullptr);
+    }
+    // Do not attempt to destroy DSU scratch if within a DSU system,
+    // because DSU scratch partition is managed by gsid.
+    if (should_destroy_scratch && !fs_mgr_is_dsu_running()) {
+        ret &= fs_mgr_overlayfs_teardown_scratch(kScratchMountPoint, change);
     }
     if (fs_mgr_overlayfs_valid() == OverlayfsValidResult::kNotSupported) {
         // After obligatory teardown to make sure everything is clean, but if
-        // we didn't want overlayfs in the the first place, we do not want to
+        // we didn't want overlayfs in the first place, we do not want to
         // waste time on a reboot (or reboot request message).
         if (change) *change = false;
     }
@@ -1394,9 +1491,6 @@
     if (mount_scratch) {
         fs_mgr_overlayfs_umount_scratch();
     }
-    if (unmap) {
-        UnmapScratchDevice();
-    }
     return ret;
 }
 
@@ -1464,6 +1558,54 @@
     }
 }
 
+void TeardownAllOverlayForMountPoint(const std::string& mount_point) {
+    if (!fs_mgr_in_recovery()) {
+        LERROR << __FUNCTION__ << "(): must be called within recovery.";
+        return;
+    }
+
+    // Empty string means teardown everything.
+    const std::string teardown_dir = mount_point.empty() ? "" : fs_mgr_mount_point(mount_point);
+    constexpr bool* ignore_change = nullptr;
+
+    // Teardown legacy overlay mount points that's not backed by a scratch device.
+    for (const auto& overlay_mount_point : kOverlayMountPoints) {
+        if (overlay_mount_point == kScratchMountPoint) {
+            continue;
+        }
+        fs_mgr_overlayfs_teardown_one(overlay_mount_point, teardown_dir, ignore_change);
+    }
+
+    // Map scratch device, mount kScratchMountPoint and teardown kScratchMountPoint.
+    bool mapped = false;
+    std::string scratch_device;
+    if (EnsureScratchMapped(&scratch_device, &mapped)) {
+        fs_mgr_overlayfs_umount_scratch();
+        if (fs_mgr_overlayfs_mount_scratch(scratch_device, fs_mgr_overlayfs_scratch_mount_type())) {
+            bool should_destroy_scratch = false;
+            fs_mgr_overlayfs_teardown_one(kScratchMountPoint, teardown_dir, ignore_change,
+                                          &should_destroy_scratch);
+            if (should_destroy_scratch) {
+                fs_mgr_overlayfs_teardown_scratch(kScratchMountPoint, nullptr);
+            }
+            fs_mgr_overlayfs_umount_scratch();
+        }
+        if (mapped) {
+            DestroyLogicalPartition(android::base::Basename(kScratchMountPoint));
+        }
+    }
+
+    // Teardown DSU overlay if present.
+    if (MapDsuScratchDevice(&scratch_device)) {
+        fs_mgr_overlayfs_umount_scratch();
+        if (fs_mgr_overlayfs_mount_scratch(scratch_device, fs_mgr_overlayfs_scratch_mount_type())) {
+            fs_mgr_overlayfs_teardown_one(kScratchMountPoint, teardown_dir, ignore_change);
+            fs_mgr_overlayfs_umount_scratch();
+        }
+        DestroyLogicalPartition(android::gsi::kDsuScratch);
+    }
+}
+
 }  // namespace fs_mgr
 }  // namespace android
 
diff --git a/fs_mgr/fs_mgr_remount.cpp b/fs_mgr/fs_mgr_remount.cpp
index def1c21..745dab2 100644
--- a/fs_mgr/fs_mgr_remount.cpp
+++ b/fs_mgr/fs_mgr_remount.cpp
@@ -16,7 +16,6 @@
 
 #include <errno.h>
 #include <getopt.h>
-#include <libavb_user/libavb_user.h>
 #include <stdio.h>
 #include <sys/mount.h>
 #include <sys/types.h>
@@ -40,6 +39,8 @@
 #include <fs_mgr_overlayfs.h>
 #include <fs_mgr_priv.h>
 #include <fstab/fstab.h>
+#include <libavb_user/libavb_user.h>
+#include <libgsi/libgsid.h>
 
 namespace {
 
@@ -52,7 +53,9 @@
                  "\tpartition\tspecific partition(s) (empty does all)\n"
                  "\n"
                  "Remount specified partition(s) read-write, by name or mount point.\n"
-                 "-R notwithstanding, verity must be disabled on partition(s).";
+                 "-R notwithstanding, verity must be disabled on partition(s).\n"
+                 "-R within a DSU guest system reboots into the DSU instead of the host system,\n"
+                 "this command would enable DSU (one-shot) if not already enabled.";
 
     ::exit(exit_status);
 }
@@ -123,23 +126,26 @@
 
 using namespace std::chrono_literals;
 
+enum RemountStatus {
+    REMOUNT_SUCCESS = 0,
+    NOT_USERDEBUG,
+    BADARG,
+    NOT_ROOT,
+    NO_FSTAB,
+    UNKNOWN_PARTITION,
+    INVALID_PARTITION,
+    VERITY_PARTITION,
+    BAD_OVERLAY,
+    NO_MOUNTS,
+    REMOUNT_FAILED,
+    MUST_REBOOT,
+    BINDER_ERROR,
+    CHECKPOINTING,
+    GSID_ERROR,
+};
+
 static int do_remount(int argc, char* argv[]) {
-    enum {
-        SUCCESS = 0,
-        NOT_USERDEBUG,
-        BADARG,
-        NOT_ROOT,
-        NO_FSTAB,
-        UNKNOWN_PARTITION,
-        INVALID_PARTITION,
-        VERITY_PARTITION,
-        BAD_OVERLAY,
-        NO_MOUNTS,
-        REMOUNT_FAILED,
-        MUST_REBOOT,
-        BINDER_ERROR,
-        CHECKPOINTING
-    } retval = SUCCESS;
+    RemountStatus retval = REMOUNT_SUCCESS;
 
     // If somehow this executable is delivered on a "user" build, it can
     // not function, so providing a clear message to the caller rather than
@@ -338,11 +344,45 @@
         ++it;
     }
 
+    // If (1) remount requires a reboot to take effect, (2) system is currently
+    // running a DSU guest and (3) DSU is disabled, then enable DSU so that the
+    // next reboot would not take us back to the host system but stay within
+    // the guest system.
+    if (reboot_later) {
+        if (auto gsid = android::gsi::GetGsiService()) {
+            auto dsu_running = false;
+            if (auto status = gsid->isGsiRunning(&dsu_running); !status.isOk()) {
+                LOG(ERROR) << "Failed to get DSU running state: " << status;
+                return BINDER_ERROR;
+            }
+            auto dsu_enabled = false;
+            if (auto status = gsid->isGsiEnabled(&dsu_enabled); !status.isOk()) {
+                LOG(ERROR) << "Failed to get DSU enabled state: " << status;
+                return BINDER_ERROR;
+            }
+            if (dsu_running && !dsu_enabled) {
+                std::string dsu_slot;
+                if (auto status = gsid->getActiveDsuSlot(&dsu_slot); !status.isOk()) {
+                    LOG(ERROR) << "Failed to get active DSU slot: " << status;
+                    return BINDER_ERROR;
+                }
+                LOG(INFO) << "DSU is running but disabled, enable DSU so that we stay within the "
+                             "DSU guest system after reboot";
+                int error = 0;
+                if (auto status = gsid->enableGsi(/* oneShot = */ true, dsu_slot, &error);
+                    !status.isOk() || error != android::gsi::IGsiService::INSTALL_OK) {
+                    LOG(ERROR) << "Failed to enable DSU: " << status << ", error code: " << error;
+                    return !status.isOk() ? BINDER_ERROR : GSID_ERROR;
+                }
+                LOG(INFO) << "Successfully enabled DSU (one-shot mode)";
+            }
+        }
+    }
+
     if (partitions.empty() || just_disabled_verity) {
         if (reboot_later) reboot(setup_overlayfs);
         if (user_please_reboot_later) {
-            LOG(INFO) << "Now reboot your device for settings to take effect";
-            return 0;
+            return MUST_REBOOT;
         }
         LOG(WARNING) << "No partitions to remount";
         return retval;
@@ -431,6 +471,12 @@
 int main(int argc, char* argv[]) {
     android::base::InitLogging(argv, MyLogger);
     int result = do_remount(argc, argv);
-    printf("remount %s\n", result ? "failed" : "succeeded");
+    if (result == MUST_REBOOT) {
+        LOG(INFO) << "Now reboot your device for settings to take effect";
+    } else if (result == REMOUNT_SUCCESS) {
+        printf("remount succeeded\n");
+    } else {
+        printf("remount failed\n");
+    }
     return result;
 }
diff --git a/fs_mgr/fs_mgr_roots.cpp b/fs_mgr/fs_mgr_roots.cpp
index 1e65587..fdaffbe 100644
--- a/fs_mgr/fs_mgr_roots.cpp
+++ b/fs_mgr/fs_mgr_roots.cpp
@@ -111,7 +111,8 @@
         return true;
     }
 
-    static const std::vector<std::string> supported_fs{"ext4", "squashfs", "vfat", "f2fs", "none"};
+    static const std::vector<std::string> supported_fs{"ext4", "squashfs", "vfat", "f2fs", "erofs",
+                                                       "none"};
     if (std::find(supported_fs.begin(), supported_fs.end(), rec->fs_type) == supported_fs.end()) {
         LERROR << "unknown fs_type \"" << rec->fs_type << "\" for " << mount_point;
         return false;
diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h
index 2a67b8c..22c02cc 100644
--- a/fs_mgr/include/fs_mgr.h
+++ b/fs_mgr/include/fs_mgr.h
@@ -60,8 +60,20 @@
 #define FS_MGR_MNTALL_DEV_NOT_ENCRYPTED 1
 #define FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE 0
 #define FS_MGR_MNTALL_FAIL (-1)
+
+struct MountAllResult {
+    // One of the FS_MGR_MNTALL_* returned code defined above.
+    int code;
+    // Whether userdata was mounted as a result of |fs_mgr_mount_all| call.
+    bool userdata_mounted;
+};
+
 // fs_mgr_mount_all() updates fstab entries that reference device-mapper.
-int fs_mgr_mount_all(android::fs_mgr::Fstab* fstab, int mount_mode);
+// Returns a |MountAllResult|. The first element is one of the FS_MNG_MNTALL_* return codes
+// defined above, and the second element tells whether this call to fs_mgr_mount_all was responsible
+// for mounting userdata. Later is required for init to correctly enqueue fs-related events as part
+// of userdata remount during userspace reboot.
+MountAllResult fs_mgr_mount_all(android::fs_mgr::Fstab* fstab, int mount_mode);
 
 #define FS_MGR_DOMNT_FAILED (-1)
 #define FS_MGR_DOMNT_BUSY (-2)
@@ -76,6 +88,10 @@
 bool fs_mgr_load_verity_state(int* mode);
 // Returns true if verity is enabled on this particular FstabEntry.
 bool fs_mgr_is_verity_enabled(const android::fs_mgr::FstabEntry& entry);
+// Returns the hash algorithm used to build the hashtree of this particular FstabEntry. Returns an
+// empty string if the input isn't a dm-verity entry, or if there is an error.
+std::string fs_mgr_get_hashtree_algorithm(const android::fs_mgr::FstabEntry& entry);
+
 bool fs_mgr_swapon_all(const android::fs_mgr::Fstab& fstab);
 bool fs_mgr_update_logical_partition(android::fs_mgr::FstabEntry* entry);
 
diff --git a/fs_mgr/include/fs_mgr_overlayfs.h b/fs_mgr/include/fs_mgr_overlayfs.h
index 34aded9..d45e2de 100644
--- a/fs_mgr/include/fs_mgr_overlayfs.h
+++ b/fs_mgr/include/fs_mgr_overlayfs.h
@@ -49,5 +49,12 @@
                                  const std::function<bool(const std::set<std::string>&)>& init);
 void CleanupOldScratchFiles();
 
+// Teardown overlays of all sources (cache dir, scratch device, DSU) for |mount_point|.
+// Teardown all overlays if |mount_point| is empty.
+//
+// Note: This should be called if and only if in recovery or fastbootd to teardown
+// overlays if any partition is flashed or updated.
+void TeardownAllOverlayForMountPoint(const std::string& mount_point = {});
+
 }  // namespace fs_mgr
 }  // namespace android
diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h
index 7cf4f89..2d4de09 100644
--- a/fs_mgr/include_fstab/fstab/fstab.h
+++ b/fs_mgr/include_fstab/fstab/fstab.h
@@ -83,6 +83,7 @@
         bool slot_select_other : 1;
         bool fs_verity : 1;
         bool ext_meta_csum : 1;
+        bool fs_compress : 1;
     } fs_mgr_flags = {};
 
     bool is_encryptable() const {
@@ -112,7 +113,8 @@
 //     dsu_partitions[0] = "system_gsi"
 //     dsu_partitions[1] = "userdata_gsi"
 //     dsu_partitions[2] = ...
-void TransformFstabForDsu(Fstab* fstab, const std::vector<std::string>& dsu_partitions);
+void TransformFstabForDsu(Fstab* fstab, const std::string& dsu_slot,
+                          const std::vector<std::string>& dsu_partitions);
 
 std::set<std::string> GetBootDevices();
 
diff --git a/fs_mgr/libdm/Android.bp b/fs_mgr/libdm/Android.bp
index 58241b3..0efe384 100644
--- a/fs_mgr/libdm/Android.bp
+++ b/fs_mgr/libdm/Android.bp
@@ -42,6 +42,8 @@
             enabled: false,
         },
     },
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
 }
 
 filegroup {
@@ -98,7 +100,3 @@
         "liblog",
     ],
 }
-
-vts_config {
-    name: "VtsKernelLibdmTest",
-}
diff --git a/fs_mgr/libdm/AndroidTest.xml b/fs_mgr/libdm/AndroidTest.xml
deleted file mode 100644
index b4e0c23..0000000
--- a/fs_mgr/libdm/AndroidTest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<configuration description="Config for VTS VtsKernelLibdmTest">
-    <option name="config-descriptor:metadata" key="plan" value="vts-kernel" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
-        <option name="abort-on-push-failure" value="false"/>
-        <option name="push-group" value="HostDrivenTest.push"/>
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
-      <option name="test-module-name" value="VtsKernelLibdmTest"/>
-        <option name="binary-test-source" value="_32bit::DATA/nativetest/libdm_test/libdm_test" />
-        <option name="binary-test-source" value="_64bit::DATA/nativetest64/libdm_test/libdm_test" />
-        <option name="binary-test-type" value="gtest"/>
-        <option name="test-timeout" value="1m"/>
-        <option name="precondition-first-api-level" value="29" />
-    </test>
-</configuration>
-
diff --git a/fs_mgr/libdm/dm.cpp b/fs_mgr/libdm/dm.cpp
index 7912688..d5b8a61 100644
--- a/fs_mgr/libdm/dm.cpp
+++ b/fs_mgr/libdm/dm.cpp
@@ -111,8 +111,10 @@
 
     // Check to make sure appropriate uevent is generated so ueventd will
     // do the right thing and remove the corresponding device node and symlinks.
-    CHECK(io.flags & DM_UEVENT_GENERATED_FLAG)
-            << "Didn't generate uevent for [" << name << "] removal";
+    if ((io.flags & DM_UEVENT_GENERATED_FLAG) == 0) {
+        LOG(ERROR) << "Didn't generate uevent for [" << name << "] removal";
+        return false;
+    }
 
     if (timeout_ms <= std::chrono::milliseconds::zero()) {
         return true;
@@ -427,6 +429,20 @@
     return true;
 }
 
+// Accepts a device mapper device name (like system_a, vendor_b etc) and
+// returns its UUID.
+bool DeviceMapper::GetDmDeviceUuidByName(const std::string& name, std::string* uuid) {
+    struct dm_ioctl io;
+    InitIo(&io, name);
+    if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) {
+        PLOG(WARNING) << "DM_DEV_STATUS failed for " << name;
+        return false;
+    }
+
+    *uuid = std::string(io.uuid);
+    return true;
+}
+
 bool DeviceMapper::GetDeviceNumber(const std::string& name, dev_t* dev) {
     struct dm_ioctl io;
     InitIo(&io, name);
diff --git a/fs_mgr/libdm/dm_target.cpp b/fs_mgr/libdm/dm_target.cpp
index 250cb82..ef46eb9 100644
--- a/fs_mgr/libdm/dm_target.cpp
+++ b/fs_mgr/libdm/dm_target.cpp
@@ -280,5 +280,13 @@
     return android::base::Join(argv, " ");
 }
 
+std::string DmTargetUser::GetParameterString() const {
+    std::vector<std::string> argv;
+    argv.push_back(std::to_string(start()));
+    argv.push_back(std::to_string(size()));
+    argv.push_back(control_device());
+    return android::base::Join(argv, " ");
+}
+
 }  // namespace dm
 }  // namespace android
diff --git a/fs_mgr/libdm/include/libdm/dm.h b/fs_mgr/libdm/include/libdm/dm.h
index abe9c4c..5d6db46 100644
--- a/fs_mgr/libdm/include/libdm/dm.h
+++ b/fs_mgr/libdm/include/libdm/dm.h
@@ -172,6 +172,13 @@
     // could race with ueventd.
     bool GetDmDevicePathByName(const std::string& name, std::string* path);
 
+    // Returns the device mapper UUID for a given name.  If the device does not
+    // exist, false is returned, and the path parameter is not set.
+    //
+    // WaitForFile() should not be used in conjunction with this call, since it
+    // could race with ueventd.
+    bool GetDmDeviceUuidByName(const std::string& name, std::string* path);
+
     // Returns a device's unique path as generated by ueventd. This will return
     // true as long as the device has been created, even if ueventd has not
     // processed it yet.
diff --git a/fs_mgr/libdm/include/libdm/dm_target.h b/fs_mgr/libdm/include/libdm/dm_target.h
index f986cfe..478a3c6 100644
--- a/fs_mgr/libdm/include/libdm/dm_target.h
+++ b/fs_mgr/libdm/include/libdm/dm_target.h
@@ -309,6 +309,19 @@
     bool is_hw_wrapped_ = false;
 };
 
+class DmTargetUser final : public DmTarget {
+  public:
+    DmTargetUser(uint64_t start, uint64_t length, std::string control_device)
+        : DmTarget(start, length), control_device_(control_device) {}
+
+    std::string name() const override { return "user"; }
+    std::string control_device() const { return control_device_; }
+    std::string GetParameterString() const override;
+
+  private:
+    std::string control_device_;
+};
+
 }  // namespace dm
 }  // namespace android
 
diff --git a/fs_mgr/libfiemap/Android.bp b/fs_mgr/libfiemap/Android.bp
index 976cd90..a622110 100644
--- a/fs_mgr/libfiemap/Android.bp
+++ b/fs_mgr/libfiemap/Android.bp
@@ -45,6 +45,7 @@
     whole_static_libs: [
         "gsi_aidl_interface-cpp",
         "libgsi",
+        "libgsid",
     ],
     shared_libs: [
         "libbinder",
@@ -90,6 +91,7 @@
 cc_test {
     name: "fiemap_image_test",
     static_libs: [
+        "libcrypto_utils",
         "libdm",
         "libext4_utils",
         "libfs_mgr",
@@ -98,34 +100,6 @@
     shared_libs: [
         "libbase",
         "libcrypto",
-        "libcrypto_utils",
-        "libcutils",
-        "liblog",
-    ],
-    srcs: [
-        "image_test.cpp",
-    ],
-    test_suites: ["device-tests"],
-    auto_gen_config: true,
-    require_root: true,
-}
-
-/* BUG(148874852) temporary test */
-cc_test {
-    name: "fiemap_image_test_presubmit",
-    cppflags: [
-        "-DSKIP_TEST_IN_PRESUBMIT",
-    ],
-    static_libs: [
-        "libdm",
-        "libext4_utils",
-        "libfs_mgr",
-        "liblp",
-    ],
-    shared_libs: [
-        "libbase",
-        "libcrypto",
-        "libcrypto_utils",
         "libcutils",
         "liblog",
     ],
diff --git a/fs_mgr/libfiemap/binder.cpp b/fs_mgr/libfiemap/binder.cpp
index 5e29d4e..c8516ab 100644
--- a/fs_mgr/libfiemap/binder.cpp
+++ b/fs_mgr/libfiemap/binder.cpp
@@ -19,9 +19,9 @@
 #include <android-base/properties.h>
 #include <android/gsi/BnProgressCallback.h>
 #include <android/gsi/IGsiService.h>
-#include <binder/IServiceManager.h>
 #include <libfiemap/image_manager.h>
 #include <libgsi/libgsi.h>
+#include <libgsi/libgsid.h>
 
 namespace android {
 namespace fiemap {
@@ -224,19 +224,9 @@
     return false;
 }
 
-static sp<IGsiService> GetGsiService() {
-    auto sm = android::defaultServiceManager();
-    auto name = android::String16(kGsiServiceName);
-    android::sp<android::IBinder> res = sm->waitForService(name);
-    if (res) {
-        return android::interface_cast<IGsiService>(res);
-    }
-    return nullptr;
-}
-
 std::unique_ptr<IImageManager> IImageManager::Open(
         const std::string& dir, const std::chrono::milliseconds& /*timeout_ms*/) {
-    android::sp<IGsiService> service = GetGsiService();
+    android::sp<IGsiService> service = android::gsi::GetGsiService();
     android::sp<IImageService> manager;
 
     auto status = service->openImageService(dir, &manager);
diff --git a/fs_mgr/libfiemap/fiemap_writer.cpp b/fs_mgr/libfiemap/fiemap_writer.cpp
index 4dd4bcc..621031a 100644
--- a/fs_mgr/libfiemap/fiemap_writer.cpp
+++ b/fs_mgr/libfiemap/fiemap_writer.cpp
@@ -45,7 +45,7 @@
 
 using namespace android::dm;
 
-// We cap the maximum number of extents as a sanity measure.
+// We cap the maximum number of extents as a robustness measure.
 static constexpr uint32_t kMaxExtents = 50000;
 
 // TODO: Fallback to using fibmap if FIEMAP_EXTENT_MERGED is set.
diff --git a/fs_mgr/libfiemap/image_manager.cpp b/fs_mgr/libfiemap/image_manager.cpp
index 3ee742f..841f215 100644
--- a/fs_mgr/libfiemap/image_manager.cpp
+++ b/fs_mgr/libfiemap/image_manager.cpp
@@ -136,13 +136,13 @@
     return !!FindPartition(*metadata.get(), name);
 }
 
-static bool IsTestDir(const std::string& path) {
-    return android::base::StartsWith(path, kTestImageMetadataDir) ||
-           android::base::StartsWith(path, kOtaTestImageMetadataDir);
+bool ImageManager::MetadataDirIsTest() const {
+    return IsSubdir(metadata_dir_, kTestImageMetadataDir) ||
+           IsSubdir(metadata_dir_, kOtaTestImageMetadataDir);
 }
 
-static bool IsUnreliablePinningAllowed(const std::string& path) {
-    return android::base::StartsWith(path, "/data/gsi/dsu/") || IsTestDir(path);
+bool ImageManager::IsUnreliablePinningAllowed() const {
+    return IsSubdir(data_dir_, "/data/gsi/dsu/") || MetadataDirIsTest();
 }
 
 FiemapStatus ImageManager::CreateBackingImage(
@@ -159,7 +159,7 @@
     if (!FilesystemHasReliablePinning(data_path, &reliable_pinning)) {
         return FiemapStatus::Error();
     }
-    if (!reliable_pinning && !IsUnreliablePinningAllowed(data_path)) {
+    if (!reliable_pinning && !IsUnreliablePinningAllowed()) {
         // For historical reasons, we allow unreliable pinning for certain use
         // cases (DSUs, testing) because the ultimate use case is either
         // developer-oriented or ephemeral (the intent is to boot immediately
@@ -178,7 +178,7 @@
     // if device-mapper is stacked in some complex way not supported by
     // FiemapWriter.
     auto device_path = GetDevicePathForFile(fw.get());
-    if (android::base::StartsWith(device_path, "/dev/block/dm-") && !IsTestDir(metadata_dir_)) {
+    if (android::base::StartsWith(device_path, "/dev/block/dm-") && !MetadataDirIsTest()) {
         LOG(ERROR) << "Cannot persist images against device-mapper device: " << device_path;
 
         fw = {};
@@ -486,15 +486,14 @@
         if (!MapWithLoopDeviceList(loop_devices, name, timeout_ms, path)) {
             return false;
         }
+    } else {
+        auto status_message = "loop:" + loop_devices.back();
+        auto status_file = GetStatusFilePath(name);
+        if (!android::base::WriteStringToFile(status_message, status_file)) {
+            PLOG(ERROR) << "Write failed: " << status_file;
+            return false;
+        }
     }
-
-    auto status_message = "loop:" + loop_devices.back();
-    auto status_file = GetStatusFilePath(name);
-    if (!android::base::WriteStringToFile(status_message, status_file)) {
-        PLOG(ERROR) << "Write failed: " << status_file;
-        return false;
-    }
-
     auto_detach.Commit();
 
     *path = loop_devices.back();
@@ -640,16 +639,22 @@
         return false;
     }
 
+    bool ok = true;
     for (const auto& partition : metadata->partitions) {
         auto name = GetPartitionName(partition);
         auto image_path = GetImageHeaderPath(name);
         auto fiemap = SplitFiemap::Open(image_path);
-        if (!fiemap || !fiemap->HasPinnedExtents()) {
-            LOG(ERROR) << "Image is missing or was moved: " << image_path;
-            return false;
+        if (fiemap == nullptr) {
+            LOG(ERROR) << "SplitFiemap::Open(\"" << image_path << "\") failed";
+            ok = false;
+            continue;
+        }
+        if (!fiemap->HasPinnedExtents()) {
+            LOG(ERROR) << "Image doesn't have pinned extents: " << image_path;
+            ok = false;
         }
     }
-    return true;
+    return ok;
 }
 
 bool ImageManager::DisableImage(const std::string& name) {
diff --git a/fs_mgr/libfiemap/image_test.cpp b/fs_mgr/libfiemap/image_test.cpp
index 6663391..6d09751 100644
--- a/fs_mgr/libfiemap/image_test.cpp
+++ b/fs_mgr/libfiemap/image_test.cpp
@@ -34,10 +34,13 @@
 #include <libdm/dm.h>
 #include <libfiemap/image_manager.h>
 
+#include "utility.h"
+
 using namespace android::dm;
 using namespace std::literals;
 using android::base::unique_fd;
 using android::fiemap::ImageManager;
+using android::fiemap::IsSubdir;
 using android::fs_mgr::BlockDeviceInfo;
 using android::fs_mgr::PartitionOpener;
 using android::fs_mgr::WaitForFile;
@@ -131,6 +134,51 @@
     ASSERT_TRUE(manager_->UnmapImageDevice(base_name_));
 }
 
+namespace {
+
+struct IsSubdirTestParam {
+    std::string child;
+    std::string parent;
+    bool result;
+};
+
+class IsSubdirTest : public ::testing::TestWithParam<IsSubdirTestParam> {};
+
+TEST_P(IsSubdirTest, Test) {
+    const auto& param = GetParam();
+    EXPECT_EQ(param.result, IsSubdir(param.child, param.parent))
+            << "IsSubdir(child=\"" << param.child << "\", parent=\"" << param.parent
+            << "\") != " << (param.result ? "true" : "false");
+}
+
+std::vector<IsSubdirTestParam> IsSubdirTestValues() {
+    // clang-format off
+    std::vector<IsSubdirTestParam> base_cases{
+            {"/foo/bar",     "/foo",     true},
+            {"/foo/bar/baz", "/foo",     true},
+            {"/foo",         "/foo",     true},
+            {"/foo",         "/",        true},
+            {"/",            "/",        true},
+            {"/foo",         "/foo/bar", false},
+            {"/foo",         "/bar",     false},
+            {"/foo-bar",     "/foo",     false},
+            {"/",            "/foo",     false},
+    };
+    // clang-format on
+    std::vector<IsSubdirTestParam> ret;
+    for (const auto& e : base_cases) {
+        ret.push_back(e);
+        ret.push_back({e.child + "/", e.parent, e.result});
+        ret.push_back({e.child, e.parent + "/", e.result});
+        ret.push_back({e.child + "/", e.parent + "/", e.result});
+    }
+    return ret;
+}
+
+INSTANTIATE_TEST_SUITE_P(IsSubdirTest, IsSubdirTest, ::testing::ValuesIn(IsSubdirTestValues()));
+
+}  // namespace
+
 bool Mkdir(const std::string& path) {
     if (mkdir(path.c_str(), 0700) && errno != EEXIST) {
         std::cerr << "Could not mkdir " << path << ": " << strerror(errno) << std::endl;
diff --git a/fs_mgr/libfiemap/include/libfiemap/image_manager.h b/fs_mgr/libfiemap/include/libfiemap/image_manager.h
index 60b98dc..50f4f33 100644
--- a/fs_mgr/libfiemap/include/libfiemap/image_manager.h
+++ b/fs_mgr/libfiemap/include/libfiemap/image_manager.h
@@ -176,6 +176,8 @@
     bool MapWithDmLinear(const IPartitionOpener& opener, const std::string& name,
                          const std::chrono::milliseconds& timeout_ms, std::string* path);
     bool UnmapImageDevice(const std::string& name, bool force);
+    bool IsUnreliablePinningAllowed() const;
+    bool MetadataDirIsTest() const;
 
     ImageManager(const ImageManager&) = delete;
     ImageManager& operator=(const ImageManager&) = delete;
diff --git a/fs_mgr/libfiemap/split_fiemap_writer.cpp b/fs_mgr/libfiemap/split_fiemap_writer.cpp
index 12c7397..36bb3df 100644
--- a/fs_mgr/libfiemap/split_fiemap_writer.cpp
+++ b/fs_mgr/libfiemap/split_fiemap_writer.cpp
@@ -266,7 +266,7 @@
         cursor_file_pos_ += bytes_to_write;
     }
 
-    // If we've reached the end of the current file, close it for sanity.
+    // If we've reached the end of the current file, close it.
     if (cursor_file_pos_ == file->size()) {
         cursor_fd_ = {};
     }
diff --git a/fs_mgr/libfiemap/utility.cpp b/fs_mgr/libfiemap/utility.cpp
index bbb0510..54cf183 100644
--- a/fs_mgr/libfiemap/utility.cpp
+++ b/fs_mgr/libfiemap/utility.cpp
@@ -139,8 +139,7 @@
     }
 
     *bdev_name = ::android::base::Basename(sysfs_bdev);
-    // Paranoid sanity check to make sure we just didn't get the
-    // input in return as-is.
+    // Check that the symlink doesn't point to itself.
     if (sysfs_bdev == *bdev_name) {
         LOG(ERROR) << "Malformed symlink for block device: " << sysfs_bdev;
         return false;
@@ -168,5 +167,30 @@
     return F2fsPinBeforeAllocate(fd, supported);
 }
 
+bool IsSubdir(const std::string& child, const std::string& parent) {
+    // Precondition: both are absolute paths.
+    CHECK(android::base::StartsWith(child, "/")) << "Not an absolute path: " << child;
+    CHECK(android::base::StartsWith(parent, "/")) << "Not an absolute path: " << parent;
+
+    // Remove extraneous "/" at the end.
+    std::string_view child_sv = child;
+    while (child_sv != "/" && android::base::ConsumeSuffix(&child_sv, "/"))
+        ;
+
+    std::string_view parent_sv = parent;
+    while (parent_sv != "/" && android::base::ConsumeSuffix(&parent_sv, "/"))
+        ;
+
+    // IsSubdir(anything, "/") => true
+    if (parent_sv == "/") return true;
+
+    // IsSubdir("/foo", "/foo") => true
+    if (parent_sv == child_sv) return true;
+
+    // IsSubdir("/foo/bar", "/foo") => true
+    // IsSubdir("/foo-bar", "/foo") => false
+    return android::base::StartsWith(child_sv, std::string(parent_sv) + "/");
+}
+
 }  // namespace fiemap
 }  // namespace android
diff --git a/fs_mgr/libfiemap/utility.h b/fs_mgr/libfiemap/utility.h
index 4c0bc2b..aa40f79 100644
--- a/fs_mgr/libfiemap/utility.h
+++ b/fs_mgr/libfiemap/utility.h
@@ -51,5 +51,9 @@
 // cases (such as snapshots or adb remount).
 bool FilesystemHasReliablePinning(const std::string& file, bool* supported);
 
+// Crude implementation to check if |child| is a subdir of |parent|.
+// Assume both are absolute paths.
+bool IsSubdir(const std::string& child, const std::string& parent);
+
 }  // namespace fiemap
 }  // namespace android
diff --git a/fs_mgr/libfs_avb/Android.bp b/fs_mgr/libfs_avb/Android.bp
index 8fb9697..45e7a30 100644
--- a/fs_mgr/libfs_avb/Android.bp
+++ b/fs_mgr/libfs_avb/Android.bp
@@ -91,12 +91,20 @@
     name: "libfs_avb_test",
     defaults: ["libfs_avb_host_test_defaults"],
     test_suites: ["general-tests"],
+    test_options: {
+        unit_test: true,
+    },
     static_libs: [
         "libfs_avb_test_util",
     ],
     shared_libs: [
         "libcrypto",
     ],
+    compile_multilib: "first",
+    data: [
+        ":avbtool",
+        ":fec",
+    ],
     srcs: [
         "tests/basic_test.cpp",
         "tests/fs_avb_test.cpp",
@@ -108,9 +116,17 @@
     name: "libfs_avb_internal_test",
     defaults: ["libfs_avb_host_test_defaults"],
     test_suites: ["general-tests"],
+    test_options: {
+        unit_test: true,
+    },
     static_libs: [
         "libfs_avb_test_util",
     ],
+    compile_multilib: "first",
+    data: [
+        ":avbtool",
+        ":fec",
+    ],
     srcs: [
         "avb_util.cpp",
         "util.cpp",
diff --git a/fs_mgr/libfs_avb/avb_ops.cpp b/fs_mgr/libfs_avb/avb_ops.cpp
index c192bf5..46072bb 100644
--- a/fs_mgr/libfs_avb/avb_ops.cpp
+++ b/fs_mgr/libfs_avb/avb_ops.cpp
@@ -52,16 +52,16 @@
             partition, offset, num_bytes, buffer, out_num_read);
 }
 
-static AvbIOResult dummy_read_rollback_index(AvbOps* ops ATTRIBUTE_UNUSED,
-                                             size_t rollback_index_location ATTRIBUTE_UNUSED,
-                                             uint64_t* out_rollback_index) {
+static AvbIOResult no_op_read_rollback_index(AvbOps* ops ATTRIBUTE_UNUSED,
+                                            size_t rollback_index_location ATTRIBUTE_UNUSED,
+                                            uint64_t* out_rollback_index) {
     // rollback_index has been checked in bootloader phase.
     // In user-space, returns the smallest value 0 to pass the check.
     *out_rollback_index = 0;
     return AVB_IO_RESULT_OK;
 }
 
-static AvbIOResult dummy_validate_vbmeta_public_key(
+static AvbIOResult no_op_validate_vbmeta_public_key(
         AvbOps* ops ATTRIBUTE_UNUSED, const uint8_t* public_key_data ATTRIBUTE_UNUSED,
         size_t public_key_length ATTRIBUTE_UNUSED,
         const uint8_t* public_key_metadata ATTRIBUTE_UNUSED,
@@ -76,8 +76,8 @@
     return AVB_IO_RESULT_OK;
 }
 
-static AvbIOResult dummy_read_is_device_unlocked(AvbOps* ops ATTRIBUTE_UNUSED,
-                                                 bool* out_is_unlocked) {
+static AvbIOResult no_op_read_is_device_unlocked(AvbOps* ops ATTRIBUTE_UNUSED,
+                                                bool* out_is_unlocked) {
     // The function is for bootloader to update the value into
     // androidboot.vbmeta.device_state in kernel cmdline.
     // In user-space, returns true as we don't need to update it anymore.
@@ -85,9 +85,9 @@
     return AVB_IO_RESULT_OK;
 }
 
-static AvbIOResult dummy_get_unique_guid_for_partition(AvbOps* ops ATTRIBUTE_UNUSED,
-                                                       const char* partition ATTRIBUTE_UNUSED,
-                                                       char* guid_buf, size_t guid_buf_size) {
+static AvbIOResult no_op_get_unique_guid_for_partition(AvbOps* ops ATTRIBUTE_UNUSED,
+                                                      const char* partition ATTRIBUTE_UNUSED,
+                                                      char* guid_buf, size_t guid_buf_size) {
     // The function is for bootloader to set the correct UUID
     // for a given partition in kernel cmdline.
     // In user-space, returns a faking one as we don't need to update
@@ -96,9 +96,9 @@
     return AVB_IO_RESULT_OK;
 }
 
-static AvbIOResult dummy_get_size_of_partition(AvbOps* ops ATTRIBUTE_UNUSED,
-                                               const char* partition ATTRIBUTE_UNUSED,
-                                               uint64_t* out_size_num_byte) {
+static AvbIOResult no_op_get_size_of_partition(AvbOps* ops ATTRIBUTE_UNUSED,
+                                              const char* partition ATTRIBUTE_UNUSED,
+                                              uint64_t* out_size_num_byte) {
     // The function is for bootloader to load entire content of AVB HASH partitions.
     // In user-space, returns 0 as we only need to set up AVB HASHTHREE partitions.
     *out_size_num_byte = 0;
@@ -123,15 +123,15 @@
     // We only need to provide the implementation of read_from_partition()
     // operation since that's all what is being used by the avb_slot_verify().
     // Other I/O operations are only required in bootloader but not in
-    // user-space so we set them as dummy operations. Also zero the entire
+    // user-space so we set them as no-op operations. Also zero the entire
     // struct so operations added in the future will be set to NULL.
     memset(&avb_ops_, 0, sizeof(AvbOps));
     avb_ops_.read_from_partition = read_from_partition;
-    avb_ops_.read_rollback_index = dummy_read_rollback_index;
-    avb_ops_.validate_vbmeta_public_key = dummy_validate_vbmeta_public_key;
-    avb_ops_.read_is_device_unlocked = dummy_read_is_device_unlocked;
-    avb_ops_.get_unique_guid_for_partition = dummy_get_unique_guid_for_partition;
-    avb_ops_.get_size_of_partition = dummy_get_size_of_partition;
+    avb_ops_.read_rollback_index = no_op_read_rollback_index;
+    avb_ops_.validate_vbmeta_public_key = no_op_validate_vbmeta_public_key;
+    avb_ops_.read_is_device_unlocked = no_op_read_is_device_unlocked;
+    avb_ops_.get_unique_guid_for_partition = no_op_get_unique_guid_for_partition;
+    avb_ops_.get_size_of_partition = no_op_get_size_of_partition;
 
     // Sets user_data for GetInstanceFromAvbOps() to convert it back to FsManagerAvbOps.
     avb_ops_.user_data = this;
diff --git a/fs_mgr/libfs_avb/fs_avb.cpp b/fs_mgr/libfs_avb/fs_avb.cpp
index 5d504ab..49333a1 100644
--- a/fs_mgr/libfs_avb/fs_avb.cpp
+++ b/fs_mgr/libfs_avb/fs_avb.cpp
@@ -226,7 +226,7 @@
             return nullptr;
     }
 
-    // Sanity check here because we have to use vbmeta_images_[0] below.
+    // Validity check here because we have to use vbmeta_images_[0] below.
     if (avb_handle->vbmeta_images_.size() < 1) {
         LERROR << "LoadAndVerifyVbmetaByPartition failed, no vbmeta loaded";
         return nullptr;
@@ -405,11 +405,11 @@
     //   - AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION (UNLOCKED only).
     //     Might occur in either the top-level vbmeta or a chained vbmeta.
     //   - AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED (UNLOCKED only).
-    //     Could only occur in a chained vbmeta. Because we have *dummy* operations in
+    //     Could only occur in a chained vbmeta. Because we have *no-op* operations in
     //     FsManagerAvbOps such that avb_ops->validate_vbmeta_public_key() used to validate
     //     the public key of the top-level vbmeta always pass in userspace here.
     //
-    // The following verify result won't happen, because the *dummy* operation
+    // The following verify result won't happen, because the *no-op* operation
     // avb_ops->read_rollback_index() always returns the minimum value zero. So rollbacked
     // vbmeta images, which should be caught in the bootloader stage, won't be detected here.
     //   - AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX
diff --git a/fs_mgr/libfs_avb/tests/avb_util_test.cpp b/fs_mgr/libfs_avb/tests/avb_util_test.cpp
index 784eb9c..1827566 100644
--- a/fs_mgr/libfs_avb/tests/avb_util_test.cpp
+++ b/fs_mgr/libfs_avb/tests/avb_util_test.cpp
@@ -216,9 +216,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     1088 bytes\n"
             "Auxiliary Block:          2304 bytes\n"
+            "Public key (sha1):        5227b569de003adc7f8ec3fc03e05dfbd969abad\n"
             "Algorithm:                SHA512_RSA8192\n"
             "Rollback Index:           20\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hashtree descriptor:\n"
@@ -346,9 +348,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     576 bytes\n"
             "Auxiliary Block:          1216 bytes\n"
+            "Public key (sha1):        2597c218aae470a130f61162feaae70afd97f011\n"
             "Algorithm:                SHA256_RSA4096\n"
             "Rollback Index:           10\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hash descriptor:\n"
@@ -639,9 +643,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     1088 bytes\n"
             "Auxiliary Block:          3840 bytes\n"
+            "Public key (sha1):        5227b569de003adc7f8ec3fc03e05dfbd969abad\n"
             "Algorithm:                SHA256_RSA8192\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Chain Partition descriptor:\n"
@@ -854,9 +860,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     1088 bytes\n"
             "Auxiliary Block:          3840 bytes\n"
+            "Public key (sha1):        5227b569de003adc7f8ec3fc03e05dfbd969abad\n"
             "Algorithm:                SHA256_RSA8192\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Chain Partition descriptor:\n"
@@ -886,9 +894,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     576 bytes\n"
             "Auxiliary Block:          2176 bytes\n"
+            "Public key (sha1):        2597c218aae470a130f61162feaae70afd97f011\n"
             "Algorithm:                SHA256_RSA4096\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Chain Partition descriptor:\n"
@@ -936,9 +946,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     320 bytes\n"
             "Auxiliary Block:          960 bytes\n"
+            "Public key (sha1):        cdbb77177f731920bbe0a0f94f84d9038ae0617d\n"
             "Algorithm:                SHA256_RSA2048\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hash descriptor:\n"
diff --git a/fs_mgr/libfs_avb/tests/basic_test.cpp b/fs_mgr/libfs_avb/tests/basic_test.cpp
index 5a1cd0d..1c47c07 100644
--- a/fs_mgr/libfs_avb/tests/basic_test.cpp
+++ b/fs_mgr/libfs_avb/tests/basic_test.cpp
@@ -59,9 +59,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     320 bytes\n"
             "Auxiliary Block:          576 bytes\n"
+            "Public key (sha1):        cdbb77177f731920bbe0a0f94f84d9038ae0617d\n"
             "Algorithm:                SHA256_RSA2048\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    (none)\n",
@@ -89,9 +91,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     576 bytes\n"
             "Auxiliary Block:          1216 bytes\n"
+            "Public key (sha1):        2597c218aae470a130f61162feaae70afd97f011\n"
             "Algorithm:                SHA256_RSA4096\n"
             "Rollback Index:           10\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hash descriptor:\n"
@@ -126,9 +130,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     1088 bytes\n"
             "Auxiliary Block:          2304 bytes\n"
+            "Public key (sha1):        5227b569de003adc7f8ec3fc03e05dfbd969abad\n"
             "Algorithm:                SHA512_RSA8192\n"
             "Rollback Index:           20\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hashtree descriptor:\n"
@@ -180,9 +186,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     320 bytes\n"
             "Auxiliary Block:          960 bytes\n"
+            "Public key (sha1):        cdbb77177f731920bbe0a0f94f84d9038ae0617d\n"
             "Algorithm:                SHA256_RSA2048\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hash descriptor:\n"
@@ -249,9 +257,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     1088 bytes\n"
             "Auxiliary Block:          3840 bytes\n"
+            "Public key (sha1):        5227b569de003adc7f8ec3fc03e05dfbd969abad\n"
             "Algorithm:                SHA256_RSA8192\n"
             "Rollback Index:           0\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Chain Partition descriptor:\n"
diff --git a/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp b/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp
index 7c34009..5ec1e90 100644
--- a/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp
+++ b/fs_mgr/libfs_avb/tests/fs_avb_util_test.cpp
@@ -57,9 +57,11 @@
             "Header Block:             256 bytes\n"
             "Authentication Block:     576 bytes\n"
             "Auxiliary Block:          1280 bytes\n"
+            "Public key (sha1):        2597c218aae470a130f61162feaae70afd97f011\n"
             "Algorithm:                SHA512_RSA4096\n"
             "Rollback Index:           20\n"
             "Flags:                    0\n"
+            "Rollback Index Location:  0\n"
             "Release String:           'unit test'\n"
             "Descriptors:\n"
             "    Hashtree descriptor:\n"
diff --git a/fs_mgr/libfs_avb/tests/util_test.cpp b/fs_mgr/libfs_avb/tests/util_test.cpp
index 5c388aa..a52a00d 100644
--- a/fs_mgr/libfs_avb/tests/util_test.cpp
+++ b/fs_mgr/libfs_avb/tests/util_test.cpp
@@ -222,7 +222,7 @@
     base::FilePath test_dir;
     ASSERT_TRUE(base::CreateTemporaryDirInDir(tmp_dir, "list-file-tests.", &test_dir));
 
-    // Generates dummy files to list.
+    // Generates test files to list.
     base::FilePath file_path_1 = test_dir.Append("1.txt");
     ASSERT_TRUE(base::WriteFile(file_path_1, "1", 1));
     base::FilePath file_path_2 = test_dir.Append("2.txt");
@@ -253,7 +253,7 @@
     base::FilePath test_dir;
     ASSERT_TRUE(base::CreateTemporaryDirInDir(tmp_dir, "list-file-tests.", &test_dir));
 
-    // Generates dummy files to list.
+    // Generates test files to list.
     base::FilePath file_path_1 = test_dir.Append("1.txt");
     ASSERT_TRUE(base::WriteFile(file_path_1, "1", 1));
     base::FilePath file_path_2 = test_dir.Append("2.txt");
@@ -281,7 +281,7 @@
     base::FilePath tmp_dir;
     ASSERT_TRUE(GetTempDir(&tmp_dir));
 
-    // Generates dummy files to list.
+    // Generates test files to list.
     base::FilePath no_such_dir = tmp_dir.Append("not_such_dir");
 
     auto fail = ListFiles(no_such_dir.value());
diff --git a/fs_mgr/liblp/Android.bp b/fs_mgr/liblp/Android.bp
index a779a78..9517bd3 100644
--- a/fs_mgr/liblp/Android.bp
+++ b/fs_mgr/liblp/Android.bp
@@ -107,7 +107,3 @@
     name: "vts_kernel_liblp_test",
     defaults: ["liblp_test_defaults"],
 }
-
-vts_config {
-    name: "VtsKernelLiblpTest",
-}
diff --git a/fs_mgr/liblp/AndroidTest.xml b/fs_mgr/liblp/AndroidTest.xml
deleted file mode 100644
index 2eb0ad1..0000000
--- a/fs_mgr/liblp/AndroidTest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<configuration description="Config for VTS VtsKernelLiblpTest">
-    <option name="config-descriptor:metadata" key="plan" value="vts-kernel" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
-        <option name="abort-on-push-failure" value="false"/>
-        <option name="push-group" value="HostDrivenTest.push"/>
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
-      <option name="test-module-name" value="VtsKernelLiblpTest"/>
-        <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_kernel_liblp_test/vts_kernel_liblp_test" />
-        <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_kernel_liblp_test/vts_kernel_liblp_test" />
-        <option name="binary-test-type" value="gtest"/>
-        <option name="test-timeout" value="1m"/>
-        <option name="precondition-first-api-level" value="29" />
-    </test>
-</configuration>
-
diff --git a/fs_mgr/liblp/builder.cpp b/fs_mgr/liblp/builder.cpp
index 5554f77..623293e 100644
--- a/fs_mgr/liblp/builder.cpp
+++ b/fs_mgr/liblp/builder.cpp
@@ -19,6 +19,7 @@
 #include <string.h>
 
 #include <algorithm>
+#include <limits>
 
 #include <android-base/unique_fd.h>
 
@@ -30,6 +31,22 @@
 namespace android {
 namespace fs_mgr {
 
+std::ostream& operator<<(std::ostream& os, const Extent& extent) {
+    switch (extent.GetExtentType()) {
+        case ExtentType::kZero: {
+            os << "type: Zero";
+            break;
+        }
+        case ExtentType::kLinear: {
+            auto linear_extent = static_cast<const LinearExtent*>(&extent);
+            os << "type: Linear, physical sectors: " << linear_extent->physical_sector()
+               << ", end sectors: " << linear_extent->end_sector();
+            break;
+        }
+    }
+    return os;
+}
+
 bool LinearExtent::AddTo(LpMetadata* out) const {
     if (device_index_ >= out->block_devices.size()) {
         LERROR << "Extent references unknown block device.";
@@ -40,6 +57,17 @@
     return true;
 }
 
+bool LinearExtent::operator==(const android::fs_mgr::Extent& other) const {
+    if (other.GetExtentType() != ExtentType::kLinear) {
+        return false;
+    }
+
+    auto other_ptr = static_cast<const LinearExtent*>(&other);
+    return num_sectors_ == other_ptr->num_sectors_ &&
+           physical_sector_ == other_ptr->physical_sector_ &&
+           device_index_ == other_ptr->device_index_;
+}
+
 bool LinearExtent::OverlapsWith(const LinearExtent& other) const {
     if (device_index_ != other.device_index()) {
         return false;
@@ -63,6 +91,10 @@
     return true;
 }
 
+bool ZeroExtent::operator==(const android::fs_mgr::Extent& other) const {
+    return other.GetExtentType() == ExtentType::kZero && num_sectors_ == other.num_sectors();
+}
+
 Partition::Partition(std::string_view name, std::string_view group_name, uint32_t attributes)
     : name_(name), group_name_(group_name), attributes_(attributes), size_(0) {}
 
@@ -376,7 +408,10 @@
     }
 
     // Align the metadata size up to the nearest sector.
-    metadata_max_size = AlignTo(metadata_max_size, LP_SECTOR_SIZE);
+    if (!AlignTo(metadata_max_size, LP_SECTOR_SIZE, &metadata_max_size)) {
+        LERROR << "Max metadata size " << metadata_max_size << " is too large.";
+        return false;
+    }
 
     // Validate and build the block device list.
     uint32_t logical_block_size = 0;
@@ -408,10 +443,15 @@
         // untouched to be compatible code that looks for an MBR. Thus we
         // start counting free sectors at sector 1, not 0.
         uint64_t free_area_start = LP_SECTOR_SIZE;
-        if (out.alignment || out.alignment_offset) {
-            free_area_start = AlignTo(free_area_start, out.alignment, out.alignment_offset);
+        bool ok;
+        if (out.alignment) {
+            ok = AlignTo(free_area_start, out.alignment, &free_area_start);
         } else {
-            free_area_start = AlignTo(free_area_start, logical_block_size);
+            ok = AlignTo(free_area_start, logical_block_size, &free_area_start);
+        }
+        if (!ok) {
+            LERROR << "Integer overflow computing free area start";
+            return false;
         }
         out.first_logical_sector = free_area_start / LP_SECTOR_SIZE;
 
@@ -448,10 +488,15 @@
 
     // Compute the first free sector, factoring in alignment.
     uint64_t free_area_start = total_reserved;
+    bool ok;
     if (super.alignment || super.alignment_offset) {
-        free_area_start = AlignTo(free_area_start, super.alignment, super.alignment_offset);
+        ok = AlignTo(free_area_start, super.alignment, &free_area_start);
     } else {
-        free_area_start = AlignTo(free_area_start, logical_block_size);
+        ok = AlignTo(free_area_start, logical_block_size, &free_area_start);
+    }
+    if (!ok) {
+        LERROR << "Integer overflow computing free area start";
+        return false;
     }
     super.first_logical_sector = free_area_start / LP_SECTOR_SIZE;
 
@@ -504,7 +549,7 @@
     return partitions_.back().get();
 }
 
-Partition* MetadataBuilder::FindPartition(std::string_view name) {
+Partition* MetadataBuilder::FindPartition(std::string_view name) const {
     for (const auto& partition : partitions_) {
         if (partition->name() == name) {
             return partition.get();
@@ -513,7 +558,7 @@
     return nullptr;
 }
 
-PartitionGroup* MetadataBuilder::FindGroup(std::string_view group_name) {
+PartitionGroup* MetadataBuilder::FindGroup(std::string_view group_name) const {
     for (const auto& group : groups_) {
         if (group->name() == group_name) {
             return group.get();
@@ -551,7 +596,11 @@
         const Interval& current = extents[i];
         DCHECK(previous.device_index == current.device_index);
 
-        uint64_t aligned = AlignSector(block_devices_[current.device_index], previous.end);
+        uint64_t aligned;
+        if (!AlignSector(block_devices_[current.device_index], previous.end, &aligned)) {
+            LERROR << "Sector " << previous.end << " caused integer overflow.";
+            continue;
+        }
         if (aligned >= current.start) {
             // There is no gap between these two extents, try the next one.
             // Note that we check with >= instead of >, since alignment may
@@ -737,7 +786,10 @@
     // Choose an aligned sector for the midpoint. This could lead to one half
     // being slightly larger than the other, but this will not restrict the
     // size of partitions (it might lead to one extra extent if "B" overflows).
-    midpoint = AlignSector(super, midpoint);
+    if (!AlignSector(super, midpoint, &midpoint)) {
+        LERROR << "Unexpected integer overflow aligning midpoint " << midpoint;
+        return free_list;
+    }
 
     std::vector<Interval> first_half;
     std::vector<Interval> second_half;
@@ -775,7 +827,11 @@
     // If the sector ends where the next aligned chunk begins, then there's
     // no missing gap to try and allocate.
     const auto& block_device = block_devices_[extent->device_index()];
-    uint64_t next_aligned_sector = AlignSector(block_device, extent->end_sector());
+    uint64_t next_aligned_sector;
+    if (!AlignSector(block_device, extent->end_sector(), &next_aligned_sector)) {
+        LERROR << "Integer overflow aligning sector " << extent->end_sector();
+        return nullptr;
+    }
     if (extent->end_sector() == next_aligned_sector) {
         return nullptr;
     }
@@ -932,13 +988,19 @@
     return size;
 }
 
-uint64_t MetadataBuilder::AlignSector(const LpMetadataBlockDevice& block_device,
-                                      uint64_t sector) const {
+bool MetadataBuilder::AlignSector(const LpMetadataBlockDevice& block_device, uint64_t sector,
+                                  uint64_t* out) const {
     // Note: when reading alignment info from the Kernel, we don't assume it
     // is aligned to the sector size, so we round up to the nearest sector.
     uint64_t lba = sector * LP_SECTOR_SIZE;
-    uint64_t aligned = AlignTo(lba, block_device.alignment, block_device.alignment_offset);
-    return AlignTo(aligned, LP_SECTOR_SIZE) / LP_SECTOR_SIZE;
+    if (!AlignTo(lba, block_device.alignment, out)) {
+        return false;
+    }
+    if (!AlignTo(*out, LP_SECTOR_SIZE, out)) {
+        return false;
+    }
+    *out /= LP_SECTOR_SIZE;
+    return true;
 }
 
 bool MetadataBuilder::FindBlockDeviceByName(const std::string& partition_name,
@@ -1012,7 +1074,12 @@
 bool MetadataBuilder::ResizePartition(Partition* partition, uint64_t requested_size,
                                       const std::vector<Interval>& free_region_hint) {
     // Align the space needed up to the nearest sector.
-    uint64_t aligned_size = AlignTo(requested_size, geometry_.logical_block_size);
+    uint64_t aligned_size;
+    if (!AlignTo(requested_size, geometry_.logical_block_size, &aligned_size)) {
+        LERROR << "Cannot resize partition " << partition->name() << " to " << requested_size
+               << " bytes; integer overflow.";
+        return false;
+    }
     uint64_t old_size = partition->size();
 
     if (!ValidatePartitionSizeChange(partition, old_size, aligned_size, false)) {
@@ -1234,5 +1301,50 @@
     return geometry_.logical_block_size;
 }
 
+bool MetadataBuilder::VerifyExtentsAgainstSourceMetadata(
+        const MetadataBuilder& source_metadata, uint32_t source_slot_number,
+        const MetadataBuilder& target_metadata, uint32_t target_slot_number,
+        const std::vector<std::string>& partitions) {
+    for (const auto& base_name : partitions) {
+        // Find the partition in metadata with the slot suffix.
+        auto target_partition_name = base_name + SlotSuffixForSlotNumber(target_slot_number);
+        const auto target_partition = target_metadata.FindPartition(target_partition_name);
+        if (!target_partition) {
+            LERROR << "Failed to find partition " << target_partition_name << " in metadata slot "
+                   << target_slot_number;
+            return false;
+        }
+
+        auto source_partition_name = base_name + SlotSuffixForSlotNumber(source_slot_number);
+        const auto source_partition = source_metadata.FindPartition(source_partition_name);
+        if (!source_partition) {
+            LERROR << "Failed to find partition " << source_partition << " in metadata slot "
+                   << source_slot_number;
+            return false;
+        }
+
+        // We expect the partitions in the target metadata to have the identical extents as the
+        // one in the source metadata. Because they are copied in NewForUpdate.
+        if (target_partition->extents().size() != source_partition->extents().size()) {
+            LERROR << "Extents count mismatch for partition " << base_name << " target slot has "
+                   << target_partition->extents().size() << ", source slot has "
+                   << source_partition->extents().size();
+            return false;
+        }
+
+        for (size_t i = 0; i < target_partition->extents().size(); i++) {
+            const auto& src_extent = *source_partition->extents()[i];
+            const auto& tgt_extent = *target_partition->extents()[i];
+            if (tgt_extent != src_extent) {
+                LERROR << "Extents " << i << " is different for partition " << base_name;
+                LERROR << "tgt extent " << tgt_extent << "; src extent " << src_extent;
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
 }  // namespace fs_mgr
 }  // namespace android
diff --git a/fs_mgr/liblp/builder_test.cpp b/fs_mgr/liblp/builder_test.cpp
index 977ebe3..e4b617a 100644
--- a/fs_mgr/liblp/builder_test.cpp
+++ b/fs_mgr/liblp/builder_test.cpp
@@ -174,7 +174,7 @@
     ASSERT_NE(exported, nullptr);
     super_device = GetMetadataSuperBlockDevice(*exported.get());
     ASSERT_NE(super_device, nullptr);
-    EXPECT_EQ(super_device->first_logical_sector, 1472);
+    EXPECT_EQ(super_device->first_logical_sector, 1536);
 
     // Alignment offset without alignment doesn't mean anything.
     device_info.alignment = 0;
@@ -190,7 +190,7 @@
     ASSERT_NE(exported, nullptr);
     super_device = GetMetadataSuperBlockDevice(*exported.get());
     ASSERT_NE(super_device, nullptr);
-    EXPECT_EQ(super_device->first_logical_sector, 174);
+    EXPECT_EQ(super_device->first_logical_sector, 168);
 
     // Test a small alignment with no alignment offset.
     device_info.alignment = 11 * 1024;
@@ -200,7 +200,7 @@
     ASSERT_NE(exported, nullptr);
     super_device = GetMetadataSuperBlockDevice(*exported.get());
     ASSERT_NE(super_device, nullptr);
-    EXPECT_EQ(super_device->first_logical_sector, 160);
+    EXPECT_EQ(super_device->first_logical_sector, 154);
 }
 
 TEST_F(BuilderTest, InternalPartitionAlignment) {
@@ -228,13 +228,14 @@
         ASSERT_EQ(extent.target_type, LP_TARGET_TYPE_LINEAR);
         EXPECT_EQ(extent.num_sectors, 80);
 
+        uint64_t aligned_lba;
         uint64_t lba = extent.target_data * LP_SECTOR_SIZE;
-        uint64_t aligned_lba = AlignTo(lba, device_info.alignment, device_info.alignment_offset);
+        ASSERT_TRUE(AlignTo(lba, device_info.alignment, &aligned_lba));
         EXPECT_EQ(lba, aligned_lba);
     }
 
-    // Sanity check one extent.
-    EXPECT_EQ(exported->extents.back().target_data, 3008);
+    // Check one extent.
+    EXPECT_EQ(exported->extents.back().target_data, 3072);
 }
 
 TEST_F(BuilderTest, UseAllDiskSpace) {
@@ -652,7 +653,7 @@
     };
     unique_ptr<MetadataBuilder> builder = MetadataBuilder::New(partitions, "system_a", 65536, 2);
     ASSERT_NE(builder, nullptr);
-    EXPECT_EQ(builder->AllocatableSpace(), 467238912);
+    EXPECT_EQ(builder->AllocatableSpace(), 467402752);
 
     // Create a partition that spans 3 devices.
     Partition* p = builder->AddPartition("system_a", 0);
@@ -675,17 +676,17 @@
     EXPECT_EQ(metadata->block_devices[2].alignment, 786432);
     EXPECT_EQ(metadata->block_devices[2].alignment_offset, 753664);
     ASSERT_EQ(metadata->extents.size(), 3);
-    EXPECT_EQ(metadata->extents[0].num_sectors, 522304);
+    EXPECT_EQ(metadata->extents[0].num_sectors, 522752);
     EXPECT_EQ(metadata->extents[0].target_type, LP_TARGET_TYPE_LINEAR);
-    EXPECT_EQ(metadata->extents[0].target_data, 1984);
+    EXPECT_EQ(metadata->extents[0].target_data, 1536);
     EXPECT_EQ(metadata->extents[0].target_source, 0);
-    EXPECT_EQ(metadata->extents[1].num_sectors, 260672);
+    EXPECT_EQ(metadata->extents[1].num_sectors, 260608);
     EXPECT_EQ(metadata->extents[1].target_type, LP_TARGET_TYPE_LINEAR);
-    EXPECT_EQ(metadata->extents[1].target_data, 1472);
+    EXPECT_EQ(metadata->extents[1].target_data, 1536);
     EXPECT_EQ(metadata->extents[1].target_source, 1);
-    EXPECT_EQ(metadata->extents[2].num_sectors, 129088);
+    EXPECT_EQ(metadata->extents[2].num_sectors, 128704);
     EXPECT_EQ(metadata->extents[2].target_type, LP_TARGET_TYPE_LINEAR);
-    EXPECT_EQ(metadata->extents[2].target_data, 1472);
+    EXPECT_EQ(metadata->extents[2].target_data, 1536);
     EXPECT_EQ(metadata->extents[2].target_source, 2);
 }
 
@@ -946,9 +947,10 @@
 }
 
 static void AddPartition(const std::unique_ptr<MetadataBuilder>& builder,
-                         const std::string& partition_name, uint64_t num_sectors,
-                         uint64_t start_sector, std::vector<Interval>* intervals) {
-    Partition* p = builder->AddPartition(partition_name, "group", 0);
+                         const std::string& partition_name, const std::string& group_name,
+                         uint64_t num_sectors, uint64_t start_sector,
+                         std::vector<Interval>* intervals = nullptr) {
+    Partition* p = builder->AddPartition(partition_name, group_name, 0);
     ASSERT_NE(p, nullptr);
     ASSERT_TRUE(builder->AddLinearExtent(p, "super", num_sectors, start_sector));
     ASSERT_EQ(p->extents().size(), 1);
@@ -976,17 +978,17 @@
     ASSERT_TRUE(builder->AddGroup("group", 0));
 
     std::vector<Interval> old_intervals;
-    AddPartition(builder, "system", 10229008, 2048, &old_intervals);
-    AddPartition(builder, "test_a", 648, 12709888, &old_intervals);
-    AddPartition(builder, "test_b", 625184, 12711936, &old_intervals);
-    AddPartition(builder, "test_c", 130912, 13338624, &old_intervals);
-    AddPartition(builder, "test_d", 888, 13469696, &old_intervals);
-    AddPartition(builder, "test_e", 888, 13471744, &old_intervals);
-    AddPartition(builder, "test_f", 888, 13475840, &old_intervals);
-    AddPartition(builder, "test_g", 888, 13477888, &old_intervals);
+    AddPartition(builder, "system", "group", 10229008, 2048, &old_intervals);
+    AddPartition(builder, "test_a", "group", 648, 12709888, &old_intervals);
+    AddPartition(builder, "test_b", "group", 625184, 12711936, &old_intervals);
+    AddPartition(builder, "test_c", "group", 130912, 13338624, &old_intervals);
+    AddPartition(builder, "test_d", "group", 888, 13469696, &old_intervals);
+    AddPartition(builder, "test_e", "group", 888, 13471744, &old_intervals);
+    AddPartition(builder, "test_f", "group", 888, 13475840, &old_intervals);
+    AddPartition(builder, "test_g", "group", 888, 13477888, &old_intervals);
 
     // Don't track the first vendor interval, since it will get extended.
-    AddPartition(builder, "vendor", 2477920, 10231808, nullptr);
+    AddPartition(builder, "vendor", "group", 2477920, 10231808, nullptr);
 
     std::vector<Interval> new_intervals;
 
@@ -1019,3 +1021,76 @@
     EXPECT_FALSE(extent.OverlapsWith(LinearExtent{20, 1, 15}));
     EXPECT_FALSE(extent.OverlapsWith(LinearExtent{20, 1, 10}));
 }
+
+TEST_F(BuilderTest, AlignFreeRegion) {
+    BlockDeviceInfo super("super", 8_GiB, 786432, 0, 4096);
+    std::vector<BlockDeviceInfo> block_devices = {super};
+
+    unique_ptr<MetadataBuilder> builder = MetadataBuilder::New(block_devices, "super", 65536, 2);
+    ASSERT_NE(builder, nullptr);
+
+    Partition* p = builder->AddPartition("system", "default", 0);
+    ASSERT_NE(p, nullptr);
+    ASSERT_TRUE(builder->AddLinearExtent(p, "super", 64, (super.alignment + 4096) / 512));
+
+    p = builder->AddPartition("vendor", "default", 0);
+    ASSERT_NE(p, nullptr);
+    ASSERT_TRUE(builder->ResizePartition(p, 2_GiB));
+
+    const auto& extents = p->extents();
+    ASSERT_EQ(extents.size(), 2);
+
+    LinearExtent* e1 = extents[0]->AsLinearExtent();
+    ASSERT_NE(e1, nullptr);
+    LinearExtent* e2 = extents[1]->AsLinearExtent();
+    ASSERT_NE(e2, nullptr);
+
+    // The misaligned partition starting at sector 1544 should not cause any
+    // overlap with previous extents. We should see vendor punch a hole where
+    // "system" is, extending the hole up to the next aligned block.
+    EXPECT_EQ(e1->physical_sector(), 1536);
+    EXPECT_EQ(e1->end_sector(), 1544);
+    EXPECT_EQ(e2->physical_sector(), 3072);
+    EXPECT_EQ(e2->end_sector(), 4197368);
+}
+
+TEST_F(BuilderTest, ResizeOverflow) {
+    BlockDeviceInfo super("super", 8_GiB, 786432, 229376, 4096);
+    std::vector<BlockDeviceInfo> block_devices = {super};
+
+    unique_ptr<MetadataBuilder> builder = MetadataBuilder::New(block_devices, "super", 65536, 2);
+    ASSERT_NE(builder, nullptr);
+
+    ASSERT_TRUE(builder->AddGroup("group", 0));
+
+    Partition* p = builder->AddPartition("system", "default", 0);
+    ASSERT_NE(p, nullptr);
+    ASSERT_FALSE(builder->ResizePartition(p, 18446744073709551615ULL));
+}
+
+TEST_F(BuilderTest, VerifyExtent) {
+    auto source_builder = MetadataBuilder::New(4096 * 50, 40960, 2);
+    ASSERT_NE(source_builder, nullptr);
+    ASSERT_TRUE(source_builder->AddGroup("test_group_a", 40960));
+    ASSERT_TRUE(source_builder->AddGroup("test_group_b", 40960));
+    AddPartition(source_builder, "system_a", "test_group_a", 8192, 2048);
+    AddPartition(source_builder, "vendor_a", "test_group_a", 10240, 10240);
+    AddPartition(source_builder, "system_b", "test_group_b", 8192, 20480);
+
+    auto target_builder = MetadataBuilder::New(4096 * 50, 40960, 2);
+    ASSERT_NE(target_builder, nullptr);
+    ASSERT_TRUE(target_builder->AddGroup("test_group_b", 40960));
+    AddPartition(target_builder, "system_b", "test_group_b", 8192, 2048);
+    AddPartition(target_builder, "vendor_b", "test_group_b", 10240, 10240);
+
+    ASSERT_TRUE(MetadataBuilder::VerifyExtentsAgainstSourceMetadata(
+            *source_builder, 0, *target_builder, 1, std::vector<std::string>{"system", "vendor"}));
+
+    target_builder->RemovePartition("vendor_b");
+    ASSERT_FALSE(target_builder->VerifyExtentsAgainstSourceMetadata(
+            *source_builder, 0, *target_builder, 1, std::vector<std::string>{"vendor"}));
+
+    AddPartition(target_builder, "vendor_b", "test_group_b", 1000, 10240);
+    ASSERT_FALSE(target_builder->VerifyExtentsAgainstSourceMetadata(
+            *source_builder, 0, *target_builder, 1, std::vector<std::string>{"vendor"}));
+}
diff --git a/fs_mgr/liblp/device_test.cpp b/fs_mgr/liblp/device_test.cpp
index 382d53d..236fd8d 100644
--- a/fs_mgr/liblp/device_test.cpp
+++ b/fs_mgr/liblp/device_test.cpp
@@ -47,15 +47,10 @@
     BlockDeviceInfo device_info;
     ASSERT_TRUE(opener.GetInfo(fs_mgr_get_super_partition_name(), &device_info));
 
-    // Sanity check that the device doesn't give us some weird inefficient
+    // Check that the device doesn't give us some weird inefficient
     // alignment.
     EXPECT_EQ(device_info.alignment % LP_SECTOR_SIZE, 0);
-    EXPECT_EQ(device_info.alignment_offset % LP_SECTOR_SIZE, 0);
-    EXPECT_LE(device_info.alignment_offset, INT_MAX);
     EXPECT_EQ(device_info.logical_block_size % LP_SECTOR_SIZE, 0);
-
-    // Having an alignment offset > alignment doesn't really make sense.
-    EXPECT_LT(device_info.alignment_offset, device_info.alignment);
 }
 
 TEST_F(DeviceTest, ReadSuperPartitionCurrentSlot) {
diff --git a/fs_mgr/liblp/images.cpp b/fs_mgr/liblp/images.cpp
index e4d92ca..0b1e522 100644
--- a/fs_mgr/liblp/images.cpp
+++ b/fs_mgr/liblp/images.cpp
@@ -124,7 +124,7 @@
 }
 
 bool WriteToImageFile(const std::string& file, const LpMetadata& input) {
-    unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC, 0644));
+    unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_BINARY, 0644));
     if (fd < 0) {
         PERROR << __PRETTY_FUNCTION__ << " open failed: " << file;
         return false;
@@ -184,7 +184,7 @@
 }
 
 bool ImageBuilder::Export(const std::string& file) {
-    unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC, 0644));
+    unique_fd fd(open(file.c_str(), O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_BINARY, 0644));
     if (fd < 0) {
         PERROR << "open failed: " << file;
         return false;
@@ -208,7 +208,7 @@
         std::string file_name = "super_" + name + ".img";
         std::string file_path = output_dir + "/" + file_name;
 
-        static const int kOpenFlags = O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_NOFOLLOW;
+        static const int kOpenFlags = O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
         unique_fd fd(open(file_path.c_str(), kOpenFlags, 0644));
         if (fd < 0) {
             PERROR << "open failed: " << file_path;
@@ -443,7 +443,7 @@
 }
 
 int ImageBuilder::OpenImageFile(const std::string& file) {
-    android::base::unique_fd source_fd = GetControlFileOrOpen(file.c_str(), O_RDONLY | O_CLOEXEC);
+    unique_fd source_fd = GetControlFileOrOpen(file.c_str(), O_RDONLY | O_CLOEXEC | O_BINARY);
     if (source_fd < 0) {
         PERROR << "open image file failed: " << file;
         return -1;
diff --git a/fs_mgr/liblp/include/liblp/builder.h b/fs_mgr/liblp/include/liblp/builder.h
index 6c7a707..54f31bc 100644
--- a/fs_mgr/liblp/include/liblp/builder.h
+++ b/fs_mgr/liblp/include/liblp/builder.h
@@ -42,6 +42,11 @@
 // Name of the default group in a metadata.
 static constexpr std::string_view kDefaultGroup = "default";
 
+enum class ExtentType {
+    kZero,
+    kLinear,
+};
+
 // Abstraction around dm-targets that can be encoded into logical partition tables.
 class Extent {
   public:
@@ -50,6 +55,10 @@
 
     virtual bool AddTo(LpMetadata* out) const = 0;
     virtual LinearExtent* AsLinearExtent() { return nullptr; }
+    virtual ExtentType GetExtentType() const = 0;
+
+    virtual bool operator==(const Extent& other) const = 0;
+    virtual bool operator!=(const Extent& other) const { return !(*this == other); }
 
     uint64_t num_sectors() const { return num_sectors_; }
     void set_num_sectors(uint64_t num_sectors) { num_sectors_ = num_sectors; }
@@ -58,6 +67,8 @@
     uint64_t num_sectors_;
 };
 
+std::ostream& operator<<(std::ostream& os, const Extent& extent);
+
 // This corresponds to a dm-linear target.
 class LinearExtent final : public Extent {
   public:
@@ -66,6 +77,9 @@
 
     bool AddTo(LpMetadata* metadata) const override;
     LinearExtent* AsLinearExtent() override { return this; }
+    ExtentType GetExtentType() const override { return ExtentType::kLinear; }
+
+    bool operator==(const Extent& other) const override;
 
     uint64_t physical_sector() const { return physical_sector_; }
     uint64_t end_sector() const { return physical_sector_ + num_sectors_; }
@@ -87,6 +101,9 @@
     explicit ZeroExtent(uint64_t num_sectors) : Extent(num_sectors) {}
 
     bool AddTo(LpMetadata* out) const override;
+    ExtentType GetExtentType() const override { return ExtentType::kZero; }
+
+    bool operator==(const Extent& other) const override;
 };
 
 class PartitionGroup final {
@@ -144,7 +161,6 @@
     std::vector<std::unique_ptr<Extent>> extents_;
     uint32_t attributes_;
     uint64_t size_;
-    bool disabled_;
 };
 
 // An interval in the metadata. This is similar to a LinearExtent with one difference.
@@ -244,6 +260,14 @@
         return New(device_info, metadata_max_size, metadata_slot_count);
     }
 
+    // Verifies that the given partitions in the metadata have the same extents as the source
+    // metadata.
+    static bool VerifyExtentsAgainstSourceMetadata(const MetadataBuilder& source_metadata,
+                                                   uint32_t source_slot_number,
+                                                   const MetadataBuilder& target_metadata,
+                                                   uint32_t target_slot_number,
+                                                   const std::vector<std::string>& partitions);
+
     // Define a new partition group. By default there is one group called
     // "default", with an unrestricted size. A non-zero size will restrict the
     // total space used by all partitions in the group.
@@ -268,10 +292,10 @@
     void RemovePartition(std::string_view name);
 
     // Find a partition by name. If no partition is found, nullptr is returned.
-    Partition* FindPartition(std::string_view name);
+    Partition* FindPartition(std::string_view name) const;
 
     // Find a group by name. If no group is found, nullptr is returned.
-    PartitionGroup* FindGroup(std::string_view name);
+    PartitionGroup* FindGroup(std::string_view name) const;
 
     // Add a predetermined extent to a partition.
     bool AddLinearExtent(Partition* partition, const std::string& block_device,
@@ -323,9 +347,6 @@
     // Set the LP_HEADER_FLAG_VIRTUAL_AB_DEVICE flag.
     void SetVirtualABDeviceFlag();
 
-    // If set, checks for slot suffixes will be ignored internally.
-    void IgnoreSlotSuffixing();
-
     bool GetBlockDeviceInfo(const std::string& partition_name, BlockDeviceInfo* info) const;
     bool UpdateBlockDeviceInfo(const std::string& partition_name, const BlockDeviceInfo& info);
 
@@ -361,7 +382,7 @@
     bool GrowPartition(Partition* partition, uint64_t aligned_size,
                        const std::vector<Interval>& free_region_hint);
     void ShrinkPartition(Partition* partition, uint64_t aligned_size);
-    uint64_t AlignSector(const LpMetadataBlockDevice& device, uint64_t sector) const;
+    bool AlignSector(const LpMetadataBlockDevice& device, uint64_t sector, uint64_t* out) const;
     uint64_t TotalSizeOfGroup(PartitionGroup* group) const;
     bool UpdateBlockDeviceInfo(size_t index, const BlockDeviceInfo& info);
     bool FindBlockDeviceByName(const std::string& partition_name, uint32_t* index) const;
diff --git a/fs_mgr/liblp/partition_opener.cpp b/fs_mgr/liblp/partition_opener.cpp
index 1d4db85..4696ff1 100644
--- a/fs_mgr/liblp/partition_opener.cpp
+++ b/fs_mgr/liblp/partition_opener.cpp
@@ -38,6 +38,9 @@
 namespace {
 
 std::string GetPartitionAbsolutePath(const std::string& path) {
+#if !defined(__ANDROID__)
+    return path;
+#else
     if (android::base::StartsWith(path, "/")) {
         return path;
     }
@@ -49,13 +52,14 @@
         // Dynamic System Update is installed to an sdcard, which won't be in
         // the boot device list.
         //
-        // We whitelist because most devices in /dev/block are not valid for
+        // mmcblk* is allowed because most devices in /dev/block are not valid for
         // storing fiemaps.
         if (android::base::StartsWith(path, "mmcblk")) {
             return "/dev/block/" + path;
         }
     }
     return by_name;
+#endif
 }
 
 bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device_info) {
diff --git a/fs_mgr/liblp/reader.cpp b/fs_mgr/liblp/reader.cpp
index e6fd9f7..24ccc0f 100644
--- a/fs_mgr/liblp/reader.cpp
+++ b/fs_mgr/liblp/reader.cpp
@@ -174,7 +174,7 @@
         return false;
     }
 
-    // Do basic sanity checks before computing the checksum.
+    // Do basic validity checks before computing the checksum.
     if (header.magic != LP_METADATA_HEADER_MAGIC) {
         LERROR << "Logical partition metadata has invalid magic value.";
         return false;
@@ -255,7 +255,7 @@
 
     LpMetadataHeader& header = metadata->header;
 
-    // Sanity check the table size.
+    // Check the table size.
     if (header.tables_size > geometry.metadata_max_size) {
         LERROR << "Invalid partition metadata header table size.";
         return nullptr;
diff --git a/fs_mgr/liblp/utility.h b/fs_mgr/liblp/utility.h
index 1d86edd..aa3a6a0 100644
--- a/fs_mgr/liblp/utility.h
+++ b/fs_mgr/liblp/utility.h
@@ -21,6 +21,7 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+#include <limits>
 #include <string>
 #include <string_view>
 
@@ -66,27 +67,26 @@
 void SHA256(const void* data, size_t length, uint8_t out[32]);
 
 // Align |base| such that it is evenly divisible by |alignment|, which does not
-// have to be a power of two.
-constexpr uint64_t AlignTo(uint64_t base, uint32_t alignment) {
+// have to be a power of two. Return false on overflow.
+template <typename T>
+bool AlignTo(T base, uint32_t alignment, T* out) {
+    static_assert(std::numeric_limits<T>::is_integer);
+    static_assert(!std::numeric_limits<T>::is_signed);
     if (!alignment) {
-        return base;
+        *out = base;
+        return true;
     }
-    uint64_t remainder = base % alignment;
+    T remainder = base % alignment;
     if (remainder == 0) {
-        return base;
+        *out = base;
+        return true;
     }
-    return base + (alignment - remainder);
-}
-
-// Same as the above |AlignTo|, except that |base| is only aligned when added to
-// |alignment_offset|.
-constexpr uint64_t AlignTo(uint64_t base, uint32_t alignment, uint32_t alignment_offset) {
-    uint64_t aligned = AlignTo(base, alignment) + alignment_offset;
-    if (aligned - alignment >= base) {
-        // We overaligned (base < alignment_offset).
-        return aligned - alignment;
+    T to_add = alignment - remainder;
+    if (to_add > std::numeric_limits<T>::max() - base) {
+        return false;
     }
-    return aligned;
+    *out = base + to_add;
+    return true;
 }
 
 // Update names from C++ strings.
diff --git a/fs_mgr/liblp/utility_test.cpp b/fs_mgr/liblp/utility_test.cpp
index cac3989..fc90872 100644
--- a/fs_mgr/liblp/utility_test.cpp
+++ b/fs_mgr/liblp/utility_test.cpp
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include <optional>
+
 #include <gtest/gtest.h>
 #include <liblp/builder.h>
 #include <liblp/liblp.h>
@@ -58,15 +60,28 @@
     EXPECT_EQ(GetBackupMetadataOffset(geometry, 0), backup_start + 16384 * 0);
 }
 
+std::optional<uint64_t> AlignTo(uint64_t base, uint32_t alignment) {
+    uint64_t r;
+    if (!AlignTo(base, alignment, &r)) {
+        return {};
+    }
+    return {r};
+}
+
 TEST(liblp, AlignTo) {
-    EXPECT_EQ(AlignTo(37, 0), 37);
-    EXPECT_EQ(AlignTo(1024, 1024), 1024);
-    EXPECT_EQ(AlignTo(555, 1024), 1024);
-    EXPECT_EQ(AlignTo(555, 1000), 1000);
-    EXPECT_EQ(AlignTo(0, 1024), 0);
-    EXPECT_EQ(AlignTo(54, 32, 30), 62);
-    EXPECT_EQ(AlignTo(32, 32, 30), 62);
-    EXPECT_EQ(AlignTo(17, 32, 30), 30);
+    EXPECT_EQ(AlignTo(37, 0), std::optional<uint64_t>(37));
+    EXPECT_EQ(AlignTo(1024, 1024), std::optional<uint64_t>(1024));
+    EXPECT_EQ(AlignTo(555, 1024), std::optional<uint64_t>(1024));
+    EXPECT_EQ(AlignTo(555, 1000), std::optional<uint64_t>(1000));
+    EXPECT_EQ(AlignTo(0, 1024), std::optional<uint64_t>(0));
+    EXPECT_EQ(AlignTo(54, 32), std::optional<uint64_t>(64));
+    EXPECT_EQ(AlignTo(32, 32), std::optional<uint64_t>(32));
+    EXPECT_EQ(AlignTo(17, 32), std::optional<uint64_t>(32));
+
+    auto u32limit = std::numeric_limits<uint32_t>::max();
+    auto u64limit = std::numeric_limits<uint64_t>::max();
+    EXPECT_EQ(AlignTo(u64limit - u32limit + 1, u32limit), std::optional<uint64_t>{u64limit});
+    EXPECT_EQ(AlignTo(std::numeric_limits<uint64_t>::max(), 2), std::optional<uint64_t>{});
 }
 
 TEST(liblp, GetPartitionSlotSuffix) {
diff --git a/fs_mgr/liblp/writer.cpp b/fs_mgr/liblp/writer.cpp
index 8bf1ee9..2708efa 100644
--- a/fs_mgr/liblp/writer.cpp
+++ b/fs_mgr/liblp/writer.cpp
@@ -81,8 +81,8 @@
     return header_blob + tables;
 }
 
-// Perform sanity checks so we don't accidentally overwrite valid metadata
-// with potentially invalid metadata, or random partition data with metadata.
+// Perform checks so we don't accidentally overwrite valid metadata with
+// potentially invalid metadata, or random partition data with metadata.
 static bool ValidateAndSerializeMetadata([[maybe_unused]] const IPartitionOpener& opener,
                                          const LpMetadata& metadata, const std::string& slot_suffix,
                                          std::string* blob) {
diff --git a/fs_mgr/libsnapshot/Android.bp b/fs_mgr/libsnapshot/Android.bp
index c118788..d36a7f0 100644
--- a/fs_mgr/libsnapshot/Android.bp
+++ b/fs_mgr/libsnapshot/Android.bp
@@ -24,21 +24,30 @@
     ],
     shared_libs: [
         "libbase",
+        "libchrome",
         "libcutils",
         "liblog",
     ],
     static_libs: [
+        "libbrotli",
         "libdm",
         "libfstab",
         "update_metadata-protos",
     ],
     whole_static_libs: [
+        "libbrotli",
+        "libcutils",
         "libext2_uuid",
         "libext4_utils",
         "libfstab",
+        "libsnapshot_cow",
+        "libsnapshot_snapuserd",
+        "libz",
     ],
     header_libs: [
         "libfiemap_headers",
+        "libstorage_literals_headers",
+        "libupdate_engine_headers",
     ],
     export_static_lib_headers: [
         "update_metadata-protos",
@@ -71,8 +80,11 @@
         "android/snapshot/snapshot.proto",
         "device_info.cpp",
         "snapshot.cpp",
+        "snapshot_reader.cpp",
         "snapshot_stats.cpp",
+        "snapshot_stub.cpp",
         "snapshot_metadata_updater.cpp",
+        "snapshot_writer.cpp",
         "partition_cow_creator.cpp",
         "return.cpp",
         "utility.cpp",
@@ -99,9 +111,13 @@
 
 cc_library_static {
     name: "libsnapshot_init",
+    native_coverage : true,
     defaults: ["libsnapshot_defaults"],
     srcs: [":libsnapshot_sources"],
     recovery_available: true,
+    cflags: [
+        "-DLIBSNAPSHOT_NO_COW_WRITE",
+    ],
     static_libs: [
         "libfs_mgr",
     ],
@@ -115,11 +131,84 @@
     ],
     srcs: [":libsnapshot_sources"],
     recovery_available: true,
+    cflags: [
+        "-DLIBSNAPSHOT_NO_COW_WRITE",
+    ],
     static_libs: [
         "libfs_mgr",
     ],
 }
 
+cc_defaults {
+    name: "libsnapshot_cow_defaults",
+    defaults: [
+        "fs_mgr_defaults",
+    ],
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Werror",
+    ],
+    export_include_dirs: ["include"],
+    srcs: [
+        "cow_decompress.cpp",
+        "cow_reader.cpp",
+        "cow_writer.cpp",
+        "cow_format.cpp",
+    ],
+}
+
+cc_library_static {
+    name: "libsnapshot_cow",
+    defaults: [
+        "libsnapshot_cow_defaults",
+    ],
+    host_supported: true,
+    recovery_available: true,
+    shared_libs: [
+        "libbase",
+        "liblog",
+    ],
+    static_libs: [
+        "libbrotli",
+        "libz",
+    ],
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
+}
+
+cc_defaults {
+    name: "libsnapshot_snapuserd_defaults",
+    defaults: [
+        "fs_mgr_defaults",
+    ],
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Werror",
+    ],
+    export_include_dirs: ["include"],
+    srcs: [
+        "snapuserd_client.cpp",
+    ],
+}
+
+cc_library_static {
+    name: "libsnapshot_snapuserd",
+    defaults: [
+        "libsnapshot_snapuserd_defaults",
+    ],
+    recovery_available: true,
+    static_libs: [
+        "libcutils_sockets",
+    ],
+    shared_libs: [
+        "libbase",
+        "liblog",
+    ],
+    ramdisk_available: true,
+}
+
 cc_library_static {
     name: "libsnapshot_test_helpers",
     defaults: ["libsnapshot_defaults"],
@@ -156,6 +245,7 @@
     srcs: [
         "partition_cow_creator_test.cpp",
         "snapshot_metadata_updater_test.cpp",
+        "snapshot_reader_test.cpp",
         "snapshot_test.cpp",
     ],
     shared_libs: [
@@ -169,11 +259,13 @@
     static_libs: [
         "android.hardware.boot@1.0",
         "android.hardware.boot@1.1",
+        "libbrotli",
         "libfs_mgr",
         "libgsi",
         "libgmock",
         "liblp",
         "libsnapshot",
+        "libsnapshot_cow",
         "libsnapshot_test_helpers",
         "libsparse",
     ],
@@ -194,20 +286,18 @@
     defaults: ["libsnapshot_test_defaults"],
 }
 
-// For VTS 10
-vts_config {
-    name: "VtsLibsnapshotTest",
-    test_config: "VtsLibsnapshotTest.xml"
-}
-
 cc_binary {
     name: "snapshotctl",
     srcs: [
         "snapshotctl.cpp",
     ],
     static_libs: [
+        "libbrotli",
         "libfstab",
         "libsnapshot",
+        "libsnapshot_cow",
+        "libz",
+        "update_metadata-protos",
     ],
     shared_libs: [
         "android.hardware.boot@1.0",
@@ -225,3 +315,288 @@
         "libutils",
     ],
 }
+
+cc_test {
+    name: "snapshot_power_test",
+    srcs: [
+        "power_test.cpp",
+    ],
+    static_libs: [
+        "libsnapshot",
+        "update_metadata-protos",
+    ],
+    shared_libs: [
+        "libbase",
+        "libfs_mgr_binder",
+        "liblog",
+    ],
+    gtest: false,
+}
+
+cc_defaults {
+    name: "libsnapshot_fuzzer_defaults",
+    native_coverage : true,
+    srcs: [
+        // Compile the protobuf definition again with type full.
+        "android/snapshot/snapshot_fuzz.proto",
+        "update_engine/update_metadata.proto",
+        "fuzz_utils.cpp",
+        "snapshot_fuzz.cpp",
+        "snapshot_fuzz_utils.cpp",
+
+        // Compile libsnapshot sources directly to avoid dependency
+        // to update_metadata-protos
+        ":libsnapshot_sources",
+    ],
+    static_libs: [
+        "libbase",
+        "libbrotli",
+        "libchrome",
+        "libcrypto_static",
+        "libcutils",
+        "libext2_uuid",
+        "libext4_utils",
+        "libfstab",
+        "libfs_mgr",
+        "libgtest", // from libsnapshot_test_helpers
+        "libgmock", // from libsnapshot_test_helpers
+        "liblog",
+        "liblp",
+        "libsnapshot_cow",
+        "libsnapshot_test_helpers",
+        "libprotobuf-mutator",
+        "libz",
+    ],
+    header_libs: [
+        "libfiemap_headers",
+        "libstorage_literals_headers",
+        "libupdate_engine_headers",
+    ],
+    proto: {
+        type: "full",
+        canonical_path_from_root: false,
+        local_include_dirs: ["."],
+    },
+}
+
+cc_fuzz {
+    name: "libsnapshot_fuzzer",
+    defaults: ["libsnapshot_fuzzer_defaults"],
+    corpus: ["corpus/*"],
+    fuzz_config: {
+        cc: ["android-virtual-ab+bugs@google.com"],
+        componentid: 30545,
+        hotlists: ["1646452"],
+        fuzz_on_haiku_host: false,
+        fuzz_on_haiku_device: true,
+    },
+}
+
+cc_test {
+    name: "libsnapshot_fuzzer_test",
+    defaults: ["libsnapshot_fuzzer_defaults"],
+    data: ["corpus/*"],
+    test_suites: [
+        "device-tests",
+    ],
+    auto_gen_config: true,
+    require_root: true,
+}
+
+cc_defaults {
+    name: "snapuserd_defaults",
+    defaults: [
+        "fs_mgr_defaults",
+    ],
+    srcs: [
+        "snapuserd_server.cpp",
+        "snapuserd.cpp",
+        "snapuserd_daemon.cpp",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror"
+    ],
+
+    static_libs: [
+        "libbase",
+        "libbrotli",
+        "libcutils_sockets",
+        "libdm",
+        "libgflags",
+        "liblog",
+        "libsnapshot_cow",
+        "libz",
+    ],
+}
+
+cc_binary {
+    name: "snapuserd",
+    defaults: ["snapuserd_defaults"],
+    init_rc: [
+        "snapuserd.rc",
+    ],
+    static_executable: true,
+    system_shared_libs: [],
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
+    recovery_available: true,
+}
+
+cc_test {
+    name: "cow_api_test",
+    defaults: [
+        "fs_mgr_defaults",
+    ],
+    srcs: [
+        "cow_api_test.cpp",
+    ],
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Werror",
+    ],
+    shared_libs: [
+        "libbase",
+        "libcrypto",
+        "liblog",
+        "libz",
+    ],
+    static_libs: [
+        "libbrotli",
+        "libgtest",
+        "libsnapshot_cow",
+    ],
+    test_min_api_level: 30,
+    auto_gen_config: true,
+    require_root: false,
+    host_supported: true,
+}
+
+cc_binary {
+    name: "make_cow_from_ab_ota",
+    host_supported: true,
+    device_supported: false,
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Werror",
+    ],
+    static_libs: [
+        "libbase",
+        "libbspatch",
+        "libbrotli",
+        "libbz",
+        "libchrome",
+        "libcrypto",
+        "libgflags",
+        "liblog",
+        "libprotobuf-cpp-lite",
+        "libpuffpatch",
+        "libsnapshot_cow",
+        "libsparse",
+        "libxz",
+        "libz",
+        "libziparchive",
+        "update_metadata-protos",
+    ],
+    srcs: [
+        "make_cow_from_ab_ota.cpp",
+    ],
+    target: {
+        darwin: {
+            enabled: false,
+        },
+    },
+}
+
+cc_binary {
+    name: "estimate_cow_from_nonab_ota",
+    host_supported: true,
+    device_supported: false,
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Werror",
+    ],
+    static_libs: [
+        "libbase",
+        "libbrotli",
+        "libbz",
+        "libcrypto",
+        "libgflags",
+        "liblog",
+        "libsnapshot_cow",
+        "libsparse",
+        "libz",
+        "libziparchive",
+    ],
+    srcs: [
+        "estimate_cow_from_nonab_ota.cpp",
+    ],
+    target: {
+        darwin: {
+            enabled: false,
+        },
+    },
+}
+
+cc_test {
+    name: "cow_snapuserd_test",
+    defaults: [
+        "fs_mgr_defaults",
+    ],
+    srcs: [
+        "cow_snapuserd_test.cpp",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    shared_libs: [
+        "libbase",
+        "liblog",
+    ],
+    static_libs: [
+        "libbrotli",
+        "libgtest",
+        "libsnapshot_cow",
+        "libsnapshot_snapuserd",
+        "libcutils_sockets",
+        "libz",
+	"libfs_mgr",
+        "libdm",
+    ],
+    header_libs: [
+        "libstorage_literals_headers",
+        "libfiemap_headers",
+    ],
+    test_min_api_level: 30,
+    auto_gen_config: true,
+    require_root: false,
+}
+
+cc_binary {
+    name: "inspect_cow",
+    host_supported: true,
+    device_supported: true,
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wall",
+        "-Werror",
+    ],
+    static_libs: [
+        "libbase",
+        "libbrotli",
+        "libcrypto_static",
+        "liblog",
+        "libsnapshot_cow",
+        "libz",
+    ],
+    shared_libs: [
+    ],
+    srcs: [
+        "inspect_cow.cpp",
+    ],
+}
diff --git a/fs_mgr/libsnapshot/PowerTest.md b/fs_mgr/libsnapshot/PowerTest.md
new file mode 100644
index 0000000..0b0cb5d
--- /dev/null
+++ b/fs_mgr/libsnapshot/PowerTest.md
@@ -0,0 +1,40 @@
+snapshot\_power\_test
+---------------------
+
+snapshot\_power\_test is a standalone test to simulate power failures during a snapshot-merge operation.
+
+### Test Setup
+
+Start by creating two large files that will be used as the pre-merge and post-merge state. You can take two different partition images (for example, a product.img from two separate builds), or just create random data:
+
+	dd if=/dev/urandom of=pre-merge count=1024 bs=1048576
+	dd if=/dev/urandom of=post-merge count=1024 bs=1048576
+
+Next, push these files to an unencrypted directory on the device:
+
+	adb push pre-merge /data/local/unencrypted
+	adb push post-merge /data/local/unencrypted
+
+Next, run the test setup:
+
+	adb sync data
+	adb shell /data/nativetest64/snapshot_power_test/snapshot_power_test \
+		/data/local/unencrypted/pre-merge \
+		/data/local/unencrypted/post-merge
+
+This will create the necessary fiemap-based images.
+
+### Running
+The actual test can be run via `run_power_test.sh`. Its syntax is:
+
+	run_power_test.sh <POST_MERGE_FILE>
+
+`POST_MERGE_FILE` should be the path on the device of the image to validate the merge against. Example:
+
+	run_power_test.sh /data/local/unencrypted/post-merge
+
+The device will begin the merge with a 5% chance of injecting a kernel crash every 10ms. The device should be capable of rebooting normally without user intervention. Once the merge has completed, the test will run a final check command to validate the contents of the snapshot against the post-merge file. It will error if there are any incorrect blocks.
+
+Two environment variables can be passed to `run_power_test.sh`:
+1. `FAIL_RATE` - A fraction between 0 and 100 (inclusive) indicating the probability the device should inject a kernel crash every 10ms.
+2. `DEVICE_SERIAL` - If multiple devices are attached to adb, this argument is passed as the serial to select (to `adb -s`).
diff --git a/fs_mgr/libsnapshot/VtsLibsnapshotTest.xml b/fs_mgr/libsnapshot/VtsLibsnapshotTest.xml
deleted file mode 100644
index b53b51e..0000000
--- a/fs_mgr/libsnapshot/VtsLibsnapshotTest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-<configuration description="Config for VTS VtsLibsnapshotTest">
-    <option name="config-descriptor:metadata" key="plan" value="vts-kernel"/>
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
-        <option name="abort-on-push-failure" value="false"/>
-        <option name="push-group" value="HostDrivenTest.push"/>
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
-        <option name="test-module-name" value="VtsLibsnapshotTest"/>
-        <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_libsnapshot_test/vts_libsnapshot_test"/>
-        <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_libsnapshot_test/vts_libsnapshot_test"/>
-        <option name="binary-test-type" value="gtest"/>
-        <option name="test-timeout" value="5m"/>
-    </test>
-</configuration>
diff --git a/fs_mgr/libsnapshot/android/snapshot/snapshot.proto b/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
index 0328132..36e1169 100644
--- a/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
+++ b/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
@@ -34,7 +34,19 @@
     MERGE_COMPLETED = 3;
 }
 
-// Next: 9
+// Next: 3
+enum MergePhase {
+    // No merge is in progress.
+    NO_MERGE = 0;
+
+    // Shrunk partitions can merge.
+    FIRST_PHASE = 1;
+
+    // Grown partitions can merge.
+    SECOND_PHASE = 2;
+}
+
+// Next: 11
 message SnapshotStatus {
     // Name of the snapshot. This is usually the name of the snapshotted
     // logical partition; for example, "system_b".
@@ -84,6 +96,12 @@
     // the merge process.
     // This is non-zero when |state| == MERGING or MERGE_COMPLETED.
     uint64 metadata_sectors = 8;
+
+    // True if compression is enabled, false otherwise.
+    bool compression_enabled = 9;
+
+    // The old partition size (if none existed, this will be zero).
+    uint64 old_partition_size = 10;
 }
 
 // Next: 8
@@ -115,7 +133,7 @@
     Cancelled = 7;
 };
 
-// Next: 5
+// Next: 7
 message SnapshotUpdateStatus {
     UpdateState state = 1;
 
@@ -130,6 +148,12 @@
 
     // Sectors allocated for metadata in all the snapshot devices.
     uint64 metadata_sectors = 4;
+
+    // Whether compression/dm-user was used for any snapshots.
+    bool compression_enabled = 5;
+
+    // Merge phase (if state == MERGING).
+    MergePhase merge_phase = 6;
 }
 
 // Next: 4
diff --git a/fs_mgr/libsnapshot/android/snapshot/snapshot_fuzz.proto b/fs_mgr/libsnapshot/android/snapshot/snapshot_fuzz.proto
new file mode 100644
index 0000000..a55b42a
--- /dev/null
+++ b/fs_mgr/libsnapshot/android/snapshot/snapshot_fuzz.proto
@@ -0,0 +1,110 @@
+// Copyright (C) 2020 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.
+
+syntax = "proto3";
+package android.snapshot;
+
+import "update_engine/update_metadata.proto";
+
+// Controls the behavior of IDeviceInfo.
+// Next: 6
+message FuzzDeviceInfoData {
+    bool slot_suffix_is_a = 1;
+    bool is_overlayfs_setup = 2;
+    bool allow_set_boot_control_merge_status = 3;
+    bool allow_set_slot_as_unbootable = 4;
+    bool is_recovery = 5;
+}
+
+// Controls the behavior of the test SnapshotManager.
+// Next: 2
+message FuzzSnapshotManagerData {
+    bool is_local_image_manager = 1;
+}
+
+// A simplified version of CreateLogicalPartitionParams for fuzzing.
+// Next: 9
+message CreateLogicalPartitionParamsProto {
+    bool use_correct_super = 1;
+    string block_device = 2;
+    bool has_metadata_slot = 3;
+    uint32 metadata_slot = 4;
+    string partition_name = 5;
+    bool force_writable = 6;
+    int64 timeout_millis = 7;
+    string device_name = 8;
+}
+
+// Mimics the API of ISnapshotManager. Defines one action on the snapshot
+// manager.
+// Next: 18
+message SnapshotManagerActionProto {
+    message NoArgs {}
+    message ProcessUpdateStateArgs {
+        bool has_before_cancel = 1;
+        bool fail_before_cancel = 2;
+    }
+    message CreateLogicalAndSnapshotPartitionsArgs {
+        bool use_correct_super = 1;
+        string super = 2;
+        int64 timeout_millis = 3;
+    }
+    message RecoveryCreateSnapshotDevicesArgs {
+        bool has_metadata_device_object = 1;
+        bool metadata_mounted = 2;
+    }
+    reserved 18 to 9999;
+    oneof value {
+        NoArgs begin_update = 1;
+        NoArgs cancel_update = 2;
+        bool finished_snapshot_writes = 3;
+        NoArgs initiate_merge = 4;
+        ProcessUpdateStateArgs process_update_state = 5;
+        bool get_update_state = 6;
+        chromeos_update_engine.DeltaArchiveManifest create_update_snapshots = 7;
+        CreateLogicalPartitionParamsProto map_update_snapshot = 8;
+        string unmap_update_snapshot = 9;
+        NoArgs need_snapshots_in_first_stage_mount = 10;
+        CreateLogicalAndSnapshotPartitionsArgs create_logical_and_snapshot_partitions = 11;
+        bool handle_imminent_data_wipe = 12;
+        NoArgs recovery_create_snapshot_devices = 13;
+        RecoveryCreateSnapshotDevicesArgs recovery_create_snapshot_devices_with_metadata = 14;
+        NoArgs dump = 15;
+        NoArgs ensure_metadata_mounted = 16;
+        NoArgs get_snapshot_merge_stats_instance = 17;
+
+        // Test directives that has nothing to do with ISnapshotManager API surface.
+        NoArgs switch_slot = 10000;
+    }
+}
+
+// Includes all data that needs to be fuzzed.
+message SnapshotFuzzData {
+    FuzzDeviceInfoData device_info_data = 1;
+    FuzzSnapshotManagerData manager_data = 2;
+
+    // If true:
+    // - if super_data is empty, create empty super partition metadata.
+    // - otherwise, create super partition metadata accordingly.
+    // If false, no valid super partition metadata (it is zeroed)
+    bool is_super_metadata_valid = 3;
+    chromeos_update_engine.DeltaArchiveManifest super_data = 4;
+
+    // Whether the directory that mocks /metadata/ota/snapshot is created.
+    bool has_metadata_snapshots_dir = 5;
+
+    // More data used to prep the test before running actions.
+    reserved 6 to 9999;
+    repeated SnapshotManagerActionProto actions = 10000;
+}
diff --git a/fs_mgr/libsnapshot/corpus/launch_device.txt b/fs_mgr/libsnapshot/corpus/launch_device.txt
new file mode 100644
index 0000000..55a7f2c
--- /dev/null
+++ b/fs_mgr/libsnapshot/corpus/launch_device.txt
@@ -0,0 +1,161 @@
+device_info_data {
+  slot_suffix_is_a: true
+  is_overlayfs_setup: false
+  allow_set_boot_control_merge_status: true
+  allow_set_slot_as_unbootable: true
+  is_recovery: false
+}
+manager_data {
+  is_local_image_manager: false
+}
+is_super_metadata_valid: true
+super_data {
+  partitions {
+    partition_name: "sys_a"
+    new_partition_info {
+      size: 3145728
+    }
+  }
+  partitions {
+    partition_name: "vnd_a"
+    new_partition_info {
+      size: 3145728
+    }
+  }
+  partitions {
+    partition_name: "prd_a"
+    new_partition_info {
+      size: 3145728
+    }
+  }
+  dynamic_partition_metadata {
+    groups {
+      name: "group_google_dp_a"
+      size: 15728640
+      partition_names: "sys_a"
+      partition_names: "vnd_a"
+      partition_names: "prd_a"
+    }
+  }
+}
+has_metadata_snapshots_dir: true
+actions {
+  begin_update {
+  }
+}
+actions {
+  create_update_snapshots {
+    partitions {
+      partition_name: "sys"
+      new_partition_info {
+        size: 3878912
+      }
+      operations {
+        type: ZERO,
+        dst_extents {
+          start_block: 0
+          num_blocks: 947
+        }
+      }
+    }
+    partitions {
+      partition_name: "vnd"
+      new_partition_info {
+        size: 3878912
+      }
+      operations {
+        type: ZERO,
+        dst_extents {
+          start_block: 0
+          num_blocks: 947
+        }
+      }
+    }
+    partitions {
+      partition_name: "prd"
+      new_partition_info {
+        size: 3878912
+      }
+      operations {
+        type: ZERO,
+        dst_extents {
+          start_block: 0
+          num_blocks: 947
+        }
+      }
+    }
+    dynamic_partition_metadata {
+      groups {
+        name: "group_google_dp"
+        size: 15728640
+        partition_names: "sys"
+        partition_names: "vnd"
+        partition_names: "prd"
+      }
+    }
+  }
+}
+actions {
+  map_update_snapshot {
+    use_correct_super: true
+    has_metadata_slot: true
+    metadata_slot: 1
+    partition_name: "sys_b"
+    force_writable: true
+    timeout_millis: 3000
+  }
+}
+actions {
+  map_update_snapshot {
+    use_correct_super: true
+    has_metadata_slot: true
+    metadata_slot: 1
+    partition_name: "vnd_b"
+    force_writable: true
+    timeout_millis: 3000
+  }
+}
+actions {
+  map_update_snapshot {
+    use_correct_super: true
+    has_metadata_slot: true
+    metadata_slot: 1
+    partition_name: "prd_b"
+    force_writable: true
+    timeout_millis: 3000
+  }
+}
+actions {
+  finished_snapshot_writes: false
+}
+actions {
+  unmap_update_snapshot: "sys_b"
+}
+actions {
+  unmap_update_snapshot: "vnd_b"
+}
+actions {
+  unmap_update_snapshot: "prd_b"
+}
+actions {
+  switch_slot {
+  }
+}
+actions {
+  need_snapshots_in_first_stage_mount {
+  }
+}
+actions {
+  create_logical_and_snapshot_partitions {
+    use_correct_super: true
+    timeout_millis: 5000
+  }
+}
+actions {
+  initiate_merge {
+  }
+}
+actions {
+  process_update_state {
+  }
+}
diff --git a/fs_mgr/libsnapshot/cow_api_test.cpp b/fs_mgr/libsnapshot/cow_api_test.cpp
new file mode 100644
index 0000000..a96352a
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_api_test.cpp
@@ -0,0 +1,766 @@
+// Copyright (C) 2018 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.
+
+#include <sys/stat.h>
+
+#include <cstdio>
+#include <iostream>
+#include <memory>
+#include <string_view>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <gtest/gtest.h>
+#include <libsnapshot/cow_reader.h>
+#include <libsnapshot/cow_writer.h>
+
+namespace android {
+namespace snapshot {
+
+class CowTest : public ::testing::Test {
+  protected:
+    virtual void SetUp() override {
+        cow_ = std::make_unique<TemporaryFile>();
+        ASSERT_GE(cow_->fd, 0) << strerror(errno);
+    }
+
+    virtual void TearDown() override { cow_ = nullptr; }
+
+    std::unique_ptr<TemporaryFile> cow_;
+};
+
+// Sink that always appends to the end of a string.
+class StringSink : public IByteSink {
+  public:
+    void* GetBuffer(size_t requested, size_t* actual) override {
+        size_t old_size = stream_.size();
+        stream_.resize(old_size + requested, '\0');
+        *actual = requested;
+        return stream_.data() + old_size;
+    }
+    bool ReturnData(void*, size_t) override { return true; }
+    void Reset() { stream_.clear(); }
+
+    std::string& stream() { return stream_; }
+
+  private:
+    std::string stream_;
+};
+
+TEST_F(CowTest, ReadWrite) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    CowWriter writer(options);
+
+    ASSERT_TRUE(writer.Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+
+    ASSERT_TRUE(writer.AddCopy(10, 20));
+    ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer.AddZeroBlocks(51, 2));
+    ASSERT_TRUE(writer.Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    CowReader reader;
+    CowHeader header;
+    CowFooter footer;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+    ASSERT_TRUE(reader.GetHeader(&header));
+    ASSERT_TRUE(reader.GetFooter(&footer));
+    ASSERT_EQ(header.magic, kCowMagicNumber);
+    ASSERT_EQ(header.major_version, kCowVersionMajor);
+    ASSERT_EQ(header.minor_version, kCowVersionMinor);
+    ASSERT_EQ(header.block_size, options.block_size);
+    ASSERT_EQ(footer.op.num_ops, 4);
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+
+    ASSERT_EQ(op->type, kCowCopyOp);
+    ASSERT_EQ(op->compression, kCowCompressNone);
+    ASSERT_EQ(op->data_length, 0);
+    ASSERT_EQ(op->new_block, 10);
+    ASSERT_EQ(op->source, 20);
+
+    StringSink sink;
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_EQ(op->compression, kCowCompressNone);
+    ASSERT_EQ(op->data_length, 4096);
+    ASSERT_EQ(op->new_block, 50);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data);
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+
+    // Note: the zero operation gets split into two blocks.
+    ASSERT_EQ(op->type, kCowZeroOp);
+    ASSERT_EQ(op->compression, kCowCompressNone);
+    ASSERT_EQ(op->data_length, 0);
+    ASSERT_EQ(op->new_block, 51);
+    ASSERT_EQ(op->source, 0);
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+
+    ASSERT_EQ(op->type, kCowZeroOp);
+    ASSERT_EQ(op->compression, kCowCompressNone);
+    ASSERT_EQ(op->data_length, 0);
+    ASSERT_EQ(op->new_block, 52);
+    ASSERT_EQ(op->source, 0);
+
+    iter->Next();
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, CompressGz) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    options.compression = "gz";
+    CowWriter writer(options);
+
+    ASSERT_TRUE(writer.Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+
+    ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer.Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+
+    StringSink sink;
+
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_EQ(op->compression, kCowCompressGz);
+    ASSERT_EQ(op->data_length, 56);  // compressed!
+    ASSERT_EQ(op->new_block, 50);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data);
+
+    iter->Next();
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, ClusterCompressGz) {
+    CowOptions options;
+    options.compression = "gz";
+    options.cluster_ops = 2;
+    CowWriter writer(options);
+
+    ASSERT_TRUE(writer.Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size()));
+
+    std::string data2 = "More data!";
+    data2.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer.AddRawBlocks(51, data2.data(), data2.size()));
+
+    ASSERT_TRUE(writer.Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+
+    StringSink sink;
+
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_EQ(op->compression, kCowCompressGz);
+    ASSERT_EQ(op->data_length, 56);  // compressed!
+    ASSERT_EQ(op->new_block, 50);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data);
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+
+    ASSERT_EQ(op->type, kCowClusterOp);
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+
+    sink.Reset();
+    ASSERT_EQ(op->compression, kCowCompressGz);
+    ASSERT_EQ(op->data_length, 41);  // compressed!
+    ASSERT_EQ(op->new_block, 51);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data2);
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+
+    ASSERT_EQ(op->type, kCowClusterOp);
+
+    iter->Next();
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, CompressTwoBlocks) {
+    CowOptions options;
+    options.compression = "gz";
+    options.cluster_ops = 0;
+    CowWriter writer(options);
+
+    ASSERT_TRUE(writer.Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size * 2, '\0');
+
+    ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer.Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+    ASSERT_FALSE(iter->Done());
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+
+    StringSink sink;
+
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_EQ(op->compression, kCowCompressGz);
+    ASSERT_EQ(op->new_block, 51);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+}
+
+// Only return 1-byte buffers, to stress test the partial read logic in
+// CowReader.
+class HorribleStringSink : public StringSink {
+  public:
+    void* GetBuffer(size_t, size_t* actual) override { return StringSink::GetBuffer(1, actual); }
+};
+
+class CompressionTest : public CowTest, public testing::WithParamInterface<const char*> {};
+
+TEST_P(CompressionTest, HorribleSink) {
+    CowOptions options;
+    options.compression = GetParam();
+    options.cluster_ops = 0;
+    CowWriter writer(options);
+
+    ASSERT_TRUE(writer.Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+
+    ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer.Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+    ASSERT_FALSE(iter->Done());
+
+    HorribleStringSink sink;
+    auto op = &iter->Get();
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data);
+}
+
+INSTANTIATE_TEST_SUITE_P(CowApi, CompressionTest, testing::Values("none", "gz", "brotli"));
+
+TEST_F(CowTest, GetSize) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    CowWriter writer(options);
+    if (ftruncate(cow_->fd, 0) < 0) {
+        perror("Fails to set temp file size");
+        FAIL();
+    }
+    ASSERT_TRUE(writer.Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+
+    ASSERT_TRUE(writer.AddCopy(10, 20));
+    ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer.AddZeroBlocks(51, 2));
+    auto size_before = writer.GetCowSize();
+    ASSERT_TRUE(writer.Finalize());
+    auto size_after = writer.GetCowSize();
+    ASSERT_EQ(size_before, size_after);
+    struct stat buf;
+
+    ASSERT_GE(fstat(cow_->fd, &buf), 0) << strerror(errno);
+    ASSERT_EQ(buf.st_size, writer.GetCowSize());
+}
+
+TEST_F(CowTest, AppendLabelSmall) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    auto writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer->AddLabel(3));
+    ASSERT_TRUE(writer->Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->InitializeAppend(cow_->fd, 3));
+
+    std::string data2 = "More data!";
+    data2.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(51, data2.data(), data2.size()));
+    ASSERT_TRUE(writer->Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    struct stat buf;
+    ASSERT_EQ(fstat(cow_->fd, &buf), 0);
+    ASSERT_EQ(buf.st_size, writer->GetCowSize());
+
+    // Read back both operations, and label.
+    CowReader reader;
+    uint64_t label;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+    ASSERT_TRUE(reader.GetLastLabel(&label));
+    ASSERT_EQ(label, 3);
+
+    StringSink sink;
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data);
+
+    iter->Next();
+    sink.Reset();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 3);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data2);
+
+    iter->Next();
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, AppendLabelMissing) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    auto writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->Initialize(cow_->fd));
+
+    ASSERT_TRUE(writer->AddLabel(0));
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer->AddLabel(1));
+    // Drop the tail end of the last op header, corrupting it.
+    ftruncate(cow_->fd, writer->GetCowSize() - sizeof(CowFooter) - 3);
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    writer = std::make_unique<CowWriter>(options);
+    ASSERT_FALSE(writer->InitializeAppend(cow_->fd, 1));
+    ASSERT_TRUE(writer->InitializeAppend(cow_->fd, 0));
+
+    ASSERT_TRUE(writer->AddZeroBlocks(51, 1));
+    ASSERT_TRUE(writer->Finalize());
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    struct stat buf;
+    ASSERT_EQ(fstat(cow_->fd, &buf), 0);
+    ASSERT_EQ(buf.st_size, writer->GetCowSize());
+
+    // Read back both operations.
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    StringSink sink;
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 0);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowZeroOp);
+
+    iter->Next();
+
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, AppendExtendedCorrupted) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    auto writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->Initialize(cow_->fd));
+
+    ASSERT_TRUE(writer->AddLabel(5));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size * 2, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size()));
+    ASSERT_TRUE(writer->AddLabel(6));
+
+    // fail to write the footer. Cow Format does not know if Label 6 is valid
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    // Get the last known good label
+    CowReader label_reader;
+    uint64_t label;
+    ASSERT_TRUE(label_reader.Parse(cow_->fd, {5}));
+    ASSERT_TRUE(label_reader.GetLastLabel(&label));
+    ASSERT_EQ(label, 5);
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->InitializeAppend(cow_->fd, 5));
+
+    ASSERT_TRUE(writer->Finalize());
+
+    struct stat buf;
+    ASSERT_EQ(fstat(cow_->fd, &buf), 0);
+    ASSERT_EQ(buf.st_size, writer->GetCowSize());
+
+    // Read back all valid operations
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    StringSink sink;
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 5);
+
+    iter->Next();
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, AppendbyLabel) {
+    CowOptions options;
+    options.cluster_ops = 0;
+    auto writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size * 2, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size()));
+
+    ASSERT_TRUE(writer->AddLabel(4));
+
+    ASSERT_TRUE(writer->AddZeroBlocks(50, 2));
+
+    ASSERT_TRUE(writer->AddLabel(5));
+
+    ASSERT_TRUE(writer->AddCopy(5, 6));
+
+    ASSERT_TRUE(writer->AddLabel(6));
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    writer = std::make_unique<CowWriter>(options);
+    ASSERT_FALSE(writer->InitializeAppend(cow_->fd, 12));
+    ASSERT_TRUE(writer->InitializeAppend(cow_->fd, 5));
+
+    // This should drop label 6
+    ASSERT_TRUE(writer->Finalize());
+
+    struct stat buf;
+    ASSERT_EQ(fstat(cow_->fd, &buf), 0);
+    ASSERT_EQ(buf.st_size, writer->GetCowSize());
+
+    // Read back all ops
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    StringSink sink;
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data.substr(0, options.block_size));
+
+    iter->Next();
+    sink.Reset();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data.substr(options.block_size, 2 * options.block_size));
+
+    iter->Next();
+    sink.Reset();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 4);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowZeroOp);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowZeroOp);
+
+    iter->Next();
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 5);
+
+    iter->Next();
+
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, ClusterTest) {
+    CowOptions options;
+    options.cluster_ops = 4;
+    auto writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->Initialize(cow_->fd));
+
+    std::string data = "This is some data, believe it";
+    data.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size()));
+
+    ASSERT_TRUE(writer->AddLabel(4));
+
+    ASSERT_TRUE(writer->AddZeroBlocks(50, 2));  // Cluster split in middle
+
+    ASSERT_TRUE(writer->AddLabel(5));
+
+    ASSERT_TRUE(writer->AddCopy(5, 6));
+
+    // Cluster split
+
+    ASSERT_TRUE(writer->AddLabel(6));
+
+    ASSERT_TRUE(writer->Finalize());  // No data for cluster, so no cluster split needed
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    // Read back all ops
+    CowReader reader;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+
+    StringSink sink;
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data.substr(0, options.block_size));
+
+    iter->Next();
+    sink.Reset();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 4);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowZeroOp);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowClusterOp);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowZeroOp);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 5);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowCopyOp);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowClusterOp);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 6);
+
+    iter->Next();
+
+    ASSERT_TRUE(iter->Done());
+}
+
+TEST_F(CowTest, ClusterAppendTest) {
+    CowOptions options;
+    options.cluster_ops = 3;
+    auto writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->Initialize(cow_->fd));
+
+    ASSERT_TRUE(writer->AddLabel(50));
+    ASSERT_TRUE(writer->Finalize());  // Adds a cluster op, should be dropped on append
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    writer = std::make_unique<CowWriter>(options);
+    ASSERT_TRUE(writer->InitializeAppend(cow_->fd, 50));
+
+    std::string data2 = "More data!";
+    data2.resize(options.block_size, '\0');
+    ASSERT_TRUE(writer->AddRawBlocks(51, data2.data(), data2.size()));
+    ASSERT_TRUE(writer->Finalize());  // Adds a cluster op
+
+    ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0);
+
+    struct stat buf;
+    ASSERT_EQ(fstat(cow_->fd, &buf), 0);
+    ASSERT_EQ(buf.st_size, writer->GetCowSize());
+
+    // Read back both operations, plus cluster op at end
+    CowReader reader;
+    uint64_t label;
+    ASSERT_TRUE(reader.Parse(cow_->fd));
+    ASSERT_TRUE(reader.GetLastLabel(&label));
+    ASSERT_EQ(label, 50);
+
+    StringSink sink;
+
+    auto iter = reader.GetOpIter();
+    ASSERT_NE(iter, nullptr);
+
+    ASSERT_FALSE(iter->Done());
+    auto op = &iter->Get();
+    ASSERT_EQ(op->type, kCowLabelOp);
+    ASSERT_EQ(op->source, 50);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowReplaceOp);
+    ASSERT_TRUE(reader.ReadData(*op, &sink));
+    ASSERT_EQ(sink.stream(), data2);
+
+    iter->Next();
+
+    ASSERT_FALSE(iter->Done());
+    op = &iter->Get();
+    ASSERT_EQ(op->type, kCowClusterOp);
+
+    iter->Next();
+
+    ASSERT_TRUE(iter->Done());
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/fs_mgr/libsnapshot/cow_decompress.cpp b/fs_mgr/libsnapshot/cow_decompress.cpp
new file mode 100644
index 0000000..faceafe
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_decompress.cpp
@@ -0,0 +1,264 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include "cow_decompress.h"
+
+#include <utility>
+
+#include <android-base/logging.h>
+#include <brotli/decode.h>
+#include <zlib.h>
+
+namespace android {
+namespace snapshot {
+
+class NoDecompressor final : public IDecompressor {
+  public:
+    bool Decompress(size_t) override;
+};
+
+bool NoDecompressor::Decompress(size_t) {
+    size_t stream_remaining = stream_->Size();
+    while (stream_remaining) {
+        size_t buffer_size = stream_remaining;
+        uint8_t* buffer = reinterpret_cast<uint8_t*>(sink_->GetBuffer(buffer_size, &buffer_size));
+        if (!buffer) {
+            LOG(ERROR) << "Could not acquire buffer from sink";
+            return false;
+        }
+
+        // Read until we can fill the buffer.
+        uint8_t* buffer_pos = buffer;
+        size_t bytes_to_read = std::min(buffer_size, stream_remaining);
+        while (bytes_to_read) {
+            size_t read;
+            if (!stream_->Read(buffer_pos, bytes_to_read, &read)) {
+                return false;
+            }
+            if (!read) {
+                LOG(ERROR) << "Stream ended prematurely";
+                return false;
+            }
+            if (!sink_->ReturnData(buffer_pos, read)) {
+                LOG(ERROR) << "Could not return buffer to sink";
+                return false;
+            }
+            buffer_pos += read;
+            bytes_to_read -= read;
+            stream_remaining -= read;
+        }
+    }
+    return true;
+}
+
+std::unique_ptr<IDecompressor> IDecompressor::Uncompressed() {
+    return std::unique_ptr<IDecompressor>(new NoDecompressor());
+}
+
+// Read chunks of the COW and incrementally stream them to the decoder.
+class StreamDecompressor : public IDecompressor {
+  public:
+    bool Decompress(size_t output_bytes) override;
+
+    virtual bool Init() = 0;
+    virtual bool DecompressInput(const uint8_t* data, size_t length) = 0;
+    virtual bool Done() = 0;
+
+  protected:
+    bool GetFreshBuffer();
+
+    size_t output_bytes_;
+    size_t stream_remaining_;
+    uint8_t* output_buffer_ = nullptr;
+    size_t output_buffer_remaining_ = 0;
+};
+
+static constexpr size_t kChunkSize = 4096;
+
+bool StreamDecompressor::Decompress(size_t output_bytes) {
+    if (!Init()) {
+        return false;
+    }
+
+    stream_remaining_ = stream_->Size();
+    output_bytes_ = output_bytes;
+
+    uint8_t chunk[kChunkSize];
+    while (stream_remaining_) {
+        size_t read = std::min(stream_remaining_, sizeof(chunk));
+        if (!stream_->Read(chunk, read, &read)) {
+            return false;
+        }
+        if (!read) {
+            LOG(ERROR) << "Stream ended prematurely";
+            return false;
+        }
+        if (!DecompressInput(chunk, read)) {
+            return false;
+        }
+
+        stream_remaining_ -= read;
+
+        if (stream_remaining_ && Done()) {
+            LOG(ERROR) << "Decompressor terminated early";
+            return false;
+        }
+    }
+    if (!Done()) {
+        LOG(ERROR) << "Decompressor expected more bytes";
+        return false;
+    }
+    return true;
+}
+
+bool StreamDecompressor::GetFreshBuffer() {
+    size_t request_size = std::min(output_bytes_, kChunkSize);
+    output_buffer_ =
+            reinterpret_cast<uint8_t*>(sink_->GetBuffer(request_size, &output_buffer_remaining_));
+    if (!output_buffer_) {
+        LOG(ERROR) << "Could not acquire buffer from sink";
+        return false;
+    }
+    return true;
+}
+
+class GzDecompressor final : public StreamDecompressor {
+  public:
+    ~GzDecompressor();
+
+    bool Init() override;
+    bool DecompressInput(const uint8_t* data, size_t length) override;
+    bool Done() override { return ended_; }
+
+  private:
+    z_stream z_ = {};
+    bool ended_ = false;
+};
+
+bool GzDecompressor::Init() {
+    if (int rv = inflateInit(&z_); rv != Z_OK) {
+        LOG(ERROR) << "inflateInit returned error code " << rv;
+        return false;
+    }
+    return true;
+}
+
+GzDecompressor::~GzDecompressor() {
+    inflateEnd(&z_);
+}
+
+bool GzDecompressor::DecompressInput(const uint8_t* data, size_t length) {
+    z_.next_in = reinterpret_cast<Bytef*>(const_cast<uint8_t*>(data));
+    z_.avail_in = length;
+
+    while (z_.avail_in) {
+        // If no more output buffer, grab a new buffer.
+        if (z_.avail_out == 0) {
+            if (!GetFreshBuffer()) {
+                return false;
+            }
+            z_.next_out = reinterpret_cast<Bytef*>(output_buffer_);
+            z_.avail_out = output_buffer_remaining_;
+        }
+
+        // Remember the position of the output buffer so we can call ReturnData.
+        auto avail_out = z_.avail_out;
+
+        // Decompress.
+        int rv = inflate(&z_, Z_NO_FLUSH);
+        if (rv != Z_OK && rv != Z_STREAM_END) {
+            LOG(ERROR) << "inflate returned error code " << rv;
+            return false;
+        }
+
+        size_t returned = avail_out - z_.avail_out;
+        if (!sink_->ReturnData(output_buffer_, returned)) {
+            LOG(ERROR) << "Could not return buffer to sink";
+            return false;
+        }
+        output_buffer_ += returned;
+        output_buffer_remaining_ -= returned;
+
+        if (rv == Z_STREAM_END) {
+            if (z_.avail_in) {
+                LOG(ERROR) << "Gz stream ended prematurely";
+                return false;
+            }
+            ended_ = true;
+            return true;
+        }
+    }
+    return true;
+}
+
+std::unique_ptr<IDecompressor> IDecompressor::Gz() {
+    return std::unique_ptr<IDecompressor>(new GzDecompressor());
+}
+
+class BrotliDecompressor final : public StreamDecompressor {
+  public:
+    ~BrotliDecompressor();
+
+    bool Init() override;
+    bool DecompressInput(const uint8_t* data, size_t length) override;
+    bool Done() override { return BrotliDecoderIsFinished(decoder_); }
+
+  private:
+    BrotliDecoderState* decoder_ = nullptr;
+};
+
+bool BrotliDecompressor::Init() {
+    decoder_ = BrotliDecoderCreateInstance(nullptr, nullptr, nullptr);
+    return true;
+}
+
+BrotliDecompressor::~BrotliDecompressor() {
+    if (decoder_) {
+        BrotliDecoderDestroyInstance(decoder_);
+    }
+}
+
+bool BrotliDecompressor::DecompressInput(const uint8_t* data, size_t length) {
+    size_t available_in = length;
+    const uint8_t* next_in = data;
+
+    bool needs_more_output = false;
+    while (available_in || needs_more_output) {
+        if (!output_buffer_remaining_ && !GetFreshBuffer()) {
+            return false;
+        }
+
+        auto output_buffer = output_buffer_;
+        auto r = BrotliDecoderDecompressStream(decoder_, &available_in, &next_in,
+                                               &output_buffer_remaining_, &output_buffer_, nullptr);
+        if (r == BROTLI_DECODER_RESULT_ERROR) {
+            LOG(ERROR) << "brotli decode failed";
+            return false;
+        }
+        if (!sink_->ReturnData(output_buffer, output_buffer_ - output_buffer)) {
+            return false;
+        }
+        needs_more_output = (r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT);
+    }
+    return true;
+}
+
+std::unique_ptr<IDecompressor> IDecompressor::Brotli() {
+    return std::unique_ptr<IDecompressor>(new BrotliDecompressor());
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/cow_decompress.h b/fs_mgr/libsnapshot/cow_decompress.h
new file mode 100644
index 0000000..f485256
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_decompress.h
@@ -0,0 +1,57 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#pragma once
+
+#include <libsnapshot/cow_reader.h>
+
+namespace android {
+namespace snapshot {
+
+class IByteStream {
+  public:
+    virtual ~IByteStream() {}
+
+    // Read up to |length| bytes, storing the number of bytes read in the out-
+    // parameter. If the end of the stream is reached, 0 is returned.
+    virtual bool Read(void* buffer, size_t length, size_t* read) = 0;
+
+    // Size of the stream.
+    virtual size_t Size() const = 0;
+};
+
+class IDecompressor {
+  public:
+    virtual ~IDecompressor() {}
+
+    // Factory methods for decompression methods.
+    static std::unique_ptr<IDecompressor> Uncompressed();
+    static std::unique_ptr<IDecompressor> Gz();
+    static std::unique_ptr<IDecompressor> Brotli();
+
+    // |output_bytes| is the expected total number of bytes to sink.
+    virtual bool Decompress(size_t output_bytes) = 0;
+
+    void set_stream(IByteStream* stream) { stream_ = stream; }
+    void set_sink(IByteSink* sink) { sink_ = sink; }
+
+  protected:
+    IByteStream* stream_ = nullptr;
+    IByteSink* sink_ = nullptr;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/cow_format.cpp b/fs_mgr/libsnapshot/cow_format.cpp
new file mode 100644
index 0000000..0753c49
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_format.cpp
@@ -0,0 +1,91 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include <libsnapshot/cow_format.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <android-base/logging.h>
+
+namespace android {
+namespace snapshot {
+
+std::ostream& operator<<(std::ostream& os, CowOperation const& op) {
+    os << "CowOperation(type:";
+    if (op.type == kCowCopyOp)
+        os << "kCowCopyOp,    ";
+    else if (op.type == kCowReplaceOp)
+        os << "kCowReplaceOp, ";
+    else if (op.type == kCowZeroOp)
+        os << "kZeroOp,       ";
+    else if (op.type == kCowFooterOp)
+        os << "kCowFooterOp,  ";
+    else if (op.type == kCowLabelOp)
+        os << "kCowLabelOp,   ";
+    else if (op.type == kCowClusterOp)
+        os << "kCowClusterOp  ";
+    else if (op.type == kCowFooterOp)
+        os << "kCowFooterOp  ";
+    else
+        os << (int)op.type << "?,";
+    os << "compression:";
+    if (op.compression == kCowCompressNone)
+        os << "kCowCompressNone,   ";
+    else if (op.compression == kCowCompressGz)
+        os << "kCowCompressGz,     ";
+    else if (op.compression == kCowCompressBrotli)
+        os << "kCowCompressBrotli, ";
+    else
+        os << (int)op.compression << "?, ";
+    os << "data_length:" << op.data_length << ",\t";
+    os << "new_block:" << op.new_block << ",\t";
+    os << "source:" << op.source << ")";
+    return os;
+}
+
+int64_t GetNextOpOffset(const CowOperation& op, uint32_t cluster_ops) {
+    if (op.type == kCowClusterOp) {
+        return op.source;
+    } else if (op.type == kCowReplaceOp && cluster_ops == 0) {
+        return op.data_length;
+    } else {
+        return 0;
+    }
+}
+
+int64_t GetNextDataOffset(const CowOperation& op, uint32_t cluster_ops) {
+    if (op.type == kCowClusterOp) {
+        return cluster_ops * sizeof(CowOperation);
+    } else if (cluster_ops == 0) {
+        return sizeof(CowOperation);
+    } else {
+        return 0;
+    }
+}
+
+bool IsMetadataOp(const CowOperation& op) {
+    switch (op.type) {
+        case kCowLabelOp:
+        case kCowClusterOp:
+        case kCowFooterOp:
+            return true;
+        default:
+            return false;
+    }
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/cow_reader.cpp b/fs_mgr/libsnapshot/cow_reader.cpp
new file mode 100644
index 0000000..c15a05b
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_reader.cpp
@@ -0,0 +1,520 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <limits>
+#include <optional>
+#include <vector>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <libsnapshot/cow_reader.h>
+#include <zlib.h>
+
+#include "cow_decompress.h"
+
+namespace android {
+namespace snapshot {
+
+CowReader::CowReader() : fd_(-1), header_(), fd_size_(0) {}
+
+static void SHA256(const void*, size_t, uint8_t[]) {
+#if 0
+    SHA256_CTX c;
+    SHA256_Init(&c);
+    SHA256_Update(&c, data, length);
+    SHA256_Final(out, &c);
+#endif
+}
+
+bool CowReader::Parse(android::base::unique_fd&& fd, std::optional<uint64_t> label) {
+    owned_fd_ = std::move(fd);
+    return Parse(android::base::borrowed_fd{owned_fd_}, label);
+}
+
+bool CowReader::Parse(android::base::borrowed_fd fd, std::optional<uint64_t> label) {
+    fd_ = fd;
+
+    auto pos = lseek(fd_.get(), 0, SEEK_END);
+    if (pos < 0) {
+        PLOG(ERROR) << "lseek end failed";
+        return false;
+    }
+    fd_size_ = pos;
+
+    if (lseek(fd_.get(), 0, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek header failed";
+        return false;
+    }
+    if (!android::base::ReadFully(fd_, &header_, sizeof(header_))) {
+        PLOG(ERROR) << "read header failed";
+        return false;
+    }
+
+    if (header_.magic != kCowMagicNumber) {
+        LOG(ERROR) << "Header Magic corrupted. Magic: " << header_.magic
+                   << "Expected: " << kCowMagicNumber;
+        return false;
+    }
+    if (header_.header_size != sizeof(CowHeader)) {
+        LOG(ERROR) << "Header size unknown, read " << header_.header_size << ", expected "
+                   << sizeof(CowHeader);
+        return false;
+    }
+    if (header_.footer_size != sizeof(CowFooter)) {
+        LOG(ERROR) << "Footer size unknown, read " << header_.footer_size << ", expected "
+                   << sizeof(CowFooter);
+        return false;
+    }
+    if (header_.op_size != sizeof(CowOperation)) {
+        LOG(ERROR) << "Operation size unknown, read " << header_.op_size << ", expected "
+                   << sizeof(CowOperation);
+        return false;
+    }
+    if (header_.cluster_ops == 1) {
+        LOG(ERROR) << "Clusters must contain at least two operations to function.";
+        return false;
+    }
+    if (header_.op_size != sizeof(CowOperation)) {
+        LOG(ERROR) << "Operation size unknown, read " << header_.op_size << ", expected "
+                   << sizeof(CowOperation);
+        return false;
+    }
+    if (header_.cluster_ops == 1) {
+        LOG(ERROR) << "Clusters must contain at least two operations to function.";
+        return false;
+    }
+
+    if ((header_.major_version != kCowVersionMajor) ||
+        (header_.minor_version != kCowVersionMinor)) {
+        LOG(ERROR) << "Header version mismatch";
+        LOG(ERROR) << "Major version: " << header_.major_version
+                   << "Expected: " << kCowVersionMajor;
+        LOG(ERROR) << "Minor version: " << header_.minor_version
+                   << "Expected: " << kCowVersionMinor;
+        return false;
+    }
+
+    return ParseOps(label);
+}
+
+bool CowReader::ParseOps(std::optional<uint64_t> label) {
+    uint64_t pos = lseek(fd_.get(), sizeof(header_), SEEK_SET);
+    if (pos != sizeof(header_)) {
+        PLOG(ERROR) << "lseek ops failed";
+        return false;
+    }
+
+    auto ops_buffer = std::make_shared<std::vector<CowOperation>>();
+    uint64_t current_op_num = 0;
+    uint64_t cluster_ops = header_.cluster_ops ?: 1;
+    bool done = false;
+
+    // Alternating op clusters and data
+    while (!done) {
+        uint64_t to_add = std::min(cluster_ops, (fd_size_ - pos) / sizeof(CowOperation));
+        if (to_add == 0) break;
+        ops_buffer->resize(current_op_num + to_add);
+        if (!android::base::ReadFully(fd_, &ops_buffer->data()[current_op_num],
+                                      to_add * sizeof(CowOperation))) {
+            PLOG(ERROR) << "read op failed";
+            return false;
+        }
+        // Parse current cluster to find start of next cluster
+        while (current_op_num < ops_buffer->size()) {
+            auto& current_op = ops_buffer->data()[current_op_num];
+            current_op_num++;
+            pos += sizeof(CowOperation) + GetNextOpOffset(current_op, header_.cluster_ops);
+
+            if (current_op.type == kCowClusterOp) {
+                break;
+            } else if (current_op.type == kCowLabelOp) {
+                last_label_ = {current_op.source};
+
+                // If we reach the requested label, stop reading.
+                if (label && label.value() == current_op.source) {
+                    done = true;
+                    break;
+                }
+            } else if (current_op.type == kCowFooterOp) {
+                footer_.emplace();
+                CowFooter* footer = &footer_.value();
+                memcpy(&footer_->op, &current_op, sizeof(footer->op));
+                off_t offs = lseek(fd_.get(), pos, SEEK_SET);
+                if (offs < 0 || pos != static_cast<uint64_t>(offs)) {
+                    PLOG(ERROR) << "lseek next op failed";
+                    return false;
+                }
+                if (!android::base::ReadFully(fd_, &footer->data, sizeof(footer->data))) {
+                    LOG(ERROR) << "Could not read COW footer";
+                    return false;
+                }
+
+                // Drop the footer from the op stream.
+                current_op_num--;
+                done = true;
+                break;
+            }
+        }
+
+        // Position for next cluster read
+        off_t offs = lseek(fd_.get(), pos, SEEK_SET);
+        if (offs < 0 || pos != static_cast<uint64_t>(offs)) {
+            PLOG(ERROR) << "lseek next op failed";
+            return false;
+        }
+        ops_buffer->resize(current_op_num);
+    }
+
+    // To successfully parse a COW file, we need either:
+    //  (1) a label to read up to, and for that label to be found, or
+    //  (2) a valid footer.
+    if (label) {
+        if (!last_label_) {
+            LOG(ERROR) << "Did not find label " << label.value()
+                       << " while reading COW (no labels found)";
+            return false;
+        }
+        if (last_label_.value() != label.value()) {
+            LOG(ERROR) << "Did not find label " << label.value()
+                       << ", last label=" << last_label_.value();
+            return false;
+        }
+    } else if (!footer_) {
+        LOG(ERROR) << "No COW footer found";
+        return false;
+    }
+
+    uint8_t csum[32];
+    memset(csum, 0, sizeof(uint8_t) * 32);
+
+    if (footer_) {
+        if (ops_buffer->size() != footer_->op.num_ops) {
+            LOG(ERROR) << "num ops does not match";
+            return false;
+        }
+        if (ops_buffer->size() * sizeof(CowOperation) != footer_->op.ops_size) {
+            LOG(ERROR) << "ops size does not match ";
+            return false;
+        }
+        SHA256(&footer_->op, sizeof(footer_->op), footer_->data.footer_checksum);
+        if (memcmp(csum, footer_->data.ops_checksum, sizeof(csum)) != 0) {
+            LOG(ERROR) << "ops checksum does not match";
+            return false;
+        }
+        SHA256(ops_buffer.get()->data(), footer_->op.ops_size, csum);
+        if (memcmp(csum, footer_->data.ops_checksum, sizeof(csum)) != 0) {
+            LOG(ERROR) << "ops checksum does not match";
+            return false;
+        }
+    }
+
+    ops_ = ops_buffer;
+    return true;
+}
+
+void CowReader::InitializeMerge() {
+    uint64_t num_copy_ops = 0;
+
+    // Remove all the metadata operations
+    ops_->erase(std::remove_if(ops_.get()->begin(), ops_.get()->end(),
+                               [](CowOperation& op) { return IsMetadataOp(op); }),
+                ops_.get()->end());
+
+    // We will re-arrange the vector in such a way that
+    // kernel can batch merge. Ex:
+    //
+    // Existing COW format; All the copy operations
+    // are at the beginning.
+    // =======================================
+    // Copy-op-1    - cow_op->new_block = 1
+    // Copy-op-2    - cow_op->new_block = 2
+    // Copy-op-3    - cow_op->new_block = 3
+    // Replace-op-4 - cow_op->new_block = 6
+    // Replace-op-5 - cow_op->new_block = 4
+    // Replace-op-6 - cow_op->new_block = 8
+    // Replace-op-7 - cow_op->new_block = 9
+    // Zero-op-8    - cow_op->new_block = 7
+    // Zero-op-9    - cow_op->new_block = 5
+    // =======================================
+    //
+    // First find the operation which isn't a copy-op
+    // and then sort all the operations in descending order
+    // with the key being cow_op->new_block (source block)
+    //
+    // The data-structure will look like:
+    //
+    // =======================================
+    // Copy-op-1    - cow_op->new_block = 1
+    // Copy-op-2    - cow_op->new_block = 2
+    // Copy-op-3    - cow_op->new_block = 3
+    // Replace-op-7 - cow_op->new_block = 9
+    // Replace-op-6 - cow_op->new_block = 8
+    // Zero-op-8    - cow_op->new_block = 7
+    // Replace-op-4 - cow_op->new_block = 6
+    // Zero-op-9    - cow_op->new_block = 5
+    // Replace-op-5 - cow_op->new_block = 4
+    // =======================================
+    //
+    // Daemon will read the above data-structure in reverse-order
+    // when reading metadata. Thus, kernel will get the metadata
+    // in the following order:
+    //
+    // ========================================
+    // Replace-op-5 - cow_op->new_block = 4
+    // Zero-op-9    - cow_op->new_block = 5
+    // Replace-op-4 - cow_op->new_block = 6
+    // Zero-op-8    - cow_op->new_block = 7
+    // Replace-op-6 - cow_op->new_block = 8
+    // Replace-op-7 - cow_op->new_block = 9
+    // Copy-op-3    - cow_op->new_block = 3
+    // Copy-op-2    - cow_op->new_block = 2
+    // Copy-op-1    - cow_op->new_block = 1
+    // ===========================================
+    //
+    // When merging begins, kernel will start from the last
+    // metadata which was read: In the above format, Copy-op-1
+    // will be the first merge operation.
+    //
+    // Now, batching of the merge operations happens only when
+    // 1: origin block numbers in the base device are contiguous
+    // (cow_op->new_block) and,
+    // 2: cow block numbers which are assigned by daemon in ReadMetadata()
+    // are contiguous. These are monotonically increasing numbers.
+    //
+    // When both (1) and (2) are true, kernel will batch merge the operations.
+    // However, we do not want copy operations to be batch merged as
+    // a crash or system reboot during an overlapping copy can drive the device
+    // to a corrupted state. Hence, merging of copy operations should always be
+    // done as a individual 4k block. In the above case, since the
+    // cow_op->new_block numbers are contiguous, we will ensure that the
+    // cow block numbers assigned in ReadMetadata() for these respective copy
+    // operations are not contiguous forcing kernel to issue merge for each
+    // copy operations without batch merging.
+    //
+    // For all the other operations viz. Replace and Zero op, the cow block
+    // numbers assigned by daemon will be contiguous allowing kernel to batch
+    // merge.
+    //
+    // The final format after assiging COW block numbers by the daemon will
+    // look something like:
+    //
+    // =========================================================
+    // Replace-op-5 - cow_op->new_block = 4  cow-block-num = 2
+    // Zero-op-9    - cow_op->new_block = 5  cow-block-num = 3
+    // Replace-op-4 - cow_op->new_block = 6  cow-block-num = 4
+    // Zero-op-8    - cow_op->new_block = 7  cow-block-num = 5
+    // Replace-op-6 - cow_op->new_block = 8  cow-block-num = 6
+    // Replace-op-7 - cow_op->new_block = 9  cow-block-num = 7
+    // Copy-op-3    - cow_op->new_block = 3  cow-block-num = 9
+    // Copy-op-2    - cow_op->new_block = 2  cow-block-num = 11
+    // Copy-op-1    - cow_op->new_block = 1  cow-block-num = 13
+    // ==========================================================
+    //
+    // Merge sequence will look like:
+    //
+    // Merge-1 - Copy-op-1
+    // Merge-2 - Copy-op-2
+    // Merge-3 - Copy-op-3
+    // Merge-4 - Batch-merge {Replace-op-7, Replace-op-6, Zero-op-8,
+    //                        Replace-op-4, Zero-op-9, Replace-op-5 }
+    //==============================================================
+
+    for (uint64_t i = 0; i < ops_->size(); i++) {
+        auto& current_op = ops_->data()[i];
+        if (current_op.type != kCowCopyOp) {
+            break;
+        }
+        num_copy_ops += 1;
+    }
+
+    std::sort(ops_.get()->begin() + num_copy_ops, ops_.get()->end(),
+              [](CowOperation& op1, CowOperation& op2) -> bool {
+                  return op1.new_block > op2.new_block;
+              });
+
+    if (header_.num_merge_ops > 0) {
+        CHECK(ops_->size() >= header_.num_merge_ops);
+        ops_->erase(ops_.get()->begin(), ops_.get()->begin() + header_.num_merge_ops);
+    }
+}
+
+bool CowReader::GetHeader(CowHeader* header) {
+    *header = header_;
+    return true;
+}
+
+bool CowReader::GetFooter(CowFooter* footer) {
+    if (!footer_) return false;
+    *footer = footer_.value();
+    return true;
+}
+
+bool CowReader::GetLastLabel(uint64_t* label) {
+    if (!last_label_) return false;
+    *label = last_label_.value();
+    return true;
+}
+
+class CowOpIter final : public ICowOpIter {
+  public:
+    CowOpIter(std::shared_ptr<std::vector<CowOperation>>& ops);
+
+    bool Done() override;
+    const CowOperation& Get() override;
+    void Next() override;
+
+  private:
+    std::shared_ptr<std::vector<CowOperation>> ops_;
+    std::vector<CowOperation>::iterator op_iter_;
+};
+
+CowOpIter::CowOpIter(std::shared_ptr<std::vector<CowOperation>>& ops) {
+    ops_ = ops;
+    op_iter_ = ops_.get()->begin();
+}
+
+bool CowOpIter::Done() {
+    return op_iter_ == ops_.get()->end();
+}
+
+void CowOpIter::Next() {
+    CHECK(!Done());
+    op_iter_++;
+}
+
+const CowOperation& CowOpIter::Get() {
+    CHECK(!Done());
+    return (*op_iter_);
+}
+
+class CowOpReverseIter final : public ICowOpReverseIter {
+  public:
+    explicit CowOpReverseIter(std::shared_ptr<std::vector<CowOperation>> ops);
+
+    bool Done() override;
+    const CowOperation& Get() override;
+    void Next() override;
+
+  private:
+    std::shared_ptr<std::vector<CowOperation>> ops_;
+    std::vector<CowOperation>::reverse_iterator op_riter_;
+};
+
+CowOpReverseIter::CowOpReverseIter(std::shared_ptr<std::vector<CowOperation>> ops) {
+    ops_ = ops;
+    op_riter_ = ops_.get()->rbegin();
+}
+
+bool CowOpReverseIter::Done() {
+    return op_riter_ == ops_.get()->rend();
+}
+
+void CowOpReverseIter::Next() {
+    CHECK(!Done());
+    op_riter_++;
+}
+
+const CowOperation& CowOpReverseIter::Get() {
+    CHECK(!Done());
+    return (*op_riter_);
+}
+
+std::unique_ptr<ICowOpIter> CowReader::GetOpIter() {
+    return std::make_unique<CowOpIter>(ops_);
+}
+
+std::unique_ptr<ICowOpReverseIter> CowReader::GetRevOpIter() {
+    return std::make_unique<CowOpReverseIter>(ops_);
+}
+
+bool CowReader::GetRawBytes(uint64_t offset, void* buffer, size_t len, size_t* read) {
+    // Validate the offset, taking care to acknowledge possible overflow of offset+len.
+    if (offset < sizeof(header_) || offset >= fd_size_ - sizeof(CowFooter) || len >= fd_size_ ||
+        offset + len > fd_size_ - sizeof(CowFooter)) {
+        LOG(ERROR) << "invalid data offset: " << offset << ", " << len << " bytes";
+        return false;
+    }
+    if (lseek(fd_.get(), offset, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek to read raw bytes failed";
+        return false;
+    }
+    ssize_t rv = TEMP_FAILURE_RETRY(::read(fd_.get(), buffer, len));
+    if (rv < 0) {
+        PLOG(ERROR) << "read failed";
+        return false;
+    }
+    *read = rv;
+    return true;
+}
+
+class CowDataStream final : public IByteStream {
+  public:
+    CowDataStream(CowReader* reader, uint64_t offset, size_t data_length)
+        : reader_(reader), offset_(offset), data_length_(data_length) {
+        remaining_ = data_length_;
+    }
+
+    bool Read(void* buffer, size_t length, size_t* read) override {
+        size_t to_read = std::min(length, remaining_);
+        if (!to_read) {
+            *read = 0;
+            return true;
+        }
+        if (!reader_->GetRawBytes(offset_, buffer, to_read, read)) {
+            return false;
+        }
+        offset_ += *read;
+        remaining_ -= *read;
+        return true;
+    }
+
+    size_t Size() const override { return data_length_; }
+
+  private:
+    CowReader* reader_;
+    uint64_t offset_;
+    size_t data_length_;
+    size_t remaining_;
+};
+
+bool CowReader::ReadData(const CowOperation& op, IByteSink* sink) {
+    std::unique_ptr<IDecompressor> decompressor;
+    switch (op.compression) {
+        case kCowCompressNone:
+            decompressor = IDecompressor::Uncompressed();
+            break;
+        case kCowCompressGz:
+            decompressor = IDecompressor::Gz();
+            break;
+        case kCowCompressBrotli:
+            decompressor = IDecompressor::Brotli();
+            break;
+        default:
+            LOG(ERROR) << "Unknown compression type: " << op.compression;
+            return false;
+    }
+
+    CowDataStream stream(this, op.source, op.data_length);
+    decompressor->set_stream(&stream);
+    decompressor->set_sink(sink);
+    return decompressor->Decompress(header_.block_size);
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/cow_snapuserd_test.cpp b/fs_mgr/libsnapshot/cow_snapuserd_test.cpp
new file mode 100644
index 0000000..7fa23db
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_snapuserd_test.cpp
@@ -0,0 +1,475 @@
+// Copyright (C) 2018 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.
+
+#include <fcntl.h>
+#include <linux/fs.h>
+#include <linux/memfd.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <chrono>
+#include <iostream>
+#include <memory>
+#include <string_view>
+
+#include <android-base/file.h>
+#include <android-base/unique_fd.h>
+#include <fs_mgr/file_wait.h>
+#include <gtest/gtest.h>
+#include <libdm/dm.h>
+#include <libdm/loop_control.h>
+#include <libsnapshot/cow_writer.h>
+#include <libsnapshot/snapuserd_client.h>
+#include <storage_literals/storage_literals.h>
+
+namespace android {
+namespace snapshot {
+
+using namespace android::storage_literals;
+using android::base::unique_fd;
+using LoopDevice = android::dm::LoopDevice;
+using namespace std::chrono_literals;
+using namespace android::dm;
+using namespace std;
+
+static constexpr char kSnapuserdSocketTest[] = "snapuserdTest";
+
+class TempDevice {
+  public:
+    TempDevice(const std::string& name, const DmTable& table)
+        : dm_(DeviceMapper::Instance()), name_(name), valid_(false) {
+        valid_ = dm_.CreateDevice(name, table, &path_, std::chrono::seconds(5));
+    }
+    TempDevice(TempDevice&& other) noexcept
+        : dm_(other.dm_), name_(other.name_), path_(other.path_), valid_(other.valid_) {
+        other.valid_ = false;
+    }
+    ~TempDevice() {
+        if (valid_) {
+            dm_.DeleteDevice(name_);
+        }
+    }
+    bool Destroy() {
+        if (!valid_) {
+            return false;
+        }
+        valid_ = false;
+        return dm_.DeleteDevice(name_);
+    }
+    const std::string& path() const { return path_; }
+    const std::string& name() const { return name_; }
+    bool valid() const { return valid_; }
+
+    TempDevice(const TempDevice&) = delete;
+    TempDevice& operator=(const TempDevice&) = delete;
+
+    TempDevice& operator=(TempDevice&& other) noexcept {
+        name_ = other.name_;
+        valid_ = other.valid_;
+        other.valid_ = false;
+        return *this;
+    }
+
+  private:
+    DeviceMapper& dm_;
+    std::string name_;
+    std::string path_;
+    bool valid_;
+};
+
+class CowSnapuserdTest final {
+  public:
+    bool Setup();
+    bool Merge();
+    void ValidateMerge();
+    void ReadSnapshotDeviceAndValidate();
+    void Shutdown();
+    void MergeInterrupt();
+
+    std::string snapshot_dev() const { return snapshot_dev_->path(); }
+
+    static const uint64_t kSectorSize = 512;
+
+  private:
+    void SetupImpl();
+
+    void MergeImpl();
+    void SimulateDaemonRestart();
+    void StartMerge();
+
+    void CreateCowDevice();
+    void CreateBaseDevice();
+    void InitCowDevice();
+    void SetDeviceControlName();
+    void InitDaemon();
+    void CreateDmUserDevice();
+    void StartSnapuserdDaemon();
+    void CreateSnapshotDevice();
+    unique_fd CreateTempFile(const std::string& name, size_t size);
+
+    unique_ptr<LoopDevice> base_loop_;
+    unique_ptr<TempDevice> dmuser_dev_;
+    unique_ptr<TempDevice> snapshot_dev_;
+
+    std::string system_device_ctrl_name_;
+    std::string system_device_name_;
+
+    unique_fd base_fd_;
+    std::unique_ptr<TemporaryFile> cow_system_;
+    std::unique_ptr<SnapuserdClient> client_;
+    std::unique_ptr<uint8_t[]> orig_buffer_;
+    std::unique_ptr<uint8_t[]> merged_buffer_;
+    bool setup_ok_ = false;
+    bool merge_ok_ = false;
+    size_t size_ = 50_MiB;
+    int cow_num_sectors_;
+    int total_base_size_;
+};
+
+unique_fd CowSnapuserdTest::CreateTempFile(const std::string& name, size_t size) {
+    unique_fd fd(syscall(__NR_memfd_create, name.c_str(), MFD_ALLOW_SEALING));
+    if (fd < 0) {
+        return {};
+    }
+    if (size) {
+        if (ftruncate(fd, size) < 0) {
+            perror("ftruncate");
+            return {};
+        }
+        if (fcntl(fd, F_ADD_SEALS, F_SEAL_GROW | F_SEAL_SHRINK) < 0) {
+            perror("fcntl");
+            return {};
+        }
+    }
+    return fd;
+}
+
+void CowSnapuserdTest::Shutdown() {
+    ASSERT_TRUE(snapshot_dev_->Destroy());
+    ASSERT_TRUE(dmuser_dev_->Destroy());
+
+    auto misc_device = "/dev/dm-user/" + system_device_ctrl_name_;
+    ASSERT_TRUE(client_->WaitForDeviceDelete(system_device_ctrl_name_));
+    ASSERT_TRUE(android::fs_mgr::WaitForFileDeleted(misc_device, 10s));
+    ASSERT_TRUE(client_->DetachSnapuserd());
+}
+
+bool CowSnapuserdTest::Setup() {
+    SetupImpl();
+    return setup_ok_;
+}
+
+void CowSnapuserdTest::StartSnapuserdDaemon() {
+    pid_t pid = fork();
+    ASSERT_GE(pid, 0);
+    if (pid == 0) {
+        std::string arg0 = "/system/bin/snapuserd";
+        std::string arg1 = "-socket="s + kSnapuserdSocketTest;
+        char* const argv[] = {arg0.data(), arg1.data(), nullptr};
+        ASSERT_GE(execv(arg0.c_str(), argv), 0);
+    } else {
+        client_ = SnapuserdClient::Connect(kSnapuserdSocketTest, 10s);
+        ASSERT_NE(client_, nullptr);
+    }
+}
+
+void CowSnapuserdTest::CreateBaseDevice() {
+    unique_fd rnd_fd;
+
+    total_base_size_ = (size_ * 4);
+    base_fd_ = CreateTempFile("base_device", total_base_size_);
+    ASSERT_GE(base_fd_, 0);
+
+    rnd_fd.reset(open("/dev/random", O_RDONLY));
+    ASSERT_TRUE(rnd_fd > 0);
+
+    std::unique_ptr<uint8_t[]> random_buffer = std::make_unique<uint8_t[]>(1_MiB);
+
+    for (size_t j = 0; j < ((total_base_size_) / 1_MiB); j++) {
+        ASSERT_EQ(ReadFullyAtOffset(rnd_fd, (char*)random_buffer.get(), 1_MiB, 0), true);
+        ASSERT_EQ(android::base::WriteFully(base_fd_, random_buffer.get(), 1_MiB), true);
+    }
+
+    ASSERT_EQ(lseek(base_fd_, 0, SEEK_SET), 0);
+
+    base_loop_ = std::make_unique<LoopDevice>(base_fd_, 10s);
+    ASSERT_TRUE(base_loop_->valid());
+}
+
+void CowSnapuserdTest::ReadSnapshotDeviceAndValidate() {
+    unique_fd snapshot_fd(open(snapshot_dev_->path().c_str(), O_RDONLY));
+    ASSERT_TRUE(snapshot_fd > 0);
+
+    std::unique_ptr<uint8_t[]> snapuserd_buffer = std::make_unique<uint8_t[]>(size_);
+
+    // COPY
+    loff_t offset = 0;
+    ASSERT_EQ(ReadFullyAtOffset(snapshot_fd, snapuserd_buffer.get(), size_, offset), true);
+    ASSERT_EQ(memcmp(snapuserd_buffer.get(), orig_buffer_.get(), size_), 0);
+
+    // REPLACE
+    offset += size_;
+    ASSERT_EQ(ReadFullyAtOffset(snapshot_fd, snapuserd_buffer.get(), size_, offset), true);
+    ASSERT_EQ(memcmp(snapuserd_buffer.get(), (char*)orig_buffer_.get() + size_, size_), 0);
+
+    // ZERO
+    offset += size_;
+    ASSERT_EQ(ReadFullyAtOffset(snapshot_fd, snapuserd_buffer.get(), size_, offset), true);
+    ASSERT_EQ(memcmp(snapuserd_buffer.get(), (char*)orig_buffer_.get() + (size_ * 2), size_), 0);
+
+    // REPLACE
+    offset += size_;
+    ASSERT_EQ(ReadFullyAtOffset(snapshot_fd, snapuserd_buffer.get(), size_, offset), true);
+    ASSERT_EQ(memcmp(snapuserd_buffer.get(), (char*)orig_buffer_.get() + (size_ * 3), size_), 0);
+}
+
+void CowSnapuserdTest::CreateCowDevice() {
+    unique_fd rnd_fd;
+    loff_t offset = 0;
+
+    std::string path = android::base::GetExecutableDirectory();
+    cow_system_ = std::make_unique<TemporaryFile>(path);
+
+    rnd_fd.reset(open("/dev/random", O_RDONLY));
+    ASSERT_TRUE(rnd_fd > 0);
+
+    std::unique_ptr<uint8_t[]> random_buffer_1_ = std::make_unique<uint8_t[]>(size_);
+
+    // Fill random data
+    for (size_t j = 0; j < (size_ / 1_MiB); j++) {
+        ASSERT_EQ(ReadFullyAtOffset(rnd_fd, (char*)random_buffer_1_.get() + offset, 1_MiB, 0),
+                  true);
+
+        offset += 1_MiB;
+    }
+
+    CowOptions options;
+    options.compression = "gz";
+    CowWriter writer(options);
+
+    ASSERT_TRUE(writer.Initialize(cow_system_->fd));
+
+    size_t num_blocks = size_ / options.block_size;
+    size_t blk_end_copy = num_blocks * 2;
+    size_t source_blk = num_blocks - 1;
+    size_t blk_src_copy = blk_end_copy - 1;
+
+    size_t x = num_blocks;
+    while (1) {
+        ASSERT_TRUE(writer.AddCopy(source_blk, blk_src_copy));
+        x -= 1;
+        if (x == 0) {
+            break;
+        }
+        source_blk -= 1;
+        blk_src_copy -= 1;
+    }
+
+    source_blk = num_blocks;
+    blk_src_copy = blk_end_copy;
+
+    ASSERT_TRUE(writer.AddRawBlocks(source_blk, random_buffer_1_.get(), size_));
+
+    size_t blk_zero_copy_start = source_blk + num_blocks;
+    size_t blk_zero_copy_end = blk_zero_copy_start + num_blocks;
+
+    ASSERT_TRUE(writer.AddZeroBlocks(blk_zero_copy_start, num_blocks));
+
+    size_t blk_random2_replace_start = blk_zero_copy_end;
+
+    ASSERT_TRUE(writer.AddRawBlocks(blk_random2_replace_start, random_buffer_1_.get(), size_));
+
+    // Flush operations
+    ASSERT_TRUE(writer.Finalize());
+    // Construct the buffer required for validation
+    orig_buffer_ = std::make_unique<uint8_t[]>(total_base_size_);
+    std::string zero_buffer(size_, 0);
+    ASSERT_EQ(android::base::ReadFullyAtOffset(base_fd_, orig_buffer_.get(), size_, size_), true);
+    memcpy((char*)orig_buffer_.get() + size_, random_buffer_1_.get(), size_);
+    memcpy((char*)orig_buffer_.get() + (size_ * 2), (void*)zero_buffer.c_str(), size_);
+    memcpy((char*)orig_buffer_.get() + (size_ * 3), random_buffer_1_.get(), size_);
+}
+
+void CowSnapuserdTest::InitCowDevice() {
+    cow_num_sectors_ = client_->InitDmUserCow(system_device_ctrl_name_, cow_system_->path,
+                                              base_loop_->device());
+    ASSERT_NE(cow_num_sectors_, 0);
+}
+
+void CowSnapuserdTest::SetDeviceControlName() {
+    system_device_name_.clear();
+    system_device_ctrl_name_.clear();
+
+    std::string str(cow_system_->path);
+    std::size_t found = str.find_last_of("/\\");
+    ASSERT_NE(found, std::string::npos);
+    system_device_name_ = str.substr(found + 1);
+
+    system_device_ctrl_name_ = system_device_name_ + "-ctrl";
+}
+
+void CowSnapuserdTest::CreateDmUserDevice() {
+    DmTable dmuser_table;
+    ASSERT_TRUE(dmuser_table.AddTarget(
+            std::make_unique<DmTargetUser>(0, cow_num_sectors_, system_device_ctrl_name_)));
+    ASSERT_TRUE(dmuser_table.valid());
+
+    dmuser_dev_ = std::make_unique<TempDevice>(system_device_name_, dmuser_table);
+    ASSERT_TRUE(dmuser_dev_->valid());
+    ASSERT_FALSE(dmuser_dev_->path().empty());
+
+    auto misc_device = "/dev/dm-user/" + system_device_ctrl_name_;
+    ASSERT_TRUE(android::fs_mgr::WaitForFile(misc_device, 10s));
+}
+
+void CowSnapuserdTest::InitDaemon() {
+    bool ok = client_->AttachDmUser(system_device_ctrl_name_);
+    ASSERT_TRUE(ok);
+}
+
+void CowSnapuserdTest::CreateSnapshotDevice() {
+    DmTable snap_table;
+    ASSERT_TRUE(snap_table.AddTarget(std::make_unique<DmTargetSnapshot>(
+            0, total_base_size_ / kSectorSize, base_loop_->device(), dmuser_dev_->path(),
+            SnapshotStorageMode::Persistent, 8)));
+    ASSERT_TRUE(snap_table.valid());
+
+    snap_table.set_readonly(true);
+
+    snapshot_dev_ = std::make_unique<TempDevice>("cowsnapuserd-test-dm-snapshot", snap_table);
+    ASSERT_TRUE(snapshot_dev_->valid());
+    ASSERT_FALSE(snapshot_dev_->path().empty());
+}
+
+void CowSnapuserdTest::SetupImpl() {
+    CreateBaseDevice();
+    CreateCowDevice();
+
+    SetDeviceControlName();
+
+    StartSnapuserdDaemon();
+    InitCowDevice();
+
+    CreateDmUserDevice();
+    InitDaemon();
+
+    CreateSnapshotDevice();
+    setup_ok_ = true;
+}
+
+bool CowSnapuserdTest::Merge() {
+    MergeImpl();
+    return merge_ok_;
+}
+
+void CowSnapuserdTest::StartMerge() {
+    DmTable merge_table;
+    ASSERT_TRUE(merge_table.AddTarget(std::make_unique<DmTargetSnapshot>(
+            0, total_base_size_ / kSectorSize, base_loop_->device(), dmuser_dev_->path(),
+            SnapshotStorageMode::Merge, 8)));
+    ASSERT_TRUE(merge_table.valid());
+    ASSERT_EQ(total_base_size_ / kSectorSize, merge_table.num_sectors());
+
+    DeviceMapper& dm = DeviceMapper::Instance();
+    ASSERT_TRUE(dm.LoadTableAndActivate("cowsnapuserd-test-dm-snapshot", merge_table));
+}
+
+void CowSnapuserdTest::MergeImpl() {
+    StartMerge();
+    DeviceMapper& dm = DeviceMapper::Instance();
+
+    while (true) {
+        vector<DeviceMapper::TargetInfo> status;
+        ASSERT_TRUE(dm.GetTableStatus("cowsnapuserd-test-dm-snapshot", &status));
+        ASSERT_EQ(status.size(), 1);
+        ASSERT_EQ(strncmp(status[0].spec.target_type, "snapshot-merge", strlen("snapshot-merge")),
+                  0);
+
+        DmTargetSnapshot::Status merge_status;
+        ASSERT_TRUE(DmTargetSnapshot::ParseStatusText(status[0].data, &merge_status));
+        ASSERT_TRUE(merge_status.error.empty());
+        if (merge_status.sectors_allocated == merge_status.metadata_sectors) {
+            break;
+        }
+
+        std::this_thread::sleep_for(250ms);
+    }
+
+    merge_ok_ = true;
+}
+
+void CowSnapuserdTest::ValidateMerge() {
+    merged_buffer_ = std::make_unique<uint8_t[]>(total_base_size_);
+    ASSERT_EQ(android::base::ReadFullyAtOffset(base_fd_, merged_buffer_.get(), total_base_size_, 0),
+              true);
+    ASSERT_EQ(memcmp(merged_buffer_.get(), orig_buffer_.get(), total_base_size_), 0);
+}
+
+void CowSnapuserdTest::SimulateDaemonRestart() {
+    Shutdown();
+    SetDeviceControlName();
+    StartSnapuserdDaemon();
+    InitCowDevice();
+    CreateDmUserDevice();
+    InitDaemon();
+    CreateSnapshotDevice();
+}
+
+void CowSnapuserdTest::MergeInterrupt() {
+    StartMerge();
+    std::this_thread::sleep_for(4s);
+    SimulateDaemonRestart();
+
+    StartMerge();
+    std::this_thread::sleep_for(3s);
+    SimulateDaemonRestart();
+
+    StartMerge();
+    std::this_thread::sleep_for(3s);
+    SimulateDaemonRestart();
+
+    StartMerge();
+    std::this_thread::sleep_for(1s);
+    SimulateDaemonRestart();
+
+    ASSERT_TRUE(Merge());
+}
+
+TEST(Snapuserd_Test, Snapshot_Merge_Resume) {
+    CowSnapuserdTest harness;
+    ASSERT_TRUE(harness.Setup());
+    harness.MergeInterrupt();
+    harness.ValidateMerge();
+    harness.Shutdown();
+}
+
+TEST(Snapuserd_Test, Snapshot) {
+    CowSnapuserdTest harness;
+    ASSERT_TRUE(harness.Setup());
+    harness.ReadSnapshotDeviceAndValidate();
+    ASSERT_TRUE(harness.Merge());
+    harness.ValidateMerge();
+    harness.Shutdown();
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/fs_mgr/libsnapshot/cow_writer.cpp b/fs_mgr/libsnapshot/cow_writer.cpp
new file mode 100644
index 0000000..c1a5f32
--- /dev/null
+++ b/fs_mgr/libsnapshot/cow_writer.cpp
@@ -0,0 +1,528 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <limits>
+#include <queue>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include <brotli/encode.h>
+#include <libsnapshot/cow_reader.h>
+#include <libsnapshot/cow_writer.h>
+#include <zlib.h>
+
+namespace android {
+namespace snapshot {
+
+static_assert(sizeof(off_t) == sizeof(uint64_t));
+
+using android::base::borrowed_fd;
+using android::base::unique_fd;
+
+bool ICowWriter::AddCopy(uint64_t new_block, uint64_t old_block) {
+    if (!ValidateNewBlock(new_block)) {
+        return false;
+    }
+    return EmitCopy(new_block, old_block);
+}
+
+bool ICowWriter::AddRawBlocks(uint64_t new_block_start, const void* data, size_t size) {
+    if (size % options_.block_size != 0) {
+        LOG(ERROR) << "AddRawBlocks: size " << size << " is not a multiple of "
+                   << options_.block_size;
+        return false;
+    }
+
+    uint64_t num_blocks = size / options_.block_size;
+    uint64_t last_block = new_block_start + num_blocks - 1;
+    if (!ValidateNewBlock(last_block)) {
+        return false;
+    }
+    return EmitRawBlocks(new_block_start, data, size);
+}
+
+bool ICowWriter::AddZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) {
+    uint64_t last_block = new_block_start + num_blocks - 1;
+    if (!ValidateNewBlock(last_block)) {
+        return false;
+    }
+    return EmitZeroBlocks(new_block_start, num_blocks);
+}
+
+bool ICowWriter::AddLabel(uint64_t label) {
+    return EmitLabel(label);
+}
+
+bool ICowWriter::ValidateNewBlock(uint64_t new_block) {
+    if (options_.max_blocks && new_block >= options_.max_blocks.value()) {
+        LOG(ERROR) << "New block " << new_block << " exceeds maximum block count "
+                   << options_.max_blocks.value();
+        return false;
+    }
+    return true;
+}
+
+CowWriter::CowWriter(const CowOptions& options) : ICowWriter(options), fd_(-1) {
+    SetupHeaders();
+}
+
+void CowWriter::SetupHeaders() {
+    header_ = {};
+    header_.magic = kCowMagicNumber;
+    header_.major_version = kCowVersionMajor;
+    header_.minor_version = kCowVersionMinor;
+    header_.header_size = sizeof(CowHeader);
+    header_.footer_size = sizeof(CowFooter);
+    header_.op_size = sizeof(CowOperation);
+    header_.block_size = options_.block_size;
+    header_.num_merge_ops = 0;
+    header_.cluster_ops = options_.cluster_ops;
+    footer_ = {};
+    footer_.op.data_length = 64;
+    footer_.op.type = kCowFooterOp;
+}
+
+bool CowWriter::ParseOptions() {
+    if (options_.compression == "gz") {
+        compression_ = kCowCompressGz;
+    } else if (options_.compression == "brotli") {
+        compression_ = kCowCompressBrotli;
+    } else if (options_.compression == "none") {
+        compression_ = kCowCompressNone;
+    } else if (!options_.compression.empty()) {
+        LOG(ERROR) << "unrecognized compression: " << options_.compression;
+        return false;
+    }
+    if (options_.cluster_ops == 1) {
+        LOG(ERROR) << "Clusters must contain at least two operations to function.";
+        return false;
+    }
+    return true;
+}
+
+bool CowWriter::SetFd(android::base::borrowed_fd fd) {
+    if (fd.get() < 0) {
+        owned_fd_.reset(open("/dev/null", O_RDWR | O_CLOEXEC));
+        if (owned_fd_ < 0) {
+            PLOG(ERROR) << "open /dev/null failed";
+            return false;
+        }
+        fd_ = owned_fd_;
+        is_dev_null_ = true;
+    } else {
+        fd_ = fd;
+
+        struct stat stat;
+        if (fstat(fd.get(), &stat) < 0) {
+            PLOG(ERROR) << "fstat failed";
+            return false;
+        }
+        is_block_device_ = S_ISBLK(stat.st_mode);
+    }
+    return true;
+}
+
+void CowWriter::InitializeMerge(borrowed_fd fd, CowHeader* header) {
+    fd_ = fd;
+    memcpy(&header_, header, sizeof(CowHeader));
+    merge_in_progress_ = true;
+}
+
+bool CowWriter::Initialize(unique_fd&& fd) {
+    owned_fd_ = std::move(fd);
+    return Initialize(borrowed_fd{owned_fd_});
+}
+
+bool CowWriter::Initialize(borrowed_fd fd) {
+    if (!SetFd(fd) || !ParseOptions()) {
+        return false;
+    }
+
+    return OpenForWrite();
+}
+
+bool CowWriter::InitializeAppend(android::base::unique_fd&& fd, uint64_t label) {
+    owned_fd_ = std::move(fd);
+    return InitializeAppend(android::base::borrowed_fd{owned_fd_}, label);
+}
+
+bool CowWriter::InitializeAppend(android::base::borrowed_fd fd, uint64_t label) {
+    if (!SetFd(fd) || !ParseOptions()) {
+        return false;
+    }
+
+    return OpenForAppend(label);
+}
+
+void CowWriter::InitPos() {
+    next_op_pos_ = sizeof(header_);
+    cluster_size_ = header_.cluster_ops * sizeof(CowOperation);
+    if (header_.cluster_ops) {
+        next_data_pos_ = next_op_pos_ + cluster_size_;
+    } else {
+        next_data_pos_ = next_op_pos_ + sizeof(CowOperation);
+    }
+    ops_.clear();
+    current_cluster_size_ = 0;
+    current_data_size_ = 0;
+}
+
+bool CowWriter::OpenForWrite() {
+    // This limitation is tied to the data field size in CowOperation.
+    if (header_.block_size > std::numeric_limits<uint16_t>::max()) {
+        LOG(ERROR) << "Block size is too large";
+        return false;
+    }
+
+    if (lseek(fd_.get(), 0, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return false;
+    }
+
+    // Headers are not complete, but this ensures the file is at the right
+    // position.
+    if (!android::base::WriteFully(fd_, &header_, sizeof(header_))) {
+        PLOG(ERROR) << "write failed";
+        return false;
+    }
+
+    InitPos();
+    return true;
+}
+
+bool CowWriter::OpenForAppend(uint64_t label) {
+    auto reader = std::make_unique<CowReader>();
+    std::queue<CowOperation> toAdd;
+
+    if (!reader->Parse(fd_, {label}) || !reader->GetHeader(&header_)) {
+        return false;
+    }
+
+    options_.block_size = header_.block_size;
+    options_.cluster_ops = header_.cluster_ops;
+
+    // Reset this, since we're going to reimport all operations.
+    footer_.op.num_ops = 0;
+    InitPos();
+
+    auto iter = reader->GetOpIter();
+
+    while (!iter->Done()) {
+        AddOperation(iter->Get());
+        iter->Next();
+    }
+
+    // Free reader so we own the descriptor position again.
+    reader = nullptr;
+
+    // Remove excess data
+    if (!Truncate(next_op_pos_)) {
+        return false;
+    }
+    if (lseek(fd_.get(), next_op_pos_, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return false;
+    }
+    return true;
+}
+
+bool CowWriter::EmitCopy(uint64_t new_block, uint64_t old_block) {
+    CHECK(!merge_in_progress_);
+    CowOperation op = {};
+    op.type = kCowCopyOp;
+    op.new_block = new_block;
+    op.source = old_block;
+    return WriteOperation(op);
+}
+
+bool CowWriter::EmitRawBlocks(uint64_t new_block_start, const void* data, size_t size) {
+    const uint8_t* iter = reinterpret_cast<const uint8_t*>(data);
+    CHECK(!merge_in_progress_);
+    for (size_t i = 0; i < size / header_.block_size; i++) {
+        CowOperation op = {};
+        op.type = kCowReplaceOp;
+        op.new_block = new_block_start + i;
+        op.source = next_data_pos_;
+
+        if (compression_) {
+            auto data = Compress(iter, header_.block_size);
+            if (data.empty()) {
+                PLOG(ERROR) << "AddRawBlocks: compression failed";
+                return false;
+            }
+            if (data.size() > std::numeric_limits<uint16_t>::max()) {
+                LOG(ERROR) << "Compressed block is too large: " << data.size() << " bytes";
+                return false;
+            }
+            op.compression = compression_;
+            op.data_length = static_cast<uint16_t>(data.size());
+
+            if (!WriteOperation(op, data.data(), data.size())) {
+                PLOG(ERROR) << "AddRawBlocks: write failed";
+                return false;
+            }
+        } else {
+            op.data_length = static_cast<uint16_t>(header_.block_size);
+            if (!WriteOperation(op, iter, header_.block_size)) {
+                PLOG(ERROR) << "AddRawBlocks: write failed";
+                return false;
+            }
+        }
+
+        iter += header_.block_size;
+    }
+    return true;
+}
+
+bool CowWriter::EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) {
+    CHECK(!merge_in_progress_);
+    for (uint64_t i = 0; i < num_blocks; i++) {
+        CowOperation op = {};
+        op.type = kCowZeroOp;
+        op.new_block = new_block_start + i;
+        op.source = 0;
+        WriteOperation(op);
+    }
+    return true;
+}
+
+bool CowWriter::EmitLabel(uint64_t label) {
+    CHECK(!merge_in_progress_);
+    CowOperation op = {};
+    op.type = kCowLabelOp;
+    op.source = label;
+    return WriteOperation(op) && Sync();
+}
+
+bool CowWriter::EmitCluster() {
+    CowOperation op = {};
+    op.type = kCowClusterOp;
+    // Next cluster starts after remainder of current cluster and the next data block.
+    op.source = current_data_size_ + cluster_size_ - current_cluster_size_ - sizeof(CowOperation);
+    return WriteOperation(op);
+}
+
+std::basic_string<uint8_t> CowWriter::Compress(const void* data, size_t length) {
+    switch (compression_) {
+        case kCowCompressGz: {
+            auto bound = compressBound(length);
+            auto buffer = std::make_unique<uint8_t[]>(bound);
+
+            uLongf dest_len = bound;
+            auto rv = compress2(buffer.get(), &dest_len, reinterpret_cast<const Bytef*>(data),
+                                length, Z_BEST_COMPRESSION);
+            if (rv != Z_OK) {
+                LOG(ERROR) << "compress2 returned: " << rv;
+                return {};
+            }
+            return std::basic_string<uint8_t>(buffer.get(), dest_len);
+        }
+        case kCowCompressBrotli: {
+            auto bound = BrotliEncoderMaxCompressedSize(length);
+            if (!bound) {
+                LOG(ERROR) << "BrotliEncoderMaxCompressedSize returned 0";
+                return {};
+            }
+            auto buffer = std::make_unique<uint8_t[]>(bound);
+
+            size_t encoded_size = bound;
+            auto rv = BrotliEncoderCompress(
+                    BROTLI_DEFAULT_QUALITY, BROTLI_DEFAULT_WINDOW, BROTLI_DEFAULT_MODE, length,
+                    reinterpret_cast<const uint8_t*>(data), &encoded_size, buffer.get());
+            if (!rv) {
+                LOG(ERROR) << "BrotliEncoderCompress failed";
+                return {};
+            }
+            return std::basic_string<uint8_t>(buffer.get(), encoded_size);
+        }
+        default:
+            LOG(ERROR) << "unhandled compression type: " << compression_;
+            break;
+    }
+    return {};
+}
+
+// TODO: Fix compilation issues when linking libcrypto library
+// when snapuserd is compiled as part of ramdisk.
+static void SHA256(const void*, size_t, uint8_t[]) {
+#if 0
+    SHA256_CTX c;
+    SHA256_Init(&c);
+    SHA256_Update(&c, data, length);
+    SHA256_Final(out, &c);
+#endif
+}
+
+bool CowWriter::Finalize() {
+    auto continue_cluster_size = current_cluster_size_;
+    auto continue_data_size = current_data_size_;
+    auto continue_data_pos = next_data_pos_;
+    auto continue_op_pos = next_op_pos_;
+    auto continue_size = ops_.size();
+    bool extra_cluster = false;
+
+    // Footer should be at the end of a file, so if there is data after the current block, end it
+    // and start a new cluster.
+    if (cluster_size_ && current_data_size_ > 0) {
+        EmitCluster();
+        extra_cluster = true;
+    }
+
+    footer_.op.ops_size = ops_.size();
+    if (lseek(fd_.get(), next_op_pos_, SEEK_SET) < 0) {
+        PLOG(ERROR) << "Failed to seek to footer position.";
+        return false;
+    }
+    memset(&footer_.data.ops_checksum, 0, sizeof(uint8_t) * 32);
+    memset(&footer_.data.footer_checksum, 0, sizeof(uint8_t) * 32);
+
+    SHA256(ops_.data(), ops_.size(), footer_.data.ops_checksum);
+    SHA256(&footer_.op, sizeof(footer_.op), footer_.data.footer_checksum);
+    // Write out footer at end of file
+    if (!android::base::WriteFully(fd_, reinterpret_cast<const uint8_t*>(&footer_),
+                                   sizeof(footer_))) {
+        PLOG(ERROR) << "write footer failed";
+        return false;
+    }
+
+    // Reposition for additional Writing
+    if (extra_cluster) {
+        current_cluster_size_ = continue_cluster_size;
+        current_data_size_ = continue_data_size;
+        next_data_pos_ = continue_data_pos;
+        next_op_pos_ = continue_op_pos;
+        ops_.resize(continue_size);
+    }
+
+    return Sync();
+}
+
+uint64_t CowWriter::GetCowSize() {
+    if (current_data_size_ > 0) {
+        return next_data_pos_ + sizeof(footer_);
+    } else {
+        return next_op_pos_ + sizeof(footer_);
+    }
+}
+
+bool CowWriter::GetDataPos(uint64_t* pos) {
+    off_t offs = lseek(fd_.get(), 0, SEEK_CUR);
+    if (offs < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return false;
+    }
+    *pos = offs;
+    return true;
+}
+
+bool CowWriter::WriteOperation(const CowOperation& op, const void* data, size_t size) {
+    if (lseek(fd_.get(), next_op_pos_, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed for writing operation.";
+        return false;
+    }
+    if (!android::base::WriteFully(fd_, reinterpret_cast<const uint8_t*>(&op), sizeof(op))) {
+        return false;
+    }
+    if (data != nullptr && size > 0) {
+        if (!WriteRawData(data, size)) return false;
+    }
+    AddOperation(op);
+    // If there isn't room for another op and the cluster end op, end the current cluster
+    if (cluster_size_ && op.type != kCowClusterOp &&
+        cluster_size_ < current_cluster_size_ + 2 * sizeof(op)) {
+        if (!EmitCluster()) return false;
+    }
+    return true;
+}
+
+void CowWriter::AddOperation(const CowOperation& op) {
+    footer_.op.num_ops++;
+
+    if (op.type == kCowClusterOp) {
+        current_cluster_size_ = 0;
+        current_data_size_ = 0;
+    } else if (header_.cluster_ops) {
+        current_cluster_size_ += sizeof(op);
+        current_data_size_ += op.data_length;
+    }
+
+    next_data_pos_ += op.data_length + GetNextDataOffset(op, header_.cluster_ops);
+    next_op_pos_ += sizeof(CowOperation) + GetNextOpOffset(op, header_.cluster_ops);
+    ops_.insert(ops_.size(), reinterpret_cast<const uint8_t*>(&op), sizeof(op));
+}
+
+bool CowWriter::WriteRawData(const void* data, size_t size) {
+    if (lseek(fd_.get(), next_data_pos_, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed for writing data.";
+        return false;
+    }
+
+    if (!android::base::WriteFully(fd_, data, size)) {
+        return false;
+    }
+    return true;
+}
+
+bool CowWriter::Sync() {
+    if (is_dev_null_) {
+        return true;
+    }
+    if (fsync(fd_.get()) < 0) {
+        PLOG(ERROR) << "fsync failed";
+        return false;
+    }
+    return true;
+}
+
+bool CowWriter::CommitMerge(int merged_ops, bool sync) {
+    CHECK(merge_in_progress_);
+    header_.num_merge_ops += merged_ops;
+
+    if (lseek(fd_.get(), 0, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return false;
+    }
+
+    if (!android::base::WriteFully(fd_, reinterpret_cast<const uint8_t*>(&header_),
+                                   sizeof(header_))) {
+        PLOG(ERROR) << "WriteFully failed";
+        return false;
+    }
+
+    // Sync only for merging of copy operations.
+    if (sync) {
+        return Sync();
+    }
+    return true;
+}
+
+bool CowWriter::Truncate(off_t length) {
+    if (is_dev_null_ || is_block_device_) {
+        return true;
+    }
+    if (ftruncate(fd_.get(), length) < 0) {
+        PLOG(ERROR) << "Failed to truncate.";
+        return false;
+    }
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/estimate_cow_from_nonab_ota.cpp b/fs_mgr/libsnapshot/estimate_cow_from_nonab_ota.cpp
new file mode 100644
index 0000000..45833e1
--- /dev/null
+++ b/fs_mgr/libsnapshot/estimate_cow_from_nonab_ota.cpp
@@ -0,0 +1,432 @@
+//
+// Copyright (C) 2020 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.
+//
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <iostream>
+#include <memory>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/strings.h>
+#include <android-base/unique_fd.h>
+#include <gflags/gflags.h>
+#include <libsnapshot/cow_writer.h>
+#include <openssl/sha.h>
+#include <sparse/sparse.h>
+#include <ziparchive/zip_archive.h>
+
+DEFINE_string(source_tf, "", "Source target files (dir or zip file)");
+DEFINE_string(ota_tf, "", "Target files of the build for an OTA");
+DEFINE_string(compression, "gz", "Compression (options: none, gz, brotli)");
+
+namespace android {
+namespace snapshot {
+
+using android::base::borrowed_fd;
+using android::base::unique_fd;
+
+static constexpr size_t kBlockSize = 4096;
+
+void MyLogger(android::base::LogId, android::base::LogSeverity severity, const char*, const char*,
+              unsigned int, const char* message) {
+    if (severity == android::base::ERROR) {
+        fprintf(stderr, "%s\n", message);
+    } else {
+        fprintf(stdout, "%s\n", message);
+    }
+}
+
+class TargetFilesPackage final {
+  public:
+    explicit TargetFilesPackage(const std::string& path);
+
+    bool Open();
+    bool HasFile(const std::string& path);
+    std::unordered_set<std::string> GetDynamicPartitionNames();
+    unique_fd OpenFile(const std::string& path);
+    unique_fd OpenImage(const std::string& path);
+
+  private:
+    std::string path_;
+    unique_fd fd_;
+    std::unique_ptr<ZipArchive, decltype(&CloseArchive)> zip_;
+};
+
+TargetFilesPackage::TargetFilesPackage(const std::string& path)
+    : path_(path), zip_(nullptr, &CloseArchive) {}
+
+bool TargetFilesPackage::Open() {
+    fd_.reset(open(path_.c_str(), O_RDONLY));
+    if (fd_ < 0) {
+        PLOG(ERROR) << "open failed: " << path_;
+        return false;
+    }
+
+    struct stat s;
+    if (fstat(fd_.get(), &s) < 0) {
+        PLOG(ERROR) << "fstat failed: " << path_;
+        return false;
+    }
+    if (S_ISDIR(s.st_mode)) {
+        return true;
+    }
+
+    // Otherwise, assume it's a zip file.
+    ZipArchiveHandle handle;
+    if (OpenArchiveFd(fd_.get(), path_.c_str(), &handle, false)) {
+        LOG(ERROR) << "Could not open " << path_ << " as a zip archive.";
+        return false;
+    }
+    zip_.reset(handle);
+    return true;
+}
+
+bool TargetFilesPackage::HasFile(const std::string& path) {
+    if (zip_) {
+        ZipEntry64 entry;
+        return !FindEntry(zip_.get(), path, &entry);
+    }
+
+    auto full_path = path_ + "/" + path;
+    return access(full_path.c_str(), F_OK) == 0;
+}
+
+unique_fd TargetFilesPackage::OpenFile(const std::string& path) {
+    if (!zip_) {
+        auto full_path = path_ + "/" + path;
+        unique_fd fd(open(full_path.c_str(), O_RDONLY));
+        if (fd < 0) {
+            PLOG(ERROR) << "open failed: " << full_path;
+            return {};
+        }
+        return fd;
+    }
+
+    ZipEntry64 entry;
+    if (FindEntry(zip_.get(), path, &entry)) {
+        LOG(ERROR) << path << " not found in archive: " << path_;
+        return {};
+    }
+
+    TemporaryFile temp;
+    if (temp.fd < 0) {
+        PLOG(ERROR) << "mkstemp failed";
+        return {};
+    }
+
+    LOG(INFO) << "Extracting " << path << " from " << path_ << " ...";
+    if (ExtractEntryToFile(zip_.get(), &entry, temp.fd)) {
+        LOG(ERROR) << "could not extract " << path << " from " << path_;
+        return {};
+    }
+    if (lseek(temp.fd, 0, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return {};
+    }
+    return unique_fd{temp.release()};
+}
+
+unique_fd TargetFilesPackage::OpenImage(const std::string& path) {
+    auto fd = OpenFile(path);
+    if (fd < 0) {
+        return {};
+    }
+
+    LOG(INFO) << "Unsparsing " << path << " ...";
+    std::unique_ptr<struct sparse_file, decltype(&sparse_file_destroy)> s(
+            sparse_file_import(fd.get(), false, false), &sparse_file_destroy);
+    if (!s) {
+        return fd;
+    }
+
+    TemporaryFile temp;
+    if (temp.fd < 0) {
+        PLOG(ERROR) << "mkstemp failed";
+        return {};
+    }
+    if (sparse_file_write(s.get(), temp.fd, false, false, false) < 0) {
+        LOG(ERROR) << "sparse_file_write failed";
+        return {};
+    }
+    if (lseek(temp.fd, 0, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return {};
+    }
+
+    fd.reset(temp.release());
+    return fd;
+}
+
+std::unordered_set<std::string> TargetFilesPackage::GetDynamicPartitionNames() {
+    auto fd = OpenFile("META/misc_info.txt");
+    if (fd < 0) {
+        return {};
+    }
+
+    std::string contents;
+    if (!android::base::ReadFdToString(fd, &contents)) {
+        PLOG(ERROR) << "read failed";
+        return {};
+    }
+
+    std::unordered_set<std::string> set;
+
+    auto lines = android::base::Split(contents, "\n");
+    for (const auto& line : lines) {
+        auto parts = android::base::Split(line, "=");
+        if (parts.size() == 2 && parts[0] == "dynamic_partition_list") {
+            auto partitions = android::base::Split(parts[1], " ");
+            for (const auto& name : partitions) {
+                if (!name.empty()) {
+                    set.emplace(name);
+                }
+            }
+            break;
+        }
+    }
+    return set;
+}
+
+class NonAbEstimator final {
+  public:
+    NonAbEstimator(const std::string& ota_tf_path, const std::string& source_tf_path)
+        : ota_tf_path_(ota_tf_path), source_tf_path_(source_tf_path) {}
+
+    bool Run();
+
+  private:
+    bool OpenPackages();
+    bool AnalyzePartition(const std::string& partition_name);
+    std::unordered_map<std::string, uint64_t> GetBlockMap(borrowed_fd fd);
+
+    std::string ota_tf_path_;
+    std::string source_tf_path_;
+    std::unique_ptr<TargetFilesPackage> ota_tf_;
+    std::unique_ptr<TargetFilesPackage> source_tf_;
+    uint64_t size_ = 0;
+};
+
+bool NonAbEstimator::Run() {
+    if (!OpenPackages()) {
+        return false;
+    }
+
+    auto partitions = ota_tf_->GetDynamicPartitionNames();
+    if (partitions.empty()) {
+        LOG(ERROR) << "No dynamic partitions found in META/misc_info.txt";
+        return false;
+    }
+    for (const auto& partition : partitions) {
+        if (!AnalyzePartition(partition)) {
+            return false;
+        }
+    }
+
+    int64_t size_in_mb = int64_t(double(size_) / 1024.0 / 1024.0);
+
+    std::cout << "Estimated COW size: " << size_ << " (" << size_in_mb << "MiB)\n";
+    return true;
+}
+
+bool NonAbEstimator::OpenPackages() {
+    ota_tf_ = std::make_unique<TargetFilesPackage>(ota_tf_path_);
+    if (!ota_tf_->Open()) {
+        return false;
+    }
+    if (!source_tf_path_.empty()) {
+        source_tf_ = std::make_unique<TargetFilesPackage>(source_tf_path_);
+        if (!source_tf_->Open()) {
+            return false;
+        }
+    }
+    return true;
+}
+
+static std::string SHA256(const std::string& input) {
+    std::string hash(32, '\0');
+    SHA256_CTX c;
+    SHA256_Init(&c);
+    SHA256_Update(&c, input.data(), input.size());
+    SHA256_Final(reinterpret_cast<unsigned char*>(hash.data()), &c);
+    return hash;
+}
+
+bool NonAbEstimator::AnalyzePartition(const std::string& partition_name) {
+    auto path = "IMAGES/" + partition_name + ".img";
+    auto fd = ota_tf_->OpenImage(path);
+    if (fd < 0) {
+        return false;
+    }
+
+    unique_fd source_fd;
+    uint64_t source_size = 0;
+    std::unordered_map<std::string, uint64_t> source_blocks;
+    if (source_tf_) {
+        auto dap = source_tf_->GetDynamicPartitionNames();
+
+        source_fd = source_tf_->OpenImage(path);
+        if (source_fd >= 0) {
+            struct stat s;
+            if (fstat(source_fd.get(), &s)) {
+                PLOG(ERROR) << "fstat failed";
+                return false;
+            }
+            source_size = s.st_size;
+
+            std::cout << "Hashing blocks for " << partition_name << "...\n";
+            source_blocks = GetBlockMap(source_fd);
+            if (source_blocks.empty()) {
+                LOG(ERROR) << "Could not build a block map for source partition: "
+                           << partition_name;
+                return false;
+            }
+        } else {
+            if (dap.count(partition_name)) {
+                return false;
+            }
+            LOG(ERROR) << "Warning: " << partition_name
+                       << " has no incremental diff since it's not in the source image.";
+        }
+    }
+
+    TemporaryFile cow;
+    if (cow.fd < 0) {
+        PLOG(ERROR) << "mkstemp failed";
+        return false;
+    }
+
+    CowOptions options;
+    options.block_size = kBlockSize;
+    options.compression = FLAGS_compression;
+
+    auto writer = std::make_unique<CowWriter>(options);
+    if (!writer->Initialize(borrowed_fd{cow.fd})) {
+        LOG(ERROR) << "Could not initialize COW writer";
+        return false;
+    }
+
+    LOG(INFO) << "Analyzing " << partition_name << " ...";
+
+    std::string zeroes(kBlockSize, '\0');
+    std::string chunk(kBlockSize, '\0');
+    std::string src_chunk(kBlockSize, '\0');
+    uint64_t next_block_number = 0;
+    while (true) {
+        if (!android::base::ReadFully(fd, chunk.data(), chunk.size())) {
+            if (errno) {
+                PLOG(ERROR) << "read failed";
+                return false;
+            }
+            break;
+        }
+
+        uint64_t block_number = next_block_number++;
+        if (chunk == zeroes) {
+            if (!writer->AddZeroBlocks(block_number, 1)) {
+                LOG(ERROR) << "Could not add zero block";
+                return false;
+            }
+            continue;
+        }
+
+        uint64_t source_offset = block_number * kBlockSize;
+        if (source_fd >= 0 && source_offset <= source_size) {
+            off64_t offset = block_number * kBlockSize;
+            if (android::base::ReadFullyAtOffset(source_fd, src_chunk.data(), src_chunk.size(),
+                                                 offset)) {
+                if (chunk == src_chunk) {
+                    continue;
+                }
+            } else if (errno) {
+                PLOG(ERROR) << "pread failed";
+                return false;
+            }
+        }
+
+        auto hash = SHA256(chunk);
+        if (auto iter = source_blocks.find(hash); iter != source_blocks.end()) {
+            if (!writer->AddCopy(block_number, iter->second)) {
+                return false;
+            }
+            continue;
+        }
+
+        if (!writer->AddRawBlocks(block_number, chunk.data(), chunk.size())) {
+            return false;
+        }
+    }
+
+    if (!writer->Finalize()) {
+        return false;
+    }
+
+    struct stat s;
+    if (fstat(cow.fd, &s) < 0) {
+        PLOG(ERROR) << "fstat failed";
+        return false;
+    }
+
+    size_ += s.st_size;
+    return true;
+}
+
+std::unordered_map<std::string, uint64_t> NonAbEstimator::GetBlockMap(borrowed_fd fd) {
+    std::string chunk(kBlockSize, '\0');
+
+    std::unordered_map<std::string, uint64_t> block_map;
+    uint64_t block_number = 0;
+    while (true) {
+        if (!android::base::ReadFully(fd, chunk.data(), chunk.size())) {
+            if (errno) {
+                PLOG(ERROR) << "read failed";
+                return {};
+            }
+            break;
+        }
+        auto hash = SHA256(chunk);
+        block_map[hash] = block_number;
+        block_number++;
+    }
+    return block_map;
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+using namespace android::snapshot;
+
+int main(int argc, char** argv) {
+    android::base::InitLogging(argv, android::snapshot::MyLogger);
+    gflags::SetUsageMessage("Estimate VAB disk usage from Non A/B builds");
+    gflags::ParseCommandLineFlags(&argc, &argv, false);
+
+    if (FLAGS_ota_tf.empty()) {
+        std::cerr << "Must specify -ota_tf on the command-line." << std::endl;
+        return 1;
+    }
+
+    NonAbEstimator estimator(FLAGS_ota_tf, FLAGS_source_tf);
+    if (!estimator.Run()) {
+        return 1;
+    }
+    return 0;
+}
diff --git a/fs_mgr/libsnapshot/fuzz.sh b/fs_mgr/libsnapshot/fuzz.sh
new file mode 100755
index 0000000..5995cef
--- /dev/null
+++ b/fs_mgr/libsnapshot/fuzz.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+PROJECT_PATH=system/core/fs_mgr/libsnapshot
+FUZZ_TARGET=libsnapshot_fuzzer
+TARGET_ARCH=$(get_build_var TARGET_ARCH)
+FUZZ_BINARY=/data/fuzz/${TARGET_ARCH}/${FUZZ_TARGET}/${FUZZ_TARGET}
+DEVICE_INIT_CORPUS_DIR=/data/fuzz/${TARGET_ARCH}/${FUZZ_TARGET}/corpus
+DEVICE_GENERATED_CORPUS_DIR=/data/local/tmp/${FUZZ_TARGET}/corpus
+DEVICE_GCOV_DIR=/data/local/tmp/${FUZZ_TARGET}/gcov
+HOST_SCRATCH_DIR=/tmp/${FUZZ_TARGET}
+GCOV_TOOL=${HOST_SCRATCH_DIR}/llvm-gcov
+
+build_normal() (
+    pushd $(gettop)
+    NATIVE_COVERAGE="" NATIVE_LINE_COVERAGE="" NATIVE_COVERAGE_PATHS="" m ${FUZZ_TARGET}
+    ret=$?
+    popd
+    return ${ret}
+)
+
+build_cov() {
+    pushd $(gettop)
+    NATIVE_COVERAGE="true" NATIVE_LINE_COVERAGE="true" NATIVE_COVERAGE_PATHS="${PROJECT_PATH}" m ${FUZZ_TARGET}
+    ret=$?
+    popd
+    return ${ret}
+}
+
+prepare_device() {
+    adb root && adb remount &&
+    adb shell mkdir -p ${DEVICE_GENERATED_CORPUS_DIR} &&
+    adb shell rm -rf ${DEVICE_GCOV_DIR} &&
+    adb shell mkdir -p ${DEVICE_GCOV_DIR}
+}
+
+push_binary() {
+    adb push ${ANDROID_PRODUCT_OUT}/${FUZZ_BINARY} ${FUZZ_BINARY} &&
+    adb push ${ANDROID_PRODUCT_OUT}/${DEVICE_INIT_CORPUS_DIR} $(dirname ${FUZZ_BINARY})
+}
+
+prepare_host() {
+    which lcov || {
+        echo "please run:";
+        echo "   sudo apt-get install lcov ";
+        return 1;
+    }
+    rm -rf ${HOST_SCRATCH_DIR} &&
+    mkdir -p ${HOST_SCRATCH_DIR}
+}
+
+# run_snapshot_fuzz -runs=10000
+generate_corpus() {
+    [[ "$@" ]] || { echo "run with -runs=X"; return 1; }
+
+    prepare_device &&
+    build_normal &&
+    push_binary &&
+    adb shell ${FUZZ_BINARY} "$@" ${DEVICE_INIT_CORPUS_DIR} ${DEVICE_GENERATED_CORPUS_DIR}
+}
+
+run_snapshot_fuzz() {
+    prepare_device &&
+    build_cov &&
+    push_binary &&
+    adb shell GCOV_PREFIX=${DEVICE_GCOV_DIR} GCOV_PREFIX_STRIP=3 \
+        ${FUZZ_BINARY} \
+        -runs=0 \
+        ${DEVICE_INIT_CORPUS_DIR} ${DEVICE_GENERATED_CORPUS_DIR}
+}
+
+show_fuzz_result() {
+    prepare_host &&
+    unzip -o -j -d ${HOST_SCRATCH_DIR} ${ANDROID_PRODUCT_OUT}/coverage/data/fuzz/${TARGET_ARCH}/${FUZZ_TARGET}/${FUZZ_TARGET}.zip &&
+    adb shell find ${DEVICE_GCOV_DIR} -type f | xargs -I {} adb pull {} ${HOST_SCRATCH_DIR} &&
+    ls ${HOST_SCRATCH_DIR} &&
+    cat > ${GCOV_TOOL} <<< '
+#!/bin/bash
+exec llvm-cov gcov "$@"
+' &&
+    chmod +x ${GCOV_TOOL} &&
+    lcov --directory ${HOST_SCRATCH_DIR} --base-directory $(gettop) --gcov-tool ${GCOV_TOOL} --capture -o ${HOST_SCRATCH_DIR}/report.cov &&
+    genhtml ${HOST_SCRATCH_DIR}/report.cov -o ${HOST_SCRATCH_DIR}/html &&
+    echo file://$(realpath ${HOST_SCRATCH_DIR}/html/index.html)
+}
+
+# run_snapshot_fuzz -runs=10000
+run_snapshot_fuzz_all() {
+    generate_corpus "$@" &&
+    run_snapshot_fuzz &&
+    show_fuzz_result
+}
diff --git a/fs_mgr/libsnapshot/fuzz_utils.cpp b/fs_mgr/libsnapshot/fuzz_utils.cpp
new file mode 100644
index 0000000..0263f7e
--- /dev/null
+++ b/fs_mgr/libsnapshot/fuzz_utils.cpp
@@ -0,0 +1,38 @@
+// Copyright (C) 2020 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.
+
+#include "fuzz_utils.h"
+
+#include <android-base/logging.h>
+
+namespace android::fuzz {
+
+void CheckInternal(bool value, std::string_view msg) {
+    CHECK(value) << msg;
+}
+
+const google::protobuf::OneofDescriptor* GetProtoValueDescriptor(
+        const google::protobuf::Descriptor* action_desc) {
+    CHECK(action_desc);
+    CHECK(action_desc->oneof_decl_count() == 1)
+            << action_desc->oneof_decl_count() << " oneof fields found in " << action_desc->name()
+            << "; only one is expected.";
+    auto* oneof_value_desc = action_desc->oneof_decl(0);
+    CHECK(oneof_value_desc);
+    CHECK(oneof_value_desc->name() == "value")
+            << "oneof field has name " << oneof_value_desc->name();
+    return oneof_value_desc;
+}
+
+}  // namespace android::fuzz
diff --git a/fs_mgr/libsnapshot/fuzz_utils.h b/fs_mgr/libsnapshot/fuzz_utils.h
new file mode 100644
index 0000000..20b13b2
--- /dev/null
+++ b/fs_mgr/libsnapshot/fuzz_utils.h
@@ -0,0 +1,285 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <map>
+#include <string>
+#include <string_view>
+
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/message.h>
+#include <google/protobuf/repeated_field.h>
+
+// Utilities for using a protobuf definition to fuzz APIs in a class.
+// Terms:
+// The "fuzzed class" is the C++ class definition whose functions are fuzzed.
+// The "fuzzed object" is an instantiated object of the fuzzed class. It is
+//   typically created and destroyed for each test run.
+// An "action" is an operation on the fuzzed object that may mutate its state.
+//   This typically involves one function call into the fuzzed object.
+
+namespace android::fuzz {
+
+// CHECK(value) << msg
+void CheckInternal(bool value, std::string_view msg);
+
+// Get the oneof descriptor inside Action
+const google::protobuf::OneofDescriptor* GetProtoValueDescriptor(
+        const google::protobuf::Descriptor* action_desc);
+
+template <typename Class>
+using FunctionMapImpl =
+        std::map<int, std::function<void(Class*, const google::protobuf::Message& action_proto,
+                                         const google::protobuf::FieldDescriptor* field_desc)>>;
+
+template <typename Class>
+class FunctionMap : public FunctionMapImpl<Class> {
+  public:
+    void CheckEmplace(typename FunctionMapImpl<Class>::key_type key,
+                      typename FunctionMapImpl<Class>::mapped_type&& value) {
+        auto [it, inserted] = this->emplace(key, std::move(value));
+        CheckInternal(inserted,
+                      "Multiple implementation registered for tag number " + std::to_string(key));
+    }
+};
+
+template <typename Action>
+int CheckConsistency() {
+    const auto* function_map = Action::GetFunctionMap();
+    const auto* action_value_desc = GetProtoValueDescriptor(Action::Proto::GetDescriptor());
+
+    for (int field_index = 0; field_index < action_value_desc->field_count(); ++field_index) {
+        const auto* field_desc = action_value_desc->field(field_index);
+        CheckInternal(function_map->find(field_desc->number()) != function_map->end(),
+                      "Missing impl for function " + field_desc->camelcase_name());
+    }
+    return 0;
+}
+
+// Get the field descriptor for the oneof field in the action message. If no oneof field is set,
+// return nullptr.
+template <typename Action>
+const google::protobuf::FieldDescriptor* GetValueFieldDescriptor(
+        const typename Action::Proto& action_proto) {
+    static auto* action_value_desc = GetProtoValueDescriptor(Action::Proto::GetDescriptor());
+
+    auto* action_refl = Action::Proto::GetReflection();
+    if (!action_refl->HasOneof(action_proto, action_value_desc)) {
+        return nullptr;
+    }
+    return action_refl->GetOneofFieldDescriptor(action_proto, action_value_desc);
+}
+
+template <typename Action>
+void ExecuteActionProto(typename Action::ClassType* module,
+                        const typename Action::Proto& action_proto) {
+    const auto* field_desc = GetValueFieldDescriptor<Action>(action_proto);
+    if (field_desc == nullptr) return;
+    auto number = field_desc->number();
+    const auto& map = *Action::GetFunctionMap();
+    auto it = map.find(number);
+    CheckInternal(it != map.end(), "Missing impl for function " + field_desc->camelcase_name());
+    const auto& func = it->second;
+    func(module, action_proto, field_desc);
+}
+
+template <typename Action>
+void ExecuteAllActionProtos(
+        typename Action::ClassType* module,
+        const google::protobuf::RepeatedPtrField<typename Action::Proto>& action_protos) {
+    for (const auto& proto : action_protos) {
+        ExecuteActionProto<Action>(module, proto);
+    }
+}
+
+// Safely cast message to T. Returns a pointer to message if cast successfully, otherwise nullptr.
+template <typename T>
+const T* SafeCast(const google::protobuf::Message& message) {
+    if (message.GetDescriptor() != T::GetDescriptor()) {
+        return nullptr;
+    }
+    return static_cast<const T*>(&message);
+}
+
+// Cast message to const T&. Abort if type mismatch.
+template <typename T>
+const T& CheckedCast(const google::protobuf::Message& message) {
+    const auto* ptr = SafeCast<T>(message);
+    CheckInternal(ptr, "Cannot cast " + message.GetDescriptor()->name() + " to " +
+                               T::GetDescriptor()->name());
+    return *ptr;
+}
+
+// A templated way to a primitive field from a message using reflection.
+template <typename T>
+struct PrimitiveGetter;
+#define FUZZ_DEFINE_PRIMITIVE_GETTER(type, func_name)                              \
+    template <>                                                                    \
+    struct PrimitiveGetter<type> {                                                 \
+        static constexpr const auto fp = &google::protobuf::Reflection::func_name; \
+    }
+
+FUZZ_DEFINE_PRIMITIVE_GETTER(bool, GetBool);
+FUZZ_DEFINE_PRIMITIVE_GETTER(uint32_t, GetUInt32);
+FUZZ_DEFINE_PRIMITIVE_GETTER(int32_t, GetInt32);
+FUZZ_DEFINE_PRIMITIVE_GETTER(uint64_t, GetUInt64);
+FUZZ_DEFINE_PRIMITIVE_GETTER(int64_t, GetInt64);
+FUZZ_DEFINE_PRIMITIVE_GETTER(double, GetDouble);
+FUZZ_DEFINE_PRIMITIVE_GETTER(float, GetFloat);
+
+// ActionPerformer extracts arguments from the protobuf message, and then call FuzzFunction
+// with these arguments.
+template <typename FuzzFunction, typename Signature, typename Enabled = void>
+struct ActionPerformerImpl;  // undefined
+
+template <typename FuzzFunction, typename MessageProto>
+struct ActionPerformerImpl<
+        FuzzFunction, void(const MessageProto&),
+        typename std::enable_if_t<std::is_base_of_v<google::protobuf::Message, MessageProto>>> {
+    static typename FuzzFunction::ReturnType Invoke(
+            typename FuzzFunction::ClassType* module, const google::protobuf::Message& action_proto,
+            const google::protobuf::FieldDescriptor* field_desc) {
+        const MessageProto& arg = CheckedCast<std::remove_reference_t<MessageProto>>(
+                action_proto.GetReflection()->GetMessage(action_proto, field_desc));
+        return FuzzFunction::ImplBody(module, arg);
+    }
+};
+
+template <typename FuzzFunction, typename Primitive>
+struct ActionPerformerImpl<FuzzFunction, void(Primitive),
+                           typename std::enable_if_t<std::is_arithmetic_v<Primitive>>> {
+    static typename FuzzFunction::ReturnType Invoke(
+            typename FuzzFunction::ClassType* module, const google::protobuf::Message& action_proto,
+            const google::protobuf::FieldDescriptor* field_desc) {
+        Primitive arg = std::invoke(PrimitiveGetter<Primitive>::fp, action_proto.GetReflection(),
+                                    action_proto, field_desc);
+        return FuzzFunction::ImplBody(module, arg);
+    }
+};
+
+template <typename FuzzFunction>
+struct ActionPerformerImpl<FuzzFunction, void()> {
+    static typename FuzzFunction::ReturnType Invoke(typename FuzzFunction::ClassType* module,
+                                                    const google::protobuf::Message&,
+                                                    const google::protobuf::FieldDescriptor*) {
+        return FuzzFunction::ImplBody(module);
+    }
+};
+
+template <typename FuzzFunction>
+struct ActionPerformerImpl<FuzzFunction, void(const std::string&)> {
+    static typename FuzzFunction::ReturnType Invoke(
+            typename FuzzFunction::ClassType* module, const google::protobuf::Message& action_proto,
+            const google::protobuf::FieldDescriptor* field_desc) {
+        std::string scratch;
+        const std::string& arg = action_proto.GetReflection()->GetStringReference(
+                action_proto, field_desc, &scratch);
+        return FuzzFunction::ImplBody(module, arg);
+    }
+};
+
+template <typename FuzzFunction>
+struct ActionPerformer : ActionPerformerImpl<FuzzFunction, typename FuzzFunction::Signature> {};
+
+}  // namespace android::fuzz
+
+// Fuzz existing C++ class, ClassType, with a collection of functions under the name Action.
+//
+// Prerequisite: ActionProto must be defined in Protobuf to describe possible actions:
+// message FooActionProto {
+//     message NoArgs {}
+//     oneof value {
+//         bool do_foo = 1;
+//         NoArgs do_bar = 1;
+//     }
+// }
+// Use it to fuzz a C++ class Foo by doing the following:
+//   FUZZ_CLASS(Foo, FooAction)
+// After linking functions of Foo to FooAction, execute all actions by:
+//   FooAction::ExecuteAll(foo_object, action_protos)
+#define FUZZ_CLASS(Class, Action)                                                                \
+    class Action {                                                                               \
+      public:                                                                                    \
+        using Proto = Action##Proto;                                                             \
+        using ClassType = Class;                                                                 \
+        using FunctionMap = android::fuzz::FunctionMap<Class>;                                   \
+        static FunctionMap* GetFunctionMap() {                                                   \
+            static Action::FunctionMap map;                                                      \
+            return &map;                                                                         \
+        }                                                                                        \
+        static void ExecuteAll(Class* module,                                                    \
+                               const google::protobuf::RepeatedPtrField<Proto>& action_protos) { \
+            [[maybe_unused]] static int consistent = android::fuzz::CheckConsistency<Action>();  \
+            android::fuzz::ExecuteAllActionProtos<Action>(module, action_protos);                \
+        }                                                                                        \
+    }
+
+#define FUZZ_FUNCTION_CLASS_NAME(Action, FunctionName) Action##_##FunctionName
+#define FUZZ_FUNCTION_TAG_NAME(FunctionName) k##FunctionName
+
+// Implement an action defined in protobuf. Example:
+// message FooActionProto {
+//     oneof value {
+//         bool do_foo = 1;
+//     }
+// }
+// class Foo { public: void DoAwesomeFoo(bool arg); };
+// FUZZ_OBJECT(FooAction, Foo);
+// FUZZ_FUNCTION(FooAction, DoFoo, void, IFoo* module, bool arg) {
+//   module->DoAwesomeFoo(arg);
+// }
+// The name DoFoo is the camel case name of the action in protobuf definition of FooActionProto.
+#define FUZZ_FUNCTION(Action, FunctionName, Return, ModuleArg, ...)             \
+    class FUZZ_FUNCTION_CLASS_NAME(Action, FunctionName) {                      \
+      public:                                                                   \
+        using ActionType = Action;                                              \
+        using ClassType = Action::ClassType;                                    \
+        using ReturnType = Return;                                              \
+        using Signature = void(__VA_ARGS__);                                    \
+        static constexpr const char name[] = #FunctionName;                     \
+        static constexpr const auto tag =                                       \
+                Action::Proto::ValueCase::FUZZ_FUNCTION_TAG_NAME(FunctionName); \
+        static ReturnType ImplBody(ModuleArg, ##__VA_ARGS__);                   \
+                                                                                \
+      private:                                                                  \
+        static bool registered_;                                                \
+    };                                                                          \
+    auto FUZZ_FUNCTION_CLASS_NAME(Action, FunctionName)::registered_ = ([] {    \
+        auto tag = FUZZ_FUNCTION_CLASS_NAME(Action, FunctionName)::tag;         \
+        auto func = &::android::fuzz::ActionPerformer<FUZZ_FUNCTION_CLASS_NAME( \
+                Action, FunctionName)>::Invoke;                                 \
+        Action::GetFunctionMap()->CheckEmplace(tag, func);                      \
+        return true;                                                            \
+    })();                                                                       \
+    Return FUZZ_FUNCTION_CLASS_NAME(Action, FunctionName)::ImplBody(ModuleArg, ##__VA_ARGS__)
+
+// Implement a simple action by linking it to the function with the same name. Example:
+// message FooActionProto {
+//     message NoArgs {}
+//     oneof value {
+//         NoArgs do_bar = 1;
+//     }
+// }
+// class Foo { public void DoBar(); };
+// FUZZ_OBJECT(FooAction, Foo);
+// FUZZ_FUNCTION(FooAction, DoBar);
+// The name DoBar is the camel case name of the action in protobuf definition of FooActionProto, and
+// also the name of the function of Foo.
+#define FUZZ_SIMPLE_FUNCTION(Action, FunctionName)                            \
+    FUZZ_FUNCTION(Action, FunctionName,                                       \
+                  decltype(std::declval<Action::ClassType>().FunctionName()), \
+                  Action::ClassType* module) {                                \
+        return module->FunctionName();                                        \
+    }
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h b/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h
new file mode 100644
index 0000000..797b8ef
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/cow_format.h
@@ -0,0 +1,160 @@
+// Copyright (C) 2019 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.
+
+#pragma once
+
+#include <stdint.h>
+#include <string>
+
+namespace android {
+namespace snapshot {
+
+static constexpr uint64_t kCowMagicNumber = 0x436f77634f572121ULL;
+static constexpr uint32_t kCowVersionMajor = 1;
+static constexpr uint32_t kCowVersionMinor = 0;
+
+// This header appears as the first sequence of bytes in the COW. All fields
+// in the layout are little-endian encoded. The on-disk layout is:
+//
+//      +-----------------------+
+//      |     Header (fixed)    |
+//      +-----------------------+
+//      | Operation  (variable) |
+//      | Data       (variable) |
+//      +-----------------------+
+//      |    Footer (fixed)     |
+//      +-----------------------+
+//
+// The operations begin immediately after the header, and the "raw data"
+// immediately follows the operation which refers to it. While streaming
+// an OTA, we can immediately write the op and data, syncing after each pair,
+// while storing operation metadata in memory. At the end, we compute data and
+// hashes for the footer, which is placed at the tail end of the file.
+//
+// A missing or corrupt footer likely indicates that writing was cut off
+// between writing the last operation/data pair, or the footer itself. In this
+// case, the safest way to proceed is to assume the last operation is faulty.
+
+struct CowHeader {
+    uint64_t magic;
+    uint16_t major_version;
+    uint16_t minor_version;
+
+    // Size of this struct.
+    uint16_t header_size;
+
+    // Size of footer struct
+    uint16_t footer_size;
+
+    // Size of op struct
+    uint16_t op_size;
+
+    // The size of block operations, in bytes.
+    uint32_t block_size;
+
+    // The number of ops to cluster together. 0 For no clustering. Cannot be 1.
+    uint32_t cluster_ops;
+
+    // Tracks merge operations completed
+    uint64_t num_merge_ops;
+} __attribute__((packed));
+
+// This structure is the same size of a normal Operation, but is repurposed for the footer.
+struct CowFooterOperation {
+    // The operation code (always kCowFooterOp).
+    uint8_t type;
+
+    // If this operation reads from the data section of the COW, this contains
+    // the compression type of that data (see constants below).
+    uint8_t compression;
+
+    // Length of Footer Data. Currently 64 for both checksums
+    uint16_t data_length;
+
+    // The amount of file space used by Cow operations
+    uint64_t ops_size;
+
+    // The number of cow operations in the file
+    uint64_t num_ops;
+} __attribute__((packed));
+
+struct CowFooterData {
+    // SHA256 checksums of Footer op
+    uint8_t footer_checksum[32];
+
+    // SHA256 of the operation sequence.
+    uint8_t ops_checksum[32];
+} __attribute__((packed));
+
+// Cow operations are currently fixed-size entries, but this may change if
+// needed.
+struct CowOperation {
+    // The operation code (see the constants and structures below).
+    uint8_t type;
+
+    // If this operation reads from the data section of the COW, this contains
+    // the compression type of that data (see constants below).
+    uint8_t compression;
+
+    // If this operation reads from the data section of the COW, this contains
+    // the length.
+    uint16_t data_length;
+
+    // The block of data in the new image that this operation modifies.
+    uint64_t new_block;
+
+    // The value of |source| depends on the operation code.
+    //
+    // For copy operations, this is a block location in the source image.
+    //
+    // For replace operations, this is a byte offset within the COW's data
+    // sections (eg, not landing within the header or metadata). It is an
+    // absolute position within the image.
+    //
+    // For zero operations (replace with all zeroes), this is unused and must
+    // be zero.
+    //
+    // For Label operations, this is the value of the applied label.
+    //
+    // For Cluster operations, this is the length of the following data region
+    uint64_t source;
+} __attribute__((packed));
+
+static_assert(sizeof(CowOperation) == sizeof(CowFooterOperation));
+
+static constexpr uint8_t kCowCopyOp = 1;
+static constexpr uint8_t kCowReplaceOp = 2;
+static constexpr uint8_t kCowZeroOp = 3;
+static constexpr uint8_t kCowLabelOp = 4;
+static constexpr uint8_t kCowClusterOp = 5;
+static constexpr uint8_t kCowFooterOp = -1;
+
+static constexpr uint8_t kCowCompressNone = 0;
+static constexpr uint8_t kCowCompressGz = 1;
+static constexpr uint8_t kCowCompressBrotli = 2;
+
+struct CowFooter {
+    CowFooterOperation op;
+    CowFooterData data;
+} __attribute__((packed));
+
+std::ostream& operator<<(std::ostream& os, CowOperation const& arg);
+
+int64_t GetNextOpOffset(const CowOperation& op, uint32_t cluster_size);
+int64_t GetNextDataOffset(const CowOperation& op, uint32_t cluster_size);
+
+bool IsMetadataOp(const CowOperation& op);
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/cow_reader.h b/fs_mgr/libsnapshot/include/libsnapshot/cow_reader.h
new file mode 100644
index 0000000..62b54f9
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/cow_reader.h
@@ -0,0 +1,158 @@
+// Copyright (C) 2019 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.
+
+#pragma once
+
+#include <stdint.h>
+
+#include <functional>
+#include <memory>
+#include <optional>
+
+#include <android-base/unique_fd.h>
+#include <libsnapshot/cow_format.h>
+
+namespace android {
+namespace snapshot {
+
+class ICowOpIter;
+class ICowOpReverseIter;
+
+// A ByteSink object handles requests for a buffer of a specific size. It
+// always owns the underlying buffer. It's designed to minimize potential
+// copying as we parse or decompress the COW.
+class IByteSink {
+  public:
+    virtual ~IByteSink() {}
+
+    // Called when the reader has data. The size of the request is given. The
+    // sink must return a valid pointer (or null on failure), and return the
+    // maximum number of bytes that can be written to the returned buffer.
+    //
+    // The returned buffer is owned by IByteSink, but must remain valid until
+    // the read operation has completed (or the entire buffer has been
+    // covered by calls to ReturnData).
+    //
+    // After calling GetBuffer(), all previous buffers returned are no longer
+    // valid.
+    //
+    // GetBuffer() is intended to be sequential. A returned size of N indicates
+    // that the output stream will advance by N bytes, and the ReturnData call
+    // indicates that those bytes have been fulfilled. Therefore, it is
+    // possible to have ReturnBuffer do nothing, if the implementation doesn't
+    // care about incremental writes.
+    virtual void* GetBuffer(size_t requested, size_t* actual) = 0;
+
+    // Called when a section returned by |GetBuffer| has been filled with data.
+    virtual bool ReturnData(void* buffer, size_t length) = 0;
+};
+
+// Interface for reading from a snapuserd COW.
+class ICowReader {
+  public:
+    virtual ~ICowReader() {}
+
+    // Return the file header.
+    virtual bool GetHeader(CowHeader* header) = 0;
+
+    // Return the file footer.
+    virtual bool GetFooter(CowFooter* footer) = 0;
+
+    // Return the last valid label
+    virtual bool GetLastLabel(uint64_t* label) = 0;
+
+    // Return an iterator for retrieving CowOperation entries.
+    virtual std::unique_ptr<ICowOpIter> GetOpIter() = 0;
+
+    // Return an reverse iterator for retrieving CowOperation entries.
+    virtual std::unique_ptr<ICowOpReverseIter> GetRevOpIter() = 0;
+
+    // Get decoded bytes from the data section, handling any decompression.
+    // All retrieved data is passed to the sink.
+    virtual bool ReadData(const CowOperation& op, IByteSink* sink) = 0;
+};
+
+// Iterate over a sequence of COW operations.
+class ICowOpIter {
+  public:
+    virtual ~ICowOpIter() {}
+
+    // True if there are more items to read, false otherwise.
+    virtual bool Done() = 0;
+
+    // Read the current operation.
+    virtual const CowOperation& Get() = 0;
+
+    // Advance to the next item.
+    virtual void Next() = 0;
+};
+
+// Reverse Iterate over a sequence of COW operations.
+class ICowOpReverseIter {
+  public:
+    virtual ~ICowOpReverseIter() {}
+
+    // True if there are more items to read, false otherwise.
+    virtual bool Done() = 0;
+
+    // Read the current operation.
+    virtual const CowOperation& Get() = 0;
+
+    // Advance to the next item.
+    virtual void Next() = 0;
+};
+
+class CowReader : public ICowReader {
+  public:
+    CowReader();
+
+    // Parse the COW, optionally, up to the given label. If no label is
+    // specified, the COW must have an intact footer.
+    bool Parse(android::base::unique_fd&& fd, std::optional<uint64_t> label = {});
+    bool Parse(android::base::borrowed_fd fd, std::optional<uint64_t> label = {});
+
+    bool GetHeader(CowHeader* header) override;
+    bool GetFooter(CowFooter* footer) override;
+
+    bool GetLastLabel(uint64_t* label) override;
+
+    // Create a CowOpIter object which contains footer_.num_ops
+    // CowOperation objects. Get() returns a unique CowOperation object
+    // whose lifetime depends on the CowOpIter object; the return
+    // value of these will never be null.
+    std::unique_ptr<ICowOpIter> GetOpIter() override;
+    std::unique_ptr<ICowOpReverseIter> GetRevOpIter() override;
+
+    bool ReadData(const CowOperation& op, IByteSink* sink) override;
+
+    bool GetRawBytes(uint64_t offset, void* buffer, size_t len, size_t* read);
+
+    void UpdateMergeProgress(uint64_t merge_ops) { header_.num_merge_ops += merge_ops; }
+
+    void InitializeMerge();
+
+  private:
+    bool ParseOps(std::optional<uint64_t> label);
+
+    android::base::unique_fd owned_fd_;
+    android::base::borrowed_fd fd_;
+    CowHeader header_;
+    std::optional<CowFooter> footer_;
+    uint64_t fd_size_;
+    std::optional<uint64_t> last_label_;
+    std::shared_ptr<std::vector<CowOperation>> ops_;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h b/fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h
new file mode 100644
index 0000000..22ddfa6
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h
@@ -0,0 +1,154 @@
+// Copyright (C) 2019 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.
+
+#pragma once
+
+#include <stdint.h>
+
+#include <memory>
+#include <optional>
+#include <string>
+
+#include <android-base/unique_fd.h>
+#include <libsnapshot/cow_format.h>
+#include <libsnapshot/cow_reader.h>
+
+namespace android {
+namespace snapshot {
+
+struct CowOptions {
+    uint32_t block_size = 4096;
+    std::string compression;
+
+    // Maximum number of blocks that can be written.
+    std::optional<uint64_t> max_blocks;
+
+    // Number of CowOperations in a cluster. 0 for no clustering. Cannot be 1.
+    uint32_t cluster_ops = 200;
+};
+
+// Interface for writing to a snapuserd COW. All operations are ordered; merges
+// will occur in the sequence they were added to the COW.
+class ICowWriter {
+  public:
+    explicit ICowWriter(const CowOptions& options) : options_(options) {}
+
+    virtual ~ICowWriter() {}
+
+    // Encode an operation that copies the contents of |old_block| to the
+    // location of |new_block|.
+    bool AddCopy(uint64_t new_block, uint64_t old_block);
+
+    // Encode a sequence of raw blocks. |size| must be a multiple of the block size.
+    bool AddRawBlocks(uint64_t new_block_start, const void* data, size_t size);
+
+    // Encode a sequence of zeroed blocks. |size| must be a multiple of the block size.
+    bool AddZeroBlocks(uint64_t new_block_start, uint64_t num_blocks);
+
+    // Add a label to the op sequence.
+    bool AddLabel(uint64_t label);
+
+    // Flush all pending writes. This must be called before closing the writer
+    // to ensure that the correct headers and footers are written.
+    virtual bool Finalize() = 0;
+
+    // Return number of bytes the cow image occupies on disk.
+    virtual uint64_t GetCowSize() = 0;
+
+    // Returns true if AddCopy() operations are supported.
+    virtual bool SupportsCopyOperation() const { return true; }
+
+    const CowOptions& options() { return options_; }
+
+  protected:
+    virtual bool EmitCopy(uint64_t new_block, uint64_t old_block) = 0;
+    virtual bool EmitRawBlocks(uint64_t new_block_start, const void* data, size_t size) = 0;
+    virtual bool EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) = 0;
+    virtual bool EmitLabel(uint64_t label) = 0;
+
+    bool ValidateNewBlock(uint64_t new_block);
+
+  protected:
+    CowOptions options_;
+};
+
+class CowWriter : public ICowWriter {
+  public:
+    explicit CowWriter(const CowOptions& options);
+
+    // Set up the writer.
+    // The file starts from the beginning.
+    //
+    // If fd is < 0, the CowWriter will be opened against /dev/null. This is for
+    // computing COW sizes without using storage space.
+    bool Initialize(android::base::unique_fd&& fd);
+    bool Initialize(android::base::borrowed_fd fd);
+    // Set up a writer, assuming that the given label is the last valid label.
+    // This will result in dropping any labels that occur after the given on, and will fail
+    // if the given label does not appear.
+    bool InitializeAppend(android::base::unique_fd&&, uint64_t label);
+    bool InitializeAppend(android::base::borrowed_fd fd, uint64_t label);
+
+    void InitializeMerge(android::base::borrowed_fd fd, CowHeader* header);
+    bool CommitMerge(int merged_ops, bool sync);
+
+    bool Finalize() override;
+
+    uint64_t GetCowSize() override;
+
+  protected:
+    virtual bool EmitCopy(uint64_t new_block, uint64_t old_block) override;
+    virtual bool EmitRawBlocks(uint64_t new_block_start, const void* data, size_t size) override;
+    virtual bool EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) override;
+    virtual bool EmitLabel(uint64_t label) override;
+
+  private:
+    bool EmitCluster();
+    void SetupHeaders();
+    bool ParseOptions();
+    bool OpenForWrite();
+    bool OpenForAppend(uint64_t label);
+    bool GetDataPos(uint64_t* pos);
+    bool WriteRawData(const void* data, size_t size);
+    bool WriteOperation(const CowOperation& op, const void* data = nullptr, size_t size = 0);
+    void AddOperation(const CowOperation& op);
+    std::basic_string<uint8_t> Compress(const void* data, size_t length);
+    void InitPos();
+
+    bool SetFd(android::base::borrowed_fd fd);
+    bool Sync();
+    bool Truncate(off_t length);
+
+  private:
+    android::base::unique_fd owned_fd_;
+    android::base::borrowed_fd fd_;
+    CowHeader header_{};
+    CowFooter footer_{};
+    int compression_ = 0;
+    uint64_t next_op_pos_ = 0;
+    uint64_t next_data_pos_ = 0;
+    uint32_t cluster_size_ = 0;
+    uint32_t current_cluster_size_ = 0;
+    uint64_t current_data_size_ = 0;
+    bool is_dev_null_ = false;
+    bool merge_in_progress_ = false;
+    bool is_block_device_ = false;
+
+    // :TODO: this is not efficient, but stringstream ubsan aborts because some
+    // bytes overflow a signed char.
+    std::basic_string<uint8_t> ops_;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/mock_device_info.h b/fs_mgr/libsnapshot/include/libsnapshot/mock_device_info.h
new file mode 100644
index 0000000..ef9d648
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/mock_device_info.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <libsnapshot/snapshot.h>
+
+#include <gmock/gmock.h>
+
+namespace android::snapshot {
+
+class MockDeviceInfo : public SnapshotManager::IDeviceInfo {
+  public:
+    MOCK_METHOD(std::string, GetGsidDir, (), (const, override));
+    MOCK_METHOD(std::string, GetMetadataDir, (), (const, override));
+    MOCK_METHOD(std::string, GetSlotSuffix, (), (const, override));
+    MOCK_METHOD(std::string, GetOtherSlotSuffix, (), (const, override));
+    MOCK_METHOD(std::string, GetSuperDevice, (uint32_t slot), (const, override));
+    MOCK_METHOD(const android::fs_mgr::IPartitionOpener&, GetPartitionOpener, (), (const));
+    MOCK_METHOD(bool, IsOverlayfsSetup, (), (const, override));
+    MOCK_METHOD(bool, SetBootControlMergeStatus, (MergeStatus status), (override));
+    MOCK_METHOD(bool, SetSlotAsUnbootable, (unsigned int slot), (override));
+    MOCK_METHOD(bool, IsRecovery, (), (const, override));
+};
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h
new file mode 100644
index 0000000..92e7910
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <libsnapshot/snapshot.h>
+#include <payload_consumer/file_descriptor.h>
+
+#include <gmock/gmock.h>
+
+namespace android::snapshot {
+
+class MockSnapshotManager : public ISnapshotManager {
+  public:
+    MOCK_METHOD(bool, BeginUpdate, (), (override));
+    MOCK_METHOD(bool, CancelUpdate, (), (override));
+    MOCK_METHOD(bool, FinishedSnapshotWrites, (bool wipe), (override));
+    MOCK_METHOD(bool, InitiateMerge, (uint64_t * cow_file_size), (override));
+
+    MOCK_METHOD(UpdateState, ProcessUpdateState,
+                (const std::function<bool()>& callback, const std::function<bool()>& before_cancel),
+                (override));
+    MOCK_METHOD(UpdateState, GetUpdateState, (double* progress), (override));
+    MOCK_METHOD(Return, CreateUpdateSnapshots,
+                (const chromeos_update_engine::DeltaArchiveManifest& manifest), (override));
+    MOCK_METHOD(bool, MapUpdateSnapshot,
+                (const android::fs_mgr::CreateLogicalPartitionParams& params,
+                 std::string* snapshot_path),
+                (override));
+    MOCK_METHOD(std::unique_ptr<ISnapshotWriter>, OpenSnapshotWriter,
+                (const android::fs_mgr::CreateLogicalPartitionParams& params,
+                 const std::optional<std::string>&),
+                (override));
+    MOCK_METHOD(bool, UnmapUpdateSnapshot, (const std::string& target_partition_name), (override));
+    MOCK_METHOD(bool, NeedSnapshotsInFirstStageMount, (), (override));
+    MOCK_METHOD(bool, CreateLogicalAndSnapshotPartitions,
+                (const std::string& super_device, const std::chrono::milliseconds& timeout_ms),
+                (override));
+    MOCK_METHOD(bool, MapAllSnapshots, (const std::chrono::milliseconds& timeout_ms), (override));
+    MOCK_METHOD(bool, UnmapAllSnapshots, (), (override));
+    MOCK_METHOD(bool, HandleImminentDataWipe, (const std::function<void()>& callback), (override));
+    MOCK_METHOD(bool, FinishMergeInRecovery, (), (override));
+    MOCK_METHOD(CreateResult, RecoveryCreateSnapshotDevices, (), (override));
+    MOCK_METHOD(CreateResult, RecoveryCreateSnapshotDevices,
+                (const std::unique_ptr<AutoDevice>& metadata_device), (override));
+    MOCK_METHOD(bool, Dump, (std::ostream & os), (override));
+    MOCK_METHOD(std::unique_ptr<AutoDevice>, EnsureMetadataMounted, (), (override));
+    MOCK_METHOD(ISnapshotMergeStats*, GetSnapshotMergeStatsInstance, (), (override));
+};
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
index b207978..ff7a727 100644
--- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
@@ -15,6 +15,7 @@
 #pragma once
 
 #include <stdint.h>
+#include <unistd.h>
 
 #include <chrono>
 #include <map>
@@ -36,6 +37,8 @@
 
 #include <libsnapshot/auto_device.h>
 #include <libsnapshot/return.h>
+#include <libsnapshot/snapshot_writer.h>
+#include <libsnapshot/snapuserd_client.h>
 
 #ifndef FRIEND_TEST
 #define FRIEND_TEST(test_set_name, individual_test) \
@@ -70,9 +73,12 @@
 struct AutoDeleteSnapshot;
 struct AutoDeviceList;
 struct PartitionCowCreator;
+class ISnapshotMergeStats;
+class SnapshotMergeStats;
 class SnapshotStatus;
 
 static constexpr const std::string_view kCowGroupName = "cow";
+static constexpr char kVirtualAbCompressionProp[] = "ro.virtual_ab.compression.enabled";
 
 bool OptimizeSourceCopyOperation(const chromeos_update_engine::InstallOperation& operation,
                                  chromeos_update_engine::InstallOperation* optimized);
@@ -83,17 +89,7 @@
     NOT_CREATED,
 };
 
-class SnapshotManager final {
-    using CreateLogicalPartitionParams = android::fs_mgr::CreateLogicalPartitionParams;
-    using IPartitionOpener = android::fs_mgr::IPartitionOpener;
-    using LpMetadata = android::fs_mgr::LpMetadata;
-    using MetadataBuilder = android::fs_mgr::MetadataBuilder;
-    using DeltaArchiveManifest = chromeos_update_engine::DeltaArchiveManifest;
-    using MergeStatus = android::hardware::boot::V1_1::MergeStatus;
-    using FiemapStatus = android::fiemap::FiemapStatus;
-
-    friend class SnapshotMergeStats;
-
+class ISnapshotManager {
   public:
     // Dependency injection for testing.
     class IDeviceInfo {
@@ -104,39 +100,24 @@
         virtual std::string GetSlotSuffix() const = 0;
         virtual std::string GetOtherSlotSuffix() const = 0;
         virtual std::string GetSuperDevice(uint32_t slot) const = 0;
-        virtual const IPartitionOpener& GetPartitionOpener() const = 0;
+        virtual const android::fs_mgr::IPartitionOpener& GetPartitionOpener() const = 0;
         virtual bool IsOverlayfsSetup() const = 0;
-        virtual bool SetBootControlMergeStatus(MergeStatus status) = 0;
+        virtual bool SetBootControlMergeStatus(
+                android::hardware::boot::V1_1::MergeStatus status) = 0;
         virtual bool SetSlotAsUnbootable(unsigned int slot) = 0;
         virtual bool IsRecovery() const = 0;
+        virtual bool IsTestDevice() const { return false; }
     };
-
-    ~SnapshotManager();
-
-    // Return a new SnapshotManager instance, or null on error. The device
-    // pointer is owned for the lifetime of SnapshotManager. If null, a default
-    // instance will be created.
-    static std::unique_ptr<SnapshotManager> New(IDeviceInfo* device = nullptr);
-
-    // This is similar to New(), except designed specifically for first-stage
-    // init or recovery.
-    static std::unique_ptr<SnapshotManager> NewForFirstStageMount(IDeviceInfo* device = nullptr);
-
-    // Helper function for first-stage init to check whether a SnapshotManager
-    // might be needed to perform first-stage mounts.
-    static bool IsSnapshotManagerNeeded();
-
-    // Helper function for second stage init to restorecon on the rollback indicator.
-    static std::string GetGlobalRollbackIndicatorPath();
+    virtual ~ISnapshotManager() = default;
 
     // Begin an update. This must be called before creating any snapshots. It
     // will fail if GetUpdateState() != None.
-    bool BeginUpdate();
+    virtual bool BeginUpdate() = 0;
 
     // Cancel an update; any snapshots will be deleted. This is allowed if the
     // state == Initiated, None, or Unverified (before rebooting to the new
     // slot).
-    bool CancelUpdate();
+    virtual bool CancelUpdate() = 0;
 
     // Mark snapshot writes as having completed. After this, new snapshots cannot
     // be created, and the device must either cancel the OTA (either before
@@ -144,11 +125,11 @@
     // Before calling this function, all snapshots must be mapped.
     // If |wipe| is set to true, wipe is scheduled after reboot, and snapshots
     // may need to be merged before wiping.
-    bool FinishedSnapshotWrites(bool wipe);
+    virtual bool FinishedSnapshotWrites(bool wipe) = 0;
 
     // Initiate a merge on all snapshot devices. This should only be used after an
     // update has been marked successful after booting.
-    bool InitiateMerge(uint64_t* cow_file_size = nullptr);
+    virtual bool InitiateMerge(uint64_t* cow_file_size = nullptr) = 0;
 
     // Perform any necessary post-boot actions. This should be run soon after
     // /data is mounted.
@@ -178,8 +159,8 @@
     //
     // The optional callback allows the caller to periodically check the
     // progress with GetUpdateState().
-    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
-                                   const std::function<bool()>& before_cancel = {});
+    virtual UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
+                                           const std::function<bool()>& before_cancel = {}) = 0;
 
     // Find the status of the current update, if any.
     //
@@ -187,28 +168,55 @@
     //   Merging: Value in the range [0, 100]
     //   MergeCompleted: 100
     //   Other: 0
-    UpdateState GetUpdateState(double* progress = nullptr);
+    virtual UpdateState GetUpdateState(double* progress = nullptr) = 0;
 
     // Create necessary COW device / files for OTA clients. New logical partitions will be added to
     // group "cow" in target_metadata. Regions of partitions of current_metadata will be
     // "write-protected" and snapshotted.
-    Return CreateUpdateSnapshots(const DeltaArchiveManifest& manifest);
+    virtual Return CreateUpdateSnapshots(
+            const chromeos_update_engine::DeltaArchiveManifest& manifest) = 0;
 
     // Map a snapshotted partition for OTA clients to write to. Write-protected regions are
     // determined previously in CreateSnapshots.
-    bool MapUpdateSnapshot(const CreateLogicalPartitionParams& params, std::string* snapshot_path);
+    //
+    // |snapshot_path| must not be nullptr.
+    //
+    // This method will return false if ro.virtual_ab.compression.enabled is true.
+    virtual bool MapUpdateSnapshot(const android::fs_mgr::CreateLogicalPartitionParams& params,
+                                   std::string* snapshot_path) = 0;
 
-    // Unmap a snapshot device that's previously mapped with MapUpdateSnapshot.
-    bool UnmapUpdateSnapshot(const std::string& target_partition_name);
+    // Create an ISnapshotWriter to build a snapshot against a target partition. The partition name
+    // must be suffixed. If a source partition exists, it must be specified as well. The source
+    // partition will only be used if raw bytes are needed. The source partition should be an
+    // absolute path to the device, not a partition name.
+    //
+    // After calling OpenSnapshotWriter, the caller must invoke Initialize or InitializeForAppend
+    // before invoking write operations.
+    virtual std::unique_ptr<ISnapshotWriter> OpenSnapshotWriter(
+            const android::fs_mgr::CreateLogicalPartitionParams& params,
+            const std::optional<std::string>& source_device) = 0;
+
+    // Unmap a snapshot device or CowWriter that was previously opened with MapUpdateSnapshot,
+    // OpenSnapshotWriter. All outstanding open descriptors, writers, or
+    // readers must be deleted before this is called.
+    virtual bool UnmapUpdateSnapshot(const std::string& target_partition_name) = 0;
 
     // If this returns true, first-stage mount must call
     // CreateLogicalAndSnapshotPartitions rather than CreateLogicalPartitions.
-    bool NeedSnapshotsInFirstStageMount();
+    virtual bool NeedSnapshotsInFirstStageMount() = 0;
 
     // Perform first-stage mapping of snapshot targets. This replaces init's
     // call to CreateLogicalPartitions when snapshots are present.
-    bool CreateLogicalAndSnapshotPartitions(const std::string& super_device,
-                                            const std::chrono::milliseconds& timeout_ms = {});
+    virtual bool CreateLogicalAndSnapshotPartitions(
+            const std::string& super_device, const std::chrono::milliseconds& timeout_ms = {}) = 0;
+
+    // Map all snapshots. This is analogous to CreateLogicalAndSnapshotPartitions, except it maps
+    // the target slot rather than the current slot. It should only be used immediately after
+    // applying an update, before rebooting to the new slot.
+    virtual bool MapAllSnapshots(const std::chrono::milliseconds& timeout_ms = {}) = 0;
+
+    // Unmap all snapshots. This should be called to undo MapAllSnapshots().
+    virtual bool UnmapAllSnapshots() = 0;
 
     // This method should be called preceding any wipe or flash of metadata or
     // userdata. It is only valid in recovery or fastbootd, and it ensures that
@@ -221,11 +229,11 @@
     //
     // Returns true on success (or nothing to do), false on failure. The
     // optional callback fires periodically to query progress via GetUpdateState.
-    bool HandleImminentDataWipe(const std::function<void()>& callback = {});
+    virtual bool HandleImminentDataWipe(const std::function<void()>& callback = {}) = 0;
 
     // Force a merge to complete in recovery. This is similar to HandleImminentDataWipe
     // but does not expect a data wipe after.
-    bool FinishMergeInRecovery();
+    virtual bool FinishMergeInRecovery() = 0;
 
     // This method is only allowed in recovery and is used as a helper to
     // initialize the snapshot devices as a requirement to mount a snapshotted
@@ -238,14 +246,15 @@
     // be aborted.
     // This function mounts /metadata when called, and unmounts /metadata upon
     // return.
-    CreateResult RecoveryCreateSnapshotDevices();
+    virtual CreateResult RecoveryCreateSnapshotDevices() = 0;
 
     // Same as RecoveryCreateSnapshotDevices(), but does not auto mount/umount
     // /metadata.
-    CreateResult RecoveryCreateSnapshotDevices(const std::unique_ptr<AutoDevice>& metadata_device);
+    virtual CreateResult RecoveryCreateSnapshotDevices(
+            const std::unique_ptr<AutoDevice>& metadata_device) = 0;
 
     // Dump debug information.
-    bool Dump(std::ostream& os);
+    virtual bool Dump(std::ostream& os) = 0;
 
     // Ensure metadata directory is mounted in recovery. When the returned
     // AutoDevice is destroyed, the metadata directory is automatically
@@ -261,7 +270,95 @@
     //   auto b = mgr->EnsureMetadataMounted(); // does nothing
     //   b.reset() // unmounts
     //   a.reset() // does nothing
-    std::unique_ptr<AutoDevice> EnsureMetadataMounted();
+    virtual std::unique_ptr<AutoDevice> EnsureMetadataMounted() = 0;
+
+    // Return the associated ISnapshotMergeStats instance. Never null.
+    virtual ISnapshotMergeStats* GetSnapshotMergeStatsInstance() = 0;
+};
+
+class SnapshotManager final : public ISnapshotManager {
+    using CreateLogicalPartitionParams = android::fs_mgr::CreateLogicalPartitionParams;
+    using IPartitionOpener = android::fs_mgr::IPartitionOpener;
+    using LpMetadata = android::fs_mgr::LpMetadata;
+    using MetadataBuilder = android::fs_mgr::MetadataBuilder;
+    using DeltaArchiveManifest = chromeos_update_engine::DeltaArchiveManifest;
+    using MergeStatus = android::hardware::boot::V1_1::MergeStatus;
+    using FiemapStatus = android::fiemap::FiemapStatus;
+
+    friend class SnapshotMergeStats;
+
+  public:
+    ~SnapshotManager();
+
+    // Return a new SnapshotManager instance, or null on error. The device
+    // pointer is owned for the lifetime of SnapshotManager. If null, a default
+    // instance will be created.
+    static std::unique_ptr<SnapshotManager> New(IDeviceInfo* device = nullptr);
+
+    // This is similar to New(), except designed specifically for first-stage
+    // init or recovery.
+    static std::unique_ptr<SnapshotManager> NewForFirstStageMount(IDeviceInfo* device = nullptr);
+
+    // Helper function for first-stage init to check whether a SnapshotManager
+    // might be needed to perform first-stage mounts.
+    static bool IsSnapshotManagerNeeded();
+
+    // Helper function for second stage init to restorecon on the rollback indicator.
+    static std::string GetGlobalRollbackIndicatorPath();
+
+    // Detach dm-user devices from the current snapuserd, and populate
+    // |snapuserd_argv| with the necessary arguments to restart snapuserd
+    // and reattach them.
+    bool DetachSnapuserdForSelinux(std::vector<std::string>* snapuserd_argv);
+
+    // Perform the transition from the selinux stage of snapuserd into the
+    // second-stage of snapuserd. This process involves re-creating the dm-user
+    // table entries for each device, so that they connect to the new daemon.
+    // Once all new tables have been activated, we ask the first-stage daemon
+    // to cleanly exit.
+    bool PerformSecondStageInitTransition();
+
+    // ISnapshotManager overrides.
+    bool BeginUpdate() override;
+    bool CancelUpdate() override;
+    bool FinishedSnapshotWrites(bool wipe) override;
+    bool InitiateMerge(uint64_t* cow_file_size = nullptr) override;
+    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
+                                   const std::function<bool()>& before_cancel = {}) override;
+    UpdateState GetUpdateState(double* progress = nullptr) override;
+    Return CreateUpdateSnapshots(const DeltaArchiveManifest& manifest) override;
+    bool MapUpdateSnapshot(const CreateLogicalPartitionParams& params,
+                           std::string* snapshot_path) override;
+    std::unique_ptr<ISnapshotWriter> OpenSnapshotWriter(
+            const android::fs_mgr::CreateLogicalPartitionParams& params,
+            const std::optional<std::string>& source_device) override;
+    bool UnmapUpdateSnapshot(const std::string& target_partition_name) override;
+    bool NeedSnapshotsInFirstStageMount() override;
+    bool CreateLogicalAndSnapshotPartitions(
+            const std::string& super_device,
+            const std::chrono::milliseconds& timeout_ms = {}) override;
+    bool HandleImminentDataWipe(const std::function<void()>& callback = {}) override;
+    bool FinishMergeInRecovery() override;
+    CreateResult RecoveryCreateSnapshotDevices() override;
+    CreateResult RecoveryCreateSnapshotDevices(
+            const std::unique_ptr<AutoDevice>& metadata_device) override;
+    bool Dump(std::ostream& os) override;
+    std::unique_ptr<AutoDevice> EnsureMetadataMounted() override;
+    ISnapshotMergeStats* GetSnapshotMergeStatsInstance() override;
+    bool MapAllSnapshots(const std::chrono::milliseconds& timeout_ms = {}) override;
+    bool UnmapAllSnapshots() override;
+
+    // We can't use WaitForFile during first-stage init, because ueventd is not
+    // running and therefore will not automatically create symlinks. Instead,
+    // we let init provide us with the correct function to use to ensure
+    // uevents have been processed and symlink/mknod calls completed.
+    void SetUeventRegenCallback(std::function<bool(const std::string&)> callback) {
+        uevent_regen_callback_ = callback;
+    }
+
+    // If true, compression is enabled for this update. This is used by
+    // first-stage to decide whether to launch snapuserd.
+    bool IsSnapuserdRequired();
 
   private:
     FRIEND_TEST(SnapshotTest, CleanFirstStageMount);
@@ -275,16 +372,19 @@
     FRIEND_TEST(SnapshotTest, Merge);
     FRIEND_TEST(SnapshotTest, NoMergeBeforeReboot);
     FRIEND_TEST(SnapshotTest, UpdateBootControlHal);
+    FRIEND_TEST(SnapshotUpdateTest, DaemonTransition);
     FRIEND_TEST(SnapshotUpdateTest, DataWipeAfterRollback);
     FRIEND_TEST(SnapshotUpdateTest, DataWipeRollbackInRecovery);
     FRIEND_TEST(SnapshotUpdateTest, FullUpdateFlow);
     FRIEND_TEST(SnapshotUpdateTest, MergeCannotRemoveCow);
     FRIEND_TEST(SnapshotUpdateTest, MergeInRecovery);
     FRIEND_TEST(SnapshotUpdateTest, SnapshotStatusFileWithoutCow);
+    FRIEND_TEST(SnapshotUpdateTest, SpaceSwapUpdate);
     friend class SnapshotTest;
     friend class SnapshotUpdateTest;
     friend class FlashAfterUpdateTest;
     friend class LockTestConsumer;
+    friend class SnapshotFuzzEnv;
     friend struct AutoDeleteCowImage;
     friend struct AutoDeleteSnapshot;
     friend struct PartitionCowCreator;
@@ -298,11 +398,16 @@
     // This is created lazily since it can connect via binder.
     bool EnsureImageManager();
 
-    // Helper for first-stage init.
-    bool ForceLocalImageManager();
+    // Ensure we're connected to snapuserd.
+    bool EnsureSnapuserdConnected();
 
-    // Helper function for tests.
+    // Helpers for first-stage init.
+    bool ForceLocalImageManager();
+    const std::unique_ptr<IDeviceInfo>& device() const { return device_; }
+
+    // Helper functions for tests.
     IImageManager* image_manager() const { return images_.get(); }
+    void set_use_first_stage_snapuserd(bool value) { use_first_stage_snapuserd_ = value; }
 
     // Since libsnapshot is included into multiple processes, we flock() our
     // files for simple synchronization. LockedFile is a helper to assist with
@@ -337,7 +442,7 @@
     //
     // All sizes are specified in bytes, and the device, snapshot, COW partition and COW file sizes
     // must be a multiple of the sector size (512 bytes).
-    bool CreateSnapshot(LockedFile* lock, SnapshotStatus* status);
+    bool CreateSnapshot(LockedFile* lock, PartitionCowCreator* cow_creator, SnapshotStatus* status);
 
     // |name| should be the base partition name (e.g. "system_a"). Create the
     // backing COW image using the size previously passed to CreateSnapshot().
@@ -354,6 +459,15 @@
                      const std::string& cow_device, const std::chrono::milliseconds& timeout_ms,
                      std::string* dev_path);
 
+    // Create a dm-user device for a given snapshot.
+    bool MapDmUserCow(LockedFile* lock, const std::string& name, const std::string& cow_file,
+                      const std::string& base_device, const std::chrono::milliseconds& timeout_ms,
+                      std::string* path);
+
+    // Map the source device used for dm-user.
+    bool MapSourceDevice(LockedFile* lock, const std::string& name,
+                         const std::chrono::milliseconds& timeout_ms, std::string* path);
+
     // Map a COW image that was previous created with CreateCowImage.
     std::optional<std::string> MapCowImage(const std::string& name,
                                            const std::chrono::milliseconds& timeout_ms);
@@ -412,11 +526,13 @@
     std::string GetMergeStateFilePath() const;
 
     // Helpers for merging.
+    bool MergeSecondPhaseSnapshots(LockedFile* lock);
     bool SwitchSnapshotToMerge(LockedFile* lock, const std::string& name);
     bool RewriteSnapshotDeviceTable(const std::string& dm_name);
     bool MarkSnapshotMergeCompleted(LockedFile* snapshot_lock, const std::string& snapshot_name);
     void AcknowledgeMergeSuccess(LockedFile* lock);
     void AcknowledgeMergeFailure();
+    MergePhase DecideMergePhase(const SnapshotStatus& status);
     std::unique_ptr<LpMetadata> ReadCurrentMetadata();
 
     enum class MetadataPartitionState {
@@ -449,7 +565,8 @@
     //   UpdateState::MergeNeedsReboot
     UpdateState CheckMergeState(const std::function<bool()>& before_cancel);
     UpdateState CheckMergeState(LockedFile* lock, const std::function<bool()>& before_cancel);
-    UpdateState CheckTargetMergeState(LockedFile* lock, const std::string& name);
+    UpdateState CheckTargetMergeState(LockedFile* lock, const std::string& name,
+                                      const SnapshotUpdateStatus& update_status);
 
     // Interact with status files under /metadata/ota/snapshots.
     bool WriteSnapshotStatus(LockedFile* lock, const SnapshotStatus& status);
@@ -459,16 +576,46 @@
     std::string GetSnapshotBootIndicatorPath();
     std::string GetRollbackIndicatorPath();
     std::string GetForwardMergeIndicatorPath();
+    std::string GetOldPartitionMetadataPath();
 
-    // Return the name of the device holding the "snapshot" or "snapshot-merge"
-    // target. This may not be the final device presented via MapSnapshot(), if
-    // for example there is a linear segment.
-    std::string GetSnapshotDeviceName(const std::string& snapshot_name,
-                                      const SnapshotStatus& status);
+    const LpMetadata* ReadOldPartitionMetadata(LockedFile* lock);
+
+    bool MapAllPartitions(LockedFile* lock, const std::string& super_device, uint32_t slot,
+                          const std::chrono::milliseconds& timeout_ms);
+
+    // Reason for calling MapPartitionWithSnapshot.
+    enum class SnapshotContext {
+        // For writing or verification (during update_engine).
+        Update,
+
+        // For mounting a full readable device.
+        Mount,
+    };
+
+    struct SnapshotPaths {
+        // Target/base device (eg system_b), always present.
+        std::string target_device;
+
+        // COW name (eg system_cow). Not present if no COW is needed.
+        std::string cow_device_name;
+
+        // dm-snapshot instance. Not present in Update mode for VABC.
+        std::string snapshot_device;
+    };
+
+    // Helpers for OpenSnapshotWriter.
+    std::unique_ptr<ISnapshotWriter> OpenCompressedSnapshotWriter(
+            LockedFile* lock, const std::optional<std::string>& source_device,
+            const std::string& partition_name, const SnapshotStatus& status,
+            const SnapshotPaths& paths);
+    std::unique_ptr<ISnapshotWriter> OpenKernelSnapshotWriter(
+            LockedFile* lock, const std::optional<std::string>& source_device,
+            const std::string& partition_name, const SnapshotStatus& status,
+            const SnapshotPaths& paths);
 
     // Map the base device, COW devices, and snapshot device.
     bool MapPartitionWithSnapshot(LockedFile* lock, CreateLogicalPartitionParams params,
-                                  std::string* path);
+                                  SnapshotContext context, SnapshotPaths* paths);
 
     // Map the COW devices, including the partition in super and the images.
     // |params|:
@@ -488,6 +635,9 @@
     // The reverse of MapPartitionWithSnapshot.
     bool UnmapPartitionWithSnapshot(LockedFile* lock, const std::string& target_partition_name);
 
+    // Unmap a dm-user device through snapuserd.
+    bool UnmapDmUserDevice(const std::string& snapshot_name);
+
     // If there isn't a previous update, return true. |needs_merge| is set to false.
     // If there is a previous update but the device has not boot into it, tries to cancel the
     //   update and delete any snapshots. Return true if successful. |needs_merge| is set to false.
@@ -509,13 +659,15 @@
             const LpMetadata* exported_target_metadata, const std::string& target_suffix,
             const std::map<std::string, SnapshotStatus>& all_snapshot_status);
 
+    // Implementation of UnmapAllSnapshots(), with the lock provided.
+    bool UnmapAllSnapshots(LockedFile* lock);
+
     // Unmap all partitions that were mapped by CreateLogicalAndSnapshotPartitions.
     // This should only be called in recovery.
-    bool UnmapAllPartitions();
+    bool UnmapAllPartitionsInRecovery();
 
-    // Sanity check no snapshot overflows. Note that this returns false negatives if the snapshot
-    // overflows, then is remapped and not written afterwards. Hence, the function may only serve
-    // as a sanity check.
+    // Check no snapshot overflows. Note that this returns false negatives if the snapshot
+    // overflows, then is remapped and not written afterwards.
     bool EnsureNoOverflowSnapshot(LockedFile* lock);
 
     enum class Slot { Unknown, Source, Target };
@@ -526,8 +678,8 @@
 
     // Helper for RemoveAllSnapshots.
     // Check whether |name| should be deleted as a snapshot name.
-    bool ShouldDeleteSnapshot(LockedFile* lock, const std::map<std::string, bool>& flashing_status,
-                              Slot current_slot, const std::string& name);
+    bool ShouldDeleteSnapshot(const std::map<std::string, bool>& flashing_status, Slot current_slot,
+                              const std::string& name);
 
     // Create or delete forward merge indicator given |wipe|. Iff wipe is scheduled,
     // allow forward merge on FDR.
@@ -544,12 +696,40 @@
     bool GetMappedImageDeviceStringOrPath(const std::string& device_name,
                                           std::string* device_string_or_mapped_path);
 
+    // Same as above, but for paths only (no major:minor device strings).
+    bool GetMappedImageDevicePath(const std::string& device_name, std::string* device_path);
+
+    // Wait for a device to be created by ueventd (eg, its symlink or node to be populated).
+    // This is needed for any code that uses device-mapper path in first-stage init. If
+    // |timeout_ms| is empty or the given device is not a path, WaitForDevice immediately
+    // returns true.
+    bool WaitForDevice(const std::string& device, std::chrono::milliseconds timeout_ms);
+
+    enum class InitTransition { SELINUX_DETACH, SECOND_STAGE };
+
+    // Initiate the transition from first-stage to second-stage snapuserd. This
+    // process involves re-creating the dm-user table entries for each device,
+    // so that they connect to the new daemon. Once all new tables have been
+    // activated, we ask the first-stage daemon to cleanly exit.
+    //
+    // If the mode is SELINUX_DETACH, snapuserd_argv must be non-null and will
+    // be populated with a list of snapuserd arguments to pass to execve(). It
+    // is otherwise ignored.
+    bool PerformInitTransition(InitTransition transition,
+                               std::vector<std::string>* snapuserd_argv = nullptr);
+
+    SnapuserdClient* snapuserd_client() const { return snapuserd_client_.get(); }
+
     std::string gsid_dir_;
     std::string metadata_dir_;
     std::unique_ptr<IDeviceInfo> device_;
     std::unique_ptr<IImageManager> images_;
     bool has_local_image_manager_ = false;
+    bool use_first_stage_snapuserd_ = false;
     bool in_factory_data_reset_ = false;
+    std::function<bool(const std::string&)> uevent_regen_callback_;
+    std::unique_ptr<SnapuserdClient> snapuserd_client_;
+    std::unique_ptr<LpMetadata> old_partition_metadata_;
 };
 
 }  // namespace snapshot
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stats.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stats.h
index bdc3ea3..d691d4f 100644
--- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stats.h
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stats.h
@@ -23,16 +23,14 @@
 namespace android {
 namespace snapshot {
 
-class SnapshotMergeStats {
+class ISnapshotMergeStats {
   public:
-    // Not thread safe.
-    static SnapshotMergeStats* GetInstance(SnapshotManager& manager);
-
+    virtual ~ISnapshotMergeStats() = default;
     // Called when merge starts or resumes.
-    bool Start();
-    void set_state(android::snapshot::UpdateState state);
-    virtual void set_cow_file_size(uint64_t cow_file_size);
-    virtual uint64_t cow_file_size();
+    virtual bool Start() = 0;
+    virtual void set_state(android::snapshot::UpdateState state) = 0;
+    virtual void set_cow_file_size(uint64_t cow_file_size) = 0;
+    virtual uint64_t cow_file_size() = 0;
 
     // Called when merge ends. Properly clean up permanent storage.
     class Result {
@@ -42,11 +40,23 @@
         // Time between successful Start() / Resume() to Finish().
         virtual std::chrono::steady_clock::duration merge_time() const = 0;
     };
-    std::unique_ptr<Result> Finish();
+    // Return nullptr if any failure.
+    virtual std::unique_ptr<Result> Finish() = 0;
+};
+
+class SnapshotMergeStats : public ISnapshotMergeStats {
+  public:
+    // Not thread safe.
+    static SnapshotMergeStats* GetInstance(SnapshotManager& manager);
+
+    // ISnapshotMergeStats overrides
+    bool Start() override;
+    void set_state(android::snapshot::UpdateState state) override;
+    void set_cow_file_size(uint64_t cow_file_size) override;
+    uint64_t cow_file_size() override;
+    std::unique_ptr<Result> Finish() override;
 
   private:
-    virtual ~SnapshotMergeStats() {}
-
     bool ReadState();
     bool WriteState();
     bool DeleteState();
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h
new file mode 100644
index 0000000..cba3560
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <libsnapshot/snapshot.h>
+#include <payload_consumer/file_descriptor.h>
+
+namespace android::snapshot {
+
+class SnapshotManagerStub : public ISnapshotManager {
+  public:
+    // Create a stubbed snapshot manager. All calls into the stub fails.
+    static std::unique_ptr<ISnapshotManager> New();
+
+    // ISnapshotManager overrides.
+    bool BeginUpdate() override;
+    bool CancelUpdate() override;
+    bool FinishedSnapshotWrites(bool wipe) override;
+    bool InitiateMerge(uint64_t* cow_file_size = nullptr) override;
+    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
+                                   const std::function<bool()>& before_cancel = {}) override;
+    UpdateState GetUpdateState(double* progress = nullptr) override;
+    Return CreateUpdateSnapshots(
+            const chromeos_update_engine::DeltaArchiveManifest& manifest) override;
+    bool MapUpdateSnapshot(const android::fs_mgr::CreateLogicalPartitionParams& params,
+                           std::string* snapshot_path) override;
+    std::unique_ptr<ISnapshotWriter> OpenSnapshotWriter(
+            const android::fs_mgr::CreateLogicalPartitionParams& params,
+            const std::optional<std::string>& source_device) override;
+    bool UnmapUpdateSnapshot(const std::string& target_partition_name) override;
+    bool NeedSnapshotsInFirstStageMount() override;
+    bool CreateLogicalAndSnapshotPartitions(
+            const std::string& super_device,
+            const std::chrono::milliseconds& timeout_ms = {}) override;
+    bool HandleImminentDataWipe(const std::function<void()>& callback = {}) override;
+    bool FinishMergeInRecovery() override;
+    CreateResult RecoveryCreateSnapshotDevices() override;
+    CreateResult RecoveryCreateSnapshotDevices(
+            const std::unique_ptr<AutoDevice>& metadata_device) override;
+    bool Dump(std::ostream& os) override;
+    std::unique_ptr<AutoDevice> EnsureMetadataMounted() override;
+    ISnapshotMergeStats* GetSnapshotMergeStatsInstance() override;
+    bool MapAllSnapshots(const std::chrono::milliseconds& timeout_ms) override;
+    bool UnmapAllSnapshots() override;
+};
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot_writer.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_writer.h
new file mode 100644
index 0000000..bf5ce8b
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_writer.h
@@ -0,0 +1,113 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <optional>
+
+#include <android-base/unique_fd.h>
+
+#include <libsnapshot/cow_writer.h>
+
+namespace chromeos_update_engine {
+class FileDescriptor;
+}  // namespace chromeos_update_engine
+
+namespace android {
+namespace snapshot {
+
+class ISnapshotWriter : public ICowWriter {
+  public:
+    using FileDescriptor = chromeos_update_engine::FileDescriptor;
+
+    explicit ISnapshotWriter(const CowOptions& options);
+
+    // Set the source device. This is used for AddCopy() operations, if the
+    // underlying writer needs the original bytes (for example if backed by
+    // dm-snapshot or if writing directly to an unsnapshotted region). The
+    // device is only opened on the first operation that requires it.
+    void SetSourceDevice(const std::string& source_device);
+
+    // Open the writer in write mode (no append).
+    virtual bool Initialize() = 0;
+
+    // Open the writer in append mode, with the last label to resume
+    // from. See CowWriter::InitializeAppend.
+    virtual bool InitializeAppend(uint64_t label) = 0;
+
+    virtual std::unique_ptr<FileDescriptor> OpenReader() = 0;
+
+  protected:
+    android::base::borrowed_fd GetSourceFd();
+
+    std::optional<std::string> source_device_;
+
+  private:
+    android::base::unique_fd source_fd_;
+};
+
+// Send writes to a COW or a raw device directly, based on a threshold.
+class CompressedSnapshotWriter : public ISnapshotWriter {
+  public:
+    CompressedSnapshotWriter(const CowOptions& options);
+
+    // Sets the COW device; this is required.
+    bool SetCowDevice(android::base::unique_fd&& cow_device);
+
+    bool Initialize() override;
+    bool InitializeAppend(uint64_t label) override;
+    bool Finalize() override;
+    uint64_t GetCowSize() override;
+    std::unique_ptr<FileDescriptor> OpenReader() override;
+
+  protected:
+    bool EmitCopy(uint64_t new_block, uint64_t old_block) override;
+    bool EmitRawBlocks(uint64_t new_block_start, const void* data, size_t size) override;
+    bool EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) override;
+    bool EmitLabel(uint64_t label) override;
+
+  private:
+    android::base::unique_fd cow_device_;
+
+    std::unique_ptr<CowWriter> cow_;
+};
+
+// Write directly to a dm-snapshot device.
+class OnlineKernelSnapshotWriter : public ISnapshotWriter {
+  public:
+    OnlineKernelSnapshotWriter(const CowOptions& options);
+
+    // Set the device used for all writes.
+    void SetSnapshotDevice(android::base::unique_fd&& snapshot_fd, uint64_t cow_size);
+
+    bool Initialize() override { return true; }
+    bool InitializeAppend(uint64_t) override { return true; }
+
+    bool Finalize() override;
+    uint64_t GetCowSize() override { return cow_size_; }
+    std::unique_ptr<FileDescriptor> OpenReader() override;
+
+  protected:
+    bool EmitRawBlocks(uint64_t new_block_start, const void* data, size_t size) override;
+    bool EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) override;
+    bool EmitCopy(uint64_t new_block, uint64_t old_block) override;
+    bool EmitLabel(uint64_t label) override;
+
+  private:
+    android::base::unique_fd snapshot_fd_;
+    uint64_t cow_size_ = 0;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapuserd_client.h b/fs_mgr/libsnapshot/include/libsnapshot/snapuserd_client.h
new file mode 100644
index 0000000..1dab361
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapuserd_client.h
@@ -0,0 +1,79 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <unistd.h>
+
+#include <chrono>
+#include <cstring>
+#include <iostream>
+#include <string>
+#include <thread>
+#include <vector>
+
+#include <android-base/unique_fd.h>
+
+namespace android {
+namespace snapshot {
+
+static constexpr uint32_t PACKET_SIZE = 512;
+
+static constexpr char kSnapuserdSocket[] = "snapuserd";
+
+// Ensure that the second-stage daemon for snapuserd is running.
+bool EnsureSnapuserdStarted();
+
+class SnapuserdClient {
+  private:
+    android::base::unique_fd sockfd_;
+
+    bool Sendmsg(const std::string& msg);
+    std::string Receivemsg();
+
+    bool ValidateConnection();
+
+  public:
+    explicit SnapuserdClient(android::base::unique_fd&& sockfd);
+
+    static std::unique_ptr<SnapuserdClient> Connect(const std::string& socket_name,
+                                                    std::chrono::milliseconds timeout_ms);
+
+    bool StopSnapuserd();
+
+    // Initializing a snapuserd handler is a three-step process:
+    //
+    //  1. Client invokes InitDmUserCow. This creates the snapuserd handler and validates the
+    //     COW. The number of sectors required for the dm-user target is returned.
+    //  2. Client creates the device-mapper device with the dm-user target.
+    //  3. Client calls AttachControlDevice.
+    //
+    // The misc_name must be the "misc_name" given to dm-user in step 2.
+    //
+    uint64_t InitDmUserCow(const std::string& misc_name, const std::string& cow_device,
+                           const std::string& backing_device);
+    bool AttachDmUser(const std::string& misc_name);
+
+    // Wait for snapuserd to disassociate with a dm-user control device. This
+    // must ONLY be called if the control device has already been deleted.
+    bool WaitForDeviceDelete(const std::string& control_device);
+
+    // Detach snapuserd. This shuts down the listener socket, and will cause
+    // snapuserd to gracefully exit once all handler threads have terminated.
+    // This should only be used on first-stage instances of snapuserd.
+    bool DetachSnapuserd();
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapuserd_kernel.h b/fs_mgr/libsnapshot/include/libsnapshot/snapuserd_kernel.h
new file mode 100644
index 0000000..7941e68
--- /dev/null
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapuserd_kernel.h
@@ -0,0 +1,105 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+namespace android {
+namespace snapshot {
+
+#define DM_USER_REQ_MAP_READ 0
+#define DM_USER_REQ_MAP_WRITE 1
+
+#define DM_USER_RESP_SUCCESS 0
+#define DM_USER_RESP_ERROR 1
+#define DM_USER_RESP_UNSUPPORTED 2
+
+// Kernel COW header fields
+static constexpr uint32_t SNAP_MAGIC = 0x70416e53;
+
+static constexpr uint32_t SNAPSHOT_DISK_VERSION = 1;
+
+static constexpr uint32_t NUM_SNAPSHOT_HDR_CHUNKS = 1;
+
+static constexpr uint32_t SNAPSHOT_VALID = 1;
+
+/*
+ * The basic unit of block I/O is a sector. It is used in a number of contexts
+ * in Linux (blk, bio, genhd). The size of one sector is 512 = 2**9
+ * bytes. Variables of type sector_t represent an offset or size that is a
+ * multiple of 512 bytes. Hence these two constants.
+ */
+static constexpr uint32_t SECTOR_SHIFT = 9;
+
+typedef __u64 sector_t;
+typedef sector_t chunk_t;
+
+static constexpr uint32_t CHUNK_SIZE = 8;
+static constexpr uint32_t CHUNK_SHIFT = (__builtin_ffs(CHUNK_SIZE) - 1);
+
+static constexpr uint32_t BLOCK_SIZE = 4096;
+static constexpr uint32_t BLOCK_SHIFT = (__builtin_ffs(BLOCK_SIZE) - 1);
+
+#define DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d))
+
+// This structure represents the kernel COW header.
+// All the below fields should be in Little Endian format.
+struct disk_header {
+    uint32_t magic;
+
+    /*
+     * Is this snapshot valid.  There is no way of recovering
+     * an invalid snapshot.
+     */
+    uint32_t valid;
+
+    /*
+     * Simple, incrementing version. no backward
+     * compatibility.
+     */
+    uint32_t version;
+
+    /* In sectors */
+    uint32_t chunk_size;
+} __packed;
+
+// A disk exception is a mapping of old_chunk to new_chunk
+// old_chunk is the chunk ID of a dm-snapshot device.
+// new_chunk is the chunk ID of the COW device.
+struct disk_exception {
+    uint64_t old_chunk;
+    uint64_t new_chunk;
+} __packed;
+
+// Control structures to communicate with dm-user
+// It comprises of header and a payload
+struct dm_user_header {
+    __u64 seq;
+    __u64 type;
+    __u64 flags;
+    __u64 sector;
+    __u64 len;
+} __attribute__((packed));
+
+struct dm_user_payload {
+    __u8 buf[];
+};
+
+// Message comprising both header and payload
+struct dm_user_message {
+    struct dm_user_header header;
+    struct dm_user_payload payload;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/include_test/libsnapshot/test_helpers.h b/fs_mgr/libsnapshot/include_test/libsnapshot/test_helpers.h
index 8e369b0..b038527 100644
--- a/fs_mgr/libsnapshot/include_test/libsnapshot/test_helpers.h
+++ b/fs_mgr/libsnapshot/include_test/libsnapshot/test_helpers.h
@@ -51,8 +51,8 @@
 extern std::unique_ptr<SnapshotManager> sm;
 extern class TestDeviceInfo* test_device;
 extern std::string fake_super;
-static constexpr uint64_t kSuperSize = 16_MiB + 4_KiB;
-static constexpr uint64_t kGroupSize = 16_MiB;
+static constexpr uint64_t kSuperSize = 32_MiB + 4_KiB;
+static constexpr uint64_t kGroupSize = 32_MiB;
 
 // Redirect requests for "super" to our fake super partition.
 class TestPartitionOpener final : public android::fs_mgr::PartitionOpener {
@@ -95,6 +95,7 @@
         unbootable_slots_.insert(slot);
         return true;
     }
+    bool IsTestDevice() const override { return true; }
 
     bool IsSlotUnbootable(uint32_t slot) { return unbootable_slots_.count(slot) != 0; }
 
@@ -144,6 +145,8 @@
 // Expect space of |path| is multiple of 4K.
 bool WriteRandomData(const std::string& path, std::optional<size_t> expect_size = std::nullopt,
                      std::string* hash = nullptr);
+bool WriteRandomData(ICowWriter* writer, std::string* hash = nullptr);
+std::string HashSnapshot(ISnapshotWriter* writer);
 
 std::optional<std::string> GetHash(const std::string& path);
 
diff --git a/fs_mgr/libsnapshot/inspect_cow.cpp b/fs_mgr/libsnapshot/inspect_cow.cpp
new file mode 100644
index 0000000..453b5c6
--- /dev/null
+++ b/fs_mgr/libsnapshot/inspect_cow.cpp
@@ -0,0 +1,150 @@
+//
+// Copyright (C) 2020 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.
+//
+#include <stdio.h>
+#include <unistd.h>
+
+#include <iostream>
+#include <string>
+
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include <libsnapshot/cow_reader.h>
+
+namespace android {
+namespace snapshot {
+
+void MyLogger(android::base::LogId, android::base::LogSeverity severity, const char*, const char*,
+              unsigned int, const char* message) {
+    if (severity == android::base::ERROR) {
+        fprintf(stderr, "%s\n", message);
+    } else {
+        fprintf(stdout, "%s\n", message);
+    }
+}
+
+static void usage(void) {
+    LOG(ERROR) << "Usage: inspect_cow [-sd] <COW_FILE>";
+    LOG(ERROR) << "\t -s Run Silent";
+    LOG(ERROR) << "\t -d Attempt to decompress\n";
+}
+
+// Sink that always appends to the end of a string.
+class StringSink : public IByteSink {
+  public:
+    void* GetBuffer(size_t requested, size_t* actual) override {
+        size_t old_size = stream_.size();
+        stream_.resize(old_size + requested, '\0');
+        *actual = requested;
+        return stream_.data() + old_size;
+    }
+    bool ReturnData(void*, size_t) override { return true; }
+    void Reset() { stream_.clear(); }
+
+    std::string& stream() { return stream_; }
+
+  private:
+    std::string stream_;
+};
+
+static bool Inspect(const std::string& path, bool silent, bool decompress) {
+    android::base::unique_fd fd(open(path.c_str(), O_RDONLY));
+    if (fd < 0) {
+        PLOG(ERROR) << "open failed: " << path;
+        return false;
+    }
+
+    CowReader reader;
+    if (!reader.Parse(fd)) {
+        LOG(ERROR) << "parse failed: " << path;
+        return false;
+    }
+
+    CowHeader header;
+    if (!reader.GetHeader(&header)) {
+        LOG(ERROR) << "could not get header: " << path;
+        return false;
+    }
+    CowFooter footer;
+    bool has_footer = false;
+    if (reader.GetFooter(&footer)) has_footer = true;
+
+    if (!silent) {
+        std::cout << "Major version: " << header.major_version << "\n";
+        std::cout << "Minor version: " << header.minor_version << "\n";
+        std::cout << "Header size: " << header.header_size << "\n";
+        std::cout << "Footer size: " << header.footer_size << "\n";
+        std::cout << "Block size: " << header.block_size << "\n";
+        std::cout << "\n";
+        if (has_footer) {
+            std::cout << "Total Ops size: " << footer.op.ops_size << "\n";
+            std::cout << "Number of Ops: " << footer.op.num_ops << "\n";
+            std::cout << "\n";
+        }
+    }
+
+    auto iter = reader.GetOpIter();
+    StringSink sink;
+    bool success = true;
+    while (!iter->Done()) {
+        const CowOperation& op = iter->Get();
+
+        if (!silent) std::cout << op << "\n";
+
+        if (decompress && op.type == kCowReplaceOp && op.compression != kCowCompressNone) {
+            if (!reader.ReadData(op, &sink)) {
+                std::cerr << "Failed to decompress for :" << op << "\n";
+                success = false;
+            }
+            sink.Reset();
+        }
+
+        iter->Next();
+    }
+
+    return success;
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+int main(int argc, char** argv) {
+    int ch;
+    bool silent = false;
+    bool decompress = false;
+    while ((ch = getopt(argc, argv, "sd")) != -1) {
+        switch (ch) {
+            case 's':
+                silent = true;
+                break;
+            case 'd':
+                decompress = true;
+                break;
+            default:
+                android::snapshot::usage();
+        }
+    }
+    android::base::InitLogging(argv, android::snapshot::MyLogger);
+
+    if (argc < optind + 1) {
+        android::snapshot::usage();
+        return 1;
+    }
+
+    if (!android::snapshot::Inspect(argv[optind], silent, decompress)) {
+        return 1;
+    }
+    return 0;
+}
diff --git a/fs_mgr/libsnapshot/make_cow_from_ab_ota.cpp b/fs_mgr/libsnapshot/make_cow_from_ab_ota.cpp
new file mode 100644
index 0000000..6a5754d
--- /dev/null
+++ b/fs_mgr/libsnapshot/make_cow_from_ab_ota.cpp
@@ -0,0 +1,692 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <iostream>
+#include <limits>
+#include <string>
+#include <unordered_set>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include <bsdiff/bspatch.h>
+#include <bzlib.h>
+#include <gflags/gflags.h>
+#include <libsnapshot/cow_writer.h>
+#include <puffin/puffpatch.h>
+#include <sparse/sparse.h>
+#include <update_engine/update_metadata.pb.h>
+#include <xz.h>
+#include <ziparchive/zip_archive.h>
+
+namespace android {
+namespace snapshot {
+
+using android::base::borrowed_fd;
+using android::base::unique_fd;
+using chromeos_update_engine::DeltaArchiveManifest;
+using chromeos_update_engine::Extent;
+using chromeos_update_engine::InstallOperation;
+using chromeos_update_engine::PartitionUpdate;
+
+static constexpr uint64_t kBlockSize = 4096;
+
+DEFINE_string(source_tf, "", "Source target files (dir or zip file) for incremental payloads");
+DEFINE_string(compression, "gz", "Compression type to use (none or gz)");
+DEFINE_uint32(cluster_ops, 0, "Number of Cow Ops per cluster (0 or >1)");
+
+void MyLogger(android::base::LogId, android::base::LogSeverity severity, const char*, const char*,
+              unsigned int, const char* message) {
+    if (severity == android::base::ERROR) {
+        fprintf(stderr, "%s\n", message);
+    } else {
+        fprintf(stdout, "%s\n", message);
+    }
+}
+
+uint64_t ToLittleEndian(uint64_t value) {
+    union {
+        uint64_t u64;
+        char bytes[8];
+    } packed;
+    packed.u64 = value;
+    std::swap(packed.bytes[0], packed.bytes[7]);
+    std::swap(packed.bytes[1], packed.bytes[6]);
+    std::swap(packed.bytes[2], packed.bytes[5]);
+    std::swap(packed.bytes[3], packed.bytes[4]);
+    return packed.u64;
+}
+
+class PayloadConverter final {
+  public:
+    PayloadConverter(const std::string& in_file, const std::string& out_dir)
+        : in_file_(in_file), out_dir_(out_dir), source_tf_zip_(nullptr, &CloseArchive) {}
+
+    bool Run();
+
+  private:
+    bool OpenPayload();
+    bool OpenSourceTargetFiles();
+    bool ProcessPartition(const PartitionUpdate& update);
+    bool ProcessOperation(const InstallOperation& op);
+    bool ProcessZero(const InstallOperation& op);
+    bool ProcessCopy(const InstallOperation& op);
+    bool ProcessReplace(const InstallOperation& op);
+    bool ProcessDiff(const InstallOperation& op);
+    borrowed_fd OpenSourceImage();
+
+    std::string in_file_;
+    std::string out_dir_;
+    unique_fd in_fd_;
+    uint64_t payload_offset_ = 0;
+    DeltaArchiveManifest manifest_;
+    std::unordered_set<std::string> dap_;
+    unique_fd source_tf_fd_;
+    std::unique_ptr<ZipArchive, decltype(&CloseArchive)> source_tf_zip_;
+
+    // Updated during ProcessPartition().
+    std::string partition_name_;
+    std::unique_ptr<CowWriter> writer_;
+    unique_fd source_image_;
+};
+
+bool PayloadConverter::Run() {
+    if (!OpenPayload()) {
+        return false;
+    }
+
+    if (manifest_.has_dynamic_partition_metadata()) {
+        const auto& dpm = manifest_.dynamic_partition_metadata();
+        for (const auto& group : dpm.groups()) {
+            for (const auto& partition : group.partition_names()) {
+                dap_.emplace(partition);
+            }
+        }
+    }
+
+    if (dap_.empty()) {
+        LOG(ERROR) << "No dynamic partitions found.";
+        return false;
+    }
+
+    if (!OpenSourceTargetFiles()) {
+        return false;
+    }
+
+    for (const auto& update : manifest_.partitions()) {
+        if (!ProcessPartition(update)) {
+            return false;
+        }
+        writer_ = nullptr;
+        source_image_.reset();
+    }
+    return true;
+}
+
+bool PayloadConverter::OpenSourceTargetFiles() {
+    if (FLAGS_source_tf.empty()) {
+        return true;
+    }
+
+    source_tf_fd_.reset(open(FLAGS_source_tf.c_str(), O_RDONLY));
+    if (source_tf_fd_ < 0) {
+        LOG(ERROR) << "open failed: " << FLAGS_source_tf;
+        return false;
+    }
+
+    struct stat s;
+    if (fstat(source_tf_fd_.get(), &s) < 0) {
+        LOG(ERROR) << "fstat failed: " << FLAGS_source_tf;
+        return false;
+    }
+    if (S_ISDIR(s.st_mode)) {
+        return true;
+    }
+
+    // Otherwise, assume it's a zip file.
+    ZipArchiveHandle handle;
+    if (OpenArchiveFd(source_tf_fd_.get(), FLAGS_source_tf.c_str(), &handle, false)) {
+        LOG(ERROR) << "Could not open " << FLAGS_source_tf << " as a zip archive.";
+        return false;
+    }
+    source_tf_zip_.reset(handle);
+    return true;
+}
+
+bool PayloadConverter::ProcessPartition(const PartitionUpdate& update) {
+    auto partition_name = update.partition_name();
+    if (dap_.find(partition_name) == dap_.end()) {
+        // Skip non-DAP partitions.
+        return true;
+    }
+
+    auto path = out_dir_ + "/" + partition_name + ".cow";
+    unique_fd fd(open(path.c_str(), O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644));
+    if (fd < 0) {
+        PLOG(ERROR) << "open failed: " << path;
+        return false;
+    }
+
+    CowOptions options;
+    options.block_size = kBlockSize;
+    options.compression = FLAGS_compression;
+    options.cluster_ops = FLAGS_cluster_ops;
+
+    writer_ = std::make_unique<CowWriter>(options);
+    if (!writer_->Initialize(std::move(fd))) {
+        LOG(ERROR) << "Unable to initialize COW writer";
+        return false;
+    }
+
+    partition_name_ = partition_name;
+
+    for (const auto& op : update.operations()) {
+        if (!ProcessOperation(op)) {
+            return false;
+        }
+    }
+
+    if (!writer_->Finalize()) {
+        LOG(ERROR) << "Unable to finalize COW for " << partition_name;
+        return false;
+    }
+    return true;
+}
+
+bool PayloadConverter::ProcessOperation(const InstallOperation& op) {
+    switch (op.type()) {
+        case InstallOperation::SOURCE_COPY:
+            return ProcessCopy(op);
+        case InstallOperation::BROTLI_BSDIFF:
+        case InstallOperation::PUFFDIFF:
+            return ProcessDiff(op);
+        case InstallOperation::REPLACE:
+        case InstallOperation::REPLACE_XZ:
+        case InstallOperation::REPLACE_BZ:
+            return ProcessReplace(op);
+        case InstallOperation::ZERO:
+            return ProcessZero(op);
+        default:
+            LOG(ERROR) << "Unsupported op: " << (int)op.type();
+            return false;
+    }
+    return true;
+}
+
+bool PayloadConverter::ProcessZero(const InstallOperation& op) {
+    for (const auto& extent : op.dst_extents()) {
+        if (!writer_->AddZeroBlocks(extent.start_block(), extent.num_blocks())) {
+            LOG(ERROR) << "Could not add zero operation";
+            return false;
+        }
+    }
+    return true;
+}
+
+template <typename T>
+static uint64_t SizeOfAllExtents(const T& extents) {
+    uint64_t total = 0;
+    for (const auto& extent : extents) {
+        total += extent.num_blocks() * kBlockSize;
+    }
+    return total;
+}
+
+class PuffInputStream final : public puffin::StreamInterface {
+  public:
+    PuffInputStream(uint8_t* buffer, size_t length) : buffer_(buffer), length_(length), pos_(0) {}
+
+    bool GetSize(uint64_t* size) const override {
+        *size = length_;
+        return true;
+    }
+    bool GetOffset(uint64_t* offset) const override {
+        *offset = pos_;
+        return true;
+    }
+    bool Seek(uint64_t offset) override {
+        if (offset > length_) return false;
+        pos_ = offset;
+        return true;
+    }
+    bool Read(void* buffer, size_t length) override {
+        if (length_ - pos_ < length) return false;
+        memcpy(buffer, buffer_ + pos_, length);
+        pos_ += length;
+        return true;
+    }
+    bool Write(const void*, size_t) override { return false; }
+    bool Close() override { return true; }
+
+  private:
+    uint8_t* buffer_;
+    size_t length_;
+    size_t pos_;
+};
+
+class PuffOutputStream final : public puffin::StreamInterface {
+  public:
+    PuffOutputStream(std::vector<uint8_t>& stream) : stream_(stream), pos_(0) {}
+
+    bool GetSize(uint64_t* size) const override {
+        *size = stream_.size();
+        return true;
+    }
+    bool GetOffset(uint64_t* offset) const override {
+        *offset = pos_;
+        return true;
+    }
+    bool Seek(uint64_t offset) override {
+        if (offset > stream_.size()) {
+            return false;
+        }
+        pos_ = offset;
+        return true;
+    }
+    bool Read(void* buffer, size_t length) override {
+        if (stream_.size() - pos_ < length) {
+            return false;
+        }
+        memcpy(buffer, &stream_[0] + pos_, length);
+        pos_ += length;
+        return true;
+    }
+    bool Write(const void* buffer, size_t length) override {
+        auto remaining = stream_.size() - pos_;
+        if (remaining < length) {
+            stream_.resize(stream_.size() + (length - remaining));
+        }
+        memcpy(&stream_[0] + pos_, buffer, length);
+        pos_ += length;
+        return true;
+    }
+    bool Close() override { return true; }
+
+  private:
+    std::vector<uint8_t>& stream_;
+    size_t pos_;
+};
+
+bool PayloadConverter::ProcessDiff(const InstallOperation& op) {
+    auto source_image = OpenSourceImage();
+    if (source_image < 0) {
+        return false;
+    }
+
+    uint64_t src_length = SizeOfAllExtents(op.src_extents());
+    auto src = std::make_unique<uint8_t[]>(src_length);
+    size_t src_pos = 0;
+
+    // Read source bytes.
+    for (const auto& extent : op.src_extents()) {
+        uint64_t offset = extent.start_block() * kBlockSize;
+        if (lseek(source_image.get(), offset, SEEK_SET) < 0) {
+            PLOG(ERROR) << "lseek source image failed";
+            return false;
+        }
+
+        uint64_t size = extent.num_blocks() * kBlockSize;
+        CHECK(src_length - src_pos >= size);
+        if (!android::base::ReadFully(source_image, src.get() + src_pos, size)) {
+            PLOG(ERROR) << "read source image failed";
+            return false;
+        }
+        src_pos += size;
+    }
+    CHECK(src_pos == src_length);
+
+    // Read patch bytes.
+    auto patch = std::make_unique<uint8_t[]>(op.data_length());
+    if (lseek(in_fd_.get(), payload_offset_ + op.data_offset(), SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek payload failed";
+        return false;
+    }
+    if (!android::base::ReadFully(in_fd_, patch.get(), op.data_length())) {
+        PLOG(ERROR) << "read payload failed";
+        return false;
+    }
+
+    std::vector<uint8_t> dest(SizeOfAllExtents(op.dst_extents()));
+
+    // Apply the diff.
+    if (op.type() == InstallOperation::BROTLI_BSDIFF) {
+        size_t dest_pos = 0;
+        auto sink = [&](const uint8_t* data, size_t length) -> size_t {
+            CHECK(dest.size() - dest_pos >= length);
+            memcpy(&dest[dest_pos], data, length);
+            dest_pos += length;
+            return length;
+        };
+        if (int rv = bsdiff::bspatch(src.get(), src_pos, patch.get(), op.data_length(), sink)) {
+            LOG(ERROR) << "bspatch failed, error code " << rv;
+            return false;
+        }
+    } else if (op.type() == InstallOperation::PUFFDIFF) {
+        auto src_stream = std::make_unique<PuffInputStream>(src.get(), src_length);
+        auto dest_stream = std::make_unique<PuffOutputStream>(dest);
+        bool ok = PuffPatch(std::move(src_stream), std::move(dest_stream), patch.get(),
+                            op.data_length());
+        if (!ok) {
+            LOG(ERROR) << "puffdiff operation failed to apply";
+            return false;
+        }
+    } else {
+        LOG(ERROR) << "unsupported diff operation: " << op.type();
+        return false;
+    }
+
+    // Write the final blocks to the COW.
+    size_t dest_pos = 0;
+    for (const auto& extent : op.dst_extents()) {
+        uint64_t size = extent.num_blocks() * kBlockSize;
+        CHECK(dest.size() - dest_pos >= size);
+
+        if (!writer_->AddRawBlocks(extent.start_block(), &dest[dest_pos], size)) {
+            return false;
+        }
+        dest_pos += size;
+    }
+    return true;
+}
+
+borrowed_fd PayloadConverter::OpenSourceImage() {
+    if (source_image_ >= 0) {
+        return source_image_;
+    }
+
+    unique_fd unzip_fd;
+
+    auto local_path = "IMAGES/" + partition_name_ + ".img";
+    if (source_tf_zip_) {
+        {
+            TemporaryFile tmp;
+            if (tmp.fd < 0) {
+                PLOG(ERROR) << "mkstemp failed";
+                return -1;
+            }
+            unzip_fd.reset(tmp.release());
+        }
+
+        ZipEntry64 entry;
+        if (FindEntry(source_tf_zip_.get(), local_path, &entry)) {
+            LOG(ERROR) << "not found in archive: " << local_path;
+            return -1;
+        }
+        if (ExtractEntryToFile(source_tf_zip_.get(), &entry, unzip_fd.get())) {
+            LOG(ERROR) << "could not extract " << local_path;
+            return -1;
+        }
+        if (lseek(unzip_fd.get(), 0, SEEK_SET) < 0) {
+            PLOG(ERROR) << "lseek failed";
+            return -1;
+        }
+    } else if (source_tf_fd_ >= 0) {
+        unzip_fd.reset(openat(source_tf_fd_.get(), local_path.c_str(), O_RDONLY));
+        if (unzip_fd < 0) {
+            PLOG(ERROR) << "open failed: " << FLAGS_source_tf << "/" << local_path;
+            return -1;
+        }
+    } else {
+        LOG(ERROR) << "No source target files package was specified; need -source_tf";
+        return -1;
+    }
+
+    std::unique_ptr<struct sparse_file, decltype(&sparse_file_destroy)> s(
+            sparse_file_import(unzip_fd.get(), false, false), &sparse_file_destroy);
+    if (s) {
+        TemporaryFile tmp;
+        if (tmp.fd < 0) {
+            PLOG(ERROR) << "mkstemp failed";
+            return -1;
+        }
+        if (sparse_file_write(s.get(), tmp.fd, false, false, false) < 0) {
+            LOG(ERROR) << "sparse_file_write failed";
+            return -1;
+        }
+        source_image_.reset(tmp.release());
+    } else {
+        source_image_ = std::move(unzip_fd);
+    }
+    return source_image_;
+}
+
+template <typename ContainerType>
+class ExtentIter final {
+  public:
+    ExtentIter(const ContainerType& container)
+        : iter_(container.cbegin()), end_(container.cend()), dst_index_(0) {}
+
+    bool GetNext(uint64_t* block) {
+        while (iter_ != end_) {
+            if (dst_index_ < iter_->num_blocks()) {
+                break;
+            }
+            iter_++;
+            dst_index_ = 0;
+        }
+        if (iter_ == end_) {
+            return false;
+        }
+        *block = iter_->start_block() + dst_index_;
+        dst_index_++;
+        return true;
+    }
+
+  private:
+    typename ContainerType::const_iterator iter_;
+    typename ContainerType::const_iterator end_;
+    uint64_t dst_index_;
+};
+
+bool PayloadConverter::ProcessCopy(const InstallOperation& op) {
+    ExtentIter dst_blocks(op.dst_extents());
+
+    for (const auto& extent : op.src_extents()) {
+        for (uint64_t i = 0; i < extent.num_blocks(); i++) {
+            uint64_t src_block = extent.start_block() + i;
+            uint64_t dst_block;
+            if (!dst_blocks.GetNext(&dst_block)) {
+                LOG(ERROR) << "SOURCE_COPY contained mismatching extents";
+                return false;
+            }
+            if (src_block == dst_block) continue;
+            if (!writer_->AddCopy(dst_block, src_block)) {
+                LOG(ERROR) << "Could not add copy operation";
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
+bool PayloadConverter::ProcessReplace(const InstallOperation& op) {
+    auto buffer_size = op.data_length();
+    auto buffer = std::make_unique<char[]>(buffer_size);
+    uint64_t offs = payload_offset_ + op.data_offset();
+    if (lseek(in_fd_.get(), offs, SEEK_SET) < 0) {
+        PLOG(ERROR) << "lseek " << offs << " failed";
+        return false;
+    }
+    if (!android::base::ReadFully(in_fd_, buffer.get(), buffer_size)) {
+        PLOG(ERROR) << "read " << buffer_size << " bytes from offset " << offs << "failed";
+        return false;
+    }
+
+    uint64_t dst_size = 0;
+    for (const auto& extent : op.dst_extents()) {
+        dst_size += extent.num_blocks() * kBlockSize;
+    }
+
+    if (op.type() == InstallOperation::REPLACE_BZ) {
+        auto tmp = std::make_unique<char[]>(dst_size);
+
+        uint32_t actual_size;
+        if (dst_size > std::numeric_limits<typeof(actual_size)>::max()) {
+            LOG(ERROR) << "too many bytes to decompress: " << dst_size;
+            return false;
+        }
+        actual_size = static_cast<uint32_t>(dst_size);
+
+        auto rv = BZ2_bzBuffToBuffDecompress(tmp.get(), &actual_size, buffer.get(), buffer_size, 0,
+                                             0);
+        if (rv) {
+            LOG(ERROR) << "bz2 decompress failed: " << rv;
+            return false;
+        }
+        if (actual_size != dst_size) {
+            LOG(ERROR) << "bz2 returned " << actual_size << " bytes, expected " << dst_size;
+            return false;
+        }
+        buffer = std::move(tmp);
+        buffer_size = dst_size;
+    } else if (op.type() == InstallOperation::REPLACE_XZ) {
+        constexpr uint32_t kXzMaxDictSize = 64 * 1024 * 1024;
+
+        if (dst_size > std::numeric_limits<size_t>::max()) {
+            LOG(ERROR) << "too many bytes to decompress: " << dst_size;
+            return false;
+        }
+
+        std::unique_ptr<struct xz_dec, decltype(&xz_dec_end)> s(
+                xz_dec_init(XZ_DYNALLOC, kXzMaxDictSize), xz_dec_end);
+        if (!s) {
+            LOG(ERROR) << "xz_dec_init failed";
+            return false;
+        }
+
+        auto tmp = std::make_unique<char[]>(dst_size);
+
+        struct xz_buf args;
+        args.in = reinterpret_cast<const uint8_t*>(buffer.get());
+        args.in_pos = 0;
+        args.in_size = buffer_size;
+        args.out = reinterpret_cast<uint8_t*>(tmp.get());
+        args.out_pos = 0;
+        args.out_size = dst_size;
+
+        auto rv = xz_dec_run(s.get(), &args);
+        if (rv != XZ_STREAM_END) {
+            LOG(ERROR) << "xz decompress failed: " << (int)rv;
+            return false;
+        }
+        buffer = std::move(tmp);
+        buffer_size = dst_size;
+    }
+
+    uint64_t buffer_pos = 0;
+    for (const auto& extent : op.dst_extents()) {
+        uint64_t extent_size = extent.num_blocks() * kBlockSize;
+        if (buffer_size - buffer_pos < extent_size) {
+            LOG(ERROR) << "replace op ran out of input buffer";
+            return false;
+        }
+        if (!writer_->AddRawBlocks(extent.start_block(), buffer.get() + buffer_pos, extent_size)) {
+            LOG(ERROR) << "failed to add raw blocks from replace op";
+            return false;
+        }
+        buffer_pos += extent_size;
+    }
+    return true;
+}
+
+bool PayloadConverter::OpenPayload() {
+    in_fd_.reset(open(in_file_.c_str(), O_RDONLY));
+    if (in_fd_ < 0) {
+        PLOG(ERROR) << "open " << in_file_;
+        return false;
+    }
+
+    char magic[4];
+    if (!android::base::ReadFully(in_fd_, magic, sizeof(magic))) {
+        PLOG(ERROR) << "read magic";
+        return false;
+    }
+    if (std::string(magic, sizeof(magic)) != "CrAU") {
+        LOG(ERROR) << "Invalid magic in " << in_file_;
+        return false;
+    }
+
+    uint64_t version;
+    uint64_t manifest_size;
+    uint32_t manifest_signature_size = 0;
+    if (!android::base::ReadFully(in_fd_, &version, sizeof(version))) {
+        PLOG(ERROR) << "read version";
+        return false;
+    }
+    version = ToLittleEndian(version);
+    if (version < 2) {
+        LOG(ERROR) << "Only payload version 2 or higher is supported.";
+        return false;
+    }
+
+    if (!android::base::ReadFully(in_fd_, &manifest_size, sizeof(manifest_size))) {
+        PLOG(ERROR) << "read manifest_size";
+        return false;
+    }
+    manifest_size = ToLittleEndian(manifest_size);
+    if (!android::base::ReadFully(in_fd_, &manifest_signature_size,
+                                  sizeof(manifest_signature_size))) {
+        PLOG(ERROR) << "read manifest_signature_size";
+        return false;
+    }
+    manifest_signature_size = ntohl(manifest_signature_size);
+
+    auto manifest = std::make_unique<uint8_t[]>(manifest_size);
+    if (!android::base::ReadFully(in_fd_, manifest.get(), manifest_size)) {
+        PLOG(ERROR) << "read manifest";
+        return false;
+    }
+
+    // Skip past manifest signature.
+    auto offs = lseek(in_fd_, manifest_signature_size, SEEK_CUR);
+    if (offs < 0) {
+        PLOG(ERROR) << "lseek failed";
+        return false;
+    }
+    payload_offset_ = offs;
+
+    if (!manifest_.ParseFromArray(manifest.get(), manifest_size)) {
+        LOG(ERROR) << "could not parse manifest";
+        return false;
+    }
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+int main(int argc, char** argv) {
+    android::base::InitLogging(argv, android::snapshot::MyLogger);
+    gflags::SetUsageMessage("Convert OTA payload to a Virtual A/B COW");
+    int arg_start = gflags::ParseCommandLineFlags(&argc, &argv, false);
+
+    xz_crc32_init();
+
+    if (argc - arg_start != 2) {
+        std::cerr << "Usage: [options] <payload.bin> <out-dir>\n";
+        return 1;
+    }
+
+    android::snapshot::PayloadConverter pc(argv[arg_start], argv[arg_start + 1]);
+    return pc.Run() ? 0 : 1;
+}
diff --git a/fs_mgr/libsnapshot/partition_cow_creator.cpp b/fs_mgr/libsnapshot/partition_cow_creator.cpp
index 0df5664..da6fc9d 100644
--- a/fs_mgr/libsnapshot/partition_cow_creator.cpp
+++ b/fs_mgr/libsnapshot/partition_cow_creator.cpp
@@ -18,6 +18,7 @@
 
 #include <android-base/logging.h>
 #include <android/snapshot/snapshot.pb.h>
+#include <storage_literals/storage_literals.h>
 
 #include "dm_snapshot_internals.h"
 #include "utility.h"
@@ -34,6 +35,10 @@
 namespace android {
 namespace snapshot {
 
+static constexpr uint64_t kBlockSize = 4096;
+
+using namespace android::storage_literals;
+
 // Intersect two linear extents. If no intersection, return an extent with length 0.
 static std::unique_ptr<Extent> Intersect(Extent* target_extent, Extent* existing_extent) {
     // Convert target_extent and existing_extent to linear extents. Zero extents
@@ -138,6 +143,22 @@
 }
 
 uint64_t PartitionCowCreator::GetCowSize() {
+    if (compression_enabled) {
+        if (update == nullptr || !update->has_estimate_cow_size()) {
+            LOG(ERROR) << "Update manifest does not include a COW size";
+            return 0;
+        }
+
+        // Add an extra 2MB of wiggle room for any minor differences in labels/metadata
+        // that might come up.
+        auto size = update->estimate_cow_size() + 2_MiB;
+
+        // Align to nearest block.
+        size += kBlockSize - 1;
+        size &= ~(kBlockSize - 1);
+        return size;
+    }
+
     // WARNING: The origin partition should be READ-ONLY
     const uint64_t logical_block_size = current_metadata->logical_block_size();
     const unsigned int sectors_per_block = logical_block_size / kSectorSize;
@@ -149,9 +170,9 @@
         WriteExtent(&sc, de, sectors_per_block);
     }
 
-    if (operations == nullptr) return sc.cow_size_bytes();
+    if (update == nullptr) return sc.cow_size_bytes();
 
-    for (const auto& iop : *operations) {
+    for (const auto& iop : update->operations()) {
         const InstallOperation* written_op = &iop;
         InstallOperation buf;
         // Do not allocate space for extents that are going to be skipped
@@ -213,6 +234,9 @@
 
     LOG(INFO) << "Remaining free space for COW: " << free_region_length << " bytes";
     auto cow_size = GetCowSize();
+    if (!cow_size) {
+        return {};
+    }
 
     // Compute the COW partition size.
     uint64_t cow_partition_size = std::min(cow_size, free_region_length);
diff --git a/fs_mgr/libsnapshot/partition_cow_creator.h b/fs_mgr/libsnapshot/partition_cow_creator.h
index 699f9a1..64d186b 100644
--- a/fs_mgr/libsnapshot/partition_cow_creator.h
+++ b/fs_mgr/libsnapshot/partition_cow_creator.h
@@ -36,6 +36,7 @@
     using MetadataBuilder = android::fs_mgr::MetadataBuilder;
     using Partition = android::fs_mgr::Partition;
     using InstallOperation = chromeos_update_engine::InstallOperation;
+    using PartitionUpdate = chromeos_update_engine::PartitionUpdate;
     template <typename T>
     using RepeatedPtrField = google::protobuf::RepeatedPtrField<T>;
 
@@ -50,11 +51,13 @@
     MetadataBuilder* current_metadata = nullptr;
     // The suffix of the current slot.
     std::string current_suffix;
-    // List of operations to be applied on the partition.
-    const RepeatedPtrField<InstallOperation>* operations = nullptr;
+    // Partition information from the OTA manifest.
+    const PartitionUpdate* update = nullptr;
     // Extra extents that are going to be invalidated during the update
     // process.
     std::vector<ChromeOSExtent> extra_extents = {};
+    // True if compression is enabled.
+    bool compression_enabled = false;
 
     struct Return {
         SnapshotStatus snapshot_status;
diff --git a/fs_mgr/libsnapshot/partition_cow_creator_test.cpp b/fs_mgr/libsnapshot/partition_cow_creator_test.cpp
index aca55b4..e4b476f 100644
--- a/fs_mgr/libsnapshot/partition_cow_creator_test.cpp
+++ b/fs_mgr/libsnapshot/partition_cow_creator_test.cpp
@@ -52,20 +52,20 @@
 };
 
 TEST_F(PartitionCowCreatorTest, IntersectSelf) {
-    constexpr uint64_t initial_size = 1_MiB;
-    constexpr uint64_t final_size = 40_KiB;
+    constexpr uint64_t super_size = 1_MiB;
+    constexpr uint64_t partition_size = 40_KiB;
 
-    auto builder_a = MetadataBuilder::New(initial_size, 1_KiB, 2);
+    auto builder_a = MetadataBuilder::New(super_size, 1_KiB, 2);
     ASSERT_NE(builder_a, nullptr);
     auto system_a = builder_a->AddPartition("system_a", LP_PARTITION_ATTR_READONLY);
     ASSERT_NE(system_a, nullptr);
-    ASSERT_TRUE(builder_a->ResizePartition(system_a, final_size));
+    ASSERT_TRUE(builder_a->ResizePartition(system_a, partition_size));
 
-    auto builder_b = MetadataBuilder::New(initial_size, 1_KiB, 2);
+    auto builder_b = MetadataBuilder::New(super_size, 1_KiB, 2);
     ASSERT_NE(builder_b, nullptr);
     auto system_b = builder_b->AddPartition("system_b", LP_PARTITION_ATTR_READONLY);
     ASSERT_NE(system_b, nullptr);
-    ASSERT_TRUE(builder_b->ResizePartition(system_b, final_size));
+    ASSERT_TRUE(builder_b->ResizePartition(system_b, partition_size));
 
     PartitionCowCreator creator{.target_metadata = builder_b.get(),
                                 .target_suffix = "_b",
@@ -74,8 +74,8 @@
                                 .current_suffix = "_a"};
     auto ret = creator.Run();
     ASSERT_TRUE(ret.has_value());
-    ASSERT_EQ(final_size, ret->snapshot_status.device_size());
-    ASSERT_EQ(final_size, ret->snapshot_status.snapshot_size());
+    ASSERT_EQ(partition_size, ret->snapshot_status.device_size());
+    ASSERT_EQ(partition_size, ret->snapshot_status.snapshot_size());
 }
 
 TEST_F(PartitionCowCreatorTest, Holes) {
@@ -124,20 +124,20 @@
     using RepeatedInstallOperationPtr = google::protobuf::RepeatedPtrField<InstallOperation>;
     using Extent = chromeos_update_engine::Extent;
 
-    constexpr uint64_t initial_size = 50_MiB;
-    constexpr uint64_t final_size = 40_MiB;
+    constexpr uint64_t super_size = 50_MiB;
+    constexpr uint64_t partition_size = 40_MiB;
 
-    auto builder_a = MetadataBuilder::New(initial_size, 1_KiB, 2);
+    auto builder_a = MetadataBuilder::New(super_size, 1_KiB, 2);
     ASSERT_NE(builder_a, nullptr);
     auto system_a = builder_a->AddPartition("system_a", LP_PARTITION_ATTR_READONLY);
     ASSERT_NE(system_a, nullptr);
-    ASSERT_TRUE(builder_a->ResizePartition(system_a, final_size));
+    ASSERT_TRUE(builder_a->ResizePartition(system_a, partition_size));
 
-    auto builder_b = MetadataBuilder::New(initial_size, 1_KiB, 2);
+    auto builder_b = MetadataBuilder::New(super_size, 1_KiB, 2);
     ASSERT_NE(builder_b, nullptr);
     auto system_b = builder_b->AddPartition("system_b", LP_PARTITION_ATTR_READONLY);
     ASSERT_NE(system_b, nullptr);
-    ASSERT_TRUE(builder_b->ResizePartition(system_b, final_size));
+    ASSERT_TRUE(builder_b->ResizePartition(system_b, partition_size));
 
     const uint64_t block_size = builder_b->logical_block_size();
     const uint64_t chunk_size = kSnapshotChunkSize * dm::kSectorSize;
@@ -145,13 +145,15 @@
 
     auto cow_device_size = [](const std::vector<InstallOperation>& iopv, MetadataBuilder* builder_a,
                               MetadataBuilder* builder_b, Partition* system_b) {
-        RepeatedInstallOperationPtr riop(iopv.begin(), iopv.end());
+        PartitionUpdate update;
+        *update.mutable_operations() = RepeatedInstallOperationPtr(iopv.begin(), iopv.end());
+
         PartitionCowCreator creator{.target_metadata = builder_b,
                                     .target_suffix = "_b",
                                     .target_partition = system_b,
                                     .current_metadata = builder_a,
                                     .current_suffix = "_a",
-                                    .operations = &riop};
+                                    .update = &update};
 
         auto ret = creator.Run();
 
@@ -203,6 +205,83 @@
     ASSERT_EQ(6 * chunk_size, cow_device_size(iopv, builder_a.get(), builder_b.get(), system_b));
 }
 
+TEST_F(PartitionCowCreatorTest, Zero) {
+    constexpr uint64_t super_size = 1_MiB;
+    auto builder_a = MetadataBuilder::New(super_size, 1_KiB, 2);
+    ASSERT_NE(builder_a, nullptr);
+
+    auto builder_b = MetadataBuilder::New(super_size, 1_KiB, 2);
+    ASSERT_NE(builder_b, nullptr);
+    auto system_b = builder_b->AddPartition("system_b", LP_PARTITION_ATTR_READONLY);
+    ASSERT_NE(system_b, nullptr);
+
+    PartitionCowCreator creator{.target_metadata = builder_b.get(),
+                                .target_suffix = "_b",
+                                .target_partition = system_b,
+                                .current_metadata = builder_a.get(),
+                                .current_suffix = "_a",
+                                .update = nullptr};
+
+    auto ret = creator.Run();
+
+    ASSERT_EQ(0u, ret->snapshot_status.device_size());
+    ASSERT_EQ(0u, ret->snapshot_status.snapshot_size());
+    ASSERT_EQ(0u, ret->snapshot_status.cow_file_size());
+    ASSERT_EQ(0u, ret->snapshot_status.cow_partition_size());
+}
+
+TEST_F(PartitionCowCreatorTest, CompressionEnabled) {
+    constexpr uint64_t super_size = 1_MiB;
+    auto builder_a = MetadataBuilder::New(super_size, 1_KiB, 2);
+    ASSERT_NE(builder_a, nullptr);
+
+    auto builder_b = MetadataBuilder::New(super_size, 1_KiB, 2);
+    ASSERT_NE(builder_b, nullptr);
+    auto system_b = builder_b->AddPartition("system_b", LP_PARTITION_ATTR_READONLY);
+    ASSERT_NE(system_b, nullptr);
+    ASSERT_TRUE(builder_b->ResizePartition(system_b, 128_KiB));
+
+    PartitionUpdate update;
+    update.set_estimate_cow_size(256_KiB);
+
+    PartitionCowCreator creator{.target_metadata = builder_b.get(),
+                                .target_suffix = "_b",
+                                .target_partition = system_b,
+                                .current_metadata = builder_a.get(),
+                                .current_suffix = "_a",
+                                .compression_enabled = true,
+                                .update = &update};
+
+    auto ret = creator.Run();
+    ASSERT_TRUE(ret.has_value());
+    ASSERT_EQ(ret->snapshot_status.cow_file_size(), 1458176);
+}
+
+TEST_F(PartitionCowCreatorTest, CompressionWithNoManifest) {
+    constexpr uint64_t super_size = 1_MiB;
+    auto builder_a = MetadataBuilder::New(super_size, 1_KiB, 2);
+    ASSERT_NE(builder_a, nullptr);
+
+    auto builder_b = MetadataBuilder::New(super_size, 1_KiB, 2);
+    ASSERT_NE(builder_b, nullptr);
+    auto system_b = builder_b->AddPartition("system_b", LP_PARTITION_ATTR_READONLY);
+    ASSERT_NE(system_b, nullptr);
+    ASSERT_TRUE(builder_b->ResizePartition(system_b, 128_KiB));
+
+    PartitionUpdate update;
+
+    PartitionCowCreator creator{.target_metadata = builder_b.get(),
+                                .target_suffix = "_b",
+                                .target_partition = system_b,
+                                .current_metadata = builder_a.get(),
+                                .current_suffix = "_a",
+                                .compression_enabled = true,
+                                .update = nullptr};
+
+    auto ret = creator.Run();
+    ASSERT_FALSE(ret.has_value());
+}
+
 TEST(DmSnapshotInternals, CowSizeCalculator) {
     SKIP_IF_NON_VIRTUAL_AB();
 
diff --git a/fs_mgr/libsnapshot/power_test.cpp b/fs_mgr/libsnapshot/power_test.cpp
new file mode 100644
index 0000000..4d2548a
--- /dev/null
+++ b/fs_mgr/libsnapshot/power_test.cpp
@@ -0,0 +1,559 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <chrono>
+#include <iostream>
+#include <random>
+#include <string>
+#include <thread>
+#include <vector>
+
+#include <android-base/file.h>
+#include <android-base/parsedouble.h>
+#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
+#include <android-base/unique_fd.h>
+#include <ext4_utils/ext4_utils.h>
+#include <fstab/fstab.h>
+#include <libdm/dm.h>
+#include <libfiemap/image_manager.h>
+
+using namespace std::chrono_literals;
+using namespace std::string_literals;
+using android::base::borrowed_fd;
+using android::base::unique_fd;
+using android::dm::DeviceMapper;
+using android::dm::DmDeviceState;
+using android::dm::DmTable;
+using android::dm::DmTargetSnapshot;
+using android::dm::SnapshotStorageMode;
+using android::fiemap::ImageManager;
+using android::fs_mgr::Fstab;
+
+namespace android {
+namespace snapshot {
+
+static void usage() {
+    std::cerr << "Usage:\n";
+    std::cerr << "  create <orig-payload> <new-payload>\n";
+    std::cerr << "\n";
+    std::cerr << "  Create a snapshot device containing the contents of\n";
+    std::cerr << "  orig-payload, and then write the contents of new-payload.\n";
+    std::cerr << "  The original files are not modified.\n";
+    std::cerr << "\n";
+    std::cerr << "  merge <fail-rate>\n";
+    std::cerr << "\n";
+    std::cerr << "  Merge the snapshot previously started by create, and wait\n";
+    std::cerr << "  for it to complete. Once done, it is compared to the\n";
+    std::cerr << "  new-payload for consistency. The original files are not \n";
+    std::cerr << "  modified. If a fail-rate is passed (as a fraction between 0\n";
+    std::cerr << "  and 100), every 10ms the device has that percent change of\n";
+    std::cerr << "  injecting a kernel crash.\n";
+    std::cerr << "\n";
+    std::cerr << "  check <new-payload>\n";
+    std::cerr << "  Verify that all artifacts are correct after a merge\n";
+    std::cerr << "  completes.\n";
+    std::cerr << "\n";
+    std::cerr << "  cleanup\n";
+    std::cerr << "  Remove all ImageManager artifacts from create/merge.\n";
+}
+
+class PowerTest final {
+  public:
+    PowerTest();
+    bool Run(int argc, char** argv);
+
+  private:
+    bool OpenImageManager();
+    bool Create(int argc, char** argv);
+    bool Merge(int argc, char** argv);
+    bool Check(int argc, char** argv);
+    bool Cleanup();
+    bool CleanupImage(const std::string& name);
+    bool SetupImages(const std::string& first_file, borrowed_fd second_fd);
+    bool MapImages();
+    bool MapSnapshot(SnapshotStorageMode mode);
+    bool GetMergeStatus(DmTargetSnapshot::Status* status);
+
+    static constexpr char kSnapshotName[] = "snapshot-power-test";
+    static constexpr char kSnapshotImageName[] = "snapshot-power-test-image";
+    static constexpr char kSnapshotCowName[] = "snapshot-power-test-cow";
+
+    DeviceMapper& dm_;
+    std::unique_ptr<ImageManager> images_;
+    std::string image_path_;
+    std::string cow_path_;
+    std::string snapshot_path_;
+};
+
+PowerTest::PowerTest() : dm_(DeviceMapper::Instance()) {}
+
+bool PowerTest::Run([[maybe_unused]] int argc, [[maybe_unused]] char** argv) {
+    if (!OpenImageManager()) {
+        return false;
+    }
+
+    if (argc < 2) {
+        usage();
+        return false;
+    }
+    if (argv[1] == "create"s) {
+        return Create(argc, argv);
+    } else if (argv[1] == "merge"s) {
+        return Merge(argc, argv);
+    } else if (argv[1] == "check"s) {
+        return Check(argc, argv);
+    } else if (argv[1] == "cleanup"s) {
+        return Cleanup();
+    } else {
+        usage();
+        return false;
+    }
+}
+
+bool PowerTest::OpenImageManager() {
+    std::vector<std::string> dirs = {
+            "/data/gsi/test",
+            "/metadata/gsi/test",
+    };
+    for (const auto& dir : dirs) {
+        if (mkdir(dir.c_str(), 0700) && errno != EEXIST) {
+            std::cerr << "mkdir " << dir << ": " << strerror(errno) << "\n";
+            return false;
+        }
+    }
+
+    images_ = ImageManager::Open("/metadata/gsi/test", "/data/gsi/test");
+    if (!images_) {
+        std::cerr << "Could not open ImageManager\n";
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::Create(int argc, char** argv) {
+    if (argc < 4) {
+        usage();
+        return false;
+    }
+
+    std::string first = argv[2];
+    std::string second = argv[3];
+
+    unique_fd second_fd(open(second.c_str(), O_RDONLY));
+    if (second_fd < 0) {
+        std::cerr << "open " << second << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    if (!Cleanup()) {
+        return false;
+    }
+    if (!SetupImages(first, second_fd)) {
+        return false;
+    }
+    if (!MapSnapshot(SnapshotStorageMode::Persistent)) {
+        return false;
+    }
+
+    struct stat s;
+    if (fstat(second_fd, &s)) {
+        std::cerr << "fstat " << second << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    unique_fd snap_fd(open(snapshot_path_.c_str(), O_WRONLY));
+    if (snap_fd < 0) {
+        std::cerr << "open " << snapshot_path_ << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    uint8_t chunk[4096];
+    uint64_t written = 0;
+    while (written < s.st_size) {
+        uint64_t remaining = s.st_size - written;
+        size_t bytes = (size_t)std::min((uint64_t)sizeof(chunk), remaining);
+        if (!android::base::ReadFully(second_fd, chunk, bytes)) {
+            std::cerr << "read " << second << ": " << strerror(errno) << "\n";
+            return false;
+        }
+        if (!android::base::WriteFully(snap_fd, chunk, bytes)) {
+            std::cerr << "write " << snapshot_path_ << ": " << strerror(errno) << "\n";
+            return false;
+        }
+        written += bytes;
+    }
+    if (fsync(snap_fd)) {
+        std::cerr << "fsync: " << strerror(errno) << "\n";
+        return false;
+    }
+
+    sync();
+
+    snap_fd = {};
+    if (!dm_.DeleteDeviceIfExists(kSnapshotName)) {
+        std::cerr << "could not delete dm device " << kSnapshotName << "\n";
+        return false;
+    }
+    if (!images_->UnmapImageIfExists(kSnapshotImageName)) {
+        std::cerr << "failed to unmap " << kSnapshotImageName << "\n";
+        return false;
+    }
+    if (!images_->UnmapImageIfExists(kSnapshotCowName)) {
+        std::cerr << "failed to unmap " << kSnapshotImageName << "\n";
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::Cleanup() {
+    if (!dm_.DeleteDeviceIfExists(kSnapshotName)) {
+        std::cerr << "could not delete dm device " << kSnapshotName << "\n";
+        return false;
+    }
+    if (!CleanupImage(kSnapshotImageName) || !CleanupImage(kSnapshotCowName)) {
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::CleanupImage(const std::string& name) {
+    if (!images_->UnmapImageIfExists(name)) {
+        std::cerr << "failed to unmap " << name << "\n";
+        return false;
+    }
+    if (images_->BackingImageExists(name) && !images_->DeleteBackingImage(name)) {
+        std::cerr << "failed to delete " << name << "\n";
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::SetupImages(const std::string& first, borrowed_fd second_fd) {
+    unique_fd first_fd(open(first.c_str(), O_RDONLY));
+    if (first_fd < 0) {
+        std::cerr << "open " << first << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    struct stat s1, s2;
+    if (fstat(first_fd.get(), &s1)) {
+        std::cerr << "first stat: " << strerror(errno) << "\n";
+        return false;
+    }
+    if (fstat(second_fd.get(), &s2)) {
+        std::cerr << "second stat: " << strerror(errno) << "\n";
+        return false;
+    }
+
+    // Pick the bigger size of both images, rounding up to the nearest block.
+    uint64_t s1_size = (s1.st_size + 4095) & ~uint64_t(4095);
+    uint64_t s2_size = (s2.st_size + 4095) & ~uint64_t(4095);
+    uint64_t image_size = std::max(s1_size, s2_size) + (1024 * 1024 * 128);
+    if (!images_->CreateBackingImage(kSnapshotImageName, image_size, 0, nullptr)) {
+        std::cerr << "failed to create " << kSnapshotImageName << "\n";
+        return false;
+    }
+    // Use the same size for the cow.
+    if (!images_->CreateBackingImage(kSnapshotCowName, image_size, 0, nullptr)) {
+        std::cerr << "failed to create " << kSnapshotCowName << "\n";
+        return false;
+    }
+    if (!MapImages()) {
+        return false;
+    }
+
+    unique_fd image_fd(open(image_path_.c_str(), O_WRONLY));
+    if (image_fd < 0) {
+        std::cerr << "open: " << image_path_ << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    uint8_t chunk[4096];
+    uint64_t written = 0;
+    while (written < s1.st_size) {
+        uint64_t remaining = s1.st_size - written;
+        size_t bytes = (size_t)std::min((uint64_t)sizeof(chunk), remaining);
+        if (!android::base::ReadFully(first_fd, chunk, bytes)) {
+            std::cerr << "read: " << strerror(errno) << "\n";
+            return false;
+        }
+        if (!android::base::WriteFully(image_fd, chunk, bytes)) {
+            std::cerr << "write: " << strerror(errno) << "\n";
+            return false;
+        }
+        written += bytes;
+    }
+    if (fsync(image_fd)) {
+        std::cerr << "fsync: " << strerror(errno) << "\n";
+        return false;
+    }
+
+    // Zero the first block of the COW.
+    unique_fd cow_fd(open(cow_path_.c_str(), O_WRONLY));
+    if (cow_fd < 0) {
+        std::cerr << "open: " << cow_path_ << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    memset(chunk, 0, sizeof(chunk));
+    if (!android::base::WriteFully(cow_fd, chunk, sizeof(chunk))) {
+        std::cerr << "read: " << strerror(errno) << "\n";
+        return false;
+    }
+    if (fsync(cow_fd)) {
+        std::cerr << "fsync: " << strerror(errno) << "\n";
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::MapImages() {
+    if (!images_->MapImageDevice(kSnapshotImageName, 10s, &image_path_)) {
+        std::cerr << "failed to map " << kSnapshotImageName << "\n";
+        return false;
+    }
+    if (!images_->MapImageDevice(kSnapshotCowName, 10s, &cow_path_)) {
+        std::cerr << "failed to map " << kSnapshotCowName << "\n";
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::MapSnapshot(SnapshotStorageMode mode) {
+    uint64_t sectors;
+    {
+        unique_fd fd(open(image_path_.c_str(), O_RDONLY));
+        if (fd < 0) {
+            std::cerr << "open: " << image_path_ << ": " << strerror(errno) << "\n";
+            return false;
+        }
+        sectors = get_block_device_size(fd) / 512;
+    }
+
+    DmTable table;
+    table.Emplace<DmTargetSnapshot>(0, sectors, image_path_, cow_path_, mode, 8);
+    if (!dm_.CreateDevice(kSnapshotName, table, &snapshot_path_, 10s)) {
+        std::cerr << "failed to create snapshot device\n";
+        return false;
+    }
+    return true;
+}
+
+bool PowerTest::GetMergeStatus(DmTargetSnapshot::Status* status) {
+    std::vector<DeviceMapper::TargetInfo> targets;
+    if (!dm_.GetTableStatus(kSnapshotName, &targets)) {
+        std::cerr << "failed to get merge status\n";
+        return false;
+    }
+    if (targets.size() != 1) {
+        std::cerr << "merge device has wrong number of targets\n";
+        return false;
+    }
+    if (!DmTargetSnapshot::ParseStatusText(targets[0].data, status)) {
+        std::cerr << "could not parse merge target status text\n";
+        return false;
+    }
+    return true;
+}
+
+static std::string GetUserdataBlockDeviceName() {
+    Fstab fstab;
+    if (!ReadFstabFromFile("/proc/mounts", &fstab)) {
+        return {};
+    }
+
+    auto entry = android::fs_mgr::GetEntryForMountPoint(&fstab, "/data");
+    if (!entry) {
+        return {};
+    }
+
+    auto prefix = "/dev/block/"s;
+    if (!android::base::StartsWith(entry->blk_device, prefix)) {
+        return {};
+    }
+    return entry->blk_device.substr(prefix.size());
+}
+
+bool PowerTest::Merge(int argc, char** argv) {
+    // Start an f2fs GC to really stress things. :TODO: figure out data device
+    auto userdata_dev = GetUserdataBlockDeviceName();
+    if (userdata_dev.empty()) {
+        std::cerr << "could not locate userdata block device\n";
+        return false;
+    }
+
+    auto cmd =
+            android::base::StringPrintf("echo 1 > /sys/fs/f2fs/%s/gc_urgent", userdata_dev.c_str());
+    system(cmd.c_str());
+
+    if (dm_.GetState(kSnapshotName) == DmDeviceState::INVALID) {
+        if (!MapImages()) {
+            return false;
+        }
+        if (!MapSnapshot(SnapshotStorageMode::Merge)) {
+            return false;
+        }
+    }
+
+    std::random_device r;
+    std::default_random_engine re(r());
+    std::uniform_real_distribution<double> dist(0.0, 100.0);
+
+    std::optional<double> failure_rate;
+    if (argc >= 3) {
+        double d;
+        if (!android::base::ParseDouble(argv[2], &d)) {
+            std::cerr << "Could not parse failure rate as double: " << argv[2] << "\n";
+            return false;
+        }
+        failure_rate = d;
+    }
+
+    while (true) {
+        DmTargetSnapshot::Status status;
+        if (!GetMergeStatus(&status)) {
+            return false;
+        }
+        if (!status.error.empty()) {
+            std::cerr << "merge reported error: " << status.error << "\n";
+            return false;
+        }
+        if (status.sectors_allocated == status.metadata_sectors) {
+            break;
+        }
+
+        std::cerr << status.sectors_allocated << " / " << status.metadata_sectors << "\n";
+
+        if (failure_rate && *failure_rate >= dist(re)) {
+            system("echo 1 > /proc/sys/kernel/sysrq");
+            system("echo c > /proc/sysrq-trigger");
+        }
+
+        std::this_thread::sleep_for(10ms);
+    }
+
+    std::cout << "Merge completed.\n";
+    return true;
+}
+
+bool PowerTest::Check([[maybe_unused]] int argc, [[maybe_unused]] char** argv) {
+    if (argc < 3) {
+        std::cerr << "Expected argument: <new-image-path>\n";
+        return false;
+    }
+    std::string md_path, image_path;
+    std::string canonical_path = argv[2];
+
+    if (!dm_.GetDmDevicePathByName(kSnapshotName, &md_path)) {
+        std::cerr << "could not get dm-path for merge device\n";
+        return false;
+    }
+    if (!images_->GetMappedImageDevice(kSnapshotImageName, &image_path)) {
+        std::cerr << "could not get image path\n";
+        return false;
+    }
+
+    unique_fd md_fd(open(md_path.c_str(), O_RDONLY));
+    if (md_fd < 0) {
+        std::cerr << "open: " << md_path << ": " << strerror(errno) << "\n";
+        return false;
+    }
+    unique_fd image_fd(open(image_path.c_str(), O_RDONLY));
+    if (image_fd < 0) {
+        std::cerr << "open: " << image_path << ": " << strerror(errno) << "\n";
+        return false;
+    }
+    unique_fd canonical_fd(open(canonical_path.c_str(), O_RDONLY));
+    if (canonical_fd < 0) {
+        std::cerr << "open: " << canonical_path << ": " << strerror(errno) << "\n";
+        return false;
+    }
+
+    struct stat s;
+    if (fstat(canonical_fd, &s)) {
+        std::cerr << "fstat: " << canonical_path << ": " << strerror(errno) << "\n";
+        return false;
+    }
+    uint64_t canonical_size = s.st_size;
+    uint64_t md_size = get_block_device_size(md_fd);
+    uint64_t image_size = get_block_device_size(image_fd);
+    if (image_size != md_size) {
+        std::cerr << "image size does not match merge device size\n";
+        return false;
+    }
+    if (canonical_size > image_size) {
+        std::cerr << "canonical size " << canonical_size << " is greater than image size "
+                  << image_size << "\n";
+        return false;
+    }
+
+    constexpr size_t kBlockSize = 4096;
+    uint8_t canonical_buffer[kBlockSize];
+    uint8_t image_buffer[kBlockSize];
+    uint8_t md_buffer[kBlockSize];
+
+    uint64_t remaining = canonical_size;
+    uint64_t blockno = 0;
+    while (remaining) {
+        size_t bytes = (size_t)std::min((uint64_t)kBlockSize, remaining);
+        if (!android::base::ReadFully(canonical_fd, canonical_buffer, bytes)) {
+            std::cerr << "read: " << canonical_buffer << ": " << strerror(errno) << "\n";
+            return false;
+        }
+        if (!android::base::ReadFully(image_fd, image_buffer, bytes)) {
+            std::cerr << "read: " << image_buffer << ": " << strerror(errno) << "\n";
+            return false;
+        }
+        if (!android::base::ReadFully(md_fd, md_buffer, bytes)) {
+            std::cerr << "read: " << md_buffer << ": " << strerror(errno) << "\n";
+            return false;
+        }
+        if (memcmp(canonical_buffer, image_buffer, bytes)) {
+            std::cerr << "canonical and image differ at block " << blockno << "\n";
+            return false;
+        }
+        if (memcmp(canonical_buffer, md_buffer, bytes)) {
+            std::cerr << "canonical and image differ at block " << blockno << "\n";
+            return false;
+        }
+
+        remaining -= bytes;
+        blockno++;
+    }
+
+    std::cout << "Images all match.\n";
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+int main(int argc, char** argv) {
+    android::snapshot::PowerTest test;
+
+    if (!test.Run(argc, argv)) {
+        std::cerr << "Unexpected error running test." << std::endl;
+        return 1;
+    }
+    fflush(stdout);
+    return 0;
+}
diff --git a/fs_mgr/libsnapshot/run_power_test.sh b/fs_mgr/libsnapshot/run_power_test.sh
new file mode 100755
index 0000000..dc03dc9
--- /dev/null
+++ b/fs_mgr/libsnapshot/run_power_test.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$FAIL_RATE" ]; then
+    FAIL_RATE=5.0
+fi
+if [ ! -z "$ANDROID_SERIAL" ]; then
+    DEVICE_ARGS=-s $ANDROID_SERIAL
+else
+    DEVICE_ARGS=
+fi
+
+TEST_BIN=/data/nativetest64/snapshot_power_test/snapshot_power_test
+
+while :
+do
+    adb $DEVICE_ARGS wait-for-device
+    adb $DEVICE_ARGS root
+    adb $DEVICE_ARGS shell rm $TEST_BIN
+    adb $DEVICE_ARGS sync data
+    set +e
+    output=$(adb $DEVICE_ARGS shell $TEST_BIN merge $FAIL_RATE 2>&1)
+    set -e
+    if [[ "$output" == *"Merge completed"* ]]; then
+        echo "Merge completed."
+        break
+    fi
+    if [[ "$output" == *"Unexpected error"* ]]; then
+        echo "Unexpected error."
+        exit 1
+    fi
+done
+
+adb $DEVICE_ARGS shell $TEST_BIN check $1
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index 4178349..9329725 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -15,6 +15,7 @@
 #include <libsnapshot/snapshot.h>
 
 #include <dirent.h>
+#include <fcntl.h>
 #include <math.h>
 #include <sys/file.h>
 #include <sys/types.h>
@@ -27,10 +28,13 @@
 #include <android-base/file.h>
 #include <android-base/logging.h>
 #include <android-base/parseint.h>
+#include <android-base/properties.h>
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
+#include <cutils/sockets.h>
 #include <ext4_utils/ext4_utils.h>
 #include <fs_mgr.h>
+#include <fs_mgr/file_wait.h>
 #include <fs_mgr_dm_linear.h>
 #include <fstab/fstab.h>
 #include <libdm/dm.h>
@@ -42,6 +46,7 @@
 #include "device_info.h"
 #include "partition_cow_creator.h"
 #include "snapshot_metadata_updater.h"
+#include "snapshot_reader.h"
 #include "utility.h"
 
 namespace android {
@@ -53,6 +58,7 @@
 using android::dm::DmTable;
 using android::dm::DmTargetLinear;
 using android::dm::DmTargetSnapshot;
+using android::dm::DmTargetUser;
 using android::dm::kSectorSize;
 using android::dm::SnapshotStorageMode;
 using android::fiemap::FiemapStatus;
@@ -68,7 +74,8 @@
 using android::hardware::boot::V1_1::MergeStatus;
 using chromeos_update_engine::DeltaArchiveManifest;
 using chromeos_update_engine::Extent;
-using chromeos_update_engine::InstallOperation;
+using chromeos_update_engine::FileDescriptor;
+using chromeos_update_engine::PartitionUpdate;
 template <typename T>
 using RepeatedPtrField = google::protobuf::RepeatedPtrField<T>;
 using std::chrono::duration_cast;
@@ -95,6 +102,12 @@
     if (!sm || !sm->ForceLocalImageManager()) {
         return nullptr;
     }
+
+    // The first-stage version of snapuserd is explicitly started by init. Do
+    // not attempt to using it during tests (which run in normal AOSP).
+    if (!sm->device()->IsTestDevice()) {
+        sm->use_first_stage_snapuserd_ = true;
+    }
     return sm;
 }
 
@@ -107,6 +120,10 @@
     return snapshot_name + "-cow";
 }
 
+static std::string GetDmUserCowName(const std::string& snapshot_name) {
+    return snapshot_name + "-user-cow";
+}
+
 static std::string GetCowImageDeviceName(const std::string& snapshot_name) {
     return snapshot_name + "-cow-img";
 }
@@ -115,8 +132,8 @@
     return partition_name + "-base";
 }
 
-static std::string GetSnapshotExtraDeviceName(const std::string& snapshot_name) {
-    return snapshot_name + "-inner";
+static std::string GetSourceDeviceName(const std::string& partition_name) {
+    return partition_name + "-src";
 }
 
 bool SnapshotManager::BeginUpdate() {
@@ -140,6 +157,9 @@
         images_->RemoveAllImages();
     }
 
+    // Clear any cached metadata (this allows re-using one manager across tests).
+    old_partition_metadata_ = nullptr;
+
     auto state = ReadUpdateState(file.get());
     if (state != UpdateState::None) {
         LOG(ERROR) << "An update is already in progress, cannot begin a new update";
@@ -238,6 +258,7 @@
             GetSnapshotBootIndicatorPath(),
             GetRollbackIndicatorPath(),
             GetForwardMergeIndicatorPath(),
+            GetOldPartitionMetadataPath(),
     };
     for (const auto& file : files) {
         RemoveFileIfExists(file);
@@ -291,7 +312,8 @@
     return WriteUpdateState(lock.get(), UpdateState::Unverified);
 }
 
-bool SnapshotManager::CreateSnapshot(LockedFile* lock, SnapshotStatus* status) {
+bool SnapshotManager::CreateSnapshot(LockedFile* lock, PartitionCowCreator* cow_creator,
+                                     SnapshotStatus* status) {
     CHECK(lock);
     CHECK(lock->lock_mode() == LOCK_EX);
     CHECK(status);
@@ -300,9 +322,9 @@
         LOG(ERROR) << "SnapshotStatus has no name.";
         return false;
     }
-    // Sanity check these sizes. Like liblp, we guarantee the partition size
-    // is respected, which means it has to be sector-aligned. (This guarantee
-    // is useful for locating avb footers correctly). The COW file size, however,
+    // Check these sizes. Like liblp, we guarantee the partition size is
+    // respected, which means it has to be sector-aligned. (This guarantee is
+    // useful for locating avb footers correctly). The COW file size, however,
     // can be arbitrarily larger than specified, so we can safely round it up.
     if (status->device_size() % kSectorSize != 0) {
         LOG(ERROR) << "Snapshot " << status->name()
@@ -332,6 +354,7 @@
     status->set_state(SnapshotState::CREATED);
     status->set_sectors_allocated(0);
     status->set_metadata_sectors(0);
+    status->set_compression_enabled(cow_creator->compression_enabled);
 
     if (!WriteSnapshotStatus(lock, *status)) {
         PLOG(ERROR) << "Could not write snapshot status: " << status->name();
@@ -351,7 +374,6 @@
     }
 
     // The COW file size should have been rounded up to the nearest sector in CreateSnapshot.
-    // Sanity check this.
     if (status.cow_file_size() % kSectorSize != 0) {
         LOG(ERROR) << "Snapshot " << name << " COW file size is not a multiple of the sector size: "
                    << status.cow_file_size();
@@ -363,6 +385,47 @@
     return Return(images_->CreateBackingImage(cow_image_name, status.cow_file_size(), cow_flags));
 }
 
+bool SnapshotManager::MapDmUserCow(LockedFile* lock, const std::string& name,
+                                   const std::string& cow_file, const std::string& base_device,
+                                   const std::chrono::milliseconds& timeout_ms, std::string* path) {
+    CHECK(lock);
+
+    auto& dm = DeviceMapper::Instance();
+
+    // Use an extra decoration for first-stage init, so we can transition
+    // to a new table entry in second-stage.
+    std::string misc_name = name;
+    if (use_first_stage_snapuserd_) {
+        misc_name += "-init";
+    }
+
+    if (!EnsureSnapuserdConnected()) {
+        return false;
+    }
+
+    uint64_t base_sectors = snapuserd_client_->InitDmUserCow(misc_name, cow_file, base_device);
+    if (base_sectors == 0) {
+        LOG(ERROR) << "Failed to retrieve base_sectors from Snapuserd";
+        return false;
+    }
+
+    DmTable table;
+    table.Emplace<DmTargetUser>(0, base_sectors, misc_name);
+    if (!dm.CreateDevice(name, table, path, timeout_ms)) {
+        return false;
+    }
+    if (!WaitForDevice(*path, timeout_ms)) {
+        return false;
+    }
+
+    auto control_device = "/dev/dm-user/" + misc_name;
+    if (!WaitForDevice(control_device, timeout_ms)) {
+        return false;
+    }
+
+    return snapuserd_client_->AttachDmUser(misc_name);
+}
+
 bool SnapshotManager::MapSnapshot(LockedFile* lock, const std::string& name,
                                   const std::string& base_device, const std::string& cow_device,
                                   const std::chrono::milliseconds& timeout_ms,
@@ -407,8 +470,13 @@
         LOG(ERROR) << "Invalid snapshot size for " << base_device << ": " << status.snapshot_size();
         return false;
     }
+    if (status.device_size() != status.snapshot_size()) {
+        LOG(ERROR) << "Device size and snapshot size must be the same (device size = "
+                   << status.device_size() << ", snapshot size = " << status.snapshot_size();
+        return false;
+    }
+
     uint64_t snapshot_sectors = status.snapshot_size() / kSectorSize;
-    uint64_t linear_sectors = (status.device_size() - status.snapshot_size()) / kSectorSize;
 
     auto& dm = DeviceMapper::Instance();
 
@@ -416,7 +484,8 @@
     // have completed merging, but the start of the merge process is considered
     // atomic.
     SnapshotStorageMode mode;
-    switch (ReadUpdateState(lock)) {
+    SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
+    switch (update_status.state()) {
         case UpdateState::MergeCompleted:
         case UpdateState::MergeNeedsReboot:
             LOG(ERROR) << "Should not create a snapshot device for " << name
@@ -426,52 +495,24 @@
         case UpdateState::MergeFailed:
             // Note: MergeFailed indicates that a merge is in progress, but
             // is possibly stalled. We still have to honor the merge.
-            mode = SnapshotStorageMode::Merge;
+            if (DecideMergePhase(status) == update_status.merge_phase()) {
+                mode = SnapshotStorageMode::Merge;
+            } else {
+                mode = SnapshotStorageMode::Persistent;
+            }
             break;
         default:
             mode = SnapshotStorageMode::Persistent;
             break;
     }
 
-    // The kernel (tested on 4.19) crashes horribly if a device has both a snapshot
-    // and a linear target in the same table. Instead, we stack them, and give the
-    // snapshot device a different name. It is not exposed to the caller in this
-    // case.
-    auto snap_name = (linear_sectors > 0) ? GetSnapshotExtraDeviceName(name) : name;
-
     DmTable table;
     table.Emplace<DmTargetSnapshot>(0, snapshot_sectors, base_device, cow_device, mode,
                                     kSnapshotChunkSize);
-    if (!dm.CreateDevice(snap_name, table, dev_path, timeout_ms)) {
-        LOG(ERROR) << "Could not create snapshot device: " << snap_name;
+    if (!dm.CreateDevice(name, table, dev_path, timeout_ms)) {
+        LOG(ERROR) << "Could not create snapshot device: " << name;
         return false;
     }
-
-    if (linear_sectors) {
-        std::string snap_dev;
-        if (!dm.GetDeviceString(snap_name, &snap_dev)) {
-            LOG(ERROR) << "Cannot determine major/minor for: " << snap_name;
-            return false;
-        }
-
-        // Our stacking will looks like this:
-        //     [linear, linear] ; to snapshot, and non-snapshot region of base device
-        //     [snapshot-inner]
-        //     [base device]   [cow]
-        DmTable table;
-        table.Emplace<DmTargetLinear>(0, snapshot_sectors, snap_dev, 0);
-        table.Emplace<DmTargetLinear>(snapshot_sectors, linear_sectors, base_device,
-                                      snapshot_sectors);
-        if (!dm.CreateDevice(name, table, dev_path, timeout_ms)) {
-            LOG(ERROR) << "Could not create outer snapshot device: " << name;
-            dm.DeleteDevice(snap_name);
-            return false;
-        }
-    }
-
-    // :TODO: when merging is implemented, we need to add an argument to the
-    // status indicating how much progress is left to merge. (device-mapper
-    // does not retain the initial values, so we can't derive them.)
     return true;
 }
 
@@ -499,6 +540,36 @@
     return std::nullopt;
 }
 
+bool SnapshotManager::MapSourceDevice(LockedFile* lock, const std::string& name,
+                                      const std::chrono::milliseconds& timeout_ms,
+                                      std::string* path) {
+    CHECK(lock);
+
+    auto metadata = ReadOldPartitionMetadata(lock);
+    if (!metadata) {
+        LOG(ERROR) << "Could not map source device due to missing or corrupt metadata";
+        return false;
+    }
+
+    auto old_name = GetOtherPartitionName(name);
+    auto slot_suffix = device_->GetSlotSuffix();
+    auto slot = SlotNumberForSlotSuffix(slot_suffix);
+
+    CreateLogicalPartitionParams params = {
+            .block_device = device_->GetSuperDevice(slot),
+            .metadata = metadata,
+            .partition_name = old_name,
+            .timeout_ms = timeout_ms,
+            .device_name = GetSourceDeviceName(name),
+            .partition_opener = &device_->GetPartitionOpener(),
+    };
+    if (!CreateLogicalPartition(std::move(params), path)) {
+        LOG(ERROR) << "Could not create source device for snapshot " << name;
+        return false;
+    }
+    return true;
+}
+
 bool SnapshotManager::UnmapSnapshot(LockedFile* lock, const std::string& name) {
     CHECK(lock);
 
@@ -507,13 +578,6 @@
         LOG(ERROR) << "Could not delete snapshot device: " << name;
         return false;
     }
-
-    auto snapshot_extra_device = GetSnapshotExtraDeviceName(name);
-    if (!dm.DeleteDeviceIfExists(snapshot_extra_device)) {
-        LOG(ERROR) << "Could not delete snapshot inner device: " << snapshot_extra_device;
-        return false;
-    }
-
     return true;
 }
 
@@ -618,6 +682,10 @@
         }
     }
 
+    bool compression_enabled = false;
+
+    std::vector<std::string> first_merge_group;
+
     uint64_t total_cow_file_size = 0;
     DmTargetSnapshot::Status initial_target_values = {};
     for (const auto& snapshot : snapshots) {
@@ -634,6 +702,11 @@
             return false;
         }
         total_cow_file_size += snapshot_status.cow_file_size();
+
+        compression_enabled |= snapshot_status.compression_enabled();
+        if (DecideMergePhase(snapshot_status) == MergePhase::FIRST_PHASE) {
+            first_merge_group.emplace_back(snapshot);
+        }
     }
 
     if (cow_file_size) {
@@ -645,15 +718,28 @@
     initial_status.set_sectors_allocated(initial_target_values.sectors_allocated);
     initial_status.set_total_sectors(initial_target_values.total_sectors);
     initial_status.set_metadata_sectors(initial_target_values.metadata_sectors);
+    initial_status.set_compression_enabled(compression_enabled);
+
+    // If any partitions shrunk, we need to merge them before we merge any other
+    // partitions (see b/177935716). Otherwise, a merge from another partition
+    // may overwrite the source block of a copy operation.
+    const std::vector<std::string>* merge_group;
+    if (first_merge_group.empty()) {
+        merge_group = &snapshots;
+        initial_status.set_merge_phase(MergePhase::SECOND_PHASE);
+    } else {
+        merge_group = &first_merge_group;
+        initial_status.set_merge_phase(MergePhase::FIRST_PHASE);
+    }
 
     // Point of no return - mark that we're starting a merge. From now on every
-    // snapshot must be a merge target.
+    // eligible snapshot must be a merge target.
     if (!WriteSnapshotUpdateStatus(lock.get(), initial_status)) {
         return false;
     }
 
     bool rewrote_all = true;
-    for (const auto& snapshot : snapshots) {
+    for (const auto& snapshot : *merge_group) {
         // If this fails, we have no choice but to continue. Everything must
         // be merged. This is not an ideal state to be in, but it is safe,
         // because we the next boot will try again.
@@ -686,16 +772,15 @@
 
     // After this, we return true because we technically did switch to a merge
     // target. Everything else we do here is just informational.
-    auto dm_name = GetSnapshotDeviceName(name, status);
-    if (!RewriteSnapshotDeviceTable(dm_name)) {
+    if (!RewriteSnapshotDeviceTable(name)) {
         return false;
     }
 
     status.set_state(SnapshotState::MERGING);
 
     DmTargetSnapshot::Status dm_status;
-    if (!QuerySnapshotStatus(dm_name, nullptr, &dm_status)) {
-        LOG(ERROR) << "Could not query merge status for snapshot: " << dm_name;
+    if (!QuerySnapshotStatus(name, nullptr, &dm_status)) {
+        LOG(ERROR) << "Could not query merge status for snapshot: " << name;
     }
     status.set_sectors_allocated(dm_status.sectors_allocated);
     status.set_metadata_sectors(dm_status.metadata_sectors);
@@ -705,33 +790,33 @@
     return true;
 }
 
-bool SnapshotManager::RewriteSnapshotDeviceTable(const std::string& dm_name) {
+bool SnapshotManager::RewriteSnapshotDeviceTable(const std::string& name) {
     auto& dm = DeviceMapper::Instance();
 
     std::vector<DeviceMapper::TargetInfo> old_targets;
-    if (!dm.GetTableInfo(dm_name, &old_targets)) {
-        LOG(ERROR) << "Could not read snapshot device table: " << dm_name;
+    if (!dm.GetTableInfo(name, &old_targets)) {
+        LOG(ERROR) << "Could not read snapshot device table: " << name;
         return false;
     }
     if (old_targets.size() != 1 || DeviceMapper::GetTargetType(old_targets[0].spec) != "snapshot") {
-        LOG(ERROR) << "Unexpected device-mapper table for snapshot: " << dm_name;
+        LOG(ERROR) << "Unexpected device-mapper table for snapshot: " << name;
         return false;
     }
 
     std::string base_device, cow_device;
     if (!DmTargetSnapshot::GetDevicesFromParams(old_targets[0].data, &base_device, &cow_device)) {
-        LOG(ERROR) << "Could not derive underlying devices for snapshot: " << dm_name;
+        LOG(ERROR) << "Could not derive underlying devices for snapshot: " << name;
         return false;
     }
 
     DmTable table;
     table.Emplace<DmTargetSnapshot>(0, old_targets[0].spec.length, base_device, cow_device,
                                     SnapshotStorageMode::Merge, kSnapshotChunkSize);
-    if (!dm.LoadTableAndActivate(dm_name, table)) {
-        LOG(ERROR) << "Could not swap device-mapper tables on snapshot device " << dm_name;
+    if (!dm.LoadTableAndActivate(name, table)) {
+        LOG(ERROR) << "Could not swap device-mapper tables on snapshot device " << name;
         return false;
     }
-    LOG(INFO) << "Successfully switched snapshot device to a merge target: " << dm_name;
+    LOG(INFO) << "Successfully switched snapshot device to a merge target: " << name;
     return true;
 }
 
@@ -845,13 +930,13 @@
 
 UpdateState SnapshotManager::CheckMergeState(LockedFile* lock,
                                              const std::function<bool()>& before_cancel) {
-    UpdateState state = ReadUpdateState(lock);
-    switch (state) {
+    SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
+    switch (update_status.state()) {
         case UpdateState::None:
         case UpdateState::MergeCompleted:
             // Harmless races are allowed between two callers of WaitForMerge,
             // so in both of these cases we just propagate the state.
-            return state;
+            return update_status.state();
 
         case UpdateState::Merging:
         case UpdateState::MergeNeedsReboot:
@@ -868,10 +953,10 @@
             if (HandleCancelledUpdate(lock, before_cancel)) {
                 return UpdateState::Cancelled;
             }
-            return state;
+            return update_status.state();
 
         default:
-            return state;
+            return update_status.state();
     }
 
     std::vector<std::string> snapshots;
@@ -883,8 +968,9 @@
     bool failed = false;
     bool merging = false;
     bool needs_reboot = false;
+    bool wrong_phase = false;
     for (const auto& snapshot : snapshots) {
-        UpdateState snapshot_state = CheckTargetMergeState(lock, snapshot);
+        UpdateState snapshot_state = CheckTargetMergeState(lock, snapshot, update_status);
         switch (snapshot_state) {
             case UpdateState::MergeFailed:
                 failed = true;
@@ -900,6 +986,9 @@
             case UpdateState::Cancelled:
                 cancelled = true;
                 break;
+            case UpdateState::None:
+                wrong_phase = true;
+                break;
             default:
                 LOG(ERROR) << "Unknown merge status for \"" << snapshot << "\": "
                            << "\"" << snapshot_state << "\"";
@@ -919,6 +1008,14 @@
         // it in WaitForMerge rather than here and elsewhere.
         return UpdateState::MergeFailed;
     }
+    if (wrong_phase) {
+        // If we got here, no other partitions are being merged, and nothing
+        // failed to merge. It's safe to move to the next merge phase.
+        if (!MergeSecondPhaseSnapshots(lock)) {
+            return UpdateState::MergeFailed;
+        }
+        return UpdateState::Merging;
+    }
     if (needs_reboot) {
         WriteUpdateState(lock, UpdateState::MergeNeedsReboot);
         return UpdateState::MergeNeedsReboot;
@@ -934,17 +1031,16 @@
     return UpdateState::MergeCompleted;
 }
 
-UpdateState SnapshotManager::CheckTargetMergeState(LockedFile* lock, const std::string& name) {
+UpdateState SnapshotManager::CheckTargetMergeState(LockedFile* lock, const std::string& name,
+                                                   const SnapshotUpdateStatus& update_status) {
     SnapshotStatus snapshot_status;
     if (!ReadSnapshotStatus(lock, name, &snapshot_status)) {
         return UpdateState::MergeFailed;
     }
 
-    std::string dm_name = GetSnapshotDeviceName(name, snapshot_status);
-
     std::unique_ptr<LpMetadata> current_metadata;
 
-    if (!IsSnapshotDevice(dm_name)) {
+    if (!IsSnapshotDevice(name)) {
         if (!current_metadata) {
             current_metadata = ReadCurrentMetadata();
         }
@@ -958,7 +1054,7 @@
         // During a check, we decided the merge was complete, but we were unable to
         // collapse the device-mapper stack and perform COW cleanup. If we haven't
         // rebooted after this check, the device will still be a snapshot-merge
-        // target. If the have rebooted, the device will now be a linear target,
+        // target. If we have rebooted, the device will now be a linear target,
         // and we can try cleanup again.
         if (snapshot_status.state() == SnapshotState::MERGE_COMPLETED) {
             // NB: It's okay if this fails now, we gave cleanup our best effort.
@@ -966,7 +1062,7 @@
             return UpdateState::MergeCompleted;
         }
 
-        LOG(ERROR) << "Expected snapshot or snapshot-merge for device: " << dm_name;
+        LOG(ERROR) << "Expected snapshot or snapshot-merge for device: " << name;
         return UpdateState::MergeFailed;
     }
 
@@ -976,9 +1072,15 @@
 
     std::string target_type;
     DmTargetSnapshot::Status status;
-    if (!QuerySnapshotStatus(dm_name, &target_type, &status)) {
+    if (!QuerySnapshotStatus(name, &target_type, &status)) {
         return UpdateState::MergeFailed;
     }
+    if (target_type == "snapshot" &&
+        DecideMergePhase(snapshot_status) == MergePhase::SECOND_PHASE &&
+        update_status.merge_phase() == MergePhase::FIRST_PHASE) {
+        // The snapshot is not being merged because it's in the wrong phase.
+        return UpdateState::None;
+    }
     if (target_type != "snapshot-merge") {
         // We can get here if we failed to rewrite the target type in
         // InitiateMerge(). If we failed to create the target in first-stage
@@ -1014,6 +1116,38 @@
     return UpdateState::MergeCompleted;
 }
 
+bool SnapshotManager::MergeSecondPhaseSnapshots(LockedFile* lock) {
+    std::vector<std::string> snapshots;
+    if (!ListSnapshots(lock, &snapshots)) {
+        return UpdateState::MergeFailed;
+    }
+
+    SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
+    CHECK(update_status.state() == UpdateState::Merging);
+    CHECK(update_status.merge_phase() == MergePhase::FIRST_PHASE);
+
+    update_status.set_merge_phase(MergePhase::SECOND_PHASE);
+    if (!WriteSnapshotUpdateStatus(lock, update_status)) {
+        return false;
+    }
+
+    bool rewrote_all = true;
+    for (const auto& snapshot : snapshots) {
+        SnapshotStatus snapshot_status;
+        if (!ReadSnapshotStatus(lock, snapshot, &snapshot_status)) {
+            return UpdateState::MergeFailed;
+        }
+        if (DecideMergePhase(snapshot_status) != MergePhase::SECOND_PHASE) {
+            continue;
+        }
+        if (!SwitchSnapshotToMerge(lock, snapshot)) {
+            LOG(ERROR) << "Failed to switch snapshot to a second-phase merge target: " << snapshot;
+            rewrote_all = false;
+        }
+    }
+    return rewrote_all;
+}
+
 std::string SnapshotManager::GetSnapshotBootIndicatorPath() {
     return metadata_dir_ + "/" + android::base::Basename(kBootIndicatorPath);
 }
@@ -1026,6 +1160,10 @@
     return metadata_dir_ + "/allow-forward-merge";
 }
 
+std::string SnapshotManager::GetOldPartitionMetadataPath() {
+    return metadata_dir_ + "/old-partition-metadata";
+}
+
 void SnapshotManager::AcknowledgeMergeSuccess(LockedFile* lock) {
     // It's not possible to remove update state in recovery, so write an
     // indicator that cleanup is needed on reboot. If a factory data reset
@@ -1061,21 +1199,20 @@
 
 bool SnapshotManager::OnSnapshotMergeComplete(LockedFile* lock, const std::string& name,
                                               const SnapshotStatus& status) {
-    auto dm_name = GetSnapshotDeviceName(name, status);
-    if (IsSnapshotDevice(dm_name)) {
+    if (IsSnapshotDevice(name)) {
         // We are extra-cautious here, to avoid deleting the wrong table.
         std::string target_type;
         DmTargetSnapshot::Status dm_status;
-        if (!QuerySnapshotStatus(dm_name, &target_type, &dm_status)) {
+        if (!QuerySnapshotStatus(name, &target_type, &dm_status)) {
             return false;
         }
         if (target_type != "snapshot-merge") {
             LOG(ERROR) << "Unexpected target type " << target_type
-                       << " for snapshot device: " << dm_name;
+                       << " for snapshot device: " << name;
             return false;
         }
         if (dm_status.sectors_allocated != dm_status.metadata_sectors) {
-            LOG(ERROR) << "Merge is unexpectedly incomplete for device " << dm_name;
+            LOG(ERROR) << "Merge is unexpectedly incomplete for device " << name;
             return false;
         }
         if (!CollapseSnapshotDevice(name, status)) {
@@ -1096,23 +1233,21 @@
 bool SnapshotManager::CollapseSnapshotDevice(const std::string& name,
                                              const SnapshotStatus& status) {
     auto& dm = DeviceMapper::Instance();
-    auto dm_name = GetSnapshotDeviceName(name, status);
 
     // Verify we have a snapshot-merge device.
     DeviceMapper::TargetInfo target;
-    if (!GetSingleTarget(dm_name, TableQuery::Table, &target)) {
+    if (!GetSingleTarget(name, TableQuery::Table, &target)) {
         return false;
     }
     if (DeviceMapper::GetTargetType(target.spec) != "snapshot-merge") {
         // This should be impossible, it was checked earlier.
-        LOG(ERROR) << "Snapshot device has invalid target type: " << dm_name;
+        LOG(ERROR) << "Snapshot device has invalid target type: " << name;
         return false;
     }
 
     std::string base_device, cow_device;
     if (!DmTargetSnapshot::GetDevicesFromParams(target.data, &base_device, &cow_device)) {
-        LOG(ERROR) << "Could not parse snapshot device " << dm_name
-                   << " parameters: " << target.data;
+        LOG(ERROR) << "Could not parse snapshot device " << name << " parameters: " << target.data;
         return false;
     }
 
@@ -1123,42 +1258,6 @@
         return false;
     }
 
-    if (dm_name != name) {
-        // We've derived the base device, but we actually need to replace the
-        // table of the outermost device. Do a quick verification that this
-        // device looks like we expect it to.
-        std::vector<DeviceMapper::TargetInfo> outer_table;
-        if (!dm.GetTableInfo(name, &outer_table)) {
-            LOG(ERROR) << "Could not validate outer snapshot table: " << name;
-            return false;
-        }
-        if (outer_table.size() != 2) {
-            LOG(ERROR) << "Expected 2 dm-linear targets for table " << name
-                       << ", got: " << outer_table.size();
-            return false;
-        }
-        for (const auto& target : outer_table) {
-            auto target_type = DeviceMapper::GetTargetType(target.spec);
-            if (target_type != "linear") {
-                LOG(ERROR) << "Outer snapshot table may only contain linear targets, but " << name
-                           << " has target: " << target_type;
-                return false;
-            }
-        }
-        if (outer_table[0].spec.length != snapshot_sectors) {
-            LOG(ERROR) << "dm-snapshot " << name << " should have " << snapshot_sectors
-                       << " sectors, got: " << outer_table[0].spec.length;
-            return false;
-        }
-        uint64_t expected_device_sectors = status.device_size() / kSectorSize;
-        uint64_t actual_device_sectors = outer_table[0].spec.length + outer_table[1].spec.length;
-        if (expected_device_sectors != actual_device_sectors) {
-            LOG(ERROR) << "Outer device " << name << " should have " << expected_device_sectors
-                       << " sectors, got: " << actual_device_sectors;
-            return false;
-        }
-    }
-
     uint32_t slot = SlotNumberForSlotSuffix(device_->GetSlotSuffix());
     // Create a DmTable that is identical to the base device.
     CreateLogicalPartitionParams base_device_params{
@@ -1173,7 +1272,6 @@
         return false;
     }
 
-    // Note: we are replacing the *outer* table here, so we do not use dm_name.
     if (!dm.LoadTableAndActivate(name, table)) {
         return false;
     }
@@ -1183,18 +1281,17 @@
     // flushed remaining I/O. We could in theory replace with dm-zero (or
     // re-use the table above), but for now it's better to know why this
     // would fail.
-    if (dm_name != name && !dm.DeleteDeviceIfExists(dm_name)) {
-        LOG(ERROR) << "Unable to delete snapshot device " << dm_name << ", COW cannot be "
-                   << "reclaimed until after reboot.";
-        return false;
+    if (status.compression_enabled()) {
+        UnmapDmUserDevice(name);
     }
-
-    // Cleanup the base device as well, since it is no longer used. This does
-    // not block cleanup.
     auto base_name = GetBaseDeviceName(name);
     if (!dm.DeleteDeviceIfExists(base_name)) {
         LOG(ERROR) << "Unable to delete base device for snapshot: " << base_name;
     }
+    auto source_name = GetSourceDeviceName(name);
+    if (!dm.DeleteDeviceIfExists(source_name)) {
+        LOG(ERROR) << "Unable to delete source device for snapshot: " << source_name;
+    }
     return true;
 }
 
@@ -1233,6 +1330,135 @@
     return RemoveAllUpdateState(lock, before_cancel);
 }
 
+bool SnapshotManager::PerformInitTransition(InitTransition transition,
+                                            std::vector<std::string>* snapuserd_argv) {
+    LOG(INFO) << "Performing transition for snapuserd.";
+
+    // Don't use EnsuerSnapuserdConnected() because this is called from init,
+    // and attempting to do so will deadlock.
+    if (!snapuserd_client_ && transition != InitTransition::SELINUX_DETACH) {
+        snapuserd_client_ = SnapuserdClient::Connect(kSnapuserdSocket, 10s);
+        if (!snapuserd_client_) {
+            LOG(ERROR) << "Unable to connect to snapuserd";
+            return false;
+        }
+    }
+
+    auto& dm = DeviceMapper::Instance();
+
+    auto lock = LockExclusive();
+    if (!lock) return false;
+
+    std::vector<std::string> snapshots;
+    if (!ListSnapshots(lock.get(), &snapshots)) {
+        LOG(ERROR) << "Failed to list snapshots.";
+        return false;
+    }
+
+    size_t num_cows = 0;
+    size_t ok_cows = 0;
+    for (const auto& snapshot : snapshots) {
+        std::string user_cow_name = GetDmUserCowName(snapshot);
+        if (dm.GetState(user_cow_name) == DmDeviceState::INVALID) {
+            continue;
+        }
+
+        DeviceMapper::TargetInfo target;
+        if (!GetSingleTarget(user_cow_name, TableQuery::Table, &target)) {
+            continue;
+        }
+
+        auto target_type = DeviceMapper::GetTargetType(target.spec);
+        if (target_type != "user") {
+            LOG(ERROR) << "Unexpected target type for " << user_cow_name << ": " << target_type;
+            continue;
+        }
+
+        num_cows++;
+
+        SnapshotStatus snapshot_status;
+        if (!ReadSnapshotStatus(lock.get(), snapshot, &snapshot_status)) {
+            LOG(ERROR) << "Unable to read snapshot status: " << snapshot;
+            continue;
+        }
+
+        auto misc_name = user_cow_name;
+        if (transition == InitTransition::SELINUX_DETACH) {
+            misc_name += "-selinux";
+        }
+
+        DmTable table;
+        table.Emplace<DmTargetUser>(0, target.spec.length, misc_name);
+        if (!dm.LoadTableAndActivate(user_cow_name, table)) {
+            LOG(ERROR) << "Unable to swap tables for " << misc_name;
+            continue;
+        }
+
+        std::string source_device;
+        if (!dm.GetDmDevicePathByName(GetSourceDeviceName(snapshot), &source_device)) {
+            LOG(ERROR) << "Could not get device path for " << GetSourceDeviceName(snapshot);
+            continue;
+        }
+
+        // If no partition was created (the COW exists entirely on /data), the
+        // device-mapper layering is different than if we had a partition.
+        std::string cow_image_name;
+        if (snapshot_status.cow_partition_size() == 0) {
+            cow_image_name = GetCowImageDeviceName(snapshot);
+        } else {
+            cow_image_name = GetCowName(snapshot);
+        }
+
+        std::string cow_image_device;
+        if (!dm.GetDmDevicePathByName(cow_image_name, &cow_image_device)) {
+            LOG(ERROR) << "Could not get device path for " << cow_image_name;
+            continue;
+        }
+
+        // Wait for ueventd to acknowledge and create the control device node.
+        std::string control_device = "/dev/dm-user/" + misc_name;
+        if (!WaitForDevice(control_device, 10s)) {
+            continue;
+        }
+
+        if (transition == InitTransition::SELINUX_DETACH) {
+            auto message = misc_name + "," + cow_image_device + "," + source_device;
+            snapuserd_argv->emplace_back(std::move(message));
+
+            // Do not attempt to connect to the new snapuserd yet, it hasn't
+            // been started. We do however want to wait for the misc device
+            // to have been created.
+            ok_cows++;
+            continue;
+        }
+
+        uint64_t base_sectors =
+                snapuserd_client_->InitDmUserCow(misc_name, cow_image_device, source_device);
+        if (base_sectors == 0) {
+            // Unrecoverable as metadata reads from cow device failed
+            LOG(FATAL) << "Failed to retrieve base_sectors from Snapuserd";
+            return false;
+        }
+
+        CHECK(base_sectors <= target.spec.length);
+
+        if (!snapuserd_client_->AttachDmUser(misc_name)) {
+            // This error is unrecoverable. We cannot proceed because reads to
+            // the underlying device will fail.
+            LOG(FATAL) << "Could not initialize snapuserd for " << user_cow_name;
+            return false;
+        }
+
+        ok_cows++;
+    }
+
+    if (ok_cows != num_cows) {
+        LOG(ERROR) << "Could not transition all snapuserd consumers.";
+        return false;
+    }
+    return true;
+}
+
 std::unique_ptr<LpMetadata> SnapshotManager::ReadCurrentMetadata() {
     const auto& opener = device_->GetPartitionOpener();
     uint32_t slot = SlotNumberForSlotSuffix(device_->GetSlotSuffix());
@@ -1352,7 +1578,7 @@
         //    Otherwise (UPDATED flag), only delete snapshots if they are not mapped
         //    as dm-snapshot (for example, after merge completes).
         bool should_unmap = current_slot != Slot::Target;
-        bool should_delete = ShouldDeleteSnapshot(lock, flashing_status, current_slot, name);
+        bool should_delete = ShouldDeleteSnapshot(flashing_status, current_slot, name);
 
         bool partition_ok = true;
         if (should_unmap && !UnmapPartitionWithSnapshot(lock, name)) {
@@ -1386,8 +1612,7 @@
 }
 
 // See comments in RemoveAllSnapshots().
-bool SnapshotManager::ShouldDeleteSnapshot(LockedFile* lock,
-                                           const std::map<std::string, bool>& flashing_status,
+bool SnapshotManager::ShouldDeleteSnapshot(const std::map<std::string, bool>& flashing_status,
                                            Slot current_slot, const std::string& name) {
     if (current_slot != Slot::Target) {
         return true;
@@ -1401,16 +1626,7 @@
         // partition flashed, okay to delete obsolete snapshots
         return true;
     }
-    // partition updated, only delete if not dm-snapshot
-    SnapshotStatus status;
-    if (!ReadSnapshotStatus(lock, name, &status)) {
-        LOG(WARNING) << "Unable to read snapshot status for " << name
-                     << ", guessing snapshot device name";
-        auto extra_name = GetSnapshotExtraDeviceName(name);
-        return !IsSnapshotDevice(name) && !IsSnapshotDevice(extra_name);
-    }
-    auto dm_name = GetSnapshotDeviceName(name, status);
-    return !IsSnapshotDevice(dm_name);
+    return !IsSnapshotDevice(name);
 }
 
 UpdateState SnapshotManager::GetUpdateState(double* progress) {
@@ -1542,8 +1758,13 @@
     auto lock = LockExclusive();
     if (!lock) return false;
 
-    const auto& opener = device_->GetPartitionOpener();
     uint32_t slot = SlotNumberForSlotSuffix(device_->GetSlotSuffix());
+    return MapAllPartitions(lock.get(), super_device, slot, timeout_ms);
+}
+
+bool SnapshotManager::MapAllPartitions(LockedFile* lock, const std::string& super_device,
+                                       uint32_t slot, const std::chrono::milliseconds& timeout_ms) {
+    const auto& opener = device_->GetPartitionOpener();
     auto metadata = android::fs_mgr::ReadMetadata(opener, super_device, slot);
     if (!metadata) {
         LOG(ERROR) << "Could not read dynamic partition metadata for device: " << super_device;
@@ -1564,8 +1785,7 @@
                 .partition_opener = &opener,
                 .timeout_ms = timeout_ms,
         };
-        std::string ignore_path;
-        if (!MapPartitionWithSnapshot(lock.get(), std::move(params), &ignore_path)) {
+        if (!MapPartitionWithSnapshot(lock, std::move(params), SnapshotContext::Mount, nullptr)) {
             return false;
         }
     }
@@ -1593,11 +1813,10 @@
 
 bool SnapshotManager::MapPartitionWithSnapshot(LockedFile* lock,
                                                CreateLogicalPartitionParams params,
-                                               std::string* path) {
+                                               SnapshotContext context, SnapshotPaths* paths) {
     auto begin = std::chrono::steady_clock::now();
 
     CHECK(lock);
-    path->clear();
 
     if (params.GetPartitionName() != params.GetDeviceName()) {
         LOG(ERROR) << "Mapping snapshot with a different name is unsupported: partition_name = "
@@ -1678,8 +1897,11 @@
     }
     created_devices.EmplaceBack<AutoUnmapDevice>(&dm, params.GetDeviceName());
 
+    if (paths) {
+        paths->target_device = base_path;
+    }
+
     if (!live_snapshot_status.has_value()) {
-        *path = base_path;
         created_devices.Release();
         return true;
     }
@@ -1706,21 +1928,76 @@
         LOG(ERROR) << "Could not determine major/minor for: " << cow_name;
         return false;
     }
+    if (paths) {
+        paths->cow_device_name = cow_name;
+    }
 
     remaining_time = GetRemainingTime(params.timeout_ms, begin);
     if (remaining_time.count() < 0) return false;
 
+    if (context == SnapshotContext::Update && live_snapshot_status->compression_enabled()) {
+        // Stop here, we can't run dm-user yet, the COW isn't built.
+        created_devices.Release();
+        return true;
+    }
+
+    if (live_snapshot_status->compression_enabled()) {
+        // Get the source device (eg the view of the partition from before it was resized).
+        std::string source_device_path;
+        if (!MapSourceDevice(lock, params.GetPartitionName(), remaining_time,
+                             &source_device_path)) {
+            LOG(ERROR) << "Could not map source device for: " << cow_name;
+            return false;
+        }
+
+        auto source_device = GetSourceDeviceName(params.GetPartitionName());
+        created_devices.EmplaceBack<AutoUnmapDevice>(&dm, source_device);
+
+        if (!WaitForDevice(source_device_path, remaining_time)) {
+            return false;
+        }
+
+        std::string cow_path;
+        if (!GetMappedImageDevicePath(cow_name, &cow_path)) {
+            LOG(ERROR) << "Could not determine path for: " << cow_name;
+            return false;
+        }
+        if (!WaitForDevice(cow_path, remaining_time)) {
+            return false;
+        }
+
+        auto name = GetDmUserCowName(params.GetPartitionName());
+
+        std::string new_cow_device;
+        if (!MapDmUserCow(lock, name, cow_path, source_device_path, remaining_time,
+                          &new_cow_device)) {
+            LOG(ERROR) << "Could not map dm-user device for partition "
+                       << params.GetPartitionName();
+            return false;
+        }
+        created_devices.EmplaceBack<AutoUnmapDevice>(&dm, name);
+
+        remaining_time = GetRemainingTime(params.timeout_ms, begin);
+        if (remaining_time.count() < 0) return false;
+
+        cow_device = new_cow_device;
+    }
+
+    std::string path;
     if (!MapSnapshot(lock, params.GetPartitionName(), base_device, cow_device, remaining_time,
-                     path)) {
+                     &path)) {
         LOG(ERROR) << "Could not map snapshot for partition: " << params.GetPartitionName();
         return false;
     }
     // No need to add params.GetPartitionName() to created_devices since it is immediately released.
 
+    if (paths) {
+        paths->snapshot_device = path;
+    }
+
     created_devices.Release();
 
-    LOG(INFO) << "Mapped " << params.GetPartitionName() << " as snapshot device at " << *path;
-
+    LOG(INFO) << "Mapped " << params.GetPartitionName() << " as snapshot device at " << path;
     return true;
 }
 
@@ -1737,12 +2014,18 @@
     }
 
     auto& dm = DeviceMapper::Instance();
-    std::string base_name = GetBaseDeviceName(target_partition_name);
+    auto base_name = GetBaseDeviceName(target_partition_name);
     if (!dm.DeleteDeviceIfExists(base_name)) {
         LOG(ERROR) << "Cannot delete base device: " << base_name;
         return false;
     }
 
+    auto source_name = GetSourceDeviceName(target_partition_name);
+    if (!dm.DeleteDeviceIfExists(source_name)) {
+        LOG(ERROR) << "Cannot delete source device: " << source_name;
+        return false;
+    }
+
     LOG(INFO) << "Successfully unmapped snapshot " << target_partition_name;
 
     return true;
@@ -1825,6 +2108,11 @@
     if (!EnsureImageManager()) return false;
 
     auto& dm = DeviceMapper::Instance();
+
+    if (IsCompressionEnabled() && !UnmapDmUserDevice(name)) {
+        return false;
+    }
+
     auto cow_name = GetCowName(name);
     if (!dm.DeleteDeviceIfExists(cow_name)) {
         LOG(ERROR) << "Cannot unmap " << cow_name;
@@ -1839,6 +2127,113 @@
     return true;
 }
 
+bool SnapshotManager::UnmapDmUserDevice(const std::string& snapshot_name) {
+    auto& dm = DeviceMapper::Instance();
+
+    auto dm_user_name = GetDmUserCowName(snapshot_name);
+    if (dm.GetState(dm_user_name) == DmDeviceState::INVALID) {
+        return true;
+    }
+
+    if (!dm.DeleteDeviceIfExists(dm_user_name)) {
+        LOG(ERROR) << "Cannot unmap " << dm_user_name;
+        return false;
+    }
+
+    if (!EnsureSnapuserdConnected()) {
+        return false;
+    }
+    if (!snapuserd_client_->WaitForDeviceDelete(dm_user_name)) {
+        LOG(ERROR) << "Failed to wait for " << dm_user_name << " control device to delete";
+        return false;
+    }
+
+    // Ensure the control device is gone so we don't run into ABA problems.
+    auto control_device = "/dev/dm-user/" + dm_user_name;
+    if (!android::fs_mgr::WaitForFileDeleted(control_device, 10s)) {
+        LOG(ERROR) << "Timed out waiting for " << control_device << " to unlink";
+        return false;
+    }
+    return true;
+}
+
+bool SnapshotManager::MapAllSnapshots(const std::chrono::milliseconds& timeout_ms) {
+    auto lock = LockExclusive();
+    if (!lock) return false;
+
+    auto state = ReadUpdateState(lock.get());
+    if (state == UpdateState::Unverified) {
+        if (GetCurrentSlot() == Slot::Target) {
+            LOG(ERROR) << "Cannot call MapAllSnapshots when booting from the target slot.";
+            return false;
+        }
+    } else if (state != UpdateState::Initiated) {
+        LOG(ERROR) << "Cannot call MapAllSnapshots from update state: " << state;
+        return false;
+    }
+
+    std::vector<std::string> snapshots;
+    if (!ListSnapshots(lock.get(), &snapshots)) {
+        return false;
+    }
+
+    const auto& opener = device_->GetPartitionOpener();
+    auto slot_suffix = device_->GetOtherSlotSuffix();
+    auto slot_number = SlotNumberForSlotSuffix(slot_suffix);
+    auto super_device = device_->GetSuperDevice(slot_number);
+    auto metadata = android::fs_mgr::ReadMetadata(opener, super_device, slot_number);
+    if (!metadata) {
+        LOG(ERROR) << "MapAllSnapshots could not read dynamic partition metadata for device: "
+                   << super_device;
+        return false;
+    }
+
+    for (const auto& snapshot : snapshots) {
+        if (!UnmapPartitionWithSnapshot(lock.get(), snapshot)) {
+            LOG(ERROR) << "MapAllSnapshots could not unmap snapshot: " << snapshot;
+            return false;
+        }
+
+        CreateLogicalPartitionParams params = {
+                .block_device = super_device,
+                .metadata = metadata.get(),
+                .partition_name = snapshot,
+                .partition_opener = &opener,
+                .timeout_ms = timeout_ms,
+        };
+        if (!MapPartitionWithSnapshot(lock.get(), std::move(params), SnapshotContext::Mount,
+                                      nullptr)) {
+            LOG(ERROR) << "MapAllSnapshots failed to map: " << snapshot;
+            return false;
+        }
+    }
+
+    LOG(INFO) << "MapAllSnapshots succeeded.";
+    return true;
+}
+
+bool SnapshotManager::UnmapAllSnapshots() {
+    auto lock = LockExclusive();
+    if (!lock) return false;
+
+    return UnmapAllSnapshots(lock.get());
+}
+
+bool SnapshotManager::UnmapAllSnapshots(LockedFile* lock) {
+    std::vector<std::string> snapshots;
+    if (!ListSnapshots(lock, &snapshots)) {
+        return false;
+    }
+
+    for (const auto& snapshot : snapshots) {
+        if (!UnmapPartitionWithSnapshot(lock, snapshot)) {
+            LOG(ERROR) << "Failed to unmap snapshot: " << snapshot;
+            return false;
+        }
+    }
+    return true;
+}
+
 auto SnapshotManager::OpenFile(const std::string& file, int lock_flags)
         -> std::unique_ptr<LockedFile> {
     unique_fd fd(open(file.c_str(), O_RDONLY | O_CLOEXEC | O_NOFOLLOW));
@@ -1963,8 +2358,15 @@
 }
 
 bool SnapshotManager::WriteUpdateState(LockedFile* lock, UpdateState state) {
-    SnapshotUpdateStatus status = {};
+    SnapshotUpdateStatus status;
     status.set_state(state);
+
+    // If we're transitioning between two valid states (eg, we're not beginning
+    // or ending an OTA), then make sure to propagate the compression bit.
+    if (!(state == UpdateState::Initiated || state == UpdateState::None)) {
+        SnapshotUpdateStatus old_status = ReadSnapshotUpdateStatus(lock);
+        status.set_compression_enabled(old_status.compression_enabled());
+    }
     return WriteSnapshotUpdateStatus(lock, status);
 }
 
@@ -2075,14 +2477,6 @@
     return true;
 }
 
-std::string SnapshotManager::GetSnapshotDeviceName(const std::string& snapshot_name,
-                                                   const SnapshotStatus& status) {
-    if (status.device_size() != status.snapshot_size()) {
-        return GetSnapshotExtraDeviceName(snapshot_name);
-    }
-    return snapshot_name;
-}
-
 bool SnapshotManager::EnsureImageManager() {
     if (images_) return true;
 
@@ -2095,6 +2489,23 @@
     return true;
 }
 
+bool SnapshotManager::EnsureSnapuserdConnected() {
+    if (snapuserd_client_) {
+        return true;
+    }
+
+    if (!use_first_stage_snapuserd_ && !EnsureSnapuserdStarted()) {
+        return false;
+    }
+
+    snapuserd_client_ = SnapuserdClient::Connect(kSnapuserdSocket, 10s);
+    if (!snapuserd_client_) {
+        LOG(ERROR) << "Unable to connect to snapuserd";
+        return false;
+    }
+    return true;
+}
+
 bool SnapshotManager::ForceLocalImageManager() {
     images_ = android::fiemap::ImageManager::Open(gsid_dir_);
     if (!images_) {
@@ -2137,6 +2548,12 @@
     auto lock = LockExclusive();
     if (!lock) return Return::Error();
 
+    auto update_state = ReadUpdateState(lock.get());
+    if (update_state != UpdateState::Initiated) {
+        LOG(ERROR) << "Cannot create update snapshots in state " << update_state;
+        return Return::Error();
+    }
+
     // TODO(b/134949511): remove this check. Right now, with overlayfs mounted, the scratch
     // partition takes up a big chunk of space in super, causing COW images to be created on
     // retrofit Virtual A/B devices.
@@ -2199,14 +2616,19 @@
     // these devices.
     AutoDeviceList created_devices;
 
+    bool use_compression = IsCompressionEnabled() &&
+                           manifest.dynamic_partition_metadata().vabc_enabled() &&
+                           !device_->IsRecovery();
+
     PartitionCowCreator cow_creator{
             .target_metadata = target_metadata.get(),
             .target_suffix = target_suffix,
             .target_partition = nullptr,
             .current_metadata = current_metadata.get(),
             .current_suffix = current_suffix,
-            .operations = nullptr,
+            .update = nullptr,
             .extra_extents = {},
+            .compression_enabled = use_compression,
     };
 
     auto ret = CreateUpdateSnapshotsInternal(lock.get(), manifest, &cow_creator, &created_devices,
@@ -2230,6 +2652,32 @@
         return Return::Error();
     }
 
+    // If compression is enabled, we need to retain a copy of the old metadata
+    // so we can access original blocks in case they are moved around. We do
+    // not want to rely on the old super metadata slot because we don't
+    // guarantee its validity after the slot switch is successful.
+    if (cow_creator.compression_enabled) {
+        auto metadata = current_metadata->Export();
+        if (!metadata) {
+            LOG(ERROR) << "Could not export current metadata";
+            return Return::Error();
+        }
+
+        auto path = GetOldPartitionMetadataPath();
+        if (!android::fs_mgr::WriteToImageFile(path, *metadata.get())) {
+            LOG(ERROR) << "Cannot write old metadata to " << path;
+            return Return::Error();
+        }
+    }
+
+    SnapshotUpdateStatus status = {};
+    status.set_state(update_state);
+    status.set_compression_enabled(cow_creator.compression_enabled);
+    if (!WriteSnapshotUpdateStatus(lock.get(), status)) {
+        LOG(ERROR) << "Unable to write new update state";
+        return Return::Error();
+    }
+
     created_devices.Release();
     LOG(INFO) << "Successfully created all snapshots for target slot " << target_suffix;
 
@@ -2250,12 +2698,11 @@
         return Return::Error();
     }
 
-    std::map<std::string, const RepeatedPtrField<InstallOperation>*> install_operation_map;
+    std::map<std::string, const PartitionUpdate*> partition_map;
     std::map<std::string, std::vector<Extent>> extra_extents_map;
     for (const auto& partition_update : manifest.partitions()) {
         auto suffixed_name = partition_update.partition_name() + target_suffix;
-        auto&& [it, inserted] =
-                install_operation_map.emplace(suffixed_name, &partition_update.operations());
+        auto&& [it, inserted] = partition_map.emplace(suffixed_name, &partition_update);
         if (!inserted) {
             LOG(ERROR) << "Duplicated partition " << partition_update.partition_name()
                        << " in update manifest.";
@@ -2273,10 +2720,14 @@
 
     for (auto* target_partition : ListPartitionsWithSuffix(target_metadata, target_suffix)) {
         cow_creator->target_partition = target_partition;
-        cow_creator->operations = nullptr;
-        auto operations_it = install_operation_map.find(target_partition->name());
-        if (operations_it != install_operation_map.end()) {
-            cow_creator->operations = operations_it->second;
+        cow_creator->update = nullptr;
+        auto iter = partition_map.find(target_partition->name());
+        if (iter != partition_map.end()) {
+            cow_creator->update = iter->second;
+        } else {
+            LOG(INFO) << target_partition->name()
+                      << " isn't included in the payload, skipping the cow creation.";
+            continue;
         }
 
         cow_creator->extra_extents.clear();
@@ -2288,6 +2739,7 @@
         // Compute the device sizes for the partition.
         auto cow_creator_ret = cow_creator->Run();
         if (!cow_creator_ret.has_value()) {
+            LOG(ERROR) << "PartitionCowCreator returned no value for " << target_partition->name();
             return Return::Error();
         }
 
@@ -2318,8 +2770,17 @@
             continue;
         }
 
+        // Find the original partition size.
+        auto name = target_partition->name();
+        auto old_partition_name =
+                name.substr(0, name.size() - target_suffix.size()) + cow_creator->current_suffix;
+        auto old_partition = cow_creator->current_metadata->FindPartition(old_partition_name);
+        if (old_partition) {
+            cow_creator_ret->snapshot_status.set_old_partition_size(old_partition->size());
+        }
+
         // Store these device sizes to snapshot status file.
-        if (!CreateSnapshot(lock, &cow_creator_ret->snapshot_status)) {
+        if (!CreateSnapshot(lock, cow_creator, &cow_creator_ret->snapshot_status)) {
             return Return::Error();
         }
         created_devices->EmplaceBack<AutoDeleteSnapshot>(this, lock, target_partition->name());
@@ -2404,11 +2865,26 @@
             return Return::Error();
         }
 
-        auto ret = InitializeCow(cow_path);
-        if (!ret.is_ok()) {
-            LOG(ERROR) << "Can't zero-fill COW device for " << target_partition->name() << ": "
-                       << cow_path;
-            return AddRequiredSpace(ret, all_snapshot_status);
+        if (it->second.compression_enabled()) {
+            unique_fd fd(open(cow_path.c_str(), O_RDWR | O_CLOEXEC));
+            if (fd < 0) {
+                PLOG(ERROR) << "open " << cow_path << " failed for snapshot "
+                            << cow_params.partition_name;
+                return Return::Error();
+            }
+
+            CowWriter writer(CowOptions{});
+            if (!writer.Initialize(fd) || !writer.Finalize()) {
+                LOG(ERROR) << "Could not initialize COW device for " << target_partition->name();
+                return Return::Error();
+            }
+        } else {
+            auto ret = InitializeKernelCow(cow_path);
+            if (!ret.is_ok()) {
+                LOG(ERROR) << "Can't zero-fill COW device for " << target_partition->name() << ": "
+                           << cow_path;
+                return AddRequiredSpace(ret, all_snapshot_status);
+            }
         }
         // Let destructor of created_devices_for_cow to unmap the COW devices.
     };
@@ -2424,16 +2900,153 @@
                    << params.GetPartitionName();
         return false;
     }
-    return MapPartitionWithSnapshot(lock.get(), params, snapshot_path);
+
+    SnapshotStatus status;
+    if (!ReadSnapshotStatus(lock.get(), params.GetPartitionName(), &status)) {
+        return false;
+    }
+    if (status.compression_enabled()) {
+        LOG(ERROR) << "Cannot use MapUpdateSnapshot with compressed snapshots";
+        return false;
+    }
+
+    SnapshotPaths paths;
+    if (!MapPartitionWithSnapshot(lock.get(), params, SnapshotContext::Update, &paths)) {
+        return false;
+    }
+
+    if (!paths.snapshot_device.empty()) {
+        *snapshot_path = paths.snapshot_device;
+    } else {
+        *snapshot_path = paths.target_device;
+    }
+    DCHECK(!snapshot_path->empty());
+    return true;
 }
 
+std::unique_ptr<ISnapshotWriter> SnapshotManager::OpenSnapshotWriter(
+        const android::fs_mgr::CreateLogicalPartitionParams& params,
+        const std::optional<std::string>& source_device) {
+#if defined(LIBSNAPSHOT_NO_COW_WRITE)
+    (void)params;
+    (void)source_device;
+
+    LOG(ERROR) << "Snapshots cannot be written in first-stage init or recovery";
+    return nullptr;
+#else
+    // First unmap any existing mapping.
+    auto lock = LockShared();
+    if (!lock) return nullptr;
+    if (!UnmapPartitionWithSnapshot(lock.get(), params.GetPartitionName())) {
+        LOG(ERROR) << "Cannot unmap existing snapshot before re-mapping it: "
+                   << params.GetPartitionName();
+        return nullptr;
+    }
+
+    SnapshotPaths paths;
+    if (!MapPartitionWithSnapshot(lock.get(), params, SnapshotContext::Update, &paths)) {
+        return nullptr;
+    }
+
+    SnapshotStatus status;
+    if (!paths.cow_device_name.empty()) {
+        if (!ReadSnapshotStatus(lock.get(), params.GetPartitionName(), &status)) {
+            return nullptr;
+        }
+    } else {
+        // Currently, partition_cow_creator always creates snapshots. The
+        // reason is that if partition X shrinks while partition Y grows, we
+        // cannot bindly write to the newly freed extents in X. This would
+        // make the old slot unusable. So, the entire size of the target
+        // partition is currently considered snapshottable.
+        LOG(ERROR) << "No snapshot available for partition " << params.GetPartitionName();
+        return nullptr;
+    }
+
+    if (status.compression_enabled()) {
+        return OpenCompressedSnapshotWriter(lock.get(), source_device, params.GetPartitionName(),
+                                            status, paths);
+    }
+    return OpenKernelSnapshotWriter(lock.get(), source_device, params.GetPartitionName(), status,
+                                    paths);
+#endif
+}
+
+#if !defined(LIBSNAPSHOT_NO_COW_WRITE)
+std::unique_ptr<ISnapshotWriter> SnapshotManager::OpenCompressedSnapshotWriter(
+        LockedFile* lock, const std::optional<std::string>& source_device,
+        [[maybe_unused]] const std::string& partition_name, const SnapshotStatus& status,
+        const SnapshotPaths& paths) {
+    CHECK(lock);
+
+    CowOptions cow_options;
+    cow_options.compression = "gz";
+    cow_options.max_blocks = {status.device_size() / cow_options.block_size};
+
+    // Currently we don't support partial snapshots, since partition_cow_creator
+    // never creates this scenario.
+    CHECK(status.snapshot_size() == status.device_size());
+
+    auto writer = std::make_unique<CompressedSnapshotWriter>(cow_options);
+    if (source_device) {
+        writer->SetSourceDevice(*source_device);
+    }
+
+    std::string cow_path;
+    if (!GetMappedImageDevicePath(paths.cow_device_name, &cow_path)) {
+        LOG(ERROR) << "Could not determine path for " << paths.cow_device_name;
+        return nullptr;
+    }
+
+    unique_fd cow_fd(open(cow_path.c_str(), O_RDWR | O_CLOEXEC));
+    if (cow_fd < 0) {
+        PLOG(ERROR) << "OpenCompressedSnapshotWriter: open " << cow_path;
+        return nullptr;
+    }
+    if (!writer->SetCowDevice(std::move(cow_fd))) {
+        LOG(ERROR) << "Could not create COW writer from " << cow_path;
+        return nullptr;
+    }
+
+    return writer;
+}
+
+std::unique_ptr<ISnapshotWriter> SnapshotManager::OpenKernelSnapshotWriter(
+        LockedFile* lock, const std::optional<std::string>& source_device,
+        [[maybe_unused]] const std::string& partition_name, const SnapshotStatus& status,
+        const SnapshotPaths& paths) {
+    CHECK(lock);
+
+    CowOptions cow_options;
+    cow_options.max_blocks = {status.device_size() / cow_options.block_size};
+
+    auto writer = std::make_unique<OnlineKernelSnapshotWriter>(cow_options);
+
+    std::string path = paths.snapshot_device.empty() ? paths.target_device : paths.snapshot_device;
+    unique_fd fd(open(path.c_str(), O_RDWR | O_CLOEXEC));
+    if (fd < 0) {
+        PLOG(ERROR) << "open failed: " << path;
+        return nullptr;
+    }
+
+    if (source_device) {
+        writer->SetSourceDevice(*source_device);
+    }
+
+    uint64_t cow_size = status.cow_partition_size() + status.cow_file_size();
+    writer->SetSnapshotDevice(std::move(fd), cow_size);
+
+    return writer;
+}
+#endif  // !defined(LIBSNAPSHOT_NO_COW_WRITE)
+
 bool SnapshotManager::UnmapUpdateSnapshot(const std::string& target_partition_name) {
     auto lock = LockShared();
     if (!lock) return false;
     return UnmapPartitionWithSnapshot(lock.get(), target_partition_name);
 }
 
-bool SnapshotManager::UnmapAllPartitions() {
+bool SnapshotManager::UnmapAllPartitionsInRecovery() {
     auto lock = LockExclusive();
     if (!lock) return false;
 
@@ -2577,7 +3190,7 @@
     }
 
     // Nothing should be depending on partitions now, so unmap them all.
-    if (!UnmapAllPartitions()) {
+    if (!UnmapAllPartitionsInRecovery()) {
         LOG(ERROR) << "Unable to unmap all partitions; fastboot may fail to flash.";
     }
     return true;
@@ -2608,7 +3221,7 @@
     }
 
     // Nothing should be depending on partitions now, so unmap them all.
-    if (!UnmapAllPartitions()) {
+    if (!UnmapAllPartitionsInRecovery()) {
         LOG(ERROR) << "Unable to unmap all partitions; fastboot may fail to flash.";
     }
     return true;
@@ -2675,6 +3288,14 @@
 
     auto& dm = DeviceMapper::Instance();
     for (const auto& snapshot : snapshots) {
+        SnapshotStatus status;
+        if (!ReadSnapshotStatus(lock, snapshot, &status)) {
+            return false;
+        }
+        if (status.compression_enabled()) {
+            continue;
+        }
+
         std::vector<DeviceMapper::TargetInfo> targets;
         if (!dm.GetTableStatus(snapshot, &targets)) {
             LOG(ERROR) << "Could not read snapshot device table: " << snapshot;
@@ -2760,6 +3381,26 @@
     return true;
 }
 
+ISnapshotMergeStats* SnapshotManager::GetSnapshotMergeStatsInstance() {
+    return SnapshotMergeStats::GetInstance(*this);
+}
+
+// This is only to be used in recovery or normal Android (not first-stage init).
+// We don't guarantee dm paths are available in first-stage init, because ueventd
+// isn't running yet.
+bool SnapshotManager::GetMappedImageDevicePath(const std::string& device_name,
+                                               std::string* device_path) {
+    auto& dm = DeviceMapper::Instance();
+
+    // Try getting the device string if it is a device mapper device.
+    if (dm.GetState(device_name) != DmDeviceState::INVALID) {
+        return dm.GetDmDevicePathByName(device_name, device_path);
+    }
+
+    // Otherwise, get path from IImageManager.
+    return images_->GetMappedImageDevice(device_name, device_path);
+}
+
 bool SnapshotManager::GetMappedImageDeviceStringOrPath(const std::string& device_name,
                                                        std::string* device_string_or_mapped_path) {
     auto& dm = DeviceMapper::Instance();
@@ -2779,5 +3420,76 @@
     return true;
 }
 
+bool SnapshotManager::WaitForDevice(const std::string& device,
+                                    std::chrono::milliseconds timeout_ms) {
+    if (!android::base::StartsWith(device, "/")) {
+        return true;
+    }
+
+    // In first-stage init, we rely on init setting a callback which can
+    // regenerate uevents and populate /dev for us.
+    if (uevent_regen_callback_) {
+        if (!uevent_regen_callback_(device)) {
+            LOG(ERROR) << "Failed to find device after regenerating uevents: " << device;
+            return false;
+        }
+        return true;
+    }
+
+    // Otherwise, the only kind of device we need to wait for is a dm-user
+    // misc device. Normal calls to DeviceMapper::CreateDevice() guarantee
+    // the path has been created.
+    if (!android::base::StartsWith(device, "/dev/dm-user/")) {
+        return true;
+    }
+
+    if (timeout_ms.count() == 0) {
+        LOG(ERROR) << "No timeout was specified to wait for device: " << device;
+        return false;
+    }
+    if (!android::fs_mgr::WaitForFile(device, timeout_ms)) {
+        LOG(ERROR) << "Timed out waiting for device to appear: " << device;
+        return false;
+    }
+    return true;
+}
+
+bool SnapshotManager::IsSnapuserdRequired() {
+    auto lock = LockExclusive();
+    if (!lock) return false;
+
+    auto status = ReadSnapshotUpdateStatus(lock.get());
+    return status.state() != UpdateState::None && status.compression_enabled();
+}
+
+bool SnapshotManager::DetachSnapuserdForSelinux(std::vector<std::string>* snapuserd_argv) {
+    return PerformInitTransition(InitTransition::SELINUX_DETACH, snapuserd_argv);
+}
+
+bool SnapshotManager::PerformSecondStageInitTransition() {
+    return PerformInitTransition(InitTransition::SECOND_STAGE);
+}
+
+const LpMetadata* SnapshotManager::ReadOldPartitionMetadata(LockedFile* lock) {
+    CHECK(lock);
+
+    if (!old_partition_metadata_) {
+        auto path = GetOldPartitionMetadataPath();
+        old_partition_metadata_ = android::fs_mgr::ReadFromImageFile(path);
+        if (!old_partition_metadata_) {
+            LOG(ERROR) << "Could not read old partition metadata from " << path;
+            return nullptr;
+        }
+    }
+    return old_partition_metadata_.get();
+}
+
+MergePhase SnapshotManager::DecideMergePhase(const SnapshotStatus& status) {
+    if (status.compression_enabled() && status.device_size() < status.old_partition_size()) {
+        return MergePhase::FIRST_PHASE;
+    }
+    return MergePhase::SECOND_PHASE;
+}
+
 }  // namespace snapshot
 }  // namespace android
diff --git a/fs_mgr/libsnapshot/snapshot_fuzz.cpp b/fs_mgr/libsnapshot/snapshot_fuzz.cpp
new file mode 100644
index 0000000..aced3ed
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_fuzz.cpp
@@ -0,0 +1,352 @@
+// Copyright (C) 2020 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.
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sysexits.h>
+
+#include <functional>
+#include <sstream>
+#include <tuple>
+
+#include <android-base/logging.h>
+#include <android-base/properties.h>
+#include <android-base/result.h>
+#include <gtest/gtest.h>
+#include <src/libfuzzer/libfuzzer_macro.h>
+#include <storage_literals/storage_literals.h>
+
+#include "fuzz_utils.h"
+#include "snapshot_fuzz_utils.h"
+
+using android::base::Error;
+using android::base::GetBoolProperty;
+using android::base::LogId;
+using android::base::LogSeverity;
+using android::base::ReadFileToString;
+using android::base::Result;
+using android::base::SetLogger;
+using android::base::StderrLogger;
+using android::base::StdioLogger;
+using android::fs_mgr::CreateLogicalPartitionParams;
+using android::fuzz::CheckedCast;
+using android::snapshot::SnapshotFuzzData;
+using android::snapshot::SnapshotFuzzEnv;
+using chromeos_update_engine::DeltaArchiveManifest;
+using google::protobuf::FieldDescriptor;
+using google::protobuf::Message;
+using google::protobuf::RepeatedPtrField;
+
+// Avoid linking to libgsi since it needs disk I/O.
+namespace android::gsi {
+bool IsGsiRunning() {
+    LOG(FATAL) << "Called IsGsiRunning";
+    __builtin_unreachable();
+}
+std::string GetDsuSlot(const std::string& install_dir) {
+    LOG(FATAL) << "Called GetDsuSlot(" << install_dir << ")";
+    __builtin_unreachable();
+}
+}  // namespace android::gsi
+
+namespace android::snapshot {
+
+const SnapshotFuzzData* current_data = nullptr;
+const SnapshotTestModule* current_module = nullptr;
+
+SnapshotFuzzEnv* GetSnapshotFuzzEnv();
+
+FUZZ_CLASS(ISnapshotManager, SnapshotManagerAction);
+
+using ProcessUpdateStateArgs = SnapshotManagerAction::Proto::ProcessUpdateStateArgs;
+using CreateLogicalAndSnapshotPartitionsArgs =
+        SnapshotManagerAction::Proto::CreateLogicalAndSnapshotPartitionsArgs;
+using RecoveryCreateSnapshotDevicesArgs =
+        SnapshotManagerAction::Proto::RecoveryCreateSnapshotDevicesArgs;
+
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, BeginUpdate);
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, CancelUpdate);
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, InitiateMerge);
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, NeedSnapshotsInFirstStageMount);
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, RecoveryCreateSnapshotDevices);
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, EnsureMetadataMounted);
+FUZZ_SIMPLE_FUNCTION(SnapshotManagerAction, GetSnapshotMergeStatsInstance);
+
+#define SNAPSHOT_FUZZ_FUNCTION(FunctionName, ReturnType, ...)                                  \
+    FUZZ_FUNCTION(SnapshotManagerAction, FunctionName, ReturnType, ISnapshotManager* snapshot, \
+                  ##__VA_ARGS__)
+
+SNAPSHOT_FUZZ_FUNCTION(FinishedSnapshotWrites, bool, bool wipe) {
+    return snapshot->FinishedSnapshotWrites(wipe);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(ProcessUpdateState, bool, const ProcessUpdateStateArgs& args) {
+    std::function<bool()> before_cancel;
+    if (args.has_before_cancel()) {
+        before_cancel = [&]() { return args.fail_before_cancel(); };
+    }
+    return snapshot->ProcessUpdateState({}, before_cancel);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(GetUpdateState, UpdateState, bool has_progress_arg) {
+    double progress;
+    return snapshot->GetUpdateState(has_progress_arg ? &progress : nullptr);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(HandleImminentDataWipe, bool, bool has_callback) {
+    std::function<void()> callback;
+    if (has_callback) {
+        callback = []() {};
+    }
+    return snapshot->HandleImminentDataWipe(callback);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(Dump, bool) {
+    std::stringstream ss;
+    return snapshot->Dump(ss);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(CreateUpdateSnapshots, bool, const DeltaArchiveManifest& manifest) {
+    return snapshot->CreateUpdateSnapshots(manifest);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(UnmapUpdateSnapshot, bool, const std::string& name) {
+    return snapshot->UnmapUpdateSnapshot(name);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(CreateLogicalAndSnapshotPartitions, bool,
+                       const CreateLogicalAndSnapshotPartitionsArgs& args) {
+    const std::string* super;
+    if (args.use_correct_super()) {
+        super = &GetSnapshotFuzzEnv()->super();
+    } else {
+        super = &args.super();
+    }
+    return snapshot->CreateLogicalAndSnapshotPartitions(
+            *super, std::chrono::milliseconds(args.timeout_millis()));
+}
+
+SNAPSHOT_FUZZ_FUNCTION(RecoveryCreateSnapshotDevicesWithMetadata, CreateResult,
+                       const RecoveryCreateSnapshotDevicesArgs& args) {
+    std::unique_ptr<AutoDevice> device;
+    if (args.has_metadata_device_object()) {
+        device = std::make_unique<NoOpAutoDevice>(args.metadata_mounted());
+    }
+    return snapshot->RecoveryCreateSnapshotDevices(device);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(MapUpdateSnapshot, bool,
+                       const CreateLogicalPartitionParamsProto& params_proto) {
+    auto partition_opener = std::make_unique<TestPartitionOpener>(GetSnapshotFuzzEnv()->super());
+    CreateLogicalPartitionParams params;
+    if (params_proto.use_correct_super()) {
+        params.block_device = GetSnapshotFuzzEnv()->super();
+    } else {
+        params.block_device = params_proto.block_device();
+    }
+    if (params_proto.has_metadata_slot()) {
+        params.metadata_slot = params_proto.metadata_slot();
+    }
+    params.partition_name = params_proto.partition_name();
+    params.force_writable = params_proto.force_writable();
+    params.timeout_ms = std::chrono::milliseconds(params_proto.timeout_millis());
+    params.device_name = params_proto.device_name();
+    params.partition_opener = partition_opener.get();
+    std::string path;
+    return snapshot->MapUpdateSnapshot(params, &path);
+}
+
+SNAPSHOT_FUZZ_FUNCTION(SwitchSlot, void) {
+    (void)snapshot;
+    CHECK(current_module != nullptr);
+    CHECK(current_module->device_info != nullptr);
+    current_module->device_info->SwitchSlot();
+}
+
+// During global init, log all messages to stdio. This is only done once.
+int AllowLoggingDuringGlobalInit() {
+    SetLogger(&StdioLogger);
+    return 0;
+}
+
+// Only log fatal messages during tests.
+void FatalOnlyLogger(LogId logid, LogSeverity severity, const char* tag, const char* file,
+                     unsigned int line, const char* message) {
+    if (severity == LogSeverity::FATAL) {
+        StderrLogger(logid, severity, tag, file, line, message);
+
+        // If test fails by a LOG(FATAL) or CHECK(), log the corpus. If it abort()'s, there's
+        // nothing else we can do.
+        StderrLogger(logid, severity, tag, __FILE__, __LINE__,
+                     "Attempting to dump current corpus:");
+        if (current_data == nullptr) {
+            StderrLogger(logid, severity, tag, __FILE__, __LINE__, "Current corpus is nullptr.");
+        } else {
+            std::string content;
+            if (!google::protobuf::TextFormat::PrintToString(*current_data, &content)) {
+                StderrLogger(logid, severity, tag, __FILE__, __LINE__,
+                             "Failed to print corpus to string.");
+            } else {
+                StderrLogger(logid, severity, tag, __FILE__, __LINE__, content.c_str());
+            }
+        }
+    }
+}
+// Stop logging (except fatal messages) after global initialization. This is only done once.
+int StopLoggingAfterGlobalInit() {
+    (void)GetSnapshotFuzzEnv();
+    [[maybe_unused]] static protobuf_mutator::protobuf::LogSilencer log_silencer;
+    SetLogger(&FatalOnlyLogger);
+    return 0;
+}
+
+SnapshotFuzzEnv* GetSnapshotFuzzEnv() {
+    [[maybe_unused]] static auto allow_logging = AllowLoggingDuringGlobalInit();
+    static SnapshotFuzzEnv env;
+    return &env;
+}
+
+SnapshotTestModule SetUpTest(const SnapshotFuzzData& snapshot_fuzz_data) {
+    current_data = &snapshot_fuzz_data;
+
+    auto env = GetSnapshotFuzzEnv();
+    env->CheckSoftReset();
+
+    auto test_module = env->CheckCreateSnapshotManager(snapshot_fuzz_data);
+    current_module = &test_module;
+    CHECK(test_module.snapshot);
+    return test_module;
+}
+
+void TearDownTest() {
+    current_module = nullptr;
+    current_data = nullptr;
+}
+
+}  // namespace android::snapshot
+
+DEFINE_PROTO_FUZZER(const SnapshotFuzzData& snapshot_fuzz_data) {
+    using namespace android::snapshot;
+
+    [[maybe_unused]] static auto stop_logging = StopLoggingAfterGlobalInit();
+    auto test_module = SetUpTest(snapshot_fuzz_data);
+    SnapshotManagerAction::ExecuteAll(test_module.snapshot.get(), snapshot_fuzz_data.actions());
+    TearDownTest();
+}
+
+namespace android::snapshot {
+
+// Work-around to cast a 'void' value to Result<void>.
+template <typename T>
+struct GoodResult {
+    template <typename F>
+    static Result<T> Cast(F&& f) {
+        return f();
+    }
+};
+
+template <>
+struct GoodResult<void> {
+    template <typename F>
+    static Result<void> Cast(F&& f) {
+        f();
+        return {};
+    }
+};
+
+class LibsnapshotFuzzerTest : public ::testing::Test {
+  protected:
+    static void SetUpTestCase() {
+        // Do initialization once.
+        (void)GetSnapshotFuzzEnv();
+    }
+    void SetUp() override {
+        bool is_virtual_ab = GetBoolProperty("ro.virtual_ab.enabled", false);
+        if (!is_virtual_ab) GTEST_SKIP() << "Test only runs on Virtual A/B devices.";
+    }
+    void SetUpFuzzData(const std::string& fn) {
+        auto path = android::base::GetExecutableDirectory() + "/corpus/"s + fn;
+        std::string proto_text;
+        ASSERT_TRUE(ReadFileToString(path, &proto_text));
+        snapshot_fuzz_data_ = std::make_unique<SnapshotFuzzData>();
+        ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString(proto_text,
+                                                                  snapshot_fuzz_data_.get()));
+        test_module_ = android::snapshot::SetUpTest(*snapshot_fuzz_data_);
+    }
+    void TearDown() override { android::snapshot::TearDownTest(); }
+    template <typename FuzzFunction>
+    Result<typename FuzzFunction::ReturnType> Execute(int action_index) {
+        if (action_index >= snapshot_fuzz_data_->actions_size()) {
+            return Error() << "Index " << action_index << " is out of bounds ("
+                           << snapshot_fuzz_data_->actions_size() << " actions in corpus";
+        }
+        const auto& action_proto = snapshot_fuzz_data_->actions(action_index);
+        const auto* field_desc =
+                android::fuzz::GetValueFieldDescriptor<typename FuzzFunction::ActionType>(
+                        action_proto);
+        if (field_desc == nullptr) {
+            return Error() << "Action at index " << action_index << " has no value defined.";
+        }
+        if (FuzzFunction::tag != field_desc->number()) {
+            return Error() << "Action at index " << action_index << " is expected to be "
+                           << FuzzFunction::name << ", but it is " << field_desc->name()
+                           << " in corpus.";
+        }
+        return GoodResult<typename FuzzFunction::ReturnType>::Cast([&]() {
+            return android::fuzz::ActionPerformer<FuzzFunction>::Invoke(test_module_.snapshot.get(),
+                                                                        action_proto, field_desc);
+        });
+    }
+
+    std::unique_ptr<SnapshotFuzzData> snapshot_fuzz_data_;
+    SnapshotTestModule test_module_;
+};
+
+#define SNAPSHOT_FUZZ_FN_NAME(name) FUZZ_FUNCTION_CLASS_NAME(SnapshotManagerAction, name)
+
+MATCHER_P(ResultIs, expected, "") {
+    if (!arg.ok()) {
+        *result_listener << arg.error();
+        return false;
+    }
+    *result_listener << "expected: " << expected;
+    return arg.value() == expected;
+}
+
+#define ASSERT_RESULT_TRUE(actual) ASSERT_THAT(actual, ResultIs(true))
+
+// Check that launch_device.txt is executed correctly.
+TEST_F(LibsnapshotFuzzerTest, LaunchDevice) {
+    SetUpFuzzData("launch_device.txt");
+
+    int i = 0;
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(BeginUpdate)>(i++));
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(CreateUpdateSnapshots)>(i++));
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(MapUpdateSnapshot)>(i++)) << "sys_b";
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(MapUpdateSnapshot)>(i++)) << "vnd_b";
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(MapUpdateSnapshot)>(i++)) << "prd_b";
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(FinishedSnapshotWrites)>(i++));
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(UnmapUpdateSnapshot)>(i++)) << "sys_b";
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(UnmapUpdateSnapshot)>(i++)) << "vnd_b";
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(UnmapUpdateSnapshot)>(i++)) << "prd_b";
+    ASSERT_RESULT_OK(Execute<SNAPSHOT_FUZZ_FN_NAME(SwitchSlot)>(i++));
+    ASSERT_EQ("_b", test_module_.device_info->GetSlotSuffix());
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(NeedSnapshotsInFirstStageMount)>(i++));
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(CreateLogicalAndSnapshotPartitions)>(i++));
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(InitiateMerge)>(i++));
+    ASSERT_RESULT_TRUE(Execute<SNAPSHOT_FUZZ_FN_NAME(ProcessUpdateState)>(i++));
+    ASSERT_EQ(i, snapshot_fuzz_data_->actions_size()) << "Not all actions are executed.";
+}
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/snapshot_fuzz_utils.cpp b/fs_mgr/libsnapshot/snapshot_fuzz_utils.cpp
new file mode 100644
index 0000000..8926535
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_fuzz_utils.cpp
@@ -0,0 +1,516 @@
+// Copyright (C) 2020 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.
+
+#include <ftw.h>
+#include <inttypes.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sysexits.h>
+
+#include <chrono>
+#include <string>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/properties.h>
+#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
+#include <fs_mgr.h>
+#include <libsnapshot/auto_device.h>
+#include <libsnapshot/snapshot.h>
+#include <storage_literals/storage_literals.h>
+
+#include "snapshot_fuzz_utils.h"
+#include "utility.h"
+
+// Prepends the errno string, but it is good enough.
+#ifndef PCHECK
+#define PCHECK(x) CHECK(x) << strerror(errno) << ": "
+#endif
+
+using namespace android::storage_literals;
+using namespace std::chrono_literals;
+using namespace std::string_literals;
+
+using android::base::Basename;
+using android::base::ReadFileToString;
+using android::base::SetProperty;
+using android::base::Split;
+using android::base::StartsWith;
+using android::base::StringPrintf;
+using android::base::unique_fd;
+using android::base::WriteStringToFile;
+using android::dm::DeviceMapper;
+using android::dm::DmTarget;
+using android::dm::LoopControl;
+using android::fiemap::IImageManager;
+using android::fiemap::ImageManager;
+using android::fs_mgr::BlockDeviceInfo;
+using android::fs_mgr::FstabEntry;
+using android::fs_mgr::IPartitionOpener;
+using chromeos_update_engine::DynamicPartitionMetadata;
+
+static const char MNT_DIR[] = "/mnt";
+static const char BLOCK_SYSFS[] = "/sys/block";
+
+static const char FAKE_ROOT_NAME[] = "snapshot_fuzz";
+static const auto SUPER_IMAGE_SIZE = 16_MiB;
+static const auto DATA_IMAGE_SIZE = 16_MiB;
+static const auto FAKE_ROOT_SIZE = 64_MiB;
+
+namespace android::snapshot {
+
+bool Mkdir(const std::string& path) {
+    if (mkdir(path.c_str(), 0750) == -1 && errno != EEXIST) {
+        PLOG(ERROR) << "Cannot create " << path;
+        return false;
+    }
+    return true;
+}
+
+bool RmdirRecursive(const std::string& path) {
+    auto callback = [](const char* child, const struct stat*, int file_type, struct FTW*) -> int {
+        switch (file_type) {
+            case FTW_D:
+            case FTW_DP:
+            case FTW_DNR:
+                if (rmdir(child) == -1) {
+                    PLOG(ERROR) << "rmdir " << child;
+                    return -1;
+                }
+                return 0;
+            case FTW_NS:
+            default:
+                if (rmdir(child) != -1) break;
+                [[fallthrough]];
+            case FTW_F:
+            case FTW_SL:
+            case FTW_SLN:
+                if (unlink(child) == -1) {
+                    PLOG(ERROR) << "unlink " << child;
+                    return -1;
+                }
+                return 0;
+        }
+        return 0;
+    };
+
+    return nftw(path.c_str(), callback, 128, FTW_DEPTH | FTW_MOUNT | FTW_PHYS) == 0;
+}
+
+std::string GetLinearBaseDeviceString(const DeviceMapper::TargetInfo& target) {
+    if (target.spec.target_type != "linear"s) return {};
+    auto tokens = Split(target.data, " ");
+    CHECK_EQ(2, tokens.size());
+    return tokens[0];
+}
+
+std::vector<std::string> GetSnapshotBaseDeviceStrings(const DeviceMapper::TargetInfo& target) {
+    if (target.spec.target_type != "snapshot"s && target.spec.target_type != "snapshot-merge"s)
+        return {};
+    auto tokens = Split(target.data, " ");
+    CHECK_EQ(4, tokens.size());
+    return {tokens[0], tokens[1]};
+}
+
+bool ShouldDeleteLoopDevice(const std::string& node) {
+    std::string backing_file;
+    if (ReadFileToString(StringPrintf("%s/loop/backing_file", node.data()), &backing_file)) {
+        if (StartsWith(backing_file, std::string(MNT_DIR) + "/" + FAKE_ROOT_NAME)) {
+            return true;
+        }
+    }
+    return false;
+}
+
+std::vector<DeviceMapper::TargetInfo> GetTableInfoIfExists(const std::string& dev_name) {
+    auto& dm = DeviceMapper::Instance();
+    std::vector<DeviceMapper::TargetInfo> table;
+    if (!dm.GetTableInfo(dev_name, &table)) {
+        PCHECK(errno == ENODEV);
+        return {};
+    }
+    return table;
+}
+
+std::set<std::string> GetAllBaseDeviceStrings(const std::string& child_dev) {
+    std::set<std::string> ret;
+    for (const auto& child_target : GetTableInfoIfExists(child_dev)) {
+        auto snapshot_bases = GetSnapshotBaseDeviceStrings(child_target);
+        ret.insert(snapshot_bases.begin(), snapshot_bases.end());
+
+        auto linear_base = GetLinearBaseDeviceString(child_target);
+        if (!linear_base.empty()) {
+            ret.insert(linear_base);
+        }
+    }
+    return ret;
+}
+
+using PropertyList = std::set<std::string>;
+void InsertProperty(const char* key, const char* /*name*/, void* cookie) {
+    reinterpret_cast<PropertyList*>(cookie)->insert(key);
+}
+
+// Attempt to delete all devices that is based on dev_name, including itself.
+void CheckDeleteDeviceMapperTree(const std::string& dev_name, bool known_allow_delete = false,
+                                 uint64_t depth = 100) {
+    CHECK(depth > 0) << "Reaching max depth when deleting " << dev_name
+                     << ". There may be devices referencing itself. Check `dmctl list devices -v`.";
+
+    auto& dm = DeviceMapper::Instance();
+    auto table = GetTableInfoIfExists(dev_name);
+    if (table.empty()) {
+        PCHECK(dm.DeleteDeviceIfExists(dev_name)) << dev_name;
+        return;
+    }
+
+    if (!known_allow_delete) {
+        for (const auto& target : table) {
+            auto base_device_string = GetLinearBaseDeviceString(target);
+            if (base_device_string.empty()) continue;
+            if (ShouldDeleteLoopDevice(
+                        StringPrintf("/sys/dev/block/%s", base_device_string.data()))) {
+                known_allow_delete = true;
+                break;
+            }
+        }
+    }
+    if (!known_allow_delete) {
+        return;
+    }
+
+    std::string dev_string;
+    PCHECK(dm.GetDeviceString(dev_name, &dev_string));
+
+    std::vector<DeviceMapper::DmBlockDevice> devices;
+    PCHECK(dm.GetAvailableDevices(&devices));
+    for (const auto& child_dev : devices) {
+        auto child_bases = GetAllBaseDeviceStrings(child_dev.name());
+        if (child_bases.find(dev_string) != child_bases.end()) {
+            CheckDeleteDeviceMapperTree(child_dev.name(), true /* known_allow_delete */, depth - 1);
+        }
+    }
+
+    PCHECK(dm.DeleteDeviceIfExists(dev_name)) << dev_name;
+}
+
+// Attempt to clean up residues from previous runs.
+void CheckCleanupDeviceMapperDevices() {
+    auto& dm = DeviceMapper::Instance();
+    std::vector<DeviceMapper::DmBlockDevice> devices;
+    PCHECK(dm.GetAvailableDevices(&devices));
+
+    for (const auto& dev : devices) {
+        CheckDeleteDeviceMapperTree(dev.name());
+    }
+}
+
+void CheckUmount(const std::string& path) {
+    PCHECK(TEMP_FAILURE_RETRY(umount(path.data()) == 0) || errno == ENOENT || errno == EINVAL)
+            << path;
+}
+
+void CheckDetachLoopDevices(const std::set<std::string>& exclude_names = {}) {
+    // ~SnapshotFuzzEnv automatically does the following.
+    std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(BLOCK_SYSFS), closedir);
+    PCHECK(dir != nullptr) << BLOCK_SYSFS;
+    LoopControl loop_control;
+    dirent* dp;
+    while ((dp = readdir(dir.get())) != nullptr) {
+        if (exclude_names.find(dp->d_name) != exclude_names.end()) {
+            continue;
+        }
+        if (!ShouldDeleteLoopDevice(StringPrintf("%s/%s", BLOCK_SYSFS, dp->d_name).data())) {
+            continue;
+        }
+        PCHECK(loop_control.Detach(StringPrintf("/dev/block/%s", dp->d_name).data()));
+    }
+}
+
+void CheckUmountAll() {
+    CheckUmount(std::string(MNT_DIR) + "/snapshot_fuzz_data");
+    CheckUmount(std::string(MNT_DIR) + "/" + FAKE_ROOT_NAME);
+}
+
+class AutoDeleteDir : public AutoDevice {
+  public:
+    static std::unique_ptr<AutoDeleteDir> New(const std::string& path) {
+        if (!Mkdir(path)) {
+            return std::unique_ptr<AutoDeleteDir>(new AutoDeleteDir(""));
+        }
+        return std::unique_ptr<AutoDeleteDir>(new AutoDeleteDir(path));
+    }
+    ~AutoDeleteDir() {
+        if (!HasDevice()) return;
+        PCHECK(rmdir(name_.c_str()) == 0 || errno == ENOENT) << name_;
+    }
+
+  private:
+    AutoDeleteDir(const std::string& path) : AutoDevice(path) {}
+};
+
+class AutoUnmount : public AutoDevice {
+  public:
+    ~AutoUnmount() {
+        if (!HasDevice()) return;
+        CheckUmount(name_);
+    }
+    AutoUnmount(const std::string& path) : AutoDevice(path) {}
+};
+
+class AutoUnmountTmpfs : public AutoUnmount {
+  public:
+    static std::unique_ptr<AutoUnmount> New(const std::string& path, uint64_t size) {
+        if (mount("tmpfs", path.c_str(), "tmpfs", 0,
+                  (void*)StringPrintf("size=%" PRIu64, size).data()) == -1) {
+            PLOG(ERROR) << "Cannot mount " << path;
+            return std::unique_ptr<AutoUnmount>(new AutoUnmount(""));
+        }
+        return std::unique_ptr<AutoUnmount>(new AutoUnmount(path));
+    }
+  private:
+    using AutoUnmount::AutoUnmount;
+};
+
+// A directory on tmpfs. Upon destruct, it is unmounted and deleted.
+class AutoMemBasedDir : public AutoDevice {
+  public:
+    static std::unique_ptr<AutoMemBasedDir> New(const std::string& name, uint64_t size) {
+        auto ret = std::unique_ptr<AutoMemBasedDir>(new AutoMemBasedDir(name));
+        ret->auto_delete_mount_dir_ = AutoDeleteDir::New(ret->mount_path());
+        if (!ret->auto_delete_mount_dir_->HasDevice()) {
+            return std::unique_ptr<AutoMemBasedDir>(new AutoMemBasedDir(""));
+        }
+        ret->auto_umount_mount_point_ = AutoUnmountTmpfs::New(ret->mount_path(), size);
+        if (!ret->auto_umount_mount_point_->HasDevice()) {
+            return std::unique_ptr<AutoMemBasedDir>(new AutoMemBasedDir(""));
+        }
+        // tmp_path() and persist_path does not need to be deleted upon destruction, hence it is
+        // not wrapped with AutoDeleteDir.
+        if (!Mkdir(ret->tmp_path())) {
+            return std::unique_ptr<AutoMemBasedDir>(new AutoMemBasedDir(""));
+        }
+        if (!Mkdir(ret->persist_path())) {
+            return std::unique_ptr<AutoMemBasedDir>(new AutoMemBasedDir(""));
+        }
+        return ret;
+    }
+    // Return the temporary scratch directory.
+    std::string tmp_path() const {
+        CHECK(HasDevice());
+        return mount_path() + "/tmp";
+    }
+    // Return the temporary scratch directory.
+    std::string persist_path() const {
+        CHECK(HasDevice());
+        return mount_path() + "/persist";
+    }
+    // Delete all contents in tmp_path() and start over. tmp_path() itself is re-created.
+    void CheckSoftReset() {
+        PCHECK(RmdirRecursive(tmp_path()));
+        PCHECK(Mkdir(tmp_path()));
+    }
+
+  private:
+    AutoMemBasedDir(const std::string& name) : AutoDevice(name) {}
+    std::string mount_path() const {
+        CHECK(HasDevice());
+        return MNT_DIR + "/"s + name_;
+    }
+    std::unique_ptr<AutoDeleteDir> auto_delete_mount_dir_;
+    std::unique_ptr<AutoUnmount> auto_umount_mount_point_;
+};
+
+SnapshotFuzzEnv::SnapshotFuzzEnv() {
+    CheckCleanupDeviceMapperDevices();
+    CheckDetachLoopDevices();
+    CheckUmountAll();
+
+    fake_root_ = AutoMemBasedDir::New(FAKE_ROOT_NAME, FAKE_ROOT_SIZE);
+    CHECK(fake_root_ != nullptr);
+    CHECK(fake_root_->HasDevice());
+    loop_control_ = std::make_unique<LoopControl>();
+
+    fake_data_mount_point_ = MNT_DIR + "/snapshot_fuzz_data"s;
+    auto_delete_data_mount_point_ = AutoDeleteDir::New(fake_data_mount_point_);
+    CHECK(auto_delete_data_mount_point_ != nullptr);
+    CHECK(auto_delete_data_mount_point_->HasDevice());
+
+    const auto& fake_persist_path = fake_root_->persist_path();
+    mapped_super_ = CheckMapImage(fake_persist_path + "/super.img", SUPER_IMAGE_SIZE,
+                                  loop_control_.get(), &fake_super_);
+    mapped_data_ = CheckMapImage(fake_persist_path + "/data.img", DATA_IMAGE_SIZE,
+                                 loop_control_.get(), &fake_data_block_device_);
+    mounted_data_ = CheckMountFormatData(fake_data_block_device_, fake_data_mount_point_);
+}
+
+SnapshotFuzzEnv::~SnapshotFuzzEnv() {
+    CheckCleanupDeviceMapperDevices();
+    mounted_data_ = nullptr;
+    auto_delete_data_mount_point_ = nullptr;
+    mapped_data_ = nullptr;
+    mapped_super_ = nullptr;
+    CheckDetachLoopDevices();
+    loop_control_ = nullptr;
+    fake_root_ = nullptr;
+    CheckUmountAll();
+}
+
+void CheckZeroFill(const std::string& file, size_t size) {
+    std::string zeros(size, '\0');
+    PCHECK(WriteStringToFile(zeros, file)) << "Cannot write zeros to " << file;
+}
+
+void SnapshotFuzzEnv::CheckSoftReset() {
+    fake_root_->CheckSoftReset();
+    CheckZeroFill(super(), SUPER_IMAGE_SIZE);
+    CheckCleanupDeviceMapperDevices();
+    CheckDetachLoopDevices({Basename(fake_super_), Basename(fake_data_block_device_)});
+}
+
+std::unique_ptr<IImageManager> SnapshotFuzzEnv::CheckCreateFakeImageManager(
+        const std::string& metadata_dir, const std::string& data_dir) {
+    PCHECK(Mkdir(metadata_dir));
+    PCHECK(Mkdir(data_dir));
+    return SnapshotFuzzImageManager::Open(metadata_dir, data_dir);
+}
+
+// Helper to create a loop device for a file.
+static void CheckCreateLoopDevice(LoopControl* control, const std::string& file,
+                                  const std::chrono::milliseconds& timeout_ms, std::string* path) {
+    static constexpr int kOpenFlags = O_RDWR | O_NOFOLLOW | O_CLOEXEC;
+    android::base::unique_fd file_fd(open(file.c_str(), kOpenFlags));
+    PCHECK(file_fd >= 0) << "Could not open file: " << file;
+    CHECK(control->Attach(file_fd, timeout_ms, path))
+            << "Could not create loop device for: " << file;
+}
+
+class AutoDetachLoopDevice : public AutoDevice {
+  public:
+    AutoDetachLoopDevice(LoopControl* control, const std::string& device)
+        : AutoDevice(device), control_(control) {}
+    ~AutoDetachLoopDevice() { PCHECK(control_->Detach(name_)) << name_; }
+
+  private:
+    LoopControl* control_;
+};
+
+std::unique_ptr<AutoDevice> SnapshotFuzzEnv::CheckMapImage(const std::string& img_path,
+                                                           uint64_t size, LoopControl* control,
+                                                           std::string* mapped_path) {
+    CheckZeroFill(img_path, size);
+    CheckCreateLoopDevice(control, img_path, 1s, mapped_path);
+
+    return std::make_unique<AutoDetachLoopDevice>(control, *mapped_path);
+}
+
+SnapshotTestModule SnapshotFuzzEnv::CheckCreateSnapshotManager(const SnapshotFuzzData& data) {
+    SnapshotTestModule ret;
+    auto partition_opener = std::make_unique<TestPartitionOpener>(super());
+    ret.opener = partition_opener.get();
+    CheckWriteSuperMetadata(data, *partition_opener);
+    auto metadata_dir = fake_root_->tmp_path() + "/snapshot_metadata";
+    PCHECK(Mkdir(metadata_dir));
+    if (data.has_metadata_snapshots_dir()) {
+        PCHECK(Mkdir(metadata_dir + "/snapshots"));
+    }
+
+    ret.device_info = new SnapshotFuzzDeviceInfo(data.device_info_data(),
+                                                 std::move(partition_opener), metadata_dir);
+    auto snapshot = SnapshotManager::New(ret.device_info /* takes ownership */);
+    snapshot->images_ =
+            CheckCreateFakeImageManager(fake_root_->tmp_path() + "/images_manager_metadata",
+                                        fake_data_mount_point_ + "/image_manager_data");
+    snapshot->has_local_image_manager_ = data.manager_data().is_local_image_manager();
+    ret.snapshot = std::move(snapshot);
+
+    return ret;
+}
+
+const std::string& SnapshotFuzzEnv::super() const {
+    return fake_super_;
+}
+
+void SnapshotFuzzEnv::CheckWriteSuperMetadata(const SnapshotFuzzData& data,
+                                              const IPartitionOpener& opener) {
+    if (!data.is_super_metadata_valid()) {
+        // Leave it zero.
+        return;
+    }
+
+    BlockDeviceInfo super_device("super", SUPER_IMAGE_SIZE, 0, 0, 4096);
+    std::vector<BlockDeviceInfo> devices = {super_device};
+    auto builder = MetadataBuilder::New(devices, "super", 65536, 2);
+    CHECK(builder != nullptr);
+
+    // Attempt to create a super partition metadata using proto. All errors are ignored.
+    for (const auto& group_proto : data.super_data().dynamic_partition_metadata().groups()) {
+        (void)builder->AddGroup(group_proto.name(), group_proto.size());
+        for (const auto& partition_name : group_proto.partition_names()) {
+            (void)builder->AddPartition(partition_name, group_proto.name(),
+                                        LP_PARTITION_ATTR_READONLY);
+        }
+    }
+
+    for (const auto& partition_proto : data.super_data().partitions()) {
+        auto p = builder->FindPartition(partition_proto.partition_name());
+        if (p == nullptr) continue;
+        (void)builder->ResizePartition(p, partition_proto.new_partition_info().size());
+    }
+
+    auto metadata = builder->Export();
+    // metadata may be nullptr if it is not valid (e.g. partition name too long).
+    // In this case, just use empty super partition data.
+    if (metadata == nullptr) {
+        builder = MetadataBuilder::New(devices, "super", 65536, 2);
+        CHECK(builder != nullptr);
+        metadata = builder->Export();
+        CHECK(metadata != nullptr);
+    }
+    CHECK(FlashPartitionTable(opener, super(), *metadata.get()));
+}
+
+std::unique_ptr<AutoDevice> SnapshotFuzzEnv::CheckMountFormatData(const std::string& blk_device,
+                                                                  const std::string& mount_point) {
+    FstabEntry entry{
+            .blk_device = blk_device,
+            .length = static_cast<off64_t>(DATA_IMAGE_SIZE),
+            .fs_type = "ext4",
+            .mount_point = mount_point,
+    };
+    CHECK(0 == fs_mgr_do_format(entry, false /* crypt_footer */));
+    CHECK(0 == fs_mgr_do_mount_one(entry));
+    return std::make_unique<AutoUnmount>(mount_point);
+}
+
+SnapshotFuzzImageManager::~SnapshotFuzzImageManager() {
+    // Remove relevant gsid.mapped_images.* props.
+    for (const auto& name : mapped_) {
+        CHECK(UnmapImageIfExists(name)) << "Cannot unmap " << name;
+    }
+}
+
+bool SnapshotFuzzImageManager::MapImageDevice(const std::string& name,
+                                              const std::chrono::milliseconds& timeout_ms,
+                                              std::string* path) {
+    if (impl_->MapImageDevice(name, timeout_ms, path)) {
+        mapped_.insert(name);
+        return true;
+    }
+    return false;
+}
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/snapshot_fuzz_utils.h b/fs_mgr/libsnapshot/snapshot_fuzz_utils.h
new file mode 100644
index 0000000..5319e69
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_fuzz_utils.h
@@ -0,0 +1,203 @@
+// Copyright (C) 2020 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.
+
+#include <memory>
+#include <set>
+#include <string>
+
+#include <android-base/file.h>
+#include <android-base/stringprintf.h>
+#include <android/snapshot/snapshot_fuzz.pb.h>
+#include <libdm/loop_control.h>
+#include <libfiemap/image_manager.h>
+#include <liblp/liblp.h>
+#include <libsnapshot/auto_device.h>
+#include <libsnapshot/test_helpers.h>
+
+// libsnapshot-specific code for fuzzing. Defines fake classes that are depended
+// by SnapshotManager.
+
+#include "android/snapshot/snapshot_fuzz.pb.h"
+
+namespace android::snapshot {
+
+class AutoMemBasedDir;
+class SnapshotFuzzDeviceInfo;
+
+class NoOpAutoDevice : public AutoDevice {
+  public:
+    NoOpAutoDevice(bool mounted) : AutoDevice(mounted ? "no_op" : "") {}
+};
+
+struct SnapshotTestModule {
+    std::unique_ptr<ISnapshotManager> snapshot;
+    SnapshotFuzzDeviceInfo* device_info = nullptr;
+    TestPartitionOpener* opener = nullptr;
+};
+
+// Prepare test environment. This has a heavy overhead and should be done once.
+class SnapshotFuzzEnv {
+  public:
+    // Check if test should run at all.
+    static bool ShouldSkipTest();
+
+    // Initialize the environment.
+    SnapshotFuzzEnv();
+    ~SnapshotFuzzEnv();
+
+    // Soft reset part of the environment before running the next test.
+    // Abort if fails.
+    void CheckSoftReset();
+
+    // Create a snapshot manager for this test run.
+    // Client is responsible for maintaining the lifetime of |data| over the life time of
+    // ISnapshotManager.
+    SnapshotTestModule CheckCreateSnapshotManager(const SnapshotFuzzData& data);
+
+    // Return path to super partition.
+    const std::string& super() const;
+
+  private:
+    std::unique_ptr<AutoMemBasedDir> fake_root_;
+    std::unique_ptr<android::dm::LoopControl> loop_control_;
+    std::string fake_data_mount_point_;
+    std::unique_ptr<AutoDevice> auto_delete_data_mount_point_;
+    std::unique_ptr<AutoDevice> mapped_super_;
+    std::string fake_super_;
+    std::unique_ptr<AutoDevice> mapped_data_;
+    std::string fake_data_block_device_;
+    std::unique_ptr<AutoDevice> mounted_data_;
+
+    static std::unique_ptr<android::fiemap::IImageManager> CheckCreateFakeImageManager(
+            const std::string& metadata_dir, const std::string& data_dir);
+    static std::unique_ptr<AutoDevice> CheckMapImage(const std::string& fake_persist_path,
+                                                     uint64_t size,
+                                                     android::dm::LoopControl* control,
+                                                     std::string* mapped_path);
+    static std::unique_ptr<AutoDevice> CheckMountFormatData(const std::string& blk_device,
+                                                            const std::string& mount_point);
+
+    void CheckWriteSuperMetadata(const SnapshotFuzzData& proto,
+                                 const android::fs_mgr::IPartitionOpener& opener);
+};
+
+class SnapshotFuzzDeviceInfo : public ISnapshotManager::IDeviceInfo {
+  public:
+    // Client is responsible for maintaining the lifetime of |data|.
+    SnapshotFuzzDeviceInfo(const FuzzDeviceInfoData& data,
+                           std::unique_ptr<TestPartitionOpener>&& partition_opener,
+                           const std::string& metadata_dir)
+        : data_(&data),
+          partition_opener_(std::move(partition_opener)),
+          metadata_dir_(metadata_dir) {}
+
+    // Following APIs are mocked.
+    std::string GetGsidDir() const override { return "fuzz_ota"; }
+    std::string GetMetadataDir() const override { return metadata_dir_; }
+    std::string GetSuperDevice(uint32_t) const override {
+        // TestPartitionOpener can recognize this.
+        return "super";
+    }
+    const android::fs_mgr::IPartitionOpener& GetPartitionOpener() const override {
+        return *partition_opener_;
+    }
+
+    // Following APIs are fuzzed.
+    std::string GetSlotSuffix() const override { return CurrentSlotIsA() ? "_a" : "_b"; }
+    std::string GetOtherSlotSuffix() const override { return CurrentSlotIsA() ? "_b" : "_a"; }
+    bool IsOverlayfsSetup() const override { return data_->is_overlayfs_setup(); }
+    bool SetBootControlMergeStatus(android::hardware::boot::V1_1::MergeStatus) override {
+        return data_->allow_set_boot_control_merge_status();
+    }
+    bool SetSlotAsUnbootable(unsigned int) override {
+        return data_->allow_set_slot_as_unbootable();
+    }
+    bool IsRecovery() const override { return data_->is_recovery(); }
+
+    void SwitchSlot() { switched_slot_ = !switched_slot_; }
+
+  private:
+    const FuzzDeviceInfoData* data_;
+    std::unique_ptr<TestPartitionOpener> partition_opener_;
+    std::string metadata_dir_;
+    bool switched_slot_ = false;
+
+    bool CurrentSlotIsA() const { return data_->slot_suffix_is_a() != switched_slot_; }
+};
+
+// A spy class on ImageManager implementation. Upon destruction, unmaps all images
+// map through this object.
+class SnapshotFuzzImageManager : public android::fiemap::IImageManager {
+  public:
+    static std::unique_ptr<SnapshotFuzzImageManager> Open(const std::string& metadata_dir,
+                                                          const std::string& data_dir) {
+        auto impl = android::fiemap::ImageManager::Open(metadata_dir, data_dir);
+        if (impl == nullptr) return nullptr;
+        return std::unique_ptr<SnapshotFuzzImageManager>(
+                new SnapshotFuzzImageManager(std::move(impl)));
+    }
+
+    ~SnapshotFuzzImageManager();
+
+    // Spied APIs.
+    bool MapImageDevice(const std::string& name, const std::chrono::milliseconds& timeout_ms,
+                        std::string* path) override;
+
+    // Other functions call through.
+    android::fiemap::FiemapStatus CreateBackingImage(
+            const std::string& name, uint64_t size, int flags,
+            std::function<bool(uint64_t, uint64_t)>&& on_progress) override {
+        return impl_->CreateBackingImage(name, size, flags, std::move(on_progress));
+    }
+    bool DeleteBackingImage(const std::string& name) override {
+        return impl_->DeleteBackingImage(name);
+    }
+    bool UnmapImageDevice(const std::string& name) override {
+        return impl_->UnmapImageDevice(name);
+    }
+    bool BackingImageExists(const std::string& name) override {
+        return impl_->BackingImageExists(name);
+    }
+    bool IsImageMapped(const std::string& name) override { return impl_->IsImageMapped(name); }
+    bool MapImageWithDeviceMapper(const IPartitionOpener& opener, const std::string& name,
+                                  std::string* dev) override {
+        return impl_->MapImageWithDeviceMapper(opener, name, dev);
+    }
+    bool GetMappedImageDevice(const std::string& name, std::string* device) override {
+        return impl_->GetMappedImageDevice(name, device);
+    }
+    bool MapAllImages(const std::function<bool(std::set<std::string>)>& init) override {
+        return impl_->MapAllImages(init);
+    }
+    bool DisableImage(const std::string& name) override { return impl_->DisableImage(name); }
+    bool RemoveDisabledImages() override { return impl_->RemoveDisabledImages(); }
+    std::vector<std::string> GetAllBackingImages() override { return impl_->GetAllBackingImages(); }
+    android::fiemap::FiemapStatus ZeroFillNewImage(const std::string& name,
+                                                   uint64_t bytes) override {
+        return impl_->ZeroFillNewImage(name, bytes);
+    }
+    bool RemoveAllImages() override { return impl_->RemoveAllImages(); }
+    bool UnmapImageIfExists(const std::string& name) override {
+        return impl_->UnmapImageIfExists(name);
+    }
+
+  private:
+    std::unique_ptr<android::fiemap::IImageManager> impl_;
+    std::set<std::string> mapped_;
+
+    SnapshotFuzzImageManager(std::unique_ptr<android::fiemap::IImageManager>&& impl)
+        : impl_(std::move(impl)) {}
+};
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp b/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp
index 60bf796..17a0c96 100644
--- a/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp
+++ b/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp
@@ -39,6 +39,8 @@
 SnapshotMetadataUpdater::SnapshotMetadataUpdater(MetadataBuilder* builder, uint32_t target_slot,
                                                  const DeltaArchiveManifest& manifest)
     : builder_(builder), target_suffix_(SlotSuffixForSlotNumber(target_slot)) {
+    partial_update_ = manifest.partial_update();
+
     if (!manifest.has_dynamic_partition_metadata()) {
         return;
     }
@@ -62,6 +64,7 @@
                                                std::string(it->second) + target_suffix_, &p});
         }
     }
+
 }
 
 bool SnapshotMetadataUpdater::ShrinkPartitions() const {
@@ -82,6 +85,18 @@
 }
 
 bool SnapshotMetadataUpdater::DeletePartitions() const {
+    // For partial update, not all dynamic partitions are included in the payload.
+    // TODO(xunchang) delete the untouched partitions whose group is in the payload.
+    // e.g. Delete vendor in the following scenario
+    // On device:
+    //   Group A: system, vendor
+    // In payload:
+    //   Group A: system
+    if (partial_update_) {
+        LOG(INFO) << "Skip deleting partitions for partial update";
+        return true;
+    }
+
     std::vector<std::string> partitions_to_delete;
     // Don't delete partitions in groups where the group name doesn't have target_suffix,
     // e.g. default.
@@ -139,6 +154,11 @@
 }
 
 bool SnapshotMetadataUpdater::DeleteGroups() const {
+    if (partial_update_) {
+        LOG(INFO) << "Skip deleting groups for partial update";
+        return true;
+    }
+
     std::vector<std::string> existing_groups = builder_->ListGroups();
     for (const auto& existing_group_name : existing_groups) {
         // Don't delete groups without target suffix, e.g. default.
@@ -154,9 +174,9 @@
         if (iter != groups_.end()) {
             continue;
         }
-        // Update package metadata doesn't have this group. Before deleting it, sanity check that it
-        // doesn't have any partitions left. Update metadata shouldn't assign any partitions to this
-        // group, so all partitions that originally belong to this group should be moved by
+        // Update package metadata doesn't have this group. Before deleting it, check that it
+        // doesn't have any partitions left. Update metadata shouldn't assign any partitions to
+        // this group, so all partitions that originally belong to this group should be moved by
         // MovePartitionsToDefault at this point.
         auto existing_partitions_in_group = builder_->ListPartitionsInGroup(existing_group_name);
         if (!existing_partitions_in_group.empty()) {
diff --git a/fs_mgr/libsnapshot/snapshot_metadata_updater.h b/fs_mgr/libsnapshot/snapshot_metadata_updater.h
index 83c9460..5b1cbf9 100644
--- a/fs_mgr/libsnapshot/snapshot_metadata_updater.h
+++ b/fs_mgr/libsnapshot/snapshot_metadata_updater.h
@@ -79,6 +79,7 @@
     const std::string target_suffix_;
     std::vector<Group> groups_;
     std::vector<Partition> partitions_;
+    bool partial_update_{false};
 };
 
 }  // namespace snapshot
diff --git a/fs_mgr/libsnapshot/snapshot_reader.cpp b/fs_mgr/libsnapshot/snapshot_reader.cpp
new file mode 100644
index 0000000..5ee8e25
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_reader.cpp
@@ -0,0 +1,332 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include "snapshot_reader.h"
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <ext4_utils/ext4_utils.h>
+
+namespace android {
+namespace snapshot {
+
+using android::base::borrowed_fd;
+
+// Not supported.
+bool ReadOnlyFileDescriptor::Open(const char*, int, mode_t) {
+    errno = EINVAL;
+    return false;
+}
+
+bool ReadOnlyFileDescriptor::Open(const char*, int) {
+    errno = EINVAL;
+    return false;
+}
+
+ssize_t ReadOnlyFileDescriptor::Write(const void*, size_t) {
+    errno = EINVAL;
+    return false;
+}
+
+bool ReadOnlyFileDescriptor::BlkIoctl(int, uint64_t, uint64_t, int*) {
+    errno = EINVAL;
+    return false;
+}
+
+ReadFdFileDescriptor::ReadFdFileDescriptor(android::base::unique_fd&& fd) : fd_(std::move(fd)) {}
+
+ssize_t ReadFdFileDescriptor::Read(void* buf, size_t count) {
+    return read(fd_.get(), buf, count);
+}
+
+off64_t ReadFdFileDescriptor::Seek(off64_t offset, int whence) {
+    return lseek(fd_.get(), offset, whence);
+}
+
+uint64_t ReadFdFileDescriptor::BlockDevSize() {
+    return get_block_device_size(fd_.get());
+}
+
+bool ReadFdFileDescriptor::Close() {
+    fd_ = {};
+    return true;
+}
+
+bool ReadFdFileDescriptor::IsSettingErrno() {
+    return true;
+}
+
+bool ReadFdFileDescriptor::IsOpen() {
+    return fd_ >= 0;
+}
+
+bool ReadFdFileDescriptor::Flush() {
+    return true;
+}
+
+bool CompressedSnapshotReader::SetCow(std::unique_ptr<CowReader>&& cow) {
+    cow_ = std::move(cow);
+
+    CowHeader header;
+    if (!cow_->GetHeader(&header)) {
+        return false;
+    }
+    block_size_ = header.block_size;
+
+    // Populate the operation map.
+    op_iter_ = cow_->GetOpIter();
+    while (!op_iter_->Done()) {
+        const CowOperation* op = &op_iter_->Get();
+        if (IsMetadataOp(*op)) {
+            op_iter_->Next();
+            continue;
+        }
+        if (op->new_block >= ops_.size()) {
+            ops_.resize(op->new_block + 1, nullptr);
+        }
+        ops_[op->new_block] = op;
+        op_iter_->Next();
+    }
+
+    return true;
+}
+
+void CompressedSnapshotReader::SetSourceDevice(const std::string& source_device) {
+    source_device_ = {source_device};
+}
+
+void CompressedSnapshotReader::SetBlockDeviceSize(uint64_t block_device_size) {
+    block_device_size_ = block_device_size;
+}
+
+borrowed_fd CompressedSnapshotReader::GetSourceFd() {
+    if (source_fd_ < 0) {
+        if (!source_device_) {
+            LOG(ERROR) << "CompressedSnapshotReader needs source device, but none was set";
+            errno = EINVAL;
+            return {-1};
+        }
+        source_fd_.reset(open(source_device_->c_str(), O_RDONLY | O_CLOEXEC));
+        if (source_fd_ < 0) {
+            PLOG(ERROR) << "open " << *source_device_;
+            return {-1};
+        }
+    }
+    return source_fd_;
+}
+
+class MemoryByteSink : public IByteSink {
+  public:
+    MemoryByteSink(void* buf, size_t count) {
+        buf_ = reinterpret_cast<uint8_t*>(buf);
+        pos_ = buf_;
+        end_ = buf_ + count;
+    }
+
+    void* GetBuffer(size_t requested, size_t* actual) override {
+        *actual = std::min(remaining(), requested);
+        if (!*actual) {
+            return nullptr;
+        }
+
+        uint8_t* start = pos_;
+        pos_ += *actual;
+        return start;
+    }
+
+    bool ReturnData(void*, size_t) override { return true; }
+
+    uint8_t* buf() const { return buf_; }
+    uint8_t* pos() const { return pos_; }
+    size_t remaining() const { return end_ - pos_; }
+
+  private:
+    uint8_t* buf_;
+    uint8_t* pos_;
+    uint8_t* end_;
+};
+
+ssize_t CompressedSnapshotReader::Read(void* buf, size_t count) {
+    // Find the start and end chunks, inclusive.
+    uint64_t start_chunk = offset_ / block_size_;
+    uint64_t end_chunk = (offset_ + count - 1) / block_size_;
+
+    // Chop off the first N bytes if the position is not block-aligned.
+    size_t start_offset = offset_ % block_size_;
+
+    MemoryByteSink sink(buf, count);
+
+    size_t initial_bytes = std::min(block_size_ - start_offset, sink.remaining());
+    ssize_t rv = ReadBlock(start_chunk, &sink, start_offset, initial_bytes);
+    if (rv < 0) {
+        return -1;
+    }
+    offset_ += rv;
+
+    for (uint64_t chunk = start_chunk + 1; chunk < end_chunk; chunk++) {
+        ssize_t rv = ReadBlock(chunk, &sink, 0);
+        if (rv < 0) {
+            return -1;
+        }
+        offset_ += rv;
+    }
+
+    if (sink.remaining()) {
+        ssize_t rv = ReadBlock(end_chunk, &sink, 0, {sink.remaining()});
+        if (rv < 0) {
+            return -1;
+        }
+        offset_ += rv;
+    }
+
+    errno = 0;
+
+    DCHECK(sink.pos() - sink.buf() == count);
+    return count;
+}
+
+// Discard the first N bytes of a sink request, or any excess bytes.
+class PartialSink : public MemoryByteSink {
+  public:
+    PartialSink(void* buffer, size_t size, size_t ignore_start)
+        : MemoryByteSink(buffer, size), ignore_start_(ignore_start) {}
+
+    void* GetBuffer(size_t requested, size_t* actual) override {
+        // Throw away the first N bytes if needed.
+        if (ignore_start_) {
+            *actual = std::min({requested, ignore_start_, sizeof(discard_)});
+            ignore_start_ -= *actual;
+            return discard_;
+        }
+        // Throw away any excess bytes if needed.
+        if (remaining() == 0) {
+            *actual = std::min(requested, sizeof(discard_));
+            return discard_;
+        }
+        return MemoryByteSink::GetBuffer(requested, actual);
+    }
+
+  private:
+    size_t ignore_start_;
+    char discard_[4096];
+};
+
+ssize_t CompressedSnapshotReader::ReadBlock(uint64_t chunk, IByteSink* sink, size_t start_offset,
+                                            const std::optional<uint64_t>& max_bytes) {
+    size_t bytes_to_read = block_size_;
+    if (max_bytes) {
+        bytes_to_read = *max_bytes;
+    }
+
+    // The offset is relative to the chunk; we should be reading no more than
+    // one chunk.
+    CHECK(start_offset + bytes_to_read <= block_size_);
+
+    const CowOperation* op = nullptr;
+    if (chunk < ops_.size()) {
+        op = ops_[chunk];
+    }
+
+    size_t actual;
+    void* buffer = sink->GetBuffer(bytes_to_read, &actual);
+    if (!buffer || actual < bytes_to_read) {
+        // This should never happen unless we calculated the read size wrong
+        // somewhere. MemoryByteSink always fulfills the entire requested
+        // region unless there's not enough buffer remaining.
+        LOG(ERROR) << "Asked for buffer of size " << bytes_to_read << ", got " << actual;
+        errno = EINVAL;
+        return -1;
+    }
+
+    if (!op || op->type == kCowCopyOp) {
+        borrowed_fd fd = GetSourceFd();
+        if (fd < 0) {
+            // GetSourceFd sets errno.
+            return -1;
+        }
+
+        if (op) {
+            chunk = op->source;
+        }
+
+        off64_t offset = (chunk * block_size_) + start_offset;
+        if (!android::base::ReadFullyAtOffset(fd, buffer, bytes_to_read, offset)) {
+            PLOG(ERROR) << "read " << *source_device_;
+            // ReadFullyAtOffset sets errno.
+            return -1;
+        }
+    } else if (op->type == kCowZeroOp) {
+        memset(buffer, 0, bytes_to_read);
+    } else if (op->type == kCowReplaceOp) {
+        PartialSink partial_sink(buffer, bytes_to_read, start_offset);
+        if (!cow_->ReadData(*op, &partial_sink)) {
+            LOG(ERROR) << "CompressedSnapshotReader failed to read replace op";
+            errno = EIO;
+            return -1;
+        }
+    } else {
+        LOG(ERROR) << "CompressedSnapshotReader unknown op type: " << uint32_t(op->type);
+        errno = EINVAL;
+        return -1;
+    }
+
+    // MemoryByteSink doesn't do anything in ReturnBuffer, so don't bother calling it.
+    return bytes_to_read;
+}
+
+off64_t CompressedSnapshotReader::Seek(off64_t offset, int whence) {
+    switch (whence) {
+        case SEEK_SET:
+            offset_ = offset;
+            break;
+        case SEEK_END:
+            offset_ = static_cast<off64_t>(block_device_size_) + offset;
+            break;
+        case SEEK_CUR:
+            offset_ += offset;
+            break;
+        default:
+            LOG(ERROR) << "Unrecognized seek whence: " << whence;
+            errno = EINVAL;
+            return -1;
+    }
+    return offset_;
+}
+
+uint64_t CompressedSnapshotReader::BlockDevSize() {
+    return block_device_size_;
+}
+
+bool CompressedSnapshotReader::Close() {
+    cow_ = nullptr;
+    source_fd_ = {};
+    return true;
+}
+
+bool CompressedSnapshotReader::IsSettingErrno() {
+    return true;
+}
+
+bool CompressedSnapshotReader::IsOpen() {
+    return cow_ != nullptr;
+}
+
+bool CompressedSnapshotReader::Flush() {
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapshot_reader.h b/fs_mgr/libsnapshot/snapshot_reader.h
new file mode 100644
index 0000000..a3e7e22
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_reader.h
@@ -0,0 +1,85 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#pragma once
+
+#include <optional>
+#include <vector>
+
+#include <android-base/file.h>
+#include <libsnapshot/cow_reader.h>
+#include <payload_consumer/file_descriptor.h>
+
+namespace android {
+namespace snapshot {
+
+class ReadOnlyFileDescriptor : public chromeos_update_engine::FileDescriptor {
+  public:
+    bool Open(const char* path, int flags, mode_t mode) override;
+    bool Open(const char* path, int flags) override;
+    ssize_t Write(const void* buf, size_t count) override;
+    bool BlkIoctl(int request, uint64_t start, uint64_t length, int* result) override;
+};
+
+class ReadFdFileDescriptor : public ReadOnlyFileDescriptor {
+  public:
+    explicit ReadFdFileDescriptor(android::base::unique_fd&& fd);
+
+    ssize_t Read(void* buf, size_t count) override;
+    off64_t Seek(off64_t offset, int whence) override;
+    uint64_t BlockDevSize() override;
+    bool Close() override;
+    bool IsSettingErrno() override;
+    bool IsOpen() override;
+    bool Flush() override;
+
+  private:
+    android::base::unique_fd fd_;
+};
+
+class CompressedSnapshotReader : public ReadOnlyFileDescriptor {
+  public:
+    bool SetCow(std::unique_ptr<CowReader>&& cow);
+    void SetSourceDevice(const std::string& source_device);
+    void SetBlockDeviceSize(uint64_t block_device_size);
+
+    ssize_t Read(void* buf, size_t count) override;
+    off64_t Seek(off64_t offset, int whence) override;
+    uint64_t BlockDevSize() override;
+    bool Close() override;
+    bool IsSettingErrno() override;
+    bool IsOpen() override;
+    bool Flush() override;
+
+  private:
+    ssize_t ReadBlock(uint64_t chunk, IByteSink* sink, size_t start_offset,
+                      const std::optional<uint64_t>& max_bytes = {});
+    android::base::borrowed_fd GetSourceFd();
+
+    std::unique_ptr<CowReader> cow_;
+    std::unique_ptr<ICowOpIter> op_iter_;
+    uint32_t block_size_ = 0;
+
+    std::optional<std::string> source_device_;
+    android::base::unique_fd source_fd_;
+    uint64_t block_device_size_ = 0;
+    off64_t offset_ = 0;
+
+    std::vector<const CowOperation*> ops_;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapshot_reader_test.cpp b/fs_mgr/libsnapshot/snapshot_reader_test.cpp
new file mode 100644
index 0000000..4202d22
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_reader_test.cpp
@@ -0,0 +1,166 @@
+// Copyright (C) 2018 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.
+
+#include <libsnapshot/snapshot.h>
+
+#include <unordered_set>
+
+#include <android-base/file.h>
+#include <gtest/gtest.h>
+#include <libsnapshot/cow_writer.h>
+#include <payload_consumer/file_descriptor.h>
+
+namespace android {
+namespace snapshot {
+
+using android::base::unique_fd;
+using chromeos_update_engine::FileDescriptor;
+
+static constexpr uint32_t kBlockSize = 4096;
+static constexpr size_t kBlockCount = 10;
+
+class OfflineSnapshotTest : public ::testing::Test {
+  protected:
+    virtual void SetUp() override {
+        base_ = std::make_unique<TemporaryFile>();
+        ASSERT_GE(base_->fd, 0) << strerror(errno);
+
+        cow_ = std::make_unique<TemporaryFile>();
+        ASSERT_GE(cow_->fd, 0) << strerror(errno);
+
+        WriteBaseDevice();
+    }
+
+    virtual void TearDown() override {
+        base_ = nullptr;
+        cow_ = nullptr;
+        base_blocks_ = {};
+    }
+
+    void WriteBaseDevice() {
+        unique_fd random(open("/dev/urandom", O_RDONLY));
+        ASSERT_GE(random, 0);
+
+        for (size_t i = 0; i < kBlockCount; i++) {
+            std::string block(kBlockSize, 0);
+            ASSERT_TRUE(android::base::ReadFully(random, block.data(), block.size()));
+            ASSERT_TRUE(android::base::WriteFully(base_->fd, block.data(), block.size()));
+            base_blocks_.emplace_back(std::move(block));
+        }
+        ASSERT_EQ(fsync(base_->fd), 0);
+    }
+
+    void WriteCow(ISnapshotWriter* writer) {
+        std::string new_block = MakeNewBlockString();
+
+        ASSERT_TRUE(writer->AddCopy(3, 0));
+        ASSERT_TRUE(writer->AddRawBlocks(5, new_block.data(), new_block.size()));
+        ASSERT_TRUE(writer->AddZeroBlocks(7, 2));
+        ASSERT_TRUE(writer->Finalize());
+    }
+
+    void TestBlockReads(ISnapshotWriter* writer) {
+        auto reader = writer->OpenReader();
+        ASSERT_NE(reader, nullptr);
+
+        // Test that unchanged blocks are not modified.
+        std::unordered_set<size_t> changed_blocks = {3, 5, 7, 8};
+        for (size_t i = 0; i < kBlockCount; i++) {
+            if (changed_blocks.count(i)) {
+                continue;
+            }
+
+            std::string block(kBlockSize, 0);
+            ASSERT_EQ(reader->Seek(i * kBlockSize, SEEK_SET), i * kBlockSize);
+            ASSERT_EQ(reader->Read(block.data(), block.size()), kBlockSize);
+            ASSERT_EQ(block, base_blocks_[i]);
+        }
+
+        // Test that we can read back our modified blocks.
+        std::string block(kBlockSize, 0);
+        ASSERT_EQ(reader->Seek(3 * kBlockSize, SEEK_SET), 3 * kBlockSize);
+        ASSERT_EQ(reader->Read(block.data(), block.size()), kBlockSize);
+        ASSERT_EQ(block, base_blocks_[0]);
+
+        ASSERT_EQ(reader->Seek(5 * kBlockSize, SEEK_SET), 5 * kBlockSize);
+        ASSERT_EQ(reader->Read(block.data(), block.size()), kBlockSize);
+        ASSERT_EQ(block, MakeNewBlockString());
+
+        std::string two_blocks(kBlockSize * 2, 0x7f);
+        std::string zeroes(kBlockSize * 2, 0);
+        ASSERT_EQ(reader->Seek(7 * kBlockSize, SEEK_SET), 7 * kBlockSize);
+        ASSERT_EQ(reader->Read(two_blocks.data(), two_blocks.size()), two_blocks.size());
+        ASSERT_EQ(two_blocks, zeroes);
+    }
+
+    void TestByteReads(ISnapshotWriter* writer) {
+        auto reader = writer->OpenReader();
+        ASSERT_NE(reader, nullptr);
+
+        std::string blob(kBlockSize * 3, 'x');
+
+        // Test that we can read in the middle of a block.
+        static constexpr size_t kOffset = 970;
+        off64_t offset = 3 * kBlockSize + kOffset;
+        ASSERT_EQ(reader->Seek(0, SEEK_SET), 0);
+        ASSERT_EQ(reader->Seek(offset, SEEK_CUR), offset);
+        ASSERT_EQ(reader->Read(blob.data(), blob.size()), blob.size());
+        ASSERT_EQ(blob.substr(0, 100), base_blocks_[0].substr(kOffset, 100));
+        ASSERT_EQ(blob.substr(kBlockSize - kOffset, kBlockSize), base_blocks_[4]);
+        ASSERT_EQ(blob.substr(kBlockSize * 2 - kOffset, 100), MakeNewBlockString().substr(0, 100));
+        ASSERT_EQ(blob.substr(blob.size() - kOffset), base_blocks_[6].substr(0, kOffset));
+
+        // Pull a random byte from the compressed block.
+        char value;
+        offset = 5 * kBlockSize + 1000;
+        ASSERT_EQ(reader->Seek(offset, SEEK_SET), offset);
+        ASSERT_EQ(reader->Read(&value, sizeof(value)), sizeof(value));
+        ASSERT_EQ(value, MakeNewBlockString()[1000]);
+    }
+
+    void TestReads(ISnapshotWriter* writer) {
+        ASSERT_NO_FATAL_FAILURE(TestBlockReads(writer));
+        ASSERT_NO_FATAL_FAILURE(TestByteReads(writer));
+    }
+
+    std::string MakeNewBlockString() {
+        std::string new_block = "This is a new block";
+        new_block.resize(kBlockSize / 2, '*');
+        new_block.resize(kBlockSize, '!');
+        return new_block;
+    }
+
+    std::unique_ptr<TemporaryFile> base_;
+    std::unique_ptr<TemporaryFile> cow_;
+    std::vector<std::string> base_blocks_;
+};
+
+TEST_F(OfflineSnapshotTest, CompressedSnapshot) {
+    CowOptions options;
+    options.compression = "gz";
+    options.max_blocks = {kBlockCount};
+
+    unique_fd cow_fd(dup(cow_->fd));
+    ASSERT_GE(cow_fd, 0);
+
+    auto writer = std::make_unique<CompressedSnapshotWriter>(options);
+    writer->SetSourceDevice(base_->path);
+    ASSERT_TRUE(writer->SetCowDevice(std::move(cow_fd)));
+    ASSERT_TRUE(writer->Initialize());
+    ASSERT_NO_FATAL_FAILURE(WriteCow(writer.get()));
+    ASSERT_NO_FATAL_FAILURE(TestReads(writer.get()));
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapshot_stub.cpp b/fs_mgr/libsnapshot/snapshot_stub.cpp
new file mode 100644
index 0000000..26b9129
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_stub.cpp
@@ -0,0 +1,149 @@
+// Copyright (C) 2020 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.
+
+#include <libsnapshot/snapshot_stub.h>
+
+#include <android-base/logging.h>
+
+#include <libsnapshot/snapshot_stats.h>
+
+using android::fs_mgr::CreateLogicalPartitionParams;
+using chromeos_update_engine::DeltaArchiveManifest;
+using chromeos_update_engine::FileDescriptor;
+
+namespace android::snapshot {
+
+std::unique_ptr<ISnapshotManager> SnapshotManagerStub::New() {
+    return std::make_unique<SnapshotManagerStub>();
+}
+
+bool SnapshotManagerStub::BeginUpdate() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::CancelUpdate() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::FinishedSnapshotWrites(bool) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::InitiateMerge(uint64_t*) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+UpdateState SnapshotManagerStub::ProcessUpdateState(const std::function<bool()>&,
+                                                    const std::function<bool()>&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return UpdateState::None;
+}
+
+UpdateState SnapshotManagerStub::GetUpdateState(double*) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return UpdateState::None;
+}
+
+Return SnapshotManagerStub::CreateUpdateSnapshots(const DeltaArchiveManifest&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return Return::Error();
+}
+
+bool SnapshotManagerStub::MapUpdateSnapshot(const CreateLogicalPartitionParams&, std::string*) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::UnmapUpdateSnapshot(const std::string&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::NeedSnapshotsInFirstStageMount() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::CreateLogicalAndSnapshotPartitions(const std::string&,
+                                                             const std::chrono::milliseconds&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::HandleImminentDataWipe(const std::function<void()>&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::FinishMergeInRecovery() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+CreateResult SnapshotManagerStub::RecoveryCreateSnapshotDevices() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return CreateResult::ERROR;
+}
+
+CreateResult SnapshotManagerStub::RecoveryCreateSnapshotDevices(
+        const std::unique_ptr<AutoDevice>&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return CreateResult::ERROR;
+}
+
+bool SnapshotManagerStub::Dump(std::ostream&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+std::unique_ptr<AutoDevice> SnapshotManagerStub::EnsureMetadataMounted() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return nullptr;
+}
+
+class SnapshotMergeStatsStub : public ISnapshotMergeStats {
+    bool Start() override { return false; }
+    void set_state(android::snapshot::UpdateState) override {}
+    void set_cow_file_size(uint64_t) override {}
+    uint64_t cow_file_size() override { return 0; }
+    std::unique_ptr<Result> Finish() override { return nullptr; }
+};
+
+ISnapshotMergeStats* SnapshotManagerStub::GetSnapshotMergeStatsInstance() {
+    static SnapshotMergeStatsStub snapshot_merge_stats;
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return &snapshot_merge_stats;
+}
+
+std::unique_ptr<ISnapshotWriter> SnapshotManagerStub::OpenSnapshotWriter(
+        const CreateLogicalPartitionParams&, const std::optional<std::string>&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return nullptr;
+}
+
+bool SnapshotManagerStub::MapAllSnapshots(const std::chrono::milliseconds&) {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+bool SnapshotManagerStub::UnmapAllSnapshots() {
+    LOG(ERROR) << __FUNCTION__ << " should never be called.";
+    return false;
+}
+
+}  // namespace android::snapshot
diff --git a/fs_mgr/libsnapshot/snapshot_test.cpp b/fs_mgr/libsnapshot/snapshot_test.cpp
index dce2c41..95e7d89 100644
--- a/fs_mgr/libsnapshot/snapshot_test.cpp
+++ b/fs_mgr/libsnapshot/snapshot_test.cpp
@@ -15,6 +15,7 @@
 #include <libsnapshot/snapshot.h>
 
 #include <fcntl.h>
+#include <signal.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -29,6 +30,7 @@
 #include <android-base/properties.h>
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
+#include <fs_mgr/file_wait.h>
 #include <fs_mgr/roots.h>
 #include <fs_mgr_dm_linear.h>
 #include <gtest/gtest.h>
@@ -39,8 +41,14 @@
 
 #include <android/snapshot/snapshot.pb.h>
 #include <libsnapshot/test_helpers.h>
+#include "partition_cow_creator.h"
 #include "utility.h"
 
+// Mock classes are not used. Header included to ensure mocked class definition aligns with the
+// class itself.
+#include <libsnapshot/mock_device_info.h>
+#include <libsnapshot/mock_snapshot.h>
+
 namespace android {
 namespace snapshot {
 
@@ -112,6 +120,8 @@
         image_manager_ = sm->image_manager();
 
         test_device->set_slot_suffix("_a");
+
+        sm->set_use_first_stage_snapuserd(false);
     }
 
     void CleanupTestArtifacts() {
@@ -137,6 +147,7 @@
                 "base-device",
                 "test_partition_b",
                 "test_partition_b-base",
+                "test_partition_b-base",
         };
         for (const auto& partition : partitions) {
             DeleteDevice(partition);
@@ -171,12 +182,22 @@
     }
 
     // If |path| is non-null, the partition will be mapped after creation.
-    bool CreatePartition(const std::string& name, uint64_t size, std::string* path = nullptr) {
+    bool CreatePartition(const std::string& name, uint64_t size, std::string* path = nullptr,
+                         const std::optional<std::string> group = {}) {
         TestPartitionOpener opener(fake_super);
         auto builder = MetadataBuilder::New(opener, "super", 0);
         if (!builder) return false;
 
-        auto partition = builder->AddPartition(name, 0);
+        std::string partition_group = std::string(android::fs_mgr::kDefaultGroup);
+        if (group) {
+            partition_group = *group;
+        }
+        return CreatePartition(builder.get(), name, size, path, partition_group);
+    }
+
+    bool CreatePartition(MetadataBuilder* builder, const std::string& name, uint64_t size,
+                         std::string* path, const std::string& group) {
+        auto partition = builder->AddPartition(name, group, 0);
         if (!partition) return false;
         if (!builder->ResizePartition(partition, size)) {
             return false;
@@ -185,6 +206,8 @@
         // Update the source slot.
         auto metadata = builder->Export();
         if (!metadata) return false;
+
+        TestPartitionOpener opener(fake_super);
         if (!UpdatePartitionTable(opener, "super", *metadata.get(), 0)) {
             return false;
         }
@@ -201,45 +224,62 @@
         return CreateLogicalPartition(params, path);
     }
 
-    bool MapUpdatePartitions() {
+    AssertionResult MapUpdateSnapshot(const std::string& name,
+                                      std::unique_ptr<ISnapshotWriter>* writer) {
         TestPartitionOpener opener(fake_super);
-        auto builder = MetadataBuilder::NewForUpdate(opener, "super", 0, 1);
-        if (!builder) return false;
+        CreateLogicalPartitionParams params{
+                .block_device = fake_super,
+                .metadata_slot = 1,
+                .partition_name = name,
+                .timeout_ms = 10s,
+                .partition_opener = &opener,
+        };
 
-        auto metadata = builder->Export();
-        if (!metadata) return false;
-
-        // Update the destination slot, mark it as updated.
-        if (!UpdatePartitionTable(opener, "super", *metadata.get(), 1)) {
-            return false;
+        auto old_partition = "/dev/block/mapper/" + GetOtherPartitionName(name);
+        auto result = sm->OpenSnapshotWriter(params, {old_partition});
+        if (!result) {
+            return AssertionFailure() << "Cannot open snapshot for writing: " << name;
+        }
+        if (!result->Initialize()) {
+            return AssertionFailure() << "Cannot initialize snapshot for writing: " << name;
         }
 
-        for (const auto& partition : metadata->partitions) {
-            CreateLogicalPartitionParams params = {
-                    .block_device = fake_super,
-                    .metadata = metadata.get(),
-                    .partition = &partition,
-                    .force_writable = true,
-                    .timeout_ms = 10s,
-                    .device_name = GetPartitionName(partition) + "-base",
-            };
-            std::string ignore_path;
-            if (!CreateLogicalPartition(params, &ignore_path)) {
-                return false;
-            }
+        if (writer) {
+            *writer = std::move(result);
         }
-        return true;
+        return AssertionSuccess();
+    }
+
+    AssertionResult MapUpdateSnapshot(const std::string& name, std::string* path) {
+        TestPartitionOpener opener(fake_super);
+        CreateLogicalPartitionParams params{
+                .block_device = fake_super,
+                .metadata_slot = 1,
+                .partition_name = name,
+                .timeout_ms = 10s,
+                .partition_opener = &opener,
+        };
+
+        auto result = sm->MapUpdateSnapshot(params, path);
+        if (!result) {
+            return AssertionFailure() << "Cannot open snapshot for writing: " << name;
+        }
+        return AssertionSuccess();
     }
 
     AssertionResult DeleteSnapshotDevice(const std::string& snapshot) {
         AssertionResult res = AssertionSuccess();
         if (!(res = DeleteDevice(snapshot))) return res;
+        if (!sm->UnmapDmUserDevice(snapshot)) {
+            return AssertionFailure() << "Cannot delete dm-user device for " << snapshot;
+        }
         if (!(res = DeleteDevice(snapshot + "-inner"))) return res;
         if (!(res = DeleteDevice(snapshot + "-cow"))) return res;
         if (!image_manager_->UnmapImageIfExists(snapshot + "-cow-img")) {
             return AssertionFailure() << "Cannot unmap image " << snapshot << "-cow-img";
         }
         if (!(res = DeleteDevice(snapshot + "-base"))) return res;
+        if (!(res = DeleteDevice(snapshot + "-src"))) return res;
         return AssertionSuccess();
     }
 
@@ -259,7 +299,7 @@
         if (!map_res) {
             return map_res;
         }
-        if (!InitializeCow(cow_device)) {
+        if (!InitializeKernelCow(cow_device)) {
             return AssertionFailure() << "Cannot zero fill " << cow_device;
         }
         if (!sm->UnmapCowImage(name)) {
@@ -280,37 +320,58 @@
 
     // Prepare A/B slot for a partition named "test_partition".
     AssertionResult PrepareOneSnapshot(uint64_t device_size,
-                                       std::string* out_snap_device = nullptr) {
-        std::string base_device, cow_device, snap_device;
-        if (!CreatePartition("test_partition_a", device_size)) {
-            return AssertionFailure();
+                                       std::unique_ptr<ISnapshotWriter>* writer = nullptr) {
+        lock_ = nullptr;
+
+        DeltaArchiveManifest manifest;
+
+        auto dynamic_partition_metadata = manifest.mutable_dynamic_partition_metadata();
+        dynamic_partition_metadata->set_vabc_enabled(IsCompressionEnabled());
+
+        auto group = dynamic_partition_metadata->add_groups();
+        group->set_name("group");
+        group->set_size(device_size * 2);
+        group->add_partition_names("test_partition");
+
+        auto pu = manifest.add_partitions();
+        pu->set_partition_name("test_partition");
+        pu->set_estimate_cow_size(device_size);
+        SetSize(pu, device_size);
+
+        auto extent = pu->add_operations()->add_dst_extents();
+        extent->set_start_block(0);
+        if (device_size) {
+            extent->set_num_blocks(device_size / manifest.block_size());
         }
-        if (!MapUpdatePartitions()) {
-            return AssertionFailure();
+
+        TestPartitionOpener opener(fake_super);
+        auto builder = MetadataBuilder::New(opener, "super", 0);
+        if (!builder) {
+            return AssertionFailure() << "Failed to open MetadataBuilder";
         }
-        if (!dm_.GetDmDevicePathByName("test_partition_b-base", &base_device)) {
-            return AssertionFailure();
+        builder->AddGroup("group_a", 16_GiB);
+        builder->AddGroup("group_b", 16_GiB);
+        if (!CreatePartition(builder.get(), "test_partition_a", device_size, nullptr, "group_a")) {
+            return AssertionFailure() << "Failed create test_partition_a";
         }
-        SnapshotStatus status;
-        status.set_name("test_partition_b");
-        status.set_device_size(device_size);
-        status.set_snapshot_size(device_size);
-        status.set_cow_file_size(device_size);
-        if (!sm->CreateSnapshot(lock_.get(), &status)) {
-            return AssertionFailure();
+
+        if (!sm->CreateUpdateSnapshots(manifest)) {
+            return AssertionFailure() << "Failed to create update snapshots";
         }
-        if (!CreateCowImage("test_partition_b")) {
-            return AssertionFailure();
+
+        if (writer) {
+            auto res = MapUpdateSnapshot("test_partition_b", writer);
+            if (!res) {
+                return res;
+            }
+        } else if (!IsCompressionEnabled()) {
+            std::string ignore;
+            if (!MapUpdateSnapshot("test_partition_b", &ignore)) {
+                return AssertionFailure() << "Failed to map test_partition_b";
+            }
         }
-        if (!MapCowImage("test_partition_b", 10s, &cow_device)) {
-            return AssertionFailure();
-        }
-        if (!sm->MapSnapshot(lock_.get(), "test_partition_b", base_device, cow_device, 10s,
-                             &snap_device)) {
-            return AssertionFailure();
-        }
-        if (out_snap_device) {
-            *out_snap_device = std::move(snap_device);
+        if (!AcquireLock()) {
+            return AssertionFailure() << "Failed to acquire lock";
         }
         return AssertionSuccess();
     }
@@ -319,20 +380,37 @@
     AssertionResult SimulateReboot() {
         lock_ = nullptr;
         if (!sm->FinishedSnapshotWrites(false)) {
-            return AssertionFailure();
+            return AssertionFailure() << "Failed to finish snapshot writes";
         }
-        if (!dm_.DeleteDevice("test_partition_b")) {
-            return AssertionFailure();
+        if (!sm->UnmapUpdateSnapshot("test_partition_b")) {
+            return AssertionFailure() << "Failed to unmap COW for test_partition_b";
         }
-        if (!DestroyLogicalPartition("test_partition_b-base")) {
-            return AssertionFailure();
+        if (!dm_.DeleteDeviceIfExists("test_partition_b")) {
+            return AssertionFailure() << "Failed to delete test_partition_b";
         }
-        if (!sm->UnmapCowImage("test_partition_b")) {
-            return AssertionFailure();
+        if (!dm_.DeleteDeviceIfExists("test_partition_b-base")) {
+            return AssertionFailure() << "Failed to destroy test_partition_b-base";
         }
         return AssertionSuccess();
     }
 
+    std::unique_ptr<SnapshotManager> NewManagerForFirstStageMount(
+            const std::string& slot_suffix = "_a") {
+        auto info = new TestDeviceInfo(fake_super, slot_suffix);
+        return NewManagerForFirstStageMount(info);
+    }
+
+    std::unique_ptr<SnapshotManager> NewManagerForFirstStageMount(TestDeviceInfo* info) {
+        auto init = SnapshotManager::NewForFirstStageMount(info);
+        if (!init) {
+            return nullptr;
+        }
+        init->SetUeventRegenCallback([](const std::string& device) -> bool {
+            return android::fs_mgr::WaitForFile(device, snapshot_timeout_);
+        });
+        return init;
+    }
+
     static constexpr std::chrono::milliseconds snapshot_timeout_ = 5s;
     DeviceMapper& dm_;
     std::unique_ptr<SnapshotManager::LockedFile> lock_;
@@ -343,13 +421,16 @@
 TEST_F(SnapshotTest, CreateSnapshot) {
     ASSERT_TRUE(AcquireLock());
 
+    PartitionCowCreator cow_creator;
+    cow_creator.compression_enabled = IsCompressionEnabled();
+
     static const uint64_t kDeviceSize = 1024 * 1024;
     SnapshotStatus status;
     status.set_name("test-snapshot");
     status.set_device_size(kDeviceSize);
     status.set_snapshot_size(kDeviceSize);
     status.set_cow_file_size(kDeviceSize);
-    ASSERT_TRUE(sm->CreateSnapshot(lock_.get(), &status));
+    ASSERT_TRUE(sm->CreateSnapshot(lock_.get(), &cow_creator, &status));
     ASSERT_TRUE(CreateCowImage("test-snapshot"));
 
     std::vector<std::string> snapshots;
@@ -364,6 +445,7 @@
         ASSERT_EQ(status.state(), SnapshotState::CREATED);
         ASSERT_EQ(status.device_size(), kDeviceSize);
         ASSERT_EQ(status.snapshot_size(), kDeviceSize);
+        ASSERT_EQ(status.compression_enabled(), cow_creator.compression_enabled);
     }
 
     ASSERT_TRUE(sm->UnmapSnapshot(lock_.get(), "test-snapshot"));
@@ -374,38 +456,16 @@
 TEST_F(SnapshotTest, MapSnapshot) {
     ASSERT_TRUE(AcquireLock());
 
+    PartitionCowCreator cow_creator;
+    cow_creator.compression_enabled = IsCompressionEnabled();
+
     static const uint64_t kDeviceSize = 1024 * 1024;
     SnapshotStatus status;
     status.set_name("test-snapshot");
     status.set_device_size(kDeviceSize);
     status.set_snapshot_size(kDeviceSize);
     status.set_cow_file_size(kDeviceSize);
-    ASSERT_TRUE(sm->CreateSnapshot(lock_.get(), &status));
-    ASSERT_TRUE(CreateCowImage("test-snapshot"));
-
-    std::string base_device;
-    ASSERT_TRUE(CreatePartition("base-device", kDeviceSize, &base_device));
-
-    std::string cow_device;
-    ASSERT_TRUE(MapCowImage("test-snapshot", 10s, &cow_device));
-
-    std::string snap_device;
-    ASSERT_TRUE(sm->MapSnapshot(lock_.get(), "test-snapshot", base_device, cow_device, 10s,
-                                &snap_device));
-    ASSERT_TRUE(android::base::StartsWith(snap_device, "/dev/block/dm-"));
-}
-
-TEST_F(SnapshotTest, MapPartialSnapshot) {
-    ASSERT_TRUE(AcquireLock());
-
-    static const uint64_t kSnapshotSize = 1024 * 1024;
-    static const uint64_t kDeviceSize = 1024 * 1024 * 2;
-    SnapshotStatus status;
-    status.set_name("test-snapshot");
-    status.set_device_size(kDeviceSize);
-    status.set_snapshot_size(kSnapshotSize);
-    status.set_cow_file_size(kSnapshotSize);
-    ASSERT_TRUE(sm->CreateSnapshot(lock_.get(), &status));
+    ASSERT_TRUE(sm->CreateSnapshot(lock_.get(), &cow_creator, &status));
     ASSERT_TRUE(CreateCowImage("test-snapshot"));
 
     std::string base_device;
@@ -430,8 +490,7 @@
 TEST_F(SnapshotTest, CleanFirstStageMount) {
     // If there's no update in progress, there should be no first-stage mount
     // needed.
-    TestDeviceInfo* info = new TestDeviceInfo(fake_super);
-    auto sm = SnapshotManager::NewForFirstStageMount(info);
+    auto sm = NewManagerForFirstStageMount();
     ASSERT_NE(sm, nullptr);
     ASSERT_FALSE(sm->NeedSnapshotsInFirstStageMount());
 }
@@ -440,8 +499,7 @@
     ASSERT_TRUE(sm->FinishedSnapshotWrites(false));
 
     // We didn't change the slot, so we shouldn't need snapshots.
-    TestDeviceInfo* info = new TestDeviceInfo(fake_super);
-    auto sm = SnapshotManager::NewForFirstStageMount(info);
+    auto sm = NewManagerForFirstStageMount();
     ASSERT_NE(sm, nullptr);
     ASSERT_FALSE(sm->NeedSnapshotsInFirstStageMount());
 
@@ -453,32 +511,30 @@
     ASSERT_TRUE(AcquireLock());
 
     static const uint64_t kDeviceSize = 1024 * 1024;
-    std::string snap_device;
-    ASSERT_TRUE(PrepareOneSnapshot(kDeviceSize, &snap_device));
 
-    std::string test_string = "This is a test string.";
-    {
-        unique_fd fd(open(snap_device.c_str(), O_RDWR | O_CLOEXEC | O_SYNC));
-        ASSERT_GE(fd, 0);
-        ASSERT_TRUE(android::base::WriteFully(fd, test_string.data(), test_string.size()));
-    }
-
-    // Note: we know there is no inner/outer dm device since we didn't request
-    // a linear segment.
-    DeviceMapper::TargetInfo target;
-    ASSERT_TRUE(sm->IsSnapshotDevice("test_partition_b", &target));
-    ASSERT_EQ(DeviceMapper::GetTargetType(target.spec), "snapshot");
+    std::unique_ptr<ISnapshotWriter> writer;
+    ASSERT_TRUE(PrepareOneSnapshot(kDeviceSize, &writer));
 
     // Release the lock.
     lock_ = nullptr;
 
+    std::string test_string = "This is a test string.";
+    test_string.resize(writer->options().block_size);
+    ASSERT_TRUE(writer->AddRawBlocks(0, test_string.data(), test_string.size()));
+    ASSERT_TRUE(writer->Finalize());
+    writer = nullptr;
+
     // Done updating.
     ASSERT_TRUE(sm->FinishedSnapshotWrites(false));
 
+    ASSERT_TRUE(sm->UnmapUpdateSnapshot("test_partition_b"));
+
     test_device->set_slot_suffix("_b");
+    ASSERT_TRUE(sm->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
     ASSERT_TRUE(sm->InitiateMerge());
 
     // The device should have been switched to a snapshot-merge target.
+    DeviceMapper::TargetInfo target;
     ASSERT_TRUE(sm->IsSnapshotDevice("test_partition_b", &target));
     ASSERT_EQ(DeviceMapper::GetTargetType(target.spec), "snapshot-merge");
 
@@ -494,7 +550,7 @@
     // Test that we can read back the string we wrote to the snapshot. Note
     // that the base device is gone now. |snap_device| contains the correct
     // partition.
-    unique_fd fd(open(snap_device.c_str(), O_RDONLY | O_CLOEXEC));
+    unique_fd fd(open("/dev/block/mapper/test_partition_b", O_RDONLY | O_CLOEXEC));
     ASSERT_GE(fd, 0);
 
     std::string buffer(test_string.size(), '\0');
@@ -509,7 +565,7 @@
     ASSERT_TRUE(PrepareOneSnapshot(kDeviceSize));
     ASSERT_TRUE(SimulateReboot());
 
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -522,8 +578,7 @@
     ASSERT_EQ(status.state(), SnapshotState::CREATED);
 
     DeviceMapper::TargetInfo target;
-    auto dm_name = init->GetSnapshotDeviceName("test_partition_b", status);
-    ASSERT_TRUE(init->IsSnapshotDevice(dm_name, &target));
+    ASSERT_TRUE(init->IsSnapshotDevice("test_partition_b", &target));
     ASSERT_EQ(DeviceMapper::GetTargetType(target.spec), "snapshot");
 }
 
@@ -538,7 +593,7 @@
     FormatFakeSuper();
     ASSERT_TRUE(CreatePartition("test_partition_b", kDeviceSize));
 
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -550,8 +605,7 @@
 
     // We should not get a snapshot device now.
     DeviceMapper::TargetInfo target;
-    auto dm_name = init->GetSnapshotDeviceName("test_partition_b", status);
-    ASSERT_FALSE(init->IsSnapshotDevice(dm_name, &target));
+    ASSERT_FALSE(init->IsSnapshotDevice("test_partition_b", &target));
 
     // We should see a cancelled update as well.
     lock_ = nullptr;
@@ -565,7 +619,7 @@
     ASSERT_TRUE(PrepareOneSnapshot(kDeviceSize));
     ASSERT_TRUE(SimulateReboot());
 
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -774,11 +828,14 @@
 
         opener_ = std::make_unique<TestPartitionOpener>(fake_super);
 
+        auto dynamic_partition_metadata = manifest_.mutable_dynamic_partition_metadata();
+        dynamic_partition_metadata->set_vabc_enabled(IsCompressionEnabled());
+
         // Create a fake update package metadata.
         // Not using full name "system", "vendor", "product" because these names collide with the
         // mapped partitions on the running device.
         // Each test modifies manifest_ slightly to indicate changes to the partition layout.
-        group_ = manifest_.mutable_dynamic_partition_metadata()->add_groups();
+        group_ = dynamic_partition_metadata->add_groups();
         group_->set_name("group");
         group_->set_size(kGroupSize);
         group_->add_partition_names("sys");
@@ -786,12 +843,15 @@
         group_->add_partition_names("prd");
         sys_ = manifest_.add_partitions();
         sys_->set_partition_name("sys");
+        sys_->set_estimate_cow_size(2_MiB);
         SetSize(sys_, 3_MiB);
         vnd_ = manifest_.add_partitions();
         vnd_->set_partition_name("vnd");
+        vnd_->set_estimate_cow_size(2_MiB);
         SetSize(vnd_, 3_MiB);
         prd_ = manifest_.add_partitions();
         prd_->set_partition_name("prd");
+        prd_->set_estimate_cow_size(2_MiB);
         SetSize(prd_, 3_MiB);
 
         // Initialize source partition metadata using |manifest_|.
@@ -887,49 +947,87 @@
         return AssertionSuccess();
     }
 
-    AssertionResult MapUpdateSnapshot(const std::string& name, std::string* path = nullptr) {
-        std::string real_path;
-        if (!sm->MapUpdateSnapshot(
-                    CreateLogicalPartitionParams{
-                            .block_device = fake_super,
-                            .metadata_slot = 1,
-                            .partition_name = name,
-                            .timeout_ms = 10s,
-                            .partition_opener = opener_.get(),
-                    },
-                    &real_path)) {
-            return AssertionFailure() << "Unable to map snapshot " << name;
+    AssertionResult MapOneUpdateSnapshot(const std::string& name) {
+        if (IsCompressionEnabled()) {
+            std::unique_ptr<ISnapshotWriter> writer;
+            return MapUpdateSnapshot(name, &writer);
+        } else {
+            std::string path;
+            return MapUpdateSnapshot(name, &path);
         }
-        if (path) {
-            *path = real_path;
-        }
-        return AssertionSuccess() << "Mapped snapshot " << name << " to " << real_path;
     }
 
-    AssertionResult WriteSnapshotAndHash(const std::string& name,
-                                         std::optional<size_t> size = std::nullopt) {
-        std::string path;
-        auto res = MapUpdateSnapshot(name, &path);
-        if (!res) {
+    AssertionResult WriteSnapshotAndHash(const std::string& name) {
+        if (IsCompressionEnabled()) {
+            std::unique_ptr<ISnapshotWriter> writer;
+            auto res = MapUpdateSnapshot(name, &writer);
+            if (!res) {
+                return res;
+            }
+            if (!WriteRandomData(writer.get(), &hashes_[name])) {
+                return AssertionFailure() << "Unable to write random data to snapshot " << name;
+            }
+            if (!writer->Finalize()) {
+                return AssertionFailure() << "Unable to finalize COW for " << name;
+            }
+        } else {
+            std::string path;
+            auto res = MapUpdateSnapshot(name, &path);
+            if (!res) {
+                return res;
+            }
+            if (!WriteRandomData(path, std::nullopt, &hashes_[name])) {
+                return AssertionFailure() << "Unable to write random data to snapshot " << name;
+            }
+        }
+
+        // Make sure updates to one device are seen by all devices.
+        sync();
+
+        return AssertionSuccess() << "Written random data to snapshot " << name
+                                  << ", hash: " << hashes_[name];
+    }
+
+    // Generate a snapshot that moves all the upper blocks down to the start.
+    // It doesn't really matter the order, we just want copies that reference
+    // blocks that won't exist if the partition shrinks.
+    AssertionResult ShiftAllSnapshotBlocks(const std::string& name, uint64_t old_size) {
+        std::unique_ptr<ISnapshotWriter> writer;
+        if (auto res = MapUpdateSnapshot(name, &writer); !res) {
             return res;
         }
-
-        std::string size_string = size ? (std::to_string(*size) + " bytes") : "";
-
-        if (!WriteRandomData(path, size, &hashes_[name])) {
-            return AssertionFailure() << "Unable to write " << size_string << " to " << path
-                                      << " for partition " << name;
+        if (!writer->options().max_blocks || !*writer->options().max_blocks) {
+            return AssertionFailure() << "No max blocks set for " << name << " writer";
         }
 
-        return AssertionSuccess() << "Written " << size_string << " to " << path
-                                  << " for snapshot partition " << name
-                                  << ", hash: " << hashes_[name];
+        uint64_t src_block = (old_size / writer->options().block_size) - 1;
+        uint64_t dst_block = 0;
+        uint64_t max_blocks = *writer->options().max_blocks;
+        while (dst_block < max_blocks && dst_block < src_block) {
+            if (!writer->AddCopy(dst_block, src_block)) {
+                return AssertionFailure() << "Unable to add copy for " << name << " for blocks "
+                                          << src_block << ", " << dst_block;
+            }
+            dst_block++;
+            src_block--;
+        }
+        if (!writer->Finalize()) {
+            return AssertionFailure() << "Unable to finalize writer for " << name;
+        }
+
+        auto hash = HashSnapshot(writer.get());
+        if (hash.empty()) {
+            return AssertionFailure() << "Unable to hash snapshot writer for " << name;
+        }
+        hashes_[name] = hash;
+
+        return AssertionSuccess();
     }
 
     AssertionResult MapUpdateSnapshots(const std::vector<std::string>& names = {"sys_b", "vnd_b",
                                                                                 "prd_b"}) {
         for (const auto& name : names) {
-            auto res = MapUpdateSnapshot(name);
+            auto res = MapOneUpdateSnapshot(name);
             if (!res) {
                 return res;
             }
@@ -977,11 +1075,17 @@
         ASSERT_TRUE(sm->UnmapUpdateSnapshot(name));
     }
 
-    // Grow all partitions.
+    // Grow all partitions. Set |prd| large enough that |sys| and |vnd|'s COWs
+    // fit in super, but not |prd|.
     constexpr uint64_t partition_size = 3788_KiB;
     SetSize(sys_, partition_size);
     SetSize(vnd_, partition_size);
-    SetSize(prd_, partition_size);
+    SetSize(prd_, 18_MiB);
+
+    // Make sure |prd| does not fit in super at all. On VABC, this means we
+    // fake an extra large COW for |vnd| to fill up super.
+    vnd_->set_estimate_cow_size(30_MiB);
+    prd_->set_estimate_cow_size(30_MiB);
 
     AddOperationForPartitions();
 
@@ -998,7 +1102,7 @@
 
     // Write some data to target partitions.
     for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
-        ASSERT_TRUE(WriteSnapshotAndHash(name, partition_size));
+        ASSERT_TRUE(WriteSnapshotAndHash(name));
     }
 
     // Assert that source partitions aren't affected.
@@ -1012,7 +1116,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1027,8 +1131,133 @@
 
     // Initiate the merge and wait for it to be completed.
     ASSERT_TRUE(init->InitiateMerge());
+    ASSERT_EQ(init->IsSnapuserdRequired(), IsCompressionEnabled());
+    {
+        // We should have started in SECOND_PHASE since nothing shrinks.
+        ASSERT_TRUE(AcquireLock());
+        auto local_lock = std::move(lock_);
+        auto status = init->ReadSnapshotUpdateStatus(local_lock.get());
+        ASSERT_EQ(status.merge_phase(), MergePhase::SECOND_PHASE);
+    }
     ASSERT_EQ(UpdateState::MergeCompleted, init->ProcessUpdateState());
 
+    // Make sure the second phase ran and deleted snapshots.
+    {
+        ASSERT_TRUE(AcquireLock());
+        auto local_lock = std::move(lock_);
+        std::vector<std::string> snapshots;
+        ASSERT_TRUE(init->ListSnapshots(local_lock.get(), &snapshots));
+        ASSERT_TRUE(snapshots.empty());
+    }
+
+    // Check that the target partitions have the same content after the merge.
+    for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
+        ASSERT_TRUE(IsPartitionUnchanged(name))
+                << "Content of " << name << " changes after the merge";
+    }
+}
+
+// Test that shrinking and growing partitions at the same time is handled
+// correctly in VABC.
+TEST_F(SnapshotUpdateTest, SpaceSwapUpdate) {
+    // OTA client blindly unmaps all partitions that are possibly mapped.
+    for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
+        ASSERT_TRUE(sm->UnmapUpdateSnapshot(name));
+    }
+
+    auto old_sys_size = GetSize(sys_);
+    auto old_prd_size = GetSize(prd_);
+
+    // Grow |sys| but shrink |prd|.
+    SetSize(sys_, old_sys_size * 2);
+    sys_->set_estimate_cow_size(8_MiB);
+    SetSize(prd_, old_prd_size / 2);
+    prd_->set_estimate_cow_size(1_MiB);
+
+    AddOperationForPartitions();
+
+    ASSERT_TRUE(sm->BeginUpdate());
+    ASSERT_TRUE(sm->CreateUpdateSnapshots(manifest_));
+
+    // Check that the old partition sizes were saved correctly.
+    {
+        ASSERT_TRUE(AcquireLock());
+        auto local_lock = std::move(lock_);
+
+        SnapshotStatus status;
+        ASSERT_TRUE(sm->ReadSnapshotStatus(local_lock.get(), "prd_b", &status));
+        ASSERT_EQ(status.old_partition_size(), 3145728);
+        ASSERT_TRUE(sm->ReadSnapshotStatus(local_lock.get(), "sys_b", &status));
+        ASSERT_EQ(status.old_partition_size(), 3145728);
+    }
+
+    ASSERT_TRUE(WriteSnapshotAndHash("sys_b"));
+    ASSERT_TRUE(WriteSnapshotAndHash("vnd_b"));
+    ASSERT_TRUE(ShiftAllSnapshotBlocks("prd_b", old_prd_size));
+
+    sync();
+
+    // Assert that source partitions aren't affected.
+    for (const auto& name : {"sys_a", "vnd_a", "prd_a"}) {
+        ASSERT_TRUE(IsPartitionUnchanged(name));
+    }
+
+    ASSERT_TRUE(sm->FinishedSnapshotWrites(false));
+
+    // Simulate shutting down the device.
+    ASSERT_TRUE(UnmapAll());
+
+    // After reboot, init does first stage mount.
+    auto init = NewManagerForFirstStageMount("_b");
+    ASSERT_NE(init, nullptr);
+    ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
+    ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
+
+    auto indicator = sm->GetRollbackIndicatorPath();
+    ASSERT_NE(access(indicator.c_str(), R_OK), 0);
+
+    // Check that the target partitions have the same content.
+    for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
+        ASSERT_TRUE(IsPartitionUnchanged(name));
+    }
+
+    // Initiate the merge and wait for it to be completed.
+    ASSERT_TRUE(init->InitiateMerge());
+    ASSERT_EQ(init->IsSnapuserdRequired(), IsCompressionEnabled());
+    {
+        // Check that the merge phase is FIRST_PHASE until at least one call
+        // to ProcessUpdateState() occurs.
+        ASSERT_TRUE(AcquireLock());
+        auto local_lock = std::move(lock_);
+        auto status = init->ReadSnapshotUpdateStatus(local_lock.get());
+        ASSERT_EQ(status.merge_phase(), MergePhase::FIRST_PHASE);
+    }
+
+    // Simulate shutting down the device and creating partitions again.
+    ASSERT_TRUE(UnmapAll());
+    ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
+
+    // Check that we used the correct types after rebooting mid-merge.
+    DeviceMapper::TargetInfo target;
+    ASSERT_TRUE(init->IsSnapshotDevice("prd_b", &target));
+    ASSERT_EQ(DeviceMapper::GetTargetType(target.spec), "snapshot-merge");
+    ASSERT_TRUE(init->IsSnapshotDevice("sys_b", &target));
+    ASSERT_EQ(DeviceMapper::GetTargetType(target.spec), "snapshot");
+    ASSERT_TRUE(init->IsSnapshotDevice("vnd_b", &target));
+    ASSERT_EQ(DeviceMapper::GetTargetType(target.spec), "snapshot");
+
+    // Complete the merge.
+    ASSERT_EQ(UpdateState::MergeCompleted, init->ProcessUpdateState());
+
+    // Make sure the second phase ran and deleted snapshots.
+    {
+        ASSERT_TRUE(AcquireLock());
+        auto local_lock = std::move(lock_);
+        std::vector<std::string> snapshots;
+        ASSERT_TRUE(init->ListSnapshots(local_lock.get(), &snapshots));
+        ASSERT_TRUE(snapshots.empty());
+    }
+
     // Check that the target partitions have the same content after the merge.
     for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
         ASSERT_TRUE(IsPartitionUnchanged(name))
@@ -1051,6 +1280,7 @@
     SetSize(sys_, 4_MiB);  // grows
     SetSize(vnd_, 2_MiB);  // shrinks
     // prd_b is unchanged
+    ASSERT_TRUE(sm->BeginUpdate());
     ASSERT_TRUE(sm->CreateUpdateSnapshots(manifest_));
     ASSERT_EQ(4_MiB, GetSnapshotSize("sys_b").value_or(0));
 }
@@ -1060,6 +1290,7 @@
 TEST_F(SnapshotUpdateTest, CowPartitionDoNotTakeOldPartitions) {
     SetSize(sys_, 2_MiB);  // shrinks
     // vnd_b and prd_b are unchanged.
+    ASSERT_TRUE(sm->BeginUpdate());
     ASSERT_TRUE(sm->CreateUpdateSnapshots(manifest_));
 
     auto tgt = MetadataBuilder::New(*opener_, "super", 1);
@@ -1144,7 +1375,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1156,7 +1387,7 @@
 
     // Simulate shutting down the device again.
     ASSERT_TRUE(UnmapAll());
-    init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_a"));
+    init = NewManagerForFirstStageMount("_a");
     ASSERT_NE(init, nullptr);
     ASSERT_FALSE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1183,6 +1414,11 @@
 
 // Test that at the second update, old COW partition spaces are reclaimed.
 TEST_F(SnapshotUpdateTest, ReclaimCow) {
+    // Make sure VABC cows are small enough that they fit in fake_super.
+    sys_->set_estimate_cow_size(64_KiB);
+    vnd_->set_estimate_cow_size(64_KiB);
+    prd_->set_estimate_cow_size(64_KiB);
+
     // Execute the first update.
     ASSERT_TRUE(sm->BeginUpdate());
     ASSERT_TRUE(sm->CreateUpdateSnapshots(manifest_));
@@ -1193,7 +1429,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1299,9 +1535,13 @@
 
 TEST_F(SnapshotUpdateTest, MergeCannotRemoveCow) {
     // Make source partitions as big as possible to force COW image to be created.
-    SetSize(sys_, 5_MiB);
-    SetSize(vnd_, 5_MiB);
-    SetSize(prd_, 5_MiB);
+    SetSize(sys_, 10_MiB);
+    SetSize(vnd_, 10_MiB);
+    SetSize(prd_, 10_MiB);
+    sys_->set_estimate_cow_size(12_MiB);
+    vnd_->set_estimate_cow_size(12_MiB);
+    prd_->set_estimate_cow_size(12_MiB);
+
     src_ = MetadataBuilder::New(*opener_, "super", 0);
     ASSERT_NE(src_, nullptr);
     src_->RemoveGroupAndPartitions(group_->name() + "_a");
@@ -1329,8 +1569,8 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    // Normally we should use NewForFirstStageMount, but if so, "gsid.mapped_image.sys_b-cow-img"
-    // won't be set.
+    // Normally we should use NewManagerForFirstStageMount, but if so,
+    // "gsid.mapped_image.sys_b-cow-img" won't be set.
     auto init = SnapshotManager::New(new TestDeviceInfo(fake_super, "_b"));
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1437,7 +1677,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1451,7 +1691,7 @@
     // Simulate a reboot into recovery.
     auto test_device = std::make_unique<TestDeviceInfo>(fake_super, "_b");
     test_device->set_recovery(true);
-    new_sm = SnapshotManager::NewForFirstStageMount(test_device.release());
+    new_sm = NewManagerForFirstStageMount(test_device.release());
 
     ASSERT_TRUE(new_sm->HandleImminentDataWipe());
     ASSERT_EQ(new_sm->GetUpdateState(), UpdateState::None);
@@ -1469,7 +1709,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1483,7 +1723,7 @@
     // Simulate a reboot into recovery.
     auto test_device = std::make_unique<TestDeviceInfo>(fake_super, "_b");
     test_device->set_recovery(true);
-    new_sm = SnapshotManager::NewForFirstStageMount(test_device.release());
+    new_sm = NewManagerForFirstStageMount(test_device.release());
 
     ASSERT_TRUE(new_sm->FinishMergeInRecovery());
 
@@ -1493,12 +1733,12 @@
 
     // Finish the merge in a normal boot.
     test_device = std::make_unique<TestDeviceInfo>(fake_super, "_b");
-    init = SnapshotManager::NewForFirstStageMount(test_device.release());
+    init = NewManagerForFirstStageMount(test_device.release());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
     init = nullptr;
 
     test_device = std::make_unique<TestDeviceInfo>(fake_super, "_b");
-    new_sm = SnapshotManager::NewForFirstStageMount(test_device.release());
+    new_sm = NewManagerForFirstStageMount(test_device.release());
     ASSERT_EQ(new_sm->ProcessUpdateState(), UpdateState::MergeCompleted);
     ASSERT_EQ(new_sm->ProcessUpdateState(), UpdateState::None);
 }
@@ -1517,7 +1757,7 @@
     // Simulate a reboot into recovery.
     auto test_device = new TestDeviceInfo(fake_super, "_b");
     test_device->set_recovery(true);
-    auto new_sm = SnapshotManager::NewForFirstStageMount(test_device);
+    auto new_sm = NewManagerForFirstStageMount(test_device);
 
     ASSERT_TRUE(new_sm->HandleImminentDataWipe());
     // Manually mount metadata so that we can call GetUpdateState() below.
@@ -1542,7 +1782,7 @@
     // Simulate a rollback, with reboot into recovery.
     auto test_device = new TestDeviceInfo(fake_super, "_a");
     test_device->set_recovery(true);
-    auto new_sm = SnapshotManager::NewForFirstStageMount(test_device);
+    auto new_sm = NewManagerForFirstStageMount(test_device);
 
     ASSERT_TRUE(new_sm->HandleImminentDataWipe());
     EXPECT_EQ(new_sm->GetUpdateState(), UpdateState::None);
@@ -1570,7 +1810,7 @@
     // Simulate a reboot into recovery.
     auto test_device = new TestDeviceInfo(fake_super, "_b");
     test_device->set_recovery(true);
-    auto new_sm = SnapshotManager::NewForFirstStageMount(test_device);
+    auto new_sm = NewManagerForFirstStageMount(test_device);
 
     ASSERT_TRUE(new_sm->HandleImminentDataWipe());
     // Manually mount metadata so that we can call GetUpdateState() below.
@@ -1581,7 +1821,7 @@
 
     // Now reboot into new slot.
     test_device = new TestDeviceInfo(fake_super, "_b");
-    auto init = SnapshotManager::NewForFirstStageMount(test_device);
+    auto init = NewManagerForFirstStageMount(test_device);
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
     // Verify that we are on the downgraded build.
     for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
@@ -1599,6 +1839,8 @@
     SetSize(sys_, partition_size);
     AddOperation(sys_, data_size);
 
+    sys_->set_estimate_cow_size(partition_size + data_size);
+
     // Set hastree extents.
     sys_->mutable_hash_tree_data_extent()->set_start_block(0);
     sys_->mutable_hash_tree_data_extent()->set_num_blocks(data_size / block_size);
@@ -1618,7 +1860,7 @@
 
     // Map and write some data to target partition.
     ASSERT_TRUE(MapUpdateSnapshots({"vnd_b", "prd_b"}));
-    ASSERT_TRUE(WriteSnapshotAndHash("sys_b", partition_size));
+    ASSERT_TRUE(WriteSnapshotAndHash("sys_b"));
 
     // Finish update.
     ASSERT_TRUE(sm->FinishedSnapshotWrites(false));
@@ -1627,7 +1869,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(new TestDeviceInfo(fake_super, "_b"));
+    auto init = NewManagerForFirstStageMount("_b");
     ASSERT_NE(init, nullptr);
     ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
     ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
@@ -1639,6 +1881,10 @@
 
 // Test for overflow bit after update
 TEST_F(SnapshotUpdateTest, Overflow) {
+    if (IsCompressionEnabled()) {
+        GTEST_SKIP() << "No overflow bit set for userspace COWs";
+    }
+
     const auto actual_write_size = GetSize(sys_);
     const auto declared_write_size = actual_write_size - 1_MiB;
 
@@ -1650,7 +1896,7 @@
 
     // Map and write some data to target partitions.
     ASSERT_TRUE(MapUpdateSnapshots({"vnd_b", "prd_b"}));
-    ASSERT_TRUE(WriteSnapshotAndHash("sys_b", actual_write_size));
+    ASSERT_TRUE(WriteSnapshotAndHash("sys_b"));
 
     std::vector<android::dm::DeviceMapper::TargetInfo> table;
     ASSERT_TRUE(DeviceMapper::Instance().GetTableStatus("sys_b", &table));
@@ -1666,12 +1912,15 @@
     auto userdata = std::make_unique<LowSpaceUserdata>();
     ASSERT_TRUE(userdata->Init(kMaxFree));
 
-    // Grow all partitions to 5_MiB, total 15_MiB. This requires 15 MiB of CoW space. After
-    // using the empty space in super (< 1 MiB), it uses at least 14 MiB of /userdata space.
-    constexpr uint64_t partition_size = 5_MiB;
+    // Grow all partitions to 10_MiB, total 30_MiB. This requires 30 MiB of CoW space. After
+    // using the empty space in super (< 1 MiB), it uses 30 MiB of /userdata space.
+    constexpr uint64_t partition_size = 10_MiB;
     SetSize(sys_, partition_size);
     SetSize(vnd_, partition_size);
     SetSize(prd_, partition_size);
+    sys_->set_estimate_cow_size(partition_size);
+    vnd_->set_estimate_cow_size(partition_size);
+    prd_->set_estimate_cow_size(partition_size);
 
     AddOperationForPartitions();
 
@@ -1681,7 +1930,79 @@
     ASSERT_FALSE(res);
     ASSERT_EQ(Return::ErrorCode::NO_SPACE, res.error_code());
     ASSERT_GE(res.required_size(), 14_MiB);
-    ASSERT_LT(res.required_size(), 15_MiB);
+    ASSERT_LT(res.required_size(), 40_MiB);
+}
+
+class AutoKill final {
+  public:
+    explicit AutoKill(pid_t pid) : pid_(pid) {}
+    ~AutoKill() {
+        if (pid_ > 0) kill(pid_, SIGKILL);
+    }
+
+    bool valid() const { return pid_ > 0; }
+
+  private:
+    pid_t pid_;
+};
+
+TEST_F(SnapshotUpdateTest, DaemonTransition) {
+    if (!IsCompressionEnabled()) {
+        GTEST_SKIP() << "Skipping Virtual A/B Compression test";
+    }
+
+    // Ensure a connection to the second-stage daemon, but use the first-stage
+    // code paths thereafter.
+    ASSERT_TRUE(sm->EnsureSnapuserdConnected());
+    sm->set_use_first_stage_snapuserd(true);
+
+    AddOperationForPartitions();
+    // Execute the update.
+    ASSERT_TRUE(sm->BeginUpdate());
+    ASSERT_TRUE(sm->CreateUpdateSnapshots(manifest_));
+    ASSERT_TRUE(MapUpdateSnapshots());
+    ASSERT_TRUE(sm->FinishedSnapshotWrites(false));
+    ASSERT_TRUE(UnmapAll());
+
+    auto init = NewManagerForFirstStageMount("_b");
+    ASSERT_NE(init, nullptr);
+
+    ASSERT_TRUE(init->EnsureSnapuserdConnected());
+    init->set_use_first_stage_snapuserd(true);
+
+    ASSERT_TRUE(init->NeedSnapshotsInFirstStageMount());
+    ASSERT_TRUE(init->CreateLogicalAndSnapshotPartitions("super", snapshot_timeout_));
+
+    ASSERT_EQ(access("/dev/dm-user/sys_b-user-cow-init", F_OK), 0);
+    ASSERT_EQ(access("/dev/dm-user/sys_b-user-cow", F_OK), -1);
+
+    ASSERT_TRUE(init->PerformInitTransition(SnapshotManager::InitTransition::SECOND_STAGE));
+
+    // :TODO: this is a workaround to ensure the handler list stays empty. We
+    // should make this test more like actual init, and spawn two copies of
+    // snapuserd, given how many other tests we now have for normal snapuserd.
+    ASSERT_TRUE(init->snapuserd_client()->WaitForDeviceDelete("sys_b-user-cow-init"));
+    ASSERT_TRUE(init->snapuserd_client()->WaitForDeviceDelete("vnd_b-user-cow-init"));
+    ASSERT_TRUE(init->snapuserd_client()->WaitForDeviceDelete("prd_b-user-cow-init"));
+
+    // The control device should have been renamed.
+    ASSERT_TRUE(android::fs_mgr::WaitForFileDeleted("/dev/dm-user/sys_b-user-cow-init", 10s));
+    ASSERT_EQ(access("/dev/dm-user/sys_b-user-cow", F_OK), 0);
+}
+
+TEST_F(SnapshotUpdateTest, MapAllSnapshots) {
+    AddOperationForPartitions();
+    // Execute the update.
+    ASSERT_TRUE(sm->BeginUpdate());
+    ASSERT_TRUE(sm->CreateUpdateSnapshots(manifest_));
+    for (const auto& name : {"sys_b", "vnd_b", "prd_b"}) {
+        ASSERT_TRUE(WriteSnapshotAndHash(name));
+    }
+    ASSERT_TRUE(sm->FinishedSnapshotWrites(false));
+    ASSERT_TRUE(sm->MapAllSnapshots(10s));
+
+    // Read bytes back and verify they match the cache.
+    ASSERT_TRUE(IsPartitionUnchanged("sys_b"));
 }
 
 class FlashAfterUpdateTest : public SnapshotUpdateTest,
@@ -1764,8 +2085,7 @@
     ASSERT_TRUE(UnmapAll());
 
     // Simulate reboot. After reboot, init does first stage mount.
-    auto init = SnapshotManager::NewForFirstStageMount(
-            new TestDeviceInfo(fake_super, flashed_slot_suffix));
+    auto init = NewManagerForFirstStageMount(flashed_slot_suffix);
     ASSERT_NE(init, nullptr);
 
     if (flashed_slot && after_merge) {
diff --git a/fs_mgr/libsnapshot/snapshot_writer.cpp b/fs_mgr/libsnapshot/snapshot_writer.cpp
new file mode 100644
index 0000000..8e379e4
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapshot_writer.cpp
@@ -0,0 +1,194 @@
+//
+// Copyright (C) 2020 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.
+//
+
+#include <libsnapshot/snapshot_writer.h>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <payload_consumer/file_descriptor.h>
+#include "snapshot_reader.h"
+
+namespace android {
+namespace snapshot {
+
+using android::base::borrowed_fd;
+using android::base::unique_fd;
+using chromeos_update_engine::FileDescriptor;
+
+ISnapshotWriter::ISnapshotWriter(const CowOptions& options) : ICowWriter(options) {}
+
+void ISnapshotWriter::SetSourceDevice(const std::string& source_device) {
+    source_device_ = {source_device};
+}
+
+borrowed_fd ISnapshotWriter::GetSourceFd() {
+    if (!source_device_) {
+        LOG(ERROR) << "Attempted to read from source device but none was set";
+        return borrowed_fd{-1};
+    }
+
+    if (source_fd_ < 0) {
+        source_fd_.reset(open(source_device_->c_str(), O_RDONLY | O_CLOEXEC));
+        if (source_fd_ < 0) {
+            PLOG(ERROR) << "open " << *source_device_;
+            return borrowed_fd{-1};
+        }
+    }
+    return source_fd_;
+}
+
+CompressedSnapshotWriter::CompressedSnapshotWriter(const CowOptions& options)
+    : ISnapshotWriter(options) {}
+
+bool CompressedSnapshotWriter::SetCowDevice(android::base::unique_fd&& cow_device) {
+    cow_device_ = std::move(cow_device);
+    cow_ = std::make_unique<CowWriter>(options_);
+    return true;
+}
+
+bool CompressedSnapshotWriter::Finalize() {
+    return cow_->Finalize();
+}
+
+uint64_t CompressedSnapshotWriter::GetCowSize() {
+    return cow_->GetCowSize();
+}
+
+std::unique_ptr<FileDescriptor> CompressedSnapshotWriter::OpenReader() {
+    unique_fd cow_fd(dup(cow_device_.get()));
+    if (cow_fd < 0) {
+        PLOG(ERROR) << "dup COW device";
+        return nullptr;
+    }
+
+    auto cow = std::make_unique<CowReader>();
+    if (!cow->Parse(std::move(cow_fd))) {
+        LOG(ERROR) << "Unable to read COW";
+        return nullptr;
+    }
+
+    auto reader = std::make_unique<CompressedSnapshotReader>();
+    if (!reader->SetCow(std::move(cow))) {
+        LOG(ERROR) << "Unable to initialize COW reader";
+        return nullptr;
+    }
+    if (source_device_) {
+        reader->SetSourceDevice(*source_device_);
+    }
+
+    const auto& cow_options = options();
+    reader->SetBlockDeviceSize(*cow_options.max_blocks * cow_options.block_size);
+
+    return reader;
+}
+
+bool CompressedSnapshotWriter::EmitCopy(uint64_t new_block, uint64_t old_block) {
+    return cow_->AddCopy(new_block, old_block);
+}
+
+bool CompressedSnapshotWriter::EmitRawBlocks(uint64_t new_block_start, const void* data,
+                                             size_t size) {
+    return cow_->AddRawBlocks(new_block_start, data, size);
+}
+
+bool CompressedSnapshotWriter::EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) {
+    return cow_->AddZeroBlocks(new_block_start, num_blocks);
+}
+
+bool CompressedSnapshotWriter::EmitLabel(uint64_t label) {
+    return cow_->AddLabel(label);
+}
+
+bool CompressedSnapshotWriter::Initialize() {
+    return cow_->Initialize(cow_device_);
+}
+
+bool CompressedSnapshotWriter::InitializeAppend(uint64_t label) {
+    return cow_->InitializeAppend(cow_device_, label);
+}
+
+OnlineKernelSnapshotWriter::OnlineKernelSnapshotWriter(const CowOptions& options)
+    : ISnapshotWriter(options) {}
+
+void OnlineKernelSnapshotWriter::SetSnapshotDevice(android::base::unique_fd&& snapshot_fd,
+                                                   uint64_t cow_size) {
+    snapshot_fd_ = std::move(snapshot_fd);
+    cow_size_ = cow_size;
+}
+
+bool OnlineKernelSnapshotWriter::Finalize() {
+    if (fsync(snapshot_fd_.get()) < 0) {
+        PLOG(ERROR) << "fsync";
+        return false;
+    }
+    return true;
+}
+
+bool OnlineKernelSnapshotWriter::EmitRawBlocks(uint64_t new_block_start, const void* data,
+                                               size_t size) {
+    uint64_t offset = new_block_start * options_.block_size;
+    if (lseek(snapshot_fd_.get(), offset, SEEK_SET) < 0) {
+        PLOG(ERROR) << "EmitRawBlocks lseek to offset " << offset;
+        return false;
+    }
+    if (!android::base::WriteFully(snapshot_fd_, data, size)) {
+        PLOG(ERROR) << "EmitRawBlocks write";
+        return false;
+    }
+    return true;
+}
+
+bool OnlineKernelSnapshotWriter::EmitZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) {
+    std::string zeroes(options_.block_size, 0);
+    for (uint64_t i = 0; i < num_blocks; i++) {
+        if (!EmitRawBlocks(new_block_start + i, zeroes.data(), zeroes.size())) {
+            return false;
+        }
+    }
+    return true;
+}
+
+bool OnlineKernelSnapshotWriter::EmitCopy(uint64_t new_block, uint64_t old_block) {
+    auto source_fd = GetSourceFd();
+    if (source_fd < 0) {
+        return false;
+    }
+
+    std::string buffer(options_.block_size, 0);
+    uint64_t offset = old_block * options_.block_size;
+    if (!android::base::ReadFullyAtOffset(source_fd, buffer.data(), buffer.size(), offset)) {
+        PLOG(ERROR) << "EmitCopy read";
+        return false;
+    }
+    return EmitRawBlocks(new_block, buffer.data(), buffer.size());
+}
+
+bool OnlineKernelSnapshotWriter::EmitLabel(uint64_t) {
+    // Not Needed
+    return true;
+}
+
+std::unique_ptr<FileDescriptor> OnlineKernelSnapshotWriter::OpenReader() {
+    unique_fd fd(dup(snapshot_fd_.get()));
+    if (fd < 0) {
+        PLOG(ERROR) << "dup2 failed in OpenReader";
+        return nullptr;
+    }
+    return std::make_unique<ReadFdFileDescriptor>(std::move(fd));
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapuserd.cpp b/fs_mgr/libsnapshot/snapuserd.cpp
new file mode 100644
index 0000000..82db0d3
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd.cpp
@@ -0,0 +1,874 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "snapuserd.h"
+
+#include <csignal>
+
+#include <libsnapshot/snapuserd_client.h>
+
+namespace android {
+namespace snapshot {
+
+using namespace android;
+using namespace android::dm;
+using android::base::unique_fd;
+
+#define SNAP_LOG(level) LOG(level) << misc_name_ << ": "
+#define SNAP_PLOG(level) PLOG(level) << misc_name_ << ": "
+
+static constexpr size_t PAYLOAD_SIZE = (1UL << 20);
+
+static_assert(PAYLOAD_SIZE >= BLOCK_SIZE);
+
+void BufferSink::Initialize(size_t size) {
+    buffer_size_ = size;
+    buffer_offset_ = 0;
+    buffer_ = std::make_unique<uint8_t[]>(size);
+}
+
+void* BufferSink::GetPayloadBuffer(size_t size) {
+    if ((buffer_size_ - buffer_offset_) < size) return nullptr;
+
+    char* buffer = reinterpret_cast<char*>(GetBufPtr());
+    struct dm_user_message* msg = (struct dm_user_message*)(&(buffer[0]));
+    return (char*)msg->payload.buf + buffer_offset_;
+}
+
+void* BufferSink::GetBuffer(size_t requested, size_t* actual) {
+    void* buf = GetPayloadBuffer(requested);
+    if (!buf) {
+        *actual = 0;
+        return nullptr;
+    }
+    *actual = requested;
+    return buf;
+}
+
+struct dm_user_header* BufferSink::GetHeaderPtr() {
+    CHECK(sizeof(struct dm_user_header) <= buffer_size_);
+    char* buf = reinterpret_cast<char*>(GetBufPtr());
+    struct dm_user_header* header = (struct dm_user_header*)(&(buf[0]));
+    return header;
+}
+
+Snapuserd::Snapuserd(const std::string& misc_name, const std::string& cow_device,
+                     const std::string& backing_device) {
+    misc_name_ = misc_name;
+    cow_device_ = cow_device;
+    backing_store_device_ = backing_device;
+    control_device_ = "/dev/dm-user/" + misc_name;
+}
+
+// Construct kernel COW header in memory
+// This header will be in sector 0. The IO
+// request will always be 4k. After constructing
+// the header, zero out the remaining block.
+void Snapuserd::ConstructKernelCowHeader() {
+    void* buffer = bufsink_.GetPayloadBuffer(BLOCK_SIZE);
+    CHECK(buffer != nullptr);
+
+    memset(buffer, 0, BLOCK_SIZE);
+
+    struct disk_header* dh = reinterpret_cast<struct disk_header*>(buffer);
+
+    dh->magic = SNAP_MAGIC;
+    dh->valid = SNAPSHOT_VALID;
+    dh->version = SNAPSHOT_DISK_VERSION;
+    dh->chunk_size = CHUNK_SIZE;
+}
+
+// Start the replace operation. This will read the
+// internal COW format and if the block is compressed,
+// it will be de-compressed.
+bool Snapuserd::ProcessReplaceOp(const CowOperation* cow_op) {
+    if (!reader_->ReadData(*cow_op, &bufsink_)) {
+        SNAP_LOG(ERROR) << "ProcessReplaceOp failed for block " << cow_op->new_block;
+        return false;
+    }
+
+    return true;
+}
+
+// Start the copy operation. This will read the backing
+// block device which is represented by cow_op->source.
+bool Snapuserd::ProcessCopyOp(const CowOperation* cow_op) {
+    void* buffer = bufsink_.GetPayloadBuffer(BLOCK_SIZE);
+    CHECK(buffer != nullptr);
+
+    // Issue a single 4K IO. However, this can be optimized
+    // if the successive blocks are contiguous.
+    if (!android::base::ReadFullyAtOffset(backing_store_fd_, buffer, BLOCK_SIZE,
+                                          cow_op->source * BLOCK_SIZE)) {
+        SNAP_PLOG(ERROR) << "Copy-op failed. Read from backing store: " << backing_store_device_
+                         << "at block :" << cow_op->source;
+        return false;
+    }
+
+    return true;
+}
+
+bool Snapuserd::ProcessZeroOp() {
+    // Zero out the entire block
+    void* buffer = bufsink_.GetPayloadBuffer(BLOCK_SIZE);
+    CHECK(buffer != nullptr);
+
+    memset(buffer, 0, BLOCK_SIZE);
+    return true;
+}
+
+bool Snapuserd::ProcessCowOp(const CowOperation* cow_op) {
+    CHECK(cow_op != nullptr);
+
+    switch (cow_op->type) {
+        case kCowReplaceOp: {
+            return ProcessReplaceOp(cow_op);
+        }
+
+        case kCowZeroOp: {
+            return ProcessZeroOp();
+        }
+
+        case kCowCopyOp: {
+            return ProcessCopyOp(cow_op);
+        }
+
+        default: {
+            SNAP_LOG(ERROR) << "Unknown operation-type found: " << cow_op->type;
+        }
+    }
+    return false;
+}
+
+int Snapuserd::ReadUnalignedSector(sector_t sector, size_t size,
+                                   std::map<sector_t, const CowOperation*>::iterator& it) {
+    size_t skip_sector_size = 0;
+
+    SNAP_LOG(DEBUG) << "ReadUnalignedSector: sector " << sector << " size: " << size
+                    << " Aligned sector: " << it->second;
+
+    if (!ProcessCowOp(it->second)) {
+        SNAP_LOG(ERROR) << "ReadUnalignedSector: " << sector << " failed of size: " << size;
+        return -1;
+    }
+
+    int num_sectors_skip = sector - it->first;
+
+    if (num_sectors_skip > 0) {
+        skip_sector_size = num_sectors_skip << SECTOR_SHIFT;
+        char* buffer = reinterpret_cast<char*>(bufsink_.GetBufPtr());
+        struct dm_user_message* msg = (struct dm_user_message*)(&(buffer[0]));
+
+        memmove(msg->payload.buf, (char*)msg->payload.buf + skip_sector_size,
+                (BLOCK_SIZE - skip_sector_size));
+    }
+
+    bufsink_.ResetBufferOffset();
+    return std::min(size, (BLOCK_SIZE - skip_sector_size));
+}
+
+/*
+ * Read the data for a given COW Operation.
+ *
+ * Kernel can issue IO at a sector granularity.
+ * Hence, an IO may end up with reading partial
+ * data from a COW operation or we may also
+ * end up with interspersed request between
+ * two COW operations.
+ *
+ */
+int Snapuserd::ReadData(sector_t sector, size_t size) {
+    /*
+     * chunk_map stores COW operation at 4k granularity.
+     * If the requested IO with the sector falls on the 4k
+     * boundary, then we can read the COW op directly without
+     * any issue.
+     *
+     * However, if the requested sector is not 4K aligned,
+     * then we will have the find the nearest COW operation
+     * and chop the 4K block to fetch the requested sector.
+     */
+    std::map<sector_t, const CowOperation*>::iterator it = chunk_map_.find(sector);
+    if (it == chunk_map_.end()) {
+        it = chunk_map_.lower_bound(sector);
+        if (it != chunk_map_.begin()) {
+            --it;
+        }
+
+        /*
+         * If the IO is spanned between two COW operations,
+         * split the IO into two parts:
+         *
+         * 1: Read the first part from the single COW op
+         * 2: Read the second part from the next COW op.
+         *
+         * Ex: Let's say we have a 1024 Bytes IO request.
+         *
+         * 0       COW OP-1  4096     COW OP-2  8192
+         * |******************|*******************|
+         *              |*****|*****|
+         *           3584           4608
+         *              <- 1024B - >
+         *
+         * We have two COW operations which are 4k blocks.
+         * The IO is requested for 1024 Bytes which are spanned
+         * between two COW operations. We will split this IO
+         * into two parts:
+         *
+         * 1: IO of size 512B from offset 3584 bytes (COW OP-1)
+         * 2: IO of size 512B from offset 4096 bytes (COW OP-2)
+         */
+        return ReadUnalignedSector(sector, size, it);
+    }
+
+    int num_ops = DIV_ROUND_UP(size, BLOCK_SIZE);
+    while (num_ops) {
+        if (!ProcessCowOp(it->second)) {
+            return -1;
+        }
+        num_ops -= 1;
+        it++;
+        // Update the buffer offset
+        bufsink_.UpdateBufferOffset(BLOCK_SIZE);
+
+        SNAP_LOG(DEBUG) << "ReadData at sector: " << sector << " size: " << size;
+    }
+
+    // Reset the buffer offset
+    bufsink_.ResetBufferOffset();
+    return size;
+}
+
+/*
+ * dm-snap does prefetch reads while reading disk-exceptions.
+ * By default, prefetch value is set to 12; this means that
+ * dm-snap will issue 12 areas wherein each area is a 4k page
+ * of disk-exceptions.
+ *
+ * If during prefetch, if the chunk-id seen is beyond the
+ * actual number of metadata page, fill the buffer with zero.
+ * When dm-snap starts parsing the buffer, it will stop
+ * reading metadata page once the buffer content is zero.
+ */
+bool Snapuserd::ZerofillDiskExceptions(size_t read_size) {
+    size_t size = exceptions_per_area_ * sizeof(struct disk_exception);
+
+    if (read_size > size) {
+        return false;
+    }
+
+    void* buffer = bufsink_.GetPayloadBuffer(size);
+    CHECK(buffer != nullptr);
+
+    memset(buffer, 0, size);
+    return true;
+}
+
+/*
+ * A disk exception is a simple mapping of old_chunk to new_chunk.
+ * When dm-snapshot device is created, kernel requests these mapping.
+ *
+ * Each disk exception is of size 16 bytes. Thus a single 4k page can
+ * have:
+ *
+ * exceptions_per_area_ = 4096/16 = 256. This entire 4k page
+ * is considered a metadata page and it is represented by chunk ID.
+ *
+ * Convert the chunk ID to index into the vector which gives us
+ * the metadata page.
+ */
+bool Snapuserd::ReadDiskExceptions(chunk_t chunk, size_t read_size) {
+    uint32_t stride = exceptions_per_area_ + 1;
+    size_t size;
+
+    // ChunkID to vector index
+    lldiv_t divresult = lldiv(chunk, stride);
+
+    if (divresult.quot < vec_.size()) {
+        size = exceptions_per_area_ * sizeof(struct disk_exception);
+
+        CHECK(read_size == size);
+
+        void* buffer = bufsink_.GetPayloadBuffer(size);
+        CHECK(buffer != nullptr);
+
+        memcpy(buffer, vec_[divresult.quot].get(), size);
+    } else {
+        return ZerofillDiskExceptions(read_size);
+    }
+
+    return true;
+}
+
+loff_t Snapuserd::GetMergeStartOffset(void* merged_buffer, void* unmerged_buffer,
+                                      int* unmerged_exceptions) {
+    loff_t offset = 0;
+    *unmerged_exceptions = 0;
+
+    while (*unmerged_exceptions <= exceptions_per_area_) {
+        struct disk_exception* merged_de =
+                reinterpret_cast<struct disk_exception*>((char*)merged_buffer + offset);
+        struct disk_exception* cow_de =
+                reinterpret_cast<struct disk_exception*>((char*)unmerged_buffer + offset);
+
+        // Unmerged op by the kernel
+        if (merged_de->old_chunk != 0 || merged_de->new_chunk != 0) {
+            CHECK(merged_de->old_chunk == cow_de->old_chunk);
+            CHECK(merged_de->new_chunk == cow_de->new_chunk);
+
+            offset += sizeof(struct disk_exception);
+            *unmerged_exceptions += 1;
+            continue;
+        }
+
+        break;
+    }
+
+    CHECK(!(*unmerged_exceptions == exceptions_per_area_));
+
+    SNAP_LOG(DEBUG) << "Unmerged_Exceptions: " << *unmerged_exceptions << " Offset: " << offset;
+    return offset;
+}
+
+int Snapuserd::GetNumberOfMergedOps(void* merged_buffer, void* unmerged_buffer, loff_t offset,
+                                    int unmerged_exceptions, bool* copy_op) {
+    int merged_ops_cur_iter = 0;
+
+    // Find the operations which are merged in this cycle.
+    while ((unmerged_exceptions + merged_ops_cur_iter) < exceptions_per_area_) {
+        struct disk_exception* merged_de =
+                reinterpret_cast<struct disk_exception*>((char*)merged_buffer + offset);
+        struct disk_exception* cow_de =
+                reinterpret_cast<struct disk_exception*>((char*)unmerged_buffer + offset);
+
+        CHECK(merged_de->new_chunk == 0);
+        CHECK(merged_de->old_chunk == 0);
+
+        if (cow_de->new_chunk != 0) {
+            merged_ops_cur_iter += 1;
+            offset += sizeof(struct disk_exception);
+            const CowOperation* cow_op = chunk_map_[ChunkToSector(cow_de->new_chunk)];
+            CHECK(cow_op != nullptr);
+            CHECK(cow_op->new_block == cow_de->old_chunk);
+            if (cow_op->type == kCowCopyOp) {
+                *copy_op = true;
+            }
+            // zero out to indicate that operation is merged.
+            cow_de->old_chunk = 0;
+            cow_de->new_chunk = 0;
+        } else if (cow_de->old_chunk == 0) {
+            // Already merged op in previous iteration or
+            // This could also represent a partially filled area.
+            //
+            // If the op was merged in previous cycle, we don't have
+            // to count them.
+            CHECK(cow_de->new_chunk == 0);
+            break;
+        } else {
+            SNAP_LOG(ERROR) << "Error in merge operation. Found invalid metadata: "
+                            << " merged_de-old-chunk: " << merged_de->old_chunk
+                            << " merged_de-new-chunk: " << merged_de->new_chunk
+                            << " cow_de-old-chunk: " << cow_de->old_chunk
+                            << " cow_de-new-chunk: " << cow_de->new_chunk
+                            << " unmerged_exceptions: " << unmerged_exceptions
+                            << " merged_ops_cur_iter: " << merged_ops_cur_iter
+                            << " offset: " << offset;
+            return -1;
+        }
+    }
+
+    if (*copy_op) {
+        CHECK(merged_ops_cur_iter == 1);
+    }
+    return merged_ops_cur_iter;
+}
+
+bool Snapuserd::ProcessMergeComplete(chunk_t chunk, void* buffer) {
+    uint32_t stride = exceptions_per_area_ + 1;
+    CowHeader header;
+
+    if (!reader_->GetHeader(&header)) {
+        SNAP_LOG(ERROR) << "Failed to get header";
+        return false;
+    }
+
+    // ChunkID to vector index
+    lldiv_t divresult = lldiv(chunk, stride);
+    CHECK(divresult.quot < vec_.size());
+    SNAP_LOG(DEBUG) << "ProcessMergeComplete: chunk: " << chunk
+                    << " Metadata-Index: " << divresult.quot;
+
+    int unmerged_exceptions = 0;
+    loff_t offset = GetMergeStartOffset(buffer, vec_[divresult.quot].get(), &unmerged_exceptions);
+
+    bool copy_op = false;
+    // Check if the merged operation is a copy operation. If so, then we need
+    // to explicitly sync the metadata before initiating the next merge.
+    // For ex: Consider a following sequence of copy operations in the COW file:
+    //
+    // Op-1: Copy 2 -> 3
+    // Op-2: Copy 1 -> 2
+    // Op-3: Copy 5 -> 10
+    //
+    // Op-1 and Op-2 are overlapping copy operations. The merge sequence will
+    // look like:
+    //
+    // Merge op-1: Copy 2 -> 3
+    // Merge op-2: Copy 1 -> 2
+    // Merge op-3: Copy 5 -> 10
+    //
+    // Now, let's say we have a crash _after_ Merge op-2; Block 2 contents would
+    // have been over-written by Block-1 after merge op-2. During next reboot,
+    // kernel will request the metadata for all the un-merged blocks. If we had
+    // not sync the metadata after Merge-op 1 and Merge op-2, snapuser daemon
+    // will think that these merge operations are still pending and hence will
+    // inform the kernel that Op-1 and Op-2 are un-merged blocks. When kernel
+    // resumes back the merging process, it will attempt to redo the Merge op-1
+    // once again. However, block 2 contents are wrong as it has the contents
+    // of block 1 from previous merge cycle. Although, merge will silently succeed,
+    // this will lead to silent data corruption.
+    //
+    int merged_ops_cur_iter = GetNumberOfMergedOps(buffer, vec_[divresult.quot].get(), offset,
+                                                   unmerged_exceptions, &copy_op);
+
+    // There should be at least one operation merged in this cycle
+    CHECK(merged_ops_cur_iter > 0);
+
+    header.num_merge_ops += merged_ops_cur_iter;
+    reader_->UpdateMergeProgress(merged_ops_cur_iter);
+    if (!writer_->CommitMerge(merged_ops_cur_iter, copy_op)) {
+        SNAP_LOG(ERROR) << "CommitMerge failed... merged_ops_cur_iter: " << merged_ops_cur_iter;
+        return false;
+    }
+
+    SNAP_LOG(DEBUG) << "Merge success: " << merged_ops_cur_iter << "chunk: " << chunk;
+    return true;
+}
+
+bool Snapuserd::IsChunkIdMetadata(chunk_t chunk) {
+    uint32_t stride = exceptions_per_area_ + 1;
+    lldiv_t divresult = lldiv(chunk, stride);
+
+    return (divresult.rem == NUM_SNAPSHOT_HDR_CHUNKS);
+}
+
+// Find the next free chunk-id to be assigned. Check if the next free
+// chunk-id represents a metadata page. If so, skip it.
+chunk_t Snapuserd::GetNextAllocatableChunkId(chunk_t chunk) {
+    chunk_t next_chunk = chunk + 1;
+
+    if (IsChunkIdMetadata(next_chunk)) {
+        next_chunk += 1;
+    }
+    return next_chunk;
+}
+
+/*
+ * Read the metadata from COW device and
+ * construct the metadata as required by the kernel.
+ *
+ * Please see design on kernel COW format
+ *
+ * 1: Read the metadata from internal COW device
+ * 2: There are 3 COW operations:
+ *     a: Replace op
+ *     b: Copy op
+ *     c: Zero op
+ * 3: For each of the 3 operations, op->new_block
+ *    represents the block number in the base device
+ *    for which one of the 3 operations have to be applied.
+ *    This represents the old_chunk in the kernel COW format
+ * 4: We need to assign new_chunk for a corresponding old_chunk
+ * 5: The algorithm is similar to how kernel assigns chunk number
+ *    while creating exceptions. However, there are few cases
+ *    which needs to be addressed here:
+ *      a: During merge process, kernel scans the metadata page
+ *      from backwards when merge is initiated. Since, we need
+ *      to make sure that the merge ordering follows our COW format,
+ *      we read the COW operation from backwards and populate the
+ *      metadata so that when kernel starts the merging from backwards,
+ *      those ops correspond to the beginning of our COW format.
+ *      b: Kernel can merge successive operations if the two chunk IDs
+ *      are contiguous. This can be problematic when there is a crash
+ *      during merge; specifically when the merge operation has dependency.
+ *      These dependencies can only happen during copy operations.
+ *
+ *      To avoid this problem, we make sure that no two copy-operations
+ *      do not have contiguous chunk IDs. Additionally, we make sure
+ *      that each copy operation is merged individually.
+ * 6: Use a monotonically increasing chunk number to assign the
+ *    new_chunk
+ * 7: Each chunk-id represents either a: Metadata page or b: Data page
+ * 8: Chunk-id representing a data page is stored in a map.
+ * 9: Chunk-id representing a metadata page is converted into a vector
+ *    index. We store this in vector as kernel requests metadata during
+ *    two stage:
+ *       a: When initial dm-snapshot device is created, kernel requests
+ *          all the metadata and stores it in its internal data-structures.
+ *       b: During merge, kernel once again requests the same metadata
+ *          once-again.
+ *    In both these cases, a quick lookup based on chunk-id is done.
+ * 10: When chunk number is incremented, we need to make sure that
+ *    if the chunk is representing a metadata page and skip.
+ * 11: Each 4k page will contain 256 disk exceptions. We call this
+ *    exceptions_per_area_
+ * 12: Kernel will stop issuing metadata IO request when new-chunk ID is 0.
+ */
+bool Snapuserd::ReadMetadata() {
+    reader_ = std::make_unique<CowReader>();
+    CowHeader header;
+    CowOptions options;
+    bool prev_copy_op = false;
+    bool metadata_found = false;
+
+    SNAP_LOG(DEBUG) << "ReadMetadata Start...";
+
+    if (!reader_->Parse(cow_fd_)) {
+        SNAP_LOG(ERROR) << "Failed to parse";
+        return false;
+    }
+
+    if (!reader_->GetHeader(&header)) {
+        SNAP_LOG(ERROR) << "Failed to get header";
+        return false;
+    }
+
+    CHECK(header.block_size == BLOCK_SIZE);
+
+    SNAP_LOG(DEBUG) << "Merge-ops: " << header.num_merge_ops;
+    reader_->InitializeMerge();
+
+    writer_ = std::make_unique<CowWriter>(options);
+    writer_->InitializeMerge(cow_fd_.get(), &header);
+
+    // Initialize the iterator for reading metadata
+    cowop_riter_ = reader_->GetRevOpIter();
+
+    exceptions_per_area_ = (CHUNK_SIZE << SECTOR_SHIFT) / sizeof(struct disk_exception);
+
+    // Start from chunk number 2. Chunk 0 represents header and chunk 1
+    // represents first metadata page.
+    chunk_t data_chunk_id = NUM_SNAPSHOT_HDR_CHUNKS + 1;
+    size_t num_ops = 0;
+
+    loff_t offset = 0;
+    std::unique_ptr<uint8_t[]> de_ptr =
+            std::make_unique<uint8_t[]>(exceptions_per_area_ * sizeof(struct disk_exception));
+
+    // This memset is important. Kernel will stop issuing IO when new-chunk ID
+    // is 0. When Area is not filled completely with all 256 exceptions,
+    // this memset will ensure that metadata read is completed.
+    memset(de_ptr.get(), 0, (exceptions_per_area_ * sizeof(struct disk_exception)));
+
+    while (!cowop_riter_->Done()) {
+        const CowOperation* cow_op = &cowop_riter_->Get();
+        struct disk_exception* de =
+                reinterpret_cast<struct disk_exception*>((char*)de_ptr.get() + offset);
+
+        if (IsMetadataOp(*cow_op)) {
+            cowop_riter_->Next();
+            continue;
+        }
+
+        metadata_found = true;
+        if ((cow_op->type == kCowCopyOp || prev_copy_op)) {
+            data_chunk_id = GetNextAllocatableChunkId(data_chunk_id);
+        }
+
+        prev_copy_op = (cow_op->type == kCowCopyOp);
+
+        // Construct the disk-exception
+        de->old_chunk = cow_op->new_block;
+        de->new_chunk = data_chunk_id;
+
+        SNAP_LOG(DEBUG) << "Old-chunk: " << de->old_chunk << "New-chunk: " << de->new_chunk;
+
+        // Store operation pointer.
+        chunk_map_[ChunkToSector(data_chunk_id)] = cow_op;
+        num_ops += 1;
+        offset += sizeof(struct disk_exception);
+        cowop_riter_->Next();
+
+        if (num_ops == exceptions_per_area_) {
+            // Store it in vector at the right index. This maps the chunk-id to
+            // vector index.
+            vec_.push_back(std::move(de_ptr));
+            offset = 0;
+            num_ops = 0;
+
+            // Create buffer for next area
+            de_ptr = std::make_unique<uint8_t[]>(exceptions_per_area_ *
+                                                 sizeof(struct disk_exception));
+            memset(de_ptr.get(), 0, (exceptions_per_area_ * sizeof(struct disk_exception)));
+
+            if (cowop_riter_->Done()) {
+                vec_.push_back(std::move(de_ptr));
+                SNAP_LOG(DEBUG) << "ReadMetadata() completed; Number of Areas: " << vec_.size();
+            }
+        }
+
+        data_chunk_id = GetNextAllocatableChunkId(data_chunk_id);
+    }
+
+    // Partially filled area or there is no metadata
+    // If there is no metadata, fill with zero so that kernel
+    // is aware that merge is completed.
+    if (num_ops || !metadata_found) {
+        vec_.push_back(std::move(de_ptr));
+        SNAP_LOG(DEBUG) << "ReadMetadata() completed. Partially filled area num_ops: " << num_ops
+                        << "Areas : " << vec_.size();
+    }
+
+    SNAP_LOG(DEBUG) << "ReadMetadata() completed. Final_chunk_id: " << data_chunk_id
+                    << "Num Sector: " << ChunkToSector(data_chunk_id);
+
+    // Total number of sectors required for creating dm-user device
+    num_sectors_ = ChunkToSector(data_chunk_id);
+    metadata_read_done_ = true;
+    return true;
+}
+
+void MyLogger(android::base::LogId, android::base::LogSeverity severity, const char*, const char*,
+              unsigned int, const char* message) {
+    if (severity == android::base::ERROR) {
+        fprintf(stderr, "%s\n", message);
+    } else {
+        fprintf(stdout, "%s\n", message);
+    }
+}
+
+// Read Header from dm-user misc device. This gives
+// us the sector number for which IO is issued by dm-snapshot device
+bool Snapuserd::ReadDmUserHeader() {
+    if (!android::base::ReadFully(ctrl_fd_, bufsink_.GetBufPtr(), sizeof(struct dm_user_header))) {
+        SNAP_PLOG(ERROR) << "Control-read failed";
+        return false;
+    }
+
+    return true;
+}
+
+// Send the payload/data back to dm-user misc device.
+bool Snapuserd::WriteDmUserPayload(size_t size) {
+    if (!android::base::WriteFully(ctrl_fd_, bufsink_.GetBufPtr(),
+                                   sizeof(struct dm_user_header) + size)) {
+        SNAP_PLOG(ERROR) << "Write to dm-user failed size: " << size;
+        return false;
+    }
+
+    return true;
+}
+
+bool Snapuserd::ReadDmUserPayload(void* buffer, size_t size) {
+    if (!android::base::ReadFully(ctrl_fd_, buffer, size)) {
+        SNAP_PLOG(ERROR) << "ReadDmUserPayload failed size: " << size;
+        return false;
+    }
+
+    return true;
+}
+
+bool Snapuserd::InitCowDevice() {
+    cow_fd_.reset(open(cow_device_.c_str(), O_RDWR));
+    if (cow_fd_ < 0) {
+        SNAP_PLOG(ERROR) << "Open Failed: " << cow_device_;
+        return false;
+    }
+
+    // Allocate the buffer which is used to communicate between
+    // daemon and dm-user. The buffer comprises of header and a fixed payload.
+    // If the dm-user requests a big IO, the IO will be broken into chunks
+    // of PAYLOAD_SIZE.
+    size_t buf_size = sizeof(struct dm_user_header) + PAYLOAD_SIZE;
+    bufsink_.Initialize(buf_size);
+
+    return ReadMetadata();
+}
+
+bool Snapuserd::InitBackingAndControlDevice() {
+    backing_store_fd_.reset(open(backing_store_device_.c_str(), O_RDONLY));
+    if (backing_store_fd_ < 0) {
+        SNAP_PLOG(ERROR) << "Open Failed: " << backing_store_device_;
+        return false;
+    }
+
+    ctrl_fd_.reset(open(control_device_.c_str(), O_RDWR));
+    if (ctrl_fd_ < 0) {
+        SNAP_PLOG(ERROR) << "Unable to open " << control_device_;
+        return false;
+    }
+
+    return true;
+}
+
+bool Snapuserd::DmuserWriteRequest() {
+    struct dm_user_header* header = bufsink_.GetHeaderPtr();
+
+    // device mapper has the capability to allow
+    // targets to flush the cache when writes are completed. This
+    // is controlled by each target by a flag "flush_supported".
+    // This flag is set by dm-user. When flush is supported,
+    // a number of zero-length bio's will be submitted to
+    // the target for the purpose of flushing cache. It is the
+    // responsibility of the target driver - which is dm-user in this
+    // case, to remap these bio's to the underlying device. Since,
+    // there is no underlying device for dm-user, this zero length
+    // bio's gets routed to daemon.
+    //
+    // Flush operations are generated post merge by dm-snap by having
+    // REQ_PREFLUSH flag set. Snapuser daemon doesn't have anything
+    // to flush per se; hence, just respond back with a success message.
+    if (header->sector == 0) {
+        CHECK(header->len == 0);
+        header->type = DM_USER_RESP_SUCCESS;
+        if (!WriteDmUserPayload(0)) {
+            return false;
+        }
+        return true;
+    }
+
+    size_t remaining_size = header->len;
+    size_t read_size = std::min(PAYLOAD_SIZE, remaining_size);
+    CHECK(read_size == BLOCK_SIZE);
+
+    CHECK(header->sector > 0);
+    chunk_t chunk = SectorToChunk(header->sector);
+    CHECK(chunk_map_.find(header->sector) == chunk_map_.end());
+
+    void* buffer = bufsink_.GetPayloadBuffer(read_size);
+    CHECK(buffer != nullptr);
+    header->type = DM_USER_RESP_SUCCESS;
+
+    if (!ReadDmUserPayload(buffer, read_size)) {
+        SNAP_LOG(ERROR) << "ReadDmUserPayload failed for chunk id: " << chunk
+                        << "Sector: " << header->sector;
+        header->type = DM_USER_RESP_ERROR;
+    }
+
+    if (header->type == DM_USER_RESP_SUCCESS && !ProcessMergeComplete(chunk, buffer)) {
+        SNAP_LOG(ERROR) << "ProcessMergeComplete failed for chunk id: " << chunk
+                        << "Sector: " << header->sector;
+        header->type = DM_USER_RESP_ERROR;
+    } else {
+        SNAP_LOG(DEBUG) << "ProcessMergeComplete success for chunk id: " << chunk
+                        << "Sector: " << header->sector;
+    }
+
+    if (!WriteDmUserPayload(0)) {
+        return false;
+    }
+
+    return true;
+}
+
+bool Snapuserd::DmuserReadRequest() {
+    struct dm_user_header* header = bufsink_.GetHeaderPtr();
+    size_t remaining_size = header->len;
+    loff_t offset = 0;
+    sector_t sector = header->sector;
+    do {
+        size_t read_size = std::min(PAYLOAD_SIZE, remaining_size);
+
+        int ret = read_size;
+        header->type = DM_USER_RESP_SUCCESS;
+        chunk_t chunk = SectorToChunk(header->sector);
+
+        // Request to sector 0 is always for kernel
+        // representation of COW header. This IO should be only
+        // once during dm-snapshot device creation. We should
+        // never see multiple IO requests. Additionally this IO
+        // will always be a single 4k.
+        if (header->sector == 0) {
+            CHECK(metadata_read_done_ == true);
+            CHECK(read_size == BLOCK_SIZE);
+            ConstructKernelCowHeader();
+            SNAP_LOG(DEBUG) << "Kernel header constructed";
+        } else {
+            if (!offset && (read_size == BLOCK_SIZE) &&
+                chunk_map_.find(header->sector) == chunk_map_.end()) {
+                if (!ReadDiskExceptions(chunk, read_size)) {
+                    SNAP_LOG(ERROR) << "ReadDiskExceptions failed for chunk id: " << chunk
+                                    << "Sector: " << header->sector;
+                    header->type = DM_USER_RESP_ERROR;
+                } else {
+                    SNAP_LOG(DEBUG) << "ReadDiskExceptions success for chunk id: " << chunk
+                                    << "Sector: " << header->sector;
+                }
+            } else {
+                chunk_t num_sectors_read = (offset >> SECTOR_SHIFT);
+                ret = ReadData(sector + num_sectors_read, read_size);
+                if (ret < 0) {
+                    SNAP_LOG(ERROR) << "ReadData failed for chunk id: " << chunk
+                                    << " Sector: " << (sector + num_sectors_read)
+                                    << " size: " << read_size << " header-len: " << header->len;
+                    header->type = DM_USER_RESP_ERROR;
+                } else {
+                    SNAP_LOG(DEBUG) << "ReadData success for chunk id: " << chunk
+                                    << "Sector: " << header->sector;
+                }
+            }
+        }
+
+        // Daemon will not be terminated if there is any error. We will
+        // just send the error back to dm-user.
+        if (!WriteDmUserPayload(ret)) {
+            return false;
+        }
+
+        remaining_size -= ret;
+        offset += ret;
+    } while (remaining_size > 0);
+
+    return true;
+}
+
+bool Snapuserd::Run() {
+    struct dm_user_header* header = bufsink_.GetHeaderPtr();
+
+    bufsink_.Clear();
+
+    if (!ReadDmUserHeader()) {
+        SNAP_LOG(ERROR) << "ReadDmUserHeader failed";
+        return false;
+    }
+
+    SNAP_LOG(DEBUG) << "msg->seq: " << std::hex << header->seq;
+    SNAP_LOG(DEBUG) << "msg->type: " << std::hex << header->type;
+    SNAP_LOG(DEBUG) << "msg->flags: " << std::hex << header->flags;
+    SNAP_LOG(DEBUG) << "msg->sector: " << std::hex << header->sector;
+    SNAP_LOG(DEBUG) << "msg->len: " << std::hex << header->len;
+
+    switch (header->type) {
+        case DM_USER_REQ_MAP_READ: {
+            if (!DmuserReadRequest()) {
+                return false;
+            }
+            break;
+        }
+
+        case DM_USER_REQ_MAP_WRITE: {
+            if (!DmuserWriteRequest()) {
+                return false;
+            }
+            break;
+        }
+    }
+
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapuserd.h b/fs_mgr/libsnapshot/snapuserd.h
new file mode 100644
index 0000000..c01fee3
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd.h
@@ -0,0 +1,141 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <linux/types.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <csignal>
+#include <cstring>
+#include <iostream>
+#include <limits>
+#include <map>
+#include <string>
+#include <thread>
+#include <vector>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
+#include <android-base/unique_fd.h>
+#include <libdm/dm.h>
+#include <libsnapshot/cow_reader.h>
+#include <libsnapshot/cow_writer.h>
+#include <libsnapshot/snapuserd_kernel.h>
+
+namespace android {
+namespace snapshot {
+
+using android::base::unique_fd;
+
+class BufferSink : public IByteSink {
+  public:
+    void Initialize(size_t size);
+    void* GetBufPtr() { return buffer_.get(); }
+    void Clear() { memset(GetBufPtr(), 0, buffer_size_); }
+    void* GetPayloadBuffer(size_t size);
+    void* GetBuffer(size_t requested, size_t* actual) override;
+    void UpdateBufferOffset(size_t size) { buffer_offset_ += size; }
+    struct dm_user_header* GetHeaderPtr();
+    bool ReturnData(void*, size_t) override { return true; }
+    void ResetBufferOffset() { buffer_offset_ = 0; }
+
+  private:
+    std::unique_ptr<uint8_t[]> buffer_;
+    loff_t buffer_offset_;
+    size_t buffer_size_;
+};
+
+class Snapuserd final {
+  public:
+    Snapuserd(const std::string& misc_name, const std::string& cow_device,
+              const std::string& backing_device);
+    bool InitBackingAndControlDevice();
+    bool InitCowDevice();
+    bool Run();
+    const std::string& GetControlDevicePath() { return control_device_; }
+    const std::string& GetMiscName() { return misc_name_; }
+    uint64_t GetNumSectors() { return num_sectors_; }
+    bool IsAttached() const { return ctrl_fd_ >= 0; }
+
+  private:
+    bool DmuserReadRequest();
+    bool DmuserWriteRequest();
+
+    bool ReadDmUserHeader();
+    bool ReadDmUserPayload(void* buffer, size_t size);
+    bool WriteDmUserPayload(size_t size);
+    void ConstructKernelCowHeader();
+    bool ReadMetadata();
+    bool ZerofillDiskExceptions(size_t read_size);
+    bool ReadDiskExceptions(chunk_t chunk, size_t size);
+    int ReadUnalignedSector(sector_t sector, size_t size,
+                            std::map<sector_t, const CowOperation*>::iterator& it);
+    int ReadData(sector_t sector, size_t size);
+    bool IsChunkIdMetadata(chunk_t chunk);
+    chunk_t GetNextAllocatableChunkId(chunk_t chunk_id);
+
+    bool ProcessCowOp(const CowOperation* cow_op);
+    bool ProcessReplaceOp(const CowOperation* cow_op);
+    bool ProcessCopyOp(const CowOperation* cow_op);
+    bool ProcessZeroOp();
+
+    loff_t GetMergeStartOffset(void* merged_buffer, void* unmerged_buffer,
+                               int* unmerged_exceptions);
+    int GetNumberOfMergedOps(void* merged_buffer, void* unmerged_buffer, loff_t offset,
+                             int unmerged_exceptions, bool* copy_op);
+    bool ProcessMergeComplete(chunk_t chunk, void* buffer);
+    sector_t ChunkToSector(chunk_t chunk) { return chunk << CHUNK_SHIFT; }
+    chunk_t SectorToChunk(sector_t sector) { return sector >> CHUNK_SHIFT; }
+    bool IsBlockAligned(int read_size) { return ((read_size & (BLOCK_SIZE - 1)) == 0); }
+
+    std::string cow_device_;
+    std::string backing_store_device_;
+    std::string control_device_;
+    std::string misc_name_;
+
+    unique_fd cow_fd_;
+    unique_fd backing_store_fd_;
+    unique_fd ctrl_fd_;
+
+    uint32_t exceptions_per_area_;
+    uint64_t num_sectors_;
+
+    std::unique_ptr<ICowOpIter> cowop_iter_;
+    std::unique_ptr<ICowOpReverseIter> cowop_riter_;
+    std::unique_ptr<CowReader> reader_;
+    std::unique_ptr<CowWriter> writer_;
+
+    // Vector of disk exception which is a
+    // mapping of old-chunk to new-chunk
+    std::vector<std::unique_ptr<uint8_t[]>> vec_;
+
+    // Key - Sector
+    // Value - cow operation
+    //
+    // chunk_map stores the pseudo mapping of sector
+    // to COW operations. Each COW op is 4k; however,
+    // we can get a read request which are as small
+    // as 512 bytes. Hence, we need to binary search
+    // in the chunk_map to find the nearest COW op.
+    std::map<sector_t, const CowOperation*> chunk_map_;
+
+    bool metadata_read_done_ = false;
+    BufferSink bufsink_;
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapuserd.rc b/fs_mgr/libsnapshot/snapuserd.rc
new file mode 100644
index 0000000..f2d21ac
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd.rc
@@ -0,0 +1,6 @@
+service snapuserd /system/bin/snapuserd
+    socket snapuserd stream 0660 system system
+    oneshot
+    disabled
+    user root
+    group root system
diff --git a/fs_mgr/libsnapshot/snapuserd_client.cpp b/fs_mgr/libsnapshot/snapuserd_client.cpp
new file mode 100644
index 0000000..16d02e4
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd_client.cpp
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <arpa/inet.h>
+#include <cutils/sockets.h>
+#include <errno.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <chrono>
+#include <sstream>
+
+#include <android-base/logging.h>
+#include <android-base/parseint.h>
+#include <android-base/properties.h>
+#include <android-base/strings.h>
+#include <libsnapshot/snapuserd_client.h>
+
+namespace android {
+namespace snapshot {
+
+using namespace std::chrono_literals;
+using android::base::unique_fd;
+
+bool EnsureSnapuserdStarted() {
+    if (android::base::GetProperty("init.svc.snapuserd", "") == "running") {
+        return true;
+    }
+
+    android::base::SetProperty("ctl.start", "snapuserd");
+    if (!android::base::WaitForProperty("init.svc.snapuserd", "running", 10s)) {
+        LOG(ERROR) << "Timed out waiting for snapuserd to start.";
+        return false;
+    }
+    return true;
+}
+
+SnapuserdClient::SnapuserdClient(android::base::unique_fd&& sockfd) : sockfd_(std::move(sockfd)) {}
+
+static inline bool IsRetryErrno() {
+    return errno == ECONNREFUSED || errno == EINTR || errno == ENOENT;
+}
+
+std::unique_ptr<SnapuserdClient> SnapuserdClient::Connect(const std::string& socket_name,
+                                                          std::chrono::milliseconds timeout_ms) {
+    unique_fd fd;
+    auto start = std::chrono::steady_clock::now();
+    while (true) {
+        fd.reset(socket_local_client(socket_name.c_str(), ANDROID_SOCKET_NAMESPACE_RESERVED,
+                                     SOCK_STREAM));
+        if (fd >= 0) break;
+        if (fd < 0 && !IsRetryErrno()) {
+            PLOG(ERROR) << "connect failed: " << socket_name;
+            return nullptr;
+        }
+
+        auto now = std::chrono::steady_clock::now();
+        auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(now - start);
+        if (elapsed >= timeout_ms) {
+            LOG(ERROR) << "Timed out connecting to snapuserd socket: " << socket_name;
+            return nullptr;
+        }
+
+        std::this_thread::sleep_for(100ms);
+    }
+
+    auto client = std::make_unique<SnapuserdClient>(std::move(fd));
+    if (!client->ValidateConnection()) {
+        return nullptr;
+    }
+    return client;
+}
+
+bool SnapuserdClient::ValidateConnection() {
+    if (!Sendmsg("query")) {
+        return false;
+    }
+
+    std::string str = Receivemsg();
+
+    // If the daemon is passive then fallback to secondary active daemon. Daemon
+    // is passive during transition phase.
+    if (str.find("passive") != std::string::npos) {
+        LOG(ERROR) << "Snapuserd is terminating";
+        return false;
+    }
+
+    if (str != "active") {
+        LOG(ERROR) << "Received failure querying daemon";
+        return false;
+    }
+    return true;
+}
+
+bool SnapuserdClient::Sendmsg(const std::string& msg) {
+    LOG(DEBUG) << "Sendmsg: msg " << msg << " sockfd: " << sockfd_;
+    ssize_t numBytesSent = TEMP_FAILURE_RETRY(send(sockfd_, msg.data(), msg.size(), 0));
+    if (numBytesSent < 0) {
+        PLOG(ERROR) << "Send failed";
+        return false;
+    }
+
+    if ((size_t)numBytesSent < msg.size()) {
+        LOG(ERROR) << "Partial data sent, expected " << msg.size() << " bytes, sent "
+                   << numBytesSent;
+        return false;
+    }
+    return true;
+}
+
+bool SnapuserdClient::WaitForDeviceDelete(const std::string& control_device) {
+    std::string msg = "delete," + control_device;
+    if (!Sendmsg(msg)) {
+        LOG(ERROR) << "Failed to send message " << msg << " to snapuserd";
+        return false;
+    }
+    std::string response = Receivemsg();
+    if (response != "success") {
+        LOG(ERROR) << "Failed waiting to delete device " << control_device;
+        return false;
+    }
+    return true;
+}
+
+std::string SnapuserdClient::Receivemsg() {
+    char msg[PACKET_SIZE];
+    ssize_t ret = TEMP_FAILURE_RETRY(recv(sockfd_, msg, sizeof(msg), 0));
+    if (ret < 0) {
+        PLOG(ERROR) << "Snapuserd:client: recv failed";
+        return {};
+    }
+    if (ret == 0) {
+        LOG(DEBUG) << "Snapuserd:client disconnected";
+        return {};
+    }
+    return std::string(msg, ret);
+}
+
+bool SnapuserdClient::StopSnapuserd() {
+    if (!Sendmsg("stop")) {
+        LOG(ERROR) << "Failed to send stop message to snapuserd daemon";
+        return false;
+    }
+
+    sockfd_ = {};
+    return true;
+}
+
+bool SnapuserdClient::AttachDmUser(const std::string& misc_name) {
+    std::string msg = "start," + misc_name;
+    if (!Sendmsg(msg)) {
+        LOG(ERROR) << "Failed to send message " << msg << " to snapuserd daemon";
+        return false;
+    }
+
+    std::string str = Receivemsg();
+    if (str != "success") {
+        LOG(ERROR) << "Failed to receive ack for " << msg << " from snapuserd daemon";
+        return false;
+    }
+
+    LOG(DEBUG) << "Snapuserd daemon initialized with " << msg;
+    return true;
+}
+
+uint64_t SnapuserdClient::InitDmUserCow(const std::string& misc_name, const std::string& cow_device,
+                                        const std::string& backing_device) {
+    std::vector<std::string> parts = {"init", misc_name, cow_device, backing_device};
+    std::string msg = android::base::Join(parts, ",");
+    if (!Sendmsg(msg)) {
+        LOG(ERROR) << "Failed to send message " << msg << " to snapuserd daemon";
+        return 0;
+    }
+
+    std::string str = Receivemsg();
+
+    std::vector<std::string> input = android::base::Split(str, ",");
+
+    if (input.empty() || input[0] != "success") {
+        LOG(ERROR) << "Failed to receive number of sectors for " << msg << " from snapuserd daemon";
+        return 0;
+    }
+
+    LOG(DEBUG) << "Snapuserd daemon COW device initialized: " << cow_device
+               << " Num-sectors: " << input[1];
+
+    uint64_t num_sectors = 0;
+    if (!android::base::ParseUint(input[1], &num_sectors)) {
+        LOG(ERROR) << "Failed to parse input string to sectors";
+        return 0;
+    }
+    return num_sectors;
+}
+
+bool SnapuserdClient::DetachSnapuserd() {
+    if (!Sendmsg("detach")) {
+        LOG(ERROR) << "Failed to detach snapuserd.";
+        return false;
+    }
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapuserd_daemon.cpp b/fs_mgr/libsnapshot/snapuserd_daemon.cpp
new file mode 100644
index 0000000..7fa01b7
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd_daemon.cpp
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "snapuserd_daemon.h"
+
+#include <android-base/logging.h>
+#include <android-base/strings.h>
+#include <gflags/gflags.h>
+#include <libsnapshot/snapuserd_client.h>
+
+#include "snapuserd_server.h"
+
+DEFINE_string(socket, android::snapshot::kSnapuserdSocket, "Named socket or socket path.");
+DEFINE_bool(no_socket, false,
+            "If true, no socket is used. Each additional argument is an INIT message.");
+
+namespace android {
+namespace snapshot {
+
+bool Daemon::StartServer(int argc, char** argv) {
+    int arg_start = gflags::ParseCommandLineFlags(&argc, &argv, true);
+
+    if (!FLAGS_no_socket) {
+        return server_.Start(FLAGS_socket);
+    }
+
+    for (int i = arg_start; i < argc; i++) {
+        auto parts = android::base::Split(argv[i], ",");
+        if (parts.size() != 3) {
+            LOG(ERROR) << "Malformed message, expected three sub-arguments.";
+            return false;
+        }
+        auto handler = server_.AddHandler(parts[0], parts[1], parts[2]);
+        if (!handler || !server_.StartHandler(handler)) {
+            return false;
+        }
+    }
+
+    // Skip the accept() call to avoid spurious log spam. The server will still
+    // run until all handlers have completed.
+    server_.SetTerminating();
+    return true;
+}
+
+void Daemon::MaskAllSignalsExceptIntAndTerm() {
+    sigset_t signal_mask;
+    sigfillset(&signal_mask);
+    sigdelset(&signal_mask, SIGINT);
+    sigdelset(&signal_mask, SIGTERM);
+    sigdelset(&signal_mask, SIGPIPE);
+    if (sigprocmask(SIG_SETMASK, &signal_mask, NULL) != 0) {
+        PLOG(ERROR) << "Failed to set sigprocmask";
+    }
+}
+
+void Daemon::MaskAllSignals() {
+    sigset_t signal_mask;
+    sigfillset(&signal_mask);
+    if (sigprocmask(SIG_SETMASK, &signal_mask, NULL) != 0) {
+        PLOG(ERROR) << "Couldn't mask all signals";
+    }
+}
+
+void Daemon::Run() {
+    sigfillset(&signal_mask_);
+    sigdelset(&signal_mask_, SIGINT);
+    sigdelset(&signal_mask_, SIGTERM);
+
+    // Masking signals here ensure that after this point, we won't handle INT/TERM
+    // until after we call into ppoll()
+    signal(SIGINT, Daemon::SignalHandler);
+    signal(SIGTERM, Daemon::SignalHandler);
+    signal(SIGPIPE, Daemon::SignalHandler);
+
+    LOG(DEBUG) << "Snapuserd-server: ready to accept connections";
+
+    MaskAllSignalsExceptIntAndTerm();
+
+    server_.Run();
+}
+
+void Daemon::Interrupt() {
+    server_.Interrupt();
+}
+
+void Daemon::SignalHandler(int signal) {
+    LOG(DEBUG) << "Snapuserd received signal: " << signal;
+    switch (signal) {
+        case SIGINT:
+        case SIGTERM: {
+            Daemon::Instance().Interrupt();
+            break;
+        }
+        case SIGPIPE: {
+            LOG(ERROR) << "Received SIGPIPE signal";
+            break;
+        }
+        default:
+            LOG(ERROR) << "Received unknown signal " << signal;
+            break;
+    }
+}
+
+}  // namespace snapshot
+}  // namespace android
+
+int main(int argc, char** argv) {
+    android::base::InitLogging(argv, &android::base::KernelLogger);
+
+    android::snapshot::Daemon& daemon = android::snapshot::Daemon::Instance();
+
+    if (!daemon.StartServer(argc, argv)) {
+        LOG(ERROR) << "Snapuserd daemon failed to start.";
+        exit(EXIT_FAILURE);
+    }
+    daemon.Run();
+
+    return 0;
+}
diff --git a/fs_mgr/libsnapshot/snapuserd_daemon.h b/fs_mgr/libsnapshot/snapuserd_daemon.h
new file mode 100644
index 0000000..f8afac5
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd_daemon.h
@@ -0,0 +1,56 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <poll.h>
+
+#include <string>
+#include <vector>
+
+#include "snapuserd_server.h"
+
+namespace android {
+namespace snapshot {
+
+class Daemon {
+    // The Daemon class is a singleton to avoid
+    // instantiating more than once
+  public:
+    Daemon() {}
+
+    static Daemon& Instance() {
+        static Daemon instance;
+        return instance;
+    }
+
+    bool StartServer(int argc, char** argv);
+    void Run();
+    void Interrupt();
+
+  private:
+    // Signal mask used with ppoll()
+    sigset_t signal_mask_;
+
+    Daemon(Daemon const&) = delete;
+    void operator=(Daemon const&) = delete;
+
+    SnapuserdServer server_;
+    void MaskAllSignalsExceptIntAndTerm();
+    void MaskAllSignals();
+    static void SignalHandler(int signal);
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapuserd_server.cpp b/fs_mgr/libsnapshot/snapuserd_server.cpp
new file mode 100644
index 0000000..38abaec
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd_server.cpp
@@ -0,0 +1,413 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <arpa/inet.h>
+#include <cutils/sockets.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <android-base/logging.h>
+
+#include "snapuserd.h"
+#include "snapuserd_server.h"
+
+namespace android {
+namespace snapshot {
+
+DaemonOperations SnapuserdServer::Resolveop(std::string& input) {
+    if (input == "init") return DaemonOperations::INIT;
+    if (input == "start") return DaemonOperations::START;
+    if (input == "stop") return DaemonOperations::STOP;
+    if (input == "query") return DaemonOperations::QUERY;
+    if (input == "delete") return DaemonOperations::DELETE;
+    if (input == "detach") return DaemonOperations::DETACH;
+
+    return DaemonOperations::INVALID;
+}
+
+SnapuserdServer::~SnapuserdServer() {
+    // Close any client sockets that were added via AcceptClient().
+    for (size_t i = 1; i < watched_fds_.size(); i++) {
+        close(watched_fds_[i].fd);
+    }
+}
+
+std::string SnapuserdServer::GetDaemonStatus() {
+    std::string msg = "";
+
+    if (IsTerminating())
+        msg = "passive";
+    else
+        msg = "active";
+
+    return msg;
+}
+
+void SnapuserdServer::Parsemsg(std::string const& msg, const char delim,
+                               std::vector<std::string>& out) {
+    std::stringstream ss(msg);
+    std::string s;
+
+    while (std::getline(ss, s, delim)) {
+        out.push_back(s);
+    }
+}
+
+void SnapuserdServer::ShutdownThreads() {
+    StopThreads();
+    JoinAllThreads();
+}
+
+DmUserHandler::DmUserHandler(std::unique_ptr<Snapuserd>&& snapuserd)
+    : snapuserd_(std::move(snapuserd)), misc_name_(snapuserd_->GetMiscName()) {}
+
+bool SnapuserdServer::Sendmsg(android::base::borrowed_fd fd, const std::string& msg) {
+    ssize_t ret = TEMP_FAILURE_RETRY(send(fd.get(), msg.data(), msg.size(), 0));
+    if (ret < 0) {
+        PLOG(ERROR) << "Snapuserd:server: send() failed";
+        return false;
+    }
+
+    if (ret < msg.size()) {
+        LOG(ERROR) << "Partial send; expected " << msg.size() << " bytes, sent " << ret;
+        return false;
+    }
+    return true;
+}
+
+bool SnapuserdServer::Recv(android::base::borrowed_fd fd, std::string* data) {
+    char msg[MAX_PACKET_SIZE];
+    ssize_t rv = TEMP_FAILURE_RETRY(recv(fd.get(), msg, sizeof(msg), 0));
+    if (rv < 0) {
+        PLOG(ERROR) << "recv failed";
+        return false;
+    }
+    *data = std::string(msg, rv);
+    return true;
+}
+
+bool SnapuserdServer::Receivemsg(android::base::borrowed_fd fd, const std::string& str) {
+    const char delim = ',';
+
+    std::vector<std::string> out;
+    Parsemsg(str, delim, out);
+    DaemonOperations op = Resolveop(out[0]);
+
+    switch (op) {
+        case DaemonOperations::INIT: {
+            // Message format:
+            // init,<misc_name>,<cow_device_path>,<backing_device>
+            //
+            // Reads the metadata and send the number of sectors
+            if (out.size() != 4) {
+                LOG(ERROR) << "Malformed init message, " << out.size() << " parts";
+                return Sendmsg(fd, "fail");
+            }
+
+            auto handler = AddHandler(out[1], out[2], out[3]);
+            if (!handler) {
+                return Sendmsg(fd, "fail");
+            }
+
+            auto retval = "success," + std::to_string(handler->snapuserd()->GetNumSectors());
+            return Sendmsg(fd, retval);
+        }
+        case DaemonOperations::START: {
+            // Message format:
+            // start,<misc_name>
+            //
+            // Start the new thread which binds to dm-user misc device
+            if (out.size() != 2) {
+                LOG(ERROR) << "Malformed start message, " << out.size() << " parts";
+                return Sendmsg(fd, "fail");
+            }
+
+            std::lock_guard<std::mutex> lock(lock_);
+            auto iter = FindHandler(&lock, out[1]);
+            if (iter == dm_users_.end()) {
+                LOG(ERROR) << "Could not find handler: " << out[1];
+                return Sendmsg(fd, "fail");
+            }
+            if (!(*iter)->snapuserd() || (*iter)->snapuserd()->IsAttached()) {
+                LOG(ERROR) << "Tried to re-attach control device: " << out[1];
+                return Sendmsg(fd, "fail");
+            }
+            if (!StartHandler(*iter)) {
+                return Sendmsg(fd, "fail");
+            }
+            return Sendmsg(fd, "success");
+        }
+        case DaemonOperations::STOP: {
+            // Message format: stop
+            //
+            // Stop all the threads gracefully and then shutdown the
+            // main thread
+            SetTerminating();
+            ShutdownThreads();
+            return true;
+        }
+        case DaemonOperations::QUERY: {
+            // Message format: query
+            //
+            // As part of transition, Second stage daemon will be
+            // created before terminating the first stage daemon. Hence,
+            // for a brief period client may have to distiguish between
+            // first stage daemon and second stage daemon.
+            //
+            // Second stage daemon is marked as active and hence will
+            // be ready to receive control message.
+            return Sendmsg(fd, GetDaemonStatus());
+        }
+        case DaemonOperations::DELETE: {
+            // Message format:
+            // delete,<misc_name>
+            if (out.size() != 2) {
+                LOG(ERROR) << "Malformed delete message, " << out.size() << " parts";
+                return Sendmsg(fd, "fail");
+            }
+            if (!RemoveAndJoinHandler(out[1])) {
+                return Sendmsg(fd, "fail");
+            }
+            return Sendmsg(fd, "success");
+        }
+        case DaemonOperations::DETACH: {
+            terminating_ = true;
+            return Sendmsg(fd, "success");
+        }
+        default: {
+            LOG(ERROR) << "Received unknown message type from client";
+            Sendmsg(fd, "fail");
+            return false;
+        }
+    }
+}
+
+void SnapuserdServer::RunThread(std::shared_ptr<DmUserHandler> handler) {
+    LOG(INFO) << "Entering thread for handler: " << handler->misc_name();
+
+    while (!StopRequested()) {
+        if (!handler->snapuserd()->Run()) {
+            break;
+        }
+    }
+
+    auto misc_name = handler->misc_name();
+    LOG(INFO) << "Handler thread about to exit: " << misc_name;
+
+    {
+        std::lock_guard<std::mutex> lock(lock_);
+        auto iter = FindHandler(&lock, handler->misc_name());
+        if (iter == dm_users_.end()) {
+            // RemoveAndJoinHandler() already removed us from the list, and is
+            // now waiting on a join(), so just return.
+            LOG(INFO) << "Exiting handler thread to allow for join: " << misc_name;
+            return;
+        }
+
+        LOG(INFO) << "Exiting handler thread and freeing resources: " << misc_name;
+
+        if (handler->snapuserd()->IsAttached()) {
+            handler->thread().detach();
+        }
+
+        // Important: free resources within the lock. This ensures that if
+        // WaitForDelete() is called, the handler is either in the list, or
+        // it's not and its resources are guaranteed to be freed.
+        handler->FreeResources();
+    }
+}
+
+bool SnapuserdServer::Start(const std::string& socketname) {
+    sockfd_.reset(android_get_control_socket(socketname.c_str()));
+    if (sockfd_ >= 0) {
+        if (listen(sockfd_.get(), 4) < 0) {
+            PLOG(ERROR) << "listen socket failed: " << socketname;
+            return false;
+        }
+    } else {
+        sockfd_.reset(socket_local_server(socketname.c_str(), ANDROID_SOCKET_NAMESPACE_RESERVED,
+                                          SOCK_STREAM));
+        if (sockfd_ < 0) {
+            PLOG(ERROR) << "Failed to create server socket " << socketname;
+            return false;
+        }
+    }
+
+    AddWatchedFd(sockfd_);
+
+    LOG(DEBUG) << "Snapuserd server successfully started with socket name " << socketname;
+    return true;
+}
+
+bool SnapuserdServer::Run() {
+    while (!IsTerminating()) {
+        int rv = TEMP_FAILURE_RETRY(poll(watched_fds_.data(), watched_fds_.size(), -1));
+        if (rv < 0) {
+            PLOG(ERROR) << "poll failed";
+            return false;
+        }
+        if (!rv) {
+            continue;
+        }
+
+        if (watched_fds_[0].revents) {
+            AcceptClient();
+        }
+
+        auto iter = watched_fds_.begin() + 1;
+        while (iter != watched_fds_.end()) {
+            if (iter->revents && !HandleClient(iter->fd, iter->revents)) {
+                close(iter->fd);
+                iter = watched_fds_.erase(iter);
+            } else {
+                iter++;
+            }
+        }
+    }
+
+    JoinAllThreads();
+    return true;
+}
+
+void SnapuserdServer::JoinAllThreads() {
+    // Acquire the thread list within the lock.
+    std::vector<std::shared_ptr<DmUserHandler>> dm_users;
+    {
+        std::lock_guard<std::mutex> guard(lock_);
+        dm_users = std::move(dm_users_);
+    }
+
+    for (auto& client : dm_users) {
+        auto& th = client->thread();
+
+        if (th.joinable()) th.join();
+    }
+}
+
+void SnapuserdServer::AddWatchedFd(android::base::borrowed_fd fd) {
+    struct pollfd p = {};
+    p.fd = fd.get();
+    p.events = POLLIN;
+    watched_fds_.emplace_back(std::move(p));
+}
+
+void SnapuserdServer::AcceptClient() {
+    int fd = TEMP_FAILURE_RETRY(accept4(sockfd_.get(), nullptr, nullptr, SOCK_CLOEXEC));
+    if (fd < 0) {
+        PLOG(ERROR) << "accept4 failed";
+        return;
+    }
+
+    AddWatchedFd(fd);
+}
+
+bool SnapuserdServer::HandleClient(android::base::borrowed_fd fd, int revents) {
+    if (revents & POLLHUP) {
+        LOG(DEBUG) << "Snapuserd client disconnected";
+        return false;
+    }
+
+    std::string str;
+    if (!Recv(fd, &str)) {
+        return false;
+    }
+    if (!Receivemsg(fd, str)) {
+        LOG(ERROR) << "Encountered error handling client message, revents: " << revents;
+        return false;
+    }
+    return true;
+}
+
+void SnapuserdServer::Interrupt() {
+    // Force close the socket so poll() fails.
+    sockfd_ = {};
+    SetTerminating();
+}
+
+std::shared_ptr<DmUserHandler> SnapuserdServer::AddHandler(const std::string& misc_name,
+                                                           const std::string& cow_device_path,
+                                                           const std::string& backing_device) {
+    auto snapuserd = std::make_unique<Snapuserd>(misc_name, cow_device_path, backing_device);
+    if (!snapuserd->InitCowDevice()) {
+        LOG(ERROR) << "Failed to initialize Snapuserd";
+        return nullptr;
+    }
+
+    auto handler = std::make_shared<DmUserHandler>(std::move(snapuserd));
+    {
+        std::lock_guard<std::mutex> lock(lock_);
+        if (FindHandler(&lock, misc_name) != dm_users_.end()) {
+            LOG(ERROR) << "Handler already exists: " << misc_name;
+            return nullptr;
+        }
+        dm_users_.push_back(handler);
+    }
+    return handler;
+}
+
+bool SnapuserdServer::StartHandler(const std::shared_ptr<DmUserHandler>& handler) {
+    CHECK(!handler->snapuserd()->IsAttached());
+
+    if (!handler->snapuserd()->InitBackingAndControlDevice()) {
+        LOG(ERROR) << "Failed to initialize control device: " << handler->misc_name();
+        return false;
+    }
+
+    handler->thread() = std::thread(std::bind(&SnapuserdServer::RunThread, this, handler));
+    return true;
+}
+
+auto SnapuserdServer::FindHandler(std::lock_guard<std::mutex>* proof_of_lock,
+                                  const std::string& misc_name) -> HandlerList::iterator {
+    CHECK(proof_of_lock);
+
+    for (auto iter = dm_users_.begin(); iter != dm_users_.end(); iter++) {
+        if ((*iter)->misc_name() == misc_name) {
+            return iter;
+        }
+    }
+    return dm_users_.end();
+}
+
+bool SnapuserdServer::RemoveAndJoinHandler(const std::string& misc_name) {
+    std::shared_ptr<DmUserHandler> handler;
+    {
+        std::lock_guard<std::mutex> lock(lock_);
+
+        auto iter = FindHandler(&lock, misc_name);
+        if (iter == dm_users_.end()) {
+            // Client already deleted.
+            return true;
+        }
+        handler = std::move(*iter);
+        dm_users_.erase(iter);
+    }
+
+    auto& th = handler->thread();
+    if (th.joinable()) {
+        th.join();
+    }
+    return true;
+}
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/snapuserd_server.h b/fs_mgr/libsnapshot/snapuserd_server.h
new file mode 100644
index 0000000..7cbc2de
--- /dev/null
+++ b/fs_mgr/libsnapshot/snapuserd_server.h
@@ -0,0 +1,134 @@
+// Copyright (C) 2020 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.
+
+#pragma once
+
+#include <poll.h>
+
+#include <cstdio>
+#include <cstring>
+#include <functional>
+#include <future>
+#include <iostream>
+#include <mutex>
+#include <sstream>
+#include <string>
+#include <thread>
+#include <vector>
+
+#include <android-base/unique_fd.h>
+#include "snapuserd.h"
+
+namespace android {
+namespace snapshot {
+
+static constexpr uint32_t MAX_PACKET_SIZE = 512;
+
+enum class DaemonOperations {
+    INIT,
+    START,
+    QUERY,
+    STOP,
+    DELETE,
+    DETACH,
+    INVALID,
+};
+
+class DmUserHandler {
+  public:
+    explicit DmUserHandler(std::unique_ptr<Snapuserd>&& snapuserd);
+
+    void FreeResources() { snapuserd_ = nullptr; }
+    const std::unique_ptr<Snapuserd>& snapuserd() const { return snapuserd_; }
+    std::thread& thread() { return thread_; }
+
+    const std::string& misc_name() const { return misc_name_; }
+
+  private:
+    std::thread thread_;
+    std::unique_ptr<Snapuserd> snapuserd_;
+    std::string misc_name_;
+};
+
+class Stoppable {
+    std::promise<void> exitSignal_;
+    std::future<void> futureObj_;
+
+  public:
+    Stoppable() : futureObj_(exitSignal_.get_future()) {}
+
+    virtual ~Stoppable() {}
+
+    bool StopRequested() {
+        // checks if value in future object is available
+        if (futureObj_.wait_for(std::chrono::milliseconds(0)) == std::future_status::timeout) {
+            return false;
+        }
+        return true;
+    }
+    // Request the thread to stop by setting value in promise object
+    void StopThreads() { exitSignal_.set_value(); }
+};
+
+class SnapuserdServer : public Stoppable {
+  private:
+    android::base::unique_fd sockfd_;
+    bool terminating_;
+    std::vector<struct pollfd> watched_fds_;
+
+    std::mutex lock_;
+
+    using HandlerList = std::vector<std::shared_ptr<DmUserHandler>>;
+    HandlerList dm_users_;
+
+    void AddWatchedFd(android::base::borrowed_fd fd);
+    void AcceptClient();
+    bool HandleClient(android::base::borrowed_fd fd, int revents);
+    bool Recv(android::base::borrowed_fd fd, std::string* data);
+    bool Sendmsg(android::base::borrowed_fd fd, const std::string& msg);
+    bool Receivemsg(android::base::borrowed_fd fd, const std::string& str);
+
+    void ShutdownThreads();
+    bool RemoveAndJoinHandler(const std::string& control_device);
+    DaemonOperations Resolveop(std::string& input);
+    std::string GetDaemonStatus();
+    void Parsemsg(std::string const& msg, const char delim, std::vector<std::string>& out);
+
+    bool IsTerminating() { return terminating_; }
+
+    void RunThread(std::shared_ptr<DmUserHandler> handler);
+    void JoinAllThreads();
+
+    // Find a DmUserHandler within a lock.
+    HandlerList::iterator FindHandler(std::lock_guard<std::mutex>* proof_of_lock,
+                                      const std::string& misc_name);
+
+  public:
+    SnapuserdServer() { terminating_ = false; }
+    ~SnapuserdServer();
+
+    bool Start(const std::string& socketname);
+    bool Run();
+    void Interrupt();
+
+    std::shared_ptr<DmUserHandler> AddHandler(const std::string& misc_name,
+                                              const std::string& cow_device_path,
+                                              const std::string& backing_device);
+    bool StartHandler(const std::shared_ptr<DmUserHandler>& handler);
+
+    void SetTerminating() { terminating_ = true; }
+};
+
+}  // namespace snapshot
+}  // namespace android
diff --git a/fs_mgr/libsnapshot/test_helpers.cpp b/fs_mgr/libsnapshot/test_helpers.cpp
index b07bf91..e3e3af8 100644
--- a/fs_mgr/libsnapshot/test_helpers.cpp
+++ b/fs_mgr/libsnapshot/test_helpers.cpp
@@ -23,6 +23,7 @@
 #include <android-base/unique_fd.h>
 #include <gtest/gtest.h>
 #include <openssl/sha.h>
+#include <payload_consumer/file_descriptor.h>
 
 namespace android {
 namespace snapshot {
@@ -127,6 +128,79 @@
     return true;
 }
 
+bool WriteRandomData(ICowWriter* writer, std::string* hash) {
+    unique_fd rand(open("/dev/urandom", O_RDONLY));
+    if (rand < 0) {
+        PLOG(ERROR) << "open /dev/urandom";
+        return false;
+    }
+
+    SHA256_CTX ctx;
+    if (hash) {
+        SHA256_Init(&ctx);
+    }
+
+    if (!writer->options().max_blocks) {
+        LOG(ERROR) << "CowWriter must specify maximum number of blocks";
+        return false;
+    }
+    uint64_t num_blocks = writer->options().max_blocks.value();
+
+    size_t block_size = writer->options().block_size;
+    std::string block(block_size, '\0');
+    for (uint64_t i = 0; i < num_blocks; i++) {
+        if (!ReadFully(rand, block.data(), block.size())) {
+            PLOG(ERROR) << "read /dev/urandom";
+            return false;
+        }
+        if (!writer->AddRawBlocks(i, block.data(), block.size())) {
+            LOG(ERROR) << "Failed to add raw block " << i;
+            return false;
+        }
+        if (hash) {
+            SHA256_Update(&ctx, block.data(), block.size());
+        }
+    }
+
+    if (hash) {
+        uint8_t out[32];
+        SHA256_Final(out, &ctx);
+        *hash = ToHexString(out, sizeof(out));
+    }
+    return true;
+}
+
+std::string HashSnapshot(ISnapshotWriter* writer) {
+    auto reader = writer->OpenReader();
+    if (!reader) {
+        return {};
+    }
+
+    SHA256_CTX ctx;
+    SHA256_Init(&ctx);
+
+    uint64_t remaining = reader->BlockDevSize();
+    char buffer[4096];
+    while (remaining) {
+        size_t to_read =
+                static_cast<size_t>(std::min(remaining, static_cast<uint64_t>(sizeof(buffer))));
+        ssize_t read = reader->Read(&buffer, to_read);
+        if (read <= 0) {
+            if (read < 0) {
+                LOG(ERROR) << "Failed to read from snapshot writer";
+                return {};
+            }
+            break;
+        }
+        SHA256_Update(&ctx, buffer, to_read);
+        remaining -= static_cast<size_t>(read);
+    }
+
+    uint8_t out[32];
+    SHA256_Final(out, &ctx);
+    return ToHexString(out, sizeof(out));
+}
+
 std::optional<std::string> GetHash(const std::string& path) {
     std::string content;
     if (!android::base::ReadFileToString(path, &content, true)) {
diff --git a/fs_mgr/libsnapshot/update_engine/update_metadata.proto b/fs_mgr/libsnapshot/update_engine/update_metadata.proto
new file mode 100644
index 0000000..4a97f81
--- /dev/null
+++ b/fs_mgr/libsnapshot/update_engine/update_metadata.proto
@@ -0,0 +1,83 @@
+//
+// Copyright (C) 2020 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.
+//
+
+// A subset of system/update_engine/update_metadata.proto. A separate file is
+// used here because:
+// - The original file is optimized for LITE_RUNTIME, but fuzzing needs
+// reflection.
+// - The definition here has less fields. libsnapshot only uses fields declared
+// here, and all fields declared here are fuzzed by libsnapshot_fuzzer. If
+// libsnapshot uses more fields in system/update_engine/update_metadata.proto
+// in the future, they must be added here too, otherwise it will fail to
+// compile.
+//
+// It is okay that this file is older than
+// system/update_engine/update_metadata.proto as long as the messages defined
+// here can also be parsed by protobuf defined there. However, it is not
+// okay to add fields here without adding them to
+// system/update_engine/update_metadata.proto. Doing so will cause a compiler
+// error when libsnapshot code starts to use these dangling fields.
+
+syntax = "proto2";
+
+package chromeos_update_engine;
+
+message Extent {
+    optional uint64 start_block = 1;
+    optional uint64 num_blocks = 2;
+}
+
+message PartitionInfo {
+    optional uint64 size = 1;
+}
+
+message InstallOperation {
+    enum Type {
+        SOURCE_COPY = 4;
+        // Not used by libsnapshot. Declared here so that the fuzzer has an
+        // alternative value to use for |type|.
+        ZERO = 6;
+    }
+    required Type type = 1;
+    repeated Extent src_extents = 4;
+    repeated Extent dst_extents = 6;
+}
+
+message PartitionUpdate {
+    required string partition_name = 1;
+    optional PartitionInfo new_partition_info = 7;
+    repeated InstallOperation operations = 8;
+    optional Extent hash_tree_extent = 11;
+    optional Extent fec_extent = 15;
+    optional uint64 estimate_cow_size = 19;
+}
+
+message DynamicPartitionGroup {
+    required string name = 1;
+    optional uint64 size = 2;
+    repeated string partition_names = 3;
+}
+
+message DynamicPartitionMetadata {
+    repeated DynamicPartitionGroup groups = 1;
+    optional bool vabc_enabled = 3;
+}
+
+message DeltaArchiveManifest {
+    repeated PartitionUpdate partitions = 13;
+    optional DynamicPartitionMetadata dynamic_partition_metadata = 15;
+    optional bool partial_update = 16;
+}
diff --git a/fs_mgr/libsnapshot/utility.cpp b/fs_mgr/libsnapshot/utility.cpp
index d32b61e..4a2af1c 100644
--- a/fs_mgr/libsnapshot/utility.cpp
+++ b/fs_mgr/libsnapshot/utility.cpp
@@ -22,6 +22,7 @@
 
 #include <android-base/file.h>
 #include <android-base/logging.h>
+#include <android-base/properties.h>
 #include <android-base/strings.h>
 #include <fs_mgr/roots.h>
 
@@ -91,7 +92,7 @@
     }
 }
 
-Return InitializeCow(const std::string& device) {
+Return InitializeKernelCow(const std::string& device) {
     // When the kernel creates a persistent dm-snapshot, it requires a CoW file
     // to store the modifications. The kernel interface does not specify how
     // the CoW is used, and there is no standard associated.
@@ -182,5 +183,17 @@
     new_extent->set_num_blocks(num_blocks);
 }
 
+bool IsCompressionEnabled() {
+    return android::base::GetBoolProperty("ro.virtual_ab.compression.enabled", false);
+}
+
+std::string GetOtherPartitionName(const std::string& name) {
+    auto suffix = android::fs_mgr::GetPartitionSlotSuffix(name);
+    CHECK(suffix == "_a" || suffix == "_b");
+
+    auto other_suffix = (suffix == "_a") ? "_b" : "_a";
+    return name.substr(0, name.size() - suffix.size()) + other_suffix;
+}
+
 }  // namespace snapshot
 }  // namespace android
diff --git a/fs_mgr/libsnapshot/utility.h b/fs_mgr/libsnapshot/utility.h
index e69bdad..671de9d 100644
--- a/fs_mgr/libsnapshot/utility.h
+++ b/fs_mgr/libsnapshot/utility.h
@@ -112,7 +112,7 @@
         android::fs_mgr::MetadataBuilder* builder, const std::string& suffix);
 
 // Initialize a device before using it as the COW device for a dm-snapshot device.
-Return InitializeCow(const std::string& device);
+Return InitializeKernelCow(const std::string& device);
 
 // "Atomically" write string to file. This is done by a series of actions:
 // 1. Write to path + ".tmp"
@@ -129,5 +129,10 @@
 void AppendExtent(google::protobuf::RepeatedPtrField<chromeos_update_engine::Extent>* extents,
                   uint64_t start_block, uint64_t num_blocks);
 
+bool IsCompressionEnabled();
+
+// Swap the suffix of a partition name.
+std::string GetOtherPartitionName(const std::string& name);
+
 }  // namespace snapshot
 }  // namespace android
diff --git a/fs_mgr/libvbmeta/Android.bp b/fs_mgr/libvbmeta/Android.bp
index bceabab..a299b6e 100644
--- a/fs_mgr/libvbmeta/Android.bp
+++ b/fs_mgr/libvbmeta/Android.bp
@@ -50,4 +50,11 @@
         "avbtool",
         "vbmake",
     ],
-}
\ No newline at end of file
+    data: [
+        "data/*",
+    ],
+    // Not unit tests due to several binary and lib dependencies currently hard to replicate in continuous execution
+    test_options: {
+        unit_test: false,
+    },
+}
diff --git a/fs_mgr/libvbmeta/data/testkey_rsa2048.pem b/fs_mgr/libvbmeta/data/testkey_rsa2048.pem
new file mode 100644
index 0000000..867dcff
--- /dev/null
+++ b/fs_mgr/libvbmeta/data/testkey_rsa2048.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAxlVR3TIkouAOvH79vaJTgFhpfvVKQIeVkFRZPVXK/zY0Gvrh
+4JAqGjJoW/PfrQv5sdD36qtHH3a+G5hLZ6Ni+t/mtfjucxZfuLGC3kmJ1T3XqEKZ
+gXXI2IR7vVSoImREvDQGEDyJwtHzLANlkbGg0cghVhWZSCAndO8BenalC2v94/rt
+DfkPekH6dgU3Sf40T0sBSeSY94mOzTaqOR2pfV1rWlLRdWmo33zeHBv52Rlbt0dM
+uXAureXWiHztkm5GCBC1dgM+CaxNtizNEgC91KcD0xuRCCM2WxH+r1lpszyIJDct
+YbrFmVEYl/kjQpafhy7Nsk1fqSTyRdriZSYmTQIDAQABAoIBAQC+kJgaCuX8wYAn
+SXWQ0fmdZlXnMNRpcF0a0pD0SAzGb1RdYBXMaXiqtyhiwc53PPxsCDdNecjayIMd
+jJVXPTwLhTruOgMS/bp3gcgWwV34UHV4LJXGOGAE+jbS0hbDBMiudOYmj6RmVshp
+z9G1zZCSQNMXHaWsEYkX59XpzzoB384nRul2QgEtwzUNR9XlpzgtJBLk3SACkvsN
+mQ/DW8IWHXLg8vLn1LzVJ2e3B16H4MoE2TCHxqfMgr03IDRRJogkenQuQsFhevYT
+o/mJyHSWavVgzMHG9I5m+eepF4Wyhj1Y4WyKAuMI+9dHAX/h7Lt8XFCQCh5DbkVG
+zGr34sWBAoGBAOs7n7YZqNaaguovfIdRRsxxZr1yJAyDsr6w3yGImDZYju4c4WY9
+5esO2kP3FA4p0c7FhQF5oOb1rBuHEPp36cpL4aGeK87caqTfq63WZAujoTZpr9Lp
+BRbkL7w/xG7jpQ/clpA8sHzHGQs/nelxoOtC7E118FiRgvD/jdhlMyL9AoGBANfX
+vyoN1pplfT2xR8QOjSZ+Q35S/+SAtMuBnHx3l0qH2bbBjcvM1MNDWjnRDyaYhiRu
+i+KA7tqfib09+XpB3g5D6Ov7ls/Ldx0S/VcmVWtia2HK8y8iLGtokoBZKQ5AaFX2
+iQU8+tC4h69GnJYQKqNwgCUzh8+gHX5Y46oDiTmRAoGAYpOx8lX+czB8/Da6MNrW
+mIZNT8atZLEsDs2ANEVRxDSIcTCZJId7+m1W+nRoaycLTWNowZ1+2ErLvR10+AGY
+b7Ys79Wg9idYaY9yGn9lnZsMzAiuLeyIvXcSqgjvAKlVWrhOQFOughvNWvFl85Yy
+oWSCMlPiTLtt7CCsCKsgKuECgYBgdIp6GZsIfkgclKe0hqgvRoeU4TR3gcjJlM9A
+lBTo+pKhaBectplx9RxR8AnsPobbqwcaHnIfAuKDzjk5mEvKZjClnFXF4HAHbyAF
+nRzZEy9XkWFhc80T5rRpZO7C7qdxmu2aiKixM3V3L3/0U58qULEDbubHMw9bEhAT
+PudI8QKBgHEEiMm/hr9T41hbQi/LYanWnlFw1ue+osKuF8bXQuxnnHNuFT/c+9/A
+vWhgqG6bOEHu+p/IPrYm4tBMYlwsyh4nXCyGgDJLbLIfzKwKAWCtH9LwnyDVhOow
+GH9shdR+sW3Ew97xef02KAH4VlNANEmBV4sQNqWWvsYrcFm2rOdL
+-----END RSA PRIVATE KEY-----
diff --git a/fs_mgr/libvbmeta/super_vbmeta_test.cpp b/fs_mgr/libvbmeta/super_vbmeta_test.cpp
index daed0d1..7329a61 100644
--- a/fs_mgr/libvbmeta/super_vbmeta_test.cpp
+++ b/fs_mgr/libvbmeta/super_vbmeta_test.cpp
@@ -54,7 +54,7 @@
     cmd << "avbtool add_hashtree_footer"
         << " --image " << file_name << " --partition_name " << partition_name
         << " --partition_size " << FAKE_PARTITION_SIZE << " --algorithm SHA256_RSA2048"
-        << " --key external/avb/test/data/testkey_rsa2048.pem";
+        << " --key data/testkey_rsa2048.pem";
 
     int rc = system(cmd.str().c_str());
     EXPECT_TRUE(WIFEXITED(rc));
diff --git a/fs_mgr/tests/Android.bp b/fs_mgr/tests/Android.bp
index f68ab87..9ed283a 100644
--- a/fs_mgr/tests/Android.bp
+++ b/fs_mgr/tests/Android.bp
@@ -17,7 +17,6 @@
     test_suites: [
         "cts",
         "device-tests",
-        "vts10",
     ],
     compile_multilib: "both",
     multilib: {
diff --git a/fs_mgr/tests/AndroidTest.xml b/fs_mgr/tests/AndroidTest.xml
index 0ff8995..de835b3 100644
--- a/fs_mgr/tests/AndroidTest.xml
+++ b/fs_mgr/tests/AndroidTest.xml
@@ -21,6 +21,9 @@
         <option name="push" value="CtsFsMgrTestCases->/data/local/tmp/CtsFsMgrTestCases" />
         <option name="append-bitness" value="true" />
     </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+        <option name="throw-on-error" value="false" />
+    </target_preparer>
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="CtsFsMgrTestCases" />
diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh
index 82c4262..0df8cf0 100755
--- a/fs_mgr/tests/adb-remount-test.sh
+++ b/fs_mgr/tests/adb-remount-test.sh
@@ -15,13 +15,17 @@
 
 adb remount tests
 
---color                     Dress output with highlighting colors
---help                      This help
---no-wait-screen            Do not wait for display screen to settle
---print-time                Report the test duration
---serial                    Specify device (must if multiple are present)
---wait-adb <duration>       adb wait timeout
---wait-fastboot <duration>  fastboot wait timeout
+-c --color                     Dress output with highlighting colors
+-h --help                      This help
+-D --no-wait-screen            Do not wait for display screen to settle
+-t --print-time                Report the test duration
+-s --serial                    Specify device (must if multiple are present)"
+if [ -n "`which timeout`" ]; then
+  USAGE="${USAGE}
+-a --wait-adb <duration>       adb wait timeout
+-f --wait-fastboot <duration>  fastboot wait timeout"
+fi
+USAGE="${USAGE}
 
 Conditions:
  - Must be a userdebug build.
@@ -46,10 +50,10 @@
 ESCAPE="`echo | tr '\n' '\033'`"
 # A _real_ embedded carriage return character
 CR="`echo | tr '\n' '\r'`"
-GREEN="${ESCAPE}[38;5;40m"
-RED="${ESCAPE}[38;5;196m"
-ORANGE="${ESCAPE}[38;5;255:165:0m"
-BLUE="${ESCAPE}[35m"
+GREEN="${ESCAPE}[32m"
+RED="${ESCAPE}[31m"
+YELLOW="${ESCAPE}[33m"
+BLUE="${ESCAPE}[34m"
 NORMAL="${ESCAPE}[0m"
 TMPDIR=${TMPDIR:-/tmp}
 print_time=false
@@ -72,7 +76,7 @@
     if [ -n "${ANDROID_SERIAL}" ]; then
       grep "^${ANDROID_SERIAL}[${SPACE}${TAB}]" > /dev/null
     else
-      wc -l | grep '^1$' >/dev/null
+      wc -l | grep "^[${SPACE}${TAB}]*1\$" >/dev/null
     fi
 }
 
@@ -85,7 +89,7 @@
     if [ -n "${ANDROID_SERIAL}" ]; then
       grep "^${ANDROID_SERIAL}[${SPACE}${TAB}]" > /dev/null
     else
-      wc -l | grep '^1$' >/dev/null
+      wc -l | grep "^[${SPACE}${TAB}]*1\$" >/dev/null
     fi
 }
 
@@ -100,7 +104,7 @@
       grep "^${ANDROID_SERIAL}[${SPACE}${TAB}][${SPACE}${TAB}]*recovery\$" >/dev/null
     return ${?}
   fi
-  if echo "${list}" | wc -l | grep '^1$' >/dev/null; then
+  if echo "${list}" | wc -l | grep "^[${SPACE}${TAB}]*1\$" >/dev/null; then
     echo "${list}" |
       grep "[${SPACE}${TAB}]recovery\$" >/dev/null
     return ${?}
@@ -143,7 +147,7 @@
   adb logcat "${@}" </dev/null |
     tr -d '\r' |
     grep -v 'logd    : logdr: UID=' |
-    sed -e '${/------- beginning of kernel/d}' -e 's/^[0-1][0-9]-[0-3][0-9] //'
+    sed -e '${ /------- beginning of kernel/d }' -e 's/^[0-1][0-9]-[0-3][0-9] //'
 }
 
 [ "USAGE: avc_check >/dev/stderr
@@ -160,7 +164,7 @@
   if [ -z "${L}" ]; then
     return
   fi
-  echo "${ORANGE}[  WARNING ]${NORMAL} unlabeled sepolicy violations:" >&2
+  echo "${YELLOW}[  WARNING ]${NORMAL} unlabeled sepolicy violations:" >&2
   echo "${L}" | sed "s/^/${INDENT}/" >&2
 }
 
@@ -209,6 +213,13 @@
     return ${ret}
 }
 
+[ "USAGE: adb_test <expression>
+
+Returns: exit status of the test expression" ]
+adb_test() {
+  adb_sh test "${@}" </dev/null
+}
+
 [ "USAGE: adb_reboot
 
 Returns: true if the reboot command succeeded" ]
@@ -284,7 +295,7 @@
   local start=`date +%s`
   local duration=
   local ret
-  if [ -n "${1}" ]; then
+  if [ -n "${1}" -a -n "`which timeout`" ]; then
     USB_DEVICE=`usb_devnum --next`
     duration=`format_duration ${1}`
     echo -n ". . . waiting ${duration}" ${ANDROID_SERIAL} ${USB_ADDRESS} ${USB_DEVICE} "${CR}"
@@ -299,7 +310,7 @@
   if [ 0 = ${ret} -a -n "${ACTIVE_SLOT}" ]; then
     local active_slot=`get_active_slot`
     if [ X"${ACTIVE_SLOT}" != X"${active_slot}" ]; then
-      echo "${ORANGE}[  WARNING ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}" >&2
+      echo "${YELLOW}[  WARNING ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}" >&2
     fi
   fi
   local end=`date +%s`
@@ -359,18 +370,22 @@
     echo "(In adb mode `adb_user`)"
   else
     echo "(USB stack borken for ${USB_ADDRESS})"
-    USB_DEVICE=`usb_devnum`
-    if [ -n "${USB_DEVICE}" ]; then
-      echo "# lsusb -v -s ${USB_DEVICE#dev}"
-      local D=`lsusb -v -s ${USB_DEVICE#dev} 2>&1`
-      if [ -n "${D}" ]; then
-        echo "${D}"
-      else
-        lsusb -v
+    if [ -n "`which usb_devnum`" ]; then
+      USB_DEVICE=`usb_devnum`
+      if [ -n "`which lsusb`" ]; then
+        if [ -n "${USB_DEVICE}" ]; then
+          echo "# lsusb -v -s ${USB_DEVICE#dev}"
+          local D=`lsusb -v -s ${USB_DEVICE#dev} 2>&1`
+          if [ -n "${D}" ]; then
+            echo "${D}"
+          else
+            lsusb -v
+          fi
+        else
+          echo "# lsusb -v (expected device missing)"
+          lsusb -v
+        fi
       fi
-    else
-      echo "# lsusb -v (expected device missing)"
-      lsusb -v
     fi >&2
   fi
 }
@@ -382,7 +397,7 @@
   local ret
   # fastboot has no wait-for-device, but it does an automatic
   # wait and requires (even a nonsensical) command to do so.
-  if [ -n "${1}" ]; then
+  if [ -n "${1}" -a -n "`which timeout`" ]; then
     USB_DEVICE=`usb_devnum --next`
     echo -n ". . . waiting `format_duration ${1}`" ${ANDROID_SERIAL} ${USB_ADDRESS} ${USB_DEVICE} "${CR}"
     timeout --preserve-status --signal=KILL ${1} fastboot wait-for-device >/dev/null 2>/dev/null
@@ -398,7 +413,7 @@
   if [ 0 = ${ret} -a -n "${ACTIVE_SLOT}" ]; then
     local active_slot=`get_active_slot`
     if [ X"${ACTIVE_SLOT}" != X"${active_slot}" ]; then
-      echo "${ORANGE}[  WARNING ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}"
+      echo "${YELLOW}[  WARNING ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}"
     fi >&2
   fi
   return ${ret}
@@ -409,7 +424,7 @@
 Returns: waits until the device has returned for recovery or optional timeout" ]
 recovery_wait() {
   local ret
-  if [ -n "${1}" ]; then
+  if [ -n "${1}" -a -n "`which timeout`" ]; then
     USB_DEVICE=`usb_devnum --next`
     echo -n ". . . waiting `format_duration ${1}`" ${ANDROID_SERIAL} ${USB_ADDRESS} ${USB_DEVICE} "${CR}"
     timeout --preserve-status --signal=KILL ${1} adb wait-for-recovery 2>/dev/null
@@ -423,7 +438,7 @@
   if [ 0 = ${ret} -a -n "${ACTIVE_SLOT}" ]; then
     local active_slot=`get_active_slot`
     if [ X"${ACTIVE_SLOT}" != X"${active_slot}" ]; then
-      echo "${ORANGE}[  WARNING ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}"
+      echo "${YELLOW}[  WARNING ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}"
     fi >&2
   fi
   return ${ret}
@@ -732,6 +747,7 @@
   grep -v \
     -e "^\(overlay\|tmpfs\|none\|sysfs\|proc\|selinuxfs\|debugfs\|bpf\) " \
     -e "^\(binfmt_misc\|cg2_bpf\|pstore\|tracefs\|adb\|mtp\|ptp\|devpts\) " \
+    -e "^\(ramdumpfs\|binder\|/sys/kernel/debug\|securityfs\) " \
     -e " functionfs " \
     -e "^\(/data/media\|/dev/block/loop[0-9]*\) " \
     -e "^rootfs / rootfs rw," \
@@ -746,20 +762,35 @@
 uninteresting to the test" ]
 skip_unrelated_mounts() {
     grep -v "^overlay.* /\(apex\|bionic\|system\|vendor\)/[^ ]" |
-      grep -v "[%] /\(apex\|bionic\|system\|vendor\)/[^ ][^ ]*$"
+      grep -v "[%] /\(data_mirror\|apex\|bionic\|system\|vendor\)/[^ ][^ ]*$"
 }
 
 ##
 ##  MAINLINE
 ##
 
-OPTIONS=`getopt --alternative --unquoted \
-                --longoptions help,serial:,colour,color,no-colour,no-color \
-                --longoptions wait-adb:,wait-fastboot: \
-                --longoptions wait-screen,wait-display \
-                --longoptions no-wait-screen,no-wait-display \
-                --longoptions gtest_print_time,print-time \
-                -- "?hs:" ${*}` ||
+HOSTOS=`uname`
+GETOPTS="--alternative --unquoted
+         --longoptions help,serial:,colour,color,no-colour,no-color
+         --longoptions wait-adb:,wait-fastboot:
+         --longoptions wait-screen,wait-display
+         --longoptions no-wait-screen,no-wait-display
+         --longoptions gtest_print_time,print-time
+         --"
+if [ "Darwin" = "${HOSTOS}" ]; then
+  GETOPTS=
+  USAGE="`echo \"${USAGE}\" |
+            sed 's/--color/       /g
+                 1s/--help/-h/
+                 s/--help/      /g
+                 s/--no-wait-screen/                /g
+                 s/--print-time/            /g
+                 1s/--serial/-s/
+                 s/--serial/        /g
+                 s/--wait-adb/          /g
+                 s/--wait-fastboot/               /g'`"
+fi
+OPTIONS=`getopt ${GETOPTS} "?a:cCdDf:hs:t" ${*}` ||
   ( echo "${USAGE}" >&2 ; false ) ||
   die "getopt failure"
 set -- ${OPTIONS}
@@ -775,26 +806,26 @@
       export ANDROID_SERIAL=${2}
       shift
       ;;
-    --color | --colour)
+    -c | --color | --colour)
       color=true
       ;;
-    --no-color | --no-colour)
+    -C | --no-color | --no-colour)
       color=false
       ;;
-    --no-wait-display | --no-wait-screen)
+    -D | --no-wait-display | --no-wait-screen)
       screen_wait=false
       ;;
-    --wait-display | --wait-screen)
+    -d | --wait-display | --wait-screen)
       screen_wait=true
       ;;
-    --print-time | --gtest_print_time)
+    -t | --print-time | --gtest_print_time)
       print_time=true
       ;;
-    --wait-adb)
+    -a | --wait-adb)
       ADB_WAIT=${2}
       shift
       ;;
-    --wait-fastboot)
+    -f | --wait-fastboot)
       FASTBOOT_WAIT=${2}
       shift
       ;;
@@ -815,7 +846,7 @@
 if ! ${color}; then
   GREEN=""
   RED=""
-  ORANGE=""
+  YELLOW=""
   BLUE=""
   NORMAL=""
 fi
@@ -827,14 +858,14 @@
 inFastboot && die "device in fastboot mode"
 inRecovery && die "device in recovery mode"
 if ! inAdb; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} device not in adb mode" >&2
+  echo "${YELLOW}[  WARNING ]${NORMAL} device not in adb mode" >&2
   adb_wait ${ADB_WAIT}
 fi
 inAdb || die "specified device not in adb mode"
 isDebuggable || die "device not a debug build"
 enforcing=true
 if ! adb_su getenforce </dev/null | grep 'Enforcing' >/dev/null; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} device does not have sepolicy in enforcing mode" >&2
+  echo "${YELLOW}[  WARNING ]${NORMAL} device does not have sepolicy in enforcing mode" >&2
   enforcing=false
 fi
 
@@ -846,9 +877,13 @@
 [ -n "${D}" ] || D=`get_property ro.boot.serialno`
 [ -z "${D}" -o -n "${ANDROID_SERIAL}" ] || ANDROID_SERIAL=${D}
 USB_SERIAL=
-[ -z "${ANDROID_SERIAL}" ] || USB_SERIAL=`find /sys/devices -name serial |
-                                          grep usb |
-                                          xargs -r grep -l ${ANDROID_SERIAL}`
+if [ -n "${ANDROID_SERIAL}" -a "Darwin" != "${HOSTOS}" ]; then
+  USB_SERIAL="`find /sys/devices -name serial | grep usb`"
+  if [ -n "${USB_SERIAL}" ]; then
+    USB_SERIAL=`echo "${USB_SERIAL}" |
+                  xargs grep -l ${ANDROID_SERIAL}`
+  fi
+fi
 USB_ADDRESS=
 if [ -n "${USB_SERIAL}" ]; then
   USB_ADDRESS=${USB_SERIAL%/serial}
@@ -860,13 +895,16 @@
 BUILD_DESCRIPTION=`get_property ro.build.description`
 [ -z "${BUILD_DESCRIPTION}" ] ||
   echo "${BLUE}[     INFO ]${NORMAL} ${BUILD_DESCRIPTION}" >&2
+KERNEL_VERSION="`adb_su cat /proc/version </dev/null 2>/dev/null`"
+[ -z "${KERNEL_VERSION}" ] ||
+  echo "${BLUE}[     INFO ]${NORMAL} ${KERNEL_VERSION}" >&2
 ACTIVE_SLOT=`get_active_slot`
 [ -z "${ACTIVE_SLOT}" ] ||
   echo "${BLUE}[     INFO ]${NORMAL} active slot is ${ACTIVE_SLOT}" >&2
 
 # Acquire list of system partitions
 
-PARTITIONS=`adb_su cat /vendor/etc/fstab* |
+PARTITIONS=`adb_su cat /vendor/etc/fstab* </dev/null |
               skip_administrative_mounts |
               sed -n "s@^\([^ ${TAB}/][^ ${TAB}/]*\)[ ${TAB}].*[, ${TAB}]ro[, ${TAB}].*@\1@p" |
               sort -u |
@@ -903,9 +941,12 @@
   done
 
 # If reboot too soon after fresh flash, could trip device update failure logic
+if ${screen_wait}; then
+  echo "${YELLOW}[  WARNING ]${NORMAL} waiting for screen to come up. Consider --no-wait-screen option" >&2
+fi
 if ! wait_for_screen && ${screen_wait}; then
   screen_wait=false
-  echo "${ORANGE}[  WARNING ]${NORMAL} not healthy, no launcher, skipping wait for screen" >&2
+  echo "${YELLOW}[  WARNING ]${NORMAL} not healthy, no launcher, skipping wait for screen" >&2
 fi
 
 # Can we test remount -R command?
@@ -922,7 +963,7 @@
     if inAdb; then
       reboot=false
       for d in ${OVERLAYFS_BACKING}; do
-        if adb_su ls -d /${d}/overlay </dev/null >/dev/null 2>/dev/null; then
+        if adb_test -d /${d}/overlay; then
           adb_su rm -rf /${d}/overlay </dev/null
           reboot=true
         fi
@@ -954,7 +995,7 @@
   adb_su remount -R system </dev/null
   err=${?}
   if [ "${err}" != 0 ]; then
-    echo "${ORANGE}[  WARNING ]${NORMAL} adb shell su root remount -R system = ${err}, likely did not reboot!" >&2
+    echo "${YELLOW}[  WARNING ]${NORMAL} adb shell su root remount -R system = ${err}, likely did not reboot!" >&2
     T="-t ${T}"
   else
     # Rebooted, logcat will be meaningless, and last logcat will likely be clear
@@ -976,20 +1017,23 @@
 echo "${GREEN}[ RUN      ]${NORMAL} Testing kernel support for overlayfs" >&2
 
 adb_wait || die "wait for device failed"
-adb_sh ls -d /sys/module/overlay </dev/null >/dev/null 2>/dev/null ||
+adb_root ||
+  die "initial setup"
+
+adb_test -d /sys/module/overlay ||
   adb_sh grep "nodev${TAB}overlay" /proc/filesystems </dev/null >/dev/null 2>/dev/null &&
   echo "${GREEN}[       OK ]${NORMAL} overlay module present" >&2 ||
   (
-    echo "${ORANGE}[  WARNING ]${NORMAL} overlay module not present" >&2 &&
+    echo "${YELLOW}[  WARNING ]${NORMAL} overlay module not present" >&2 &&
       false
   ) ||
   overlayfs_supported=false
 if ${overlayfs_supported}; then
-  adb_su ls /sys/module/overlay/parameters/override_creds </dev/null >/dev/null 2>/dev/null &&
+  adb_test -f /sys/module/overlay/parameters/override_creds &&
     echo "${GREEN}[       OK ]${NORMAL} overlay module supports override_creds" >&2 ||
     case `adb_sh uname -r </dev/null` in
       4.[456789].* | 4.[1-9][0-9]* | [56789].*)
-        echo "${ORANGE}[  WARNING ]${NORMAL} overlay module does not support override_creds" >&2 &&
+        echo "${YELLOW}[  WARNING ]${NORMAL} overlay module does not support override_creds" >&2 &&
         overlayfs_supported=false
         ;;
       *)
@@ -998,9 +1042,6 @@
     esac
 fi
 
-adb_root ||
-  die "initial setup"
-
 echo "${GREEN}[ RUN      ]${NORMAL} Checking current overlayfs status" >&2
 
 # We can not universally use adb enable-verity to ensure device is
@@ -1010,15 +1051,15 @@
 # having to go through enable-verity transition.
 reboot=false
 for d in ${OVERLAYFS_BACKING}; do
-  if adb_sh ls -d /${d}/overlay </dev/null >/dev/null 2>/dev/null; then
-    echo "${ORANGE}[  WARNING ]${NORMAL} /${d}/overlay is setup, surgically wiping" >&2
+  if adb_test -d /${d}/overlay; then
+    echo "${YELLOW}[  WARNING ]${NORMAL} /${d}/overlay is setup, surgically wiping" >&2
     adb_sh rm -rf /${d}/overlay </dev/null ||
       die "/${d}/overlay wipe"
     reboot=true
   fi
 done
 if ${reboot}; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} rebooting before test" >&2
+  echo "${YELLOW}[  WARNING ]${NORMAL} rebooting before test" >&2
   adb_reboot &&
     adb_wait ${ADB_WAIT} ||
     die "lost device after reboot after wipe `usb_status`"
@@ -1030,7 +1071,7 @@
   D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay "` &&
   echo "${H}" &&
   echo "${D}" &&
-  echo "${ORANGE}[  WARNING ]${NORMAL} overlays present before setup" >&2 ||
+  echo "${YELLOW}[  WARNING ]${NORMAL} overlays present before setup" >&2 ||
   echo "${GREEN}[       OK ]${NORMAL} no overlay present before setup" >&2
 overlayfs_needed=true
 D=`adb_sh cat /proc/mounts </dev/null |
@@ -1083,7 +1124,7 @@
 if [ X"${D}" != X"${H}" ]; then
   echo "${H}"
   if [ X"${D}" != X"${D##*setup failed}" ]; then
-    echo "${ORANGE}[  WARNING ]${NORMAL} overlayfs setup whined" >&2
+    echo "${YELLOW}[  WARNING ]${NORMAL} overlayfs setup whined" >&2
   fi
   D=`adb_sh df -k </dev/null` &&
     H=`echo "${D}" | head -1` &&
@@ -1130,7 +1171,7 @@
 elif ${rebooted}; then
   echo "${GREEN}[       OK ]${NORMAL} verity already disabled" >&2
 else
-  echo "${ORANGE}[  WARNING ]${NORMAL} verity already disabled" >&2
+  echo "${YELLOW}[  WARNING ]${NORMAL} verity already disabled" >&2
 fi
 
 echo "${GREEN}[ RUN      ]${NORMAL} remount" >&2
@@ -1160,7 +1201,7 @@
     die -t ${T} "overlay takeover failed"
   fi
   echo "${D}" | grep "^overlay .* /system\$" >/dev/null ||
-   echo "${ORANGE}[  WARNING ]${NORMAL} overlay takeover not complete" >&2
+   echo "${YELLOW}[  WARNING ]${NORMAL} overlay takeover not complete" >&2
   if [ -z "${virtual_ab}" ]; then
     scratch_partition=scratch
   fi
@@ -1186,7 +1227,7 @@
     die "scratch size"
   echo "${BLUE}[     INFO ]${NORMAL} scratch size ${scratch_size}KB" >&2
   for d in ${OVERLAYFS_BACKING}; do
-    if adb_sh ls -d /${d}/overlay/system/upper </dev/null >/dev/null 2>/dev/null; then
+    if adb_test -d /${d}/overlay/system/upper; then
       echo "${BLUE}[     INFO ]${NORMAL} /${d}/overlay is setup" >&2
     fi
   done
@@ -1267,9 +1308,9 @@
 fi
 check_ne "${BASE_SYSTEM_DEVT}" "${BASE_VENDOR_DEVT}" --warning system/vendor devt
 [ -n "${SYSTEM_DEVT%[0-9a-fA-F][0-9a-fA-F]}" ] ||
-  die "system devt ${SYSTEM_DEVT} is major 0"
+  echo "${YELLOW}[  WARNING ]${NORMAL} system devt ${SYSTEM_DEVT} major 0" >&2
 [ -n "${VENDOR_DEVT%[0-9a-fA-F][0-9a-fA-F]}" ] ||
-  die "vendor devt ${SYSTEM_DEVT} is major 0"
+  echo "${YELLOW}[  WARNING ]${NORMAL} vendor devt ${VENDOR_DEVT} major 0" >&2
 
 # Download libc.so, append some gargage, push back, and check if the file
 # is updated.
@@ -1292,7 +1333,7 @@
 
 fixup_from_recovery() {
   inRecovery || return 1
-  echo "${ORANGE}[    ERROR ]${NORMAL} Device in recovery" >&2
+  echo "${YELLOW}[    ERROR ]${NORMAL} Device in recovery" >&2
   adb reboot </dev/null
   adb_wait ${ADB_WAIT}
 }
@@ -1312,7 +1353,7 @@
   adb_su sed -n '1,/overlay \/system/p' /proc/mounts </dev/null |
     skip_administrative_mounts |
     grep -v ' \(erofs\|squashfs\|ext4\|f2fs\|vfat\) ' &&
-    echo "${ORANGE}[  WARNING ]${NORMAL} overlay takeover after first stage init" >&2 ||
+    echo "${YELLOW}[  WARNING ]${NORMAL} overlay takeover after first stage init" >&2 ||
     echo "${GREEN}[       OK ]${NORMAL} overlay takeover in first stage init" >&2
 fi
 
@@ -1346,9 +1387,9 @@
 check_eq "${VENDOR_DEVT}" "`adb_sh stat --format=%D /vendor/hello </dev/null`" vendor devt after reboot
 check_eq "${SYSTEM_INO}" "`adb_sh stat --format=%i /system/hello </dev/null`" system inode after reboot
 check_eq "${VENDOR_INO}" "`adb_sh stat --format=%i /vendor/hello </dev/null`" vendor inode after reboot
-check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/bin/stat </dev/null`" base system devt after reboot
-check_eq "${BASE_VENDOR_DEVT}" "`adb_sh stat --format=%D /vendor/bin/stat </dev/null`" base system devt after reboot
-check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/xbin/su </dev/null`" devt for su after reboot
+check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/bin/stat </dev/null`" --warning base system devt after reboot
+check_eq "${BASE_VENDOR_DEVT}" "`adb_sh stat --format=%D /vendor/bin/stat </dev/null`" --warning base vendor devt after reboot
+check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/xbin/su </dev/null`" --warning devt for su after reboot
 
 # Feed log with selinux denials as a result of overlays
 adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null
@@ -1373,20 +1414,20 @@
 is_userspace_fastboot=false
 
 if ! ${is_bootloader_fastboot}; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} does not support fastboot, skipping"
+  echo "${YELLOW}[  WARNING ]${NORMAL} does not support fastboot, skipping"
 elif [ -z "${ANDROID_PRODUCT_OUT}" ]; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} build tree not setup, skipping"
+  echo "${YELLOW}[  WARNING ]${NORMAL} build tree not setup, skipping"
 elif [ ! -s "${ANDROID_PRODUCT_OUT}/vendor.img" ]; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} vendor image missing, skipping"
+  echo "${YELLOW}[  WARNING ]${NORMAL} vendor image missing, skipping"
 elif [ "${ANDROID_PRODUCT_OUT}" = "${ANDROID_PRODUCT_OUT%*/${H}}" ]; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} wrong vendor image, skipping"
+  echo "${YELLOW}[  WARNING ]${NORMAL} wrong vendor image, skipping"
 elif [ -z "${ANDROID_HOST_OUT}" ]; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} please run lunch, skipping"
+  echo "${YELLOW}[  WARNING ]${NORMAL} please run lunch, skipping"
 elif ! (
           adb_cat /vendor/build.prop |
           cmp -s ${ANDROID_PRODUCT_OUT}/vendor/build.prop
        ) >/dev/null 2>/dev/null; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} vendor image signature mismatch, skipping"
+  echo "${YELLOW}[  WARNING ]${NORMAL} vendor image signature mismatch, skipping"
 else
   wait_for_screen
   avc_check
@@ -1432,7 +1473,7 @@
   fi
   fastboot reboot ||
     die "can not reboot out of fastboot"
-  echo "${ORANGE}[  WARNING ]${NORMAL} adb after fastboot"
+  echo "${YELLOW}[  WARNING ]${NORMAL} adb after fastboot"
   adb_wait ${ADB_WAIT} ||
     fixup_from_recovery ||
     die "did not reboot after formatting ${scratch_partition} `usb_status`"
@@ -1449,8 +1490,8 @@
       if ${is_userspace_fastboot}; then
         die  "overlay supposed to be minus /vendor takeover after flash vendor"
       else
-        echo "${ORANGE}[  WARNING ]${NORMAL} user fastboot missing required to invalidate, ignoring a failure" >&2
-        echo "${ORANGE}[  WARNING ]${NORMAL} overlay supposed to be minus /vendor takeover after flash vendor" >&2
+        echo "${YELLOW}[  WARNING ]${NORMAL} user fastboot missing required to invalidate, ignoring a failure" >&2
+        echo "${YELLOW}[  WARNING ]${NORMAL} overlay supposed to be minus /vendor takeover after flash vendor" >&2
       fi
   fi
   B="`adb_cat /system/hello`"
@@ -1468,15 +1509,15 @@
     check_eq "cat: /vendor/hello: No such file or directory" "${B}" \
              vendor content after flash vendor
   else
-    echo "${ORANGE}[  WARNING ]${NORMAL} user fastboot missing required to invalidate, ignoring a failure" >&2
+    echo "${YELLOW}[  WARNING ]${NORMAL} user fastboot missing required to invalidate, ignoring a failure" >&2
     check_eq "cat: /vendor/hello: No such file or directory" "${B}" \
              --warning vendor content after flash vendor
   fi
 
   check_eq "${SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/hello </dev/null`" system devt after reboot
   check_eq "${SYSTEM_INO}" "`adb_sh stat --format=%i /system/hello </dev/null`" system inode after reboot
-  check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/bin/stat </dev/null`" base system devt after reboot
-  check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/xbin/su </dev/null`" devt for su after reboot
+  check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/bin/stat </dev/null`" --warning base system devt after reboot
+  check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/xbin/su </dev/null`" --warning devt for su after reboot
 
 fi
 
@@ -1489,7 +1530,7 @@
 L=
 D="${H%?Now reboot your device for settings to take effect*}"
 if [ X"${H}" != X"${D}" ]; then
-  echo "${ORANGE}[  WARNING ]${NORMAL} adb remount requires a reboot after partial flash (legacy avb)"
+  echo "${YELLOW}[  WARNING ]${NORMAL} adb remount requires a reboot after partial flash (legacy avb)"
   L=`adb_logcat -b all -v nsec -t ${T} 2>&1`
   adb_reboot &&
     adb_wait ${ADB_WAIT} &&
@@ -1547,7 +1588,7 @@
   err=${?}
   if [ X"${D}" != "${D%?Now reboot your device for settings to take effect*}" ]
   then
-    echo "${ORANGE}[  WARNING ]${NORMAL} adb disable-verity requires a reboot after partial flash"
+    echo "${YELLOW}[  WARNING ]${NORMAL} adb disable-verity requires a reboot after partial flash"
     adb_reboot &&
       adb_wait ${ADB_WAIT} &&
       adb_root ||
@@ -1580,9 +1621,9 @@
   if [ -n "${ACTIVE_SLOT}" ]; then
     local active_slot=`get_active_slot`
     if [ X"${ACTIVE_SLOT}" != X"${active_slot}" ]; then
-      echo "${ORANGE}[    ERROR ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}"
+      echo "${YELLOW}[    ERROR ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}"
     else
-      echo "${ORANGE}[    ERROR ]${NORMAL} Active slot to be set to ${ACTIVE_SLOT}"
+      echo "${YELLOW}[    ERROR ]${NORMAL} Active slot to be set to ${ACTIVE_SLOT}"
     fi >&2
     fastboot --set-active=${ACTIVE_SLOT}
   fi
@@ -1622,8 +1663,10 @@
 # This also saves a lot of 'noise' from the command doing a mkfs on backing
 # storage and all the related tuning and adjustment.
 for d in ${OVERLAYFS_BACKING}; do
-  adb_su rm -rf /${d}/overlay </dev/null ||
-    die "/${d}/overlay wipe"
+  if adb_test -d /${d}/overlay; then
+    adb_su rm -rf /${d}/overlay </dev/null ||
+      die "/${d}/overlay wipe"
+  fi
 done
 adb_reboot &&
   adb_wait ${ADB_WAIT} ||
diff --git a/fs_mgr/tools/Android.bp b/fs_mgr/tools/Android.bp
index 4d4aae4..d6ccc4b 100644
--- a/fs_mgr/tools/Android.bp
+++ b/fs_mgr/tools/Android.bp
@@ -29,3 +29,15 @@
 
     cflags: ["-Werror"],
 }
+
+cc_binary {
+    name: "dmuserd",
+    srcs: ["dmuserd.cpp"],
+
+    shared_libs: [
+        "libbase",
+        "liblog",
+    ],
+
+    cflags: ["-Werror"],
+}
diff --git a/fs_mgr/tools/dmctl.cpp b/fs_mgr/tools/dmctl.cpp
index 2738457..62ca162 100644
--- a/fs_mgr/tools/dmctl.cpp
+++ b/fs_mgr/tools/dmctl.cpp
@@ -38,6 +38,7 @@
 #include <vector>
 
 using namespace std::literals::string_literals;
+using namespace std::chrono_literals;
 using namespace android::dm;
 using DmBlockDevice = ::android::dm::DeviceMapper::DmBlockDevice;
 
@@ -49,6 +50,7 @@
     std::cerr << "  delete <dm-name>" << std::endl;
     std::cerr << "  list <devices | targets> [-v]" << std::endl;
     std::cerr << "  getpath <dm-name>" << std::endl;
+    std::cerr << "  getuuid <dm-name>" << std::endl;
     std::cerr << "  info <dm-name>" << std::endl;
     std::cerr << "  status <dm-name>" << std::endl;
     std::cerr << "  resume <dm-name>" << std::endl;
@@ -174,6 +176,13 @@
             }
             return std::make_unique<DmTargetSnapshot>(start_sector, num_sectors, base_device,
                                                       cow_device, mode, chunk_size);
+        } else if (target_type == "user") {
+            if (!HasArgs(1)) {
+                std::cerr << "Expected \"user\" <control_device_name>" << std::endl;
+                return nullptr;
+            }
+            std::string control_device = NextArg();
+            return std::make_unique<DmTargetUser>(start_sector, num_sectors, control_device);
         } else {
             std::cerr << "Unrecognized target type: " << target_type << std::endl;
             return nullptr;
@@ -239,8 +248,9 @@
         return ret;
     }
 
+    std::string ignore_path;
     DeviceMapper& dm = DeviceMapper::Instance();
-    if (!dm.CreateDevice(name, table)) {
+    if (!dm.CreateDevice(name, table, &ignore_path, 5s)) {
         std::cerr << "Failed to create device-mapper device with name: " << name << std::endl;
         return -EIO;
     }
@@ -389,6 +399,22 @@
     return 0;
 }
 
+static int GetUuidCmdHandler(int argc, char** argv) {
+    if (argc != 1) {
+        std::cerr << "Invalid arguments, see \'dmctl help\'" << std::endl;
+        return -EINVAL;
+    }
+
+    DeviceMapper& dm = DeviceMapper::Instance();
+    std::string uuid;
+    if (!dm.GetDmDeviceUuidByName(argv[0], &uuid)) {
+        std::cerr << "Could not query uuid of device \"" << argv[0] << "\"." << std::endl;
+        return -EINVAL;
+    }
+    std::cout << uuid << std::endl;
+    return 0;
+}
+
 static int InfoCmdHandler(int argc, char** argv) {
     if (argc != 1) {
         std::cerr << "Invalid arguments, see \'dmctl help\'" << std::endl;
@@ -502,6 +528,7 @@
         {"list", DmListCmdHandler},
         {"help", HelpCmdHandler},
         {"getpath", GetPathCmdHandler},
+        {"getuuid", GetUuidCmdHandler},
         {"info", InfoCmdHandler},
         {"table", TableCmdHandler},
         {"status", StatusCmdHandler},
diff --git a/fs_mgr/tools/dmuserd.cpp b/fs_mgr/tools/dmuserd.cpp
new file mode 100644
index 0000000..e50a4a2
--- /dev/null
+++ b/fs_mgr/tools/dmuserd.cpp
@@ -0,0 +1,319 @@
+// SPDX-License-Identifier: Apache-2.0
+
+#define _LARGEFILE64_SOURCE
+
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <poll.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <unistd.h>
+#include <iostream>
+
+#define SECTOR_SIZE ((__u64)512)
+#define BUFFER_BYTES 4096
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
+/* This should be replaced with linux/dm-user.h. */
+#ifndef _LINUX_DM_USER_H
+#define _LINUX_DM_USER_H
+
+#include <linux/types.h>
+
+#define DM_USER_REQ_MAP_READ 0
+#define DM_USER_REQ_MAP_WRITE 1
+#define DM_USER_REQ_MAP_FLUSH 2
+#define DM_USER_REQ_MAP_DISCARD 3
+#define DM_USER_REQ_MAP_SECURE_ERASE 4
+#define DM_USER_REQ_MAP_WRITE_SAME 5
+#define DM_USER_REQ_MAP_WRITE_ZEROES 6
+#define DM_USER_REQ_MAP_ZONE_OPEN 7
+#define DM_USER_REQ_MAP_ZONE_CLOSE 8
+#define DM_USER_REQ_MAP_ZONE_FINISH 9
+#define DM_USER_REQ_MAP_ZONE_APPEND 10
+#define DM_USER_REQ_MAP_ZONE_RESET 11
+#define DM_USER_REQ_MAP_ZONE_RESET_ALL 12
+
+#define DM_USER_REQ_MAP_FLAG_FAILFAST_DEV 0x00001
+#define DM_USER_REQ_MAP_FLAG_FAILFAST_TRANSPORT 0x00002
+#define DM_USER_REQ_MAP_FLAG_FAILFAST_DRIVER 0x00004
+#define DM_USER_REQ_MAP_FLAG_SYNC 0x00008
+#define DM_USER_REQ_MAP_FLAG_META 0x00010
+#define DM_USER_REQ_MAP_FLAG_PRIO 0x00020
+#define DM_USER_REQ_MAP_FLAG_NOMERGE 0x00040
+#define DM_USER_REQ_MAP_FLAG_IDLE 0x00080
+#define DM_USER_REQ_MAP_FLAG_INTEGRITY 0x00100
+#define DM_USER_REQ_MAP_FLAG_FUA 0x00200
+#define DM_USER_REQ_MAP_FLAG_PREFLUSH 0x00400
+#define DM_USER_REQ_MAP_FLAG_RAHEAD 0x00800
+#define DM_USER_REQ_MAP_FLAG_BACKGROUND 0x01000
+#define DM_USER_REQ_MAP_FLAG_NOWAIT 0x02000
+#define DM_USER_REQ_MAP_FLAG_CGROUP_PUNT 0x04000
+#define DM_USER_REQ_MAP_FLAG_NOUNMAP 0x08000
+#define DM_USER_REQ_MAP_FLAG_HIPRI 0x10000
+#define DM_USER_REQ_MAP_FLAG_DRV 0x20000
+#define DM_USER_REQ_MAP_FLAG_SWAP 0x40000
+
+#define DM_USER_RESP_SUCCESS 0
+#define DM_USER_RESP_ERROR 1
+#define DM_USER_RESP_UNSUPPORTED 2
+
+struct dm_user_message {
+    __u64 seq;
+    __u64 type;
+    __u64 flags;
+    __u64 sector;
+    __u64 len;
+    __u8 buf[];
+};
+
+#endif
+
+static bool verbose = false;
+
+ssize_t write_all(int fd, void* buf, size_t len) {
+    char* buf_c = (char*)buf;
+    ssize_t total = 0;
+    ssize_t once;
+
+    while (total < len) {
+        once = write(fd, buf_c + total, len - total);
+        if (once < 0) return once;
+        if (once == 0) {
+            errno = ENOSPC;
+            return 0;
+        }
+        total += once;
+    }
+
+    return total;
+}
+
+ssize_t read_all(int fd, void* buf, size_t len) {
+    char* buf_c = (char*)buf;
+    ssize_t total = 0;
+    ssize_t once;
+
+    while (total < len) {
+        once = read(fd, buf_c + total, len - total);
+        if (once < 0) return once;
+        if (once == 0) {
+            errno = ENOSPC;
+            return 0;
+        }
+        total += once;
+    }
+
+    return total;
+}
+
+int not_splice(int from, int to, __u64 count) {
+    while (count > 0) {
+        char buf[BUFFER_BYTES];
+        __u64 max = count > BUFFER_BYTES ? BUFFER_BYTES : count;
+
+        if (read_all(from, buf, max) <= 0) {
+            perror("Unable to read");
+            return -EIO;
+        }
+
+        if (write_all(to, buf, max) <= 0) {
+            perror("Unable to write");
+            return -EIO;
+        }
+
+        count -= max;
+    }
+
+    return 0;
+}
+
+int simple_daemon(char* control_path, char* backing_path) {
+    int control_fd = open(control_path, O_RDWR);
+    if (control_fd < 0) {
+        fprintf(stderr, "Unable to open control device %s\n", control_path);
+        return -1;
+    }
+
+    int backing_fd = open(backing_path, O_RDWR);
+    if (backing_fd < 0) {
+        fprintf(stderr, "Unable to open backing device %s\n", backing_path);
+        return -1;
+    }
+
+    while (1) {
+        struct dm_user_message msg;
+        char* base;
+        __u64 type;
+
+        if (verbose) std::cerr << "dmuserd: Waiting for message...\n";
+
+        if (read_all(control_fd, &msg, sizeof(msg)) < 0) {
+            if (errno == ENOTBLK) return 0;
+
+            perror("unable to read msg");
+            return -1;
+        }
+
+        if (verbose) {
+            std::string type;
+            switch (msg.type) {
+                case DM_USER_REQ_MAP_WRITE:
+                    type = "write";
+                    break;
+                case DM_USER_REQ_MAP_READ:
+                    type = "read";
+                    break;
+                case DM_USER_REQ_MAP_FLUSH:
+                    type = "flush";
+                    break;
+                default:
+                    /*
+                     * FIXME: Can't I do "whatever"s here rather that
+                     * std::string("whatever")?
+                     */
+                    type = std::string("(unknown, id=") + std::to_string(msg.type) + ")";
+                    break;
+            }
+
+            std::string flags;
+            if (msg.flags & DM_USER_REQ_MAP_FLAG_SYNC) {
+                if (!flags.empty()) flags += "|";
+                flags += "S";
+            }
+            if (msg.flags & DM_USER_REQ_MAP_FLAG_META) {
+                if (!flags.empty()) flags += "|";
+                flags += "M";
+            }
+            if (msg.flags & DM_USER_REQ_MAP_FLAG_FUA) {
+                if (!flags.empty()) flags += "|";
+                flags += "FUA";
+            }
+            if (msg.flags & DM_USER_REQ_MAP_FLAG_PREFLUSH) {
+                if (!flags.empty()) flags += "|";
+                flags += "F";
+            }
+
+            std::cerr << "dmuserd: Got " << type << " request " << flags << " for sector "
+                      << std::to_string(msg.sector) << " with length " << std::to_string(msg.len)
+                      << "\n";
+        }
+
+        type = msg.type;
+        switch (type) {
+            case DM_USER_REQ_MAP_READ:
+                msg.type = DM_USER_RESP_SUCCESS;
+                break;
+            case DM_USER_REQ_MAP_WRITE:
+                if (msg.flags & DM_USER_REQ_MAP_FLAG_PREFLUSH ||
+                    msg.flags & DM_USER_REQ_MAP_FLAG_FUA) {
+                    if (fsync(backing_fd) < 0) {
+                        perror("Unable to fsync(), just sync()ing instead");
+                        sync();
+                    }
+                }
+                msg.type = DM_USER_RESP_SUCCESS;
+                if (lseek64(backing_fd, msg.sector * SECTOR_SIZE, SEEK_SET) < 0) {
+                    perror("Unable to seek");
+                    return -1;
+                }
+                if (not_splice(control_fd, backing_fd, msg.len) < 0) {
+                    if (errno == ENOTBLK) return 0;
+                    std::cerr << "unable to handle write data\n";
+                    return -1;
+                }
+                if (msg.flags & DM_USER_REQ_MAP_FLAG_FUA) {
+                    if (fsync(backing_fd) < 0) {
+                        perror("Unable to fsync(), just sync()ing instead");
+                        sync();
+                    }
+                }
+                break;
+            case DM_USER_REQ_MAP_FLUSH:
+                msg.type = DM_USER_RESP_SUCCESS;
+                if (fsync(backing_fd) < 0) {
+                    perror("Unable to fsync(), just sync()ing instead");
+                    sync();
+                }
+                break;
+            default:
+                std::cerr << "dmuserd: unsupported op " << std::to_string(msg.type) << "\n";
+                msg.type = DM_USER_RESP_UNSUPPORTED;
+                break;
+        }
+
+        if (verbose) std::cerr << "dmuserd: Responding to message\n";
+
+        if (write_all(control_fd, &msg, sizeof(msg)) < 0) {
+            if (errno == ENOTBLK) return 0;
+            perror("unable to write msg");
+            return -1;
+        }
+
+        switch (type) {
+            case DM_USER_REQ_MAP_READ:
+                if (verbose) std::cerr << "dmuserd: Sending read data\n";
+                if (lseek64(backing_fd, msg.sector * SECTOR_SIZE, SEEK_SET) < 0) {
+                    perror("Unable to seek");
+                    return -1;
+                }
+                if (not_splice(backing_fd, control_fd, msg.len) < 0) {
+                    if (errno == ENOTBLK) return 0;
+                    std::cerr << "unable to handle read data\n";
+                    return -1;
+                }
+                break;
+        }
+    }
+
+    /* The daemon doesn't actully terminate for this test. */
+    perror("Unable to read from control device");
+    return -1;
+}
+
+void usage(char* prog) {
+    printf("Usage: %s\n", prog);
+    printf("	Handles block requests in userspace, backed by memory\n");
+    printf("  -h			Display this help message\n");
+    printf("  -c <control dev>		Control device to use for the test\n");
+    printf("  -b <store path>		The file to use as a backing store, otherwise memory\n");
+    printf("  -v                        Enable verbose mode\n");
+}
+
+int main(int argc, char* argv[]) {
+    char* control_path = NULL;
+    char* backing_path = NULL;
+    char* store;
+    int c;
+
+    prctl(PR_SET_IO_FLUSHER, 0, 0, 0, 0);
+
+    while ((c = getopt(argc, argv, "h:c:s:b:v")) != -1) {
+        switch (c) {
+            case 'h':
+                usage(basename(argv[0]));
+                exit(0);
+            case 'c':
+                control_path = strdup(optarg);
+                break;
+            case 'b':
+                backing_path = strdup(optarg);
+                break;
+            case 'v':
+                verbose = true;
+                break;
+            default:
+                usage(basename(argv[0]));
+                exit(1);
+        }
+    }
+
+    int r = simple_daemon(control_path, backing_path);
+    if (r) fprintf(stderr, "simple_daemon() errored out\n");
+    return r;
+}
diff --git a/gatekeeperd/Android.bp b/gatekeeperd/Android.bp
index 27a6452..d1046df 100644
--- a/gatekeeperd/Android.bp
+++ b/gatekeeperd/Android.bp
@@ -28,6 +28,7 @@
 
     shared_libs: [
         "libbinder",
+        "libbinder_ndk",
         "libgatekeeper",
         "libgsi",
         "liblog",
@@ -40,6 +41,8 @@
         "libhidlbase",
         "android.hardware.gatekeeper@1.0",
         "libgatekeeper_aidl",
+        "android.hardware.security.keymint-V1-ndk_platform",
+        "android.security.authorization-ndk_platform",
     ],
 
     static_libs: ["libscrypt_static"],
diff --git a/gatekeeperd/binder/android/service/gatekeeper/IGateKeeperService.aidl b/gatekeeperd/binder/android/service/gatekeeper/IGateKeeperService.aidl
index 57adaba..67e8633 100644
--- a/gatekeeperd/binder/android/service/gatekeeper/IGateKeeperService.aidl
+++ b/gatekeeperd/binder/android/service/gatekeeper/IGateKeeperService.aidl
@@ -27,10 +27,11 @@
  *
  * @hide
  */
+@SensitiveData
 interface IGateKeeperService {
     /**
      * Enrolls a password, returning the handle to the enrollment to be stored locally.
-     * @param uid The Android user ID associated to this enrollment
+     * @param userId The Android user ID associated to this enrollment
      * @param currentPasswordHandle The previously enrolled handle, or null if none
      * @param currentPassword The previously enrolled plaintext password, or null if none.
      *                        If provided, must verify against the currentPasswordHandle.
@@ -38,22 +39,22 @@
      *                        upon success.
      * @return an EnrollResponse or null on failure
      */
-    GateKeeperResponse enroll(int uid, in @nullable byte[] currentPasswordHandle,
+    GateKeeperResponse enroll(int userId, in @nullable byte[] currentPasswordHandle,
             in @nullable byte[] currentPassword, in byte[] desiredPassword);
 
     /**
      * Verifies an enrolled handle against a provided, plaintext blob.
-     * @param uid The Android user ID associated to this enrollment
+     * @param userId The Android user ID associated to this enrollment
      * @param enrolledPasswordHandle The handle against which the provided password will be
      *                               verified.
      * @param The plaintext blob to verify against enrolledPassword.
      * @return a VerifyResponse, or null on failure.
      */
-    GateKeeperResponse verify(int uid, in byte[] enrolledPasswordHandle, in byte[] providedPassword);
+    GateKeeperResponse verify(int userId, in byte[] enrolledPasswordHandle, in byte[] providedPassword);
 
     /**
      * Verifies an enrolled handle against a provided, plaintext blob.
-     * @param uid The Android user ID associated to this enrollment
+     * @param userId The Android user ID associated to this enrollment
      * @param challenge a challenge to authenticate agaisnt the device credential. If successful
      *                  authentication occurs, this value will be written to the returned
      *                  authentication attestation.
@@ -62,22 +63,22 @@
      * @param The plaintext blob to verify against enrolledPassword.
      * @return a VerifyResponse with an attestation, or null on failure.
      */
-    GateKeeperResponse verifyChallenge(int uid, long challenge, in byte[] enrolledPasswordHandle,
+    GateKeeperResponse verifyChallenge(int userId, long challenge, in byte[] enrolledPasswordHandle,
             in byte[] providedPassword);
 
     /**
      * Retrieves the secure identifier for the user with the provided Android ID,
      * or 0 if none is found.
-     * @param uid the Android user id
+     * @param userId the Android user id
      */
-    long getSecureUserId(int uid);
+    long getSecureUserId(int userId);
 
     /**
      * Clears secure user id associated with the provided Android ID.
      * Must be called when password is set to NONE.
-     * @param uid the Android user id.
+     * @param userId the Android user id.
      */
-    void clearSecureUserId(int uid);
+    void clearSecureUserId(int userId);
 
     /**
      * Notifies gatekeeper that device setup has been completed and any potentially still existing
diff --git a/gatekeeperd/gatekeeperd.cpp b/gatekeeperd/gatekeeperd.cpp
index 1d65b1c..781b4af 100644
--- a/gatekeeperd/gatekeeperd.cpp
+++ b/gatekeeperd/gatekeeperd.cpp
@@ -19,42 +19,45 @@
 #include <android/service/gatekeeper/BnGateKeeperService.h>
 #include <gatekeeper/GateKeeperResponse.h>
 
+#include <endian.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
-#include <stdint.h>
 #include <unistd.h>
 #include <memory>
 
-#include <android/security/keystore/IKeystoreService.h>
 #include <android-base/logging.h>
 #include <android-base/properties.h>
+#include <android/binder_ibinder.h>
+#include <android/binder_manager.h>
+#include <android/security/keystore/IKeystoreService.h>
 #include <binder/IPCThreadState.h>
 #include <binder/IServiceManager.h>
 #include <binder/PermissionCache.h>
-#include <gatekeeper/password_handle.h> // for password_handle_t
-#include <hardware/gatekeeper.h>
+#include <gatekeeper/password_handle.h>  // for password_handle_t
 #include <hardware/hw_auth_token.h>
-#include <keystore/keystore.h> // For error code
 #include <keystore/keystore_return_types.h>
 #include <libgsi/libgsi.h>
 #include <log/log.h>
-#include <utils/Log.h>
 #include <utils/String16.h>
 
-#include <hidl/HidlSupport.h>
+#include <aidl/android/hardware/security/keymint/HardwareAuthToken.h>
+#include <aidl/android/security/authorization/IKeystoreAuthorization.h>
 #include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
+#include <hidl/HidlSupport.h>
 
 using android::sp;
-using android::hardware::gatekeeper::V1_0::IGatekeeper;
-using android::hardware::gatekeeper::V1_0::GatekeeperStatusCode;
-using android::hardware::gatekeeper::V1_0::GatekeeperResponse;
 using android::hardware::Return;
+using android::hardware::gatekeeper::V1_0::GatekeeperResponse;
+using android::hardware::gatekeeper::V1_0::GatekeeperStatusCode;
+using android::hardware::gatekeeper::V1_0::IGatekeeper;
 
 using ::android::binder::Status;
 using ::android::service::gatekeeper::BnGateKeeperService;
 using GKResponse = ::android::service::gatekeeper::GateKeeperResponse;
 using GKResponseCode = ::android::service::gatekeeper::ResponseCode;
+using ::aidl::android::hardware::security::keymint::HardwareAuthenticatorType;
+using ::aidl::android::hardware::security::keymint::HardwareAuthToken;
+using ::aidl::android::security::authorization::IKeystoreAuthorization;
 
 namespace android {
 
@@ -62,7 +65,7 @@
 static const String16 DUMP_PERMISSION("android.permission.DUMP");
 
 class GateKeeperProxy : public BnGateKeeperService {
-public:
+  public:
     GateKeeperProxy() {
         clear_state_if_needed_done = false;
         hw_device = IGatekeeper::getService();
@@ -73,12 +76,11 @@
         }
     }
 
-    virtual ~GateKeeperProxy() {
-    }
+    virtual ~GateKeeperProxy() {}
 
-    void store_sid(uint32_t uid, uint64_t sid) {
+    void store_sid(uint32_t userId, uint64_t sid) {
         char filename[21];
-        snprintf(filename, sizeof(filename), "%u", uid);
+        snprintf(filename, sizeof(filename), "%u", userId);
         int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
         if (fd < 0) {
             ALOGE("could not open file: %s: %s", filename, strerror(errno));
@@ -96,7 +98,7 @@
         if (mark_cold_boot() && !is_running_gsi) {
             ALOGI("cold boot: clearing state");
             if (hw_device) {
-                hw_device->deleteAllUsers([](const GatekeeperResponse &){});
+                hw_device->deleteAllUsers([](const GatekeeperResponse&) {});
             }
         }
 
@@ -104,7 +106,7 @@
     }
 
     bool mark_cold_boot() {
-        const char *filename = ".coldboot";
+        const char* filename = ".coldboot";
         if (access(filename, F_OK) == -1) {
             int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
             if (fd < 0) {
@@ -117,18 +119,18 @@
         return false;
     }
 
-    void maybe_store_sid(uint32_t uid, uint64_t sid) {
+    void maybe_store_sid(uint32_t userId, uint64_t sid) {
         char filename[21];
-        snprintf(filename, sizeof(filename), "%u", uid);
+        snprintf(filename, sizeof(filename), "%u", userId);
         if (access(filename, F_OK) == -1) {
-            store_sid(uid, sid);
+            store_sid(userId, sid);
         }
     }
 
-    uint64_t read_sid(uint32_t uid) {
+    uint64_t read_sid(uint32_t userId) {
         char filename[21];
         uint64_t sid;
-        snprintf(filename, sizeof(filename), "%u", uid);
+        snprintf(filename, sizeof(filename), "%u", userId);
         int fd = open(filename, O_RDONLY);
         if (fd < 0) return 0;
         read(fd, &sid, sizeof(sid));
@@ -136,31 +138,31 @@
         return sid;
     }
 
-    void clear_sid(uint32_t uid) {
+    void clear_sid(uint32_t userId) {
         char filename[21];
-        snprintf(filename, sizeof(filename), "%u", uid);
+        snprintf(filename, sizeof(filename), "%u", userId);
         if (remove(filename) < 0) {
             ALOGE("%s: could not remove file [%s], attempting 0 write", __func__, strerror(errno));
-            store_sid(uid, 0);
+            store_sid(userId, 0);
         }
     }
 
-    // This should only be called on uids being passed to the GateKeeper HAL. It ensures that
+    // This should only be called on userIds being passed to the GateKeeper HAL. It ensures that
     // secure storage shared across a GSI image and a host image will not overlap.
-    uint32_t adjust_uid(uint32_t uid) {
+    uint32_t adjust_userId(uint32_t userId) {
         static constexpr uint32_t kGsiOffset = 1000000;
-        CHECK(uid < kGsiOffset);
+        CHECK(userId < kGsiOffset);
         CHECK(hw_device != nullptr);
         if (is_running_gsi) {
-            return uid + kGsiOffset;
+            return userId + kGsiOffset;
         }
-        return uid;
+        return userId;
     }
 
 #define GK_ERROR *gkResponse = GKResponse::error(), Status::ok()
 
-    Status enroll(int32_t uid, const std::unique_ptr<std::vector<uint8_t>>& currentPasswordHandle,
-                  const std::unique_ptr<std::vector<uint8_t>>& currentPassword,
+    Status enroll(int32_t userId, const std::optional<std::vector<uint8_t>>& currentPasswordHandle,
+                  const std::optional<std::vector<uint8_t>>& currentPassword,
                   const std::vector<uint8_t>& desiredPassword, GKResponse* gkResponse) override {
         IPCThreadState* ipc = IPCThreadState::self();
         const int calling_pid = ipc->getCallingPid();
@@ -198,9 +200,10 @@
         android::hardware::hidl_vec<uint8_t> newPwd;
         newPwd.setToExternal(const_cast<uint8_t*>(desiredPassword.data()), desiredPassword.size());
 
-        uint32_t hw_uid = adjust_uid(uid);
+        uint32_t hw_userId = adjust_userId(userId);
         Return<void> hwRes = hw_device->enroll(
-                hw_uid, curPwdHandle, curPwd, newPwd, [&gkResponse](const GatekeeperResponse& rsp) {
+                hw_userId, curPwdHandle, curPwd, newPwd,
+                [&gkResponse](const GatekeeperResponse& rsp) {
                     if (rsp.code >= GatekeeperStatusCode::STATUS_OK) {
                         *gkResponse = GKResponse::ok({rsp.data.begin(), rsp.data.end()});
                     } else if (rsp.code == GatekeeperStatusCode::ERROR_RETRY_TIMEOUT &&
@@ -225,12 +228,12 @@
             const gatekeeper::password_handle_t* handle =
                     reinterpret_cast<const gatekeeper::password_handle_t*>(
                             gkResponse->payload().data());
-            store_sid(uid, handle->user_id);
+            store_sid(userId, handle->user_id);
 
             GKResponse verifyResponse;
             // immediately verify this password so we don't ask the user to enter it again
             // if they just created it.
-            auto status = verify(uid, gkResponse->payload(), desiredPassword, &verifyResponse);
+            auto status = verify(userId, gkResponse->payload(), desiredPassword, &verifyResponse);
             if (!status.isOk() || verifyResponse.response_code() != GKResponseCode::OK) {
                 LOG(ERROR) << "Failed to verify password after enrolling";
             }
@@ -239,13 +242,13 @@
         return Status::ok();
     }
 
-    Status verify(int32_t uid, const ::std::vector<uint8_t>& enrolledPasswordHandle,
+    Status verify(int32_t userId, const ::std::vector<uint8_t>& enrolledPasswordHandle,
                   const ::std::vector<uint8_t>& providedPassword, GKResponse* gkResponse) override {
-        return verifyChallenge(uid, 0 /* challenge */, enrolledPasswordHandle, providedPassword,
+        return verifyChallenge(userId, 0 /* challenge */, enrolledPasswordHandle, providedPassword,
                                gkResponse);
     }
 
-    Status verifyChallenge(int32_t uid, int64_t challenge,
+    Status verifyChallenge(int32_t userId, int64_t challenge,
                            const std::vector<uint8_t>& enrolledPasswordHandle,
                            const std::vector<uint8_t>& providedPassword,
                            GKResponse* gkResponse) override {
@@ -269,7 +272,7 @@
                 reinterpret_cast<const gatekeeper::password_handle_t*>(
                         enrolledPasswordHandle.data());
 
-        uint32_t hw_uid = adjust_uid(uid);
+        uint32_t hw_userId = adjust_userId(userId);
         android::hardware::hidl_vec<uint8_t> curPwdHandle;
         curPwdHandle.setToExternal(const_cast<uint8_t*>(enrolledPasswordHandle.data()),
                                    enrolledPasswordHandle.size());
@@ -278,7 +281,7 @@
                                  providedPassword.size());
 
         Return<void> hwRes = hw_device->verify(
-                hw_uid, challenge, curPwdHandle, enteredPwd,
+                hw_userId, challenge, curPwdHandle, enteredPwd,
                 [&gkResponse](const GatekeeperResponse& rsp) {
                     if (rsp.code >= GatekeeperStatusCode::STATUS_OK) {
                         *gkResponse = GKResponse::ok(
@@ -298,7 +301,35 @@
 
         if (gkResponse->response_code() == GKResponseCode::OK) {
             if (gkResponse->payload().size() != 0) {
+                // try to connect to IKeystoreAuthorization AIDL service first.
+                AIBinder* authzAIBinder =
+                        AServiceManager_checkService("android.security.authorization");
+                ::ndk::SpAIBinder authzBinder(authzAIBinder);
+                auto authzService = IKeystoreAuthorization::fromBinder(authzBinder);
+                if (authzService) {
+                    if (gkResponse->payload().size() != sizeof(hw_auth_token_t)) {
+                        LOG(ERROR) << "Incorrect size of AuthToken payload.";
+                        return GK_ERROR;
+                    }
+
+                    const hw_auth_token_t* hwAuthToken =
+                            reinterpret_cast<const hw_auth_token_t*>(gkResponse->payload().data());
+                    HardwareAuthToken authToken;
+
+                    authToken.timestamp.milliSeconds = betoh64(hwAuthToken->timestamp);
+                    authToken.challenge = hwAuthToken->challenge;
+                    authToken.authenticatorId = hwAuthToken->authenticator_id;
+                    authToken.authenticatorType = static_cast<HardwareAuthenticatorType>(
+                            betoh32(hwAuthToken->authenticator_type));
+                    authToken.mac.assign(&hwAuthToken->hmac[0], &hwAuthToken->hmac[32]);
+                    auto result = authzService->addAuthToken(authToken);
+                    if (!result.isOk()) {
+                        LOG(ERROR) << "Failure in sending AuthToken to AuthorizationService.";
+                        return GK_ERROR;
+                    }
+                }
                 sp<IServiceManager> sm = defaultServiceManager();
+
                 sp<IBinder> binder = sm->getService(String16("android.security.keystore"));
                 sp<security::keystore::IKeystoreService> service =
                         interface_cast<security::keystore::IKeystoreService>(binder);
@@ -309,24 +340,27 @@
                     if (!binder_result.isOk() ||
                         !keystore::KeyStoreServiceReturnCode(result).isOk()) {
                         LOG(ERROR) << "Failure sending auth token to KeyStore: " << result;
+                        return GK_ERROR;
                     }
                 } else {
-                    LOG(ERROR) << "Cannot deliver auth token. Unable to communicate with Keystore.";
+                    LOG(ERROR) << "Cannot deliver auth token. Unable to communicate with "
+                                  "Keystore.";
+                    return GK_ERROR;
                 }
             }
 
-            maybe_store_sid(uid, handle->user_id);
+            maybe_store_sid(userId, handle->user_id);
         }
 
         return Status::ok();
     }
 
-    Status getSecureUserId(int32_t uid, int64_t* sid) override {
-        *sid = read_sid(uid);
+    Status getSecureUserId(int32_t userId, int64_t* sid) override {
+        *sid = read_sid(userId);
         return Status::ok();
     }
 
-    Status clearSecureUserId(int32_t uid) override {
+    Status clearSecureUserId(int32_t userId) override {
         IPCThreadState* ipc = IPCThreadState::self();
         const int calling_pid = ipc->getCallingPid();
         const int calling_uid = ipc->getCallingUid();
@@ -334,11 +368,11 @@
             ALOGE("%s: permission denied for [%d:%d]", __func__, calling_pid, calling_uid);
             return Status::ok();
         }
-        clear_sid(uid);
+        clear_sid(userId);
 
         if (hw_device) {
-            uint32_t hw_uid = adjust_uid(uid);
-            hw_device->deleteUser(hw_uid, [] (const GatekeeperResponse &){});
+            uint32_t hw_userId = adjust_userId(userId);
+            hw_device->deleteUser(hw_userId, [](const GatekeeperResponse&) {});
         }
         return Status::ok();
     }
@@ -365,23 +399,23 @@
         }
 
         if (hw_device == NULL) {
-            const char *result = "Device not available";
+            const char* result = "Device not available";
             write(fd, result, strlen(result) + 1);
         } else {
-            const char *result = "OK";
+            const char* result = "OK";
             write(fd, result, strlen(result) + 1);
         }
 
         return OK;
     }
 
-private:
+  private:
     sp<IGatekeeper> hw_device;
 
     bool clear_state_if_needed_done;
     bool is_running_gsi;
 };
-}// namespace android
+}  // namespace android
 
 int main(int argc, char* argv[]) {
     ALOGI("Starting gatekeeperd...");
diff --git a/healthd/Android.bp b/healthd/Android.bp
index 14d46b3..251a45b 100644
--- a/healthd/Android.bp
+++ b/healthd/Android.bp
@@ -62,29 +62,6 @@
     srcs: [
         "HealthServiceDefault.cpp",
     ],
-
-    overrides: [
-        "healthd",
-    ]
-}
-
-cc_binary {
-    name: "healthd",
-    defaults: ["android.hardware.health@2.0-service_defaults"],
-
-    init_rc: ["healthd.rc"],
-    srcs: [
-        "HealthServiceHealthd.cpp",
-    ],
-    local_include_dirs: ["include"],
-
-    shared_libs: [
-        "android.hardware.health@1.0",
-    ],
-
-    vintf_fragments: [
-        "manifest_healthd.xml"
-    ],
 }
 
 cc_library_static {
@@ -240,3 +217,47 @@
     defaults: ["charger_defaults"],
     srcs: ["charger_test.cpp"],
 }
+
+cc_test {
+    name: "libhealthd_charger_test",
+    defaults: ["charger_defaults"],
+    srcs: [
+        "AnimationParser_test.cpp",
+        "healthd_mode_charger_test.cpp"
+    ],
+    static_libs: [
+        "libgmock",
+    ],
+    test_suites: [
+        "general-tests",
+        "device-tests",
+    ],
+    data: [
+        ":libhealthd_charger_test_data",
+    ],
+    require_root: true,
+}
+
+// /system/etc/res/images/charger/battery_fail.png
+prebuilt_etc {
+    name: "system_core_charger_res_images_battery_fail.png",
+    src: "images/battery_fail.png",
+    relative_install_path: "res/images/charger",
+    filename: "battery_fail.png",
+}
+
+// /system/etc/res/images/charger/battery_scale.png
+prebuilt_etc {
+    name: "system_core_charger_res_images_battery_scale.png",
+    src: "images/battery_scale.png",
+    relative_install_path: "res/images/charger",
+    filename: "battery_scale.png",
+}
+
+phony {
+    name: "charger_res_images",
+    required: [
+        "system_core_charger_res_images_battery_fail.png",
+        "system_core_charger_res_images_battery_scale.png",
+    ],
+}
diff --git a/healthd/Android.mk b/healthd/Android.mk
deleted file mode 100644
index 4b09cf8..0000000
--- a/healthd/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2013 The Android Open Source Project
-
-LOCAL_PATH := $(call my-dir)
-
-ifeq ($(strip $(BOARD_CHARGER_NO_UI)),true)
-LOCAL_CHARGER_NO_UI := true
-endif
-
-### charger_res_images ###
-ifneq ($(strip $(LOCAL_CHARGER_NO_UI)),true)
-define _add-charger-image
-include $$(CLEAR_VARS)
-LOCAL_MODULE := system_core_charger_res_images_$(notdir $(1))
-LOCAL_MODULE_STEM := $(notdir $(1))
-_img_modules += $$(LOCAL_MODULE)
-LOCAL_SRC_FILES := $1
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $$(TARGET_ROOT_OUT)/res/images/charger
-include $$(BUILD_PREBUILT)
-endef
-
-_img_modules :=
-_images :=
-$(foreach _img, $(call find-subdir-subdir-files, "images", "*.png"), \
-  $(eval $(call _add-charger-image,$(_img))))
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := charger_res_images
-LOCAL_MODULE_TAGS := optional
-LOCAL_REQUIRED_MODULES := $(_img_modules)
-include $(BUILD_PHONY_PACKAGE)
-
-_add-charger-image :=
-_img_modules :=
-endif # LOCAL_CHARGER_NO_UI
diff --git a/healthd/AnimationParser.cpp b/healthd/AnimationParser.cpp
index fde3b95..6b08570 100644
--- a/healthd/AnimationParser.cpp
+++ b/healthd/AnimationParser.cpp
@@ -37,8 +37,8 @@
     return true;
 }
 
-bool remove_prefix(const std::string& line, const char* prefix, const char** rest) {
-    const char* str = line.c_str();
+bool remove_prefix(std::string_view line, const char* prefix, const char** rest) {
+    const char* str = line.data();
     int start;
     char c;
 
diff --git a/healthd/AnimationParser.h b/healthd/AnimationParser.h
index bc00845..f55b563 100644
--- a/healthd/AnimationParser.h
+++ b/healthd/AnimationParser.h
@@ -17,6 +17,8 @@
 #ifndef HEALTHD_ANIMATION_PARSER_H
 #define HEALTHD_ANIMATION_PARSER_H
 
+#include <string_view>
+
 #include "animation.h"
 
 namespace android {
@@ -24,7 +26,7 @@
 bool parse_animation_desc(const std::string& content, animation* anim);
 
 bool can_ignore_line(const char* str);
-bool remove_prefix(const std::string& str, const char* prefix, const char** rest);
+bool remove_prefix(std::string_view str, const char* prefix, const char** rest);
 bool parse_text_field(const char* in, animation::text_field* field);
 }  // namespace android
 
diff --git a/healthd/tests/AnimationParser_test.cpp b/healthd/AnimationParser_test.cpp
similarity index 100%
rename from healthd/tests/AnimationParser_test.cpp
rename to healthd/AnimationParser_test.cpp
diff --git a/healthd/HealthServiceHealthd.cpp b/healthd/HealthServiceHealthd.cpp
deleted file mode 100644
index 5fd2597..0000000
--- a/healthd/HealthServiceHealthd.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#define LOG_TAG "healthd"
-#include <android-base/logging.h>
-
-#include <android/hardware/health/1.0/IHealth.h>
-#include <android/hardware/health/1.0/types.h>
-#include <hal_conversion.h>
-#include <health2/service.h>
-#include <healthd/healthd.h>
-#include <hidl/HidlTransportSupport.h>
-
-using android::OK;
-using android::NAME_NOT_FOUND;
-using android::hardware::health::V1_0::HealthConfig;
-using android::hardware::health::V1_0::HealthInfo;
-using android::hardware::health::V1_0::Result;
-using android::hardware::health::V1_0::hal_conversion::convertFromHealthConfig;
-using android::hardware::health::V1_0::hal_conversion::convertToHealthConfig;
-using android::hardware::health::V1_0::hal_conversion::convertFromHealthInfo;
-using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo;
-
-using IHealthLegacy = android::hardware::health::V1_0::IHealth;
-
-static android::sp<IHealthLegacy> gHealth_1_0;
-
-static int healthd_board_get_energy_counter(int64_t* energy) {
-    if (gHealth_1_0 == nullptr) {
-        return NAME_NOT_FOUND;
-    }
-
-    Result result = Result::NOT_SUPPORTED;
-    gHealth_1_0->energyCounter([energy, &result](Result ret, int64_t energyOut) {
-        result = ret;
-        *energy = energyOut;
-    });
-
-    return result == Result::SUCCESS ? OK : NAME_NOT_FOUND;
-}
-
-void healthd_board_init(struct healthd_config* config) {
-    gHealth_1_0 = IHealthLegacy::getService();
-
-    if (gHealth_1_0 == nullptr) {
-        return;
-    }
-
-    HealthConfig halConfig{};
-    convertToHealthConfig(config, halConfig);
-    gHealth_1_0->init(halConfig, [config](const auto& halConfigOut) {
-        convertFromHealthConfig(halConfigOut, config);
-        // always redirect energy counter queries
-        config->energyCounter = healthd_board_get_energy_counter;
-    });
-    LOG(INFO) << LOG_TAG << ": redirecting calls to 1.0 health HAL";
-}
-
-// TODO(b/68724651): Move this function into healthd_mode_service_2_0_battery_update
-// with logthis returned.
-int healthd_board_battery_update(struct android::BatteryProperties* props) {
-    int logthis = 0;
-
-    if (gHealth_1_0 == nullptr) {
-        return logthis;
-    }
-
-    HealthInfo info;
-    convertToHealthInfo(props, info);
-    gHealth_1_0->update(info, [props, &logthis](int32_t ret, const auto& infoOut) {
-        logthis = ret;
-        convertFromHealthInfo(infoOut, props);
-    });
-
-    return logthis;
-}
-
-int main() {
-    return health_service_main("backup");
-}
diff --git a/healthd/TEST_MAPPING b/healthd/TEST_MAPPING
new file mode 100644
index 0000000..5893d10
--- /dev/null
+++ b/healthd/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "libhealthd_charger_test"
+    }
+  ]
+}
diff --git a/healthd/android.hardware.health@2.0-service.rc b/healthd/android.hardware.health@2.0-service.rc
index 6960c5d..762771e 100644
--- a/healthd/android.hardware.health@2.0-service.rc
+++ b/healthd/android.hardware.health@2.0-service.rc
@@ -2,5 +2,5 @@
     class hal
     user system
     group system
-    capabilities WAKE_ALARM
+    capabilities WAKE_ALARM BLOCK_SUSPEND
     file /dev/kmsg w
diff --git a/healthd/animation.h b/healthd/animation.h
index d02d7a7..c2d5f1c 100644
--- a/healthd/animation.h
+++ b/healthd/animation.h
@@ -18,6 +18,7 @@
 #define HEALTHD_ANIMATION_H
 
 #include <inttypes.h>
+
 #include <string>
 
 class GRSurface;
@@ -52,20 +53,11 @@
     // - When treating paths as relative paths, it adds ".png" suffix.
     // - When treating paths as absolute paths, it doesn't add the suffix. Hence, the suffix
     //   is added here.
-    void set_resource_root(const std::string& root) {
-        if (!animation_file.empty()) {
-            animation_file = root + animation_file + ".png";
-        }
-        if (!fail_file.empty()) {
-            fail_file = root + fail_file + ".png";
-        }
-        if (!text_clock.font_file.empty()) {
-            text_clock.font_file = root + text_clock.font_file + ".png";
-        }
-        if (!text_percent.font_file.empty()) {
-            text_percent.font_file = root + text_percent.font_file + ".png";
-        }
-    }
+    // If |backup_root| is provided, additionally check if file under |root| is accessbile or not.
+    // If not accessbile, use |backup_root| instead.
+    // Require that |root| starts and ends with "/". If |backup_root| is provided, require that
+    // |backup_root| starts and ends with "/".
+    void set_resource_root(const std::string& root, const std::string& backup_root = "");
 
     std::string animation_file;
     std::string fail_file;
diff --git a/healthd/api/charger_sysprop-current.txt b/healthd/api/charger_sysprop-current.txt
index 678c847..e69de29 100644
--- a/healthd/api/charger_sysprop-current.txt
+++ b/healthd/api/charger_sysprop-current.txt
@@ -1,29 +0,0 @@
-props {
-  module: "android.sysprop.ChargerProperties"
-  prop {
-    api_name: "disable_init_blank"
-    scope: Internal
-    prop_name: "ro.charger.disable_init_blank"
-  }
-  prop {
-    api_name: "draw_split_offset"
-    type: Long
-    scope: Internal
-    prop_name: "ro.charger.draw_split_offset"
-  }
-  prop {
-    api_name: "draw_split_screen"
-    scope: Internal
-    prop_name: "ro.charger.draw_split_screen"
-  }
-  prop {
-    api_name: "enable_suspend"
-    scope: Internal
-    prop_name: "ro.charger.enable_suspend"
-  }
-  prop {
-    api_name: "no_ui"
-    scope: Internal
-    prop_name: "ro.charger.no_ui"
-  }
-}
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index 386ba1a..e95efc0 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -33,7 +33,9 @@
 #include <optional>
 
 #include <android-base/file.h>
+#include <android-base/logging.h>
 #include <android-base/macros.h>
+#include <android-base/strings.h>
 
 #include <linux/netlink.h>
 #include <sys/socket.h>
@@ -58,6 +60,7 @@
 #include <health2impl/Health.h>
 #include <healthd/healthd.h>
 
+using std::string_literals::operator""s;
 using namespace android;
 using android::hardware::Return;
 using android::hardware::health::GetHealthServiceOrDefault;
@@ -103,7 +106,13 @@
 
 namespace android {
 
-// Resources in /product/etc/res overrides resources in /res.
+// Legacy animation resources are loaded from this directory.
+static constexpr const char* legacy_animation_root = "/res/images/";
+
+// Built-in animation resources are loaded from this directory.
+static constexpr const char* system_animation_root = "/system/etc/res/images/";
+
+// Resources in /product/etc/res overrides resources in /res and /system/etc/res.
 // If the device is using the Generic System Image (GSI), resources may exist in
 // both paths.
 static constexpr const char* product_animation_desc_path =
@@ -625,6 +634,12 @@
         batt_anim_.set_resource_root(product_animation_root);
     } else if (base::ReadFileToString(animation_desc_path, &content)) {
         parse_success = parse_animation_desc(content, &batt_anim_);
+        // Fallback resources always exist in system_animation_root. On legacy devices with an old
+        // ramdisk image, resources may be overridden under root. For example,
+        // /res/images/charger/battery_fail.png may not be the same as
+        // system/core/healthd/images/battery_fail.png in the source tree, but is a device-specific
+        // image. Hence, load from /res, and fall back to /system/etc/res.
+        batt_anim_.set_resource_root(legacy_animation_root, system_animation_root);
     } else {
         LOGW("Could not open animation description at %s\n", animation_desc_path);
         parse_success = false;
@@ -633,13 +648,13 @@
     if (!parse_success) {
         LOGW("Could not parse animation description. Using default animation.\n");
         batt_anim_ = BASE_ANIMATION;
-        batt_anim_.animation_file.assign("charger/battery_scale");
+        batt_anim_.animation_file.assign(system_animation_root + "charger/battery_scale.png"s);
         InitDefaultAnimationFrames();
         batt_anim_.frames = owned_frames_.data();
         batt_anim_.num_frames = owned_frames_.size();
     }
     if (batt_anim_.fail_file.empty()) {
-        batt_anim_.fail_file.assign("charger/battery_fail");
+        batt_anim_.fail_file.assign(system_animation_root + "charger/battery_fail.png"s);
     }
 
     LOGV("Animation Description:\n");
@@ -678,10 +693,11 @@
 
     InitAnimation();
 
-    ret = res_create_display_surface(batt_anim_.fail_file.c_str(), &surf_unknown_);
+    ret = CreateDisplaySurface(batt_anim_.fail_file, &surf_unknown_);
     if (ret < 0) {
         LOGE("Cannot load custom battery_fail image. Reverting to built in: %d\n", ret);
-        ret = res_create_display_surface("charger/battery_fail", &surf_unknown_);
+        ret = CreateDisplaySurface((system_animation_root + "charger/battery_fail.png"s).c_str(),
+                                   &surf_unknown_);
         if (ret < 0) {
             LOGE("Cannot load built in battery_fail image\n");
             surf_unknown_ = NULL;
@@ -692,8 +708,8 @@
     int scale_count;
     int scale_fps;  // Not in use (charger/battery_scale doesn't have FPS text
                     // chunk). We are using hard-coded frame.disp_time instead.
-    ret = res_create_multi_display_surface(batt_anim_.animation_file.c_str(), &scale_count,
-                                           &scale_fps, &scale_frames);
+    ret = CreateMultiDisplaySurface(batt_anim_.animation_file, &scale_count, &scale_fps,
+                                    &scale_frames);
     if (ret < 0) {
         LOGE("Cannot load battery_scale image\n");
         batt_anim_.num_frames = 0;
@@ -722,6 +738,43 @@
     boot_min_cap_ = config->boot_min_cap;
 }
 
+int Charger::CreateDisplaySurface(const std::string& name, GRSurface** surface) {
+    return res_create_display_surface(name.c_str(), surface);
+}
+
+int Charger::CreateMultiDisplaySurface(const std::string& name, int* frames, int* fps,
+                                       GRSurface*** surface) {
+    return res_create_multi_display_surface(name.c_str(), frames, fps, surface);
+}
+
+void set_resource_root_for(const std::string& root, const std::string& backup_root,
+                           std::string* value) {
+    if (value->empty()) {
+        return;
+    }
+
+    std::string new_value = root + *value + ".png";
+    // If |backup_root| is provided, additionally check whether the file under |root| is
+    // accessible or not. If not accessible, fallback to file under |backup_root|.
+    if (!backup_root.empty() && access(new_value.data(), F_OK) == -1) {
+        new_value = backup_root + *value + ".png";
+    }
+
+    *value = new_value;
+}
+
+void animation::set_resource_root(const std::string& root, const std::string& backup_root) {
+    CHECK(android::base::StartsWith(root, "/") && android::base::EndsWith(root, "/"))
+            << "animation root " << root << " must start and end with /";
+    CHECK(backup_root.empty() || (android::base::StartsWith(backup_root, "/") &&
+                                  android::base::EndsWith(backup_root, "/")))
+            << "animation backup root " << backup_root << " must start and end with /";
+    set_resource_root_for(root, backup_root, &animation_file);
+    set_resource_root_for(root, backup_root, &fail_file);
+    set_resource_root_for(root, backup_root, &text_clock.font_file);
+    set_resource_root_for(root, backup_root, &text_percent.font_file);
+}
+
 }  // namespace android
 
 int healthd_charger_main(int argc, char** argv) {
diff --git a/healthd/healthd_mode_charger.h b/healthd/healthd_mode_charger.h
index 6e569ee..6f9ae8c 100644
--- a/healthd/healthd_mode_charger.h
+++ b/healthd/healthd_mode_charger.h
@@ -53,6 +53,11 @@
     // HalHealthLoop overrides
     void OnHealthInfoChanged(const HealthInfo_2_1& health_info) override;
 
+    // Allowed to be mocked for testing.
+    virtual int CreateDisplaySurface(const std::string& name, GRSurface** surface);
+    virtual int CreateMultiDisplaySurface(const std::string& name, int* frames, int* fps,
+                                          GRSurface*** surface);
+
   private:
     void InitDefaultAnimationFrames();
     void UpdateScreenState(int64_t now);
diff --git a/healthd/healthd_mode_charger_test.cpp b/healthd/healthd_mode_charger_test.cpp
new file mode 100644
index 0000000..f444f66
--- /dev/null
+++ b/healthd/healthd_mode_charger_test.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <sysexits.h>
+#include <unistd.h>
+
+#include <iostream>
+#include <string>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/strings.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <health/utils.h>
+
+#include "healthd_mode_charger.h"
+
+using android::hardware::Return;
+using android::hardware::health::InitHealthdConfig;
+using std::string_literals::operator""s;
+using testing::_;
+using testing::Invoke;
+using testing::NiceMock;
+using testing::StrEq;
+using testing::Test;
+
+namespace android {
+
+// A replacement to ASSERT_* to be used in a forked process. When the condition is not met,
+// print a gtest message, then exit abnormally.
+class ChildAssertHelper : public std::stringstream {
+  public:
+    ChildAssertHelper(bool res, const char* expr, const char* file, int line) : res_(res) {
+        (*this) << file << ":" << line << ": `" << expr << "` evaluates to false\n";
+    }
+    ~ChildAssertHelper() {
+        EXPECT_TRUE(res_) << str();
+        if (!res_) exit(EX_SOFTWARE);
+    }
+
+  private:
+    bool res_;
+    DISALLOW_COPY_AND_ASSIGN(ChildAssertHelper);
+};
+#define CHILD_ASSERT_TRUE(expr) ChildAssertHelper(expr, #expr, __FILE__, __LINE__)
+
+// Run |test_body| in a chroot jail in a forked process. |subdir| is a sub-directory in testdata.
+// Within |test_body|,
+// - non-fatal errors may be reported using EXPECT_* macro as usual.
+// - fatal errors must be reported using CHILD_ASSERT_TRUE macro. ASSERT_* must not be used.
+void ForkTest(const std::string& subdir, const std::function<void(void)>& test_body) {
+    pid_t pid = fork();
+    ASSERT_GE(pid, 0) << "Fork fails: " << strerror(errno);
+    if (pid == 0) {
+        // child
+        CHILD_ASSERT_TRUE(
+                chroot((android::base::GetExecutableDirectory() + "/" + subdir).c_str()) != -1)
+                << "Failed to chroot to " << subdir << ": " << strerror(errno);
+        test_body();
+        // EXPECT_* macros may set the HasFailure bit without calling exit(). Set exit status
+        // accordingly.
+        exit(::testing::Test::HasFailure() ? EX_SOFTWARE : EX_OK);
+    }
+    // parent
+    int status;
+    ASSERT_NE(-1, waitpid(pid, &status, 0)) << "waitpid() fails: " << strerror(errno);
+    ASSERT_TRUE(WIFEXITED(status)) << "Test fails, waitpid() returns " << status;
+    ASSERT_EQ(EX_OK, WEXITSTATUS(status)) << "Test fails, child process returns " << status;
+}
+
+class MockHealth : public android::hardware::health::V2_1::IHealth {
+    MOCK_METHOD(Return<::android::hardware::health::V2_0::Result>, registerCallback,
+                (const sp<::android::hardware::health::V2_0::IHealthInfoCallback>& callback));
+    MOCK_METHOD(Return<::android::hardware::health::V2_0::Result>, unregisterCallback,
+                (const sp<::android::hardware::health::V2_0::IHealthInfoCallback>& callback));
+    MOCK_METHOD(Return<::android::hardware::health::V2_0::Result>, update, ());
+    MOCK_METHOD(Return<void>, getChargeCounter, (getChargeCounter_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getCurrentNow, (getCurrentNow_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getCurrentAverage, (getCurrentAverage_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getCapacity, (getCapacity_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getEnergyCounter, (getEnergyCounter_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getChargeStatus, (getChargeStatus_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getStorageInfo, (getStorageInfo_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getDiskStats, (getDiskStats_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getHealthInfo, (getHealthInfo_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getHealthConfig, (getHealthConfig_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, getHealthInfo_2_1, (getHealthInfo_2_1_cb _hidl_cb));
+    MOCK_METHOD(Return<void>, shouldKeepScreenOn, (shouldKeepScreenOn_cb _hidl_cb));
+};
+
+class TestCharger : public Charger {
+  public:
+    // Inherit constructor.
+    using Charger::Charger;
+    // Expose protected functions to be used in tests.
+    void Init(struct healthd_config* config) override { Charger::Init(config); }
+    MOCK_METHOD(int, CreateDisplaySurface, (const std::string& name, GRSurface** surface));
+    MOCK_METHOD(int, CreateMultiDisplaySurface,
+                (const std::string& name, int* frames, int* fps, GRSurface*** surface));
+};
+
+// Intentionally leak TestCharger instance to avoid calling ~HealthLoop() because ~HealthLoop()
+// should never be called. But still verify expected calls upon destruction.
+class VerifiedTestCharger {
+  public:
+    VerifiedTestCharger(TestCharger* charger) : charger_(charger) {
+        testing::Mock::AllowLeak(charger_);
+    }
+    TestCharger& operator*() { return *charger_; }
+    TestCharger* operator->() { return charger_; }
+    ~VerifiedTestCharger() { testing::Mock::VerifyAndClearExpectations(charger_); }
+
+  private:
+    TestCharger* charger_;
+};
+
+// Do not use SetUp and TearDown of a test suite, as they will be invoked in the parent process, not
+// the child process. In particular, if the test suite contains mocks, they will not be verified in
+// the child process. Instead, create mocks within closures in each tests.
+void ExpectChargerResAt(const std::string& root) {
+    sp<NiceMock<MockHealth>> health(new NiceMock<MockHealth>());
+    VerifiedTestCharger charger(new NiceMock<TestCharger>(health));
+
+    // Only one frame in all testdata/**/animation.txt
+    GRSurface* multi[] = {nullptr};
+
+    EXPECT_CALL(*charger, CreateDisplaySurface(StrEq(root + "charger/battery_fail.png"), _))
+            .WillRepeatedly(Invoke([](const auto&, GRSurface** surface) {
+                *surface = nullptr;
+                return 0;
+            }));
+    EXPECT_CALL(*charger,
+                CreateMultiDisplaySurface(StrEq(root + "charger/battery_scale.png"), _, _, _))
+            .WillRepeatedly(Invoke([&](const auto&, int* frames, int* fps, GRSurface*** surface) {
+                *frames = arraysize(multi);
+                *fps = 60;  // Unused fps value
+                *surface = multi;
+                return 0;
+            }));
+    struct healthd_config healthd_config;
+    InitHealthdConfig(&healthd_config);
+    charger->Init(&healthd_config);
+};
+
+// Test that if resources does not exist in /res or in /product/etc/res, load from /system.
+TEST(ChargerLoadAnimationRes, Empty) {
+    ForkTest("empty", std::bind(&ExpectChargerResAt, "/system/etc/res/images/"));
+}
+
+// Test loading everything from /res
+TEST(ChargerLoadAnimationRes, Legacy) {
+    ForkTest("legacy", std::bind(&ExpectChargerResAt, "/res/images/"));
+}
+
+// Test loading animation text from /res but images from /system if images does not exist under
+// /res.
+TEST(ChargerLoadAnimationRes, LegacyTextSystemImages) {
+    ForkTest("legacy_text_system_images",
+             std::bind(&ExpectChargerResAt, "/system/etc/res/images/"));
+}
+
+// Test loading everything from /product
+TEST(ChargerLoadAnimationRes, Product) {
+    ForkTest("product", std::bind(&ExpectChargerResAt, "/product/etc/res/images/"));
+}
+
+}  // namespace android
diff --git a/healthd/manifest_healthd.xml b/healthd/manifest_healthd.xml
deleted file mode 100644
index 097a7d8..0000000
--- a/healthd/manifest_healthd.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="framework">
-    <hal>
-        <name>android.hardware.health</name>
-        <transport>hwbinder</transport>
-        <version>2.0</version>
-        <interface>
-            <name>IHealth</name>
-            <instance>backup</instance>
-        </interface>
-    </hal>
-</manifest>
diff --git a/healthd/testdata/Android.bp b/healthd/testdata/Android.bp
new file mode 100644
index 0000000..110c79a
--- /dev/null
+++ b/healthd/testdata/Android.bp
@@ -0,0 +1,20 @@
+//
+// Copyright (C) 2020 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.
+//
+
+filegroup {
+    name: "libhealthd_charger_test_data",
+    srcs: ["**/*.*"],
+}
diff --git a/healthd/testdata/empty/ensure_directory_creation.txt b/healthd/testdata/empty/ensure_directory_creation.txt
new file mode 100644
index 0000000..36ceff4
--- /dev/null
+++ b/healthd/testdata/empty/ensure_directory_creation.txt
@@ -0,0 +1 @@
+File is placed to ensure directory is created on the device.
diff --git a/adb/MODULE_LICENSE_APACHE2 b/healthd/testdata/legacy/res/images/charger/battery_fail.png
similarity index 100%
rename from adb/MODULE_LICENSE_APACHE2
rename to healthd/testdata/legacy/res/images/charger/battery_fail.png
diff --git a/adb/MODULE_LICENSE_APACHE2 b/healthd/testdata/legacy/res/images/charger/battery_scale.png
similarity index 100%
copy from adb/MODULE_LICENSE_APACHE2
copy to healthd/testdata/legacy/res/images/charger/battery_scale.png
diff --git a/healthd/testdata/legacy/res/values/charger/animation.txt b/healthd/testdata/legacy/res/values/charger/animation.txt
new file mode 100644
index 0000000..0753336
--- /dev/null
+++ b/healthd/testdata/legacy/res/values/charger/animation.txt
@@ -0,0 +1,9 @@
+# Sample Animation file for testing.
+
+# animation: num_cycles, first_frame_repeats, animation_file
+animation: 2 1 charger/battery_scale
+
+fail: charger/battery_fail
+
+# frame: disp_time min_level max_level
+frame: 15 0 100
diff --git a/healthd/testdata/legacy_text_system_images/res/values/charger/animation.txt b/healthd/testdata/legacy_text_system_images/res/values/charger/animation.txt
new file mode 100644
index 0000000..0753336
--- /dev/null
+++ b/healthd/testdata/legacy_text_system_images/res/values/charger/animation.txt
@@ -0,0 +1,9 @@
+# Sample Animation file for testing.
+
+# animation: num_cycles, first_frame_repeats, animation_file
+animation: 2 1 charger/battery_scale
+
+fail: charger/battery_fail
+
+# frame: disp_time min_level max_level
+frame: 15 0 100
diff --git a/adb/MODULE_LICENSE_APACHE2 b/healthd/testdata/product/product/etc/res/images/charger/battery_fail.png
similarity index 100%
copy from adb/MODULE_LICENSE_APACHE2
copy to healthd/testdata/product/product/etc/res/images/charger/battery_fail.png
diff --git a/adb/MODULE_LICENSE_APACHE2 b/healthd/testdata/product/product/etc/res/images/charger/battery_scale.png
similarity index 100%
copy from adb/MODULE_LICENSE_APACHE2
copy to healthd/testdata/product/product/etc/res/images/charger/battery_scale.png
diff --git a/healthd/testdata/product/product/etc/res/values/charger/animation.txt b/healthd/testdata/product/product/etc/res/values/charger/animation.txt
new file mode 100644
index 0000000..0753336
--- /dev/null
+++ b/healthd/testdata/product/product/etc/res/values/charger/animation.txt
@@ -0,0 +1,9 @@
+# Sample Animation file for testing.
+
+# animation: num_cycles, first_frame_repeats, animation_file
+animation: 2 1 charger/battery_scale
+
+fail: charger/battery_fail
+
+# frame: disp_time min_level max_level
+frame: 15 0 100
diff --git a/healthd/tests/Android.mk b/healthd/tests/Android.mk
deleted file mode 100644
index 87e8862..0000000
--- a/healthd/tests/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2016 The Android Open Source Project
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-    AnimationParser_test.cpp \
-
-LOCAL_MODULE := healthd_test
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_STATIC_LIBRARIES := \
-	libhealthd_internal \
-
-LOCAL_SHARED_LIBRARIES := \
-	liblog \
-	libbase \
-	libcutils \
-
-include $(BUILD_NATIVE_TEST)
diff --git a/include/android/log.h b/include/android/log.h
deleted file mode 120000
index 736c448..0000000
--- a/include/android/log.h
+++ /dev/null
@@ -1 +0,0 @@
-../../liblog/include/android/log.h
\ No newline at end of file
diff --git a/include/backtrace b/include/backtrace
deleted file mode 120000
index 93ce2b1..0000000
--- a/include/backtrace
+++ /dev/null
@@ -1 +0,0 @@
-../libbacktrace/include/backtrace
\ No newline at end of file
diff --git a/include/log b/include/log
deleted file mode 120000
index 714065f..0000000
--- a/include/log
+++ /dev/null
@@ -1 +0,0 @@
-../liblog/include/log
\ No newline at end of file
diff --git a/include/private/android_filesystem_capability.h b/include/private/android_filesystem_capability.h
deleted file mode 120000
index f310b35..0000000
--- a/include/private/android_filesystem_capability.h
+++ /dev/null
@@ -1 +0,0 @@
-../../libcutils/include/private/android_filesystem_capability.h
\ No newline at end of file
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
deleted file mode 120000
index f28a564..0000000
--- a/include/private/android_filesystem_config.h
+++ /dev/null
@@ -1 +0,0 @@
-../../libcutils/include/private/android_filesystem_config.h
\ No newline at end of file
diff --git a/include/private/android_logger.h b/include/private/android_logger.h
deleted file mode 120000
index f187a6d..0000000
--- a/include/private/android_logger.h
+++ /dev/null
@@ -1 +0,0 @@
-../../liblog/include/private/android_logger.h
\ No newline at end of file
diff --git a/include/private/canned_fs_config.h b/include/private/canned_fs_config.h
deleted file mode 120000
index 8f92b2d..0000000
--- a/include/private/canned_fs_config.h
+++ /dev/null
@@ -1 +0,0 @@
-../../libcutils/include/private/canned_fs_config.h
\ No newline at end of file
diff --git a/include/private/fs_config.h b/include/private/fs_config.h
deleted file mode 100644
index e9868a4..0000000
--- a/include/private/fs_config.h
+++ /dev/null
@@ -1,4 +0,0 @@
-// TODO(b/63135587) remove this file after the transitive dependency
-// from private/android_filesystem_config.h is resolved. All files that use
-// libcutils/include/private/fs_config.h should include the file directly, not
-// indirectly via private/android_filesystem_config.h.
diff --git a/include/sysutils b/include/sysutils
deleted file mode 120000
index 1c8e85b..0000000
--- a/include/sysutils
+++ /dev/null
@@ -1 +0,0 @@
-../libsysutils/include/sysutils/
\ No newline at end of file
diff --git a/init/Android.bp b/init/Android.bp
index 827a829..06ecc59 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -60,6 +60,7 @@
     "selabel.cpp",
     "selinux.cpp",
     "sigchld_handler.cpp",
+    "snapuserd_transition.cpp",
     "switch_root.cpp",
     "uevent_listener.cpp",
     "ueventd.cpp",
@@ -129,8 +130,11 @@
         "libprotobuf-cpp-lite",
         "libpropertyinfoserializer",
         "libpropertyinfoparser",
+        "libsnapshot_cow",
         "libsnapshot_init",
+        "libxml2",
         "lib_apex_manifest_proto_lite",
+        "update_metadata-protos",
     ],
     shared_libs: [
         "libbacktrace",
@@ -163,6 +167,9 @@
         "selinux_policy_version",
     ],
     srcs: init_common_sources + init_device_sources,
+    generated_sources: [
+        "apex-info-list",
+    ],
     whole_static_libs: [
         "libcap",
         "com.android.sysprop.apex",
@@ -177,6 +184,12 @@
     target: {
         recovery: {
             cflags: ["-DRECOVERY"],
+            exclude_static_libs: [
+                "libxml2",
+            ],
+            exclude_generated_sources: [
+                "apex-info-list",
+            ],
             exclude_shared_libs: [
                 "libbinder",
                 "libutils",
@@ -211,12 +224,16 @@
     target: {
         recovery: {
             cflags: ["-DRECOVERY"],
+            exclude_static_libs: [
+                "libxml2",
+            ],
             exclude_shared_libs: [
                 "libbinder",
                 "libutils",
             ],
         },
     },
+    visibility: ["//packages/modules/Virtualization/microdroid"],
 }
 
 // Tests
@@ -259,7 +276,6 @@
     test_suites: [
         "cts",
         "device-tests",
-        "vts10",
     ],
 }
 
diff --git a/init/Android.mk b/init/Android.mk
index 416b732..561d641 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -57,6 +57,8 @@
     reboot_utils.cpp \
     selabel.cpp \
     selinux.cpp \
+    service_utils.cpp \
+    snapuserd_transition.cpp \
     switch_root.cpp \
     uevent_listener.cpp \
     util.cpp \
@@ -75,12 +77,22 @@
    adb_debug.prop \
 
 # Set up the directories that first stage init mounts on.
-LOCAL_POST_INSTALL_CMD := mkdir -p \
-    $(TARGET_RAMDISK_OUT)/debug_ramdisk \
-    $(TARGET_RAMDISK_OUT)/dev \
-    $(TARGET_RAMDISK_OUT)/mnt \
-    $(TARGET_RAMDISK_OUT)/proc \
-    $(TARGET_RAMDISK_OUT)/sys \
+
+my_ramdisk_dirs := \
+    debug_ramdisk \
+    dev \
+    metadata \
+    mnt \
+    proc \
+    second_stage_resources \
+    sys \
+
+LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_RAMDISK_OUT)/,$(my_ramdisk_dirs))
+ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE))
+    LOCAL_POST_INSTALL_CMD += $(addprefix $(TARGET_RAMDISK_OUT)/first_stage_ramdisk/,$(my_ramdisk_dirs))
+endif
+
+my_ramdisk_dirs :=
 
 LOCAL_STATIC_LIBRARIES := \
     libc++fs \
@@ -112,7 +124,9 @@
     libmodprobe \
     libext2_uuid \
     libprotobuf-cpp-lite \
+    libsnapshot_cow \
     libsnapshot_init \
+    update_metadata-protos \
 
 LOCAL_SANITIZE := signed-integer-overflow
 # First stage init is weird: it may start without stdout/stderr, and no /proc.
diff --git a/init/AndroidTest.xml b/init/AndroidTest.xml
index 95f97e3..6f22ab7 100644
--- a/init/AndroidTest.xml
+++ b/init/AndroidTest.xml
@@ -24,6 +24,9 @@
         <option name="push" value="CtsInitTestCases->/data/local/tmp/CtsInitTestCases" />
         <option name="append-bitness" value="true" />
     </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+        <option name="throw-on-error" value="false" />
+    </target_preparer>
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="CtsInitTestCases" />
diff --git a/init/OWNERS b/init/OWNERS
index babbe4d..9e70e7d 100644
--- a/init/OWNERS
+++ b/init/OWNERS
@@ -1 +1 @@
-tomcherry@google.com
+dvander@google.com
diff --git a/init/README.md b/init/README.md
index 6f2c01f..67d55e1 100644
--- a/init/README.md
+++ b/init/README.md
@@ -31,14 +31,13 @@
 extension.  There are typically multiple of these in multiple
 locations on the system, described below.
 
-/init.rc is the primary .rc file and is loaded by the init executable
-at the beginning of its execution.  It is responsible for the initial
-set up of the system.
+`/system/etc/init/hw/init.rc` is the primary .rc file and is loaded by the init executable at the
+beginning of its execution.  It is responsible for the initial set up of the system.
 
 Init loads all of the files contained within the
-/{system,vendor,odm}/etc/init/ directories immediately after loading
-the primary /init.rc.  This is explained in more details in the
-Imports section of this file.
+`/{system,system_ext,vendor,odm,product}/etc/init/` directories immediately after loading
+the primary `/system/etc/init/hw/init.rc`.  This is explained in more details in the
+[Imports](#imports) section of this file.
 
 Legacy devices without the first stage mount mechanism previously were
 able to import init scripts during mount_all, however that is deprecated
@@ -173,9 +172,14 @@
   This option connects stdin, stdout, and stderr to the console. It is mutually exclusive with the
   stdio_to_kmsg option, which only connects stdout and stderr to kmsg.
 
-`critical`
+`critical [window=<fatal crash window mins>] [target=<fatal reboot target>]`
 > This is a device-critical service. If it exits more than four times in
-  four minutes or before boot completes, the device will reboot into bootloader.
+  _fatal crash window mins_ minutes or before boot completes, the device
+  will reboot into _fatal reboot target_.
+  The default value of _fatal crash window mins_ is 4, and default value
+  of _fatal reboot target_ is 'bootloader'.
+  For tests, the fatal reboot can be skipped by setting property
+  `init.svc_debug.no_fatal.<service-name>` to `true` for specified critical service.
 
 `disabled`
 > This service will not automatically start with its class.
@@ -197,11 +201,14 @@
   Currently defaults to root.  (??? probably should default to nobody)
 
 `interface <interface name> <instance name>`
-> Associates this service with a list of the HIDL services that it provides. The interface name
-  must be a fully-qualified name and not a value name. For instance, this is used to allow
-  hwservicemanager to lazily start services. When multiple interfaces are served, this tag should
-  be used multiple times.
-  For example: interface vendor.foo.bar@1.0::IBaz default
+> Associates this service with a list of the AIDL or HIDL services that it provides. The interface
+  name must be a fully-qualified name and not a value name. For instance, this is used to allow
+  servicemanager or hwservicemanager to lazily start services. When multiple interfaces are served,
+  this tag should be used multiple times. An example of an entry for a HIDL
+  interface is `interface vendor.foo.bar@1.0::IBaz default`. For an AIDL interface, use
+  `interface aidl <instance name>`. The instance name for an AIDL interface is
+  whatever is registered with servicemanager, and these can be listed with `adb
+  shell dumpsys -l`.
 
 `ioprio <class> <priority>`
 > Sets the IO priority and IO priority class for this service via the SYS_ioprio_set syscall.
@@ -446,6 +453,10 @@
   exist. And it will be truncated if dst file is a normal regular file and
   already exists.
 
+`copy_per_line <src> <dst>`
+> Copies a file line by line. Similar to copy, but useful for dst is a sysfs node
+  that doesn't handle multiple lines of data.
+
 `domainname <name>`
 > Set the domain name.
 
@@ -564,9 +575,11 @@
   _options_ include "barrier=1", "noauto\_da\_alloc", "discard", ... as
   a comma separated string, e.g. barrier=1,noauto\_da\_alloc
 
-`parse_apex_configs`
-> Parses config file(s) from the mounted APEXes. Intended to be used only once
-  when apexd notifies the mount event by setting apexd.status to ready.
+`perform_apex_config`
+> Performs tasks after APEXes are mounted. For example, creates data directories
+  for the mounted APEXes, parses config file(s) from them, and updates linker
+  configurations. Intended to be used only once when apexd notifies the mount
+  event by setting `apexd.status` to ready.
 
 `restart <service>`
 > Stops and restarts a running service, does nothing if the service is currently
@@ -684,29 +697,22 @@
 
 There are only three times where the init executable imports .rc files:
 
-   1. When it imports /init.rc or the script indicated by the property
+   1. When it imports `/system/etc/init/hw/init.rc` or the script indicated by the property
       `ro.boot.init_rc` during initial boot.
-   2. When it imports /{system,vendor,odm}/etc/init/ for first stage mount
-      devices immediately after importing /init.rc.
+   2. When it imports `/{system,system_ext,vendor,odm,product}/etc/init/` immediately after
+      importing `/system/etc/init/hw/init.rc`.
    3. (Deprecated) When it imports /{system,vendor,odm}/etc/init/ or .rc files
       at specified paths during mount_all, not allowed for devices launching
       after Q.
 
-The order that files are imported is a bit complex for legacy reasons
-and to keep backwards compatibility.  It is not strictly guaranteed.
+The order that files are imported is a bit complex for legacy reasons.  The below is guaranteed:
 
-The only correct way to guarantee that a command has been run before a
-different command is to either 1) place it in an Action with an
-earlier executed trigger, or 2) place it in an Action with the same
-trigger within the same file at an earlier line.
-
-Nonetheless, the de facto order for first stage mount devices is:
-1. /init.rc is parsed then recursively each of its imports are
+1. `/system/etc/init/hw/init.rc` is parsed then recursively each of its imports are
    parsed.
-2. The contents of /system/etc/init/ are alphabetized and parsed
-   sequentially, with imports happening recursively after each file is
-   parsed.
-3. Step 2 is repeated for /vendor/etc/init then /odm/etc/init
+2. The contents of `/system/etc/init/` are alphabetized and parsed sequentially, with imports
+   happening recursively after each file is parsed.
+3. Step 2 is repeated for `/system_ext/etc/init`, `/vendor/etc/init`, `/odm/etc/init`,
+   `/product/etc/init`
 
 The below pseudocode may explain this more clearly:
 
@@ -715,13 +721,17 @@
       for (import : file.imports)
         Import(import)
 
-    Import(/init.rc)
-    Directories = [/system/etc/init, /vendor/etc/init, /odm/etc/init]
+    Import(/system/etc/init/hw/init.rc)
+    Directories = [/system/etc/init, /system_ext/etc/init, /vendor/etc/init, /odm/etc/init, /product/etc/init]
     for (directory : Directories)
       files = <Alphabetical order of directory's contents>
       for (file : files)
         Import(file)
 
+Actions are executed in the order that they are parsed.  For example the `post-fs-data` action(s)
+in `/system/etc/init/hw/init.rc` are always the first `post-fs-data` action(s) to be executed in
+order of how they appear in that file.  Then the `post-fs-data` actions of the imports of
+`/system/etc/init/hw/init.rc` in the order that they're imported, etc.
 
 Properties
 ----------
@@ -762,7 +772,7 @@
 These are equivalent to using the `start`, `restart`, and `stop` commands on the service specified
 by the _value_ of the property.
 
-`oneshot_one` and `oneshot_off` will turn on or off the _oneshot_
+`oneshot_on` and `oneshot_off` will turn on or off the _oneshot_
 flag for the service specified by the _value_ of the property.  This is
 particularly intended for services that are conditionally lazy HALs.  When
 they are lazy HALs, oneshot must be on, otherwise oneshot should be off.
diff --git a/init/README.ueventd.md b/init/README.ueventd.md
index 053ebf8..2a76620 100644
--- a/init/README.ueventd.md
+++ b/init/README.ueventd.md
@@ -13,6 +13,16 @@
     uevent_socket_rcvbuf_size 16M
 Sets the uevent socket rcvbuf_size to 16 megabytes.
 
+## Importing configuration files
+--------------------------------
+Ueventd reads /system/etc/ueventd.rc, all other files are imported via the `import` command, which
+takes the format of
+
+    import <path>
+This command parses an ueventd config file, extending the current configuration.  If _path_ is a
+directory, each file in the directory is parsed as a config file. It is not recursive, nested
+directories will not be parsed.  Imported files are parsed after the current file has been parsed.
+
 ## /dev
 ----
 Ueventd listens to the kernel uevent sockets and creates/deletes nodes in `/dev` based on the
@@ -32,7 +42,7 @@
 The permissions can be modified using a ueventd.rc script and a line that beings with `/dev`. These
 lines take the format of
 
-    devname mode uid gid
+    devname mode uid gid [options]
 For example
 
     /dev/null 0666 root root
@@ -70,7 +80,7 @@
 certain files in `/sys` when matching uevents are generated. This is done using a ueventd.rc script
 and a line that begins with `/sys`. These lines take the format of
 
-    nodename attr mode uid gid
+    nodename attr mode uid gid [options]
 For example
 
     /sys/devices/system/cpu/cpu* cpufreq/scaling_max_freq 0664 system system
@@ -78,7 +88,15 @@
 attribute, `cpufreq/scaling_max_freq`, will have its mode set to `0664`, its user to to `system` and
 its group set to `system`.
 
-Note that `*` matches as a wildcard and can be used anywhere in a path.
+## Path matching
+----------------
+The path for a `/dev` or `/sys` entry can contain a `*` anywhere in the path.
+1. If the only `*` appears at the end of the string or if the _options_ parameter is set to
+`no_fnm_pathname`, ueventd matches the entry by `fnmatch(entry_path, incoming_path, 0)`
+2. Otherwise, ueventd matches the entry by `fnmatch(entry_path, incoming_path, FNM_PATHNAME)`
+
+See the [man page for fnmatch](https://www.man7.org/linux/man-pages/man3/fnmatch.3.html) for more
+details.
 
 ## Firmware loading
 ----------------
@@ -86,6 +104,8 @@
 for a file matching the uevent `FIRMWARE`. It then forks a process to serve this firmware to the
 kernel.
 
+`/apex/*/etc/firmware` is also searched after a list of firmware directories.
+
 The list of firmware directories is customized by a `firmware_directories` line in a ueventd.rc
 file. This line takes the format of
 
diff --git a/init/block_dev_initializer.cpp b/init/block_dev_initializer.cpp
index b423f86..9c2a7bb 100644
--- a/init/block_dev_initializer.cpp
+++ b/init/block_dev_initializer.cpp
@@ -37,7 +37,15 @@
 }
 
 bool BlockDevInitializer::InitDeviceMapper() {
-    const std::string dm_path = "/devices/virtual/misc/device-mapper";
+    return InitMiscDevice("device-mapper");
+}
+
+bool BlockDevInitializer::InitDmUser(const std::string& name) {
+    return InitMiscDevice("dm-user!" + name);
+}
+
+bool BlockDevInitializer::InitMiscDevice(const std::string& name) {
+    const std::string dm_path = "/devices/virtual/misc/" + name;
     bool found = false;
     auto dm_callback = [this, &dm_path, &found](const Uevent& uevent) {
         if (uevent.path == dm_path) {
@@ -49,13 +57,13 @@
     };
     uevent_listener_.RegenerateUeventsForPath("/sys" + dm_path, dm_callback);
     if (!found) {
-        LOG(INFO) << "device-mapper device not found in /sys, waiting for its uevent";
+        LOG(INFO) << name << " device not found in /sys, waiting for its uevent";
         Timer t;
         uevent_listener_.Poll(dm_callback, 10s);
-        LOG(INFO) << "Wait for device-mapper returned after " << t;
+        LOG(INFO) << "Wait for " << name << " returned after " << t;
     }
     if (!found) {
-        LOG(ERROR) << "device-mapper device not found after polling timeout";
+        LOG(ERROR) << name << " device not found after polling timeout";
         return false;
     }
     return true;
diff --git a/init/block_dev_initializer.h b/init/block_dev_initializer.h
index 0d4c6e9..ec39ce0 100644
--- a/init/block_dev_initializer.h
+++ b/init/block_dev_initializer.h
@@ -12,6 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#pragma once
+
 #include <memory>
 #include <set>
 #include <string>
@@ -27,12 +29,15 @@
     BlockDevInitializer();
 
     bool InitDeviceMapper();
+    bool InitDmUser(const std::string& name);
     bool InitDevices(std::set<std::string> devices);
     bool InitDmDevice(const std::string& device);
 
   private:
     ListenerAction HandleUevent(const Uevent& uevent, std::set<std::string>* devices);
 
+    bool InitMiscDevice(const std::string& name);
+
     std::unique_ptr<DeviceHandler> device_handler_;
     UeventListener uevent_listener_;
 };
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 0ac66f2..6b7d1e9 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -88,6 +88,7 @@
 
 using android::base::Basename;
 using android::base::SetProperty;
+using android::base::Split;
 using android::base::StartsWith;
 using android::base::StringPrintf;
 using android::base::unique_fd;
@@ -570,7 +571,6 @@
             trigger_shutdown("reboot,requested-userdata-remount-on-fde-device");
         }
         SetProperty("ro.crypto.state", "encrypted");
-        SetProperty("ro.crypto.type", "block");
         ActionManager::GetInstance().QueueEventTrigger("defaultcrypto");
         return {};
     } else if (code == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
@@ -595,7 +595,6 @@
             return Error() << "FscryptInstallKeyring() failed";
         }
         SetProperty("ro.crypto.state", "encrypted");
-        SetProperty("ro.crypto.type", "file");
 
         // Although encrypted, we have device key, so we do not need to
         // do anything different from the nonencrypted case.
@@ -606,7 +605,6 @@
             return Error() << "FscryptInstallKeyring() failed";
         }
         SetProperty("ro.crypto.state", "encrypted");
-        SetProperty("ro.crypto.type", "file");
 
         // Although encrypted, vold has already set the device up, so we do not need to
         // do anything different from the nonencrypted case.
@@ -617,7 +615,6 @@
             return Error() << "FscryptInstallKeyring() failed";
         }
         SetProperty("ro.crypto.state", "encrypted");
-        SetProperty("ro.crypto.type", "file");
 
         // Although encrypted, vold has already set the device up, so we do not need to
         // do anything different from the nonencrypted case.
@@ -666,18 +663,26 @@
         }
     }
 
-    auto mount_fstab_return_code = fs_mgr_mount_all(&fstab, mount_all->mode);
+    auto mount_fstab_result = fs_mgr_mount_all(&fstab, mount_all->mode);
     SetProperty(prop_name, std::to_string(t.duration().count()));
 
     if (mount_all->import_rc) {
         import_late(mount_all->rc_paths);
     }
 
+    if (mount_fstab_result.userdata_mounted) {
+        // This call to fs_mgr_mount_all mounted userdata. Keep the result in
+        // order for userspace reboot to correctly remount userdata.
+        LOG(INFO) << "Userdata mounted using "
+                  << (mount_all->fstab_path.empty() ? "(default fstab)" : mount_all->fstab_path)
+                  << " result : " << mount_fstab_result.code;
+        initial_mount_fstab_return_code = mount_fstab_result.code;
+    }
+
     if (queue_event) {
         /* queue_fs_event will queue event based on mount_fstab return code
          * and return processed return code*/
-        initial_mount_fstab_return_code = mount_fstab_return_code;
-        auto queue_fs_result = queue_fs_event(mount_fstab_return_code, false);
+        auto queue_fs_result = queue_fs_event(mount_fstab_result.code, false);
         if (!queue_fs_result.ok()) {
             return Error() << "queue_fs_event() failed: " << queue_fs_result.error();
         }
@@ -856,6 +861,11 @@
         // for system as root, so it has property [partition.system.verified].
         std::string partition = entry.mount_point == "/" ? "system" : Basename(entry.mount_point);
         SetProperty("partition." + partition + ".verified", std::to_string(mode));
+
+        std::string hash_alg = fs_mgr_get_hashtree_algorithm(entry);
+        if (!hash_alg.empty()) {
+            SetProperty("partition." + partition + ".verified.hash_alg", hash_alg);
+        }
     }
 
     return {};
@@ -964,6 +974,23 @@
     return {};
 }
 
+static Result<void> do_copy_per_line(const BuiltinArguments& args) {
+    std::string file_contents;
+    if (!android::base::ReadFileToString(args[1], &file_contents, true)) {
+        return Error() << "Could not read input file '" << args[1] << "'";
+    }
+    auto lines = Split(file_contents, "\n");
+    for (const auto& line : lines) {
+        auto result = WriteFile(args[2], line);
+        if (!result.ok()) {
+            LOG(VERBOSE) << "Could not write to output file '" << args[2] << "' with '" << line
+                         << "' : " << result.error();
+        }
+    }
+
+    return {};
+}
+
 static Result<void> do_chown(const BuiltinArguments& args) {
     auto uid = DecodeUid(args[1]);
     if (!uid.ok()) {
@@ -1177,6 +1204,10 @@
     }
     // TODO(b/135984674): check that fstab contains /data.
     if (auto rc = fs_mgr_remount_userdata_into_checkpointing(&fstab); rc < 0) {
+        std::string proc_mounts_output;
+        android::base::ReadFileToString("/proc/mounts", &proc_mounts_output, true);
+        android::base::WriteStringToFile(proc_mounts_output,
+                                         "/metadata/userspacereboot/mount_info.txt");
         trigger_shutdown("reboot,mount_userdata_failed");
     }
     if (auto result = queue_fs_event(initial_mount_fstab_return_code, true); !result.ok()) {
@@ -1206,7 +1237,7 @@
 }
 
 static Result<void> GenerateLinkerConfiguration() {
-    const char* linkerconfig_binary = "/system/bin/linkerconfig";
+    const char* linkerconfig_binary = "/apex/com.android.runtime/bin/linkerconfig";
     const char* linkerconfig_target = "/linkerconfig";
     const char* arguments[] = {linkerconfig_binary, "--target", linkerconfig_target};
 
@@ -1221,6 +1252,20 @@
     return {};
 }
 
+static Result<void> MountLinkerConfigForDefaultNamespace() {
+    // No need to mount linkerconfig for default mount namespace if the path does not exist (which
+    // would mean it is already mounted)
+    if (access("/linkerconfig/default", 0) != 0) {
+        return {};
+    }
+
+    if (mount("/linkerconfig/default", "/linkerconfig", nullptr, MS_BIND | MS_REC, nullptr) != 0) {
+        return ErrnoError() << "Failed to mount linker configuration for default mount namespace.";
+    }
+
+    return {};
+}
+
 static bool IsApexUpdatable() {
     static bool updatable = android::sysprop::ApexProperties::updatable().value_or(false);
     return updatable;
@@ -1319,11 +1364,14 @@
 }
 
 static Result<void> do_enter_default_mount_ns(const BuiltinArguments& args) {
-    if (SwitchToDefaultMountNamespace()) {
-        return {};
-    } else {
-        return Error() << "Failed to enter into default mount namespace";
+    if (auto result = SwitchToMountNamespaceIfNeeded(NS_DEFAULT); !result.ok()) {
+        return result.error();
     }
+    if (auto result = MountLinkerConfigForDefaultNamespace(); !result.ok()) {
+        return result.error();
+    }
+    LOG(INFO) << "Switched to default mount namespace";
+    return {};
 }
 
 // Builtin-function-map start
@@ -1341,6 +1389,7 @@
         {"class_start_post_data",   {1,     1,    {false,  do_class_start_post_data}}},
         {"class_stop",              {1,     1,    {false,  do_class_stop}}},
         {"copy",                    {2,     2,    {true,   do_copy}}},
+        {"copy_per_line",           {2,     2,    {true,   do_copy_per_line}}},
         {"domainname",              {1,     1,    {true,   do_domainname}}},
         {"enable",                  {1,     1,    {false,  do_enable}}},
         {"exec",                    {1,     kMax, {false,  do_exec}}},
diff --git a/init/capabilities.cpp b/init/capabilities.cpp
index a91cd1d..ab6ff03 100644
--- a/init/capabilities.cpp
+++ b/init/capabilities.cpp
@@ -28,47 +28,56 @@
 namespace init {
 
 static const std::map<std::string, int> cap_map = {
-    CAP_MAP_ENTRY(CHOWN),
-    CAP_MAP_ENTRY(DAC_OVERRIDE),
-    CAP_MAP_ENTRY(DAC_READ_SEARCH),
-    CAP_MAP_ENTRY(FOWNER),
-    CAP_MAP_ENTRY(FSETID),
-    CAP_MAP_ENTRY(KILL),
-    CAP_MAP_ENTRY(SETGID),
-    CAP_MAP_ENTRY(SETUID),
-    CAP_MAP_ENTRY(SETPCAP),
-    CAP_MAP_ENTRY(LINUX_IMMUTABLE),
-    CAP_MAP_ENTRY(NET_BIND_SERVICE),
-    CAP_MAP_ENTRY(NET_BROADCAST),
-    CAP_MAP_ENTRY(NET_ADMIN),
-    CAP_MAP_ENTRY(NET_RAW),
-    CAP_MAP_ENTRY(IPC_LOCK),
-    CAP_MAP_ENTRY(IPC_OWNER),
-    CAP_MAP_ENTRY(SYS_MODULE),
-    CAP_MAP_ENTRY(SYS_RAWIO),
-    CAP_MAP_ENTRY(SYS_CHROOT),
-    CAP_MAP_ENTRY(SYS_PTRACE),
-    CAP_MAP_ENTRY(SYS_PACCT),
-    CAP_MAP_ENTRY(SYS_ADMIN),
-    CAP_MAP_ENTRY(SYS_BOOT),
-    CAP_MAP_ENTRY(SYS_NICE),
-    CAP_MAP_ENTRY(SYS_RESOURCE),
-    CAP_MAP_ENTRY(SYS_TIME),
-    CAP_MAP_ENTRY(SYS_TTY_CONFIG),
-    CAP_MAP_ENTRY(MKNOD),
-    CAP_MAP_ENTRY(LEASE),
-    CAP_MAP_ENTRY(AUDIT_WRITE),
-    CAP_MAP_ENTRY(AUDIT_CONTROL),
-    CAP_MAP_ENTRY(SETFCAP),
-    CAP_MAP_ENTRY(MAC_OVERRIDE),
-    CAP_MAP_ENTRY(MAC_ADMIN),
-    CAP_MAP_ENTRY(SYSLOG),
-    CAP_MAP_ENTRY(WAKE_ALARM),
-    CAP_MAP_ENTRY(BLOCK_SUSPEND),
-    CAP_MAP_ENTRY(AUDIT_READ),
+        CAP_MAP_ENTRY(CHOWN),
+        CAP_MAP_ENTRY(DAC_OVERRIDE),
+        CAP_MAP_ENTRY(DAC_READ_SEARCH),
+        CAP_MAP_ENTRY(FOWNER),
+        CAP_MAP_ENTRY(FSETID),
+        CAP_MAP_ENTRY(KILL),
+        CAP_MAP_ENTRY(SETGID),
+        CAP_MAP_ENTRY(SETUID),
+        CAP_MAP_ENTRY(SETPCAP),
+        CAP_MAP_ENTRY(LINUX_IMMUTABLE),
+        CAP_MAP_ENTRY(NET_BIND_SERVICE),
+        CAP_MAP_ENTRY(NET_BROADCAST),
+        CAP_MAP_ENTRY(NET_ADMIN),
+        CAP_MAP_ENTRY(NET_RAW),
+        CAP_MAP_ENTRY(IPC_LOCK),
+        CAP_MAP_ENTRY(IPC_OWNER),
+        CAP_MAP_ENTRY(SYS_MODULE),
+        CAP_MAP_ENTRY(SYS_RAWIO),
+        CAP_MAP_ENTRY(SYS_CHROOT),
+        CAP_MAP_ENTRY(SYS_PTRACE),
+        CAP_MAP_ENTRY(SYS_PACCT),
+        CAP_MAP_ENTRY(SYS_ADMIN),
+        CAP_MAP_ENTRY(SYS_BOOT),
+        CAP_MAP_ENTRY(SYS_NICE),
+        CAP_MAP_ENTRY(SYS_RESOURCE),
+        CAP_MAP_ENTRY(SYS_TIME),
+        CAP_MAP_ENTRY(SYS_TTY_CONFIG),
+        CAP_MAP_ENTRY(MKNOD),
+        CAP_MAP_ENTRY(LEASE),
+        CAP_MAP_ENTRY(AUDIT_WRITE),
+        CAP_MAP_ENTRY(AUDIT_CONTROL),
+        CAP_MAP_ENTRY(SETFCAP),
+        CAP_MAP_ENTRY(MAC_OVERRIDE),
+        CAP_MAP_ENTRY(MAC_ADMIN),
+        CAP_MAP_ENTRY(SYSLOG),
+        CAP_MAP_ENTRY(WAKE_ALARM),
+        CAP_MAP_ENTRY(BLOCK_SUSPEND),
+        CAP_MAP_ENTRY(AUDIT_READ),
+#if defined(__BIONIC__)
+        CAP_MAP_ENTRY(PERFMON),
+        CAP_MAP_ENTRY(BPF),
+        CAP_MAP_ENTRY(CHECKPOINT_RESTORE),
+#endif
 };
 
+#if defined(__BIONIC__)
+static_assert(CAP_LAST_CAP == CAP_CHECKPOINT_RESTORE, "CAP_LAST_CAP is not CAP_CHECKPOINT_RESTORE");
+#else
 static_assert(CAP_LAST_CAP == CAP_AUDIT_READ, "CAP_LAST_CAP is not CAP_AUDIT_READ");
+#endif
 
 static bool ComputeCapAmbientSupported() {
 #if defined(__ANDROID__)
diff --git a/init/devices.cpp b/init/devices.cpp
index 9fbec64..ce6298a 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -22,6 +22,7 @@
 #include <unistd.h>
 
 #include <chrono>
+#include <filesystem>
 #include <memory>
 #include <string>
 #include <thread>
@@ -123,8 +124,15 @@
     return true;
 }
 
-Permissions::Permissions(const std::string& name, mode_t perm, uid_t uid, gid_t gid)
-    : name_(name), perm_(perm), uid_(uid), gid_(gid), prefix_(false), wildcard_(false) {
+Permissions::Permissions(const std::string& name, mode_t perm, uid_t uid, gid_t gid,
+                         bool no_fnm_pathname)
+    : name_(name),
+      perm_(perm),
+      uid_(uid),
+      gid_(gid),
+      prefix_(false),
+      wildcard_(false),
+      no_fnm_pathname_(no_fnm_pathname) {
     // Set 'prefix_' or 'wildcard_' based on the below cases:
     //
     // 1) No '*' in 'name' -> Neither are set and Match() checks a given path for strict
@@ -135,7 +143,6 @@
     //
     // 3) '*' appears elsewhere -> 'wildcard_' is set to true and Match() uses fnmatch()
     //    with FNM_PATHNAME to compare 'name' to a given path.
-
     auto wildcard_position = name_.find('*');
     if (wildcard_position != std::string::npos) {
         if (wildcard_position == name_.length() - 1) {
@@ -149,7 +156,8 @@
 
 bool Permissions::Match(const std::string& path) const {
     if (prefix_) return StartsWith(path, name_);
-    if (wildcard_) return fnmatch(name_.c_str(), path.c_str(), FNM_PATHNAME) == 0;
+    if (wildcard_)
+        return fnmatch(name_.c_str(), path.c_str(), no_fnm_pathname_ ? 0 : FNM_PATHNAME) == 0;
     return path == name_;
 }
 
@@ -193,7 +201,8 @@
     while (directory != "/" && directory != ".") {
         std::string subsystem_link_path;
         if (Realpath(directory + "/subsystem", &subsystem_link_path) &&
-            subsystem_link_path == sysfs_mount_point_ + "/bus/platform") {
+            (subsystem_link_path == sysfs_mount_point_ + "/bus/platform" ||
+             subsystem_link_path == sysfs_mount_point_ + "/bus/amba")) {
             // We need to remove the mount point that we added above before returning.
             directory.erase(0, sysfs_mount_point_.size());
             *platform_device_path = directory;
@@ -459,9 +468,10 @@
 }
 
 void DeviceHandler::HandleUevent(const Uevent& uevent) {
-    if (uevent.action == "add" || uevent.action == "change" || uevent.action == "online") {
-        FixupSysPermissions(uevent.path, uevent.subsystem);
-    }
+  if (uevent.action == "add" || uevent.action == "change" ||
+      uevent.action == "bind" || uevent.action == "online") {
+    FixupSysPermissions(uevent.path, uevent.subsystem);
+  }
 
     // if it's not a /dev device, nothing to do
     if (uevent.major < 0 || uevent.minor < 0) return;
@@ -495,6 +505,8 @@
     } else if (StartsWith(uevent.subsystem, "usb")) {
         // ignore other USB events
         return;
+    } else if (uevent.subsystem == "misc" && StartsWith(uevent.device_name, "dm-user/")) {
+        devpath = "/dev/dm-user/" + uevent.device_name.substr(8);
     } else {
         devpath = "/dev/" + Basename(uevent.path);
     }
diff --git a/init/devices.h b/init/devices.h
index 05d64da..d70d746 100644
--- a/init/devices.h
+++ b/init/devices.h
@@ -38,7 +38,7 @@
   public:
     friend void TestPermissions(const Permissions& expected, const Permissions& test);
 
-    Permissions(const std::string& name, mode_t perm, uid_t uid, gid_t gid);
+    Permissions(const std::string& name, mode_t perm, uid_t uid, gid_t gid, bool no_fnm_pathname);
 
     bool Match(const std::string& path) const;
 
@@ -56,6 +56,7 @@
     gid_t gid_;
     bool prefix_;
     bool wildcard_;
+    bool no_fnm_pathname_;
 };
 
 class SysfsPermissions : public Permissions {
@@ -63,8 +64,8 @@
     friend void TestSysfsPermissions(const SysfsPermissions& expected, const SysfsPermissions& test);
 
     SysfsPermissions(const std::string& name, const std::string& attribute, mode_t perm, uid_t uid,
-                     gid_t gid)
-        : Permissions(name, perm, uid, gid), attribute_(attribute) {}
+                     gid_t gid, bool no_fnm_pathname)
+        : Permissions(name, perm, uid, gid, no_fnm_pathname), attribute_(attribute) {}
 
     bool MatchWithSubsystem(const std::string& path, const std::string& subsystem) const;
     void SetPermissions(const std::string& path) const;
diff --git a/init/devices_test.cpp b/init/devices_test.cpp
index c408bc1..e7bac68 100644
--- a/init/devices_test.cpp
+++ b/init/devices_test.cpp
@@ -221,7 +221,7 @@
 TEST(device_handler, DevPermissionsMatchNormal) {
     // Basic from ueventd.rc
     // /dev/null                 0666   root       root
-    Permissions permissions("/dev/null", 0666, 0, 0);
+    Permissions permissions("/dev/null", 0666, 0, 0, false);
     EXPECT_TRUE(permissions.Match("/dev/null"));
     EXPECT_FALSE(permissions.Match("/dev/nullsuffix"));
     EXPECT_FALSE(permissions.Match("/dev/nul"));
@@ -233,7 +233,7 @@
 TEST(device_handler, DevPermissionsMatchPrefix) {
     // Prefix from ueventd.rc
     // /dev/dri/*                0666   root       graphics
-    Permissions permissions("/dev/dri/*", 0666, 0, 1000);
+    Permissions permissions("/dev/dri/*", 0666, 0, 1000, false);
     EXPECT_TRUE(permissions.Match("/dev/dri/some_dri_device"));
     EXPECT_TRUE(permissions.Match("/dev/dri/some_other_dri_device"));
     EXPECT_TRUE(permissions.Match("/dev/dri/"));
@@ -246,7 +246,7 @@
 TEST(device_handler, DevPermissionsMatchWildcard) {
     // Wildcard example
     // /dev/device*name                0666   root       graphics
-    Permissions permissions("/dev/device*name", 0666, 0, 1000);
+    Permissions permissions("/dev/device*name", 0666, 0, 1000, false);
     EXPECT_TRUE(permissions.Match("/dev/devicename"));
     EXPECT_TRUE(permissions.Match("/dev/device123name"));
     EXPECT_TRUE(permissions.Match("/dev/deviceabcname"));
@@ -260,13 +260,31 @@
 TEST(device_handler, DevPermissionsMatchWildcardPrefix) {
     // Wildcard+Prefix example
     // /dev/device*name*                0666   root       graphics
-    Permissions permissions("/dev/device*name*", 0666, 0, 1000);
+    Permissions permissions("/dev/device*name*", 0666, 0, 1000, false);
     EXPECT_TRUE(permissions.Match("/dev/devicename"));
     EXPECT_TRUE(permissions.Match("/dev/device123name"));
     EXPECT_TRUE(permissions.Match("/dev/deviceabcname"));
     EXPECT_TRUE(permissions.Match("/dev/device123namesomething"));
     // FNM_PATHNAME doesn't match '/' with *
     EXPECT_FALSE(permissions.Match("/dev/device123name/something"));
+    EXPECT_FALSE(permissions.Match("/dev/device/1/2/3name/something"));
+    EXPECT_FALSE(permissions.Match("/dev/deviceame"));
+    EXPECT_EQ(0666U, permissions.perm());
+    EXPECT_EQ(0U, permissions.uid());
+    EXPECT_EQ(1000U, permissions.gid());
+}
+
+TEST(device_handler, DevPermissionsMatchWildcardPrefix_NoFnmPathName) {
+    // Wildcard+Prefix example with no_fnm_pathname
+    // /dev/device*name*                0666   root       graphics
+    Permissions permissions("/dev/device*name*", 0666, 0, 1000, true);
+    EXPECT_TRUE(permissions.Match("/dev/devicename"));
+    EXPECT_TRUE(permissions.Match("/dev/device123name"));
+    EXPECT_TRUE(permissions.Match("/dev/deviceabcname"));
+    EXPECT_TRUE(permissions.Match("/dev/device123namesomething"));
+    // With NoFnmPathName, the below matches, unlike DevPermissionsMatchWildcardPrefix.
+    EXPECT_TRUE(permissions.Match("/dev/device123name/something"));
+    EXPECT_TRUE(permissions.Match("/dev/device/1/2/3name/something"));
     EXPECT_FALSE(permissions.Match("/dev/deviceame"));
     EXPECT_EQ(0666U, permissions.perm());
     EXPECT_EQ(0U, permissions.uid());
@@ -275,7 +293,8 @@
 
 TEST(device_handler, SysfsPermissionsMatchWithSubsystemNormal) {
     // /sys/devices/virtual/input/input*   enable      0660  root   input
-    SysfsPermissions permissions("/sys/devices/virtual/input/input*", "enable", 0660, 0, 1001);
+    SysfsPermissions permissions("/sys/devices/virtual/input/input*", "enable", 0660, 0, 1001,
+                                 false);
     EXPECT_TRUE(permissions.MatchWithSubsystem("/sys/devices/virtual/input/input0", "input"));
     EXPECT_FALSE(permissions.MatchWithSubsystem("/sys/devices/virtual/input/not_input0", "input"));
     EXPECT_EQ(0660U, permissions.perm());
@@ -285,7 +304,7 @@
 
 TEST(device_handler, SysfsPermissionsMatchWithSubsystemClass) {
     // /sys/class/input/event*   enable      0660  root   input
-    SysfsPermissions permissions("/sys/class/input/event*", "enable", 0660, 0, 1001);
+    SysfsPermissions permissions("/sys/class/input/event*", "enable", 0660, 0, 1001, false);
     EXPECT_TRUE(permissions.MatchWithSubsystem(
         "/sys/devices/soc.0/f9924000.i2c/i2c-2/2-0020/input/input0/event0", "input"));
     EXPECT_FALSE(permissions.MatchWithSubsystem(
@@ -299,7 +318,7 @@
 
 TEST(device_handler, SysfsPermissionsMatchWithSubsystemBus) {
     // /sys/bus/i2c/devices/i2c-*   enable      0660  root   input
-    SysfsPermissions permissions("/sys/bus/i2c/devices/i2c-*", "enable", 0660, 0, 1001);
+    SysfsPermissions permissions("/sys/bus/i2c/devices/i2c-*", "enable", 0660, 0, 1001, false);
     EXPECT_TRUE(permissions.MatchWithSubsystem("/sys/devices/soc.0/f9967000.i2c/i2c-5", "i2c"));
     EXPECT_FALSE(permissions.MatchWithSubsystem("/sys/devices/soc.0/f9967000.i2c/not-i2c", "i2c"));
     EXPECT_FALSE(
diff --git a/init/firmware_handler.cpp b/init/firmware_handler.cpp
index dff7b69..ba7e6bd 100644
--- a/init/firmware_handler.cpp
+++ b/init/firmware_handler.cpp
@@ -17,6 +17,7 @@
 #include "firmware_handler.h"
 
 #include <fcntl.h>
+#include <glob.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -30,6 +31,7 @@
 #include <android-base/chrono_utils.h>
 #include <android-base/file.h>
 #include <android-base/logging.h>
+#include <android-base/scopeguard.h>
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
 
@@ -203,25 +205,28 @@
     }
 
     std::vector<std::string> attempted_paths_and_errors;
-
-    int booting = IsBooting();
-try_loading_again:
-    attempted_paths_and_errors.clear();
-    for (const auto& firmware_directory : firmware_directories_) {
+    auto TryLoadFirmware = [&](const std::string& firmware_directory) {
         std::string file = firmware_directory + firmware;
         unique_fd fw_fd(open(file.c_str(), O_RDONLY | O_CLOEXEC));
         if (fw_fd == -1) {
             attempted_paths_and_errors.emplace_back("firmware: attempted " + file +
                                                     ", open failed: " + strerror(errno));
-            continue;
+            return false;
         }
         struct stat sb;
         if (fstat(fw_fd, &sb) == -1) {
             attempted_paths_and_errors.emplace_back("firmware: attempted " + file +
                                                     ", fstat failed: " + strerror(errno));
-            continue;
+            return false;
         }
         LoadFirmware(firmware, root, fw_fd, sb.st_size, loading_fd, data_fd);
+        return true;
+    };
+
+    int booting = IsBooting();
+try_loading_again:
+    attempted_paths_and_errors.clear();
+    if (ForEachFirmwareDirectory(TryLoadFirmware)) {
         return;
     }
 
@@ -242,6 +247,33 @@
     write(loading_fd, "-1", 2);
 }
 
+bool FirmwareHandler::ForEachFirmwareDirectory(
+        std::function<bool(const std::string&)> handler) const {
+    for (const std::string& firmware_directory : firmware_directories_) {
+        if (std::invoke(handler, firmware_directory)) {
+            return true;
+        }
+    }
+
+    glob_t glob_result;
+    glob("/apex/*/etc/firmware/", GLOB_MARK, nullptr, &glob_result);
+    auto free_glob = android::base::make_scope_guard(std::bind(&globfree, &glob_result));
+    for (size_t i = 0; i < glob_result.gl_pathc; i++) {
+        char* apex_firmware_directory = glob_result.gl_pathv[i];
+        // Filter-out /apex/<name>@<ver> paths. The paths are bind-mounted to
+        // /apex/<name> paths, so unless we filter them out, we will look into the
+        // same apex twice.
+        if (strchr(apex_firmware_directory, '@')) {
+            continue;
+        }
+        if (std::invoke(handler, apex_firmware_directory)) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 void FirmwareHandler::HandleUevent(const Uevent& uevent) {
     if (uevent.subsystem != "firmware" || uevent.action != "add") return;
 
diff --git a/init/firmware_handler.h b/init/firmware_handler.h
index b4138f1..8b758ae 100644
--- a/init/firmware_handler.h
+++ b/init/firmware_handler.h
@@ -18,6 +18,7 @@
 
 #include <pwd.h>
 
+#include <functional>
 #include <string>
 #include <vector>
 
@@ -52,6 +53,7 @@
                                            const Uevent& uevent) const;
     std::string GetFirmwarePath(const Uevent& uevent) const;
     void ProcessFirmwareEvent(const std::string& root, const std::string& firmware) const;
+    bool ForEachFirmwareDirectory(std::function<bool(const std::string&)> handler) const;
 
     std::vector<std::string> firmware_directories_;
     std::vector<ExternalFirmwareHandler> external_firmware_handlers_;
diff --git a/init/firmware_handler_test.cpp b/init/firmware_handler_test.cpp
index 7bb603c..5124a6f 100644
--- a/init/firmware_handler_test.cpp
+++ b/init/firmware_handler_test.cpp
@@ -79,6 +79,8 @@
 }
 
 int HandleAbort(int argc, char** argv) {
+    // Since this is an expected failure, disable debuggerd to not generate a tombstone.
+    signal(SIGABRT, SIG_DFL);
     abort();
     return 0;
 }
diff --git a/init/first_stage_console.cpp b/init/first_stage_console.cpp
index cfa0d99..0f01166 100644
--- a/init/first_stage_console.cpp
+++ b/init/first_stage_console.cpp
@@ -30,6 +30,41 @@
 #include <android-base/file.h>
 #include <android-base/logging.h>
 
+static bool KernelConsolePresent(const std::string& cmdline) {
+    size_t pos = 0;
+    while (true) {
+        pos = cmdline.find("console=", pos);
+        if (pos == std::string::npos) return false;
+        if (pos == 0 || cmdline[pos - 1] == ' ') return true;
+        pos++;
+    }
+}
+
+static bool SetupConsole() {
+    if (mknod("/dev/console", S_IFCHR | 0600, makedev(5, 1))) {
+        PLOG(ERROR) << "unable to create /dev/console";
+        return false;
+    }
+    int fd = -1;
+    int tries = 50;  // should timeout after 5s
+    // The device driver for console may not be ready yet so retry for a while in case of failure.
+    while (tries--) {
+        fd = open("/dev/console", O_RDWR);
+        if (fd != -1) break;
+        std::this_thread::sleep_for(100ms);
+    }
+    if (fd == -1) {
+        PLOG(ERROR) << "could not open /dev/console";
+        return false;
+    }
+    ioctl(fd, TIOCSCTTY, 0);
+    dup2(fd, STDIN_FILENO);
+    dup2(fd, STDOUT_FILENO);
+    dup2(fd, STDERR_FILENO);
+    close(fd);
+    return true;
+}
+
 static void RunScript() {
     LOG(INFO) << "Attempting to run /first_stage.sh...";
     pid_t pid = fork();
@@ -48,11 +83,9 @@
 namespace android {
 namespace init {
 
-void StartConsole() {
-    if (mknod("/dev/console", S_IFCHR | 0600, makedev(5, 1))) {
-        PLOG(ERROR) << "unable to create /dev/console";
-        return;
-    }
+void StartConsole(const std::string& cmdline) {
+    bool console = KernelConsolePresent(cmdline);
+
     pid_t pid = fork();
     if (pid != 0) {
         int status;
@@ -60,31 +93,15 @@
         LOG(ERROR) << "console shell exited with status " << status;
         return;
     }
-    int fd = -1;
-    int tries = 50; // should timeout after 5s
-    // The device driver for console may not be ready yet so retry for a while in case of failure.
-    while (tries--) {
-        fd = open("/dev/console", O_RDWR);
-        if (fd != -1) {
-            break;
-        }
-        std::this_thread::sleep_for(100ms);
-    }
-    if (fd == -1) {
-        LOG(ERROR) << "Could not open /dev/console, errno = " << errno;
-        _exit(127);
-    }
-    ioctl(fd, TIOCSCTTY, 0);
-    dup2(fd, STDIN_FILENO);
-    dup2(fd, STDOUT_FILENO);
-    dup2(fd, STDERR_FILENO);
-    close(fd);
 
+    if (console) console = SetupConsole();
     RunScript();
-    const char* path = "/system/bin/sh";
-    const char* args[] = {path, nullptr};
-    int rv = execv(path, const_cast<char**>(args));
-    LOG(ERROR) << "unable to execv, returned " << rv << " errno " << errno;
+    if (console) {
+        const char* path = "/system/bin/sh";
+        const char* args[] = {path, nullptr};
+        int rv = execv(path, const_cast<char**>(args));
+        LOG(ERROR) << "unable to execv, returned " << rv << " errno " << errno;
+    }
     _exit(127);
 }
 
diff --git a/init/first_stage_console.h b/init/first_stage_console.h
index 8f36a7c..d5744df 100644
--- a/init/first_stage_console.h
+++ b/init/first_stage_console.h
@@ -28,7 +28,7 @@
     MAX_PARAM_VALUE = IGNORE_FAILURE,
 };
 
-void StartConsole();
+void StartConsole(const std::string& cmdline);
 int FirstStageConsole(const std::string& cmdline);
 
 }  // namespace init
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index 0215576..6954c03 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -41,6 +41,8 @@
 #include "first_stage_console.h"
 #include "first_stage_mount.h"
 #include "reboot_utils.h"
+#include "second_stage_resources.h"
+#include "snapuserd_transition.h"
 #include "switch_root.h"
 #include "util.h"
 
@@ -89,6 +91,12 @@
                     }
                 }
             }
+        } else if (de->d_type == DT_REG) {
+            // Do not free snapuserd if we will need the ramdisk copy during the
+            // selinux transition.
+            if (de->d_name == "snapuserd"s && IsFirstStageSnapuserdRunning()) {
+                continue;
+            }
         }
         unlinkat(dfd, de->d_name, is_dir ? AT_REMOVEDIR : 0);
     }
@@ -192,6 +200,7 @@
     CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
     CHECKCALL(mkdir("/dev/pts", 0755));
     CHECKCALL(mkdir("/dev/socket", 0755));
+    CHECKCALL(mkdir("/dev/dm-user", 0755));
     CHECKCALL(mount("devpts", "/dev/pts", "devpts", 0, NULL));
 #define MAKE_STR(x) __STRING(x)
     CHECKCALL(mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)));
@@ -235,6 +244,11 @@
     // /debug_ramdisk is used to preserve additional files from the debug ramdisk
     CHECKCALL(mount("tmpfs", "/debug_ramdisk", "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV,
                     "mode=0755,uid=0,gid=0"));
+
+    // /second_stage_resources is used to preserve files from first to second
+    // stage init
+    CHECKCALL(mount("tmpfs", kSecondStageRes, "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV,
+                    "mode=0755,uid=0,gid=0"))
 #undef CHECKCALL
 
     SetStdioToDevNull(argv);
@@ -273,7 +287,21 @@
     }
 
     if (want_console == FirstStageConsoleParam::CONSOLE_ON_FAILURE) {
-        StartConsole();
+        StartConsole(cmdline);
+    }
+
+    if (access(kBootImageRamdiskProp, F_OK) == 0) {
+        std::string dest = GetRamdiskPropForSecondStage();
+        std::string dir = android::base::Dirname(dest);
+        std::error_code ec;
+        if (!fs::create_directories(dir, ec) && !!ec) {
+            LOG(FATAL) << "Can't mkdir " << dir << ": " << ec.message();
+        }
+        if (!fs::copy_file(kBootImageRamdiskProp, dest, ec)) {
+            LOG(FATAL) << "Can't copy " << kBootImageRamdiskProp << " to " << dest << ": "
+                       << ec.message();
+        }
+        LOG(INFO) << "Copied ramdisk prop to " << dest;
     }
 
     if (ForceNormalBoot(cmdline)) {
diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp
index 8eb2f97..7307237 100644
--- a/init/first_stage_mount.cpp
+++ b/init/first_stage_mount.cpp
@@ -44,6 +44,7 @@
 
 #include "block_dev_initializer.h"
 #include "devices.h"
+#include "snapuserd_transition.h"
 #include "switch_root.h"
 #include "uevent.h"
 #include "uevent_listener.h"
@@ -87,6 +88,7 @@
   protected:
     bool InitRequiredDevices(std::set<std::string> devices);
     bool CreateLogicalPartitions();
+    bool CreateSnapshotPartitions(android::snapshot::SnapshotManager* sm);
     bool MountPartition(const Fstab::iterator& begin, bool erase_same_mounts,
                         Fstab::iterator* end = nullptr);
 
@@ -109,6 +111,7 @@
 
     bool need_dm_verity_;
     bool dsu_not_on_userdata_ = false;
+    bool use_snapuserd_ = false;
 
     Fstab fstab_;
     // The super path is only set after InitDevices, and is invalid before.
@@ -250,6 +253,22 @@
 
     if (!InitDevices()) return false;
 
+    // Mount /metadata before creating logical partitions, since we need to
+    // know whether a snapshot merge is in progress.
+    auto metadata_partition = std::find_if(fstab_.begin(), fstab_.end(), [](const auto& entry) {
+        return entry.mount_point == "/metadata";
+    });
+    if (metadata_partition != fstab_.end()) {
+        if (MountPartition(metadata_partition, true /* erase_same_mounts */)) {
+            // Copies DSU AVB keys from the ramdisk to /metadata.
+            // Must be done before the following TrySwitchSystemAsRoot().
+            // Otherwise, ramdisk will be inaccessible after switching root.
+            CopyDsuAvbKeys();
+        }
+    }
+
+    if (!CreateLogicalPartitions()) return false;
+
     if (!MountPartitions()) return false;
 
     return true;
@@ -338,12 +357,7 @@
             return false;
         }
         if (sm->NeedSnapshotsInFirstStageMount()) {
-            // When COW images are present for snapshots, they are stored on
-            // the data partition.
-            if (!InitRequiredDevices({"userdata"})) {
-                return false;
-            }
-            return sm->CreateLogicalAndSnapshotPartitions(super_path_);
+            return CreateSnapshotPartitions(sm.get());
         }
     }
 
@@ -358,6 +372,37 @@
     return android::fs_mgr::CreateLogicalPartitions(*metadata.get(), super_path_);
 }
 
+bool FirstStageMount::CreateSnapshotPartitions(SnapshotManager* sm) {
+    // When COW images are present for snapshots, they are stored on
+    // the data partition.
+    if (!InitRequiredDevices({"userdata"})) {
+        return false;
+    }
+
+    use_snapuserd_ = sm->IsSnapuserdRequired();
+    if (use_snapuserd_) {
+        LaunchFirstStageSnapuserd();
+    }
+
+    sm->SetUeventRegenCallback([this](const std::string& device) -> bool {
+        if (android::base::StartsWith(device, "/dev/block/dm-")) {
+            return block_dev_init_.InitDmDevice(device);
+        }
+        if (android::base::StartsWith(device, "/dev/dm-user/")) {
+            return block_dev_init_.InitDmUser(android::base::Basename(device));
+        }
+        return block_dev_init_.InitDevices({device});
+    });
+    if (!sm->CreateLogicalAndSnapshotPartitions(super_path_)) {
+        return false;
+    }
+
+    if (use_snapuserd_) {
+        CleanupSnapuserdSocket();
+    }
+    return true;
+}
+
 bool FirstStageMount::MountPartition(const Fstab::iterator& begin, bool erase_same_mounts,
                                      Fstab::iterator* end) {
     // Sets end to begin + 1, so we can just return on failure below.
@@ -457,6 +502,10 @@
 
     if (system_partition == fstab_.end()) return true;
 
+    if (use_snapuserd_) {
+        SaveRamdiskPathToSnapuserd();
+    }
+
     if (MountPartition(system_partition, false /* erase_same_mounts */)) {
         if (dsu_not_on_userdata_ && fs_mgr_verity_is_check_at_most_once(*system_partition)) {
             LOG(ERROR) << "check_most_at_once forbidden on external media";
@@ -472,22 +521,6 @@
 }
 
 bool FirstStageMount::MountPartitions() {
-    // Mount /metadata before creating logical partitions, since we need to
-    // know whether a snapshot merge is in progress.
-    auto metadata_partition = std::find_if(fstab_.begin(), fstab_.end(), [](const auto& entry) {
-        return entry.mount_point == "/metadata";
-    });
-    if (metadata_partition != fstab_.end()) {
-        if (MountPartition(metadata_partition, true /* erase_same_mounts */)) {
-            // Copies DSU AVB keys from the ramdisk to /metadata.
-            // Must be done before the following TrySwitchSystemAsRoot().
-            // Otherwise, ramdisk will be inaccessible after switching root.
-            CopyDsuAvbKeys();
-        }
-    }
-
-    if (!CreateLogicalPartitions()) return false;
-
     if (!TrySwitchSystemAsRoot()) return false;
 
     if (!SkipMountingPartitions(&fstab_)) return false;
@@ -613,7 +646,7 @@
     }
     // Publish the logical partition names for TransformFstabForDsu
     WriteFile(gsi::kGsiLpNamesFile, lp_names);
-    TransformFstabForDsu(&fstab_, dsu_partitions);
+    TransformFstabForDsu(&fstab_, active_dsu, dsu_partitions);
 }
 
 bool FirstStageMountVBootV1::GetDmVerityDevices(std::set<std::string>* devices) {
diff --git a/init/host_init_stubs.h b/init/host_init_stubs.h
index caa8f8d..2a8bf6c 100644
--- a/init/host_init_stubs.h
+++ b/init/host_init_stubs.h
@@ -20,6 +20,7 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 
+#include <optional>
 #include <string>
 
 #include <android-base/properties.h>
@@ -41,7 +42,7 @@
 }
 
 // reboot_utils.h
-inline void SetFatalRebootTarget() {}
+inline void SetFatalRebootTarget(const std::optional<std::string>& = std::nullopt) {}
 inline void __attribute__((noreturn)) InitFatalReboot(int signal_number) {
     abort();
 }
diff --git a/init/host_init_verifier.cpp b/init/host_init_verifier.cpp
index 0bd4df4..db127d3 100644
--- a/init/host_init_verifier.cpp
+++ b/init/host_init_verifier.cpp
@@ -25,6 +25,8 @@
 #include <fstream>
 #include <iostream>
 #include <iterator>
+#include <map>
+#include <set>
 #include <string>
 #include <vector>
 
@@ -32,6 +34,7 @@
 #include <android-base/logging.h>
 #include <android-base/parseint.h>
 #include <android-base/strings.h>
+#include <generated_android_ids.h>
 #include <hidl/metadata.h>
 #include <property_info_serializer/property_info_serializer.h>
 
@@ -48,11 +51,9 @@
 #include "service_list.h"
 #include "service_parser.h"
 
-#define EXCLUDE_FS_CONFIG_STRUCTURES
-#include "generated_android_ids.h"
-
 using namespace std::literals;
 
+using android::base::EndsWith;
 using android::base::ParseInt;
 using android::base::ReadFileToString;
 using android::base::Split;
@@ -63,6 +64,10 @@
 
 static std::vector<std::string> passwd_files;
 
+// NOTE: Keep this in sync with the order used by init.cpp LoadBootScripts()
+static const std::vector<std::string> partition_search_order =
+        std::vector<std::string>({"system", "system_ext", "odm", "vendor", "product"});
+
 static std::vector<std::pair<std::string, int>> GetVendorPasswd(const std::string& passwd_file) {
     std::string passwd;
     if (!ReadFileToString(passwd_file, &passwd)) {
@@ -150,13 +155,24 @@
 #include "generated_stub_builtin_function_map.h"
 
 void PrintUsage() {
-    std::cout << "usage: host_init_verifier [options] <init rc file>\n"
-                 "\n"
-                 "Tests an init script for correctness\n"
-                 "\n"
-                 "-p FILE\tSearch this passwd file for users and groups\n"
-                 "--property_contexts=FILE\t Use this file for property_contexts\n"
-              << std::endl;
+    fprintf(stdout, R"(usage: host_init_verifier [options]
+
+Tests init script(s) for correctness.
+
+Generic options:
+  -p FILE                     Search this passwd file for users and groups.
+  --property_contexts=FILE    Use this file for property_contexts.
+
+Single script mode options:
+  [init rc file]              Positional argument; test this init script.
+
+Multiple script mode options:
+  --out_system=DIR            Path to the output product directory for the system partition.
+  --out_system_ext=DIR        Path to the output product directory for the system_ext partition.
+  --out_odm=DIR               Path to the output product directory for the odm partition.
+  --out_vendor=DIR            Path to the output product directory for the vendor partition.
+  --out_product=DIR           Path to the output product directory for the product partition.
+)");
 }
 
 Result<InterfaceInheritanceHierarchyMap> ReadInterfaceInheritanceHierarchy() {
@@ -205,12 +221,18 @@
     android::base::SetMinimumLogSeverity(android::base::ERROR);
 
     auto property_infos = std::vector<PropertyInfoEntry>();
+    std::map<std::string, std::string> partition_map;
 
     while (true) {
         static const char kPropertyContexts[] = "property-contexts=";
         static const struct option long_options[] = {
                 {"help", no_argument, nullptr, 'h'},
                 {kPropertyContexts, required_argument, nullptr, 0},
+                {"out_system", required_argument, nullptr, 0},
+                {"out_system_ext", required_argument, nullptr, 0},
+                {"out_odm", required_argument, nullptr, 0},
+                {"out_vendor", required_argument, nullptr, 0},
+                {"out_product", required_argument, nullptr, 0},
                 {nullptr, 0, nullptr, 0},
         };
 
@@ -226,6 +248,16 @@
                 if (long_options[option_index].name == kPropertyContexts) {
                     HandlePropertyContexts(optarg, &property_infos);
                 }
+                for (const auto& p : partition_search_order) {
+                    if (long_options[option_index].name == "out_" + p) {
+                        if (partition_map.find(p) != partition_map.end()) {
+                            PrintUsage();
+                            return EXIT_FAILURE;
+                        }
+                        partition_map[p] =
+                                EndsWith(optarg, "/") ? optarg : std::string(optarg) + "/";
+                    }
+                }
                 break;
             case 'h':
                 PrintUsage();
@@ -242,7 +274,9 @@
     argc -= optind;
     argv += optind;
 
-    if (argc != 1) {
+    // If provided, use the partition map to check multiple init rc files.
+    // Otherwise, check a single init rc file.
+    if ((!partition_map.empty() && argc != 0) || (partition_map.empty() && argc != 1)) {
         PrintUsage();
         return EXIT_FAILURE;
     }
@@ -264,24 +298,42 @@
 
     property_info_area = reinterpret_cast<const PropertyInfoArea*>(serialized_contexts.c_str());
 
+    if (!partition_map.empty()) {
+        std::vector<std::string> vendor_prefixes;
+        for (const auto& partition : {"vendor", "odm"}) {
+            if (partition_map.find(partition) != partition_map.end()) {
+                vendor_prefixes.push_back(partition_map.at(partition));
+            }
+        }
+        InitializeHostSubcontext(vendor_prefixes);
+    }
+
     const BuiltinFunctionMap& function_map = GetBuiltinFunctionMap();
     Action::set_function_map(&function_map);
     ActionManager& am = ActionManager::GetInstance();
     ServiceList& sl = ServiceList::GetInstance();
     Parser parser;
-    parser.AddSectionParser("service", std::make_unique<ServiceParser>(
-                                               &sl, nullptr, *interface_inheritance_hierarchy_map));
-    parser.AddSectionParser("on", std::make_unique<ActionParser>(&am, nullptr));
+    parser.AddSectionParser("service",
+                            std::make_unique<ServiceParser>(&sl, GetSubcontext(),
+                                                            *interface_inheritance_hierarchy_map));
+    parser.AddSectionParser("on", std::make_unique<ActionParser>(&am, GetSubcontext()));
     parser.AddSectionParser("import", std::make_unique<HostImportParser>());
 
-    if (!parser.ParseConfigFileInsecure(*argv)) {
-        LOG(ERROR) << "Failed to open init rc script '" << *argv << "'";
-        return EXIT_FAILURE;
+    if (!partition_map.empty()) {
+        for (const auto& p : partition_search_order) {
+            if (partition_map.find(p) != partition_map.end()) {
+                parser.ParseConfig(partition_map.at(p) + "etc/init");
+            }
+        }
+    } else {
+        if (!parser.ParseConfigFileInsecure(*argv)) {
+            LOG(ERROR) << "Failed to open init rc script '" << *argv << "'";
+            return EXIT_FAILURE;
+        }
     }
     size_t failures = parser.parse_error_count() + am.CheckAllCommands() + sl.CheckAllCommands();
     if (failures > 0) {
-        LOG(ERROR) << "Failed to parse init script '" << *argv << "' with " << failures
-                   << " errors";
+        LOG(ERROR) << "Failed to parse init scripts with " << failures << " error(s).";
         return EXIT_FAILURE;
     }
     return EXIT_SUCCESS;
diff --git a/init/init.cpp b/init/init.cpp
index 29859c5..ca2d5da 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -18,6 +18,7 @@
 
 #include <dirent.h>
 #include <fcntl.h>
+#include <paths.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -46,11 +47,13 @@
 #include <android-base/properties.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
+#include <backtrace/Backtrace.h>
 #include <fs_avb/fs_avb.h>
 #include <fs_mgr_vendor_overlay.h>
 #include <keyutils.h>
 #include <libavb/libavb.h>
 #include <libgsi/libgsi.h>
+#include <libsnapshot/snapshot.h>
 #include <processgroup/processgroup.h>
 #include <processgroup/setup.h>
 #include <selinux/android.h>
@@ -69,12 +72,14 @@
 #include "proto_utils.h"
 #include "reboot.h"
 #include "reboot_utils.h"
+#include "second_stage_resources.h"
 #include "security.h"
 #include "selabel.h"
 #include "selinux.h"
 #include "service.h"
 #include "service_parser.h"
 #include "sigchld_handler.h"
+#include "snapuserd_transition.h"
 #include "subcontext.h"
 #include "system/core/init/property_service.pb.h"
 #include "util.h"
@@ -91,6 +96,7 @@
 using android::base::Timer;
 using android::base::Trim;
 using android::fs_mgr::AvbHandle;
+using android::snapshot::SnapshotManager;
 
 namespace android {
 namespace init {
@@ -231,18 +237,43 @@
     std::optional<std::string> CheckShutdown() {
         auto lock = std::lock_guard{shutdown_command_lock_};
         if (do_shutdown_ && !IsShuttingDown()) {
-            do_shutdown_ = false;
             return shutdown_command_;
         }
         return {};
     }
 
+    bool do_shutdown() const { return do_shutdown_; }
+    void set_do_shutdown(bool value) { do_shutdown_ = value; }
+
   private:
     std::mutex shutdown_command_lock_;
     std::string shutdown_command_;
     bool do_shutdown_ = false;
 } shutdown_state;
 
+static void UnwindMainThreadStack() {
+    std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, 1));
+    if (!backtrace->Unwind(0)) {
+        LOG(ERROR) << __FUNCTION__ << "sys.powerctl: Failed to unwind callstack.";
+    }
+    for (size_t i = 0; i < backtrace->NumFrames(); i++) {
+        LOG(ERROR) << "sys.powerctl: " << backtrace->FormatFrameData(i);
+    }
+}
+
+void DebugRebootLogging() {
+    LOG(INFO) << "sys.powerctl: do_shutdown: " << shutdown_state.do_shutdown()
+              << " IsShuttingDown: " << IsShuttingDown();
+    if (shutdown_state.do_shutdown()) {
+        LOG(ERROR) << "sys.powerctl set while a previous shutdown command has not been handled";
+        UnwindMainThreadStack();
+    }
+    if (IsShuttingDown()) {
+        LOG(ERROR) << "sys.powerctl set while init is already shutting down";
+        UnwindMainThreadStack();
+    }
+}
+
 void DumpState() {
     ServiceList::GetInstance().DumpState();
     ActionManager::GetInstance().DumpState();
@@ -281,14 +312,14 @@
         // late_import is available only in Q and earlier release. As we don't
         // have system_ext in those versions, skip late_import for system_ext.
         parser.ParseConfig("/system_ext/etc/init");
-        if (!parser.ParseConfig("/product/etc/init")) {
-            late_import_paths.emplace_back("/product/etc/init");
+        if (!parser.ParseConfig("/vendor/etc/init")) {
+            late_import_paths.emplace_back("/vendor/etc/init");
         }
         if (!parser.ParseConfig("/odm/etc/init")) {
             late_import_paths.emplace_back("/odm/etc/init");
         }
-        if (!parser.ParseConfig("/vendor/etc/init")) {
-            late_import_paths.emplace_back("/vendor/etc/init");
+        if (!parser.ParseConfig("/product/etc/init")) {
+            late_import_paths.emplace_back("/product/etc/init");
         }
     } else {
         parser.ParseConfig(bootscript);
@@ -639,6 +670,12 @@
     }
 }
 
+static void UmountSecondStageRes() {
+    if (umount(kSecondStageRes) != 0) {
+        PLOG(ERROR) << "Failed to umount " << kSecondStageRes;
+    }
+}
+
 static void MountExtraFilesystems() {
 #define CHECKCALL(x) \
     if ((x) != 0) PLOG(FATAL) << #x " failed.";
@@ -686,6 +723,37 @@
     }
 }
 
+static Result<void> TransitionSnapuserdAction(const BuiltinArguments&) {
+    if (!SnapshotManager::IsSnapshotManagerNeeded() ||
+        !android::base::GetBoolProperty(android::snapshot::kVirtualAbCompressionProp, false)) {
+        return {};
+    }
+
+    auto sm = SnapshotManager::New();
+    if (!sm) {
+        LOG(FATAL) << "Failed to create SnapshotManager, will not transition snapuserd";
+        return {};
+    }
+
+    ServiceList& service_list = ServiceList::GetInstance();
+    auto svc = service_list.FindService("snapuserd");
+    if (!svc) {
+        LOG(FATAL) << "Failed to find snapuserd service, aborting transition";
+        return {};
+    }
+    svc->Start();
+    svc->SetShutdownCritical();
+
+    if (!sm->PerformSecondStageInitTransition()) {
+        LOG(FATAL) << "Failed to transition snapuserd to second-stage";
+    }
+
+    if (auto pid = GetSnapuserdFirstStagePid()) {
+        KillFirstStageSnapuserd(pid.value());
+    }
+    return {};
+}
+
 int SecondStageMain(int argc, char** argv) {
     if (REBOOT_BOOTLOADER_ON_PANIC) {
         InstallRebootSignalHandlers();
@@ -699,6 +767,12 @@
     InitKernelLogging(argv);
     LOG(INFO) << "init second stage started!";
 
+    // Update $PATH in the case the second stage init is newer than first stage init, where it is
+    // first set.
+    if (setenv("PATH", _PATH_DEFPATH, 1) != 0) {
+        PLOG(FATAL) << "Could not set $PATH to '" << _PATH_DEFPATH << "' in second stage";
+    }
+
     // Init should not crash because of a dependence on any other process, therefore we ignore
     // SIGPIPE and handle EPIPE at the call site directly.  Note that setting a signal to SIG_IGN
     // is inherited across exec, but custom signal handlers are not.  Since we do not want to
@@ -741,6 +815,9 @@
 
     PropertyInit();
 
+    // Umount second stage resources after property service has read the .prop files.
+    UmountSecondStageRes();
+
     // Umount the debug ramdisk after property service has read the .prop files when it means to.
     if (load_debug_prop) {
         UmountDebugRamdisk();
@@ -801,6 +878,21 @@
     auto is_installed = android::gsi::IsGsiInstalled() ? "1" : "0";
     SetProperty(gsi::kGsiInstalledProp, is_installed);
 
+    /*
+     * For debug builds of S launching devices, init mounts debugfs for
+     * enabling vendor debug data collection setup at boot time. Init will unmount it on
+     * boot-complete after vendor code has performed the required initializations
+     * during boot. Dumpstate will then mount debugfs in order to read data
+     * from the same using the dumpstate HAL during bugreport creation.
+     * Dumpstate will also unmount debugfs after bugreport creation.
+     * first_api_level comparison is done here instead
+     * of init.rc since init.rc parser does not support >/< operators.
+     */
+    auto api_level = android::base::GetIntProperty("ro.product.first_api_level", 0);
+    bool is_debuggable = android::base::GetBoolProperty("ro.debuggable", false);
+    auto mount_debugfs = (is_debuggable && (api_level >= 31)) ? "1" : "0";
+    SetProperty("init.mount_debugfs", mount_debugfs);
+
     am.QueueBuiltinAction(SetupCgroupsAction, "SetupCgroups");
     am.QueueBuiltinAction(SetKptrRestrictAction, "SetKptrRestrict");
     am.QueueBuiltinAction(TestPerfEventSelinuxAction, "TestPerfEventSelinux");
@@ -808,6 +900,7 @@
 
     // Queue an action that waits for coldboot done so we know ueventd has set up all of /dev...
     am.QueueBuiltinAction(wait_for_coldboot_done_action, "wait_for_coldboot_done");
+    am.QueueBuiltinAction(TransitionSnapuserdAction, "TransitionSnapuserd");
     // ... so that we can start queuing up actions that require stuff from /dev.
     am.QueueBuiltinAction(MixHwrngIntoLinuxRngAction, "MixHwrngIntoLinuxRng");
     am.QueueBuiltinAction(SetMmapRndBitsAction, "SetMmapRndBits");
@@ -840,13 +933,18 @@
     // Run all property triggers based on current state of the properties.
     am.QueueBuiltinAction(queue_property_triggers_action, "queue_property_triggers");
 
+    // Restore prio before main loop
+    setpriority(PRIO_PROCESS, 0, 0);
     while (true) {
         // By default, sleep until something happens.
         auto epoll_timeout = std::optional<std::chrono::milliseconds>{};
 
         auto shutdown_command = shutdown_state.CheckShutdown();
         if (shutdown_command) {
+            LOG(INFO) << "Got shutdown_command '" << *shutdown_command
+                      << "' Calling HandlePowerctlMessage()";
             HandlePowerctlMessage(*shutdown_command);
+            shutdown_state.set_do_shutdown(false);
         }
 
         if (!(prop_waiter_state.MightBeWaiting() || Service::is_exec_service_running())) {
diff --git a/init/init.h b/init/init.h
index 27f64e2..4f686cb 100644
--- a/init/init.h
+++ b/init/init.h
@@ -42,6 +42,8 @@
 void PropertyChanged(const std::string& name, const std::string& value);
 bool QueueControlMessage(const std::string& message, const std::string& name, pid_t pid, int fd);
 
+void DebugRebootLogging();
+
 int SecondStageMain(int argc, char** argv);
 
 }  // namespace init
diff --git a/init/init_test.cpp b/init/init_test.cpp
index fa65740..8550ec8 100644
--- a/init/init_test.cpp
+++ b/init/init_test.cpp
@@ -17,6 +17,7 @@
 #include <functional>
 
 #include <android-base/file.h>
+#include <android-base/logging.h>
 #include <android-base/properties.h>
 #include <gtest/gtest.h>
 
@@ -268,6 +269,17 @@
     ASSERT_EQ(1u, parser.parse_error_count());
 }
 
+class TestCaseLogger : public ::testing::EmptyTestEventListener {
+    void OnTestStart(const ::testing::TestInfo& test_info) override {
+#ifdef __ANDROID__
+        LOG(INFO) << "===== " << test_info.test_suite_name() << "::" << test_info.name() << " ("
+                  << test_info.file() << ":" << test_info.line() << ")";
+#else
+        UNUSED(test_info);
+#endif
+    }
+};
+
 }  // namespace init
 }  // namespace android
 
@@ -284,5 +296,6 @@
     }
 
     testing::InitGoogleTest(&argc, argv);
+    testing::UnitTest::GetInstance()->listeners().Append(new android::init::TestCaseLogger());
     return RUN_ALL_TESTS();
 }
diff --git a/init/main.cpp b/init/main.cpp
index 38bc74b..23f5530 100644
--- a/init/main.cpp
+++ b/init/main.cpp
@@ -52,7 +52,8 @@
 #if __has_feature(address_sanitizer)
     __asan_set_error_report_callback(AsanReportCallback);
 #endif
-
+    // Boost prio which will be restored later
+    setpriority(PRIO_PROCESS, 0, -20);
     if (!strcmp(basename(argv[0]), "ueventd")) {
         return ueventd_main(argc, argv);
     }
diff --git a/init/mount_handler.cpp b/init/mount_handler.cpp
index 01abba8..46f8331 100644
--- a/init/mount_handler.cpp
+++ b/init/mount_handler.cpp
@@ -130,7 +130,11 @@
     char* buf = nullptr;
     size_t len = 0;
     while (getline(&buf, &len, fp_.get()) != -1) {
-        auto entry = ParseMount(std::string(buf));
+        auto buf_string = std::string(buf);
+        if (buf_string.find("/emulated") != std::string::npos) {
+            continue;
+        }
+        auto entry = ParseMount(buf_string);
         auto match = untouched.find(entry);
         if (match == untouched.end()) {
             touched.emplace_back(std::move(entry));
diff --git a/init/mount_namespace.cpp b/init/mount_namespace.cpp
index f3b584c..ec48cde 100644
--- a/init/mount_namespace.cpp
+++ b/init/mount_namespace.cpp
@@ -27,58 +27,34 @@
 #include <android-base/properties.h>
 #include <android-base/result.h>
 #include <android-base/unique_fd.h>
-#include <apex_manifest.pb.h>
 
 #include "util.h"
 
+#ifndef RECOVERY
+#define ACTIVATE_FLATTENED_APEX 1
+#endif
+
+#ifdef ACTIVATE_FLATTENED_APEX
+#include <apex_manifest.pb.h>
+#include <com_android_apex.h>
+#include <selinux/android.h>
+#endif  // ACTIVATE_FLATTENED_APEX
+
 namespace android {
 namespace init {
 namespace {
 
-static bool BindMount(const std::string& source, const std::string& mount_point,
-                      bool recursive = false) {
-    unsigned long mountflags = MS_BIND;
-    if (recursive) {
-        mountflags |= MS_REC;
-    }
-    if (mount(source.c_str(), mount_point.c_str(), nullptr, mountflags, nullptr) == -1) {
+static bool BindMount(const std::string& source, const std::string& mount_point) {
+    if (mount(source.c_str(), mount_point.c_str(), nullptr, MS_BIND | MS_REC, nullptr) == -1) {
         PLOG(ERROR) << "Failed to bind mount " << source;
         return false;
     }
     return true;
 }
 
-static bool MakeShared(const std::string& mount_point, bool recursive = false) {
-    unsigned long mountflags = MS_SHARED;
-    if (recursive) {
-        mountflags |= MS_REC;
-    }
+static bool ChangeMount(const std::string& mount_point, unsigned long mountflags) {
     if (mount(nullptr, mount_point.c_str(), nullptr, mountflags, nullptr) == -1) {
-        PLOG(ERROR) << "Failed to change propagation type to shared";
-        return false;
-    }
-    return true;
-}
-
-static bool MakeSlave(const std::string& mount_point, bool recursive = false) {
-    unsigned long mountflags = MS_SLAVE;
-    if (recursive) {
-        mountflags |= MS_REC;
-    }
-    if (mount(nullptr, mount_point.c_str(), nullptr, mountflags, nullptr) == -1) {
-        PLOG(ERROR) << "Failed to change propagation type to slave";
-        return false;
-    }
-    return true;
-}
-
-static bool MakePrivate(const std::string& mount_point, bool recursive = false) {
-    unsigned long mountflags = MS_PRIVATE;
-    if (recursive) {
-        mountflags |= MS_REC;
-    }
-    if (mount(nullptr, mount_point.c_str(), nullptr, mountflags, nullptr) == -1) {
-        PLOG(ERROR) << "Failed to change propagation type to private";
+        PLOG(ERROR) << "Failed to remount " << mount_point << " as " << std::hex << mountflags;
         return false;
     }
     return true;
@@ -106,6 +82,8 @@
     return updatable;
 }
 
+#ifdef ACTIVATE_FLATTENED_APEX
+
 static Result<void> MountDir(const std::string& path, const std::string& mount_path) {
     if (int ret = mkdir(mount_path.c_str(), 0755); ret != 0 && errno != EEXIST) {
         return ErrnoError() << "Could not create mount point " << mount_path;
@@ -116,7 +94,7 @@
     return {};
 }
 
-static Result<std::string> GetApexName(const std::string& apex_dir) {
+static Result<apex::proto::ApexManifest> GetApexManifest(const std::string& apex_dir) {
     const std::string manifest_path = apex_dir + "/apex_manifest.pb";
     std::string content;
     if (!android::base::ReadFileToString(manifest_path, &content)) {
@@ -126,31 +104,40 @@
     if (!manifest.ParseFromString(content)) {
         return Error() << "Can't parse manifest file: " << manifest_path;
     }
-    return manifest.name();
+    return manifest;
 }
 
+template <typename Fn>
 static Result<void> ActivateFlattenedApexesFrom(const std::string& from_dir,
-                                                const std::string& to_dir) {
+                                                const std::string& to_dir, Fn on_activate) {
     std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(from_dir.c_str()), closedir);
     if (!dir) {
         return {};
     }
     dirent* entry;
+    std::vector<std::string> entries;
+
     while ((entry = readdir(dir.get())) != nullptr) {
         if (entry->d_name[0] == '.') continue;
         if (entry->d_type == DT_DIR) {
-            const std::string apex_path = from_dir + "/" + entry->d_name;
-            const auto apex_name = GetApexName(apex_path);
-            if (!apex_name.ok()) {
-                LOG(ERROR) << apex_path << " is not an APEX directory: " << apex_name.error();
-                continue;
-            }
-            const std::string mount_path = to_dir + "/" + (*apex_name);
-            if (auto result = MountDir(apex_path, mount_path); !result.ok()) {
-                return result;
-            }
+            entries.push_back(entry->d_name);
         }
     }
+
+    std::sort(entries.begin(), entries.end());
+    for (const auto& name : entries) {
+        const std::string apex_path = from_dir + "/" + name;
+        const auto apex_manifest = GetApexManifest(apex_path);
+        if (!apex_manifest.ok()) {
+            LOG(ERROR) << apex_path << " is not an APEX directory: " << apex_manifest.error();
+            continue;
+        }
+        const std::string mount_path = to_dir + "/" + apex_manifest->name();
+        if (auto result = MountDir(apex_path, mount_path); !result.ok()) {
+            return result;
+        }
+        on_activate(apex_path, *apex_manifest);
+    }
     return {};
 }
 
@@ -167,28 +154,36 @@
             "/vendor/apex",
     };
 
+    std::vector<com::android::apex::ApexInfo> apex_infos;
+    auto on_activate = [&](const std::string& apex_path,
+                           const apex::proto::ApexManifest& apex_manifest) {
+        apex_infos.emplace_back(apex_manifest.name(), apex_path, apex_path, apex_manifest.version(),
+                                apex_manifest.versionname(), /*isFactory=*/true, /*isActive=*/true);
+    };
+
     for (const auto& dir : kBuiltinDirsForApexes) {
-        if (auto result = ActivateFlattenedApexesFrom(dir, kApexTop); !result.ok()) {
+        if (auto result = ActivateFlattenedApexesFrom(dir, kApexTop, on_activate); !result.ok()) {
             LOG(ERROR) << result.error();
             return false;
         }
     }
+
+    std::ostringstream oss;
+    com::android::apex::ApexInfoList apex_info_list(apex_infos);
+    com::android::apex::write(oss, apex_info_list);
+    const std::string kApexInfoList = kApexTop + "/apex-info-list.xml";
+    if (!android::base::WriteStringToFile(oss.str(), kApexInfoList)) {
+        PLOG(ERROR) << "Failed to write " << kApexInfoList;
+        return false;
+    }
+    if (selinux_android_restorecon(kApexInfoList.c_str(), 0) != 0) {
+        PLOG(ERROR) << "selinux_android_restorecon(" << kApexInfoList << ") failed";
+    }
+
     return true;
 }
 
-static Result<void> MountLinkerConfigForDefaultNamespace() {
-    // No need to mount linkerconfig for default mount namespace if the path does not exist (which
-    // would mean it is already mounted)
-    if (access("/linkerconfig/default", 0) != 0) {
-        return {};
-    }
-
-    if (mount("/linkerconfig/default", "/linkerconfig", nullptr, MS_BIND | MS_REC, nullptr) != 0) {
-        return ErrnoError() << "Failed to mount linker configuration for default mount namespace.";
-    }
-
-    return {};
-}
+#endif  // ACTIVATE_FLATTENED_APEX
 
 static android::base::unique_fd bootstrap_ns_fd;
 static android::base::unique_fd default_ns_fd;
@@ -204,17 +199,17 @@
     // needed for /foo/bar, then we will make /foo/bar as a mount point (by
     // bind-mounting by to itself) and set the propagation type of the mount
     // point to private.
-    if (!MakeShared("/", true /*recursive*/)) return false;
+    if (!ChangeMount("/", MS_SHARED | MS_REC)) return false;
 
     // /apex is a private mountpoint to give different sets of APEXes for
     // the bootstrap and default mount namespaces. The processes running with
     // the bootstrap namespace get APEXes from the read-only partition.
-    if (!(MakePrivate("/apex"))) return false;
+    if (!(ChangeMount("/apex", MS_PRIVATE))) return false;
 
     // /linkerconfig is a private mountpoint to give a different linker configuration
     // based on the mount namespace. Subdirectory will be bind-mounted based on current mount
     // namespace
-    if (!(MakePrivate("/linkerconfig"))) return false;
+    if (!(ChangeMount("/linkerconfig", MS_PRIVATE))) return false;
 
     // The two mount namespaces present challenges for scoped storage, because
     // vold, which is responsible for most of the mounting, lives in the
@@ -245,15 +240,15 @@
     if (!mkdir_recursive("/mnt/user", 0755)) return false;
     if (!mkdir_recursive("/mnt/installer", 0755)) return false;
     if (!mkdir_recursive("/mnt/androidwritable", 0755)) return false;
-    if (!(BindMount("/mnt/user", "/mnt/installer", true))) return false;
-    if (!(BindMount("/mnt/user", "/mnt/androidwritable", true))) return false;
+    if (!(BindMount("/mnt/user", "/mnt/installer"))) return false;
+    if (!(BindMount("/mnt/user", "/mnt/androidwritable"))) return false;
     // First, make /mnt/installer and /mnt/androidwritable a slave bind mount
-    if (!(MakeSlave("/mnt/installer"))) return false;
-    if (!(MakeSlave("/mnt/androidwritable"))) return false;
+    if (!(ChangeMount("/mnt/installer", MS_SLAVE))) return false;
+    if (!(ChangeMount("/mnt/androidwritable", MS_SLAVE))) return false;
     // Then, make it shared again - effectively creating a new peer group, that
     // will be inherited by new mount namespaces.
-    if (!(MakeShared("/mnt/installer"))) return false;
-    if (!(MakeShared("/mnt/androidwritable"))) return false;
+    if (!(ChangeMount("/mnt/installer", MS_SHARED))) return false;
+    if (!(ChangeMount("/mnt/androidwritable", MS_SHARED))) return false;
 
     bootstrap_ns_fd.reset(OpenMountNamespace());
     bootstrap_ns_id = GetMountNamespaceId();
@@ -283,47 +278,27 @@
         default_ns_fd.reset(OpenMountNamespace());
         default_ns_id = GetMountNamespaceId();
     }
-
+#ifdef ACTIVATE_FLATTENED_APEX
     success &= ActivateFlattenedApexesIfPossible();
-
+#endif
     LOG(INFO) << "SetupMountNamespaces done";
     return success;
 }
 
-bool SwitchToDefaultMountNamespace() {
-    if (IsRecoveryMode()) {
-        // we don't have multiple namespaces in recovery mode
-        return true;
+Result<void> SwitchToMountNamespaceIfNeeded(MountNamespace target_mount_namespace) {
+    if (IsRecoveryMode() || !IsApexUpdatable()) {
+        // we don't have multiple namespaces in recovery mode or if apex is not updatable
+        return {};
     }
-    if (default_ns_id != GetMountNamespaceId()) {
-        if (setns(default_ns_fd.get(), CLONE_NEWNS) == -1) {
-            PLOG(ERROR) << "Failed to switch back to the default mount namespace.";
-            return false;
-        }
-
-        if (auto result = MountLinkerConfigForDefaultNamespace(); !result.ok()) {
-            LOG(ERROR) << result.error();
-            return false;
+    const auto& ns_id = target_mount_namespace == NS_BOOTSTRAP ? bootstrap_ns_id : default_ns_id;
+    const auto& ns_fd = target_mount_namespace == NS_BOOTSTRAP ? bootstrap_ns_fd : default_ns_fd;
+    const auto& ns_name = target_mount_namespace == NS_BOOTSTRAP ? "bootstrap" : "default";
+    if (ns_id != GetMountNamespaceId() && ns_fd.get() != -1) {
+        if (setns(ns_fd.get(), CLONE_NEWNS) == -1) {
+            return ErrnoError() << "Failed to switch to " << ns_name << " mount namespace.";
         }
     }
-
-    LOG(INFO) << "Switched to default mount namespace";
-    return true;
-}
-
-bool SwitchToBootstrapMountNamespaceIfNeeded() {
-    if (IsRecoveryMode()) {
-        // we don't have multiple namespaces in recovery mode
-        return true;
-    }
-    if (bootstrap_ns_id != GetMountNamespaceId() && bootstrap_ns_fd.get() != -1 &&
-        IsApexUpdatable()) {
-        if (setns(bootstrap_ns_fd.get(), CLONE_NEWNS) == -1) {
-            PLOG(ERROR) << "Failed to switch to bootstrap mount namespace.";
-            return false;
-        }
-    }
-    return true;
+    return {};
 }
 
 }  // namespace init
diff --git a/init/mount_namespace.h b/init/mount_namespace.h
index c41a449..d4d6f82 100644
--- a/init/mount_namespace.h
+++ b/init/mount_namespace.h
@@ -16,12 +16,15 @@
 
 #pragma once
 
+#include <android-base/result.h>
+
 namespace android {
 namespace init {
 
+enum MountNamespace { NS_BOOTSTRAP, NS_DEFAULT };
+
 bool SetupMountNamespaces();
-bool SwitchToDefaultMountNamespace();
-bool SwitchToBootstrapMountNamespaceIfNeeded();
+base::Result<void> SwitchToMountNamespaceIfNeeded(MountNamespace target_mount_namespace);
 
 }  // namespace init
 }  // namespace android
diff --git a/init/parser.cpp b/init/parser.cpp
index 507ee4a..5c18551 100644
--- a/init/parser.cpp
+++ b/init/parser.cpp
@@ -41,7 +41,7 @@
 }
 
 void Parser::ParseData(const std::string& filename, std::string* data) {
-    data->push_back('\n');  // TODO: fix tokenizer
+    data->push_back('\n');
     data->push_back('\0');
 
     parse_state state;
diff --git a/init/perfboot.py b/init/perfboot.py
index 713290b..4b23ad2 100755
--- a/init/perfboot.py
+++ b/init/perfboot.py
@@ -349,9 +349,9 @@
     # Filter out invalid data.
     end_times = [get_last_value(record, end_tag) for record in record_list
                  if get_last_value(record, end_tag) != 0]
-    print 'mean: ', mean(end_times)
-    print 'median:', median(end_times)
-    print 'standard deviation:', stddev(end_times)
+    print 'mean:', int(round(mean(end_times))), 'ms'
+    print 'median:', int(round(median(end_times))), 'ms'
+    print 'standard deviation:', int(round(stddev(end_times))), 'ms'
 
 
 def do_iteration(device, interval_adjuster, event_tags_re, end_tag):
diff --git a/init/property_service.cpp b/init/property_service.cpp
index a89504e..ce67386 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -51,6 +51,7 @@
 #include <android-base/chrono_utils.h>
 #include <android-base/file.h>
 #include <android-base/logging.h>
+#include <android-base/parseint.h>
 #include <android-base/properties.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
@@ -66,6 +67,7 @@
 #include "persistent_properties.h"
 #include "property_type.h"
 #include "proto_utils.h"
+#include "second_stage_resources.h"
 #include "selinux.h"
 #include "subcontext.h"
 #include "system/core/init/property_service.pb.h"
@@ -74,6 +76,7 @@
 using namespace std::literals;
 
 using android::base::GetProperty;
+using android::base::ParseInt;
 using android::base::ReadFileToString;
 using android::base::Split;
 using android::base::StartsWith;
@@ -491,6 +494,9 @@
         }
         LOG(INFO) << "Received sys.powerctl='" << value << "' from pid: " << cr.pid
                   << process_log_string;
+        if (!value.empty()) {
+            DebugRebootLogging();
+        }
         if (value == "reboot,userspace" && !is_userspace_reboot_supported().value_or(false)) {
             *error = "Userspace reboot is not supported by this device";
             return PROP_ERROR_INVALID_VALUE;
@@ -627,9 +633,11 @@
     char *key, *value, *eol, *sol, *tmp, *fn;
     size_t flen = 0;
 
-    static constexpr const char* const kVendorPathPrefixes[2] = {
+    static constexpr const char* const kVendorPathPrefixes[4] = {
             "/vendor",
             "/odm",
+            "/vendor_dlkm",
+            "/odm_dlkm",
     };
 
     const char* context = kInitContext;
@@ -708,8 +716,8 @@
                 if (it == properties->end()) {
                     (*properties)[key] = value;
                 } else if (it->second != value) {
-                    LOG(WARNING) << "Overriding previous 'ro.' property '" << key << "':'"
-                                 << it->second << "' with new value '" << value << "'";
+                    LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second
+                                 << "' with new value '" << value << "'";
                     it->second = value;
                 }
             } else {
@@ -738,6 +746,15 @@
     return true;
 }
 
+static void LoadPropertiesFromSecondStageRes(std::map<std::string, std::string>* properties) {
+    std::string prop = GetRamdiskPropForSecondStage();
+    if (access(prop.c_str(), R_OK) != 0) {
+        CHECK(errno == ENOENT) << "Cannot access " << prop << ": " << strerror(errno);
+        return;
+    }
+    load_properties_from_file(prop.c_str(), nullptr, properties);
+}
+
 // persist.sys.usb.config values can't be combined on build-time when property
 // files are split into each partition.
 // So we need to apply the same rule of build/make/tools/post_process_props.py
@@ -853,7 +870,7 @@
     build_fingerprint += '/';
     build_fingerprint += GetProperty("ro.product.device", UNKNOWN);
     build_fingerprint += ':';
-    build_fingerprint += GetProperty("ro.build.version.release", UNKNOWN);
+    build_fingerprint += GetProperty("ro.build.version.release_or_codename", UNKNOWN);
     build_fingerprint += '/';
     build_fingerprint += GetProperty("ro.build.id", UNKNOWN);
     build_fingerprint += '/';
@@ -873,31 +890,135 @@
     }
 }
 
+// If the ro.product.cpu.abilist* properties have not been explicitly
+// set, derive them from ro.${partition}.product.cpu.abilist* properties.
+static void property_initialize_ro_cpu_abilist() {
+    // From high to low priority.
+    const char* kAbilistSources[] = {
+            "product",
+            "odm",
+            "vendor",
+            "system",
+    };
+    const std::string EMPTY = "";
+    const char* kAbilistProp = "ro.product.cpu.abilist";
+    const char* kAbilist32Prop = "ro.product.cpu.abilist32";
+    const char* kAbilist64Prop = "ro.product.cpu.abilist64";
+
+    // If the properties are defined explicitly, just use them.
+    if (GetProperty(kAbilistProp, EMPTY) != EMPTY) {
+        return;
+    }
+
+    // Find the first source defining these properties by order.
+    std::string abilist32_prop_val;
+    std::string abilist64_prop_val;
+    for (const auto& source : kAbilistSources) {
+        const auto abilist32_prop = std::string("ro.") + source + ".product.cpu.abilist32";
+        const auto abilist64_prop = std::string("ro.") + source + ".product.cpu.abilist64";
+        abilist32_prop_val = GetProperty(abilist32_prop, EMPTY);
+        abilist64_prop_val = GetProperty(abilist64_prop, EMPTY);
+        // The properties could be empty on 32-bit-only or 64-bit-only devices,
+        // but we cannot identify a property is empty or undefined by GetProperty().
+        // So, we assume both of these 2 properties are empty as undefined.
+        if (abilist32_prop_val != EMPTY || abilist64_prop_val != EMPTY) {
+            break;
+        }
+    }
+
+    // Merge ABI lists for ro.product.cpu.abilist
+    auto abilist_prop_val = abilist64_prop_val;
+    if (abilist32_prop_val != EMPTY) {
+        if (abilist_prop_val != EMPTY) {
+            abilist_prop_val += ",";
+        }
+        abilist_prop_val += abilist32_prop_val;
+    }
+
+    // Set these properties
+    const std::pair<const char*, const std::string&> set_prop_list[] = {
+            {kAbilistProp, abilist_prop_val},
+            {kAbilist32Prop, abilist32_prop_val},
+            {kAbilist64Prop, abilist64_prop_val},
+    };
+    for (const auto& [prop, prop_val] : set_prop_list) {
+        LOG(INFO) << "Setting property '" << prop << "' to '" << prop_val << "'";
+
+        std::string error;
+        uint32_t res = PropertySet(prop, prop_val, &error);
+        if (res != PROP_SUCCESS) {
+            LOG(ERROR) << "Error setting property '" << prop << "': err=" << res << " (" << error
+                       << ")";
+        }
+    }
+}
+
 void PropertyLoadBootDefaults() {
-    // TODO(b/117892318): merge prop.default and build.prop files into one
     // We read the properties and their values into a map, in order to always allow properties
     // loaded in the later property files to override the properties in loaded in the earlier
     // property files, regardless of if they are "ro." properties or not.
     std::map<std::string, std::string> properties;
-    if (!load_properties_from_file("/system/etc/prop.default", nullptr, &properties)) {
-        // Try recovery path
-        if (!load_properties_from_file("/prop.default", nullptr, &properties)) {
-            // Try legacy path
-            load_properties_from_file("/default.prop", nullptr, &properties);
+
+    if (IsRecoveryMode()) {
+        load_properties_from_file("/prop.default", nullptr, &properties);
+    }
+
+    // /<part>/etc/build.prop is the canonical location of the build-time properties since S.
+    // Falling back to /<part>/defalt.prop and /<part>/build.prop only when legacy path has to
+    // be supported, which is controlled by the support_legacy_path_until argument.
+    const auto load_properties_from_partition = [&properties](const std::string& partition,
+                                                              int support_legacy_path_until) {
+        auto path = "/" + partition + "/etc/build.prop";
+        if (load_properties_from_file(path.c_str(), nullptr, &properties)) {
+            return;
         }
-    }
+        // To read ro.<partition>.build.version.sdk, temporarily load the legacy paths into a
+        // separate map. Then by comparing its value with legacy_version, we know that if the
+        // partition is old enough so that we need to respect the legacy paths.
+        std::map<std::string, std::string> temp;
+        auto legacy_path1 = "/" + partition + "/default.prop";
+        auto legacy_path2 = "/" + partition + "/build.prop";
+        load_properties_from_file(legacy_path1.c_str(), nullptr, &temp);
+        load_properties_from_file(legacy_path2.c_str(), nullptr, &temp);
+        bool support_legacy_path = false;
+        auto version_prop_name = "ro." + partition + ".build.version.sdk";
+        auto it = temp.find(version_prop_name);
+        if (it == temp.end()) {
+            // This is embarassing. Without the prop, we can't determine how old the partition is.
+            // Let's be conservative by assuming it is very very old.
+            support_legacy_path = true;
+        } else if (int value;
+                   ParseInt(it->second.c_str(), &value) && value <= support_legacy_path_until) {
+            support_legacy_path = true;
+        }
+        if (support_legacy_path) {
+            // We don't update temp into properties directly as it might skip any (future) logic
+            // for resolving duplicates implemented in load_properties_from_file.  Instead, read
+            // the files again into the properties map.
+            load_properties_from_file(legacy_path1.c_str(), nullptr, &properties);
+            load_properties_from_file(legacy_path2.c_str(), nullptr, &properties);
+        } else {
+            LOG(FATAL) << legacy_path1 << " and " << legacy_path2 << " were not loaded "
+                       << "because " << version_prop_name << "(" << it->second << ") is newer "
+                       << "than " << support_legacy_path_until;
+        }
+    };
+
+    // Order matters here. The more the partition is specific to a product, the higher its
+    // precedence is.
+    LoadPropertiesFromSecondStageRes(&properties);
     load_properties_from_file("/system/build.prop", nullptr, &properties);
-    load_properties_from_file("/system_ext/build.prop", nullptr, &properties);
+    load_properties_from_partition("system_ext", /* support_legacy_path_until */ 30);
+    // TODO(b/117892318): uncomment the following condition when vendor.imgs for aosp_* targets are
+    // all updated.
+    // if (SelinuxGetVendorAndroidVersion() <= __ANDROID_API_R__) {
     load_properties_from_file("/vendor/default.prop", nullptr, &properties);
+    // }
     load_properties_from_file("/vendor/build.prop", nullptr, &properties);
-    if (SelinuxGetVendorAndroidVersion() >= __ANDROID_API_Q__) {
-        load_properties_from_file("/odm/etc/build.prop", nullptr, &properties);
-    } else {
-        load_properties_from_file("/odm/default.prop", nullptr, &properties);
-        load_properties_from_file("/odm/build.prop", nullptr, &properties);
-    }
-    load_properties_from_file("/product/build.prop", nullptr, &properties);
-    load_properties_from_file("/factory/factory.prop", "ro.*", &properties);
+    load_properties_from_file("/vendor_dlkm/etc/build.prop", nullptr, &properties);
+    load_properties_from_file("/odm_dlkm/etc/build.prop", nullptr, &properties);
+    load_properties_from_partition("odm", /* support_legacy_path_until */ 28);
+    load_properties_from_partition("product", /* support_legacy_path_until */ 30);
 
     if (access(kDebugRamdiskProp, R_OK) == 0) {
         LOG(INFO) << "Loading " << kDebugRamdiskProp;
@@ -914,6 +1035,7 @@
 
     property_initialize_ro_product_props();
     property_derive_build_fingerprint();
+    property_initialize_ro_cpu_abilist();
 
     update_sys_usb_config();
 }
@@ -945,7 +1067,7 @@
                                       &property_infos)) {
             return;
         }
-        // Don't check for failure here, so we always have a sane list of properties.
+        // Don't check for failure here, since we don't always have all of these partitions.
         // E.g. In case of recovery, the vendor partition will not have mounted and we
         // still need the system / platform properties to function.
         if (access("/system_ext/etc/selinux/system_ext_property_contexts", R_OK) != -1) {
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 23a07aa..e3aaa38 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -544,6 +544,18 @@
     return still_running;
 }
 
+static Result<void> UnmountAllApexes() {
+    const char* args[] = {"/system/bin/apexd", "--unmount-all"};
+    int status;
+    if (logwrap_fork_execvp(arraysize(args), args, &status, false, LOG_KLOG, true, nullptr) != 0) {
+        return ErrnoError() << "Failed to call '/system/bin/apexd --unmount-all'";
+    }
+    if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+        return {};
+    }
+    return Error() << "'/system/bin/apexd --unmount-all' failed : " << status;
+}
+
 //* Reboot / shutdown the system.
 // cmd ANDROID_RB_* as defined in android_reboot.h
 // reason Reason string like "reboot", "shutdown,userrequested"
@@ -643,6 +655,7 @@
 
         if (do_shutdown_animation) {
             SetProperty("service.bootanim.exit", "0");
+            SetProperty("service.bootanim.progress", "0");
             // Could be in the middle of animation. Stop and start so that it can pick
             // up the right mode.
             boot_anim->Stop();
@@ -701,6 +714,11 @@
     // 5. drop caches and disable zram backing device, if exist
     KillZramBackingDevice();
 
+    LOG(INFO) << "Ready to unmount apexes. So far shutdown sequence took " << t;
+    // 6. unmount active apexes, otherwise they might prevent clean unmount of /data.
+    if (auto ret = UnmountAllApexes(); !ret.ok()) {
+        LOG(ERROR) << ret.error();
+    }
     UmountStat stat =
             TryUmountAndFsck(cmd, run_fsck, shutdown_timeout - t.duration(), &reboot_semaphore);
     // Follow what linux shutdown is doing: one more sync with little bit delay
@@ -739,18 +757,6 @@
     StartSendingMessages();
 }
 
-static Result<void> UnmountAllApexes() {
-    const char* args[] = {"/system/bin/apexd", "--unmount-all"};
-    int status;
-    if (logwrap_fork_execvp(arraysize(args), args, &status, false, LOG_KLOG, true, nullptr) != 0) {
-        return ErrnoError() << "Failed to call '/system/bin/apexd --unmount-all'";
-    }
-    if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
-        return {};
-    }
-    return Error() << "'/system/bin/apexd --unmount-all' failed : " << status;
-}
-
 static std::chrono::milliseconds GetMillisProperty(const std::string& name,
                                                    std::chrono::milliseconds default_value) {
     auto value = GetUintProperty(name, static_cast<uint64_t>(default_value.count()));
@@ -802,11 +808,19 @@
     auto sigkill_timeout = GetMillisProperty("init.userspace_reboot.sigkill.timeoutmillis", 10s);
     LOG(INFO) << "Timeout to terminate services: " << sigterm_timeout.count() << "ms "
               << "Timeout to kill services: " << sigkill_timeout.count() << "ms";
+    std::string services_file_name = "/metadata/userspacereboot/services.txt";
+    const int flags = O_RDWR | O_CREAT | O_SYNC | O_APPEND | O_CLOEXEC;
     StopServicesAndLogViolations(stop_first, sigterm_timeout, true /* SIGTERM */);
     if (int r = StopServicesAndLogViolations(stop_first, sigkill_timeout, false /* SIGKILL */);
         r > 0) {
+        auto fd = unique_fd(TEMP_FAILURE_RETRY(open(services_file_name.c_str(), flags, 0666)));
+        android::base::WriteStringToFd("Post-data services still running: \n", fd);
+        for (const auto& s : stop_first) {
+            if (s->IsRunning()) {
+                android::base::WriteStringToFd(s->name() + "\n", fd);
+            }
+        }
         sub_reason = "sigkill";
-        // TODO(b/135984674): store information about offending services for debugging.
         return Error() << r << " post-data services are still running";
     }
     if (auto result = KillZramBackingDevice(); !result.ok()) {
@@ -820,8 +834,14 @@
     if (int r = StopServicesAndLogViolations(GetDebuggingServices(true /* only_post_data */),
                                              sigkill_timeout, false /* SIGKILL */);
         r > 0) {
+        auto fd = unique_fd(TEMP_FAILURE_RETRY(open(services_file_name.c_str(), flags, 0666)));
+        android::base::WriteStringToFd("Debugging services still running: \n", fd);
+        for (const auto& s : GetDebuggingServices(true)) {
+            if (s->IsRunning()) {
+                android::base::WriteStringToFd(s->name() + "\n", fd);
+            }
+        }
         sub_reason = "sigkill_debug";
-        // TODO(b/135984674): store information about offending services for debugging.
         return Error() << r << " debugging services are still running";
     }
     {
@@ -834,7 +854,7 @@
         sub_reason = "apex";
         return result;
     }
-    if (!SwitchToBootstrapMountNamespaceIfNeeded()) {
+    if (!SwitchToMountNamespaceIfNeeded(NS_BOOTSTRAP).ok()) {
         sub_reason = "ns_switch";
         return Error() << "Failed to switch to bootstrap namespace";
     }
diff --git a/init/reboot_utils.cpp b/init/reboot_utils.cpp
index 76460a5..98f6857 100644
--- a/init/reboot_utils.cpp
+++ b/init/reboot_utils.cpp
@@ -19,6 +19,7 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
+#include <optional>
 #include <string>
 
 #include <android-base/file.h>
@@ -37,7 +38,7 @@
 static std::string init_fatal_reboot_target = "bootloader";
 static bool init_fatal_panic = false;
 
-void SetFatalRebootTarget() {
+void SetFatalRebootTarget(const std::optional<std::string>& reboot_target) {
     std::string cmdline;
     android::base::ReadFileToString("/proc/cmdline", &cmdline);
     cmdline = android::base::Trim(cmdline);
@@ -45,6 +46,11 @@
     const char kInitFatalPanicString[] = "androidboot.init_fatal_panic=true";
     init_fatal_panic = cmdline.find(kInitFatalPanicString) != std::string::npos;
 
+    if (reboot_target) {
+        init_fatal_reboot_target = *reboot_target;
+        return;
+    }
+
     const char kRebootTargetString[] = "androidboot.init_fatal_reboot_target=";
     auto start_pos = cmdline.find(kRebootTargetString);
     if (start_pos == std::string::npos) {
diff --git a/init/reboot_utils.h b/init/reboot_utils.h
index 05bb9ae..a0023b9 100644
--- a/init/reboot_utils.h
+++ b/init/reboot_utils.h
@@ -16,6 +16,7 @@
 
 #pragma once
 
+#include <optional>
 #include <string>
 
 #define PROC_SYSRQ "/proc/sysrq-trigger"
@@ -23,7 +24,7 @@
 namespace android {
 namespace init {
 
-void SetFatalRebootTarget();
+void SetFatalRebootTarget(const std::optional<std::string>& reboot_target = std::nullopt);
 // Determines whether the system is capable of rebooting. This is conservative,
 // so if any of the attempts to determine this fail, it will still return true.
 bool IsRebootCapable();
diff --git a/init/second_stage_resources.h b/init/second_stage_resources.h
new file mode 100644
index 0000000..544d16f
--- /dev/null
+++ b/init/second_stage_resources.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <string>
+
+namespace android {
+namespace init {
+
+constexpr const char kSecondStageRes[] = "/second_stage_resources";
+constexpr const char kBootImageRamdiskProp[] = "/system/etc/ramdisk/build.prop";
+
+inline std::string GetRamdiskPropForSecondStage() {
+    return std::string(kSecondStageRes) + kBootImageRamdiskProp;
+}
+
+}  // namespace init
+}  // namespace android
diff --git a/init/security.cpp b/init/security.cpp
index 6cbe642..ac784a3 100644
--- a/init/security.cpp
+++ b/init/security.cpp
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <linux/perf_event.h>
+#include <selinux/selinux.h>
 #include <sys/ioctl.h>
 #include <sys/syscall.h>
 #include <unistd.h>
@@ -128,8 +129,7 @@
 #define MMAP_RND_PATH "/proc/sys/vm/mmap_rnd_bits"
 #define MMAP_RND_COMPAT_PATH "/proc/sys/vm/mmap_rnd_compat_bits"
 
-// __attribute__((unused)) due to lack of mips support: see mips block in SetMmapRndBitsAction
-static bool __attribute__((unused)) SetMmapRndBitsMin(int start, int min, bool compat) {
+static bool SetMmapRndBitsMin(int start, int min, bool compat) {
     std::string path;
     if (compat) {
         path = MMAP_RND_COMPAT_PATH;
@@ -174,9 +174,6 @@
     if (SetMmapRndBitsMin(16, 16, h64)) {
         return {};
     }
-#elif defined(__mips__) || defined(__mips64__)
-    // TODO: add mips support b/27788820
-    return {};
 #else
     LOG(ERROR) << "Unknown architecture";
 #endif
@@ -226,6 +223,19 @@
 // supporting kernels that precede the perf_event_open hooks (Android common
 // kernels 4.4 and 4.9).
 Result<void> TestPerfEventSelinuxAction(const BuiltinArguments&) {
+    // Special case: for *development devices* that boot with permissive
+    // SELinux, treat the LSM hooks as present for the effect of lowering the
+    // perf_event_paranoid sysctl. The sysprop is reused for pragmatic reasons,
+    // as there no existing way for init rules to check for permissive boot at
+    // the time of writing.
+    if (ALLOW_PERMISSIVE_SELINUX) {
+        if (!security_getenforce()) {
+            LOG(INFO) << "Permissive SELinux boot, forcing sys.init.perf_lsm_hooks to 1.";
+            SetProperty("sys.init.perf_lsm_hooks", "1");
+            return {};
+        }
+    }
+
     // Use a trivial event that will be configured, but not started.
     struct perf_event_attr pe = {
             .type = PERF_TYPE_SOFTWARE,
diff --git a/init/selinux.cpp b/init/selinux.cpp
index 5a0255a..0336936 100644
--- a/init/selinux.cpp
+++ b/init/selinux.cpp
@@ -45,7 +45,7 @@
 // 2) If these hashes do not match, then either /system or /system_ext or /product (or some of them)
 //    have been updated out of sync with /vendor (or /odm if it is present) and the init needs to
 //    compile the SEPolicy.  /system contains the SEPolicy compiler, secilc, and it is used by the
-//    LoadSplitPolicy() function below to compile the SEPolicy to a temp directory and load it.
+//    OpenSplitPolicy() function below to compile the SEPolicy to a temp directory and load it.
 //    That function contains even more documentation with the specific implementation details of how
 //    the SEPolicy is compiled if needed.
 
@@ -74,6 +74,7 @@
 #include "block_dev_initializer.h"
 #include "debug_ramdisk.h"
 #include "reboot_utils.h"
+#include "snapuserd_transition.h"
 #include "util.h"
 
 using namespace std::string_literals;
@@ -298,7 +299,12 @@
     return access(plat_policy_cil_file, R_OK) != -1;
 }
 
-bool LoadSplitPolicy() {
+struct PolicyFile {
+    unique_fd fd;
+    std::string path;
+};
+
+bool OpenSplitPolicy(PolicyFile* policy_file) {
     // IMPLEMENTATION NOTE: Split policy consists of three CIL files:
     // * platform -- policy needed due to logic contained in the system image,
     // * non-platform -- policy needed due to logic contained in the vendor image,
@@ -325,10 +331,8 @@
     if (!use_userdebug_policy && FindPrecompiledSplitPolicy(&precompiled_sepolicy_file)) {
         unique_fd fd(open(precompiled_sepolicy_file.c_str(), O_RDONLY | O_CLOEXEC | O_BINARY));
         if (fd != -1) {
-            if (selinux_android_load_policy_from_fd(fd, precompiled_sepolicy_file.c_str()) < 0) {
-                LOG(ERROR) << "Failed to load SELinux policy from " << precompiled_sepolicy_file;
-                return false;
-            }
+            policy_file->fd = std::move(fd);
+            policy_file->path = std::move(precompiled_sepolicy_file);
             return true;
         }
     }
@@ -446,34 +450,39 @@
     }
     unlink(compiled_sepolicy);
 
-    LOG(INFO) << "Loading compiled SELinux policy";
-    if (selinux_android_load_policy_from_fd(compiled_sepolicy_fd, compiled_sepolicy) < 0) {
-        LOG(ERROR) << "Failed to load SELinux policy from " << compiled_sepolicy;
-        return false;
-    }
-
+    policy_file->fd = std::move(compiled_sepolicy_fd);
+    policy_file->path = compiled_sepolicy;
     return true;
 }
 
-bool LoadMonolithicPolicy() {
-    LOG(VERBOSE) << "Loading SELinux policy from monolithic file";
-    if (selinux_android_load_policy() < 0) {
-        PLOG(ERROR) << "Failed to load monolithic SELinux policy";
+bool OpenMonolithicPolicy(PolicyFile* policy_file) {
+    static constexpr char kSepolicyFile[] = "/sepolicy";
+
+    LOG(VERBOSE) << "Opening SELinux policy from monolithic file";
+    policy_file->fd.reset(open(kSepolicyFile, O_RDONLY | O_CLOEXEC | O_NOFOLLOW));
+    if (policy_file->fd < 0) {
+        PLOG(ERROR) << "Failed to open monolithic SELinux policy";
         return false;
     }
+    policy_file->path = kSepolicyFile;
     return true;
 }
 
-bool LoadPolicy() {
-    return IsSplitPolicyDevice() ? LoadSplitPolicy() : LoadMonolithicPolicy();
-}
+void ReadPolicy(std::string* policy) {
+    PolicyFile policy_file;
 
-void SelinuxInitialize() {
-    LOG(INFO) << "Loading SELinux policy";
-    if (!LoadPolicy()) {
-        LOG(FATAL) << "Unable to load SELinux policy";
+    bool ok = IsSplitPolicyDevice() ? OpenSplitPolicy(&policy_file)
+                                    : OpenMonolithicPolicy(&policy_file);
+    if (!ok) {
+        LOG(FATAL) << "Unable to open SELinux policy";
     }
 
+    if (!android::base::ReadFdToString(policy_file.fd, policy)) {
+        PLOG(FATAL) << "Failed to read policy file: " << policy_file.path;
+    }
+}
+
+void SelinuxSetEnforcement() {
     bool kernel_enforcing = (security_getenforce() == 1);
     bool is_enforcing = IsEnforcing();
     if (kernel_enforcing != is_enforcing) {
@@ -534,6 +543,7 @@
     selinux_android_restorecon("/dev/__properties__", 0);
 
     selinux_android_restorecon("/dev/block", SELINUX_ANDROID_RESTORECON_RECURSE);
+    selinux_android_restorecon("/dev/dm-user", SELINUX_ANDROID_RESTORECON_RECURSE);
     selinux_android_restorecon("/dev/device-mapper", 0);
 
     selinux_android_restorecon("/apex", 0);
@@ -669,6 +679,30 @@
     }
 }
 
+static void LoadSelinuxPolicy(std::string& policy) {
+    LOG(INFO) << "Loading SELinux policy";
+
+    set_selinuxmnt("/sys/fs/selinux");
+    if (security_load_policy(policy.data(), policy.size()) < 0) {
+        PLOG(FATAL) << "SELinux:  Could not load policy";
+    }
+}
+
+// The SELinux setup process is carefully orchestrated around snapuserd. Policy
+// must be loaded off dynamic partitions, and during an OTA, those partitions
+// cannot be read without snapuserd. But, with kernel-privileged snapuserd
+// running, loading the policy will immediately trigger audits.
+//
+// We use a five-step process to address this:
+//  (1) Read the policy into a string, with snapuserd running.
+//  (2) Rewrite the snapshot device-mapper tables, to generate new dm-user
+//      devices and to flush I/O.
+//  (3) Kill snapuserd, which no longer has any dm-user devices to attach to.
+//  (4) Load the sepolicy and issue critical restorecons in /dev, carefully
+//      avoiding anything that would read from /system.
+//  (5) Re-launch snapuserd and attach it to the dm-user devices from step (2).
+//
+// After this sequence, it is safe to enable enforcing mode and continue booting.
 int SetupSelinux(char** argv) {
     SetStdioToDevNull(argv);
     InitKernelLogging(argv);
@@ -681,9 +715,31 @@
 
     MountMissingSystemPartitions();
 
-    // Set up SELinux, loading the SELinux policy.
     SelinuxSetupKernelLogging();
-    SelinuxInitialize();
+
+    LOG(INFO) << "Opening SELinux policy";
+
+    // Read the policy before potentially killing snapuserd.
+    std::string policy;
+    ReadPolicy(&policy);
+
+    auto snapuserd_helper = SnapuserdSelinuxHelper::CreateIfNeeded();
+    if (snapuserd_helper) {
+        // Kill the old snapused to avoid audit messages. After this we cannot
+        // read from /system (or other dynamic partitions) until we call
+        // FinishTransition().
+        snapuserd_helper->StartTransition();
+    }
+
+    LoadSelinuxPolicy(policy);
+
+    if (snapuserd_helper) {
+        // Before enforcing, finish the pending snapuserd transition.
+        snapuserd_helper->FinishTransition();
+        snapuserd_helper = nullptr;
+    }
+
+    SelinuxSetEnforcement();
 
     // We're in the kernel domain and want to transition to the init domain.  File systems that
     // store SELabels in their xattrs, such as ext4 do not need an explicit restorecon here,
diff --git a/init/service.cpp b/init/service.cpp
index 69f944e..f6ce094 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -45,12 +45,14 @@
 #include <android/api-level.h>
 
 #include "mount_namespace.h"
+#include "reboot_utils.h"
 #include "selinux.h"
 #else
 #include "host_init_stubs.h"
 #endif
 
 using android::base::boot_clock;
+using android::base::GetBoolProperty;
 using android::base::GetProperty;
 using android::base::Join;
 using android::base::make_scope_guard;
@@ -71,12 +73,12 @@
     if (getcon(&raw_con) == -1) {
         return Error() << "Could not get security context";
     }
-    std::unique_ptr<char> mycon(raw_con);
+    std::unique_ptr<char, decltype(&freecon)> mycon(raw_con, freecon);
 
     if (getfilecon(service_path.c_str(), &raw_filecon) == -1) {
         return Error() << "Could not get file context";
     }
-    std::unique_ptr<char> filecon(raw_filecon);
+    std::unique_ptr<char, decltype(&freecon)> filecon(raw_filecon, freecon);
 
     char* new_con = nullptr;
     int rc = security_compute_create(mycon.get(), filecon.get(),
@@ -90,7 +92,9 @@
                        << "\") has incorrect label or no domain transition from " << mycon.get()
                        << " to another SELinux domain defined. Have you configured your "
                           "service correctly? https://source.android.com/security/selinux/"
-                          "device-policy#label_new_services_and_address_denials";
+                          "device-policy#label_new_services_and_address_denials. Note: this "
+                          "error shows up even in permissive mode in order to make auditing "
+                          "denials possible.";
     }
     if (rc < 0) {
         return Error() << "Could not get process context";
@@ -151,6 +155,7 @@
                  .priority = 0},
       namespaces_{.flags = namespace_flags},
       seclabel_(seclabel),
+      subcontext_(subcontext_for_restart_commands),
       onrestart_(false, subcontext_for_restart_commands, "<Service '" + name + "' onrestart>", 0,
                  "onrestart", {}),
       oom_score_adjust_(DEFAULT_OOM_SCORE_ADJUST),
@@ -310,20 +315,26 @@
 #endif
     const bool is_process_updatable = !pre_apexd_ && is_apex_updatable;
 
-    // If we crash > 4 times in 4 minutes or before boot_completed,
+    // If we crash > 4 times in 'fatal_crash_window_' minutes or before boot_completed,
     // reboot into bootloader or set crashing property
     boot_clock::time_point now = boot_clock::now();
     if (((flags_ & SVC_CRITICAL) || is_process_updatable) && !(flags_ & SVC_RESTART)) {
-        bool boot_completed = android::base::GetBoolProperty("sys.boot_completed", false);
-        if (now < time_crashed_ + 4min || !boot_completed) {
+        bool boot_completed = GetBoolProperty("sys.boot_completed", false);
+        if (now < time_crashed_ + fatal_crash_window_ || !boot_completed) {
             if (++crash_count_ > 4) {
+                auto exit_reason = boot_completed ?
+                    "in " + std::to_string(fatal_crash_window_.count()) + " minutes" :
+                    "before boot completed";
                 if (flags_ & SVC_CRITICAL) {
-                    // Aborts into bootloader
-                    LOG(FATAL) << "critical process '" << name_ << "' exited 4 times "
-                               << (boot_completed ? "in 4 minutes" : "before boot completed");
+                    if (!GetBoolProperty("init.svc_debug.no_fatal." + name_, false)) {
+                        // Aborts into `fatal_reboot_target_'.
+                        SetFatalRebootTarget(fatal_reboot_target_);
+                        LOG(FATAL) << "critical process '" << name_ << "' exited 4 times "
+                                   << exit_reason;
+                    }
                 } else {
-                    LOG(ERROR) << "updatable process '" << name_ << "' exited 4 times "
-                               << (boot_completed ? "in 4 minutes" : "before boot completed");
+                    LOG(ERROR) << "process with updatable components '" << name_
+                               << "' exited 4 times " << exit_reason;
                     // Notifies update_verifier and apexd
                     SetProperty("sys.init.updatable_crashing_process_name", name_);
                     SetProperty("sys.init.updatable_crashing", "1");
@@ -463,6 +474,16 @@
         pre_apexd_ = true;
     }
 
+    // For pre-apexd services, override mount namespace as "bootstrap" one before starting.
+    // Note: "ueventd" is supposed to be run in "default" mount namespace even if it's pre-apexd
+    // to support loading firmwares from APEXes.
+    std::optional<MountNamespace> override_mount_namespace;
+    if (name_ == "ueventd") {
+        override_mount_namespace = NS_DEFAULT;
+    } else if (pre_apexd_) {
+        override_mount_namespace = NS_BOOTSTRAP;
+    }
+
     post_data_ = ServiceList::GetInstance().IsPostData();
 
     LOG(INFO) << "starting service '" << name_ << "'...";
@@ -494,7 +515,8 @@
     if (pid == 0) {
         umask(077);
 
-        if (auto result = EnterNamespaces(namespaces_, name_, pre_apexd_); !result.ok()) {
+        if (auto result = EnterNamespaces(namespaces_, name_, override_mount_namespace);
+            !result.ok()) {
             LOG(FATAL) << "Service '" << name_
                        << "' failed to set up namespaces: " << result.error();
         }
diff --git a/init/service.h b/init/service.h
index 34ed5ef..aee1e5d 100644
--- a/init/service.h
+++ b/init/service.h
@@ -137,6 +137,7 @@
             flags_ &= ~SVC_ONESHOT;
         }
     }
+    Subcontext* subcontext() const { return subcontext_; }
 
   private:
     void NotifyStateChange(const std::string& new_state) const;
@@ -155,6 +156,8 @@
     android::base::boot_clock::time_point time_started_;  // time of last start
     android::base::boot_clock::time_point time_crashed_;  // first crash within inspection window
     int crash_count_;                     // number of times crashed within window
+    std::chrono::minutes fatal_crash_window_ = 4min;  // fatal() when more than 4 crashes in it
+    std::optional<std::string> fatal_reboot_target_;  // reboot target of fatal handler
 
     std::optional<CapSet> capabilities_;
     ProcessAttributes proc_attr_;
@@ -166,6 +169,7 @@
     std::vector<FileDescriptor> files_;
     std::vector<std::pair<std::string, std::string>> environment_vars_;
 
+    Subcontext* subcontext_;
     Action onrestart_;  // Commands to execute on restart.
 
     std::vector<std::string> writepid_files_;
diff --git a/init/service_parser.cpp b/init/service_parser.cpp
index bdac077..57c311a 100644
--- a/init/service_parser.cpp
+++ b/init/service_parser.cpp
@@ -93,6 +93,39 @@
 }
 
 Result<void> ServiceParser::ParseCritical(std::vector<std::string>&& args) {
+    std::optional<std::string> fatal_reboot_target;
+    std::optional<std::chrono::minutes> fatal_crash_window;
+
+    for (auto it = args.begin() + 1; it != args.end(); ++it) {
+        auto arg = android::base::Split(*it, "=");
+        if (arg.size() != 2) {
+            return Error() << "critical: Argument '" << *it << "' is not supported";
+        } else if (arg[0] == "target") {
+            fatal_reboot_target = arg[1];
+        } else if (arg[0] == "window") {
+            int minutes;
+            auto window = ExpandProps(arg[1]);
+            if (!window.ok()) {
+                return Error() << "critical: Could not expand argument ': " << arg[1];
+            }
+            if (*window == "off") {
+                return {};
+            }
+            if (!ParseInt(*window, &minutes, 0)) {
+                return Error() << "critical: 'fatal_crash_window' must be an integer > 0";
+            }
+            fatal_crash_window = std::chrono::minutes(minutes);
+        } else {
+            return Error() << "critical: Argument '" << *it << "' is not supported";
+        }
+    }
+
+    if (fatal_reboot_target) {
+        service_->fatal_reboot_target_ = *fatal_reboot_target;
+    }
+    if (fatal_crash_window) {
+        service_->fatal_crash_window_ = *fatal_crash_window;
+    }
     service_->flags_ |= SVC_CRITICAL;
     return {};
 }
@@ -506,7 +539,7 @@
         {"capabilities",            {0,     kMax, &ServiceParser::ParseCapabilities}},
         {"class",                   {1,     kMax, &ServiceParser::ParseClass}},
         {"console",                 {0,     1,    &ServiceParser::ParseConsole}},
-        {"critical",                {0,     0,    &ServiceParser::ParseCritical}},
+        {"critical",                {0,     2,    &ServiceParser::ParseCritical}},
         {"disabled",                {0,     0,    &ServiceParser::ParseDisabled}},
         {"enter_namespace",         {2,     2,    &ServiceParser::ParseEnterNamespace}},
         {"file",                    {2,     2,    &ServiceParser::ParseFile}},
@@ -624,6 +657,14 @@
                            << "' with a config in APEX";
         }
 
+        std::string context = service_->subcontext() ? service_->subcontext()->context() : "";
+        std::string old_context =
+                old_service->subcontext() ? old_service->subcontext()->context() : "";
+        if (context != old_context) {
+            return Error() << "service '" << service_->name() << "' overrides another service "
+                           << "across the treble boundary.";
+        }
+
         service_list_->RemoveService(*old_service);
         old_service = nullptr;
     }
diff --git a/init/service_utils.cpp b/init/service_utils.cpp
index 484c2c8..f2383d7 100644
--- a/init/service_utils.cpp
+++ b/init/service_utils.cpp
@@ -60,13 +60,14 @@
 Result<void> SetUpMountNamespace(bool remount_proc, bool remount_sys) {
     constexpr unsigned int kSafeFlags = MS_NODEV | MS_NOEXEC | MS_NOSUID;
 
-    // Recursively remount / as slave like zygote does so unmounting and mounting /proc
-    // doesn't interfere with the parent namespace's /proc mount. This will also
-    // prevent any other mounts/unmounts initiated by the service from interfering
-    // with the parent namespace but will still allow mount events from the parent
+    // Recursively remount / as MS_SLAVE like zygote does so that
+    // unmounting and mounting /proc doesn't interfere with the parent
+    // namespace's /proc mount. This will also prevent any other
+    // mounts/unmounts initiated by the service from interfering with the
+    // parent namespace but will still allow mount events from the parent
     // namespace to propagate to the child.
     if (mount("rootfs", "/", nullptr, (MS_SLAVE | MS_REC), nullptr) == -1) {
-        return ErrnoError() << "Could not remount(/) recursively as slave";
+        return ErrnoError() << "Could not remount(/) recursively as MS_SLAVE";
     }
 
     // umount() then mount() /proc and/or /sys
@@ -194,7 +195,8 @@
     return Descriptor(ANDROID_FILE_ENV_PREFIX + name, std::move(fd));
 }
 
-Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name, bool pre_apexd) {
+Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name,
+                             std::optional<MountNamespace> override_mount_namespace) {
     for (const auto& [nstype, path] : info.namespaces_to_enter) {
         if (auto result = EnterNamespace(nstype, path.c_str()); !result.ok()) {
             return result;
@@ -202,9 +204,10 @@
     }
 
 #if defined(__ANDROID__)
-    if (pre_apexd) {
-        if (!SwitchToBootstrapMountNamespaceIfNeeded()) {
-            return Error() << "could not enter into the bootstrap mount namespace";
+    if (override_mount_namespace.has_value()) {
+        if (auto result = SwitchToMountNamespaceIfNeeded(override_mount_namespace.value());
+            !result.ok()) {
+            return result;
         }
     }
 #endif
diff --git a/init/service_utils.h b/init/service_utils.h
index 3f1071e..1e0b4bd 100644
--- a/init/service_utils.h
+++ b/init/service_utils.h
@@ -19,12 +19,14 @@
 #include <sys/resource.h>
 #include <sys/types.h>
 
+#include <optional>
 #include <string>
 #include <vector>
 
 #include <android-base/unique_fd.h>
 #include <cutils/iosched_policy.h>
 
+#include "mount_namespace.h"
 #include "result.h"
 
 namespace android {
@@ -35,6 +37,8 @@
     Descriptor(const std::string& name, android::base::unique_fd fd)
         : name_(name), fd_(std::move(fd)){};
 
+    // Publish() unsets FD_CLOEXEC from the FD and publishes its name via setenv().  It should be
+    // called when starting a service after fork() and before exec().
     void Publish() const;
 
   private:
@@ -51,6 +55,9 @@
     std::string context;
     bool passcred = false;
 
+    // Create() creates the named unix domain socket in /dev/socket and returns a Descriptor object.
+    // It should be called when starting a service, before calling fork(), such that the socket is
+    // synchronously created before starting any other services, which may depend on it.
     Result<Descriptor> Create(const std::string& global_context) const;
 };
 
@@ -66,7 +73,8 @@
     // Pair of namespace type, path to name.
     std::vector<std::pair<int, std::string>> namespaces_to_enter;
 };
-Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name, bool pre_apexd);
+Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name,
+                             std::optional<MountNamespace> override_mount_namespace);
 
 struct ProcessAttributes {
     std::string console;
diff --git a/init/snapuserd_transition.cpp b/init/snapuserd_transition.cpp
new file mode 100644
index 0000000..19b5c57
--- /dev/null
+++ b/init/snapuserd_transition.cpp
@@ -0,0 +1,305 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "snapuserd_transition.h"
+
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/syscall.h>
+#include <sys/xattr.h>
+#include <unistd.h>
+
+#include <filesystem>
+#include <string>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/parseint.h>
+#include <android-base/strings.h>
+#include <android-base/unique_fd.h>
+#include <cutils/sockets.h>
+#include <libsnapshot/snapshot.h>
+#include <libsnapshot/snapuserd_client.h>
+#include <private/android_filesystem_config.h>
+#include <selinux/android.h>
+
+#include "block_dev_initializer.h"
+#include "service_utils.h"
+#include "util.h"
+
+namespace android {
+namespace init {
+
+using namespace std::string_literals;
+
+using android::base::unique_fd;
+using android::snapshot::SnapshotManager;
+using android::snapshot::SnapuserdClient;
+
+static constexpr char kSnapuserdPath[] = "/system/bin/snapuserd";
+static constexpr char kSnapuserdFirstStagePidVar[] = "FIRST_STAGE_SNAPUSERD_PID";
+static constexpr char kSnapuserdFirstStageFdVar[] = "FIRST_STAGE_SNAPUSERD_FD";
+static constexpr char kSnapuserdLabel[] = "u:object_r:snapuserd_exec:s0";
+static constexpr char kSnapuserdSocketLabel[] = "u:object_r:snapuserd_socket:s0";
+
+void LaunchFirstStageSnapuserd() {
+    SocketDescriptor socket_desc;
+    socket_desc.name = android::snapshot::kSnapuserdSocket;
+    socket_desc.type = SOCK_STREAM;
+    socket_desc.perm = 0660;
+    socket_desc.uid = AID_SYSTEM;
+    socket_desc.gid = AID_SYSTEM;
+
+    // We specify a label here even though it technically is not needed. During
+    // first_stage_mount there is no sepolicy loaded. Once sepolicy is loaded,
+    // we bypass the socket entirely.
+    auto socket = socket_desc.Create(kSnapuserdSocketLabel);
+    if (!socket.ok()) {
+        LOG(FATAL) << "Could not create snapuserd socket: " << socket.error();
+    }
+
+    pid_t pid = fork();
+    if (pid < 0) {
+        PLOG(FATAL) << "Cannot launch snapuserd; fork failed";
+    }
+    if (pid == 0) {
+        socket->Publish();
+        char arg0[] = "/system/bin/snapuserd";
+        char* const argv[] = {arg0, nullptr};
+        if (execv(arg0, argv) < 0) {
+            PLOG(FATAL) << "Cannot launch snapuserd; execv failed";
+        }
+        _exit(127);
+    }
+
+    setenv(kSnapuserdFirstStagePidVar, std::to_string(pid).c_str(), 1);
+
+    LOG(INFO) << "Relaunched snapuserd with pid: " << pid;
+}
+
+std::optional<pid_t> GetSnapuserdFirstStagePid() {
+    const char* pid_str = getenv(kSnapuserdFirstStagePidVar);
+    if (!pid_str) {
+        return {};
+    }
+
+    int pid = 0;
+    if (!android::base::ParseInt(pid_str, &pid)) {
+        LOG(FATAL) << "Could not parse pid in environment, " << kSnapuserdFirstStagePidVar << "="
+                   << pid_str;
+    }
+    return {pid};
+}
+
+static void RelabelLink(const std::string& link) {
+    selinux_android_restorecon(link.c_str(), 0);
+
+    std::string path;
+    if (android::base::Readlink(link, &path)) {
+        selinux_android_restorecon(path.c_str(), 0);
+    }
+}
+
+static void RelabelDeviceMapper() {
+    selinux_android_restorecon("/dev/device-mapper", 0);
+
+    std::error_code ec;
+    for (auto& iter : std::filesystem::directory_iterator("/dev/block", ec)) {
+        const auto& path = iter.path();
+        if (android::base::StartsWith(path.string(), "/dev/block/dm-")) {
+            selinux_android_restorecon(path.string().c_str(), 0);
+        }
+    }
+}
+
+static std::optional<int> GetRamdiskSnapuserdFd() {
+    const char* fd_str = getenv(kSnapuserdFirstStageFdVar);
+    if (!fd_str) {
+        return {};
+    }
+
+    int fd;
+    if (!android::base::ParseInt(fd_str, &fd)) {
+        LOG(FATAL) << "Could not parse fd in environment, " << kSnapuserdFirstStageFdVar << "="
+                   << fd_str;
+    }
+    return {fd};
+}
+
+void RestoreconRamdiskSnapuserd(int fd) {
+    if (fsetxattr(fd, XATTR_NAME_SELINUX, kSnapuserdLabel, strlen(kSnapuserdLabel) + 1, 0) < 0) {
+        PLOG(FATAL) << "fsetxattr snapuserd failed";
+    }
+}
+
+SnapuserdSelinuxHelper::SnapuserdSelinuxHelper(std::unique_ptr<SnapshotManager>&& sm, pid_t old_pid)
+    : sm_(std::move(sm)), old_pid_(old_pid) {
+    // Only dm-user device names change during transitions, so the other
+    // devices are expected to be present.
+    sm_->SetUeventRegenCallback([this](const std::string& device) -> bool {
+        if (android::base::StartsWith(device, "/dev/dm-user/")) {
+            return block_dev_init_.InitDmUser(android::base::Basename(device));
+        }
+        return true;
+    });
+}
+
+void SnapuserdSelinuxHelper::StartTransition() {
+    LOG(INFO) << "Starting SELinux transition of snapuserd";
+
+    // The restorecon path reads from /system etc, so make sure any reads have
+    // been cached before proceeding.
+    auto handle = selinux_android_file_context_handle();
+    if (!handle) {
+        LOG(FATAL) << "Could not create SELinux file context handle";
+    }
+    selinux_android_set_sehandle(handle);
+
+    // We cannot access /system after the transition, so make sure init is
+    // pinned in memory.
+    if (mlockall(MCL_CURRENT) < 0) {
+        LOG(FATAL) << "mlockall failed";
+    }
+
+    argv_.emplace_back("snapuserd");
+    argv_.emplace_back("-no_socket");
+    if (!sm_->DetachSnapuserdForSelinux(&argv_)) {
+        LOG(FATAL) << "Could not perform selinux transition";
+    }
+
+    // Make sure the process is gone so we don't have any selinux audits.
+    KillFirstStageSnapuserd(old_pid_);
+}
+
+void SnapuserdSelinuxHelper::FinishTransition() {
+    RelabelLink("/dev/block/by-name/super");
+    RelabelDeviceMapper();
+
+    selinux_android_restorecon("/dev/null", 0);
+    selinux_android_restorecon("/dev/urandom", 0);
+    selinux_android_restorecon("/dev/kmsg", 0);
+    selinux_android_restorecon("/dev/dm-user", SELINUX_ANDROID_RESTORECON_RECURSE);
+
+    RelaunchFirstStageSnapuserd();
+
+    if (munlockall() < 0) {
+        PLOG(ERROR) << "munlockall failed";
+    }
+}
+
+void SnapuserdSelinuxHelper::RelaunchFirstStageSnapuserd() {
+    auto fd = GetRamdiskSnapuserdFd();
+    if (!fd) {
+        LOG(FATAL) << "Environment variable " << kSnapuserdFirstStageFdVar << " was not set!";
+    }
+    unsetenv(kSnapuserdFirstStageFdVar);
+
+    RestoreconRamdiskSnapuserd(fd.value());
+
+    pid_t pid = fork();
+    if (pid < 0) {
+        PLOG(FATAL) << "Fork to relaunch snapuserd failed";
+    }
+    if (pid > 0) {
+        // We don't need the descriptor anymore, and it should be closed to
+        // avoid leaking into subprocesses.
+        close(fd.value());
+
+        setenv(kSnapuserdFirstStagePidVar, std::to_string(pid).c_str(), 1);
+
+        LOG(INFO) << "Relaunched snapuserd with pid: " << pid;
+        return;
+    }
+
+    // Make sure the descriptor is gone after we exec.
+    if (fcntl(fd.value(), F_SETFD, FD_CLOEXEC) < 0) {
+        PLOG(FATAL) << "fcntl FD_CLOEXEC failed for snapuserd fd";
+    }
+
+    std::vector<char*> argv;
+    for (auto& arg : argv_) {
+        argv.emplace_back(arg.data());
+    }
+    argv.emplace_back(nullptr);
+
+    int rv = syscall(SYS_execveat, fd.value(), "", reinterpret_cast<char* const*>(argv.data()),
+                     nullptr, AT_EMPTY_PATH);
+    if (rv < 0) {
+        PLOG(FATAL) << "Failed to execveat() snapuserd";
+    }
+}
+
+std::unique_ptr<SnapuserdSelinuxHelper> SnapuserdSelinuxHelper::CreateIfNeeded() {
+    if (IsRecoveryMode()) {
+        return nullptr;
+    }
+
+    auto old_pid = GetSnapuserdFirstStagePid();
+    if (!old_pid) {
+        return nullptr;
+    }
+
+    auto sm = SnapshotManager::NewForFirstStageMount();
+    if (!sm) {
+        LOG(FATAL) << "Unable to create SnapshotManager";
+    }
+    return std::make_unique<SnapuserdSelinuxHelper>(std::move(sm), old_pid.value());
+}
+
+void KillFirstStageSnapuserd(pid_t pid) {
+    if (kill(pid, SIGTERM) < 0 && errno != ESRCH) {
+        LOG(ERROR) << "Kill snapuserd pid failed: " << pid;
+    } else {
+        LOG(INFO) << "Sent SIGTERM to snapuserd process " << pid;
+    }
+}
+
+void CleanupSnapuserdSocket() {
+    auto socket_path = ANDROID_SOCKET_DIR "/"s + android::snapshot::kSnapuserdSocket;
+    if (access(socket_path.c_str(), F_OK) != 0) {
+        return;
+    }
+
+    // Tell the daemon to stop accepting connections and to gracefully exit
+    // once all outstanding handlers have terminated.
+    if (auto client = SnapuserdClient::Connect(android::snapshot::kSnapuserdSocket, 3s)) {
+        client->DetachSnapuserd();
+    }
+
+    // Unlink the socket so we can create it again in second-stage.
+    if (unlink(socket_path.c_str()) < 0) {
+        PLOG(FATAL) << "unlink " << socket_path << " failed";
+    }
+}
+
+void SaveRamdiskPathToSnapuserd() {
+    int fd = open(kSnapuserdPath, O_PATH);
+    if (fd < 0) {
+        PLOG(FATAL) << "Unable to open snapuserd: " << kSnapuserdPath;
+    }
+
+    auto value = std::to_string(fd);
+    if (setenv(kSnapuserdFirstStageFdVar, value.c_str(), 1) < 0) {
+        PLOG(FATAL) << "setenv failed: " << kSnapuserdFirstStageFdVar << "=" << value;
+    }
+}
+
+bool IsFirstStageSnapuserdRunning() {
+    return GetSnapuserdFirstStagePid().has_value();
+}
+
+}  // namespace init
+}  // namespace android
diff --git a/init/snapuserd_transition.h b/init/snapuserd_transition.h
new file mode 100644
index 0000000..a5ab652
--- /dev/null
+++ b/init/snapuserd_transition.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <sys/types.h>
+
+#include <optional>
+#include <string>
+#include <vector>
+
+#include <libsnapshot/snapshot.h>
+
+#include "block_dev_initializer.h"
+
+namespace android {
+namespace init {
+
+// Fork and exec a new copy of snapuserd.
+void LaunchFirstStageSnapuserd();
+
+class SnapuserdSelinuxHelper final {
+    using SnapshotManager = android::snapshot::SnapshotManager;
+
+  public:
+    SnapuserdSelinuxHelper(std::unique_ptr<SnapshotManager>&& sm, pid_t old_pid);
+
+    void StartTransition();
+    void FinishTransition();
+
+    // Return a helper for facilitating the selinux transition of snapuserd.
+    // If snapuserd is not in use, null is returned. StartTransition() should
+    // be called after reading policy. FinishTransition() should be called
+    // after loading policy. In between, no reads of /system or other dynamic
+    // partitions are possible.
+    static std::unique_ptr<SnapuserdSelinuxHelper> CreateIfNeeded();
+
+  private:
+    void RelaunchFirstStageSnapuserd();
+    void ExecSnapuserd();
+
+    std::unique_ptr<SnapshotManager> sm_;
+    BlockDevInitializer block_dev_init_;
+    pid_t old_pid_;
+    std::vector<std::string> argv_;
+};
+
+// Remove /dev/socket/snapuserd. This ensures that (1) the existing snapuserd
+// will receive no new requests, and (2) the next copy we transition to can
+// own the socket.
+void CleanupSnapuserdSocket();
+
+// Kill an instance of snapuserd given a pid.
+void KillFirstStageSnapuserd(pid_t pid);
+
+// Save an open fd to /system/bin (in the ramdisk) into an environment. This is
+// used to later execveat() snapuserd.
+void SaveRamdiskPathToSnapuserd();
+
+// Returns true if first-stage snapuserd is running.
+bool IsFirstStageSnapuserdRunning();
+
+// Return the pid of the first-stage instances of snapuserd, if it was started.
+std::optional<pid_t> GetSnapuserdFirstStagePid();
+
+// Save an open fd to /system/bin (in the ramdisk) into an environment. This is
+// used to later execveat() snapuserd.
+void SaveRamdiskPathToSnapuserd();
+
+// Returns true if first-stage snapuserd is running.
+bool IsFirstStageSnapuserdRunning();
+
+}  // namespace init
+}  // namespace android
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index f3dd538..f1fbffe 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -18,6 +18,8 @@
 
 #include <fcntl.h>
 #include <poll.h>
+#include <sys/time.h>
+#include <sys/resource.h>
 #include <unistd.h>
 
 #include <android-base/file.h>
@@ -28,6 +30,7 @@
 
 #include "action.h"
 #include "builtins.h"
+#include "mount_namespace.h"
 #include "proto_utils.h"
 #include "util.h"
 
@@ -181,6 +184,8 @@
     trigger_shutdown = [](const std::string& command) { shutdown_command = command; };
 
     auto subcontext_process = SubcontextProcess(function_map, context, init_fd);
+    // Restore prio before main loop
+    setpriority(PRIO_PROCESS, 0, 0);
     subcontext_process.MainLoop();
     return 0;
 }
@@ -213,7 +218,13 @@
                 PLOG(FATAL) << "Could not set execcon for '" << context_ << "'";
             }
         }
-
+#if defined(__ANDROID__)
+        // subcontext init runs in "default" mount namespace
+        // so that it can access /apex/*
+        if (auto result = SwitchToMountNamespaceIfNeeded(NS_DEFAULT); !result.ok()) {
+            LOG(FATAL) << "Could not switch to \"default\" mount namespace: " << result.error();
+        }
+#endif
         auto init_path = GetExecutablePath();
         auto child_fd_string = std::to_string(child_fd);
         const char* args[] = {init_path.c_str(), "subcontext", context_.c_str(),
@@ -331,6 +342,9 @@
                 new Subcontext(std::vector<std::string>{"/vendor", "/odm"}, kVendorContext));
     }
 }
+void InitializeHostSubcontext(std::vector<std::string> vendor_prefixes) {
+    subcontext.reset(new Subcontext(vendor_prefixes, kVendorContext, /*host=*/true));
+}
 
 Subcontext* GetSubcontext() {
     return subcontext.get();
diff --git a/init/subcontext.h b/init/subcontext.h
index 788d3be..cb4138e 100644
--- a/init/subcontext.h
+++ b/init/subcontext.h
@@ -36,9 +36,11 @@
 
 class Subcontext {
   public:
-    Subcontext(std::vector<std::string> path_prefixes, std::string context)
+    Subcontext(std::vector<std::string> path_prefixes, std::string context, bool host = false)
         : path_prefixes_(std::move(path_prefixes)), context_(std::move(context)), pid_(0) {
-        Fork();
+        if (!host) {
+            Fork();
+        }
     }
 
     Result<void> Execute(const std::vector<std::string>& args);
@@ -61,6 +63,7 @@
 
 int SubcontextMain(int argc, char** argv, const BuiltinFunctionMap* function_map);
 void InitializeSubcontext();
+void InitializeHostSubcontext(std::vector<std::string> vendor_prefixes);
 Subcontext* GetSubcontext();
 bool SubcontextChildReap(pid_t pid);
 void SubcontextTerminate();
diff --git a/init/subcontext_test.cpp b/init/subcontext_test.cpp
index ee765a7..da1f455 100644
--- a/init/subcontext_test.cpp
+++ b/init/subcontext_test.cpp
@@ -202,6 +202,8 @@
 
     // For RecoverAfterAbort
     auto do_cause_log_fatal = [](const BuiltinArguments& args) -> Result<void> {
+        // Since this is an expected failure, disable debuggerd to not generate a tombstone.
+        signal(SIGABRT, SIG_DFL);
         return Error() << std::string(4097, 'f');
     };
     auto do_generate_sane_error = [](const BuiltinArguments& args) -> Result<void> {
diff --git a/init/sysprop/api/com.android.sysprop.init-latest.txt b/init/sysprop/api/com.android.sysprop.init-latest.txt
index c835b95..01f4e9a 100644
--- a/init/sysprop/api/com.android.sysprop.init-latest.txt
+++ b/init/sysprop/api/com.android.sysprop.init-latest.txt
@@ -1,8 +1,13 @@
 props {
   module: "android.sysprop.InitProperties"
   prop {
+    api_name: "is_userspace_reboot_supported"
+    prop_name: "init.userspace_reboot.is_supported"
+    integer_as_bool: true
+  }
+  prop {
     api_name: "userspace_reboot_in_progress"
-    scope: Public
+    access: ReadWrite
     prop_name: "sys.init.userspace_reboot.in_progress"
     integer_as_bool: true
   }
diff --git a/init/test_kill_services/Android.bp b/init/test_kill_services/Android.bp
new file mode 100644
index 0000000..d59e548
--- /dev/null
+++ b/init/test_kill_services/Android.bp
@@ -0,0 +1,11 @@
+cc_test {
+    name: "init_kill_services_test",
+    srcs: ["init_kill_services_test.cpp"],
+    shared_libs: ["libbase"],
+    test_suites: ["general-tests"],
+
+    // TODO(b/153565474): switch back to auto-generation
+    // and add back:
+    //     require_root: true,
+    auto_gen_config: false,
+}
diff --git a/init/test_kill_services/AndroidTest.xml b/init/test_kill_services/AndroidTest.xml
new file mode 100644
index 0000000..8018efa
--- /dev/null
+++ b/init/test_kill_services/AndroidTest.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+<configuration description="Runs init_kill_services_test.">
+    <option name="test-suite-tag" value="apct" />
+    <option name="test-suite-tag" value="apct-native" />
+
+    <!-- cannot be autogenerated: b/153565474 -->
+    <target_preparer class="com.android.tradefed.targetprep.RebootTargetPreparer">
+        <!-- flake mitigation, in case device is in bad state-->
+        <option name="pre-reboot" value="true" />
+        <!-- sometimes device gets into bad state, and we don't detect it in this test,
+          so the test succeeds and the next test fails. This is a really bad result, so
+          to avoid that, making sure we reboot the device again before running any more
+          tests.
+          TODO(b/152556737): add metrics for successful device recovery -->
+        <option name="post-reboot" value="true" />
+    </target_preparer>
+
+    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
+
+    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+        <option name="cleanup" value="true" />
+        <option name="push" value="init_kill_services_test->/data/local/tmp/init_kill_services_test" />
+    </target_preparer>
+
+    <test class="com.android.tradefed.testtype.GTest" >
+        <option name="native-test-device-path" value="/data/local/tmp" />
+        <option name="module-name" value="init_kill_services_test" />
+    </test>
+</configuration>
diff --git a/init/test_kill_services/init_kill_services_test.cpp b/init/test_kill_services/init_kill_services_test.cpp
new file mode 100644
index 0000000..66a3328
--- /dev/null
+++ b/init/test_kill_services/init_kill_services_test.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <gtest/gtest.h>
+
+#include <android-base/properties.h>
+
+#include <iostream>
+
+using ::android::base::GetProperty;
+using ::android::base::SetProperty;
+
+void ExpectKillingServiceRecovers(const std::string& service_name) {
+    const std::string status_prop = "init.svc." + service_name;
+    const std::string pid_prop = "init.svc_debug_pid." + service_name;
+
+    const std::string initial_pid = GetProperty(pid_prop, "");
+
+    EXPECT_EQ("running", GetProperty(status_prop, "")) << status_prop;
+    EXPECT_NE("", initial_pid) << pid_prop;
+
+    EXPECT_EQ(0, system(("kill -9 " + initial_pid).c_str()));
+
+    constexpr size_t kMaxWaitMilliseconds = 10000;
+    constexpr size_t kRetryWaitMilliseconds = 100;
+
+    constexpr size_t kRetryTimes = kMaxWaitMilliseconds / kRetryWaitMilliseconds;
+
+    for (size_t retry = 0; retry < kRetryTimes; retry++) {
+        const std::string& pid = GetProperty(pid_prop, "");
+        if (pid != initial_pid && pid != "") break;
+        usleep(kRetryWaitMilliseconds * 1000);
+    }
+
+    // svc_debug_pid is set after svc property
+    EXPECT_EQ("running", GetProperty(status_prop, ""));
+}
+
+class InitKillServicesTest : public ::testing::TestWithParam<std::string> {};
+
+TEST_P(InitKillServicesTest, KillCriticalProcesses) {
+    ExpectKillingServiceRecovers(GetParam());
+
+    // Ensure that init is still responding
+    EXPECT_TRUE(SetProperty("test.death.test", "asdf"));
+    EXPECT_EQ(GetProperty("test.death.test", ""), "asdf");
+    EXPECT_TRUE(SetProperty("test.death.test", ""));
+}
+
+static inline std::string PrintName(const testing::TestParamInfo<std::string>& info) {
+    return info.param;
+}
+
+INSTANTIATE_TEST_CASE_P(DeathTest, InitKillServicesTest,
+                        ::testing::Values("lmkd", "ueventd", "hwservicemanager", "servicemanager"),
+                        PrintName);
diff --git a/init/tokenizer_test.cpp b/init/tokenizer_test.cpp
index 6b31683..0122884 100644
--- a/init/tokenizer_test.cpp
+++ b/init/tokenizer_test.cpp
@@ -28,7 +28,7 @@
 
 void RunTest(const std::string& data, const std::vector<std::vector<std::string>>& expected_tokens) {
     auto data_copy = std::string{data};
-    data_copy.push_back('\n');  // TODO: fix tokenizer
+    data_copy.push_back('\n');
     data_copy.push_back('\0');
 
     parse_state state;
diff --git a/init/ueventd.cpp b/init/ueventd.cpp
index d2b503b..331255b 100644
--- a/init/ueventd.cpp
+++ b/init/ueventd.cpp
@@ -16,6 +16,7 @@
 
 #include "ueventd.h"
 
+#include <android/api-level.h>
 #include <ctype.h>
 #include <dirent.h>
 #include <fcntl.h>
@@ -266,6 +267,17 @@
     LOG(INFO) << "Coldboot took " << cold_boot_timer.duration().count() / 1000.0f << " seconds";
 }
 
+static UeventdConfiguration GetConfiguration() {
+    // TODO: Remove these legacy paths once Android S is no longer supported.
+    if (android::base::GetIntProperty("ro.product.first_api_level", 10000) <= __ANDROID_API_S__) {
+        auto hardware = android::base::GetProperty("ro.hardware", "");
+        return ParseConfig({"/system/etc/ueventd.rc", "/vendor/ueventd.rc", "/odm/ueventd.rc",
+                            "/ueventd." + hardware + ".rc"});
+    }
+
+    return ParseConfig({"/system/etc/ueventd.rc"});
+}
+
 int ueventd_main(int argc, char** argv) {
     /*
      * init sets the umask to 077 for forked processes. We need to
@@ -283,13 +295,7 @@
 
     std::vector<std::unique_ptr<UeventHandler>> uevent_handlers;
 
-    // Keep the current product name base configuration so we remain backwards compatible and
-    // allow it to override everything.
-    // TODO: cleanup platform ueventd.rc to remove vendor specific device node entries (b/34968103)
-    auto hardware = android::base::GetProperty("ro.hardware", "");
-
-    auto ueventd_configuration = ParseConfig({"/system/etc/ueventd.rc", "/vendor/ueventd.rc",
-                                              "/odm/ueventd.rc", "/ueventd." + hardware + ".rc"});
+    auto ueventd_configuration = GetConfiguration();
 
     uevent_handlers.emplace_back(std::make_unique<DeviceHandler>(
             std::move(ueventd_configuration.dev_permissions),
@@ -322,6 +328,8 @@
     while (waitpid(-1, nullptr, WNOHANG) > 0) {
     }
 
+    // Restore prio before main loop
+    setpriority(PRIO_PROCESS, 0, 0);
     uevent_listener.Poll([&uevent_handlers](const Uevent& uevent) {
         for (auto& uevent_handler : uevent_handlers) {
             uevent_handler->HandleUevent(uevent);
diff --git a/init/ueventd_parser.cpp b/init/ueventd_parser.cpp
index 09dce44..cab988b 100644
--- a/init/ueventd_parser.cpp
+++ b/init/ueventd_parser.cpp
@@ -21,6 +21,7 @@
 
 #include <android-base/parseint.h>
 
+#include "import_parser.h"
 #include "keyword_map.h"
 #include "parser.h"
 
@@ -33,12 +34,12 @@
                                   std::vector<SysfsPermissions>* out_sysfs_permissions,
                                   std::vector<Permissions>* out_dev_permissions) {
     bool is_sysfs = out_sysfs_permissions != nullptr;
-    if (is_sysfs && args.size() != 5) {
-        return Error() << "/sys/ lines must have 5 entries";
+    if (is_sysfs && !(args.size() == 5 || args.size() == 6)) {
+        return Error() << "/sys/ lines must have 5 or 6 entries";
     }
 
-    if (!is_sysfs && args.size() != 4) {
-        return Error() << "/dev/ lines must have 4 entries";
+    if (!is_sysfs && !(args.size() == 4 || args.size() == 5)) {
+        return Error() << "/dev/ lines must have 4 or 5 entries";
     }
 
     auto it = args.begin();
@@ -69,10 +70,19 @@
     }
     gid_t gid = grp->gr_gid;
 
+    bool no_fnm_pathname = false;
+    if (it != args.end()) {
+        std::string& flags = *it++;
+        if (flags != "no_fnm_pathname") {
+            return Error() << "invalid option '" << flags << "', only no_fnm_pathname is supported";
+        }
+        no_fnm_pathname = true;
+    }
+
     if (is_sysfs) {
-        out_sysfs_permissions->emplace_back(name, sysfs_attribute, perm, uid, gid);
+        out_sysfs_permissions->emplace_back(name, sysfs_attribute, perm, uid, gid, no_fnm_pathname);
     } else {
-        out_dev_permissions->emplace_back(name, perm, uid, gid);
+        out_dev_permissions->emplace_back(name, perm, uid, gid, no_fnm_pathname);
     }
     return {};
 }
@@ -224,6 +234,7 @@
     Parser parser;
     UeventdConfiguration ueventd_configuration;
 
+    parser.AddSectionParser("import", std::make_unique<ImportParser>(&parser));
     parser.AddSectionParser("subsystem",
                             std::make_unique<SubsystemParser>(&ueventd_configuration.subsystems));
 
diff --git a/init/ueventd_parser_test.cpp b/init/ueventd_parser_test.cpp
index 172ba0b..b604c53 100644
--- a/init/ueventd_parser_test.cpp
+++ b/init/ueventd_parser_test.cpp
@@ -104,21 +104,21 @@
 /dev/graphics/*           0660   root       graphics
 /dev/*/test               0660   root       system
 
-/sys/devices/platform/trusty.*      trusty_version        0440  root   log
-/sys/devices/virtual/input/input   enable      0660  root   input
-/sys/devices/virtual/*/input   poll_delay  0660  root   input
+/sys/devices/platform/trusty.*      trusty_version    0440  root   log
+/sys/devices/virtual/input/input    enable            0660  root   input
+/sys/devices/virtual/*/input        poll_delay        0660  root   input    no_fnm_pathname
 )";
 
     auto permissions = std::vector<Permissions>{
-            {"/dev/rtc0", 0640, AID_SYSTEM, AID_SYSTEM},
-            {"/dev/graphics/*", 0660, AID_ROOT, AID_GRAPHICS},
-            {"/dev/*/test", 0660, AID_ROOT, AID_SYSTEM},
+            {"/dev/rtc0", 0640, AID_SYSTEM, AID_SYSTEM, false},
+            {"/dev/graphics/*", 0660, AID_ROOT, AID_GRAPHICS, false},
+            {"/dev/*/test", 0660, AID_ROOT, AID_SYSTEM, false},
     };
 
     auto sysfs_permissions = std::vector<SysfsPermissions>{
-            {"/sys/devices/platform/trusty.*", "trusty_version", 0440, AID_ROOT, AID_LOG},
-            {"/sys/devices/virtual/input/input", "enable", 0660, AID_ROOT, AID_INPUT},
-            {"/sys/devices/virtual/*/input", "poll_delay", 0660, AID_ROOT, AID_INPUT},
+            {"/sys/devices/platform/trusty.*", "trusty_version", 0440, AID_ROOT, AID_LOG, false},
+            {"/sys/devices/virtual/input/input", "enable", 0660, AID_ROOT, AID_INPUT, false},
+            {"/sys/devices/virtual/*/input", "poll_delay", 0660, AID_ROOT, AID_INPUT, true},
     };
 
     TestUeventdFile(ueventd_file, {{}, sysfs_permissions, permissions, {}, {}});
@@ -240,7 +240,7 @@
     dirname /dev/graphics
 
 /dev/*/test               0660   root       system
-/sys/devices/virtual/*/input   poll_delay  0660  root   input
+/sys/devices/virtual/*/input   poll_delay  0660  root   input    no_fnm_pathname
 firmware_directories /more
 
 external_firmware_handler /devices/path/firmware/firmware001.bin root /vendor/bin/touch.sh
@@ -259,15 +259,15 @@
             {"test_devpath_dirname", Subsystem::DEVNAME_UEVENT_DEVPATH, "/dev/graphics"}};
 
     auto permissions = std::vector<Permissions>{
-            {"/dev/rtc0", 0640, AID_SYSTEM, AID_SYSTEM},
-            {"/dev/graphics/*", 0660, AID_ROOT, AID_GRAPHICS},
-            {"/dev/*/test", 0660, AID_ROOT, AID_SYSTEM},
+            {"/dev/rtc0", 0640, AID_SYSTEM, AID_SYSTEM, false},
+            {"/dev/graphics/*", 0660, AID_ROOT, AID_GRAPHICS, false},
+            {"/dev/*/test", 0660, AID_ROOT, AID_SYSTEM, false},
     };
 
     auto sysfs_permissions = std::vector<SysfsPermissions>{
-            {"/sys/devices/platform/trusty.*", "trusty_version", 0440, AID_ROOT, AID_LOG},
-            {"/sys/devices/virtual/input/input", "enable", 0660, AID_ROOT, AID_INPUT},
-            {"/sys/devices/virtual/*/input", "poll_delay", 0660, AID_ROOT, AID_INPUT},
+            {"/sys/devices/platform/trusty.*", "trusty_version", 0440, AID_ROOT, AID_LOG, false},
+            {"/sys/devices/virtual/input/input", "enable", 0660, AID_ROOT, AID_INPUT, false},
+            {"/sys/devices/virtual/*/input", "poll_delay", 0660, AID_ROOT, AID_INPUT, true},
     };
 
     auto firmware_directories = std::vector<std::string>{
@@ -299,6 +299,7 @@
 /sys/devices/platform/trusty.*      trusty_version        badmode  root   log
 /sys/devices/platform/trusty.*      trusty_version        0440  baduidbad   log
 /sys/devices/platform/trusty.*      trusty_version        0440  root   baduidbad
+/sys/devices/platform/trusty.*      trusty_version        0440  root   root    bad_option
 
 uevent_socket_rcvbuf_size blah
 
diff --git a/init/ueventd_test.cpp b/init/ueventd_test.cpp
index 2d7d2f8..fc3cdfb 100644
--- a/init/ueventd_test.cpp
+++ b/init/ueventd_test.cpp
@@ -53,11 +53,7 @@
     };
 
     std::vector<std::thread> threads;
-    // TODO(b/63712782): Structured bindings + templated containers are broken in clang :(
-    // for (const auto& [file, parameter] : files_and_parameters) {
-    for (const auto& pair : files_and_parameters) {
-        const auto& file = pair.first;
-        const auto& parameter = pair.second;
+    for (const auto& [file, parameter] : files_and_parameters) {
         threads.emplace_back(std::thread(make_thread_function(file, parameter)));
     }
 
diff --git a/init/util_test.cpp b/init/util_test.cpp
index 08343dc..565e7d4 100644
--- a/init/util_test.cpp
+++ b/init/util_test.cpp
@@ -61,9 +61,8 @@
 
 TEST(util, ReadFileSymbolicLink) {
     errno = 0;
-    // lrwxrwxrwx 1 root shell 6 2020-06-26 09:55 /system/bin/ps -> toybox
+    // lrwxr-xr-x 1 root shell 6 2009-01-01 09:00 /system/bin/ps -> toybox
     auto file_contents = ReadFile("/system/bin/ps");
-
     EXPECT_EQ(ELOOP, errno);
     ASSERT_FALSE(file_contents.ok());
     EXPECT_EQ("open() failed: Too many symbolic links encountered",
diff --git a/libappfuse/tests/FuseAppLoopTest.cc b/libappfuse/tests/FuseAppLoopTest.cc
index 98e3665..ea98ae2 100644
--- a/libappfuse/tests/FuseAppLoopTest.cc
+++ b/libappfuse/tests/FuseAppLoopTest.cc
@@ -167,7 +167,7 @@
   EXPECT_EQ(0u, response_.entry_out.attr.gid);
   EXPECT_EQ(0u, response_.entry_out.attr.rdev);
   EXPECT_EQ(0u, response_.entry_out.attr.blksize);
-  EXPECT_EQ(0u, response_.entry_out.attr.padding);
+  EXPECT_EQ(0u, response_.entry_out.attr.flags);
 }
 
 TEST_F(FuseAppLoopTest, LookUp_InvalidName) {
@@ -226,7 +226,7 @@
   EXPECT_EQ(0u, response_.attr_out.attr.gid);
   EXPECT_EQ(0u, response_.attr_out.attr.rdev);
   EXPECT_EQ(0u, response_.attr_out.attr.blksize);
-  EXPECT_EQ(0u, response_.attr_out.attr.padding);
+  EXPECT_EQ(0u, response_.attr_out.attr.flags);
 }
 
 TEST_F(FuseAppLoopTest, GetAttr_Root) {
@@ -259,7 +259,7 @@
   EXPECT_EQ(0u, response_.attr_out.attr.gid);
   EXPECT_EQ(0u, response_.attr_out.attr.rdev);
   EXPECT_EQ(0u, response_.attr_out.attr.blksize);
-  EXPECT_EQ(0u, response_.attr_out.attr.padding);
+  EXPECT_EQ(0u, response_.attr_out.attr.flags);
 }
 
 TEST_F(FuseAppLoopTest, Open) {
diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp
deleted file mode 100644
index c9e4512..0000000
--- a/libbacktrace/Android.bp
+++ /dev/null
@@ -1,230 +0,0 @@
-//
-// Copyright (C) 2014 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.
-//
-
-cc_defaults {
-    name: "libbacktrace_common",
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-
-    target: {
-        darwin: {
-            enabled: false,
-        },
-    },
-}
-
-libbacktrace_sources = [
-    "Backtrace.cpp",
-    "BacktraceCurrent.cpp",
-    "BacktracePtrace.cpp",
-    "ThreadEntry.cpp",
-    "UnwindStack.cpp",
-    "UnwindStackMap.cpp",
-]
-
-cc_library_headers {
-    name: "libbacktrace_headers",
-    vendor_available: true,
-    recovery_available: true,
-    native_bridge_supported: true,
-    export_include_dirs: ["include"],
-    apex_available: [
-        "//apex_available:platform",
-        "//apex_available:anyapex",
-    ],
-    min_sdk_version: "apex_inherit",
-}
-
-cc_defaults {
-    name: "libbacktrace_defaults",
-    defaults: ["libbacktrace_common"],
-
-    cflags: [
-        "-Wexit-time-destructors",
-    ],
-
-    srcs: [
-        "BacktraceMap.cpp",
-    ],
-
-    export_include_dirs: ["include"],
-
-    target: {
-        darwin: {
-            enabled: true,
-            shared_libs: [
-                "libbase",
-            ],
-        },
-        linux: {
-            srcs: libbacktrace_sources,
-
-            shared_libs: [
-                "libbase",
-                "liblog",
-            ],
-
-            static_libs: [
-                "libprocinfo",
-            ],
-        },
-        android: {
-            static_libs: ["libasync_safe"],
-            static: {
-                whole_static_libs: ["libasync_safe"],
-            },
-        },
-    },
-}
-
-cc_library {
-    name: "libbacktrace",
-    vendor_available: false,
-    // TODO(b/153609531): remove when no longer needed.
-    native_bridge_supported: true,
-    recovery_available: true,
-    apex_available: [
-        "//apex_available:platform",
-        "//apex_available:anyapex",
-    ],
-    vndk: {
-        enabled: true,
-        support_system_process: true,
-    },
-    host_supported: true,
-    defaults: ["libbacktrace_defaults"],
-
-    target: {
-        linux: {
-            shared_libs: [
-                "libunwindstack",
-            ],
-        },
-        vendor: {
-            cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
-        },
-        recovery: {
-            cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
-        },
-        native_bridge: {
-            cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
-        },
-    },
-}
-
-// Static library without DEX support to avoid dependencies on the ART APEX.
-cc_library_static {
-    name: "libbacktrace_no_dex",
-    visibility: ["//system/core/debuggerd"],
-    defaults: ["libbacktrace_defaults"],
-    cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
-    target: {
-        linux: {
-            static_libs: [
-                "libunwindstack_no_dex",
-            ],
-        },
-    },
-}
-
-cc_test_library {
-    name: "libbacktrace_test",
-    defaults: ["libbacktrace_common"],
-    host_supported: true,
-    strip: {
-        none: true,
-    },
-    cflags: ["-O0"],
-    srcs: ["backtrace_testlib.cpp"],
-
-    shared_libs: [
-        "libunwindstack",
-    ],
-    relative_install_path: "backtrace_test_libs",
-
-    target: {
-        linux_glibc: {
-            // This forces the creation of eh_frame with unwind information
-            // for host.
-            cflags: [
-                "-fcxx-exceptions"
-            ],
-        },
-    },
-}
-
-//-------------------------------------------------------------------------
-// The backtrace_test executable.
-//-------------------------------------------------------------------------
-cc_test {
-    name: "backtrace_test",
-    isolated: true,
-    defaults: ["libbacktrace_common"],
-    host_supported: true,
-    srcs: [
-        "backtrace_test.cpp",
-    ],
-
-    cflags: [
-        "-fno-builtin",
-        "-O0",
-        "-g",
-    ],
-
-    shared_libs: [
-        "libbacktrace",
-        "libbase",
-        "liblog",
-        "libunwindstack",
-    ],
-
-    group_static_libs: true,
-
-    // So that the dlopen can find the libbacktrace_test.so.
-    ldflags: [
-        "-Wl,--rpath,${ORIGIN}/../backtrace_test_libs",
-    ],
-
-    test_suites: ["device-tests"],
-    data: [
-        "testdata/arm/*",
-        "testdata/arm64/*",
-        "testdata/x86/*",
-        "testdata/x86_64/*",
-    ],
-    required: [
-        "libbacktrace_test",
-    ],
-}
-
-cc_benchmark {
-    name: "backtrace_benchmarks",
-    defaults: ["libbacktrace_common"],
-
-    srcs: [
-        "backtrace_benchmarks.cpp",
-        "backtrace_read_benchmarks.cpp",
-    ],
-
-    shared_libs: [
-        "libbacktrace",
-        "libbase",
-        "libunwindstack",
-    ],
-}
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp
deleted file mode 100644
index 3e050ab..0000000
--- a/libbacktrace/Backtrace.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <ucontext.h>
-
-#include <string>
-
-#include <android-base/stringprintf.h>
-#include <android-base/threads.h>
-
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-
-#include "BacktraceLog.h"
-#include "UnwindStack.h"
-
-using android::base::StringPrintf;
-
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
-//-------------------------------------------------------------------------
-// Backtrace functions.
-//-------------------------------------------------------------------------
-Backtrace::Backtrace(pid_t pid, pid_t tid, BacktraceMap* map)
-    : pid_(pid), tid_(tid), map_(map), map_shared_(true) {
-  if (map_ == nullptr) {
-    map_ = BacktraceMap::Create(pid);
-    map_shared_ = false;
-  }
-}
-
-Backtrace::~Backtrace() {
-  if (map_ && !map_shared_) {
-    delete map_;
-    map_ = nullptr;
-  }
-}
-
-std::string Backtrace::GetFunctionName(uint64_t pc, uint64_t* offset, const backtrace_map_t* map) {
-  backtrace_map_t map_value;
-  if (map == nullptr) {
-    FillInMap(pc, &map_value);
-    map = &map_value;
-  }
-  // If no map is found, or this map is backed by a device, then return nothing.
-  if (map->start == 0 || (map->flags & PROT_DEVICE_MAP)) {
-    return "";
-  }
-  std::string name(GetFunctionNameRaw(pc, offset));
-  char* demangled_name = __cxa_demangle(name.c_str(), nullptr, nullptr, nullptr);
-  if (demangled_name != nullptr) {
-    name = demangled_name;
-    free(demangled_name);
-    return name;
-  }
-  return name;
-}
-
-bool Backtrace::VerifyReadWordArgs(uint64_t ptr, word_t* out_value) {
-  if (ptr & (sizeof(word_t)-1)) {
-    BACK_LOGW("invalid pointer %p", reinterpret_cast<void*>(ptr));
-    *out_value = static_cast<word_t>(-1);
-    return false;
-  }
-  return true;
-}
-
-std::string Backtrace::FormatFrameData(size_t frame_num) {
-  if (frame_num >= frames_.size()) {
-    return "";
-  }
-  return FormatFrameData(&frames_[frame_num]);
-}
-
-std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) {
-  std::string map_name;
-  if (BacktraceMap::IsValid(frame->map)) {
-    map_name = frame->map.Name();
-    if (!frame->map.name.empty()) {
-      if (map_name[0] == '[' && map_name[map_name.size() - 1] == ']') {
-        map_name.resize(map_name.size() - 1);
-        map_name += StringPrintf(":%" PRIPTR "]", frame->map.start);
-      }
-    }
-  } else {
-    map_name = "<unknown>";
-  }
-
-  std::string line(StringPrintf("#%02zu pc %" PRIPTR "  ", frame->num, frame->rel_pc));
-  line += map_name;
-  // Special handling for non-zero offset maps, we need to print that
-  // information.
-  if (frame->map.offset != 0) {
-    line += " (offset " + StringPrintf("0x%" PRIx64, frame->map.offset) + ")";
-  }
-  if (!frame->func_name.empty()) {
-    line += " (" + frame->func_name;
-    if (frame->func_offset) {
-      line += StringPrintf("+%" PRIu64, frame->func_offset);
-    }
-    line += ')';
-  }
-
-  return line;
-}
-
-void Backtrace::FillInMap(uint64_t pc, backtrace_map_t* map) {
-  if (map_ != nullptr) {
-    map_->FillIn(pc, map);
-  }
-}
-
-Backtrace* Backtrace::Create(pid_t pid, pid_t tid, BacktraceMap* map) {
-  if (pid == BACKTRACE_CURRENT_PROCESS) {
-    pid = getpid();
-    if (tid == BACKTRACE_CURRENT_THREAD) {
-      tid = android::base::GetThreadId();
-    }
-  } else if (tid == BACKTRACE_CURRENT_THREAD) {
-    tid = pid;
-  }
-
-  if (pid == getpid()) {
-    return new UnwindStackCurrent(pid, tid, map);
-  } else {
-    return new UnwindStackPtrace(pid, tid, map);
-  }
-}
-
-std::string Backtrace::GetErrorString(BacktraceUnwindError error) {
-  switch (error.error_code) {
-    case BACKTRACE_UNWIND_NO_ERROR:
-      return "No error";
-    case BACKTRACE_UNWIND_ERROR_SETUP_FAILED:
-      return "Setup failed";
-    case BACKTRACE_UNWIND_ERROR_MAP_MISSING:
-      return "No map found";
-    case BACKTRACE_UNWIND_ERROR_INTERNAL:
-      return "Internal libbacktrace error, please submit a bugreport";
-    case BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST:
-      return "Thread doesn't exist";
-    case BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT:
-      return "Thread has not responded to signal in time";
-    case BACKTRACE_UNWIND_ERROR_UNSUPPORTED_OPERATION:
-      return "Attempt to use an unsupported feature";
-    case BACKTRACE_UNWIND_ERROR_NO_CONTEXT:
-      return "Attempt to do an offline unwind without a context";
-    case BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT:
-      return "Exceed MAX_BACKTRACE_FRAMES limit";
-    case BACKTRACE_UNWIND_ERROR_ACCESS_MEM_FAILED:
-      return android::base::StringPrintf("Failed to read memory at addr 0x%" PRIx64,
-                                         error.error_info.addr);
-    case BACKTRACE_UNWIND_ERROR_ACCESS_REG_FAILED:
-      return android::base::StringPrintf("Failed to read register %" PRIu64, error.error_info.regno);
-    case BACKTRACE_UNWIND_ERROR_FIND_PROC_INFO_FAILED:
-      return "Failed to find a function in debug sections";
-    case BACKTRACE_UNWIND_ERROR_EXECUTE_DWARF_INSTRUCTION_FAILED:
-      return "Failed to execute dwarf instructions in debug sections";
-    case BACKTRACE_UNWIND_ERROR_UNWIND_INFO:
-      return "Failed to unwind due to invalid unwind information";
-    case BACKTRACE_UNWIND_ERROR_REPEATED_FRAME:
-      return "Failed to unwind due to same sp/pc repeating";
-    case BACKTRACE_UNWIND_ERROR_INVALID_ELF:
-      return "Failed to unwind due to invalid elf";
-  }
-}
diff --git a/libbacktrace/BacktraceAsyncSafeLog.h b/libbacktrace/BacktraceAsyncSafeLog.h
deleted file mode 100644
index 14f51be..0000000
--- a/libbacktrace/BacktraceAsyncSafeLog.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LIBBACKTRACE_BACKTRACE_ASYNC_SAFE_LOG_H
-#define _LIBBACKTRACE_BACKTRACE_ASYNC_SAFE_LOG_H
-
-#if defined(__ANDROID__)
-
-#include <async_safe/log.h>
-
-// Logging macros for use in signal handler, only available on target.
-#define BACK_ASYNC_SAFE_LOGW(format, ...)                                                     \
-  async_safe_format_log(ANDROID_LOG_WARN, "libbacktrace", "%s: " format, __PRETTY_FUNCTION__, \
-                        ##__VA_ARGS__)
-
-#define BACK_ASYNC_SAFE_LOGE(format, ...)                                                      \
-  async_safe_format_log(ANDROID_LOG_ERROR, "libbacktrace", "%s: " format, __PRETTY_FUNCTION__, \
-                        ##__VA_ARGS__)
-
-#else
-
-#define BACK_ASYNC_SAFE_LOGW(format, ...)
-
-#define BACK_ASYNC_SAFE_LOGE(format, ...)
-
-#endif
-
-#endif  // _LIBBACKTRACE_BACKTRACE_ASYNC_SAFE_LOG_H
diff --git a/libbacktrace/BacktraceCurrent.cpp b/libbacktrace/BacktraceCurrent.cpp
deleted file mode 100644
index 038b59e..0000000
--- a/libbacktrace/BacktraceCurrent.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#define _GNU_SOURCE 1
-#include <errno.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <ucontext.h>
-#include <unistd.h>
-
-#include <stdlib.h>
-
-#include <string>
-
-#include <android-base/threads.h>
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-
-#include "BacktraceAsyncSafeLog.h"
-#include "BacktraceCurrent.h"
-#include "ThreadEntry.h"
-
-bool BacktraceCurrent::ReadWord(uint64_t ptr, word_t* out_value) {
-  if (!VerifyReadWordArgs(ptr, out_value)) {
-    return false;
-  }
-
-  backtrace_map_t map;
-  FillInMap(ptr, &map);
-  if (BacktraceMap::IsValid(map) && map.flags & PROT_READ) {
-    *out_value = *reinterpret_cast<word_t*>(ptr);
-    return true;
-  } else {
-    BACK_ASYNC_SAFE_LOGW("pointer %p not in a readable map", reinterpret_cast<void*>(ptr));
-    *out_value = static_cast<word_t>(-1);
-    return false;
-  }
-}
-
-size_t BacktraceCurrent::Read(uint64_t addr, uint8_t* buffer, size_t bytes) {
-  backtrace_map_t map;
-  FillInMap(addr, &map);
-  if (!BacktraceMap::IsValid(map) || !(map.flags & PROT_READ)) {
-    return 0;
-  }
-  bytes = MIN(map.end - addr, bytes);
-  memcpy(buffer, reinterpret_cast<uint8_t*>(addr), bytes);
-  return bytes;
-}
-
-bool BacktraceCurrent::Unwind(size_t num_ignore_frames, void* ucontext) {
-  if (GetMap() == nullptr) {
-    // Without a map object, we can't do anything.
-    error_.error_code = BACKTRACE_UNWIND_ERROR_MAP_MISSING;
-    return false;
-  }
-
-  error_.error_code = BACKTRACE_UNWIND_NO_ERROR;
-  if (ucontext) {
-    return UnwindFromContext(num_ignore_frames, ucontext);
-  }
-
-  if (Tid() != static_cast<pid_t>(android::base::GetThreadId())) {
-    return UnwindThread(num_ignore_frames);
-  }
-
-  return UnwindFromContext(num_ignore_frames, nullptr);
-}
-
-bool BacktraceCurrent::DiscardFrame(const backtrace_frame_data_t& frame) {
-  if (BacktraceMap::IsValid(frame.map)) {
-    const std::string library = basename(frame.map.name.c_str());
-    if (library == "libunwind.so" || library == "libbacktrace.so") {
-      return true;
-    }
-  }
-  return false;
-}
-
-static pthread_mutex_t g_sigaction_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-// Since errno is stored per thread, changing it in the signal handler
-// modifies the value on the thread in which the signal handler executes.
-// If a signal occurs between a call and an errno check, it's possible
-// to get the errno set here. Always save and restore it just in case
-// code would modify it.
-class ErrnoRestorer {
- public:
-  ErrnoRestorer() : saved_errno_(errno) {}
-  ~ErrnoRestorer() {
-    errno = saved_errno_;
-  }
-
- private:
-  int saved_errno_;
-};
-
-static void SignalLogOnly(int, siginfo_t*, void*) {
-  ErrnoRestorer restore;
-
-  BACK_ASYNC_SAFE_LOGE("pid %d, tid %d: Received a spurious signal %d\n", getpid(),
-                       static_cast<int>(android::base::GetThreadId()), THREAD_SIGNAL);
-}
-
-static void SignalHandler(int, siginfo_t*, void* sigcontext) {
-  ErrnoRestorer restore;
-
-  ThreadEntry* entry = ThreadEntry::Get(getpid(), android::base::GetThreadId(), false);
-  if (!entry) {
-    BACK_ASYNC_SAFE_LOGE("pid %d, tid %d entry not found", getpid(),
-                         static_cast<int>(android::base::GetThreadId()));
-    return;
-  }
-
-  entry->CopyUcontextFromSigcontext(sigcontext);
-
-  // Indicate the ucontext is now valid.
-  entry->Wake();
-
-  // Pause the thread until the unwind is complete. This avoids having
-  // the thread run ahead causing problems.
-  // The number indicates that we are waiting for the second Wake() call
-  // overall which is made by the thread requesting an unwind.
-  if (entry->Wait(2)) {
-    // Do not remove the entry here because that can result in a deadlock
-    // if the code cannot properly send a signal to the thread under test.
-    entry->Wake();
-  } else {
-    // At this point, it is possible that entry has been freed, so just exit.
-    BACK_ASYNC_SAFE_LOGE("Timed out waiting for unwind thread to indicate it completed.");
-  }
-}
-
-bool BacktraceCurrent::UnwindThread(size_t num_ignore_frames) {
-  // Prevent multiple threads trying to set the trigger action on different
-  // threads at the same time.
-  pthread_mutex_lock(&g_sigaction_mutex);
-
-  ThreadEntry* entry = ThreadEntry::Get(Pid(), Tid());
-  entry->Lock();
-
-  struct sigaction act, oldact;
-  memset(&act, 0, sizeof(act));
-  act.sa_sigaction = SignalHandler;
-  act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
-  sigemptyset(&act.sa_mask);
-  if (sigaction(THREAD_SIGNAL, &act, &oldact) != 0) {
-    BACK_ASYNC_SAFE_LOGE("sigaction failed: %s", strerror(errno));
-    ThreadEntry::Remove(entry);
-    pthread_mutex_unlock(&g_sigaction_mutex);
-    error_.error_code = BACKTRACE_UNWIND_ERROR_INTERNAL;
-    return false;
-  }
-
-  if (tgkill(Pid(), Tid(), THREAD_SIGNAL) != 0) {
-    // Do not emit an error message, this might be expected. Set the
-    // error and let the caller decide.
-    if (errno == ESRCH) {
-      error_.error_code = BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST;
-    } else {
-      error_.error_code = BACKTRACE_UNWIND_ERROR_INTERNAL;
-    }
-
-    sigaction(THREAD_SIGNAL, &oldact, nullptr);
-    ThreadEntry::Remove(entry);
-    pthread_mutex_unlock(&g_sigaction_mutex);
-    return false;
-  }
-
-  // Wait for the thread to get the ucontext. The number indicates
-  // that we are waiting for the first Wake() call made by the thread.
-  bool wait_completed = entry->Wait(1);
-
-  if (!wait_completed && oldact.sa_sigaction == nullptr) {
-    // If the wait failed, it could be that the signal could not be delivered
-    // within the timeout. Add a signal handler that's simply going to log
-    // something so that we don't crash if the signal eventually gets
-    // delivered. Only do this if there isn't already an action set up.
-    memset(&act, 0, sizeof(act));
-    act.sa_sigaction = SignalLogOnly;
-    act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
-    sigemptyset(&act.sa_mask);
-    sigaction(THREAD_SIGNAL, &act, nullptr);
-  } else {
-    sigaction(THREAD_SIGNAL, &oldact, nullptr);
-  }
-  // After the thread has received the signal, allow other unwinders to
-  // continue.
-  pthread_mutex_unlock(&g_sigaction_mutex);
-
-  bool unwind_done = false;
-  if (wait_completed) {
-    unwind_done = UnwindFromContext(num_ignore_frames, entry->GetUcontext());
-
-    // Tell the signal handler to exit and release the entry.
-    entry->Wake();
-
-    // Wait for the thread to indicate it is done with the ThreadEntry.
-    if (!entry->Wait(3)) {
-      // Send a warning, but do not mark as a failure to unwind.
-      BACK_ASYNC_SAFE_LOGW("Timed out waiting for signal handler to indicate it finished.");
-    }
-  } else {
-    // Check to see if the thread has disappeared.
-    if (tgkill(Pid(), Tid(), 0) == -1 && errno == ESRCH) {
-      error_.error_code = BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST;
-    } else {
-      error_.error_code = BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT;
-      BACK_ASYNC_SAFE_LOGE("Timed out waiting for signal handler to get ucontext data.");
-    }
-  }
-
-  ThreadEntry::Remove(entry);
-
-  return unwind_done;
-}
diff --git a/libbacktrace/BacktraceCurrent.h b/libbacktrace/BacktraceCurrent.h
deleted file mode 100644
index 48c14ea..0000000
--- a/libbacktrace/BacktraceCurrent.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _LIBBACKTRACE_BACKTRACE_CURRENT_H
-#define _LIBBACKTRACE_BACKTRACE_CURRENT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <backtrace/Backtrace.h>
-
-// The signal used to cause a thread to dump the stack.
-#if defined(__GLIBC__)
-// In order to run the backtrace_tests on the host, we can't use
-// the internal real time signals used by GLIBC. To avoid this,
-// use SIGRTMIN for the signal to dump the stack.
-#define THREAD_SIGNAL SIGRTMIN
-#else
-#define THREAD_SIGNAL (__SIGRTMIN+1)
-#endif
-
-class BacktraceMap;
-
-class BacktraceCurrent : public Backtrace {
- public:
-  BacktraceCurrent(pid_t pid, pid_t tid, BacktraceMap* map) : Backtrace(pid, tid, map) {}
-  virtual ~BacktraceCurrent() {}
-
-  size_t Read(uint64_t addr, uint8_t* buffer, size_t bytes) override;
-
-  bool ReadWord(uint64_t ptr, word_t* out_value) override;
-
-  bool Unwind(size_t num_ignore_frames, void* ucontext) override;
-
- protected:
-  bool DiscardFrame(const backtrace_frame_data_t& frame);
-
- private:
-  bool UnwindThread(size_t num_ignore_frames);
-
-  virtual bool UnwindFromContext(size_t num_ignore_frames, void* ucontext) = 0;
-};
-
-#endif // _LIBBACKTRACE_BACKTRACE_CURRENT_H
diff --git a/libbacktrace/BacktraceLog.h b/libbacktrace/BacktraceLog.h
deleted file mode 100644
index 5c39f1c..0000000
--- a/libbacktrace/BacktraceLog.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LIBBACKTRACE_BACKTRACE_LOG_H
-#define _LIBBACKTRACE_BACKTRACE_LOG_H
-
-#define LOG_TAG "libbacktrace"
-
-#include <log/log.h>
-
-// Macro to log the function name along with the warning message.
-#define BACK_LOGW(format, ...) \
-  ALOGW("%s: " format, __PRETTY_FUNCTION__, ##__VA_ARGS__)
-
-#define BACK_LOGE(format, ...) \
-  ALOGE("%s: " format, __PRETTY_FUNCTION__, ##__VA_ARGS__)
-
-#endif // _LIBBACKTRACE_BACKTRACE_LOG_H
diff --git a/libbacktrace/BacktraceMap.cpp b/libbacktrace/BacktraceMap.cpp
deleted file mode 100644
index 781819a..0000000
--- a/libbacktrace/BacktraceMap.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#define LOG_TAG "backtrace-map"
-
-#include <ctype.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <log/log.h>
-
-#include <android-base/stringprintf.h>
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-#include <backtrace/backtrace_constants.h>
-#if defined(__linux__)
-#include <procinfo/process_map.h>
-#endif
-
-using android::base::StringPrintf;
-
-std::string backtrace_map_t::Name() const {
-  if (!name.empty()) return name;
-  if (start == 0 && end == 0) return "";
-  return StringPrintf("<anonymous:%" PRIPTR ">", start);
-}
-
-BacktraceMap::BacktraceMap(pid_t pid) : pid_(pid) {
-  if (pid_ < 0) {
-    pid_ = getpid();
-  }
-}
-
-BacktraceMap::~BacktraceMap() {}
-
-void BacktraceMap::FillIn(uint64_t addr, backtrace_map_t* map) {
-  ScopedBacktraceMapIteratorLock lock(this);
-  for (auto it = begin(); it != end(); ++it) {
-    const backtrace_map_t* entry = *it;
-    if (addr >= entry->start && addr < entry->end) {
-      *map = *entry;
-      return;
-    }
-  }
-  *map = {};
-}
-
-#if defined(__APPLE__)
-static bool ParseLine(const char* line, backtrace_map_t* map) {
-  uint64_t start;
-  uint64_t end;
-  char permissions[5];
-  int name_pos;
-
-  // Mac OS vmmap(1) output:
-  // __TEXT                 0009f000-000a1000 [    8K     8K] r-x/rwx SM=COW
-  // /Volumes/android/dalvik-dev/out/host/darwin-x86/bin/libcorkscrew_test\n
-  // 012345678901234567890123456789012345678901234567890123456789
-  // 0         1         2         3         4         5
-  if (sscanf(line, "%*21c %" SCNx64 "-%" SCNx64 " [%*13c] %3c/%*3c SM=%*3c  %n", &start, &end,
-             permissions, &name_pos) != 3) {
-    return false;
-  }
-
-  map->start = start;
-  map->end = end;
-  map->flags = PROT_NONE;
-  if (permissions[0] == 'r') {
-    map->flags |= PROT_READ;
-  }
-  if (permissions[1] == 'w') {
-    map->flags |= PROT_WRITE;
-  }
-  if (permissions[2] == 'x') {
-    map->flags |= PROT_EXEC;
-  }
-
-  map->name = line + name_pos;
-  if (!map->name.empty() && map->name[map->name.length() - 1] == '\n') {
-    map->name.erase(map->name.length() - 1);
-  }
-
-  ALOGV("Parsed map: start=%p, end=%p, flags=%x, name=%s", reinterpret_cast<void*>(map->start),
-        reinterpret_cast<void*>(map->end), map->flags, map->name.c_str());
-  return true;
-}
-#endif  // defined(__APPLE__)
-
-bool BacktraceMap::Build() {
-#if defined(__APPLE__)
-  char
-      cmd[sizeof(pid_t) * 3 + sizeof("vmmap -w -resident -submap -allSplitLibs -interleaved ") + 1];
-  char line[1024];
-  // cmd is guaranteed to always be big enough to hold this string.
-  snprintf(cmd, sizeof(cmd), "vmmap -w -resident -submap -allSplitLibs -interleaved %d", pid_);
-  FILE* fp = popen(cmd, "r");
-  if (fp == nullptr) {
-    return false;
-  }
-
-  while (fgets(line, sizeof(line), fp)) {
-    backtrace_map_t map;
-    if (ParseLine(line, &map)) {
-      maps_.push_back(map);
-    }
-  }
-  pclose(fp);
-  return true;
-#else
-  return android::procinfo::ReadProcessMaps(
-      pid_, [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t, ino_t, const char* name) {
-        maps_.resize(maps_.size() + 1);
-        backtrace_map_t& map = maps_.back();
-        map.start = start;
-        map.end = end;
-        map.flags = flags;
-        map.name = name;
-      });
-#endif
-}
-
-#if defined(__APPLE__)
-// Corkscrew and libunwind don't compile on the mac, so create a generic
-// map object.
-BacktraceMap* BacktraceMap::Create(pid_t pid, bool /*uncached*/) {
-  BacktraceMap* map = new BacktraceMap(pid);
-  if (!map->Build()) {
-    delete map;
-    return nullptr;
-  }
-  return map;
-}
-#endif
diff --git a/libbacktrace/BacktracePtrace.cpp b/libbacktrace/BacktracePtrace.cpp
deleted file mode 100644
index 9da457d..0000000
--- a/libbacktrace/BacktracePtrace.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include <errno.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <ucontext.h>
-#include <unistd.h>
-
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-
-#include "BacktraceLog.h"
-#include "BacktracePtrace.h"
-
-#if !defined(__APPLE__)
-static bool PtraceRead(pid_t tid, uint64_t addr, word_t* out_value) {
-  // ptrace() returns -1 and sets errno when the operation fails.
-  // To disambiguate -1 from a valid result, we clear errno beforehand.
-  errno = 0;
-  *out_value = ptrace(PTRACE_PEEKTEXT, tid, reinterpret_cast<void*>(addr), nullptr);
-  if (*out_value == static_cast<word_t>(-1) && errno) {
-    return false;
-  }
-  return true;
-}
-#endif
-
-bool BacktracePtrace::ReadWord(uint64_t ptr, word_t* out_value) {
-#if defined(__APPLE__)
-  BACK_LOGW("MacOS does not support reading from another pid.");
-  return false;
-#else
-  if (!VerifyReadWordArgs(ptr, out_value)) {
-    return false;
-  }
-
-  backtrace_map_t map;
-  FillInMap(ptr, &map);
-  if (!BacktraceMap::IsValid(map) || !(map.flags & PROT_READ)) {
-    return false;
-  }
-
-  return PtraceRead(Tid(), ptr, out_value);
-#endif
-}
-
-size_t BacktracePtrace::Read(uint64_t addr, uint8_t* buffer, size_t bytes) {
-#if defined(__APPLE__)
-  BACK_LOGW("MacOS does not support reading from another pid.");
-  return 0;
-#else
-  backtrace_map_t map;
-  FillInMap(addr, &map);
-  if (!BacktraceMap::IsValid(map) || !(map.flags & PROT_READ)) {
-    return 0;
-  }
-
-  bytes = MIN(map.end - addr, bytes);
-  size_t bytes_read = 0;
-  word_t data_word;
-  size_t align_bytes = addr & (sizeof(word_t) - 1);
-  if (align_bytes != 0) {
-    if (!PtraceRead(Tid(), addr & ~(sizeof(word_t) - 1), &data_word)) {
-      return 0;
-    }
-    size_t copy_bytes = MIN(sizeof(word_t) - align_bytes, bytes);
-    memcpy(buffer, reinterpret_cast<uint8_t*>(&data_word) + align_bytes, copy_bytes);
-    addr += copy_bytes;
-    buffer += copy_bytes;
-    bytes -= copy_bytes;
-    bytes_read += copy_bytes;
-  }
-
-  size_t num_words = bytes / sizeof(word_t);
-  for (size_t i = 0; i < num_words; i++) {
-    if (!PtraceRead(Tid(), addr, &data_word)) {
-      return bytes_read;
-    }
-    memcpy(buffer, &data_word, sizeof(word_t));
-    buffer += sizeof(word_t);
-    addr += sizeof(word_t);
-    bytes_read += sizeof(word_t);
-  }
-
-  size_t left_over = bytes & (sizeof(word_t) - 1);
-  if (left_over) {
-    if (!PtraceRead(Tid(), addr, &data_word)) {
-      return bytes_read;
-    }
-    memcpy(buffer, &data_word, left_over);
-    bytes_read += left_over;
-  }
-  return bytes_read;
-#endif
-}
diff --git a/libbacktrace/BacktracePtrace.h b/libbacktrace/BacktracePtrace.h
deleted file mode 100644
index 1ae3adf..0000000
--- a/libbacktrace/BacktracePtrace.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _LIBBACKTRACE_BACKTRACE_PTRACE_H
-#define _LIBBACKTRACE_BACKTRACE_PTRACE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <backtrace/Backtrace.h>
-
-class BacktraceMap;
-
-class BacktracePtrace : public Backtrace {
- public:
-  BacktracePtrace(pid_t pid, pid_t tid, BacktraceMap* map) : Backtrace(pid, tid, map) {}
-  virtual ~BacktracePtrace() {}
-
-  size_t Read(uint64_t addr, uint8_t* buffer, size_t bytes) override;
-
-  bool ReadWord(uint64_t ptr, word_t* out_value) override;
-};
-
-#endif // _LIBBACKTRACE_BACKTRACE_PTRACE_H
diff --git a/libbacktrace/BacktraceTest.h b/libbacktrace/BacktraceTest.h
deleted file mode 100644
index c38af04..0000000
--- a/libbacktrace/BacktraceTest.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _LIBBACKTRACE_BACKTRACE_TEST_H
-#define _LIBBACKTRACE_BACKTRACE_TEST_H
-
-#include <dlfcn.h>
-
-#include <gtest/gtest.h>
-
-class BacktraceTest : public ::testing::Test {
- protected:
-  static void SetUpTestCase() {
-    dl_handle_ = dlopen("libbacktrace_test.so", RTLD_NOW | RTLD_LOCAL);
-
-    test_level_one_ = reinterpret_cast<int (*)(int, int, int, int, void (*)(void*), void*)>(
-        dlsym(dl_handle_, "test_level_one"));
-
-    test_level_two_ = reinterpret_cast<int (*)(int, int, int, int, void (*)(void*), void*)>(
-        dlsym(dl_handle_, "test_level_two"));
-
-    test_level_three_ = reinterpret_cast<int (*)(int, int, int, int, void (*)(void*), void*)>(
-        dlsym(dl_handle_, "test_level_three"));
-
-    test_level_four_ = reinterpret_cast<int (*)(int, int, int, int, void (*)(void*), void*)>(
-        dlsym(dl_handle_, "test_level_four"));
-
-    test_recursive_call_ = reinterpret_cast<int (*)(int, void (*)(void*), void*)>(
-        dlsym(dl_handle_, "test_recursive_call"));
-
-    test_get_context_and_wait_ = reinterpret_cast<void (*)(void*, volatile int*)>(
-        dlsym(dl_handle_, "test_get_context_and_wait"));
-
-    test_signal_action_ =
-        reinterpret_cast<void (*)(int, siginfo_t*, void*)>(dlsym(dl_handle_, "test_signal_action"));
-
-    test_signal_handler_ =
-        reinterpret_cast<void (*)(int)>(dlsym(dl_handle_, "test_signal_handler"));
-  }
-
-  void SetUp() override {
-    ASSERT_TRUE(dl_handle_ != nullptr);
-    ASSERT_TRUE(test_level_one_ != nullptr);
-    ASSERT_TRUE(test_level_two_ != nullptr);
-    ASSERT_TRUE(test_level_three_ != nullptr);
-    ASSERT_TRUE(test_level_four_ != nullptr);
-    ASSERT_TRUE(test_recursive_call_ != nullptr);
-    ASSERT_TRUE(test_get_context_and_wait_ != nullptr);
-    ASSERT_TRUE(test_signal_action_ != nullptr);
-    ASSERT_TRUE(test_signal_handler_ != nullptr);
-  }
-
- public:
-  static void* dl_handle_;
-  static int (*test_level_one_)(int, int, int, int, void (*)(void*), void*);
-  static int (*test_level_two_)(int, int, int, int, void (*)(void*), void*);
-  static int (*test_level_three_)(int, int, int, int, void (*)(void*), void*);
-  static int (*test_level_four_)(int, int, int, int, void (*)(void*), void*);
-  static int (*test_recursive_call_)(int, void (*)(void*), void*);
-  static void (*test_get_context_and_wait_)(void*, volatile int*);
-  static void (*test_signal_action_)(int, siginfo_t*, void*);
-  static void (*test_signal_handler_)(int);
-};
-
-#endif  // _LIBBACKTRACE_BACKTRACE_TEST_H
diff --git a/libbacktrace/OWNERS b/libbacktrace/OWNERS
deleted file mode 100644
index bfeedca..0000000
--- a/libbacktrace/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-cferris@google.com
-jmgao@google.com
diff --git a/libbacktrace/ThreadEntry.cpp b/libbacktrace/ThreadEntry.cpp
deleted file mode 100644
index 9bd59e4..0000000
--- a/libbacktrace/ThreadEntry.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <pthread.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-#include <time.h>
-#include <ucontext.h>
-
-#include "BacktraceAsyncSafeLog.h"
-#include "ThreadEntry.h"
-
-// Initialize static member variables.
-ThreadEntry* ThreadEntry::list_ = nullptr;
-pthread_mutex_t ThreadEntry::list_mutex_ = PTHREAD_MUTEX_INITIALIZER;
-
-// Assumes that ThreadEntry::list_mutex_ has already been locked before
-// creating a ThreadEntry object.
-ThreadEntry::ThreadEntry(pid_t pid, pid_t tid)
-    : pid_(pid), tid_(tid), ref_count_(1), mutex_(PTHREAD_MUTEX_INITIALIZER),
-      wait_mutex_(PTHREAD_MUTEX_INITIALIZER), wait_value_(0),
-      next_(ThreadEntry::list_), prev_(nullptr) {
-  pthread_condattr_t attr;
-  pthread_condattr_init(&attr);
-  pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
-  pthread_cond_init(&wait_cond_, &attr);
-
-  // Add ourselves to the list.
-  if (ThreadEntry::list_) {
-    ThreadEntry::list_->prev_ = this;
-  }
-  ThreadEntry::list_ = this;
-}
-
-ThreadEntry* ThreadEntry::Get(pid_t pid, pid_t tid, bool create) {
-  pthread_mutex_lock(&ThreadEntry::list_mutex_);
-  ThreadEntry* entry = list_;
-  while (entry != nullptr) {
-    if (entry->Match(pid, tid)) {
-      break;
-    }
-    entry = entry->next_;
-  }
-
-  if (!entry) {
-    if (create) {
-      entry = new ThreadEntry(pid, tid);
-    }
-  } else {
-    entry->ref_count_++;
-  }
-  pthread_mutex_unlock(&ThreadEntry::list_mutex_);
-
-  return entry;
-}
-
-void ThreadEntry::Remove(ThreadEntry* entry) {
-  entry->Unlock();
-
-  pthread_mutex_lock(&ThreadEntry::list_mutex_);
-  if (--entry->ref_count_ == 0) {
-    delete entry;
-  }
-  pthread_mutex_unlock(&ThreadEntry::list_mutex_);
-}
-
-// Assumes that ThreadEntry::list_mutex_ has already been locked before
-// deleting a ThreadEntry object.
-ThreadEntry::~ThreadEntry() {
-  if (list_ == this) {
-    list_ = next_;
-  } else {
-    if (next_) {
-      next_->prev_ = prev_;
-    }
-    prev_->next_ = next_;
-  }
-
-  next_ = nullptr;
-  prev_ = nullptr;
-
-  pthread_cond_destroy(&wait_cond_);
-}
-
-bool ThreadEntry::Wait(int value) {
-  timespec ts;
-  clock_gettime(CLOCK_MONOTONIC, &ts);
-  ts.tv_sec += 5;
-
-  bool wait_completed = true;
-  pthread_mutex_lock(&wait_mutex_);
-  while (wait_value_ != value) {
-    int ret = pthread_cond_timedwait(&wait_cond_, &wait_mutex_, &ts);
-    if (ret != 0) {
-      BACK_ASYNC_SAFE_LOGW("pthread_cond_timedwait for value %d failed: %s", value, strerror(ret));
-      wait_completed = false;
-      break;
-    }
-  }
-  pthread_mutex_unlock(&wait_mutex_);
-
-  return wait_completed;
-}
-
-void ThreadEntry::Wake() {
-  pthread_mutex_lock(&wait_mutex_);
-  wait_value_++;
-  pthread_mutex_unlock(&wait_mutex_);
-
-  pthread_cond_signal(&wait_cond_);
-}
-
-void ThreadEntry::CopyUcontextFromSigcontext(void* sigcontext) {
-  ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(sigcontext);
-  // The only thing the unwinder cares about is the mcontext data.
-  memcpy(&ucontext_.uc_mcontext, &ucontext->uc_mcontext, sizeof(ucontext->uc_mcontext));
-}
diff --git a/libbacktrace/ThreadEntry.h b/libbacktrace/ThreadEntry.h
deleted file mode 100644
index caa5497..0000000
--- a/libbacktrace/ThreadEntry.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _LIBBACKTRACE_THREAD_ENTRY_H
-#define _LIBBACKTRACE_THREAD_ENTRY_H
-
-#include <pthread.h>
-#include <sys/types.h>
-#include <ucontext.h>
-
-class ThreadEntry {
- public:
-  static ThreadEntry* Get(pid_t pid, pid_t tid, bool create = true);
-
-  static void Remove(ThreadEntry* entry);
-
-  void Wake();
-
-  bool Wait(int);
-
-  void CopyUcontextFromSigcontext(void*);
-
-  inline void Lock() {
-    pthread_mutex_lock(&mutex_);
-
-    // Always reset the wait value since this could be the first or nth
-    // time this entry is locked.
-    wait_value_ = 0;
-  }
-
-  inline void Unlock() {
-    pthread_mutex_unlock(&mutex_);
-  }
-
-  inline ucontext_t* GetUcontext() { return &ucontext_; }
-
- private:
-  ThreadEntry(pid_t pid, pid_t tid);
-  ~ThreadEntry();
-
-  bool Match(pid_t chk_pid, pid_t chk_tid) { return (chk_pid == pid_ && chk_tid == tid_); }
-
-  pid_t pid_;
-  pid_t tid_;
-  int ref_count_;
-  pthread_mutex_t mutex_;
-  pthread_mutex_t wait_mutex_;
-  pthread_cond_t wait_cond_;
-  int wait_value_;
-  ThreadEntry* next_;
-  ThreadEntry* prev_;
-  ucontext_t ucontext_;
-
-  static ThreadEntry* list_;
-  static pthread_mutex_t list_mutex_;
-};
-
-#endif // _LIBBACKTRACE_THREAD_ENTRY_H
diff --git a/libbacktrace/UnwindMap.cpp b/libbacktrace/UnwindMap.cpp
deleted file mode 100644
index 798c769..0000000
--- a/libbacktrace/UnwindMap.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <pthread.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <backtrace/BacktraceMap.h>
-
-#include <libunwind.h>
-
-#include "BacktraceLog.h"
-#include "UnwindMap.h"
-
-//-------------------------------------------------------------------------
-// libunwind has a single shared address space for the current process
-// aka local. If multiple maps are created for the current pid, then
-// only update the local address space once, and keep a reference count
-// of maps using the same map cursor.
-//-------------------------------------------------------------------------
-UnwindMap::UnwindMap(pid_t pid) : BacktraceMap(pid) {
-  unw_map_cursor_clear(&map_cursor_);
-}
-
-UnwindMapRemote::UnwindMapRemote(pid_t pid) : UnwindMap(pid) {
-}
-
-UnwindMapRemote::~UnwindMapRemote() {
-  unw_map_cursor_destroy(&map_cursor_);
-  unw_map_cursor_clear(&map_cursor_);
-}
-
-bool UnwindMapRemote::GenerateMap() {
-  // Use the map_cursor information to construct the BacktraceMap data
-  // rather than reparsing /proc/self/maps.
-  unw_map_cursor_reset(&map_cursor_);
-
-  unw_map_t unw_map;
-  while (unw_map_cursor_get_next(&map_cursor_, &unw_map)) {
-    backtrace_map_t map;
-
-    map.start = unw_map.start;
-    map.end = unw_map.end;
-    map.offset = unw_map.offset;
-    map.load_bias = unw_map.load_base;
-    map.flags = unw_map.flags;
-    map.name = unw_map.path;
-
-    // The maps are in descending order, but we want them in ascending order.
-    maps_.push_front(map);
-  }
-
-  return true;
-}
-
-bool UnwindMapRemote::Build() {
-  return (unw_map_cursor_create(&map_cursor_, pid_) == 0) && GenerateMap();
-}
-
-UnwindMapLocal::UnwindMapLocal() : UnwindMap(getpid()), map_created_(false) {
-  pthread_rwlock_init(&map_lock_, nullptr);
-}
-
-UnwindMapLocal::~UnwindMapLocal() {
-  if (map_created_) {
-    unw_map_local_destroy();
-    unw_map_cursor_clear(&map_cursor_);
-  }
-}
-
-bool UnwindMapLocal::GenerateMap() {
-  // Lock so that multiple threads cannot modify the maps data at the
-  // same time.
-  pthread_rwlock_wrlock(&map_lock_);
-
-  // It's possible for the map to be regenerated while this loop is occurring.
-  // If that happens, get the map again, but only try at most three times
-  // before giving up.
-  bool generated = false;
-  for (int i = 0; i < 3; i++) {
-    maps_.clear();
-
-    // Save the map data retrieved so we can tell if it changes.
-    unw_map_local_cursor_get(&map_cursor_);
-
-    unw_map_t unw_map;
-    int ret;
-    while ((ret = unw_map_local_cursor_get_next(&map_cursor_, &unw_map)) > 0) {
-      backtrace_map_t map;
-
-      map.start = unw_map.start;
-      map.end = unw_map.end;
-      map.offset = unw_map.offset;
-      map.load_bias = unw_map.load_base;
-      map.flags = unw_map.flags;
-      map.name = unw_map.path;
-
-      free(unw_map.path);
-
-      // The maps are in descending order, but we want them in ascending order.
-      maps_.push_front(map);
-    }
-    // Check to see if the map changed while getting the data.
-    if (ret != -UNW_EINVAL) {
-      generated = true;
-      break;
-    }
-  }
-
-  pthread_rwlock_unlock(&map_lock_);
-
-  if (!generated) {
-    BACK_LOGW("Unable to generate the map.");
-  }
-  return generated;
-}
-
-bool UnwindMapLocal::Build() {
-  return (map_created_ = (unw_map_local_create() == 0)) && GenerateMap();;
-}
-
-void UnwindMapLocal::FillIn(uint64_t addr, backtrace_map_t* map) {
-  BacktraceMap::FillIn(addr, map);
-  if (!IsValid(*map)) {
-    // Check to see if the underlying map changed and regenerate the map
-    // if it did.
-    if (unw_map_local_cursor_valid(&map_cursor_) < 0) {
-      if (GenerateMap()) {
-        BacktraceMap::FillIn(addr, map);
-      }
-    }
-  }
-}
diff --git a/libbacktrace/UnwindMap.h b/libbacktrace/UnwindMap.h
deleted file mode 100644
index 15544e8..0000000
--- a/libbacktrace/UnwindMap.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LIBBACKTRACE_UNWIND_MAP_H
-#define _LIBBACKTRACE_UNWIND_MAP_H
-
-#include <pthread.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <backtrace/BacktraceMap.h>
-
-// The unw_map_cursor_t structure is different depending on whether it is
-// the local or remote version. In order to get the correct version, include
-// libunwind.h first then this header.
-
-class UnwindMap : public BacktraceMap {
- public:
-  explicit UnwindMap(pid_t pid);
-
-  unw_map_cursor_t* GetMapCursor() { return &map_cursor_; }
-
- protected:
-  unw_map_cursor_t map_cursor_;
-};
-
-class UnwindMapRemote : public UnwindMap {
- public:
-  explicit UnwindMapRemote(pid_t pid);
-  virtual ~UnwindMapRemote();
-
-  bool Build() override;
-
- private:
-  bool GenerateMap();
-};
-
-class UnwindMapLocal : public UnwindMap {
- public:
-  UnwindMapLocal();
-  virtual ~UnwindMapLocal();
-
-  bool Build() override;
-
-  void FillIn(uint64_t addr, backtrace_map_t* map) override;
-
-  void LockIterator() override { pthread_rwlock_rdlock(&map_lock_); }
-  void UnlockIterator() override { pthread_rwlock_unlock(&map_lock_); }
-
- private:
-  bool GenerateMap();
-
-  bool map_created_;
-
-  pthread_rwlock_t map_lock_;
-};
-
-#endif // _LIBBACKTRACE_UNWIND_MAP_H
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp
deleted file mode 100644
index 624711f..0000000
--- a/libbacktrace/UnwindStack.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#define _GNU_SOURCE 1
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <memory>
-#include <set>
-#include <string>
-
-#include <backtrace/Backtrace.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
-
-#if !defined(NO_LIBDEXFILE_SUPPORT)
-#include <unwindstack/DexFiles.h>
-#endif
-#include <unwindstack/Unwinder.h>
-
-#include "BacktraceLog.h"
-#include "UnwindStack.h"
-#include "UnwindStackMap.h"
-
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
-bool Backtrace::Unwind(unwindstack::Regs* regs, BacktraceMap* back_map,
-                       std::vector<backtrace_frame_data_t>* frames, size_t num_ignore_frames,
-                       std::vector<std::string>* skip_names, BacktraceUnwindError* error) {
-  UnwindStackMap* stack_map = reinterpret_cast<UnwindStackMap*>(back_map);
-  auto process_memory = stack_map->process_memory();
-  unwindstack::Unwinder unwinder(MAX_BACKTRACE_FRAMES + num_ignore_frames, stack_map->stack_maps(),
-                                 regs, stack_map->process_memory());
-  unwinder.SetResolveNames(stack_map->ResolveNames());
-  stack_map->SetArch(regs->Arch());
-  if (stack_map->GetJitDebug() != nullptr) {
-    unwinder.SetJitDebug(stack_map->GetJitDebug(), regs->Arch());
-  }
-#if !defined(NO_LIBDEXFILE_SUPPORT)
-  if (stack_map->GetDexFiles() != nullptr) {
-    unwinder.SetDexFiles(stack_map->GetDexFiles(), regs->Arch());
-  }
-#endif
-  unwinder.Unwind(skip_names, &stack_map->GetSuffixesToIgnore());
-  if (error != nullptr) {
-    switch (unwinder.LastErrorCode()) {
-      case unwindstack::ERROR_NONE:
-        error->error_code = BACKTRACE_UNWIND_NO_ERROR;
-        break;
-
-      case unwindstack::ERROR_MEMORY_INVALID:
-        error->error_code = BACKTRACE_UNWIND_ERROR_ACCESS_MEM_FAILED;
-        error->error_info.addr = unwinder.LastErrorAddress();
-        break;
-
-      case unwindstack::ERROR_UNWIND_INFO:
-        error->error_code = BACKTRACE_UNWIND_ERROR_UNWIND_INFO;
-        break;
-
-      case unwindstack::ERROR_UNSUPPORTED:
-        error->error_code = BACKTRACE_UNWIND_ERROR_UNSUPPORTED_OPERATION;
-        break;
-
-      case unwindstack::ERROR_INVALID_MAP:
-        error->error_code = BACKTRACE_UNWIND_ERROR_MAP_MISSING;
-        break;
-
-      case unwindstack::ERROR_MAX_FRAMES_EXCEEDED:
-        error->error_code = BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT;
-        break;
-
-      case unwindstack::ERROR_REPEATED_FRAME:
-        error->error_code = BACKTRACE_UNWIND_ERROR_REPEATED_FRAME;
-        break;
-
-      case unwindstack::ERROR_INVALID_ELF:
-        error->error_code = BACKTRACE_UNWIND_ERROR_INVALID_ELF;
-        break;
-    }
-  }
-
-  if (num_ignore_frames >= unwinder.NumFrames()) {
-    frames->resize(0);
-    return true;
-  }
-
-  auto unwinder_frames = unwinder.frames();
-  frames->resize(unwinder.NumFrames() - num_ignore_frames);
-  size_t cur_frame = 0;
-  for (size_t i = num_ignore_frames; i < unwinder.NumFrames(); i++) {
-    auto frame = &unwinder_frames[i];
-
-    backtrace_frame_data_t* back_frame = &frames->at(cur_frame);
-
-    back_frame->num = cur_frame++;
-
-    back_frame->rel_pc = frame->rel_pc;
-    back_frame->pc = frame->pc;
-    back_frame->sp = frame->sp;
-
-    char* demangled_name = __cxa_demangle(frame->function_name.c_str(), nullptr, nullptr, nullptr);
-    if (demangled_name != nullptr) {
-      back_frame->func_name = demangled_name;
-      free(demangled_name);
-    } else {
-      back_frame->func_name = frame->function_name;
-    }
-    back_frame->func_offset = frame->function_offset;
-
-    back_frame->map.name = frame->map_name;
-    back_frame->map.start = frame->map_start;
-    back_frame->map.end = frame->map_end;
-    back_frame->map.offset = frame->map_elf_start_offset;
-    back_frame->map.load_bias = frame->map_load_bias;
-    back_frame->map.flags = frame->map_flags;
-  }
-
-  return true;
-}
-
-UnwindStackCurrent::UnwindStackCurrent(pid_t pid, pid_t tid, BacktraceMap* map)
-    : BacktraceCurrent(pid, tid, map) {}
-
-std::string UnwindStackCurrent::GetFunctionNameRaw(uint64_t pc, uint64_t* offset) {
-  return GetMap()->GetFunctionName(pc, offset);
-}
-
-bool UnwindStackCurrent::UnwindFromContext(size_t num_ignore_frames, void* ucontext) {
-  std::unique_ptr<unwindstack::Regs> regs;
-  if (ucontext == nullptr) {
-    regs.reset(unwindstack::Regs::CreateFromLocal());
-    // Fill in the registers from this function. Do it here to avoid
-    // one extra function call appearing in the unwind.
-    unwindstack::RegsGetLocal(regs.get());
-  } else {
-    regs.reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), ucontext));
-  }
-
-  std::vector<std::string> skip_names{"libunwindstack.so", "libbacktrace.so"};
-  if (!skip_frames_) {
-    skip_names.clear();
-  }
-  return Backtrace::Unwind(regs.get(), GetMap(), &frames_, num_ignore_frames, &skip_names, &error_);
-}
-
-UnwindStackPtrace::UnwindStackPtrace(pid_t pid, pid_t tid, BacktraceMap* map)
-    : BacktracePtrace(pid, tid, map), memory_(unwindstack::Memory::CreateProcessMemory(pid)) {}
-
-std::string UnwindStackPtrace::GetFunctionNameRaw(uint64_t pc, uint64_t* offset) {
-  return GetMap()->GetFunctionName(pc, offset);
-}
-
-bool UnwindStackPtrace::Unwind(size_t num_ignore_frames, void* context) {
-  std::unique_ptr<unwindstack::Regs> regs;
-  if (context == nullptr) {
-    regs.reset(unwindstack::Regs::RemoteGet(Tid()));
-  } else {
-    regs.reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), context));
-  }
-
-  return Backtrace::Unwind(regs.get(), GetMap(), &frames_, num_ignore_frames, nullptr, &error_);
-}
-
-size_t UnwindStackPtrace::Read(uint64_t addr, uint8_t* buffer, size_t bytes) {
-  return memory_->Read(addr, buffer, bytes);
-}
diff --git a/libbacktrace/UnwindStack.h b/libbacktrace/UnwindStack.h
deleted file mode 100644
index 47f6757..0000000
--- a/libbacktrace/UnwindStack.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBBACKTRACE_UNWIND_STACK_H
-#define _LIBBACKTRACE_UNWIND_STACK_H
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include <backtrace/BacktraceMap.h>
-#include <unwindstack/Memory.h>
-
-#include "BacktraceCurrent.h"
-#include "BacktracePtrace.h"
-
-class UnwindStackCurrent : public BacktraceCurrent {
- public:
-  UnwindStackCurrent(pid_t pid, pid_t tid, BacktraceMap* map);
-  virtual ~UnwindStackCurrent() = default;
-
-  std::string GetFunctionNameRaw(uint64_t pc, uint64_t* offset) override;
-
-  bool UnwindFromContext(size_t num_ignore_frames, void* ucontext) override;
-};
-
-class UnwindStackPtrace : public BacktracePtrace {
- public:
-  UnwindStackPtrace(pid_t pid, pid_t tid, BacktraceMap* map);
-  virtual ~UnwindStackPtrace() = default;
-
-  bool Unwind(size_t num_ignore_frames, void* context) override;
-
-  std::string GetFunctionNameRaw(uint64_t pc, uint64_t* offset) override;
-
-  size_t Read(uint64_t addr, uint8_t* buffer, size_t bytes) override;
-
- private:
-  std::shared_ptr<unwindstack::Memory> memory_;
-};
-
-#endif  // _LIBBACKTRACE_UNWIND_STACK_H
diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp
deleted file mode 100644
index aa0b17c..0000000
--- a/libbacktrace/UnwindStackMap.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-#include <string>
-#include <vector>
-
-#include <backtrace/BacktraceMap.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Regs.h>
-
-#include "UnwindStackMap.h"
-
-//-------------------------------------------------------------------------
-UnwindStackMap::UnwindStackMap(pid_t pid) : BacktraceMap(pid) {}
-
-bool UnwindStackMap::Build() {
-  if (pid_ == 0) {
-    pid_ = getpid();
-    stack_maps_.reset(new unwindstack::LocalMaps);
-  } else {
-    stack_maps_.reset(new unwindstack::RemoteMaps(pid_));
-  }
-
-  // Create the process memory object.
-  process_memory_ = unwindstack::Memory::CreateProcessMemory(pid_);
-
-  // Create a JitDebug object for getting jit unwind information.
-  std::vector<std::string> search_libs_{"libart.so", "libartd.so"};
-  jit_debug_.reset(new unwindstack::JitDebug(process_memory_, search_libs_));
-#if !defined(NO_LIBDEXFILE_SUPPORT)
-  dex_files_.reset(new unwindstack::DexFiles(process_memory_, search_libs_));
-#endif
-
-  if (!stack_maps_->Parse()) {
-    return false;
-  }
-
-  // Iterate through the maps and fill in the backtrace_map_t structure.
-  for (const auto& map_info : *stack_maps_) {
-    backtrace_map_t map;
-    map.start = map_info->start;
-    map.end = map_info->end;
-    map.offset = map_info->offset;
-    // Set to -1 so that it is demand loaded.
-    map.load_bias = static_cast<uint64_t>(-1);
-    map.flags = map_info->flags;
-    map.name = map_info->name;
-
-    maps_.push_back(map);
-  }
-
-  return true;
-}
-
-void UnwindStackMap::FillIn(uint64_t addr, backtrace_map_t* map) {
-  BacktraceMap::FillIn(addr, map);
-  if (map->load_bias != static_cast<uint64_t>(-1)) {
-    return;
-  }
-
-  // Fill in the load_bias.
-  unwindstack::MapInfo* map_info = stack_maps_->Find(addr);
-  if (map_info == nullptr) {
-    return;
-  }
-  map->load_bias = map_info->GetLoadBias(process_memory_);
-}
-
-uint64_t UnwindStackMap::GetLoadBias(size_t index) {
-  if (index >= stack_maps_->Total()) {
-    return 0;
-  }
-
-  unwindstack::MapInfo* map_info = stack_maps_->Get(index);
-  if (map_info == nullptr) {
-    return 0;
-  }
-  return map_info->GetLoadBias(process_memory_);
-}
-
-std::string UnwindStackMap::GetFunctionName(uint64_t pc, uint64_t* offset) {
-  *offset = 0;
-  unwindstack::Maps* maps = stack_maps();
-
-  // Get the map for this
-  unwindstack::MapInfo* map_info = maps->Find(pc);
-  if (map_info == nullptr || map_info->flags & PROT_DEVICE_MAP) {
-    return "";
-  }
-
-  if (arch_ == unwindstack::ARCH_UNKNOWN) {
-    if (pid_ == getpid()) {
-      arch_ = unwindstack::Regs::CurrentArch();
-    } else {
-      // Create a remote regs, to figure out the architecture.
-      std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::RemoteGet(pid_));
-      arch_ = regs->Arch();
-    }
-  }
-
-  unwindstack::Elf* elf = map_info->GetElf(process_memory(), arch_);
-
-  std::string name;
-  uint64_t func_offset;
-  if (!elf->GetFunctionName(elf->GetRelPc(pc, map_info), &name, &func_offset)) {
-    return "";
-  }
-  *offset = func_offset;
-  return name;
-}
-
-std::shared_ptr<unwindstack::Memory> UnwindStackMap::GetProcessMemory() {
-  return process_memory_;
-}
-
-//-------------------------------------------------------------------------
-// BacktraceMap create function.
-//-------------------------------------------------------------------------
-BacktraceMap* BacktraceMap::Create(pid_t pid, bool uncached) {
-  BacktraceMap* map;
-
-  if (uncached) {
-    // Force use of the base class to parse the maps when this call is made.
-    map = new BacktraceMap(pid);
-  } else if (pid == getpid()) {
-    map = new UnwindStackMap(0);
-  } else {
-    map = new UnwindStackMap(pid);
-  }
-  if (!map->Build()) {
-    delete map;
-    return nullptr;
-  }
-  return map;
-}
diff --git a/libbacktrace/UnwindStackMap.h b/libbacktrace/UnwindStackMap.h
deleted file mode 100644
index f0e7d8b..0000000
--- a/libbacktrace/UnwindStackMap.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBBACKTRACE_UNWINDSTACK_MAP_H
-#define _LIBBACKTRACE_UNWINDSTACK_MAP_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <memory>
-#include <mutex>
-#include <unordered_map>
-#include <vector>
-
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-#if !defined(NO_LIBDEXFILE_SUPPORT)
-#include <unwindstack/DexFiles.h>
-#endif
-#include <unwindstack/Elf.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-// Forward declarations.
-class UnwindDexFile;
-
-class UnwindStackMap : public BacktraceMap {
- public:
-  explicit UnwindStackMap(pid_t pid);
-  ~UnwindStackMap() = default;
-
-  bool Build() override;
-
-  void FillIn(uint64_t addr, backtrace_map_t* map) override;
-
-  virtual std::string GetFunctionName(uint64_t pc, uint64_t* offset) override;
-  virtual std::shared_ptr<unwindstack::Memory> GetProcessMemory() override final;
-
-  unwindstack::Maps* stack_maps() { return stack_maps_.get(); }
-
-  const std::shared_ptr<unwindstack::Memory>& process_memory() { return process_memory_; }
-
-  unwindstack::JitDebug* GetJitDebug() { return jit_debug_.get(); }
-
-#if !defined(NO_LIBDEXFILE_SUPPORT)
-  unwindstack::DexFiles* GetDexFiles() { return dex_files_.get(); }
-#endif
-
-  void SetArch(unwindstack::ArchEnum arch) { arch_ = arch; }
-
- protected:
-  uint64_t GetLoadBias(size_t index) override;
-
-  std::unique_ptr<unwindstack::Maps> stack_maps_;
-  std::shared_ptr<unwindstack::Memory> process_memory_;
-  std::unique_ptr<unwindstack::JitDebug> jit_debug_;
-#if !defined(NO_LIBDEXFILE_SUPPORT)
-  std::unique_ptr<unwindstack::DexFiles> dex_files_;
-#endif
-
-  unwindstack::ArchEnum arch_ = unwindstack::ARCH_UNKNOWN;
-};
-
-#endif  // _LIBBACKTRACE_UNWINDSTACK_MAP_H
diff --git a/libbacktrace/backtrace_benchmarks.cpp b/libbacktrace/backtrace_benchmarks.cpp
deleted file mode 100644
index a93a25e..0000000
--- a/libbacktrace/backtrace_benchmarks.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/prctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/threads.h>
-
-#include <benchmark/benchmark.h>
-
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-#include <unwindstack/Memory.h>
-
-constexpr size_t kNumMaps = 2000;
-
-static bool CountMaps(pid_t pid, size_t* num_maps) {
-  // Minimize the calls that might allocate memory. If too much memory
-  // gets allocated, then this routine will add extra maps and the next
-  // call will fail to get the same number of maps as before.
-  int fd =
-      open((std::string("/proc/") + std::to_string(pid) + "/maps").c_str(), O_RDONLY | O_CLOEXEC);
-  if (fd == -1) {
-    fprintf(stderr, "Cannot open map file for pid %d: %s\n", pid, strerror(errno));
-    return false;
-  }
-  *num_maps = 0;
-  while (true) {
-    char buffer[2048];
-    ssize_t bytes = read(fd, buffer, sizeof(buffer));
-    if (bytes <= 0) {
-      break;
-    }
-    // Count the '\n'.
-    for (size_t i = 0; i < static_cast<size_t>(bytes); i++) {
-      if (buffer[i] == '\n') {
-        ++*num_maps;
-      }
-    }
-  }
-
-  close(fd);
-  return true;
-}
-
-static void CreateMap(benchmark::State& state, BacktraceMap* (*map_func)(pid_t, bool)) {
-  // Create a remote process so that the map data is exactly the same.
-  // Also, so that we can create a set number of maps.
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    size_t num_maps;
-    if (!CountMaps(getpid(), &num_maps)) {
-      exit(1);
-    }
-    // Create uniquely named maps.
-    std::vector<void*> maps;
-    for (size_t i = num_maps; i < kNumMaps; i++) {
-      int flags = PROT_READ | PROT_WRITE;
-      // Alternate page type to make sure a map entry is added for each call.
-      if ((i % 2) == 0) {
-        flags |= PROT_EXEC;
-      }
-      void* memory = mmap(nullptr, PAGE_SIZE, flags, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-      if (memory == MAP_FAILED) {
-        fprintf(stderr, "Failed to create map: %s\n", strerror(errno));
-        exit(1);
-      }
-      memset(memory, 0x1, PAGE_SIZE);
-#if defined(PR_SET_VMA)
-      if (prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, memory, PAGE_SIZE, "test_map") == -1) {
-        fprintf(stderr, "Failed: %s\n", strerror(errno));
-      }
-#endif
-      maps.push_back(memory);
-    }
-
-    if (!CountMaps(getpid(), &num_maps)) {
-      exit(1);
-    }
-
-    if (num_maps < kNumMaps) {
-      fprintf(stderr, "Maps set incorrectly: %zu found, %zu expected at least.\n", num_maps,
-              kNumMaps);
-      std::string str;
-      android::base::ReadFileToString("/proc/self/maps", &str);
-      fprintf(stderr, "%s\n", str.c_str());
-      exit(1);
-    }
-
-    // Wait for an hour at most.
-    sleep(3600);
-    exit(1);
-  } else if (pid < 0) {
-    fprintf(stderr, "Fork failed: %s\n", strerror(errno));
-    return;
-  }
-
-  size_t num_maps = 0;
-  for (size_t i = 0; i < 2000; i++) {
-    if (CountMaps(pid, &num_maps) && num_maps >= kNumMaps) {
-      break;
-    }
-    usleep(1000);
-  }
-  if (num_maps < kNumMaps) {
-    fprintf(stderr, "Timed out waiting for the number of maps available: %zu\n", num_maps);
-    return;
-  }
-
-  while (state.KeepRunning()) {
-    BacktraceMap* map = map_func(pid, false);
-    if (map == nullptr) {
-      fprintf(stderr, "Failed to create map\n");
-      return;
-    }
-    delete map;
-  }
-
-  kill(pid, SIGKILL);
-  waitpid(pid, nullptr, 0);
-}
-
-static void BM_create_map(benchmark::State& state) {
-  CreateMap(state, BacktraceMap::Create);
-}
-BENCHMARK(BM_create_map);
-
-using BacktraceCreateFn = decltype(Backtrace::Create);
-
-static void CreateBacktrace(benchmark::State& state, BacktraceMap* map, BacktraceCreateFn fn) {
-  while (state.KeepRunning()) {
-    std::unique_ptr<Backtrace> backtrace(fn(getpid(), android::base::GetThreadId(), map));
-    backtrace->Unwind(0);
-  }
-}
-
-static void BM_create_backtrace(benchmark::State& state) {
-  std::unique_ptr<BacktraceMap> backtrace_map(BacktraceMap::Create(getpid()));
-  CreateBacktrace(state, backtrace_map.get(), Backtrace::Create);
-}
-BENCHMARK(BM_create_backtrace);
-
-BENCHMARK_MAIN();
diff --git a/libbacktrace/backtrace_read_benchmarks.cpp b/libbacktrace/backtrace_read_benchmarks.cpp
deleted file mode 100644
index 6a688b0..0000000
--- a/libbacktrace/backtrace_read_benchmarks.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <errno.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#include <benchmark/benchmark.h>
-
-#include <backtrace/Backtrace.h>
-
-#define AT_COMMON_SIZES Arg(1)->Arg(4)->Arg(8)->Arg(16)->Arg(100)->Arg(200)->Arg(500)->Arg(1024)
-
-static void Attach(pid_t pid) {
-  if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) {
-    perror("Failed to attach");
-    abort();
-  }
-
-  siginfo_t si;
-  // Wait for up to 5 seconds.
-  for (size_t i = 0; i < 5000; i++) {
-    if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) {
-      return;
-    }
-    usleep(1000);
-  }
-  printf("Remote process failed to stop in five seconds.\n");
-  abort();
-}
-
-class ScopedPidReaper {
- public:
-  ScopedPidReaper(pid_t pid) : pid_(pid) {}
-  ~ScopedPidReaper() {
-    kill(pid_, SIGKILL);
-    waitpid(pid_, nullptr, 0);
-  }
-
- private:
-  pid_t pid_;
-};
-
-static size_t ProcessVmRead(pid_t pid, uint64_t remote_src, void* dst, size_t len) {
-  struct iovec dst_iov = {
-      .iov_base = dst, .iov_len = len,
-  };
-
-  struct iovec src_iov = {
-      .iov_base = reinterpret_cast<void*>(remote_src), .iov_len = len,
-  };
-
-  ssize_t rc = process_vm_readv(pid, &dst_iov, 1, &src_iov, 1, 0);
-  return rc == -1 ? 0 : rc;
-}
-
-static bool PtraceReadLong(pid_t pid, uint64_t addr, long* value) {
-  // ptrace() returns -1 and sets errno when the operation fails.
-  // To disambiguate -1 from a valid result, we clear errno beforehand.
-  errno = 0;
-  *value = ptrace(PTRACE_PEEKTEXT, pid, reinterpret_cast<void*>(addr), nullptr);
-  if (*value == -1 && errno) {
-    return false;
-  }
-  return true;
-}
-
-static size_t PtraceRead(pid_t pid, uint64_t addr, void* dst, size_t bytes) {
-  size_t bytes_read = 0;
-  long data;
-  for (size_t i = 0; i < bytes / sizeof(long); i++) {
-    if (!PtraceReadLong(pid, addr, &data)) {
-      return bytes_read;
-    }
-    memcpy(dst, &data, sizeof(long));
-    dst = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(dst) + sizeof(long));
-    addr += sizeof(long);
-    bytes_read += sizeof(long);
-  }
-
-  size_t left_over = bytes & (sizeof(long) - 1);
-  if (left_over) {
-    if (!PtraceReadLong(pid, addr, &data)) {
-      return bytes_read;
-    }
-    memcpy(dst, &data, left_over);
-    bytes_read += left_over;
-  }
-  return bytes_read;
-}
-
-static void CreateRemoteProcess(size_t size, void** map, pid_t* pid) {
-  *map = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-  if (*map == MAP_FAILED) {
-    perror("Can't allocate memory");
-    abort();
-  }
-  memset(*map, 0xaa, size);
-
-  if ((*pid = fork()) == 0) {
-    for (volatile int i = 0;; i++)
-      ;
-    exit(1);
-  }
-  if (*pid < 0) {
-    perror("Failed to fork");
-    abort();
-  }
-  Attach(*pid);
-  // Don't need this map in the current process any more.
-  munmap(*map, size);
-}
-
-static void BM_read_with_ptrace(benchmark::State& state) {
-  void* map;
-  pid_t pid;
-  CreateRemoteProcess(state.range(0), &map, &pid);
-  ScopedPidReaper reap(pid);
-
-  std::vector<uint8_t> read_buffer(state.range(0));
-  uint64_t addr = reinterpret_cast<uint64_t>(map);
-  while (state.KeepRunning()) {
-    if (PtraceRead(pid, addr, read_buffer.data(), read_buffer.size()) != read_buffer.size()) {
-      printf("Unexpected bad read.\n");
-      abort();
-    }
-  }
-  ptrace(PTRACE_DETACH, pid, 0, 0);
-}
-BENCHMARK(BM_read_with_ptrace)->AT_COMMON_SIZES;
-
-static void BM_read_with_process_vm_read(benchmark::State& state) {
-  void* map;
-  pid_t pid;
-  CreateRemoteProcess(state.range(0), &map, &pid);
-  ScopedPidReaper reap(pid);
-
-  std::vector<uint8_t> read_buffer(state.range(0));
-  uint64_t addr = reinterpret_cast<uint64_t>(map);
-  while (state.KeepRunning()) {
-    if (ProcessVmRead(pid, addr, read_buffer.data(), read_buffer.size()) != read_buffer.size()) {
-      printf("Unexpected bad read.\n");
-      abort();
-    }
-  }
-  ptrace(PTRACE_DETACH, pid, 0, 0);
-}
-BENCHMARK(BM_read_with_process_vm_read)->AT_COMMON_SIZES;
-
-static void BM_read_with_backtrace_object(benchmark::State& state) {
-  void* map;
-  pid_t pid;
-  CreateRemoteProcess(state.range(0), &map, &pid);
-  ScopedPidReaper reap(pid);
-
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD));
-  if (backtrace.get() == nullptr) {
-    printf("Failed to create backtrace.\n");
-    abort();
-  }
-
-  uint64_t addr = reinterpret_cast<uint64_t>(map);
-  std::vector<uint8_t> read_buffer(state.range(0));
-  while (state.KeepRunning()) {
-    if (backtrace->Read(addr, read_buffer.data(), read_buffer.size()) != read_buffer.size()) {
-      printf("Unexpected bad read.\n");
-      abort();
-    }
-  }
-  ptrace(PTRACE_DETACH, pid, 0, 0);
-}
-BENCHMARK(BM_read_with_backtrace_object)->AT_COMMON_SIZES;
diff --git a/libbacktrace/backtrace_test.cpp b/libbacktrace/backtrace_test.cpp
deleted file mode 100644
index f4191b9..0000000
--- a/libbacktrace/backtrace_test.cpp
+++ /dev/null
@@ -1,1893 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#define _GNU_SOURCE 1
-#include <dirent.h>
-#include <dlfcn.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <malloc.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ptrace.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <time.h>
-#include <ucontext.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <list>
-#include <memory>
-#include <ostream>
-#include <string>
-#include <vector>
-
-#include <backtrace/Backtrace.h>
-#include <backtrace/BacktraceMap.h>
-
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-#include <android-base/test_utils.h>
-#include <android-base/threads.h>
-#include <android-base/unique_fd.h>
-#include <cutils/atomic.h>
-
-#include <gtest/gtest.h>
-
-// For the THREAD_SIGNAL definition.
-#include "BacktraceCurrent.h"
-#include "BacktraceTest.h"
-#include "backtrace_testlib.h"
-
-// Number of microseconds per milliseconds.
-#define US_PER_MSEC             1000
-
-// Number of nanoseconds in a second.
-#define NS_PER_SEC              1000000000ULL
-
-// Number of simultaneous dumping operations to perform.
-#define NUM_THREADS  40
-
-// Number of simultaneous threads running in our forked process.
-#define NUM_PTRACE_THREADS 5
-
-// The list of shared libaries that make up the backtrace library.
-static std::vector<std::string> kBacktraceLibs{"libunwindstack.so", "libbacktrace.so"};
-
-struct thread_t {
-  pid_t tid;
-  int32_t state;
-  pthread_t threadId;
-  void* data;
-};
-
-struct dump_thread_t {
-  thread_t thread;
-  BacktraceMap* map;
-  Backtrace* backtrace;
-  int32_t* now;
-  int32_t done;
-};
-
-typedef Backtrace* (*create_func_t)(pid_t, pid_t, BacktraceMap*);
-typedef BacktraceMap* (*map_create_func_t)(pid_t, bool);
-
-static void VerifyLevelDump(Backtrace* backtrace, create_func_t create_func = nullptr,
-                            map_create_func_t map_func = nullptr);
-static void VerifyMaxDump(Backtrace* backtrace, create_func_t create_func = nullptr,
-                          map_create_func_t map_func = nullptr);
-
-void* BacktraceTest::dl_handle_;
-int (*BacktraceTest::test_level_one_)(int, int, int, int, void (*)(void*), void*);
-int (*BacktraceTest::test_level_two_)(int, int, int, int, void (*)(void*), void*);
-int (*BacktraceTest::test_level_three_)(int, int, int, int, void (*)(void*), void*);
-int (*BacktraceTest::test_level_four_)(int, int, int, int, void (*)(void*), void*);
-int (*BacktraceTest::test_recursive_call_)(int, void (*)(void*), void*);
-void (*BacktraceTest::test_get_context_and_wait_)(void*, volatile int*);
-void (*BacktraceTest::test_signal_action_)(int, siginfo_t*, void*);
-void (*BacktraceTest::test_signal_handler_)(int);
-
-extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
-  static const char* initial_args[] = {"--slow_threshold_ms=8000", "--deadline_threshold_ms=15000"};
-  *args = initial_args;
-  *num_args = 2;
-  return true;
-}
-
-static uint64_t NanoTime() {
-  struct timespec t = { 0, 0 };
-  clock_gettime(CLOCK_MONOTONIC, &t);
-  return static_cast<uint64_t>(t.tv_sec * NS_PER_SEC + t.tv_nsec);
-}
-
-static std::string DumpFrames(Backtrace* backtrace) {
-  if (backtrace->NumFrames() == 0) {
-    return "   No frames to dump.\n";
-  }
-
-  std::string frame;
-  for (size_t i = 0; i < backtrace->NumFrames(); i++) {
-    frame += "   " + backtrace->FormatFrameData(i) + '\n';
-  }
-  return frame;
-}
-
-static void WaitForStop(pid_t pid) {
-  uint64_t start = NanoTime();
-
-  siginfo_t si;
-  while (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) < 0 && (errno == EINTR || errno == ESRCH)) {
-    if ((NanoTime() - start) > NS_PER_SEC) {
-      printf("The process did not get to a stopping point in 1 second.\n");
-      break;
-    }
-    usleep(US_PER_MSEC);
-  }
-}
-
-static void CreateRemoteProcess(pid_t* pid) {
-  if ((*pid = fork()) == 0) {
-    while (true)
-      ;
-    _exit(0);
-  }
-  ASSERT_NE(-1, *pid);
-
-  ASSERT_TRUE(ptrace(PTRACE_ATTACH, *pid, 0, 0) == 0);
-
-  // Wait for the process to get to a stopping point.
-  WaitForStop(*pid);
-}
-
-static void FinishRemoteProcess(pid_t pid) {
-  ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0);
-
-  kill(pid, SIGKILL);
-  ASSERT_EQ(waitpid(pid, nullptr, 0), pid);
-}
-
-#if !defined(__ANDROID__) || defined(__arm__)
-// On host and arm target we aren't guaranteed that we will terminate cleanly.
-#define VERIFY_NO_ERROR(error_code)                               \
-  ASSERT_TRUE(error_code == BACKTRACE_UNWIND_NO_ERROR ||          \
-              error_code == BACKTRACE_UNWIND_ERROR_UNWIND_INFO || \
-              error_code == BACKTRACE_UNWIND_ERROR_MAP_MISSING)   \
-      << "Unknown error code " << std::to_string(error_code);
-#else
-#define VERIFY_NO_ERROR(error_code) ASSERT_EQ(BACKTRACE_UNWIND_NO_ERROR, error_code);
-#endif
-
-static bool ReadyLevelBacktrace(Backtrace* backtrace) {
-  // See if test_level_four is in the backtrace.
-  bool found = false;
-  for (Backtrace::const_iterator it = backtrace->begin(); it != backtrace->end(); ++it) {
-    if (it->func_name == "test_level_four") {
-      found = true;
-      break;
-    }
-  }
-
-  return found;
-}
-
-static void VerifyLevelDump(Backtrace* backtrace, create_func_t, map_create_func_t) {
-  ASSERT_GT(backtrace->NumFrames(), static_cast<size_t>(0))
-    << DumpFrames(backtrace);
-  ASSERT_LT(backtrace->NumFrames(), static_cast<size_t>(MAX_BACKTRACE_FRAMES))
-    << DumpFrames(backtrace);
-
-  // Look through the frames starting at the highest to find the
-  // frame we want.
-  size_t frame_num = 0;
-  for (size_t i = backtrace->NumFrames()-1; i > 2; i--) {
-    if (backtrace->GetFrame(i)->func_name == "test_level_one") {
-      frame_num = i;
-      break;
-    }
-  }
-  ASSERT_LT(static_cast<size_t>(0), frame_num) << DumpFrames(backtrace);
-  ASSERT_LE(static_cast<size_t>(3), frame_num) << DumpFrames(backtrace);
-
-  ASSERT_EQ(backtrace->GetFrame(frame_num)->func_name, "test_level_one")
-    << DumpFrames(backtrace);
-  ASSERT_EQ(backtrace->GetFrame(frame_num-1)->func_name, "test_level_two")
-    << DumpFrames(backtrace);
-  ASSERT_EQ(backtrace->GetFrame(frame_num-2)->func_name, "test_level_three")
-    << DumpFrames(backtrace);
-  ASSERT_EQ(backtrace->GetFrame(frame_num-3)->func_name, "test_level_four")
-    << DumpFrames(backtrace);
-}
-
-static void VerifyLevelBacktrace(void*) {
-  std::unique_ptr<Backtrace> backtrace(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-  VerifyLevelDump(backtrace.get());
-}
-
-static bool ReadyMaxBacktrace(Backtrace* backtrace) {
-  return (backtrace->NumFrames() == MAX_BACKTRACE_FRAMES);
-}
-
-static void VerifyMaxDump(Backtrace* backtrace, create_func_t, map_create_func_t) {
-  ASSERT_EQ(backtrace->NumFrames(), static_cast<size_t>(MAX_BACKTRACE_FRAMES))
-    << DumpFrames(backtrace);
-  // Verify that the last frame is our recursive call.
-  ASSERT_EQ(backtrace->GetFrame(MAX_BACKTRACE_FRAMES-1)->func_name, "test_recursive_call")
-    << DumpFrames(backtrace);
-}
-
-static void VerifyMaxBacktrace(void*) {
-  std::unique_ptr<Backtrace> backtrace(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  ASSERT_EQ(BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT, backtrace->GetError().error_code);
-
-  VerifyMaxDump(backtrace.get());
-}
-
-static void ThreadSetState(void* data) {
-  thread_t* thread = reinterpret_cast<thread_t*>(data);
-  android_atomic_acquire_store(1, &thread->state);
-  volatile int i = 0;
-  while (thread->state) {
-    i++;
-  }
-}
-
-static bool WaitForNonZero(int32_t* value, uint64_t seconds) {
-  uint64_t start = NanoTime();
-  do {
-    if (android_atomic_acquire_load(value)) {
-      return true;
-    }
-  } while ((NanoTime() - start) < seconds * NS_PER_SEC);
-  return false;
-}
-
-TEST_F(BacktraceTest, local_no_unwind_frames) {
-  // Verify that a local unwind does not include any frames within
-  // libunwind or libbacktrace.
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), getpid()));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-  ASSERT_TRUE(backtrace->NumFrames() != 0);
-  // None of the frames should be in the backtrace libraries.
-  for (const auto& frame : *backtrace ) {
-    if (BacktraceMap::IsValid(frame.map)) {
-      const std::string name = basename(frame.map.name.c_str());
-      for (const auto& lib : kBacktraceLibs) {
-        ASSERT_TRUE(name != lib) << DumpFrames(backtrace.get());
-      }
-    }
-  }
-}
-
-TEST_F(BacktraceTest, local_unwind_frames) {
-  // Verify that a local unwind with the skip frames disabled does include
-  // frames within the backtrace libraries.
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), getpid()));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  backtrace->SetSkipFrames(false);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-  ASSERT_TRUE(backtrace->NumFrames() != 0);
-  size_t first_frame_non_backtrace_lib = 0;
-  for (const auto& frame : *backtrace) {
-    if (BacktraceMap::IsValid(frame.map)) {
-      const std::string name = basename(frame.map.name.c_str());
-      bool found = false;
-      for (const auto& lib : kBacktraceLibs) {
-        if (name == lib) {
-          found = true;
-          break;
-        }
-      }
-      if (!found) {
-        first_frame_non_backtrace_lib = frame.num;
-        break;
-      }
-    }
-  }
-
-  ASSERT_NE(0U, first_frame_non_backtrace_lib) << "No frames found in backtrace libraries:\n"
-                                               << DumpFrames(backtrace.get());
-}
-
-TEST_F(BacktraceTest, local_trace) {
-  ASSERT_NE(test_level_one_(1, 2, 3, 4, VerifyLevelBacktrace, nullptr), 0);
-}
-
-static void VerifyIgnoreFrames(Backtrace* bt_all, Backtrace* bt_ign1, Backtrace* bt_ign2,
-                               const char* cur_proc) {
-  ASSERT_EQ(bt_all->NumFrames(), bt_ign1->NumFrames() + 1) << "All backtrace:\n"
-                                                           << DumpFrames(bt_all)
-                                                           << "Ignore 1 backtrace:\n"
-                                                           << DumpFrames(bt_ign1);
-  ASSERT_EQ(bt_all->NumFrames(), bt_ign2->NumFrames() + 2) << "All backtrace:\n"
-                                                           << DumpFrames(bt_all)
-                                                           << "Ignore 2 backtrace:\n"
-                                                           << DumpFrames(bt_ign2);
-
-  // Check all of the frames are the same > the current frame.
-  bool check = (cur_proc == nullptr);
-  for (size_t i = 0; i < bt_ign2->NumFrames(); i++) {
-    if (check) {
-      EXPECT_EQ(bt_ign2->GetFrame(i)->pc, bt_ign1->GetFrame(i+1)->pc);
-      EXPECT_EQ(bt_ign2->GetFrame(i)->sp, bt_ign1->GetFrame(i+1)->sp);
-      EXPECT_EQ(bt_ign2->GetFrame(i)->stack_size, bt_ign1->GetFrame(i+1)->stack_size);
-
-      EXPECT_EQ(bt_ign2->GetFrame(i)->pc, bt_all->GetFrame(i+2)->pc);
-      EXPECT_EQ(bt_ign2->GetFrame(i)->sp, bt_all->GetFrame(i+2)->sp);
-      EXPECT_EQ(bt_ign2->GetFrame(i)->stack_size, bt_all->GetFrame(i+2)->stack_size);
-    }
-    if (!check && bt_ign2->GetFrame(i)->func_name == cur_proc) {
-      check = true;
-    }
-  }
-}
-
-static void VerifyLevelIgnoreFrames(void*) {
-  std::unique_ptr<Backtrace> all(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(all.get() != nullptr);
-  ASSERT_TRUE(all->Unwind(0));
-  VERIFY_NO_ERROR(all->GetError().error_code);
-
-  std::unique_ptr<Backtrace> ign1(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(ign1.get() != nullptr);
-  ASSERT_TRUE(ign1->Unwind(1));
-  VERIFY_NO_ERROR(ign1->GetError().error_code);
-
-  std::unique_ptr<Backtrace> ign2(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(ign2.get() != nullptr);
-  ASSERT_TRUE(ign2->Unwind(2));
-  VERIFY_NO_ERROR(ign2->GetError().error_code);
-
-  VerifyIgnoreFrames(all.get(), ign1.get(), ign2.get(), "VerifyLevelIgnoreFrames");
-}
-
-TEST_F(BacktraceTest, local_trace_ignore_frames) {
-  ASSERT_NE(test_level_one_(1, 2, 3, 4, VerifyLevelIgnoreFrames, nullptr), 0);
-}
-
-TEST_F(BacktraceTest, local_max_trace) {
-  ASSERT_NE(test_recursive_call_(MAX_BACKTRACE_FRAMES + 10, VerifyMaxBacktrace, nullptr), 0);
-}
-
-static void VerifyProcTest(pid_t pid, pid_t tid, bool (*ReadyFunc)(Backtrace*),
-                           void (*VerifyFunc)(Backtrace*, create_func_t, map_create_func_t),
-                           create_func_t create_func, map_create_func_t map_create_func) {
-  pid_t ptrace_tid;
-  if (tid < 0) {
-    ptrace_tid = pid;
-  } else {
-    ptrace_tid = tid;
-  }
-  uint64_t start = NanoTime();
-  bool verified = false;
-  std::string last_dump;
-  do {
-    usleep(US_PER_MSEC);
-    if (ptrace(PTRACE_ATTACH, ptrace_tid, 0, 0) == 0) {
-      // Wait for the process to get to a stopping point.
-      WaitForStop(ptrace_tid);
-
-      std::unique_ptr<BacktraceMap> map;
-      map.reset(map_create_func(pid, false));
-      std::unique_ptr<Backtrace> backtrace(create_func(pid, tid, map.get()));
-      ASSERT_TRUE(backtrace.get() != nullptr);
-      ASSERT_TRUE(backtrace->Unwind(0));
-      if (ReadyFunc(backtrace.get())) {
-        VerifyFunc(backtrace.get(), create_func, map_create_func);
-        verified = true;
-      } else {
-        last_dump = DumpFrames(backtrace.get());
-      }
-
-      ASSERT_TRUE(ptrace(PTRACE_DETACH, ptrace_tid, 0, 0) == 0);
-    }
-    // If 5 seconds have passed, then we are done.
-  } while (!verified && (NanoTime() - start) <= 5 * NS_PER_SEC);
-  ASSERT_TRUE(verified) << "Last backtrace:\n" << last_dump;
-}
-
-TEST_F(BacktraceTest, ptrace_trace) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    ASSERT_NE(test_level_one_(1, 2, 3, 4, nullptr, nullptr), 0);
-    _exit(1);
-  }
-  VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, ReadyLevelBacktrace, VerifyLevelDump,
-                 Backtrace::Create, BacktraceMap::Create);
-
-  kill(pid, SIGKILL);
-  int status;
-  ASSERT_EQ(waitpid(pid, &status, 0), pid);
-}
-
-TEST_F(BacktraceTest, ptrace_max_trace) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    ASSERT_NE(test_recursive_call_(MAX_BACKTRACE_FRAMES + 10, nullptr, nullptr), 0);
-    _exit(1);
-  }
-  VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, ReadyMaxBacktrace, VerifyMaxDump, Backtrace::Create,
-                 BacktraceMap::Create);
-
-  kill(pid, SIGKILL);
-  int status;
-  ASSERT_EQ(waitpid(pid, &status, 0), pid);
-}
-
-static void VerifyProcessIgnoreFrames(Backtrace* bt_all, create_func_t create_func,
-                                      map_create_func_t map_create_func) {
-  std::unique_ptr<BacktraceMap> map(map_create_func(bt_all->Pid(), false));
-  std::unique_ptr<Backtrace> ign1(create_func(bt_all->Pid(), BACKTRACE_CURRENT_THREAD, map.get()));
-  ASSERT_TRUE(ign1.get() != nullptr);
-  ASSERT_TRUE(ign1->Unwind(1));
-  VERIFY_NO_ERROR(ign1->GetError().error_code);
-
-  std::unique_ptr<Backtrace> ign2(create_func(bt_all->Pid(), BACKTRACE_CURRENT_THREAD, map.get()));
-  ASSERT_TRUE(ign2.get() != nullptr);
-  ASSERT_TRUE(ign2->Unwind(2));
-  VERIFY_NO_ERROR(ign2->GetError().error_code);
-
-  VerifyIgnoreFrames(bt_all, ign1.get(), ign2.get(), nullptr);
-}
-
-TEST_F(BacktraceTest, ptrace_ignore_frames) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    ASSERT_NE(test_level_one_(1, 2, 3, 4, nullptr, nullptr), 0);
-    _exit(1);
-  }
-  VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, ReadyLevelBacktrace, VerifyProcessIgnoreFrames,
-                 Backtrace::Create, BacktraceMap::Create);
-
-  kill(pid, SIGKILL);
-  int status;
-  ASSERT_EQ(waitpid(pid, &status, 0), pid);
-}
-
-// Create a process with multiple threads and dump all of the threads.
-static void* PtraceThreadLevelRun(void*) {
-  EXPECT_NE(BacktraceTest::test_level_one_(1, 2, 3, 4, nullptr, nullptr), 0);
-  return nullptr;
-}
-
-static void GetThreads(pid_t pid, std::vector<pid_t>* threads) {
-  // Get the list of tasks.
-  char task_path[128];
-  snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid);
-
-  std::unique_ptr<DIR, decltype(&closedir)> tasks_dir(opendir(task_path), closedir);
-  ASSERT_TRUE(tasks_dir != nullptr);
-  struct dirent* entry;
-  while ((entry = readdir(tasks_dir.get())) != nullptr) {
-    char* end;
-    pid_t tid = strtoul(entry->d_name, &end, 10);
-    if (*end == '\0') {
-      threads->push_back(tid);
-    }
-  }
-}
-
-TEST_F(BacktraceTest, ptrace_threads) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    for (size_t i = 0; i < NUM_PTRACE_THREADS; i++) {
-      pthread_attr_t attr;
-      pthread_attr_init(&attr);
-      pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
-      pthread_t thread;
-      ASSERT_TRUE(pthread_create(&thread, &attr, PtraceThreadLevelRun, nullptr) == 0);
-    }
-    ASSERT_NE(test_level_one_(1, 2, 3, 4, nullptr, nullptr), 0);
-    _exit(1);
-  }
-
-  // Check to see that all of the threads are running before unwinding.
-  std::vector<pid_t> threads;
-  uint64_t start = NanoTime();
-  do {
-    usleep(US_PER_MSEC);
-    threads.clear();
-    GetThreads(pid, &threads);
-  } while ((threads.size() != NUM_PTRACE_THREADS + 1) &&
-      ((NanoTime() - start) <= 5 * NS_PER_SEC));
-  ASSERT_EQ(threads.size(), static_cast<size_t>(NUM_PTRACE_THREADS + 1));
-
-  ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0);
-  WaitForStop(pid);
-  for (std::vector<int>::const_iterator it = threads.begin(); it != threads.end(); ++it) {
-    // Skip the current forked process, we only care about the threads.
-    if (pid == *it) {
-      continue;
-    }
-    VerifyProcTest(pid, *it, ReadyLevelBacktrace, VerifyLevelDump, Backtrace::Create,
-                   BacktraceMap::Create);
-  }
-
-  FinishRemoteProcess(pid);
-}
-
-void VerifyLevelThread(void*) {
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), android::base::GetThreadId()));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-  VerifyLevelDump(backtrace.get());
-}
-
-TEST_F(BacktraceTest, thread_current_level) {
-  ASSERT_NE(test_level_one_(1, 2, 3, 4, VerifyLevelThread, nullptr), 0);
-}
-
-static void VerifyMaxThread(void*) {
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), android::base::GetThreadId()));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  ASSERT_EQ(BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT, backtrace->GetError().error_code);
-
-  VerifyMaxDump(backtrace.get());
-}
-
-TEST_F(BacktraceTest, thread_current_max) {
-  ASSERT_NE(test_recursive_call_(MAX_BACKTRACE_FRAMES + 10, VerifyMaxThread, nullptr), 0);
-}
-
-static void* ThreadLevelRun(void* data) {
-  thread_t* thread = reinterpret_cast<thread_t*>(data);
-
-  thread->tid = android::base::GetThreadId();
-  EXPECT_NE(BacktraceTest::test_level_one_(1, 2, 3, 4, ThreadSetState, data), 0);
-  return nullptr;
-}
-
-TEST_F(BacktraceTest, thread_level_trace) {
-  pthread_attr_t attr;
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
-  thread_t thread_data = { 0, 0, 0, nullptr };
-  pthread_t thread;
-  ASSERT_TRUE(pthread_create(&thread, &attr, ThreadLevelRun, &thread_data) == 0);
-
-  // Wait up to 2 seconds for the tid to be set.
-  ASSERT_TRUE(WaitForNonZero(&thread_data.state, 2));
-
-  // Make sure that the thread signal used is not visible when compiled for
-  // the target.
-#if !defined(__GLIBC__)
-  ASSERT_LT(THREAD_SIGNAL, SIGRTMIN);
-#endif
-
-  // Save the current signal action and make sure it is restored afterwards.
-  struct sigaction cur_action;
-  ASSERT_TRUE(sigaction(THREAD_SIGNAL, nullptr, &cur_action) == 0);
-
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), thread_data.tid));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-  VerifyLevelDump(backtrace.get());
-
-  // Tell the thread to exit its infinite loop.
-  android_atomic_acquire_store(0, &thread_data.state);
-
-  // Verify that the old action was restored.
-  struct sigaction new_action;
-  ASSERT_TRUE(sigaction(THREAD_SIGNAL, nullptr, &new_action) == 0);
-  EXPECT_EQ(cur_action.sa_sigaction, new_action.sa_sigaction);
-  // The SA_RESTORER flag gets set behind our back, so a direct comparison
-  // doesn't work unless we mask the value off. Mips doesn't have this
-  // flag, so skip this on that platform.
-#if defined(SA_RESTORER)
-  cur_action.sa_flags &= ~SA_RESTORER;
-  new_action.sa_flags &= ~SA_RESTORER;
-#elif defined(__GLIBC__)
-  // Our host compiler doesn't appear to define this flag for some reason.
-  cur_action.sa_flags &= ~0x04000000;
-  new_action.sa_flags &= ~0x04000000;
-#endif
-  EXPECT_EQ(cur_action.sa_flags, new_action.sa_flags);
-}
-
-TEST_F(BacktraceTest, thread_ignore_frames) {
-  pthread_attr_t attr;
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
-  thread_t thread_data = { 0, 0, 0, nullptr };
-  pthread_t thread;
-  ASSERT_TRUE(pthread_create(&thread, &attr, ThreadLevelRun, &thread_data) == 0);
-
-  // Wait up to 2 seconds for the tid to be set.
-  ASSERT_TRUE(WaitForNonZero(&thread_data.state, 2));
-
-  std::unique_ptr<Backtrace> all(Backtrace::Create(getpid(), thread_data.tid));
-  ASSERT_TRUE(all.get() != nullptr);
-  ASSERT_TRUE(all->Unwind(0));
-  VERIFY_NO_ERROR(all->GetError().error_code);
-
-  std::unique_ptr<Backtrace> ign1(Backtrace::Create(getpid(), thread_data.tid));
-  ASSERT_TRUE(ign1.get() != nullptr);
-  ASSERT_TRUE(ign1->Unwind(1));
-  VERIFY_NO_ERROR(ign1->GetError().error_code);
-
-  std::unique_ptr<Backtrace> ign2(Backtrace::Create(getpid(), thread_data.tid));
-  ASSERT_TRUE(ign2.get() != nullptr);
-  ASSERT_TRUE(ign2->Unwind(2));
-  VERIFY_NO_ERROR(ign2->GetError().error_code);
-
-  VerifyIgnoreFrames(all.get(), ign1.get(), ign2.get(), nullptr);
-
-  // Tell the thread to exit its infinite loop.
-  android_atomic_acquire_store(0, &thread_data.state);
-}
-
-static void* ThreadMaxRun(void* data) {
-  thread_t* thread = reinterpret_cast<thread_t*>(data);
-
-  thread->tid = android::base::GetThreadId();
-  EXPECT_NE(BacktraceTest::test_recursive_call_(MAX_BACKTRACE_FRAMES + 10, ThreadSetState, data),
-            0);
-  return nullptr;
-}
-
-TEST_F(BacktraceTest, thread_max_trace) {
-  pthread_attr_t attr;
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
-  thread_t thread_data = { 0, 0, 0, nullptr };
-  pthread_t thread;
-  ASSERT_TRUE(pthread_create(&thread, &attr, ThreadMaxRun, &thread_data) == 0);
-
-  // Wait for the tid to be set.
-  ASSERT_TRUE(WaitForNonZero(&thread_data.state, 2));
-
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), thread_data.tid));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  ASSERT_EQ(BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT, backtrace->GetError().error_code);
-
-  VerifyMaxDump(backtrace.get());
-
-  // Tell the thread to exit its infinite loop.
-  android_atomic_acquire_store(0, &thread_data.state);
-}
-
-static void* ThreadDump(void* data) {
-  dump_thread_t* dump = reinterpret_cast<dump_thread_t*>(data);
-  while (true) {
-    if (android_atomic_acquire_load(dump->now)) {
-      break;
-    }
-  }
-
-  // The status of the actual unwind will be checked elsewhere.
-  dump->backtrace = Backtrace::Create(getpid(), dump->thread.tid, dump->map);
-  dump->backtrace->Unwind(0);
-
-  android_atomic_acquire_store(1, &dump->done);
-
-  return nullptr;
-}
-
-static void MultipleThreadDumpTest(bool share_map) {
-  // Dump NUM_THREADS simultaneously using the same map.
-  std::vector<thread_t> runners(NUM_THREADS);
-  std::vector<dump_thread_t> dumpers(NUM_THREADS);
-
-  pthread_attr_t attr;
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-  for (size_t i = 0; i < NUM_THREADS; i++) {
-    // Launch the runners, they will spin in hard loops doing nothing.
-    runners[i].tid = 0;
-    runners[i].state = 0;
-    ASSERT_TRUE(pthread_create(&runners[i].threadId, &attr, ThreadMaxRun, &runners[i]) == 0);
-  }
-
-  // Wait for tids to be set.
-  for (std::vector<thread_t>::iterator it = runners.begin(); it != runners.end(); ++it) {
-    ASSERT_TRUE(WaitForNonZero(&it->state, 30));
-  }
-
-  // Start all of the dumpers at once, they will spin until they are signalled
-  // to begin their dump run.
-  std::unique_ptr<BacktraceMap> map;
-  if (share_map) {
-    map.reset(BacktraceMap::Create(getpid()));
-  }
-  int32_t dump_now = 0;
-  for (size_t i = 0; i < NUM_THREADS; i++) {
-    dumpers[i].thread.tid = runners[i].tid;
-    dumpers[i].thread.state = 0;
-    dumpers[i].done = 0;
-    dumpers[i].now = &dump_now;
-    dumpers[i].map = map.get();
-
-    ASSERT_TRUE(pthread_create(&dumpers[i].thread.threadId, &attr, ThreadDump, &dumpers[i]) == 0);
-  }
-
-  // Start all of the dumpers going at once.
-  android_atomic_acquire_store(1, &dump_now);
-
-  for (size_t i = 0; i < NUM_THREADS; i++) {
-    ASSERT_TRUE(WaitForNonZero(&dumpers[i].done, 30));
-
-    // Tell the runner thread to exit its infinite loop.
-    android_atomic_acquire_store(0, &runners[i].state);
-
-    ASSERT_TRUE(dumpers[i].backtrace != nullptr);
-    VerifyMaxDump(dumpers[i].backtrace);
-
-    delete dumpers[i].backtrace;
-    dumpers[i].backtrace = nullptr;
-  }
-}
-
-TEST_F(BacktraceTest, thread_multiple_dump) {
-  MultipleThreadDumpTest(false);
-}
-
-TEST_F(BacktraceTest, thread_multiple_dump_same_map) {
-  MultipleThreadDumpTest(true);
-}
-
-// This test is for UnwindMaps that should share the same map cursor when
-// multiple maps are created for the current process at the same time.
-TEST_F(BacktraceTest, simultaneous_maps) {
-  BacktraceMap* map1 = BacktraceMap::Create(getpid());
-  BacktraceMap* map2 = BacktraceMap::Create(getpid());
-  BacktraceMap* map3 = BacktraceMap::Create(getpid());
-
-  Backtrace* back1 = Backtrace::Create(getpid(), BACKTRACE_CURRENT_THREAD, map1);
-  ASSERT_TRUE(back1 != nullptr);
-  EXPECT_TRUE(back1->Unwind(0));
-  VERIFY_NO_ERROR(back1->GetError().error_code);
-  delete back1;
-  delete map1;
-
-  Backtrace* back2 = Backtrace::Create(getpid(), BACKTRACE_CURRENT_THREAD, map2);
-  ASSERT_TRUE(back2 != nullptr);
-  EXPECT_TRUE(back2->Unwind(0));
-  VERIFY_NO_ERROR(back2->GetError().error_code);
-  delete back2;
-  delete map2;
-
-  Backtrace* back3 = Backtrace::Create(getpid(), BACKTRACE_CURRENT_THREAD, map3);
-  ASSERT_TRUE(back3 != nullptr);
-  EXPECT_TRUE(back3->Unwind(0));
-  VERIFY_NO_ERROR(back3->GetError().error_code);
-  delete back3;
-  delete map3;
-}
-
-TEST_F(BacktraceTest, fillin_erases) {
-  BacktraceMap* back_map = BacktraceMap::Create(getpid());
-
-  backtrace_map_t map;
-
-  map.start = 1;
-  map.end = 3;
-  map.flags = 1;
-  map.name = "Initialized";
-  back_map->FillIn(0, &map);
-  delete back_map;
-
-  ASSERT_FALSE(BacktraceMap::IsValid(map));
-  ASSERT_EQ(static_cast<uint64_t>(0), map.start);
-  ASSERT_EQ(static_cast<uint64_t>(0), map.end);
-  ASSERT_EQ(0, map.flags);
-  ASSERT_EQ("", map.name);
-}
-
-TEST_F(BacktraceTest, format_test) {
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-
-  backtrace_frame_data_t frame;
-  frame.num = 1;
-  frame.pc = 2;
-  frame.rel_pc = 2;
-  frame.sp = 0;
-  frame.stack_size = 0;
-  frame.func_offset = 0;
-
-  // Check no map set.
-  frame.num = 1;
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 0000000000000002  <unknown>",
-#else
-  EXPECT_EQ("#01 pc 00000002  <unknown>",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check map name empty, but exists.
-  frame.pc = 0xb0020;
-  frame.rel_pc = 0x20;
-  frame.map.start = 0xb0000;
-  frame.map.end = 0xbffff;
-  frame.map.load_bias = 0;
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 0000000000000020  <anonymous:00000000000b0000>",
-#else
-  EXPECT_EQ("#01 pc 00000020  <anonymous:000b0000>",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check map name begins with a [.
-  frame.pc = 0xc0020;
-  frame.map.start = 0xc0000;
-  frame.map.end = 0xcffff;
-  frame.map.load_bias = 0;
-  frame.map.name = "[anon:thread signal stack]";
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 0000000000000020  [anon:thread signal stack:00000000000c0000]",
-#else
-  EXPECT_EQ("#01 pc 00000020  [anon:thread signal stack:000c0000]",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check relative pc is set and map name is set.
-  frame.pc = 0x12345679;
-  frame.rel_pc = 0x12345678;
-  frame.map.name = "MapFake";
-  frame.map.start =  1;
-  frame.map.end =  1;
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 0000000012345678  MapFake",
-#else
-  EXPECT_EQ("#01 pc 12345678  MapFake",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check func_name is set, but no func offset.
-  frame.func_name = "ProcFake";
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 0000000012345678  MapFake (ProcFake)",
-#else
-  EXPECT_EQ("#01 pc 12345678  MapFake (ProcFake)",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check func_name is set, and func offset is non-zero.
-  frame.func_offset = 645;
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 0000000012345678  MapFake (ProcFake+645)",
-#else
-  EXPECT_EQ("#01 pc 12345678  MapFake (ProcFake+645)",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check func_name is set, func offset is non-zero, and load_bias is non-zero.
-  frame.rel_pc = 0x123456dc;
-  frame.func_offset = 645;
-  frame.map.load_bias = 100;
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 00000000123456dc  MapFake (ProcFake+645)",
-#else
-  EXPECT_EQ("#01 pc 123456dc  MapFake (ProcFake+645)",
-#endif
-            backtrace->FormatFrameData(&frame));
-
-  // Check a non-zero map offset.
-  frame.map.offset = 0x1000;
-#if defined(__LP64__)
-  EXPECT_EQ("#01 pc 00000000123456dc  MapFake (offset 0x1000) (ProcFake+645)",
-#else
-  EXPECT_EQ("#01 pc 123456dc  MapFake (offset 0x1000) (ProcFake+645)",
-#endif
-            backtrace->FormatFrameData(&frame));
-}
-
-struct map_test_t {
-  uint64_t start;
-  uint64_t end;
-};
-
-static bool map_sort(map_test_t i, map_test_t j) { return i.start < j.start; }
-
-static std::string GetTestMapsAsString(const std::vector<map_test_t>& maps) {
-  if (maps.size() == 0) {
-    return "No test map entries\n";
-  }
-  std::string map_txt;
-  for (auto map : maps) {
-    map_txt += android::base::StringPrintf("%" PRIx64 "-%" PRIx64 "\n", map.start, map.end);
-  }
-  return map_txt;
-}
-
-static std::string GetMapsAsString(BacktraceMap* maps) {
-  if (maps->size() == 0) {
-    return "No map entries\n";
-  }
-  std::string map_txt;
-  for (const backtrace_map_t* map : *maps) {
-    map_txt += android::base::StringPrintf(
-        "%" PRIx64 "-%" PRIx64 " flags: 0x%x offset: 0x%" PRIx64 " load_bias: 0x%" PRIx64,
-        map->start, map->end, map->flags, map->offset, map->load_bias);
-    if (!map->name.empty()) {
-      map_txt += ' ' + map->name;
-    }
-    map_txt += '\n';
-  }
-  return map_txt;
-}
-
-static void VerifyMap(pid_t pid) {
-  char buffer[4096];
-  snprintf(buffer, sizeof(buffer), "/proc/%d/maps", pid);
-
-  FILE* map_file = fopen(buffer, "r");
-  ASSERT_TRUE(map_file != nullptr);
-  std::vector<map_test_t> test_maps;
-  while (fgets(buffer, sizeof(buffer), map_file)) {
-    map_test_t map;
-    ASSERT_EQ(2, sscanf(buffer, "%" SCNx64 "-%" SCNx64 " ", &map.start, &map.end));
-    test_maps.push_back(map);
-  }
-  fclose(map_file);
-  std::sort(test_maps.begin(), test_maps.end(), map_sort);
-
-  std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(pid));
-
-  // Basic test that verifies that the map is in the expected order.
-  auto test_it = test_maps.begin();
-  for (auto it = map->begin(); it != map->end(); ++it) {
-    ASSERT_TRUE(test_it != test_maps.end()) << "Mismatch in number of maps, expected test maps:\n"
-                                            << GetTestMapsAsString(test_maps) << "Actual maps:\n"
-                                            << GetMapsAsString(map.get());
-    ASSERT_EQ(test_it->start, (*it)->start) << "Mismatch in map data, expected test maps:\n"
-                                            << GetTestMapsAsString(test_maps) << "Actual maps:\n"
-                                            << GetMapsAsString(map.get());
-    ASSERT_EQ(test_it->end, (*it)->end) << "Mismatch maps in map data, expected test maps:\n"
-                                        << GetTestMapsAsString(test_maps) << "Actual maps:\n"
-                                        << GetMapsAsString(map.get());
-    // Make sure the load bias get set to a value.
-    ASSERT_NE(static_cast<uint64_t>(-1), (*it)->load_bias) << "Found uninitialized load_bias\n"
-                                                           << GetMapsAsString(map.get());
-    ++test_it;
-  }
-  ASSERT_TRUE(test_it == test_maps.end());
-}
-
-TEST_F(BacktraceTest, verify_map_remote) {
-  pid_t pid;
-  CreateRemoteProcess(&pid);
-
-  // The maps should match exactly since the forked process has been paused.
-  VerifyMap(pid);
-
-  FinishRemoteProcess(pid);
-}
-
-static void InitMemory(uint8_t* memory, size_t bytes) {
-  for (size_t i = 0; i < bytes; i++) {
-    memory[i] = i;
-    if (memory[i] == '\0') {
-      // Don't use '\0' in our data so we can verify that an overread doesn't
-      // occur by using a '\0' as the character after the read data.
-      memory[i] = 23;
-    }
-  }
-}
-
-static void* ThreadReadTest(void* data) {
-  thread_t* thread_data = reinterpret_cast<thread_t*>(data);
-
-  thread_data->tid = android::base::GetThreadId();
-
-  // Create two map pages.
-  // Mark the second page as not-readable.
-  size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE));
-  uint8_t* memory;
-  if (posix_memalign(reinterpret_cast<void**>(&memory), pagesize, 2 * pagesize) != 0) {
-    return reinterpret_cast<void*>(-1);
-  }
-
-  if (mprotect(&memory[pagesize], pagesize, PROT_NONE) != 0) {
-    return reinterpret_cast<void*>(-1);
-  }
-
-  // Set up a simple pattern in memory.
-  InitMemory(memory, pagesize);
-
-  thread_data->data = memory;
-
-  // Tell the caller it's okay to start reading memory.
-  android_atomic_acquire_store(1, &thread_data->state);
-
-  // Loop waiting for the caller to finish reading the memory.
-  while (thread_data->state) {
-  }
-
-  // Re-enable read-write on the page so that we don't crash if we try
-  // and access data on this page when freeing the memory.
-  if (mprotect(&memory[pagesize], pagesize, PROT_READ | PROT_WRITE) != 0) {
-    return reinterpret_cast<void*>(-1);
-  }
-  free(memory);
-
-  android_atomic_acquire_store(1, &thread_data->state);
-
-  return nullptr;
-}
-
-static void RunReadTest(Backtrace* backtrace, uint64_t read_addr) {
-  size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE));
-
-  // Create a page of data to use to do quick compares.
-  uint8_t* expected = new uint8_t[pagesize];
-  InitMemory(expected, pagesize);
-
-  uint8_t* data = new uint8_t[2 * pagesize];
-  // Verify that we can only read one page worth of data.
-  size_t bytes_read = backtrace->Read(read_addr, data, 2 * pagesize);
-  ASSERT_EQ(pagesize, bytes_read);
-  ASSERT_TRUE(memcmp(data, expected, pagesize) == 0);
-
-  // Verify unaligned reads.
-  for (size_t i = 1; i < sizeof(word_t); i++) {
-    bytes_read = backtrace->Read(read_addr + i, data, 2 * sizeof(word_t));
-    ASSERT_EQ(2 * sizeof(word_t), bytes_read);
-    ASSERT_TRUE(memcmp(data, &expected[i], 2 * sizeof(word_t)) == 0)
-        << "Offset at " << i << " failed";
-  }
-
-  // Verify small unaligned reads.
-  for (size_t i = 1; i < sizeof(word_t); i++) {
-    for (size_t j = 1; j < sizeof(word_t); j++) {
-      // Set one byte past what we expect to read, to guarantee we don't overread.
-      data[j] = '\0';
-      bytes_read = backtrace->Read(read_addr + i, data, j);
-      ASSERT_EQ(j, bytes_read);
-      ASSERT_TRUE(memcmp(data, &expected[i], j) == 0)
-          << "Offset at " << i << " length " << j << " miscompared";
-      ASSERT_EQ('\0', data[j])
-          << "Offset at " << i << " length " << j << " wrote too much data";
-    }
-  }
-  delete[] data;
-  delete[] expected;
-}
-
-TEST_F(BacktraceTest, thread_read) {
-  pthread_attr_t attr;
-  pthread_attr_init(&attr);
-  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-  pthread_t thread;
-  thread_t thread_data = { 0, 0, 0, nullptr };
-  ASSERT_TRUE(pthread_create(&thread, &attr, ThreadReadTest, &thread_data) == 0);
-
-  ASSERT_TRUE(WaitForNonZero(&thread_data.state, 10));
-
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), thread_data.tid));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-
-  RunReadTest(backtrace.get(), reinterpret_cast<uint64_t>(thread_data.data));
-
-  android_atomic_acquire_store(0, &thread_data.state);
-
-  ASSERT_TRUE(WaitForNonZero(&thread_data.state, 10));
-}
-
-// The code requires these variables are the same size.
-volatile uint64_t g_ready = 0;
-volatile uint64_t g_addr = 0;
-static_assert(sizeof(g_ready) == sizeof(g_addr), "g_ready/g_addr must be same size");
-
-static void ForkedReadTest() {
-  // Create two map pages.
-  size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE));
-  uint8_t* memory;
-  if (posix_memalign(reinterpret_cast<void**>(&memory), pagesize, 2 * pagesize) != 0) {
-    perror("Failed to allocate memory\n");
-    exit(1);
-  }
-
-  // Mark the second page as not-readable.
-  if (mprotect(&memory[pagesize], pagesize, PROT_NONE) != 0) {
-    perror("Failed to mprotect memory\n");
-    exit(1);
-  }
-
-  // Set up a simple pattern in memory.
-  InitMemory(memory, pagesize);
-
-  g_addr = reinterpret_cast<uint64_t>(memory);
-  g_ready = 1;
-
-  while (1) {
-    usleep(US_PER_MSEC);
-  }
-}
-
-TEST_F(BacktraceTest, process_read) {
-  g_ready = 0;
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    ForkedReadTest();
-    exit(0);
-  }
-  ASSERT_NE(-1, pid);
-
-  bool test_executed = false;
-  uint64_t start = NanoTime();
-  while (1) {
-    if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) {
-      WaitForStop(pid);
-
-      std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid));
-      ASSERT_TRUE(backtrace.get() != nullptr);
-
-      uint64_t read_addr;
-      size_t bytes_read = backtrace->Read(reinterpret_cast<uint64_t>(&g_ready),
-                                          reinterpret_cast<uint8_t*>(&read_addr), sizeof(g_ready));
-      ASSERT_EQ(sizeof(g_ready), bytes_read);
-      if (read_addr) {
-        // The forked process is ready to be read.
-        bytes_read = backtrace->Read(reinterpret_cast<uint64_t>(&g_addr),
-                                     reinterpret_cast<uint8_t*>(&read_addr), sizeof(g_addr));
-        ASSERT_EQ(sizeof(g_addr), bytes_read);
-
-        RunReadTest(backtrace.get(), read_addr);
-
-        test_executed = true;
-        break;
-      }
-      ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0);
-    }
-    if ((NanoTime() - start) > 5 * NS_PER_SEC) {
-      break;
-    }
-    usleep(US_PER_MSEC);
-  }
-  kill(pid, SIGKILL);
-  ASSERT_EQ(waitpid(pid, nullptr, 0), pid);
-
-  ASSERT_TRUE(test_executed);
-}
-
-static void VerifyFunctionsFound(const std::vector<std::string>& found_functions) {
-  // We expect to find these functions in libbacktrace_test. If we don't
-  // find them, that's a bug in the memory read handling code in libunwind.
-  std::list<std::string> expected_functions;
-  expected_functions.push_back("test_recursive_call");
-  expected_functions.push_back("test_level_one");
-  expected_functions.push_back("test_level_two");
-  expected_functions.push_back("test_level_three");
-  expected_functions.push_back("test_level_four");
-  for (const auto& found_function : found_functions) {
-    for (const auto& expected_function : expected_functions) {
-      if (found_function == expected_function) {
-        expected_functions.remove(found_function);
-        break;
-      }
-    }
-  }
-  ASSERT_TRUE(expected_functions.empty()) << "Not all functions found in shared library.";
-}
-
-static void CopySharedLibrary(const char* tmp_dir, std::string* tmp_so_name) {
-  std::string test_lib(testing::internal::GetArgvs()[0]);
-  auto const value = test_lib.find_last_of('/');
-  if (value == std::string::npos) {
-    test_lib = "../backtrace_test_libs/";
-  } else {
-    test_lib = test_lib.substr(0, value + 1) + "../backtrace_test_libs/";
-  }
-  test_lib += "libbacktrace_test.so";
-
-  *tmp_so_name = std::string(tmp_dir) + "/libbacktrace_test.so";
-  std::string cp_cmd = android::base::StringPrintf("cp %s %s", test_lib.c_str(), tmp_dir);
-
-  // Copy the shared so to a tempory directory.
-  ASSERT_EQ(0, system(cp_cmd.c_str()));
-}
-
-TEST_F(BacktraceTest, check_unreadable_elf_local) {
-  TemporaryDir td;
-  std::string tmp_so_name;
-  ASSERT_NO_FATAL_FAILURE(CopySharedLibrary(td.path, &tmp_so_name));
-
-  struct stat buf;
-  ASSERT_TRUE(stat(tmp_so_name.c_str(), &buf) != -1);
-  uint64_t map_size = buf.st_size;
-
-  int fd = open(tmp_so_name.c_str(), O_RDONLY);
-  ASSERT_TRUE(fd != -1);
-
-  void* map = mmap(nullptr, map_size, PROT_READ | PROT_EXEC, MAP_PRIVATE, fd, 0);
-  ASSERT_TRUE(map != MAP_FAILED);
-  close(fd);
-  ASSERT_TRUE(unlink(tmp_so_name.c_str()) != -1);
-
-  std::vector<std::string> found_functions;
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS,
-                                                         BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-
-  // Needed before GetFunctionName will work.
-  backtrace->Unwind(0);
-
-  // Loop through the entire map, and get every function we can find.
-  map_size += reinterpret_cast<uint64_t>(map);
-  std::string last_func;
-  for (uint64_t read_addr = reinterpret_cast<uint64_t>(map); read_addr < map_size; read_addr += 4) {
-    uint64_t offset;
-    std::string func_name = backtrace->GetFunctionName(read_addr, &offset);
-    if (!func_name.empty() && last_func != func_name) {
-      found_functions.push_back(func_name);
-    }
-    last_func = func_name;
-  }
-
-  ASSERT_TRUE(munmap(map, map_size - reinterpret_cast<uint64_t>(map)) == 0);
-
-  VerifyFunctionsFound(found_functions);
-}
-
-TEST_F(BacktraceTest, check_unreadable_elf_remote) {
-  TemporaryDir td;
-  std::string tmp_so_name;
-  ASSERT_NO_FATAL_FAILURE(CopySharedLibrary(td.path, &tmp_so_name));
-
-  g_ready = 0;
-
-  struct stat buf;
-  ASSERT_TRUE(stat(tmp_so_name.c_str(), &buf) != -1);
-  uint64_t map_size = buf.st_size;
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    int fd = open(tmp_so_name.c_str(), O_RDONLY);
-    if (fd == -1) {
-      fprintf(stderr, "Failed to open file %s: %s\n", tmp_so_name.c_str(), strerror(errno));
-      unlink(tmp_so_name.c_str());
-      exit(0);
-    }
-
-    void* map = mmap(nullptr, map_size, PROT_READ | PROT_EXEC, MAP_PRIVATE, fd, 0);
-    if (map == MAP_FAILED) {
-      fprintf(stderr, "Failed to map in memory: %s\n", strerror(errno));
-      unlink(tmp_so_name.c_str());
-      exit(0);
-    }
-    close(fd);
-    if (unlink(tmp_so_name.c_str()) == -1) {
-      fprintf(stderr, "Failed to unlink: %s\n", strerror(errno));
-      exit(0);
-    }
-
-    g_addr = reinterpret_cast<uint64_t>(map);
-    g_ready = 1;
-    while (true) {
-      usleep(US_PER_MSEC);
-    }
-    exit(0);
-  }
-  ASSERT_TRUE(pid > 0);
-
-  std::vector<std::string> found_functions;
-  uint64_t start = NanoTime();
-  while (true) {
-    ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0);
-
-    // Wait for the process to get to a stopping point.
-    WaitForStop(pid);
-
-    std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD));
-    ASSERT_TRUE(backtrace.get() != nullptr);
-
-    uint64_t read_addr;
-    ASSERT_EQ(sizeof(g_ready),
-              backtrace->Read(reinterpret_cast<uint64_t>(&g_ready),
-                              reinterpret_cast<uint8_t*>(&read_addr), sizeof(g_ready)));
-    if (read_addr) {
-      ASSERT_EQ(sizeof(g_addr),
-                backtrace->Read(reinterpret_cast<uint64_t>(&g_addr),
-                                reinterpret_cast<uint8_t*>(&read_addr), sizeof(uint64_t)));
-
-      // Needed before GetFunctionName will work.
-      backtrace->Unwind(0);
-
-      // Loop through the entire map, and get every function we can find.
-      map_size += read_addr;
-      std::string last_func;
-      for (; read_addr < map_size; read_addr += 4) {
-        uint64_t offset;
-        std::string func_name = backtrace->GetFunctionName(read_addr, &offset);
-        if (!func_name.empty() && last_func != func_name) {
-          found_functions.push_back(func_name);
-        }
-        last_func = func_name;
-      }
-      break;
-    }
-    ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0);
-
-    if ((NanoTime() - start) > 5 * NS_PER_SEC) {
-      break;
-    }
-    usleep(US_PER_MSEC);
-  }
-
-  kill(pid, SIGKILL);
-  ASSERT_EQ(waitpid(pid, nullptr, 0), pid);
-
-  VerifyFunctionsFound(found_functions);
-}
-
-static bool FindFuncFrameInBacktrace(Backtrace* backtrace, uint64_t test_func, size_t* frame_num) {
-  backtrace_map_t map;
-  backtrace->FillInMap(test_func, &map);
-  if (!BacktraceMap::IsValid(map)) {
-    return false;
-  }
-
-  // Loop through the frames, and find the one that is in the map.
-  *frame_num = 0;
-  for (Backtrace::const_iterator it = backtrace->begin(); it != backtrace->end(); ++it) {
-    if (BacktraceMap::IsValid(it->map) && map.start == it->map.start &&
-        it->pc >= test_func) {
-      *frame_num = it->num;
-      return true;
-    }
-  }
-  return false;
-}
-
-static void VerifyUnreadableElfFrame(Backtrace* backtrace, uint64_t test_func, size_t frame_num) {
-  ASSERT_LT(backtrace->NumFrames(), static_cast<size_t>(MAX_BACKTRACE_FRAMES))
-    << DumpFrames(backtrace);
-
-  ASSERT_TRUE(frame_num != 0) << DumpFrames(backtrace);
-  // Make sure that there is at least one more frame above the test func call.
-  ASSERT_LT(frame_num, backtrace->NumFrames()) << DumpFrames(backtrace);
-
-  uint64_t diff = backtrace->GetFrame(frame_num)->pc - test_func;
-  ASSERT_LT(diff, 200U) << DumpFrames(backtrace);
-}
-
-static void VerifyUnreadableElfBacktrace(void* func) {
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS,
-                                                         BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_TRUE(backtrace->Unwind(0));
-  VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-  size_t frame_num;
-  uint64_t test_func = reinterpret_cast<uint64_t>(func);
-  ASSERT_TRUE(FindFuncFrameInBacktrace(backtrace.get(), test_func, &frame_num))
-      << DumpFrames(backtrace.get());
-
-  VerifyUnreadableElfFrame(backtrace.get(), test_func, frame_num);
-}
-
-typedef int (*test_func_t)(int, int, int, int, void (*)(void*), void*);
-
-TEST_F(BacktraceTest, unwind_through_unreadable_elf_local) {
-  TemporaryDir td;
-  std::string tmp_so_name;
-  ASSERT_NO_FATAL_FAILURE(CopySharedLibrary(td.path, &tmp_so_name));
-
-  void* lib_handle = dlopen(tmp_so_name.c_str(), RTLD_NOW);
-  ASSERT_TRUE(lib_handle != nullptr);
-  ASSERT_TRUE(unlink(tmp_so_name.c_str()) != -1);
-
-  test_func_t test_func;
-  test_func = reinterpret_cast<test_func_t>(dlsym(lib_handle, "test_level_one"));
-  ASSERT_TRUE(test_func != nullptr);
-
-  ASSERT_NE(test_func(1, 2, 3, 4, VerifyUnreadableElfBacktrace, reinterpret_cast<void*>(test_func)),
-            0);
-}
-
-TEST_F(BacktraceTest, unwind_through_unreadable_elf_remote) {
-  TemporaryDir td;
-  std::string tmp_so_name;
-  ASSERT_NO_FATAL_FAILURE(CopySharedLibrary(td.path, &tmp_so_name));
-
-  void* lib_handle = dlopen(tmp_so_name.c_str(), RTLD_NOW);
-  ASSERT_TRUE(lib_handle != nullptr);
-  ASSERT_TRUE(unlink(tmp_so_name.c_str()) != -1);
-
-  test_func_t test_func;
-  test_func = reinterpret_cast<test_func_t>(dlsym(lib_handle, "test_level_one"));
-  ASSERT_TRUE(test_func != nullptr);
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    test_func(1, 2, 3, 4, 0, 0);
-    exit(0);
-  }
-  ASSERT_TRUE(pid > 0);
-
-  uint64_t start = NanoTime();
-  bool done = false;
-  while (!done) {
-    ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0);
-
-    // Wait for the process to get to a stopping point.
-    WaitForStop(pid);
-
-    std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD));
-    ASSERT_TRUE(backtrace.get() != nullptr);
-    ASSERT_TRUE(backtrace->Unwind(0));
-    VERIFY_NO_ERROR(backtrace->GetError().error_code);
-
-    size_t frame_num;
-    if (FindFuncFrameInBacktrace(backtrace.get(), reinterpret_cast<uint64_t>(test_func),
-                                 &frame_num) &&
-        frame_num != 0) {
-      VerifyUnreadableElfFrame(backtrace.get(), reinterpret_cast<uint64_t>(test_func), frame_num);
-      done = true;
-    }
-
-    ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0);
-
-    if ((NanoTime() - start) > 5 * NS_PER_SEC) {
-      break;
-    }
-    usleep(US_PER_MSEC);
-  }
-
-  kill(pid, SIGKILL);
-  ASSERT_EQ(waitpid(pid, nullptr, 0), pid);
-
-  ASSERT_TRUE(done) << "Test function never found in unwind.";
-}
-
-TEST_F(BacktraceTest, unwind_thread_doesnt_exist) {
-  std::unique_ptr<Backtrace> backtrace(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, 99999999));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-  ASSERT_FALSE(backtrace->Unwind(0));
-  ASSERT_EQ(BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST, backtrace->GetError().error_code);
-}
-
-TEST_F(BacktraceTest, local_get_function_name_before_unwind) {
-  std::unique_ptr<Backtrace> backtrace(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace.get() != nullptr);
-
-  // Verify that trying to get a function name before doing an unwind works.
-  uint64_t cur_func_offset = reinterpret_cast<uint64_t>(test_level_one_) + 1;
-  uint64_t offset;
-  ASSERT_NE(std::string(""), backtrace->GetFunctionName(cur_func_offset, &offset));
-}
-
-TEST_F(BacktraceTest, remote_get_function_name_before_unwind) {
-  pid_t pid;
-  CreateRemoteProcess(&pid);
-
-  // Now create an unwind object.
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid));
-
-  // Verify that trying to get a function name before doing an unwind works.
-  uint64_t cur_func_offset = reinterpret_cast<uint64_t>(test_level_one_) + 1;
-  uint64_t offset;
-  ASSERT_NE(std::string(""), backtrace->GetFunctionName(cur_func_offset, &offset));
-
-  FinishRemoteProcess(pid);
-}
-
-static void SetUcontextSp(uint64_t sp, ucontext_t* ucontext) {
-#if defined(__arm__)
-  ucontext->uc_mcontext.arm_sp = sp;
-#elif defined(__aarch64__)
-  ucontext->uc_mcontext.sp = sp;
-#elif defined(__i386__)
-  ucontext->uc_mcontext.gregs[REG_ESP] = sp;
-#elif defined(__x86_64__)
-  ucontext->uc_mcontext.gregs[REG_RSP] = sp;
-#else
-  UNUSED(sp);
-  UNUSED(ucontext);
-  ASSERT_TRUE(false) << "Unsupported architecture";
-#endif
-}
-
-static void SetUcontextPc(uint64_t pc, ucontext_t* ucontext) {
-#if defined(__arm__)
-  ucontext->uc_mcontext.arm_pc = pc;
-#elif defined(__aarch64__)
-  ucontext->uc_mcontext.pc = pc;
-#elif defined(__i386__)
-  ucontext->uc_mcontext.gregs[REG_EIP] = pc;
-#elif defined(__x86_64__)
-  ucontext->uc_mcontext.gregs[REG_RIP] = pc;
-#else
-  UNUSED(pc);
-  UNUSED(ucontext);
-  ASSERT_TRUE(false) << "Unsupported architecture";
-#endif
-}
-
-static void SetUcontextLr(uint64_t lr, ucontext_t* ucontext) {
-#if defined(__arm__)
-  ucontext->uc_mcontext.arm_lr = lr;
-#elif defined(__aarch64__)
-  ucontext->uc_mcontext.regs[30] = lr;
-#elif defined(__i386__)
-  // The lr is on the stack.
-  ASSERT_TRUE(lr != 0);
-  ASSERT_TRUE(ucontext != nullptr);
-#elif defined(__x86_64__)
-  // The lr is on the stack.
-  ASSERT_TRUE(lr != 0);
-  ASSERT_TRUE(ucontext != nullptr);
-#else
-  UNUSED(lr);
-  UNUSED(ucontext);
-  ASSERT_TRUE(false) << "Unsupported architecture";
-#endif
-}
-
-static constexpr size_t DEVICE_MAP_SIZE = 1024;
-
-static void SetupDeviceMap(void** device_map) {
-  // Make sure that anything in a device map will result in fails
-  // to read.
-  android::base::unique_fd device_fd(open("/dev/zero", O_RDONLY | O_CLOEXEC));
-
-  *device_map = mmap(nullptr, 1024, PROT_READ, MAP_PRIVATE, device_fd, 0);
-  ASSERT_TRUE(*device_map != MAP_FAILED);
-
-  // Make sure the map is readable.
-  ASSERT_EQ(0, reinterpret_cast<int*>(*device_map)[0]);
-}
-
-static void UnwindFromDevice(Backtrace* backtrace, void* device_map) {
-  uint64_t device_map_uint = reinterpret_cast<uint64_t>(device_map);
-
-  backtrace_map_t map;
-  backtrace->FillInMap(device_map_uint, &map);
-  // Verify the flag is set.
-  ASSERT_EQ(PROT_DEVICE_MAP, map.flags & PROT_DEVICE_MAP);
-
-  // Quick sanity checks.
-  uint64_t offset;
-  ASSERT_EQ(std::string(""), backtrace->GetFunctionName(device_map_uint, &offset));
-  ASSERT_EQ(std::string(""), backtrace->GetFunctionName(device_map_uint, &offset, &map));
-  ASSERT_EQ(std::string(""), backtrace->GetFunctionName(0, &offset));
-
-  uint64_t cur_func_offset = reinterpret_cast<uint64_t>(BacktraceTest::test_level_one_) + 1;
-  // Now verify the device map flag actually causes the function name to be empty.
-  backtrace->FillInMap(cur_func_offset, &map);
-  ASSERT_TRUE((map.flags & PROT_DEVICE_MAP) == 0);
-  ASSERT_NE(std::string(""), backtrace->GetFunctionName(cur_func_offset, &offset, &map));
-  map.flags |= PROT_DEVICE_MAP;
-  ASSERT_EQ(std::string(""), backtrace->GetFunctionName(cur_func_offset, &offset, &map));
-
-  ucontext_t ucontext;
-
-  // Create a context that has the pc in the device map, but the sp
-  // in a non-device map.
-  memset(&ucontext, 0, sizeof(ucontext));
-  SetUcontextSp(reinterpret_cast<uint64_t>(&ucontext), &ucontext);
-  SetUcontextPc(device_map_uint, &ucontext);
-  SetUcontextLr(cur_func_offset, &ucontext);
-
-  ASSERT_TRUE(backtrace->Unwind(0, &ucontext));
-
-  // The buffer should only be a single element.
-  ASSERT_EQ(1U, backtrace->NumFrames());
-  const backtrace_frame_data_t* frame = backtrace->GetFrame(0);
-  ASSERT_EQ(device_map_uint, frame->pc);
-  ASSERT_EQ(reinterpret_cast<uint64_t>(&ucontext), frame->sp);
-
-  // Check what happens when skipping the first frame.
-  ASSERT_TRUE(backtrace->Unwind(1, &ucontext));
-  ASSERT_EQ(0U, backtrace->NumFrames());
-
-  // Create a context that has the sp in the device map, but the pc
-  // in a non-device map.
-  memset(&ucontext, 0, sizeof(ucontext));
-  SetUcontextSp(device_map_uint, &ucontext);
-  SetUcontextPc(cur_func_offset, &ucontext);
-  SetUcontextLr(cur_func_offset, &ucontext);
-
-  ASSERT_TRUE(backtrace->Unwind(0, &ucontext));
-
-  // The buffer should only be a single element.
-  ASSERT_EQ(1U, backtrace->NumFrames());
-  frame = backtrace->GetFrame(0);
-  ASSERT_EQ(cur_func_offset, frame->pc);
-  ASSERT_EQ(device_map_uint, frame->sp);
-
-  // Check what happens when skipping the first frame.
-  ASSERT_TRUE(backtrace->Unwind(1, &ucontext));
-  ASSERT_EQ(0U, backtrace->NumFrames());
-}
-
-TEST_F(BacktraceTest, unwind_disallow_device_map_local) {
-  void* device_map;
-  SetupDeviceMap(&device_map);
-
-  // Now create an unwind object.
-  std::unique_ptr<Backtrace> backtrace(
-      Backtrace::Create(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD));
-  ASSERT_TRUE(backtrace);
-
-  UnwindFromDevice(backtrace.get(), device_map);
-
-  munmap(device_map, DEVICE_MAP_SIZE);
-}
-
-TEST_F(BacktraceTest, unwind_disallow_device_map_remote) {
-  void* device_map;
-  SetupDeviceMap(&device_map);
-
-  // Fork a process to do a remote backtrace.
-  pid_t pid;
-  CreateRemoteProcess(&pid);
-
-  // Now create an unwind object.
-  std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid));
-
-  UnwindFromDevice(backtrace.get(), device_map);
-
-  FinishRemoteProcess(pid);
-
-  munmap(device_map, DEVICE_MAP_SIZE);
-}
-
-class ScopedSignalHandler {
- public:
-  ScopedSignalHandler(int signal_number, void (*handler)(int)) : signal_number_(signal_number) {
-    memset(&action_, 0, sizeof(action_));
-    action_.sa_handler = handler;
-    sigaction(signal_number_, &action_, &old_action_);
-  }
-
-  ScopedSignalHandler(int signal_number, void (*action)(int, siginfo_t*, void*))
-      : signal_number_(signal_number) {
-    memset(&action_, 0, sizeof(action_));
-    action_.sa_flags = SA_SIGINFO;
-    action_.sa_sigaction = action;
-    sigaction(signal_number_, &action_, &old_action_);
-  }
-
-  ~ScopedSignalHandler() { sigaction(signal_number_, &old_action_, nullptr); }
-
- private:
-  struct sigaction action_;
-  struct sigaction old_action_;
-  const int signal_number_;
-};
-
-static void SetValueAndLoop(void* data) {
-  volatile int* value = reinterpret_cast<volatile int*>(data);
-
-  *value = 1;
-  for (volatile int i = 0;; i++)
-    ;
-}
-
-static void UnwindThroughSignal(bool use_action, create_func_t create_func,
-                                map_create_func_t map_create_func) {
-  volatile int value = 0;
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    if (use_action) {
-      ScopedSignalHandler ssh(SIGUSR1, BacktraceTest::test_signal_action_);
-
-      BacktraceTest::test_level_one_(1, 2, 3, 4, SetValueAndLoop, const_cast<int*>(&value));
-    } else {
-      ScopedSignalHandler ssh(SIGUSR1, BacktraceTest::test_signal_handler_);
-
-      BacktraceTest::test_level_one_(1, 2, 3, 4, SetValueAndLoop, const_cast<int*>(&value));
-    }
-  }
-  ASSERT_NE(-1, pid);
-
-  int read_value = 0;
-  uint64_t start = NanoTime();
-  while (read_value == 0) {
-    usleep(1000);
-
-    // Loop until the remote function gets into the final function.
-    ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0);
-
-    WaitForStop(pid);
-
-    std::unique_ptr<BacktraceMap> map(map_create_func(pid, false));
-    std::unique_ptr<Backtrace> backtrace(create_func(pid, pid, map.get()));
-
-    size_t bytes_read = backtrace->Read(reinterpret_cast<uint64_t>(const_cast<int*>(&value)),
-                                        reinterpret_cast<uint8_t*>(&read_value), sizeof(read_value));
-    ASSERT_EQ(sizeof(read_value), bytes_read);
-
-    ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0);
-
-    ASSERT_TRUE(NanoTime() - start < 5 * NS_PER_SEC)
-        << "Remote process did not execute far enough in 5 seconds.";
-  }
-
-  // Now need to send a signal to the remote process.
-  kill(pid, SIGUSR1);
-
-  // Wait for the process to get to the signal handler loop.
-  Backtrace::const_iterator frame_iter;
-  start = NanoTime();
-  std::unique_ptr<BacktraceMap> map;
-  std::unique_ptr<Backtrace> backtrace;
-  while (true) {
-    usleep(1000);
-
-    ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0);
-
-    WaitForStop(pid);
-
-    map.reset(map_create_func(pid, false));
-    ASSERT_TRUE(map.get() != nullptr);
-    backtrace.reset(create_func(pid, pid, map.get()));
-    ASSERT_TRUE(backtrace->Unwind(0));
-    bool found = false;
-    for (frame_iter = backtrace->begin(); frame_iter != backtrace->end(); ++frame_iter) {
-      if (frame_iter->func_name == "test_loop_forever") {
-        ++frame_iter;
-        found = true;
-        break;
-      }
-    }
-    if (found) {
-      break;
-    }
-
-    ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0);
-
-    ASSERT_TRUE(NanoTime() - start < 5 * NS_PER_SEC)
-        << "Remote process did not get in signal handler in 5 seconds." << std::endl
-        << DumpFrames(backtrace.get());
-  }
-
-  std::vector<std::string> names;
-  // Loop through the frames, and save the function names.
-  size_t frame = 0;
-  for (; frame_iter != backtrace->end(); ++frame_iter) {
-    if (frame_iter->func_name == "test_level_four") {
-      frame = names.size() + 1;
-    }
-    names.push_back(frame_iter->func_name);
-  }
-  ASSERT_NE(0U, frame) << "Unable to find test_level_four in backtrace" << std::endl
-                       << DumpFrames(backtrace.get());
-
-  // The expected order of the frames:
-  //   test_loop_forever
-  //   test_signal_handler|test_signal_action
-  //   <OPTIONAL_FRAME> May or may not exist.
-  //   SetValueAndLoop (but the function name might be empty)
-  //   test_level_four
-  //   test_level_three
-  //   test_level_two
-  //   test_level_one
-  ASSERT_LE(frame + 2, names.size()) << DumpFrames(backtrace.get());
-  ASSERT_LE(2U, frame) << DumpFrames(backtrace.get());
-  if (use_action) {
-    ASSERT_EQ("test_signal_action", names[0]) << DumpFrames(backtrace.get());
-  } else {
-    ASSERT_EQ("test_signal_handler", names[0]) << DumpFrames(backtrace.get());
-  }
-  ASSERT_EQ("test_level_three", names[frame]) << DumpFrames(backtrace.get());
-  ASSERT_EQ("test_level_two", names[frame + 1]) << DumpFrames(backtrace.get());
-  ASSERT_EQ("test_level_one", names[frame + 2]) << DumpFrames(backtrace.get());
-
-  FinishRemoteProcess(pid);
-}
-
-TEST_F(BacktraceTest, unwind_remote_through_signal_using_handler) {
-  UnwindThroughSignal(false, Backtrace::Create, BacktraceMap::Create);
-}
-
-TEST_F(BacktraceTest, unwind_remote_through_signal_using_action) {
-  UnwindThroughSignal(true, Backtrace::Create, BacktraceMap::Create);
-}
-
-static void TestFrameSkipNumbering(create_func_t create_func, map_create_func_t map_create_func) {
-  std::unique_ptr<BacktraceMap> map(map_create_func(getpid(), false));
-  std::unique_ptr<Backtrace> backtrace(
-      create_func(getpid(), android::base::GetThreadId(), map.get()));
-  backtrace->Unwind(1);
-  ASSERT_NE(0U, backtrace->NumFrames());
-  ASSERT_EQ(0U, backtrace->GetFrame(0)->num);
-}
-
-TEST_F(BacktraceTest, unwind_frame_skip_numbering) {
-  TestFrameSkipNumbering(Backtrace::Create, BacktraceMap::Create);
-}
-
-#define MAX_LEAK_BYTES (32*1024UL)
-
-static void CheckForLeak(pid_t pid, pid_t tid) {
-  std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(pid));
-
-  // Loop enough that even a small leak should be detectable.
-  size_t first_allocated_bytes = 0;
-  size_t last_allocated_bytes = 0;
-  for (size_t i = 0; i < 4096; i++) {
-    Backtrace* backtrace = Backtrace::Create(pid, tid, map.get());
-    ASSERT_TRUE(backtrace != nullptr);
-    ASSERT_TRUE(backtrace->Unwind(0));
-    VERIFY_NO_ERROR(backtrace->GetError().error_code);
-    delete backtrace;
-
-    size_t allocated_bytes = mallinfo().uordblks;
-    if (first_allocated_bytes == 0) {
-      first_allocated_bytes = allocated_bytes;
-    } else if (last_allocated_bytes > first_allocated_bytes) {
-      // Check that the memory did not increase too much over the first loop.
-      ASSERT_LE(last_allocated_bytes - first_allocated_bytes, MAX_LEAK_BYTES);
-    }
-    last_allocated_bytes = allocated_bytes;
-  }
-}
-
-TEST_F(BacktraceTest, check_for_leak_local) {
-  CheckForLeak(BACKTRACE_CURRENT_PROCESS, BACKTRACE_CURRENT_THREAD);
-}
-
-TEST_F(BacktraceTest, check_for_leak_local_thread) {
-  thread_t thread_data = { 0, 0, 0, nullptr };
-  pthread_t thread;
-  ASSERT_TRUE(pthread_create(&thread, nullptr, ThreadLevelRun, &thread_data) == 0);
-
-  // Wait up to 2 seconds for the tid to be set.
-  ASSERT_TRUE(WaitForNonZero(&thread_data.state, 2));
-
-  CheckForLeak(BACKTRACE_CURRENT_PROCESS, thread_data.tid);
-
-  // Tell the thread to exit its infinite loop.
-  android_atomic_acquire_store(0, &thread_data.state);
-
-  ASSERT_TRUE(pthread_join(thread, nullptr) == 0);
-}
-
-TEST_F(BacktraceTest, check_for_leak_remote) {
-  pid_t pid;
-  CreateRemoteProcess(&pid);
-
-  CheckForLeak(pid, BACKTRACE_CURRENT_THREAD);
-
-  FinishRemoteProcess(pid);
-}
diff --git a/libbacktrace/backtrace_testlib.cpp b/libbacktrace/backtrace_testlib.cpp
deleted file mode 100644
index fec7d98..0000000
--- a/libbacktrace/backtrace_testlib.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
-
-#include "backtrace_testlib.h"
-
-void test_loop_forever() {
-  while (1)
-    ;
-}
-
-void test_signal_handler(int) { test_loop_forever(); }
-
-void test_signal_action(int, siginfo_t*, void*) { test_loop_forever(); }
-
-int test_level_four(int one, int two, int three, int four, void (*callback_func)(void*),
-                    void* data) {
-  if (callback_func != NULL) {
-    callback_func(data);
-  } else {
-    while (1)
-      ;
-  }
-  return one + two + three + four;
-}
-
-int test_level_three(int one, int two, int three, int four, void (*callback_func)(void*),
-                     void* data) {
-  return test_level_four(one + 3, two + 6, three + 9, four + 12, callback_func, data) + 3;
-}
-
-int test_level_two(int one, int two, int three, int four, void (*callback_func)(void*), void* data) {
-  return test_level_three(one + 2, two + 4, three + 6, four + 8, callback_func, data) + 2;
-}
-
-int test_level_one(int one, int two, int three, int four, void (*callback_func)(void*), void* data) {
-  return test_level_two(one + 1, two + 2, three + 3, four + 4, callback_func, data) + 1;
-}
-
-int test_recursive_call(int level, void (*callback_func)(void*), void* data) {
-  if (level > 0) {
-    return test_recursive_call(level - 1, callback_func, data) + level;
-  } else if (callback_func != NULL) {
-    callback_func(data);
-  } else {
-    while (1) {
-    }
-  }
-  return 0;
-}
-
-typedef struct {
-  std::vector<uint8_t>* ucontext;
-  volatile int* exit_flag;
-} GetContextArg;
-
-static void GetContextAndExit(void* data) {
-  GetContextArg* arg = reinterpret_cast<GetContextArg*>(data);
-
-  std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::CreateFromLocal());
-  unwindstack::RegsGetLocal(regs.get());
-
-  ucontext_t ucontext;
-  memset(&ucontext, 0, sizeof(ucontext));
-#if defined(__arm__)
-  memcpy(&ucontext.uc_mcontext, regs->RawData(), sizeof(uint32_t) * 16);
-#elif defined(__aarch64__)
-  memcpy(&ucontext.uc_mcontext, regs->RawData(), sizeof(uint64_t) * 33);
-#elif defined(__i386__)
-  uint32_t* reg_data = reinterpret_cast<uint32_t*>(regs->RawData());
-  ucontext.uc_mcontext.gregs[0] = reg_data[15];
-  ucontext.uc_mcontext.gregs[1] = reg_data[14];
-  ucontext.uc_mcontext.gregs[2] = reg_data[13];
-  ucontext.uc_mcontext.gregs[3] = reg_data[12];
-  ucontext.uc_mcontext.gregs[4] = reg_data[7];
-  ucontext.uc_mcontext.gregs[5] = reg_data[6];
-  ucontext.uc_mcontext.gregs[6] = reg_data[5];
-  ucontext.uc_mcontext.gregs[7] = reg_data[4];
-  ucontext.uc_mcontext.gregs[8] = reg_data[3];
-  ucontext.uc_mcontext.gregs[9] = reg_data[2];
-  ucontext.uc_mcontext.gregs[10] = reg_data[1];
-  ucontext.uc_mcontext.gregs[11] = reg_data[0];
-  ucontext.uc_mcontext.gregs[14] = reg_data[8];
-  ucontext.uc_mcontext.gregs[15] = reg_data[10];
-#elif defined(__x86_64__)
-  uint64_t* reg_data = reinterpret_cast<uint64_t*>(regs->RawData());
-  ucontext.uc_mcontext.gregs[0] = reg_data[8];
-  ucontext.uc_mcontext.gregs[1] = reg_data[9];
-  ucontext.uc_mcontext.gregs[2] = reg_data[10];
-  ucontext.uc_mcontext.gregs[3] = reg_data[11];
-  ucontext.uc_mcontext.gregs[4] = reg_data[12];
-  ucontext.uc_mcontext.gregs[5] = reg_data[13];
-  ucontext.uc_mcontext.gregs[6] = reg_data[14];
-  ucontext.uc_mcontext.gregs[7] = reg_data[15];
-  ucontext.uc_mcontext.gregs[8] = reg_data[5];
-  ucontext.uc_mcontext.gregs[9] = reg_data[4];
-  ucontext.uc_mcontext.gregs[10] = reg_data[6];
-  ucontext.uc_mcontext.gregs[11] = reg_data[3];
-  ucontext.uc_mcontext.gregs[12] = reg_data[1];
-  ucontext.uc_mcontext.gregs[13] = reg_data[0];
-  ucontext.uc_mcontext.gregs[14] = reg_data[2];
-  ucontext.uc_mcontext.gregs[15] = reg_data[7];
-  ucontext.uc_mcontext.gregs[16] = reg_data[16];
-#endif
-
-  arg->ucontext->resize(sizeof(ucontext));
-  memcpy(arg->ucontext->data(), &ucontext, sizeof(ucontext));
-
-  // Don't touch the stack anymore.
-  while (*arg->exit_flag == 0) {
-  }
-}
-
-void test_get_context_and_wait(void* ucontext, volatile int* exit_flag) {
-  GetContextArg arg;
-  arg.ucontext = reinterpret_cast<std::vector<uint8_t>*>(ucontext);
-  arg.exit_flag = exit_flag;
-  test_level_one(1, 2, 3, 4, GetContextAndExit, &arg);
-}
diff --git a/libbacktrace/backtrace_testlib.h b/libbacktrace/backtrace_testlib.h
deleted file mode 100644
index 9b55e56..0000000
--- a/libbacktrace/backtrace_testlib.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBBACKTRACE_BACKTRACE_TESTLIB_H
-#define _LIBBACKTRACE_BACKTRACE_TESTLIB_H
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-void test_loop_forever();
-void test_signal_handler(int);
-void test_signal_action(int, siginfo_t*, void*);
-int test_level_four(int, int, int, int, void (*)(void*), void*);
-int test_level_three(int, int, int, int, void (*)(void*), void*);
-int test_level_two(int, int, int, int, void (*)(void*), void*);
-int test_level_one(int, int, int, int, void (*)(void*), void*);
-int test_recursive_call(int, void (*)(void*), void*);
-void test_get_context_and_wait(void*, volatile int*);
-
-__END_DECLS
-
-#endif  // _LIBBACKTRACE_BACKTRACE_TESTLIB_H
diff --git a/libbacktrace/include/backtrace/Backtrace.h b/libbacktrace/include/backtrace/Backtrace.h
deleted file mode 100644
index 664b531..0000000
--- a/libbacktrace/include/backtrace/Backtrace.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#ifndef _BACKTRACE_BACKTRACE_H
-#define _BACKTRACE_BACKTRACE_H
-
-#include <inttypes.h>
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include <backtrace/backtrace_constants.h>
-#include <backtrace/BacktraceMap.h>
-
-#if defined(__LP64__)
-#define PRIPTR "016" PRIx64
-typedef uint64_t word_t;
-#else
-#define PRIPTR "08" PRIx64
-typedef uint32_t word_t;
-#endif
-
-enum BacktraceUnwindErrorCode : uint32_t {
-  BACKTRACE_UNWIND_NO_ERROR,
-  // Something failed while trying to perform the setup to begin the unwind.
-  BACKTRACE_UNWIND_ERROR_SETUP_FAILED,
-  // There is no map information to use with the unwind.
-  BACKTRACE_UNWIND_ERROR_MAP_MISSING,
-  // An error occurred that indicates a programming error.
-  BACKTRACE_UNWIND_ERROR_INTERNAL,
-  // The thread to unwind has disappeared before the unwind can begin.
-  BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST,
-  // The thread to unwind has not responded to a signal in a timely manner.
-  BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT,
-  // Attempt to do an unsupported operation.
-  BACKTRACE_UNWIND_ERROR_UNSUPPORTED_OPERATION,
-  // Attempt to do an offline unwind without a context.
-  BACKTRACE_UNWIND_ERROR_NO_CONTEXT,
-  // The count of frames exceed MAX_BACKTRACE_FRAMES.
-  BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT,
-  // Failed to read memory.
-  BACKTRACE_UNWIND_ERROR_ACCESS_MEM_FAILED,
-  // Failed to read registers.
-  BACKTRACE_UNWIND_ERROR_ACCESS_REG_FAILED,
-  // Failed to find a function in debug sections.
-  BACKTRACE_UNWIND_ERROR_FIND_PROC_INFO_FAILED,
-  // Failed to execute dwarf instructions in debug sections.
-  BACKTRACE_UNWIND_ERROR_EXECUTE_DWARF_INSTRUCTION_FAILED,
-  // Unwind information is incorrect.
-  BACKTRACE_UNWIND_ERROR_UNWIND_INFO,
-  // Unwind information stopped due to sp/pc repeating.
-  BACKTRACE_UNWIND_ERROR_REPEATED_FRAME,
-  // Unwind information stopped due to invalid elf.
-  BACKTRACE_UNWIND_ERROR_INVALID_ELF,
-};
-
-struct BacktraceUnwindError {
-  enum BacktraceUnwindErrorCode error_code;
-
-  union {
-    // for BACKTRACE_UNWIND_ERROR_ACCESS_MEM_FAILED
-    uint64_t addr;
-    // for BACKTRACE_UNWIND_ERROR_ACCESS_REG_FAILED
-    uint64_t regno;
-  } error_info;
-
-  BacktraceUnwindError() : error_code(BACKTRACE_UNWIND_NO_ERROR) {}
-};
-
-struct backtrace_frame_data_t {
-  size_t num;             // The current fame number.
-  uint64_t pc;            // The absolute pc.
-  uint64_t rel_pc;        // The relative pc.
-  uint64_t sp;            // The top of the stack.
-  size_t stack_size;      // The size of the stack, zero indicate an unknown stack size.
-  backtrace_map_t map;    // The map associated with the given pc.
-  std::string func_name;  // The function name associated with this pc, NULL if not found.
-  uint64_t func_offset;  // pc relative to the start of the function, only valid if func_name is not
-                         // NULL.
-};
-
-struct backtrace_stackinfo_t {
-  uint64_t start;
-  uint64_t end;
-  const uint8_t* data;
-};
-
-namespace unwindstack {
-class Regs;
-}
-
-class Backtrace {
- public:
-  enum ArchEnum : uint8_t {
-    ARCH_ARM,
-    ARCH_ARM64,
-    ARCH_X86,
-    ARCH_X86_64,
-  };
-
-  static void SetGlobalElfCache(bool enable);
-
-  // Create the correct Backtrace object based on what is to be unwound.
-  // If pid < 0 or equals the current pid, then the Backtrace object
-  // corresponds to the current process.
-  // If pid < 0 or equals the current pid and tid >= 0, then the Backtrace
-  // object corresponds to a thread in the current process.
-  // If pid >= 0 and tid < 0, then the Backtrace object corresponds to a
-  // different process.
-  // Tracing a thread in a different process is not supported.
-  // If map is NULL, then create the map and manage it internally.
-  // If map is not NULL, the map is still owned by the caller.
-  static Backtrace* Create(pid_t pid, pid_t tid, BacktraceMap* map = nullptr);
-
-  virtual ~Backtrace();
-
-  // Get the current stack trace and store in the backtrace_ structure.
-  virtual bool Unwind(size_t num_ignore_frames, void* context = nullptr) = 0;
-
-  static bool Unwind(unwindstack::Regs* regs, BacktraceMap* back_map,
-                     std::vector<backtrace_frame_data_t>* frames, size_t num_ignore_frames,
-                     std::vector<std::string>* skip_names, BacktraceUnwindError* error = nullptr);
-
-  // Get the function name and offset into the function given the pc.
-  // If the string is empty, then no valid function name was found,
-  // or the pc is not in any valid map.
-  virtual std::string GetFunctionName(uint64_t pc, uint64_t* offset,
-                                      const backtrace_map_t* map = nullptr);
-
-  // Fill in the map data associated with the given pc.
-  virtual void FillInMap(uint64_t pc, backtrace_map_t* map);
-
-  // Read the data at a specific address.
-  virtual bool ReadWord(uint64_t ptr, word_t* out_value) = 0;
-
-  // Read arbitrary data from a specific address. If a read request would
-  // span from one map to another, this call only reads up until the end
-  // of the current map.
-  // Returns the total number of bytes actually read.
-  virtual size_t Read(uint64_t addr, uint8_t* buffer, size_t bytes) = 0;
-
-  // Create a string representing the formatted line of backtrace information
-  // for a single frame.
-  virtual std::string FormatFrameData(size_t frame_num);
-  static std::string FormatFrameData(const backtrace_frame_data_t* frame);
-
-  pid_t Pid() const { return pid_; }
-  pid_t Tid() const { return tid_; }
-  size_t NumFrames() const { return frames_.size(); }
-
-  const backtrace_frame_data_t* GetFrame(size_t frame_num) {
-    if (frame_num >= frames_.size()) {
-      return nullptr;
-    }
-    return &frames_[frame_num];
-  }
-
-  typedef std::vector<backtrace_frame_data_t>::iterator iterator;
-  iterator begin() { return frames_.begin(); }
-  iterator end() { return frames_.end(); }
-
-  typedef std::vector<backtrace_frame_data_t>::const_iterator const_iterator;
-  const_iterator begin() const { return frames_.begin(); }
-  const_iterator end() const { return frames_.end(); }
-
-  BacktraceMap* GetMap() { return map_; }
-
-  BacktraceUnwindError GetError() { return error_; }
-
-  std::string GetErrorString(BacktraceUnwindError error);
-
-  // Set whether to skip frames in libbacktrace/libunwindstack when doing a local unwind.
-  void SetSkipFrames(bool skip_frames) { skip_frames_ = skip_frames; }
-
- protected:
-  Backtrace(pid_t pid, pid_t tid, BacktraceMap* map);
-
-  // The name returned is not demangled, GetFunctionName() takes care of
-  // demangling the name.
-  virtual std::string GetFunctionNameRaw(uint64_t pc, uint64_t* offset) = 0;
-
-  virtual bool VerifyReadWordArgs(uint64_t ptr, word_t* out_value);
-
-  bool BuildMap();
-
-  pid_t pid_;
-  pid_t tid_;
-
-  BacktraceMap* map_;
-  bool map_shared_;
-
-  std::vector<backtrace_frame_data_t> frames_;
-
-  // Skip frames in libbacktrace/libunwindstack when doing a local unwind.
-  bool skip_frames_ = true;
-
-  BacktraceUnwindError error_;
-};
-
-#endif // _BACKTRACE_BACKTRACE_H
diff --git a/libbacktrace/include/backtrace/BacktraceMap.h b/libbacktrace/include/backtrace/BacktraceMap.h
deleted file mode 100644
index e000a00..0000000
--- a/libbacktrace/include/backtrace/BacktraceMap.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _BACKTRACE_BACKTRACE_MAP_H
-#define _BACKTRACE_BACKTRACE_MAP_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#ifdef _WIN32
-// MINGW does not define these constants.
-#define PROT_NONE 0
-#define PROT_READ 0x1
-#define PROT_WRITE 0x2
-#define PROT_EXEC 0x4
-#else
-#include <sys/mman.h>
-#endif
-
-#include <deque>
-#include <iterator>
-#include <memory>
-#include <string>
-#include <vector>
-
-// Forward declaration.
-struct backtrace_stackinfo_t;
-
-// Special flag to indicate a map is in /dev/. However, a map in
-// /dev/ashmem/... does not set this flag.
-static constexpr int PROT_DEVICE_MAP = 0x8000;
-// Special flag to indicate that this map represents an elf file
-// created by ART for use with the gdb jit debug interface.
-// This should only ever appear in offline maps data.
-static constexpr int PROT_JIT_SYMFILE_MAP = 0x4000;
-
-struct backtrace_map_t {
-  uint64_t start = 0;
-  uint64_t end = 0;
-  uint64_t offset = 0;
-  uint64_t load_bias = 0;
-  int flags = 0;
-  std::string name;
-
-  // Returns `name` if non-empty, or `<anonymous:0x...>` otherwise.
-  std::string Name() const;
-};
-
-namespace unwindstack {
-class Memory;
-}
-
-class BacktraceMap {
-public:
-  // If uncached is true, then parse the current process map as of the call.
-  // Passing a map created with uncached set to true to Backtrace::Create()
-  // is unsupported.
-  static BacktraceMap* Create(pid_t pid, bool uncached = false);
-
-  virtual ~BacktraceMap();
-
-  class iterator : public std::iterator<std::bidirectional_iterator_tag, backtrace_map_t*> {
-   public:
-    iterator(BacktraceMap* map, size_t index) : map_(map), index_(index) {}
-
-    iterator& operator++() {
-      index_++;
-      return *this;
-    }
-    const iterator operator++(int increment) {
-      index_ += increment;
-      return *this;
-    }
-    iterator& operator--() {
-      index_--;
-      return *this;
-    }
-    const iterator operator--(int decrement) {
-      index_ -= decrement;
-      return *this;
-    }
-
-    bool operator==(const iterator& rhs) { return this->index_ == rhs.index_; }
-    bool operator!=(const iterator& rhs) { return this->index_ != rhs.index_; }
-
-    const backtrace_map_t* operator*() {
-      if (index_ >= map_->size()) {
-        return nullptr;
-      }
-      backtrace_map_t* map = &map_->maps_[index_];
-      if (map->load_bias == static_cast<uint64_t>(-1)) {
-        map->load_bias = map_->GetLoadBias(index_);
-      }
-      return map;
-    }
-
-   private:
-    BacktraceMap* map_ = nullptr;
-    size_t index_ = 0;
-  };
-
-  iterator begin() { return iterator(this, 0); }
-  iterator end() { return iterator(this, maps_.size()); }
-
-  // Fill in the map data structure for the given address.
-  virtual void FillIn(uint64_t addr, backtrace_map_t* map);
-
-  // Only supported with the new unwinder.
-  virtual std::string GetFunctionName(uint64_t /*pc*/, uint64_t* /*offset*/) { return ""; }
-  virtual std::shared_ptr<unwindstack::Memory> GetProcessMemory() { return nullptr; }
-
-  // The flags returned are the same flags as used by the mmap call.
-  // The values are PROT_*.
-  int GetFlags(uint64_t pc) {
-    backtrace_map_t map;
-    FillIn(pc, &map);
-    if (IsValid(map)) {
-      return map.flags;
-    }
-    return PROT_NONE;
-  }
-
-  bool IsReadable(uint64_t pc) { return GetFlags(pc) & PROT_READ; }
-  bool IsWritable(uint64_t pc) { return GetFlags(pc) & PROT_WRITE; }
-  bool IsExecutable(uint64_t pc) { return GetFlags(pc) & PROT_EXEC; }
-
-  // In order to use the iterators on this object, a caller must
-  // call the LockIterator and UnlockIterator function to guarantee
-  // that the data does not change while it's being used.
-  virtual void LockIterator() {}
-  virtual void UnlockIterator() {}
-
-  size_t size() const { return maps_.size(); }
-
-  virtual bool Build();
-
-  static inline bool IsValid(const backtrace_map_t& map) {
-    return map.end > 0;
-  }
-
-  void SetSuffixesToIgnore(std::vector<std::string> suffixes) {
-    suffixes_to_ignore_.insert(suffixes_to_ignore_.end(), suffixes.begin(), suffixes.end());
-  }
-
-  const std::vector<std::string>& GetSuffixesToIgnore() { return suffixes_to_ignore_; }
-
-  // Disabling the resolving of names results in the function name being
-  // set to an empty string and the function offset being set to zero
-  // in the frame data when unwinding.
-  void SetResolveNames(bool resolve) { resolve_names_ = resolve; }
-
-  bool ResolveNames() { return resolve_names_; }
-
- protected:
-  BacktraceMap(pid_t pid);
-
-  virtual uint64_t GetLoadBias(size_t /* index */) { return 0; }
-
-  pid_t pid_;
-  std::deque<backtrace_map_t> maps_;
-  std::vector<std::string> suffixes_to_ignore_;
-  bool resolve_names_ = true;
-};
-
-class ScopedBacktraceMapIteratorLock {
-public:
-  explicit ScopedBacktraceMapIteratorLock(BacktraceMap* map) : map_(map) {
-    map->LockIterator();
-  }
-
-  ~ScopedBacktraceMapIteratorLock() {
-    map_->UnlockIterator();
-  }
-
-private:
-  BacktraceMap* map_;
-};
-
-#endif // _BACKTRACE_BACKTRACE_MAP_H
diff --git a/libbacktrace/include/backtrace/backtrace_constants.h b/libbacktrace/include/backtrace/backtrace_constants.h
deleted file mode 100644
index 1a2da36..0000000
--- a/libbacktrace/include/backtrace/backtrace_constants.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _BACKTRACE_BACKTRACE_CONSTANTS_H
-#define _BACKTRACE_BACKTRACE_CONSTANTS_H
-
-// When the pid to be traced is set to this value, then trace the current
-// process. If the tid value is not BACKTRACE_NO_TID, then the specified
-// thread from the current process will be traced.
-#define BACKTRACE_CURRENT_PROCESS (-1)
-// When the tid to be traced is set to this value, then trace the specified
-// current thread of the specified pid.
-#define BACKTRACE_CURRENT_THREAD (-1)
-
-#define MAX_BACKTRACE_FRAMES 256
-
-#endif // _BACKTRACE_BACKTRACE_CONSTANTS_H
diff --git a/libbacktrace/testdata/arm/libGLESv2_adreno.so b/libbacktrace/testdata/arm/libGLESv2_adreno.so
deleted file mode 100644
index 871f6dc..0000000
--- a/libbacktrace/testdata/arm/libGLESv2_adreno.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm/libandroid_runtime.so b/libbacktrace/testdata/arm/libandroid_runtime.so
deleted file mode 100644
index e4283e6..0000000
--- a/libbacktrace/testdata/arm/libandroid_runtime.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm/libart.so b/libbacktrace/testdata/arm/libart.so
deleted file mode 100644
index bed8e35..0000000
--- a/libbacktrace/testdata/arm/libart.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm/libbacktrace_test_arm_exidx.so b/libbacktrace/testdata/arm/libbacktrace_test_arm_exidx.so
deleted file mode 100755
index 454b032..0000000
--- a/libbacktrace/testdata/arm/libbacktrace_test_arm_exidx.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm/libbacktrace_test_debug_frame.so b/libbacktrace/testdata/arm/libbacktrace_test_debug_frame.so
deleted file mode 100755
index 787f2cb..0000000
--- a/libbacktrace/testdata/arm/libbacktrace_test_debug_frame.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm/libbacktrace_test_gnu_debugdata.so b/libbacktrace/testdata/arm/libbacktrace_test_gnu_debugdata.so
deleted file mode 100755
index 9340d98..0000000
--- a/libbacktrace/testdata/arm/libbacktrace_test_gnu_debugdata.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm/offline_testdata b/libbacktrace/testdata/arm/offline_testdata
deleted file mode 100644
index d5b8f47..0000000
--- a/libbacktrace/testdata/arm/offline_testdata
+++ /dev/null
@@ -1,105 +0,0 @@
-pid: 32232 tid: 32233
-map: start: aad19000 end: aad6c000 offset: 0 load_bias: 0 flags: 5 name: /data/backtrace_test32
-map: start: aad6c000 end: aad6e000 offset: 52000 load_bias: 0 flags: 1 name: /data/backtrace_test32
-map: start: aad6e000 end: aad6f000 offset: 54000 load_bias: 0 flags: 3 name: /data/backtrace_test32
-map: start: e7380000 end: e7400000 offset: 0 load_bias: 0 flags: 3 name: [anon:libc_malloc]
-map: start: e745f000 end: e7463000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libnetd_client.so
-map: start: e7463000 end: e7464000 offset: 3000 load_bias: 0 flags: 1 name: /system/lib/libnetd_client.so
-map: start: e7464000 end: e7465000 offset: 4000 load_bias: 0 flags: 3 name: /system/lib/libnetd_client.so
-map: start: e7480000 end: e7500000 offset: 0 load_bias: 0 flags: 3 name: [anon:libc_malloc]
-map: start: e7558000 end: e756c000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libunwind.so
-map: start: e756c000 end: e756d000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e756d000 end: e756e000 offset: 14000 load_bias: 0 flags: 1 name: /system/lib/libunwind.so
-map: start: e756e000 end: e756f000 offset: 15000 load_bias: 0 flags: 3 name: /system/lib/libunwind.so
-map: start: e756f000 end: e75b5000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: e75d4000 end: e75e1000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libbase.so
-map: start: e75e1000 end: e75e2000 offset: c000 load_bias: 0 flags: 1 name: /system/lib/libbase.so
-map: start: e75e2000 end: e75e3000 offset: d000 load_bias: 0 flags: 3 name: /system/lib/libbase.so
-map: start: e7600000 end: e7616000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/liblzma.so
-map: start: e7616000 end: e7617000 offset: 15000 load_bias: 0 flags: 1 name: /system/lib/liblzma.so
-map: start: e7617000 end: e7618000 offset: 16000 load_bias: 0 flags: 3 name: /system/lib/liblzma.so
-map: start: e7618000 end: e761d000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: e7647000 end: e7656000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/liblog.so
-map: start: e7656000 end: e7657000 offset: e000 load_bias: 0 flags: 1 name: /system/lib/liblog.so
-map: start: e7657000 end: e7658000 offset: f000 load_bias: 0 flags: 3 name: /system/lib/liblog.so
-map: start: e7681000 end: e76a2000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libm.so
-map: start: e76a2000 end: e76a3000 offset: 20000 load_bias: 0 flags: 1 name: /system/lib/libm.so
-map: start: e76a3000 end: e76a4000 offset: 21000 load_bias: 0 flags: 3 name: /system/lib/libm.so
-map: start: e76eb000 end: e76ee000 offset: 0 load_bias: 0 flags: 5 name: /data/libbacktrace_test.so
-map: start: e76ee000 end: e76ef000 offset: 2000 load_bias: 0 flags: 1 name: /data/libbacktrace_test.so
-map: start: e76ef000 end: e76f0000 offset: 3000 load_bias: 0 flags: 3 name: /data/libbacktrace_test.so
-map: start: e7712000 end: e771f000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libbacktrace.so
-map: start: e771f000 end: e7720000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e7720000 end: e7721000 offset: d000 load_bias: 0 flags: 1 name: /system/lib/libbacktrace.so
-map: start: e7721000 end: e7722000 offset: e000 load_bias: 0 flags: 3 name: /system/lib/libbacktrace.so
-map: start: e7761000 end: e7778000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libutils.so
-map: start: e7778000 end: e7779000 offset: 16000 load_bias: 0 flags: 1 name: /system/lib/libutils.so
-map: start: e7779000 end: e777a000 offset: 17000 load_bias: 0 flags: 3 name: /system/lib/libutils.so
-map: start: e77a5000 end: e782d000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libc.so
-map: start: e782d000 end: e7831000 offset: 87000 load_bias: 0 flags: 1 name: /system/lib/libc.so
-map: start: e7831000 end: e7833000 offset: 8b000 load_bias: 0 flags: 3 name: /system/lib/libc.so
-map: start: e7833000 end: e7834000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: e7834000 end: e7835000 offset: 0 load_bias: 0 flags: 1 name: [anon:.bss]
-map: start: e7835000 end: e783b000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: e7845000 end: e8437000 offset: 0 load_bias: 2b000 flags: 5 name: /system/lib/libLLVM.so
-map: start: e8437000 end: e8438000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e8438000 end: e848a000 offset: bf2000 load_bias: 0 flags: 1 name: /system/lib/libLLVM.so
-map: start: e848a000 end: e848b000 offset: c44000 load_bias: 0 flags: 3 name: /system/lib/libLLVM.so
-map: start: e848b000 end: e84a1000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: e84eb000 end: e84f7000 offset: 0 load_bias: 0 flags: 5 name: /system/lib/libcutils.so
-map: start: e84f7000 end: e84f8000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e84f8000 end: e84f9000 offset: c000 load_bias: 0 flags: 1 name: /system/lib/libcutils.so
-map: start: e84f9000 end: e84fa000 offset: d000 load_bias: 0 flags: 3 name: /system/lib/libcutils.so
-map: start: e852e000 end: e85b3000 offset: 0 load_bias: 2000 flags: 5 name: /system/lib/libc++.so
-map: start: e85b3000 end: e85b4000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e85b4000 end: e85b8000 offset: 85000 load_bias: 0 flags: 1 name: /system/lib/libc++.so
-map: start: e85b8000 end: e85b9000 offset: 89000 load_bias: 0 flags: 3 name: /system/lib/libc++.so
-map: start: e85b9000 end: e85ba000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: e85ce000 end: e85cf000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc]
-map: start: e85e4000 end: e85e5000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: e8607000 end: e8608000 offset: 0 load_bias: 0 flags: 1 name: [anon:linker_alloc]
-map: start: e8680000 end: e8700000 offset: 0 load_bias: 0 flags: 3 name: [anon:libc_malloc]
-map: start: e870d000 end: e8719000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: e8719000 end: e871b000 offset: 0 load_bias: 0 flags: 1 name: [anon:atexit handlers]
-map: start: e871b000 end: e873b000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/u:object_r:default_prop:s0
-map: start: e873b000 end: e875b000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/properties_serial
-map: start: e875b000 end: e875c000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: e875c000 end: e875d000 offset: 0 load_bias: 0 flags: 3 name: [anon:arc4random data]
-map: start: e875d000 end: e875e000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc]
-map: start: e875e000 end: e875f000 offset: 0 load_bias: 0 flags: 1 name: [anon:linker_alloc]
-map: start: e875f000 end: e877f000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/u:object_r:debug_prop:s0
-map: start: e877f000 end: e879f000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/properties_serial
-map: start: e879f000 end: e87a0000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: e87a0000 end: e87a1000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: e87a1000 end: e87a2000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: e87a2000 end: e87a3000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e87a3000 end: e87a4000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: e87a4000 end: e87a5000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: e87a5000 end: e87a6000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_lob]
-map: start: e87a6000 end: e87a7000 offset: 0 load_bias: 0 flags: 1 name: [anon:linker_alloc]
-map: start: e87a7000 end: e87a8000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: e87a8000 end: e87a9000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: e87a9000 end: e87aa000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: e87aa000 end: e87ab000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: e87ab000 end: e87ac000 offset: 0 load_bias: 0 flags: 1 name: [anon:atexit handlers]
-map: start: e87ac000 end: e87ad000 offset: 0 load_bias: 0 flags: 0 name: [anon:thread signal stack guard page]
-map: start: e87ad000 end: e87af000 offset: 0 load_bias: 0 flags: 3 name: [anon:thread signal stack]
-map: start: e87af000 end: e87b0000 offset: 0 load_bias: 0 flags: 3 name: [anon:arc4random data]
-map: start: e87b0000 end: e880d000 offset: 0 load_bias: 0 flags: 5 name: /system/bin/linker
-map: start: e880d000 end: e880f000 offset: 5c000 load_bias: 0 flags: 1 name: /system/bin/linker
-map: start: e880f000 end: e8810000 offset: 5e000 load_bias: 0 flags: 3 name: /system/bin/linker
-map: start: e8810000 end: e8812000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: e8812000 end: e8813000 offset: 0 load_bias: 0 flags: 1 name: 
-map: start: e8813000 end: e8815000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: ff886000 end: ff8a9000 offset: 0 load_bias: 0 flags: 3 name: [stack]
-map: start: ffff0000 end: ffff1000 offset: 0 load_bias: 0 flags: 5 name: [vectors]
-ucontext: 104 000000000000000000000000000000000000000000000000000000000000000034868affdc8871e8150000001c0000001c000000150000000e00000007000000e08771e834868aff2354d2aa24f9ffffdc8871e88c8771e875b86ee778ba6ee70000000000000000
-stack: start: e8715000 end: e8719000 size: 16384 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dc8871e87dba6ee734868affdc8871e8dc8871e85dba6ee7070000000e000000150000001c000000dc8871e85dba6ee71c000000150000000e00000007000000100000000c0000000800000004000000ddb86ee75dba6ee7dc8871e804000000080000000c00000010000000dc8871e85dba6ee7100000000c000000080000000400000008000000060000000400000002000000288871e835b96ee75dba6ee7dc8871e802000000040000000600000008000000dc8871e85dba6ee70800000006000000040000000200000004000000030000000200000001000000708871e88db96ee75dba6ee7dc8871e801000000020000000300000004000000dc8871e85dba6ee70400000003000000020000000100000004000000208971e8208971e878000000e87d00003dba6ee75dba6ee7dc8871e878000000c5807ce7fc7183e734868aff78868aff78868aff34868aff34868aff78868affe0879437208971e84154d2aa0020000034868aff34868aff34868aff78000000c9b87ee7b1b87ee7a3f47be7288971e8b1b87ee7208971e800000000f83481e800000000e97d0000e87d000000000000005071e82039000000100000000000000000000000000000000000002354d2aa34868aff00000000002071e801000000000000000000000000000000708971e8208971e8000000000000000000000000e0879437000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-function: start: 0 end: e76eb835 name: unknown_start
-function: start: e76eb835 end: e76eb88d name: test_level_four
-function: start: e76eb88d end: e76eb8e5 name: test_level_three
-function: start: e76eb8e5 end: e76eb93d name: test_level_two
-function: start: e76eb93d end: e76eb995 name: test_level_one
-function: start: e76eb995 end: e76eb9f1 name: test_recursive_call
-function: start: e76eb9f1 end: ffffffff name: test_get_context_and_wait
-function: start: ffffffff end: ffffffff name: unknown_end
diff --git a/libbacktrace/testdata/arm/offline_testdata_for_libGLESv2_adreno b/libbacktrace/testdata/arm/offline_testdata_for_libGLESv2_adreno
deleted file mode 100644
index d7c186e..0000000
--- a/libbacktrace/testdata/arm/offline_testdata_for_libGLESv2_adreno
+++ /dev/null
@@ -1,6 +0,0 @@
-pid: 7288 tid: 31656
-ucontext: 104 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f017cc00000000356241cc0000000000000000
-map: start: cc361000 end: cc758000 offset: 0 load_bias: 9000 flags: 5 name: /vendor/lib/egl/libGLESv2_adreno.so
-stack: start: cc17f234 end: cc17f258 size: 36 0000000000000000000000000000000000000000000000000000000000000000b36141cc
-function: start: be1f0 end: be304 name: EsxContext::Clear(unsigned int, unsigned int, unsigned int, EsxClearValues*)
-function: start: be058 end: be1f0 name: EsxContext::ClearBuffersForDebug()
diff --git a/libbacktrace/testdata/arm/offline_testdata_for_libandroid_runtime b/libbacktrace/testdata/arm/offline_testdata_for_libandroid_runtime
deleted file mode 100644
index 54f3525..0000000
--- a/libbacktrace/testdata/arm/offline_testdata_for_libandroid_runtime
+++ /dev/null
@@ -1,6 +0,0 @@
-pid: 7288 tid: 31656
-ucontext: 104 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003069fed80000000049dcf6f10000000000000000
-map: start: f1f10000 end: f2049000 offset: 0 load_bias: 10000 flags: 5 name: /system/lib/libandroid_runtime.so
-stack: start: d8fe6948 end: d8fe6958 size: 16 000000000000000000000000e7dcf6f1
-function: start: 6dbf9 end: 6dce5 name: android::AndroidRuntime::javaThreadShell
-function: start: 6dce5 end: 6dd79 name: android::AndroidRuntime::javaCreateThreadEtc
diff --git a/libbacktrace/testdata/arm/offline_testdata_for_libart b/libbacktrace/testdata/arm/offline_testdata_for_libart
deleted file mode 100644
index c1369ff..0000000
--- a/libbacktrace/testdata/arm/offline_testdata_for_libart
+++ /dev/null
@@ -1,10 +0,0 @@
-pid: 32232 tid: 32233
-ucontext: 104 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006473602451b3e2e700000000d82fd1ff5600000000908eec00000000d42dd1ff00000000c02dd1ff617171e9617171e90000000000000000
-map: start: e9380000 end: e9766000 offset: 0 load_bias: b000 flags: 5 name: /system/lib/libart.so
-stack: start: ffd12dc0 end: ffd1306c size: 684 00000000000c5024070000000300000005070a0a0100000051b3e2e700000000d82fd1ff560000004c2ed1ff000000000000000081b771e9d82fd1ff000000004c2ed1ff0c2ed1ff40a8d27024bf76e900908eec000000000834d1ff0000000000000000000000000d000000050000000000000000000000080000000101d1ff44b8bfeb4b0000000000000000000000e8b8952400000000fc2ed1ff4fb3e2e7bc49ac6f00908eecb02ed1ffd82fd1ff040000008c908eec942fd1ffd5c141e9d82fd1ff4fb3e2e7542fd1ff336c68e940000000400000007030d1fff031d1ff00000000bc49ac6f5c30d1ff942fd1ff842fd1ffd82fd1ff00000000b8f1786f4fb3e2e7610d67e9d82fd1ff4fb3e2e77880adeb7980adeb7a80adeb7b80adeb7c80adeb7d80adeb7e80adeb7f80adeb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007430d1ff02000000e8b89524e8d895240200000000908eec5c30d1ffbc49ac6f4fb3e2e74030d1ffe8d8952400000000b8f1786fbc49ac6f332367e94fb3e2e701000000637171e9637171e9000000005c30d1ff8430d1ffe0c08bec882fd1ff4fb3e2e70200000004000000942fd1ffe8b8952400908eec58d8952458d895247fbd69e90500000000400fe40100000000908eec58d89524060000009c86bd6f6b876fe900908eece0c08bec00008eec0000000000000000000000000000000044b8bfeb4b000000009be86f040000000038d1ff01000000c8e7446f060000000000000000908eec30d89524e8b895249c86bd6f7893476f00908eec00000000358c6fe970400fe4116e71e9a0285a6fa4d49c6f4489bd6f30d8952458d89524e8d8952400908eeca431d1ff2c31d1ffb75861e90100000000908eec30528bec409181e958d89524
-function: start: 3a2121 end: 3a217a name: art_quick_invoke_stub_internal
-function: start: 3a66a5 end: 3a6787 name: art_quick_invoke_static_stub
-function: start: a7129 end: a72f1 name: art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
-function: start: 2fbd35 end: 2fc789 name: art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*)
-function: start: 2fcf75 end: 2fd88d name: art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)
-function: start: 2a089d end: 2a08bb name: art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobject*)
diff --git a/libbacktrace/testdata/arm64/eglSubDriverAndroid.so b/libbacktrace/testdata/arm64/eglSubDriverAndroid.so
deleted file mode 100644
index 10ce06b..0000000
--- a/libbacktrace/testdata/arm64/eglSubDriverAndroid.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm64/libbacktrace_test_eh_frame.so b/libbacktrace/testdata/arm64/libbacktrace_test_eh_frame.so
deleted file mode 100755
index 880f337..0000000
--- a/libbacktrace/testdata/arm64/libbacktrace_test_eh_frame.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm64/libskia.so b/libbacktrace/testdata/arm64/libskia.so
deleted file mode 100644
index ef1a6a1..0000000
--- a/libbacktrace/testdata/arm64/libskia.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/arm64/offline_testdata b/libbacktrace/testdata/arm64/offline_testdata
deleted file mode 100644
index cee9f72..0000000
--- a/libbacktrace/testdata/arm64/offline_testdata
+++ /dev/null
@@ -1,107 +0,0 @@
-pid: 32438 tid: 32439
-map: start: 557066e000 end: 55706ee000 offset: 0 load_bias: 0 flags: 5 name: /data/backtrace_test64
-map: start: 55706ef000 end: 55706f2000 offset: 80000 load_bias: 0 flags: 1 name: /data/backtrace_test64
-map: start: 55706f2000 end: 55706f3000 offset: 83000 load_bias: 0 flags: 3 name: /data/backtrace_test64
-map: start: 7014200000 end: 7014600000 offset: 0 load_bias: 0 flags: 3 name: [anon:libc_malloc]
-map: start: 701464c000 end: 701465c000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libcutils.so
-map: start: 701465c000 end: 701465d000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: 701465d000 end: 701465e000 offset: 10000 load_bias: 0 flags: 1 name: /system/lib64/libcutils.so
-map: start: 701465e000 end: 701465f000 offset: 11000 load_bias: 0 flags: 3 name: /system/lib64/libcutils.so
-map: start: 7014691000 end: 70146b5000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/liblzma.so
-map: start: 70146b5000 end: 70146b6000 offset: 23000 load_bias: 0 flags: 1 name: /system/lib64/liblzma.so
-map: start: 70146b6000 end: 70146b7000 offset: 24000 load_bias: 0 flags: 3 name: /system/lib64/liblzma.so
-map: start: 70146b7000 end: 70146bc000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: 70146c9000 end: 70158b5000 offset: 0 load_bias: af000 flags: 5 name: /system/lib64/libLLVM.so
-map: start: 70158b5000 end: 701596b000 offset: 11eb000 load_bias: 0 flags: 1 name: /system/lib64/libLLVM.so
-map: start: 701596b000 end: 701596c000 offset: 12a1000 load_bias: 0 flags: 3 name: /system/lib64/libLLVM.so
-map: start: 701596c000 end: 701599f000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: 70159c2000 end: 70159f9000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libm.so
-map: start: 70159f9000 end: 70159fa000 offset: 36000 load_bias: 0 flags: 1 name: /system/lib64/libm.so
-map: start: 70159fa000 end: 70159fb000 offset: 37000 load_bias: 0 flags: 3 name: /system/lib64/libm.so
-map: start: 7015a1e000 end: 7015a2e000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libbacktrace.so
-map: start: 7015a2e000 end: 7015a2f000 offset: f000 load_bias: 0 flags: 1 name: /system/lib64/libbacktrace.so
-map: start: 7015a2f000 end: 7015a30000 offset: 10000 load_bias: 0 flags: 3 name: /system/lib64/libbacktrace.so
-map: start: 7015a5e000 end: 7015a7d000 offset: 0 load_bias: 1000 flags: 5 name: /system/lib64/libutils.so
-map: start: 7015a7d000 end: 7015a7e000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: 7015a7e000 end: 7015a7f000 offset: 1f000 load_bias: 0 flags: 1 name: /system/lib64/libutils.so
-map: start: 7015a7f000 end: 7015a80000 offset: 20000 load_bias: 0 flags: 3 name: /system/lib64/libutils.so
-map: start: 7015a99000 end: 7015b6d000 offset: 0 load_bias: 9000 flags: 5 name: /system/lib64/libc++.so
-map: start: 7015b6d000 end: 7015b6e000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: 7015b6e000 end: 7015b76000 offset: d4000 load_bias: 0 flags: 1 name: /system/lib64/libc++.so
-map: start: 7015b76000 end: 7015b77000 offset: dc000 load_bias: 0 flags: 3 name: /system/lib64/libc++.so
-map: start: 7015b77000 end: 7015b7a000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: 7015b81000 end: 7015b92000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/liblog.so
-map: start: 7015b92000 end: 7015b93000 offset: 10000 load_bias: 0 flags: 1 name: /system/lib64/liblog.so
-map: start: 7015b93000 end: 7015b94000 offset: 11000 load_bias: 0 flags: 3 name: /system/lib64/liblog.so
-map: start: 7015be3000 end: 7015ca3000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libc.so
-map: start: 7015ca3000 end: 7015ca9000 offset: bf000 load_bias: 0 flags: 1 name: /system/lib64/libc.so
-map: start: 7015ca9000 end: 7015cab000 offset: c5000 load_bias: 0 flags: 3 name: /system/lib64/libc.so
-map: start: 7015cab000 end: 7015cac000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: 7015cac000 end: 7015cad000 offset: 0 load_bias: 0 flags: 1 name: [anon:.bss]
-map: start: 7015cad000 end: 7015cb4000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: 7015cf5000 end: 7015cf6000 offset: 0 load_bias: 0 flags: 5 name: /data/libbacktrace_test.so
-map: start: 7015cf6000 end: 7015cf7000 offset: 0 load_bias: 0 flags: 1 name: /data/libbacktrace_test.so
-map: start: 7015cf7000 end: 7015cf8000 offset: 1000 load_bias: 0 flags: 3 name: /data/libbacktrace_test.so
-map: start: 7015d1f000 end: 7015d39000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libunwind.so
-map: start: 7015d39000 end: 7015d3a000 offset: 19000 load_bias: 0 flags: 1 name: /system/lib64/libunwind.so
-map: start: 7015d3a000 end: 7015d3b000 offset: 1a000 load_bias: 0 flags: 3 name: /system/lib64/libunwind.so
-map: start: 7015d3b000 end: 7015da4000 offset: 0 load_bias: 0 flags: 3 name: [anon:.bss]
-map: start: 7015de8000 end: 7015df7000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libbase.so
-map: start: 7015df7000 end: 7015df8000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: 7015df8000 end: 7015df9000 offset: f000 load_bias: 0 flags: 1 name: /system/lib64/libbase.so
-map: start: 7015df9000 end: 7015dfa000 offset: 10000 load_bias: 0 flags: 3 name: /system/lib64/libbase.so
-map: start: 7015e35000 end: 7015e36000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc]
-map: start: 7015e4f000 end: 7015e50000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: 7015f11000 end: 7015f13000 offset: 0 load_bias: 0 flags: 5 name: /system/lib64/libnetd_client.so
-map: start: 7015f13000 end: 7015f14000 offset: 1000 load_bias: 0 flags: 1 name: /system/lib64/libnetd_client.so
-map: start: 7015f14000 end: 7015f15000 offset: 2000 load_bias: 0 flags: 3 name: /system/lib64/libnetd_client.so
-map: start: 7015f6c000 end: 7015f79000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7015f79000 end: 7015f99000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/u:object_r:default_prop:s0
-map: start: 7015f99000 end: 7015f9a000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: 7015f9a000 end: 7015f9b000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: 7015fa6000 end: 7015fa7000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: 7015fa8000 end: 7015fa9000 offset: 0 load_bias: 0 flags: 1 name: [anon:linker_alloc]
-map: start: 7015faf000 end: 7015fcf000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/properties_serial
-map: start: 7015fcf000 end: 7015fd0000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: 7015fd0000 end: 7015fd1000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: 7015fd1000 end: 7015fd2000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: 7015fd4000 end: 7015fd7000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7015fd7000 end: 7015fdb000 offset: 0 load_bias: 0 flags: 1 name: [anon:atexit handlers]
-map: start: 7015fdb000 end: 7015fdc000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc]
-map: start: 7015fdc000 end: 7015fdd000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7015fdd000 end: 7015fde000 offset: 0 load_bias: 0 flags: 1 name: [anon:linker_alloc]
-map: start: 7015fde000 end: 7015ffe000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/u:object_r:debug_prop:s0
-map: start: 7015ffe000 end: 701601e000 offset: 0 load_bias: 0 flags: 32769 name: /dev/__properties__/properties_serial
-map: start: 701601e000 end: 701601f000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: 701601f000 end: 7016020000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: 7016020000 end: 7016021000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7016021000 end: 7016022000 offset: 0 load_bias: 0 flags: 0 name: 
-map: start: 7016022000 end: 7016023000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_lob]
-map: start: 7016023000 end: 7016025000 offset: 0 load_bias: 0 flags: 1 name: [anon:linker_alloc]
-map: start: 7016025000 end: 7016026000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: 7016026000 end: 7016027000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_vector]
-map: start: 7016027000 end: 7016028000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: 7016028000 end: 7016029000 offset: 0 load_bias: 0 flags: 3 name: [anon:arc4random data]
-map: start: 7016029000 end: 701602a000 offset: 0 load_bias: 0 flags: 3 name: [anon:linker_alloc_small_objects]
-map: start: 701602a000 end: 701602b000 offset: 0 load_bias: 0 flags: 1 name: [anon:atexit handlers]
-map: start: 701602b000 end: 701602c000 offset: 0 load_bias: 0 flags: 0 name: [anon:thread signal stack guard page]
-map: start: 701602c000 end: 7016030000 offset: 0 load_bias: 0 flags: 3 name: [anon:thread signal stack]
-map: start: 7016030000 end: 7016031000 offset: 0 load_bias: 0 flags: 3 name: [anon:arc4random data]
-map: start: 7016031000 end: 7016033000 offset: 0 load_bias: 0 flags: 5 name: [vdso]
-map: start: 7016033000 end: 70160dd000 offset: 0 load_bias: 0 flags: 5 name: /system/bin/linker64
-map: start: 70160dd000 end: 70160e0000 offset: a9000 load_bias: 0 flags: 1 name: /system/bin/linker64
-map: start: 70160e0000 end: 70160e1000 offset: ac000 load_bias: 0 flags: 3 name: /system/bin/linker64
-map: start: 70160e1000 end: 70160e4000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 70160e4000 end: 70160e5000 offset: 0 load_bias: 0 flags: 1 name: 
-map: start: 70160e5000 end: 70160e8000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd8baf000 end: 7fd8be6000 offset: 0 load_bias: 0 flags: 3 name: [stack]
-ucontext: 464 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f838bed87f0000000e0000000000000015000000000000001c00000000000000ec59cf1570000000b863fd15700000005064fd15700000000000000000000000ec59cf15700000000200000000000000b863fd1570000000144abed87f0000006064fd15700000005064fd157000000000010000000000005826bed87f000000d86fcf15700000006057cf157000000000000000000000005064fd15700000005064fd15700000005064fd1570000000b67e00000000000040fd677055000000d064fd15700000000030fd157000000002000000000000000100000000000000fcb58a56000000000063fd15700000009857cf1570000000c062fd15700000001c5acf157000000000000000000000000000000000000000
-stack: start: 7015fd3000 end: 7015fd7000 size: 16384 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f838bed87f0000004038bed87f000000b863fd1570000000b863fd1570000000b863fd1570000000ec59cf15700000001c000000150000000e000000070000003063fd15700000001c58cf1570000000b863fd1570000000ec59cf1570000000100000000c00000008000000040000006063fd15700000007c58cf1570000000b863fd1570000000ec59cf1570000000080000000600000004000000020000009063fd1570000000dc58cf1570000000b863fd1570000000ec59cf157000000004000000030000000200000001000000d063fd1570000000c459cf15700000000100000000000000144abed87f0000004038bed87f0000004038bed87f000000144abed87f000000d3aec914588f4bcd1064fd157000000074fd6770550000004038bed87f0000004038bed87f000000ec84c41570000000e484c41570000000c484c4157000000000000000000000004064fd15700000004015c01570000000b67e0000000000000000000000000000705a0e1670000000185b0e167000000000000000000000000000000000000000705a0e16700000000000000000000000b77e0000b67e000000000000550000000030fd157000000050340000000000000010000000000000000000000000000000b222147000000000102a14700000000000000000000000000000000000000040fd6770550000004038bed87f000000000000000000000000a0fa1570000000010000000000000000000000000000000000000000000000e864fd15700000005064fd1570000000000000000000000000000000000000000000000000000000d3aec914588f4bcd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-function: start: 0 end: 7015cf5760 name: unknown_start
-function: start: 7015cf5760 end: 7015cf57cc name: test_level_four
-function: start: 7015cf57cc end: 7015cf582c name: test_level_three
-function: start: 7015cf582c end: 7015cf588c name: test_level_two
-function: start: 7015cf588c end: 7015cf58ec name: test_level_one
-function: start: 7015cf58ec end: 7015cf5968 name: test_recursive_call
-function: start: 7015cf5968 end: ffffffffffffffff name: test_get_context_and_wait
-function: start: ffffffffffffffff end: ffffffffffffffff name: unknown_end
diff --git a/libbacktrace/testdata/arm64/offline_testdata_for_eglSubDriverAndroid b/libbacktrace/testdata/arm64/offline_testdata_for_eglSubDriverAndroid
deleted file mode 100644
index 673e30e..0000000
--- a/libbacktrace/testdata/arm64/offline_testdata_for_eglSubDriverAndroid
+++ /dev/null
@@ -1,6 +0,0 @@
-pid: 12276 tid: 12303
-map: start: 7b8c01e000 end: 7b8c030000 offset: 0 load_bias: 0 flags: 5 name: /vendor/lib64/egl/eglSubDriverAndroid.so
-ucontext: 464 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004070158c7b00000000000000000000001070158c7b000000647f028c7b00000000000000000000000000000000000000
-stack: start: 7b8c157020 end: 7b8c157050 size: 48 00000000000000000000000000000000000000000000000000000000000000000000000000000000547e028c7b000000
-function: start: 9ed8 end: a1b0 name: EglAndroidWindowSurface::Initialize(EglAndroidConfig*, int const*)
-function: start: 9dcc end: 9ed8 name: EglAndroidWindowSurface::Create(ANativeWindow*, EglAndroidConfig*, EglAndroidWindowSurface**, int const*)
diff --git a/libbacktrace/testdata/arm64/offline_testdata_for_libskia b/libbacktrace/testdata/arm64/offline_testdata_for_libskia
deleted file mode 100644
index da820c0..0000000
--- a/libbacktrace/testdata/arm64/offline_testdata_for_libskia
+++ /dev/null
@@ -1,6 +0,0 @@
-pid: 32232 tid: 32233
-map: start: 7c24c80000 end: 7c25413000 offset: 0 load_bias: 5f000 flags: 5 name: /system/lib64/libskia.so
-ucontext: 464 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b04b158c7b0000000000000000000000504b158c7b0000000c9a18257c00000000000000000000000000000000000000
-stack: start: 7b8c154b80 end: 7b8c154bc0 size: 64 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ec43f2247c000000
-function: start: 568970 end: 568c08 name: SkScalerContext_FreeType::generateImage(SkGlyph const&)
-function: start: 30330c end: 3044b0 name: SkScalerContext::getImage(SkGlyph const&)
diff --git a/libbacktrace/testdata/x86/libbacktrace_test_debug_frame.so b/libbacktrace/testdata/x86/libbacktrace_test_debug_frame.so
deleted file mode 100755
index a6f3b29..0000000
--- a/libbacktrace/testdata/x86/libbacktrace_test_debug_frame.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/x86/libbacktrace_test_gnu_debugdata.so b/libbacktrace/testdata/x86/libbacktrace_test_gnu_debugdata.so
deleted file mode 100755
index ea58dfb..0000000
--- a/libbacktrace/testdata/x86/libbacktrace_test_gnu_debugdata.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/x86/offline_testdata b/libbacktrace/testdata/x86/offline_testdata
deleted file mode 100644
index 920b338..0000000
--- a/libbacktrace/testdata/x86/offline_testdata
+++ /dev/null
@@ -1,82 +0,0 @@
-pid: 34545 tid: 34546
-map: start: f705a000 end: f705c000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f705c000 end: f707f000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/liblzma.so
-map: start: f707f000 end: f7080000 offset: 22000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/liblzma.so
-map: start: f7080000 end: f7081000 offset: 23000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/liblzma.so
-map: start: f7081000 end: f7088000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f7088000 end: f7230000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libc-2.19.so
-map: start: f7230000 end: f7231000 offset: 1a8000 load_bias: 0 flags: 0 name: /lib/i386-linux-gnu/libc-2.19.so
-map: start: f7231000 end: f7233000 offset: 1a8000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/libc-2.19.so
-map: start: f7233000 end: f7234000 offset: 1aa000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libc-2.19.so
-map: start: f7234000 end: f7237000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f7237000 end: f727b000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libm-2.19.so
-map: start: f727b000 end: f727c000 offset: 43000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/libm-2.19.so
-map: start: f727c000 end: f727d000 offset: 44000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libm-2.19.so
-map: start: f727d000 end: f7299000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libgcc_s.so.1
-map: start: f7299000 end: f729a000 offset: 1b000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libgcc_s.so.1
-map: start: f729a000 end: f72b8000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libtinfo.so.5.9
-map: start: f72b8000 end: f72b9000 offset: 1e000 load_bias: 0 flags: 0 name: /lib/i386-linux-gnu/libtinfo.so.5.9
-map: start: f72b9000 end: f72bb000 offset: 1e000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/libtinfo.so.5.9
-map: start: f72bb000 end: f72bc000 offset: 20000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libtinfo.so.5.9
-map: start: f72bc000 end: f72bd000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f72bd000 end: f72e0000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libncurses.so.5.9
-map: start: f72e0000 end: f72e1000 offset: 22000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/libncurses.so.5.9
-map: start: f72e1000 end: f72e2000 offset: 23000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libncurses.so.5.9
-map: start: f72e2000 end: f72e5000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libdl-2.19.so
-map: start: f72e5000 end: f72e6000 offset: 2000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/libdl-2.19.so
-map: start: f72e6000 end: f72e7000 offset: 3000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libdl-2.19.so
-map: start: f72e7000 end: f72ee000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/librt-2.19.so
-map: start: f72ee000 end: f72ef000 offset: 6000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/librt-2.19.so
-map: start: f72ef000 end: f72f0000 offset: 7000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/librt-2.19.so
-map: start: f72f0000 end: f7308000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/libpthread-2.19.so
-map: start: f7308000 end: f7309000 offset: 18000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/libpthread-2.19.so
-map: start: f7309000 end: f730a000 offset: 19000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/libpthread-2.19.so
-map: start: f730a000 end: f730c000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f732f000 end: f7331000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f7331000 end: f7425000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libc++.so
-map: start: f7425000 end: f7426000 offset: f4000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libc++.so
-map: start: f7426000 end: f742a000 offset: f4000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libc++.so
-map: start: f742a000 end: f742b000 offset: f8000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libc++.so
-map: start: f742b000 end: f742d000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f742d000 end: f7446000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libunwind.so
-map: start: f7446000 end: f7447000 offset: 18000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libunwind.so
-map: start: f7447000 end: f7448000 offset: 19000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libunwind.so
-map: start: f7448000 end: f7457000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f7457000 end: f745c000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/liblog.so
-map: start: f745c000 end: f745d000 offset: 4000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/liblog.so
-map: start: f745d000 end: f745e000 offset: 5000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/liblog.so
-map: start: f745e000 end: f7467000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libcutils.so
-map: start: f7467000 end: f7468000 offset: 9000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libcutils.so
-map: start: f7468000 end: f7469000 offset: 9000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libcutils.so
-map: start: f7469000 end: f746a000 offset: a000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libcutils.so
-map: start: f746a000 end: f7477000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbase.so
-map: start: f7477000 end: f7478000 offset: c000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbase.so
-map: start: f7478000 end: f7479000 offset: d000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbase.so
-map: start: f7479000 end: f7489000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbacktrace.so
-map: start: f7489000 end: f748a000 offset: f000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbacktrace.so
-map: start: f748a000 end: f748b000 offset: 10000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbacktrace.so
-map: start: f748b000 end: f748c000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f748c000 end: f748d000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbacktrace_test.so
-map: start: f748d000 end: f748e000 offset: 0 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbacktrace_test.so
-map: start: f748e000 end: f748f000 offset: 1000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib/libbacktrace_test.so
-map: start: f748f000 end: f7491000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f7491000 end: f74b1000 offset: 0 load_bias: 0 flags: 5 name: /lib/i386-linux-gnu/ld-2.19.so
-map: start: f74b1000 end: f74b2000 offset: 1f000 load_bias: 0 flags: 1 name: /lib/i386-linux-gnu/ld-2.19.so
-map: start: f74b2000 end: f74b3000 offset: 20000 load_bias: 0 flags: 3 name: /lib/i386-linux-gnu/ld-2.19.so
-map: start: f74b3000 end: f77c6000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/nativetest/backtrace_test/backtrace_test32
-map: start: f77c6000 end: f77c7000 offset: 0 load_bias: ffffe000 flags: 5 name: [vdso]
-map: start: f77c7000 end: f77d4000 offset: 313000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/nativetest/backtrace_test/backtrace_test32
-map: start: f77d4000 end: f77d5000 offset: 320000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/nativetest/backtrace_test/backtrace_test32
-map: start: f77d5000 end: f77d6000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: f7ec6000 end: f7ee7000 offset: 0 load_bias: 0 flags: 3 name: [heap]
-map: start: ffe4e000 end: ffe70000 offset: 0 load_bias: 0 flags: 3 name: [stack]
-ucontext: 96 0000000000000000000000000000000000000000abdae6ff00000000afdae6ff78dae6ff150000001c000000b8f132f7a0f132f7d0df48f7a0ca48f728d9e6ff000000000000000000000000ceca48f7a8dae6ff000000000000000000000000
-stack: start: f732c000 end: f7330000 size: 16384 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009d9d49f761b009f71e382ff7000000000000000000000000000000000000000002000000f6372ff704c82bf70000000000204bf7f0a908f7ceca48f728d9e6fff4a449f70000000020f332f720f332f7d0df48f7f8f132f794c748f720f332f70c144205978142a8d4be08f7d0df48f720f332f7a0ca48f71c000000150000000e000000070000001c000000a0ca48f7d0df48f748f232f739c848f7070000000e000000150000001c000000a0ca48f720f332f70000000000000000d0df48f720f332f7a0ca48f7100000000c000000080000000400000010000000a0ca48f7d0df48f798f232f7c9c848f704000000080000000c00000010000000a0ca48f720f332f70000000000000000d0df48f720f332f7a0ca48f70800000006000000040000000200000008000000a0ca48f7d0df48f7e8f232f759c948f702000000040000000600000008000000a0ca48f720f332f70000000000000000d0df48f720f332f7a0ca48f7040000000300000002000000010000000046bdaa00000000d0df48f738f332f77cca48f701000000020000000300000004000000a0ca48f720f332f700000000f83b7df7696d4df7d0df48f788dae6ff28d9e6ff28d9e6ff88dae6ff58f332f70046bdaa40fb32f7f83b7df758f332f78d6d4df728d9e6ff88dae6fff83b7df728d9e6ff28d9e6ff009030f728f432f7726f2ff728d9e6ff40fb32f740fb32f740fb32f790f332f700000000000000000000000000000000000000000000000000000000009030f740fb32f7000f3d0028f432f703b12c75032f144e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a06e2ff700000000000f3d00000000008e3f17f740fb32f7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a03823f7c4fd32f700000000e0341df7e02e1df7e03d1df70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040fb32f7188eecf740fb32f70100000030647cf70046bdaa28658876000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060a705f7a4b130f7f2860000f1860000b0fb32f7ecffffff000000000000000090f332f7000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ccfb32f70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000c2638cfa7f3e1d0000000000000000000000000000000000406d4df728d9e6ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c032f7004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-function: start: 0 end: f748c740 name: unknown_start
-function: start: f748c740 end: f748c7c0 name: test_level_four
-function: start: f748c7c0 end: f748c850 name: test_level_three
-function: start: f748c850 end: f748c8e0 name: test_level_two
-function: start: f748c8e0 end: f748c970 name: test_level_one
-function: start: f748c970 end: f748ca10 name: test_recursive_call
-function: start: f748ca10 end: ffffffff name: test_get_context_and_wait
-function: start: ffffffff end: ffffffff name: unknown_end
diff --git a/libbacktrace/testdata/x86_64/libbacktrace_test_eh_frame.so b/libbacktrace/testdata/x86_64/libbacktrace_test_eh_frame.so
deleted file mode 100755
index f116658..0000000
--- a/libbacktrace/testdata/x86_64/libbacktrace_test_eh_frame.so
+++ /dev/null
Binary files differ
diff --git a/libbacktrace/testdata/x86_64/offline_testdata b/libbacktrace/testdata/x86_64/offline_testdata
deleted file mode 100644
index c6bb241..0000000
--- a/libbacktrace/testdata/x86_64/offline_testdata
+++ /dev/null
@@ -1,93 +0,0 @@
-pid: 25683 tid: 25692
-map: start: 7fd5aa784000 end: 7fd5aa93e000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libc-2.19.so
-map: start: 7fd5aa93e000 end: 7fd5aab3e000 offset: 1ba000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libc-2.19.so
-map: start: 7fd5aab3e000 end: 7fd5aab42000 offset: 1ba000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/libc-2.19.so
-map: start: 7fd5aab42000 end: 7fd5aab44000 offset: 1be000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libc-2.19.so
-map: start: 7fd5aab44000 end: 7fd5aab49000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5aab49000 end: 7fd5aac4e000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libm-2.19.so
-map: start: 7fd5aac4e000 end: 7fd5aae4d000 offset: 105000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libm-2.19.so
-map: start: 7fd5aae4d000 end: 7fd5aae4e000 offset: 104000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/libm-2.19.so
-map: start: 7fd5aae4e000 end: 7fd5aae4f000 offset: 105000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libm-2.19.so
-map: start: 7fd5aae4f000 end: 7fd5aae65000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libgcc_s.so.1
-map: start: 7fd5aae65000 end: 7fd5ab064000 offset: 16000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libgcc_s.so.1
-map: start: 7fd5ab064000 end: 7fd5ab065000 offset: 15000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libgcc_s.so.1
-map: start: 7fd5ab065000 end: 7fd5ab08a000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libtinfo.so.5.9
-map: start: 7fd5ab08a000 end: 7fd5ab289000 offset: 25000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libtinfo.so.5.9
-map: start: 7fd5ab289000 end: 7fd5ab28d000 offset: 24000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/libtinfo.so.5.9
-map: start: 7fd5ab28d000 end: 7fd5ab28e000 offset: 28000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libtinfo.so.5.9
-map: start: 7fd5ab28e000 end: 7fd5ab2b0000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libncurses.so.5.9
-map: start: 7fd5ab2b0000 end: 7fd5ab4af000 offset: 22000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libncurses.so.5.9
-map: start: 7fd5ab4af000 end: 7fd5ab4b0000 offset: 21000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/libncurses.so.5.9
-map: start: 7fd5ab4b0000 end: 7fd5ab4b1000 offset: 22000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libncurses.so.5.9
-map: start: 7fd5ab4b1000 end: 7fd5ab4b4000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libdl-2.19.so
-map: start: 7fd5ab4b4000 end: 7fd5ab6b3000 offset: 3000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libdl-2.19.so
-map: start: 7fd5ab6b3000 end: 7fd5ab6b4000 offset: 2000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/libdl-2.19.so
-map: start: 7fd5ab6b4000 end: 7fd5ab6b5000 offset: 3000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libdl-2.19.so
-map: start: 7fd5ab6b5000 end: 7fd5ab6bc000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/librt-2.19.so
-map: start: 7fd5ab6bc000 end: 7fd5ab8bb000 offset: 7000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/librt-2.19.so
-map: start: 7fd5ab8bb000 end: 7fd5ab8bc000 offset: 6000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/librt-2.19.so
-map: start: 7fd5ab8bc000 end: 7fd5ab8bd000 offset: 7000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/librt-2.19.so
-map: start: 7fd5ab8bd000 end: 7fd5ab8d6000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/libpthread-2.19.so
-map: start: 7fd5ab8d6000 end: 7fd5abad5000 offset: 19000 load_bias: 0 flags: 0 name: /lib/x86_64-linux-gnu/libpthread-2.19.so
-map: start: 7fd5abad5000 end: 7fd5abad6000 offset: 18000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/libpthread-2.19.so
-map: start: 7fd5abad6000 end: 7fd5abad7000 offset: 19000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/libpthread-2.19.so
-map: start: 7fd5abad7000 end: 7fd5abadb000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abadb000 end: 7fd5abafe000 offset: 0 load_bias: 0 flags: 5 name: /lib/x86_64-linux-gnu/ld-2.19.so
-map: start: 7fd5abb17000 end: 7fd5abb1a000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abb1a000 end: 7fd5abb40000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblzma.so
-map: start: 7fd5abb40000 end: 7fd5abb41000 offset: 25000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblzma.so
-map: start: 7fd5abb41000 end: 7fd5abb42000 offset: 26000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblzma.so
-map: start: 7fd5abb42000 end: 7fd5abb4b000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abb6a000 end: 7fd5abb70000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abb70000 end: 7fd5abc62000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libc++.so
-map: start: 7fd5abc62000 end: 7fd5abc63000 offset: f2000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libc++.so
-map: start: 7fd5abc63000 end: 7fd5abc6b000 offset: f2000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libc++.so
-map: start: 7fd5abc6b000 end: 7fd5abc6c000 offset: fa000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libc++.so
-map: start: 7fd5abc6c000 end: 7fd5abc70000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abc70000 end: 7fd5abc8d000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libunwind.so
-map: start: 7fd5abc8d000 end: 7fd5abc8e000 offset: 1c000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libunwind.so
-map: start: 7fd5abc8e000 end: 7fd5abc8f000 offset: 1d000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libunwind.so
-map: start: 7fd5abc8f000 end: 7fd5abcb8000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abcb8000 end: 7fd5abcbe000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblog.so
-map: start: 7fd5abcbe000 end: 7fd5abcbf000 offset: 6000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblog.so
-map: start: 7fd5abcbf000 end: 7fd5abcc0000 offset: 6000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblog.so
-map: start: 7fd5abcc0000 end: 7fd5abcc1000 offset: 7000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/liblog.so
-map: start: 7fd5abcc1000 end: 7fd5abcc2000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abcc2000 end: 7fd5abccd000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libcutils.so
-map: start: 7fd5abccd000 end: 7fd5abcce000 offset: b000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libcutils.so
-map: start: 7fd5abcce000 end: 7fd5abccf000 offset: b000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libcutils.so
-map: start: 7fd5abccf000 end: 7fd5abcd0000 offset: c000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libcutils.so
-map: start: 7fd5abcd0000 end: 7fd5abcdf000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbase.so
-map: start: 7fd5abcdf000 end: 7fd5abce0000 offset: f000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbase.so
-map: start: 7fd5abce0000 end: 7fd5abce1000 offset: f000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbase.so
-map: start: 7fd5abce1000 end: 7fd5abce2000 offset: 10000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbase.so
-map: start: 7fd5abce2000 end: 7fd5abcf5000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace.so
-map: start: 7fd5abcf5000 end: 7fd5abcf6000 offset: 12000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace.so
-map: start: 7fd5abcf6000 end: 7fd5abcf7000 offset: 13000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace.so
-map: start: 7fd5abcf7000 end: 7fd5abcf8000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace_test.so
-map: start: 7fd5abcf8000 end: 7fd5abcf9000 offset: 1000 load_bias: 0 flags: 0 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace_test.so
-map: start: 7fd5abcf9000 end: 7fd5abcfa000 offset: 1000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace_test.so
-map: start: 7fd5abcfa000 end: 7fd5abcfb000 offset: 2000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/lib64/libbacktrace_test.so
-map: start: 7fd5abcfb000 end: 7fd5abcfd000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abcfd000 end: 7fd5abcfe000 offset: 22000 load_bias: 0 flags: 1 name: /lib/x86_64-linux-gnu/ld-2.19.so
-map: start: 7fd5abcfe000 end: 7fd5abcff000 offset: 23000 load_bias: 0 flags: 3 name: /lib/x86_64-linux-gnu/ld-2.19.so
-map: start: 7fd5abcff000 end: 7fd5abd00000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5abd00000 end: 7fd5ac053000 offset: 0 load_bias: 0 flags: 5 name: /ssd/android/aosp_master/out/host/linux-x86/nativetest64/backtrace_test/backtrace_test64
-map: start: 7fd5ac053000 end: 7fd5ac054000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5ac054000 end: 7fd5ac06f000 offset: 353000 load_bias: 0 flags: 1 name: /ssd/android/aosp_master/out/host/linux-x86/nativetest64/backtrace_test/backtrace_test64
-map: start: 7fd5ac06f000 end: 7fd5ac070000 offset: 36e000 load_bias: 0 flags: 3 name: /ssd/android/aosp_master/out/host/linux-x86/nativetest64/backtrace_test/backtrace_test64
-map: start: 7fd5ac070000 end: 7fd5ac071000 offset: 0 load_bias: 0 flags: 3 name: 
-map: start: 7fd5ad54e000 end: 7fd5ad56f000 offset: 0 load_bias: 0 flags: 3 name: [heap]
-map: start: 7ffcf47ed000 end: 7ffcf480f000 offset: 0 load_bias: 0 flags: 3 name: [stack]
-map: start: 7ffcf48d5000 end: 7ffcf48d7000 offset: 0 load_bias: ffffffffff700000 flags: 5 name: [vdso]
-map: start: ffffffffff600000 end: ffffffffff601000 offset: 0 load_bias: 0 flags: 5 name: [vsyscall]
-ucontext: 224 00000000000000000000000000000000000000000000000000000000000000000000000000000000b07bcfabd57f000098deb6abd57f0000b82455add57f0000010000000000000000000000000000000000000000000000c0e354add57f000000e7b6abd57f0000c8b080f4fc7f00000e0000000000000080ddb6abd57f000000000000000000001500000000000000b07bcfabd57f00001c0000000000000060ddb6abd57f0000d07bcfabd57f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-stack: start: 7fd5abb6b000 end: 7fd5abb6f000 size: 16384 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c4eaeabd57f00000000000000000000978142a8000000000f0000000000000012000000000000003888b4abd57f0000e657aeabd57f00000000000000000000a0dcb6abd57f0000307d78aad57f0000b0ddb6abd57f000028d978aad57f0000060aa10200000000a0ddb6abd57f0000000000000000000000000000000000002091b1abd57f0000e094b4abd57f000017008cabd57f0000c84d79aad57f000028e28babd57f00000000000005000000d503000001000000000000000000000068deb6abd57f000040deb6abd57f00002091b1abd57f00000100000000000000e0f3c6abd57f000088f0c6abd57f00006159aeabd57f000000000000000000002091b1abd57f000005000000000000000000000000000000010000000000000088f0c6abd57f00000000000000000000d07bcfabd57f00000000000000000000000000000000000098deb6abd57f000098deb6abd57f0000b0ddb6abd57f00006179cfabd57f000098deb6abd57f0000b07bcfabd57f00001c000000150000000e00000007000000f0ddb6abd57f0000e179cfabd57f00000000000000000000150000001c00000098deb6abd57f0000b07bcfabd57f0000100000000c000000080000000400000030deb6abd57f0000417acfabd57f000000000000000000000c0000001000000098deb6abd57f0000b07bcfabd57f00000800000006000000040000000200000070deb6abd57f0000a17acfabd57f00000000000000000000060000000800000098deb6abd57f0000b07bcfabd57f000004000000030000000200000001000000b0deb6abd57f0000817bcfabd57f0000000000000000000074b480f4fc7f0000c8b080f4fc7f0000c8b080f4fc7f000074b480f4fc7f000000006a80f3f73cf1d0deb6abd57f00002a52d5abd57f0000c8b080f4fc7f0000c8b080f4fc7f0000000000000000000084518cabd57f0000000000000000000000e7b6abd57f000000e7b6abd57f00008f990b1e3bad5a6700000000000000000000000000000000c0e354add57f000000e7b6abd57f00008f99cba356faf1988f9991bc23faf1980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e7b6abd57f00007de387aad57f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006030b4aad57f0000b8edb6abd57f00000000000000000000000000000000000080b88eaad57f0000000000000000000080b28eaad57f0000000000000000000080c18eaad57f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e7b6abd57f0000402555add57f000000e7b6abd57f00000100000000000000000000000000000000006a80f3f73cf1058f9d56adb3c7cc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000407ab1abd57f000030a3adabd57f00005c64000053640000e0e9b6abd57f0000e0e9b6abd57f0000e0ffffffffffffff00000000000000000000000000000000f0deb6abd57f00000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010eab6abd57f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000c46ad90f52391d00000000000000000000000000000000000000000000000000f051d5abd57f0000c8b080f4fc7f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b0b6abd57f000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-function: start: 0 end: 7fd5abcf7930 name: unknown_start
-function: start: 7fd5abcf7930 end: 7fd5abcf7990 name: test_level_four
-function: start: 7fd5abcf7990 end: 7fd5abcf79f0 name: test_level_three
-function: start: 7fd5abcf79f0 end: 7fd5abcf7a50 name: test_level_two
-function: start: 7fd5abcf7a50 end: 7fd5abcf7ab0 name: test_level_one
-function: start: 7fd5abcf7ab0 end: 7fd5abcf7b30 name: test_recursive_call
-function: start: 7fd5abcf7b30 end: ffffffffffffffff name: test_get_context_and_wait
-function: start: ffffffffffffffff end: ffffffffffffffff name: unknown_end
diff --git a/libbacktrace/.clang-format b/libcrypto_utils/.clang-format
similarity index 100%
rename from libbacktrace/.clang-format
rename to libcrypto_utils/.clang-format
diff --git a/libcrypto_utils/Android.bp b/libcrypto_utils/Android.bp
index d7175e0..923b291 100644
--- a/libcrypto_utils/Android.bp
+++ b/libcrypto_utils/Android.bp
@@ -23,7 +23,7 @@
     },
     host_supported: true,
     srcs: [
-        "android_pubkey.c",
+        "android_pubkey.cpp",
     ],
     cflags: [
         "-Wall",
diff --git a/libcrypto_utils/android_pubkey.c b/libcrypto_utils/android_pubkey.c
deleted file mode 100644
index 3052e52..0000000
--- a/libcrypto_utils/android_pubkey.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <crypto_utils/android_pubkey.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <openssl/bn.h>
-
-// Better safe than sorry.
-#if (ANDROID_PUBKEY_MODULUS_SIZE % 4) != 0
-#error RSA modulus size must be multiple of the word size!
-#endif
-
-// Size of the RSA modulus in words.
-#define ANDROID_PUBKEY_MODULUS_SIZE_WORDS (ANDROID_PUBKEY_MODULUS_SIZE / 4)
-
-// This file implements encoding and decoding logic for Android's custom RSA
-// public key binary format. Public keys are stored as a sequence of
-// little-endian 32 bit words. Note that Android only supports little-endian
-// processors, so we don't do any byte order conversions when parsing the binary
-// struct.
-typedef struct RSAPublicKey {
-    // Modulus length. This must be ANDROID_PUBKEY_MODULUS_SIZE.
-    uint32_t modulus_size_words;
-
-    // Precomputed montgomery parameter: -1 / n[0] mod 2^32
-    uint32_t n0inv;
-
-    // RSA modulus as a little-endian array.
-    uint8_t modulus[ANDROID_PUBKEY_MODULUS_SIZE];
-
-    // Montgomery parameter R^2 as a little-endian array of little-endian words.
-    uint8_t rr[ANDROID_PUBKEY_MODULUS_SIZE];
-
-    // RSA modulus: 3 or 65537
-    uint32_t exponent;
-} RSAPublicKey;
-
-// Reverses byte order in |buffer|.
-static void reverse_bytes(uint8_t* buffer, size_t size) {
-  for (size_t i = 0; i < (size + 1) / 2; ++i) {
-    uint8_t tmp = buffer[i];
-    buffer[i] = buffer[size - i - 1];
-    buffer[size - i - 1] = tmp;
-  }
-}
-
-bool android_pubkey_decode(const uint8_t* key_buffer, size_t size, RSA** key) {
-  const RSAPublicKey* key_struct = (RSAPublicKey*)key_buffer;
-  bool ret = false;
-  uint8_t modulus_buffer[ANDROID_PUBKEY_MODULUS_SIZE];
-  RSA* new_key = RSA_new();
-  if (!new_key) {
-    goto cleanup;
-  }
-
-  // Check |size| is large enough and the modulus size is correct.
-  if (size < sizeof(RSAPublicKey)) {
-    goto cleanup;
-  }
-  if (key_struct->modulus_size_words != ANDROID_PUBKEY_MODULUS_SIZE_WORDS) {
-    goto cleanup;
-  }
-
-  // Convert the modulus to big-endian byte order as expected by BN_bin2bn.
-  memcpy(modulus_buffer, key_struct->modulus, sizeof(modulus_buffer));
-  reverse_bytes(modulus_buffer, sizeof(modulus_buffer));
-  new_key->n = BN_bin2bn(modulus_buffer, sizeof(modulus_buffer), NULL);
-  if (!new_key->n) {
-    goto cleanup;
-  }
-
-  // Read the exponent.
-  new_key->e = BN_new();
-  if (!new_key->e || !BN_set_word(new_key->e, key_struct->exponent)) {
-    goto cleanup;
-  }
-
-  // Note that we don't extract the montgomery parameters n0inv and rr from
-  // the RSAPublicKey structure. They assume a word size of 32 bits, but
-  // BoringSSL may use a word size of 64 bits internally, so we're lacking the
-  // top 32 bits of n0inv in general. For now, we just ignore the parameters
-  // and have BoringSSL recompute them internally. More sophisticated logic can
-  // be added here if/when we want the additional speedup from using the
-  // pre-computed montgomery parameters.
-
-  *key = new_key;
-  ret = true;
-
-cleanup:
-  if (!ret && new_key) {
-    RSA_free(new_key);
-  }
-  return ret;
-}
-
-static bool android_pubkey_encode_bignum(const BIGNUM* num, uint8_t* buffer) {
-  if (!BN_bn2bin_padded(buffer, ANDROID_PUBKEY_MODULUS_SIZE, num)) {
-    return false;
-  }
-
-  reverse_bytes(buffer, ANDROID_PUBKEY_MODULUS_SIZE);
-  return true;
-}
-
-bool android_pubkey_encode(const RSA* key, uint8_t* key_buffer, size_t size) {
-  RSAPublicKey* key_struct = (RSAPublicKey*)key_buffer;
-  bool ret = false;
-  BN_CTX* ctx = BN_CTX_new();
-  BIGNUM* r32 = BN_new();
-  BIGNUM* n0inv = BN_new();
-  BIGNUM* rr = BN_new();
-
-  if (sizeof(RSAPublicKey) > size ||
-      RSA_size(key) != ANDROID_PUBKEY_MODULUS_SIZE) {
-    goto cleanup;
-  }
-
-  // Store the modulus size.
-  key_struct->modulus_size_words = ANDROID_PUBKEY_MODULUS_SIZE_WORDS;
-
-  // Compute and store n0inv = -1 / N[0] mod 2^32.
-  if (!ctx || !r32 || !n0inv || !BN_set_bit(r32, 32) ||
-      !BN_mod(n0inv, key->n, r32, ctx) ||
-      !BN_mod_inverse(n0inv, n0inv, r32, ctx) || !BN_sub(n0inv, r32, n0inv)) {
-    goto cleanup;
-  }
-  key_struct->n0inv = (uint32_t)BN_get_word(n0inv);
-
-  // Store the modulus.
-  if (!android_pubkey_encode_bignum(key->n, key_struct->modulus)) {
-    goto cleanup;
-  }
-
-  // Compute and store rr = (2^(rsa_size)) ^ 2 mod N.
-  if (!ctx || !rr || !BN_set_bit(rr, ANDROID_PUBKEY_MODULUS_SIZE * 8) ||
-      !BN_mod_sqr(rr, rr, key->n, ctx) ||
-      !android_pubkey_encode_bignum(rr, key_struct->rr)) {
-    goto cleanup;
-  }
-
-  // Store the exponent.
-  key_struct->exponent = (uint32_t)BN_get_word(key->e);
-
-  ret = true;
-
-cleanup:
-  BN_free(rr);
-  BN_free(n0inv);
-  BN_free(r32);
-  BN_CTX_free(ctx);
-  return ret;
-}
diff --git a/libcrypto_utils/android_pubkey.cpp b/libcrypto_utils/android_pubkey.cpp
new file mode 100644
index 0000000..21e5663
--- /dev/null
+++ b/libcrypto_utils/android_pubkey.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#include <crypto_utils/android_pubkey.h>
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <openssl/bn.h>
+
+// Better safe than sorry.
+#if (ANDROID_PUBKEY_MODULUS_SIZE % 4) != 0
+#error RSA modulus size must be multiple of the word size!
+#endif
+
+// Size of the RSA modulus in words.
+#define ANDROID_PUBKEY_MODULUS_SIZE_WORDS (ANDROID_PUBKEY_MODULUS_SIZE / 4)
+
+// This file implements encoding and decoding logic for Android's custom RSA
+// public key binary format. Public keys are stored as a sequence of
+// little-endian 32 bit words. Note that Android only supports little-endian
+// processors, so we don't do any byte order conversions when parsing the binary
+// struct.
+struct RSAPublicKey {
+  // Modulus length. This must be ANDROID_PUBKEY_MODULUS_SIZE.
+  uint32_t modulus_size_words;
+
+  // Precomputed montgomery parameter: -1 / n[0] mod 2^32
+  uint32_t n0inv;
+
+  // RSA modulus as a little-endian array.
+  uint8_t modulus[ANDROID_PUBKEY_MODULUS_SIZE];
+
+  // Montgomery parameter R^2 as a little-endian array.
+  uint8_t rr[ANDROID_PUBKEY_MODULUS_SIZE];
+
+  // RSA modulus: 3 or 65537
+  uint32_t exponent;
+};
+
+bool android_pubkey_decode(const uint8_t* key_buffer, size_t size, RSA** key) {
+  const RSAPublicKey* key_struct = (RSAPublicKey*)key_buffer;
+  bool ret = false;
+  RSA* new_key = RSA_new();
+  BIGNUM* n = NULL;
+  BIGNUM* e = NULL;
+  if (!new_key) {
+    goto cleanup;
+  }
+
+  // Check |size| is large enough and the modulus size is correct.
+  if (size < sizeof(RSAPublicKey)) {
+    goto cleanup;
+  }
+  if (key_struct->modulus_size_words != ANDROID_PUBKEY_MODULUS_SIZE_WORDS) {
+    goto cleanup;
+  }
+
+  // Convert the modulus to big-endian byte order as expected by BN_bin2bn.
+  n = BN_le2bn(key_struct->modulus, ANDROID_PUBKEY_MODULUS_SIZE, NULL);
+  if (!n) {
+    goto cleanup;
+  }
+
+  // Read the exponent.
+  e = BN_new();
+  if (!e || !BN_set_word(e, key_struct->exponent)) {
+    goto cleanup;
+  }
+
+  if (!RSA_set0_key(new_key, n, e, NULL)) {
+    goto cleanup;
+  }
+  // RSA_set0_key takes ownership of its inputs on success.
+  n = NULL;
+  e = NULL;
+
+  // Note that we don't extract the montgomery parameters n0inv and rr from
+  // the RSAPublicKey structure. They assume a word size of 32 bits, but
+  // BoringSSL may use a word size of 64 bits internally, so we're lacking the
+  // top 32 bits of n0inv in general. For now, we just ignore the parameters
+  // and have BoringSSL recompute them internally. More sophisticated logic can
+  // be added here if/when we want the additional speedup from using the
+  // pre-computed montgomery parameters.
+
+  *key = new_key;
+  new_key = NULL;
+  ret = true;
+
+cleanup:
+  RSA_free(new_key);
+  BN_free(n);
+  BN_free(e);
+  return ret;
+}
+
+bool android_pubkey_encode(const RSA* key, uint8_t* key_buffer, size_t size) {
+  RSAPublicKey* key_struct = (RSAPublicKey*)key_buffer;
+  bool ret = false;
+  BN_CTX* ctx = BN_CTX_new();
+  BIGNUM* r32 = BN_new();
+  BIGNUM* n0inv = BN_new();
+  BIGNUM* rr = BN_new();
+
+  if (sizeof(RSAPublicKey) > size || RSA_size(key) != ANDROID_PUBKEY_MODULUS_SIZE) {
+    goto cleanup;
+  }
+
+  // Store the modulus size.
+  key_struct->modulus_size_words = ANDROID_PUBKEY_MODULUS_SIZE_WORDS;
+
+  // Compute and store n0inv = -1 / N[0] mod 2^32.
+  if (!ctx || !r32 || !n0inv || !BN_set_bit(r32, 32) || !BN_mod(n0inv, RSA_get0_n(key), r32, ctx) ||
+      !BN_mod_inverse(n0inv, n0inv, r32, ctx) || !BN_sub(n0inv, r32, n0inv)) {
+    goto cleanup;
+  }
+  key_struct->n0inv = (uint32_t)BN_get_word(n0inv);
+
+  // Store the modulus.
+  if (!BN_bn2le_padded(key_struct->modulus, ANDROID_PUBKEY_MODULUS_SIZE, RSA_get0_n(key))) {
+    goto cleanup;
+  }
+
+  // Compute and store rr = (2^(rsa_size)) ^ 2 mod N.
+  if (!ctx || !rr || !BN_set_bit(rr, ANDROID_PUBKEY_MODULUS_SIZE * 8) ||
+      !BN_mod_sqr(rr, rr, RSA_get0_n(key), ctx) ||
+      !BN_bn2le_padded(key_struct->rr, ANDROID_PUBKEY_MODULUS_SIZE, rr)) {
+    goto cleanup;
+  }
+
+  // Store the exponent.
+  key_struct->exponent = (uint32_t)BN_get_word(RSA_get0_e(key));
+
+  ret = true;
+
+cleanup:
+  BN_free(rr);
+  BN_free(n0inv);
+  BN_free(r32);
+  BN_CTX_free(ctx);
+  return ret;
+}
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 24110ee..c75e538 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -14,6 +14,11 @@
 // limitations under the License.
 //
 
+filegroup {
+    name: "android_filesystem_config_header",
+    srcs: ["include/private/android_filesystem_config.h"],
+}
+
 // some files must not be compiled when building against Mingw
 // they correspond to features not used by our host development tools
 // which are also hard or even impossible to port to native Win32
@@ -27,7 +32,10 @@
 cc_library_headers {
     name: "libcutils_headers",
     vendor_available: true,
+    product_available: true,
     recovery_available: true,
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     host_supported: true,
     apex_available: [
         "//apex_available:platform",
@@ -38,7 +46,10 @@
     export_include_dirs: ["include"],
     target: {
         vendor: {
-            override_export_include_dirs: ["include_vndk"],
+            override_export_include_dirs: ["include_outside_system"],
+        },
+        product: {
+            override_export_include_dirs: ["include_outside_system"],
         },
         linux_bionic: {
             enabled: true,
@@ -53,7 +64,10 @@
 cc_library {
     name: "libcutils_sockets",
     vendor_available: true,
+    product_available: true,
     recovery_available: true,
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     host_supported: true,
     native_bridge_supported: true,
     apex_available: [
@@ -134,11 +148,13 @@
 cc_library {
     name: "libcutils",
     vendor_available: true,
+    product_available: true,
     vndk: {
         enabled: true,
         support_system_process: true,
     },
     recovery_available: true,
+    vendor_ramdisk_available: true,
     host_supported: true,
     apex_available: [
         "//apex_available:platform",
@@ -152,6 +168,7 @@
         "iosched_policy.cpp",
         "load_file.cpp",
         "native_handle.cpp",
+        "properties.cpp",
         "record_stream.cpp",
         "strlcpy.c",
         "threads.cpp",
@@ -187,7 +204,6 @@
                 "fs_config.cpp",
                 "klog.cpp",
                 "partition_utils.cpp",
-                "properties.cpp",
                 "qtaguid.cpp",
                 "trace-dev.cpp",
                 "uevent.cpp",
@@ -220,14 +236,19 @@
             },
         },
 
+        // qtaguid.cpp loads libnetd_client.so with dlopen().  Since
+        // the interface of libnetd_client.so may vary between AOSP
+        // releases, exclude qtaguid.cpp from the VNDK-SP variant.
         vendor: {
             exclude_srcs: [
-                // qtaguid.cpp loads libnetd_client.so with dlopen().  Since
-                // the interface of libnetd_client.so may vary between AOSP
-                // releases, exclude qtaguid.cpp from the VNDK-SP variant.
                 "qtaguid.cpp",
             ],
-        }
+        },
+        product: {
+            exclude_srcs: [
+                "qtaguid.cpp",
+            ],
+        },
     },
 
     whole_static_libs: ["libcutils_sockets"],
@@ -258,6 +279,7 @@
     name: "libcutils_test_default",
     srcs: [
         "native_handle_test.cpp",
+        "properties_test.cpp",
         "sockets_test.cpp",
     ],
 
@@ -269,7 +291,6 @@
                 "ashmem_test.cpp",
                 "fs_config_test.cpp",
                 "multiuser_test.cpp",
-                "properties_test.cpp",
                 "sched_policy_test.cpp",
                 "str_parms_test.cpp",
                 "trace-dev_test.cpp",
diff --git a/libcutils/OWNERS b/libcutils/OWNERS
index c18ed51..7529cb9 100644
--- a/libcutils/OWNERS
+++ b/libcutils/OWNERS
@@ -1,4 +1 @@
-cferris@google.com
-enh@google.com
-jmgao@google.com
-tomcherry@google.com
+include platform/system/core:/janitors/OWNERS
diff --git a/libcutils/ashmem-dev.cpp b/libcutils/ashmem-dev.cpp
index 8c232f0..6a27f9a 100644
--- a/libcutils/ashmem-dev.cpp
+++ b/libcutils/ashmem-dev.cpp
@@ -122,7 +122,8 @@
         return true;
     }
 
-    /* If its not a number, assume string, but check if its a sane string */
+    // Non-numeric should be a single ASCII character. Characters after the
+    // first are ignored.
     if (tolower(vndk_version[0]) < 'a' || tolower(vndk_version[0]) > 'z') {
         ALOGE("memfd: ro.vndk.version not defined or invalid (%s), this is mandated since P.\n",
               vndk_version.c_str());
@@ -158,9 +159,11 @@
         return false;
     }
 
-    /* Check if kernel support exists, otherwise fall back to ashmem */
+    // Check if kernel support exists, otherwise fall back to ashmem.
+    // This code needs to build on old API levels, so we can't use the libc
+    // wrapper.
     android::base::unique_fd fd(
-            syscall(__NR_memfd_create, "test_android_memfd", MFD_ALLOW_SEALING));
+            syscall(__NR_memfd_create, "test_android_memfd", MFD_CLOEXEC | MFD_ALLOW_SEALING));
     if (fd == -1) {
         ALOGE("memfd_create failed: %s, no memfd support.\n", strerror(errno));
         return false;
@@ -211,13 +214,16 @@
 
     // fallback for APEX w/ use_vendor on Q, which would have still used /dev/ashmem
     if (fd < 0) {
+        int saved_errno = errno;
         fd = TEMP_FAILURE_RETRY(open("/dev/ashmem", O_RDWR | O_CLOEXEC));
+        if (fd < 0) {
+            /* Q launching devices and newer must not reach here since they should have been
+             * able to open ashmem_device_path */
+            ALOGE("Unable to open ashmem device %s (error = %s) and /dev/ashmem(error = %s)",
+                  ashmem_device_path.c_str(), strerror(saved_errno), strerror(errno));
+            return fd;
+        }
     }
-
-    if (fd < 0) {
-        return fd;
-    }
-
     struct stat st;
     int ret = TEMP_FAILURE_RETRY(fstat(fd, &st));
     if (ret < 0) {
@@ -329,7 +335,9 @@
 }
 
 static int memfd_create_region(const char* name, size_t size) {
-    android::base::unique_fd fd(syscall(__NR_memfd_create, name, MFD_ALLOW_SEALING));
+    // This code needs to build on old API levels, so we can't use the libc
+    // wrapper.
+    android::base::unique_fd fd(syscall(__NR_memfd_create, name, MFD_CLOEXEC | MFD_ALLOW_SEALING));
 
     if (fd == -1) {
         ALOGE("memfd_create(%s, %zd) failed: %s\n", name, size, strerror(errno));
diff --git a/libcutils/ashmem_test.cpp b/libcutils/ashmem_test.cpp
index b37d020..fb657f6 100644
--- a/libcutils/ashmem_test.cpp
+++ b/libcutils/ashmem_test.cpp
@@ -35,6 +35,11 @@
     ASSERT_TRUE(ashmem_valid(fd));
     ASSERT_EQ(size, static_cast<size_t>(ashmem_get_size_region(fd)));
     ASSERT_EQ(0, ashmem_set_prot_region(fd, prot));
+
+    // We've been inconsistent historically about whether or not these file
+    // descriptors were CLOEXEC. Make sure we're consistent going forward.
+    // https://issuetracker.google.com/165667331
+    ASSERT_EQ(FD_CLOEXEC, (fcntl(fd, F_GETFD) & FD_CLOEXEC));
 }
 
 void TestMmap(const unique_fd& fd, size_t size, int prot, void** region, off_t off = 0) {
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 5805a4d..79c3abc 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -80,6 +80,7 @@
     { 00771, AID_SYSTEM,       AID_SYSTEM,       0, "data" },
     { 00755, AID_ROOT,         AID_SYSTEM,       0, "mnt" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "product/bin" },
+    { 00751, AID_ROOT,         AID_SHELL,        0, "product/apex/*/bin" },
     { 00777, AID_ROOT,         AID_ROOT,         0, "sdcard" },
     { 00751, AID_ROOT,         AID_SDCARD_R,     0, "storage" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "system/bin" },
@@ -90,6 +91,7 @@
     { 00751, AID_ROOT,         AID_SHELL,        0, "system_ext/bin" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "system_ext/apex/*/bin" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "vendor/bin" },
+    { 00751, AID_ROOT,         AID_SHELL,        0, "vendor/apex/*/bin" },
     { 00755, AID_ROOT,         AID_SHELL,        0, "vendor" },
     { 00755, AID_ROOT,         AID_ROOT,         0, 0 },
         // clang-format on
@@ -201,20 +203,28 @@
                                            CAP_MASK_LONG(CAP_SETGID),
                                               "system/bin/simpleperf_app_runner" },
     { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/e2fsck" },
-    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/tune2fs" },
+#ifdef __LP64__
+    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/linker64" },
+#else
+    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/linker" },
+#endif
     { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/resize2fs" },
+    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/snapuserd" },
+    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/tune2fs" },
     // generic defaults
     { 00755, AID_ROOT,      AID_ROOT,      0, "bin/*" },
     { 00640, AID_ROOT,      AID_SHELL,     0, "fstab.*" },
     { 00750, AID_ROOT,      AID_SHELL,     0, "init*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "odm/bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "product/bin/*" },
+    { 00755, AID_ROOT,      AID_SHELL,     0, "product/apex/*bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "system/bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "system/xbin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "system/apex/*/bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "system_ext/bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "system_ext/apex/*/bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "vendor/bin/*" },
+    { 00755, AID_ROOT,      AID_SHELL,     0, "vendor/apex/*bin/*" },
     { 00755, AID_ROOT,      AID_SHELL,     0, "vendor/xbin/*" },
     { 00644, AID_ROOT,      AID_ROOT,      0, 0 },
         // clang-format on
diff --git a/libcutils/include/cutils/ashmem.h b/libcutils/include/cutils/ashmem.h
index d80caa6..1913c1e 100644
--- a/libcutils/include/cutils/ashmem.h
+++ b/libcutils/include/cutils/ashmem.h
@@ -1,14 +1,20 @@
-/* cutils/ashmem.h
- **
- ** Copyright 2008 The Android Open Source Project
- **
- ** This file is dual licensed.  It may be redistributed and/or modified
- ** under the terms of the Apache 2.0 License OR version 2 of the GNU
- ** General Public License.
+/*
+ * Copyright (C) 2008 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.
  */
 
-#ifndef _CUTILS_ASHMEM_H
-#define _CUTILS_ASHMEM_H
+#pragma once
 
 #include <stddef.h>
 
@@ -30,5 +36,3 @@
 #ifdef __cplusplus
 }
 #endif
-
-#endif	/* _CUTILS_ASHMEM_H */
diff --git a/libcutils/include/cutils/properties.h b/libcutils/include/cutils/properties.h
index d2e0871..78d8bc6 100644
--- a/libcutils/include/cutils/properties.h
+++ b/libcutils/include/cutils/properties.h
@@ -14,27 +14,30 @@
  * limitations under the License.
  */
 
-#ifndef __CUTILS_PROPERTIES_H
-#define __CUTILS_PROPERTIES_H
+#pragma once
 
 #include <sys/cdefs.h>
 #include <stddef.h>
-#include <sys/system_properties.h>
 #include <stdint.h>
 
+#if __has_include(<sys/system_properties.h>)
+#include <sys/system_properties.h>
+#else
+#define PROP_VALUE_MAX 92
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/* System properties are *small* name value pairs managed by the
-** property service.  If your data doesn't fit in the provided
-** space it is not appropriate for a system property.
-**
-** WARNING: system/bionic/include/sys/system_properties.h also defines
-**          these, but with different names.  (TODO: fix that)
-*/
-#define PROPERTY_KEY_MAX   PROP_NAME_MAX
-#define PROPERTY_VALUE_MAX  PROP_VALUE_MAX
+//
+// Deprecated.
+//
+// See <android-base/properties.h> for better API.
+//
+
+#define PROPERTY_KEY_MAX PROP_NAME_MAX
+#define PROPERTY_VALUE_MAX PROP_VALUE_MAX
 
 /* property_get: returns the length of the value which will never be
 ** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
@@ -146,5 +149,3 @@
 #ifdef __cplusplus
 }
 #endif
-
-#endif
diff --git a/libcutils/include/cutils/threads.h b/libcutils/include/cutils/threads.h
index ba4846e..0f7f8a8 100644
--- a/libcutils/include/cutils/threads.h
+++ b/libcutils/include/cutils/threads.h
@@ -14,15 +14,14 @@
  * limitations under the License.
  */
 
-#ifndef _LIBS_CUTILS_THREADS_H
-#define _LIBS_CUTILS_THREADS_H
+#pragma once
 
 #include  <sys/types.h>
 
-#if !defined(_WIN32)
-#include <pthread.h>
-#else
+#if defined(_WIN32)
 #include <windows.h>
+#else
+#include <pthread.h>
 #endif
 
 #ifdef __cplusplus
@@ -32,46 +31,8 @@
 //
 // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows.
 //
-
 extern pid_t gettid();
 
-//
-// Deprecated: use `_Thread_local` in C or `thread_local` in C++.
-//
-
-#if !defined(_WIN32)
-
-typedef struct {
-    pthread_mutex_t   lock;
-    int               has_tls;
-    pthread_key_t     tls;
-} thread_store_t;
-
-#define  THREAD_STORE_INITIALIZER  { PTHREAD_MUTEX_INITIALIZER, 0, 0 }
-
-#else // !defined(_WIN32)
-
-typedef struct {
-    int               lock_init;
-    int               has_tls;
-    DWORD             tls;
-    CRITICAL_SECTION  lock;
-} thread_store_t;
-
-#define  THREAD_STORE_INITIALIZER  { 0, 0, 0, {0, 0, 0, 0, 0, 0} }
-
-#endif // !defined(_WIN32)
-
-typedef void  (*thread_store_destruct_t)(void*  value);
-
-extern void*  thread_store_get(thread_store_t*  store);
-
-extern void   thread_store_set(thread_store_t*          store,
-                               void*                    value,
-                               thread_store_destruct_t  destroy);
-
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* _LIBS_CUTILS_THREADS_H */
diff --git a/libcutils/include/cutils/trace.h b/libcutils/include/cutils/trace.h
index c74ee3e..793e2ce 100644
--- a/libcutils/include/cutils/trace.h
+++ b/libcutils/include/cutils/trace.h
@@ -75,7 +75,8 @@
 #define ATRACE_TAG_AIDL             (1<<24)
 #define ATRACE_TAG_NNAPI            (1<<25)
 #define ATRACE_TAG_RRO              (1<<26)
-#define ATRACE_TAG_LAST             ATRACE_TAG_RRO
+#define ATRACE_TAG_SYSPROP          (1<<27)
+#define ATRACE_TAG_LAST             ATRACE_TAG_SYSPROP
 
 // Reserved for initialization.
 #define ATRACE_TAG_NOT_READY        (1ULL<<63)
diff --git a/libcutils/include/private/android_filesystem_config.h b/libcutils/include/private/android_filesystem_config.h
index b73a29b..b4fe2e6 100644
--- a/libcutils/include/private/android_filesystem_config.h
+++ b/libcutils/include/private/android_filesystem_config.h
@@ -34,16 +34,9 @@
  * partition, from which the system reads passwd and group files.
  */
 
-#ifndef _ANDROID_FILESYSTEM_CONFIG_H_
-#define _ANDROID_FILESYSTEM_CONFIG_H_
+#pragma once
 
-#include <sys/types.h>
-
-#if !defined(__ANDROID_VNDK__) && !defined(EXCLUDE_FS_CONFIG_STRUCTURES)
-#include <private/fs_config.h>
-#endif
-
-/* This is the master Users and Groups config for the platform.
+/* This is the main Users and Groups config for the platform.
  * DO NOT EVER RENUMBER
  */
 
@@ -224,5 +217,3 @@
  * documented at the top of this header file.
  * Also see build/tools/fs_config for more details.
  */
-
-#endif
diff --git a/libcutils/include/private/canned_fs_config.h b/libcutils/include/private/canned_fs_config.h
index 135b91c..ad4de4c 100644
--- a/libcutils/include/private/canned_fs_config.h
+++ b/libcutils/include/private/canned_fs_config.h
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-#ifndef _CANNED_FS_CONFIG_H
-#define _CANNED_FS_CONFIG_H
+#pragma once
 
 #include <inttypes.h>
+#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 
@@ -26,5 +26,3 @@
                       unsigned* gid, unsigned* mode, uint64_t* capabilities);
 
 __END_DECLS
-
-#endif
diff --git a/libcutils/include_vndk/cutils/android_filesystem_config.h b/libcutils/include_outside_system/cutils/android_filesystem_config.h
similarity index 100%
rename from libcutils/include_vndk/cutils/android_filesystem_config.h
rename to libcutils/include_outside_system/cutils/android_filesystem_config.h
diff --git a/libcutils/include_vndk/cutils/android_get_control_file.h b/libcutils/include_outside_system/cutils/android_get_control_file.h
similarity index 100%
rename from libcutils/include_vndk/cutils/android_get_control_file.h
rename to libcutils/include_outside_system/cutils/android_get_control_file.h
diff --git a/libcutils/include_vndk/cutils/android_reboot.h b/libcutils/include_outside_system/cutils/android_reboot.h
similarity index 100%
rename from libcutils/include_vndk/cutils/android_reboot.h
rename to libcutils/include_outside_system/cutils/android_reboot.h
diff --git a/libcutils/include_vndk/cutils/ashmem.h b/libcutils/include_outside_system/cutils/ashmem.h
similarity index 100%
rename from libcutils/include_vndk/cutils/ashmem.h
rename to libcutils/include_outside_system/cutils/ashmem.h
diff --git a/libcutils/include_vndk/cutils/atomic.h b/libcutils/include_outside_system/cutils/atomic.h
similarity index 100%
rename from libcutils/include_vndk/cutils/atomic.h
rename to libcutils/include_outside_system/cutils/atomic.h
diff --git a/libcutils/include_vndk/cutils/bitops.h b/libcutils/include_outside_system/cutils/bitops.h
similarity index 100%
rename from libcutils/include_vndk/cutils/bitops.h
rename to libcutils/include_outside_system/cutils/bitops.h
diff --git a/libcutils/include_vndk/cutils/compiler.h b/libcutils/include_outside_system/cutils/compiler.h
similarity index 100%
rename from libcutils/include_vndk/cutils/compiler.h
rename to libcutils/include_outside_system/cutils/compiler.h
diff --git a/libcutils/include_vndk/cutils/config_utils.h b/libcutils/include_outside_system/cutils/config_utils.h
similarity index 100%
rename from libcutils/include_vndk/cutils/config_utils.h
rename to libcutils/include_outside_system/cutils/config_utils.h
diff --git a/libcutils/include_vndk/cutils/fs.h b/libcutils/include_outside_system/cutils/fs.h
similarity index 100%
rename from libcutils/include_vndk/cutils/fs.h
rename to libcutils/include_outside_system/cutils/fs.h
diff --git a/libcutils/include_vndk/cutils/hashmap.h b/libcutils/include_outside_system/cutils/hashmap.h
similarity index 100%
rename from libcutils/include_vndk/cutils/hashmap.h
rename to libcutils/include_outside_system/cutils/hashmap.h
diff --git a/libcutils/include_vndk/cutils/iosched_policy.h b/libcutils/include_outside_system/cutils/iosched_policy.h
similarity index 100%
rename from libcutils/include_vndk/cutils/iosched_policy.h
rename to libcutils/include_outside_system/cutils/iosched_policy.h
diff --git a/libcutils/include_vndk/cutils/klog.h b/libcutils/include_outside_system/cutils/klog.h
similarity index 100%
rename from libcutils/include_vndk/cutils/klog.h
rename to libcutils/include_outside_system/cutils/klog.h
diff --git a/libcutils/include_vndk/cutils/list.h b/libcutils/include_outside_system/cutils/list.h
similarity index 100%
rename from libcutils/include_vndk/cutils/list.h
rename to libcutils/include_outside_system/cutils/list.h
diff --git a/libcutils/include_vndk/cutils/log.h b/libcutils/include_outside_system/cutils/log.h
similarity index 100%
rename from libcutils/include_vndk/cutils/log.h
rename to libcutils/include_outside_system/cutils/log.h
diff --git a/libcutils/include_vndk/cutils/memory.h b/libcutils/include_outside_system/cutils/memory.h
similarity index 100%
rename from libcutils/include_vndk/cutils/memory.h
rename to libcutils/include_outside_system/cutils/memory.h
diff --git a/libcutils/include_vndk/cutils/misc.h b/libcutils/include_outside_system/cutils/misc.h
similarity index 100%
rename from libcutils/include_vndk/cutils/misc.h
rename to libcutils/include_outside_system/cutils/misc.h
diff --git a/libcutils/include_vndk/cutils/multiuser.h b/libcutils/include_outside_system/cutils/multiuser.h
similarity index 100%
rename from libcutils/include_vndk/cutils/multiuser.h
rename to libcutils/include_outside_system/cutils/multiuser.h
diff --git a/libcutils/include_vndk/cutils/native_handle.h b/libcutils/include_outside_system/cutils/native_handle.h
similarity index 100%
rename from libcutils/include_vndk/cutils/native_handle.h
rename to libcutils/include_outside_system/cutils/native_handle.h
diff --git a/libcutils/include_vndk/cutils/partition_utils.h b/libcutils/include_outside_system/cutils/partition_utils.h
similarity index 100%
rename from libcutils/include_vndk/cutils/partition_utils.h
rename to libcutils/include_outside_system/cutils/partition_utils.h
diff --git a/libcutils/include_vndk/cutils/properties.h b/libcutils/include_outside_system/cutils/properties.h
similarity index 100%
rename from libcutils/include_vndk/cutils/properties.h
rename to libcutils/include_outside_system/cutils/properties.h
diff --git a/libcutils/include_vndk/cutils/qtaguid.h b/libcutils/include_outside_system/cutils/qtaguid.h
similarity index 100%
rename from libcutils/include_vndk/cutils/qtaguid.h
rename to libcutils/include_outside_system/cutils/qtaguid.h
diff --git a/libcutils/include_vndk/cutils/record_stream.h b/libcutils/include_outside_system/cutils/record_stream.h
similarity index 100%
rename from libcutils/include_vndk/cutils/record_stream.h
rename to libcutils/include_outside_system/cutils/record_stream.h
diff --git a/libcutils/include_vndk/cutils/sched_policy.h b/libcutils/include_outside_system/cutils/sched_policy.h
similarity index 100%
rename from libcutils/include_vndk/cutils/sched_policy.h
rename to libcutils/include_outside_system/cutils/sched_policy.h
diff --git a/libcutils/include_vndk/cutils/sockets.h b/libcutils/include_outside_system/cutils/sockets.h
similarity index 100%
rename from libcutils/include_vndk/cutils/sockets.h
rename to libcutils/include_outside_system/cutils/sockets.h
diff --git a/libcutils/include_vndk/cutils/str_parms.h b/libcutils/include_outside_system/cutils/str_parms.h
similarity index 100%
rename from libcutils/include_vndk/cutils/str_parms.h
rename to libcutils/include_outside_system/cutils/str_parms.h
diff --git a/libcutils/include_vndk/cutils/threads.h b/libcutils/include_outside_system/cutils/threads.h
similarity index 100%
rename from libcutils/include_vndk/cutils/threads.h
rename to libcutils/include_outside_system/cutils/threads.h
diff --git a/libcutils/include_vndk/cutils/trace.h b/libcutils/include_outside_system/cutils/trace.h
similarity index 100%
rename from libcutils/include_vndk/cutils/trace.h
rename to libcutils/include_outside_system/cutils/trace.h
diff --git a/libcutils/include_vndk/cutils/uevent.h b/libcutils/include_outside_system/cutils/uevent.h
similarity index 100%
rename from libcutils/include_vndk/cutils/uevent.h
rename to libcutils/include_outside_system/cutils/uevent.h
diff --git a/libcutils/properties.cpp b/libcutils/properties.cpp
index 5dbbeba..03f0496 100644
--- a/libcutils/properties.cpp
+++ b/libcutils/properties.cpp
@@ -16,27 +16,19 @@
 
 #include <cutils/properties.h>
 
-#define LOG_TAG "properties"
-// #define LOG_NDEBUG 0
-
-#include <assert.h>
-#include <ctype.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#include <cutils/sockets.h>
-#include <log/log.h>
+#include <android-base/properties.h>
 
-int8_t property_get_bool(const char *key, int8_t default_value) {
-    if (!key) {
-        return default_value;
-    }
+int8_t property_get_bool(const char* key, int8_t default_value) {
+    if (!key) return default_value;
 
     int8_t result = default_value;
-    char buf[PROPERTY_VALUE_MAX] = {'\0'};
+    char buf[PROPERTY_VALUE_MAX] = {};
 
     int len = property_get(key, buf, "");
     if (len == 1) {
@@ -57,73 +49,53 @@
     return result;
 }
 
-// Convert string property to int (default if fails); return default value if out of bounds
-static intmax_t property_get_imax(const char *key, intmax_t lower_bound, intmax_t upper_bound,
-                                  intmax_t default_value) {
-    if (!key) {
-        return default_value;
+template <typename T>
+static T property_get_int(const char* key, T default_value) {
+    if (!key) return default_value;
+
+    char value[PROPERTY_VALUE_MAX] = {};
+    if (property_get(key, value, "") < 1) return default_value;
+
+    // libcutils unwisely allows octal, which libbase doesn't.
+    T result = default_value;
+    int saved_errno = errno;
+    errno = 0;
+    char* end = nullptr;
+    intmax_t v = strtoimax(value, &end, 0);
+    if (errno != ERANGE && end != value && v >= std::numeric_limits<T>::min() &&
+        v <= std::numeric_limits<T>::max()) {
+        result = v;
     }
-
-    intmax_t result = default_value;
-    char buf[PROPERTY_VALUE_MAX] = {'\0'};
-    char *end = NULL;
-
-    int len = property_get(key, buf, "");
-    if (len > 0) {
-        int tmp = errno;
-        errno = 0;
-
-        // Infer base automatically
-        result = strtoimax(buf, &end, /*base*/ 0);
-        if ((result == INTMAX_MIN || result == INTMAX_MAX) && errno == ERANGE) {
-            // Over or underflow
-            result = default_value;
-            ALOGV("%s(%s,%" PRIdMAX ") - overflow", __FUNCTION__, key, default_value);
-        } else if (result < lower_bound || result > upper_bound) {
-            // Out of range of requested bounds
-            result = default_value;
-            ALOGV("%s(%s,%" PRIdMAX ") - out of range", __FUNCTION__, key, default_value);
-        } else if (end == buf) {
-            // Numeric conversion failed
-            result = default_value;
-            ALOGV("%s(%s,%" PRIdMAX ") - numeric conversion failed", __FUNCTION__, key,
-                  default_value);
-        }
-
-        errno = tmp;
-    }
-
+    errno = saved_errno;
     return result;
 }
 
-int64_t property_get_int64(const char *key, int64_t default_value) {
-    return (int64_t)property_get_imax(key, INT64_MIN, INT64_MAX, default_value);
+int64_t property_get_int64(const char* key, int64_t default_value) {
+    return property_get_int<int64_t>(key, default_value);
 }
 
-int32_t property_get_int32(const char *key, int32_t default_value) {
-    return (int32_t)property_get_imax(key, INT32_MIN, INT32_MAX, default_value);
+int32_t property_get_int32(const char* key, int32_t default_value) {
+    return property_get_int<int32_t>(key, default_value);
 }
 
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/_system_properties.h>
-
-int property_set(const char *key, const char *value) {
+int property_set(const char* key, const char* value) {
     return __system_property_set(key, value);
 }
 
-int property_get(const char *key, char *value, const char *default_value) {
+int property_get(const char* key, char* value, const char* default_value) {
     int len = __system_property_get(key, value);
-    if (len > 0) {
-        return len;
-    }
-    if (default_value) {
-        len = strnlen(default_value, PROPERTY_VALUE_MAX - 1);
-        memcpy(value, default_value, len);
-        value[len] = '\0';
+    if (len < 1 && default_value) {
+        snprintf(value, PROPERTY_VALUE_MAX, "%s", default_value);
+        return strlen(value);
     }
     return len;
 }
 
+#if __has_include(<sys/system_properties.h>)
+
+#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
+#include <sys/_system_properties.h>
+
 struct callback_data {
     void (*callback)(const char* name, const char* value, void* cookie);
     void* cookie;
@@ -139,6 +111,8 @@
 }
 
 int property_list(void (*fn)(const char* name, const char* value, void* cookie), void* cookie) {
-    callback_data data = { fn, cookie };
+    callback_data data = {fn, cookie};
     return __system_property_foreach(property_list_callback, &data);
 }
+
+#endif
diff --git a/libcutils/properties_test.cpp b/libcutils/properties_test.cpp
index 7921972..efc0183 100644
--- a/libcutils/properties_test.cpp
+++ b/libcutils/properties_test.cpp
@@ -93,160 +93,179 @@
     }
 };
 
-TEST_F(PropertiesTest, SetString) {
-
+TEST_F(PropertiesTest, property_set_null_key) {
     // Null key -> unsuccessful set
-    {
-        // Null key -> fails
-        EXPECT_GT(0, property_set(/*key*/NULL, PROPERTY_TEST_VALUE_DEFAULT));
-    }
+    EXPECT_GT(0, property_set(/*key*/ NULL, PROPERTY_TEST_VALUE_DEFAULT));
+}
 
-    // Null value -> returns default value
-    {
-        // Null value -> OK , and it clears the value
-        EXPECT_OK(property_set(PROPERTY_TEST_KEY, /*value*/NULL));
-        ResetValue();
+TEST_F(PropertiesTest, property_set_null_value) {
+    // Null value -> OK, and it clears the value
+    EXPECT_OK(property_set(PROPERTY_TEST_KEY, /*value*/ NULL));
+    ResetValue();
 
-        // Since the value is null, default value will be returned
-        size_t len = property_get(PROPERTY_TEST_KEY, mValue, PROPERTY_TEST_VALUE_DEFAULT);
-        EXPECT_EQ(strlen(PROPERTY_TEST_VALUE_DEFAULT), len);
-        EXPECT_STREQ(PROPERTY_TEST_VALUE_DEFAULT, mValue);
-    }
+    // Since the value is null, default value will be returned
+    size_t len = property_get(PROPERTY_TEST_KEY, mValue, PROPERTY_TEST_VALUE_DEFAULT);
+    EXPECT_EQ(strlen(PROPERTY_TEST_VALUE_DEFAULT), len);
+    EXPECT_STREQ(PROPERTY_TEST_VALUE_DEFAULT, mValue);
+}
 
+TEST_F(PropertiesTest, property_set) {
     // Trivial case => get returns what was set
-    {
-        size_t len = SetAndGetProperty("hello_world");
-        EXPECT_EQ(strlen("hello_world"), len) << "hello_world key";
-        EXPECT_STREQ("hello_world", mValue);
-        ResetValue();
-    }
+    size_t len = SetAndGetProperty("hello_world");
+    EXPECT_EQ(strlen("hello_world"), len) << "hello_world key";
+    EXPECT_STREQ("hello_world", mValue);
+    ResetValue();
+}
 
+TEST_F(PropertiesTest, property_set_empty) {
     // Set to empty string => get returns default always
-    {
-        const char* EMPTY_STRING_DEFAULT = "EMPTY_STRING";
-        size_t len = SetAndGetProperty("", EMPTY_STRING_DEFAULT);
-        EXPECT_EQ(strlen(EMPTY_STRING_DEFAULT), len) << "empty key";
-        EXPECT_STREQ(EMPTY_STRING_DEFAULT, mValue);
-        ResetValue();
-    }
+    const char* EMPTY_STRING_DEFAULT = "EMPTY_STRING";
+    size_t len = SetAndGetProperty("", EMPTY_STRING_DEFAULT);
+    EXPECT_EQ(strlen(EMPTY_STRING_DEFAULT), len) << "empty key";
+    EXPECT_STREQ(EMPTY_STRING_DEFAULT, mValue);
+    ResetValue();
+}
 
+TEST_F(PropertiesTest, property_set_max_length) {
     // Set to max length => get returns what was set
-    {
-        std::string maxLengthString = std::string(PROPERTY_VALUE_MAX-1, 'a');
+    std::string maxLengthString = std::string(PROPERTY_VALUE_MAX - 1, 'a');
 
-        int len = SetAndGetProperty(maxLengthString.c_str());
-        EXPECT_EQ(PROPERTY_VALUE_MAX-1, len) << "max length key";
-        EXPECT_STREQ(maxLengthString.c_str(), mValue);
-        ResetValue();
-    }
+    int len = SetAndGetProperty(maxLengthString.c_str());
+    EXPECT_EQ(PROPERTY_VALUE_MAX - 1, len) << "max length key";
+    EXPECT_STREQ(maxLengthString.c_str(), mValue);
+    ResetValue();
+}
 
+TEST_F(PropertiesTest, property_set_too_long) {
     // Set to max length + 1 => set fails
-    {
-        const char* VALID_TEST_VALUE = "VALID_VALUE";
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, VALID_TEST_VALUE));
+    const char* VALID_TEST_VALUE = "VALID_VALUE";
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, VALID_TEST_VALUE));
 
-        std::string oneLongerString = std::string(PROPERTY_VALUE_MAX, 'a');
+    std::string oneLongerString = std::string(PROPERTY_VALUE_MAX, 'a');
 
-        // Expect that the value set fails since it's too long
-        EXPECT_GT(0, property_set(PROPERTY_TEST_KEY, oneLongerString.c_str()));
-        size_t len = property_get(PROPERTY_TEST_KEY, mValue, PROPERTY_TEST_VALUE_DEFAULT);
+    // Expect that the value set fails since it's too long
+    EXPECT_GT(0, property_set(PROPERTY_TEST_KEY, oneLongerString.c_str()));
+    size_t len = property_get(PROPERTY_TEST_KEY, mValue, PROPERTY_TEST_VALUE_DEFAULT);
 
-        EXPECT_EQ(strlen(VALID_TEST_VALUE), len) << "set should've failed";
-        EXPECT_STREQ(VALID_TEST_VALUE, mValue);
-        ResetValue();
-    }
+    EXPECT_EQ(strlen(VALID_TEST_VALUE), len) << "set should've failed";
+    EXPECT_STREQ(VALID_TEST_VALUE, mValue);
+    ResetValue();
 }
 
-TEST_F(PropertiesTest, GetString) {
-
+TEST_F(PropertiesTest, property_get_too_long) {
     // Try to use a default value that's too long => get truncates the value
-    {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
 
-        std::string maxLengthString = std::string(PROPERTY_VALUE_MAX - 1, 'a');
-        std::string oneLongerString = std::string(PROPERTY_VALUE_MAX, 'a');
+    std::string maxLengthString = std::string(PROPERTY_VALUE_MAX - 1, 'a');
+    std::string oneLongerString = std::string(PROPERTY_VALUE_MAX, 'a');
 
-        // Expect that the value is truncated since it's too long (by 1)
-        int len = property_get(PROPERTY_TEST_KEY, mValue, oneLongerString.c_str());
-        EXPECT_EQ(PROPERTY_VALUE_MAX - 1, len);
-        EXPECT_STREQ(maxLengthString.c_str(), mValue);
-        ResetValue();
-    }
-
-    // Try to use a default value that's the max length => get succeeds
-    {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
-
-        std::string maxLengthString = std::string(PROPERTY_VALUE_MAX - 1, 'b');
-
-        // Expect that the value matches maxLengthString
-        int len = property_get(PROPERTY_TEST_KEY, mValue, maxLengthString.c_str());
-        EXPECT_EQ(PROPERTY_VALUE_MAX - 1, len);
-        EXPECT_STREQ(maxLengthString.c_str(), mValue);
-        ResetValue();
-    }
-
-    // Try to use a default value of length one => get succeeds
-    {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
-
-        std::string oneCharString = std::string(1, 'c');
-
-        // Expect that the value matches oneCharString
-        int len = property_get(PROPERTY_TEST_KEY, mValue, oneCharString.c_str());
-        EXPECT_EQ(1, len);
-        EXPECT_STREQ(oneCharString.c_str(), mValue);
-        ResetValue();
-    }
-
-    // Try to use a default value of length zero => get succeeds
-    {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
-
-        std::string zeroCharString = std::string(0, 'd');
-
-        // Expect that the value matches oneCharString
-        int len = property_get(PROPERTY_TEST_KEY, mValue, zeroCharString.c_str());
-        EXPECT_EQ(0, len);
-        EXPECT_STREQ(zeroCharString.c_str(), mValue);
-        ResetValue();
-    }
-
-    // Try to use a NULL default value => get returns 0
-    {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
-
-        // Expect a return value of 0
-        int len = property_get(PROPERTY_TEST_KEY, mValue, NULL);
-        EXPECT_EQ(0, len);
-        ResetValue();
-    }
+    // Expect that the value is truncated since it's too long (by 1)
+    int len = property_get(PROPERTY_TEST_KEY, mValue, oneLongerString.c_str());
+    EXPECT_EQ(PROPERTY_VALUE_MAX - 1, len);
+    EXPECT_STREQ(maxLengthString.c_str(), mValue);
+    ResetValue();
 }
 
-TEST_F(PropertiesTest, GetBool) {
-    /**
-     * TRUE
-     */
-    const char *valuesTrue[] = { "1", "true", "y", "yes", "on", };
-    for (size_t i = 0; i < arraysize(valuesTrue); ++i) {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, valuesTrue[i]));
-        bool val = property_get_bool(PROPERTY_TEST_KEY, /*default_value*/false);
-        EXPECT_TRUE(val) << "Property should've been TRUE for value: '" << valuesTrue[i] << "'";
-    }
+TEST_F(PropertiesTest, property_get_default_too_long) {
+    // Try to use a default value that's the max length => get succeeds
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
 
-    /**
-     * FALSE
-     */
-    const char *valuesFalse[] = { "0", "false", "n", "no", "off", };
-    for (size_t i = 0; i < arraysize(valuesFalse); ++i) {
-        ASSERT_OK(property_set(PROPERTY_TEST_KEY, valuesFalse[i]));
-        bool val = property_get_bool(PROPERTY_TEST_KEY, /*default_value*/true);
-        EXPECT_FALSE(val) << "Property shoud've been FALSE For string value: '" << valuesFalse[i] << "'";
-    }
+    std::string maxLengthString = std::string(PROPERTY_VALUE_MAX - 1, 'b');
 
-    /**
-     * NEITHER
-     */
+    // Expect that the value matches maxLengthString
+    int len = property_get(PROPERTY_TEST_KEY, mValue, maxLengthString.c_str());
+    EXPECT_EQ(PROPERTY_VALUE_MAX - 1, len);
+    EXPECT_STREQ(maxLengthString.c_str(), mValue);
+    ResetValue();
+}
+
+TEST_F(PropertiesTest, property_get_default_okay) {
+    // Try to use a default value of length one => get succeeds
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
+
+    std::string oneCharString = std::string(1, 'c');
+
+    // Expect that the value matches oneCharString
+    int len = property_get(PROPERTY_TEST_KEY, mValue, oneCharString.c_str());
+    EXPECT_EQ(1, len);
+    EXPECT_STREQ(oneCharString.c_str(), mValue);
+    ResetValue();
+}
+
+TEST_F(PropertiesTest, property_get_default_empty) {
+    // Try to use a default value of length zero => get succeeds
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
+
+    std::string zeroCharString = std::string(0, 'd');
+
+    // Expect that the value matches oneCharString
+    int len = property_get(PROPERTY_TEST_KEY, mValue, zeroCharString.c_str());
+    EXPECT_EQ(0, len);
+    EXPECT_STREQ(zeroCharString.c_str(), mValue);
+    ResetValue();
+}
+
+TEST_F(PropertiesTest, property_get_default_NULL) {
+    // Try to use a NULL default value => get returns 0
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, ""));
+
+    // Expect a return value of 0
+    int len = property_get(PROPERTY_TEST_KEY, mValue, NULL);
+    EXPECT_EQ(0, len);
+    ResetValue();
+}
+
+TEST_F(PropertiesTest, property_get_bool_0) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "0"));
+    ASSERT_FALSE(property_get_bool(PROPERTY_TEST_KEY, true));
+}
+
+TEST_F(PropertiesTest, property_get_bool_1) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "1"));
+    ASSERT_TRUE(property_get_bool(PROPERTY_TEST_KEY, false));
+}
+
+TEST_F(PropertiesTest, property_get_bool_false) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "false"));
+    ASSERT_FALSE(property_get_bool(PROPERTY_TEST_KEY, true));
+}
+
+TEST_F(PropertiesTest, property_get_bool_n) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "n"));
+    ASSERT_FALSE(property_get_bool(PROPERTY_TEST_KEY, true));
+}
+
+TEST_F(PropertiesTest, property_get_bool_no) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "no"));
+    ASSERT_FALSE(property_get_bool(PROPERTY_TEST_KEY, true));
+}
+
+TEST_F(PropertiesTest, property_get_bool_off) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "off"));
+    ASSERT_FALSE(property_get_bool(PROPERTY_TEST_KEY, true));
+}
+
+TEST_F(PropertiesTest, property_get_bool_on) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "on"));
+    ASSERT_TRUE(property_get_bool(PROPERTY_TEST_KEY, false));
+}
+
+TEST_F(PropertiesTest, property_get_bool_true) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "true"));
+    ASSERT_TRUE(property_get_bool(PROPERTY_TEST_KEY, false));
+}
+
+TEST_F(PropertiesTest, property_get_bool_y) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "y"));
+    ASSERT_TRUE(property_get_bool(PROPERTY_TEST_KEY, false));
+}
+
+TEST_F(PropertiesTest, property_get_bool_yes) {
+    ASSERT_OK(property_set(PROPERTY_TEST_KEY, "yes"));
+    ASSERT_TRUE(property_get_bool(PROPERTY_TEST_KEY, false));
+}
+
+TEST_F(PropertiesTest, property_get_bool_neither) {
     const char *valuesNeither[] = { "x0", "x1", "2", "-2", "True", "False", "garbage", "", " ",
             "+1", "  1  ", "  true", "  true  ", "  y  ", "  yes", "yes  ",
             "+0", "-0", "00", "  00  ", "  false", "false  ",
@@ -263,7 +282,7 @@
     }
 }
 
-TEST_F(PropertiesTest, GetInt64) {
+TEST_F(PropertiesTest, property_get_int64) {
     const int64_t DEFAULT_VALUE = INT64_C(0xDEADBEEFBEEFDEAD);
 
     const std::string longMaxString = ToString(INT64_MAX);
@@ -310,7 +329,7 @@
     }
 }
 
-TEST_F(PropertiesTest, GetInt32) {
+TEST_F(PropertiesTest, property_get_int32) {
     const int32_t DEFAULT_VALUE = INT32_C(0xDEADBEEF);
 
     const std::string intMaxString = ToString(INT32_MAX);
diff --git a/libcutils/qtaguid.cpp b/libcutils/qtaguid.cpp
index b94d134..2fe877c 100644
--- a/libcutils/qtaguid.cpp
+++ b/libcutils/qtaguid.cpp
@@ -38,24 +38,24 @@
     int (*netdDeleteTagData)(uint32_t, uid_t);
 };
 
-int dummyTagSocket(int, uint32_t, uid_t) {
+int stubTagSocket(int, uint32_t, uid_t) {
     return -EREMOTEIO;
 }
 
-int dummyUntagSocket(int) {
+int stubUntagSocket(int) {
     return -EREMOTEIO;
 }
 
-int dummySetCounterSet(uint32_t, uid_t) {
+int stubSetCounterSet(uint32_t, uid_t) {
     return -EREMOTEIO;
 }
 
-int dummyDeleteTagData(uint32_t, uid_t) {
+int stubDeleteTagData(uint32_t, uid_t) {
     return -EREMOTEIO;
 }
 
 netdHandler initHandler(void) {
-    netdHandler handler = {dummyTagSocket, dummyUntagSocket, dummySetCounterSet, dummyDeleteTagData};
+    netdHandler handler = {stubTagSocket, stubUntagSocket, stubSetCounterSet, stubDeleteTagData};
 
     void* netdClientHandle = dlopen("libnetd_client.so", RTLD_NOW);
     if (!netdClientHandle) {
diff --git a/libcutils/threads.cpp b/libcutils/threads.cpp
index a7e6b2d..8cfee1e 100644
--- a/libcutils/threads.cpp
+++ b/libcutils/threads.cpp
@@ -16,23 +16,18 @@
 
 #include <cutils/threads.h>
 
-// For gettid.
 #if defined(__APPLE__)
-#include "AvailabilityMacros.h"  // For MAC_OS_X_VERSION_MAX_ALLOWED
 #include <stdint.h>
-#include <stdlib.h>
-#include <sys/syscall.h>
-#include <sys/time.h>
-#include <unistd.h>
-#elif defined(__linux__) && !defined(__ANDROID__)
+#elif defined(__linux__)
 #include <syscall.h>
 #include <unistd.h>
 #elif defined(_WIN32)
 #include <windows.h>
 #endif
 
+#if defined(__BIONIC__)
 // No definition needed for Android because we'll just pick up bionic's copy.
-#ifndef __ANDROID__
+#else
 pid_t gettid() {
 #if defined(__APPLE__)
   uint64_t tid;
@@ -44,68 +39,4 @@
   return GetCurrentThreadId();
 #endif
 }
-#endif  // __ANDROID__
-
-#if !defined(_WIN32)
-
-void*  thread_store_get( thread_store_t*  store )
-{
-    if (!store->has_tls)
-        return NULL;
-
-    return pthread_getspecific( store->tls );
-}
-
-extern void   thread_store_set( thread_store_t*          store,
-                                void*                    value,
-                                thread_store_destruct_t  destroy)
-{
-    pthread_mutex_lock( &store->lock );
-    if (!store->has_tls) {
-        if (pthread_key_create( &store->tls, destroy) != 0) {
-            pthread_mutex_unlock(&store->lock);
-            return;
-        }
-        store->has_tls = 1;
-    }
-    pthread_mutex_unlock( &store->lock );
-
-    pthread_setspecific( store->tls, value );
-}
-
-#else /* !defined(_WIN32) */
-void*  thread_store_get( thread_store_t*  store )
-{
-    if (!store->has_tls)
-        return NULL;
-
-    return (void*) TlsGetValue( store->tls );
-}
-
-void   thread_store_set( thread_store_t*          store,
-                         void*                    value,
-                         thread_store_destruct_t  /*destroy*/ )
-{
-    /* XXX: can't use destructor on thread exit */
-    if (!store->lock_init) {
-        store->lock_init = -1;
-        InitializeCriticalSection( &store->lock );
-        store->lock_init = -2;
-    } else while (store->lock_init != -2) {
-        Sleep(10); /* 10ms */
-    }
-
-    EnterCriticalSection( &store->lock );
-    if (!store->has_tls) {
-        store->tls = TlsAlloc();
-        if (store->tls == TLS_OUT_OF_INDEXES) {
-            LeaveCriticalSection( &store->lock );
-            return;
-        }
-        store->has_tls = 1;
-    }
-    LeaveCriticalSection( &store->lock );
-
-    TlsSetValue( store->tls, value );
-}
-#endif /* !defined(_WIN32) */
+#endif
diff --git a/libcutils/trace-dev.cpp b/libcutils/trace-dev.cpp
index 5a09a2d..1ab63dc 100644
--- a/libcutils/trace-dev.cpp
+++ b/libcutils/trace-dev.cpp
@@ -30,9 +30,9 @@
 
 static void atrace_init_once()
 {
-    atrace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
+    atrace_marker_fd = open("/sys/kernel/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
     if (atrace_marker_fd == -1) {
-        atrace_marker_fd = open("/sys/kernel/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
+        atrace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
     }
 
     if (atrace_marker_fd == -1) {
diff --git a/libcutils/uevent.cpp b/libcutils/uevent.cpp
index bf244d2..40bbd5c 100644
--- a/libcutils/uevent.cpp
+++ b/libcutils/uevent.cpp
@@ -101,7 +101,7 @@
 
     memset(&addr, 0, sizeof(addr));
     addr.nl_family = AF_NETLINK;
-    addr.nl_pid = getpid();
+    addr.nl_pid = 0;
     addr.nl_groups = 0xffffffff;
 
     s = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT);
diff --git a/libkeyutils/keyutils_test.cpp b/libkeyutils/keyutils_test.cpp
index d41c91b..d03747b 100644
--- a/libkeyutils/keyutils_test.cpp
+++ b/libkeyutils/keyutils_test.cpp
@@ -33,7 +33,7 @@
 #include <gtest/gtest.h>
 
 TEST(keyutils, smoke) {
-  // Check that the exported type is sane.
+  // Check that the exported type is the right size.
   ASSERT_EQ(4U, sizeof(key_serial_t));
 
   // Check that all the functions actually exist.
diff --git a/liblog/.clang-format b/liblog/.clang-format
deleted file mode 120000
index fd0645f..0000000
--- a/liblog/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-2
\ No newline at end of file
diff --git a/liblog/Android.bp b/liblog/Android.bp
deleted file mode 100644
index 6051ac7..0000000
--- a/liblog/Android.bp
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// Copyright (C) 2008-2014 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.
-//
-
-liblog_sources = [
-    "log_event_list.cpp",
-    "log_event_write.cpp",
-    "logger_name.cpp",
-    "logger_read.cpp",
-    "logger_write.cpp",
-    "logprint.cpp",
-    "properties.cpp",
-]
-liblog_target_sources = [
-    "event_tag_map.cpp",
-    "log_time.cpp",
-    "pmsg_reader.cpp",
-    "pmsg_writer.cpp",
-    "logd_reader.cpp",
-    "logd_writer.cpp",
-]
-
-cc_library_headers {
-    name: "liblog_headers",
-    host_supported: true,
-    vendor_available: true,
-    ramdisk_available: true,
-    recovery_available: true,
-    apex_available: [
-        "//apex_available:platform",
-        "//apex_available:anyapex",
-    ],
-    min_sdk_version: "29",
-    native_bridge_supported: true,
-    export_include_dirs: ["include"],
-    system_shared_libs: [],
-    stl: "none",
-    target: {
-        windows: {
-            enabled: true,
-        },
-        linux_bionic: {
-            enabled: true,
-        },
-        vendor: {
-            override_export_include_dirs: ["include_vndk"],
-        },
-    },
-}
-
-// Shared and static library for host and device
-// ========================================================
-cc_library {
-    name: "liblog",
-    host_supported: true,
-    ramdisk_available: true,
-    recovery_available: true,
-    native_bridge_supported: true,
-    srcs: liblog_sources,
-
-    target: {
-        android: {
-            version_script: "liblog.map.txt",
-            srcs: liblog_target_sources,
-            // AddressSanitizer runtime library depends on liblog.
-            sanitize: {
-                address: false,
-            },
-        },
-        android_arm: {
-            // TODO: This is to work around b/24465209. Remove after root cause is fixed
-            pack_relocations: false,
-            ldflags: ["-Wl,--hash-style=both"],
-        },
-        windows: {
-            enabled: true,
-        },
-        not_windows: {
-            srcs: ["event_tag_map.cpp"],
-        },
-        linux_bionic: {
-            enabled: true,
-        },
-    },
-
-    header_libs: [
-        "libbase_headers",
-        "liblog_headers",
-    ],
-    export_header_lib_headers: ["liblog_headers"],
-
-    stubs: {
-        symbol_file: "liblog.map.txt",
-        versions: ["29", "30"],
-    },
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-        // This is what we want to do:
-        //  liblog_cflags := $(shell \
-        //   sed -n \
-        //       's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \
-        //       $(LOCAL_PATH)/event.logtags)
-        // so make sure we do not regret hard-coding it as follows:
-        "-DLIBLOG_LOG_TAG=1006",
-        "-DSNET_EVENT_LOG_TAG=1397638484",
-    ],
-    logtags: ["event.logtags"],
-    compile_multilib: "both",
-    apex_available: [
-        "//apex_available:platform",
-        // liblog is exceptionally available to the runtime APEX
-        // because the dynamic linker has to use it statically.
-        // See b/151051671
-        "com.android.runtime",
-        // DO NOT add more apex names here
-    ],
-}
-
-ndk_headers {
-    name: "liblog_ndk_headers",
-    from: "include/android",
-    to: "android",
-    srcs: ["include/android/log.h"],
-    license: "NOTICE",
-}
-
-ndk_library {
-    name: "liblog",
-    symbol_file: "liblog.map.txt",
-    first_version: "9",
-    unversioned_until: "current",
-}
-
-llndk_library {
-    name: "liblog",
-    native_bridge_supported: true,
-    symbol_file: "liblog.map.txt",
-    export_include_dirs: ["include_vndk"],
-}
diff --git a/liblog/NOTICE b/liblog/NOTICE
deleted file mode 100644
index 06a9081..0000000
--- a/liblog/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
-   Copyright (c) 2005-2014, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
diff --git a/liblog/OWNERS b/liblog/OWNERS
deleted file mode 100644
index babbe4d..0000000
--- a/liblog/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-tomcherry@google.com
diff --git a/liblog/README.md b/liblog/README.md
deleted file mode 100644
index 871399a..0000000
--- a/liblog/README.md
+++ /dev/null
@@ -1,166 +0,0 @@
-Android liblog
---------------
-
-Public Functions and Macros
----------------------------
-
-    /*
-     * Please limit to 24 characters for runtime is loggable,
-     * 16 characters for persist is loggable, and logcat pretty
-     * alignment with limit of 7 characters.
-    */
-    #define LOG_TAG "yourtag"
-    #include <log/log.h>
-
-    ALOG(android_priority, tag, format, ...)
-    IF_ALOG(android_priority, tag)
-    LOG_PRI(priority, tag, format, ...)
-    LOG_PRI_VA(priority, tag, format, args)
-    #define LOG_TAG NULL
-    ALOGV(format, ...)
-    SLOGV(format, ...)
-    RLOGV(format, ...)
-    ALOGV_IF(cond, format, ...)
-    SLOGV_IF(cond, format, ...)
-    RLOGV_IF(cond, format, ...)
-    IF_ALOGC()
-    ALOGD(format, ...)
-    SLOGD(format, ...)
-    RLOGD(format, ...)
-    ALOGD_IF(cond, format, ...)
-    SLOGD_IF(cond, format, ...)
-    RLOGD_IF(cond, format, ...)
-    IF_ALOGD()
-    ALOGI(format, ...)
-    SLOGI(format, ...)
-    RLOGI(format, ...)
-    ALOGI_IF(cond, format, ...)
-    SLOGI_IF(cond, format, ...)
-    RLOGI_IF(cond, format, ...)
-    IF_ALOGI()
-    ALOGW(format, ...)
-    SLOGW(format, ...)
-    RLOGW(format, ...)
-    ALOGW_IF(cond, format, ...)
-    SLOGW_IF(cond, format, ...)
-    RLOGW_IF(cond, format, ...)
-    IF_ALOGW()
-    ALOGE(format, ...)
-    SLOGE(format, ...)
-    RLOGE(format, ...)
-    ALOGE_IF(cond, format, ...)
-    SLOGE_IF(cond, format, ...)
-    RLOGE_IF(cond, format, ...)
-    IF_ALOGE()
-    LOG_FATAL(format, ...)
-    LOG_ALWAYS_FATAL(format, ...)
-    LOG_FATAL_IF(cond, format, ...)
-    LOG_ALWAYS_FATAL_IF(cond, format, ...)
-    ALOG_ASSERT(cond, format, ...)
-    LOG_EVENT_INT(tag, value)
-    LOG_EVENT_LONG(tag, value)
-
-    clockid_t android_log_clockid()
-
-    log_id_t android_logger_get_id(struct logger *logger)
-    int android_logger_clear(struct logger *logger)
-    int android_logger_get_log_size(struct logger *logger)
-    int android_logger_get_log_readable_size(struct logger *logger)
-    int android_logger_get_log_version(struct logger *logger)
-
-    struct logger_list *android_logger_list_alloc(int mode, unsigned int tail, pid_t pid)
-    struct logger *android_logger_open(struct logger_list *logger_list, log_id_t id)
-    struct logger_list *android_logger_list_open(log_id_t id, int mode, unsigned int tail, pid_t pid)
-    int android_logger_list_read(struct logger_list *logger_list, struct log_msg *log_msg)
-    void android_logger_list_free(struct logger_list *logger_list)
-
-    log_id_t android_name_to_log_id(const char *logName)
-    const char *android_log_id_to_name(log_id_t log_id)
-
-    android_log_context create_android_logger(uint32_t tag)
-
-    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)
-
-    int android_log_write_list(android_log_context ctx, log_id_t id = LOG_ID_EVENTS)
-
-    android_log_context create_android_log_parser(const char *msg, size_t len)
-    android_log_list_element android_log_read_next(android_log_context ctx)
-    android_log_list_element android_log_peek_next(android_log_context ctx)
-
-    int android_log_destroy(android_log_context *ctx)
-
-Description
------------
-
-liblog represents an interface to the volatile Android Logging system for NDK (Native) applications
-and libraries.  Interfaces for either writing or reading logs.  The log buffers are divided up in
-Main, System, Radio and Events sub-logs.
-
-The logging interfaces are a series of macros, all of which can be overridden individually in order
-to control the verbosity of the application or library.  `[ASR]LOG[VDIWE]` calls are used to log to
-BAsic, System or Radio sub-logs in either the Verbose, Debug, Info, Warning or Error priorities.
-`[ASR]LOG[VDIWE]_IF` calls are used to perform thus based on a condition being true.
-`IF_ALOG[VDIWE]` calls are true if the current `LOG_TAG` is enabled at the specified priority.
-`LOG_ALWAYS_FATAL` is used to `ALOG` a message, then kill the process.  `LOG_FATAL` call is a
-variant of `LOG_ALWAYS_FATAL`, only enabled in engineering, and not release builds.  `ALOG_ASSERT`
-is used to `ALOG` a message if the condition is false; the condition is part of the logged message.
-`LOG_EVENT_(INT|LONG)` is used to drop binary content into the Events sub-log.
-
-The log reading interfaces permit opening the logs either singly or multiply, retrieving a log entry
-at a time in time sorted order, optionally limited to a specific pid and tail of the log(s) and
-finally a call closing the logs.  A single log can be opened with `android_logger_list_open()`; or
-multiple logs can be opened with `android_logger_list_alloc()`, calling in turn the
-`android_logger_open()` for each log id.  Each entry can be retrieved with
-`android_logger_list_read()`.  The log(s) can be closed with `android_logger_list_free()`.  The logs
-should be opened with an `ANDROID_LOG_RDONLY` mode.  `ANDROID_LOG_NONBLOCK` mode will report when
-the log reading is done with an `EAGAIN` error return code, otherwise the
-`android_logger_list_read()` call will block for new entries.
-
-The `ANDROID_LOG_WRAP` mode flag to the `android_logger_list_alloc_time()` signals logd to quiesce
-the reader until the buffer is about to prune at the start time then proceed to dumping content.
-
-The `ANDROID_LOG_PSTORE` mode flag to the `android_logger_open()` is used to switch from the active
-logs to the persistent logs from before the last reboot.
-
-The value returned by `android_logger_open()` can be used as a parameter to the
-`android_logger_clear()` function to empty the sub-log.  It is recommended to only open log
-`ANDROID_LOG_WRONLY` in that case.
-
-The value returned by `android_logger_open()` can be used as a parameter to the
-`android_logger_get_log_(size|readable_size|version)` to retrieve the sub-log maximum size, readable
-size and log buffer format protocol version respectively.  `android_logger_get_id()` returns the id
-that was used when opening the sub-log.  It is recommended to open the log `ANDROID_LOG_RDONLY` in
-these cases.
-
-Errors
-------
-
-If messages fail, a negative error code will be returned to the caller.
-
-The `-ENOTCONN` return code indicates that the logger daemon is stopped.
-
-The `-EBADF` return code indicates that the log access point can not be opened, or the log buffer id
-is out of range.
-
-For the `-EAGAIN` return code, this means that the logging message was temporarily backed-up either
-because of Denial Of Service (DOS) logging pressure from some chatty application or service in the
-Android system, or if too small of a value is set in /proc/sys/net/unix/max_dgram_qlen.  To aid in
-diagnosing the occurence of this, a binary event from liblog will be sent to the log daemon once a
-new message can get through indicating how many messages were dropped as a result.  Please take
-action to resolve the structural problems at the source.
-
-It is generally not advised for the caller to retry the `-EAGAIN` return code as this will only make
-the problem(s) worse and cause your application to temporarily drop to the logger daemon priority,
-BATCH scheduling policy and background task cgroup. If you require a group of messages to be passed
-atomically, merge them into one message with embedded newlines to the maximum length
-`LOGGER_ENTRY_MAX_PAYLOAD`.
-
-Other return codes from writing operation can be returned.  Since the library retries on `EINTR`,
-`-EINTR` should never be returned.
diff --git a/liblog/README.protocol.md b/liblog/README.protocol.md
deleted file mode 100644
index fef29c9..0000000
--- a/liblog/README.protocol.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# liblog -> logd
-
-The data that liblog sends to logd is represented below.
-
-    struct {
-        android_log_header_t header;
-        union {
-           struct {
-                char     prio;
-                char     tag[...];
-                char     message[...];
-            } string;
-            struct {
-                android_event_header_t event_header;
-                android_event_*_t      payload[...];
-            } binary;
-        };
-    };
-
-The payload, excluding the header, has a max size of LOGGER_ENTRY_MAX_PAYLOAD.
-
-## header
-
-The header is added immediately before sending the log message to logd.
-
-## `string` payload
-
-The `string` part of the union is for normal buffers (main, system, radio, etc) and consists of a
-single character priority, followed by a variable length null terminated string for the tag, and
-finally a variable length null terminated string for the message.
-
-This payload is used for the `__android_log_buf_write()` family of functions.
-
-## `binary` payload
-
-The `binary` part of the union is for binary buffers (events, security, etc) and consists of an
-android_event_header_t struct followed by a variable number of android_event_*_t
-(android_event_list_t, android_event_int_t, etc) structs.
-
-If multiple android_event_*_t elements are present, then they must be in a list and the first
-element in payload must be an android_event_list_t.
-
-This payload is used for the `__android_log_bwrite()` family of functions. It is additionally used
-for `android_log_write_list()` and the related functions that manipulate event lists.
-
-# logd -> liblog
-
-logd sends a `logger_entry` struct to liblog followed by the payload. The payload is identical to
-the payloads defined above. The max size of the entire message from logd is LOGGER_ENTRY_MAX_LEN.
diff --git a/liblog/event.logtags b/liblog/event.logtags
deleted file mode 100644
index 0a3b650..0000000
--- a/liblog/event.logtags
+++ /dev/null
@@ -1,37 +0,0 @@
-# The entries in this file map a sparse set of log tag numbers to tag names.
-# This is installed on the device, in /system/etc, and parsed by logcat.
-#
-# Tag numbers are decimal integers, from 0 to 2^31.  (Let's leave the
-# negative values alone for now.)
-#
-# Tag names are one or more ASCII letters and numbers or underscores, i.e.
-# "[A-Z][a-z][0-9]_".  Do not include spaces or punctuation (the former
-# impacts log readability, the latter makes regex searches more annoying).
-#
-# Tag numbers and names are separated by whitespace.  Blank lines and lines
-# starting with '#' are ignored.
-#
-# Optionally, after the tag names can be put a description for the value(s)
-# of the tag. Description are in the format
-#    (<name>|data type[|data unit])
-# Multiple values are separated by commas.
-#
-# The data type is a number from the following values:
-# 1: int
-# 2: long
-# 3: string
-# 4: list
-#
-# The data unit is a number taken from the following list:
-# 1: Number of objects
-# 2: Number of bytes
-# 3: Number of milliseconds
-# 4: Number of allocations
-# 5: Id
-# 6: Percent
-# s: Number of seconds (monotonic time)
-# Default value for data of type int/long is 2 (bytes).
-#
-# TODO: generate ".java" and ".h" files with integer constants from this file.
-
-1006  liblog (dropped|1)
diff --git a/liblog/event_tag_map.cpp b/liblog/event_tag_map.cpp
deleted file mode 100644
index 51c5e60..0000000
--- a/liblog/event_tag_map.cpp
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * Copyright (C) 2007-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.
- */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <functional>
-#include <string>
-#include <string_view>
-#include <unordered_map>
-
-#include <log/event_tag_map.h>
-#include <log/log_properties.h>
-#include <private/android_logger.h>
-#include <utils/FastStrcmp.h>
-#include <utils/RWLock.h>
-
-#include "logd_reader.h"
-
-#define OUT_TAG "EventTagMap"
-
-class MapString {
- private:
-  const std::string* alloc;                  // HAS-AN
-  const std::string_view str;                // HAS-A
-
- public:
-  operator const std::string_view() const {
-    return str;
-  }
-
-  const char* data() const {
-    return str.data();
-  }
-  size_t length() const {
-    return str.length();
-  }
-
-  bool operator==(const MapString& rval) const {
-    if (length() != rval.length()) return false;
-    if (length() == 0) return true;
-    return fastcmp<strncmp>(data(), rval.data(), length()) == 0;
-  }
-  bool operator!=(const MapString& rval) const {
-    return !(*this == rval);
-  }
-
-  MapString(const char* str, size_t len) : alloc(NULL), str(str, len) {
-  }
-  explicit MapString(const std::string& str)
-      : alloc(new std::string(str)), str(alloc->data(), alloc->length()) {
-  }
-  MapString(MapString&& rval) noexcept
-      : alloc(rval.alloc), str(rval.data(), rval.length()) {
-    rval.alloc = NULL;
-  }
-  explicit MapString(const MapString& rval)
-      : alloc(rval.alloc ? new std::string(*rval.alloc) : NULL),
-        str(alloc ? alloc->data() : rval.data(), rval.length()) {
-  }
-
-  ~MapString() {
-    if (alloc) delete alloc;
-  }
-};
-
-// Hash for MapString
-template <>
-struct std::hash<MapString>
-    : public std::unary_function<const MapString&, size_t> {
-  size_t operator()(const MapString& __t) const noexcept {
-    if (!__t.length()) return 0;
-    return std::hash<std::string_view>()(std::string_view(__t));
-  }
-};
-
-typedef std::pair<MapString, MapString> TagFmt;
-
-template <>
-struct std::hash<TagFmt> : public std::unary_function<const TagFmt&, size_t> {
-  size_t operator()(const TagFmt& __t) const noexcept {
-    // Tag is typically unique.  Will cost us an extra 100ns for the
-    // unordered_map lookup if we instead did a hash that combined
-    // both of tag and fmt members, e.g.:
-    //
-    // return std::hash<MapString>()(__t.first) ^
-    //        std::hash<MapString>()(__t.second);
-    return std::hash<MapString>()(__t.first);
-  }
-};
-
-// Map
-struct EventTagMap {
-#define NUM_MAPS 2
-  // memory-mapped source file; we get strings from here
-  void* mapAddr[NUM_MAPS];
-  size_t mapLen[NUM_MAPS];
-
- private:
-  std::unordered_map<uint32_t, TagFmt> Idx2TagFmt;
-  std::unordered_map<TagFmt, uint32_t> TagFmt2Idx;
-  std::unordered_map<MapString, uint32_t> Tag2Idx;
-  // protect unordered sets
-  android::RWLock rwlock;
-
- public:
-  EventTagMap() {
-    memset(mapAddr, 0, sizeof(mapAddr));
-    memset(mapLen, 0, sizeof(mapLen));
-  }
-
-  ~EventTagMap() {
-    Idx2TagFmt.clear();
-    TagFmt2Idx.clear();
-    Tag2Idx.clear();
-    for (size_t which = 0; which < NUM_MAPS; ++which) {
-      if (mapAddr[which]) {
-        munmap(mapAddr[which], mapLen[which]);
-        mapAddr[which] = 0;
-      }
-    }
-  }
-
-  bool emplaceUnique(uint32_t tag, const TagFmt& tagfmt, bool verbose = false);
-  const TagFmt* find(uint32_t tag) const;
-  int find(TagFmt&& tagfmt) const;
-  int find(MapString&& tag) const;
-};
-
-bool EventTagMap::emplaceUnique(uint32_t tag, const TagFmt& tagfmt,
-                                bool verbose) {
-  bool ret = true;
-  static const char errorFormat[] =
-      OUT_TAG ": duplicate tag entries %" PRIu32 ":%.*s:%.*s and %" PRIu32
-              ":%.*s:%.*s)\n";
-  android::RWLock::AutoWLock writeLock(rwlock);
-  {
-    std::unordered_map<uint32_t, TagFmt>::const_iterator it;
-    it = Idx2TagFmt.find(tag);
-    if (it != Idx2TagFmt.end()) {
-      if (verbose) {
-        fprintf(stderr, errorFormat, it->first, (int)it->second.first.length(),
-                it->second.first.data(), (int)it->second.second.length(),
-                it->second.second.data(), tag, (int)tagfmt.first.length(),
-                tagfmt.first.data(), (int)tagfmt.second.length(),
-                tagfmt.second.data());
-      }
-      ret = false;
-    } else {
-      Idx2TagFmt.emplace(std::make_pair(tag, tagfmt));
-    }
-  }
-
-  {
-    std::unordered_map<TagFmt, uint32_t>::const_iterator it;
-    it = TagFmt2Idx.find(tagfmt);
-    if (it != TagFmt2Idx.end()) {
-      if (verbose) {
-        fprintf(stderr, errorFormat, it->second, (int)it->first.first.length(),
-                it->first.first.data(), (int)it->first.second.length(),
-                it->first.second.data(), tag, (int)tagfmt.first.length(),
-                tagfmt.first.data(), (int)tagfmt.second.length(),
-                tagfmt.second.data());
-      }
-      ret = false;
-    } else {
-      TagFmt2Idx.emplace(std::make_pair(tagfmt, tag));
-    }
-  }
-
-  {
-    std::unordered_map<MapString, uint32_t>::const_iterator it;
-    it = Tag2Idx.find(tagfmt.first);
-    if (!tagfmt.second.length() && (it != Tag2Idx.end())) {
-      Tag2Idx.erase(it);
-      it = Tag2Idx.end();
-    }
-    if (it == Tag2Idx.end()) {
-      Tag2Idx.emplace(std::make_pair(tagfmt.first, tag));
-    }
-  }
-
-  return ret;
-}
-
-const TagFmt* EventTagMap::find(uint32_t tag) const {
-  std::unordered_map<uint32_t, TagFmt>::const_iterator it;
-  android::RWLock::AutoRLock readLock(const_cast<android::RWLock&>(rwlock));
-  it = Idx2TagFmt.find(tag);
-  if (it == Idx2TagFmt.end()) return NULL;
-  return &(it->second);
-}
-
-int EventTagMap::find(TagFmt&& tagfmt) const {
-  std::unordered_map<TagFmt, uint32_t>::const_iterator it;
-  android::RWLock::AutoRLock readLock(const_cast<android::RWLock&>(rwlock));
-  it = TagFmt2Idx.find(std::move(tagfmt));
-  if (it == TagFmt2Idx.end()) return -1;
-  return it->second;
-}
-
-int EventTagMap::find(MapString&& tag) const {
-  std::unordered_map<MapString, uint32_t>::const_iterator it;
-  android::RWLock::AutoRLock readLock(const_cast<android::RWLock&>(rwlock));
-  it = Tag2Idx.find(std::move(tag));
-  if (it == Tag2Idx.end()) return -1;
-  return it->second;
-}
-
-// The position after the end of a valid section of the tag string,
-// caller makes sure delimited appropriately.
-static const char* endOfTag(const char* cp) {
-  while (*cp && (isalnum(*cp) || strchr("_.-@,", *cp))) ++cp;
-  return cp;
-}
-
-// Scan one tag line.
-//
-// "pData" should be pointing to the first digit in the tag number.  On
-// successful return, it will be pointing to the last character in the
-// tag line (i.e. the character before the start of the next line).
-//
-// lineNum = 0 removes verbose comments and requires us to cache the
-// content rather than make direct raw references since the content
-// will disappear after the call. A non-zero lineNum means we own the
-// data and it will outlive the call.
-//
-// Returns 0 on success, nonzero on failure.
-static int scanTagLine(EventTagMap* map, const char*& pData, int lineNum) {
-  char* ep;
-  unsigned long val = strtoul(pData, &ep, 10);
-  const char* cp = ep;
-  if (cp == pData) {
-    if (lineNum) {
-      fprintf(stderr, OUT_TAG ": malformed tag number on line %d\n", lineNum);
-    }
-    errno = EINVAL;
-    return -1;
-  }
-
-  uint32_t tagIndex = val;
-  if (tagIndex != val) {
-    if (lineNum) {
-      fprintf(stderr, OUT_TAG ": tag number too large on line %d\n", lineNum);
-    }
-    errno = ERANGE;
-    return -1;
-  }
-
-  while ((*++cp != '\n') && isspace(*cp)) {
-  }
-
-  if (*cp == '\n') {
-    if (lineNum) {
-      fprintf(stderr, OUT_TAG ": missing tag string on line %d\n", lineNum);
-    }
-    errno = EINVAL;
-    return -1;
-  }
-
-  const char* tag = cp;
-  cp = endOfTag(cp);
-  size_t tagLen = cp - tag;
-
-  if (!isspace(*cp)) {
-    if (lineNum) {
-      fprintf(stderr, OUT_TAG ": invalid tag char %c on line %d\n", *cp,
-              lineNum);
-    }
-    errno = EINVAL;
-    return -1;
-  }
-
-  while (isspace(*cp) && (*cp != '\n')) ++cp;
-  const char* fmt = NULL;
-  size_t fmtLen = 0;
-  if (*cp && (*cp != '#')) {
-    fmt = cp;
-    while (*cp && (*cp != '\n') && (*cp != '#')) ++cp;
-    while ((cp > fmt) && isspace(*(cp - 1))) --cp;
-    fmtLen = cp - fmt;
-  }
-
-  // KISS Only report identicals if they are global
-  // Ideally we want to check if there are identicals
-  // recorded for the same uid, but recording that
-  // unused detail in our database is too burdensome.
-  bool verbose = true;
-  while (*cp && (*cp != '#') && (*cp != '\n')) ++cp;
-  if (*cp == '#') {
-    do {
-      ++cp;
-    } while (isspace(*cp) && (*cp != '\n'));
-    verbose = !!fastcmp<strncmp>(cp, "uid=", strlen("uid="));
-  }
-
-  while (*cp && (*cp != '\n')) ++cp;
-#ifdef DEBUG
-  fprintf(stderr, "%d: %p: %.*s\n", lineNum, tag, (int)(cp - pData), pData);
-#endif
-  pData = cp;
-
-  if (lineNum) {
-    if (map->emplaceUnique(tagIndex,
-                           TagFmt(std::make_pair(MapString(tag, tagLen),
-                                                 MapString(fmt, fmtLen))),
-                           verbose)) {
-      return 0;
-    }
-  } else {
-    // cache
-    if (map->emplaceUnique(
-            tagIndex,
-            TagFmt(std::make_pair(MapString(std::string(tag, tagLen)),
-                                  MapString(std::string(fmt, fmtLen)))))) {
-      return 0;
-    }
-  }
-  errno = EMLINK;
-  return -1;
-}
-
-static const char* eventTagFiles[NUM_MAPS] = {
-  EVENT_TAG_MAP_FILE, "/dev/event-log-tags",
-};
-
-// Parse the tags out of the file.
-static int parseMapLines(EventTagMap* map, size_t which) {
-  const char* cp = static_cast<char*>(map->mapAddr[which]);
-  size_t len = map->mapLen[which];
-  const char* endp = cp + len;
-
-  // insist on EOL at EOF; simplifies parsing and null-termination
-  if (!len || (*(endp - 1) != '\n')) {
-#ifdef DEBUG
-    fprintf(stderr, OUT_TAG ": map file %zu[%zu] missing EOL on last line\n",
-            which, len);
-#endif
-    if (which) {  // do not propagate errors for other files
-      return 0;
-    }
-    errno = EINVAL;
-    return -1;
-  }
-
-  bool lineStart = true;
-  int lineNum = 1;
-  while (cp < endp) {
-    if (*cp == '\n') {
-      lineStart = true;
-      lineNum++;
-    } else if (lineStart) {
-      if (*cp == '#') {
-        // comment; just scan to end
-        lineStart = false;
-      } else if (isdigit(*cp)) {
-        // looks like a tag; scan it out
-        if (scanTagLine(map, cp, lineNum) != 0) {
-          if (!which || (errno != EMLINK)) {
-            return -1;
-          }
-        }
-        lineNum++;  // we eat the '\n'
-                    // leave lineStart==true
-      } else if (isspace(*cp)) {
-        // looks like leading whitespace; keep scanning
-      } else {
-        fprintf(stderr,
-                OUT_TAG
-                ": unexpected chars (0x%02x) in tag number on line %d\n",
-                *cp, lineNum);
-        errno = EINVAL;
-        return -1;
-      }
-    } else {
-      // this is a blank or comment line
-    }
-    cp++;
-  }
-
-  return 0;
-}
-
-// Open the map file and allocate a structure to manage it.
-//
-// We create a private mapping because we want to terminate the log tag
-// strings with '\0'.
-EventTagMap* android_openEventTagMap(const char* fileName) {
-  EventTagMap* newTagMap;
-  off_t end[NUM_MAPS];
-  int save_errno, fd[NUM_MAPS];
-  size_t which;
-
-  memset(fd, -1, sizeof(fd));
-  memset(end, 0, sizeof(end));
-
-  for (which = 0; which < NUM_MAPS; ++which) {
-    const char* tagfile = fileName ? fileName : eventTagFiles[which];
-
-    fd[which] = open(tagfile, O_RDONLY | O_CLOEXEC);
-    if (fd[which] < 0) {
-      if (!which) {
-        save_errno = errno;
-        fprintf(stderr, OUT_TAG ": unable to open map '%s': %s\n", tagfile,
-                strerror(save_errno));
-        goto fail_errno;
-      }
-      continue;
-    }
-    end[which] = lseek(fd[which], 0L, SEEK_END);
-    save_errno = errno;
-    (void)lseek(fd[which], 0L, SEEK_SET);
-    if (!which && (end[0] < 0)) {
-      fprintf(stderr, OUT_TAG ": unable to seek map '%s' %s\n", tagfile,
-              strerror(save_errno));
-      goto fail_close;
-    }
-    if (fileName) break;  // Only allow one as specified
-  }
-
-  newTagMap = new EventTagMap;
-  if (newTagMap == NULL) {
-    save_errno = errno;
-    goto fail_close;
-  }
-
-  for (which = 0; which < NUM_MAPS; ++which) {
-    if (fd[which] >= 0) {
-      newTagMap->mapAddr[which] =
-          mmap(NULL, end[which], which ? PROT_READ : PROT_READ | PROT_WRITE,
-               which ? MAP_SHARED : MAP_PRIVATE, fd[which], 0);
-      save_errno = errno;
-      close(fd[which]); /* fd DONE */
-      fd[which] = -1;
-      if ((newTagMap->mapAddr[which] != MAP_FAILED) &&
-          (newTagMap->mapAddr[which] != NULL)) {
-        newTagMap->mapLen[which] = end[which];
-      } else if (!which) {
-        const char* tagfile = fileName ? fileName : eventTagFiles[which];
-
-        fprintf(stderr, OUT_TAG ": mmap(%s) failed: %s\n", tagfile,
-                strerror(save_errno));
-        goto fail_unmap;
-      }
-    }
-  }
-
-  for (which = 0; which < NUM_MAPS; ++which) {
-    if (parseMapLines(newTagMap, which) != 0) {
-      delete newTagMap;
-      return NULL;
-    }
-    /* See 'fd DONE' comments above and below, no need to clean up here */
-  }
-
-  return newTagMap;
-
-fail_unmap:
-  save_errno = EINVAL;
-  delete newTagMap;
-fail_close:
-  for (which = 0; which < NUM_MAPS; ++which) close(fd[which]); /* fd DONE */
-fail_errno:
-  errno = save_errno;
-  return NULL;
-}
-
-// Close the map.
-void android_closeEventTagMap(EventTagMap* map) {
-  if (map) delete map;
-}
-
-// Cache miss, go to logd to acquire a public reference.
-// Because we lack access to a SHARED PUBLIC /dev/event-log-tags file map?
-static const TagFmt* __getEventTag([[maybe_unused]] EventTagMap* map, unsigned int tag) {
-  // call event tag service to arrange for a new tag
-  char* buf = NULL;
-  // Can not use android::base::StringPrintf, asprintf + free instead.
-  static const char command_template[] = "getEventTag id=%u";
-  int ret = asprintf(&buf, command_template, tag);
-  if (ret > 0) {
-    // Add some buffer margin for an estimate of the full return content.
-    size_t size =
-        ret - strlen(command_template) +
-        strlen("65535\n4294967295\t?\t\t\t?\t# uid=32767\n\n\f?success?");
-    if (size > (size_t)ret) {
-      char* np = static_cast<char*>(realloc(buf, size));
-      if (np) {
-        buf = np;
-      } else {
-        size = ret;
-      }
-    } else {
-      size = ret;
-    }
-#ifdef __ANDROID__
-    // Ask event log tag service for an existing entry
-    if (SendLogdControlMessage(buf, size) >= 0) {
-      buf[size - 1] = '\0';
-      char* ep;
-      unsigned long val = strtoul(buf, &ep, 10);  // return size
-      const char* cp = ep;
-      if ((buf != cp) && (val > 0) && (*cp == '\n')) {  // truncation OK
-        ++cp;
-        if (!scanTagLine(map, cp, 0)) {
-          free(buf);
-          return map->find(tag);
-        }
-      }
-    }
-#endif
-    free(buf);
-  }
-  return NULL;
-}
-
-// Look up an entry in the map.
-const char* android_lookupEventTag_len(const EventTagMap* map, size_t* len, unsigned int tag) {
-  if (len) *len = 0;
-  const TagFmt* str = map->find(tag);
-  if (!str) {
-    str = __getEventTag(const_cast<EventTagMap*>(map), tag);
-  }
-  if (!str) return NULL;
-  if (len) *len = str->first.length();
-  return str->first.data();
-}
-
-// Look up an entry in the map.
-const char* android_lookupEventFormat_len(const EventTagMap* map, size_t* len, unsigned int tag) {
-  if (len) *len = 0;
-  const TagFmt* str = map->find(tag);
-  if (!str) {
-    str = __getEventTag(const_cast<EventTagMap*>(map), tag);
-  }
-  if (!str) return NULL;
-  if (len) *len = str->second.length();
-  return str->second.data();
-}
-
-// This function is deprecated and replaced with android_lookupEventTag_len
-// since it will cause the map to change from Shared and backed by a file,
-// to Private Dirty and backed up by swap, albeit highly compressible. By
-// deprecating this function everywhere, we save 100s of MB of memory space.
-const char* android_lookupEventTag(const EventTagMap* map, unsigned int tag) {
-  size_t len;
-  const char* tagStr = android_lookupEventTag_len(map, &len, tag);
-
-  if (!tagStr) return tagStr;
-  char* cp = const_cast<char*>(tagStr);
-  cp += len;
-  if (*cp) *cp = '\0';  // Trigger copy on write :-( and why deprecated.
-  return tagStr;
-}
-
-// Look up tagname, generate one if necessary, and return a tag
-int android_lookupEventTagNum(EventTagMap* map, const char* tagname, const char* format, int prio) {
-  const char* ep = endOfTag(tagname);
-  size_t len = ep - tagname;
-  if (!len || *ep) {
-    errno = EINVAL;
-    return -1;
-  }
-
-  if ((prio != ANDROID_LOG_UNKNOWN) && (prio < ANDROID_LOG_SILENT) &&
-      !__android_log_is_loggable_len(prio, tagname, len,
-                                     __android_log_is_debuggable()
-                                         ? ANDROID_LOG_VERBOSE
-                                         : ANDROID_LOG_DEBUG)) {
-    errno = EPERM;
-    return -1;
-  }
-
-  if (!format) format = "";
-  ssize_t fmtLen = strlen(format);
-  int ret = map->find(TagFmt(
-      std::make_pair(MapString(tagname, len), MapString(format, fmtLen))));
-  if (ret != -1) return ret;
-
-  // call event tag service to arrange for a new tag
-  char* buf = NULL;
-  // Can not use android::base::StringPrintf, asprintf + free instead.
-  static const char command_template[] = "getEventTag name=%s format=\"%s\"";
-  ret = asprintf(&buf, command_template, tagname, format);
-  if (ret > 0) {
-    // Add some buffer margin for an estimate of the full return content.
-    char* cp;
-    size_t size =
-        ret - strlen(command_template) +
-        strlen("65535\n4294967295\t?\t\t\t?\t# uid=32767\n\n\f?success?");
-    if (size > (size_t)ret) {
-      cp = static_cast<char*>(realloc(buf, size));
-      if (cp) {
-        buf = cp;
-      } else {
-        size = ret;
-      }
-    } else {
-      size = ret;
-    }
-#ifdef __ANDROID__
-    // Ask event log tag service for an allocation
-    if (SendLogdControlMessage(buf, size) >= 0) {
-      buf[size - 1] = '\0';
-      unsigned long val = strtoul(buf, &cp, 10);        // return size
-      if ((buf != cp) && (val > 0) && (*cp == '\n')) {  // truncation OK
-        val = strtoul(cp + 1, &cp, 10);                 // allocated tag number
-        if ((val > 0) && (val < UINT32_MAX) && (*cp == '\t')) {
-          free(buf);
-          ret = val;
-          // cache
-          map->emplaceUnique(ret, TagFmt(std::make_pair(
-                                      MapString(std::string(tagname, len)),
-                                      MapString(std::string(format, fmtLen)))));
-          return ret;
-        }
-      }
-    }
-#endif
-    free(buf);
-  }
-
-  // Hail Mary
-  ret = map->find(MapString(tagname, len));
-  if (ret == -1) errno = ESRCH;
-  return ret;
-}
diff --git a/liblog/include/android/log.h b/liblog/include/android/log.h
deleted file mode 100644
index 512c7cd..0000000
--- a/liblog/include/android/log.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#pragma once
-
-/**
- * @addtogroup Logging
- * @{
- */
-
-/**
- * \file
- *
- * Support routines to send messages to the Android log buffer,
- * which can later be accessed through the `logcat` utility.
- *
- * Each log message must have
- *   - a priority
- *   - a log tag
- *   - some text
- *
- * The tag normally corresponds to the component that emits the log message,
- * and should be reasonably small.
- *
- * Log message text may be truncated to less than an implementation-specific
- * limit (1023 bytes).
- *
- * Note that a newline character ("\n") will be appended automatically to your
- * log message, if not already there. It is not possible to send several
- * messages and have them appear on a single line in logcat.
- *
- * Please use logging in moderation:
- *
- *  - Sending log messages eats CPU and slow down your application and the
- *    system.
- *
- *  - The circular log buffer is pretty small, so sending many messages
- *    will hide other important log messages.
- *
- *  - In release builds, only send log messages to account for exceptional
- *    conditions.
- */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-#if !defined(__BIONIC__) && !defined(__INTRODUCED_IN)
-#define __INTRODUCED_IN(x)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Android log priority values, in increasing order of priority.
- */
-typedef enum android_LogPriority {
-  /** For internal use only.  */
-  ANDROID_LOG_UNKNOWN = 0,
-  /** The default priority, for internal use only.  */
-  ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
-  /** Verbose logging. Should typically be disabled for a release apk. */
-  ANDROID_LOG_VERBOSE,
-  /** Debug logging. Should typically be disabled for a release apk. */
-  ANDROID_LOG_DEBUG,
-  /** Informational logging. Should typically be disabled for a release apk. */
-  ANDROID_LOG_INFO,
-  /** Warning logging. For use with recoverable failures. */
-  ANDROID_LOG_WARN,
-  /** Error logging. For use with unrecoverable failures. */
-  ANDROID_LOG_ERROR,
-  /** Fatal logging. For use when aborting. */
-  ANDROID_LOG_FATAL,
-  /** For internal use only.  */
-  ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
-} android_LogPriority;
-
-/**
- * Writes the constant string `text` to the log, with priority `prio` and tag
- * `tag`.
- */
-int __android_log_write(int prio, const char* tag, const char* text);
-
-/**
- * Writes a formatted string to the log, with priority `prio` and tag `tag`.
- * The details of formatting are the same as for
- * [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html).
- */
-int __android_log_print(int prio, const char* tag, const char* fmt, ...)
-    __attribute__((__format__(printf, 3, 4)));
-
-/**
- * Equivalent to `__android_log_print`, but taking a `va_list`.
- * (If `__android_log_print` is like `printf`, this is like `vprintf`.)
- */
-int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap)
-    __attribute__((__format__(printf, 3, 0)));
-
-/**
- * Writes an assertion failure to the log (as `ANDROID_LOG_FATAL`) and to
- * stderr, before calling
- * [abort(3)](http://man7.org/linux/man-pages/man3/abort.3.html).
- *
- * If `fmt` is non-null, `cond` is unused. If `fmt` is null, the string
- * `Assertion failed: %s` is used with `cond` as the string argument.
- * If both `fmt` and `cond` are null, a default string is provided.
- *
- * Most callers should use
- * [assert(3)](http://man7.org/linux/man-pages/man3/assert.3.html) from
- * `&lt;assert.h&gt;` instead, or the `__assert` and `__assert2` functions
- * provided by bionic if more control is needed. They support automatically
- * including the source filename and line number more conveniently than this
- * function.
- */
-void __android_log_assert(const char* cond, const char* tag, const char* fmt, ...)
-    __attribute__((__noreturn__)) __attribute__((__format__(printf, 3, 4)));
-
-/**
- * Identifies a specific log buffer for __android_log_buf_write()
- * and __android_log_buf_print().
- */
-typedef enum log_id {
-  LOG_ID_MIN = 0,
-
-  /** The main log buffer. This is the only log buffer available to apps. */
-  LOG_ID_MAIN = 0,
-  /** The radio log buffer. */
-  LOG_ID_RADIO = 1,
-  /** The event log buffer. */
-  LOG_ID_EVENTS = 2,
-  /** The system log buffer. */
-  LOG_ID_SYSTEM = 3,
-  /** The crash log buffer. */
-  LOG_ID_CRASH = 4,
-  /** The statistics log buffer. */
-  LOG_ID_STATS = 5,
-  /** The security log buffer. */
-  LOG_ID_SECURITY = 6,
-  /** The kernel log buffer. */
-  LOG_ID_KERNEL = 7,
-
-  LOG_ID_MAX,
-
-  /** Let the logging function choose the best log target. */
-  LOG_ID_DEFAULT = 0x7FFFFFFF
-} log_id_t;
-
-/**
- * Writes the constant string `text` to the log buffer `id`,
- * with priority `prio` and tag `tag`.
- *
- * Apps should use __android_log_write() instead.
- */
-int __android_log_buf_write(int bufID, int prio, const char* tag, const char* text);
-
-/**
- * Writes a formatted string to log buffer `id`,
- * with priority `prio` and tag `tag`.
- * The details of formatting are the same as for
- * [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html).
- *
- * Apps should use __android_log_print() instead.
- */
-int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...)
-    __attribute__((__format__(printf, 4, 5)));
-
-/**
- * Logger data struct used for writing log messages to liblog via __android_log_write_logger_data()
- * and sending log messages to user defined loggers specified in __android_log_set_logger().
- */
-struct __android_log_message {
-  size_t
-      struct_size;   /** Must be set to sizeof(__android_log_message) and is used for versioning. */
-  int32_t buffer_id; /** {@link log_id_t} values. */
-  int32_t priority;  /** {@link android_LogPriority} values. */
-  const char* tag;   /** The tag for the log message. */
-  const char* file;  /** Optional file name, may be set to nullptr. */
-  uint32_t line;     /** Optional line number, ignore if file is nullptr. */
-  const char* message; /** The log message itself. */
-};
-
-/**
- * Prototype for the 'logger' function that is called for every log message.
- */
-typedef void (*__android_logger_function)(const struct __android_log_message* log_message);
-/**
- * Prototype for the 'abort' function that is called when liblog will abort due to
- * __android_log_assert() failures.
- */
-typedef void (*__android_aborter_function)(const char* abort_message);
-
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
-/**
- * Writes the log message specified by log_message.  log_message includes additional file name and
- * line number information that a logger may use.  log_message is versioned for backwards
- * compatibility.
- * This assumes that loggability has already been checked through __android_log_is_loggable().
- * Higher level logging libraries, such as libbase, first check loggability, then format their
- * buffers, then pass the message to liblog via this function, and therefore we do not want to
- * duplicate the loggability check here.
- *
- * @param log_message the log message itself, see {@link __android_log_message}.
- *
- * Available since API level 30.
- */
-void __android_log_write_log_message(struct __android_log_message* log_message) __INTRODUCED_IN(30);
-
-/**
- * Sets a user defined logger function.  All log messages sent to liblog will be set to the
- * function pointer specified by logger for processing.  It is not expected that log messages are
- * already terminated with a new line.  This function should add new lines if required for line
- * separation.
- *
- * @param logger the new function that will handle log messages.
- *
- * Available since API level 30.
- */
-void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN(30);
-
-/**
- * Writes the log message to logd.  This is an __android_logger_function and can be provided to
- * __android_log_set_logger().  It is the default logger when running liblog on a device.
- *
- * @param log_message the log message to write, see {@link __android_log_message}.
- *
- * Available since API level 30.
- */
-void __android_log_logd_logger(const struct __android_log_message* log_message) __INTRODUCED_IN(30);
-
-/**
- * Writes the log message to stderr.  This is an __android_logger_function and can be provided to
- * __android_log_set_logger().  It is the default logger when running liblog on host.
- *
- * @param log_message the log message to write, see {@link __android_log_message}.
- *
- * Available since API level 30.
- */
-void __android_log_stderr_logger(const struct __android_log_message* log_message)
-    __INTRODUCED_IN(30);
-
-/**
- * Sets a user defined aborter function that is called for __android_log_assert() failures.  This
- * user defined aborter function is highly recommended to abort and be noreturn, but is not strictly
- * required to.
- *
- * @param aborter the new aborter function, see {@link __android_aborter_function}.
- *
- * Available since API level 30.
- */
-void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_IN(30);
-
-/**
- * Calls the stored aborter function.  This allows for other logging libraries to use the same
- * aborter function by calling this function in liblog.
- *
- * @param abort_message an additional message supplied when aborting, for example this is used to
- *                      call android_set_abort_message() in __android_log_default_aborter().
- *
- * Available since API level 30.
- */
-void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(30);
-
-/**
- * Sets android_set_abort_message() on device then aborts().  This is the default aborter.
- *
- * @param abort_message an additional message supplied when aborting.  This functions calls
- *                      android_set_abort_message() with its contents.
- *
- * Available since API level 30.
- */
-void __android_log_default_aborter(const char* abort_message) __attribute__((noreturn))
-__INTRODUCED_IN(30);
-
-/**
- * Use the per-tag properties "log.tag.<tagname>" along with the minimum priority from
- * __android_log_set_minimum_priority() to determine if a log message with a given prio and tag will
- * be printed.  A non-zero result indicates yes, zero indicates false.
- *
- * If both a priority for a tag and a minimum priority are set by
- * __android_log_set_minimum_priority(), then the lowest of the two values are to determine the
- * minimum priority needed to log.  If only one is set, then that value is used to determine the
- * minimum priority needed.  If none are set, then default_priority is used.
- *
- * @param prio         the priority to test, takes {@link android_LogPriority} values.
- * @param tag          the tag to test.
- * @param len          the length of the tag.
- * @param default_prio the default priority to use if no properties or minimum priority are set.
- * @return an integer where 1 indicates that the message is loggable and 0 indicates that it is not.
- *
- * Available since API level 30.
- */
-int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INTRODUCED_IN(30);
-int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio)
-    __INTRODUCED_IN(30);
-
-/**
- * Sets the minimum priority that will be logged for this process.
- *
- * @param priority the new minimum priority to set, takes @{link android_LogPriority} values.
- * @return the previous set minimum priority as @{link android_LogPriority} values, or
- *         ANDROID_LOG_DEFAULT if none was set.
- *
- * Available since API level 30.
- */
-int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(30);
-
-/**
- * Gets the minimum priority that will be logged for this process.  If none has been set by a
- * previous __android_log_set_minimum_priority() call, this returns ANDROID_LOG_DEFAULT.
- *
- * @return the current minimum priority as @{link android_LogPriority} values, or
- *         ANDROID_LOG_DEFAULT if none is set.
- *
- * Available since API level 30.
- */
-int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(30);
-
-/**
- * Sets the default tag if no tag is provided when writing a log message.  Defaults to
- * getprogname().  This truncates tag to the maximum log message size, though appropriate tags
- * should be much smaller.
- *
- * @param tag the new log tag.
- *
- * Available since API level 30.
- */
-void __android_log_set_default_tag(const char* tag) __INTRODUCED_IN(30);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
diff --git a/liblog/include/log/event_tag_map.h b/liblog/include/log/event_tag_map.h
deleted file mode 100644
index f7ec208..0000000
--- a/liblog/include/log/event_tag_map.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define EVENT_TAG_MAP_FILE "/system/etc/event-log-tags"
-
-struct EventTagMap;
-typedef struct EventTagMap EventTagMap;
-
-/*
- * Open the specified file as an event log tag map.
- *
- * Returns NULL on failure.
- */
-EventTagMap* android_openEventTagMap(const char* fileName);
-
-/*
- * Close the map.
- */
-void android_closeEventTagMap(EventTagMap* map);
-
-/*
- * Look up a tag by index.  Returns the tag string, or NULL if not found.
- */
-const char* android_lookupEventTag(const EventTagMap* map, unsigned int tag)
-    __attribute__((
-        deprecated("use android_lookupEventTag_len() instead to minimize "
-                   "MAP_PRIVATE copy-on-write memory impact")));
-
-/*
- * Look up a tag by index.  Returns the tag string & string length, or NULL if
- * not found.  Returned string is not guaranteed to be nul terminated.
- */
-const char* android_lookupEventTag_len(const EventTagMap* map, size_t* len,
-                                       unsigned int tag);
-
-/*
- * Look up a format by index. Returns the format string & string length,
- * or NULL if not found. Returned string is not guaranteed to be nul terminated.
- */
-const char* android_lookupEventFormat_len(const EventTagMap* map, size_t* len,
-                                          unsigned int tag);
-
-/*
- * Look up tagname, generate one if necessary, and return a tag
- */
-int android_lookupEventTagNum(EventTagMap* map, const char* tagname,
-                              const char* format, int prio);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log.h b/liblog/include/log/log.h
deleted file mode 100644
index c116add..0000000
--- a/liblog/include/log/log.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2005-2014 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.
- */
-
-#pragma once
-
-/* Too many in the ecosystem assume these are included */
-#if !defined(_WIN32)
-#include <pthread.h>
-#endif
-#include <stdint.h> /* uint16_t, int32_t */
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <android/log.h>
-#include <log/log_id.h>
-#include <log/log_main.h>
-#include <log/log_radio.h>
-#include <log/log_read.h>
-#include <log/log_safetynet.h>
-#include <log/log_system.h>
-#include <log/log_time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * LOG_TAG is the local tag used for the following simplified
- * logging macros.  You can change this preprocessor definition
- * before using the other macros to change the tag.
- */
-
-#ifndef LOG_TAG
-#define LOG_TAG NULL
-#endif
-
-/*
- * Normally we strip the effects of ALOGV (VERBOSE messages),
- * LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
- * release builds be defining NDEBUG.  You can modify this (for
- * example with "#define LOG_NDEBUG 0" at the top of your source
- * file) to change that behavior.
- */
-
-#ifndef LOG_NDEBUG
-#ifdef NDEBUG
-#define LOG_NDEBUG 1
-#else
-#define LOG_NDEBUG 0
-#endif
-#endif
-
-/*
- * Event logging.
- */
-
-/*
- * The following should not be used directly.
- */
-
-int __android_log_bwrite(int32_t tag, const void* payload, size_t len);
-int __android_log_btwrite(int32_t tag, char type, const void* payload,
-                          size_t len);
-int __android_log_bswrite(int32_t tag, const char* payload);
-
-int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len);
-
-#define android_bWriteLog(tag, payload, len) \
-  __android_log_bwrite(tag, payload, len)
-#define android_btWriteLog(tag, type, payload, len) \
-  __android_log_btwrite(tag, type, payload, len)
-
-/*
- * Event log entry types.
- */
-#ifndef __AndroidEventLogType_defined
-#define __AndroidEventLogType_defined
-typedef enum {
-  /* Special markers for android_log_list_element type */
-  EVENT_TYPE_LIST_STOP = '\n', /* declare end of list  */
-  EVENT_TYPE_UNKNOWN = '?',    /* protocol error       */
-
-  /* must match with declaration in java/android/android/util/EventLog.java */
-  EVENT_TYPE_INT = 0,  /* int32_t */
-  EVENT_TYPE_LONG = 1, /* int64_t */
-  EVENT_TYPE_STRING = 2,
-  EVENT_TYPE_LIST = 3,
-  EVENT_TYPE_FLOAT = 4,
-} AndroidEventLogType;
-#endif
-#define sizeof_AndroidEventLogType sizeof(typeof_AndroidEventLogType)
-#define typeof_AndroidEventLogType unsigned char
-
-#ifndef LOG_EVENT_INT
-#define LOG_EVENT_INT(_tag, _value)                                          \
-  {                                                                          \
-    int intBuf = _value;                                                     \
-    (void)android_btWriteLog(_tag, EVENT_TYPE_INT, &intBuf, sizeof(intBuf)); \
-  }
-#endif
-#ifndef LOG_EVENT_LONG
-#define LOG_EVENT_LONG(_tag, _value)                                            \
-  {                                                                             \
-    long long longBuf = _value;                                                 \
-    (void)android_btWriteLog(_tag, EVENT_TYPE_LONG, &longBuf, sizeof(longBuf)); \
-  }
-#endif
-#ifndef LOG_EVENT_FLOAT
-#define LOG_EVENT_FLOAT(_tag, _value)                           \
-  {                                                             \
-    float floatBuf = _value;                                    \
-    (void)android_btWriteLog(_tag, EVENT_TYPE_FLOAT, &floatBuf, \
-                             sizeof(floatBuf));                 \
-  }
-#endif
-#ifndef LOG_EVENT_STRING
-#define LOG_EVENT_STRING(_tag, _value) \
-  (void)__android_log_bswrite(_tag, _value);
-#endif
-
-#ifdef __linux__
-
-clockid_t android_log_clockid(void);
-
-#endif /* __linux__ */
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Release any logger resources (a new log write will immediately re-acquire)
- *
- * This is specifically meant to be used by Zygote to close open file descriptors after fork()
- * and before specialization.  O_CLOEXEC is used on file descriptors, so they will be closed upon
- * exec() in normal use cases.
- *
- * Note that this is not safe to call from a multi-threaded program.
- */
-void __android_log_close(void);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log_event_list.h b/liblog/include/log/log_event_list.h
deleted file mode 100644
index deadf20..0000000
--- a/liblog/include/log/log_event_list.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <errno.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-#include <string>
-#endif
-
-#include <log/log.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For manipulating lists of events. */
-
-#define ANDROID_MAX_LIST_NEST_DEPTH 8
-
-/*
- * The opaque context used to manipulate lists of events.
- */
-typedef struct android_log_context_internal* android_log_context;
-
-/*
- * Elements returned when reading a list of events.
- */
-typedef struct {
-  AndroidEventLogType type;
-  uint16_t complete;
-  uint16_t len;
-  union {
-    int32_t int32;
-    int64_t int64;
-    char* string;
-    float float32;
-  } data;
-} android_log_list_element;
-
-/*
- * 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);
-
-/*
- * Creates a context from a raw buffer representing a list of events to be read.
- */
-android_log_context create_android_log_parser(const char* msg, size_t len);
-
-android_log_list_element android_log_read_next(android_log_context ctx);
-android_log_list_element android_log_peek_next(android_log_context ctx);
-
-/* Reset writer context */
-int android_log_reset(android_log_context ctx);
-
-/* Reset reader context */
-int android_log_parser_reset(android_log_context ctx,
-                             const char* msg, size_t len);
-
-/* Finished with reader or writer context */
-int android_log_destroy(android_log_context* ctx);
-
-#ifdef __cplusplus
-/* android_log_list C++ helpers */
-extern "C++" {
-class android_log_event_list {
- private:
-  android_log_context ctx;
-  int ret;
-
-  android_log_event_list(const android_log_event_list&) = delete;
-  void operator=(const android_log_event_list&) = delete;
-
- public:
-  explicit android_log_event_list(int tag) : ret(0) {
-    ctx = create_android_logger(static_cast<uint32_t>(tag));
-  }
-  ~android_log_event_list() {
-    android_log_destroy(&ctx);
-  }
-
-  int close() {
-    int retval = android_log_destroy(&ctx);
-    if (retval < 0) ret = retval;
-    return retval;
-  }
-
-  /* To allow above C calls to use this class as parameter */
-  operator android_log_context() const {
-    return ctx;
-  }
-
-  /* return errors or transmit status */
-  int status() const {
-    return ret;
-  }
-
-  int begin() {
-    int retval = android_log_write_list_begin(ctx);
-    if (retval < 0) ret = retval;
-    return ret;
-  }
-  int end() {
-    int retval = android_log_write_list_end(ctx);
-    if (retval < 0) ret = retval;
-    return ret;
-  }
-
-  android_log_event_list& operator<<(int32_t value) {
-    int retval = android_log_write_int32(ctx, value);
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(uint32_t value) {
-    int retval = android_log_write_int32(ctx, static_cast<int32_t>(value));
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(bool value) {
-    int retval = android_log_write_int32(ctx, value ? 1 : 0);
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(int64_t value) {
-    int retval = android_log_write_int64(ctx, value);
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(uint64_t value) {
-    int retval = android_log_write_int64(ctx, static_cast<int64_t>(value));
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(const char* value) {
-    int retval = android_log_write_string8(ctx, value);
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(const std::string& value) {
-    int retval =
-        android_log_write_string8_len(ctx, value.data(), value.length());
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  android_log_event_list& operator<<(float value) {
-    int retval = android_log_write_float32(ctx, value);
-    if (retval < 0) ret = retval;
-    return *this;
-  }
-
-  int write(log_id_t id = LOG_ID_EVENTS) {
-    /* facilitate -EBUSY retry */
-    if ((ret == -EBUSY) || (ret > 0)) ret = 0;
-    int retval = android_log_write_list(ctx, id);
-    /* existing errors trump transmission errors */
-    if (!ret) ret = retval;
-    return ret;
-  }
-
-  int operator<<(log_id_t id) {
-    write(id);
-    android_log_destroy(&ctx);
-    return ret;
-  }
-
-  /*
-   * Append<Type> methods removes any integer promotion
-   * confusion, and adds access to string with length.
-   * Append methods are also added for all types for
-   * convenience.
-   */
-
-  bool AppendInt(int32_t value) {
-    int retval = android_log_write_int32(ctx, value);
-    if (retval < 0) ret = retval;
-    return ret >= 0;
-  }
-
-  bool AppendLong(int64_t value) {
-    int retval = android_log_write_int64(ctx, value);
-    if (retval < 0) ret = retval;
-    return ret >= 0;
-  }
-
-  bool AppendString(const char* value) {
-    int retval = android_log_write_string8(ctx, value);
-    if (retval < 0) ret = retval;
-    return ret >= 0;
-  }
-
-  bool AppendString(const char* value, size_t len) {
-    int retval = android_log_write_string8_len(ctx, value, len);
-    if (retval < 0) ret = retval;
-    return ret >= 0;
-  }
-
-  bool AppendString(const std::string& value) {
-    int retval =
-        android_log_write_string8_len(ctx, value.data(), value.length());
-    if (retval < 0) ret = retval;
-    return ret;
-  }
-
-  bool Append(const std::string& value) {
-    int retval =
-        android_log_write_string8_len(ctx, value.data(), value.length());
-    if (retval < 0) ret = retval;
-    return ret;
-  }
-
-  bool AppendFloat(float value) {
-    int retval = android_log_write_float32(ctx, value);
-    if (retval < 0) ret = retval;
-    return ret >= 0;
-  }
-
-  template <typename Tvalue>
-  bool Append(Tvalue value) {
-    *this << value;
-    return ret >= 0;
-  }
-
-  bool Append(const char* value, size_t len) {
-    int retval = android_log_write_string8_len(ctx, value, len);
-    if (retval < 0) ret = retval;
-    return ret >= 0;
-  }
-};
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log_id.h b/liblog/include/log/log_id.h
deleted file mode 100644
index c8fafe7..0000000
--- a/liblog/include/log/log_id.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#pragma once
-
-#include <android/log.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Send a simple string to the log.
- */
-int __android_log_buf_write(int bufID, int prio, const char* tag,
-                            const char* text);
-int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...)
-    __attribute__((__format__(printf, 4, 5)));
-
-/*
- * log_id_t helpers
- */
-log_id_t android_name_to_log_id(const char* logName);
-const char* android_log_id_to_name(log_id_t log_id);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log_main.h b/liblog/include/log/log_main.h
deleted file mode 100644
index 1bd1c8a..0000000
--- a/liblog/include/log/log_main.h
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#pragma once
-
-#include <stdbool.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <android/log.h>
-
-__BEGIN_DECLS
-
-/*
- * Normally we strip the effects of ALOGV (VERBOSE messages),
- * LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
- * release builds be defining NDEBUG.  You can modify this (for
- * example with "#define LOG_NDEBUG 0" at the top of your source
- * file) to change that behavior.
- */
-
-#ifndef LOG_NDEBUG
-#ifdef NDEBUG
-#define LOG_NDEBUG 1
-#else
-#define LOG_NDEBUG 0
-#endif
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * This file uses ", ## __VA_ARGS__" zero-argument token pasting to
- * work around issues with debug-only syntax errors in assertions
- * that are missing format strings.  See commit
- * 19299904343daf191267564fe32e6cd5c165cd42
- */
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
-#endif
-
-/*
- * Use __VA_ARGS__ if running a static analyzer,
- * to avoid warnings of unused variables in __VA_ARGS__.
- * Use constexpr function in C++ mode, so these macros can be used
- * in other constexpr functions without warning.
- */
-#ifdef __clang_analyzer__
-#ifdef __cplusplus
-extern "C++" {
-template <typename... Ts>
-constexpr int __fake_use_va_args(Ts...) {
-  return 0;
-}
-}
-#else
-extern int __fake_use_va_args(int, ...);
-#endif /* __cplusplus */
-#define __FAKE_USE_VA_ARGS(...) ((void)__fake_use_va_args(0, ##__VA_ARGS__))
-#else
-#define __FAKE_USE_VA_ARGS(...) ((void)(0))
-#endif /* __clang_analyzer__ */
-
-#ifndef __predict_false
-#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
-#endif
-
-#define android_writeLog(prio, tag, text) __android_log_write(prio, tag, text)
-
-#define android_printLog(prio, tag, ...) \
-  __android_log_print(prio, tag, __VA_ARGS__)
-
-#define android_vprintLog(prio, cond, tag, ...) \
-  __android_log_vprint(prio, tag, __VA_ARGS__)
-
-/*
- * Log macro that allows you to specify a number for the priority.
- */
-#ifndef LOG_PRI
-#define LOG_PRI(priority, tag, ...) android_printLog(priority, tag, __VA_ARGS__)
-#endif
-
-/*
- * Log macro that allows you to pass in a varargs ("args" is a va_list).
- */
-#ifndef LOG_PRI_VA
-#define LOG_PRI_VA(priority, tag, fmt, args) \
-  android_vprintLog(priority, NULL, tag, fmt, args)
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/* XXX Macros to work around syntax errors in places where format string
- * arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
- * (happens only in debug builds).
- */
-
-/* Returns 2nd arg.  Used to substitute default value if caller's vararg list
- * is empty.
- */
-#define __android_second(dummy, second, ...) second
-
-/* If passed multiple args, returns ',' followed by all but 1st arg, otherwise
- * returns nothing.
- */
-#define __android_rest(first, ...) , ##__VA_ARGS__
-
-#define android_printAssert(cond, tag, ...)                     \
-  __android_log_assert(cond, tag,                               \
-                       __android_second(0, ##__VA_ARGS__, NULL) \
-                           __android_rest(__VA_ARGS__))
-
-/*
- * Log a fatal error.  If the given condition fails, this stops program
- * execution like a normal assertion, but also generating the given message.
- * It is NOT stripped from release builds.  Note that the condition test
- * is -inverted- from the normal assert() semantics.
- */
-#ifndef LOG_ALWAYS_FATAL_IF
-#define LOG_ALWAYS_FATAL_IF(cond, ...)                                                    \
-  ((__predict_false(cond)) ? (__FAKE_USE_VA_ARGS(__VA_ARGS__),                            \
-                              ((void)android_printAssert(#cond, LOG_TAG, ##__VA_ARGS__))) \
-                           : ((void)0))
-#endif
-
-#ifndef LOG_ALWAYS_FATAL
-#define LOG_ALWAYS_FATAL(...) \
-  (((void)android_printAssert(NULL, LOG_TAG, ##__VA_ARGS__)))
-#endif
-
-/*
- * Versions of LOG_ALWAYS_FATAL_IF and LOG_ALWAYS_FATAL that
- * are stripped out of release builds.
- */
-
-#if LOG_NDEBUG
-
-#ifndef LOG_FATAL_IF
-#define LOG_FATAL_IF(cond, ...) __FAKE_USE_VA_ARGS(__VA_ARGS__)
-#endif
-#ifndef LOG_FATAL
-#define LOG_FATAL(...) __FAKE_USE_VA_ARGS(__VA_ARGS__)
-#endif
-
-#else
-
-#ifndef LOG_FATAL_IF
-#define LOG_FATAL_IF(cond, ...) LOG_ALWAYS_FATAL_IF(cond, ##__VA_ARGS__)
-#endif
-#ifndef LOG_FATAL
-#define LOG_FATAL(...) LOG_ALWAYS_FATAL(__VA_ARGS__)
-#endif
-
-#endif
-
-/*
- * Assertion that generates a log message when the assertion fails.
- * Stripped out of release builds.  Uses the current LOG_TAG.
- */
-#ifndef ALOG_ASSERT
-#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ##__VA_ARGS__)
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * C/C++ logging functions.  See the logging documentation for API details.
- *
- * We'd like these to be available from C code (in case we import some from
- * somewhere), so this has a C interface.
- *
- * The output will be correct when the log file is shared between multiple
- * threads and/or multiple processes so long as the operating system
- * supports O_APPEND.  These calls have mutex-protected data structures
- * and so are NOT reentrant.  Do not use LOG in a signal handler.
- */
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Simplified macro to send a verbose log message using the current LOG_TAG.
- */
-#ifndef ALOGV
-#define __ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
-#if LOG_NDEBUG
-#define ALOGV(...)                   \
-  do {                               \
-    __FAKE_USE_VA_ARGS(__VA_ARGS__); \
-    if (false) {                     \
-      __ALOGV(__VA_ARGS__);          \
-    }                                \
-  } while (false)
-#else
-#define ALOGV(...) __ALOGV(__VA_ARGS__)
-#endif
-#endif
-
-#ifndef ALOGV_IF
-#if LOG_NDEBUG
-#define ALOGV_IF(cond, ...) __FAKE_USE_VA_ARGS(__VA_ARGS__)
-#else
-#define ALOGV_IF(cond, ...)                                                               \
-  ((__predict_false(cond))                                                                \
-       ? (__FAKE_USE_VA_ARGS(__VA_ARGS__), (void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
-       : ((void)0))
-#endif
-#endif
-
-/*
- * Simplified macro to send a debug log message using the current LOG_TAG.
- */
-#ifndef ALOGD
-#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef ALOGD_IF
-#define ALOGD_IF(cond, ...)                                                             \
-  ((__predict_false(cond))                                                              \
-       ? (__FAKE_USE_VA_ARGS(__VA_ARGS__), (void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
-       : ((void)0))
-#endif
-
-/*
- * Simplified macro to send an info log message using the current LOG_TAG.
- */
-#ifndef ALOGI
-#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef ALOGI_IF
-#define ALOGI_IF(cond, ...)                                                            \
-  ((__predict_false(cond))                                                             \
-       ? (__FAKE_USE_VA_ARGS(__VA_ARGS__), (void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
-       : ((void)0))
-#endif
-
-/*
- * Simplified macro to send a warning log message using the current LOG_TAG.
- */
-#ifndef ALOGW
-#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef ALOGW_IF
-#define ALOGW_IF(cond, ...)                                                            \
-  ((__predict_false(cond))                                                             \
-       ? (__FAKE_USE_VA_ARGS(__VA_ARGS__), (void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
-       : ((void)0))
-#endif
-
-/*
- * Simplified macro to send an error log message using the current LOG_TAG.
- */
-#ifndef ALOGE
-#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
-#endif
-
-#ifndef ALOGE_IF
-#define ALOGE_IF(cond, ...)                                                             \
-  ((__predict_false(cond))                                                              \
-       ? (__FAKE_USE_VA_ARGS(__VA_ARGS__), (void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
-       : ((void)0))
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Conditional based on whether the current LOG_TAG is enabled at
- * verbose priority.
- */
-#ifndef IF_ALOGV
-#if LOG_NDEBUG
-#define IF_ALOGV() if (false)
-#else
-#define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
-#endif
-#endif
-
-/*
- * Conditional based on whether the current LOG_TAG is enabled at
- * debug priority.
- */
-#ifndef IF_ALOGD
-#define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
-#endif
-
-/*
- * Conditional based on whether the current LOG_TAG is enabled at
- * info priority.
- */
-#ifndef IF_ALOGI
-#define IF_ALOGI() IF_ALOG(LOG_INFO, LOG_TAG)
-#endif
-
-/*
- * Conditional based on whether the current LOG_TAG is enabled at
- * warn priority.
- */
-#ifndef IF_ALOGW
-#define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG)
-#endif
-
-/*
- * Conditional based on whether the current LOG_TAG is enabled at
- * error priority.
- */
-#ifndef IF_ALOGE
-#define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- * Basic log message macro.
- *
- * Example:
- *  ALOG(LOG_WARN, NULL, "Failed with error %d", errno);
- *
- * The second argument may be NULL or "" to indicate the "global" tag.
- */
-#ifndef ALOG
-#define ALOG(priority, tag, ...) LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
-#endif
-
-/*
- * Conditional given a desired logging priority and tag.
- */
-#ifndef IF_ALOG
-#define IF_ALOG(priority, tag) if (android_testLog(ANDROID_##priority, tag))
-#endif
-
-/* --------------------------------------------------------------------- */
-
-/*
- *    IF_ALOG uses android_testLog, but IF_ALOG can be overridden.
- *    android_testLog will remain constant in its purpose as a wrapper
- *        for Android logging filter policy, and can be subject to
- *        change. It can be reused by the developers that override
- *        IF_ALOG as a convenient means to reimplement their policy
- *        over Android.
- */
-
-/*
- * Use the per-tag properties "log.tag.<tagname>" to generate a runtime
- * result of non-zero to expose a log. prio is ANDROID_LOG_VERBOSE to
- * ANDROID_LOG_FATAL. default_prio if no property. Undefined behavior if
- * any other value.
- */
-int __android_log_is_loggable(int prio, const char* tag, int default_prio);
-int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio);
-
-#if LOG_NDEBUG /* Production */
-#define android_testLog(prio, tag)                                           \
-  (__android_log_is_loggable_len(prio, tag, ((tag) && *(tag)) ? strlen(tag) : 0, \
-                                 ANDROID_LOG_DEBUG) != 0)
-#else
-#define android_testLog(prio, tag)                                           \
-  (__android_log_is_loggable_len(prio, tag, ((tag) && *(tag)) ? strlen(tag) : 0, \
-                                 ANDROID_LOG_VERBOSE) != 0)
-#endif
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
-__END_DECLS
diff --git a/liblog/include/log/log_properties.h b/liblog/include/log/log_properties.h
deleted file mode 100644
index 3a8af6d..0000000
--- a/liblog/include/log/log_properties.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-**
-** Copyright 2017, The Android Open Source Project
-**
-** This file is dual licensed.  It may be redistributed and/or modified
-** under the terms of the Apache 2.0 License OR version 2 of the GNU
-** General Public License.
-*/
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int __android_log_is_debuggable();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log_radio.h b/liblog/include/log/log_radio.h
deleted file mode 100644
index 8b8a362..0000000
--- a/liblog/include/log/log_radio.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#pragma once
-
-#include <android/log.h>
-#include <log/log_id.h>
-
-/*
- * Normally we strip the effects of ALOGV (VERBOSE messages),
- * LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
- * release builds be defining NDEBUG.  You can modify this (for
- * example with "#define LOG_NDEBUG 0" at the top of your source
- * file) to change that behavior.
- */
-
-#ifndef LOG_NDEBUG
-#ifdef NDEBUG
-#define LOG_NDEBUG 1
-#else
-#define LOG_NDEBUG 0
-#endif
-#endif
-
-/* --------------------------------------------------------------------- */
-
-#ifndef __predict_false
-#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
-#endif
-
-/*
- * Simplified macro to send a verbose radio log message using current LOG_TAG.
- */
-#ifndef RLOGV
-#define __RLOGV(...)                                                         \
-  ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, \
-                                 __VA_ARGS__))
-#if LOG_NDEBUG
-#define RLOGV(...)          \
-  do {                      \
-    if (0) {                \
-      __RLOGV(__VA_ARGS__); \
-    }                       \
-  } while (0)
-#else
-#define RLOGV(...) __RLOGV(__VA_ARGS__)
-#endif
-#endif
-
-#ifndef RLOGV_IF
-#if LOG_NDEBUG
-#define RLOGV_IF(cond, ...) ((void)0)
-#else
-#define RLOGV_IF(cond, ...)                                                \
-  ((__predict_false(cond))                                                 \
-       ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, \
-                                        LOG_TAG, __VA_ARGS__))             \
-       : (void)0)
-#endif
-#endif
-
-/*
- * Simplified macro to send a debug radio log message using  current LOG_TAG.
- */
-#ifndef RLOGD
-#define RLOGD(...)                                                         \
-  ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef RLOGD_IF
-#define RLOGD_IF(cond, ...)                                              \
-  ((__predict_false(cond))                                               \
-       ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, \
-                                        LOG_TAG, __VA_ARGS__))           \
-       : (void)0)
-#endif
-
-/*
- * Simplified macro to send an info radio log message using  current LOG_TAG.
- */
-#ifndef RLOGI
-#define RLOGI(...)                                                        \
-  ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef RLOGI_IF
-#define RLOGI_IF(cond, ...)                                             \
-  ((__predict_false(cond))                                              \
-       ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, \
-                                        LOG_TAG, __VA_ARGS__))          \
-       : (void)0)
-#endif
-
-/*
- * Simplified macro to send a warning radio log message using current LOG_TAG.
- */
-#ifndef RLOGW
-#define RLOGW(...)                                                        \
-  ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef RLOGW_IF
-#define RLOGW_IF(cond, ...)                                             \
-  ((__predict_false(cond))                                              \
-       ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, \
-                                        LOG_TAG, __VA_ARGS__))          \
-       : (void)0)
-#endif
-
-/*
- * Simplified macro to send an error radio log message using current LOG_TAG.
- */
-#ifndef RLOGE
-#define RLOGE(...)                                                         \
-  ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef RLOGE_IF
-#define RLOGE_IF(cond, ...)                                              \
-  ((__predict_false(cond))                                               \
-       ? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, \
-                                        LOG_TAG, __VA_ARGS__))           \
-       : (void)0)
-#endif
diff --git a/liblog/include/log/log_read.h b/liblog/include/log/log_read.h
deleted file mode 100644
index f9c1d69..0000000
--- a/liblog/include/log/log_read.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#pragma once
-
-#include <sys/types.h>
-
-/* deal with possible sys/cdefs.h conflict with fcntl.h */
-#ifdef __unused
-#define __unused_defined __unused
-#undef __unused
-#endif
-
-#include <fcntl.h> /* Pick up O_* macros */
-
-/* restore definitions from above */
-#ifdef __unused_defined
-#define __unused __attribute__((__unused__))
-#endif
-
-#include <stdint.h>
-
-#include <log/log_id.h>
-#include <log/log_time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Native log reading interface section. See logcat for sample code.
- *
- * The preferred API is an exec of logcat. Likely uses of this interface
- * are if native code suffers from exec or filtration being too costly,
- * access to raw information, or parsing is an issue.
- */
-
-struct logger_entry {
-  uint16_t len;      /* length of the payload */
-  uint16_t hdr_size; /* sizeof(struct logger_entry) */
-  int32_t pid;       /* generating process's pid */
-  uint32_t tid;      /* generating process's tid */
-  uint32_t sec;      /* seconds since Epoch */
-  uint32_t nsec;     /* nanoseconds */
-  uint32_t lid;      /* log id of the payload, bottom 4 bits currently */
-  uint32_t uid;      /* generating process's uid */
-};
-
-/*
- * The maximum size of the log entry payload that can be
- * written to the logger. An attempt to write more than
- * this amount will result in a truncated log entry.
- */
-#define LOGGER_ENTRY_MAX_PAYLOAD 4068
-
-/*
- * The maximum size of a log entry which can be read.
- * An attempt to read less than this amount may result
- * in read() returning EINVAL.
- */
-#define LOGGER_ENTRY_MAX_LEN (5 * 1024)
-
-struct log_msg {
-  union {
-    unsigned char buf[LOGGER_ENTRY_MAX_LEN + 1];
-    struct logger_entry entry;
-  } __attribute__((aligned(4)));
-#ifdef __cplusplus
-  /* Matching log_time operators */
-  bool operator==(const log_msg& T) const {
-    return (entry.sec == T.entry.sec) && (entry.nsec == T.entry.nsec);
-  }
-  bool operator!=(const log_msg& T) const {
-    return !(*this == T);
-  }
-  bool operator<(const log_msg& T) const {
-    return (entry.sec < T.entry.sec) ||
-           ((entry.sec == T.entry.sec) && (entry.nsec < T.entry.nsec));
-  }
-  bool operator>=(const log_msg& T) const {
-    return !(*this < T);
-  }
-  bool operator>(const log_msg& T) const {
-    return (entry.sec > T.entry.sec) ||
-           ((entry.sec == T.entry.sec) && (entry.nsec > T.entry.nsec));
-  }
-  bool operator<=(const log_msg& T) const {
-    return !(*this > T);
-  }
-  uint64_t nsec() const {
-    return static_cast<uint64_t>(entry.sec) * NS_PER_SEC + entry.nsec;
-  }
-
-  /* packet methods */
-  log_id_t id() {
-    return static_cast<log_id_t>(entry.lid);
-  }
-  char* msg() {
-    unsigned short hdr_size = entry.hdr_size;
-    if (hdr_size >= sizeof(struct log_msg) - sizeof(entry)) {
-      return nullptr;
-    }
-    return reinterpret_cast<char*>(buf) + hdr_size;
-  }
-  unsigned int len() { return entry.hdr_size + entry.len; }
-#endif
-};
-
-struct logger;
-
-log_id_t android_logger_get_id(struct logger* logger);
-
-int android_logger_clear(struct logger* logger);
-long android_logger_get_log_size(struct logger* logger);
-int android_logger_set_log_size(struct logger* logger, unsigned long size);
-long android_logger_get_log_readable_size(struct logger* logger);
-int android_logger_get_log_version(struct logger* logger);
-
-struct logger_list;
-
-ssize_t android_logger_get_statistics(struct logger_list* logger_list,
-                                      char* buf, size_t len);
-ssize_t android_logger_get_prune_list(struct logger_list* logger_list,
-                                      char* buf, size_t len);
-int android_logger_set_prune_list(struct logger_list* logger_list, const char* buf, size_t len);
-
-#define ANDROID_LOG_RDONLY O_RDONLY
-#define ANDROID_LOG_WRONLY O_WRONLY
-#define ANDROID_LOG_RDWR O_RDWR
-#define ANDROID_LOG_ACCMODE O_ACCMODE
-#ifndef O_NONBLOCK
-#define ANDROID_LOG_NONBLOCK 0x00000800
-#else
-#define ANDROID_LOG_NONBLOCK O_NONBLOCK
-#endif
-#define ANDROID_LOG_WRAP 0x40000000 /* Block until buffer about to wrap */
-#define ANDROID_LOG_WRAP_DEFAULT_TIMEOUT 7200 /* 2 hour default */
-#define ANDROID_LOG_PSTORE 0x80000000
-
-struct logger_list* android_logger_list_alloc(int mode, unsigned int tail,
-                                              pid_t pid);
-struct logger_list* android_logger_list_alloc_time(int mode, log_time start,
-                                                   pid_t pid);
-void android_logger_list_free(struct logger_list* logger_list);
-/* In the purest sense, the following two are orthogonal interfaces */
-int android_logger_list_read(struct logger_list* logger_list,
-                             struct log_msg* log_msg);
-
-/* Multiple log_id_t opens */
-struct logger* android_logger_open(struct logger_list* logger_list, log_id_t id);
-#define android_logger_close android_logger_free
-/* Single log_id_t open */
-struct logger_list* android_logger_list_open(log_id_t id, int mode,
-                                             unsigned int tail, pid_t pid);
-#define android_logger_list_close android_logger_list_free
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log_safetynet.h b/liblog/include/log/log_safetynet.h
deleted file mode 100644
index d3e9b19..0000000
--- a/liblog/include/log/log_safetynet.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-**
-** Copyright 2017, The Android Open Source Project
-**
-** This file is dual licensed.  It may be redistributed and/or modified
-** under the terms of the Apache 2.0 License OR version 2 of the GNU
-** General Public License.
-*/
-
-#pragma once
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define android_errorWriteLog(tag, subTag) \
-  __android_log_error_write(tag, subTag, -1, NULL, 0)
-
-#define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \
-  __android_log_error_write(tag, subTag, uid, data, dataLen)
-
-int __android_log_error_write(int tag, const char* subTag, int32_t uid,
-                              const char* data, uint32_t dataLen);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/log/log_system.h b/liblog/include/log/log_system.h
deleted file mode 100644
index eaec741..0000000
--- a/liblog/include/log/log_system.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#pragma once
-
-#include <android/log.h>
-#include <log/log_id.h>
-
-/*
- * Normally we strip the effects of ALOGV (VERBOSE messages),
- * LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
- * release builds be defining NDEBUG.  You can modify this (for
- * example with "#define LOG_NDEBUG 0" at the top of your source
- * file) to change that behavior.
- */
-
-#ifndef LOG_NDEBUG
-#ifdef NDEBUG
-#define LOG_NDEBUG 1
-#else
-#define LOG_NDEBUG 0
-#endif
-#endif
-
-#ifndef __predict_false
-#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
-#endif
-
-/*
- * Simplified macro to send a verbose system log message using current LOG_TAG.
- */
-#ifndef SLOGV
-#define __SLOGV(...)                                                          \
-  ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, \
-                                 __VA_ARGS__))
-#if LOG_NDEBUG
-#define SLOGV(...)          \
-  do {                      \
-    if (0) {                \
-      __SLOGV(__VA_ARGS__); \
-    }                       \
-  } while (0)
-#else
-#define SLOGV(...) __SLOGV(__VA_ARGS__)
-#endif
-#endif
-
-#ifndef SLOGV_IF
-#if LOG_NDEBUG
-#define SLOGV_IF(cond, ...) ((void)0)
-#else
-#define SLOGV_IF(cond, ...)                                                 \
-  ((__predict_false(cond))                                                  \
-       ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, \
-                                        LOG_TAG, __VA_ARGS__))              \
-       : (void)0)
-#endif
-#endif
-
-/*
- * Simplified macro to send a debug system log message using current LOG_TAG.
- */
-#ifndef SLOGD
-#define SLOGD(...)                                                          \
-  ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef SLOGD_IF
-#define SLOGD_IF(cond, ...)                                               \
-  ((__predict_false(cond))                                                \
-       ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, \
-                                        LOG_TAG, __VA_ARGS__))            \
-       : (void)0)
-#endif
-
-/*
- * Simplified macro to send an info system log message using current LOG_TAG.
- */
-#ifndef SLOGI
-#define SLOGI(...)                                                         \
-  ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef SLOGI_IF
-#define SLOGI_IF(cond, ...)                                              \
-  ((__predict_false(cond))                                               \
-       ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, \
-                                        LOG_TAG, __VA_ARGS__))           \
-       : (void)0)
-#endif
-
-/*
- * Simplified macro to send a warning system log message using current LOG_TAG.
- */
-#ifndef SLOGW
-#define SLOGW(...)                                                         \
-  ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef SLOGW_IF
-#define SLOGW_IF(cond, ...)                                              \
-  ((__predict_false(cond))                                               \
-       ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, \
-                                        LOG_TAG, __VA_ARGS__))           \
-       : (void)0)
-#endif
-
-/*
- * Simplified macro to send an error system log message using current LOG_TAG.
- */
-#ifndef SLOGE
-#define SLOGE(...)                                                          \
-  ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, \
-                                 __VA_ARGS__))
-#endif
-
-#ifndef SLOGE_IF
-#define SLOGE_IF(cond, ...)                                               \
-  ((__predict_false(cond))                                                \
-       ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, \
-                                        LOG_TAG, __VA_ARGS__))            \
-       : (void)0)
-#endif
diff --git a/liblog/include/log/log_time.h b/liblog/include/log/log_time.h
deleted file mode 100644
index 6b4458c..0000000
--- a/liblog/include/log/log_time.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <time.h>
-
-/* struct log_time is a wire-format variant of struct timespec */
-#define NS_PER_SEC 1000000000ULL
-#define US_PER_SEC 1000000ULL
-#define MS_PER_SEC 1000ULL
-
-#define LOG_TIME_SEC(t) ((t)->tv_sec)
-/* next power of two after NS_PER_SEC */
-#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
-
-#ifdef __cplusplus
-
-extern "C" {
-
-struct log_time {
- public:
-  uint32_t tv_sec = 0; /* good to Feb 5 2106 */
-  uint32_t tv_nsec = 0;
-
-  static const uint32_t tv_sec_max = 0xFFFFFFFFUL;
-  static const uint32_t tv_nsec_max = 999999999UL;
-  static const timespec EPOCH;
-
-  log_time() {}
-  explicit log_time(const timespec& T)
-      : tv_sec(static_cast<uint32_t>(T.tv_sec)), tv_nsec(static_cast<uint32_t>(T.tv_nsec)) {}
-  explicit log_time(uint32_t sec, uint32_t nsec = 0)
-      : tv_sec(sec), tv_nsec(nsec) {
-  }
-#ifdef __linux__
-  explicit log_time(clockid_t id) {
-    timespec T;
-    clock_gettime(id, &T);
-    tv_sec = static_cast<uint32_t>(T.tv_sec);
-    tv_nsec = static_cast<uint32_t>(T.tv_nsec);
-  }
-#endif
-  explicit log_time(const char* T) {
-    const uint8_t* c = reinterpret_cast<const uint8_t*>(T);
-    tv_sec = c[0] | (static_cast<uint32_t>(c[1]) << 8) |
-             (static_cast<uint32_t>(c[2]) << 16) |
-             (static_cast<uint32_t>(c[3]) << 24);
-    tv_nsec = c[4] | (static_cast<uint32_t>(c[5]) << 8) |
-              (static_cast<uint32_t>(c[6]) << 16) |
-              (static_cast<uint32_t>(c[7]) << 24);
-  }
-
-  /* timespec */
-  bool operator==(const timespec& T) const {
-    return (tv_sec == static_cast<uint32_t>(T.tv_sec)) &&
-           (tv_nsec == static_cast<uint32_t>(T.tv_nsec));
-  }
-  bool operator!=(const timespec& T) const {
-    return !(*this == T);
-  }
-  bool operator<(const timespec& T) const {
-    return (tv_sec < static_cast<uint32_t>(T.tv_sec)) ||
-           ((tv_sec == static_cast<uint32_t>(T.tv_sec)) &&
-            (tv_nsec < static_cast<uint32_t>(T.tv_nsec)));
-  }
-  bool operator>=(const timespec& T) const {
-    return !(*this < T);
-  }
-  bool operator>(const timespec& T) const {
-    return (tv_sec > static_cast<uint32_t>(T.tv_sec)) ||
-           ((tv_sec == static_cast<uint32_t>(T.tv_sec)) &&
-            (tv_nsec > static_cast<uint32_t>(T.tv_nsec)));
-  }
-  bool operator<=(const timespec& T) const {
-    return !(*this > T);
-  }
-
-  log_time operator-=(const timespec& T);
-  log_time operator-(const timespec& T) const {
-    log_time local(*this);
-    return local -= T;
-  }
-  log_time operator+=(const timespec& T);
-  log_time operator+(const timespec& T) const {
-    log_time local(*this);
-    return local += T;
-  }
-
-  /* log_time */
-  bool operator==(const log_time& T) const {
-    return (tv_sec == T.tv_sec) && (tv_nsec == T.tv_nsec);
-  }
-  bool operator!=(const log_time& T) const {
-    return !(*this == T);
-  }
-  bool operator<(const log_time& T) const {
-    return (tv_sec < T.tv_sec) ||
-           ((tv_sec == T.tv_sec) && (tv_nsec < T.tv_nsec));
-  }
-  bool operator>=(const log_time& T) const {
-    return !(*this < T);
-  }
-  bool operator>(const log_time& T) const {
-    return (tv_sec > T.tv_sec) ||
-           ((tv_sec == T.tv_sec) && (tv_nsec > T.tv_nsec));
-  }
-  bool operator<=(const log_time& T) const {
-    return !(*this > T);
-  }
-
-  log_time operator-=(const log_time& T);
-  log_time operator-(const log_time& T) const {
-    log_time local(*this);
-    return local -= T;
-  }
-  log_time operator+=(const log_time& T);
-  log_time operator+(const log_time& T) const {
-    log_time local(*this);
-    return local += T;
-  }
-
-  uint64_t nsec() const {
-    return static_cast<uint64_t>(tv_sec) * NS_PER_SEC + tv_nsec;
-  }
-  uint64_t usec() const {
-    return static_cast<uint64_t>(tv_sec) * US_PER_SEC +
-           tv_nsec / (NS_PER_SEC / US_PER_SEC);
-  }
-  uint64_t msec() const {
-    return static_cast<uint64_t>(tv_sec) * MS_PER_SEC +
-           tv_nsec / (NS_PER_SEC / MS_PER_SEC);
-  }
-
-  static const char default_format[];
-
-  /* Add %#q for the fraction of a second to the standard library functions */
-  char* strptime(const char* s, const char* format = default_format);
-} __attribute__((__packed__));
-}
-
-#else /* __cplusplus */
-
-typedef struct log_time {
-  uint32_t tv_sec;
-  uint32_t tv_nsec;
-} __attribute__((__packed__)) log_time;
-
-#endif /* __cplusplus */
diff --git a/liblog/include/log/logprint.h b/liblog/include/log/logprint.h
deleted file mode 100644
index 7dfd914..0000000
--- a/liblog/include/log/logprint.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <android/log.h>
-#include <log/event_tag_map.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-  /* Verbs */
-  FORMAT_OFF = 0,
-  FORMAT_BRIEF,
-  FORMAT_PROCESS,
-  FORMAT_TAG,
-  FORMAT_THREAD,
-  FORMAT_RAW,
-  FORMAT_TIME,
-  FORMAT_THREADTIME,
-  FORMAT_LONG,
-  /* Adverbs. The following are modifiers to above format verbs */
-  FORMAT_MODIFIER_COLOR,     /* converts priority to color */
-  FORMAT_MODIFIER_TIME_USEC, /* switches from msec to usec time precision */
-  FORMAT_MODIFIER_PRINTABLE, /* converts non-printable to printable escapes */
-  FORMAT_MODIFIER_YEAR,      /* Adds year to date */
-  FORMAT_MODIFIER_ZONE,      /* Adds zone to date, + UTC */
-  FORMAT_MODIFIER_EPOCH,     /* Print time as seconds since Jan 1 1970 */
-  FORMAT_MODIFIER_MONOTONIC, /* Print cpu time as seconds since start */
-  FORMAT_MODIFIER_UID,       /* Adds uid */
-  FORMAT_MODIFIER_DESCRIPT,  /* Adds descriptive */
-  /* private, undocumented */
-  FORMAT_MODIFIER_TIME_NSEC, /* switches from msec to nsec time precision */
-} AndroidLogPrintFormat;
-
-typedef struct AndroidLogFormat_t AndroidLogFormat;
-
-typedef struct AndroidLogEntry_t {
-  time_t tv_sec;
-  long tv_nsec;
-  android_LogPriority priority;
-  int32_t uid;
-  int32_t pid;
-  int32_t tid;
-  const char* tag;
-  size_t tagLen;
-  size_t messageLen;
-  const char* message;
-} AndroidLogEntry;
-
-AndroidLogFormat* android_log_format_new();
-
-void android_log_format_free(AndroidLogFormat* p_format);
-
-/* currently returns 0 if format is a modifier, 1 if not */
-int android_log_setPrintFormat(AndroidLogFormat* p_format,
-                               AndroidLogPrintFormat format);
-
-/**
- * Returns FORMAT_OFF on invalid string
- */
-AndroidLogPrintFormat android_log_formatFromString(const char* s);
-
-/**
- * filterExpression: a single filter expression
- * eg "AT:d"
- *
- * returns 0 on success and -1 on invalid expression
- *
- * Assumes single threaded execution
- *
- */
-
-int android_log_addFilterRule(AndroidLogFormat* p_format,
-                              const char* filterExpression);
-
-/**
- * filterString: a whitespace-separated set of filter expressions
- * eg "AT:d *:i"
- *
- * returns 0 on success and -1 on invalid expression
- *
- * Assumes single threaded execution
- *
- */
-
-int android_log_addFilterString(AndroidLogFormat* p_format,
-                                const char* filterString);
-
-/**
- * returns 1 if this log line should be printed based on its priority
- * and tag, and 0 if it should not
- */
-int android_log_shouldPrintLine(AndroidLogFormat* p_format, const char* tag,
-                                android_LogPriority pri);
-
-/**
- * Splits a wire-format buffer into an AndroidLogEntry
- * entry allocated by caller. Pointers will point directly into buf
- *
- * Returns 0 on success and -1 on invalid wire format (entry will be
- * in unspecified state)
- */
-int android_log_processLogBuffer(struct logger_entry* buf,
-                                 AndroidLogEntry* entry);
-
-/**
- * Like android_log_processLogBuffer, but for binary logs.
- *
- * If "map" is non-NULL, it will be used to convert the log tag number
- * into a string.
- */
-int android_log_processBinaryLogBuffer(struct logger_entry* buf,
-                                       AndroidLogEntry* entry,
-                                       const EventTagMap* map, char* messageBuf,
-                                       int messageBufLen);
-
-/**
- * Formats a log message into a buffer
- *
- * Uses defaultBuffer if it can, otherwise malloc()'s a new buffer
- * If return value != defaultBuffer, caller must call free()
- * Returns NULL on malloc error
- */
-
-char* android_log_formatLogLine(AndroidLogFormat* p_format, char* defaultBuffer,
-                                size_t defaultBufferSize,
-                                const AndroidLogEntry* p_line,
-                                size_t* p_outLength);
-
-/**
- * Either print or do not print log line, based on filter
- *
- * Assumes single threaded execution
- *
- */
-int android_log_printLogLine(AndroidLogFormat* p_format, int fd,
-                             const AndroidLogEntry* entry);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/liblog/include/private/android_logger.h b/liblog/include/private/android_logger.h
deleted file mode 100644
index d3b72bc..0000000
--- a/liblog/include/private/android_logger.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-/* This file is used to define the internal protocol for the Android Logger */
-
-#pragma once
-
-/* Android private interfaces */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#ifdef __cplusplus
-#include <string>
-#endif
-
-#include <log/log.h>
-#include <log/log_event_list.h>
-
-#define LOGGER_MAGIC 'l'
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/* Header Structure to pstore */
-typedef struct __attribute__((__packed__)) {
-  uint8_t magic;
-  uint16_t len;
-  uint16_t uid;
-  uint16_t pid;
-} android_pmsg_log_header_t;
-
-/* Header Structure to logd, and second header for pstore */
-typedef struct __attribute__((__packed__)) {
-  uint8_t id;
-  uint16_t tid;
-  log_time realtime;
-} android_log_header_t;
-
-/* Event Header Structure to logd */
-typedef struct __attribute__((__packed__)) {
-  int32_t tag;  // Little Endian Order
-} android_event_header_t;
-
-// Event payload EVENT_TYPE_LIST
-typedef struct __attribute__((__packed__)) {
-  int8_t type;  // EVENT_TYPE_LIST
-  int8_t element_count;
-} android_event_list_t;
-
-// Event payload EVENT_TYPE_FLOAT
-typedef struct __attribute__((__packed__)) {
-  int8_t type;  // EVENT_TYPE_FLOAT
-  float data;
-} android_event_float_t;
-
-/* Event payload EVENT_TYPE_INT */
-typedef struct __attribute__((__packed__)) {
-  int8_t type;   // EVENT_TYPE_INT
-  int32_t data;  // Little Endian Order
-} android_event_int_t;
-
-/* Event with single EVENT_TYPE_INT */
-typedef struct __attribute__((__packed__)) {
-  android_event_header_t header;
-  android_event_int_t payload;
-} android_log_event_int_t;
-
-/* Event payload EVENT_TYPE_LONG */
-typedef struct __attribute__((__packed__)) {
-  int8_t type;   // EVENT_TYPE_LONG
-  int64_t data;  // Little Endian Order
-} android_event_long_t;
-
-/* Event with single EVENT_TYPE_LONG */
-typedef struct __attribute__((__packed__)) {
-  android_event_header_t header;
-  android_event_long_t payload;
-} android_log_event_long_t;
-
-/*
- * Event payload EVENT_TYPE_STRING
- *
- * Danger: do not embed this structure into another structure.
- * This structure uses a flexible array member, and when
- * compiled using g++, __builtin_object_size(data, 1) returns
- * a bad value. This is possibly a g++ bug, or a bug due to
- * the fact that flexible array members are not supported
- * in C++.
- * http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c
- */
-
-typedef struct __attribute__((__packed__)) {
-  int8_t type;     // EVENT_TYPE_STRING;
-  int32_t length;  // Little Endian Order
-  char data[];
-} android_event_string_t;
-
-/* Event with single EVENT_TYPE_STRING */
-typedef struct __attribute__((__packed__)) {
-  android_event_header_t header;
-  int8_t type;     // EVENT_TYPE_STRING;
-  int32_t length;  // Little Endian Order
-  char data[];
-} android_log_event_string_t;
-
-#define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */
-#define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000
-
-ssize_t __android_log_pmsg_file_write(log_id_t logId, char prio,
-                                      const char* filename, const char* buf,
-                                      size_t len);
-
-#define LOG_ID_ANY ((log_id_t)-1)
-#define ANDROID_LOG_ANY ANDROID_LOG_UNKNOWN
-
-/* first 5 arguments match __android_log_msg_file_write, a cast is safe */
-typedef ssize_t (*__android_log_pmsg_file_read_fn)(log_id_t logId, char prio,
-                                                   const char* filename,
-                                                   const char* buf, size_t len,
-                                                   void* arg);
-
-ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio,
-                                     const char* prefix,
-                                     __android_log_pmsg_file_read_fn fn,
-                                     void* arg);
-
-int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len);
-int __android_log_security_bswrite(int32_t tag, const char* payload);
-int __android_log_security(); /* Device Owner is present */
-
-#define BOOL_DEFAULT_FLAG_TRUE_FALSE 0x1
-#define BOOL_DEFAULT_FALSE 0x0        /* false if property not present   */
-#define BOOL_DEFAULT_TRUE 0x1         /* true if property not present    */
-#define BOOL_DEFAULT_FLAG_PERSIST 0x2 /* <key>, persist.<key>, ro.<key>  */
-#define BOOL_DEFAULT_FLAG_ENG 0x4     /* off for user                    */
-#define BOOL_DEFAULT_FLAG_SVELTE 0x8  /* off for low_ram                 */
-bool __android_logger_property_get_bool(const char* key, int flag);
-
-#define LOG_BUFFER_SIZE (256 * 1024) /* Tuned with ro.logd.size per-platform \
-                                      */
-#define LOG_BUFFER_MIN_SIZE (64 * 1024UL)
-#define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL)
-unsigned long __android_logger_get_buffer_size(log_id_t logId);
-bool __android_logger_valid_buffer_size(unsigned long value);
-
-/* Retrieve the composed event buffer */
-int android_log_write_list_buffer(android_log_context ctx, const char** msg);
-
-#if defined(__cplusplus)
-}
-#endif
diff --git a/liblog/include_vndk/android b/liblog/include_vndk/android
deleted file mode 120000
index a3c0320..0000000
--- a/liblog/include_vndk/android
+++ /dev/null
@@ -1 +0,0 @@
-../include/android
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log.h b/liblog/include_vndk/log/log.h
deleted file mode 100644
index a79beec..0000000
--- a/liblog/include_vndk/log/log.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*Special log.h file for VNDK linking modules*/
-
-#ifndef _LIBS_LOG_LOG_H
-#define _LIBS_LOG_LOG_H
-
-#include <android/log.h>
-#include <log/log_id.h>
-#include <log/log_main.h>
-#include <log/log_radio.h>
-#include <log/log_read.h>
-#include <log/log_safetynet.h>
-#include <log/log_system.h>
-#include <log/log_time.h>
-
-/*
- * LOG_TAG is the local tag used for the following simplified
- * logging macros.  You can change this preprocessor definition
- * before using the other macros to change the tag.
- */
-
-#ifndef LOG_TAG
-#define LOG_TAG NULL
-#endif
-
-#endif /*_LIBS_LOG_LOG_H*/
diff --git a/liblog/include_vndk/log/log_event_list.h b/liblog/include_vndk/log/log_event_list.h
deleted file mode 100644
index 1f3dd37..0000000
--- a/liblog/include_vndk/log/log_event_list.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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
-
-/*
- * 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);
-
-/* Reset writer context */
-int android_log_reset(android_log_context ctx);
-
-/* Reset reader context */
-int android_log_parser_reset(android_log_context ctx,
-                             const char* msg, size_t len);
-
-/* 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/include_vndk/log/log_id.h b/liblog/include_vndk/log/log_id.h
deleted file mode 120000
index dce92b9..0000000
--- a/liblog/include_vndk/log/log_id.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_id.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_main.h b/liblog/include_vndk/log/log_main.h
deleted file mode 120000
index f2ec018..0000000
--- a/liblog/include_vndk/log/log_main.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_main.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_properties.h b/liblog/include_vndk/log/log_properties.h
deleted file mode 120000
index bbec426..0000000
--- a/liblog/include_vndk/log/log_properties.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_properties.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_radio.h b/liblog/include_vndk/log/log_radio.h
deleted file mode 120000
index 1e12b32..0000000
--- a/liblog/include_vndk/log/log_radio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_radio.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_read.h b/liblog/include_vndk/log/log_read.h
deleted file mode 120000
index 01de8b9..0000000
--- a/liblog/include_vndk/log/log_read.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_read.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_safetynet.h b/liblog/include_vndk/log/log_safetynet.h
deleted file mode 120000
index a4614e7..0000000
--- a/liblog/include_vndk/log/log_safetynet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_safetynet.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_system.h b/liblog/include_vndk/log/log_system.h
deleted file mode 120000
index d0d3904..0000000
--- a/liblog/include_vndk/log/log_system.h
+++ /dev/null
@@ -1 +0,0 @@
-../../include/log/log_system.h
\ No newline at end of file
diff --git a/liblog/include_vndk/log/log_time.h b/liblog/include_vndk/log/log_time.h
deleted file mode 100644
index 5a09959..0000000
--- a/liblog/include_vndk/log/log_time.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2005-2017 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.
- */
-
-#ifndef _LIBS_LOG_LOG_TIME_H
-#define _LIBS_LOG_LOG_TIME_H
-
-#include <stdint.h>
-
-/* struct log_time is a wire-format variant of struct timespec */
-#ifndef NS_PER_SEC
-#define NS_PER_SEC 1000000000ULL
-#endif
-#ifndef US_PER_SEC
-#define US_PER_SEC 1000000ULL
-#endif
-#ifndef MS_PER_SEC
-#define MS_PER_SEC 1000ULL
-#endif
-
-#ifndef __struct_log_time_defined
-#define __struct_log_time_defined
-
-#define LOG_TIME_SEC(t) ((t)->tv_sec)
-/* next power of two after NS_PER_SEC */
-#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
-
-typedef struct log_time {
-  uint32_t tv_sec;
-  uint32_t tv_nsec;
-} __attribute__((__packed__)) log_time;
-
-#endif
-
-#endif /* _LIBS_LOG_LOG_TIME_H */
diff --git a/liblog/liblog.map.txt b/liblog/liblog.map.txt
deleted file mode 100644
index 6ca1a16..0000000
--- a/liblog/liblog.map.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-LIBLOG {
-  global:
-    android_name_to_log_id; # llndk
-    android_log_id_to_name; # llndk
-    __android_log_assert;
-    __android_log_buf_print;
-    __android_log_buf_write;
-    __android_log_print;
-    __android_log_vprint;
-    __android_log_write;
-  local:
-    *;
-};
-
-LIBLOG_L {
-  global:
-    android_logger_clear; # llndk
-    android_logger_get_id; # llndk
-    android_logger_get_log_readable_size; # llndk
-    android_logger_get_log_version; # llndk
-    android_logger_get_log_size; # llndk
-    android_logger_list_alloc; # apex llndk
-    android_logger_list_alloc_time; # apex llndk
-    android_logger_list_free; # apex llndk
-    android_logger_list_open; # llndk
-    android_logger_list_read; # apex llndk
-    android_logger_open; # apex llndk
-    android_logger_set_log_size; # llndk
-};
-
-LIBLOG_M {
-  global:
-    android_logger_get_prune_list; # llndk
-    android_logger_set_prune_list; # llndk
-    android_logger_get_statistics; # llndk
-    __android_log_error_write; # apex llndk
-    __android_log_is_loggable;
-    create_android_logger; # apex llndk
-    android_log_destroy; # apex llndk
-    android_log_write_list_begin; # apex llndk
-    android_log_write_list_end; # apex llndk
-    android_log_write_int32; # apex llndk
-    android_log_write_int64; # apex llndk
-    android_log_write_string8; # apex llndk
-    android_log_write_string8_len; # apex llndk
-    android_log_write_float32; # apex llndk
-    android_log_write_list; # apex llndk
-
-};
-
-LIBLOG_O {
-  global:
-    __android_log_is_loggable_len;
-    __android_log_is_debuggable; # apex llndk
-};
-
-LIBLOG_Q { # introduced=29
-  global:
-    __android_log_bswrite; # apex
-    __android_log_btwrite; # apex
-    __android_log_bwrite; # apex
-    __android_log_close; # apex
-    __android_log_security; # apex
-    android_log_reset; # llndk
-    android_log_parser_reset; # llndk
-};
-
-LIBLOG_R { # introduced=30
-  global:
-    __android_log_call_aborter;
-    __android_log_default_aborter;
-    __android_log_get_minimum_priority;
-    __android_log_logd_logger;
-    __android_log_security_bswrite; # apex
-    __android_log_set_aborter;
-    __android_log_set_default_tag;
-    __android_log_set_logger;
-    __android_log_set_minimum_priority;
-    __android_log_stderr_logger;
-    __android_log_write_log_message;
-};
-
-LIBLOG_PRIVATE {
-  global:
-    __android_log_pmsg_file_read;
-    __android_log_pmsg_file_write;
-    __android_logger_get_buffer_size;
-    __android_logger_property_get_bool;
-    android_openEventTagMap;
-    android_log_processBinaryLogBuffer;
-    android_log_processLogBuffer;
-    android_log_read_next;
-    android_log_write_list_buffer;
-    android_lookupEventTagNum;
-    create_android_log_parser;
-};
diff --git a/liblog/log_event_list.cpp b/liblog/log_event_list.cpp
deleted file mode 100644
index cb70d48..0000000
--- a/liblog/log_event_list.cpp
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <errno.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <log/log_event_list.h>
-#include <private/android_logger.h>
-
-#define MAX_EVENT_PAYLOAD (LOGGER_ENTRY_MAX_PAYLOAD - sizeof(int32_t))
-
-enum ReadWriteFlag {
-  kAndroidLoggerRead = 1,
-  kAndroidLoggerWrite = 2,
-};
-
-struct android_log_context_internal {
-  uint32_t tag;
-  unsigned pos;                                    /* Read/write position into buffer */
-  unsigned count[ANDROID_MAX_LIST_NEST_DEPTH + 1]; /* Number of elements   */
-  unsigned list[ANDROID_MAX_LIST_NEST_DEPTH + 1];  /* pos for list counter */
-  unsigned list_nest_depth;
-  unsigned len; /* Length or raw buffer. */
-  bool overflow;
-  bool list_stop; /* next call decrement list_nest_depth and issue a stop */
-  ReadWriteFlag read_write_flag;
-  uint8_t storage[LOGGER_ENTRY_MAX_PAYLOAD];
-};
-
-static void init_context(android_log_context_internal* context, uint32_t tag) {
-  context->tag = tag;
-  context->read_write_flag = kAndroidLoggerWrite;
-  size_t needed = sizeof(android_event_list_t);
-  if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
-    context->overflow = true;
-  }
-  /* Everything is a list */
-  context->storage[context->pos + 0] = EVENT_TYPE_LIST;
-  context->list[0] = context->pos + 1;
-  context->pos += needed;
-}
-
-static void init_parser_context(android_log_context_internal* context, const char* msg,
-                                size_t len) {
-  len = (len <= MAX_EVENT_PAYLOAD) ? len : MAX_EVENT_PAYLOAD;
-  context->len = len;
-  memcpy(context->storage, msg, len);
-  context->read_write_flag = kAndroidLoggerRead;
-}
-
-android_log_context create_android_logger(uint32_t tag) {
-  android_log_context_internal* context;
-
-  context =
-      static_cast<android_log_context_internal*>(calloc(1, sizeof(android_log_context_internal)));
-  if (!context) {
-    return NULL;
-  }
-  init_context(context, tag);
-
-  return (android_log_context)context;
-}
-
-android_log_context create_android_log_parser(const char* msg, size_t len) {
-  android_log_context_internal* context;
-
-  context =
-      static_cast<android_log_context_internal*>(calloc(1, sizeof(android_log_context_internal)));
-  if (!context) {
-    return NULL;
-  }
-  init_parser_context(context, msg, len);
-
-  return (android_log_context)context;
-}
-
-int android_log_destroy(android_log_context* ctx) {
-  android_log_context_internal* context;
-
-  context = (android_log_context_internal*)*ctx;
-  if (!context) {
-    return -EBADF;
-  }
-  memset(context, 0, sizeof(*context));
-  free(context);
-  *ctx = NULL;
-  return 0;
-}
-
-int android_log_reset(android_log_context context) {
-  uint32_t tag;
-
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-
-  tag = context->tag;
-  memset(context, 0, sizeof(*context));
-  init_context(context, tag);
-
-  return 0;
-}
-
-int android_log_parser_reset(android_log_context context, const char* msg, size_t len) {
-  if (!context || (kAndroidLoggerRead != context->read_write_flag)) {
-    return -EBADF;
-  }
-
-  memset(context, 0, sizeof(*context));
-  init_parser_context(context, msg, len);
-
-  return 0;
-}
-
-int android_log_write_list_begin(android_log_context context) {
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) {
-    context->overflow = true;
-    return -EOVERFLOW;
-  }
-  size_t needed = sizeof(android_event_list_t);
-  if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
-    context->overflow = true;
-    return -EIO;
-  }
-  context->count[context->list_nest_depth]++;
-  context->list_nest_depth++;
-  if (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) {
-    context->overflow = true;
-    return -EOVERFLOW;
-  }
-  if (context->overflow) {
-    return -EIO;
-  }
-  auto* event_list = reinterpret_cast<android_event_list_t*>(&context->storage[context->pos]);
-  event_list->type = EVENT_TYPE_LIST;
-  event_list->element_count = 0;
-  context->list[context->list_nest_depth] = context->pos + 1;
-  context->count[context->list_nest_depth] = 0;
-  context->pos += needed;
-  return 0;
-}
-
-int android_log_write_int32(android_log_context context, int32_t value) {
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->overflow) {
-    return -EIO;
-  }
-  size_t needed = sizeof(android_event_int_t);
-  if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
-    context->overflow = true;
-    return -EIO;
-  }
-  context->count[context->list_nest_depth]++;
-  auto* event_int = reinterpret_cast<android_event_int_t*>(&context->storage[context->pos]);
-  event_int->type = EVENT_TYPE_INT;
-  event_int->data = value;
-  context->pos += needed;
-  return 0;
-}
-
-int android_log_write_int64(android_log_context context, int64_t value) {
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->overflow) {
-    return -EIO;
-  }
-  size_t needed = sizeof(android_event_long_t);
-  if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
-    context->overflow = true;
-    return -EIO;
-  }
-  context->count[context->list_nest_depth]++;
-  auto* event_long = reinterpret_cast<android_event_long_t*>(&context->storage[context->pos]);
-  event_long->type = EVENT_TYPE_LONG;
-  event_long->data = value;
-  context->pos += needed;
-  return 0;
-}
-
-int android_log_write_string8_len(android_log_context context, const char* value, size_t maxlen) {
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->overflow) {
-    return -EIO;
-  }
-  if (!value) {
-    value = "";
-  }
-  int32_t len = strnlen(value, maxlen);
-  size_t needed = sizeof(android_event_string_t) + len;
-  if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
-    /* Truncate string for delivery */
-    len = MAX_EVENT_PAYLOAD - context->pos - 1 - sizeof(int32_t);
-    if (len <= 0) {
-      context->overflow = true;
-      return -EIO;
-    }
-  }
-  context->count[context->list_nest_depth]++;
-  auto* event_string = reinterpret_cast<android_event_string_t*>(&context->storage[context->pos]);
-  event_string->type = EVENT_TYPE_STRING;
-  event_string->length = len;
-  if (len) {
-    memcpy(&event_string->data, value, len);
-  }
-  context->pos += needed;
-  return len;
-}
-
-int android_log_write_string8(android_log_context ctx, const char* value) {
-  return android_log_write_string8_len(ctx, value, MAX_EVENT_PAYLOAD);
-}
-
-int android_log_write_float32(android_log_context context, float value) {
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->overflow) {
-    return -EIO;
-  }
-  size_t needed = sizeof(android_event_float_t);
-  if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
-    context->overflow = true;
-    return -EIO;
-  }
-  context->count[context->list_nest_depth]++;
-  auto* event_float = reinterpret_cast<android_event_float_t*>(&context->storage[context->pos]);
-  event_float->type = EVENT_TYPE_FLOAT;
-  event_float->data = value;
-  context->pos += needed;
-  return 0;
-}
-
-int android_log_write_list_end(android_log_context context) {
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) {
-    context->overflow = true;
-    context->list_nest_depth--;
-    return -EOVERFLOW;
-  }
-  if (!context->list_nest_depth) {
-    context->overflow = true;
-    return -EOVERFLOW;
-  }
-  if (context->list[context->list_nest_depth] <= 0) {
-    context->list_nest_depth--;
-    context->overflow = true;
-    return -EOVERFLOW;
-  }
-  context->storage[context->list[context->list_nest_depth]] =
-      context->count[context->list_nest_depth];
-  context->list_nest_depth--;
-  return 0;
-}
-
-/*
- * Logs the list of elements to the event log.
- */
-int android_log_write_list(android_log_context context, log_id_t id) {
-  const char* msg;
-  ssize_t len;
-
-  if ((id != LOG_ID_EVENTS) && (id != LOG_ID_SECURITY) && (id != LOG_ID_STATS)) {
-    return -EINVAL;
-  }
-
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->list_nest_depth) {
-    return -EIO;
-  }
-  /* NB: if there was overflow, then log is truncated. Nothing reported */
-  context->storage[1] = context->count[0];
-  len = context->len = context->pos;
-  msg = (const char*)context->storage;
-  /* it's not a list */
-  if (context->count[0] <= 1) {
-    len -= sizeof(uint8_t) + sizeof(uint8_t);
-    if (len < 0) {
-      len = 0;
-    }
-    msg += sizeof(uint8_t) + sizeof(uint8_t);
-  }
-  return (id == LOG_ID_EVENTS)
-             ? __android_log_bwrite(context->tag, msg, len)
-             : ((id == LOG_ID_STATS) ? __android_log_stats_bwrite(context->tag, msg, len)
-                                     : __android_log_security_bwrite(context->tag, msg, len));
-}
-
-int android_log_write_list_buffer(android_log_context context, const char** buffer) {
-  const char* msg;
-  ssize_t len;
-
-  if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
-    return -EBADF;
-  }
-  if (context->list_nest_depth) {
-    return -EIO;
-  }
-  if (buffer == NULL) {
-    return -EFAULT;
-  }
-  /* NB: if there was overflow, then log is truncated. Nothing reported */
-  context->storage[1] = context->count[0];
-  len = context->len = context->pos;
-  msg = (const char*)context->storage;
-  /* it's not a list */
-  if (context->count[0] <= 1) {
-    len -= sizeof(uint8_t) + sizeof(uint8_t);
-    if (len < 0) {
-      len = 0;
-    }
-    msg += sizeof(uint8_t) + sizeof(uint8_t);
-  }
-  *buffer = msg;
-  return len;
-}
-
-/*
- * Gets the next element. Parsing errors result in an EVENT_TYPE_UNKNOWN type.
- * If there is nothing to process, the complete field is set to non-zero. If
- * an EVENT_TYPE_UNKNOWN type is returned once, and the caller does not check
- * this and continues to call this function, the behavior is undefined
- * (although it won't crash).
- */
-static android_log_list_element android_log_read_next_internal(android_log_context context,
-                                                               int peek) {
-  android_log_list_element elem;
-  unsigned pos;
-
-  memset(&elem, 0, sizeof(elem));
-
-  /* Nothing to parse from this context, so return complete. */
-  if (!context || (kAndroidLoggerRead != context->read_write_flag) ||
-      (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) ||
-      (context->count[context->list_nest_depth] >=
-       (MAX_EVENT_PAYLOAD / (sizeof(uint8_t) + sizeof(uint8_t))))) {
-    elem.type = EVENT_TYPE_UNKNOWN;
-    if (context &&
-        (context->list_stop || ((context->list_nest_depth <= ANDROID_MAX_LIST_NEST_DEPTH) &&
-                                !context->count[context->list_nest_depth]))) {
-      elem.type = EVENT_TYPE_LIST_STOP;
-    }
-    elem.complete = true;
-    return elem;
-  }
-
-  /*
-   * Use a different variable to update the position in case this
-   * operation is a "peek".
-   */
-  pos = context->pos;
-  if (context->list_stop) {
-    elem.type = EVENT_TYPE_LIST_STOP;
-    elem.complete = !context->count[0] && (!context->list_nest_depth ||
-                                           ((context->list_nest_depth == 1) && !context->count[1]));
-    if (!peek) {
-      /* Suck in superfluous stop */
-      if (context->storage[pos] == EVENT_TYPE_LIST_STOP) {
-        context->pos = pos + 1;
-      }
-      if (context->list_nest_depth) {
-        --context->list_nest_depth;
-        if (context->count[context->list_nest_depth]) {
-          context->list_stop = false;
-        }
-      } else {
-        context->list_stop = false;
-      }
-    }
-    return elem;
-  }
-  if ((pos + 1) > context->len) {
-    elem.type = EVENT_TYPE_UNKNOWN;
-    elem.complete = true;
-    return elem;
-  }
-
-  elem.type = static_cast<AndroidEventLogType>(context->storage[pos]);
-  switch ((int)elem.type) {
-    case EVENT_TYPE_FLOAT:
-    /* Rely on union to translate elem.data.int32 into elem.data.float32 */
-    /* FALLTHRU */
-    case EVENT_TYPE_INT: {
-      elem.len = sizeof(int32_t);
-      if ((pos + sizeof(android_event_int_t)) > context->len) {
-        elem.type = EVENT_TYPE_UNKNOWN;
-        return elem;
-      }
-
-      auto* event_int = reinterpret_cast<android_event_int_t*>(&context->storage[pos]);
-      pos += sizeof(android_event_int_t);
-      elem.data.int32 = event_int->data;
-      /* common tangeable object suffix */
-      elem.complete = !context->list_nest_depth && !context->count[0];
-      if (!peek) {
-        if (!context->count[context->list_nest_depth] ||
-            !--(context->count[context->list_nest_depth])) {
-          context->list_stop = true;
-        }
-        context->pos = pos;
-      }
-      return elem;
-    }
-
-    case EVENT_TYPE_LONG: {
-      elem.len = sizeof(int64_t);
-      if ((pos + sizeof(android_event_long_t)) > context->len) {
-        elem.type = EVENT_TYPE_UNKNOWN;
-        return elem;
-      }
-
-      auto* event_long = reinterpret_cast<android_event_long_t*>(&context->storage[pos]);
-      pos += sizeof(android_event_long_t);
-      elem.data.int64 = event_long->data;
-      /* common tangeable object suffix */
-      elem.complete = !context->list_nest_depth && !context->count[0];
-      if (!peek) {
-        if (!context->count[context->list_nest_depth] ||
-            !--(context->count[context->list_nest_depth])) {
-          context->list_stop = true;
-        }
-        context->pos = pos;
-      }
-      return elem;
-    }
-
-    case EVENT_TYPE_STRING: {
-      if ((pos + sizeof(android_event_string_t)) > context->len) {
-        elem.type = EVENT_TYPE_UNKNOWN;
-        elem.complete = true;
-        return elem;
-      }
-      auto* event_string = reinterpret_cast<android_event_string_t*>(&context->storage[pos]);
-      pos += sizeof(android_event_string_t);
-      // Wire format is int32_t, but elem.len is uint16_t...
-      if (event_string->length >= UINT16_MAX) {
-        elem.type = EVENT_TYPE_UNKNOWN;
-        return elem;
-      }
-      elem.len = event_string->length;
-      if ((pos + elem.len) > context->len) {
-        elem.len = context->len - pos; /* truncate string */
-        elem.complete = true;
-        if (!elem.len) {
-          elem.type = EVENT_TYPE_UNKNOWN;
-          return elem;
-        }
-      }
-      elem.data.string = event_string->data;
-      /* common tangeable object suffix */
-      pos += elem.len;
-      elem.complete = !context->list_nest_depth && !context->count[0];
-      if (!peek) {
-        if (!context->count[context->list_nest_depth] ||
-            !--(context->count[context->list_nest_depth])) {
-          context->list_stop = true;
-        }
-        context->pos = pos;
-      }
-      return elem;
-    }
-
-    case EVENT_TYPE_LIST: {
-      if ((pos + sizeof(android_event_list_t)) > context->len) {
-        elem.type = EVENT_TYPE_UNKNOWN;
-        elem.complete = true;
-        return elem;
-      }
-      auto* event_list = reinterpret_cast<android_event_list_t*>(&context->storage[pos]);
-      pos += sizeof(android_event_list_t);
-      elem.complete = context->list_nest_depth >= ANDROID_MAX_LIST_NEST_DEPTH;
-      if (peek) {
-        return elem;
-      }
-      if (context->count[context->list_nest_depth]) {
-        context->count[context->list_nest_depth]--;
-      }
-      context->list_stop = event_list->element_count == 0;
-      context->list_nest_depth++;
-      if (context->list_nest_depth <= ANDROID_MAX_LIST_NEST_DEPTH) {
-        context->count[context->list_nest_depth] = event_list->element_count;
-      }
-      context->pos = pos;
-      return elem;
-    }
-
-    case EVENT_TYPE_LIST_STOP: /* Suprise Newline terminates lists. */
-      pos++;
-      if (!peek) {
-        context->pos = pos;
-      }
-      elem.type = EVENT_TYPE_UNKNOWN;
-      elem.complete = !context->list_nest_depth;
-      if (context->list_nest_depth > 0) {
-        elem.type = EVENT_TYPE_LIST_STOP;
-        if (!peek) {
-          context->list_nest_depth--;
-        }
-      }
-      return elem;
-
-    default:
-      elem.type = EVENT_TYPE_UNKNOWN;
-      return elem;
-  }
-}
-
-android_log_list_element android_log_read_next(android_log_context ctx) {
-  return android_log_read_next_internal(ctx, 0);
-}
-
-android_log_list_element android_log_peek_next(android_log_context ctx) {
-  return android_log_read_next_internal(ctx, 1);
-}
diff --git a/liblog/log_event_write.cpp b/liblog/log_event_write.cpp
deleted file mode 100644
index 39afd0c..0000000
--- a/liblog/log_event_write.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <errno.h>
-#include <stdint.h>
-
-#include <log/log.h>
-#include <log/log_event_list.h>
-
-#define MAX_SUBTAG_LEN 32
-
-int __android_log_error_write(int tag, const char* subTag, int32_t uid, const char* data,
-                              uint32_t dataLen) {
-  int ret = -EINVAL;
-
-  if (subTag && (data || !dataLen)) {
-    android_log_context ctx = create_android_logger(tag);
-
-    ret = -ENOMEM;
-    if (ctx) {
-      ret = android_log_write_string8_len(ctx, subTag, MAX_SUBTAG_LEN);
-      if (ret >= 0) {
-        ret = android_log_write_int32(ctx, uid);
-        if (ret >= 0) {
-          ret = android_log_write_string8_len(ctx, data, dataLen);
-          if (ret >= 0) {
-            ret = android_log_write_list(ctx, LOG_ID_EVENTS);
-          }
-        }
-      }
-      android_log_destroy(&ctx);
-    }
-  }
-  return ret;
-}
diff --git a/liblog/log_time.cpp b/liblog/log_time.cpp
deleted file mode 100644
index 3fbe1cb..0000000
--- a/liblog/log_time.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <private/android_logger.h>
-
-const char log_time::default_format[] = "%m-%d %H:%M:%S.%q";
-const timespec log_time::EPOCH = {0, 0};
-
-// Add %#q for fractional seconds to standard strptime function
-
-char* log_time::strptime(const char* s, const char* format) {
-  time_t now;
-#ifdef __linux__
-  *this = log_time(CLOCK_REALTIME);
-  now = tv_sec;
-#else
-  time(&now);
-  tv_sec = now;
-  tv_nsec = 0;
-#endif
-
-  struct tm* ptm;
-#if !defined(_WIN32)
-  struct tm tmBuf;
-  ptm = localtime_r(&now, &tmBuf);
-#else
-  ptm = localtime(&now);
-#endif
-
-  char fmt[strlen(format) + 1];
-  strcpy(fmt, format);
-
-  char* ret = const_cast<char*>(s);
-  char* cp;
-  for (char* f = cp = fmt;; ++cp) {
-    if (!*cp) {
-      if (f != cp) {
-        ret = ::strptime(ret, f, ptm);
-      }
-      break;
-    }
-    if (*cp != '%') {
-      continue;
-    }
-    char* e = cp;
-    ++e;
-#if (defined(__BIONIC__))
-    if (*e == 's') {
-      *cp = '\0';
-      if (*f) {
-        ret = ::strptime(ret, f, ptm);
-        if (!ret) {
-          break;
-        }
-      }
-      tv_sec = 0;
-      while (isdigit(*ret)) {
-        tv_sec = tv_sec * 10 + *ret - '0';
-        ++ret;
-      }
-      now = tv_sec;
-#if !defined(_WIN32)
-      ptm = localtime_r(&now, &tmBuf);
-#else
-      ptm = localtime(&now);
-#endif
-    } else
-#endif
-    {
-      unsigned num = 0;
-      while (isdigit(*e)) {
-        num = num * 10 + *e - '0';
-        ++e;
-      }
-      if (*e != 'q') {
-        continue;
-      }
-      *cp = '\0';
-      if (*f) {
-        ret = ::strptime(ret, f, ptm);
-        if (!ret) {
-          break;
-        }
-      }
-      unsigned long mul = NS_PER_SEC;
-      if (num == 0) {
-        num = INT_MAX;
-      }
-      tv_nsec = 0;
-      while (isdigit(*ret) && num && (mul > 1)) {
-        --num;
-        mul /= 10;
-        tv_nsec = tv_nsec + (*ret - '0') * mul;
-        ++ret;
-      }
-    }
-    f = cp = e;
-    ++f;
-  }
-
-  if (ret) {
-    tv_sec = mktime(ptm);
-    return ret;
-  }
-
-// Upon error, place a known value into the class, the current time.
-#ifdef __linux__
-  *this = log_time(CLOCK_REALTIME);
-#else
-  time(&now);
-  tv_sec = now;
-  tv_nsec = 0;
-#endif
-  return ret;
-}
-
-log_time log_time::operator-=(const timespec& T) {
-  // No concept of negative time, clamp to EPOCH
-  if (*this <= T) {
-    return *this = log_time(EPOCH);
-  }
-
-  if (this->tv_nsec < (unsigned long int)T.tv_nsec) {
-    --this->tv_sec;
-    this->tv_nsec = NS_PER_SEC + this->tv_nsec - T.tv_nsec;
-  } else {
-    this->tv_nsec -= T.tv_nsec;
-  }
-  this->tv_sec -= T.tv_sec;
-
-  return *this;
-}
-
-log_time log_time::operator+=(const timespec& T) {
-  this->tv_nsec += (unsigned long int)T.tv_nsec;
-  if (this->tv_nsec >= NS_PER_SEC) {
-    this->tv_nsec -= NS_PER_SEC;
-    ++this->tv_sec;
-  }
-  this->tv_sec += T.tv_sec;
-
-  return *this;
-}
-
-log_time log_time::operator-=(const log_time& T) {
-  // No concept of negative time, clamp to EPOCH
-  if (*this <= T) {
-    return *this = log_time(EPOCH);
-  }
-
-  if (this->tv_nsec < T.tv_nsec) {
-    --this->tv_sec;
-    this->tv_nsec = NS_PER_SEC + this->tv_nsec - T.tv_nsec;
-  } else {
-    this->tv_nsec -= T.tv_nsec;
-  }
-  this->tv_sec -= T.tv_sec;
-
-  return *this;
-}
-
-log_time log_time::operator+=(const log_time& T) {
-  this->tv_nsec += T.tv_nsec;
-  if (this->tv_nsec >= NS_PER_SEC) {
-    this->tv_nsec -= NS_PER_SEC;
-    ++this->tv_sec;
-  }
-  this->tv_sec += T.tv_sec;
-
-  return *this;
-}
diff --git a/liblog/logd_reader.cpp b/liblog/logd_reader.cpp
deleted file mode 100644
index 82ed6b2..0000000
--- a/liblog/logd_reader.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (C) 2007-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.
- */
-
-#include "logd_reader.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <poll.h>
-#include <stdarg.h>
-#include <stdatomic.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <private/android_logger.h>
-
-#include "logger.h"
-
-// Connects to /dev/socket/<name> and returns the associated fd or returns -1 on error.
-// O_CLOEXEC is always set.
-static int socket_local_client(const std::string& name, int type) {
-  sockaddr_un addr = {.sun_family = AF_LOCAL};
-
-  std::string path = "/dev/socket/" + name;
-  if (path.size() + 1 > sizeof(addr.sun_path)) {
-    return -1;
-  }
-  strlcpy(addr.sun_path, path.c_str(), sizeof(addr.sun_path));
-
-  int fd = socket(AF_LOCAL, type | SOCK_CLOEXEC, 0);
-  if (fd == -1) {
-    return -1;
-  }
-
-  if (connect(fd, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == -1) {
-    close(fd);
-    return -1;
-  }
-
-  return fd;
-}
-
-/* worker for sending the command to the logger */
-ssize_t SendLogdControlMessage(char* buf, size_t buf_size) {
-  ssize_t ret;
-  size_t len;
-  char* cp;
-  int errno_save = 0;
-  int sock = socket_local_client("logd", SOCK_STREAM);
-  if (sock < 0) {
-    return sock;
-  }
-
-  len = strlen(buf) + 1;
-  ret = TEMP_FAILURE_RETRY(write(sock, buf, len));
-  if (ret <= 0) {
-    goto done;
-  }
-
-  len = buf_size;
-  cp = buf;
-  while ((ret = TEMP_FAILURE_RETRY(read(sock, cp, len))) > 0) {
-    struct pollfd p;
-
-    if (((size_t)ret == len) || (buf_size < PAGE_SIZE)) {
-      break;
-    }
-
-    len -= ret;
-    cp += ret;
-
-    memset(&p, 0, sizeof(p));
-    p.fd = sock;
-    p.events = POLLIN;
-
-    /* Give other side 20ms to refill pipe */
-    ret = TEMP_FAILURE_RETRY(poll(&p, 1, 20));
-
-    if (ret <= 0) {
-      break;
-    }
-
-    if (!(p.revents & POLLIN)) {
-      ret = 0;
-      break;
-    }
-  }
-
-  if (ret >= 0) {
-    ret += buf_size - len;
-  }
-
-done:
-  if ((ret == -1) && errno) {
-    errno_save = errno;
-  }
-  close(sock);
-  if (errno_save) {
-    errno = errno_save;
-  }
-  return ret;
-}
-
-static int check_log_success(char* buf, ssize_t ret) {
-  if (ret < 0) {
-    return ret;
-  }
-
-  if (strncmp(buf, "success", 7)) {
-    errno = EINVAL;
-    return -1;
-  }
-
-  return 0;
-}
-
-int android_logger_clear(struct logger* logger) {
-  if (!android_logger_is_logd(logger)) {
-    return -EINVAL;
-  }
-  uint32_t log_id = android_logger_get_id(logger);
-  char buf[512];
-  snprintf(buf, sizeof(buf), "clear %" PRIu32, log_id);
-
-  return check_log_success(buf, SendLogdControlMessage(buf, sizeof(buf)));
-}
-
-/* returns the total size of the log's ring buffer */
-long android_logger_get_log_size(struct logger* logger) {
-  if (!android_logger_is_logd(logger)) {
-    return -EINVAL;
-  }
-
-  uint32_t log_id = android_logger_get_id(logger);
-  char buf[512];
-  snprintf(buf, sizeof(buf), "getLogSize %" PRIu32, log_id);
-
-  ssize_t ret = SendLogdControlMessage(buf, sizeof(buf));
-  if (ret < 0) {
-    return ret;
-  }
-
-  if ((buf[0] < '0') || ('9' < buf[0])) {
-    return -1;
-  }
-
-  return atol(buf);
-}
-
-int android_logger_set_log_size(struct logger* logger, unsigned long size) {
-  if (!android_logger_is_logd(logger)) {
-    return -EINVAL;
-  }
-
-  uint32_t log_id = android_logger_get_id(logger);
-  char buf[512];
-  snprintf(buf, sizeof(buf), "setLogSize %" PRIu32 " %lu", log_id, size);
-
-  return check_log_success(buf, SendLogdControlMessage(buf, sizeof(buf)));
-}
-
-/*
- * returns the readable size of the log's ring buffer (that is, amount of the
- * log consumed)
- */
-long android_logger_get_log_readable_size(struct logger* logger) {
-  if (!android_logger_is_logd(logger)) {
-    return -EINVAL;
-  }
-
-  uint32_t log_id = android_logger_get_id(logger);
-  char buf[512];
-  snprintf(buf, sizeof(buf), "getLogSizeUsed %" PRIu32, log_id);
-
-  ssize_t ret = SendLogdControlMessage(buf, sizeof(buf));
-  if (ret < 0) {
-    return ret;
-  }
-
-  if ((buf[0] < '0') || ('9' < buf[0])) {
-    return -1;
-  }
-
-  return atol(buf);
-}
-
-int android_logger_get_log_version(struct logger*) {
-  return 4;
-}
-
-ssize_t android_logger_get_statistics(struct logger_list* logger_list, char* buf, size_t len) {
-  if (logger_list->mode & ANDROID_LOG_PSTORE) {
-    return -EINVAL;
-  }
-
-  char* cp = buf;
-  size_t remaining = len;
-  size_t n;
-
-  n = snprintf(cp, remaining, "getStatistics");
-  n = MIN(n, remaining);
-  remaining -= n;
-  cp += n;
-
-  for (size_t log_id = 0; log_id < LOG_ID_MAX; ++log_id) {
-    if ((1 << log_id) & logger_list->log_mask) {
-      n = snprintf(cp, remaining, " %zu", log_id);
-      n = MIN(n, remaining);
-      remaining -= n;
-      cp += n;
-    }
-  }
-
-  if (logger_list->pid) {
-    snprintf(cp, remaining, " pid=%u", logger_list->pid);
-  }
-
-  return SendLogdControlMessage(buf, len);
-}
-ssize_t android_logger_get_prune_list(struct logger_list* logger_list, char* buf, size_t len) {
-  if (logger_list->mode & ANDROID_LOG_PSTORE) {
-    return -EINVAL;
-  }
-
-  snprintf(buf, len, "getPruneList");
-  return SendLogdControlMessage(buf, len);
-}
-
-int android_logger_set_prune_list(struct logger_list* logger_list, const char* buf, size_t len) {
-  if (logger_list->mode & ANDROID_LOG_PSTORE) {
-    return -EINVAL;
-  }
-
-  std::string cmd = "setPruneList " + std::string{buf, len};
-
-  return check_log_success(cmd.data(), SendLogdControlMessage(cmd.data(), cmd.size()));
-}
-
-static int logdOpen(struct logger_list* logger_list) {
-  char buffer[256], *cp, c;
-  int ret, remaining, sock;
-
-  sock = atomic_load(&logger_list->fd);
-  if (sock > 0) {
-    return sock;
-  }
-
-  sock = socket_local_client("logdr", SOCK_SEQPACKET);
-  if (sock <= 0) {
-    if ((sock == -1) && errno) {
-      return -errno;
-    }
-    return sock;
-  }
-
-  strcpy(buffer, (logger_list->mode & ANDROID_LOG_NONBLOCK) ? "dumpAndClose" : "stream");
-  cp = buffer + strlen(buffer);
-
-  strcpy(cp, " lids");
-  cp += 5;
-  c = '=';
-  remaining = sizeof(buffer) - (cp - buffer);
-
-  for (size_t log_id = 0; log_id < LOG_ID_MAX; ++log_id) {
-    if ((1 << log_id) & logger_list->log_mask) {
-      ret = snprintf(cp, remaining, "%c%zu", c, log_id);
-      ret = MIN(ret, remaining);
-      remaining -= ret;
-      cp += ret;
-      c = ',';
-    }
-  }
-
-  if (logger_list->tail) {
-    ret = snprintf(cp, remaining, " tail=%u", logger_list->tail);
-    ret = MIN(ret, remaining);
-    remaining -= ret;
-    cp += ret;
-  }
-
-  if (logger_list->start.tv_sec || logger_list->start.tv_nsec) {
-    if (logger_list->mode & ANDROID_LOG_WRAP) {
-      // ToDo: alternate API to allow timeout to be adjusted.
-      ret = snprintf(cp, remaining, " timeout=%u", ANDROID_LOG_WRAP_DEFAULT_TIMEOUT);
-      ret = MIN(ret, remaining);
-      remaining -= ret;
-      cp += ret;
-    }
-    ret = snprintf(cp, remaining, " start=%" PRIu32 ".%09" PRIu32, logger_list->start.tv_sec,
-                   logger_list->start.tv_nsec);
-    ret = MIN(ret, remaining);
-    remaining -= ret;
-    cp += ret;
-  }
-
-  if (logger_list->pid) {
-    ret = snprintf(cp, remaining, " pid=%u", logger_list->pid);
-    ret = MIN(ret, remaining);
-    cp += ret;
-  }
-
-  ret = TEMP_FAILURE_RETRY(write(sock, buffer, cp - buffer));
-  int write_errno = errno;
-
-  if (ret <= 0) {
-    close(sock);
-    if (ret == -1) {
-      return -write_errno;
-    }
-    if (ret == 0) {
-      return -EIO;
-    }
-    return ret;
-  }
-
-  ret = atomic_exchange(&logger_list->fd, sock);
-  if ((ret > 0) && (ret != sock)) {
-    close(ret);
-  }
-  return sock;
-}
-
-/* Read from the selected logs */
-int LogdRead(struct logger_list* logger_list, struct log_msg* log_msg) {
-  int ret = logdOpen(logger_list);
-  if (ret < 0) {
-    return ret;
-  }
-
-  /* NOTE: SOCK_SEQPACKET guarantees we read exactly one full entry */
-  ret = TEMP_FAILURE_RETRY(recv(ret, log_msg, LOGGER_ENTRY_MAX_LEN, 0));
-  if ((logger_list->mode & ANDROID_LOG_NONBLOCK) && ret == 0) {
-    return -EAGAIN;
-  }
-
-  if (ret == -1) {
-    return -errno;
-  }
-  return ret;
-}
-
-/* Close all the logs */
-void LogdClose(struct logger_list* logger_list) {
-  int sock = atomic_exchange(&logger_list->fd, -1);
-  if (sock > 0) {
-    close(sock);
-  }
-}
diff --git a/liblog/logd_reader.h b/liblog/logd_reader.h
deleted file mode 100644
index 68eef02..0000000
--- a/liblog/logd_reader.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-#include <unistd.h>
-
-#include "log/log_read.h"
-
-__BEGIN_DECLS
-
-int LogdRead(struct logger_list* logger_list, struct log_msg* log_msg);
-void LogdClose(struct logger_list* logger_list);
-
-ssize_t SendLogdControlMessage(char* buf, size_t buf_size);
-
-__END_DECLS
diff --git a/liblog/logd_writer.cpp b/liblog/logd_writer.cpp
deleted file mode 100644
index a230749..0000000
--- a/liblog/logd_writer.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2007-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.
- */
-
-#include "logd_writer.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <poll.h>
-#include <stdarg.h>
-#include <stdatomic.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-
-#include "logger.h"
-#include "uio.h"
-
-static atomic_int logd_socket;
-
-// Note that it is safe to call connect() multiple times on DGRAM Unix domain sockets, so this
-// function is used to reconnect to logd without requiring a new socket.
-static void LogdConnect() {
-  sockaddr_un un = {};
-  un.sun_family = AF_UNIX;
-  strcpy(un.sun_path, "/dev/socket/logdw");
-  TEMP_FAILURE_RETRY(connect(logd_socket, reinterpret_cast<sockaddr*>(&un), sizeof(sockaddr_un)));
-}
-
-// logd_socket should only be opened once.  If we see that logd_socket is uninitialized, we create a
-// new socket and attempt to exchange it into the atomic logd_socket.  If the compare/exchange was
-// successful, then that will be the socket used for the duration of the program, otherwise a
-// different thread has already opened and written the socket to the atomic, so close the new socket
-// and return.
-static void GetSocket() {
-  if (logd_socket != 0) {
-    return;
-  }
-
-  int new_socket =
-      TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0));
-  if (new_socket <= 0) {
-    return;
-  }
-
-  int uninitialized_value = 0;
-  if (!logd_socket.compare_exchange_strong(uninitialized_value, new_socket)) {
-    close(new_socket);
-    return;
-  }
-
-  LogdConnect();
-}
-
-// This is the one exception to the above.  Zygote uses this to clean up open FD's after fork() and
-// before specialization.  It is single threaded at this point and therefore this function is
-// explicitly not thread safe.  It sets logd_socket to 0, so future logs will be safely initialized
-// whenever they happen.
-void LogdClose() {
-  if (logd_socket > 0) {
-    close(logd_socket);
-  }
-  logd_socket = 0;
-}
-
-int LogdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr) {
-  ssize_t ret;
-  static const unsigned headerLength = 1;
-  struct iovec newVec[nr + headerLength];
-  android_log_header_t header;
-  size_t i, payloadSize;
-  static atomic_int dropped;
-  static atomic_int droppedSecurity;
-
-  GetSocket();
-
-  if (logd_socket <= 0) {
-    return -EBADF;
-  }
-
-  /* logd, after initialization and priv drop */
-  if (getuid() == AID_LOGD) {
-    /*
-     * ignore log messages we send to ourself (logd).
-     * Such log messages are often generated by libraries we depend on
-     * which use standard Android logging.
-     */
-    return 0;
-  }
-
-  header.tid = gettid();
-  header.realtime.tv_sec = ts->tv_sec;
-  header.realtime.tv_nsec = ts->tv_nsec;
-
-  newVec[0].iov_base = (unsigned char*)&header;
-  newVec[0].iov_len = sizeof(header);
-
-  int32_t snapshot = atomic_exchange_explicit(&droppedSecurity, 0, memory_order_relaxed);
-  if (snapshot) {
-    android_log_event_int_t buffer;
-
-    header.id = LOG_ID_SECURITY;
-    buffer.header.tag = LIBLOG_LOG_TAG;
-    buffer.payload.type = EVENT_TYPE_INT;
-    buffer.payload.data = snapshot;
-
-    newVec[headerLength].iov_base = &buffer;
-    newVec[headerLength].iov_len = sizeof(buffer);
-
-    ret = TEMP_FAILURE_RETRY(writev(logd_socket, newVec, 2));
-    if (ret != (ssize_t)(sizeof(header) + sizeof(buffer))) {
-      atomic_fetch_add_explicit(&droppedSecurity, snapshot, memory_order_relaxed);
-    }
-  }
-  snapshot = atomic_exchange_explicit(&dropped, 0, memory_order_relaxed);
-  if (snapshot && __android_log_is_loggable_len(ANDROID_LOG_INFO, "liblog", strlen("liblog"),
-                                                ANDROID_LOG_VERBOSE)) {
-    android_log_event_int_t buffer;
-
-    header.id = LOG_ID_EVENTS;
-    buffer.header.tag = LIBLOG_LOG_TAG;
-    buffer.payload.type = EVENT_TYPE_INT;
-    buffer.payload.data = snapshot;
-
-    newVec[headerLength].iov_base = &buffer;
-    newVec[headerLength].iov_len = sizeof(buffer);
-
-    ret = TEMP_FAILURE_RETRY(writev(logd_socket, newVec, 2));
-    if (ret != (ssize_t)(sizeof(header) + sizeof(buffer))) {
-      atomic_fetch_add_explicit(&dropped, snapshot, memory_order_relaxed);
-    }
-  }
-
-  header.id = logId;
-
-  for (payloadSize = 0, i = headerLength; i < nr + headerLength; i++) {
-    newVec[i].iov_base = vec[i - headerLength].iov_base;
-    payloadSize += newVec[i].iov_len = vec[i - headerLength].iov_len;
-
-    if (payloadSize > LOGGER_ENTRY_MAX_PAYLOAD) {
-      newVec[i].iov_len -= payloadSize - LOGGER_ENTRY_MAX_PAYLOAD;
-      if (newVec[i].iov_len) {
-        ++i;
-      }
-      break;
-    }
-  }
-
-  // The write below could be lost, but will never block.
-  // EAGAIN occurs if logd is overloaded, other errors indicate that something went wrong with
-  // the connection, so we reset it and try again.
-  ret = TEMP_FAILURE_RETRY(writev(logd_socket, newVec, i));
-  if (ret < 0 && errno != EAGAIN) {
-    LogdConnect();
-
-    ret = TEMP_FAILURE_RETRY(writev(logd_socket, newVec, i));
-  }
-
-  if (ret < 0) {
-    ret = -errno;
-  }
-
-  if (ret > (ssize_t)sizeof(header)) {
-    ret -= sizeof(header);
-  } else if (ret < 0) {
-    atomic_fetch_add_explicit(&dropped, 1, memory_order_relaxed);
-    if (logId == LOG_ID_SECURITY) {
-      atomic_fetch_add_explicit(&droppedSecurity, 1, memory_order_relaxed);
-    }
-  }
-
-  return ret;
-}
diff --git a/liblog/logd_writer.h b/liblog/logd_writer.h
deleted file mode 100644
index 41197b5..0000000
--- a/liblog/logd_writer.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-
-#include <android/log.h>
-
-int LogdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
-void LogdClose();
diff --git a/liblog/logger.h b/liblog/logger.h
deleted file mode 100644
index ddff19d..0000000
--- a/liblog/logger.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <stdatomic.h>
-#include <sys/cdefs.h>
-
-#include <log/log.h>
-
-#include "uio.h"
-
-__BEGIN_DECLS
-
-struct logger_list {
-  atomic_int fd;
-  int mode;
-  unsigned int tail;
-  log_time start;
-  pid_t pid;
-  uint32_t log_mask;
-};
-
-// Format for a 'logger' entry: uintptr_t where only the bottom 32 bits are used.
-// bit 31: Set if this 'logger' is for logd.
-// bit 30: Set if this 'logger' is for pmsg
-// bits 0-2: the decimal value of the log buffer.
-// Other bits are unused.
-
-#define LOGGER_LOGD (1U << 31)
-#define LOGGER_PMSG (1U << 30)
-#define LOGGER_LOG_ID_MASK ((1U << 3) - 1)
-
-inline bool android_logger_is_logd(struct logger* logger) {
-  return reinterpret_cast<uintptr_t>(logger) & LOGGER_LOGD;
-}
-
-__END_DECLS
diff --git a/liblog/logger_name.cpp b/liblog/logger_name.cpp
deleted file mode 100644
index e72290e..0000000
--- a/liblog/logger_name.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-** Copyright 2013-2014, 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.
-*/
-
-#include <string.h>
-#include <type_traits>
-
-#include <log/log.h>
-
-/* In the future, we would like to make this list extensible */
-static const char* LOG_NAME[LOG_ID_MAX] = {
-    /* clang-format off */
-  [LOG_ID_MAIN] = "main",
-  [LOG_ID_RADIO] = "radio",
-  [LOG_ID_EVENTS] = "events",
-  [LOG_ID_SYSTEM] = "system",
-  [LOG_ID_CRASH] = "crash",
-  [LOG_ID_STATS] = "stats",
-  [LOG_ID_SECURITY] = "security",
-  [LOG_ID_KERNEL] = "kernel",
-    /* clang-format on */
-};
-
-const char* android_log_id_to_name(log_id_t log_id) {
-  if (log_id >= LOG_ID_MAX) {
-    log_id = LOG_ID_MAIN;
-  }
-  return LOG_NAME[log_id];
-}
-
-static_assert(std::is_same<std::underlying_type<log_id_t>::type, uint32_t>::value,
-              "log_id_t must be an uint32_t");
-
-static_assert(std::is_same<std::underlying_type<android_LogPriority>::type, uint32_t>::value,
-              "log_id_t must be an uint32_t");
-
-log_id_t android_name_to_log_id(const char* logName) {
-  const char* b;
-  unsigned int ret;
-
-  if (!logName) {
-    return static_cast<log_id_t>(LOG_ID_MAX);
-  }
-
-  b = strrchr(logName, '/');
-  if (!b) {
-    b = logName;
-  } else {
-    ++b;
-  }
-
-  for (ret = LOG_ID_MIN; ret < LOG_ID_MAX; ++ret) {
-    const char* l = LOG_NAME[ret];
-    if (l && !strcmp(b, l)) {
-      return static_cast<log_id_t>(ret);
-    }
-  }
-
-  return static_cast<log_id_t>(LOG_ID_MAX);
-}
diff --git a/liblog/logger_read.cpp b/liblog/logger_read.cpp
deleted file mode 100644
index 4937042..0000000
--- a/liblog/logger_read.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-** Copyright 2013-2014, 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.
-*/
-
-#include "log/log_read.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <android/log.h>
-
-#include "logd_reader.h"
-#include "logger.h"
-#include "pmsg_reader.h"
-
-/* method for getting the associated sublog id */
-log_id_t android_logger_get_id(struct logger* logger) {
-  return static_cast<log_id_t>(reinterpret_cast<uintptr_t>(logger) & LOGGER_LOG_ID_MASK);
-}
-
-static struct logger_list* android_logger_list_alloc_internal(int mode, unsigned int tail,
-                                                              log_time start, pid_t pid) {
-  auto* logger_list = static_cast<struct logger_list*>(calloc(1, sizeof(struct logger_list)));
-  if (!logger_list) {
-    return nullptr;
-  }
-
-  logger_list->mode = mode;
-  logger_list->start = start;
-  logger_list->tail = tail;
-  logger_list->pid = pid;
-
-  return logger_list;
-}
-
-struct logger_list* android_logger_list_alloc(int mode, unsigned int tail, pid_t pid) {
-  return android_logger_list_alloc_internal(mode, tail, log_time(0, 0), pid);
-}
-
-struct logger_list* android_logger_list_alloc_time(int mode, log_time start, pid_t pid) {
-  return android_logger_list_alloc_internal(mode, 0, start, pid);
-}
-
-/* Open the named log and add it to the logger list */
-struct logger* android_logger_open(struct logger_list* logger_list, log_id_t logId) {
-  if (!logger_list || (logId >= LOG_ID_MAX)) {
-    return nullptr;
-  }
-
-  logger_list->log_mask |= 1 << logId;
-
-  uintptr_t logger = logId;
-  logger |= (logger_list->mode & ANDROID_LOG_PSTORE) ? LOGGER_PMSG : LOGGER_LOGD;
-  return reinterpret_cast<struct logger*>(logger);
-}
-
-/* Open the single named log and make it part of a new logger list */
-struct logger_list* android_logger_list_open(log_id_t logId, int mode, unsigned int tail,
-                                             pid_t pid) {
-  struct logger_list* logger_list = android_logger_list_alloc(mode, tail, pid);
-
-  if (!logger_list) {
-    return NULL;
-  }
-
-  if (!android_logger_open(logger_list, logId)) {
-    android_logger_list_free(logger_list);
-    return NULL;
-  }
-
-  return logger_list;
-}
-
-int android_logger_list_read(struct logger_list* logger_list, struct log_msg* log_msg) {
-  if (logger_list == nullptr || logger_list->log_mask == 0) {
-    return -EINVAL;
-  }
-
-  int ret = 0;
-
-#ifdef __ANDROID__
-  if (logger_list->mode & ANDROID_LOG_PSTORE) {
-    ret = PmsgRead(logger_list, log_msg);
-  } else {
-    ret = LogdRead(logger_list, log_msg);
-  }
-#endif
-
-  if (ret <= 0) {
-    return ret;
-  }
-
-  if (ret > LOGGER_ENTRY_MAX_LEN) {
-    ret = LOGGER_ENTRY_MAX_LEN;
-  }
-
-  if (ret < static_cast<int>(sizeof(log_msg->entry))) {
-    return -EINVAL;
-  }
-
-  if (log_msg->entry.hdr_size < sizeof(log_msg->entry) ||
-      log_msg->entry.hdr_size >= LOGGER_ENTRY_MAX_LEN - sizeof(log_msg->entry)) {
-    return -EINVAL;
-  }
-
-  if (log_msg->entry.len > ret - log_msg->entry.hdr_size) {
-    return -EINVAL;
-  }
-
-  log_msg->buf[log_msg->entry.len + log_msg->entry.hdr_size] = '\0';
-
-  return ret;
-}
-
-/* Close all the logs */
-void android_logger_list_free(struct logger_list* logger_list) {
-  if (logger_list == NULL) {
-    return;
-  }
-
-#ifdef __ANDROID__
-  if (logger_list->mode & ANDROID_LOG_PSTORE) {
-    PmsgClose(logger_list);
-  } else {
-    LogdClose(logger_list);
-  }
-#endif
-
-  free(logger_list);
-}
diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp
deleted file mode 100644
index b1bed80..0000000
--- a/liblog/logger_write.cpp
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * Copyright (C) 2007-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.
- */
-
-#include "logger_write.h"
-
-#include <errno.h>
-#include <inttypes.h>
-#include <libgen.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-
-#ifdef __BIONIC__
-#include <android/set_abort_message.h>
-#endif
-
-#include <atomic>
-
-#include <android-base/errno_restorer.h>
-#include <android-base/macros.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-
-#include "android/log.h"
-#include "log/log_read.h"
-#include "logger.h"
-#include "uio.h"
-
-#ifdef __ANDROID__
-#include "logd_writer.h"
-#include "pmsg_writer.h"
-#endif
-
-#if defined(__APPLE__)
-#include <pthread.h>
-#elif defined(__linux__) && !defined(__ANDROID__)
-#include <syscall.h>
-#elif defined(_WIN32)
-#include <windows.h>
-#endif
-
-using android::base::ErrnoRestorer;
-
-#define LOG_BUF_SIZE 1024
-
-#if defined(__ANDROID__)
-static int check_log_uid_permissions() {
-  uid_t uid = getuid();
-
-  /* Matches clientHasLogCredentials() in logd */
-  if ((uid != AID_SYSTEM) && (uid != AID_ROOT) && (uid != AID_LOG)) {
-    uid = geteuid();
-    if ((uid != AID_SYSTEM) && (uid != AID_ROOT) && (uid != AID_LOG)) {
-      gid_t gid = getgid();
-      if ((gid != AID_SYSTEM) && (gid != AID_ROOT) && (gid != AID_LOG)) {
-        gid = getegid();
-        if ((gid != AID_SYSTEM) && (gid != AID_ROOT) && (gid != AID_LOG)) {
-          int num_groups;
-          gid_t* groups;
-
-          num_groups = getgroups(0, NULL);
-          if (num_groups <= 0) {
-            return -EPERM;
-          }
-          groups = static_cast<gid_t*>(calloc(num_groups, sizeof(gid_t)));
-          if (!groups) {
-            return -ENOMEM;
-          }
-          num_groups = getgroups(num_groups, groups);
-          while (num_groups > 0) {
-            if (groups[num_groups - 1] == AID_LOG) {
-              break;
-            }
-            --num_groups;
-          }
-          free(groups);
-          if (num_groups <= 0) {
-            return -EPERM;
-          }
-        }
-      }
-    }
-  }
-  return 0;
-}
-#endif
-
-/*
- * Release any logger resources. A new log write will immediately re-acquire.
- */
-void __android_log_close() {
-#ifdef __ANDROID__
-  LogdClose();
-  PmsgClose();
-#endif
-}
-
-#if defined(__GLIBC__) || defined(_WIN32)
-static const char* getprogname() {
-#if defined(__GLIBC__)
-  return program_invocation_short_name;
-#elif defined(_WIN32)
-  static bool first = true;
-  static char progname[MAX_PATH] = {};
-
-  if (first) {
-    char path[PATH_MAX + 1];
-    DWORD result = GetModuleFileName(nullptr, path, sizeof(path) - 1);
-    if (result == 0 || result == sizeof(path) - 1) return "";
-    path[PATH_MAX - 1] = 0;
-
-    char* path_basename = basename(path);
-
-    snprintf(progname, sizeof(progname), "%s", path_basename);
-    first = false;
-  }
-
-  return progname;
-#endif
-}
-#endif
-
-// It's possible for logging to happen during static initialization before our globals are
-// initialized, so we place this std::string in a function such that it is initialized on the first
-// call.
-std::string& GetDefaultTag() {
-  static std::string default_tag = getprogname();
-  return default_tag;
-}
-
-void __android_log_set_default_tag(const char* tag) {
-  GetDefaultTag().assign(tag, 0, LOGGER_ENTRY_MAX_PAYLOAD);
-}
-
-static std::atomic_int32_t minimum_log_priority = ANDROID_LOG_DEFAULT;
-int32_t __android_log_set_minimum_priority(int32_t priority) {
-  return minimum_log_priority.exchange(priority, std::memory_order_relaxed);
-}
-
-int32_t __android_log_get_minimum_priority() {
-  return minimum_log_priority;
-}
-
-#ifdef __ANDROID__
-static __android_logger_function logger_function = __android_log_logd_logger;
-#else
-static __android_logger_function logger_function = __android_log_stderr_logger;
-#endif
-
-void __android_log_set_logger(__android_logger_function logger) {
-  logger_function = logger;
-}
-
-void __android_log_default_aborter(const char* abort_message) {
-#ifdef __ANDROID__
-  android_set_abort_message(abort_message);
-#else
-  UNUSED(abort_message);
-#endif
-  abort();
-}
-
-static __android_aborter_function aborter_function = __android_log_default_aborter;
-
-void __android_log_set_aborter(__android_aborter_function aborter) {
-  aborter_function = aborter;
-}
-
-void __android_log_call_aborter(const char* abort_message) {
-  aborter_function(abort_message);
-}
-
-#ifdef __ANDROID__
-static int write_to_log(log_id_t log_id, struct iovec* vec, size_t nr) {
-  int ret;
-  struct timespec ts;
-
-  if (log_id == LOG_ID_KERNEL) {
-    return -EINVAL;
-  }
-
-  clock_gettime(android_log_clockid(), &ts);
-
-  if (log_id == LOG_ID_SECURITY) {
-    if (vec[0].iov_len < 4) {
-      return -EINVAL;
-    }
-
-    ret = check_log_uid_permissions();
-    if (ret < 0) {
-      return ret;
-    }
-    if (!__android_log_security()) {
-      /* If only we could reset downstream logd counter */
-      return -EPERM;
-    }
-  } else if (log_id == LOG_ID_EVENTS || log_id == LOG_ID_STATS) {
-    if (vec[0].iov_len < 4) {
-      return -EINVAL;
-    }
-  }
-
-  ret = LogdWrite(log_id, &ts, vec, nr);
-  PmsgWrite(log_id, &ts, vec, nr);
-
-  return ret;
-}
-#else
-static int write_to_log(log_id_t, struct iovec*, size_t) {
-  // Non-Android text logs should go to __android_log_stderr_logger, not here.
-  // Non-Android binary logs are always dropped.
-  return 1;
-}
-#endif
-
-// Copied from base/threads.cpp
-static uint64_t GetThreadId() {
-#if defined(__BIONIC__)
-  return gettid();
-#elif defined(__APPLE__)
-  uint64_t tid;
-  pthread_threadid_np(NULL, &tid);
-  return tid;
-#elif defined(__linux__)
-  return syscall(__NR_gettid);
-#elif defined(_WIN32)
-  return GetCurrentThreadId();
-#endif
-}
-
-void __android_log_stderr_logger(const struct __android_log_message* log_message) {
-  struct tm now;
-  time_t t = time(nullptr);
-
-#if defined(_WIN32)
-  localtime_s(&now, &t);
-#else
-  localtime_r(&t, &now);
-#endif
-
-  char timestamp[32];
-  strftime(timestamp, sizeof(timestamp), "%m-%d %H:%M:%S", &now);
-
-  static const char log_characters[] = "XXVDIWEF";
-  static_assert(arraysize(log_characters) - 1 == ANDROID_LOG_SILENT,
-                "Mismatch in size of log_characters and values in android_LogPriority");
-  int32_t priority =
-      log_message->priority > ANDROID_LOG_SILENT ? ANDROID_LOG_FATAL : log_message->priority;
-  char priority_char = log_characters[priority];
-  uint64_t tid = GetThreadId();
-
-  if (log_message->file != nullptr) {
-    fprintf(stderr, "%s %c %s %5d %5" PRIu64 " %s:%u] %s\n",
-            log_message->tag ? log_message->tag : "nullptr", priority_char, timestamp, getpid(),
-            tid, log_message->file, log_message->line, log_message->message);
-  } else {
-    fprintf(stderr, "%s %c %s %5d %5" PRIu64 " %s\n",
-            log_message->tag ? log_message->tag : "nullptr", priority_char, timestamp, getpid(),
-            tid, log_message->message);
-  }
-}
-
-void __android_log_logd_logger(const struct __android_log_message* log_message) {
-  int buffer_id = log_message->buffer_id == LOG_ID_DEFAULT ? LOG_ID_MAIN : log_message->buffer_id;
-
-  struct iovec vec[3];
-  vec[0].iov_base =
-      const_cast<unsigned char*>(reinterpret_cast<const unsigned char*>(&log_message->priority));
-  vec[0].iov_len = 1;
-  vec[1].iov_base = const_cast<void*>(static_cast<const void*>(log_message->tag));
-  vec[1].iov_len = strlen(log_message->tag) + 1;
-  vec[2].iov_base = const_cast<void*>(static_cast<const void*>(log_message->message));
-  vec[2].iov_len = strlen(log_message->message) + 1;
-
-  write_to_log(static_cast<log_id_t>(buffer_id), vec, 3);
-}
-
-int __android_log_write(int prio, const char* tag, const char* msg) {
-  return __android_log_buf_write(LOG_ID_MAIN, prio, tag, msg);
-}
-
-void __android_log_write_log_message(__android_log_message* log_message) {
-  ErrnoRestorer errno_restorer;
-
-  if (log_message->buffer_id != LOG_ID_DEFAULT && log_message->buffer_id != LOG_ID_MAIN &&
-      log_message->buffer_id != LOG_ID_SYSTEM && log_message->buffer_id != LOG_ID_RADIO &&
-      log_message->buffer_id != LOG_ID_CRASH) {
-    return;
-  }
-
-  if (log_message->tag == nullptr) {
-    log_message->tag = GetDefaultTag().c_str();
-  }
-
-#if __BIONIC__
-  if (log_message->priority == ANDROID_LOG_FATAL) {
-    android_set_abort_message(log_message->message);
-  }
-#endif
-
-  logger_function(log_message);
-}
-
-int __android_log_buf_write(int bufID, int prio, const char* tag, const char* msg) {
-  ErrnoRestorer errno_restorer;
-
-  if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
-    return -EPERM;
-  }
-
-  __android_log_message log_message = {
-      sizeof(__android_log_message), bufID, prio, tag, nullptr, 0, msg};
-  __android_log_write_log_message(&log_message);
-  return 1;
-}
-
-int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) {
-  ErrnoRestorer errno_restorer;
-
-  if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
-    return -EPERM;
-  }
-
-  char buf[LOG_BUF_SIZE];
-
-  vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
-
-  __android_log_message log_message = {
-      sizeof(__android_log_message), LOG_ID_MAIN, prio, tag, nullptr, 0, buf};
-  __android_log_write_log_message(&log_message);
-  return 1;
-}
-
-int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
-  ErrnoRestorer errno_restorer;
-
-  if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
-    return -EPERM;
-  }
-
-  va_list ap;
-  char buf[LOG_BUF_SIZE];
-
-  va_start(ap, fmt);
-  vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
-  va_end(ap);
-
-  __android_log_message log_message = {
-      sizeof(__android_log_message), LOG_ID_MAIN, prio, tag, nullptr, 0, buf};
-  __android_log_write_log_message(&log_message);
-  return 1;
-}
-
-int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...) {
-  ErrnoRestorer errno_restorer;
-
-  if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) {
-    return -EPERM;
-  }
-
-  va_list ap;
-  char buf[LOG_BUF_SIZE];
-
-  va_start(ap, fmt);
-  vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
-  va_end(ap);
-
-  __android_log_message log_message = {
-      sizeof(__android_log_message), bufID, prio, tag, nullptr, 0, buf};
-  __android_log_write_log_message(&log_message);
-  return 1;
-}
-
-void __android_log_assert(const char* cond, const char* tag, const char* fmt, ...) {
-  char buf[LOG_BUF_SIZE];
-
-  if (fmt) {
-    va_list ap;
-    va_start(ap, fmt);
-    vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
-    va_end(ap);
-  } else {
-    /* Msg not provided, log condition.  N.B. Do not use cond directly as
-     * format string as it could contain spurious '%' syntax (e.g.
-     * "%d" in "blocks%devs == 0").
-     */
-    if (cond)
-      snprintf(buf, LOG_BUF_SIZE, "Assertion failed: %s", cond);
-    else
-      strcpy(buf, "Unspecified assertion failed");
-  }
-
-  // Log assertion failures to stderr for the benefit of "adb shell" users
-  // and gtests (http://b/23675822).
-  TEMP_FAILURE_RETRY(write(2, buf, strlen(buf)));
-  TEMP_FAILURE_RETRY(write(2, "\n", 1));
-
-  __android_log_write(ANDROID_LOG_FATAL, tag, buf);
-  __android_log_call_aborter(buf);
-  abort();
-}
-
-int __android_log_bwrite(int32_t tag, const void* payload, size_t len) {
-  ErrnoRestorer errno_restorer;
-
-  struct iovec vec[2];
-
-  vec[0].iov_base = &tag;
-  vec[0].iov_len = sizeof(tag);
-  vec[1].iov_base = (void*)payload;
-  vec[1].iov_len = len;
-
-  return write_to_log(LOG_ID_EVENTS, vec, 2);
-}
-
-int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len) {
-  ErrnoRestorer errno_restorer;
-
-  struct iovec vec[2];
-
-  vec[0].iov_base = &tag;
-  vec[0].iov_len = sizeof(tag);
-  vec[1].iov_base = (void*)payload;
-  vec[1].iov_len = len;
-
-  return write_to_log(LOG_ID_STATS, vec, 2);
-}
-
-int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len) {
-  ErrnoRestorer errno_restorer;
-
-  struct iovec vec[2];
-
-  vec[0].iov_base = &tag;
-  vec[0].iov_len = sizeof(tag);
-  vec[1].iov_base = (void*)payload;
-  vec[1].iov_len = len;
-
-  return write_to_log(LOG_ID_SECURITY, vec, 2);
-}
-
-/*
- * Like __android_log_bwrite, but takes the type as well.  Doesn't work
- * for the general case where we're generating lists of stuff, but very
- * handy if we just want to dump an integer into the log.
- */
-int __android_log_btwrite(int32_t tag, char type, const void* payload, size_t len) {
-  ErrnoRestorer errno_restorer;
-
-  struct iovec vec[3];
-
-  vec[0].iov_base = &tag;
-  vec[0].iov_len = sizeof(tag);
-  vec[1].iov_base = &type;
-  vec[1].iov_len = sizeof(type);
-  vec[2].iov_base = (void*)payload;
-  vec[2].iov_len = len;
-
-  return write_to_log(LOG_ID_EVENTS, vec, 3);
-}
-
-/*
- * Like __android_log_bwrite, but used for writing strings to the
- * event log.
- */
-int __android_log_bswrite(int32_t tag, const char* payload) {
-  ErrnoRestorer errno_restorer;
-
-  struct iovec vec[4];
-  char type = EVENT_TYPE_STRING;
-  uint32_t len = strlen(payload);
-
-  vec[0].iov_base = &tag;
-  vec[0].iov_len = sizeof(tag);
-  vec[1].iov_base = &type;
-  vec[1].iov_len = sizeof(type);
-  vec[2].iov_base = &len;
-  vec[2].iov_len = sizeof(len);
-  vec[3].iov_base = (void*)payload;
-  vec[3].iov_len = len;
-
-  return write_to_log(LOG_ID_EVENTS, vec, 4);
-}
-
-/*
- * Like __android_log_security_bwrite, but used for writing strings to the
- * security log.
- */
-int __android_log_security_bswrite(int32_t tag, const char* payload) {
-  ErrnoRestorer errno_restorer;
-
-  struct iovec vec[4];
-  char type = EVENT_TYPE_STRING;
-  uint32_t len = strlen(payload);
-
-  vec[0].iov_base = &tag;
-  vec[0].iov_len = sizeof(tag);
-  vec[1].iov_base = &type;
-  vec[1].iov_len = sizeof(type);
-  vec[2].iov_base = &len;
-  vec[2].iov_len = sizeof(len);
-  vec[3].iov_base = (void*)payload;
-  vec[3].iov_len = len;
-
-  return write_to_log(LOG_ID_SECURITY, vec, 4);
-}
diff --git a/liblog/logger_write.h b/liblog/logger_write.h
deleted file mode 100644
index eee2778..0000000
--- a/liblog/logger_write.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <string>
-
-std::string& GetDefaultTag();
diff --git a/liblog/logprint.cpp b/liblog/logprint.cpp
deleted file mode 100644
index 5c69bf8..0000000
--- a/liblog/logprint.cpp
+++ /dev/null
@@ -1,1750 +0,0 @@
-/*
-**
-** Copyright 2006-2014, 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.
-*/
-
-#ifndef __MINGW32__
-#define HAVE_STRSEP
-#endif
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#ifndef __MINGW32__
-#include <pwd.h>
-#endif
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <wchar.h>
-
-#include <cutils/list.h>
-
-#include <log/log.h>
-#include <log/logprint.h>
-#include <private/android_logger.h>
-
-#define MS_PER_NSEC 1000000
-#define US_PER_NSEC 1000
-
-#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-
-typedef struct FilterInfo_t {
-  char* mTag;
-  android_LogPriority mPri;
-  struct FilterInfo_t* p_next;
-} FilterInfo;
-
-struct AndroidLogFormat_t {
-  android_LogPriority global_pri;
-  FilterInfo* filters;
-  AndroidLogPrintFormat format;
-  bool colored_output;
-  bool usec_time_output;
-  bool nsec_time_output;
-  bool printable_output;
-  bool year_output;
-  bool zone_output;
-  bool epoch_output;
-  bool monotonic_output;
-  bool uid_output;
-  bool descriptive_output;
-};
-
-/*
- * API issues prevent us from exposing "descriptive" in AndroidLogFormat_t
- * during android_log_processBinaryLogBuffer(), so we break layering.
- */
-static bool descriptive_output = false;
-
-/*
- *  gnome-terminal color tags
- *    See http://misc.flogisoft.com/bash/tip_colors_and_formatting
- *    for ideas on how to set the forground color of the text for xterm.
- *    The color manipulation character stream is defined as:
- *      ESC [ 3 8 ; 5 ; <color#> m
- */
-#define ANDROID_COLOR_BLUE 75
-#define ANDROID_COLOR_DEFAULT 231
-#define ANDROID_COLOR_GREEN 40
-#define ANDROID_COLOR_ORANGE 166
-#define ANDROID_COLOR_RED 196
-#define ANDROID_COLOR_YELLOW 226
-
-static FilterInfo* filterinfo_new(const char* tag, android_LogPriority pri) {
-  FilterInfo* p_ret;
-
-  p_ret = (FilterInfo*)calloc(1, sizeof(FilterInfo));
-  p_ret->mTag = strdup(tag);
-  p_ret->mPri = pri;
-
-  return p_ret;
-}
-
-/* balance to above, filterinfo_free left unimplemented */
-
-/*
- * Note: also accepts 0-9 priorities
- * returns ANDROID_LOG_UNKNOWN if the character is unrecognized
- */
-static android_LogPriority filterCharToPri(char c) {
-  android_LogPriority pri;
-
-  c = tolower(c);
-
-  if (c >= '0' && c <= '9') {
-    if (c >= ('0' + ANDROID_LOG_SILENT)) {
-      pri = ANDROID_LOG_VERBOSE;
-    } else {
-      pri = (android_LogPriority)(c - '0');
-    }
-  } else if (c == 'v') {
-    pri = ANDROID_LOG_VERBOSE;
-  } else if (c == 'd') {
-    pri = ANDROID_LOG_DEBUG;
-  } else if (c == 'i') {
-    pri = ANDROID_LOG_INFO;
-  } else if (c == 'w') {
-    pri = ANDROID_LOG_WARN;
-  } else if (c == 'e') {
-    pri = ANDROID_LOG_ERROR;
-  } else if (c == 'f') {
-    pri = ANDROID_LOG_FATAL;
-  } else if (c == 's') {
-    pri = ANDROID_LOG_SILENT;
-  } else if (c == '*') {
-    pri = ANDROID_LOG_DEFAULT;
-  } else {
-    pri = ANDROID_LOG_UNKNOWN;
-  }
-
-  return pri;
-}
-
-static char filterPriToChar(android_LogPriority pri) {
-  switch (pri) {
-    /* clang-format off */
-    case ANDROID_LOG_VERBOSE: return 'V';
-    case ANDROID_LOG_DEBUG:   return 'D';
-    case ANDROID_LOG_INFO:    return 'I';
-    case ANDROID_LOG_WARN:    return 'W';
-    case ANDROID_LOG_ERROR:   return 'E';
-    case ANDROID_LOG_FATAL:   return 'F';
-    case ANDROID_LOG_SILENT:  return 'S';
-
-    case ANDROID_LOG_DEFAULT:
-    case ANDROID_LOG_UNKNOWN:
-    default:                  return '?';
-      /* clang-format on */
-  }
-}
-
-static int colorFromPri(android_LogPriority pri) {
-  switch (pri) {
-    /* clang-format off */
-    case ANDROID_LOG_VERBOSE: return ANDROID_COLOR_DEFAULT;
-    case ANDROID_LOG_DEBUG:   return ANDROID_COLOR_BLUE;
-    case ANDROID_LOG_INFO:    return ANDROID_COLOR_GREEN;
-    case ANDROID_LOG_WARN:    return ANDROID_COLOR_ORANGE;
-    case ANDROID_LOG_ERROR:   return ANDROID_COLOR_RED;
-    case ANDROID_LOG_FATAL:   return ANDROID_COLOR_RED;
-    case ANDROID_LOG_SILENT:  return ANDROID_COLOR_DEFAULT;
-
-    case ANDROID_LOG_DEFAULT:
-    case ANDROID_LOG_UNKNOWN:
-    default:                  return ANDROID_COLOR_DEFAULT;
-      /* clang-format on */
-  }
-}
-
-static android_LogPriority filterPriForTag(AndroidLogFormat* p_format, const char* tag) {
-  FilterInfo* p_curFilter;
-
-  for (p_curFilter = p_format->filters; p_curFilter != NULL; p_curFilter = p_curFilter->p_next) {
-    if (0 == strcmp(tag, p_curFilter->mTag)) {
-      if (p_curFilter->mPri == ANDROID_LOG_DEFAULT) {
-        return p_format->global_pri;
-      } else {
-        return p_curFilter->mPri;
-      }
-    }
-  }
-
-  return p_format->global_pri;
-}
-
-/**
- * returns 1 if this log line should be printed based on its priority
- * and tag, and 0 if it should not
- */
-int android_log_shouldPrintLine(AndroidLogFormat* p_format, const char* tag,
-                                android_LogPriority pri) {
-  return pri >= filterPriForTag(p_format, tag);
-}
-
-AndroidLogFormat* android_log_format_new() {
-  AndroidLogFormat* p_ret;
-
-  p_ret = static_cast<AndroidLogFormat*>(calloc(1, sizeof(AndroidLogFormat)));
-
-  p_ret->global_pri = ANDROID_LOG_VERBOSE;
-  p_ret->format = FORMAT_BRIEF;
-  p_ret->colored_output = false;
-  p_ret->usec_time_output = false;
-  p_ret->nsec_time_output = false;
-  p_ret->printable_output = false;
-  p_ret->year_output = false;
-  p_ret->zone_output = false;
-  p_ret->epoch_output = false;
-#ifdef __ANDROID__
-  p_ret->monotonic_output = android_log_clockid() == CLOCK_MONOTONIC;
-#else
-  p_ret->monotonic_output = false;
-#endif
-  p_ret->uid_output = false;
-  p_ret->descriptive_output = false;
-  descriptive_output = false;
-
-  return p_ret;
-}
-
-static list_declare(convertHead);
-
-void android_log_format_free(AndroidLogFormat* p_format) {
-  FilterInfo *p_info, *p_info_old;
-
-  p_info = p_format->filters;
-
-  while (p_info != NULL) {
-    p_info_old = p_info;
-    p_info = p_info->p_next;
-
-    free(p_info_old);
-  }
-
-  free(p_format);
-
-  /* Free conversion resource, can always be reconstructed */
-  while (!list_empty(&convertHead)) {
-    struct listnode* node = list_head(&convertHead);
-    list_remove(node);
-    LOG_ALWAYS_FATAL_IF(node == list_head(&convertHead), "corrupted list");
-    free(node);
-  }
-}
-
-int android_log_setPrintFormat(AndroidLogFormat* p_format, AndroidLogPrintFormat format) {
-  switch (format) {
-    case FORMAT_MODIFIER_COLOR:
-      p_format->colored_output = true;
-      return 0;
-    case FORMAT_MODIFIER_TIME_USEC:
-      p_format->usec_time_output = true;
-      return 0;
-    case FORMAT_MODIFIER_TIME_NSEC:
-      p_format->nsec_time_output = true;
-      return 0;
-    case FORMAT_MODIFIER_PRINTABLE:
-      p_format->printable_output = true;
-      return 0;
-    case FORMAT_MODIFIER_YEAR:
-      p_format->year_output = true;
-      return 0;
-    case FORMAT_MODIFIER_ZONE:
-      p_format->zone_output = !p_format->zone_output;
-      return 0;
-    case FORMAT_MODIFIER_EPOCH:
-      p_format->epoch_output = true;
-      return 0;
-    case FORMAT_MODIFIER_MONOTONIC:
-      p_format->monotonic_output = true;
-      return 0;
-    case FORMAT_MODIFIER_UID:
-      p_format->uid_output = true;
-      return 0;
-    case FORMAT_MODIFIER_DESCRIPT:
-      p_format->descriptive_output = true;
-      descriptive_output = true;
-      return 0;
-    default:
-      break;
-  }
-  p_format->format = format;
-  return 1;
-}
-
-#ifndef __MINGW32__
-static const char tz[] = "TZ";
-static const char utc[] = "UTC";
-#endif
-
-/**
- * Returns FORMAT_OFF on invalid string
- */
-AndroidLogPrintFormat android_log_formatFromString(const char* formatString) {
-  static AndroidLogPrintFormat format;
-
-  /* clang-format off */
-  if (!strcmp(formatString, "brief")) format = FORMAT_BRIEF;
-  else if (!strcmp(formatString, "process")) format = FORMAT_PROCESS;
-  else if (!strcmp(formatString, "tag")) format = FORMAT_TAG;
-  else if (!strcmp(formatString, "thread")) format = FORMAT_THREAD;
-  else if (!strcmp(formatString, "raw")) format = FORMAT_RAW;
-  else if (!strcmp(formatString, "time")) format = FORMAT_TIME;
-  else if (!strcmp(formatString, "threadtime")) format = FORMAT_THREADTIME;
-  else if (!strcmp(formatString, "long")) format = FORMAT_LONG;
-  else if (!strcmp(formatString, "color")) format = FORMAT_MODIFIER_COLOR;
-  else if (!strcmp(formatString, "colour")) format = FORMAT_MODIFIER_COLOR;
-  else if (!strcmp(formatString, "usec")) format = FORMAT_MODIFIER_TIME_USEC;
-  else if (!strcmp(formatString, "nsec")) format = FORMAT_MODIFIER_TIME_NSEC;
-  else if (!strcmp(formatString, "printable")) format = FORMAT_MODIFIER_PRINTABLE;
-  else if (!strcmp(formatString, "year")) format = FORMAT_MODIFIER_YEAR;
-  else if (!strcmp(formatString, "zone")) format = FORMAT_MODIFIER_ZONE;
-  else if (!strcmp(formatString, "epoch")) format = FORMAT_MODIFIER_EPOCH;
-  else if (!strcmp(formatString, "monotonic")) format = FORMAT_MODIFIER_MONOTONIC;
-  else if (!strcmp(formatString, "uid")) format = FORMAT_MODIFIER_UID;
-  else if (!strcmp(formatString, "descriptive")) format = FORMAT_MODIFIER_DESCRIPT;
-    /* clang-format on */
-
-#ifndef __MINGW32__
-  else {
-    extern char* tzname[2];
-    static const char gmt[] = "GMT";
-    char* cp = getenv(tz);
-    if (cp) {
-      cp = strdup(cp);
-    }
-    setenv(tz, formatString, 1);
-    /*
-     * Run tzset here to determine if the timezone is legitimate. If the
-     * zone is GMT, check if that is what was asked for, if not then
-     * did not match any on the system; report an error to caller.
-     */
-    tzset();
-    if (!tzname[0] ||
-        ((!strcmp(tzname[0], utc) || !strcmp(tzname[0], gmt))                  /* error? */
-         && strcasecmp(formatString, utc) && strcasecmp(formatString, gmt))) { /* ok */
-      if (cp) {
-        setenv(tz, cp, 1);
-      } else {
-        unsetenv(tz);
-      }
-      tzset();
-      format = FORMAT_OFF;
-    } else {
-      format = FORMAT_MODIFIER_ZONE;
-    }
-    free(cp);
-  }
-#endif
-
-  return format;
-}
-
-/**
- * filterExpression: a single filter expression
- * eg "AT:d"
- *
- * returns 0 on success and -1 on invalid expression
- *
- * Assumes single threaded execution
- */
-
-int android_log_addFilterRule(AndroidLogFormat* p_format, const char* filterExpression) {
-  size_t tagNameLength;
-  android_LogPriority pri = ANDROID_LOG_DEFAULT;
-
-  tagNameLength = strcspn(filterExpression, ":");
-
-  if (tagNameLength == 0) {
-    goto error;
-  }
-
-  if (filterExpression[tagNameLength] == ':') {
-    pri = filterCharToPri(filterExpression[tagNameLength + 1]);
-
-    if (pri == ANDROID_LOG_UNKNOWN) {
-      goto error;
-    }
-  }
-
-  if (0 == strncmp("*", filterExpression, tagNameLength)) {
-    /*
-     * This filter expression refers to the global filter
-     * The default level for this is DEBUG if the priority
-     * is unspecified
-     */
-    if (pri == ANDROID_LOG_DEFAULT) {
-      pri = ANDROID_LOG_DEBUG;
-    }
-
-    p_format->global_pri = pri;
-  } else {
-    /*
-     * for filter expressions that don't refer to the global
-     * filter, the default is verbose if the priority is unspecified
-     */
-    if (pri == ANDROID_LOG_DEFAULT) {
-      pri = ANDROID_LOG_VERBOSE;
-    }
-
-    char* tagName;
-
-/*
- * Presently HAVE_STRNDUP is never defined, so the second case is always taken
- * Darwin doesn't have strndup, everything else does
- */
-#ifdef HAVE_STRNDUP
-    tagName = strndup(filterExpression, tagNameLength);
-#else
-    /* a few extra bytes copied... */
-    tagName = strdup(filterExpression);
-    tagName[tagNameLength] = '\0';
-#endif /*HAVE_STRNDUP*/
-
-    FilterInfo* p_fi = filterinfo_new(tagName, pri);
-    free(tagName);
-
-    p_fi->p_next = p_format->filters;
-    p_format->filters = p_fi;
-  }
-
-  return 0;
-error:
-  return -1;
-}
-
-#ifndef HAVE_STRSEP
-/* KISS replacement helper for below */
-static char* strsep(char** stringp, const char* delim) {
-  char* token;
-  char* ret = *stringp;
-
-  if (!ret || !*ret) {
-    return NULL;
-  }
-  token = strpbrk(ret, delim);
-  if (token) {
-    *token = '\0';
-    ++token;
-  } else {
-    token = ret + strlen(ret);
-  }
-  *stringp = token;
-  return ret;
-}
-#endif
-
-/**
- * filterString: a comma/whitespace-separated set of filter expressions
- *
- * eg "AT:d *:i"
- *
- * returns 0 on success and -1 on invalid expression
- *
- * Assumes single threaded execution
- *
- */
-int android_log_addFilterString(AndroidLogFormat* p_format, const char* filterString) {
-  char* filterStringCopy = strdup(filterString);
-  char* p_cur = filterStringCopy;
-  char* p_ret;
-  int err;
-
-  /* Yes, I'm using strsep */
-  while (NULL != (p_ret = strsep(&p_cur, " \t,"))) {
-    /* ignore whitespace-only entries */
-    if (p_ret[0] != '\0') {
-      err = android_log_addFilterRule(p_format, p_ret);
-
-      if (err < 0) {
-        goto error;
-      }
-    }
-  }
-
-  free(filterStringCopy);
-  return 0;
-error:
-  free(filterStringCopy);
-  return -1;
-}
-
-/**
- * Splits a wire-format buffer into an AndroidLogEntry
- * entry allocated by caller. Pointers will point directly into buf
- *
- * Returns 0 on success and -1 on invalid wire format (entry will be
- * in unspecified state)
- */
-int android_log_processLogBuffer(struct logger_entry* buf, AndroidLogEntry* entry) {
-  entry->message = NULL;
-  entry->messageLen = 0;
-
-  entry->tv_sec = buf->sec;
-  entry->tv_nsec = buf->nsec;
-  entry->uid = -1;
-  entry->pid = buf->pid;
-  entry->tid = buf->tid;
-
-  /*
-   * format: <priority:1><tag:N>\0<message:N>\0
-   *
-   * tag str
-   *   starts at buf + buf->hdr_size + 1
-   * msg
-   *   starts at buf + buf->hdr_size + 1 + len(tag) + 1
-   *
-   * The message may have been truncated.  When that happens, we must null-terminate the message
-   * ourselves.
-   */
-  if (buf->len < 3) {
-    /*
-     * An well-formed entry must consist of at least a priority
-     * and two null characters
-     */
-    fprintf(stderr, "+++ LOG: entry too small\n");
-    return -1;
-  }
-
-  int msgStart = -1;
-  int msgEnd = -1;
-
-  int i;
-  if (buf->hdr_size < sizeof(logger_entry)) {
-    fprintf(stderr, "+++ LOG: hdr_size must be at least as big as struct logger_entry\n");
-    return -1;
-  }
-  char* msg = reinterpret_cast<char*>(buf) + buf->hdr_size;
-  entry->uid = buf->uid;
-
-  for (i = 1; i < buf->len; i++) {
-    if (msg[i] == '\0') {
-      if (msgStart == -1) {
-        msgStart = i + 1;
-      } else {
-        msgEnd = i;
-        break;
-      }
-    }
-  }
-
-  if (msgStart == -1) {
-    /* +++ LOG: malformed log message, DYB */
-    for (i = 1; i < buf->len; i++) {
-      /* odd characters in tag? */
-      if ((msg[i] <= ' ') || (msg[i] == ':') || (msg[i] >= 0x7f)) {
-        msg[i] = '\0';
-        msgStart = i + 1;
-        break;
-      }
-    }
-    if (msgStart == -1) {
-      msgStart = buf->len - 1; /* All tag, no message, print truncates */
-    }
-  }
-  if (msgEnd == -1) {
-    /* incoming message not null-terminated; force it */
-    msgEnd = buf->len - 1; /* may result in msgEnd < msgStart */
-    msg[msgEnd] = '\0';
-  }
-
-  entry->priority = static_cast<android_LogPriority>(msg[0]);
-  entry->tag = msg + 1;
-  entry->tagLen = msgStart - 1;
-  entry->message = msg + msgStart;
-  entry->messageLen = (msgEnd < msgStart) ? 0 : (msgEnd - msgStart);
-
-  return 0;
-}
-
-static bool findChar(const char** cp, size_t* len, int c) {
-  while ((*len) && isspace(*(*cp))) {
-    ++(*cp);
-    --(*len);
-  }
-  if (c == INT_MAX) return *len;
-  if ((*len) && (*(*cp) == c)) {
-    ++(*cp);
-    --(*len);
-    return true;
-  }
-  return false;
-}
-
-/*
- * Recursively convert binary log data to printable form.
- *
- * This needs to be recursive because you can have lists of lists.
- *
- * If we run out of room, we stop processing immediately.  It's important
- * for us to check for space on every output element to avoid producing
- * garbled output.
- *
- * Returns 0 on success, 1 on buffer full, -1 on failure.
- */
-enum objectType {
-  TYPE_OBJECTS = '1',
-  TYPE_BYTES = '2',
-  TYPE_MILLISECONDS = '3',
-  TYPE_ALLOCATIONS = '4',
-  TYPE_ID = '5',
-  TYPE_PERCENT = '6',
-  TYPE_MONOTONIC = 's'
-};
-
-static int android_log_printBinaryEvent(const unsigned char** pEventData, size_t* pEventDataLen,
-                                        char** pOutBuf, size_t* pOutBufLen, const char** fmtStr,
-                                        size_t* fmtLen) {
-  const unsigned char* eventData = *pEventData;
-  size_t eventDataLen = *pEventDataLen;
-  char* outBuf = *pOutBuf;
-  char* outBufSave = outBuf;
-  size_t outBufLen = *pOutBufLen;
-  size_t outBufLenSave = outBufLen;
-  unsigned char type;
-  size_t outCount = 0;
-  int result = 0;
-  const char* cp;
-  size_t len;
-  int64_t lval;
-
-  if (eventDataLen < 1) return -1;
-
-  type = *eventData;
-
-  cp = NULL;
-  len = 0;
-  if (fmtStr && *fmtStr && fmtLen && *fmtLen && **fmtStr) {
-    cp = *fmtStr;
-    len = *fmtLen;
-  }
-  /*
-   * event.logtag format specification:
-   *
-   * Optionally, after the tag names can be put a description for the value(s)
-   * of the tag. Description are in the format
-   *    (<name>|data type[|data unit])
-   * Multiple values are separated by commas.
-   *
-   * The data type is a number from the following values:
-   * 1: int
-   * 2: long
-   * 3: string
-   * 4: list
-   * 5: float
-   *
-   * The data unit is a number taken from the following list:
-   * 1: Number of objects
-   * 2: Number of bytes
-   * 3: Number of milliseconds
-   * 4: Number of allocations
-   * 5: Id
-   * 6: Percent
-   * s: Number of seconds (monotonic time)
-   * Default value for data of type int/long is 2 (bytes).
-   */
-  if (!cp || !findChar(&cp, &len, '(')) {
-    len = 0;
-  } else {
-    char* outBufLastSpace = NULL;
-
-    findChar(&cp, &len, INT_MAX);
-    while (len && *cp && (*cp != '|') && (*cp != ')')) {
-      if (outBufLen <= 0) {
-        /* halt output */
-        goto no_room;
-      }
-      outBufLastSpace = isspace(*cp) ? outBuf : NULL;
-      *outBuf = *cp;
-      ++outBuf;
-      ++cp;
-      --outBufLen;
-      --len;
-    }
-    if (outBufLastSpace) {
-      outBufLen += outBuf - outBufLastSpace;
-      outBuf = outBufLastSpace;
-    }
-    if (outBufLen <= 0) {
-      /* halt output */
-      goto no_room;
-    }
-    if (outBufSave != outBuf) {
-      *outBuf = '=';
-      ++outBuf;
-      --outBufLen;
-    }
-
-    if (findChar(&cp, &len, '|') && findChar(&cp, &len, INT_MAX)) {
-      static const unsigned char typeTable[] = {EVENT_TYPE_INT, EVENT_TYPE_LONG, EVENT_TYPE_STRING,
-                                                EVENT_TYPE_LIST, EVENT_TYPE_FLOAT};
-
-      if ((*cp >= '1') && (*cp < (char)('1' + (sizeof(typeTable) / sizeof(typeTable[0])))) &&
-          (type != typeTable[(size_t)(*cp - '1')]))
-        len = 0;
-
-      if (len) {
-        ++cp;
-        --len;
-      } else {
-        /* reset the format */
-        outBuf = outBufSave;
-        outBufLen = outBufLenSave;
-      }
-    }
-  }
-  outCount = 0;
-  lval = 0;
-  switch (type) {
-    case EVENT_TYPE_INT:
-      /* 32-bit signed int */
-      {
-        if (eventDataLen < sizeof(android_event_int_t)) return -1;
-        auto* event_int = reinterpret_cast<const android_event_int_t*>(eventData);
-        lval = event_int->data;
-        eventData += sizeof(android_event_int_t);
-        eventDataLen -= sizeof(android_event_int_t);
-      }
-      goto pr_lval;
-    case EVENT_TYPE_LONG:
-      /* 64-bit signed long */
-      if (eventDataLen < sizeof(android_event_long_t)) {
-        return -1;
-      }
-      {
-        auto* event_long = reinterpret_cast<const android_event_long_t*>(eventData);
-        lval = event_long->data;
-      }
-      eventData += sizeof(android_event_long_t);
-      eventDataLen -= sizeof(android_event_long_t);
-    pr_lval:
-      outCount = snprintf(outBuf, outBufLen, "%" PRId64, lval);
-      if (outCount < outBufLen) {
-        outBuf += outCount;
-        outBufLen -= outCount;
-      } else {
-        /* halt output */
-        goto no_room;
-      }
-      break;
-    case EVENT_TYPE_FLOAT:
-      /* float */
-      {
-        if (eventDataLen < sizeof(android_event_float_t)) return -1;
-        auto* event_float = reinterpret_cast<const android_event_float_t*>(eventData);
-        float fval = event_float->data;
-        eventData += sizeof(android_event_int_t);
-        eventDataLen -= sizeof(android_event_int_t);
-
-        outCount = snprintf(outBuf, outBufLen, "%f", fval);
-        if (outCount < outBufLen) {
-          outBuf += outCount;
-          outBufLen -= outCount;
-        } else {
-          /* halt output */
-          goto no_room;
-        }
-      }
-      break;
-    case EVENT_TYPE_STRING:
-      /* UTF-8 chars, not NULL-terminated */
-      {
-        if (eventDataLen < sizeof(android_event_string_t)) return -1;
-        auto* event_string = reinterpret_cast<const android_event_string_t*>(eventData);
-        unsigned int strLen = event_string->length;
-        eventData += sizeof(android_event_string_t);
-        eventDataLen -= sizeof(android_event_string_t);
-
-        if (eventDataLen < strLen) {
-          result = -1; /* mark truncated */
-          strLen = eventDataLen;
-        }
-
-        if (cp && (strLen == 0)) {
-          /* reset the format if no content */
-          outBuf = outBufSave;
-          outBufLen = outBufLenSave;
-        }
-        if (strLen < outBufLen) {
-          memcpy(outBuf, eventData, strLen);
-          outBuf += strLen;
-          outBufLen -= strLen;
-        } else {
-          if (outBufLen > 0) {
-            /* copy what we can */
-            memcpy(outBuf, eventData, outBufLen);
-            outBuf += outBufLen;
-            outBufLen -= outBufLen;
-          }
-          if (!result) result = 1; /* if not truncated, return no room */
-        }
-        eventData += strLen;
-        eventDataLen -= strLen;
-        if (result != 0) goto bail;
-        break;
-      }
-    case EVENT_TYPE_LIST:
-      /* N items, all different types */
-      {
-        if (eventDataLen < sizeof(android_event_list_t)) return -1;
-        auto* event_list = reinterpret_cast<const android_event_list_t*>(eventData);
-
-        int8_t count = event_list->element_count;
-        eventData += sizeof(android_event_list_t);
-        eventDataLen -= sizeof(android_event_list_t);
-
-        if (outBufLen <= 0) goto no_room;
-
-        *outBuf++ = '[';
-        outBufLen--;
-
-        for (int i = 0; i < count; i++) {
-          result = android_log_printBinaryEvent(&eventData, &eventDataLen, &outBuf, &outBufLen,
-                                                fmtStr, fmtLen);
-          if (result != 0) goto bail;
-
-          if (i < (count - 1)) {
-            if (outBufLen <= 0) goto no_room;
-            *outBuf++ = ',';
-            outBufLen--;
-          }
-        }
-
-        if (outBufLen <= 0) goto no_room;
-
-        *outBuf++ = ']';
-        outBufLen--;
-      }
-      break;
-    default:
-      fprintf(stderr, "Unknown binary event type %d\n", type);
-      return -1;
-  }
-  if (cp && len) {
-    if (findChar(&cp, &len, '|') && findChar(&cp, &len, INT_MAX)) {
-      switch (*cp) {
-        case TYPE_OBJECTS:
-          outCount = 0;
-          /* outCount = snprintf(outBuf, outBufLen, " objects"); */
-          break;
-        case TYPE_BYTES:
-          if ((lval != 0) && ((lval % 1024) == 0)) {
-            /* repaint with multiplier */
-            static const char suffixTable[] = {'K', 'M', 'G', 'T'};
-            size_t idx = 0;
-            outBuf -= outCount;
-            outBufLen += outCount;
-            do {
-              lval /= 1024;
-              if ((lval % 1024) != 0) break;
-            } while (++idx < ((sizeof(suffixTable) / sizeof(suffixTable[0])) - 1));
-            outCount = snprintf(outBuf, outBufLen, "%" PRId64 "%cB", lval, suffixTable[idx]);
-          } else {
-            outCount = snprintf(outBuf, outBufLen, "B");
-          }
-          break;
-        case TYPE_MILLISECONDS:
-          if (((lval <= -1000) || (1000 <= lval)) && (outBufLen || (outBuf[-1] == '0'))) {
-            /* repaint as (fractional) seconds, possibly saving space */
-            if (outBufLen) outBuf[0] = outBuf[-1];
-            outBuf[-1] = outBuf[-2];
-            outBuf[-2] = outBuf[-3];
-            outBuf[-3] = '.';
-            while ((outBufLen == 0) || (*outBuf == '0')) {
-              --outBuf;
-              ++outBufLen;
-            }
-            if (*outBuf != '.') {
-              ++outBuf;
-              --outBufLen;
-            }
-            outCount = snprintf(outBuf, outBufLen, "s");
-          } else {
-            outCount = snprintf(outBuf, outBufLen, "ms");
-          }
-          break;
-        case TYPE_MONOTONIC: {
-          static const uint64_t minute = 60;
-          static const uint64_t hour = 60 * minute;
-          static const uint64_t day = 24 * hour;
-
-          /* Repaint as unsigned seconds, minutes, hours ... */
-          outBuf -= outCount;
-          outBufLen += outCount;
-          uint64_t val = lval;
-          if (val >= day) {
-            outCount = snprintf(outBuf, outBufLen, "%" PRIu64 "d ", val / day);
-            if (outCount >= outBufLen) break;
-            outBuf += outCount;
-            outBufLen -= outCount;
-            val = (val % day) + day;
-          }
-          if (val >= minute) {
-            if (val >= hour) {
-              outCount = snprintf(outBuf, outBufLen, "%" PRIu64 ":", (val / hour) % (day / hour));
-              if (outCount >= outBufLen) break;
-              outBuf += outCount;
-              outBufLen -= outCount;
-            }
-            outCount =
-                snprintf(outBuf, outBufLen, (val >= hour) ? "%02" PRIu64 ":" : "%" PRIu64 ":",
-                         (val / minute) % (hour / minute));
-            if (outCount >= outBufLen) break;
-            outBuf += outCount;
-            outBufLen -= outCount;
-          }
-          outCount = snprintf(outBuf, outBufLen, (val >= minute) ? "%02" PRIu64 : "%" PRIu64 "s",
-                              val % minute);
-        } break;
-        case TYPE_ALLOCATIONS:
-          outCount = 0;
-          /* outCount = snprintf(outBuf, outBufLen, " allocations"); */
-          break;
-        case TYPE_ID:
-          outCount = 0;
-          break;
-        case TYPE_PERCENT:
-          outCount = snprintf(outBuf, outBufLen, "%%");
-          break;
-        default: /* ? */
-          outCount = 0;
-          break;
-      }
-      ++cp;
-      --len;
-      if (outCount < outBufLen) {
-        outBuf += outCount;
-        outBufLen -= outCount;
-      } else if (outCount) {
-        /* halt output */
-        goto no_room;
-      }
-    }
-    if (!findChar(&cp, &len, ')')) len = 0;
-    if (!findChar(&cp, &len, ',')) len = 0;
-  }
-
-bail:
-  *pEventData = eventData;
-  *pEventDataLen = eventDataLen;
-  *pOutBuf = outBuf;
-  *pOutBufLen = outBufLen;
-  if (cp) {
-    *fmtStr = cp;
-    *fmtLen = len;
-  }
-  return result;
-
-no_room:
-  result = 1;
-  goto bail;
-}
-
-/**
- * Convert a binary log entry to ASCII form.
- *
- * For convenience we mimic the processLogBuffer API.  There is no
- * pre-defined output length for the binary data, since we're free to format
- * it however we choose, which means we can't really use a fixed-size buffer
- * here.
- */
-int android_log_processBinaryLogBuffer(
-    struct logger_entry* buf, AndroidLogEntry* entry,
-    [[maybe_unused]] const EventTagMap* map, /* only on !__ANDROID__ */
-    char* messageBuf, int messageBufLen) {
-  size_t inCount;
-  uint32_t tagIndex;
-  const unsigned char* eventData;
-
-  entry->message = NULL;
-  entry->messageLen = 0;
-
-  entry->tv_sec = buf->sec;
-  entry->tv_nsec = buf->nsec;
-  entry->priority = ANDROID_LOG_INFO;
-  entry->uid = -1;
-  entry->pid = buf->pid;
-  entry->tid = buf->tid;
-
-  if (buf->hdr_size < sizeof(logger_entry)) {
-    fprintf(stderr, "+++ LOG: hdr_size must be at least as big as struct logger_entry\n");
-    return -1;
-  }
-  eventData = reinterpret_cast<unsigned char*>(buf) + buf->hdr_size;
-  if (buf->lid == LOG_ID_SECURITY) {
-    entry->priority = ANDROID_LOG_WARN;
-  }
-  entry->uid = buf->uid;
-  inCount = buf->len;
-  if (inCount < sizeof(android_event_header_t)) return -1;
-  auto* event_header = reinterpret_cast<const android_event_header_t*>(eventData);
-  tagIndex = event_header->tag;
-  eventData += sizeof(android_event_header_t);
-  inCount -= sizeof(android_event_header_t);
-
-  entry->tagLen = 0;
-  entry->tag = NULL;
-#ifdef __ANDROID__
-  if (map != NULL) {
-    entry->tag = android_lookupEventTag_len(map, &entry->tagLen, tagIndex);
-  }
-#endif
-
-  /*
-   * If we don't have a map, or didn't find the tag number in the map,
-   * stuff a generated tag value into the start of the output buffer and
-   * shift the buffer pointers down.
-   */
-  if (entry->tag == NULL) {
-    size_t tagLen;
-
-    tagLen = snprintf(messageBuf, messageBufLen, "[%" PRIu32 "]", tagIndex);
-    if (tagLen >= (size_t)messageBufLen) {
-      tagLen = messageBufLen - 1;
-    }
-    entry->tag = messageBuf;
-    entry->tagLen = tagLen;
-    messageBuf += tagLen + 1;
-    messageBufLen -= tagLen + 1;
-  }
-
-  /*
-   * Format the event log data into the buffer.
-   */
-  const char* fmtStr = NULL;
-  size_t fmtLen = 0;
-#ifdef __ANDROID__
-  if (descriptive_output && map) {
-    fmtStr = android_lookupEventFormat_len(map, &fmtLen, tagIndex);
-  }
-#endif
-
-  char* outBuf = messageBuf;
-  size_t outRemaining = messageBufLen - 1; /* leave one for nul byte */
-  int result = 0;
-
-  if ((inCount > 0) || fmtLen) {
-    result = android_log_printBinaryEvent(&eventData, &inCount, &outBuf, &outRemaining, &fmtStr,
-                                          &fmtLen);
-  }
-  if ((result == 1) && fmtStr) {
-    /* We overflowed :-(, let's repaint the line w/o format dressings */
-    eventData = reinterpret_cast<unsigned char*>(buf) + buf->hdr_size;
-    eventData += 4;
-    outBuf = messageBuf;
-    outRemaining = messageBufLen - 1;
-    result = android_log_printBinaryEvent(&eventData, &inCount, &outBuf, &outRemaining, NULL, NULL);
-  }
-  if (result < 0) {
-    fprintf(stderr, "Binary log entry conversion failed\n");
-  }
-  if (result) {
-    if (!outRemaining) {
-      /* make space to leave an indicator */
-      --outBuf;
-      ++outRemaining;
-    }
-    *outBuf++ = (result < 0) ? '!' : '^'; /* Error or Truncation? */
-    outRemaining--;
-    /* pretend we ate all the data to prevent log stutter */
-    inCount = 0;
-    if (result > 0) result = 0;
-  }
-
-  /* eat the silly terminating '\n' */
-  if (inCount == 1 && *eventData == '\n') {
-    eventData++;
-    inCount--;
-  }
-
-  if (inCount != 0) {
-    fprintf(stderr, "Warning: leftover binary log data (%zu bytes)\n", inCount);
-  }
-
-  /*
-   * Terminate the buffer.  The NUL byte does not count as part of
-   * entry->messageLen.
-   */
-  *outBuf = '\0';
-  entry->messageLen = outBuf - messageBuf;
-  assert(entry->messageLen == (messageBufLen - 1) - outRemaining);
-
-  entry->message = messageBuf;
-
-  return result;
-}
-
-/*
- * Convert to printable from message to p buffer, return string length. If p is
- * NULL, do not copy, but still return the expected string length.
- */
-size_t convertPrintable(char* p, const char* message, size_t messageLen) {
-  char* begin = p;
-  bool print = p != NULL;
-  mbstate_t mb_state = {};
-
-  while (messageLen) {
-    char buf[6];
-    ssize_t len = sizeof(buf) - 1;
-    if ((size_t)len > messageLen) {
-      len = messageLen;
-    }
-    len = mbrtowc(nullptr, message, len, &mb_state);
-
-    if (len < 0) {
-      snprintf(buf, sizeof(buf), "\\x%02X", static_cast<unsigned char>(*message));
-      len = 1;
-    } else {
-      buf[0] = '\0';
-      if (len == 1) {
-        if (*message == '\a') {
-          strcpy(buf, "\\a");
-        } else if (*message == '\b') {
-          strcpy(buf, "\\b");
-        } else if (*message == '\t') {
-          strcpy(buf, "\t"); /* Do not escape tabs */
-        } else if (*message == '\v') {
-          strcpy(buf, "\\v");
-        } else if (*message == '\f') {
-          strcpy(buf, "\\f");
-        } else if (*message == '\r') {
-          strcpy(buf, "\\r");
-        } else if (*message == '\\') {
-          strcpy(buf, "\\\\");
-        } else if ((*message < ' ') || (*message & 0x80)) {
-          snprintf(buf, sizeof(buf), "\\x%02X", static_cast<unsigned char>(*message));
-        }
-      }
-      if (!buf[0]) {
-        strncpy(buf, message, len);
-        buf[len] = '\0';
-      }
-    }
-    if (print) {
-      strcpy(p, buf);
-    }
-    p += strlen(buf);
-    message += len;
-    messageLen -= len;
-  }
-  return p - begin;
-}
-
-#ifdef __ANDROID__
-static char* readSeconds(char* e, struct timespec* t) {
-  unsigned long multiplier;
-  char* p;
-  t->tv_sec = strtoul(e, &p, 10);
-  if (*p != '.') {
-    return NULL;
-  }
-  t->tv_nsec = 0;
-  multiplier = NS_PER_SEC;
-  while (isdigit(*++p) && (multiplier /= 10)) {
-    t->tv_nsec += (*p - '0') * multiplier;
-  }
-  return p;
-}
-
-static struct timespec* sumTimespec(struct timespec* left, struct timespec* right) {
-  left->tv_nsec += right->tv_nsec;
-  left->tv_sec += right->tv_sec;
-  if (left->tv_nsec >= (long)NS_PER_SEC) {
-    left->tv_nsec -= NS_PER_SEC;
-    left->tv_sec += 1;
-  }
-  return left;
-}
-
-static struct timespec* subTimespec(struct timespec* result, struct timespec* left,
-                                    struct timespec* right) {
-  result->tv_nsec = left->tv_nsec - right->tv_nsec;
-  result->tv_sec = left->tv_sec - right->tv_sec;
-  if (result->tv_nsec < 0) {
-    result->tv_nsec += NS_PER_SEC;
-    result->tv_sec -= 1;
-  }
-  return result;
-}
-
-static long long nsecTimespec(struct timespec* now) {
-  return (long long)now->tv_sec * NS_PER_SEC + now->tv_nsec;
-}
-
-static void convertMonotonic(struct timespec* result, const AndroidLogEntry* entry) {
-  struct listnode* node;
-  struct conversionList {
-    struct listnode node; /* first */
-    struct timespec time;
-    struct timespec convert;
-  } * list, *next;
-  struct timespec time, convert;
-
-  /* If we do not have a conversion list, build one up */
-  if (list_empty(&convertHead)) {
-    bool suspended_pending = false;
-    struct timespec suspended_monotonic = {0, 0};
-    struct timespec suspended_diff = {0, 0};
-
-    /*
-     * Read dmesg for _some_ synchronization markers and insert
-     * Anything in the Android Logger before the dmesg logging span will
-     * be highly suspect regarding the monotonic time calculations.
-     */
-    FILE* p = popen("/system/bin/dmesg", "re");
-    if (p) {
-      char* line = NULL;
-      size_t len = 0;
-      while (getline(&line, &len, p) > 0) {
-        static const char suspend[] = "PM: suspend entry ";
-        static const char resume[] = "PM: suspend exit ";
-        static const char healthd[] = "healthd";
-        static const char battery[] = ": battery ";
-        static const char suspended[] = "Suspended for ";
-        struct timespec monotonic;
-        struct tm tm;
-        char *cp, *e = line;
-        bool add_entry = true;
-
-        if (*e == '<') {
-          while (*e && (*e != '>')) {
-            ++e;
-          }
-          if (*e != '>') {
-            continue;
-          }
-        }
-        if (*e != '[') {
-          continue;
-        }
-        while (*++e == ' ') {
-          ;
-        }
-        e = readSeconds(e, &monotonic);
-        if (!e || (*e != ']')) {
-          continue;
-        }
-
-        if ((e = strstr(e, suspend))) {
-          e += sizeof(suspend) - 1;
-        } else if ((e = strstr(line, resume))) {
-          e += sizeof(resume) - 1;
-        } else if (((e = strstr(line, healthd))) &&
-                   ((e = strstr(e + sizeof(healthd) - 1, battery)))) {
-          /* NB: healthd is roughly 150us late, worth the price to
-           * deal with ntp-induced or hardware clock drift. */
-          e += sizeof(battery) - 1;
-        } else if ((e = strstr(line, suspended))) {
-          e += sizeof(suspended) - 1;
-          e = readSeconds(e, &time);
-          if (!e) {
-            continue;
-          }
-          add_entry = false;
-          suspended_pending = true;
-          suspended_monotonic = monotonic;
-          suspended_diff = time;
-        } else {
-          continue;
-        }
-        if (add_entry) {
-          /* look for "????-??-?? ??:??:??.????????? UTC" */
-          cp = strstr(e, " UTC");
-          if (!cp || ((cp - e) < 29) || (cp[-10] != '.')) {
-            continue;
-          }
-          e = cp - 29;
-          cp = readSeconds(cp - 10, &time);
-          if (!cp) {
-            continue;
-          }
-          cp = strptime(e, "%Y-%m-%d %H:%M:%S.", &tm);
-          if (!cp) {
-            continue;
-          }
-          cp = getenv(tz);
-          if (cp) {
-            cp = strdup(cp);
-          }
-          setenv(tz, utc, 1);
-          time.tv_sec = mktime(&tm);
-          if (cp) {
-            setenv(tz, cp, 1);
-            free(cp);
-          } else {
-            unsetenv(tz);
-          }
-          list = static_cast<conversionList*>(calloc(1, sizeof(conversionList)));
-          list_init(&list->node);
-          list->time = time;
-          subTimespec(&list->convert, &time, &monotonic);
-          list_add_tail(&convertHead, &list->node);
-        }
-        if (suspended_pending && !list_empty(&convertHead)) {
-          list = node_to_item(list_tail(&convertHead), struct conversionList, node);
-          if (subTimespec(&time, subTimespec(&time, &list->time, &list->convert),
-                          &suspended_monotonic)
-                  ->tv_sec > 0) {
-            /* resume, what is convert factor before? */
-            subTimespec(&convert, &list->convert, &suspended_diff);
-          } else {
-            /* suspend */
-            convert = list->convert;
-          }
-          time = suspended_monotonic;
-          sumTimespec(&time, &convert);
-          /* breakpoint just before sleep */
-          list = static_cast<conversionList*>(calloc(1, sizeof(conversionList)));
-          list_init(&list->node);
-          list->time = time;
-          list->convert = convert;
-          list_add_tail(&convertHead, &list->node);
-          /* breakpoint just after sleep */
-          list = static_cast<conversionList*>(calloc(1, sizeof(conversionList)));
-          list_init(&list->node);
-          list->time = time;
-          sumTimespec(&list->time, &suspended_diff);
-          list->convert = convert;
-          sumTimespec(&list->convert, &suspended_diff);
-          list_add_tail(&convertHead, &list->node);
-          suspended_pending = false;
-        }
-      }
-      pclose(p);
-    }
-    /* last entry is our current time conversion */
-    list = static_cast<conversionList*>(calloc(1, sizeof(conversionList)));
-    list_init(&list->node);
-    clock_gettime(CLOCK_REALTIME, &list->time);
-    clock_gettime(CLOCK_MONOTONIC, &convert);
-    clock_gettime(CLOCK_MONOTONIC, &time);
-    /* Correct for instant clock_gettime latency (syscall or ~30ns) */
-    subTimespec(&time, &convert, subTimespec(&time, &time, &convert));
-    /* Calculate conversion factor */
-    subTimespec(&list->convert, &list->time, &time);
-    list_add_tail(&convertHead, &list->node);
-    if (suspended_pending) {
-      /* manufacture a suspend @ point before */
-      subTimespec(&convert, &list->convert, &suspended_diff);
-      time = suspended_monotonic;
-      sumTimespec(&time, &convert);
-      /* breakpoint just after sleep */
-      list = static_cast<conversionList*>(calloc(1, sizeof(conversionList)));
-      list_init(&list->node);
-      list->time = time;
-      sumTimespec(&list->time, &suspended_diff);
-      list->convert = convert;
-      sumTimespec(&list->convert, &suspended_diff);
-      list_add_head(&convertHead, &list->node);
-      /* breakpoint just before sleep */
-      list = static_cast<conversionList*>(calloc(1, sizeof(conversionList)));
-      list_init(&list->node);
-      list->time = time;
-      list->convert = convert;
-      list_add_head(&convertHead, &list->node);
-    }
-  }
-
-  /* Find the breakpoint in the conversion list */
-  list = node_to_item(list_head(&convertHead), struct conversionList, node);
-  next = NULL;
-  list_for_each(node, &convertHead) {
-    next = node_to_item(node, struct conversionList, node);
-    if (entry->tv_sec < next->time.tv_sec) {
-      break;
-    } else if (entry->tv_sec == next->time.tv_sec) {
-      if (entry->tv_nsec < next->time.tv_nsec) {
-        break;
-      }
-    }
-    list = next;
-  }
-
-  /* blend time from one breakpoint to the next */
-  convert = list->convert;
-  if (next) {
-    unsigned long long total, run;
-
-    total = nsecTimespec(subTimespec(&time, &next->time, &list->time));
-    time.tv_sec = entry->tv_sec;
-    time.tv_nsec = entry->tv_nsec;
-    run = nsecTimespec(subTimespec(&time, &time, &list->time));
-    if (run < total) {
-      long long crun;
-
-      float f = nsecTimespec(subTimespec(&time, &next->convert, &convert));
-      f *= run;
-      f /= total;
-      crun = f;
-      convert.tv_sec += crun / (long long)NS_PER_SEC;
-      if (crun < 0) {
-        convert.tv_nsec -= (-crun) % NS_PER_SEC;
-        if (convert.tv_nsec < 0) {
-          convert.tv_nsec += NS_PER_SEC;
-          convert.tv_sec -= 1;
-        }
-      } else {
-        convert.tv_nsec += crun % NS_PER_SEC;
-        if (convert.tv_nsec >= (long)NS_PER_SEC) {
-          convert.tv_nsec -= NS_PER_SEC;
-          convert.tv_sec += 1;
-        }
-      }
-    }
-  }
-
-  /* Apply the correction factor */
-  result->tv_sec = entry->tv_sec;
-  result->tv_nsec = entry->tv_nsec;
-  subTimespec(result, result, &convert);
-}
-#endif
-
-/**
- * Formats a log message into a buffer
- *
- * Uses defaultBuffer if it can, otherwise malloc()'s a new buffer
- * If return value != defaultBuffer, caller must call free()
- * Returns NULL on malloc error
- */
-
-char* android_log_formatLogLine(AndroidLogFormat* p_format, char* defaultBuffer,
-                                size_t defaultBufferSize, const AndroidLogEntry* entry,
-                                size_t* p_outLength) {
-#if !defined(_WIN32)
-  struct tm tmBuf;
-#endif
-  struct tm* ptm;
-  /* good margin, 23+nul for msec, 26+nul for usec, 29+nul to nsec */
-  char timeBuf[64];
-  char prefixBuf[128], suffixBuf[128];
-  char priChar;
-  int prefixSuffixIsHeaderFooter = 0;
-  char* ret;
-  time_t now;
-  unsigned long nsec;
-
-  priChar = filterPriToChar(entry->priority);
-  size_t prefixLen = 0, suffixLen = 0;
-  size_t len;
-
-  /*
-   * Get the current date/time in pretty form
-   *
-   * It's often useful when examining a log with "less" to jump to
-   * a specific point in the file by searching for the date/time stamp.
-   * For this reason it's very annoying to have regexp meta characters
-   * in the time stamp.  Don't use forward slashes, parenthesis,
-   * brackets, asterisks, or other special chars here.
-   *
-   * The caller may have affected the timezone environment, this is
-   * expected to be sensitive to that.
-   */
-  now = entry->tv_sec;
-  nsec = entry->tv_nsec;
-#if __ANDROID__
-  if (p_format->monotonic_output) {
-    /* prevent convertMonotonic from being called if logd is monotonic */
-    if (android_log_clockid() != CLOCK_MONOTONIC) {
-      struct timespec time;
-      convertMonotonic(&time, entry);
-      now = time.tv_sec;
-      nsec = time.tv_nsec;
-    }
-  }
-#endif
-  if (now < 0) {
-    nsec = NS_PER_SEC - nsec;
-  }
-  if (p_format->epoch_output || p_format->monotonic_output) {
-    ptm = NULL;
-    snprintf(timeBuf, sizeof(timeBuf), p_format->monotonic_output ? "%6lld" : "%19lld",
-             (long long)now);
-  } else {
-#if !defined(_WIN32)
-    ptm = localtime_r(&now, &tmBuf);
-#else
-    ptm = localtime(&now);
-#endif
-    strftime(timeBuf, sizeof(timeBuf), &"%Y-%m-%d %H:%M:%S"[p_format->year_output ? 0 : 3], ptm);
-  }
-  len = strlen(timeBuf);
-  if (p_format->nsec_time_output) {
-    len += snprintf(timeBuf + len, sizeof(timeBuf) - len, ".%09ld", nsec);
-  } else if (p_format->usec_time_output) {
-    len += snprintf(timeBuf + len, sizeof(timeBuf) - len, ".%06ld", nsec / US_PER_NSEC);
-  } else {
-    len += snprintf(timeBuf + len, sizeof(timeBuf) - len, ".%03ld", nsec / MS_PER_NSEC);
-  }
-  if (p_format->zone_output && ptm) {
-    strftime(timeBuf + len, sizeof(timeBuf) - len, " %z", ptm);
-  }
-
-  /*
-   * Construct a buffer containing the log header and log message.
-   */
-  if (p_format->colored_output) {
-    prefixLen =
-        snprintf(prefixBuf, sizeof(prefixBuf), "\x1B[38;5;%dm", colorFromPri(entry->priority));
-    prefixLen = MIN(prefixLen, sizeof(prefixBuf));
-
-    const char suffixContents[] = "\x1B[0m";
-    strcpy(suffixBuf, suffixContents);
-    suffixLen = strlen(suffixContents);
-  }
-
-  char uid[16];
-  uid[0] = '\0';
-  if (p_format->uid_output) {
-    if (entry->uid >= 0) {
-/*
- * This code is Android specific, bionic guarantees that
- * calls to non-reentrant getpwuid() are thread safe.
- */
-#ifdef __ANDROID__
-      struct passwd* pwd = getpwuid(entry->uid);
-      if (pwd && (strlen(pwd->pw_name) <= 5)) {
-        snprintf(uid, sizeof(uid), "%5s:", pwd->pw_name);
-      } else
-#endif
-      {
-        /* Not worth parsing package list, names all longer than 5 */
-        snprintf(uid, sizeof(uid), "%5d:", entry->uid);
-      }
-    } else {
-      snprintf(uid, sizeof(uid), "      ");
-    }
-  }
-
-  switch (p_format->format) {
-    case FORMAT_TAG:
-      len = snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen, "%c/%-8.*s: ", priChar,
-                     (int)entry->tagLen, entry->tag);
-      strcpy(suffixBuf + suffixLen, "\n");
-      ++suffixLen;
-      break;
-    case FORMAT_PROCESS:
-      len = snprintf(suffixBuf + suffixLen, sizeof(suffixBuf) - suffixLen, "  (%.*s)\n",
-                     (int)entry->tagLen, entry->tag);
-      suffixLen += MIN(len, sizeof(suffixBuf) - suffixLen);
-      len = snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen, "%c(%s%5d) ", priChar,
-                     uid, entry->pid);
-      break;
-    case FORMAT_THREAD:
-      len = snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen, "%c(%s%5d:%5d) ",
-                     priChar, uid, entry->pid, entry->tid);
-      strcpy(suffixBuf + suffixLen, "\n");
-      ++suffixLen;
-      break;
-    case FORMAT_RAW:
-      prefixBuf[prefixLen] = 0;
-      len = 0;
-      strcpy(suffixBuf + suffixLen, "\n");
-      ++suffixLen;
-      break;
-    case FORMAT_TIME:
-      len = snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen,
-                     "%s %c/%-8.*s(%s%5d): ", timeBuf, priChar, (int)entry->tagLen, entry->tag, uid,
-                     entry->pid);
-      strcpy(suffixBuf + suffixLen, "\n");
-      ++suffixLen;
-      break;
-    case FORMAT_THREADTIME:
-      ret = strchr(uid, ':');
-      if (ret) {
-        *ret = ' ';
-      }
-      len = snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen,
-                     "%s %s%5d %5d %c %-8.*s: ", timeBuf, uid, entry->pid, entry->tid, priChar,
-                     (int)entry->tagLen, entry->tag);
-      strcpy(suffixBuf + suffixLen, "\n");
-      ++suffixLen;
-      break;
-    case FORMAT_LONG:
-      len = snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen,
-                     "[ %s %s%5d:%5d %c/%-8.*s ]\n", timeBuf, uid, entry->pid, entry->tid, priChar,
-                     (int)entry->tagLen, entry->tag);
-      strcpy(suffixBuf + suffixLen, "\n\n");
-      suffixLen += 2;
-      prefixSuffixIsHeaderFooter = 1;
-      break;
-    case FORMAT_BRIEF:
-    default:
-      len =
-          snprintf(prefixBuf + prefixLen, sizeof(prefixBuf) - prefixLen,
-                   "%c/%-8.*s(%s%5d): ", priChar, (int)entry->tagLen, entry->tag, uid, entry->pid);
-      strcpy(suffixBuf + suffixLen, "\n");
-      ++suffixLen;
-      break;
-  }
-
-  /* snprintf has a weird return value.   It returns what would have been
-   * written given a large enough buffer.  In the case that the prefix is
-   * longer then our buffer(128), it messes up the calculations below
-   * possibly causing heap corruption.  To avoid this we double check and
-   * set the length at the maximum (size minus null byte)
-   */
-  prefixLen += len;
-  if (prefixLen >= sizeof(prefixBuf)) {
-    prefixLen = sizeof(prefixBuf) - 1;
-    prefixBuf[sizeof(prefixBuf) - 1] = '\0';
-  }
-  if (suffixLen >= sizeof(suffixBuf)) {
-    suffixLen = sizeof(suffixBuf) - 1;
-    suffixBuf[sizeof(suffixBuf) - 2] = '\n';
-    suffixBuf[sizeof(suffixBuf) - 1] = '\0';
-  }
-
-  /* the following code is tragically unreadable */
-
-  size_t numLines;
-  char* p;
-  size_t bufferSize;
-  const char* pm;
-
-  if (prefixSuffixIsHeaderFooter) {
-    /* we're just wrapping message with a header/footer */
-    numLines = 1;
-  } else {
-    pm = entry->message;
-    numLines = 0;
-
-    /*
-     * The line-end finding here must match the line-end finding
-     * in for ( ... numLines...) loop below
-     */
-    while (pm < (entry->message + entry->messageLen)) {
-      if (*pm++ == '\n') numLines++;
-    }
-    /* plus one line for anything not newline-terminated at the end */
-    if (pm > entry->message && *(pm - 1) != '\n') numLines++;
-  }
-
-  /*
-   * this is an upper bound--newlines in message may be counted
-   * extraneously
-   */
-  bufferSize = (numLines * (prefixLen + suffixLen)) + 1;
-  if (p_format->printable_output) {
-    /* Calculate extra length to convert non-printable to printable */
-    bufferSize += convertPrintable(NULL, entry->message, entry->messageLen);
-  } else {
-    bufferSize += entry->messageLen;
-  }
-
-  if (defaultBufferSize >= bufferSize) {
-    ret = defaultBuffer;
-  } else {
-    ret = (char*)malloc(bufferSize);
-
-    if (ret == NULL) {
-      return ret;
-    }
-  }
-
-  ret[0] = '\0'; /* to start strcat off */
-
-  p = ret;
-  pm = entry->message;
-
-  if (prefixSuffixIsHeaderFooter) {
-    strcat(p, prefixBuf);
-    p += prefixLen;
-    if (p_format->printable_output) {
-      p += convertPrintable(p, entry->message, entry->messageLen);
-    } else {
-      strncat(p, entry->message, entry->messageLen);
-      p += entry->messageLen;
-    }
-    strcat(p, suffixBuf);
-    p += suffixLen;
-  } else {
-    do {
-      const char* lineStart;
-      size_t lineLen;
-      lineStart = pm;
-
-      /* Find the next end-of-line in message */
-      while (pm < (entry->message + entry->messageLen) && *pm != '\n') pm++;
-      lineLen = pm - lineStart;
-
-      strcat(p, prefixBuf);
-      p += prefixLen;
-      if (p_format->printable_output) {
-        p += convertPrintable(p, lineStart, lineLen);
-      } else {
-        strncat(p, lineStart, lineLen);
-        p += lineLen;
-      }
-      strcat(p, suffixBuf);
-      p += suffixLen;
-
-      if (*pm == '\n') pm++;
-    } while (pm < (entry->message + entry->messageLen));
-  }
-
-  if (p_outLength != NULL) {
-    *p_outLength = p - ret;
-  }
-
-  return ret;
-}
-
-/**
- * Either print or do not print log line, based on filter
- *
- * Returns count bytes written
- */
-
-int android_log_printLogLine(AndroidLogFormat* p_format, int fd, const AndroidLogEntry* entry) {
-  int ret;
-  char defaultBuffer[512];
-  char* outBuffer = NULL;
-  size_t totalLen;
-
-  outBuffer =
-      android_log_formatLogLine(p_format, defaultBuffer, sizeof(defaultBuffer), entry, &totalLen);
-
-  if (!outBuffer) return -1;
-
-  do {
-    ret = write(fd, outBuffer, totalLen);
-  } while (ret < 0 && errno == EINTR);
-
-  if (ret < 0) {
-    fprintf(stderr, "+++ LOG: write failed (errno=%d)\n", errno);
-    ret = 0;
-    goto done;
-  }
-
-  if (((size_t)ret) < totalLen) {
-    fprintf(stderr, "+++ LOG: write partial (%d of %d)\n", ret, (int)totalLen);
-    goto done;
-  }
-
-done:
-  if (outBuffer != defaultBuffer) {
-    free(outBuffer);
-  }
-
-  return ret;
-}
diff --git a/liblog/pmsg_reader.cpp b/liblog/pmsg_reader.cpp
deleted file mode 100644
index 3bdc30f..0000000
--- a/liblog/pmsg_reader.cpp
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Copyright (C) 2007-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.
- */
-
-#include "pmsg_reader.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include <cutils/list.h>
-#include <private/android_logger.h>
-
-#include "logger.h"
-
-int PmsgRead(struct logger_list* logger_list, struct log_msg* log_msg) {
-  ssize_t ret;
-  off_t current, next;
-  struct __attribute__((__packed__)) {
-    android_pmsg_log_header_t p;
-    android_log_header_t l;
-    uint8_t prio;
-  } buf;
-  static uint8_t preread_count;
-
-  memset(log_msg, 0, sizeof(*log_msg));
-
-  if (atomic_load(&logger_list->fd) <= 0) {
-    int i, fd = open("/sys/fs/pstore/pmsg-ramoops-0", O_RDONLY | O_CLOEXEC);
-
-    if (fd < 0) {
-      return -errno;
-    }
-    if (fd == 0) { /* Argggg */
-      fd = open("/sys/fs/pstore/pmsg-ramoops-0", O_RDONLY | O_CLOEXEC);
-      close(0);
-      if (fd < 0) {
-        return -errno;
-      }
-    }
-    i = atomic_exchange(&logger_list->fd, fd);
-    if ((i > 0) && (i != fd)) {
-      close(i);
-    }
-    preread_count = 0;
-  }
-
-  while (1) {
-    int fd;
-
-    if (preread_count < sizeof(buf)) {
-      fd = atomic_load(&logger_list->fd);
-      if (fd <= 0) {
-        return -EBADF;
-      }
-      ret = TEMP_FAILURE_RETRY(read(fd, &buf.p.magic + preread_count, sizeof(buf) - preread_count));
-      if (ret < 0) {
-        return -errno;
-      }
-      preread_count += ret;
-    }
-    if (preread_count != sizeof(buf)) {
-      return preread_count ? -EIO : -EAGAIN;
-    }
-    if ((buf.p.magic != LOGGER_MAGIC) || (buf.p.len <= sizeof(buf)) ||
-        (buf.p.len > (sizeof(buf) + LOGGER_ENTRY_MAX_PAYLOAD)) || (buf.l.id >= LOG_ID_MAX) ||
-        (buf.l.realtime.tv_nsec >= NS_PER_SEC) ||
-        ((buf.l.id != LOG_ID_EVENTS) && (buf.l.id != LOG_ID_SECURITY) &&
-         ((buf.prio == ANDROID_LOG_UNKNOWN) || (buf.prio == ANDROID_LOG_DEFAULT) ||
-          (buf.prio >= ANDROID_LOG_SILENT)))) {
-      do {
-        memmove(&buf.p.magic, &buf.p.magic + 1, --preread_count);
-      } while (preread_count && (buf.p.magic != LOGGER_MAGIC));
-      continue;
-    }
-    preread_count = 0;
-
-    if ((logger_list->log_mask & (1 << buf.l.id)) &&
-        ((!logger_list->start.tv_sec && !logger_list->start.tv_nsec) ||
-         ((logger_list->start.tv_sec <= buf.l.realtime.tv_sec) &&
-          ((logger_list->start.tv_sec != buf.l.realtime.tv_sec) ||
-           (logger_list->start.tv_nsec <= buf.l.realtime.tv_nsec)))) &&
-        (!logger_list->pid || (logger_list->pid == buf.p.pid))) {
-      char* msg = reinterpret_cast<char*>(&log_msg->entry) + sizeof(log_msg->entry);
-      *msg = buf.prio;
-      fd = atomic_load(&logger_list->fd);
-      if (fd <= 0) {
-        return -EBADF;
-      }
-      ret = TEMP_FAILURE_RETRY(read(fd, msg + sizeof(buf.prio), buf.p.len - sizeof(buf)));
-      if (ret < 0) {
-        return -errno;
-      }
-      if (ret != (ssize_t)(buf.p.len - sizeof(buf))) {
-        return -EIO;
-      }
-
-      log_msg->entry.len = buf.p.len - sizeof(buf) + sizeof(buf.prio);
-      log_msg->entry.hdr_size = sizeof(log_msg->entry);
-      log_msg->entry.pid = buf.p.pid;
-      log_msg->entry.tid = buf.l.tid;
-      log_msg->entry.sec = buf.l.realtime.tv_sec;
-      log_msg->entry.nsec = buf.l.realtime.tv_nsec;
-      log_msg->entry.lid = buf.l.id;
-      log_msg->entry.uid = buf.p.uid;
-
-      return ret + sizeof(buf.prio) + log_msg->entry.hdr_size;
-    }
-
-    fd = atomic_load(&logger_list->fd);
-    if (fd <= 0) {
-      return -EBADF;
-    }
-    current = TEMP_FAILURE_RETRY(lseek(fd, (off_t)0, SEEK_CUR));
-    if (current < 0) {
-      return -errno;
-    }
-    fd = atomic_load(&logger_list->fd);
-    if (fd <= 0) {
-      return -EBADF;
-    }
-    next = TEMP_FAILURE_RETRY(lseek(fd, (off_t)(buf.p.len - sizeof(buf)), SEEK_CUR));
-    if (next < 0) {
-      return -errno;
-    }
-    if ((next - current) != (ssize_t)(buf.p.len - sizeof(buf))) {
-      return -EIO;
-    }
-  }
-}
-
-void PmsgClose(struct logger_list* logger_list) {
-  int fd = atomic_exchange(&logger_list->fd, 0);
-  if (fd > 0) {
-    close(fd);
-  }
-}
-
-static void* realloc_or_free(void* ptr, size_t new_size) {
-  void* result = realloc(ptr, new_size);
-  if (!result) {
-    free(ptr);
-  }
-  return result;
-}
-
-ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio, const char* prefix,
-                                     __android_log_pmsg_file_read_fn fn, void* arg) {
-  ssize_t ret;
-  struct logger_list logger_list;
-  struct content {
-    struct listnode node;
-    struct logger_entry entry;
-  } * content;
-  struct names {
-    struct listnode node;
-    struct listnode content;
-    log_id_t id;
-    char prio;
-    char name[];
-  } * names;
-  struct listnode name_list;
-  struct listnode *node, *n;
-  size_t len, prefix_len;
-
-  if (!fn) {
-    return -EINVAL;
-  }
-
-  /* Add just enough clues in logger_list and transp to make API function */
-  memset(&logger_list, 0, sizeof(logger_list));
-
-  logger_list.mode = ANDROID_LOG_PSTORE | ANDROID_LOG_NONBLOCK | ANDROID_LOG_RDONLY;
-  logger_list.log_mask = (unsigned)-1;
-  if (logId != LOG_ID_ANY) {
-    logger_list.log_mask = (1 << logId);
-  }
-  logger_list.log_mask &= ~((1 << LOG_ID_KERNEL) | (1 << LOG_ID_EVENTS) | (1 << LOG_ID_SECURITY));
-  if (!logger_list.log_mask) {
-    return -EINVAL;
-  }
-
-  /* Initialize name list */
-  list_init(&name_list);
-
-  ret = SSIZE_MAX;
-
-  /* Validate incoming prefix, shift until it contains only 0 or 1 : or / */
-  prefix_len = 0;
-  if (prefix) {
-    const char *prev = NULL, *last = NULL, *cp = prefix;
-    while ((cp = strpbrk(cp, "/:"))) {
-      prev = last;
-      last = cp;
-      cp = cp + 1;
-    }
-    if (prev) {
-      prefix = prev + 1;
-    }
-    prefix_len = strlen(prefix);
-  }
-
-  /* Read the file content */
-  log_msg log_msg;
-  while (PmsgRead(&logger_list, &log_msg) > 0) {
-    const char* cp;
-    size_t hdr_size = log_msg.entry.hdr_size;
-
-    char* msg = (char*)&log_msg + hdr_size;
-    const char* split = NULL;
-
-    if (hdr_size != sizeof(log_msg.entry)) {
-      continue;
-    }
-    /* Check for invalid sequence number */
-    if (log_msg.entry.nsec % ANDROID_LOG_PMSG_FILE_SEQUENCE ||
-        (log_msg.entry.nsec / ANDROID_LOG_PMSG_FILE_SEQUENCE) >=
-            ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE) {
-      continue;
-    }
-
-    /* Determine if it has <dirbase>:<filebase> format for tag */
-    len = log_msg.entry.len - sizeof(prio);
-    for (cp = msg + sizeof(prio); *cp && isprint(*cp) && !isspace(*cp) && --len; ++cp) {
-      if (*cp == ':') {
-        if (split) {
-          break;
-        }
-        split = cp;
-      }
-    }
-    if (*cp || !split) {
-      continue;
-    }
-
-    /* Filters */
-    if (prefix_len && strncmp(msg + sizeof(prio), prefix, prefix_len)) {
-      size_t offset;
-      /*
-       *   Allow : to be a synonym for /
-       * Things we do dealing with const char * and do not alloc
-       */
-      split = strchr(prefix, ':');
-      if (split) {
-        continue;
-      }
-      split = strchr(prefix, '/');
-      if (!split) {
-        continue;
-      }
-      offset = split - prefix;
-      if ((msg[offset + sizeof(prio)] != ':') || strncmp(msg + sizeof(prio), prefix, offset)) {
-        continue;
-      }
-      ++offset;
-      if ((prefix_len > offset) &&
-          strncmp(&msg[offset + sizeof(prio)], split + 1, prefix_len - offset)) {
-        continue;
-      }
-    }
-
-    if ((prio != ANDROID_LOG_ANY) && (*msg < prio)) {
-      continue;
-    }
-
-    /* check if there is an existing entry */
-    list_for_each(node, &name_list) {
-      names = node_to_item(node, struct names, node);
-      if (!strcmp(names->name, msg + sizeof(prio)) && names->id == log_msg.entry.lid &&
-          names->prio == *msg) {
-        break;
-      }
-    }
-
-    /* We do not have an existing entry, create and add one */
-    if (node == &name_list) {
-      static const char numbers[] = "0123456789";
-      unsigned long long nl;
-
-      len = strlen(msg + sizeof(prio)) + 1;
-      names = static_cast<struct names*>(calloc(1, sizeof(*names) + len));
-      if (!names) {
-        ret = -ENOMEM;
-        break;
-      }
-      strcpy(names->name, msg + sizeof(prio));
-      names->id = static_cast<log_id_t>(log_msg.entry.lid);
-      names->prio = *msg;
-      list_init(&names->content);
-      /*
-       * Insert in reverse numeric _then_ alpha sorted order as
-       * representative of log rotation:
-       *
-       *   log.10
-       *   klog.10
-       *   . . .
-       *   log.2
-       *   klog.2
-       *   log.1
-       *   klog.1
-       *   log
-       *   klog
-       *
-       * thus when we present the content, we are provided the oldest
-       * first, which when 'refreshed' could spill off the end of the
-       * pmsg FIFO but retaining the newest data for last with best
-       * chances to survive.
-       */
-      nl = 0;
-      cp = strpbrk(names->name, numbers);
-      if (cp) {
-        nl = strtoull(cp, NULL, 10);
-      }
-      list_for_each_reverse(node, &name_list) {
-        struct names* a_name = node_to_item(node, struct names, node);
-        const char* r = a_name->name;
-        int compare = 0;
-
-        unsigned long long nr = 0;
-        cp = strpbrk(r, numbers);
-        if (cp) {
-          nr = strtoull(cp, NULL, 10);
-        }
-        if (nr != nl) {
-          compare = (nl > nr) ? 1 : -1;
-        }
-        if (compare == 0) {
-          compare = strcmp(names->name, r);
-        }
-        if (compare <= 0) {
-          break;
-        }
-      }
-      list_add_head(node, &names->node);
-    }
-
-    /* Remove any file fragments that match our sequence number */
-    list_for_each_safe(node, n, &names->content) {
-      content = node_to_item(node, struct content, node);
-      if (log_msg.entry.nsec == content->entry.nsec) {
-        list_remove(&content->node);
-        free(content);
-      }
-    }
-
-    /* Add content */
-    content = static_cast<struct content*>(
-        calloc(1, sizeof(content->node) + hdr_size + log_msg.entry.len));
-    if (!content) {
-      ret = -ENOMEM;
-      break;
-    }
-    memcpy(&content->entry, &log_msg.entry, hdr_size + log_msg.entry.len);
-
-    /* Insert in sequence number sorted order, to ease reconstruction */
-    list_for_each_reverse(node, &names->content) {
-      if ((node_to_item(node, struct content, node))->entry.nsec < log_msg.entry.nsec) {
-        break;
-      }
-    }
-    list_add_head(node, &content->node);
-  }
-  PmsgClose(&logger_list);
-
-  /* Progress through all the collected files */
-  list_for_each_safe(node, n, &name_list) {
-    struct listnode *content_node, *m;
-    char* buf;
-    size_t sequence, tag_len;
-
-    names = node_to_item(node, struct names, node);
-
-    /* Construct content into a linear buffer */
-    buf = NULL;
-    len = 0;
-    sequence = 0;
-    tag_len = strlen(names->name) + sizeof(char); /* tag + nul */
-    list_for_each_safe(content_node, m, &names->content) {
-      ssize_t add_len;
-
-      content = node_to_item(content_node, struct content, node);
-      add_len = content->entry.len - tag_len - sizeof(prio);
-      if (add_len <= 0) {
-        list_remove(content_node);
-        free(content);
-        continue;
-      }
-
-      if (!buf) {
-        buf = static_cast<char*>(malloc(sizeof(char)));
-        if (!buf) {
-          ret = -ENOMEM;
-          list_remove(content_node);
-          free(content);
-          continue;
-        }
-        *buf = '\0';
-      }
-
-      /* Missing sequence numbers */
-      while (sequence < content->entry.nsec) {
-        /* plus space for enforced nul */
-        buf = static_cast<char*>(realloc_or_free(buf, len + sizeof(char) + sizeof(char)));
-        if (!buf) {
-          break;
-        }
-        buf[len] = '\f'; /* Mark missing content with a form feed */
-        buf[++len] = '\0';
-        sequence += ANDROID_LOG_PMSG_FILE_SEQUENCE;
-      }
-      if (!buf) {
-        ret = -ENOMEM;
-        list_remove(content_node);
-        free(content);
-        continue;
-      }
-      /* plus space for enforced nul */
-      buf = static_cast<char*>(realloc_or_free(buf, len + add_len + sizeof(char)));
-      if (!buf) {
-        ret = -ENOMEM;
-        list_remove(content_node);
-        free(content);
-        continue;
-      }
-      memcpy(buf + len, (char*)&content->entry + content->entry.hdr_size + tag_len + sizeof(prio),
-             add_len);
-      len += add_len;
-      buf[len] = '\0'; /* enforce trailing hidden nul */
-      sequence = content->entry.nsec + ANDROID_LOG_PMSG_FILE_SEQUENCE;
-
-      list_remove(content_node);
-      free(content);
-    }
-    if (buf) {
-      if (len) {
-        /* Buffer contains enforced trailing nul just beyond length */
-        ssize_t r;
-        *strchr(names->name, ':') = '/'; /* Convert back to filename */
-        r = (*fn)(names->id, names->prio, names->name, buf, len, arg);
-        if ((ret >= 0) && (r > 0)) {
-          if (ret == SSIZE_MAX) {
-            ret = r;
-          } else {
-            ret += r;
-          }
-        } else if (r < ret) {
-          ret = r;
-        }
-      }
-      free(buf);
-    }
-    list_remove(node);
-    free(names);
-  }
-  return (ret == SSIZE_MAX) ? -ENOENT : ret;
-}
diff --git a/liblog/pmsg_reader.h b/liblog/pmsg_reader.h
deleted file mode 100644
index b784f9f..0000000
--- a/liblog/pmsg_reader.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-#pragma once
-
-#include <sys/cdefs.h>
-#include <unistd.h>
-
-#include "log/log_read.h"
-
-__BEGIN_DECLS
-
-int PmsgRead(struct logger_list* logger_list, struct log_msg* log_msg);
-void PmsgClose(struct logger_list* logger_list);
-
-__END_DECLS
diff --git a/liblog/pmsg_writer.cpp b/liblog/pmsg_writer.cpp
deleted file mode 100644
index 0751e2c..0000000
--- a/liblog/pmsg_writer.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright (C) 2007-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.
- */
-
-#include "pmsg_writer.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <time.h>
-
-#include <log/log_properties.h>
-#include <private/android_logger.h>
-
-#include "logger.h"
-#include "uio.h"
-
-static atomic_int pmsg_fd;
-
-// pmsg_fd should only beopened once.  If we see that pmsg_fd is uninitialized, we open "/dev/pmsg0"
-// then attempt to compare/exchange it into pmsg_fd.  If the compare/exchange was successful, then
-// that will be the fd used for the duration of the program, otherwise a different thread has
-// already opened and written the fd to the atomic, so close the new fd and return.
-static void GetPmsgFd() {
-  if (pmsg_fd != 0) {
-    return;
-  }
-
-  int new_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-  if (new_fd <= 0) {
-    return;
-  }
-
-  int uninitialized_value = 0;
-  if (!pmsg_fd.compare_exchange_strong(uninitialized_value, new_fd)) {
-    close(new_fd);
-    return;
-  }
-}
-
-void PmsgClose() {
-  if (pmsg_fd > 0) {
-    close(pmsg_fd);
-  }
-  pmsg_fd = 0;
-}
-
-int PmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr) {
-  static const unsigned headerLength = 2;
-  struct iovec newVec[nr + headerLength];
-  android_log_header_t header;
-  android_pmsg_log_header_t pmsgHeader;
-  size_t i, payloadSize;
-  ssize_t ret;
-
-  if (!__android_log_is_debuggable()) {
-    if (logId != LOG_ID_EVENTS && logId != LOG_ID_SECURITY) {
-      return -1;
-    }
-
-    if (logId == LOG_ID_EVENTS) {
-      if (vec[0].iov_len < 4) {
-        return -EINVAL;
-      }
-
-      if (SNET_EVENT_LOG_TAG != *static_cast<uint32_t*>(vec[0].iov_base)) {
-        return -EPERM;
-      }
-    }
-  }
-
-  GetPmsgFd();
-
-  if (pmsg_fd <= 0) {
-    return -EBADF;
-  }
-
-  /*
-   *  struct {
-   *      // what we provide to pstore
-   *      android_pmsg_log_header_t pmsgHeader;
-   *      // what we provide to file
-   *      android_log_header_t header;
-   *      // caller provides
-   *      union {
-   *          struct {
-   *              char     prio;
-   *              char     payload[];
-   *          } string;
-   *          struct {
-   *              uint32_t tag
-   *              char     payload[];
-   *          } binary;
-   *      };
-   *  };
-   */
-
-  pmsgHeader.magic = LOGGER_MAGIC;
-  pmsgHeader.len = sizeof(pmsgHeader) + sizeof(header);
-  pmsgHeader.uid = getuid();
-  pmsgHeader.pid = getpid();
-
-  header.id = logId;
-  header.tid = gettid();
-  header.realtime.tv_sec = ts->tv_sec;
-  header.realtime.tv_nsec = ts->tv_nsec;
-
-  newVec[0].iov_base = (unsigned char*)&pmsgHeader;
-  newVec[0].iov_len = sizeof(pmsgHeader);
-  newVec[1].iov_base = (unsigned char*)&header;
-  newVec[1].iov_len = sizeof(header);
-
-  for (payloadSize = 0, i = headerLength; i < nr + headerLength; i++) {
-    newVec[i].iov_base = vec[i - headerLength].iov_base;
-    payloadSize += newVec[i].iov_len = vec[i - headerLength].iov_len;
-
-    if (payloadSize > LOGGER_ENTRY_MAX_PAYLOAD) {
-      newVec[i].iov_len -= payloadSize - LOGGER_ENTRY_MAX_PAYLOAD;
-      if (newVec[i].iov_len) {
-        ++i;
-      }
-      payloadSize = LOGGER_ENTRY_MAX_PAYLOAD;
-      break;
-    }
-  }
-  pmsgHeader.len += payloadSize;
-
-  ret = TEMP_FAILURE_RETRY(writev(pmsg_fd, newVec, i));
-  if (ret < 0) {
-    ret = errno ? -errno : -ENOTCONN;
-  }
-
-  if (ret > (ssize_t)(sizeof(header) + sizeof(pmsgHeader))) {
-    ret -= sizeof(header) - sizeof(pmsgHeader);
-  }
-
-  return ret;
-}
-
-/*
- * Virtual pmsg filesystem
- *
- * Payload will comprise the string "<basedir>:<basefile>\0<content>" to a
- * maximum of LOGGER_ENTRY_MAX_PAYLOAD, but scaled to the last newline in the
- * file.
- *
- * Will hijack the header.realtime.tv_nsec field for a sequence number in usec.
- */
-
-static inline const char* strnrchr(const char* buf, size_t len, char c) {
-  const char* cp = buf + len;
-  while ((--cp > buf) && (*cp != c))
-    ;
-  if (cp <= buf) {
-    return buf + len;
-  }
-  return cp;
-}
-
-/* Write a buffer as filename references (tag = <basedir>:<basename>) */
-ssize_t __android_log_pmsg_file_write(log_id_t logId, char prio, const char* filename,
-                                      const char* buf, size_t len) {
-  size_t length, packet_len;
-  const char* tag;
-  char *cp, *slash;
-  struct timespec ts;
-  struct iovec vec[3];
-
-  /* Make sure the logId value is not a bad idea */
-  if ((logId == LOG_ID_KERNEL) ||   /* Verbotten */
-      (logId == LOG_ID_EVENTS) ||   /* Do not support binary content */
-      (logId == LOG_ID_SECURITY) || /* Bad idea to allow */
-      ((unsigned)logId >= 32)) {    /* fit within logMask on arch32 */
-    return -EINVAL;
-  }
-
-  clock_gettime(android_log_clockid(), &ts);
-
-  cp = strdup(filename);
-  if (!cp) {
-    return -ENOMEM;
-  }
-
-  tag = cp;
-  slash = strrchr(cp, '/');
-  if (slash) {
-    *slash = ':';
-    slash = strrchr(cp, '/');
-    if (slash) {
-      tag = slash + 1;
-    }
-  }
-
-  length = strlen(tag) + 1;
-  packet_len = LOGGER_ENTRY_MAX_PAYLOAD - sizeof(char) - length;
-
-  vec[0].iov_base = &prio;
-  vec[0].iov_len = sizeof(char);
-  vec[1].iov_base = (unsigned char*)tag;
-  vec[1].iov_len = length;
-
-  for (ts.tv_nsec = 0, length = len; length; ts.tv_nsec += ANDROID_LOG_PMSG_FILE_SEQUENCE) {
-    ssize_t ret;
-    size_t transfer;
-
-    if ((ts.tv_nsec / ANDROID_LOG_PMSG_FILE_SEQUENCE) >= ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE) {
-      len -= length;
-      break;
-    }
-
-    transfer = length;
-    if (transfer > packet_len) {
-      transfer = strnrchr(buf, packet_len - 1, '\n') - buf;
-      if ((transfer < length) && (buf[transfer] == '\n')) {
-        ++transfer;
-      }
-    }
-
-    vec[2].iov_base = (unsigned char*)buf;
-    vec[2].iov_len = transfer;
-
-    ret = PmsgWrite(logId, &ts, vec, sizeof(vec) / sizeof(vec[0]));
-
-    if (ret <= 0) {
-      free(cp);
-      return ret ? ret : (len - length);
-    }
-    length -= transfer;
-    buf += transfer;
-  }
-  free(cp);
-  return len;
-}
diff --git a/liblog/pmsg_writer.h b/liblog/pmsg_writer.h
deleted file mode 100644
index d5e1a1c..0000000
--- a/liblog/pmsg_writer.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-
-#include <android/log.h>
-
-int PmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
-void PmsgClose();
diff --git a/liblog/properties.cpp b/liblog/properties.cpp
deleted file mode 100644
index 37670ec..0000000
--- a/liblog/properties.cpp
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
-** Copyright 2014, 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.
-*/
-
-#include <log/log_properties.h>
-
-#include <ctype.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <algorithm>
-
-#include <private/android_logger.h>
-
-#include "logger_write.h"
-
-#ifdef __ANDROID__
-#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
-#include <sys/_system_properties.h>
-
-static pthread_mutex_t lock_loggable = PTHREAD_MUTEX_INITIALIZER;
-
-static int lock() {
-  /*
-   * If we trigger a signal handler in the middle of locked activity and the
-   * signal handler logs a message, we could get into a deadlock state.
-   */
-  /*
-   *  Any contention, and we can turn around and use the non-cached method
-   * in less time than the system call associated with a mutex to deal with
-   * the contention.
-   */
-  return pthread_mutex_trylock(&lock_loggable);
-}
-
-static void unlock() {
-  pthread_mutex_unlock(&lock_loggable);
-}
-
-struct cache {
-  const prop_info* pinfo;
-  uint32_t serial;
-};
-
-struct cache_char {
-  struct cache cache;
-  unsigned char c;
-};
-
-static int check_cache(struct cache* cache) {
-  return cache->pinfo && __system_property_serial(cache->pinfo) != cache->serial;
-}
-
-#define BOOLEAN_TRUE 0xFF
-#define BOOLEAN_FALSE 0xFE
-
-static void refresh_cache(struct cache_char* cache, const char* key) {
-  char buf[PROP_VALUE_MAX];
-
-  if (!cache->cache.pinfo) {
-    cache->cache.pinfo = __system_property_find(key);
-    if (!cache->cache.pinfo) {
-      return;
-    }
-  }
-  cache->cache.serial = __system_property_serial(cache->cache.pinfo);
-  __system_property_read(cache->cache.pinfo, 0, buf);
-  switch (buf[0]) {
-    case 't':
-    case 'T':
-      cache->c = strcasecmp(buf + 1, "rue") ? buf[0] : BOOLEAN_TRUE;
-      break;
-    case 'f':
-    case 'F':
-      cache->c = strcasecmp(buf + 1, "alse") ? buf[0] : BOOLEAN_FALSE;
-      break;
-    default:
-      cache->c = buf[0];
-  }
-}
-
-static int __android_log_level(const char* tag, size_t len) {
-  /* sizeof() is used on this array below */
-  static const char log_namespace[] = "persist.log.tag.";
-  static const size_t base_offset = 8; /* skip "persist." */
-
-  if (tag == nullptr || len == 0) {
-    auto& tag_string = GetDefaultTag();
-    tag = tag_string.c_str();
-    len = tag_string.size();
-  }
-
-  /* sizeof(log_namespace) = strlen(log_namespace) + 1 */
-  char key[sizeof(log_namespace) + len];
-  char* kp;
-  size_t i;
-  char c = 0;
-  /*
-   * Single layer cache of four properties. Priorities are:
-   *    log.tag.<tag>
-   *    persist.log.tag.<tag>
-   *    log.tag
-   *    persist.log.tag
-   * Where the missing tag matches all tags and becomes the
-   * system global default. We do not support ro.log.tag* .
-   */
-  static char* last_tag;
-  static size_t last_tag_len;
-  static uint32_t global_serial;
-  /* some compilers erroneously see uninitialized use. !not_locked */
-  uint32_t current_global_serial = 0;
-  static struct cache_char tag_cache[2];
-  static struct cache_char global_cache[2];
-  int change_detected;
-  int global_change_detected;
-  int not_locked;
-
-  strcpy(key, log_namespace);
-
-  global_change_detected = change_detected = not_locked = lock();
-
-  if (!not_locked) {
-    /*
-     *  check all known serial numbers to changes.
-     */
-    for (i = 0; i < (sizeof(tag_cache) / sizeof(tag_cache[0])); ++i) {
-      if (check_cache(&tag_cache[i].cache)) {
-        change_detected = 1;
-      }
-    }
-    for (i = 0; i < (sizeof(global_cache) / sizeof(global_cache[0])); ++i) {
-      if (check_cache(&global_cache[i].cache)) {
-        global_change_detected = 1;
-      }
-    }
-
-    current_global_serial = __system_property_area_serial();
-    if (current_global_serial != global_serial) {
-      change_detected = 1;
-      global_change_detected = 1;
-    }
-  }
-
-  if (len) {
-    int local_change_detected = change_detected;
-    if (!not_locked) {
-      if (!last_tag || !last_tag[0] || (last_tag[0] != tag[0]) ||
-          strncmp(last_tag + 1, tag + 1, last_tag_len - 1)) {
-        /* invalidate log.tag.<tag> cache */
-        for (i = 0; i < (sizeof(tag_cache) / sizeof(tag_cache[0])); ++i) {
-          tag_cache[i].cache.pinfo = NULL;
-          tag_cache[i].c = '\0';
-        }
-        if (last_tag) last_tag[0] = '\0';
-        local_change_detected = 1;
-      }
-      if (!last_tag || !last_tag[0]) {
-        if (!last_tag) {
-          last_tag = static_cast<char*>(calloc(1, len + 1));
-          last_tag_len = 0;
-          if (last_tag) last_tag_len = len + 1;
-        } else if (len >= last_tag_len) {
-          last_tag = static_cast<char*>(realloc(last_tag, len + 1));
-          last_tag_len = 0;
-          if (last_tag) last_tag_len = len + 1;
-        }
-        if (last_tag) {
-          strncpy(last_tag, tag, len);
-          last_tag[len] = '\0';
-        }
-      }
-    }
-    strncpy(key + sizeof(log_namespace) - 1, tag, len);
-    key[sizeof(log_namespace) - 1 + len] = '\0';
-
-    kp = key;
-    for (i = 0; i < (sizeof(tag_cache) / sizeof(tag_cache[0])); ++i) {
-      struct cache_char* cache = &tag_cache[i];
-      struct cache_char temp_cache;
-
-      if (not_locked) {
-        temp_cache.cache.pinfo = NULL;
-        temp_cache.c = '\0';
-        cache = &temp_cache;
-      }
-      if (local_change_detected) {
-        refresh_cache(cache, kp);
-      }
-
-      if (cache->c) {
-        c = cache->c;
-        break;
-      }
-
-      kp = key + base_offset;
-    }
-  }
-
-  switch (toupper(c)) { /* if invalid, resort to global */
-    case 'V':
-    case 'D':
-    case 'I':
-    case 'W':
-    case 'E':
-    case 'F': /* Not officially supported */
-    case 'A':
-    case 'S':
-    case BOOLEAN_FALSE: /* Not officially supported */
-      break;
-    default:
-      /* clear '.' after log.tag */
-      key[sizeof(log_namespace) - 2] = '\0';
-
-      kp = key;
-      for (i = 0; i < (sizeof(global_cache) / sizeof(global_cache[0])); ++i) {
-        struct cache_char* cache = &global_cache[i];
-        struct cache_char temp_cache;
-
-        if (not_locked) {
-          temp_cache = *cache;
-          if (temp_cache.cache.pinfo != cache->cache.pinfo) { /* check atomic */
-            temp_cache.cache.pinfo = NULL;
-            temp_cache.c = '\0';
-          }
-          cache = &temp_cache;
-        }
-        if (global_change_detected) {
-          refresh_cache(cache, kp);
-        }
-
-        if (cache->c) {
-          c = cache->c;
-          break;
-        }
-
-        kp = key + base_offset;
-      }
-      break;
-  }
-
-  if (!not_locked) {
-    global_serial = current_global_serial;
-    unlock();
-  }
-
-  switch (toupper(c)) {
-    /* clang-format off */
-    case 'V': return ANDROID_LOG_VERBOSE;
-    case 'D': return ANDROID_LOG_DEBUG;
-    case 'I': return ANDROID_LOG_INFO;
-    case 'W': return ANDROID_LOG_WARN;
-    case 'E': return ANDROID_LOG_ERROR;
-    case 'F': /* FALLTHRU */ /* Not officially supported */
-    case 'A': return ANDROID_LOG_FATAL;
-    case BOOLEAN_FALSE: /* FALLTHRU */ /* Not Officially supported */
-    case 'S': return ANDROID_LOG_SILENT;
-      /* clang-format on */
-  }
-  return -1;
-}
-
-int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio) {
-  int minimum_log_priority = __android_log_get_minimum_priority();
-  int property_log_level = __android_log_level(tag, len);
-
-  if (property_log_level >= 0 && minimum_log_priority != ANDROID_LOG_DEFAULT) {
-    return prio >= std::min(property_log_level, minimum_log_priority);
-  } else if (property_log_level >= 0) {
-    return prio >= property_log_level;
-  } else if (minimum_log_priority != ANDROID_LOG_DEFAULT) {
-    return prio >= minimum_log_priority;
-  } else {
-    return prio >= default_prio;
-  }
-}
-
-int __android_log_is_loggable(int prio, const char* tag, int default_prio) {
-  auto len = tag ? strlen(tag) : 0;
-  return __android_log_is_loggable_len(prio, tag, len, default_prio);
-}
-
-int __android_log_is_debuggable() {
-  static uint32_t serial;
-  static struct cache_char tag_cache;
-  static const char key[] = "ro.debuggable";
-  int ret;
-
-  if (tag_cache.c) { /* ro property does not change after set */
-    ret = tag_cache.c == '1';
-  } else if (lock()) {
-    struct cache_char temp_cache = {{NULL, 0xFFFFFFFF}, '\0'};
-    refresh_cache(&temp_cache, key);
-    ret = temp_cache.c == '1';
-  } else {
-    int change_detected = check_cache(&tag_cache.cache);
-    uint32_t current_serial = __system_property_area_serial();
-    if (current_serial != serial) {
-      change_detected = 1;
-    }
-    if (change_detected) {
-      refresh_cache(&tag_cache, key);
-      serial = current_serial;
-    }
-    ret = tag_cache.c == '1';
-
-    unlock();
-  }
-
-  return ret;
-}
-
-/*
- * For properties that are read often, but generally remain constant.
- * Since a change is rare, we will accept a trylock failure gracefully.
- * Use a separate lock from is_loggable to keep contention down b/25563384.
- */
-struct cache2_char {
-  pthread_mutex_t lock;
-  uint32_t serial;
-  const char* key_persist;
-  struct cache_char cache_persist;
-  const char* key_ro;
-  struct cache_char cache_ro;
-  unsigned char (*const evaluate)(const struct cache2_char* self);
-};
-
-static inline unsigned char do_cache2_char(struct cache2_char* self) {
-  uint32_t current_serial;
-  int change_detected;
-  unsigned char c;
-
-  if (pthread_mutex_trylock(&self->lock)) {
-    /* We are willing to accept some race in this context */
-    return self->evaluate(self);
-  }
-
-  change_detected = check_cache(&self->cache_persist.cache) || check_cache(&self->cache_ro.cache);
-  current_serial = __system_property_area_serial();
-  if (current_serial != self->serial) {
-    change_detected = 1;
-  }
-  if (change_detected) {
-    refresh_cache(&self->cache_persist, self->key_persist);
-    refresh_cache(&self->cache_ro, self->key_ro);
-    self->serial = current_serial;
-  }
-  c = self->evaluate(self);
-
-  pthread_mutex_unlock(&self->lock);
-
-  return c;
-}
-
-static unsigned char evaluate_persist_ro(const struct cache2_char* self) {
-  unsigned char c = self->cache_persist.c;
-
-  if (c) {
-    return c;
-  }
-
-  return self->cache_ro.c;
-}
-
-/*
- * Timestamp state generally remains constant, but can change at any time
- * to handle developer requirements.
- */
-clockid_t android_log_clockid() {
-  static struct cache2_char clockid = {PTHREAD_MUTEX_INITIALIZER, 0,
-                                       "persist.logd.timestamp",  {{NULL, 0xFFFFFFFF}, '\0'},
-                                       "ro.logd.timestamp",       {{NULL, 0xFFFFFFFF}, '\0'},
-                                       evaluate_persist_ro};
-
-  return (tolower(do_cache2_char(&clockid)) == 'm') ? CLOCK_MONOTONIC : CLOCK_REALTIME;
-}
-
-/*
- * Security state generally remains constant, but the DO must be able
- * to turn off logging should it become spammy after an attack is detected.
- */
-static unsigned char evaluate_security(const struct cache2_char* self) {
-  unsigned char c = self->cache_ro.c;
-
-  return (c != BOOLEAN_FALSE) && c && (self->cache_persist.c == BOOLEAN_TRUE);
-}
-
-int __android_log_security() {
-  static struct cache2_char security = {
-      PTHREAD_MUTEX_INITIALIZER, 0,
-      "persist.logd.security",   {{NULL, 0xFFFFFFFF}, BOOLEAN_FALSE},
-      "ro.organization_owned",   {{NULL, 0xFFFFFFFF}, BOOLEAN_FALSE},
-      evaluate_security};
-
-  return do_cache2_char(&security);
-}
-
-/*
- * Interface that represents the logd buffer size determination so that others
- * need not guess our intentions.
- */
-
-/* Property helper */
-static bool check_flag(const char* prop, const char* flag) {
-  const char* cp = strcasestr(prop, flag);
-  if (!cp) {
-    return false;
-  }
-  /* We only will document comma (,) */
-  static const char sep[] = ",:;|+ \t\f";
-  if ((cp != prop) && !strchr(sep, cp[-1])) {
-    return false;
-  }
-  cp += strlen(flag);
-  return !*cp || !!strchr(sep, *cp);
-}
-
-/* cache structure */
-struct cache_property {
-  struct cache cache;
-  char property[PROP_VALUE_MAX];
-};
-
-static void refresh_cache_property(struct cache_property* cache, const char* key) {
-  if (!cache->cache.pinfo) {
-    cache->cache.pinfo = __system_property_find(key);
-    if (!cache->cache.pinfo) {
-      return;
-    }
-  }
-  cache->cache.serial = __system_property_serial(cache->cache.pinfo);
-  __system_property_read(cache->cache.pinfo, 0, cache->property);
-}
-
-/* get boolean with the logger twist that supports eng adjustments */
-bool __android_logger_property_get_bool(const char* key, int flag) {
-  struct cache_property property = {{NULL, 0xFFFFFFFF}, {0}};
-  if (flag & BOOL_DEFAULT_FLAG_PERSIST) {
-    char newkey[strlen("persist.") + strlen(key) + 1];
-    snprintf(newkey, sizeof(newkey), "ro.%s", key);
-    refresh_cache_property(&property, newkey);
-    property.cache.pinfo = NULL;
-    property.cache.serial = 0xFFFFFFFF;
-    snprintf(newkey, sizeof(newkey), "persist.%s", key);
-    refresh_cache_property(&property, newkey);
-    property.cache.pinfo = NULL;
-    property.cache.serial = 0xFFFFFFFF;
-  }
-
-  refresh_cache_property(&property, key);
-
-  if (check_flag(property.property, "true")) {
-    return true;
-  }
-  if (check_flag(property.property, "false")) {
-    return false;
-  }
-  if (property.property[0]) {
-    flag &= ~(BOOL_DEFAULT_FLAG_ENG | BOOL_DEFAULT_FLAG_SVELTE);
-  }
-  if (check_flag(property.property, "eng")) {
-    flag |= BOOL_DEFAULT_FLAG_ENG;
-  }
-  /* this is really a "not" flag */
-  if (check_flag(property.property, "svelte")) {
-    flag |= BOOL_DEFAULT_FLAG_SVELTE;
-  }
-
-  /* Sanity Check */
-  if (flag & (BOOL_DEFAULT_FLAG_SVELTE | BOOL_DEFAULT_FLAG_ENG)) {
-    flag &= ~BOOL_DEFAULT_FLAG_TRUE_FALSE;
-    flag |= BOOL_DEFAULT_TRUE;
-  }
-
-  if ((flag & BOOL_DEFAULT_FLAG_SVELTE) &&
-      __android_logger_property_get_bool("ro.config.low_ram", BOOL_DEFAULT_FALSE)) {
-    return false;
-  }
-  if ((flag & BOOL_DEFAULT_FLAG_ENG) && !__android_log_is_debuggable()) {
-    return false;
-  }
-
-  return (flag & BOOL_DEFAULT_FLAG_TRUE_FALSE) != BOOL_DEFAULT_FALSE;
-}
-
-bool __android_logger_valid_buffer_size(unsigned long value) {
-  static long pages, pagesize;
-  unsigned long maximum;
-
-  if ((value < LOG_BUFFER_MIN_SIZE) || (LOG_BUFFER_MAX_SIZE < value)) {
-    return false;
-  }
-
-  if (!pages) {
-    pages = sysconf(_SC_PHYS_PAGES);
-  }
-  if (pages < 1) {
-    return true;
-  }
-
-  if (!pagesize) {
-    pagesize = sysconf(_SC_PAGESIZE);
-    if (pagesize <= 1) {
-      pagesize = PAGE_SIZE;
-    }
-  }
-
-  /* maximum memory impact a somewhat arbitrary ~3% */
-  pages = (pages + 31) / 32;
-  maximum = pages * pagesize;
-
-  if ((maximum < LOG_BUFFER_MIN_SIZE) || (LOG_BUFFER_MAX_SIZE < maximum)) {
-    return true;
-  }
-
-  return value <= maximum;
-}
-
-struct cache2_property_size {
-  pthread_mutex_t lock;
-  uint32_t serial;
-  const char* key_persist;
-  struct cache_property cache_persist;
-  const char* key_ro;
-  struct cache_property cache_ro;
-  unsigned long (*const evaluate)(const struct cache2_property_size* self);
-};
-
-static inline unsigned long do_cache2_property_size(struct cache2_property_size* self) {
-  uint32_t current_serial;
-  int change_detected;
-  unsigned long v;
-
-  if (pthread_mutex_trylock(&self->lock)) {
-    /* We are willing to accept some race in this context */
-    return self->evaluate(self);
-  }
-
-  change_detected = check_cache(&self->cache_persist.cache) || check_cache(&self->cache_ro.cache);
-  current_serial = __system_property_area_serial();
-  if (current_serial != self->serial) {
-    change_detected = 1;
-  }
-  if (change_detected) {
-    refresh_cache_property(&self->cache_persist, self->key_persist);
-    refresh_cache_property(&self->cache_ro, self->key_ro);
-    self->serial = current_serial;
-  }
-  v = self->evaluate(self);
-
-  pthread_mutex_unlock(&self->lock);
-
-  return v;
-}
-
-static unsigned long property_get_size_from_cache(const struct cache_property* cache) {
-  char* cp;
-  unsigned long value = strtoul(cache->property, &cp, 10);
-
-  switch (*cp) {
-    case 'm':
-    case 'M':
-      value *= 1024;
-      [[fallthrough]];
-    case 'k':
-    case 'K':
-      value *= 1024;
-      [[fallthrough]];
-    case '\0':
-      break;
-
-    default:
-      value = 0;
-  }
-
-  if (!__android_logger_valid_buffer_size(value)) {
-    value = 0;
-  }
-
-  return value;
-}
-
-static unsigned long evaluate_property_get_size(const struct cache2_property_size* self) {
-  unsigned long size = property_get_size_from_cache(&self->cache_persist);
-  if (size) {
-    return size;
-  }
-  return property_get_size_from_cache(&self->cache_ro);
-}
-
-unsigned long __android_logger_get_buffer_size(log_id_t logId) {
-  static const char global_tunable[] = "persist.logd.size"; /* Settings App */
-  static const char global_default[] = "ro.logd.size";      /* BoardConfig.mk */
-  static struct cache2_property_size global = {
-      /* clang-format off */
-    PTHREAD_MUTEX_INITIALIZER, 0,
-    global_tunable, { { NULL, 0xFFFFFFFF }, {} },
-    global_default, { { NULL, 0xFFFFFFFF }, {} },
-    evaluate_property_get_size
-      /* clang-format on */
-  };
-  char key_persist[strlen(global_tunable) + strlen(".security") + 1];
-  char key_ro[strlen(global_default) + strlen(".security") + 1];
-  struct cache2_property_size local = {
-      /* clang-format off */
-    PTHREAD_MUTEX_INITIALIZER, 0,
-    key_persist, { { NULL, 0xFFFFFFFF }, {} },
-    key_ro,      { { NULL, 0xFFFFFFFF }, {} },
-    evaluate_property_get_size
-      /* clang-format on */
-  };
-  unsigned long property_size, default_size;
-
-  default_size = do_cache2_property_size(&global);
-  if (!default_size) {
-    default_size = __android_logger_property_get_bool("ro.config.low_ram", BOOL_DEFAULT_FALSE)
-                       ? LOG_BUFFER_MIN_SIZE /* 64K  */
-                       : LOG_BUFFER_SIZE;    /* 256K */
-  }
-
-  snprintf(key_persist, sizeof(key_persist), "%s.%s", global_tunable,
-           android_log_id_to_name(logId));
-  snprintf(key_ro, sizeof(key_ro), "%s.%s", global_default, android_log_id_to_name(logId));
-  property_size = do_cache2_property_size(&local);
-
-  if (!property_size) {
-    property_size = default_size;
-  }
-
-  if (!property_size) {
-    property_size = LOG_BUFFER_SIZE;
-  }
-
-  return property_size;
-}
-
-#else
-
-int __android_log_is_loggable(int prio, const char*, int) {
-  int minimum_priority = __android_log_get_minimum_priority();
-  if (minimum_priority == ANDROID_LOG_DEFAULT) {
-    minimum_priority = ANDROID_LOG_INFO;
-  }
-  return prio >= minimum_priority;
-}
-
-int __android_log_is_loggable_len(int prio, const char*, size_t, int def) {
-  return __android_log_is_loggable(prio, nullptr, def);
-}
-
-int __android_log_is_debuggable() {
-  return 1;
-}
-
-#endif
\ No newline at end of file
diff --git a/liblog/tests/Android.bp b/liblog/tests/Android.bp
deleted file mode 100644
index 50800c5..0000000
--- a/liblog/tests/Android.bp
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Copyright (C) 2013-2014 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.
-//
-
-// -----------------------------------------------------------------------------
-// Benchmarks.
-// -----------------------------------------------------------------------------
-
-// Build benchmarks for the device. Run with:
-//   adb shell liblog-benchmarks
-cc_benchmark {
-    name: "liblog-benchmarks",
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-fno-builtin",
-    ],
-    shared_libs: [
-        "libm",
-        "libbase",
-        "libcutils",
-    ],
-    static_libs: ["liblog"],
-    srcs: ["liblog_benchmark.cpp"],
-}
-
-// -----------------------------------------------------------------------------
-// Unit tests.
-// -----------------------------------------------------------------------------
-
-cc_defaults {
-    name: "liblog-tests-defaults",
-
-    cflags: [
-        "-fstack-protector-all",
-        "-g",
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-fno-builtin",
-    ],
-    srcs: [
-        "libc_test.cpp",
-        "liblog_default_tag.cpp",
-        "liblog_global_state.cpp",
-        "liblog_test.cpp",
-        "log_id_test.cpp",
-        "log_radio_test.cpp",
-        "log_read_test.cpp",
-        "log_system_test.cpp",
-        "log_time_test.cpp",
-        "log_wrap_test.cpp",
-        "logd_writer_test.cpp",
-        "logprint_test.cpp",
-    ],
-    shared_libs: [
-        "libcutils",
-        "libbase",
-    ],
-    static_libs: ["liblog"],
-    isolated: true,
-}
-
-// Build tests for the device (with .so). Run with:
-//   adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests
-cc_test {
-    name: "liblog-unit-tests",
-    defaults: ["liblog-tests-defaults"],
-}
-
-cc_test {
-    name: "CtsLiblogTestCases",
-    defaults: ["liblog-tests-defaults"],
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-
-    cflags: ["-DNO_PSTORE"],
-    test_suites: [
-        "cts",
-        "vts10",
-    ],
-}
-
-cc_test_host {
-    name: "liblog-host-test",
-    static_libs: ["liblog"],
-    shared_libs: ["libbase"],
-    srcs: [
-        "liblog_host_test.cpp",
-        "liblog_default_tag.cpp",
-        "liblog_global_state.cpp",
-    ],
-    isolated: true,
-}
diff --git a/liblog/tests/AndroidTest.xml b/liblog/tests/AndroidTest.xml
deleted file mode 100644
index fcb46b1..0000000
--- a/liblog/tests/AndroidTest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<configuration description="Config for CTS Logging Library test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-        <option name="cleanup" value="true" />
-        <option name="push" value="CtsLiblogTestCases->/data/local/tmp/CtsLiblogTestCases" />
-        <option name="append-bitness" value="true" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="CtsLiblogTestCases" />
-        <option name="runtime-hint" value="65s" />
-    </test>
-</configuration>
diff --git a/liblog/tests/libc_test.cpp b/liblog/tests/libc_test.cpp
deleted file mode 100644
index 3534eb8..0000000
--- a/liblog/tests/libc_test.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <errno.h>
-#include <stdio.h>
-
-TEST(libc, __pstore_append) {
-#ifdef __ANDROID__
-#ifndef NO_PSTORE
-  FILE* fp;
-  ASSERT_TRUE(NULL != (fp = fopen("/dev/pmsg0", "ae")));
-  static const char message[] = "libc.__pstore_append\n";
-  ASSERT_EQ((size_t)1, fwrite(message, sizeof(message), 1, fp));
-  int fflushReturn = fflush(fp);
-  int fflushErrno = fflushReturn ? errno : 0;
-  ASSERT_EQ(0, fflushReturn);
-  ASSERT_EQ(0, fflushErrno);
-  int fcloseReturn = fclose(fp);
-  int fcloseErrno = fcloseReturn ? errno : 0;
-  ASSERT_EQ(0, fcloseReturn);
-  ASSERT_EQ(0, fcloseErrno);
-  if ((fcloseErrno == ENOMEM) || (fflushErrno == ENOMEM)) {
-    fprintf(stderr,
-            "Kernel does not have space allocated to pmsg pstore driver "
-            "configured\n");
-  }
-  if (!fcloseReturn && !fcloseErrno && !fflushReturn && !fflushReturn) {
-    fprintf(stderr,
-            "Reboot, ensure string libc.__pstore_append is in "
-            "/sys/fs/pstore/pmsg-ramoops-0\n");
-  }
-#else  /* NO_PSTORE */
-  GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n";
-#endif /* NO_PSTORE */
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp
deleted file mode 100644
index 39ac7a5..0000000
--- a/liblog/tests/liblog_benchmark.cpp
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*
- * Copyright (C) 2013-2014 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.
- */
-
-#include <fcntl.h>
-#include <inttypes.h>
-#include <poll.h>
-#include <sched.h>
-#include <sys/socket.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-#include <unordered_set>
-
-#include <android-base/file.h>
-#include <benchmark/benchmark.h>
-#include <cutils/sockets.h>
-#include <log/event_tag_map.h>
-#include <private/android_logger.h>
-
-BENCHMARK_MAIN();
-
-// enhanced version of LOG_FAILURE_RETRY to add support for EAGAIN and
-// non-syscall libs. Since we are benchmarking, or using this in the emergency
-// signal to stuff a terminating code, we do NOT want to introduce
-// a syscall or usleep on EAGAIN retry.
-#define LOG_FAILURE_RETRY(exp)                                           \
-  ({                                                                     \
-    typeof(exp) _rc;                                                     \
-    do {                                                                 \
-      _rc = (exp);                                                       \
-    } while (((_rc == -1) && ((errno == EINTR) || (errno == EAGAIN))) || \
-             (_rc == -EINTR) || (_rc == -EAGAIN));                       \
-    _rc;                                                                 \
-  })
-
-/*
- *	Measure the fastest rate we can reliabley stuff print messages into
- * the log at high pressure. Expect this to be less than double the process
- * wakeup time (2ms?)
- */
-static void BM_log_maximum_retry(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    LOG_FAILURE_RETRY(__android_log_print(ANDROID_LOG_INFO, "BM_log_maximum_retry", "%" PRIu64,
-                                          state.iterations()));
-  }
-}
-BENCHMARK(BM_log_maximum_retry);
-
-/*
- *	Measure the fastest rate we can stuff print messages into the log
- * at high pressure. Expect this to be less than double the process wakeup
- * time (2ms?)
- */
-static void BM_log_maximum(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    __android_log_print(ANDROID_LOG_INFO, "BM_log_maximum", "%" PRIu64, state.iterations());
-  }
-}
-BENCHMARK(BM_log_maximum);
-
-/*
- *	Measure the time it takes to collect the time using
- * discrete acquisition (state.PauseTiming() to state.ResumeTiming())
- * under light load. Expect this to be a syscall period (2us) or
- * data read time if zero-syscall.
- *
- * vdso support in the kernel and the library can allow
- * clock_gettime to be zero-syscall, but there there does remain some
- * benchmarking overhead to pause and resume; assumptions are both are
- * covered.
- */
-static void BM_clock_overhead(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    state.PauseTiming();
-    state.ResumeTiming();
-  }
-}
-BENCHMARK(BM_clock_overhead);
-
-static void do_clock_overhead(benchmark::State& state, clockid_t clk_id) {
-  timespec t;
-  while (state.KeepRunning()) {
-    clock_gettime(clk_id, &t);
-  }
-}
-
-static void BM_time_clock_gettime_REALTIME(benchmark::State& state) {
-  do_clock_overhead(state, CLOCK_REALTIME);
-}
-BENCHMARK(BM_time_clock_gettime_REALTIME);
-
-static void BM_time_clock_gettime_MONOTONIC(benchmark::State& state) {
-  do_clock_overhead(state, CLOCK_MONOTONIC);
-}
-BENCHMARK(BM_time_clock_gettime_MONOTONIC);
-
-static void BM_time_clock_gettime_MONOTONIC_syscall(benchmark::State& state) {
-  timespec t;
-  while (state.KeepRunning()) {
-    syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &t);
-  }
-}
-BENCHMARK(BM_time_clock_gettime_MONOTONIC_syscall);
-
-static void BM_time_clock_gettime_MONOTONIC_RAW(benchmark::State& state) {
-  do_clock_overhead(state, CLOCK_MONOTONIC_RAW);
-}
-BENCHMARK(BM_time_clock_gettime_MONOTONIC_RAW);
-
-static void BM_time_clock_gettime_BOOTTIME(benchmark::State& state) {
-  do_clock_overhead(state, CLOCK_BOOTTIME);
-}
-BENCHMARK(BM_time_clock_gettime_BOOTTIME);
-
-static void BM_time_clock_getres_MONOTONIC(benchmark::State& state) {
-  timespec t;
-  while (state.KeepRunning()) {
-    clock_getres(CLOCK_MONOTONIC, &t);
-  }
-}
-BENCHMARK(BM_time_clock_getres_MONOTONIC);
-
-static void BM_time_clock_getres_MONOTONIC_syscall(benchmark::State& state) {
-  timespec t;
-  while (state.KeepRunning()) {
-    syscall(__NR_clock_getres, CLOCK_MONOTONIC, &t);
-  }
-}
-BENCHMARK(BM_time_clock_getres_MONOTONIC_syscall);
-
-static void BM_time_time(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    time_t now;
-    now = time(&now);
-  }
-}
-BENCHMARK(BM_time_time);
-
-/*
- * Measure the time it takes to submit the android logging data to pstore
- */
-static void BM_pmsg_short(benchmark::State& state) {
-  int pstore_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-  if (pstore_fd < 0) {
-    state.SkipWithError("/dev/pmsg0");
-    return;
-  }
-
-  /*
-   *  struct {
-   *      // what we provide to pstore
-   *      android_pmsg_log_header_t pmsg_header;
-   *      // what we provide to socket
-   *      android_log_header_t header;
-   *      // caller provides
-   *      union {
-   *          struct {
-   *              char     prio;
-   *              char     payload[];
-   *          } string;
-   *          struct {
-   *              uint32_t tag
-   *              char     payload[];
-   *          } binary;
-   *      };
-   *  };
-   */
-
-  struct timespec ts;
-  clock_gettime(android_log_clockid(), &ts);
-
-  android_pmsg_log_header_t pmsg_header;
-  pmsg_header.magic = LOGGER_MAGIC;
-  pmsg_header.len =
-      sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t);
-  pmsg_header.uid = getuid();
-  pmsg_header.pid = getpid();
-
-  android_log_header_t header;
-  header.tid = gettid();
-  header.realtime.tv_sec = ts.tv_sec;
-  header.realtime.tv_nsec = ts.tv_nsec;
-
-  static const unsigned nr = 1;
-  static const unsigned header_length = 2;
-  struct iovec newVec[nr + header_length];
-
-  newVec[0].iov_base = (unsigned char*)&pmsg_header;
-  newVec[0].iov_len = sizeof(pmsg_header);
-  newVec[1].iov_base = (unsigned char*)&header;
-  newVec[1].iov_len = sizeof(header);
-
-  android_log_event_int_t buffer;
-
-  header.id = LOG_ID_EVENTS;
-  buffer.header.tag = 0;
-  buffer.payload.type = EVENT_TYPE_INT;
-  uint32_t snapshot = 0;
-  buffer.payload.data = snapshot;
-
-  newVec[2].iov_base = &buffer;
-  newVec[2].iov_len = sizeof(buffer);
-
-  while (state.KeepRunning()) {
-    ++snapshot;
-    buffer.payload.data = snapshot;
-    writev(pstore_fd, newVec, nr);
-  }
-  state.PauseTiming();
-  close(pstore_fd);
-}
-BENCHMARK(BM_pmsg_short);
-
-/*
- * Measure the time it takes to submit the android logging data to pstore
- * best case aligned single block.
- */
-static void BM_pmsg_short_aligned(benchmark::State& state) {
-  int pstore_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-  if (pstore_fd < 0) {
-    state.SkipWithError("/dev/pmsg0");
-    return;
-  }
-
-  /*
-   *  struct {
-   *      // what we provide to pstore
-   *      android_pmsg_log_header_t pmsg_header;
-   *      // what we provide to socket
-   *      android_log_header_t header;
-   *      // caller provides
-   *      union {
-   *          struct {
-   *              char     prio;
-   *              char     payload[];
-   *          } string;
-   *          struct {
-   *              uint32_t tag
-   *              char     payload[];
-   *          } binary;
-   *      };
-   *  };
-   */
-
-  struct timespec ts;
-  clock_gettime(android_log_clockid(), &ts);
-
-  struct packet {
-    android_pmsg_log_header_t pmsg_header;
-    android_log_header_t header;
-    android_log_event_int_t payload;
-  };
-  alignas(8) char buf[sizeof(struct packet) + 8];
-  memset(buf, 0, sizeof(buf));
-  struct packet* buffer = (struct packet*)(((uintptr_t)buf + 7) & ~7);
-  if (((uintptr_t)&buffer->pmsg_header) & 7) {
-    fprintf(stderr, "&buffer=0x%p iterations=%" PRIu64 "\n", &buffer->pmsg_header,
-            state.iterations());
-  }
-
-  buffer->pmsg_header.magic = LOGGER_MAGIC;
-  buffer->pmsg_header.len =
-      sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t);
-  buffer->pmsg_header.uid = getuid();
-  buffer->pmsg_header.pid = getpid();
-
-  buffer->header.tid = gettid();
-  buffer->header.realtime.tv_sec = ts.tv_sec;
-  buffer->header.realtime.tv_nsec = ts.tv_nsec;
-
-  buffer->header.id = LOG_ID_EVENTS;
-  buffer->payload.header.tag = 0;
-  buffer->payload.payload.type = EVENT_TYPE_INT;
-  uint32_t snapshot = 0;
-  buffer->payload.payload.data = snapshot;
-
-  while (state.KeepRunning()) {
-    ++snapshot;
-    buffer->payload.payload.data = snapshot;
-    write(pstore_fd, &buffer->pmsg_header,
-          sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t) +
-              sizeof(android_log_event_int_t));
-  }
-  state.PauseTiming();
-  close(pstore_fd);
-}
-BENCHMARK(BM_pmsg_short_aligned);
-
-/*
- * Measure the time it takes to submit the android logging data to pstore
- * best case aligned single block.
- */
-static void BM_pmsg_short_unaligned1(benchmark::State& state) {
-  int pstore_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-  if (pstore_fd < 0) {
-    state.SkipWithError("/dev/pmsg0");
-    return;
-  }
-
-  /*
-   *  struct {
-   *      // what we provide to pstore
-   *      android_pmsg_log_header_t pmsg_header;
-   *      // what we provide to socket
-   *      android_log_header_t header;
-   *      // caller provides
-   *      union {
-   *          struct {
-   *              char     prio;
-   *              char     payload[];
-   *          } string;
-   *          struct {
-   *              uint32_t tag
-   *              char     payload[];
-   *          } binary;
-   *      };
-   *  };
-   */
-
-  struct timespec ts;
-  clock_gettime(android_log_clockid(), &ts);
-
-  struct packet {
-    android_pmsg_log_header_t pmsg_header;
-    android_log_header_t header;
-    android_log_event_int_t payload;
-  };
-  alignas(8) char buf[sizeof(struct packet) + 8];
-  memset(buf, 0, sizeof(buf));
-  struct packet* buffer = (struct packet*)((((uintptr_t)buf + 7) & ~7) + 1);
-  if ((((uintptr_t)&buffer->pmsg_header) & 7) != 1) {
-    fprintf(stderr, "&buffer=0x%p iterations=%" PRIu64 "\n", &buffer->pmsg_header,
-            state.iterations());
-  }
-
-  buffer->pmsg_header.magic = LOGGER_MAGIC;
-  buffer->pmsg_header.len =
-      sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t);
-  buffer->pmsg_header.uid = getuid();
-  buffer->pmsg_header.pid = getpid();
-
-  buffer->header.tid = gettid();
-  buffer->header.realtime.tv_sec = ts.tv_sec;
-  buffer->header.realtime.tv_nsec = ts.tv_nsec;
-
-  buffer->header.id = LOG_ID_EVENTS;
-  buffer->payload.header.tag = 0;
-  buffer->payload.payload.type = EVENT_TYPE_INT;
-  uint32_t snapshot = 0;
-  buffer->payload.payload.data = snapshot;
-
-  while (state.KeepRunning()) {
-    ++snapshot;
-    buffer->payload.payload.data = snapshot;
-    write(pstore_fd, &buffer->pmsg_header,
-          sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t) +
-              sizeof(android_log_event_int_t));
-  }
-  state.PauseTiming();
-  close(pstore_fd);
-}
-BENCHMARK(BM_pmsg_short_unaligned1);
-
-/*
- * Measure the time it takes to submit the android logging data to pstore
- * best case aligned single block.
- */
-static void BM_pmsg_long_aligned(benchmark::State& state) {
-  int pstore_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-  if (pstore_fd < 0) {
-    state.SkipWithError("/dev/pmsg0");
-    return;
-  }
-
-  /*
-   *  struct {
-   *      // what we provide to pstore
-   *      android_pmsg_log_header_t pmsg_header;
-   *      // what we provide to socket
-   *      android_log_header_t header;
-   *      // caller provides
-   *      union {
-   *          struct {
-   *              char     prio;
-   *              char     payload[];
-   *          } string;
-   *          struct {
-   *              uint32_t tag
-   *              char     payload[];
-   *          } binary;
-   *      };
-   *  };
-   */
-
-  struct timespec ts;
-  clock_gettime(android_log_clockid(), &ts);
-
-  struct packet {
-    android_pmsg_log_header_t pmsg_header;
-    android_log_header_t header;
-    android_log_event_int_t payload;
-  };
-  alignas(8) char buf[sizeof(struct packet) + 8 + LOGGER_ENTRY_MAX_PAYLOAD];
-  memset(buf, 0, sizeof(buf));
-  struct packet* buffer = (struct packet*)(((uintptr_t)buf + 7) & ~7);
-  if (((uintptr_t)&buffer->pmsg_header) & 7) {
-    fprintf(stderr, "&buffer=0x%p iterations=%" PRIu64 "\n", &buffer->pmsg_header,
-            state.iterations());
-  }
-
-  buffer->pmsg_header.magic = LOGGER_MAGIC;
-  buffer->pmsg_header.len =
-      sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t);
-  buffer->pmsg_header.uid = getuid();
-  buffer->pmsg_header.pid = getpid();
-
-  buffer->header.tid = gettid();
-  buffer->header.realtime.tv_sec = ts.tv_sec;
-  buffer->header.realtime.tv_nsec = ts.tv_nsec;
-
-  buffer->header.id = LOG_ID_EVENTS;
-  buffer->payload.header.tag = 0;
-  buffer->payload.payload.type = EVENT_TYPE_INT;
-  uint32_t snapshot = 0;
-  buffer->payload.payload.data = snapshot;
-
-  while (state.KeepRunning()) {
-    ++snapshot;
-    buffer->payload.payload.data = snapshot;
-    write(pstore_fd, &buffer->pmsg_header, LOGGER_ENTRY_MAX_PAYLOAD);
-  }
-  state.PauseTiming();
-  close(pstore_fd);
-}
-BENCHMARK(BM_pmsg_long_aligned);
-
-/*
- * Measure the time it takes to submit the android logging data to pstore
- * best case aligned single block.
- */
-static void BM_pmsg_long_unaligned1(benchmark::State& state) {
-  int pstore_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-  if (pstore_fd < 0) {
-    state.SkipWithError("/dev/pmsg0");
-    return;
-  }
-
-  /*
-   *  struct {
-   *      // what we provide to pstore
-   *      android_pmsg_log_header_t pmsg_header;
-   *      // what we provide to socket
-   *      android_log_header_t header;
-   *      // caller provides
-   *      union {
-   *          struct {
-   *              char     prio;
-   *              char     payload[];
-   *          } string;
-   *          struct {
-   *              uint32_t tag
-   *              char     payload[];
-   *          } binary;
-   *      };
-   *  };
-   */
-
-  struct timespec ts;
-  clock_gettime(android_log_clockid(), &ts);
-
-  struct packet {
-    android_pmsg_log_header_t pmsg_header;
-    android_log_header_t header;
-    android_log_event_int_t payload;
-  };
-  alignas(8) char buf[sizeof(struct packet) + 8 + LOGGER_ENTRY_MAX_PAYLOAD];
-  memset(buf, 0, sizeof(buf));
-  struct packet* buffer = (struct packet*)((((uintptr_t)buf + 7) & ~7) + 1);
-  if ((((uintptr_t)&buffer->pmsg_header) & 7) != 1) {
-    fprintf(stderr, "&buffer=0x%p iterations=%" PRIu64 "\n", &buffer->pmsg_header,
-            state.iterations());
-  }
-
-  buffer->pmsg_header.magic = LOGGER_MAGIC;
-  buffer->pmsg_header.len =
-      sizeof(android_pmsg_log_header_t) + sizeof(android_log_header_t);
-  buffer->pmsg_header.uid = getuid();
-  buffer->pmsg_header.pid = getpid();
-
-  buffer->header.tid = gettid();
-  buffer->header.realtime.tv_sec = ts.tv_sec;
-  buffer->header.realtime.tv_nsec = ts.tv_nsec;
-
-  buffer->header.id = LOG_ID_EVENTS;
-  buffer->payload.header.tag = 0;
-  buffer->payload.payload.type = EVENT_TYPE_INT;
-  uint32_t snapshot = 0;
-  buffer->payload.payload.data = snapshot;
-
-  while (state.KeepRunning()) {
-    ++snapshot;
-    buffer->payload.payload.data = snapshot;
-    write(pstore_fd, &buffer->pmsg_header, LOGGER_ENTRY_MAX_PAYLOAD);
-  }
-  state.PauseTiming();
-  close(pstore_fd);
-}
-BENCHMARK(BM_pmsg_long_unaligned1);
-
-/*
- *	Measure the time it takes to form sprintf plus time using
- * discrete acquisition under light load. Expect this to be a syscall period
- * (2us) or sprintf time if zero-syscall time.
- */
-/* helper function */
-static void test_print(const char* fmt, ...) {
-  va_list ap;
-  char buf[1024];
-
-  va_start(ap, fmt);
-  vsnprintf(buf, sizeof(buf), fmt, ap);
-  va_end(ap);
-}
-
-#define logd_yield() sched_yield()  // allow logd to catch up
-#define logd_sleep() usleep(50)     // really allow logd to catch up
-
-/* performance test */
-static void BM_sprintf_overhead(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    test_print("BM_sprintf_overhead:%" PRIu64, state.iterations());
-    state.PauseTiming();
-    logd_yield();
-    state.ResumeTiming();
-  }
-}
-BENCHMARK(BM_sprintf_overhead);
-
-/*
- *	Measure the time it takes to submit the android printing logging call
- * using discrete acquisition discrete acquisition under light load. Expect
- * this to be a dozen or so syscall periods (40us) plus time to run *printf
- */
-static void BM_log_print_overhead(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    __android_log_print(ANDROID_LOG_INFO, "BM_log_overhead", "%" PRIu64, state.iterations());
-    state.PauseTiming();
-    logd_yield();
-    state.ResumeTiming();
-  }
-}
-BENCHMARK(BM_log_print_overhead);
-
-/*
- *	Measure the time it takes to submit the android event logging call
- * using discrete acquisition under light load. Expect this to be a long path
- * to logger to convert the unknown tag (0) into a tagname (less than 200us).
- */
-static void BM_log_event_overhead(benchmark::State& state) {
-  for (int64_t i = 0; state.KeepRunning(); ++i) {
-    // log tag number 0 is not known, nor shall it ever be known
-    __android_log_btwrite(0, EVENT_TYPE_LONG, &i, sizeof(i));
-    state.PauseTiming();
-    logd_yield();
-    state.ResumeTiming();
-  }
-}
-BENCHMARK(BM_log_event_overhead);
-
-/*
- *	Measure the time it takes to submit the android event logging call
- * using discrete acquisition under light load with a known logtag.  Expect
- * this to be a dozen or so syscall periods (less than 40us)
- */
-static void BM_log_event_overhead_42(benchmark::State& state) {
-  for (int64_t i = 0; state.KeepRunning(); ++i) {
-    // In system/core/logcat/event.logtags:
-    // # These are used for testing, do not modify without updating
-    // # tests/framework-tests/src/android/util/EventLogFunctionalTest.java.
-    // # system/core/liblog/tests/liblog_benchmark.cpp
-    // # system/core/liblog/tests/liblog_test.cpp
-    // 42    answer (to life the universe etc|3)
-    __android_log_btwrite(42, EVENT_TYPE_LONG, &i, sizeof(i));
-    state.PauseTiming();
-    logd_yield();
-    state.ResumeTiming();
-  }
-}
-BENCHMARK(BM_log_event_overhead_42);
-
-/*
- *	Measure the time it takes to submit the android event logging call
- * using discrete acquisition under very-light load (<1% CPU utilization).
- */
-static void BM_log_light_overhead(benchmark::State& state) {
-  for (int64_t i = 0; state.KeepRunning(); ++i) {
-    __android_log_btwrite(0, EVENT_TYPE_LONG, &i, sizeof(i));
-    state.PauseTiming();
-    usleep(10000);
-    state.ResumeTiming();
-  }
-}
-BENCHMARK(BM_log_light_overhead);
-
-static void caught_latency(int /*signum*/) {
-  unsigned long long v = 0xDEADBEEFA55A5AA5ULL;
-
-  LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-}
-
-static unsigned long long caught_convert(char* cp) {
-  unsigned long long l = cp[0] & 0xFF;
-  l |= (unsigned long long)(cp[1] & 0xFF) << 8;
-  l |= (unsigned long long)(cp[2] & 0xFF) << 16;
-  l |= (unsigned long long)(cp[3] & 0xFF) << 24;
-  l |= (unsigned long long)(cp[4] & 0xFF) << 32;
-  l |= (unsigned long long)(cp[5] & 0xFF) << 40;
-  l |= (unsigned long long)(cp[6] & 0xFF) << 48;
-  l |= (unsigned long long)(cp[7] & 0xFF) << 56;
-  return l;
-}
-
-static const int alarm_time = 3;
-
-/*
- *	Measure the time it takes for the logd posting call to acquire the
- * timestamp to place into the internal record.  Expect this to be less than
- * 4 syscalls (3us).  This test uses manual injection of timing because it is
- * comparing the timestamp at send, and then picking up the corresponding log
- * end-to-end long path from logd to see what actual timestamp was submitted.
- */
-static void BM_log_latency(benchmark::State& state) {
-  pid_t pid = getpid();
-
-  struct logger_list* logger_list =
-      android_logger_list_open(LOG_ID_EVENTS, ANDROID_LOG_RDONLY, 0, pid);
-
-  if (!logger_list) {
-    fprintf(stderr, "Unable to open events log: %s\n", strerror(errno));
-    exit(EXIT_FAILURE);
-  }
-
-  signal(SIGALRM, caught_latency);
-  alarm(alarm_time);
-
-  for (size_t j = 0; state.KeepRunning() && j < 10 * state.iterations(); ++j) {
-  retry:  // We allow transitory errors (logd overloaded) to be retried.
-    log_time ts;
-    LOG_FAILURE_RETRY((ts = log_time(CLOCK_REALTIME),
-                       android_btWriteLog(0, EVENT_TYPE_LONG, &ts, sizeof(ts))));
-
-    for (;;) {
-      log_msg log_msg;
-      int ret = android_logger_list_read(logger_list, &log_msg);
-      alarm(alarm_time);
-
-      if (ret <= 0) {
-        state.SkipWithError("android_logger_list_read");
-        break;
-      }
-      if ((log_msg.entry.len != (4 + 1 + 8)) ||
-          (log_msg.id() != LOG_ID_EVENTS)) {
-        continue;
-      }
-
-      char* eventData = log_msg.msg();
-
-      if (!eventData || (eventData[4] != EVENT_TYPE_LONG)) {
-        continue;
-      }
-      log_time tx(eventData + 4 + 1);
-      if (ts != tx) {
-        if (0xDEADBEEFA55A5AA5ULL == caught_convert(eventData + 4 + 1)) {
-          state.SkipWithError("signal");
-          break;
-        }
-        continue;
-      }
-
-      uint64_t start = ts.nsec();
-      uint64_t end = log_msg.nsec();
-      if (end < start) goto retry;
-      state.SetIterationTime((end - start) / (double)NS_PER_SEC);
-      break;
-    }
-  }
-
-  signal(SIGALRM, SIG_DFL);
-  alarm(0);
-
-  android_logger_list_free(logger_list);
-}
-// Default gets out of hand for this test, so we set a reasonable number of
-// iterations for a timely result.
-BENCHMARK(BM_log_latency)->UseManualTime()->Iterations(200);
-
-static void caught_delay(int /*signum*/) {
-  unsigned long long v = 0xDEADBEEFA55A5AA6ULL;
-
-  LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-}
-
-/*
- *	Measure the time it takes for the logd posting call to make it into
- * the logs. Expect this to be less than double the process wakeup time (2ms).
- */
-static void BM_log_delay(benchmark::State& state) {
-  pid_t pid = getpid();
-
-  struct logger_list* logger_list =
-      android_logger_list_open(LOG_ID_EVENTS, ANDROID_LOG_RDONLY, 0, pid);
-
-  if (!logger_list) {
-    fprintf(stderr, "Unable to open events log: %s\n", strerror(errno));
-    exit(EXIT_FAILURE);
-  }
-
-  signal(SIGALRM, caught_delay);
-  alarm(alarm_time);
-
-  while (state.KeepRunning()) {
-    log_time ts(CLOCK_REALTIME);
-
-    LOG_FAILURE_RETRY(android_btWriteLog(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-
-    for (;;) {
-      log_msg log_msg;
-      int ret = android_logger_list_read(logger_list, &log_msg);
-      alarm(alarm_time);
-
-      if (ret <= 0) {
-        state.SkipWithError("android_logger_list_read");
-        break;
-      }
-      if ((log_msg.entry.len != (4 + 1 + 8)) ||
-          (log_msg.id() != LOG_ID_EVENTS)) {
-        continue;
-      }
-
-      char* eventData = log_msg.msg();
-
-      if (!eventData || (eventData[4] != EVENT_TYPE_LONG)) {
-        continue;
-      }
-      log_time tx(eventData + 4 + 1);
-      if (ts != tx) {
-        if (0xDEADBEEFA55A5AA6ULL == caught_convert(eventData + 4 + 1)) {
-          state.SkipWithError("signal");
-          break;
-        }
-        continue;
-      }
-
-      break;
-    }
-  }
-  state.PauseTiming();
-
-  signal(SIGALRM, SIG_DFL);
-  alarm(0);
-
-  android_logger_list_free(logger_list);
-}
-BENCHMARK(BM_log_delay);
-
-/*
- *	Measure the time it takes for __android_log_is_loggable.
- */
-static void BM_is_loggable(benchmark::State& state) {
-  static const char logd[] = "logd";
-
-  while (state.KeepRunning()) {
-    __android_log_is_loggable_len(ANDROID_LOG_WARN, logd, strlen(logd),
-                                  ANDROID_LOG_VERBOSE);
-  }
-}
-BENCHMARK(BM_is_loggable);
-
-/*
- *	Measure the time it takes for android_log_clockid.
- */
-static void BM_clockid(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    android_log_clockid();
-  }
-}
-BENCHMARK(BM_clockid);
-
-/*
- *	Measure the time it takes for __android_log_security.
- */
-static void BM_security(benchmark::State& state) {
-  while (state.KeepRunning()) {
-    __android_log_security();
-  }
-}
-BENCHMARK(BM_security);
-
-// Keep maps around for multiple iterations
-static std::unordered_set<uint32_t> set;
-static EventTagMap* map;
-
-static bool prechargeEventMap() {
-  if (map) return true;
-
-  fprintf(stderr, "Precharge: start\n");
-
-  map = android_openEventTagMap(NULL);
-  for (uint32_t tag = 1; tag < USHRT_MAX; ++tag) {
-    size_t len;
-    if (android_lookupEventTag_len(map, &len, tag) == NULL) continue;
-    set.insert(tag);
-  }
-
-  fprintf(stderr, "Precharge: stop %zu\n", set.size());
-
-  return true;
-}
-
-/*
- *	Measure the time it takes for android_lookupEventTag_len
- */
-static void BM_lookupEventTag(benchmark::State& state) {
-  prechargeEventMap();
-
-  std::unordered_set<uint32_t>::const_iterator it = set.begin();
-
-  while (state.KeepRunning()) {
-    size_t len;
-    android_lookupEventTag_len(map, &len, (*it));
-    ++it;
-    if (it == set.end()) it = set.begin();
-  }
-}
-BENCHMARK(BM_lookupEventTag);
-
-/*
- *	Measure the time it takes for android_lookupEventTag_len
- */
-static uint32_t notTag = 1;
-
-static void BM_lookupEventTag_NOT(benchmark::State& state) {
-  prechargeEventMap();
-
-  while (set.find(notTag) != set.end()) {
-    ++notTag;
-    if (notTag >= USHRT_MAX) notTag = 1;
-  }
-
-  while (state.KeepRunning()) {
-    size_t len;
-    android_lookupEventTag_len(map, &len, notTag);
-  }
-
-  ++notTag;
-  if (notTag >= USHRT_MAX) notTag = 1;
-}
-BENCHMARK(BM_lookupEventTag_NOT);
-
-/*
- *	Measure the time it takes for android_lookupEventFormat_len
- */
-static void BM_lookupEventFormat(benchmark::State& state) {
-  prechargeEventMap();
-
-  std::unordered_set<uint32_t>::const_iterator it = set.begin();
-
-  while (state.KeepRunning()) {
-    size_t len;
-    android_lookupEventFormat_len(map, &len, (*it));
-    ++it;
-    if (it == set.end()) it = set.begin();
-  }
-}
-BENCHMARK(BM_lookupEventFormat);
-
-/*
- *	Measure the time it takes for android_lookupEventTagNum plus above
- */
-static void BM_lookupEventTagNum(benchmark::State& state) {
-  prechargeEventMap();
-
-  std::unordered_set<uint32_t>::const_iterator it = set.begin();
-
-  while (state.KeepRunning()) {
-    size_t len;
-    const char* name = android_lookupEventTag_len(map, &len, (*it));
-    std::string Name(name, len);
-    const char* format = android_lookupEventFormat_len(map, &len, (*it));
-    std::string Format(format, len);
-    state.ResumeTiming();
-    android_lookupEventTagNum(map, Name.c_str(), Format.c_str(),
-                              ANDROID_LOG_UNKNOWN);
-    state.PauseTiming();
-    ++it;
-    if (it == set.end()) it = set.begin();
-  }
-}
-BENCHMARK(BM_lookupEventTagNum);
-
-// Must be functionally identical to liblog internal SendLogdControlMessage()
-static void send_to_control(char* buf, size_t len) {
-  int sock =
-      socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM | SOCK_CLOEXEC);
-  if (sock < 0) return;
-  size_t writeLen = strlen(buf) + 1;
-
-  ssize_t ret = TEMP_FAILURE_RETRY(write(sock, buf, writeLen));
-  if (ret <= 0) {
-    close(sock);
-    return;
-  }
-  while ((ret = read(sock, buf, len)) > 0) {
-    if (((size_t)ret == len) || (len < PAGE_SIZE)) {
-      break;
-    }
-    len -= ret;
-    buf += ret;
-
-    struct pollfd p = {.fd = sock, .events = POLLIN, .revents = 0 };
-
-    ret = poll(&p, 1, 20);
-    if ((ret <= 0) || !(p.revents & POLLIN)) {
-      break;
-    }
-  }
-  close(sock);
-}
-
-static void BM_lookupEventTagNum_logd_new(benchmark::State& state) {
-  fprintf(stderr,
-          "WARNING: "
-          "This test can cause logd to grow in size and hit DOS limiter\n");
-  // Make copies
-  static const char empty_event_log_tags[] = "# content owned by logd\n";
-  static const char dev_event_log_tags_path[] = "/dev/event-log-tags";
-  std::string dev_event_log_tags;
-  if (android::base::ReadFileToString(dev_event_log_tags_path,
-                                      &dev_event_log_tags) &&
-      (dev_event_log_tags.length() == 0)) {
-    dev_event_log_tags = empty_event_log_tags;
-  }
-  static const char data_event_log_tags_path[] =
-      "/data/misc/logd/event-log-tags";
-  std::string data_event_log_tags;
-  if (android::base::ReadFileToString(data_event_log_tags_path,
-                                      &data_event_log_tags) &&
-      (data_event_log_tags.length() == 0)) {
-    data_event_log_tags = empty_event_log_tags;
-  }
-
-  while (state.KeepRunning()) {
-    char buffer[256];
-    memset(buffer, 0, sizeof(buffer));
-    log_time now(CLOCK_MONOTONIC);
-    char name[64];
-    snprintf(name, sizeof(name), "a%" PRIu64, now.nsec());
-    snprintf(buffer, sizeof(buffer), "getEventTag name=%s format=\"(new|1)\"",
-             name);
-    state.ResumeTiming();
-    send_to_control(buffer, sizeof(buffer));
-    state.PauseTiming();
-  }
-
-  // Restore copies (logd still know about them, until crash or reboot)
-  if (dev_event_log_tags.length() &&
-      !android::base::WriteStringToFile(dev_event_log_tags,
-                                        dev_event_log_tags_path)) {
-    fprintf(stderr,
-            "WARNING: "
-            "failed to restore %s\n",
-            dev_event_log_tags_path);
-  }
-  if (data_event_log_tags.length() &&
-      !android::base::WriteStringToFile(data_event_log_tags,
-                                        data_event_log_tags_path)) {
-    fprintf(stderr,
-            "WARNING: "
-            "failed to restore %s\n",
-            data_event_log_tags_path);
-  }
-  fprintf(stderr,
-          "WARNING: "
-          "Restarting logd to make it forget what we just did\n");
-  system("stop logd ; start logd");
-}
-BENCHMARK(BM_lookupEventTagNum_logd_new);
-
-static void BM_lookupEventTagNum_logd_existing(benchmark::State& state) {
-  prechargeEventMap();
-
-  std::unordered_set<uint32_t>::const_iterator it = set.begin();
-
-  while (state.KeepRunning()) {
-    size_t len;
-    const char* name = android_lookupEventTag_len(map, &len, (*it));
-    std::string Name(name, len);
-    const char* format = android_lookupEventFormat_len(map, &len, (*it));
-    std::string Format(format, len);
-
-    char buffer[256];
-    snprintf(buffer, sizeof(buffer), "getEventTag name=%s format=\"%s\"",
-             Name.c_str(), Format.c_str());
-
-    state.ResumeTiming();
-    send_to_control(buffer, sizeof(buffer));
-    state.PauseTiming();
-    ++it;
-    if (it == set.end()) it = set.begin();
-  }
-}
-BENCHMARK(BM_lookupEventTagNum_logd_existing);
diff --git a/liblog/tests/liblog_default_tag.cpp b/liblog/tests/liblog_default_tag.cpp
deleted file mode 100644
index 31b7467..0000000
--- a/liblog/tests/liblog_default_tag.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-// LOG_TAG must be unset for android-base's logging to use a default tag.
-#undef LOG_TAG
-
-#include <stdlib.h>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android-base/scopeguard.h>
-#include <android/log.h>
-
-#include <gtest/gtest.h>
-
-#ifndef __ANDROID__
-static const char* getprogname() {
-  return program_invocation_short_name;
-}
-#endif
-
-TEST(liblog_default_tag, no_default_tag_libbase_write_first) {
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_tag = "";
-  SetLogger([&](LogId, LogSeverity, const char* tag, const char*, unsigned int, const char*) {
-    message_seen = true;
-    EXPECT_EQ(expected_tag, tag);
-  });
-
-  expected_tag = getprogname();
-  LOG(WARNING) << "message";
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_WARN, nullptr, "message");
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_default_tag, no_default_tag_liblog_write_first) {
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_tag = "";
-  SetLogger([&](LogId, LogSeverity, const char* tag, const char*, unsigned int, const char*) {
-    message_seen = true;
-    EXPECT_EQ(expected_tag, tag);
-  });
-
-  expected_tag = getprogname();
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_WARN, nullptr, "message");
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  LOG(WARNING) << "message";
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_default_tag, libbase_sets_default_tag) {
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_tag = "libbase_test_tag";
-  SetLogger([&](LogId, LogSeverity, const char* tag, const char*, unsigned int, const char*) {
-    message_seen = true;
-    EXPECT_EQ(expected_tag, tag);
-  });
-  SetDefaultTag(expected_tag);
-
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_WARN, nullptr, "message");
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  LOG(WARNING) << "message";
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_default_tag, liblog_sets_default_tag) {
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_tag = "liblog_test_tag";
-  SetLogger([&](LogId, LogSeverity, const char* tag, const char*, unsigned int, const char*) {
-    message_seen = true;
-    EXPECT_EQ(expected_tag, tag);
-  });
-  __android_log_set_default_tag(expected_tag.c_str());
-
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_WARN, nullptr, "message");
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  LOG(WARNING) << "message";
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_default_tag, default_tag_plus_log_severity) {
-#ifdef __ANDROID__
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_tag = "liblog_test_tag";
-  SetLogger([&](LogId, LogSeverity, const char* tag, const char*, unsigned int, const char*) {
-    message_seen = true;
-    EXPECT_EQ(expected_tag, tag);
-  });
-  __android_log_set_default_tag(expected_tag.c_str());
-
-  auto log_tag_property = "log.tag." + expected_tag;
-  SetProperty(log_tag_property, "V");
-  auto reset_tag_property_guard = make_scope_guard([=] { SetProperty(log_tag_property, ""); });
-
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_VERBOSE, nullptr, "message");
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  LOG(VERBOSE) << "message";
-  EXPECT_TRUE(message_seen);
-#else
-  GTEST_SKIP() << "No log tag properties on host";
-#endif
-}
-
-TEST(liblog_default_tag, generated_default_tag_plus_log_severity) {
-#ifdef __ANDROID__
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_tag = getprogname();
-  SetLogger([&](LogId, LogSeverity, const char* tag, const char*, unsigned int, const char*) {
-    message_seen = true;
-    EXPECT_EQ(expected_tag, tag);
-  });
-
-  // Even without any calls to SetDefaultTag(), the first message that attempts to log, will
-  // generate a default tag from getprogname() and check log.tag.<default tag> for loggability. This
-  // case checks that we can log a Verbose message when log.tag.<getprogname()> is set to 'V'.
-  auto log_tag_property = "log.tag." + expected_tag;
-  SetProperty(log_tag_property, "V");
-  auto reset_tag_property_guard = make_scope_guard([=] { SetProperty(log_tag_property, ""); });
-
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_VERBOSE, nullptr, "message");
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  LOG(VERBOSE) << "message";
-  EXPECT_TRUE(message_seen);
-#else
-  GTEST_SKIP() << "No log tag properties on host";
-#endif
-}
\ No newline at end of file
diff --git a/liblog/tests/liblog_global_state.cpp b/liblog/tests/liblog_global_state.cpp
deleted file mode 100644
index 3508818..0000000
--- a/liblog/tests/liblog_global_state.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#define LOG_TAG "global_state_test_tag"
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android/log.h>
-
-#include <gtest/gtest.h>
-
-TEST(liblog_global_state, libbase_logs_with_libbase_SetLogger) {
-  using namespace android::base;
-  bool message_seen = false;
-  LogSeverity expected_severity = WARNING;
-  std::string expected_file = Basename(__FILE__);
-  unsigned int expected_line;
-  std::string expected_message = "libbase test message";
-
-  auto LoggerFunction = [&](LogId log_id, LogSeverity severity, const char* tag, const char* file,
-                            unsigned int line, const char* message) {
-    message_seen = true;
-    EXPECT_EQ(DEFAULT, log_id);
-    EXPECT_EQ(expected_severity, severity);
-    EXPECT_STREQ(LOG_TAG, tag);
-    EXPECT_EQ(expected_file, file);
-    EXPECT_EQ(expected_line, line);
-    EXPECT_EQ(expected_message, message);
-  };
-
-  SetLogger(LoggerFunction);
-
-  expected_line = __LINE__ + 1;
-  LOG(expected_severity) << expected_message;
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_global_state, libbase_logs_with_liblog_set_logger) {
-  using namespace android::base;
-  // These must be static since they're used by the liblog logger function, which only accepts
-  // lambdas without captures.  The items used by the libbase logger are explicitly not static, to
-  // ensure that lambdas with captures do work there.
-  static bool message_seen = false;
-  static std::string expected_file = Basename(__FILE__);
-  static unsigned int expected_line;
-  static std::string expected_message = "libbase test message";
-
-  auto liblog_logger_function = [](const struct __android_log_message* log_message) {
-    message_seen = true;
-    EXPECT_EQ(sizeof(__android_log_message), log_message->struct_size);
-    EXPECT_EQ(LOG_ID_DEFAULT, log_message->buffer_id);
-    EXPECT_EQ(ANDROID_LOG_WARN, log_message->priority);
-    EXPECT_STREQ(LOG_TAG, log_message->tag);
-    EXPECT_EQ(expected_file, log_message->file);
-    EXPECT_EQ(expected_line, log_message->line);
-    EXPECT_EQ(expected_message, log_message->message);
-  };
-
-  __android_log_set_logger(liblog_logger_function);
-
-  expected_line = __LINE__ + 1;
-  LOG(WARNING) << expected_message;
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_global_state, liblog_logs_with_libbase_SetLogger) {
-  using namespace android::base;
-  bool message_seen = false;
-  std::string expected_message = "libbase test message";
-
-  auto LoggerFunction = [&](LogId log_id, LogSeverity severity, const char* tag, const char* file,
-                            unsigned int line, const char* message) {
-    message_seen = true;
-    EXPECT_EQ(MAIN, log_id);
-    EXPECT_EQ(WARNING, severity);
-    EXPECT_STREQ(LOG_TAG, tag);
-    EXPECT_EQ(nullptr, file);
-    EXPECT_EQ(0U, line);
-    EXPECT_EQ(expected_message, message);
-  };
-
-  SetLogger(LoggerFunction);
-
-  __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_WARN, LOG_TAG, expected_message.c_str());
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-}
-
-TEST(liblog_global_state, liblog_logs_with_liblog_set_logger) {
-  using namespace android::base;
-  // These must be static since they're used by the liblog logger function, which only accepts
-  // lambdas without captures.  The items used by the libbase logger are explicitly not static, to
-  // ensure that lambdas with captures do work there.
-  static bool message_seen = false;
-  static int expected_buffer_id = LOG_ID_MAIN;
-  static int expected_priority = ANDROID_LOG_WARN;
-  static std::string expected_message = "libbase test message";
-
-  auto liblog_logger_function = [](const struct __android_log_message* log_message) {
-    message_seen = true;
-    EXPECT_EQ(sizeof(__android_log_message), log_message->struct_size);
-    EXPECT_EQ(expected_buffer_id, log_message->buffer_id);
-    EXPECT_EQ(expected_priority, log_message->priority);
-    EXPECT_STREQ(LOG_TAG, log_message->tag);
-    EXPECT_STREQ(nullptr, log_message->file);
-    EXPECT_EQ(0U, log_message->line);
-    EXPECT_EQ(expected_message, log_message->message);
-  };
-
-  __android_log_set_logger(liblog_logger_function);
-
-  __android_log_buf_write(expected_buffer_id, expected_priority, LOG_TAG, expected_message.c_str());
-  EXPECT_TRUE(message_seen);
-}
-
-TEST(liblog_global_state, SetAborter_with_liblog) {
-  using namespace android::base;
-
-  std::string expected_message = "libbase test message";
-  static bool message_seen = false;
-  auto aborter_function = [&](const char* message) {
-    message_seen = true;
-    EXPECT_EQ(expected_message, message);
-  };
-
-  SetAborter(aborter_function);
-  LOG(FATAL) << expected_message;
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-
-  static std::string expected_message_static = "libbase test message";
-  auto liblog_aborter_function = [](const char* message) {
-    message_seen = true;
-    EXPECT_EQ(expected_message_static, message);
-  };
-  __android_log_set_aborter(liblog_aborter_function);
-  LOG(FATAL) << expected_message_static;
-  EXPECT_TRUE(message_seen);
-  message_seen = false;
-}
-
-TEST(liblog_global_state, is_loggable_both_default) {
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-}
-
-TEST(liblog_global_state, is_loggable_minimum_log_priority_only) {
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  EXPECT_EQ(ANDROID_LOG_DEFAULT, __android_log_set_minimum_priority(ANDROID_LOG_DEBUG));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  EXPECT_EQ(ANDROID_LOG_DEBUG, __android_log_set_minimum_priority(ANDROID_LOG_WARN));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  EXPECT_EQ(android::base::WARNING, android::base::SetMinimumLogSeverity(android::base::DEBUG));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  EXPECT_EQ(android::base::DEBUG, android::base::SetMinimumLogSeverity(android::base::WARNING));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-}
-
-TEST(liblog_global_state, is_loggable_tag_log_priority_only) {
-#ifdef __ANDROID__
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  auto log_tag_property = std::string("log.tag.") + LOG_TAG;
-  android::base::SetProperty(log_tag_property, "d");
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  android::base::SetProperty(log_tag_property, "w");
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  android::base::SetProperty(log_tag_property, "");
-#else
-  GTEST_SKIP() << "No log tag properties on host";
-#endif
-}
-
-TEST(liblog_global_state, is_loggable_both_set) {
-#ifdef __ANDROID__
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  // When both a tag and a minimum priority are set, we use the lower value of the two.
-
-  // tag = warning, minimum_priority = debug, expect 'debug'
-  auto log_tag_property = std::string("log.tag.") + LOG_TAG;
-  android::base::SetProperty(log_tag_property, "w");
-  EXPECT_EQ(ANDROID_LOG_DEFAULT, __android_log_set_minimum_priority(ANDROID_LOG_DEBUG));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  // tag = warning, minimum_priority = warning, expect 'warning'
-  EXPECT_EQ(ANDROID_LOG_DEBUG, __android_log_set_minimum_priority(ANDROID_LOG_WARN));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(0, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  // tag = debug, minimum_priority = warning, expect 'debug'
-  android::base::SetProperty(log_tag_property, "d");
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  // tag = debug, minimum_priority = debug, expect 'debug'
-  EXPECT_EQ(ANDROID_LOG_WARN, __android_log_set_minimum_priority(ANDROID_LOG_DEBUG));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_INFO, LOG_TAG, ANDROID_LOG_INFO));
-  EXPECT_EQ(1, __android_log_is_loggable(ANDROID_LOG_WARN, LOG_TAG, ANDROID_LOG_INFO));
-
-  android::base::SetProperty(log_tag_property, "");
-#else
-  GTEST_SKIP() << "No log tag properties on host";
-#endif
-}
diff --git a/liblog/tests/liblog_host_test.cpp b/liblog/tests/liblog_host_test.cpp
deleted file mode 100644
index ec186d4..0000000
--- a/liblog/tests/liblog_host_test.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <log/log.h>
-#include <private/android_logger.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <regex>
-#include <string>
-
-#include <android-base/logging.h>
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-#include <android-base/test_utils.h>
-#include <gtest/gtest.h>
-
-using android::base::InitLogging;
-using android::base::StderrLogger;
-using android::base::StringPrintf;
-
-static std::string MakeLogPattern(int priority, const char* tag, const char* message) {
-  static const char log_characters[] = "XXVDIWEF";
-  static_assert(arraysize(log_characters) - 1 == ANDROID_LOG_SILENT,
-                "Mismatch in size of log_characters and values in android_LogPriority");
-  priority = priority > ANDROID_LOG_SILENT ? ANDROID_LOG_FATAL : priority;
-  char log_char = log_characters[priority];
-
-  return StringPrintf("%s %c \\d+-\\d+ \\d+:\\d+:\\d+ \\s*\\d+ \\s*\\d+ %s", tag, log_char,
-                      message);
-}
-
-static void CheckMessage(bool expected, const std::string& output, int priority, const char* tag,
-                         const char* message) {
-  std::regex message_regex(MakeLogPattern(priority, tag, message));
-  EXPECT_EQ(expected, std::regex_search(output, message_regex)) << message;
-}
-
-static void GenerateLogContent() {
-  __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_VERBOSE, "tag", "verbose main");
-  __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_INFO, "tag", "info main");
-  __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_ERROR, "tag", "error main");
-
-  __android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, "tag", "verbose radio");
-  __android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, "tag", "info radio");
-  __android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, "tag", "error radio");
-
-  __android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, "tag", "verbose system");
-  __android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, "tag", "info system");
-  __android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, "tag", "error system");
-
-  __android_log_buf_print(LOG_ID_CRASH, ANDROID_LOG_VERBOSE, "tag", "verbose crash");
-  __android_log_buf_print(LOG_ID_CRASH, ANDROID_LOG_INFO, "tag", "info crash");
-  __android_log_buf_print(LOG_ID_CRASH, ANDROID_LOG_ERROR, "tag", "error crash");
-}
-
-std::string GetPidString() {
-  int pid = getpid();
-  return StringPrintf("%5d", pid);
-}
-
-TEST(liblog, default_write) {
-  CapturedStderr captured_stderr;
-  InitLogging(nullptr, StderrLogger);
-
-  GenerateLogContent();
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose main");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info main");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error main");
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose radio");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info radio");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error radio");
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose system");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info system");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error system");
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose crash");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info crash");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error crash");
-}
-
-TEST(liblog, verbose_write) {
-  setenv("ANDROID_LOG_TAGS", "*:v", true);
-  CapturedStderr captured_stderr;
-  InitLogging(nullptr, StderrLogger);
-
-  GenerateLogContent();
-
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose main");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info main");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error main");
-
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose radio");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info radio");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error radio");
-
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose system");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info system");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error system");
-
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose crash");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info crash");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error crash");
-}
-
-TEST(liblog, error_write) {
-  setenv("ANDROID_LOG_TAGS", "*:e", true);
-  CapturedStderr captured_stderr;
-  InitLogging(nullptr, StderrLogger);
-
-  GenerateLogContent();
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose main");
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info main");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error main");
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose radio");
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info radio");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error radio");
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose system");
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info system");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error system");
-
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_VERBOSE, "tag", "verbose crash");
-  CheckMessage(false, captured_stderr.str(), ANDROID_LOG_INFO, "tag", "info crash");
-  CheckMessage(true, captured_stderr.str(), ANDROID_LOG_ERROR, "tag", "error crash");
-}
-
-TEST(liblog, kernel_no_write) {
-  CapturedStderr captured_stderr;
-  InitLogging(nullptr, StderrLogger);
-  __android_log_buf_print(LOG_ID_KERNEL, ANDROID_LOG_ERROR, "tag", "kernel error");
-  EXPECT_EQ("", captured_stderr.str());
-}
-
-TEST(liblog, binary_no_write) {
-  CapturedStderr captured_stderr;
-  InitLogging(nullptr, StderrLogger);
-  __android_log_buf_print(LOG_ID_EVENTS, ANDROID_LOG_ERROR, "tag", "error events");
-  __android_log_buf_print(LOG_ID_STATS, ANDROID_LOG_ERROR, "tag", "error stats");
-  __android_log_buf_print(LOG_ID_SECURITY, ANDROID_LOG_ERROR, "tag", "error security");
-
-  __android_log_bswrite(0x12, "events");
-  __android_log_stats_bwrite(0x34, "stats", strlen("stats"));
-  __android_log_security_bswrite(0x56, "security");
-
-  EXPECT_EQ("", captured_stderr.str());
-}
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp
deleted file mode 100644
index a60d2df..0000000
--- a/liblog/tests/liblog_test.cpp
+++ /dev/null
@@ -1,2802 +0,0 @@
-/*
- * Copyright (C) 2013-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.
- */
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/scopeguard.h>
-#include <android-base/stringprintf.h>
-#ifdef __ANDROID__  // includes sys/properties.h which does not exist outside
-#include <cutils/properties.h>
-#endif
-#include <gtest/gtest.h>
-#include <log/log_event_list.h>
-#include <log/log_properties.h>
-#include <log/logprint.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-
-using android::base::make_scope_guard;
-
-// #define ENABLE_FLAKY_TESTS
-
-// enhanced version of LOG_FAILURE_RETRY to add support for EAGAIN and
-// non-syscall libs. Since we are only using this in the emergency of
-// a signal to stuff a terminating code into the logs, we will spin rather
-// than try a usleep.
-#define LOG_FAILURE_RETRY(exp)                                           \
-  ({                                                                     \
-    typeof(exp) _rc;                                                     \
-    do {                                                                 \
-      _rc = (exp);                                                       \
-    } while (((_rc == -1) && ((errno == EINTR) || (errno == EAGAIN))) || \
-             (_rc == -EINTR) || (_rc == -EAGAIN));                       \
-    _rc;                                                                 \
-  })
-
-// std::unique_ptr doesn't let you provide a pointer to a deleter (android_logger_list_close()) if
-// the type (struct logger_list) is an incomplete type, so we create ListCloser instead.
-struct ListCloser {
-  void operator()(struct logger_list* list) { android_logger_list_close(list); }
-};
-
-// This function is meant to be used for most log tests, it does the following:
-// 1) Open the log_buffer with a blocking reader
-// 2) Write the messages via write_messages
-// 3) Set an alarm for 2 seconds as a timeout
-// 4) Read until check_message returns true, which should be used to indicate the target message
-//    is found
-// 5) Open log_buffer with a non_blocking reader and dump all messages
-// 6) Count the number of times check_messages returns true for these messages and assert it's
-//    only 1.
-template <typename FWrite, typename FCheck>
-static void RunLogTests(log_id_t log_buffer, FWrite write_messages, FCheck check_message) {
-  pid_t pid = getpid();
-
-  auto logger_list = std::unique_ptr<struct logger_list, ListCloser>{
-      android_logger_list_open(log_buffer, ANDROID_LOG_RDONLY, 1000, pid)};
-  ASSERT_TRUE(logger_list);
-
-  write_messages();
-
-  alarm(2);
-  auto alarm_guard = android::base::make_scope_guard([] { alarm(0); });
-  bool found = false;
-  while (!found) {
-    log_msg log_msg;
-    ASSERT_GT(android_logger_list_read(logger_list.get(), &log_msg), 0);
-
-    ASSERT_EQ(log_buffer, log_msg.id());
-    ASSERT_EQ(pid, log_msg.entry.pid);
-
-    // TODO: Should this be an assert?
-    if (log_msg.msg() == nullptr) {
-      continue;
-    }
-
-    check_message(log_msg, &found);
-  }
-
-  auto logger_list_non_block = std::unique_ptr<struct logger_list, ListCloser>{
-      android_logger_list_open(log_buffer, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 1000, pid)};
-  ASSERT_TRUE(logger_list_non_block);
-
-  size_t count = 0;
-  while (true) {
-    log_msg log_msg;
-    auto ret = android_logger_list_read(logger_list_non_block.get(), &log_msg);
-    if (ret == -EAGAIN) {
-      break;
-    }
-    ASSERT_GT(ret, 0);
-
-    ASSERT_EQ(log_buffer, log_msg.id());
-    ASSERT_EQ(pid, log_msg.entry.pid);
-
-    // TODO: Should this be an assert?
-    if (log_msg.msg() == nullptr) {
-      continue;
-    }
-
-    found = false;
-    check_message(log_msg, &found);
-    if (found) {
-      ++count;
-    }
-  }
-
-  EXPECT_EQ(1U, count);
-}
-
-TEST(liblog, __android_log_btwrite) {
-  int intBuf = 0xDEADBEEF;
-  EXPECT_LT(0,
-            __android_log_btwrite(0, EVENT_TYPE_INT, &intBuf, sizeof(intBuf)));
-  long long longBuf = 0xDEADBEEFA55A5AA5;
-  EXPECT_LT(
-      0, __android_log_btwrite(0, EVENT_TYPE_LONG, &longBuf, sizeof(longBuf)));
-  char Buf[] = "\20\0\0\0DeAdBeEfA55a5aA5";
-  EXPECT_LT(0,
-            __android_log_btwrite(0, EVENT_TYPE_STRING, Buf, sizeof(Buf) - 1));
-}
-
-#if defined(__ANDROID__)
-static std::string popenToString(const std::string& command) {
-  std::string ret;
-
-  FILE* fp = popen(command.c_str(), "re");
-  if (fp) {
-    if (!android::base::ReadFdToString(fileno(fp), &ret)) ret = "";
-    pclose(fp);
-  }
-  return ret;
-}
-
-#ifndef NO_PSTORE
-static bool isPmsgActive() {
-  pid_t pid = getpid();
-
-  std::string myPidFds =
-      popenToString(android::base::StringPrintf("ls -l /proc/%d/fd", pid));
-  if (myPidFds.length() == 0) return true;  // guess it is?
-
-  return std::string::npos != myPidFds.find(" -> /dev/pmsg0");
-}
-#endif /* NO_PSTORE */
-
-static bool isLogdwActive() {
-  std::string logdwSignature =
-      popenToString("grep -a /dev/socket/logdw /proc/net/unix");
-  size_t beginning = logdwSignature.find(' ');
-  if (beginning == std::string::npos) return true;
-  beginning = logdwSignature.find(' ', beginning + 1);
-  if (beginning == std::string::npos) return true;
-  size_t end = logdwSignature.find(' ', beginning + 1);
-  if (end == std::string::npos) return true;
-  end = logdwSignature.find(' ', end + 1);
-  if (end == std::string::npos) return true;
-  end = logdwSignature.find(' ', end + 1);
-  if (end == std::string::npos) return true;
-  end = logdwSignature.find(' ', end + 1);
-  if (end == std::string::npos) return true;
-  std::string allLogdwEndpoints = popenToString(
-      "grep -a ' 00000002" + logdwSignature.substr(beginning, end - beginning) +
-      " ' /proc/net/unix | " +
-      "sed -n 's/.* \\([0-9][0-9]*\\)$/ -> socket:[\\1]/p'");
-  if (allLogdwEndpoints.length() == 0) return true;
-
-  // NB: allLogdwEndpoints has some false positives in it, but those
-  // strangers do not overlap with the simplistic activities inside this
-  // test suite.
-
-  pid_t pid = getpid();
-
-  std::string myPidFds =
-      popenToString(android::base::StringPrintf("ls -l /proc/%d/fd", pid));
-  if (myPidFds.length() == 0) return true;
-
-  // NB: fgrep with multiple strings is broken in Android
-  for (beginning = 0;
-       (end = allLogdwEndpoints.find('\n', beginning)) != std::string::npos;
-       beginning = end + 1) {
-    if (myPidFds.find(allLogdwEndpoints.substr(beginning, end - beginning)) !=
-        std::string::npos)
-      return true;
-  }
-  return false;
-}
-
-static bool tested__android_log_close;
-#endif
-
-TEST(liblog, __android_log_btwrite__android_logger_list_read) {
-#ifdef __ANDROID__
-  log_time ts(CLOCK_MONOTONIC);
-  log_time ts1(ts);
-
-  auto write_function = [&] {
-    EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-    // Check that we can close and reopen the logger
-    bool logdwActiveAfter__android_log_btwrite;
-    if (getuid() == AID_ROOT) {
-      tested__android_log_close = true;
-#ifndef NO_PSTORE
-      bool pmsgActiveAfter__android_log_btwrite = isPmsgActive();
-      EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite);
-#endif /* NO_PSTORE */
-      logdwActiveAfter__android_log_btwrite = isLogdwActive();
-      EXPECT_TRUE(logdwActiveAfter__android_log_btwrite);
-    } else if (!tested__android_log_close) {
-      fprintf(stderr, "WARNING: can not test __android_log_close()\n");
-    }
-    __android_log_close();
-    if (getuid() == AID_ROOT) {
-#ifndef NO_PSTORE
-      bool pmsgActiveAfter__android_log_close = isPmsgActive();
-      EXPECT_FALSE(pmsgActiveAfter__android_log_close);
-#endif /* NO_PSTORE */
-      bool logdwActiveAfter__android_log_close = isLogdwActive();
-      EXPECT_FALSE(logdwActiveAfter__android_log_close);
-    }
-
-    ts1 = log_time(CLOCK_MONOTONIC);
-    EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1)));
-    if (getuid() == AID_ROOT) {
-#ifndef NO_PSTORE
-      bool pmsgActiveAfter__android_log_btwrite = isPmsgActive();
-      EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite);
-#endif /* NO_PSTORE */
-      logdwActiveAfter__android_log_btwrite = isLogdwActive();
-      EXPECT_TRUE(logdwActiveAfter__android_log_btwrite);
-    }
-  };
-
-  int count = 0;
-  int second_count = 0;
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    if ((log_msg.entry.len != sizeof(android_log_event_long_t)) ||
-        (log_msg.id() != LOG_ID_EVENTS)) {
-      return;
-    }
-
-    android_log_event_long_t* eventData;
-    eventData = reinterpret_cast<android_log_event_long_t*>(log_msg.msg());
-
-    if (!eventData || (eventData->payload.type != EVENT_TYPE_LONG)) {
-      return;
-    }
-
-    log_time tx(reinterpret_cast<char*>(&eventData->payload.data));
-    if (ts == tx) {
-      ++count;
-    } else if (ts1 == tx) {
-      ++second_count;
-    }
-
-    if (count == 1 && second_count == 1) {
-      count = 0;
-      second_count = 0;
-      *found = true;
-    }
-  };
-
-  RunLogTests(LOG_ID_EVENTS, write_function, check_function);
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, __android_log_write__android_logger_list_read) {
-#ifdef __ANDROID__
-  pid_t pid = getpid();
-
-  struct timespec ts;
-  clock_gettime(CLOCK_MONOTONIC, &ts);
-  std::string buf = android::base::StringPrintf("pid=%u ts=%ld.%09ld", pid, ts.tv_sec, ts.tv_nsec);
-  static const char tag[] = "liblog.__android_log_write__android_logger_list_read";
-  static const char prio = ANDROID_LOG_DEBUG;
-
-  std::string expected_message =
-      std::string(&prio, sizeof(prio)) + tag + std::string("", 1) + buf + std::string("", 1);
-
-  auto write_function = [&] { ASSERT_LT(0, __android_log_write(prio, tag, buf.c_str())); };
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    if (log_msg.entry.len != expected_message.length()) {
-      return;
-    }
-
-    if (expected_message != std::string(log_msg.msg(), log_msg.entry.len)) {
-      return;
-    }
-
-    *found = true;
-  };
-
-  RunLogTests(LOG_ID_MAIN, write_function, check_function);
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-static void bswrite_test(const char* message) {
-#ifdef __ANDROID__
-  pid_t pid = getpid();
-
-  log_time ts(android_log_clockid());
-
-  size_t num_lines = 1, size = 0, length = 0, total = 0;
-  const char* cp = message;
-  while (*cp) {
-    if (*cp == '\n') {
-      if (cp[1]) {
-        ++num_lines;
-      }
-    } else {
-      ++size;
-    }
-    ++cp;
-    ++total;
-    ++length;
-    if ((LOGGER_ENTRY_MAX_PAYLOAD - 4 - 1 - 4) <= length) {
-      break;
-    }
-  }
-  while (*cp) {
-    ++cp;
-    ++total;
-  }
-
-  auto write_function = [&] { EXPECT_LT(0, __android_log_bswrite(0, message)); };
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    if ((size_t)log_msg.entry.len != (sizeof(android_log_event_string_t) + length) ||
-        log_msg.id() != LOG_ID_EVENTS) {
-      return;
-    }
-
-    android_log_event_string_t* eventData;
-    eventData = reinterpret_cast<android_log_event_string_t*>(log_msg.msg());
-
-    if (!eventData || (eventData->type != EVENT_TYPE_STRING)) {
-      return;
-    }
-
-    size_t len = eventData->length;
-    if (len == total) {
-      *found = true;
-
-      AndroidLogFormat* logformat = android_log_format_new();
-      EXPECT_TRUE(NULL != logformat);
-      AndroidLogEntry entry;
-      char msgBuf[1024];
-      if (length != total) {
-        fprintf(stderr, "Expect \"Binary log entry conversion failed\"\n");
-      }
-      int processBinaryLogBuffer = android_log_processBinaryLogBuffer(
-          &log_msg.entry, &entry, nullptr, msgBuf, sizeof(msgBuf));
-      EXPECT_EQ((length == total) ? 0 : -1, processBinaryLogBuffer);
-      if ((processBinaryLogBuffer == 0) || entry.message) {
-        size_t line_overhead = 20;
-        if (pid > 99999) ++line_overhead;
-        if (pid > 999999) ++line_overhead;
-        fflush(stderr);
-        if (processBinaryLogBuffer) {
-          EXPECT_GT((int)((line_overhead * num_lines) + size),
-                    android_log_printLogLine(logformat, fileno(stderr), &entry));
-        } else {
-          EXPECT_EQ((int)((line_overhead * num_lines) + size),
-                    android_log_printLogLine(logformat, fileno(stderr), &entry));
-        }
-      }
-      android_log_format_free(logformat);
-    }
-  };
-
-  RunLogTests(LOG_ID_EVENTS, write_function, check_function);
-
-#else
-  message = NULL;
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, __android_log_bswrite_and_print) {
-  bswrite_test("Hello World");
-}
-
-TEST(liblog, __android_log_bswrite_and_print__empty_string) {
-  bswrite_test("");
-}
-
-TEST(liblog, __android_log_bswrite_and_print__newline_prefix) {
-  bswrite_test("\nHello World\n");
-}
-
-TEST(liblog, __android_log_bswrite_and_print__newline_space_prefix) {
-  bswrite_test("\n Hello World \n");
-}
-
-TEST(liblog, __android_log_bswrite_and_print__multiple_newline) {
-  bswrite_test("one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten");
-}
-
-static void buf_write_test(const char* message) {
-#ifdef __ANDROID__
-  pid_t pid = getpid();
-
-  static const char tag[] = "TEST__android_log_buf_write";
-  log_time ts(android_log_clockid());
-
-  auto write_function = [&] {
-    EXPECT_LT(0, __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_INFO, tag, message));
-  };
-  size_t num_lines = 1, size = 0, length = 0;
-  const char* cp = message;
-  while (*cp) {
-    if (*cp == '\n') {
-      if (cp[1]) {
-        ++num_lines;
-      }
-    } else {
-      ++size;
-    }
-    ++length;
-    if ((LOGGER_ENTRY_MAX_PAYLOAD - 2 - sizeof(tag)) <= length) {
-      break;
-    }
-    ++cp;
-  }
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    if ((size_t)log_msg.entry.len != (sizeof(tag) + length + 2) || log_msg.id() != LOG_ID_MAIN) {
-      return;
-    }
-
-    *found = true;
-
-    AndroidLogFormat* logformat = android_log_format_new();
-    EXPECT_TRUE(NULL != logformat);
-    AndroidLogEntry entry;
-    int processLogBuffer = android_log_processLogBuffer(&log_msg.entry, &entry);
-    EXPECT_EQ(0, processLogBuffer);
-    if (processLogBuffer == 0) {
-      size_t line_overhead = 11;
-      if (pid > 99999) ++line_overhead;
-      if (pid > 999999) ++line_overhead;
-      fflush(stderr);
-      EXPECT_EQ((int)(((line_overhead + sizeof(tag)) * num_lines) + size),
-                android_log_printLogLine(logformat, fileno(stderr), &entry));
-    }
-    android_log_format_free(logformat);
-  };
-
-  RunLogTests(LOG_ID_MAIN, write_function, check_function);
-
-#else
-  message = NULL;
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, __android_log_buf_write_and_print__empty) {
-  buf_write_test("");
-}
-
-TEST(liblog, __android_log_buf_write_and_print__newline_prefix) {
-  buf_write_test("\nHello World\n");
-}
-
-TEST(liblog, __android_log_buf_write_and_print__newline_space_prefix) {
-  buf_write_test("\n Hello World \n");
-}
-
-#ifdef ENABLE_FLAKY_TESTS
-#ifdef __ANDROID__
-static unsigned signaled;
-static log_time signal_time;
-
-/*
- *  Strictly, we are not allowed to log messages in a signal context, but we
- * do make an effort to keep the failure surface minimized, and this in-effect
- * should catch any regressions in that effort. The odds of a logged message
- * in a signal handler causing a lockup problem should be _very_ small.
- */
-static void caught_blocking_signal(int /*signum*/) {
-  unsigned long long v = 0xDEADBEEFA55A0000ULL;
-
-  v += getpid() & 0xFFFF;
-
-  ++signaled;
-  if ((signal_time.tv_sec == 0) && (signal_time.tv_nsec == 0)) {
-    signal_time = log_time(CLOCK_MONOTONIC);
-    signal_time.tv_sec += 2;
-  }
-
-  LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-}
-
-// Fill in current process user and system time in 10ms increments
-static void get_ticks(unsigned long long* uticks, unsigned long long* sticks) {
-  *uticks = *sticks = 0;
-
-  pid_t pid = getpid();
-
-  char buffer[512];
-  snprintf(buffer, sizeof(buffer), "/proc/%u/stat", pid);
-
-  FILE* fp = fopen(buffer, "re");
-  if (!fp) {
-    return;
-  }
-
-  char* cp = fgets(buffer, sizeof(buffer), fp);
-  fclose(fp);
-  if (!cp) {
-    return;
-  }
-
-  pid_t d;
-  char s[sizeof(buffer)];
-  char c;
-  long long ll;
-  unsigned long long ull;
-
-  if (15 != sscanf(buffer,
-                   "%d %s %c %lld %lld %lld %lld %lld %llu %llu %llu %llu %llu "
-                   "%llu %llu ",
-                   &d, s, &c, &ll, &ll, &ll, &ll, &ll, &ull, &ull, &ull, &ull,
-                   &ull, uticks, sticks)) {
-    *uticks = *sticks = 0;
-  }
-}
-#endif
-
-TEST(liblog, android_logger_list_read__cpu_signal) {
-#ifdef __ANDROID__
-  struct logger_list* logger_list;
-  unsigned long long v = 0xDEADBEEFA55A0000ULL;
-
-  pid_t pid = getpid();
-
-  v += pid & 0xFFFF;
-
-  ASSERT_TRUE(NULL != (logger_list = android_logger_list_open(
-                           LOG_ID_EVENTS, ANDROID_LOG_RDONLY, 1000, pid)));
-
-  int count = 0;
-
-  int signals = 0;
-
-  unsigned long long uticks_start;
-  unsigned long long sticks_start;
-  get_ticks(&uticks_start, &sticks_start);
-
-  const unsigned alarm_time = 10;
-
-  memset(&signal_time, 0, sizeof(signal_time));
-
-  signal(SIGALRM, caught_blocking_signal);
-  alarm(alarm_time);
-
-  signaled = 0;
-
-  do {
-    log_msg log_msg;
-    if (android_logger_list_read(logger_list, &log_msg) <= 0) {
-      break;
-    }
-
-    alarm(alarm_time);
-
-    ++count;
-
-    ASSERT_EQ(log_msg.entry.pid, pid);
-
-    if ((log_msg.entry.len != sizeof(android_log_event_long_t)) ||
-        (log_msg.id() != LOG_ID_EVENTS)) {
-      continue;
-    }
-
-    android_log_event_long_t* eventData;
-    eventData = reinterpret_cast<android_log_event_long_t*>(log_msg.msg());
-
-    if (!eventData || (eventData->payload.type != EVENT_TYPE_LONG)) {
-      continue;
-    }
-
-    char* cp = reinterpret_cast<char*>(&eventData->payload.data);
-    unsigned long long l = cp[0] & 0xFF;
-    l |= (unsigned long long)(cp[1] & 0xFF) << 8;
-    l |= (unsigned long long)(cp[2] & 0xFF) << 16;
-    l |= (unsigned long long)(cp[3] & 0xFF) << 24;
-    l |= (unsigned long long)(cp[4] & 0xFF) << 32;
-    l |= (unsigned long long)(cp[5] & 0xFF) << 40;
-    l |= (unsigned long long)(cp[6] & 0xFF) << 48;
-    l |= (unsigned long long)(cp[7] & 0xFF) << 56;
-
-    if (l == v) {
-      ++signals;
-      break;
-    }
-  } while (!signaled || (log_time(CLOCK_MONOTONIC) < signal_time));
-  alarm(0);
-  signal(SIGALRM, SIG_DFL);
-
-  EXPECT_LE(1, count);
-
-  EXPECT_EQ(1, signals);
-
-  android_logger_list_close(logger_list);
-
-  unsigned long long uticks_end;
-  unsigned long long sticks_end;
-  get_ticks(&uticks_end, &sticks_end);
-
-  // Less than 1% in either user or system time, or both
-  const unsigned long long one_percent_ticks = alarm_time;
-  unsigned long long user_ticks = uticks_end - uticks_start;
-  unsigned long long system_ticks = sticks_end - sticks_start;
-  EXPECT_GT(one_percent_ticks, user_ticks);
-  EXPECT_GT(one_percent_ticks, system_ticks);
-  EXPECT_GT(one_percent_ticks, user_ticks + system_ticks);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-#ifdef __ANDROID__
-/*
- *  Strictly, we are not allowed to log messages in a signal context, the
- * correct way to handle this is to ensure the messages are constructed in
- * a thread; the signal handler should only unblock the thread.
- */
-static sem_t thread_trigger;
-
-static void caught_blocking_thread(int /*signum*/) {
-  sem_post(&thread_trigger);
-}
-
-static void* running_thread(void*) {
-  unsigned long long v = 0xDEADBEAFA55A0000ULL;
-
-  v += getpid() & 0xFFFF;
-
-  struct timespec timeout;
-  clock_gettime(CLOCK_REALTIME, &timeout);
-  timeout.tv_sec += 55;
-  sem_timedwait(&thread_trigger, &timeout);
-
-  ++signaled;
-  if ((signal_time.tv_sec == 0) && (signal_time.tv_nsec == 0)) {
-    signal_time = log_time(CLOCK_MONOTONIC);
-    signal_time.tv_sec += 2;
-  }
-
-  LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-
-  return NULL;
-}
-
-static int start_thread() {
-  sem_init(&thread_trigger, 0, 0);
-
-  pthread_attr_t attr;
-  if (pthread_attr_init(&attr)) {
-    return -1;
-  }
-
-  struct sched_param param;
-
-  memset(&param, 0, sizeof(param));
-  pthread_attr_setschedparam(&attr, &param);
-  pthread_attr_setschedpolicy(&attr, SCHED_BATCH);
-
-  if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
-    pthread_attr_destroy(&attr);
-    return -1;
-  }
-
-  pthread_t thread;
-  if (pthread_create(&thread, &attr, running_thread, NULL)) {
-    pthread_attr_destroy(&attr);
-    return -1;
-  }
-
-  pthread_attr_destroy(&attr);
-  return 0;
-}
-#endif
-
-TEST(liblog, android_logger_list_read__cpu_thread) {
-#ifdef __ANDROID__
-  struct logger_list* logger_list;
-  unsigned long long v = 0xDEADBEAFA55A0000ULL;
-
-  pid_t pid = getpid();
-
-  v += pid & 0xFFFF;
-
-  ASSERT_TRUE(NULL != (logger_list = android_logger_list_open(
-                           LOG_ID_EVENTS, ANDROID_LOG_RDONLY, 1000, pid)));
-
-  int count = 0;
-
-  int signals = 0;
-
-  unsigned long long uticks_start;
-  unsigned long long sticks_start;
-  get_ticks(&uticks_start, &sticks_start);
-
-  const unsigned alarm_time = 10;
-
-  memset(&signal_time, 0, sizeof(signal_time));
-
-  signaled = 0;
-  EXPECT_EQ(0, start_thread());
-
-  signal(SIGALRM, caught_blocking_thread);
-  alarm(alarm_time);
-
-  do {
-    log_msg log_msg;
-    if (LOG_FAILURE_RETRY(android_logger_list_read(logger_list, &log_msg)) <= 0) {
-      break;
-    }
-
-    alarm(alarm_time);
-
-    ++count;
-
-    ASSERT_EQ(log_msg.entry.pid, pid);
-
-    if ((log_msg.entry.len != sizeof(android_log_event_long_t)) ||
-        (log_msg.id() != LOG_ID_EVENTS)) {
-      continue;
-    }
-
-    android_log_event_long_t* eventData;
-    eventData = reinterpret_cast<android_log_event_long_t*>(log_msg.msg());
-
-    if (!eventData || (eventData->payload.type != EVENT_TYPE_LONG)) {
-      continue;
-    }
-
-    char* cp = reinterpret_cast<char*>(&eventData->payload.data);
-    unsigned long long l = cp[0] & 0xFF;
-    l |= (unsigned long long)(cp[1] & 0xFF) << 8;
-    l |= (unsigned long long)(cp[2] & 0xFF) << 16;
-    l |= (unsigned long long)(cp[3] & 0xFF) << 24;
-    l |= (unsigned long long)(cp[4] & 0xFF) << 32;
-    l |= (unsigned long long)(cp[5] & 0xFF) << 40;
-    l |= (unsigned long long)(cp[6] & 0xFF) << 48;
-    l |= (unsigned long long)(cp[7] & 0xFF) << 56;
-
-    if (l == v) {
-      ++signals;
-      break;
-    }
-  } while (!signaled || (log_time(CLOCK_MONOTONIC) < signal_time));
-  alarm(0);
-  signal(SIGALRM, SIG_DFL);
-
-  EXPECT_LE(1, count);
-
-  EXPECT_EQ(1, signals);
-
-  android_logger_list_close(logger_list);
-
-  unsigned long long uticks_end;
-  unsigned long long sticks_end;
-  get_ticks(&uticks_end, &sticks_end);
-
-  // Less than 1% in either user or system time, or both
-  const unsigned long long one_percent_ticks = alarm_time;
-  unsigned long long user_ticks = uticks_end - uticks_start;
-  unsigned long long system_ticks = sticks_end - sticks_start;
-  EXPECT_GT(one_percent_ticks, user_ticks);
-  EXPECT_GT(one_percent_ticks, system_ticks);
-  EXPECT_GT(one_percent_ticks, user_ticks + system_ticks);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-#endif  // ENABLE_FLAKY_TESTS
-
-static const char max_payload_buf[] =
-    "LEONATO\n\
-I learn in this letter that Don Peter of Arragon\n\
-comes this night to Messina\n\
-MESSENGER\n\
-He is very near by this: he was not three leagues off\n\
-when I left him\n\
-LEONATO\n\
-How many gentlemen have you lost in this action?\n\
-MESSENGER\n\
-But few of any sort, and none of name\n\
-LEONATO\n\
-A victory is twice itself when the achiever brings\n\
-home full numbers. I find here that Don Peter hath\n\
-bestowed much honour on a young Florentine called Claudio\n\
-MESSENGER\n\
-Much deserved on his part and equally remembered by\n\
-Don Pedro: he hath borne himself beyond the\n\
-promise of his age, doing, in the figure of a lamb,\n\
-the feats of a lion: he hath indeed better\n\
-bettered expectation than you must expect of me to\n\
-tell you how\n\
-LEONATO\n\
-He hath an uncle here in Messina will be very much\n\
-glad of it.\n\
-MESSENGER\n\
-I have already delivered him letters, and there\n\
-appears much joy in him; even so much that joy could\n\
-not show itself modest enough without a badge of\n\
-bitterness.\n\
-LEONATO\n\
-Did he break out into tears?\n\
-MESSENGER\n\
-In great measure.\n\
-LEONATO\n\
-A kind overflow of kindness: there are no faces\n\
-truer than those that are so washed. How much\n\
-better is it to weep at joy than to joy at weeping!\n\
-BEATRICE\n\
-I pray you, is Signior Mountanto returned from the\n\
-wars or no?\n\
-MESSENGER\n\
-I know none of that name, lady: there was none such\n\
-in the army of any sort.\n\
-LEONATO\n\
-What is he that you ask for, niece?\n\
-HERO\n\
-My cousin means Signior Benedick of Padua.\n\
-MESSENGER\n\
-O, he's returned; and as pleasant as ever he was.\n\
-BEATRICE\n\
-He set up his bills here in Messina and challenged\n\
-Cupid at the flight; and my uncle's fool, reading\n\
-the challenge, subscribed for Cupid, and challenged\n\
-him at the bird-bolt. I pray you, how many hath he\n\
-killed and eaten in these wars? But how many hath\n\
-he killed? for indeed I promised to eat all of his killing.\n\
-LEONATO\n\
-Faith, niece, you tax Signior Benedick too much;\n\
-but he'll be meet with you, I doubt it not.\n\
-MESSENGER\n\
-He hath done good service, lady, in these wars.\n\
-BEATRICE\n\
-You had musty victual, and he hath holp to eat it:\n\
-he is a very valiant trencherman; he hath an\n\
-excellent stomach.\n\
-MESSENGER\n\
-And a good soldier too, lady.\n\
-BEATRICE\n\
-And a good soldier to a lady: but what is he to a lord?\n\
-MESSENGER\n\
-A lord to a lord, a man to a man; stuffed with all\n\
-honourable virtues.\n\
-BEATRICE\n\
-It is so, indeed; he is no less than a stuffed man:\n\
-but for the stuffing,--well, we are all mortal.\n\
-LEONATO\n\
-You must not, sir, mistake my niece. There is a\n\
-kind of merry war betwixt Signior Benedick and her:\n\
-they never meet but there's a skirmish of wit\n\
-between them.\n\
-BEATRICE\n\
-Alas! he gets nothing by that. In our last\n\
-conflict four of his five wits went halting off, and\n\
-now is the whole man governed with one: so that if\n\
-he have wit enough to keep himself warm, let him\n\
-bear it for a difference between himself and his\n\
-horse; for it is all the wealth that he hath left,\n\
-to be known a reasonable creature. Who is his\n\
-companion now? He hath every month a new sworn brother.\n\
-MESSENGER\n\
-Is't possible?\n\
-BEATRICE\n\
-Very easily possible: he wears his faith but as\n\
-the fashion of his hat; it ever changes with the\n\
-next block.\n\
-MESSENGER\n\
-I see, lady, the gentleman is not in your books.\n\
-BEATRICE\n\
-No; an he were, I would burn my study. But, I pray\n\
-you, who is his companion? Is there no young\n\
-squarer now that will make a voyage with him to the devil?\n\
-MESSENGER\n\
-He is most in the company of the right noble Claudio.\n\
-BEATRICE\n\
-O Lord, he will hang upon him like a disease: he\n\
-is sooner caught than the pestilence, and the taker\n\
-runs presently mad. God help the noble Claudio! if\n\
-he have caught the Benedick, it will cost him a\n\
-thousand pound ere a' be cured.\n\
-MESSENGER\n\
-I will hold friends with you, lady.\n\
-BEATRICE\n\
-Do, good friend.\n\
-LEONATO\n\
-You will never run mad, niece.\n\
-BEATRICE\n\
-No, not till a hot January.\n\
-MESSENGER\n\
-Don Pedro is approached.\n\
-Enter DON PEDRO, DON JOHN, CLAUDIO, BENEDICK, and BALTHASAR\n\
-\n\
-DON PEDRO\n\
-Good Signior Leonato, you are come to meet your\n\
-trouble: the fashion of the world is to avoid\n\
-cost, and you encounter it\n\
-LEONATO\n\
-Never came trouble to my house in the likeness of your grace,\n\
-for trouble being gone, comfort should remain, but\n\
-when you depart from me, sorrow abides and happiness\n\
-takes his leave.";
-
-TEST(liblog, max_payload) {
-#ifdef __ANDROID__
-  static const char max_payload_tag[] = "TEST_max_payload_and_longish_tag_XXXX";
-#define SIZEOF_MAX_PAYLOAD_BUF (LOGGER_ENTRY_MAX_PAYLOAD - sizeof(max_payload_tag) - 1)
-
-  pid_t pid = getpid();
-  char tag[sizeof(max_payload_tag)];
-  memcpy(tag, max_payload_tag, sizeof(tag));
-  snprintf(tag + sizeof(tag) - 5, 5, "%04X", pid & 0xFFFF);
-
-  auto write_function = [&] {
-    LOG_FAILURE_RETRY(
-        __android_log_buf_write(LOG_ID_SYSTEM, ANDROID_LOG_INFO, tag, max_payload_buf));
-  };
-
-  ssize_t max_len = 0;
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    char* data = log_msg.msg();
-
-    if (!data || strcmp(++data, tag)) {
-      return;
-    }
-
-    data += strlen(data) + 1;
-
-    const char* left = data;
-    const char* right = max_payload_buf;
-    while (*left && *right && (*left == *right)) {
-      ++left;
-      ++right;
-    }
-
-    if (max_len <= (left - data)) {
-      max_len = left - data + 1;
-    }
-
-    if (max_len > 512) {
-      *found = true;
-    }
-  };
-
-  RunLogTests(LOG_ID_SYSTEM, write_function, check_function);
-
-  EXPECT_LE(SIZEOF_MAX_PAYLOAD_BUF, static_cast<size_t>(max_len));
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, __android_log_buf_print__maxtag) {
-#ifdef __ANDROID__
-  auto write_function = [&] {
-    EXPECT_LT(0, __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_INFO, max_payload_buf,
-                                         max_payload_buf));
-  };
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    if ((size_t)log_msg.entry.len < LOGGER_ENTRY_MAX_PAYLOAD) {
-      return;
-    }
-
-    *found = true;
-
-    AndroidLogFormat* logformat = android_log_format_new();
-    EXPECT_TRUE(NULL != logformat);
-    AndroidLogEntry entry;
-    int processLogBuffer = android_log_processLogBuffer(&log_msg.entry, &entry);
-    EXPECT_EQ(0, processLogBuffer);
-    if (processLogBuffer == 0) {
-      fflush(stderr);
-      int printLogLine =
-          android_log_printLogLine(logformat, fileno(stderr), &entry);
-      // Legacy tag truncation
-      EXPECT_LE(128, printLogLine);
-      // Measured maximum if we try to print part of the tag as message
-      EXPECT_GT(LOGGER_ENTRY_MAX_PAYLOAD * 13 / 8, printLogLine);
-    }
-    android_log_format_free(logformat);
-  };
-
-  RunLogTests(LOG_ID_MAIN, write_function, check_function);
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-// TODO: This test is tautological. android_logger_list_read() calls recv() with
-// LOGGER_ENTRY_MAX_PAYLOAD as its size argument, so it's not possible for this test to read a
-// payload larger than that size.
-TEST(liblog, too_big_payload) {
-#ifdef __ANDROID__
-  pid_t pid = getpid();
-  static const char big_payload_tag[] = "TEST_big_payload_XXXX";
-  char tag[sizeof(big_payload_tag)];
-  memcpy(tag, big_payload_tag, sizeof(tag));
-  snprintf(tag + sizeof(tag) - 5, 5, "%04X", pid & 0xFFFF);
-
-  std::string longString(3266519, 'x');
-  ssize_t ret;
-
-  auto write_function = [&] {
-    ret = LOG_FAILURE_RETRY(
-        __android_log_buf_write(LOG_ID_SYSTEM, ANDROID_LOG_INFO, tag, longString.c_str()));
-  };
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    char* data = log_msg.msg();
-
-    if (!data || strcmp(++data, tag)) {
-      return;
-    }
-
-    data += strlen(data) + 1;
-
-    const char* left = data;
-    const char* right = longString.c_str();
-    while (*left && *right && (*left == *right)) {
-      ++left;
-      ++right;
-    }
-
-    ssize_t len = left - data + 1;
-    // Check that we don't see any entries larger than the max payload.
-    EXPECT_LE(static_cast<size_t>(len), LOGGER_ENTRY_MAX_PAYLOAD - sizeof(big_payload_tag));
-
-    // Once we've found our expected entry, break.
-    if (len == LOGGER_ENTRY_MAX_PAYLOAD - sizeof(big_payload_tag)) {
-      *found = true;
-    }
-  };
-
-  RunLogTests(LOG_ID_SYSTEM, write_function, check_function);
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, dual_reader) {
-#ifdef __ANDROID__
-  static const int expected_count1 = 25;
-  static const int expected_count2 = 25;
-
-  pid_t pid = getpid();
-
-  auto logger_list1 = std::unique_ptr<struct logger_list, ListCloser>{
-      android_logger_list_open(LOG_ID_MAIN, ANDROID_LOG_RDONLY, expected_count1, pid)};
-  ASSERT_TRUE(logger_list1);
-
-  auto logger_list2 = std::unique_ptr<struct logger_list, ListCloser>{
-      android_logger_list_open(LOG_ID_MAIN, ANDROID_LOG_RDONLY, expected_count2, pid)};
-  ASSERT_TRUE(logger_list2);
-
-  for (int i = 25; i > 0; --i) {
-    static const char fmt[] = "dual_reader %02d";
-    char buffer[sizeof(fmt) + 8];
-    snprintf(buffer, sizeof(buffer), fmt, i);
-    LOG_FAILURE_RETRY(__android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_INFO,
-                                              "liblog", buffer));
-  }
-
-  alarm(2);
-  auto alarm_guard = android::base::make_scope_guard([] { alarm(0); });
-
-  // Wait until we see all messages with the blocking reader.
-  int count1 = 0;
-  int count2 = 0;
-
-  while (count1 != expected_count2 || count2 != expected_count2) {
-    log_msg log_msg;
-    if (count1 < expected_count1) {
-      ASSERT_GT(android_logger_list_read(logger_list1.get(), &log_msg), 0);
-      count1++;
-    }
-    if (count2 < expected_count2) {
-      ASSERT_GT(android_logger_list_read(logger_list2.get(), &log_msg), 0);
-      count2++;
-    }
-  }
-
-  // Test again with the nonblocking reader.
-  auto logger_list_non_block1 =
-      std::unique_ptr<struct logger_list, ListCloser>{android_logger_list_open(
-          LOG_ID_MAIN, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, expected_count1, pid)};
-  ASSERT_TRUE(logger_list_non_block1);
-
-  auto logger_list_non_block2 =
-      std::unique_ptr<struct logger_list, ListCloser>{android_logger_list_open(
-          LOG_ID_MAIN, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, expected_count2, pid)};
-  ASSERT_TRUE(logger_list_non_block2);
-  count1 = 0;
-  count2 = 0;
-  bool done1 = false;
-  bool done2 = false;
-
-  while (!done1 || !done2) {
-    log_msg log_msg;
-
-    if (!done1) {
-      if (android_logger_list_read(logger_list_non_block1.get(), &log_msg) <= 0) {
-        done1 = true;
-      } else {
-        ++count1;
-      }
-    }
-
-    if (!done2) {
-      if (android_logger_list_read(logger_list_non_block2.get(), &log_msg) <= 0) {
-        done2 = true;
-      } else {
-        ++count2;
-      }
-    }
-  }
-
-  EXPECT_EQ(expected_count1, count1);
-  EXPECT_EQ(expected_count2, count2);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-static bool checkPriForTag(AndroidLogFormat* p_format, const char* tag,
-                           android_LogPriority pri) {
-  return android_log_shouldPrintLine(p_format, tag, pri) &&
-         !android_log_shouldPrintLine(p_format, tag,
-                                      (android_LogPriority)(pri - 1));
-}
-
-TEST(liblog, filterRule) {
-  static const char tag[] = "random";
-
-  AndroidLogFormat* p_format = android_log_format_new();
-
-  android_log_addFilterRule(p_format, "*:i");
-
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_INFO));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) ==
-              0);
-  android_log_addFilterRule(p_format, "*");
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_DEBUG));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0);
-  android_log_addFilterRule(p_format, "*:v");
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_VERBOSE));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0);
-  android_log_addFilterRule(p_format, "*:i");
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_INFO));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) ==
-              0);
-
-  android_log_addFilterRule(p_format, tag);
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_VERBOSE));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0);
-  android_log_addFilterRule(p_format, "random:v");
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_VERBOSE));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0);
-  android_log_addFilterRule(p_format, "random:d");
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_DEBUG));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0);
-  android_log_addFilterRule(p_format, "random:w");
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_WARN));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) ==
-              0);
-
-  android_log_addFilterRule(p_format, "crap:*");
-  EXPECT_TRUE(checkPriForTag(p_format, "crap", ANDROID_LOG_VERBOSE));
-  EXPECT_TRUE(
-      android_log_shouldPrintLine(p_format, "crap", ANDROID_LOG_VERBOSE) > 0);
-
-  // invalid expression
-  EXPECT_TRUE(android_log_addFilterRule(p_format, "random:z") < 0);
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_WARN));
-  EXPECT_TRUE(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) ==
-              0);
-
-  // Issue #550946
-  EXPECT_TRUE(android_log_addFilterString(p_format, " ") == 0);
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_WARN));
-
-  // note trailing space
-  EXPECT_TRUE(android_log_addFilterString(p_format, "*:s random:d ") == 0);
-  EXPECT_TRUE(checkPriForTag(p_format, tag, ANDROID_LOG_DEBUG));
-
-  EXPECT_TRUE(android_log_addFilterString(p_format, "*:s random:z") < 0);
-
-#if 0  // bitrot, seek update
-    char defaultBuffer[512];
-
-    android_log_formatLogLine(p_format,
-        defaultBuffer, sizeof(defaultBuffer), 0, ANDROID_LOG_ERROR, 123,
-        123, 123, tag, "nofile", strlen("Hello"), "Hello", NULL);
-
-    fprintf(stderr, "%s\n", defaultBuffer);
-#endif
-
-  android_log_format_free(p_format);
-}
-
-#ifdef ENABLE_FLAKY_TESTS
-TEST(liblog, is_loggable) {
-#ifdef __ANDROID__
-  static const char tag[] = "is_loggable";
-  static const char log_namespace[] = "persist.log.tag.";
-  static const size_t base_offset = 8; /* skip "persist." */
-  // sizeof("string") = strlen("string") + 1
-  char key[sizeof(log_namespace) + sizeof(tag) - 1];
-  char hold[4][PROP_VALUE_MAX];
-  static const struct {
-    int level;
-    char type;
-  } levels[] = {
-      {ANDROID_LOG_VERBOSE, 'v'}, {ANDROID_LOG_DEBUG, 'd'},
-      {ANDROID_LOG_INFO, 'i'},    {ANDROID_LOG_WARN, 'w'},
-      {ANDROID_LOG_ERROR, 'e'},   {ANDROID_LOG_FATAL, 'a'},
-      {ANDROID_LOG_SILENT, 's'},  {-2, 'g'},  // Illegal value, resort to default
-  };
-
-  // Set up initial test condition
-  memset(hold, 0, sizeof(hold));
-  snprintf(key, sizeof(key), "%s%s", log_namespace, tag);
-  property_get(key, hold[0], "");
-  property_set(key, "");
-  property_get(key + base_offset, hold[1], "");
-  property_set(key + base_offset, "");
-  strcpy(key, log_namespace);
-  key[sizeof(log_namespace) - 2] = '\0';
-  property_get(key, hold[2], "");
-  property_set(key, "");
-  property_get(key, hold[3], "");
-  property_set(key + base_offset, "");
-
-  // All combinations of level and defaults
-  for (size_t i = 0; i < (sizeof(levels) / sizeof(levels[0])); ++i) {
-    if (levels[i].level == -2) {
-      continue;
-    }
-    for (size_t j = 0; j < (sizeof(levels) / sizeof(levels[0])); ++j) {
-      if (levels[j].level == -2) {
-        continue;
-      }
-      fprintf(stderr, "i=%zu j=%zu\r", i, j);
-      bool android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), levels[j].level);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1)) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), levels[j].level));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), levels[j].level));
-        }
-      }
-    }
-  }
-
-  // All combinations of level and tag and global properties
-  for (size_t i = 0; i < (sizeof(levels) / sizeof(levels[0])); ++i) {
-    if (levels[i].level == -2) {
-      continue;
-    }
-    for (size_t j = 0; j < (sizeof(levels) / sizeof(levels[0])); ++j) {
-      char buf[2];
-      buf[0] = levels[j].type;
-      buf[1] = '\0';
-
-      snprintf(key, sizeof(key), "%s%s", log_namespace, tag);
-      fprintf(stderr, "i=%zu j=%zu property_set(\"%s\",\"%s\")\r", i, j, key,
-              buf);
-      usleep(20000);
-      property_set(key, buf);
-      bool android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1) ||
-          ((levels[i].level < ANDROID_LOG_DEBUG) && (levels[j].level == -2))) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      }
-      usleep(20000);
-      property_set(key, "");
-
-      fprintf(stderr, "i=%zu j=%zu property_set(\"%s\",\"%s\")\r", i, j,
-              key + base_offset, buf);
-      property_set(key + base_offset, buf);
-      android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1) ||
-          ((levels[i].level < ANDROID_LOG_DEBUG) && (levels[j].level == -2))) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      }
-      usleep(20000);
-      property_set(key + base_offset, "");
-
-      strcpy(key, log_namespace);
-      key[sizeof(log_namespace) - 2] = '\0';
-      fprintf(stderr, "i=%zu j=%zu property_set(\"%s\",\"%s\")\r", i, j, key,
-              buf);
-      property_set(key, buf);
-      android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1) ||
-          ((levels[i].level < ANDROID_LOG_DEBUG) && (levels[j].level == -2))) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      }
-      usleep(20000);
-      property_set(key, "");
-
-      fprintf(stderr, "i=%zu j=%zu property_set(\"%s\",\"%s\")\r", i, j,
-              key + base_offset, buf);
-      property_set(key + base_offset, buf);
-      android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1) ||
-          ((levels[i].level < ANDROID_LOG_DEBUG) && (levels[j].level == -2))) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      }
-      usleep(20000);
-      property_set(key + base_offset, "");
-    }
-  }
-
-  // All combinations of level and tag properties, but with global set to INFO
-  strcpy(key, log_namespace);
-  key[sizeof(log_namespace) - 2] = '\0';
-  usleep(20000);
-  property_set(key, "I");
-  snprintf(key, sizeof(key), "%s%s", log_namespace, tag);
-  for (size_t i = 0; i < (sizeof(levels) / sizeof(levels[0])); ++i) {
-    if (levels[i].level == -2) {
-      continue;
-    }
-    for (size_t j = 0; j < (sizeof(levels) / sizeof(levels[0])); ++j) {
-      char buf[2];
-      buf[0] = levels[j].type;
-      buf[1] = '\0';
-
-      fprintf(stderr, "i=%zu j=%zu property_set(\"%s\",\"%s\")\r", i, j, key,
-              buf);
-      usleep(20000);
-      property_set(key, buf);
-      bool android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1) ||
-          ((levels[i].level < ANDROID_LOG_INFO)  // Yes INFO
-           && (levels[j].level == -2))) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      }
-      usleep(20000);
-      property_set(key, "");
-
-      fprintf(stderr, "i=%zu j=%zu property_set(\"%s\",\"%s\")\r", i, j,
-              key + base_offset, buf);
-      property_set(key + base_offset, buf);
-      android_log_is_loggable = __android_log_is_loggable_len(
-          levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG);
-      if ((levels[i].level < levels[j].level) || (levels[j].level == -1) ||
-          ((levels[i].level < ANDROID_LOG_INFO)  // Yes INFO
-           && (levels[j].level == -2))) {
-        if (android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_FALSE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_FALSE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      } else {
-        if (!android_log_is_loggable) {
-          fprintf(stderr, "\n");
-        }
-        EXPECT_TRUE(android_log_is_loggable);
-        for (size_t k = 10; k; --k) {
-          EXPECT_TRUE(__android_log_is_loggable_len(
-              levels[i].level, tag, strlen(tag), ANDROID_LOG_DEBUG));
-        }
-      }
-      usleep(20000);
-      property_set(key + base_offset, "");
-    }
-  }
-
-  // reset parms
-  snprintf(key, sizeof(key), "%s%s", log_namespace, tag);
-  usleep(20000);
-  property_set(key, hold[0]);
-  property_set(key + base_offset, hold[1]);
-  strcpy(key, log_namespace);
-  key[sizeof(log_namespace) - 2] = '\0';
-  property_set(key, hold[2]);
-  property_set(key + base_offset, hold[3]);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-#endif  // ENABLE_FLAKY_TESTS
-
-#ifdef ENABLE_FLAKY_TESTS
-// Following tests the specific issues surrounding error handling wrt logd.
-// Kills logd and toss all collected data, equivalent to logcat -b all -c,
-// except we also return errors to the logging callers.
-#ifdef __ANDROID__
-// helper to liblog.enoent to count end-to-end matching logging messages.
-static int count_matching_ts(log_time ts) {
-  usleep(1000000);
-
-  pid_t pid = getpid();
-
-  struct logger_list* logger_list = android_logger_list_open(
-      LOG_ID_EVENTS, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 1000, pid);
-
-  int count = 0;
-  if (logger_list == NULL) return count;
-
-  for (;;) {
-    log_msg log_msg;
-    if (android_logger_list_read(logger_list, &log_msg) <= 0) break;
-
-    if (log_msg.entry.len != sizeof(android_log_event_long_t)) continue;
-    if (log_msg.id() != LOG_ID_EVENTS) continue;
-
-    android_log_event_long_t* eventData;
-    eventData = reinterpret_cast<android_log_event_long_t*>(log_msg.msg());
-    if (!eventData) continue;
-    if (eventData->payload.type != EVENT_TYPE_LONG) continue;
-
-    log_time tx(reinterpret_cast<char*>(&eventData->payload.data));
-    if (ts != tx) continue;
-
-    // found event message with matching timestamp signature in payload
-    ++count;
-  }
-  android_logger_list_close(logger_list);
-
-  return count;
-}
-
-TEST(liblog, enoent) {
-#ifdef __ANDROID__
-  if (getuid() != 0) {
-    GTEST_SKIP() << "Skipping test, must be run as root.";
-    return;
-  }
-
-  log_time ts(CLOCK_MONOTONIC);
-  EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-  EXPECT_EQ(1, count_matching_ts(ts));
-
-  // This call will fail unless we are root, beware of any
-  // test prior to this one playing with setuid and causing interference.
-  // We need to run before these tests so that they do not interfere with
-  // this test.
-  //
-  // Stopping the logger can affect some other test's expectations as they
-  // count on the log buffers filled with existing content, and this
-  // effectively does a logcat -c emptying it.  So we want this test to be
-  // as near as possible to the bottom of the file.  For example
-  // liblog.android_logger_get_ is one of those tests that has no recourse
-  // and that would be adversely affected by emptying the log if it was run
-  // right after this test.
-  system("stop logd");
-  usleep(1000000);
-
-  // A clean stop like we are testing returns -ENOENT, but in the _real_
-  // world we could get -ENOTCONN or -ECONNREFUSED depending on timing.
-  // Alas we can not test these other return values; accept that they
-  // are treated equally within the open-retry logic in liblog.
-  ts = log_time(CLOCK_MONOTONIC);
-  int ret = __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts));
-  std::string content = android::base::StringPrintf(
-      "__android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)) = %d %s\n",
-      ret, (ret <= 0) ? strerror(-ret) : "(content sent)");
-  EXPECT_TRUE(ret == -ENOENT || ret == -ENOTCONN || ret == -ECONNREFUSED) << content;
-  ret = __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts));
-  content = android::base::StringPrintf(
-      "__android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)) = %d %s\n",
-      ret, (ret <= 0) ? strerror(-ret) : "(content sent)");
-  EXPECT_TRUE(ret == -ENOENT || ret == -ENOTCONN || ret == -ECONNREFUSED) << content;
-  EXPECT_EQ(0, count_matching_ts(ts));
-
-  system("start logd");
-  usleep(1000000);
-
-  EXPECT_EQ(0, count_matching_ts(ts));
-
-  ts = log_time(CLOCK_MONOTONIC);
-  EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-  EXPECT_EQ(1, count_matching_ts(ts));
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-#endif  // __ANDROID__
-#endif  // ENABLE_FLAKY_TESTS
-
-// Below this point we run risks of setuid(AID_SYSTEM) which may affect others.
-
-#ifdef ENABLE_FLAKY_TESTS
-// Do not retest properties, and cannot log into LOG_ID_SECURITY
-TEST(liblog, __security) {
-#ifdef __ANDROID__
-  static const char persist_key[] = "persist.logd.security";
-  static const char readonly_key[] = "ro.organization_owned";
-  // A silly default value that can never be in readonly_key so
-  // that it can be determined the property is not set.
-  static const char nothing_val[] = "_NOTHING_TO_SEE_HERE_";
-  char persist[PROP_VALUE_MAX];
-  char persist_hold[PROP_VALUE_MAX];
-  char readonly[PROP_VALUE_MAX];
-
-  // First part of this test requires the test itself to have the appropriate
-  // permissions. If we do not have them, we can not override them, so we
-  // bail rather than give a failing grade.
-  property_get(persist_key, persist, "");
-  fprintf(stderr, "INFO: getprop %s -> %s\n", persist_key, persist);
-  strncpy(persist_hold, persist, PROP_VALUE_MAX);
-  property_get(readonly_key, readonly, nothing_val);
-  fprintf(stderr, "INFO: getprop %s -> %s\n", readonly_key, readonly);
-
-  if (!strcmp(readonly, nothing_val)) {
-    // Lets check if we can set the value (we should not be allowed to do so)
-    EXPECT_FALSE(__android_log_security());
-    fprintf(stderr, "WARNING: setting ro.organization_owned to a domain\n");
-    static const char domain[] = "com.google.android.SecOps.DeviceOwner";
-    EXPECT_NE(0, property_set(readonly_key, domain));
-    useconds_t total_time = 0;
-    static const useconds_t seconds = 1000000;
-    static const useconds_t max_time = 5 * seconds;  // not going to happen
-    static const useconds_t rest = 20 * 1000;
-    for (; total_time < max_time; total_time += rest) {
-      usleep(rest);  // property system does not guarantee performance.
-      property_get(readonly_key, readonly, nothing_val);
-      if (!strcmp(readonly, domain)) {
-        if (total_time > rest) {
-          fprintf(stderr, "INFO: took %u.%06u seconds to set property\n",
-                  (unsigned)(total_time / seconds),
-                  (unsigned)(total_time % seconds));
-        }
-        break;
-      }
-    }
-    EXPECT_STRNE(domain, readonly);
-  }
-
-  if (!strcasecmp(readonly, "false") || !readonly[0] ||
-      !strcmp(readonly, nothing_val)) {
-    // not enough permissions to run tests surrounding persist.logd.security
-    EXPECT_FALSE(__android_log_security());
-    return;
-  }
-
-  if (!strcasecmp(persist, "true")) {
-    EXPECT_TRUE(__android_log_security());
-  } else {
-    EXPECT_FALSE(__android_log_security());
-  }
-  property_set(persist_key, "TRUE");
-  property_get(persist_key, persist, "");
-  uid_t uid = getuid();
-  gid_t gid = getgid();
-  bool perm = (gid == AID_ROOT) || (uid == AID_ROOT);
-  EXPECT_STREQ(perm ? "TRUE" : persist_hold, persist);
-  if (!strcasecmp(persist, "true")) {
-    EXPECT_TRUE(__android_log_security());
-  } else {
-    EXPECT_FALSE(__android_log_security());
-  }
-  property_set(persist_key, "FALSE");
-  property_get(persist_key, persist, "");
-  EXPECT_STREQ(perm ? "FALSE" : persist_hold, persist);
-  if (!strcasecmp(persist, "true")) {
-    EXPECT_TRUE(__android_log_security());
-  } else {
-    EXPECT_FALSE(__android_log_security());
-  }
-  property_set(persist_key, "true");
-  property_get(persist_key, persist, "");
-  EXPECT_STREQ(perm ? "true" : persist_hold, persist);
-  if (!strcasecmp(persist, "true")) {
-    EXPECT_TRUE(__android_log_security());
-  } else {
-    EXPECT_FALSE(__android_log_security());
-  }
-  property_set(persist_key, "false");
-  property_get(persist_key, persist, "");
-  EXPECT_STREQ(perm ? "false" : persist_hold, persist);
-  if (!strcasecmp(persist, "true")) {
-    EXPECT_TRUE(__android_log_security());
-  } else {
-    EXPECT_FALSE(__android_log_security());
-  }
-  property_set(persist_key, "");
-  property_get(persist_key, persist, "");
-  EXPECT_STREQ(perm ? "" : persist_hold, persist);
-  if (!strcasecmp(persist, "true")) {
-    EXPECT_TRUE(__android_log_security());
-  } else {
-    EXPECT_FALSE(__android_log_security());
-  }
-  property_set(persist_key, persist_hold);
-  property_get(persist_key, persist, "");
-  EXPECT_STREQ(persist_hold, persist);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, __security_buffer) {
-#ifdef __ANDROID__
-  struct logger_list* logger_list;
-  android_event_long_t buffer;
-
-  static const char persist_key[] = "persist.logd.security";
-  char persist[PROP_VALUE_MAX];
-  bool set_persist = false;
-  bool allow_security = false;
-
-  if (__android_log_security()) {
-    allow_security = true;
-  } else {
-    property_get(persist_key, persist, "");
-    if (strcasecmp(persist, "true")) {
-      property_set(persist_key, "TRUE");
-      if (__android_log_security()) {
-        allow_security = true;
-        set_persist = true;
-      } else {
-        property_set(persist_key, persist);
-      }
-    }
-  }
-
-  if (!allow_security) {
-    fprintf(stderr,
-            "WARNING: "
-            "security buffer disabled, bypassing end-to-end test\n");
-
-    log_time ts(CLOCK_MONOTONIC);
-
-    buffer.type = EVENT_TYPE_LONG;
-    buffer.data = *(static_cast<uint64_t*>((void*)&ts));
-
-    // expect failure!
-    ASSERT_GE(0, __android_log_security_bwrite(0, &buffer, sizeof(buffer)));
-
-    return;
-  }
-
-  /* Matches clientHasLogCredentials() in logd */
-  uid_t uid = getuid();
-  gid_t gid = getgid();
-  bool clientHasLogCredentials = true;
-  if ((uid != AID_SYSTEM) && (uid != AID_ROOT) && (uid != AID_LOG) &&
-      (gid != AID_SYSTEM) && (gid != AID_ROOT) && (gid != AID_LOG)) {
-    uid_t euid = geteuid();
-    if ((euid != AID_SYSTEM) && (euid != AID_ROOT) && (euid != AID_LOG)) {
-      gid_t egid = getegid();
-      if ((egid != AID_SYSTEM) && (egid != AID_ROOT) && (egid != AID_LOG)) {
-        int num_groups = getgroups(0, NULL);
-        if (num_groups > 0) {
-          gid_t groups[num_groups];
-          num_groups = getgroups(num_groups, groups);
-          while (num_groups > 0) {
-            if (groups[num_groups - 1] == AID_LOG) {
-              break;
-            }
-            --num_groups;
-          }
-        }
-        if (num_groups <= 0) {
-          clientHasLogCredentials = false;
-        }
-      }
-    }
-  }
-  if (!clientHasLogCredentials) {
-    fprintf(stderr,
-            "WARNING: "
-            "not in system context, bypassing end-to-end test\n");
-
-    log_time ts(CLOCK_MONOTONIC);
-
-    buffer.type = EVENT_TYPE_LONG;
-    buffer.data = *(static_cast<uint64_t*>((void*)&ts));
-
-    // expect failure!
-    ASSERT_GE(0, __android_log_security_bwrite(0, &buffer, sizeof(buffer)));
-
-    return;
-  }
-
-  EXPECT_EQ(0, setuid(AID_SYSTEM));  // only one that can read security buffer
-
-  uid = getuid();
-  gid = getgid();
-  pid_t pid = getpid();
-
-  ASSERT_TRUE(NULL !=
-              (logger_list = android_logger_list_open(
-                   LOG_ID_SECURITY, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK,
-                   1000, pid)));
-
-  log_time ts(CLOCK_MONOTONIC);
-
-  buffer.type = EVENT_TYPE_LONG;
-  buffer.data = *(static_cast<uint64_t*>((void*)&ts));
-
-  ASSERT_LT(0, __android_log_security_bwrite(0, &buffer, sizeof(buffer)));
-  usleep(1000000);
-
-  int count = 0;
-
-  for (;;) {
-    log_msg log_msg;
-    if (android_logger_list_read(logger_list, &log_msg) <= 0) {
-      break;
-    }
-
-    ASSERT_EQ(log_msg.entry.pid, pid);
-
-    if ((log_msg.entry.len != sizeof(android_log_event_long_t)) ||
-        (log_msg.id() != LOG_ID_SECURITY)) {
-      continue;
-    }
-
-    android_log_event_long_t* eventData;
-    eventData = reinterpret_cast<android_log_event_long_t*>(log_msg.msg());
-
-    if (!eventData || (eventData->payload.type != EVENT_TYPE_LONG)) {
-      continue;
-    }
-
-    log_time tx(reinterpret_cast<char*>(&eventData->payload.data));
-    if (ts == tx) {
-      ++count;
-    }
-  }
-
-  if (set_persist) {
-    property_set(persist_key, persist);
-  }
-
-  android_logger_list_close(logger_list);
-
-  bool clientHasSecurityCredentials = (uid == AID_SYSTEM) || (gid == AID_SYSTEM);
-  if (!clientHasSecurityCredentials) {
-    fprintf(stderr,
-            "WARNING: "
-            "not system, content submitted but can not check end-to-end\n");
-  }
-  EXPECT_EQ(clientHasSecurityCredentials ? 1 : 0, count);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-#endif  // ENABLE_FLAKY_TESTS
-
-#ifdef __ANDROID__
-static void android_errorWriteWithInfoLog_helper(int tag, const char* subtag, int uid,
-                                                 const char* payload, int data_len) {
-  auto write_function = [&] {
-    int ret = android_errorWriteWithInfoLog(tag, subtag, uid, payload, data_len);
-    ASSERT_LT(0, ret);
-  };
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    char* event_data = log_msg.msg();
-    char* original = event_data;
-
-    // Tag
-    auto* event_header = reinterpret_cast<android_event_header_t*>(event_data);
-    event_data += sizeof(android_event_header_t);
-    if (event_header->tag != tag) {
-      return;
-    }
-
-    // List type
-    auto* event_list = reinterpret_cast<android_event_list_t*>(event_data);
-    ASSERT_EQ(EVENT_TYPE_LIST, event_list->type);
-    ASSERT_EQ(3, event_list->element_count);
-    event_data += sizeof(android_event_list_t);
-
-    // Element #1: string type for subtag
-    auto* event_string_subtag = reinterpret_cast<android_event_string_t*>(event_data);
-    ASSERT_EQ(EVENT_TYPE_STRING, event_string_subtag->type);
-    int32_t subtag_len = strlen(subtag);
-    if (subtag_len > 32) {
-      subtag_len = 32;
-    }
-    ASSERT_EQ(subtag_len, event_string_subtag->length);
-    if (memcmp(subtag, &event_string_subtag->data, subtag_len)) {
-      return;
-    }
-    event_data += sizeof(android_event_string_t) + subtag_len;
-
-    // Element #2: int type for uid
-    auto* event_int_uid = reinterpret_cast<android_event_int_t*>(event_data);
-    ASSERT_EQ(EVENT_TYPE_INT, event_int_uid->type);
-    ASSERT_EQ(uid, event_int_uid->data);
-    event_data += sizeof(android_event_int_t);
-
-    // Element #3: string type for data
-    auto* event_string_data = reinterpret_cast<android_event_string_t*>(event_data);
-    ASSERT_EQ(EVENT_TYPE_STRING, event_string_data->type);
-    int32_t message_data_len = event_string_data->length;
-    if (data_len < 512) {
-      ASSERT_EQ(data_len, message_data_len);
-    }
-    if (memcmp(payload, &event_string_data->data, message_data_len) != 0) {
-      return;
-    }
-    event_data += sizeof(android_event_string_t);
-
-    if (data_len >= 512) {
-      event_data += message_data_len;
-      // 4 bytes for the tag, and max_payload_buf should be truncated.
-      ASSERT_LE(4 + 512, event_data - original);       // worst expectations
-      ASSERT_GT(4 + data_len, event_data - original);  // must be truncated
-    }
-    *found = true;
-  };
-
-  RunLogTests(LOG_ID_EVENTS, write_function, check_function);
-}
-#endif
-
-// Make multiple tests and re-tests orthogonal to prevent falsing.
-#ifdef TEST_LOGGER
-#define UNIQUE_TAG(X) \
-  (0x12340000 + (((X) + sizeof(int) + sizeof(void*)) << 8) + TEST_LOGGER)
-#else
-#define UNIQUE_TAG(X) \
-  (0x12340000 + (((X) + sizeof(int) + sizeof(void*)) << 8) + 0xBA)
-#endif
-
-TEST(liblog, android_errorWriteWithInfoLog__android_logger_list_read__typical) {
-#ifdef __ANDROID__
-  android_errorWriteWithInfoLog_helper(UNIQUE_TAG(1), "test-subtag", -1, max_payload_buf, 200);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog,
-     android_errorWriteWithInfoLog__android_logger_list_read__data_too_large) {
-#ifdef __ANDROID__
-  android_errorWriteWithInfoLog_helper(UNIQUE_TAG(2), "test-subtag", -1, max_payload_buf,
-                                       sizeof(max_payload_buf));
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-// TODO: Do we need to check that we didn't actually write anything if we return a failure here?
-TEST(liblog,
-     android_errorWriteWithInfoLog__android_logger_list_read__null_data) {
-#ifdef __ANDROID__
-  int retval_android_errorWriteWithinInfoLog =
-      android_errorWriteWithInfoLog(UNIQUE_TAG(3), "test-subtag", -1, nullptr, 200);
-  ASSERT_GT(0, retval_android_errorWriteWithinInfoLog);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog,
-     android_errorWriteWithInfoLog__android_logger_list_read__subtag_too_long) {
-#ifdef __ANDROID__
-  android_errorWriteWithInfoLog_helper(
-      UNIQUE_TAG(4), "abcdefghijklmnopqrstuvwxyz now i know my abc", -1, max_payload_buf, 200);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, __android_log_bswrite_and_print___max) {
-  bswrite_test(max_payload_buf);
-}
-
-TEST(liblog, __android_log_buf_write_and_print__max) {
-  buf_write_test(max_payload_buf);
-}
-
-TEST(liblog, android_errorWriteLog__android_logger_list_read__success) {
-#ifdef __ANDROID__
-  int kTag = UNIQUE_TAG(5);
-  const char* kSubTag = "test-subtag";
-
-  auto write_function = [&] {
-    int retval_android_errorWriteLog = android_errorWriteLog(kTag, kSubTag);
-    ASSERT_LT(0, retval_android_errorWriteLog);
-  };
-
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    char* event_data = log_msg.msg();
-
-    // Tag
-    auto* event_header = reinterpret_cast<android_event_header_t*>(event_data);
-    event_data += sizeof(android_event_header_t);
-    if (event_header->tag != kTag) {
-      return;
-    }
-
-    // List type
-    auto* event_list = reinterpret_cast<android_event_list_t*>(event_data);
-    ASSERT_EQ(EVENT_TYPE_LIST, event_list->type);
-    ASSERT_EQ(3, event_list->element_count);
-    event_data += sizeof(android_event_list_t);
-
-    // Element #1: string type for subtag
-    auto* event_string_subtag = reinterpret_cast<android_event_string_t*>(event_data);
-    ASSERT_EQ(EVENT_TYPE_STRING, event_string_subtag->type);
-    int32_t subtag_len = strlen(kSubTag);
-    ASSERT_EQ(subtag_len, event_string_subtag->length);
-    if (memcmp(kSubTag, &event_string_subtag->data, subtag_len) == 0) {
-      *found = true;
-    }
-  };
-
-  RunLogTests(LOG_ID_EVENTS, write_function, check_function);
-
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, android_errorWriteLog__android_logger_list_read__null_subtag) {
-#ifdef __ANDROID__
-  EXPECT_LT(android_errorWriteLog(UNIQUE_TAG(6), nullptr), 0);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-// Do not retest logger list handling
-#ifdef __ANDROID__
-static int is_real_element(int type) {
-  return ((type == EVENT_TYPE_INT) || (type == EVENT_TYPE_LONG) ||
-          (type == EVENT_TYPE_STRING) || (type == EVENT_TYPE_FLOAT));
-}
-
-static int android_log_buffer_to_string(const char* msg, size_t len,
-                                        char* strOut, size_t strOutLen) {
-  android_log_context context = create_android_log_parser(msg, len);
-  android_log_list_element elem;
-  bool overflow = false;
-  /* Reserve 1 byte for null terminator. */
-  size_t origStrOutLen = strOutLen--;
-
-  if (!context) {
-    return -EBADF;
-  }
-
-  memset(&elem, 0, sizeof(elem));
-
-  size_t outCount;
-
-  do {
-    elem = android_log_read_next(context);
-    switch ((int)elem.type) {
-      case EVENT_TYPE_LIST:
-        if (strOutLen == 0) {
-          overflow = true;
-        } else {
-          *strOut++ = '[';
-          strOutLen--;
-        }
-        break;
-
-      case EVENT_TYPE_LIST_STOP:
-        if (strOutLen == 0) {
-          overflow = true;
-        } else {
-          *strOut++ = ']';
-          strOutLen--;
-        }
-        break;
-
-      case EVENT_TYPE_INT:
-        /*
-         * snprintf also requires room for the null terminator, which
-         * we don't care about  but we have allocated enough room for
-         * that
-         */
-        outCount = snprintf(strOut, strOutLen + 1, "%" PRId32, elem.data.int32);
-        if (outCount <= strOutLen) {
-          strOut += outCount;
-          strOutLen -= outCount;
-        } else {
-          overflow = true;
-        }
-        break;
-
-      case EVENT_TYPE_LONG:
-        /*
-         * snprintf also requires room for the null terminator, which
-         * we don't care about but we have allocated enough room for
-         * that
-         */
-        outCount = snprintf(strOut, strOutLen + 1, "%" PRId64, elem.data.int64);
-        if (outCount <= strOutLen) {
-          strOut += outCount;
-          strOutLen -= outCount;
-        } else {
-          overflow = true;
-        }
-        break;
-
-      case EVENT_TYPE_FLOAT:
-        /*
-         * snprintf also requires room for the null terminator, which
-         * we don't care about but we have allocated enough room for
-         * that
-         */
-        outCount = snprintf(strOut, strOutLen + 1, "%f", elem.data.float32);
-        if (outCount <= strOutLen) {
-          strOut += outCount;
-          strOutLen -= outCount;
-        } else {
-          overflow = true;
-        }
-        break;
-
-      default:
-        elem.complete = true;
-        break;
-
-      case EVENT_TYPE_UNKNOWN:
-#if 0  // Ideal purity in the test, we want to complain about UNKNOWN showing up
-            if (elem.complete) {
-                break;
-            }
-#endif
-        elem.data.string = const_cast<char*>("<unknown>");
-        elem.len = strlen(elem.data.string);
-        FALLTHROUGH_INTENDED;
-      case EVENT_TYPE_STRING:
-        if (elem.len <= strOutLen) {
-          memcpy(strOut, elem.data.string, elem.len);
-          strOut += elem.len;
-          strOutLen -= elem.len;
-        } else if (strOutLen > 0) {
-          /* copy what we can */
-          memcpy(strOut, elem.data.string, strOutLen);
-          strOut += strOutLen;
-          strOutLen = 0;
-          overflow = true;
-        }
-        break;
-    }
-
-    if (elem.complete) {
-      break;
-    }
-    /* Determine whether to put a comma or not. */
-    if (!overflow &&
-        (is_real_element(elem.type) || (elem.type == EVENT_TYPE_LIST_STOP))) {
-      android_log_list_element next = android_log_peek_next(context);
-      if (!next.complete &&
-          (is_real_element(next.type) || (next.type == EVENT_TYPE_LIST))) {
-        if (strOutLen == 0) {
-          overflow = true;
-        } else {
-          *strOut++ = ',';
-          strOutLen--;
-        }
-      }
-    }
-  } while ((elem.type != EVENT_TYPE_UNKNOWN) && !overflow && !elem.complete);
-
-  android_log_destroy(&context);
-
-  if (overflow) {
-    if (strOutLen < origStrOutLen) {
-      /* leave an indicator */
-      *(strOut - 1) = '!';
-    } else {
-      /* nothing was written at all */
-      *strOut++ = '!';
-    }
-  }
-  *strOut++ = '\0';
-
-  if ((elem.type == EVENT_TYPE_UNKNOWN) && !elem.complete) {
-    fprintf(stderr, "Binary log entry conversion failed\n");
-    return -EINVAL;
-  }
-
-  return 0;
-}
-#endif  // __ANDROID__
-
-#ifdef __ANDROID__
-static const char* event_test_int32(uint32_t tag, size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  EXPECT_LE(0, android_log_write_int32(ctx, 0x40302010));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t);
-
-  return "1076895760";
-}
-
-static const char* event_test_int64(uint32_t tag, size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  EXPECT_LE(0, android_log_write_int64(ctx, 0x8070605040302010));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint64_t);
-
-  return "-9191740941672636400";
-}
-
-static const char* event_test_list_int64(uint32_t tag, size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int64(ctx, 0x8070605040302010));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint8_t) +
-                 sizeof(uint8_t) + sizeof(uint64_t);
-
-  return "[-9191740941672636400]";
-}
-
-static const char* event_test_simple_automagic_list(uint32_t tag,
-                                                    size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  // The convenience API where we allow a simple list to be
-  // created without explicit begin or end calls.
-  EXPECT_LE(0, android_log_write_int32(ctx, 0x40302010));
-  EXPECT_LE(0, android_log_write_int64(ctx, 0x8070605040302010));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint8_t) +
-                 sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint8_t) +
-                 sizeof(uint64_t);
-
-  return "[1076895760,-9191740941672636400]";
-}
-
-static const char* event_test_list_empty(uint32_t tag, size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint8_t);
-
-  return "[]";
-}
-
-static const char* event_test_complex_nested_list(uint32_t tag,
-                                                  size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-
-  EXPECT_LE(0, android_log_write_list_begin(ctx));  // [
-  EXPECT_LE(0, android_log_write_int32(ctx, 0x01020304));
-  EXPECT_LE(0, android_log_write_int64(ctx, 0x0102030405060708));
-  EXPECT_LE(0, android_log_write_string8(ctx, "Hello World"));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));  // [
-  EXPECT_LE(0, android_log_write_int32(ctx, 1));
-  EXPECT_LE(0, android_log_write_int32(ctx, 2));
-  EXPECT_LE(0, android_log_write_int32(ctx, 3));
-  EXPECT_LE(0, android_log_write_int32(ctx, 4));
-  EXPECT_LE(0, android_log_write_list_end(ctx));  // ]
-  EXPECT_LE(0, android_log_write_float32(ctx, 1.0102030405060708));
-  EXPECT_LE(0, android_log_write_list_end(ctx));  // ]
-
-  //
-  // This one checks for the automagic list creation because a list
-  // begin and end was missing for it! This is actually an <oops> corner
-  // case, and not the behavior we morally support. The automagic API is to
-  // allow for a simple case of a series of objects in a single list. e.g.
-  //   int32,int32,int32,string -> [int32,int32,int32,string]
-  //
-  EXPECT_LE(0, android_log_write_string8(ctx, "dlroW olleH"));
-
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint8_t) +
-                 sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint8_t) +
-                 sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint64_t) +
-                 sizeof(uint8_t) + sizeof(uint32_t) + sizeof("Hello World") -
-                 1 + sizeof(uint8_t) + sizeof(uint8_t) +
-                 4 * (sizeof(uint8_t) + sizeof(uint32_t)) + sizeof(uint8_t) +
-                 sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t) +
-                 sizeof("dlroW olleH") - 1;
-
-  return "[[16909060,72623859790382856,Hello World,[1,2,3,4],1.010203],dlroW "
-         "olleH]";
-}
-
-static const char* event_test_7_level_prefix(uint32_t tag,
-                                             size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 1));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 2));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 3));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 4));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 5));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 6));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 7));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + 7 * (sizeof(uint8_t) + sizeof(uint8_t) +
-                                         sizeof(uint8_t) + sizeof(uint32_t));
-
-  return "[[[[[[[1],2],3],4],5],6],7]";
-}
-
-static const char* event_test_7_level_suffix(uint32_t tag,
-                                             size_t& expected_len) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(tag)));
-  if (!ctx) {
-    return NULL;
-  }
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 1));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 2));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 3));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 4));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 5));
-  EXPECT_LE(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_write_int32(ctx, 6));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list_end(ctx));
-  EXPECT_LE(0, android_log_write_list(ctx, LOG_ID_EVENTS));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  EXPECT_TRUE(NULL == ctx);
-
-  expected_len = sizeof(uint32_t) + 6 * (sizeof(uint8_t) + sizeof(uint8_t) +
-                                         sizeof(uint8_t) + sizeof(uint32_t));
-
-  return "[1,[2,[3,[4,[5,[6]]]]]]";
-}
-
-static const char* event_test_android_log_error_write(uint32_t tag,
-                                                      size_t& expected_len) {
-  EXPECT_LE(
-      0, __android_log_error_write(tag, "Hello World", 42, "dlroW olleH", 11));
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint8_t) +
-                 sizeof(uint8_t) + sizeof(uint32_t) + sizeof("Hello World") -
-                 1 + sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint8_t) +
-                 sizeof(uint32_t) + sizeof("dlroW olleH") - 1;
-
-  return "[Hello World,42,dlroW olleH]";
-}
-
-static const char* event_test_android_log_error_write_null(uint32_t tag,
-                                                           size_t& expected_len) {
-  EXPECT_LE(0, __android_log_error_write(tag, "Hello World", 42, NULL, 0));
-
-  expected_len = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint8_t) +
-                 sizeof(uint8_t) + sizeof(uint32_t) + sizeof("Hello World") -
-                 1 + sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint8_t) +
-                 sizeof(uint32_t) + sizeof("") - 1;
-
-  return "[Hello World,42,]";
-}
-
-// make sure all user buffers are flushed
-static void print_barrier() {
-  std::cout.flush();
-  fflush(stdout);
-  std::cerr.flush();
-  fflush(stderr);  // everything else is paranoia ...
-}
-
-static void create_android_logger(const char* (*fn)(uint32_t tag,
-                                                    size_t& expected_len)) {
-  size_t expected_len;
-  const char* expected_string;
-  auto write_function = [&] {
-    expected_string = (*fn)(1005, expected_len);
-    ASSERT_NE(nullptr, expected_string);
-  };
-
-  pid_t pid = getpid();
-  auto check_function = [&](log_msg log_msg, bool* found) {
-    if (static_cast<size_t>(log_msg.entry.len) != expected_len) {
-      return;
-    }
-
-    char* eventData = log_msg.msg();
-
-    AndroidLogFormat* logformat = android_log_format_new();
-    EXPECT_TRUE(NULL != logformat);
-    AndroidLogEntry entry;
-    char msgBuf[1024];
-    int processBinaryLogBuffer =
-        android_log_processBinaryLogBuffer(&log_msg.entry, &entry, nullptr, msgBuf, sizeof(msgBuf));
-    EXPECT_EQ(0, processBinaryLogBuffer);
-    if (processBinaryLogBuffer == 0) {
-      int line_overhead = 20;
-      if (pid > 99999) ++line_overhead;
-      if (pid > 999999) ++line_overhead;
-      print_barrier();
-      int printLogLine =
-          android_log_printLogLine(logformat, fileno(stderr), &entry);
-      print_barrier();
-      EXPECT_EQ(line_overhead + (int)strlen(expected_string), printLogLine);
-    }
-    android_log_format_free(logformat);
-
-    // test buffer reading API
-    int buffer_to_string = -1;
-    if (eventData) {
-      auto* event_header = reinterpret_cast<android_event_header_t*>(eventData);
-      eventData += sizeof(android_event_header_t);
-      snprintf(msgBuf, sizeof(msgBuf), "I/[%" PRId32 "]", event_header->tag);
-      print_barrier();
-      fprintf(stderr, "%-10s(%5u): ", msgBuf, pid);
-      memset(msgBuf, 0, sizeof(msgBuf));
-      buffer_to_string =
-          android_log_buffer_to_string(eventData, log_msg.entry.len, msgBuf, sizeof(msgBuf));
-      fprintf(stderr, "%s\n", msgBuf);
-      print_barrier();
-    }
-    EXPECT_EQ(0, buffer_to_string);
-    EXPECT_STREQ(expected_string, msgBuf);
-    *found = true;
-  };
-
-  RunLogTests(LOG_ID_EVENTS, write_function, check_function);
-}
-#endif
-
-TEST(liblog, create_android_logger_int32) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_int32);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_int64) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_int64);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_list_int64) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_list_int64);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_simple_automagic_list) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_simple_automagic_list);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_list_empty) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_list_empty);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_complex_nested_list) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_complex_nested_list);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_7_level_prefix) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_7_level_prefix);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_7_level_suffix) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_7_level_suffix);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_android_log_error_write) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_android_log_error_write);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_android_log_error_write_null) {
-#ifdef __ANDROID__
-  create_android_logger(event_test_android_log_error_write_null);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(liblog, create_android_logger_overflow) {
-  android_log_context ctx;
-
-  EXPECT_TRUE(NULL != (ctx = create_android_logger(1005)));
-  if (ctx) {
-    for (size_t i = 0; i < ANDROID_MAX_LIST_NEST_DEPTH; ++i) {
-      EXPECT_LE(0, android_log_write_list_begin(ctx));
-    }
-    EXPECT_GT(0, android_log_write_list_begin(ctx));
-    /* One more for good measure, must be permanently unhappy */
-    EXPECT_GT(0, android_log_write_list_begin(ctx));
-    EXPECT_LE(0, android_log_destroy(&ctx));
-    EXPECT_TRUE(NULL == ctx);
-  }
-
-  ASSERT_TRUE(NULL != (ctx = create_android_logger(1005)));
-  for (size_t i = 0; i < ANDROID_MAX_LIST_NEST_DEPTH; ++i) {
-    EXPECT_LE(0, android_log_write_list_begin(ctx));
-    EXPECT_LE(0, android_log_write_int32(ctx, i));
-  }
-  EXPECT_GT(0, android_log_write_list_begin(ctx));
-  /* One more for good measure, must be permanently unhappy */
-  EXPECT_GT(0, android_log_write_list_begin(ctx));
-  EXPECT_LE(0, android_log_destroy(&ctx));
-  ASSERT_TRUE(NULL == ctx);
-}
-
-#ifdef ENABLE_FLAKY_TESTS
-#ifdef __ANDROID__
-#ifndef NO_PSTORE
-static const char __pmsg_file[] =
-    "/data/william-shakespeare/MuchAdoAboutNothing.txt";
-#endif /* NO_PSTORE */
-#endif
-
-TEST(liblog, __android_log_pmsg_file_write) {
-#ifdef __ANDROID__
-#ifndef NO_PSTORE
-  __android_log_close();
-  if (getuid() == AID_ROOT) {
-    tested__android_log_close = true;
-    bool pmsgActiveAfter__android_log_close = isPmsgActive();
-    bool logdwActiveAfter__android_log_close = isLogdwActive();
-    EXPECT_FALSE(pmsgActiveAfter__android_log_close);
-    EXPECT_FALSE(logdwActiveAfter__android_log_close);
-  } else if (!tested__android_log_close) {
-    fprintf(stderr, "WARNING: can not test __android_log_close()\n");
-  }
-  int return__android_log_pmsg_file_write = __android_log_pmsg_file_write(
-      LOG_ID_CRASH, ANDROID_LOG_VERBOSE, __pmsg_file, max_payload_buf,
-      sizeof(max_payload_buf));
-  EXPECT_LT(0, return__android_log_pmsg_file_write);
-  if (return__android_log_pmsg_file_write == -ENOMEM) {
-    fprintf(stderr,
-            "Kernel does not have space allocated to pmsg pstore driver "
-            "configured\n");
-  } else if (!return__android_log_pmsg_file_write) {
-    fprintf(stderr,
-            "Reboot, ensure file %s matches\n"
-            "with liblog.__android_log_msg_file_read test\n",
-            __pmsg_file);
-  }
-  bool pmsgActiveAfter__android_pmsg_file_write;
-  bool logdwActiveAfter__android_pmsg_file_write;
-  if (getuid() == AID_ROOT) {
-    pmsgActiveAfter__android_pmsg_file_write = isPmsgActive();
-    logdwActiveAfter__android_pmsg_file_write = isLogdwActive();
-    EXPECT_FALSE(pmsgActiveAfter__android_pmsg_file_write);
-    EXPECT_FALSE(logdwActiveAfter__android_pmsg_file_write);
-  }
-  EXPECT_LT(
-      0, __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_INFO,
-                                 "TEST__android_log_pmsg_file_write", "main"));
-  if (getuid() == AID_ROOT) {
-    bool pmsgActiveAfter__android_log_buf_print = isPmsgActive();
-    bool logdwActiveAfter__android_log_buf_print = isLogdwActive();
-    EXPECT_TRUE(pmsgActiveAfter__android_log_buf_print);
-    EXPECT_TRUE(logdwActiveAfter__android_log_buf_print);
-  }
-  EXPECT_LT(0, __android_log_pmsg_file_write(LOG_ID_CRASH, ANDROID_LOG_VERBOSE,
-                                             __pmsg_file, max_payload_buf,
-                                             sizeof(max_payload_buf)));
-  if (getuid() == AID_ROOT) {
-    pmsgActiveAfter__android_pmsg_file_write = isPmsgActive();
-    logdwActiveAfter__android_pmsg_file_write = isLogdwActive();
-    EXPECT_TRUE(pmsgActiveAfter__android_pmsg_file_write);
-    EXPECT_TRUE(logdwActiveAfter__android_pmsg_file_write);
-  }
-#else  /* NO_PSTORE */
-  GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n";
-#endif /* NO_PSTORE */
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-#ifdef __ANDROID__
-#ifndef NO_PSTORE
-static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename,
-                         const char* buf, size_t len, void* arg) {
-  EXPECT_TRUE(NULL == arg);
-  EXPECT_EQ(LOG_ID_CRASH, logId);
-  EXPECT_EQ(ANDROID_LOG_VERBOSE, prio);
-  EXPECT_FALSE(NULL == strstr(__pmsg_file, filename));
-  EXPECT_EQ(len, sizeof(max_payload_buf));
-  EXPECT_STREQ(max_payload_buf, buf);
-
-  ++signaled;
-  if ((len != sizeof(max_payload_buf)) || strcmp(max_payload_buf, buf)) {
-    fprintf(stderr, "comparison fails on content \"%s\"\n", buf);
-  }
-  return arg || (LOG_ID_CRASH != logId) || (ANDROID_LOG_VERBOSE != prio) ||
-                 !strstr(__pmsg_file, filename) ||
-                 (len != sizeof(max_payload_buf)) ||
-                 !!strcmp(max_payload_buf, buf)
-             ? -ENOEXEC
-             : 1;
-}
-#endif /* NO_PSTORE */
-#endif
-
-TEST(liblog, __android_log_pmsg_file_read) {
-#ifdef __ANDROID__
-#ifndef NO_PSTORE
-  signaled = 0;
-
-  __android_log_close();
-  if (getuid() == AID_ROOT) {
-    tested__android_log_close = true;
-    bool pmsgActiveAfter__android_log_close = isPmsgActive();
-    bool logdwActiveAfter__android_log_close = isLogdwActive();
-    EXPECT_FALSE(pmsgActiveAfter__android_log_close);
-    EXPECT_FALSE(logdwActiveAfter__android_log_close);
-  } else if (!tested__android_log_close) {
-    fprintf(stderr, "WARNING: can not test __android_log_close()\n");
-  }
-
-  ssize_t ret = __android_log_pmsg_file_read(LOG_ID_CRASH, ANDROID_LOG_VERBOSE,
-                                             __pmsg_file, __pmsg_fn, NULL);
-
-  if (getuid() == AID_ROOT) {
-    bool pmsgActiveAfter__android_log_pmsg_file_read = isPmsgActive();
-    bool logdwActiveAfter__android_log_pmsg_file_read = isLogdwActive();
-    EXPECT_FALSE(pmsgActiveAfter__android_log_pmsg_file_read);
-    EXPECT_FALSE(logdwActiveAfter__android_log_pmsg_file_read);
-  }
-
-  if (ret == -ENOENT) {
-    fprintf(stderr,
-            "No pre-boot results of liblog.__android_log_mesg_file_write to "
-            "compare with,\n"
-            "false positive test result.\n");
-    return;
-  }
-
-  EXPECT_LT(0, ret);
-  EXPECT_EQ(1U, signaled);
-#else  /* NO_PSTORE */
-  GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n";
-#endif /* NO_PSTORE */
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-#endif  // ENABLE_FLAKY_TESTS
-
-TEST(liblog, android_lookupEventTagNum) {
-#ifdef __ANDROID__
-  EventTagMap* map = android_openEventTagMap(NULL);
-  EXPECT_TRUE(NULL != map);
-  std::string Name = android::base::StringPrintf("a%d", getpid());
-  int tag = android_lookupEventTagNum(map, Name.c_str(), "(new|1)",
-                                      ANDROID_LOG_UNKNOWN);
-  android_closeEventTagMap(map);
-  if (tag == -1) system("tail -3 /dev/event-log-tags >&2");
-  EXPECT_NE(-1, tag);
-  EXPECT_NE(0, tag);
-  EXPECT_GT(UINT32_MAX, (unsigned)tag);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
diff --git a/liblog/tests/log_id_test.cpp b/liblog/tests/log_id_test.cpp
deleted file mode 100644
index 9fb5a2c..0000000
--- a/liblog/tests/log_id_test.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2013-2017 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.
- */
-
-#include <inttypes.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <gtest/gtest.h>
-// Test the APIs in this standalone include file
-#include <log/log_id.h>
-
-// We do not want to include <android/log.h> to acquire ANDROID_LOG_INFO for
-// include file API purity.  We do however want to allow the _option_ that
-// log/log_id.h could include this file, or related content, in the future.
-#ifndef __android_LogPriority_defined
-#define ANDROID_LOG_INFO 4
-#endif
-
-TEST(liblog, log_id) {
-  int count = 0;
-
-  for (int i = LOG_ID_MIN; i < LOG_ID_MAX; ++i) {
-    log_id_t id = static_cast<log_id_t>(i);
-    const char* name = android_log_id_to_name(id);
-    if (id != android_name_to_log_id(name)) {
-      continue;
-    }
-    ++count;
-    fprintf(stderr, "log buffer %s\r", name);
-  }
-  ASSERT_EQ(LOG_ID_MAX, count);
-}
-
-TEST(liblog, __android_log_buf_print) {
-  EXPECT_LT(0, __android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO,
-                                       "TEST__android_log_buf_print", "radio"));
-  usleep(1000);
-  EXPECT_LT(0,
-            __android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO,
-                                    "TEST__android_log_buf_print", "system"));
-  usleep(1000);
-  EXPECT_LT(0, __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_INFO,
-                                       "TEST__android_log_buf_print", "main"));
-  usleep(1000);
-}
-
-TEST(liblog, __android_log_buf_write) {
-  EXPECT_LT(0, __android_log_buf_write(LOG_ID_RADIO, ANDROID_LOG_INFO,
-                                       "TEST__android_log_buf_write", "radio"));
-  usleep(1000);
-  EXPECT_LT(0,
-            __android_log_buf_write(LOG_ID_SYSTEM, ANDROID_LOG_INFO,
-                                    "TEST__android_log_buf_write", "system"));
-  usleep(1000);
-  EXPECT_LT(0, __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_INFO,
-                                       "TEST__android_log_buf_write", "main"));
-  usleep(1000);
-}
-
-static void* ConcurrentPrintFn(void* arg) {
-  int ret = __android_log_buf_print(
-      LOG_ID_MAIN, ANDROID_LOG_INFO, "TEST__android_log_print",
-      "Concurrent %" PRIuPTR, reinterpret_cast<uintptr_t>(arg));
-  return reinterpret_cast<void*>(ret);
-}
-
-#define NUM_CONCURRENT 64
-#define _concurrent_name(a, n) a##__concurrent##n
-#define concurrent_name(a, n) _concurrent_name(a, n)
-
-TEST(liblog, concurrent_name(__android_log_buf_print, NUM_CONCURRENT)) {
-  pthread_t t[NUM_CONCURRENT];
-  int i;
-  for (i = 0; i < NUM_CONCURRENT; i++) {
-    ASSERT_EQ(0, pthread_create(&t[i], NULL, ConcurrentPrintFn,
-                                reinterpret_cast<void*>(i)));
-  }
-  int ret = 1;
-  for (i = 0; i < NUM_CONCURRENT; i++) {
-    void* result;
-    ASSERT_EQ(0, pthread_join(t[i], &result));
-    int this_result = reinterpret_cast<uintptr_t>(result);
-    if ((0 < ret) && (ret != this_result)) {
-      ret = this_result;
-    }
-  }
-  ASSERT_LT(0, ret);
-}
diff --git a/liblog/tests/log_radio_test.cpp b/liblog/tests/log_radio_test.cpp
deleted file mode 100644
index fa1255e..0000000
--- a/liblog/tests/log_radio_test.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <gtest/gtest.h>
-// Test the APIs in this standalone include file
-#include <log/log_radio.h>
-
-TEST(liblog, RLOG) {
-  static const char content[] = "log_radio.h";
-  static const char content_false[] = "log_radio.h false";
-
-// ratelimit content to 10/s to keep away from spam filters
-// do not send identical content together to keep away from spam filters
-
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGV"
-  RLOGV(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGD"
-  RLOGD(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGI"
-  RLOGI(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGW"
-  RLOGW(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGE"
-  RLOGE(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGV"
-  RLOGV_IF(true, content);
-  usleep(100000);
-  RLOGV_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGD"
-  RLOGD_IF(true, content);
-  usleep(100000);
-  RLOGD_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGI"
-  RLOGI_IF(true, content);
-  usleep(100000);
-  RLOGI_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGW"
-  RLOGW_IF(true, content);
-  usleep(100000);
-  RLOGW_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__RLOGE"
-  RLOGE_IF(true, content);
-  usleep(100000);
-  RLOGE_IF(false, content_false);
-
-#ifdef __ANDROID__
-  // give time for content to long-path through logger
-  sleep(1);
-
-  std::string buf = android::base::StringPrintf(
-      "logcat -b radio --pid=%u -d -s"
-      " TEST__RLOGV TEST__RLOGD TEST__RLOGI TEST__RLOGW TEST__RLOGE",
-      (unsigned)getpid());
-  FILE* fp = popen(buf.c_str(), "re");
-  int count = 0;
-  int count_false = 0;
-  if (fp) {
-    if (!android::base::ReadFdToString(fileno(fp), &buf)) buf = "";
-    pclose(fp);
-    for (size_t pos = 0; (pos = buf.find(content, pos)) != std::string::npos;
-         ++pos) {
-      ++count;
-    }
-    for (size_t pos = 0;
-         (pos = buf.find(content_false, pos)) != std::string::npos; ++pos) {
-      ++count_false;
-    }
-  }
-  EXPECT_EQ(0, count_false);
-#if LOG_NDEBUG
-  ASSERT_EQ(8, count);
-#else
-  ASSERT_EQ(10, count);
-#endif
-
-#else
-  GTEST_LOG_(INFO) << "This test does not test end-to-end.\n";
-#endif
-}
diff --git a/liblog/tests/log_read_test.cpp b/liblog/tests/log_read_test.cpp
deleted file mode 100644
index 1be99aa..0000000
--- a/liblog/tests/log_read_test.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2013-2017 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.
- */
-
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/stringprintf.h>
-#include <android/log.h>  // minimal logging API
-#include <gtest/gtest.h>
-#include <log/log_properties.h>
-// Test the APIs in this standalone include file
-#include <log/log_read.h>
-// Do not use anything in log/log_time.h despite side effects of the above.
-#include <private/android_logger.h>
-
-TEST(liblog, android_logger_get_) {
-#ifdef __ANDROID__
-  // This test assumes the log buffers are filled with noise from
-  // normal operations. It will fail if done immediately after a
-  // logcat -c.
-  struct logger_list* logger_list =
-      android_logger_list_alloc(ANDROID_LOG_WRONLY, 0, 0);
-
-  for (int i = LOG_ID_MIN; i < LOG_ID_MAX; ++i) {
-    log_id_t id = static_cast<log_id_t>(i);
-    const char* name = android_log_id_to_name(id);
-    if (id != android_name_to_log_id(name)) {
-      continue;
-    }
-    fprintf(stderr, "log buffer %s\r", name);
-    struct logger* logger;
-    EXPECT_TRUE(NULL != (logger = android_logger_open(logger_list, id)));
-    EXPECT_EQ(id, android_logger_get_id(logger));
-    ssize_t get_log_size = android_logger_get_log_size(logger);
-    /* security buffer is allowed to be denied */
-    if (strcmp("security", name)) {
-      EXPECT_LT(0, get_log_size);
-      // crash buffer is allowed to be empty, that is actually healthy!
-      // kernel buffer is allowed to be empty on "user" builds
-      // stats buffer is allowed to be empty TEMPORARILY.
-      // TODO: remove stats buffer from here once we start to use it in
-      // framework (b/68266385).
-      EXPECT_LE(  // boolean 1 or 0 depending on expected content or empty
-          !!((strcmp("crash", name) != 0) &&
-             ((strcmp("kernel", name) != 0) ||
-              __android_logger_property_get_bool(
-                  "ro.logd.kernel", BOOL_DEFAULT_TRUE | BOOL_DEFAULT_FLAG_ENG |
-                                        BOOL_DEFAULT_FLAG_SVELTE)) &&
-             (strcmp("stats", name) != 0)),
-          android_logger_get_log_readable_size(logger));
-    } else {
-      EXPECT_NE(0, get_log_size);
-      if (get_log_size < 0) {
-        EXPECT_GT(0, android_logger_get_log_readable_size(logger));
-      } else {
-        EXPECT_LE(0, android_logger_get_log_readable_size(logger));
-      }
-    }
-    EXPECT_LT(0, android_logger_get_log_version(logger));
-  }
-
-  android_logger_list_close(logger_list);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
diff --git a/liblog/tests/log_system_test.cpp b/liblog/tests/log_system_test.cpp
deleted file mode 100644
index 13f026d..0000000
--- a/liblog/tests/log_system_test.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <gtest/gtest.h>
-// Test the APIs in this standalone include file
-#include <log/log_system.h>
-
-TEST(liblog, SLOG) {
-  static const char content[] = "log_system.h";
-  static const char content_false[] = "log_system.h false";
-
-// ratelimit content to 10/s to keep away from spam filters
-// do not send identical content together to keep away from spam filters
-
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGV"
-  SLOGV(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGD"
-  SLOGD(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGI"
-  SLOGI(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGW"
-  SLOGW(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGE"
-  SLOGE(content);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGV"
-  SLOGV_IF(true, content);
-  usleep(100000);
-  SLOGV_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGD"
-  SLOGD_IF(true, content);
-  usleep(100000);
-  SLOGD_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGI"
-  SLOGI_IF(true, content);
-  usleep(100000);
-  SLOGI_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGW"
-  SLOGW_IF(true, content);
-  usleep(100000);
-  SLOGW_IF(false, content_false);
-  usleep(100000);
-#undef LOG_TAG
-#define LOG_TAG "TEST__SLOGE"
-  SLOGE_IF(true, content);
-  usleep(100000);
-  SLOGE_IF(false, content_false);
-
-#ifdef __ANDROID__
-  // give time for content to long-path through logger
-  sleep(1);
-
-  std::string buf = android::base::StringPrintf(
-      "logcat -b system --pid=%u -d -s"
-      " TEST__SLOGV TEST__SLOGD TEST__SLOGI TEST__SLOGW TEST__SLOGE",
-      (unsigned)getpid());
-  FILE* fp = popen(buf.c_str(), "re");
-  int count = 0;
-  int count_false = 0;
-  if (fp) {
-    if (!android::base::ReadFdToString(fileno(fp), &buf)) buf = "";
-    pclose(fp);
-    for (size_t pos = 0; (pos = buf.find(content, pos)) != std::string::npos;
-         ++pos) {
-      ++count;
-    }
-    for (size_t pos = 0;
-         (pos = buf.find(content_false, pos)) != std::string::npos; ++pos) {
-      ++count_false;
-    }
-  }
-  EXPECT_EQ(0, count_false);
-#if LOG_NDEBUG
-  ASSERT_EQ(8, count);
-#else
-  ASSERT_EQ(10, count);
-#endif
-
-#else
-  GTEST_LOG_(INFO) << "This test does not test end-to-end.\n";
-#endif
-}
diff --git a/liblog/tests/log_time_test.cpp b/liblog/tests/log_time_test.cpp
deleted file mode 100644
index 47fe594..0000000
--- a/liblog/tests/log_time_test.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <time.h>
-
-#include <gtest/gtest.h>
-// Test the APIs in this standalone include file
-#include <log/log_time.h>
-
-TEST(liblog, log_time) {
-  struct timespec ts;
-  clock_gettime(CLOCK_MONOTONIC, &ts);
-  log_time tl(ts);
-
-  EXPECT_EQ(tl, ts);
-  EXPECT_GE(tl, ts);
-  EXPECT_LE(tl, ts);
-}
diff --git a/liblog/tests/log_wrap_test.cpp b/liblog/tests/log_wrap_test.cpp
deleted file mode 100644
index e06964f..0000000
--- a/liblog/tests/log_wrap_test.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2013-2017 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.
- */
-
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/chrono_utils.h>
-#include <android-base/stringprintf.h>
-#include <android/log.h>  // minimal logging API
-#include <gtest/gtest.h>
-#include <log/log_properties.h>
-#include <log/log_read.h>
-#include <log/log_time.h>
-
-#ifdef __ANDROID__
-static void read_with_wrap() {
-  // Read the last line in the log to get a starting timestamp. We're assuming
-  // the log is not empty.
-  const int mode = ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK;
-  struct logger_list* logger_list =
-      android_logger_list_open(LOG_ID_MAIN, mode, 1000, 0);
-
-  ASSERT_NE(logger_list, nullptr);
-
-  log_msg log_msg;
-  int ret = android_logger_list_read(logger_list, &log_msg);
-  android_logger_list_close(logger_list);
-  ASSERT_GT(ret, 0);
-
-  log_time start(log_msg.entry.sec, log_msg.entry.nsec);
-  ASSERT_NE(start, log_time());
-
-  logger_list =
-      android_logger_list_alloc_time(mode | ANDROID_LOG_WRAP, start, 0);
-  ASSERT_NE(logger_list, nullptr);
-
-  struct logger* logger = android_logger_open(logger_list, LOG_ID_MAIN);
-  EXPECT_NE(logger, nullptr);
-  if (logger) {
-    android_logger_list_read(logger_list, &log_msg);
-  }
-
-  android_logger_list_close(logger_list);
-}
-#endif
-
-// b/64143705 confirm fixed
-TEST(liblog, wrap_mode_blocks) {
-#ifdef __ANDROID__
-  // The read call is expected to take up to 2 hours in the happy case.  There was a previous bug
-  // where it would take only 30 seconds due to an alarm() in logd_reader.cpp.  That alarm has been
-  // removed, so we check here that the read call blocks for a reasonable amount of time (5s).
-
-  struct sigaction ignore = {.sa_handler = [](int) { _exit(0); }};
-  struct sigaction old_sigaction;
-  sigaction(SIGALRM, &ignore, &old_sigaction);
-  alarm(5);
-
-  android::base::Timer timer;
-  read_with_wrap();
-
-  FAIL() << "read_with_wrap() should not return before the alarm is triggered.";
-
-  alarm(0);
-  sigaction(SIGALRM, &old_sigaction, nullptr);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
diff --git a/liblog/tests/logd_writer_test.cpp b/liblog/tests/logd_writer_test.cpp
deleted file mode 100644
index b8e4726..0000000
--- a/liblog/tests/logd_writer_test.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <sys/un.h>
-#include <unistd.h>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <android-base/unique_fd.h>
-#include <gtest/gtest.h>
-
-using android::base::StringPrintf;
-using android::base::unique_fd;
-
-// logd_writer takes advantage of the fact that connect() can be called multiple times for a DGRAM
-// socket.  This tests for that behavior.
-TEST(liblog, multi_connect_dgram_socket) {
-#ifdef __ANDROID__
-  if (getuid() != 0) {
-    GTEST_SKIP() << "Skipping test, must be run as root.";
-    return;
-  }
-  auto temp_dir = TemporaryDir();
-  auto socket_path = StringPrintf("%s/test_socket", temp_dir.path);
-
-  unique_fd server_socket;
-
-  auto open_server_socket = [&] {
-    server_socket.reset(TEMP_FAILURE_RETRY(socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0)));
-    ASSERT_TRUE(server_socket.ok());
-
-    sockaddr_un server_sockaddr = {};
-    server_sockaddr.sun_family = AF_UNIX;
-    strlcpy(server_sockaddr.sun_path, socket_path.c_str(), sizeof(server_sockaddr.sun_path));
-    ASSERT_EQ(0,
-              TEMP_FAILURE_RETRY(bind(server_socket, reinterpret_cast<sockaddr*>(&server_sockaddr),
-                                      sizeof(server_sockaddr))));
-  };
-
-  // Open the server socket.
-  open_server_socket();
-
-  // Open the client socket.
-  auto client_socket =
-      unique_fd{TEMP_FAILURE_RETRY(socket(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0))};
-  ASSERT_TRUE(client_socket.ok());
-  sockaddr_un client_sockaddr = {};
-  client_sockaddr.sun_family = AF_UNIX;
-  strlcpy(client_sockaddr.sun_path, socket_path.c_str(), sizeof(client_sockaddr.sun_path));
-  ASSERT_EQ(0,
-            TEMP_FAILURE_RETRY(connect(client_socket, reinterpret_cast<sockaddr*>(&client_sockaddr),
-                                       sizeof(client_sockaddr))));
-
-  // Ensure that communication works.
-  constexpr static char kSmoke[] = "smoke test";
-  ssize_t smoke_len = sizeof(kSmoke);
-  ASSERT_EQ(smoke_len, TEMP_FAILURE_RETRY(write(client_socket, kSmoke, sizeof(kSmoke))));
-  char read_buf[512];
-  ASSERT_EQ(smoke_len, TEMP_FAILURE_RETRY(read(server_socket, read_buf, sizeof(read_buf))));
-  ASSERT_STREQ(kSmoke, read_buf);
-
-  // Close the server socket.
-  server_socket.reset();
-  ASSERT_EQ(0, unlink(socket_path.c_str())) << strerror(errno);
-
-  // Ensure that write() from the client returns an error since the server is closed.
-  ASSERT_EQ(-1, TEMP_FAILURE_RETRY(write(client_socket, kSmoke, sizeof(kSmoke))));
-  ASSERT_EQ(errno, ECONNREFUSED) << strerror(errno);
-
-  // Open the server socket again.
-  open_server_socket();
-
-  // Reconnect the same client socket.
-  ASSERT_EQ(0,
-            TEMP_FAILURE_RETRY(connect(client_socket, reinterpret_cast<sockaddr*>(&client_sockaddr),
-                                       sizeof(client_sockaddr))))
-      << strerror(errno);
-
-  // Ensure that communication works.
-  ASSERT_EQ(smoke_len, TEMP_FAILURE_RETRY(write(client_socket, kSmoke, sizeof(kSmoke))));
-  ASSERT_EQ(smoke_len, TEMP_FAILURE_RETRY(read(server_socket, read_buf, sizeof(read_buf))));
-  ASSERT_STREQ(kSmoke, read_buf);
-#else
-  GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
\ No newline at end of file
diff --git a/liblog/tests/logprint_test.cpp b/liblog/tests/logprint_test.cpp
deleted file mode 100644
index 72e53f9..0000000
--- a/liblog/tests/logprint_test.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <log/logprint.h>
-
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <log/log_read.h>
-
-size_t convertPrintable(char* p, const char* message, size_t messageLen);
-
-TEST(liblog, convertPrintable_ascii) {
-  auto input = "easy string, output same";
-  auto output_size = convertPrintable(nullptr, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(input));
-
-  char output[output_size];
-
-  output_size = convertPrintable(output, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(input));
-  EXPECT_STREQ(input, output);
-}
-
-TEST(liblog, convertPrintable_escapes) {
-  // Note that \t is not escaped.
-  auto input = "escape\a\b\t\v\f\r\\";
-  auto expected_output = "escape\\a\\b\t\\v\\f\\r\\\\";
-  auto output_size = convertPrintable(nullptr, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(expected_output));
-
-  char output[output_size];
-
-  output_size = convertPrintable(output, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(expected_output));
-  EXPECT_STREQ(expected_output, output);
-}
-
-TEST(liblog, convertPrintable_validutf8) {
-  auto input = u8"¢ह€𐍈";
-  auto output_size = convertPrintable(nullptr, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(input));
-
-  char output[output_size];
-
-  output_size = convertPrintable(output, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(input));
-  EXPECT_STREQ(input, output);
-}
-
-TEST(liblog, convertPrintable_invalidutf8) {
-  auto input = "\x80\xC2\x01\xE0\xA4\x06\xE0\x06\xF0\x90\x8D\x06\xF0\x90\x06\xF0\x0E";
-  auto expected_output =
-      "\\x80\\xC2\\x01\\xE0\\xA4\\x06\\xE0\\x06\\xF0\\x90\\x8D\\x06\\xF0\\x90\\x06\\xF0\\x0E";
-  auto output_size = convertPrintable(nullptr, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(expected_output));
-
-  char output[output_size];
-
-  output_size = convertPrintable(output, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(expected_output));
-  EXPECT_STREQ(expected_output, output);
-}
-
-TEST(liblog, convertPrintable_mixed) {
-  auto input =
-      u8"\x80\xC2¢ह€𐍈\x01\xE0\xA4\x06¢ह€𐍈\xE0\x06\a\b\xF0\x90¢ह€𐍈\x8D\x06\xF0\t\t\x90\x06\xF0\x0E";
-  auto expected_output =
-      u8"\\x80\\xC2¢ह€𐍈\\x01\\xE0\\xA4\\x06¢ह€𐍈\\xE0\\x06\\a\\b\\xF0\\x90¢ह€𐍈\\x8D\\x06\\xF0\t\t"
-      u8"\\x90\\x06\\xF0\\x0E";
-  auto output_size = convertPrintable(nullptr, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(expected_output));
-
-  char output[output_size];
-
-  output_size = convertPrintable(output, input, strlen(input));
-  EXPECT_EQ(output_size, strlen(expected_output));
-  EXPECT_STREQ(expected_output, output);
-}
-
-TEST(liblog, log_print_different_header_size) {
-  constexpr int32_t kPid = 123;
-  constexpr uint32_t kTid = 456;
-  constexpr uint32_t kSec = 1000;
-  constexpr uint32_t kNsec = 999;
-  constexpr uint32_t kLid = LOG_ID_MAIN;
-  constexpr uint32_t kUid = 987;
-  constexpr char kPriority = ANDROID_LOG_ERROR;
-
-  auto create_buf = [](char* buf, size_t len, uint16_t hdr_size) {
-    memset(buf, 0, len);
-    logger_entry* header = reinterpret_cast<logger_entry*>(buf);
-    header->hdr_size = hdr_size;
-    header->pid = kPid;
-    header->tid = kTid;
-    header->sec = kSec;
-    header->nsec = kNsec;
-    header->lid = kLid;
-    header->uid = kUid;
-    char* message = buf + header->hdr_size;
-    uint16_t message_len = 0;
-    message[message_len++] = kPriority;
-    message[message_len++] = 'T';
-    message[message_len++] = 'a';
-    message[message_len++] = 'g';
-    message[message_len++] = '\0';
-    message[message_len++] = 'm';
-    message[message_len++] = 's';
-    message[message_len++] = 'g';
-    message[message_len++] = '!';
-    message[message_len++] = '\0';
-    header->len = message_len;
-  };
-
-  auto check_entry = [&](const AndroidLogEntry& entry) {
-    EXPECT_EQ(kSec, static_cast<uint32_t>(entry.tv_sec));
-    EXPECT_EQ(kNsec, static_cast<uint32_t>(entry.tv_nsec));
-    EXPECT_EQ(kPriority, entry.priority);
-    EXPECT_EQ(kUid, static_cast<uint32_t>(entry.uid));
-    EXPECT_EQ(kPid, entry.pid);
-    EXPECT_EQ(kTid, static_cast<uint32_t>(entry.tid));
-    EXPECT_STREQ("Tag", entry.tag);
-    EXPECT_EQ(4U, entry.tagLen);  // Apparently taglen includes the nullptr?
-    EXPECT_EQ(4U, entry.messageLen);
-    EXPECT_STREQ("msg!", entry.message);
-  };
-  alignas(logger_entry) char buf[LOGGER_ENTRY_MAX_LEN];
-  create_buf(buf, sizeof(buf), sizeof(logger_entry));
-
-  AndroidLogEntry entry_normal_size;
-  ASSERT_EQ(0,
-            android_log_processLogBuffer(reinterpret_cast<logger_entry*>(buf), &entry_normal_size));
-  check_entry(entry_normal_size);
-
-  create_buf(buf, sizeof(buf), sizeof(logger_entry) + 3);
-  AndroidLogEntry entry_odd_size;
-  ASSERT_EQ(0, android_log_processLogBuffer(reinterpret_cast<logger_entry*>(buf), &entry_odd_size));
-  check_entry(entry_odd_size);
-}
\ No newline at end of file
diff --git a/liblog/uio.h b/liblog/uio.h
deleted file mode 100644
index c85893c..0000000
--- a/liblog/uio.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#if defined(_WIN32)
-#include <stddef.h>
-struct iovec {
-  void* iov_base;
-  size_t iov_len;
-};
-#else
-#include <sys/uio.h>
-#endif
diff --git a/libmodprobe/OWNERS b/libmodprobe/OWNERS
index 4b770b1..e6b5bba 100644
--- a/libmodprobe/OWNERS
+++ b/libmodprobe/OWNERS
@@ -1,2 +1 @@
-tomcherry@google.com
 smuckle@google.com
diff --git a/libmodprobe/include/modprobe/modprobe.h b/libmodprobe/include/modprobe/modprobe.h
index 4806b08..baee4f9 100644
--- a/libmodprobe/include/modprobe/modprobe.h
+++ b/libmodprobe/include/modprobe/modprobe.h
@@ -37,7 +37,6 @@
     void ResetModuleCount() { module_count_ = 0; }
     int GetModuleCount() { return module_count_; }
     void EnableBlocklist(bool enable);
-    void EnableVerbose(bool enable);
 
   private:
     std::string MakeCanonical(const std::string& module_path);
diff --git a/libmodprobe/libmodprobe.cpp b/libmodprobe/libmodprobe.cpp
index 5a6ae8b..b3ae937 100644
--- a/libmodprobe/libmodprobe.cpp
+++ b/libmodprobe/libmodprobe.cpp
@@ -66,6 +66,7 @@
         deps.emplace_back(prefix + args[0].substr(0, pos));
     } else {
         LOG(ERROR) << "dependency lines must start with name followed by ':'";
+        return false;
     }
 
     // Remaining items are dependencies of our module
@@ -336,21 +337,12 @@
     }
 
     ParseKernelCmdlineOptions();
-    android::base::SetMinimumLogSeverity(android::base::INFO);
 }
 
 void Modprobe::EnableBlocklist(bool enable) {
     blocklist_enabled = enable;
 }
 
-void Modprobe::EnableVerbose(bool enable) {
-    if (enable) {
-        android::base::SetMinimumLogSeverity(android::base::VERBOSE);
-    } else {
-        android::base::SetMinimumLogSeverity(android::base::INFO);
-    }
-}
-
 std::vector<std::string> Modprobe::GetDependencies(const std::string& module) {
     auto it = module_deps_.find(module);
     if (it == module_deps_.end()) {
diff --git a/libmodprobe/libmodprobe_ext.cpp b/libmodprobe/libmodprobe_ext.cpp
index 84f7150..fb1f5e7 100644
--- a/libmodprobe/libmodprobe_ext.cpp
+++ b/libmodprobe/libmodprobe_ext.cpp
@@ -35,7 +35,7 @@
     android::base::unique_fd fd(
             TEMP_FAILURE_RETRY(open(path_name.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC)));
     if (fd == -1) {
-        LOG(ERROR) << "Could not open module '" << path_name << "'";
+        PLOG(ERROR) << "Could not open module '" << path_name << "'";
         return false;
     }
 
@@ -49,7 +49,7 @@
         options = options + " " + parameters;
     }
 
-    LOG(INFO) << "Loading module " << path_name << " with args \"" << options << "\"";
+    LOG(INFO) << "Loading module " << path_name << " with args '" << options << "'";
     int ret = syscall(__NR_finit_module, fd.get(), options.c_str(), 0);
     if (ret != 0) {
         if (errno == EEXIST) {
@@ -57,7 +57,7 @@
             module_loaded_.emplace(canonical_name);
             return true;
         }
-        LOG(ERROR) << "Failed to insmod '" << path_name << "' with args '" << options << "'";
+        PLOG(ERROR) << "Failed to insmod '" << path_name << "' with args '" << options << "'";
         return false;
     }
 
diff --git a/libmodprobe/libmodprobe_test.cpp b/libmodprobe/libmodprobe_test.cpp
index 5919c49..d50c10d 100644
--- a/libmodprobe/libmodprobe_test.cpp
+++ b/libmodprobe/libmodprobe_test.cpp
@@ -179,3 +179,16 @@
     m.EnableBlocklist(true);
     EXPECT_FALSE(m.LoadWithAliases("test4", true));
 }
+
+TEST(libmodprobe, ModuleDepLineWithoutColonIsSkipped) {
+    TemporaryDir dir;
+    auto dir_path = std::string(dir.path);
+    ASSERT_TRUE(android::base::WriteStringToFile(
+            "no_colon.ko no_colon.ko\n", dir_path + "/modules.dep", 0600, getuid(), getgid()));
+
+    kernel_cmdline = "";
+    test_modules = {dir_path + "/no_colon.ko"};
+
+    Modprobe m({dir.path});
+    EXPECT_FALSE(m.LoadWithAliases("no_colon", true));
+}
diff --git a/libnetutils/Android.bp b/libnetutils/Android.bp
index 268496f..eec2415 100644
--- a/libnetutils/Android.bp
+++ b/libnetutils/Android.bp
@@ -21,6 +21,26 @@
     cflags: ["-Werror"],
 
     export_include_dirs: ["include"],
+    // TODO: remove connectivity module dependency, or have this lib build against the ndk
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.tethering",
+    ],
+}
+
+cc_library_static {
+    name: "libipchecksum",
+
+    srcs: [
+        "checksum.c",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    export_include_dirs: ["include"],
 }
 
 cc_binary {
diff --git a/libpackagelistparser/Android.bp b/libpackagelistparser/Android.bp
index b56dcdb..c3f8692 100644
--- a/libpackagelistparser/Android.bp
+++ b/libpackagelistparser/Android.bp
@@ -1,5 +1,7 @@
 cc_library {
     name: "libpackagelistparser",
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     srcs: ["packagelistparser.cpp"],
     shared_libs: ["liblog"],
diff --git a/libprocessgroup/Android.bp b/libprocessgroup/Android.bp
index bda11e9..f104100 100644
--- a/libprocessgroup/Android.bp
+++ b/libprocessgroup/Android.bp
@@ -1,6 +1,9 @@
 cc_library_headers {
     name: "libprocessgroup_headers",
     vendor_available: true,
+    product_available: true,
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     host_supported: true,
     native_bridge_supported: true,
@@ -30,8 +33,11 @@
     name: "libprocessgroup",
     host_supported: true,
     native_bridge_supported: true,
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     vendor_available: true,
+    product_available: true,
     vndk: {
         enabled: true,
         support_system_process: true,
diff --git a/libprocessgroup/OWNERS b/libprocessgroup/OWNERS
index 27b9a03..8ebb8cc 100644
--- a/libprocessgroup/OWNERS
+++ b/libprocessgroup/OWNERS
@@ -1,3 +1,2 @@
 ccross@google.com
 surenb@google.com
-tomcherry@google.com
diff --git a/libprocessgroup/cgroup_map.cpp b/libprocessgroup/cgroup_map.cpp
index b82b0ab..5ca0967 100644
--- a/libprocessgroup/cgroup_map.cpp
+++ b/libprocessgroup/cgroup_map.cpp
@@ -71,7 +71,7 @@
     if (!HasValue()) return false;
 
     if (state_ == UNKNOWN) {
-        if (ACgroupController_getFlags != nullptr) {
+        if (__builtin_available(android 30, *)) {
             uint32_t flags = ACgroupController_getFlags(controller_);
             state_ = (flags & CGROUPRC_CONTROLLER_FLAG_MOUNTED) != 0 ? USABLE : MISSING;
         } else {
@@ -172,7 +172,7 @@
     auto controller_count = ACgroupFile_getControllerCount();
     for (uint32_t i = 0; i < controller_count; ++i) {
         const ACgroupController* controller = ACgroupFile_getController(i);
-        if (ACgroupController_getFlags != nullptr) {
+        if (__builtin_available(android 30, *)) {
             LOG(INFO) << "\t" << ACgroupController_getName(controller) << " ver "
                       << ACgroupController_getVersion(controller) << " path "
                       << ACgroupController_getPath(controller) << " flags "
diff --git a/libprocessgroup/cgrouprc/Android.bp b/libprocessgroup/cgrouprc/Android.bp
index 0af75bb..bb59942 100644
--- a/libprocessgroup/cgrouprc/Android.bp
+++ b/libprocessgroup/cgrouprc/Android.bp
@@ -15,6 +15,8 @@
 cc_library {
     name: "libcgrouprc",
     host_supported: true,
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     // Do not ever mark this as vendor_available; otherwise, vendor modules
     // that links to the static library will behave unexpectedly. All on-device
@@ -22,6 +24,7 @@
     // defined below. The static library is built for tests.
     vendor_available: false,
     native_bridge_supported: true,
+    llndk_stubs: "libcgrouprc.llndk",
     srcs: [
         "cgroup_controller.cpp",
         "cgroup_file.cpp",
@@ -54,7 +57,7 @@
 }
 
 llndk_library {
-    name: "libcgrouprc",
+    name: "libcgrouprc.llndk",
     symbol_file: "libcgrouprc.llndk.txt",
     native_bridge_supported: true,
     export_include_dirs: [
diff --git a/libprocessgroup/cgrouprc/include/android/cgrouprc.h b/libprocessgroup/cgrouprc/include/android/cgrouprc.h
index 7e74432..9a79954 100644
--- a/libprocessgroup/cgrouprc/include/android/cgrouprc.h
+++ b/libprocessgroup/cgrouprc/include/android/cgrouprc.h
@@ -28,8 +28,6 @@
 struct ACgroupController;
 typedef struct ACgroupController ACgroupController;
 
-#if __ANDROID_API__ >= __ANDROID_API_Q__
-
 // ACgroupFile
 
 /**
@@ -71,8 +69,6 @@
 #define CGROUPRC_CONTROLLER_FLAG_MOUNTED 0x1
 #define CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION 0x2
 
-#if __ANDROID_API__ >= __ANDROID_API_R__
-
 /**
  * Returns the flags bitmask of the given controller.
  * If the given controller is null, return 0.
@@ -80,8 +76,6 @@
 __attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getFlags(
         const ACgroupController*) __INTRODUCED_IN(30);
 
-#endif
-
 /**
  * Returns the name of the given controller.
  * If the given controller is null, return nullptr.
@@ -97,5 +91,3 @@
         __INTRODUCED_IN(29);
 
 __END_DECLS
-
-#endif
diff --git a/libprocessgroup/cgrouprc_format/Android.bp b/libprocessgroup/cgrouprc_format/Android.bp
index 559a869..6428930 100644
--- a/libprocessgroup/cgrouprc_format/Android.bp
+++ b/libprocessgroup/cgrouprc_format/Android.bp
@@ -15,6 +15,8 @@
 cc_library_static {
     name: "libcgrouprc_format",
     host_supported: true,
+    ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     native_bridge_supported: true,
     srcs: [
diff --git a/libprocessgroup/include/processgroup/sched_policy.h b/libprocessgroup/include/processgroup/sched_policy.h
index 945d90c..a18847e 100644
--- a/libprocessgroup/include/processgroup/sched_policy.h
+++ b/libprocessgroup/include/processgroup/sched_policy.h
@@ -42,7 +42,7 @@
     SP_DEFAULT = -1,
     SP_BACKGROUND = 0,
     SP_FOREGROUND = 1,
-    SP_SYSTEM = 2,  // can't be used with set_sched_policy()
+    SP_SYSTEM = 2,
     SP_AUDIO_APP = 3,
     SP_AUDIO_SYS = 4,
     SP_TOP_APP = 5,
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index d669ebe..2bf48fc 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -131,13 +131,25 @@
     return StringPrintf("%s/uid_%d/pid_%d", cgroup, uid, pid);
 }
 
-static int RemoveProcessGroup(const char* cgroup, uid_t uid, int pid) {
-    int ret;
-
+static int RemoveProcessGroup(const char* cgroup, uid_t uid, int pid, unsigned int retries) {
+    int ret = 0;
     auto uid_pid_path = ConvertUidPidToPath(cgroup, uid, pid);
-    ret = rmdir(uid_pid_path.c_str());
-
     auto uid_path = ConvertUidToPath(cgroup, uid);
+
+    if (retries == 0) {
+        retries = 1;
+    }
+
+    while (retries--) {
+        ret = rmdir(uid_pid_path.c_str());
+        if (!ret || errno != EBUSY) break;
+        std::this_thread::sleep_for(5ms);
+    }
+
+    // With the exception of boot or shutdown, system uid_ folders are always populated. Spinning
+    // here would needlessly delay most pid removals. Additionally, once empty a uid_ cgroup won't
+    // have processes hanging on it (we've already spun for all its pid_), so there's no need to
+    // spin anyway.
     rmdir(uid_path.c_str());
 
     return ret;
@@ -176,7 +188,7 @@
     std::vector<std::string> cgroups;
     std::string path;
 
-    if (CgroupGetControllerPath("cpuacct", &path)) {
+    if (CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &path)) {
         cgroups.push_back(path);
     }
     if (CgroupGetControllerPath("memory", &path)) {
@@ -212,19 +224,49 @@
     }
 }
 
+/**
+ * Process groups are primarily created by the Zygote, meaning that uid/pid groups are created by
+ * the user root. Ownership for the newly created cgroup and all of its files must thus be
+ * transferred for the user/group passed as uid/gid before system_server can properly access them.
+ */
 static bool MkdirAndChown(const std::string& path, mode_t mode, uid_t uid, gid_t gid) {
     if (mkdir(path.c_str(), mode) == -1 && errno != EEXIST) {
         return false;
     }
 
-    if (chown(path.c_str(), uid, gid) == -1) {
-        int saved_errno = errno;
-        rmdir(path.c_str());
-        errno = saved_errno;
-        return false;
+    auto dir = std::unique_ptr<DIR, decltype(&closedir)>(opendir(path.c_str()), closedir);
+
+    if (dir == NULL) {
+        PLOG(ERROR) << "opendir failed for " << path;
+        goto err;
+    }
+
+    struct dirent* dir_entry;
+    while ((dir_entry = readdir(dir.get()))) {
+        if (!strcmp("..", dir_entry->d_name)) {
+            continue;
+        }
+
+        std::string file_path = path + "/" + dir_entry->d_name;
+
+        if (lchown(file_path.c_str(), uid, gid) < 0) {
+            PLOG(ERROR) << "lchown failed for " << file_path;
+            goto err;
+        }
+
+        if (fchmodat(AT_FDCWD, file_path.c_str(), mode, AT_SYMLINK_NOFOLLOW) != 0) {
+            PLOG(ERROR) << "fchmodat failed for " << file_path;
+            goto err;
+        }
     }
 
     return true;
+err:
+    int saved_errno = errno;
+    rmdir(path.c_str());
+    errno = saved_errno;
+
+    return false;
 }
 
 // Returns number of processes killed on success
@@ -302,17 +344,9 @@
 
 static int KillProcessGroup(uid_t uid, int initialPid, int signal, int retries,
                             int* max_processes) {
-    std::string cpuacct_path;
-    std::string memory_path;
-
-    CgroupGetControllerPath("cpuacct", &cpuacct_path);
-    CgroupGetControllerPath("memory", &memory_path);
-    memory_path += "/apps";
-
-    const char* cgroup =
-            (!access(ConvertUidPidToPath(cpuacct_path.c_str(), uid, initialPid).c_str(), F_OK))
-                    ? cpuacct_path.c_str()
-                    : memory_path.c_str();
+    std::string hierarchy_root_path;
+    CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &hierarchy_root_path);
+    const char* cgroup = hierarchy_root_path.c_str();
 
     std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
 
@@ -355,7 +389,17 @@
             LOG(INFO) << "Successfully killed process cgroup uid " << uid << " pid " << initialPid
                       << " in " << static_cast<int>(ms) << "ms";
         }
-        return RemoveProcessGroup(cgroup, uid, initialPid);
+
+        int err = RemoveProcessGroup(cgroup, uid, initialPid, retries);
+
+        if (isMemoryCgroupSupported() && UsePerAppMemcg()) {
+            std::string memory_path;
+            CgroupGetControllerPath("memory", &memory_path);
+            memory_path += "/apps";
+            if (RemoveProcessGroup(memory_path.c_str(), uid, initialPid, retries)) return -1;
+        }
+
+        return err;
     } else {
         if (retries > 0) {
             LOG(ERROR) << "Failed to kill process cgroup uid " << uid << " pid " << initialPid
@@ -374,15 +418,7 @@
     return KillProcessGroup(uid, initialPid, signal, 0 /*retries*/, max_processes);
 }
 
-int createProcessGroup(uid_t uid, int initialPid, bool memControl) {
-    std::string cgroup;
-    if (isMemoryCgroupSupported() && (memControl || UsePerAppMemcg())) {
-        CgroupGetControllerPath("memory", &cgroup);
-        cgroup += "/apps";
-    } else {
-        CgroupGetControllerPath("cpuacct", &cgroup);
-    }
-
+static int createProcessGroupInternal(uid_t uid, int initialPid, std::string cgroup) {
     auto uid_path = ConvertUidToPath(cgroup.c_str(), uid);
 
     if (!MkdirAndChown(uid_path, 0750, AID_SYSTEM, AID_SYSTEM)) {
@@ -408,6 +444,27 @@
     return ret;
 }
 
+int createProcessGroup(uid_t uid, int initialPid, bool memControl) {
+    std::string cgroup;
+
+    if (memControl && !UsePerAppMemcg()) {
+        PLOG(ERROR) << "service memory controls are used without per-process memory cgroup support";
+        return -EINVAL;
+    }
+
+    if (isMemoryCgroupSupported() && UsePerAppMemcg()) {
+        CgroupGetControllerPath("memory", &cgroup);
+        cgroup += "/apps";
+        int ret = createProcessGroupInternal(uid, initialPid, cgroup);
+        if (ret != 0) {
+            return ret;
+        }
+    }
+
+    CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &cgroup);
+    return createProcessGroupInternal(uid, initialPid, cgroup);
+}
+
 static bool SetProcessGroupValue(int tid, const std::string& attr_name, int64_t value) {
     if (!isMemoryCgroupSupported()) {
         PLOG(ERROR) << "Memcg is not mounted.";
diff --git a/libprocessgroup/profiles/Android.bp b/libprocessgroup/profiles/Android.bp
index ccc6f62..a496237 100644
--- a/libprocessgroup/profiles/Android.bp
+++ b/libprocessgroup/profiles/Android.bp
@@ -15,6 +15,11 @@
 prebuilt_etc {
     name: "cgroups.json",
     src: "cgroups.json",
+    required: [
+        "cgroups_28.json",
+        "cgroups_29.json",
+        "cgroups_30.json",
+    ],
 }
 
 prebuilt_etc {
@@ -25,8 +30,49 @@
 }
 
 prebuilt_etc {
+    name: "cgroups_28.json",
+    src: "cgroups_28.json",
+    sub_dir: "task_profiles",
+}
+
+prebuilt_etc {
+    name: "cgroups_29.json",
+    src: "cgroups_29.json",
+    sub_dir: "task_profiles",
+}
+
+prebuilt_etc {
+    name: "cgroups_30.json",
+    src: "cgroups_30.json",
+    sub_dir: "task_profiles",
+}
+
+prebuilt_etc {
     name: "task_profiles.json",
     src: "task_profiles.json",
+    required: [
+        "task_profiles_28.json",
+        "task_profiles_29.json",
+        "task_profiles_30.json",
+    ],
+}
+
+prebuilt_etc {
+    name: "task_profiles_28.json",
+    src: "task_profiles_28.json",
+    sub_dir: "task_profiles",
+}
+
+prebuilt_etc {
+    name: "task_profiles_29.json",
+    src: "task_profiles_29.json",
+    sub_dir: "task_profiles",
+}
+
+prebuilt_etc {
+    name: "task_profiles_30.json",
+    src: "task_profiles_30.json",
+    sub_dir: "task_profiles",
 }
 
 cc_defaults {
@@ -104,8 +150,3 @@
         "vts",
     ],
 }
-
-vts_config {
-    name: "VtsProcessgroupValidateTest",
-    test_config: "vts_processgroup_validate_test.xml",
-}
diff --git a/libprocessgroup/profiles/cgroups.json b/libprocessgroup/profiles/cgroups.json
index 4518487..962d2ba 100644
--- a/libprocessgroup/profiles/cgroups.json
+++ b/libprocessgroup/profiles/cgroups.json
@@ -15,11 +15,6 @@
       "GID": "system"
     },
     {
-      "Controller": "cpuacct",
-      "Path": "/acct",
-      "Mode": "0555"
-    },
-    {
       "Controller": "cpuset",
       "Path": "/dev/cpuset",
       "Mode": "0755",
@@ -32,13 +27,6 @@
       "Mode": "0700",
       "UID": "root",
       "GID": "system"
-    },
-    {
-      "Controller": "schedtune",
-      "Path": "/dev/stune",
-      "Mode": "0755",
-      "UID": "system",
-      "GID": "system"
     }
   ],
   "Cgroups2": {
@@ -49,7 +37,7 @@
     "Controllers": [
       {
         "Controller": "freezer",
-        "Path": "freezer",
+        "Path": ".",
         "Mode": "0755",
         "UID": "system",
         "GID": "system"
diff --git a/libprocessgroup/profiles/cgroups.recovery.json b/libprocessgroup/profiles/cgroups.recovery.json
index f0bf5fd..2c63c08 100644
--- a/libprocessgroup/profiles/cgroups.recovery.json
+++ b/libprocessgroup/profiles/cgroups.recovery.json
@@ -1,9 +1,2 @@
 {
-  "Cgroups": [
-    {
-      "Controller": "cpuacct",
-      "Path": "/acct",
-      "Mode": "0555"
-    }
-  ]
 }
diff --git a/libprocessgroup/profiles/cgroups_28.json b/libprocessgroup/profiles/cgroups_28.json
new file mode 100644
index 0000000..17d4929
--- /dev/null
+++ b/libprocessgroup/profiles/cgroups_28.json
@@ -0,0 +1,11 @@
+{
+  "Cgroups": [
+    {
+      "Controller": "schedtune",
+      "Path": "/dev/stune",
+      "Mode": "0755",
+      "UID": "system",
+      "GID": "system"
+    }
+  ]
+}
diff --git a/libprocessgroup/profiles/cgroups_29.json b/libprocessgroup/profiles/cgroups_29.json
new file mode 100644
index 0000000..17d4929
--- /dev/null
+++ b/libprocessgroup/profiles/cgroups_29.json
@@ -0,0 +1,11 @@
+{
+  "Cgroups": [
+    {
+      "Controller": "schedtune",
+      "Path": "/dev/stune",
+      "Mode": "0755",
+      "UID": "system",
+      "GID": "system"
+    }
+  ]
+}
diff --git a/libprocessgroup/profiles/cgroups_30.json b/libprocessgroup/profiles/cgroups_30.json
new file mode 100644
index 0000000..17d4929
--- /dev/null
+++ b/libprocessgroup/profiles/cgroups_30.json
@@ -0,0 +1,11 @@
+{
+  "Cgroups": [
+    {
+      "Controller": "schedtune",
+      "Path": "/dev/stune",
+      "Mode": "0755",
+      "UID": "system",
+      "GID": "system"
+    }
+  ]
+}
diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json
index c4dbf8e..628098b 100644
--- a/libprocessgroup/profiles/task_profiles.json
+++ b/libprocessgroup/profiles/task_profiles.json
@@ -31,16 +31,6 @@
       "File": "memory.swappiness"
     },
     {
-      "Name": "STuneBoost",
-      "Controller": "schedtune",
-      "File": "schedtune.boost"
-    },
-    {
-      "Name": "STunePreferIdle",
-      "Controller": "schedtune",
-      "File": "schedtune.prefer_idle"
-    },
-    {
       "Name": "UClampMin",
       "Controller": "cpu",
       "File": "cpu.uclamp.min"
@@ -51,7 +41,12 @@
       "File": "cpu.uclamp.max"
     },
     {
-      "Name": "FreezerState",
+      "Name": "UClampLatencySensitive",
+      "Controller": "cpu",
+      "File": "cpu.uclamp.latency_sensitive"
+    },
+    {
+      "Name": "Freezer",
       "Controller": "freezer",
       "File": "cgroup.freeze"
     }
@@ -65,7 +60,7 @@
           "Name": "JoinCgroup",
           "Params":
           {
-            "Controller": "schedtune",
+            "Controller": "cpu",
             "Path": "background"
           }
         }
@@ -75,11 +70,11 @@
       "Name": "Frozen",
       "Actions": [
         {
-          "Name": "JoinCgroup",
+          "Name": "SetAttribute",
           "Params":
           {
-            "Controller": "freezer",
-            "Path": ""
+            "Name": "Freezer",
+            "Value": "1"
           }
         }
       ]
@@ -88,11 +83,11 @@
       "Name": "Unfrozen",
       "Actions": [
         {
-          "Name": "JoinCgroup",
+          "Name": "SetAttribute",
           "Params":
           {
-            "Controller": "freezer",
-            "Path": "../"
+            "Name": "Freezer",
+            "Value": "0"
           }
         }
       ]
@@ -104,8 +99,21 @@
           "Name": "JoinCgroup",
           "Params":
           {
-            "Controller": "schedtune",
-            "Path": ""
+            "Controller": "cpu",
+            "Path": "system"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "ServicePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "cpu",
+            "Path": "system-background"
           }
         }
       ]
@@ -117,7 +125,7 @@
           "Name": "JoinCgroup",
           "Params":
           {
-            "Controller": "schedtune",
+            "Controller": "cpu",
             "Path": "foreground"
           }
         }
@@ -130,7 +138,7 @@
           "Name": "JoinCgroup",
           "Params":
           {
-            "Controller": "schedtune",
+            "Controller": "cpu",
             "Path": "top-app"
           }
         }
@@ -143,7 +151,7 @@
           "Name": "JoinCgroup",
           "Params":
           {
-            "Controller": "schedtune",
+            "Controller": "cpu",
             "Path": "rt"
           }
         }
@@ -156,12 +164,25 @@
           "Name": "JoinCgroup",
           "Params":
           {
-            "Controller": "schedtune",
+            "Controller": "cpu",
             "Path": "camera-daemon"
           }
         }
       ]
     },
+    {
+      "Name": "NNApiHALPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "cpu",
+            "Path": "nnapi-hal"
+          }
+        }
+      ]
+    },
 
     {
       "Name": "CpuPolicySpread",
@@ -170,7 +191,7 @@
           "Name": "SetAttribute",
           "Params":
           {
-            "Name": "STunePreferIdle",
+            "Name": "UClampLatencySensitive",
             "Value": "1"
           }
         }
@@ -183,7 +204,7 @@
           "Name": "SetAttribute",
           "Params":
           {
-            "Name": "STunePreferIdle",
+            "Name": "UClampLatencySensitive",
             "Value": "0"
           }
         }
@@ -583,6 +604,10 @@
       "Profiles": [ "MaxPerformance", "MaxIoPriority", "TimerSlackNormal" ]
     },
     {
+      "Name": "SCHED_SP_SYSTEM",
+      "Profiles": [ "ServicePerformance", "LowIoPriority", "TimerSlackNormal" ]
+    },
+    {
       "Name": "SCHED_SP_RT_APP",
       "Profiles": [ "RealtimePerformance", "MaxIoPriority", "TimerSlackNormal" ]
     },
diff --git a/libprocessgroup/profiles/task_profiles_28.json b/libprocessgroup/profiles/task_profiles_28.json
new file mode 100644
index 0000000..9f83785
--- /dev/null
+++ b/libprocessgroup/profiles/task_profiles_28.json
@@ -0,0 +1,135 @@
+{
+  "Attributes": [
+    {
+      "Name": "STuneBoost",
+      "Controller": "schedtune",
+      "File": "schedtune.boost"
+    },
+    {
+      "Name": "STunePreferIdle",
+      "Controller": "schedtune",
+      "File": "schedtune.prefer_idle"
+    }
+  ],
+
+  "Profiles": [
+    {
+      "Name": "HighEnergySaving",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "background"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "NormalPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": ""
+          }
+        }
+      ]
+    },
+    {
+      "Name": "HighPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "foreground"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "MaxPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "top-app"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "RealtimePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "rt"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "CameraServicePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "camera-daemon"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "NNApiHALPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "nnapi-hal"
+          }
+        }
+      ]
+    },
+
+    {
+      "Name": "CpuPolicySpread",
+      "Actions": [
+        {
+          "Name": "SetAttribute",
+          "Params":
+          {
+            "Name": "STunePreferIdle",
+            "Value": "1"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "CpuPolicyPack",
+      "Actions": [
+        {
+          "Name": "SetAttribute",
+          "Params":
+          {
+            "Name": "STunePreferIdle",
+            "Value": "0"
+          }
+        }
+      ]
+    }
+  ]
+}
diff --git a/libprocessgroup/profiles/task_profiles_29.json b/libprocessgroup/profiles/task_profiles_29.json
new file mode 100644
index 0000000..9f83785
--- /dev/null
+++ b/libprocessgroup/profiles/task_profiles_29.json
@@ -0,0 +1,135 @@
+{
+  "Attributes": [
+    {
+      "Name": "STuneBoost",
+      "Controller": "schedtune",
+      "File": "schedtune.boost"
+    },
+    {
+      "Name": "STunePreferIdle",
+      "Controller": "schedtune",
+      "File": "schedtune.prefer_idle"
+    }
+  ],
+
+  "Profiles": [
+    {
+      "Name": "HighEnergySaving",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "background"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "NormalPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": ""
+          }
+        }
+      ]
+    },
+    {
+      "Name": "HighPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "foreground"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "MaxPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "top-app"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "RealtimePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "rt"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "CameraServicePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "camera-daemon"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "NNApiHALPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "nnapi-hal"
+          }
+        }
+      ]
+    },
+
+    {
+      "Name": "CpuPolicySpread",
+      "Actions": [
+        {
+          "Name": "SetAttribute",
+          "Params":
+          {
+            "Name": "STunePreferIdle",
+            "Value": "1"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "CpuPolicyPack",
+      "Actions": [
+        {
+          "Name": "SetAttribute",
+          "Params":
+          {
+            "Name": "STunePreferIdle",
+            "Value": "0"
+          }
+        }
+      ]
+    }
+  ]
+}
diff --git a/libprocessgroup/profiles/task_profiles_30.json b/libprocessgroup/profiles/task_profiles_30.json
new file mode 100644
index 0000000..9f83785
--- /dev/null
+++ b/libprocessgroup/profiles/task_profiles_30.json
@@ -0,0 +1,135 @@
+{
+  "Attributes": [
+    {
+      "Name": "STuneBoost",
+      "Controller": "schedtune",
+      "File": "schedtune.boost"
+    },
+    {
+      "Name": "STunePreferIdle",
+      "Controller": "schedtune",
+      "File": "schedtune.prefer_idle"
+    }
+  ],
+
+  "Profiles": [
+    {
+      "Name": "HighEnergySaving",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "background"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "NormalPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": ""
+          }
+        }
+      ]
+    },
+    {
+      "Name": "HighPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "foreground"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "MaxPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "top-app"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "RealtimePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "rt"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "CameraServicePerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "camera-daemon"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "NNApiHALPerformance",
+      "Actions": [
+        {
+          "Name": "JoinCgroup",
+          "Params":
+          {
+            "Controller": "schedtune",
+            "Path": "nnapi-hal"
+          }
+        }
+      ]
+    },
+
+    {
+      "Name": "CpuPolicySpread",
+      "Actions": [
+        {
+          "Name": "SetAttribute",
+          "Params":
+          {
+            "Name": "STunePreferIdle",
+            "Value": "1"
+          }
+        }
+      ]
+    },
+    {
+      "Name": "CpuPolicyPack",
+      "Actions": [
+        {
+          "Name": "SetAttribute",
+          "Params":
+          {
+            "Name": "STunePreferIdle",
+            "Value": "0"
+          }
+        }
+      ]
+    }
+  ]
+}
diff --git a/libprocessgroup/profiles/vts_processgroup_validate_test.xml b/libprocessgroup/profiles/vts_processgroup_validate_test.xml
deleted file mode 100644
index 21d29cd..0000000
--- a/libprocessgroup/profiles/vts_processgroup_validate_test.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<configuration description="Config for VtsProcessgroupValidateTest">
-    <option name="config-descriptor:metadata" key="plan" value="vts-treble" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
-        <option name="abort-on-push-failure" value="false"/>
-        <option name="push-group" value="HostDrivenTest.push"/>
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
-        <option name="test-module-name" value="VtsProcessgroupValidateTest"/>
-        <option name="binary-test-working-directory" value="_32bit::/data/nativetest/" />
-        <option name="binary-test-working-directory" value="_64bit::/data/nativetest64/" />
-        <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_processgroup_validate_test/vts_processgroup_validate_test" />
-        <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_processgroup_validate_test/vts_processgroup_validate_test" />
-        <option name="binary-test-type" value="gtest"/>
-        <option name="binary-test-disable-framework" value="false"/>
-        <option name="test-timeout" value="30s"/>
-    </test>
-</configuration>
diff --git a/libprocessgroup/sched_policy.cpp b/libprocessgroup/sched_policy.cpp
index 698e74d..c51ee61 100644
--- a/libprocessgroup/sched_policy.cpp
+++ b/libprocessgroup/sched_policy.cpp
@@ -124,6 +124,8 @@
             return SetTaskProfiles(tid, {"SCHED_SP_FOREGROUND"}, true) ? 0 : -1;
         case SP_TOP_APP:
             return SetTaskProfiles(tid, {"SCHED_SP_TOP_APP"}, true) ? 0 : -1;
+        case SP_SYSTEM:
+            return SetTaskProfiles(tid, {"SCHED_SP_SYSTEM"}, true) ? 0 : -1;
         case SP_RT_APP:
             return SetTaskProfiles(tid, {"SCHED_SP_RT_APP"}, true) ? 0 : -1;
         default:
@@ -258,7 +260,7 @@
      */
     static constexpr const char* kSchedProfiles[SP_CNT + 1] = {
             "SCHED_SP_DEFAULT", "SCHED_SP_BACKGROUND", "SCHED_SP_FOREGROUND",
-            "SCHED_SP_DEFAULT", "SCHED_SP_FOREGROUND", "SCHED_SP_FOREGROUND",
+            "SCHED_SP_SYSTEM",  "SCHED_SP_FOREGROUND", "SCHED_SP_FOREGROUND",
             "SCHED_SP_TOP_APP", "SCHED_SP_RT_APP",     "SCHED_SP_DEFAULT"};
     if (policy < SP_DEFAULT || policy >= SP_CNT) {
         return nullptr;
diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp
index 25f16a6..753fd2d 100644
--- a/libprocessgroup/setup/cgroup_map_write.cpp
+++ b/libprocessgroup/setup/cgroup_map_write.cpp
@@ -45,7 +45,7 @@
 
 #include "cgroup_descriptor.h"
 
-using android::base::GetBoolProperty;
+using android::base::GetUintProperty;
 using android::base::StringPrintf;
 using android::base::unique_fd;
 
@@ -55,6 +55,8 @@
 static constexpr const char* CGROUPS_DESC_FILE = "/etc/cgroups.json";
 static constexpr const char* CGROUPS_DESC_VENDOR_FILE = "/vendor/etc/cgroups.json";
 
+static constexpr const char* TEMPLATE_CGROUPS_DESC_API_FILE = "/etc/task_profiles/cgroups_%u.json";
+
 static bool ChangeDirModeAndOwner(const std::string& path, mode_t mode, const std::string& uid,
                                   const std::string& gid, bool permissive_mode = false) {
     uid_t pw_uid = -1;
@@ -217,6 +219,18 @@
         return false;
     }
 
+    // load API-level specific system cgroups descriptors if available
+    unsigned int api_level = GetUintProperty<unsigned int>("ro.product.first_api_level", 0);
+    if (api_level > 0) {
+        std::string api_cgroups_path =
+                android::base::StringPrintf(TEMPLATE_CGROUPS_DESC_API_FILE, api_level);
+        if (!access(api_cgroups_path.c_str(), F_OK) || errno != ENOENT) {
+            if (!ReadDescriptorsFromFile(api_cgroups_path, descriptors)) {
+                return false;
+            }
+        }
+    }
+
     // load vendor cgroup descriptors if the file exists
     if (!access(CGROUPS_DESC_VENDOR_FILE, F_OK) &&
         !ReadDescriptorsFromFile(CGROUPS_DESC_VENDOR_FILE, descriptors)) {
diff --git a/libprocessgroup/task_profiles.cpp b/libprocessgroup/task_profiles.cpp
index a638fca..8d4ce25 100644
--- a/libprocessgroup/task_profiles.cpp
+++ b/libprocessgroup/task_profiles.cpp
@@ -23,7 +23,9 @@
 
 #include <android-base/file.h>
 #include <android-base/logging.h>
+#include <android-base/properties.h>
 #include <android-base/stringprintf.h>
+#include <android-base/strings.h>
 #include <android-base/threads.h>
 
 #include <cutils/android_filesystem_config.h>
@@ -37,12 +39,17 @@
 #endif
 
 using android::base::GetThreadId;
+using android::base::GetUintProperty;
 using android::base::StringPrintf;
+using android::base::StringReplace;
 using android::base::unique_fd;
 using android::base::WriteStringToFile;
 
-#define TASK_PROFILE_DB_FILE "/etc/task_profiles.json"
-#define TASK_PROFILE_DB_VENDOR_FILE "/vendor/etc/task_profiles.json"
+static constexpr const char* TASK_PROFILE_DB_FILE = "/etc/task_profiles.json";
+static constexpr const char* TASK_PROFILE_DB_VENDOR_FILE = "/vendor/etc/task_profiles.json";
+
+static constexpr const char* TEMPLATE_TASK_PROFILE_API_FILE =
+        "/etc/task_profiles/task_profiles_%u.json";
 
 void ProfileAttribute::Reset(const CgroupController& controller, const std::string& file_name) {
     controller_ = controller;
@@ -257,6 +264,39 @@
     return true;
 }
 
+bool WriteFileAction::ExecuteForProcess(uid_t uid, pid_t pid) const {
+    std::string filepath(filepath_), value(value_);
+
+    filepath = StringReplace(filepath, "<uid>", std::to_string(uid), true);
+    filepath = StringReplace(filepath, "<pid>", std::to_string(pid), true);
+    value = StringReplace(value, "<uid>", std::to_string(uid), true);
+    value = StringReplace(value, "<pid>", std::to_string(pid), true);
+
+    if (!WriteStringToFile(value, filepath)) {
+        if (logfailures_) PLOG(ERROR) << "Failed to write '" << value << "' to " << filepath;
+        return false;
+    }
+
+    return true;
+}
+
+bool WriteFileAction::ExecuteForTask(int tid) const {
+    std::string filepath(filepath_), value(value_);
+    int uid = getuid();
+
+    filepath = StringReplace(filepath, "<uid>", std::to_string(uid), true);
+    filepath = StringReplace(filepath, "<pid>", std::to_string(tid), true);
+    value = StringReplace(value, "<uid>", std::to_string(uid), true);
+    value = StringReplace(value, "<pid>", std::to_string(tid), true);
+
+    if (!WriteStringToFile(value, filepath)) {
+        if (logfailures_) PLOG(ERROR) << "Failed to write '" << value << "' to " << filepath;
+        return false;
+    }
+
+    return true;
+}
+
 bool ApplyProfileAction::ExecuteForProcess(uid_t uid, pid_t pid) const {
     for (const auto& profile : profiles_) {
         if (!profile->ExecuteForProcess(uid, pid)) {
@@ -356,6 +396,19 @@
         LOG(ERROR) << "Loading " << TASK_PROFILE_DB_FILE << " for [" << getpid() << "] failed";
     }
 
+    // load API-level specific system task profiles if available
+    unsigned int api_level = GetUintProperty<unsigned int>("ro.product.first_api_level", 0);
+    if (api_level > 0) {
+        std::string api_profiles_path =
+                android::base::StringPrintf(TEMPLATE_TASK_PROFILE_API_FILE, api_level);
+        if (!access(api_profiles_path.c_str(), F_OK) || errno != ENOENT) {
+            if (!Load(CgroupMap::GetInstance(), api_profiles_path)) {
+                LOG(ERROR) << "Loading " << api_profiles_path << " for [" << getpid()
+                           << "] failed";
+            }
+        }
+    }
+
     // load vendor task profiles if the file exists
     if (!access(TASK_PROFILE_DB_VENDOR_FILE, F_OK) &&
         !Load(CgroupMap::GetInstance(), TASK_PROFILE_DB_VENDOR_FILE)) {
@@ -459,6 +512,21 @@
                 } else {
                     LOG(WARNING) << "SetClamps: invalid parameter: " << boost_value;
                 }
+            } else if (action_name == "WriteFile") {
+                std::string attr_filepath = params_val["FilePath"].asString();
+                std::string attr_value = params_val["Value"].asString();
+                if (!attr_filepath.empty() && !attr_value.empty()) {
+                    const Json::Value& logfailures = params_val["LogFailures"];
+                    bool attr_logfailures = logfailures.isNull() || logfailures.asBool();
+                    profile->Add(std::make_unique<WriteFileAction>(attr_filepath, attr_value,
+                                                                   attr_logfailures));
+                } else if (attr_filepath.empty()) {
+                    LOG(WARNING) << "WriteFile: invalid parameter: "
+                                 << "empty filepath";
+                } else if (attr_value.empty()) {
+                    LOG(WARNING) << "WriteFile: invalid parameter: "
+                                 << "empty value";
+                }
             } else {
                 LOG(WARNING) << "Unknown profile action: " << action_name;
             }
diff --git a/libprocessgroup/task_profiles.h b/libprocessgroup/task_profiles.h
index 2983a09..25a84b0 100644
--- a/libprocessgroup/task_profiles.h
+++ b/libprocessgroup/task_profiles.h
@@ -139,6 +139,21 @@
     bool IsFdValid() const { return fd_ > FDS_INACCESSIBLE; }
 };
 
+// Write to file action
+class WriteFileAction : public ProfileAction {
+  public:
+    WriteFileAction(const std::string& filepath, const std::string& value,
+                    bool logfailures) noexcept
+        : filepath_(filepath), value_(value), logfailures_(logfailures) {}
+
+    virtual bool ExecuteForProcess(uid_t uid, pid_t pid) const;
+    virtual bool ExecuteForTask(int tid) const;
+
+  private:
+    std::string filepath_, value_;
+    bool logfailures_;
+};
+
 class TaskProfile {
   public:
     TaskProfile() : res_cached_(false) {}
diff --git a/libprocinfo/.clang-format b/libprocinfo/.clang-format
deleted file mode 120000
index fd0645f..0000000
--- a/libprocinfo/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-2
\ No newline at end of file
diff --git a/libprocinfo/Android.bp b/libprocinfo/Android.bp
deleted file mode 100644
index ae45742..0000000
--- a/libprocinfo/Android.bp
+++ /dev/null
@@ -1,131 +0,0 @@
-//
-// Copyright (C) 2015 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.
-//
-
-cc_defaults {
-    name: "libprocinfo_defaults",
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-    ],
-}
-
-cc_library {
-    name: "libprocinfo",
-    defaults: ["libprocinfo_defaults"],
-    vendor_available: true,
-    // TODO(b/153609531): remove when no longer needed.
-    native_bridge_supported: true,
-    recovery_available: true,
-    vndk: {
-        enabled: true,
-    },
-    host_supported: true,
-    srcs: [
-        "process.cpp",
-        "process_map.cpp",
-    ],
-
-    local_include_dirs: ["include"],
-    export_include_dirs: ["include"],
-    shared_libs: ["libbase"],
-    target: {
-        darwin: {
-            enabled: false,
-        },
-        linux_bionic: {
-            enabled: true,
-        },
-        windows: {
-            enabled: false,
-        },
-    },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.art.debug",
-        "com.android.art.release",
-    ],
-}
-
-// Tests
-// ------------------------------------------------------------------------------
-cc_test {
-    name: "libprocinfo_test",
-    defaults: ["libprocinfo_defaults"],
-    host_supported: true,
-    isolated: true,
-    srcs: [
-        "process_test.cpp",
-        "process_map_test.cpp",
-    ],
-    target: {
-        darwin: {
-            enabled: false,
-        },
-        windows: {
-            enabled: false,
-        },
-    },
-
-    shared_libs: [
-        "libbase",
-        "libprocinfo",
-    ],
-
-    compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-
-    data: [
-        "testdata/*",
-    ],
-
-    test_suites: ["device-tests"],
-}
-
-cc_benchmark {
-    name: "libprocinfo_benchmark",
-    defaults: ["libprocinfo_defaults"],
-    srcs: [
-        "process_map_benchmark.cpp",
-    ],
-    shared_libs: [
-        "libbacktrace",
-        "libbase",
-        "libprocinfo",
-        "libunwindstack",
-    ],
-    compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-
-    data: [
-        "testdata/*",
-    ],
-}
diff --git a/libprocinfo/OWNERS b/libprocinfo/OWNERS
deleted file mode 100644
index a70cc57..0000000
--- a/libprocinfo/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-jmgao@google.com
diff --git a/libprocinfo/include/procinfo/process.h b/libprocinfo/include/procinfo/process.h
deleted file mode 100644
index 9278e18..0000000
--- a/libprocinfo/include/procinfo/process.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <string>
-#include <type_traits>
-
-#include <android-base/logging.h>
-#include <android-base/parseint.h>
-#include <android-base/unique_fd.h>
-
-namespace android {
-namespace procinfo {
-
-#if defined(__linux__)
-
-enum ProcessState {
-  kProcessStateUnknown,
-  kProcessStateRunning,
-  kProcessStateSleeping,
-  kProcessStateUninterruptibleWait,
-  kProcessStateStopped,
-  kProcessStateZombie,
-};
-
-struct ProcessInfo {
-  std::string name;
-  ProcessState state;
-  pid_t tid;
-  pid_t pid;
-  pid_t ppid;
-  pid_t tracer;
-  uid_t uid;
-  uid_t gid;
-};
-
-// Parse the contents of /proc/<tid>/status into |process_info|.
-bool GetProcessInfo(pid_t tid, ProcessInfo* process_info, std::string* error = nullptr);
-
-// Parse the contents of <fd>/status into |process_info|.
-// |fd| should be an fd pointing at a /proc/<pid> directory.
-bool GetProcessInfoFromProcPidFd(int fd, ProcessInfo* process_info, std::string* error = nullptr);
-
-// Fetch the list of threads from a given process's /proc/<pid> directory.
-// |fd| should be an fd pointing at a /proc/<pid> directory.
-template <typename Collection>
-auto GetProcessTidsFromProcPidFd(int fd, Collection* out, std::string* error = nullptr) ->
-    typename std::enable_if<sizeof(typename Collection::value_type) >= sizeof(pid_t), bool>::type {
-  out->clear();
-
-  int task_fd = openat(fd, "task", O_DIRECTORY | O_RDONLY | O_CLOEXEC);
-  std::unique_ptr<DIR, int (*)(DIR*)> dir(fdopendir(task_fd), closedir);
-  if (!dir) {
-    if (error != nullptr) {
-      *error = "failed to open task directory";
-    }
-    return false;
-  }
-
-  struct dirent* dent;
-  while ((dent = readdir(dir.get()))) {
-    if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0) {
-      pid_t tid;
-      if (!android::base::ParseInt(dent->d_name, &tid, 1, std::numeric_limits<pid_t>::max())) {
-        if (error != nullptr) {
-          *error = std::string("failed to parse task id: ") + dent->d_name;
-        }
-        return false;
-      }
-
-      out->insert(out->end(), tid);
-    }
-  }
-
-  return true;
-}
-
-template <typename Collection>
-auto GetProcessTids(pid_t pid, Collection* out, std::string* error = nullptr) ->
-    typename std::enable_if<sizeof(typename Collection::value_type) >= sizeof(pid_t), bool>::type {
-  char task_path[PATH_MAX];
-  if (snprintf(task_path, PATH_MAX, "/proc/%d", pid) >= PATH_MAX) {
-    if (error != nullptr) {
-      *error = "task path overflow (pid = " + std::to_string(pid) + ")";
-    }
-    return false;
-  }
-
-  android::base::unique_fd fd(open(task_path, O_DIRECTORY | O_RDONLY | O_CLOEXEC));
-  if (fd == -1) {
-    if (error != nullptr) {
-      *error = std::string("failed to open ") + task_path;
-    }
-    return false;
-  }
-
-  return GetProcessTidsFromProcPidFd(fd.get(), out, error);
-}
-
-#endif
-
-} /* namespace procinfo */
-} /* namespace android */
diff --git a/libprocinfo/include/procinfo/process_map.h b/libprocinfo/include/procinfo/process_map.h
deleted file mode 100644
index 569a022..0000000
--- a/libprocinfo/include/procinfo/process_map.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-
-#include <functional>
-#include <string>
-#include <vector>
-
-#include <android-base/file.h>
-
-namespace android {
-namespace procinfo {
-
-template <class CallbackType>
-bool ReadMapFileContent(char* content, const CallbackType& callback) {
-  uint64_t start_addr;
-  uint64_t end_addr;
-  uint16_t flags;
-  uint64_t pgoff;
-  ino_t inode;
-  char* next_line = content;
-  char* p;
-
-  auto pass_space = [&]() {
-    if (*p != ' ') {
-      return false;
-    }
-    while (*p == ' ') {
-      p++;
-    }
-    return true;
-  };
-
-  auto pass_xdigit = [&]() {
-    if (!isxdigit(*p)) {
-      return false;
-    }
-    do {
-      p++;
-    } while (isxdigit(*p));
-    return true;
-  };
-
-  while (next_line != nullptr && *next_line != '\0') {
-    p = next_line;
-    next_line = strchr(next_line, '\n');
-    if (next_line != nullptr) {
-      *next_line = '\0';
-      next_line++;
-    }
-    // Parse line like: 00400000-00409000 r-xp 00000000 fc:00 426998  /usr/lib/gvfs/gvfsd-http
-    char* end;
-    // start_addr
-    start_addr = strtoull(p, &end, 16);
-    if (end == p || *end != '-') {
-      return false;
-    }
-    p = end + 1;
-    // end_addr
-    end_addr = strtoull(p, &end, 16);
-    if (end == p) {
-      return false;
-    }
-    p = end;
-    if (!pass_space()) {
-      return false;
-    }
-    // flags
-    flags = 0;
-    if (*p == 'r') {
-      flags |= PROT_READ;
-    } else if (*p != '-') {
-      return false;
-    }
-    p++;
-    if (*p == 'w') {
-      flags |= PROT_WRITE;
-    } else if (*p != '-') {
-      return false;
-    }
-    p++;
-    if (*p == 'x') {
-      flags |= PROT_EXEC;
-    } else if (*p != '-') {
-      return false;
-    }
-    p++;
-    if (*p != 'p' && *p != 's') {
-      return false;
-    }
-    p++;
-    if (!pass_space()) {
-      return false;
-    }
-    // pgoff
-    pgoff = strtoull(p, &end, 16);
-    if (end == p) {
-      return false;
-    }
-    p = end;
-    if (!pass_space()) {
-      return false;
-    }
-    // major:minor
-    if (!pass_xdigit() || *p++ != ':' || !pass_xdigit() || !pass_space()) {
-      return false;
-    }
-    // inode
-    inode = strtoull(p, &end, 10);
-    if (end == p) {
-      return false;
-    }
-    p = end;
-
-    if (*p != '\0' && !pass_space()) {
-      return false;
-    }
-
-    // filename
-    callback(start_addr, end_addr, flags, pgoff, inode, p);
-  }
-  return true;
-}
-
-inline bool ReadMapFile(const std::string& map_file,
-                        const std::function<void(uint64_t, uint64_t, uint16_t, uint64_t, ino_t,
-                                                 const char*)>& callback) {
-  std::string content;
-  if (!android::base::ReadFileToString(map_file, &content)) {
-    return false;
-  }
-  return ReadMapFileContent(&content[0], callback);
-}
-
-inline bool ReadProcessMaps(pid_t pid,
-                            const std::function<void(uint64_t, uint64_t, uint16_t, uint64_t, ino_t,
-                                                     const char*)>& callback) {
-  return ReadMapFile("/proc/" + std::to_string(pid) + "/maps", callback);
-}
-
-struct MapInfo {
-  uint64_t start;
-  uint64_t end;
-  uint16_t flags;
-  uint64_t pgoff;
-  ino_t inode;
-  std::string name;
-
-  MapInfo(uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t inode,
-          const char* name)
-      : start(start), end(end), flags(flags), pgoff(pgoff), inode(inode), name(name) {}
-};
-
-inline bool ReadProcessMaps(pid_t pid, std::vector<MapInfo>* maps) {
-  return ReadProcessMaps(
-      pid, [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t inode,
-               const char* name) { maps->emplace_back(start, end, flags, pgoff, inode, name); });
-}
-
-bool ReadMapFileAsyncSafe(const char* map_file, void* buffer, size_t buffer_size,
-                          const std::function<void(uint64_t, uint64_t, uint16_t, uint64_t, ino_t,
-                                                   const char*)>& callback);
-
-} /* namespace procinfo */
-} /* namespace android */
diff --git a/libprocinfo/process.cpp b/libprocinfo/process.cpp
deleted file mode 100644
index 2efd49c..0000000
--- a/libprocinfo/process.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <procinfo/process.h>
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/unique_fd.h>
-
-using android::base::unique_fd;
-
-namespace android {
-namespace procinfo {
-
-bool GetProcessInfo(pid_t tid, ProcessInfo* process_info, std::string* error) {
-  char path[PATH_MAX];
-  snprintf(path, sizeof(path), "/proc/%d", tid);
-
-  unique_fd dirfd(open(path, O_DIRECTORY | O_RDONLY));
-  if (dirfd == -1) {
-    if (error != nullptr) {
-      *error = std::string("failed to open ") + path;
-    }
-    return false;
-  }
-
-  return GetProcessInfoFromProcPidFd(dirfd.get(), process_info, error);
-}
-
-static ProcessState parse_state(const char* state) {
-  switch (*state) {
-    case 'R':
-      return kProcessStateRunning;
-    case 'S':
-      return kProcessStateSleeping;
-    case 'D':
-      return kProcessStateUninterruptibleWait;
-    case 'T':
-      return kProcessStateStopped;
-    case 'Z':
-      return kProcessStateZombie;
-    default:
-      return kProcessStateUnknown;
-  }
-}
-
-bool GetProcessInfoFromProcPidFd(int fd, ProcessInfo* process_info, std::string* error) {
-  int status_fd = openat(fd, "status", O_RDONLY | O_CLOEXEC);
-
-  if (status_fd == -1) {
-    if (error != nullptr) {
-      *error = "failed to open status fd in GetProcessInfoFromProcPidFd";
-    }
-    return false;
-  }
-
-  std::unique_ptr<FILE, decltype(&fclose)> fp(fdopen(status_fd, "r"), fclose);
-  if (!fp) {
-    if (error != nullptr) {
-      *error = "failed to open status file in GetProcessInfoFromProcPidFd";
-    }
-    close(status_fd);
-    return false;
-  }
-
-  int field_bitmap = 0;
-  static constexpr int finished_bitmap = 255;
-  char* line = nullptr;
-  size_t len = 0;
-
-  while (getline(&line, &len, fp.get()) != -1 && field_bitmap != finished_bitmap) {
-    char* tab = strchr(line, '\t');
-    if (tab == nullptr) {
-      continue;
-    }
-
-    size_t header_len = tab - line;
-    std::string header = std::string(line, header_len);
-    if (header == "Name:") {
-      std::string name = line + header_len + 1;
-
-      // line includes the trailing newline.
-      name.pop_back();
-      process_info->name = std::move(name);
-
-      field_bitmap |= 1;
-    } else if (header == "Pid:") {
-      process_info->tid = atoi(tab + 1);
-      field_bitmap |= 2;
-    } else if (header == "Tgid:") {
-      process_info->pid = atoi(tab + 1);
-      field_bitmap |= 4;
-    } else if (header == "PPid:") {
-      process_info->ppid = atoi(tab + 1);
-      field_bitmap |= 8;
-    } else if (header == "TracerPid:") {
-      process_info->tracer = atoi(tab + 1);
-      field_bitmap |= 16;
-    } else if (header == "Uid:") {
-      process_info->uid = atoi(tab + 1);
-      field_bitmap |= 32;
-    } else if (header == "Gid:") {
-      process_info->gid = atoi(tab + 1);
-      field_bitmap |= 64;
-    } else if (header == "State:") {
-      process_info->state = parse_state(tab + 1);
-      field_bitmap |= 128;
-    }
-  }
-
-  free(line);
-  return field_bitmap == finished_bitmap;
-}
-
-} /* namespace procinfo */
-} /* namespace android */
diff --git a/libprocinfo/process_map.cpp b/libprocinfo/process_map.cpp
deleted file mode 100644
index 5e240b9..0000000
--- a/libprocinfo/process_map.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <procinfo/process_map.h>
-
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <procinfo/process.h>
-
-namespace android {
-namespace procinfo {
-
-bool ReadMapFileAsyncSafe(const char* map_file, void* buffer, size_t buffer_size,
-                          const std::function<void(uint64_t, uint64_t, uint16_t, uint64_t, ino_t,
-                                                   const char*)>& callback) {
-  if (buffer == nullptr || buffer_size == 0) {
-    return false;
-  }
-
-  int fd = open(map_file, O_RDONLY | O_CLOEXEC);
-  if (fd == -1) {
-    return false;
-  }
-
-  char* char_buffer = reinterpret_cast<char*>(buffer);
-  size_t start = 0;
-  size_t read_bytes = 0;
-  char* line = nullptr;
-  bool read_complete = false;
-  while (true) {
-    ssize_t bytes =
-        TEMP_FAILURE_RETRY(read(fd, char_buffer + read_bytes, buffer_size - read_bytes - 1));
-    if (bytes <= 0) {
-      if (read_bytes == 0) {
-        close(fd);
-        return bytes == 0;
-      }
-      // Treat the last piece of data as the last line.
-      char_buffer[start + read_bytes] = '\n';
-      bytes = 1;
-      read_complete = true;
-    }
-    read_bytes += bytes;
-
-    while (read_bytes > 0) {
-      char* newline = reinterpret_cast<char*>(memchr(&char_buffer[start], '\n', read_bytes));
-      if (newline == nullptr) {
-        break;
-      }
-      *newline = '\0';
-      line = &char_buffer[start];
-      start = newline - char_buffer + 1;
-      read_bytes -= newline - line + 1;
-
-      // Ignore the return code, errors are okay.
-      ReadMapFileContent(line, callback);
-    }
-
-    if (read_complete) {
-      close(fd);
-      return true;
-    }
-
-    if (start == 0 && read_bytes == buffer_size - 1) {
-      // The buffer provided is too small to contain this line, give up
-      // and indicate failure.
-      close(fd);
-      return false;
-    }
-
-    // Copy any leftover data to the front  of the buffer.
-    if (start > 0) {
-      if (read_bytes > 0) {
-        memmove(char_buffer, &char_buffer[start], read_bytes);
-      }
-      start = 0;
-    }
-  }
-}
-
-} /* namespace procinfo */
-} /* namespace android */
diff --git a/libprocinfo/process_map_benchmark.cpp b/libprocinfo/process_map_benchmark.cpp
deleted file mode 100644
index eba4fd0..0000000
--- a/libprocinfo/process_map_benchmark.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <procinfo/process_map.h>
-
-#include <string.h>
-#include <sys/types.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <backtrace/BacktraceMap.h>
-#include <unwindstack/Maps.h>
-
-#include <benchmark/benchmark.h>
-
-static void BM_ReadMapFile(benchmark::State& state) {
-  std::string map_file = android::base::GetExecutableDirectory() + "/testdata/maps";
-  for (auto _ : state) {
-    std::vector<android::procinfo::MapInfo> maps;
-    android::procinfo::ReadMapFile(map_file, [&](uint64_t start, uint64_t end, uint16_t flags,
-                                                 uint64_t pgoff, ino_t inode, const char* name) {
-      maps.emplace_back(start, end, flags, pgoff, inode, name);
-    });
-    CHECK_EQ(maps.size(), 2043u);
-  }
-}
-BENCHMARK(BM_ReadMapFile);
-
-static void BM_unwindstack_FileMaps(benchmark::State& state) {
-  std::string map_file = android::base::GetExecutableDirectory() + "/testdata/maps";
-  for (auto _ : state) {
-    unwindstack::FileMaps maps(map_file);
-    maps.Parse();
-    CHECK_EQ(maps.Total(), 2043u);
-  }
-}
-BENCHMARK(BM_unwindstack_FileMaps);
-
-static void BM_unwindstack_BufferMaps(benchmark::State& state) {
-  std::string map_file = android::base::GetExecutableDirectory() + "/testdata/maps";
-  std::string content;
-  CHECK(android::base::ReadFileToString(map_file, &content));
-  for (auto _ : state) {
-    unwindstack::BufferMaps maps(content.c_str());
-    maps.Parse();
-    CHECK_EQ(maps.Total(), 2043u);
-  }
-}
-BENCHMARK(BM_unwindstack_BufferMaps);
-
-static void BM_backtrace_BacktraceMap(benchmark::State& state) {
-  pid_t pid = getpid();
-  for (auto _ : state) {
-    BacktraceMap* map = BacktraceMap::Create(pid, true);
-    CHECK(map != nullptr);
-    delete map;
-  }
-}
-BENCHMARK(BM_backtrace_BacktraceMap);
-
-BENCHMARK_MAIN();
diff --git a/libprocinfo/process_map_test.cpp b/libprocinfo/process_map_test.cpp
deleted file mode 100644
index b1bdc08..0000000
--- a/libprocinfo/process_map_test.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <procinfo/process_map.h>
-
-#include <inttypes.h>
-#include <sys/mman.h>
-
-#include <string>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-
-#include <gtest/gtest.h>
-
-TEST(process_map, ReadMapFile) {
-  std::string map_file = android::base::GetExecutableDirectory() + "/testdata/maps";
-  std::vector<android::procinfo::MapInfo> maps;
-  ASSERT_TRUE(android::procinfo::ReadMapFile(
-      map_file,
-      [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t inode,
-          const char* name) { maps.emplace_back(start, end, flags, pgoff, inode, name); }));
-  ASSERT_EQ(2043u, maps.size());
-  ASSERT_EQ(maps[0].start, 0x12c00000ULL);
-  ASSERT_EQ(maps[0].end, 0x2ac00000ULL);
-  ASSERT_EQ(maps[0].flags, PROT_READ | PROT_WRITE);
-  ASSERT_EQ(maps[0].pgoff, 0ULL);
-  ASSERT_EQ(maps[0].inode, 10267643UL);
-  ASSERT_EQ(maps[0].name, "[anon:dalvik-main space (region space)]");
-  ASSERT_EQ(maps[876].start, 0x70e6c4f000ULL);
-  ASSERT_EQ(maps[876].end, 0x70e6c6b000ULL);
-  ASSERT_EQ(maps[876].flags, PROT_READ | PROT_EXEC);
-  ASSERT_EQ(maps[876].pgoff, 0ULL);
-  ASSERT_EQ(maps[876].inode, 2407UL);
-  ASSERT_EQ(maps[876].name, "/system/lib64/libutils.so");
-  ASSERT_EQ(maps[1260].start, 0x70e96fa000ULL);
-  ASSERT_EQ(maps[1260].end, 0x70e96fb000ULL);
-  ASSERT_EQ(maps[1260].flags, PROT_READ);
-  ASSERT_EQ(maps[1260].pgoff, 0ULL);
-  ASSERT_EQ(maps[1260].inode, 10266154UL);
-  ASSERT_EQ(maps[1260].name,
-            "[anon:dalvik-classes.dex extracted in memory from "
-            "/data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/base.apk]");
-}
-
-TEST(process_map, ReadProcessMaps) {
-  std::vector<android::procinfo::MapInfo> maps;
-  ASSERT_TRUE(android::procinfo::ReadProcessMaps(
-      getpid(),
-      [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t inode,
-          const char* name) { maps.emplace_back(start, end, flags, pgoff, inode, name); }));
-  ASSERT_GT(maps.size(), 0u);
-  maps.clear();
-  ASSERT_TRUE(android::procinfo::ReadProcessMaps(getpid(), &maps));
-  ASSERT_GT(maps.size(), 0u);
-}
-
-extern "C" void malloc_disable();
-extern "C" void malloc_enable();
-
-struct TestMapInfo {
-  TestMapInfo() = default;
-  TestMapInfo(uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t inode,
-              const char* new_name)
-      : start(start), end(end), flags(flags), pgoff(pgoff), inode(inode) {
-    strcpy(name, new_name);
-  }
-  uint64_t start = 0;
-  uint64_t end = 0;
-  uint16_t flags = 0;
-  uint64_t pgoff = 0;
-  ino_t inode = 0;
-  char name[100] = {};
-};
-
-void VerifyReadMapFileAsyncSafe(const char* maps_data,
-                                const std::vector<TestMapInfo>& expected_info) {
-  TemporaryFile tf;
-  ASSERT_TRUE(android::base::WriteStringToFd(maps_data, tf.fd));
-
-  std::vector<TestMapInfo> saved_info(expected_info.size());
-  size_t num_maps = 0;
-
-  auto callback = [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t inode,
-                      const char* name) {
-    if (num_maps != saved_info.size()) {
-      TestMapInfo& saved = saved_info[num_maps];
-      saved.start = start;
-      saved.end = end;
-      saved.flags = flags;
-      saved.pgoff = pgoff;
-      saved.inode = inode;
-      strcpy(saved.name, name);
-    }
-    num_maps++;
-  };
-
-  std::vector<char> buffer(64 * 1024);
-
-#if defined(__BIONIC__)
-  // Any allocations will block after this call.
-  malloc_disable();
-#endif
-
-  bool parsed =
-      android::procinfo::ReadMapFileAsyncSafe(tf.path, buffer.data(), buffer.size(), callback);
-
-#if defined(__BIONIC__)
-  malloc_enable();
-#endif
-
-  ASSERT_TRUE(parsed) << "Parsing of data failed:\n" << maps_data;
-  ASSERT_EQ(expected_info.size(), num_maps);
-  for (size_t i = 0; i < expected_info.size(); i++) {
-    const TestMapInfo& expected = expected_info[i];
-    const TestMapInfo& saved = saved_info[i];
-    EXPECT_EQ(expected.start, saved.start);
-    EXPECT_EQ(expected.end, saved.end);
-    EXPECT_EQ(expected.flags, saved.flags);
-    EXPECT_EQ(expected.pgoff, saved.pgoff);
-    EXPECT_EQ(expected.inode, saved.inode);
-    EXPECT_STREQ(expected.name, saved.name);
-  }
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_invalid) {
-  std::vector<TestMapInfo> expected_info;
-
-  VerifyReadMapFileAsyncSafe("12c00000-2ac00000", expected_info);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_single) {
-  std::vector<TestMapInfo> expected_info;
-  expected_info.emplace_back(0x12c00000, 0x2ac00000, PROT_READ | PROT_WRITE, 0x100, 10267643,
-                             "/lib/fake.so");
-
-  VerifyReadMapFileAsyncSafe("12c00000-2ac00000 rw-p 00000100 00:05 10267643 /lib/fake.so",
-                             expected_info);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_single_with_newline) {
-  std::vector<TestMapInfo> expected_info;
-  expected_info.emplace_back(0x12c00000, 0x2ac00000, PROT_READ | PROT_WRITE, 0x100, 10267643,
-                             "/lib/fake.so");
-
-  VerifyReadMapFileAsyncSafe("12c00000-2ac00000 rw-p 00000100 00:05 10267643 /lib/fake.so\n",
-                             expected_info);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_single_no_library) {
-  std::vector<TestMapInfo> expected_info;
-  expected_info.emplace_back(0xa0000, 0xc0000, PROT_READ | PROT_WRITE | PROT_EXEC, 0xb00, 101, "");
-
-  VerifyReadMapFileAsyncSafe("a0000-c0000 rwxp 00000b00 00:05 101", expected_info);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_multiple) {
-  std::vector<TestMapInfo> expected_info;
-  expected_info.emplace_back(0xa0000, 0xc0000, PROT_READ | PROT_WRITE | PROT_EXEC, 1, 100, "");
-  expected_info.emplace_back(0xd0000, 0xe0000, PROT_READ, 2, 101, "/lib/libsomething1.so");
-  expected_info.emplace_back(0xf0000, 0x100000, PROT_WRITE, 3, 102, "/lib/libsomething2.so");
-  expected_info.emplace_back(0x110000, 0x120000, PROT_EXEC, 4, 103, "[anon:something or another]");
-
-  std::string map_data =
-      "0a0000-0c0000 rwxp 00000001 00:05 100\n"
-      "0d0000-0e0000 r--p 00000002 00:05 101  /lib/libsomething1.so\n"
-      "0f0000-100000 -w-p 00000003 00:05 102  /lib/libsomething2.so\n"
-      "110000-120000 --xp 00000004 00:05 103  [anon:something or another]\n";
-
-  VerifyReadMapFileAsyncSafe(map_data.c_str(), expected_info);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_multiple_reads) {
-  std::vector<TestMapInfo> expected_info;
-  std::string map_data;
-  uint64_t start = 0xa0000;
-  for (size_t i = 0; i < 10000; i++) {
-    map_data += android::base::StringPrintf("%" PRIx64 "-%" PRIx64 " r--p %zx 01:20 %zu fake.so\n",
-                                            start, start + 0x1000, i, 1000 + i);
-    expected_info.emplace_back(start, start + 0x1000, PROT_READ, i, 1000 + i, "fake.so");
-  }
-
-  VerifyReadMapFileAsyncSafe(map_data.c_str(), expected_info);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_buffer_nullptr) {
-  size_t num_calls = 0;
-  auto callback = [&](uint64_t, uint64_t, uint16_t, uint64_t, ino_t, const char*) { num_calls++; };
-
-#if defined(__BIONIC__)
-  // Any allocations will block after this call.
-  malloc_disable();
-#endif
-
-  bool parsed = android::procinfo::ReadMapFileAsyncSafe("/proc/self/maps", nullptr, 10, callback);
-
-#if defined(__BIONIC__)
-  malloc_enable();
-#endif
-
-  ASSERT_FALSE(parsed);
-  EXPECT_EQ(0UL, num_calls);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_buffer_size_zero) {
-  size_t num_calls = 0;
-  auto callback = [&](uint64_t, uint64_t, uint16_t, uint64_t, ino_t, const char*) { num_calls++; };
-
-#if defined(__BIONIC__)
-  // Any allocations will block after this call.
-  malloc_disable();
-#endif
-
-  char buffer[10];
-  bool parsed = android::procinfo::ReadMapFileAsyncSafe("/proc/self/maps", buffer, 0, callback);
-
-#if defined(__BIONIC__)
-  malloc_enable();
-#endif
-
-  ASSERT_FALSE(parsed);
-  EXPECT_EQ(0UL, num_calls);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_buffer_too_small_no_calls) {
-  size_t num_calls = 0;
-  auto callback = [&](uint64_t, uint64_t, uint16_t, uint64_t, ino_t, const char*) { num_calls++; };
-
-#if defined(__BIONIC__)
-  // Any allocations will block after this call.
-  malloc_disable();
-#endif
-
-  char buffer[10];
-  bool parsed =
-      android::procinfo::ReadMapFileAsyncSafe("/proc/self/maps", buffer, sizeof(buffer), callback);
-
-#if defined(__BIONIC__)
-  malloc_enable();
-#endif
-
-  ASSERT_FALSE(parsed);
-  EXPECT_EQ(0UL, num_calls);
-}
-
-TEST(process_map, ReadMapFileAsyncSafe_buffer_too_small_could_parse) {
-  TemporaryFile tf;
-  ASSERT_TRUE(android::base::WriteStringToFd(
-      "0a0000-0c0000 rwxp 00000001 00:05 100    /fake/lib.so\n", tf.fd));
-
-  size_t num_calls = 0;
-  auto callback = [&](uint64_t, uint64_t, uint16_t, uint64_t, ino_t, const char*) { num_calls++; };
-
-#if defined(__BIONIC__)
-  // Any allocations will block after this call.
-  malloc_disable();
-#endif
-
-  char buffer[39];
-  bool parsed = android::procinfo::ReadMapFileAsyncSafe(tf.path, buffer, sizeof(buffer), callback);
-
-#if defined(__BIONIC__)
-  malloc_enable();
-#endif
-
-  ASSERT_FALSE(parsed);
-  EXPECT_EQ(0UL, num_calls);
-}
diff --git a/libprocinfo/process_test.cpp b/libprocinfo/process_test.cpp
deleted file mode 100644
index 9da9278..0000000
--- a/libprocinfo/process_test.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <procinfo/process.h>
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <set>
-#include <thread>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <android-base/stringprintf.h>
-
-using namespace std::chrono_literals;
-
-#if !defined(__BIONIC__)
-#include <syscall.h>
-static pid_t gettid() {
-  return syscall(__NR_gettid);
-}
-#endif
-
-TEST(process_info, process_info_smoke) {
-  android::procinfo::ProcessInfo self;
-  ASSERT_TRUE(android::procinfo::GetProcessInfo(gettid(), &self));
-  ASSERT_EQ(gettid(), self.tid);
-  ASSERT_EQ(getpid(), self.pid);
-  ASSERT_EQ(getppid(), self.ppid);
-  ASSERT_EQ(getuid(), self.uid);
-  ASSERT_EQ(getgid(), self.gid);
-}
-
-TEST(process_info, process_info_proc_pid_fd_smoke) {
-  android::procinfo::ProcessInfo self;
-  int fd = open(android::base::StringPrintf("/proc/%d", gettid()).c_str(), O_DIRECTORY | O_RDONLY);
-  ASSERT_NE(-1, fd);
-  ASSERT_TRUE(android::procinfo::GetProcessInfoFromProcPidFd(fd, &self));
-
-  // Process name is capped at 15 bytes.
-  ASSERT_EQ("libprocinfo_tes", self.name);
-  ASSERT_EQ(gettid(), self.tid);
-  ASSERT_EQ(getpid(), self.pid);
-  ASSERT_EQ(getppid(), self.ppid);
-  ASSERT_EQ(getuid(), self.uid);
-  ASSERT_EQ(getgid(), self.gid);
-  close(fd);
-}
-
-TEST(process_info, process_tids_smoke) {
-  pid_t main_tid = gettid();
-  std::thread([main_tid]() {
-    pid_t thread_tid = gettid();
-
-    {
-      std::vector<pid_t> vec;
-      ASSERT_TRUE(android::procinfo::GetProcessTids(getpid(), &vec));
-      ASSERT_EQ(1, std::count(vec.begin(), vec.end(), main_tid));
-      ASSERT_EQ(1, std::count(vec.begin(), vec.end(), thread_tid));
-    }
-
-    {
-      std::set<pid_t> set;
-      ASSERT_TRUE(android::procinfo::GetProcessTids(getpid(), &set));
-      ASSERT_EQ(1, std::count(set.begin(), set.end(), main_tid));
-      ASSERT_EQ(1, std::count(set.begin(), set.end(), thread_tid));
-    }
-  }).join();
-}
-
-TEST(process_info, process_state) {
-  int pipefd[2];
-  ASSERT_EQ(0, pipe2(pipefd, O_CLOEXEC));
-  pid_t forkpid = fork();
-
-  ASSERT_NE(-1, forkpid);
-  if (forkpid == 0) {
-    close(pipefd[1]);
-    char buf;
-    TEMP_FAILURE_RETRY(read(pipefd[0], &buf, 1));
-    _exit(0);
-  }
-
-  // Give the child some time to get to the read.
-  std::this_thread::sleep_for(100ms);
-
-  android::procinfo::ProcessInfo procinfo;
-  ASSERT_TRUE(android::procinfo::GetProcessInfo(forkpid, &procinfo));
-  ASSERT_EQ(android::procinfo::kProcessStateSleeping, procinfo.state);
-
-  ASSERT_EQ(0, kill(forkpid, SIGKILL));
-
-  // Give the kernel some time to kill the child.
-  std::this_thread::sleep_for(100ms);
-
-  ASSERT_TRUE(android::procinfo::GetProcessInfo(forkpid, &procinfo));
-  ASSERT_EQ(android::procinfo::kProcessStateZombie, procinfo.state);
-
-  ASSERT_EQ(forkpid, waitpid(forkpid, nullptr, 0));
-}
diff --git a/libprocinfo/testdata/maps b/libprocinfo/testdata/maps
deleted file mode 100644
index 098cf25..0000000
--- a/libprocinfo/testdata/maps
+++ /dev/null
@@ -1,2043 +0,0 @@
-12c00000-2ac00000 rw-p 00000000 00:05 10267643                           [anon:dalvik-main space (region space)]
-6fb5d000-6fd6e000 rw-p 00000000 103:1d 639511                            /data/dalvik-cache/arm64/system@framework@boot.art
-6fd6e000-6fd82000 r--p 00211000 103:1d 639511                            /data/dalvik-cache/arm64/system@framework@boot.art
-6fd82000-6fe47000 rw-p 00000000 103:1d 639514                            /data/dalvik-cache/arm64/system@framework@boot-core-libart.art
-6fe47000-6fe52000 r--p 000c5000 103:1d 639514                            /data/dalvik-cache/arm64/system@framework@boot-core-libart.art
-6fe52000-6fe84000 rw-p 00000000 103:1d 639517                            /data/dalvik-cache/arm64/system@framework@boot-conscrypt.art
-6fe84000-6fe87000 r--p 00032000 103:1d 639517                            /data/dalvik-cache/arm64/system@framework@boot-conscrypt.art
-6fe87000-6feb2000 rw-p 00000000 103:1d 639520                            /data/dalvik-cache/arm64/system@framework@boot-okhttp.art
-6feb2000-6feb5000 r--p 0002b000 103:1d 639520                            /data/dalvik-cache/arm64/system@framework@boot-okhttp.art
-6feb5000-6fef4000 rw-p 00000000 103:1d 639523                            /data/dalvik-cache/arm64/system@framework@boot-bouncycastle.art
-6fef4000-6fefb000 r--p 0003f000 103:1d 639523                            /data/dalvik-cache/arm64/system@framework@boot-bouncycastle.art
-6fefb000-6ff3f000 rw-p 00000000 103:1d 639526                            /data/dalvik-cache/arm64/system@framework@boot-apache-xml.art
-6ff3f000-6ff45000 r--p 00044000 103:1d 639526                            /data/dalvik-cache/arm64/system@framework@boot-apache-xml.art
-6ff45000-6ff7a000 rw-p 00000000 103:1d 639529                            /data/dalvik-cache/arm64/system@framework@boot-ext.art
-6ff7a000-6ff85000 r--p 00035000 103:1d 639529                            /data/dalvik-cache/arm64/system@framework@boot-ext.art
-6ff85000-70594000 rw-p 00000000 103:1d 639532                            /data/dalvik-cache/arm64/system@framework@boot-framework.art
-70594000-705cb000 r--p 0060f000 103:1d 639532                            /data/dalvik-cache/arm64/system@framework@boot-framework.art
-705cb000-7061f000 rw-p 00000000 103:1d 639535                            /data/dalvik-cache/arm64/system@framework@boot-telephony-common.art
-7061f000-70629000 r--p 00054000 103:1d 639535                            /data/dalvik-cache/arm64/system@framework@boot-telephony-common.art
-70629000-70635000 rw-p 00000000 103:1d 639538                            /data/dalvik-cache/arm64/system@framework@boot-voip-common.art
-70635000-70636000 r--p 0000c000 103:1d 639538                            /data/dalvik-cache/arm64/system@framework@boot-voip-common.art
-70636000-70644000 rw-p 00000000 103:1d 639541                            /data/dalvik-cache/arm64/system@framework@boot-ims-common.art
-70644000-70645000 r--p 0000e000 103:1d 639541                            /data/dalvik-cache/arm64/system@framework@boot-ims-common.art
-70645000-70648000 rw-p 00000000 103:1d 639544                            /data/dalvik-cache/arm64/system@framework@boot-android.hidl.base-V1.0-java.art
-70648000-7064c000 rw-p 00000000 103:1d 639547                            /data/dalvik-cache/arm64/system@framework@boot-android.hidl.manager-V1.0-java.art
-7064c000-7064d000 r--p 00004000 103:1d 639547                            /data/dalvik-cache/arm64/system@framework@boot-android.hidl.manager-V1.0-java.art
-7064d000-7064e000 rw-p 00000000 103:1d 639550                            /data/dalvik-cache/arm64/system@framework@boot-framework-oahl-backward-compatibility.art
-7064e000-70652000 rw-p 00000000 103:1d 639553                            /data/dalvik-cache/arm64/system@framework@boot-android.test.base.art
-70652000-70653000 r--p 00004000 103:1d 639553                            /data/dalvik-cache/arm64/system@framework@boot-android.test.base.art
-70653000-70654000 rw-p 00000000 103:1d 639556                            /data/dalvik-cache/arm64/system@framework@boot-com.google.vr.platform.art
-70654000-70655000 r--p 00001000 103:1d 639556                            /data/dalvik-cache/arm64/system@framework@boot-com.google.vr.platform.art
-70655000-70731000 r--p 00000000 fc:00 940                                /system/framework/arm64/boot.oat
-70731000-709ca000 r-xp 000dc000 fc:00 940                                /system/framework/arm64/boot.oat
-709ca000-709cb000 rw-p 00000000 00:00 0                                  [anon:.bss]
-709cb000-70e4c000 r--s 00000000 fc:00 961                                /system/framework/boot.vdex
-70e4c000-70e4d000 r--p 00375000 fc:00 940                                /system/framework/arm64/boot.oat
-70e4d000-70e4e000 rw-p 00376000 fc:00 940                                /system/framework/arm64/boot.oat
-70e4e000-70eab000 r--p 00000000 fc:00 916                                /system/framework/arm64/boot-core-libart.oat
-70eab000-70fad000 r-xp 0005d000 fc:00 916                                /system/framework/arm64/boot-core-libart.oat
-70fad000-70fae000 rw-p 00000000 00:00 0                                  [anon:.bss]
-70fae000-712a9000 r--s 00000000 fc:00 702                                /system/framework/boot-core-libart.vdex
-712a9000-712aa000 r--p 0015f000 fc:00 916                                /system/framework/arm64/boot-core-libart.oat
-712aa000-712ab000 rw-p 00160000 fc:00 916                                /system/framework/arm64/boot-core-libart.oat
-712ab000-712bb000 r--p 00000000 fc:00 941                                /system/framework/arm64/boot-conscrypt.oat
-712bb000-712e4000 r-xp 00010000 fc:00 941                                /system/framework/arm64/boot-conscrypt.oat
-712e4000-712e5000 rw-p 00000000 00:00 0                                  [anon:.bss]
-712e5000-71346000 r--s 00000000 fc:00 970                                /system/framework/boot-conscrypt.vdex
-71346000-71347000 r--p 00039000 fc:00 941                                /system/framework/arm64/boot-conscrypt.oat
-71347000-71348000 rw-p 0003a000 fc:00 941                                /system/framework/arm64/boot-conscrypt.oat
-71348000-71361000 r--p 00000000 fc:00 908                                /system/framework/arm64/boot-okhttp.oat
-71361000-713a3000 r-xp 00019000 fc:00 908                                /system/framework/arm64/boot-okhttp.oat
-713a3000-713a4000 rw-p 00000000 00:00 0                                  [anon:.bss]
-713a4000-71403000 r--s 00000000 fc:00 886                                /system/framework/boot-okhttp.vdex
-71403000-71404000 r--p 0005b000 fc:00 908                                /system/framework/arm64/boot-okhttp.oat
-71404000-71405000 rw-p 0005c000 fc:00 908                                /system/framework/arm64/boot-okhttp.oat
-71405000-71415000 r--p 00000000 fc:00 936                                /system/framework/arm64/boot-bouncycastle.oat
-71415000-71437000 r-xp 00010000 fc:00 936                                /system/framework/arm64/boot-bouncycastle.oat
-71437000-71438000 rw-p 00000000 00:00 0                                  [anon:.bss]
-71438000-7157b000 r--s 00000000 fc:00 1006                               /system/framework/boot-bouncycastle.vdex
-7157b000-7157c000 r--p 00032000 fc:00 936                                /system/framework/arm64/boot-bouncycastle.oat
-7157c000-7157d000 rw-p 00033000 fc:00 936                                /system/framework/arm64/boot-bouncycastle.oat
-7157d000-71583000 r--p 00000000 fc:00 932                                /system/framework/arm64/boot-apache-xml.oat
-71583000-71584000 r-xp 00006000 fc:00 932                                /system/framework/arm64/boot-apache-xml.oat
-71584000-716a7000 r--s 00000000 fc:00 883                                /system/framework/boot-apache-xml.vdex
-716a7000-716a8000 r--p 00007000 fc:00 932                                /system/framework/arm64/boot-apache-xml.oat
-716a8000-716a9000 rw-p 00008000 fc:00 932                                /system/framework/arm64/boot-apache-xml.oat
-716a9000-716b5000 r--p 00000000 fc:00 891                                /system/framework/arm64/boot-ext.oat
-716b5000-716cc000 r-xp 0000c000 fc:00 891                                /system/framework/arm64/boot-ext.oat
-716cc000-716cd000 rw-p 00000000 00:00 0                                  [anon:.bss]
-716cd000-717b8000 r--s 00000000 fc:00 879                                /system/framework/boot-ext.vdex
-717b8000-717b9000 r--p 00023000 fc:00 891                                /system/framework/arm64/boot-ext.oat
-717b9000-717ba000 rw-p 00024000 fc:00 891                                /system/framework/arm64/boot-ext.oat
-717ba000-71aeb000 r--p 00000000 fc:00 943                                /system/framework/arm64/boot-framework.oat
-71aeb000-72390000 r-xp 00331000 fc:00 943                                /system/framework/arm64/boot-framework.oat
-72390000-72396000 rw-p 00000000 00:00 0                                  [anon:.bss]
-72396000-73746000 r--s 00000000 fc:00 985                                /system/framework/boot-framework.vdex
-73746000-73747000 r--p 00bd6000 fc:00 943                                /system/framework/arm64/boot-framework.oat
-73747000-73748000 rw-p 00bd7000 fc:00 943                                /system/framework/arm64/boot-framework.oat
-73748000-73780000 r--p 00000000 fc:00 893                                /system/framework/arm64/boot-telephony-common.oat
-73780000-73818000 r-xp 00038000 fc:00 893                                /system/framework/arm64/boot-telephony-common.oat
-73818000-7381a000 rw-p 00000000 00:00 0                                  [anon:.bss]
-7381a000-73af0000 r--s 00000000 fc:00 697                                /system/framework/boot-telephony-common.vdex
-73af0000-73af1000 r--p 000d0000 fc:00 893                                /system/framework/arm64/boot-telephony-common.oat
-73af1000-73af2000 rw-p 000d1000 fc:00 893                                /system/framework/arm64/boot-telephony-common.oat
-73af2000-73af6000 r--p 00000000 fc:00 922                                /system/framework/arm64/boot-voip-common.oat
-73af6000-73af8000 r-xp 00004000 fc:00 922                                /system/framework/arm64/boot-voip-common.oat
-73af8000-73af9000 rw-p 00000000 00:00 0                                  [anon:.bss]
-73af9000-73b1e000 r--s 00000000 fc:00 959                                /system/framework/boot-voip-common.vdex
-73b1e000-73b1f000 r--p 00006000 fc:00 922                                /system/framework/arm64/boot-voip-common.oat
-73b1f000-73b20000 rw-p 00007000 fc:00 922                                /system/framework/arm64/boot-voip-common.oat
-73b20000-73b23000 r--p 00000000 fc:00 918                                /system/framework/arm64/boot-ims-common.oat
-73b23000-73b25000 r-xp 00003000 fc:00 918                                /system/framework/arm64/boot-ims-common.oat
-73b25000-73b26000 rw-p 00000000 00:00 0                                  [anon:.bss]
-73b26000-73b48000 r--s 00000000 fc:00 957                                /system/framework/boot-ims-common.vdex
-73b48000-73b49000 r--p 00005000 fc:00 918                                /system/framework/arm64/boot-ims-common.oat
-73b49000-73b4a000 rw-p 00006000 fc:00 918                                /system/framework/arm64/boot-ims-common.oat
-73b4a000-73b4d000 r--p 00000000 fc:00 909                                /system/framework/arm64/boot-android.hidl.base-V1.0-java.oat
-73b4d000-73b4e000 r-xp 00003000 fc:00 909                                /system/framework/arm64/boot-android.hidl.base-V1.0-java.oat
-73b4e000-73b55000 r--s 00000000 fc:00 972                                /system/framework/boot-android.hidl.base-V1.0-java.vdex
-73b55000-73b56000 r--p 00004000 fc:00 909                                /system/framework/arm64/boot-android.hidl.base-V1.0-java.oat
-73b56000-73b57000 rw-p 00005000 fc:00 909                                /system/framework/arm64/boot-android.hidl.base-V1.0-java.oat
-73b57000-73b5a000 r--p 00000000 fc:00 954                                /system/framework/arm64/boot-android.hidl.manager-V1.0-java.oat
-73b5a000-73b5c000 r-xp 00003000 fc:00 954                                /system/framework/arm64/boot-android.hidl.manager-V1.0-java.oat
-73b5c000-73b5d000 rw-p 00000000 00:00 0                                  [anon:.bss]
-73b5d000-73b68000 r--s 00000000 fc:00 704                                /system/framework/boot-android.hidl.manager-V1.0-java.vdex
-73b68000-73b69000 r--p 00005000 fc:00 954                                /system/framework/arm64/boot-android.hidl.manager-V1.0-java.oat
-73b69000-73b6a000 rw-p 00006000 fc:00 954                                /system/framework/arm64/boot-android.hidl.manager-V1.0-java.oat
-73b6a000-73b6d000 r--p 00000000 fc:00 904                                /system/framework/arm64/boot-framework-oahl-backward-compatibility.oat
-73b6d000-73b6e000 r-xp 00003000 fc:00 904                                /system/framework/arm64/boot-framework-oahl-backward-compatibility.oat
-73b6e000-73b6f000 r--s 00000000 fc:00 994                                /system/framework/boot-framework-oahl-backward-compatibility.vdex
-73b6f000-73b70000 r--p 00004000 fc:00 904                                /system/framework/arm64/boot-framework-oahl-backward-compatibility.oat
-73b70000-73b71000 rw-p 00005000 fc:00 904                                /system/framework/arm64/boot-framework-oahl-backward-compatibility.oat
-73b71000-73b75000 r--p 00000000 fc:00 896                                /system/framework/arm64/boot-android.test.base.oat
-73b75000-73b79000 r-xp 00004000 fc:00 896                                /system/framework/arm64/boot-android.test.base.oat
-73b79000-73b7a000 rw-p 00000000 00:00 0                                  [anon:.bss]
-73b7a000-73b82000 r--s 00000000 fc:00 706                                /system/framework/boot-android.test.base.vdex
-73b82000-73b83000 r--p 00008000 fc:00 896                                /system/framework/arm64/boot-android.test.base.oat
-73b83000-73b84000 rw-p 00009000 fc:00 896                                /system/framework/arm64/boot-android.test.base.oat
-73b84000-73b87000 r--p 00000000 fc:00 899                                /system/framework/arm64/boot-com.google.vr.platform.oat
-73b87000-73b88000 r-xp 00003000 fc:00 899                                /system/framework/arm64/boot-com.google.vr.platform.oat
-73b88000-73b89000 r--s 00000000 fc:00 884                                /system/framework/boot-com.google.vr.platform.vdex
-73b89000-73b8a000 r--p 00004000 fc:00 899                                /system/framework/arm64/boot-com.google.vr.platform.oat
-73b8a000-73b8b000 rw-p 00005000 fc:00 899                                /system/framework/arm64/boot-com.google.vr.platform.oat
-73b8b000-73b93000 rw-p 00000000 00:05 10267640                           [anon:dalvik-non moving space]
-73b93000-77b8b000 ---p 00008000 00:05 10267640                           [anon:dalvik-non moving space]
-77b8b000-97b8b000 rw-p 00000000 00:05 10267645                           [anon:dalvik-free list large object space]
-97b8b000-99b8b000 rw-p 00000000 00:05 10270989                           [anon:dalvik-data-code-cache]
-99b8b000-9bb8b000 r-xp 00000000 00:05 10270990                           [anon:dalvik-jit-code-cache]
-ebad6000-ebad7000 ---p 00000000 00:05 10269717                           [anon:dalvik-Sentinel fault page]
-7ffb6e000-7ffb76000 rw-s 000e5000 00:10 20630                            /dev/kgsl-3d0
-7ffb76000-7ffb78000 rw-s 000e0000 00:10 20630                            /dev/kgsl-3d0
-7ffbc3000-7ffbc4000 rw-s 000e8000 00:10 20630                            /dev/kgsl-3d0
-7ffbc4000-7ffbc5000 rw-s 000e7000 00:10 20630                            /dev/kgsl-3d0
-7ffbc6000-7ffbce000 rw-s 000e4000 00:10 20630                            /dev/kgsl-3d0
-7ffbd0000-7ffbd2000 rw-s 000df000 00:10 20630                            /dev/kgsl-3d0
-7ffbd2000-7ffbd4000 rw-s 000de000 00:10 20630                            /dev/kgsl-3d0
-7ffbd4000-7ffbd6000 rw-s 000dd000 00:10 20630                            /dev/kgsl-3d0
-7ffbd6000-7ffbd8000 rw-s 000dc000 00:10 20630                            /dev/kgsl-3d0
-7ffbd8000-7ffbda000 rw-s 000db000 00:10 20630                            /dev/kgsl-3d0
-7ffbda000-7ffbdc000 rw-s 000da000 00:10 20630                            /dev/kgsl-3d0
-7ffbdd000-7ffbde000 rw-s 000ec000 00:10 20630                            /dev/kgsl-3d0
-7ffbde000-7ffbe0000 rw-s 000d8000 00:10 20630                            /dev/kgsl-3d0
-7ffce1000-7ffce2000 rw-s 000e6000 00:10 20630                            /dev/kgsl-3d0
-7ffce2000-7ffce4000 rw-s 000d9000 00:10 20630                            /dev/kgsl-3d0
-7ffce4000-7ffce8000 rw-s 000d4000 00:10 20630                            /dev/kgsl-3d0
-7ffce8000-7ffcf8000 rw-s 000d2000 00:10 20630                            /dev/kgsl-3d0
-7ffcf8000-7ffd08000 rw-s 000d1000 00:10 20630                            /dev/kgsl-3d0
-7ffd08000-7ffd10000 rw-s 000d0000 00:10 20630                            /dev/kgsl-3d0
-7ffd14000-7ffd18000 rw-s 000cd000 00:10 20630                            /dev/kgsl-3d0
-7ffd18000-7ffd28000 rw-s 000cc000 00:10 20630                            /dev/kgsl-3d0
-7ffd28000-7ffd38000 rw-s 000cb000 00:10 20630                            /dev/kgsl-3d0
-7ffd38000-7ffd48000 rw-s 000ca000 00:10 20630                            /dev/kgsl-3d0
-7ffd48000-7ffd58000 rw-s 000c9000 00:10 20630                            /dev/kgsl-3d0
-7ffd58000-7ffd68000 rw-s 000c8000 00:10 20630                            /dev/kgsl-3d0
-7ffd68000-7ffd6c000 rw-s 000c7000 00:10 20630                            /dev/kgsl-3d0
-7ffdb1000-7ffdb2000 rw-s 000e3000 00:10 20630                            /dev/kgsl-3d0
-7ffdb4000-7ffdb5000 rw-s 000e2000 00:10 20630                            /dev/kgsl-3d0
-7ffdb5000-7ffdb7000 rw-s 000d7000 00:10 20630                            /dev/kgsl-3d0
-7ffdb7000-7ffdb8000 rw-s 000c2000 00:10 20630                            /dev/kgsl-3d0
-7ffdb8000-7ffdbc000 rw-s 000c0000 00:10 20630                            /dev/kgsl-3d0
-7ffdbc000-7ffdc0000 rw-s 000be000 00:10 20630                            /dev/kgsl-3d0
-7ffdc0000-7ffe00000 rw-s 000bb000 00:10 20630                            /dev/kgsl-3d0
-7ffe00000-7ffe20000 rw-s 000ba000 00:10 20630                            /dev/kgsl-3d0
-7ffe20000-7ffee0000 rw-s 000b9000 00:10 20630                            /dev/kgsl-3d0
-7ffee1000-7ffee3000 rw-s 000c1000 00:10 20630                            /dev/kgsl-3d0
-7ffee3000-7ffee4000 rw-s 000bf000 00:10 20630                            /dev/kgsl-3d0
-7ffee4000-7ffee8000 rw-s 000bd000 00:10 20630                            /dev/kgsl-3d0
-7ffee8000-7ffee9000 rw-s 000bc000 00:10 20630                            /dev/kgsl-3d0
-7ffeea000-7ffeeb000 rw-s 000e1000 00:10 20630                            /dev/kgsl-3d0
-7ffeeb000-7ffeec000 rw-s 000b6000 00:10 20630                            /dev/kgsl-3d0
-7ffeec000-7ffeed000 rw-s 000b5000 00:10 20630                            /dev/kgsl-3d0
-7ffeed000-7ffeee000 rw-s 000b4000 00:10 20630                            /dev/kgsl-3d0
-7ffeee000-7ffeef000 rw-s 000b3000 00:10 20630                            /dev/kgsl-3d0
-7ffeef000-7ffef0000 rw-s 000b2000 00:10 20630                            /dev/kgsl-3d0
-7ffef0000-7ffef1000 rw-s 000b1000 00:10 20630                            /dev/kgsl-3d0
-7ffef1000-7ffef2000 rw-s 000b0000 00:10 20630                            /dev/kgsl-3d0
-7ffef2000-7ffef3000 rw-s 000af000 00:10 20630                            /dev/kgsl-3d0
-7ffef3000-7ffef4000 rw-s 000ae000 00:10 20630                            /dev/kgsl-3d0
-7ffef4000-7ffef5000 rw-s 000ad000 00:10 20630                            /dev/kgsl-3d0
-7ffef5000-7ffef6000 rw-s 000ac000 00:10 20630                            /dev/kgsl-3d0
-7ffef6000-7ffef7000 rw-s 000ab000 00:10 20630                            /dev/kgsl-3d0
-7ffef7000-7ffef8000 rw-s 000aa000 00:10 20630                            /dev/kgsl-3d0
-7ffef8000-7ffef9000 rw-s 000a9000 00:10 20630                            /dev/kgsl-3d0
-7ffef9000-7ffefa000 rw-s 000a8000 00:10 20630                            /dev/kgsl-3d0
-7ffefa000-7ffefb000 rw-s 000a7000 00:10 20630                            /dev/kgsl-3d0
-7ffefb000-7ffefc000 rw-s 000a6000 00:10 20630                            /dev/kgsl-3d0
-7ffefc000-7ffefd000 rw-s 000a5000 00:10 20630                            /dev/kgsl-3d0
-7ffefd000-7ffefe000 rw-s 000a4000 00:10 20630                            /dev/kgsl-3d0
-7ffefe000-7ffeff000 rw-s 000a3000 00:10 20630                            /dev/kgsl-3d0
-7ffeff000-7fff00000 rw-s 000a2000 00:10 20630                            /dev/kgsl-3d0
-7fff00000-7fff01000 rw-s 000a1000 00:10 20630                            /dev/kgsl-3d0
-7fff01000-7fff02000 rw-s 000a0000 00:10 20630                            /dev/kgsl-3d0
-7fff02000-7fff03000 rw-s 0009f000 00:10 20630                            /dev/kgsl-3d0
-7fff03000-7fff04000 rw-s 0009e000 00:10 20630                            /dev/kgsl-3d0
-7fff04000-7fff05000 rw-s 0009d000 00:10 20630                            /dev/kgsl-3d0
-7fff05000-7fff06000 rw-s 0009c000 00:10 20630                            /dev/kgsl-3d0
-7fff06000-7fff07000 rw-s 0009b000 00:10 20630                            /dev/kgsl-3d0
-7fff07000-7fff08000 rw-s 0009a000 00:10 20630                            /dev/kgsl-3d0
-7fff08000-7fff09000 rw-s 00099000 00:10 20630                            /dev/kgsl-3d0
-7fff09000-7fff0a000 rw-s 00098000 00:10 20630                            /dev/kgsl-3d0
-7fff0a000-7fff0b000 rw-s 00097000 00:10 20630                            /dev/kgsl-3d0
-7fff0b000-7fff0c000 rw-s 00096000 00:10 20630                            /dev/kgsl-3d0
-7fff0c000-7fff0d000 rw-s 00095000 00:10 20630                            /dev/kgsl-3d0
-7fff0d000-7fff0e000 rw-s 00094000 00:10 20630                            /dev/kgsl-3d0
-7fff0e000-7fff0f000 rw-s 00093000 00:10 20630                            /dev/kgsl-3d0
-7fff0f000-7fff10000 rw-s 00092000 00:10 20630                            /dev/kgsl-3d0
-7fff10000-7fff11000 rw-s 00091000 00:10 20630                            /dev/kgsl-3d0
-7fff11000-7fff12000 rw-s 00090000 00:10 20630                            /dev/kgsl-3d0
-7fff12000-7fff13000 rw-s 0008f000 00:10 20630                            /dev/kgsl-3d0
-7fff13000-7fff14000 rw-s 0008e000 00:10 20630                            /dev/kgsl-3d0
-7fff14000-7fff15000 rw-s 0008d000 00:10 20630                            /dev/kgsl-3d0
-7fff15000-7fff16000 rw-s 0008c000 00:10 20630                            /dev/kgsl-3d0
-7fff16000-7fff17000 rw-s 0008b000 00:10 20630                            /dev/kgsl-3d0
-7fff17000-7fff18000 rw-s 0008a000 00:10 20630                            /dev/kgsl-3d0
-7fff18000-7fff19000 rw-s 00089000 00:10 20630                            /dev/kgsl-3d0
-7fff19000-7fff1a000 rw-s 00088000 00:10 20630                            /dev/kgsl-3d0
-7fff1a000-7fff1b000 rw-s 00087000 00:10 20630                            /dev/kgsl-3d0
-7fff1b000-7fff1c000 rw-s 00086000 00:10 20630                            /dev/kgsl-3d0
-7fff1c000-7fff1d000 rw-s 00085000 00:10 20630                            /dev/kgsl-3d0
-7fff1d000-7fff1e000 rw-s 00084000 00:10 20630                            /dev/kgsl-3d0
-7fff1e000-7fff1f000 rw-s 00083000 00:10 20630                            /dev/kgsl-3d0
-7fff1f000-7fff20000 rw-s 00082000 00:10 20630                            /dev/kgsl-3d0
-7fff20000-7fff21000 rw-s 00081000 00:10 20630                            /dev/kgsl-3d0
-7fff21000-7fff22000 rw-s 00080000 00:10 20630                            /dev/kgsl-3d0
-7fff22000-7fff23000 rw-s 0007f000 00:10 20630                            /dev/kgsl-3d0
-7fff23000-7fff24000 rw-s 0007e000 00:10 20630                            /dev/kgsl-3d0
-7fff24000-7fff25000 rw-s 0007d000 00:10 20630                            /dev/kgsl-3d0
-7fff25000-7fff26000 rw-s 0007c000 00:10 20630                            /dev/kgsl-3d0
-7fff26000-7fff27000 rw-s 0007b000 00:10 20630                            /dev/kgsl-3d0
-7fff27000-7fff28000 rw-s 0007a000 00:10 20630                            /dev/kgsl-3d0
-7fff28000-7fff29000 rw-s 00079000 00:10 20630                            /dev/kgsl-3d0
-7fff29000-7fff2a000 rw-s 00078000 00:10 20630                            /dev/kgsl-3d0
-7fff2a000-7fff2b000 rw-s 00077000 00:10 20630                            /dev/kgsl-3d0
-7fff2b000-7fff2c000 rw-s 00076000 00:10 20630                            /dev/kgsl-3d0
-7fff2c000-7fff2d000 rw-s 00075000 00:10 20630                            /dev/kgsl-3d0
-7fff2d000-7fff2e000 rw-s 00074000 00:10 20630                            /dev/kgsl-3d0
-7fff2e000-7fff2f000 rw-s 00073000 00:10 20630                            /dev/kgsl-3d0
-7fff2f000-7fff30000 rw-s 00072000 00:10 20630                            /dev/kgsl-3d0
-7fff30000-7fff31000 rw-s 00071000 00:10 20630                            /dev/kgsl-3d0
-7fff31000-7fff32000 rw-s 00070000 00:10 20630                            /dev/kgsl-3d0
-7fff32000-7fff33000 rw-s 0006f000 00:10 20630                            /dev/kgsl-3d0
-7fff33000-7fff34000 rw-s 0006e000 00:10 20630                            /dev/kgsl-3d0
-7fff34000-7fff35000 rw-s 0006d000 00:10 20630                            /dev/kgsl-3d0
-7fff35000-7fff36000 rw-s 0006c000 00:10 20630                            /dev/kgsl-3d0
-7fff36000-7fff37000 rw-s 0006b000 00:10 20630                            /dev/kgsl-3d0
-7fff37000-7fff38000 rw-s 0006a000 00:10 20630                            /dev/kgsl-3d0
-7fff38000-7fff39000 rw-s 00069000 00:10 20630                            /dev/kgsl-3d0
-7fff39000-7fff3a000 rw-s 00068000 00:10 20630                            /dev/kgsl-3d0
-7fff3a000-7fff3b000 rw-s 00067000 00:10 20630                            /dev/kgsl-3d0
-7fff3b000-7fff3c000 rw-s 00066000 00:10 20630                            /dev/kgsl-3d0
-7fff3c000-7fff3d000 rw-s 00065000 00:10 20630                            /dev/kgsl-3d0
-7fff3d000-7fff3e000 rw-s 00064000 00:10 20630                            /dev/kgsl-3d0
-7fff3e000-7fff3f000 rw-s 00063000 00:10 20630                            /dev/kgsl-3d0
-7fff3f000-7fff40000 rw-s 00062000 00:10 20630                            /dev/kgsl-3d0
-7fff40000-7fff41000 rw-s 00061000 00:10 20630                            /dev/kgsl-3d0
-7fff41000-7fff42000 rw-s 00060000 00:10 20630                            /dev/kgsl-3d0
-7fff42000-7fff43000 rw-s 0005f000 00:10 20630                            /dev/kgsl-3d0
-7fff43000-7fff44000 rw-s 0005e000 00:10 20630                            /dev/kgsl-3d0
-7fff44000-7fff45000 rw-s 0005d000 00:10 20630                            /dev/kgsl-3d0
-7fff45000-7fff46000 rw-s 0005c000 00:10 20630                            /dev/kgsl-3d0
-7fff46000-7fff47000 rw-s 0005b000 00:10 20630                            /dev/kgsl-3d0
-7fff47000-7fff48000 rw-s 0005a000 00:10 20630                            /dev/kgsl-3d0
-7fff48000-7fff49000 rw-s 00059000 00:10 20630                            /dev/kgsl-3d0
-7fff49000-7fff4a000 rw-s 00058000 00:10 20630                            /dev/kgsl-3d0
-7fff4a000-7fff4b000 rw-s 00057000 00:10 20630                            /dev/kgsl-3d0
-7fff4b000-7fff4c000 rw-s 00056000 00:10 20630                            /dev/kgsl-3d0
-7fff4c000-7fff4d000 rw-s 00055000 00:10 20630                            /dev/kgsl-3d0
-7fff4d000-7fff4e000 rw-s 00054000 00:10 20630                            /dev/kgsl-3d0
-7fff4e000-7fff4f000 rw-s 00053000 00:10 20630                            /dev/kgsl-3d0
-7fff4f000-7fff50000 rw-s 00052000 00:10 20630                            /dev/kgsl-3d0
-7fff50000-7fff51000 rw-s 00051000 00:10 20630                            /dev/kgsl-3d0
-7fff51000-7fff52000 rw-s 00050000 00:10 20630                            /dev/kgsl-3d0
-7fff52000-7fff53000 rw-s 0004f000 00:10 20630                            /dev/kgsl-3d0
-7fff53000-7fff54000 rw-s 0004e000 00:10 20630                            /dev/kgsl-3d0
-7fff54000-7fff55000 rw-s 0004d000 00:10 20630                            /dev/kgsl-3d0
-7fff55000-7fff56000 rw-s 0004c000 00:10 20630                            /dev/kgsl-3d0
-7fff56000-7fff57000 rw-s 0004b000 00:10 20630                            /dev/kgsl-3d0
-7fff57000-7fff58000 rw-s 0004a000 00:10 20630                            /dev/kgsl-3d0
-7fff58000-7fff59000 rw-s 00049000 00:10 20630                            /dev/kgsl-3d0
-7fff59000-7fff5a000 rw-s 00048000 00:10 20630                            /dev/kgsl-3d0
-7fff5a000-7fff5b000 rw-s 00047000 00:10 20630                            /dev/kgsl-3d0
-7fff5b000-7fff5c000 rw-s 00046000 00:10 20630                            /dev/kgsl-3d0
-7fff5c000-7fff5d000 rw-s 00045000 00:10 20630                            /dev/kgsl-3d0
-7fff5d000-7fff5e000 rw-s 00044000 00:10 20630                            /dev/kgsl-3d0
-7fff5e000-7fff5f000 rw-s 00043000 00:10 20630                            /dev/kgsl-3d0
-7fff5f000-7fff60000 rw-s 00042000 00:10 20630                            /dev/kgsl-3d0
-7fff60000-7fff61000 rw-s 00041000 00:10 20630                            /dev/kgsl-3d0
-7fff61000-7fff62000 rw-s 00040000 00:10 20630                            /dev/kgsl-3d0
-7fff62000-7fff63000 rw-s 0003f000 00:10 20630                            /dev/kgsl-3d0
-7fff63000-7fff64000 rw-s 0003e000 00:10 20630                            /dev/kgsl-3d0
-7fff64000-7fff65000 rw-s 0003d000 00:10 20630                            /dev/kgsl-3d0
-7fff65000-7fff66000 rw-s 0003c000 00:10 20630                            /dev/kgsl-3d0
-7fff66000-7fff67000 rw-s 0003b000 00:10 20630                            /dev/kgsl-3d0
-7fff67000-7fff68000 rw-s 0003a000 00:10 20630                            /dev/kgsl-3d0
-7fff68000-7fff69000 rw-s 00039000 00:10 20630                            /dev/kgsl-3d0
-7fff69000-7fff6a000 rw-s 00038000 00:10 20630                            /dev/kgsl-3d0
-7fff6a000-7fff6b000 rw-s 00037000 00:10 20630                            /dev/kgsl-3d0
-7fff6b000-7fff6c000 rw-s 00036000 00:10 20630                            /dev/kgsl-3d0
-7fff6c000-7fff6d000 rw-s 00035000 00:10 20630                            /dev/kgsl-3d0
-7fff6d000-7fff6e000 rw-s 00034000 00:10 20630                            /dev/kgsl-3d0
-7fff6e000-7fff6f000 rw-s 00033000 00:10 20630                            /dev/kgsl-3d0
-7fff6f000-7fff70000 rw-s 00032000 00:10 20630                            /dev/kgsl-3d0
-7fff70000-7fff71000 rw-s 00031000 00:10 20630                            /dev/kgsl-3d0
-7fff71000-7fff72000 rw-s 00030000 00:10 20630                            /dev/kgsl-3d0
-7fff72000-7fff73000 rw-s 0002f000 00:10 20630                            /dev/kgsl-3d0
-7fff73000-7fff74000 rw-s 0002e000 00:10 20630                            /dev/kgsl-3d0
-7fff74000-7fff75000 rw-s 0002d000 00:10 20630                            /dev/kgsl-3d0
-7fff75000-7fff76000 rw-s 0002c000 00:10 20630                            /dev/kgsl-3d0
-7fff76000-7fff77000 rw-s 0002b000 00:10 20630                            /dev/kgsl-3d0
-7fff77000-7fff78000 rw-s 0002a000 00:10 20630                            /dev/kgsl-3d0
-7fff78000-7fff79000 rw-s 00029000 00:10 20630                            /dev/kgsl-3d0
-7fff79000-7fff7a000 rw-s 00028000 00:10 20630                            /dev/kgsl-3d0
-7fff7a000-7fff7b000 rw-s 00027000 00:10 20630                            /dev/kgsl-3d0
-7fff7b000-7fff7c000 rw-s 00026000 00:10 20630                            /dev/kgsl-3d0
-7fff7c000-7fff7d000 rw-s 00025000 00:10 20630                            /dev/kgsl-3d0
-7fff7d000-7fff7e000 rw-s 00024000 00:10 20630                            /dev/kgsl-3d0
-7fff7e000-7fff7f000 rw-s 00023000 00:10 20630                            /dev/kgsl-3d0
-7fff7f000-7fff80000 rw-s 00022000 00:10 20630                            /dev/kgsl-3d0
-7fff80000-7fff90000 rw-s 00019000 00:10 20630                            /dev/kgsl-3d0
-7fff90000-7fffb0000 rw-s 00018000 00:10 20630                            /dev/kgsl-3d0
-7fffb1000-7fffb2000 rw-s 00021000 00:10 20630                            /dev/kgsl-3d0
-7fffb2000-7fffb3000 rw-s 00020000 00:10 20630                            /dev/kgsl-3d0
-7fffb3000-7fffb4000 rw-s 0001f000 00:10 20630                            /dev/kgsl-3d0
-7fffba000-7fffbe000 rw-s 0001b000 00:10 20630                            /dev/kgsl-3d0
-7fffbe000-7fffbf000 rw-s 0001a000 00:10 20630                            /dev/kgsl-3d0
-7fffbf000-7fffc0000 rw-s 00017000 00:10 20630                            /dev/kgsl-3d0
-7fffc0000-7fffe0000 rw-s 00016000 00:10 20630                            /dev/kgsl-3d0
-7fffe0000-7fffe1000 rw-s 00014000 00:10 20630                            /dev/kgsl-3d0
-7fffe1000-7fffe5000 rw-s 00013000 00:10 20630                            /dev/kgsl-3d0
-7fffe5000-7fffe6000 rw-s 00012000 00:10 20630                            /dev/kgsl-3d0
-7fffe6000-7fffe7000 rw-s 00011000 00:10 20630                            /dev/kgsl-3d0
-7fffe7000-7fffe8000 rw-s 00010000 00:10 20630                            /dev/kgsl-3d0
-7fffe8000-7fffe9000 rw-s 0000f000 00:10 20630                            /dev/kgsl-3d0
-7fffe9000-7fffea000 rw-s 0000e000 00:10 20630                            /dev/kgsl-3d0
-7fffea000-7fffeb000 rw-s 0000d000 00:10 20630                            /dev/kgsl-3d0
-7fffeb000-7fffec000 rw-s 0000c000 00:10 20630                            /dev/kgsl-3d0
-7fffec000-7ffff0000 rw-s 0000b000 00:10 20630                            /dev/kgsl-3d0
-7ffff0000-7ffff1000 rw-s 0000a000 00:10 20630                            /dev/kgsl-3d0
-7ffff1000-7ffff5000 rw-s 00009000 00:10 20630                            /dev/kgsl-3d0
-7ffff5000-7ffff6000 rw-s 00008000 00:10 20630                            /dev/kgsl-3d0
-7ffff6000-7ffff7000 rw-s 00007000 00:10 20630                            /dev/kgsl-3d0
-7ffff7000-7ffff8000 rw-s 00006000 00:10 20630                            /dev/kgsl-3d0
-7ffff8000-7ffff9000 rw-s 00005000 00:10 20630                            /dev/kgsl-3d0
-7ffff9000-7ffffa000 rw-s 00004000 00:10 20630                            /dev/kgsl-3d0
-7ffffa000-7ffffb000 rw-s 00003000 00:10 20630                            /dev/kgsl-3d0
-7ffffb000-7ffffc000 rw-s 00002000 00:10 20630                            /dev/kgsl-3d0
-7ffffc000-800000000 rw-s 00001000 00:10 20630                            /dev/kgsl-3d0
-5ff1d4f000-5ff1d54000 r-xp 00000000 fc:00 3419                           /system/bin/app_process64
-5ff1d6e000-5ff1d6f000 r--p 0000f000 fc:00 3419                           /system/bin/app_process64
-5ff1d6f000-5ff1d71000 rw-p 00000000 00:00 0 
-704defa000-704defb000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-704defb000-704defc000 ---p 00000000 00:00 0 
-704defc000-704e000000 rw-p 00000000 00:00 0 
-704e000000-704e400000 rw-p 00000000 00:00 0                              [anon:libc_malloc]
-704e455000-704e456000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-704e456000-704e457000 ---p 00000000 00:00 0 
-704e457000-704e553000 rw-p 00000000 00:00 0 
-704e553000-704e651000 r--p 00000000 00:10 16029                          /dev/hwbinder
-704e651000-704e65f000 r-xp 00000000 fc:01 1040                           /vendor/lib64/egl/eglSubDriverAndroid.so
-704e65f000-704e660000 r--p 0000e000 fc:01 1040                           /vendor/lib64/egl/eglSubDriverAndroid.so
-704e660000-704e661000 rw-p 0000f000 fc:01 1040                           /vendor/lib64/egl/eglSubDriverAndroid.so
-704e69d000-704e69e000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-704e69e000-704e79b000 rw-p 00000000 00:00 0 
-704e79b000-704f79b000 rw-s 00000000 00:05 10271021                       /dev/ashmem/AudioFlinger::Client(29312) (deleted)
-704f79b000-704f79c000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-704f79c000-704f899000 rw-p 00000000 00:00 0 
-704f899000-704f89a000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-704f89a000-704f89b000 ---p 00000000 00:00 0 
-704f89b000-704f997000 rw-p 00000000 00:00 0 
-704f997000-704f9ee000 r-xp 00000000 103:1d 1737338                       /data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/lib/arm64/libgame.so
-704f9ee000-704f9fd000 ---p 00000000 00:00 0 
-704f9fd000-704fa00000 r--p 00056000 103:1d 1737338                       /data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/lib/arm64/libgame.so
-704fa00000-704fa01000 rw-p 00059000 103:1d 1737338                       /data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/lib/arm64/libgame.so
-704fa01000-704fa19000 rw-p 00000000 00:00 0                              [anon:.bss]
-704fa40000-70507e7000 r-xp 00000000 fc:01 1026                           /vendor/lib64/libllvm-glnext.so
-70507e7000-70507fc000 ---p 00000000 00:00 0 
-70507fc000-7050835000 r--p 00da7000 fc:01 1026                           /vendor/lib64/libllvm-glnext.so
-7050835000-705083a000 rw-p 00de0000 fc:01 1026                           /vendor/lib64/libllvm-glnext.so
-705083a000-7050855000 rw-p 00000000 00:00 0                              [anon:.bss]
-705089b000-7050f19000 r-xp 00000000 fc:01 1039                           /vendor/lib64/egl/libGLESv2_adreno.so
-7050f19000-7050f22000 r--p 0067e000 fc:01 1039                           /vendor/lib64/egl/libGLESv2_adreno.so
-7050f22000-7050f29000 rw-p 00687000 fc:01 1039                           /vendor/lib64/egl/libGLESv2_adreno.so
-7050f29000-7050f2c000 rw-p 00000000 00:00 0                              [anon:.bss]
-7050f83000-7050fbc000 r-xp 00000000 fc:01 1041                           /vendor/lib64/egl/libGLESv1_CM_adreno.so
-7050fbc000-7050fbd000 r--p 00039000 fc:01 1041                           /vendor/lib64/egl/libGLESv1_CM_adreno.so
-7050fbd000-7050fbe000 rw-p 0003a000 fc:01 1041                           /vendor/lib64/egl/libGLESv1_CM_adreno.so
-7050fbe000-7050fbf000 rw-p 00000000 00:00 0                              [anon:.bss]
-7050fc6000-705111d000 r-xp 00000000 fc:01 865                            /vendor/lib64/libgsl.so
-705111d000-705111e000 r--p 00157000 fc:01 865                            /vendor/lib64/libgsl.so
-705111e000-705111f000 rw-p 00158000 fc:01 865                            /vendor/lib64/libgsl.so
-705111f000-7051120000 rw-p 00000000 00:00 0                              [anon:.bss]
-7051146000-705115d000 r-xp 00000000 fc:00 2587                           /system/lib64/vndk-sp-28/libz.so
-705115d000-7051175000 ---p 00000000 00:00 0 
-7051175000-7051176000 r--p 0001f000 fc:00 2587                           /system/lib64/vndk-sp-28/libz.so
-7051176000-7051177000 rw-p 00020000 fc:00 2587                           /system/lib64/vndk-sp-28/libz.so
-705119f000-70511ac000 r-xp 00000000 fc:01 886                            /vendor/lib64/libadreno_utils.so
-70511ac000-70511ad000 r--p 0000d000 fc:01 886                            /vendor/lib64/libadreno_utils.so
-70511ad000-70511ae000 rw-p 0000e000 fc:01 886                            /vendor/lib64/libadreno_utils.so
-70511ae000-70511b0000 rw-p 00000000 00:00 0                              [anon:.bss]
-70511c0000-70511d7000 r-xp 00000000 fc:01 1044                           /vendor/lib64/egl/libEGL_adreno.so
-70511d7000-70511d8000 r--p 00017000 fc:01 1044                           /vendor/lib64/egl/libEGL_adreno.so
-70511d8000-70511d9000 rw-p 00018000 fc:01 1044                           /vendor/lib64/egl/libEGL_adreno.so
-70511d9000-70511da000 rw-p 00000000 00:00 0                              [anon:.bss]
-705120a000-705120d000 r-xp 00000000 fc:01 972                            /vendor/lib64/libdrmutils.so
-705120d000-7051229000 ---p 00000000 00:00 0 
-7051229000-705122a000 r--p 0000f000 fc:01 972                            /vendor/lib64/libdrmutils.so
-705122a000-705122b000 rw-p 00010000 fc:01 972                            /vendor/lib64/libdrmutils.so
-705125a000-705125c000 r-xp 00000000 fc:01 1046                           /vendor/lib64/libqdMetaData.so
-705125c000-7051279000 ---p 00000000 00:00 0 
-7051279000-705127a000 r--p 0000f000 fc:01 1046                           /vendor/lib64/libqdMetaData.so
-705127a000-705127b000 rw-p 00010000 fc:01 1046                           /vendor/lib64/libqdMetaData.so
-7051286000-7051297000 r-xp 00000000 fc:01 1024                           /vendor/lib64/libdrm.so
-7051297000-70512b5000 ---p 00000000 00:00 0 
-70512b5000-70512b6000 r--p 0001f000 fc:01 1024                           /vendor/lib64/libdrm.so
-70512b6000-70512b7000 rw-p 00020000 fc:01 1024                           /vendor/lib64/libdrm.so
-70512cb000-70512de000 r-xp 00000000 fc:01 1008                           /vendor/lib64/hw/gralloc.msm8998.so
-70512de000-70512fa000 ---p 00000000 00:00 0 
-70512fa000-70512fb000 r--p 0001f000 fc:01 1008                           /vendor/lib64/hw/gralloc.msm8998.so
-70512fb000-70512fc000 rw-p 00020000 fc:01 1008                           /vendor/lib64/hw/gralloc.msm8998.so
-7051326000-7051327000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-7051327000-7051328000 ---p 00000000 00:00 0 
-7051328000-7051424000 rw-p 00000000 00:00 0 
-7051424000-705143d000 r--p 00000000 fc:00 739                            /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
-705143d000-7051480000 r-xp 00019000 fc:00 739                            /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
-7051480000-7051494000 r--p 00211000 103:1d 639511                        /data/dalvik-cache/arm64/system@framework@boot.art
-7051494000-705149f000 r--p 000c5000 103:1d 639514                        /data/dalvik-cache/arm64/system@framework@boot-core-libart.art
-705149f000-70514a2000 r--p 00032000 103:1d 639517                        /data/dalvik-cache/arm64/system@framework@boot-conscrypt.art
-70514a2000-70514a5000 r--p 0002b000 103:1d 639520                        /data/dalvik-cache/arm64/system@framework@boot-okhttp.art
-70514a5000-70514ac000 r--p 0003f000 103:1d 639523                        /data/dalvik-cache/arm64/system@framework@boot-bouncycastle.art
-70514ac000-70514b2000 r--p 00044000 103:1d 639526                        /data/dalvik-cache/arm64/system@framework@boot-apache-xml.art
-70514b2000-70514bd000 r--p 00035000 103:1d 639529                        /data/dalvik-cache/arm64/system@framework@boot-ext.art
-70514bd000-70514f4000 r--p 0060f000 103:1d 639532                        /data/dalvik-cache/arm64/system@framework@boot-framework.art
-70514f4000-70514fe000 r--p 00054000 103:1d 639535                        /data/dalvik-cache/arm64/system@framework@boot-telephony-common.art
-70514fe000-70514ff000 r--p 0000c000 103:1d 639538                        /data/dalvik-cache/arm64/system@framework@boot-voip-common.art
-70514ff000-7051500000 r--p 0000e000 103:1d 639541                        /data/dalvik-cache/arm64/system@framework@boot-ims-common.art
-7051500000-7051501000 r--p 00004000 103:1d 639547                        /data/dalvik-cache/arm64/system@framework@boot-android.hidl.manager-V1.0-java.art
-7051501000-7051502000 r--p 00004000 103:1d 639553                        /data/dalvik-cache/arm64/system@framework@boot-android.test.base.art
-7051502000-7051503000 r--p 00001000 103:1d 639556                        /data/dalvik-cache/arm64/system@framework@boot-com.google.vr.platform.art
-7051503000-7051504000 rw-p 00000000 00:00 0                              [anon:.bss]
-7051504000-7051579000 r--s 00000000 fc:00 790                            /system/framework/oat/arm64/org.apache.http.legacy.boot.vdex
-7051579000-705157a000 r--p 0005c000 fc:00 739                            /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
-705157a000-705157b000 rw-p 0005d000 fc:00 739                            /system/framework/oat/arm64/org.apache.http.legacy.boot.odex
-705158b000-7057f4d000 ---p 00000000 00:00 0 
-7057f4d000-7057f4f000 r-xp 00000000 fc:00 2646                           /system/lib64/libwebviewchromium_loader.so
-7057f4f000-7057f6c000 ---p 00000000 00:00 0 
-7057f6c000-7057f6d000 r--p 0000f000 fc:00 2646                           /system/lib64/libwebviewchromium_loader.so
-7057f6d000-7057f6e000 rw-p 00010000 fc:00 2646                           /system/lib64/libwebviewchromium_loader.so
-7057f76000-7057f96000 r--s 00000000 00:10 16615                          /dev/__properties__/u:object_r:hwservicemanager_prop:s0
-7057f96000-7057fb6000 r--s 00000000 00:10 16639                          /dev/__properties__/u:object_r:public_vendor_default_prop:s0
-7057fb6000-7058004000 r--s 00000000 fc:00 1112                           /system/usr/hyphen-data/hyph-hu.hyb
-7058004000-7058024000 r-xp 00000000 fc:00 2354                           /system/lib64/libcompiler_rt.so
-7058024000-7058043000 ---p 00000000 00:00 0 
-7058043000-7058044000 r--p 0002f000 fc:00 2354                           /system/lib64/libcompiler_rt.so
-7058044000-7058045000 rw-p 00030000 fc:00 2354                           /system/lib64/libcompiler_rt.so
-7058045000-70580b2000 rw-p 00000000 00:00 0                              [anon:.bss]
-70580bd000-70580dd000 rw-p 00000000 00:05 10265386                       [anon:dalvik-LinearAlloc]
-70580dd000-70580df000 r-xp 00000000 fc:00 2597                           /system/lib64/vndk-sp-28/libhardware.so
-70580df000-70580fc000 ---p 00000000 00:00 0 
-70580fc000-70580fd000 r--p 0000f000 fc:00 2597                           /system/lib64/vndk-sp-28/libhardware.so
-70580fd000-70580fe000 rw-p 00010000 fc:00 2597                           /system/lib64/vndk-sp-28/libhardware.so
-705810e000-705811f000 r-xp 00000000 fc:00 2589                           /system/lib64/vndk-sp-28/libbase.so
-705811f000-705813d000 ---p 00000000 00:00 0 
-705813d000-705813e000 r--p 0001f000 fc:00 2589                           /system/lib64/vndk-sp-28/libbase.so
-705813e000-705813f000 rw-p 00020000 fc:00 2589                           /system/lib64/vndk-sp-28/libbase.so
-7058140000-7058167000 r-xp 00000000 fc:00 2572                           /system/lib64/vndk-sp-28/libhwbinder.so
-7058167000-705817d000 ---p 00000000 00:00 0 
-705817d000-705817f000 r--p 0002e000 fc:00 2572                           /system/lib64/vndk-sp-28/libhwbinder.so
-705817f000-7058180000 rw-p 00030000 fc:00 2572                           /system/lib64/vndk-sp-28/libhwbinder.so
-705818c000-705818d000 r-xp 00000000 fc:00 2584                           /system/lib64/vndk-sp-28/android.hardware.graphics.common@1.0.so
-705818d000-70581ab000 ---p 00000000 00:00 0 
-70581ab000-70581ac000 r--p 0000f000 fc:00 2584                           /system/lib64/vndk-sp-28/android.hardware.graphics.common@1.0.so
-70581ac000-70581ad000 rw-p 00010000 fc:00 2584                           /system/lib64/vndk-sp-28/android.hardware.graphics.common@1.0.so
-70581b7000-70581d7000 r--s 00000000 00:10 16619                          /dev/__properties__/u:object_r:log_prop:s0
-70581d7000-7058237000 r-xp 00000000 fc:00 2574                           /system/lib64/vndk-sp-28/libhidltransport.so
-7058237000-7058255000 ---p 00000000 00:00 0 
-7058255000-705825d000 r--p 00068000 fc:00 2574                           /system/lib64/vndk-sp-28/libhidltransport.so
-705825d000-705825e000 rw-p 00070000 fc:00 2574                           /system/lib64/vndk-sp-28/libhidltransport.so
-7058260000-7058284000 r--s 00000000 fc:00 1138                           /system/usr/hyphen-data/hyph-nn.hyb
-7058284000-70582a0000 r-xp 00000000 fc:00 2576                           /system/lib64/vndk-sp-28/libutils.so
-70582a0000-70582b3000 ---p 00000000 00:00 0 
-70582b3000-70582b4000 r--p 0001f000 fc:00 2576                           /system/lib64/vndk-sp-28/libutils.so
-70582b4000-70582b5000 rw-p 00020000 fc:00 2576                           /system/lib64/vndk-sp-28/libutils.so
-70582c4000-7058391000 r-xp 00000000 fc:00 2568                           /system/lib64/vndk-sp-28/libc++.so
-7058391000-70583ad000 ---p 00000000 00:00 0 
-70583ad000-70583b7000 r--p 000d6000 fc:00 2568                           /system/lib64/vndk-sp-28/libc++.so
-70583b7000-70583b8000 rw-p 000e0000 fc:00 2568                           /system/lib64/vndk-sp-28/libc++.so
-70583b8000-70583bb000 rw-p 00000000 00:00 0                              [anon:.bss]
-70583cd000-70583e4000 r-xp 00000000 fc:00 2580                           /system/lib64/vndk-sp-28/android.hardware.graphics.mapper@2.0.so
-70583e4000-70583f9000 ---p 00000000 00:00 0 
-70583f9000-70583fb000 r--p 0001e000 fc:00 2580                           /system/lib64/vndk-sp-28/android.hardware.graphics.mapper@2.0.so
-70583fb000-70583fc000 rw-p 00020000 fc:00 2580                           /system/lib64/vndk-sp-28/android.hardware.graphics.mapper@2.0.so
-705841b000-7058421000 r-xp 00000000 fc:01 1001                           /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so
-7058421000-705843a000 ---p 00000000 00:00 0 
-705843a000-705843b000 r--p 0000f000 fc:01 1001                           /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so
-705843b000-705843c000 rw-p 00010000 fc:01 1001                           /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so
-705844f000-7058473000 r--s 00000000 fc:00 1150                           /system/usr/hyphen-data/hyph-nb.hyb
-7058473000-7058495000 r-xp 00000000 fc:00 2582                           /system/lib64/vndk-sp-28/libhidlbase.so
-7058495000-70584b1000 ---p 00000000 00:00 0 
-70584b1000-70584b3000 r--p 0002e000 fc:00 2582                           /system/lib64/vndk-sp-28/libhidlbase.so
-70584b3000-70584b4000 rw-p 00030000 fc:00 2582                           /system/lib64/vndk-sp-28/libhidlbase.so
-70584cd000-70584df000 r-xp 00000000 fc:00 2595                           /system/lib64/vndk-sp-28/libcutils.so
-70584df000-70584fb000 ---p 00000000 00:00 0 
-70584fb000-70584fd000 r--p 0001e000 fc:00 2595                           /system/lib64/vndk-sp-28/libcutils.so
-70584fd000-70584fe000 rw-p 00020000 fc:00 2595                           /system/lib64/vndk-sp-28/libcutils.so
-7058519000-7058537000 r--s 00000000 fc:00 1124                           /system/usr/hyphen-data/hyph-de-ch-1901.hyb
-7058537000-7059fd1000 r--s 0070b000 fc:00 989                            /system/framework/framework-res.apk
-7059fd1000-705a013000 r-xp 00000000 fc:00 2610                           /system/lib64/libjavacrypto.so
-705a013000-705a02b000 ---p 00000000 00:00 0 
-705a02b000-705a02d000 r--p 0004e000 fc:00 2610                           /system/lib64/libjavacrypto.so
-705a02d000-705a02f000 rw-p 00050000 fc:00 2610                           /system/lib64/libjavacrypto.so
-705a041000-705a05f000 r--s 00000000 fc:00 1128                           /system/usr/hyphen-data/hyph-de-1996.hyb
-705a05f000-705a06a000 r-xp 00000000 fc:00 2917                           /system/lib64/libsoundpool.so
-705a06a000-705a07e000 ---p 00000000 00:00 0 
-705a07e000-705a07f000 r--p 0000f000 fc:00 2917                           /system/lib64/libsoundpool.so
-705a07f000-705a080000 rw-p 00010000 fc:00 2917                           /system/lib64/libsoundpool.so
-705a087000-705a102000 r--s 00000000 fc:00 1246                           /system/usr/share/zoneinfo/tzdata
-705a102000-705a863000 r--s 00000000 fc:00 101                            /system/fonts/NotoColorEmoji.ttf
-705a863000-705c000000 r--s 00000000 fc:00 251                            /system/fonts/NotoSerifCJK-Regular.ttc
-705c000000-705c200000 rw-p 00000000 00:00 0                              [anon:libc_malloc]
-705c209000-705c227000 r--s 00000000 fc:00 1077                           /system/usr/hyphen-data/hyph-de-1901.hyb
-705c227000-705c26e000 r--s 02284000 fc:00 989                            /system/framework/framework-res.apk
-705c26e000-705d43e000 r--s 00000000 fc:00 95                             /system/fonts/NotoSansCJK-Regular.ttc
-705d43e000-705d4ec000 r--s 00000000 fc:00 278                            /system/fonts/NotoSansSymbols-Regular-Subsetted.ttf
-705d4ec000-705d548000 r--s 00000000 fc:00 233                            /system/fonts/NotoSansTibetan-Bold.ttf
-705d548000-705d5ab000 r--s 00000000 fc:00 177                            /system/fonts/NotoSansTibetan-Regular.ttf
-705d5ab000-705d627000 r--s 00000000 fc:00 197                            /system/fonts/NotoSansEgyptianHieroglyphs-Regular.ttf
-705d627000-705d6a2000 r--s 00000000 fc:00 76                             /system/fonts/NotoSansCuneiform-Regular.ttf
-705d6a2000-705d6f3000 r--s 00000000 fc:00 67                             /system/fonts/RobotoCondensed-BoldItalic.ttf
-705d6f3000-705d73e000 r--s 00000000 fc:00 199                            /system/fonts/RobotoCondensed-Bold.ttf
-705d73e000-705d78f000 r--s 00000000 fc:00 230                            /system/fonts/RobotoCondensed-MediumItalic.ttf
-705d78f000-705d7da000 r--s 00000000 fc:00 92                             /system/fonts/RobotoCondensed-Medium.ttf
-705d7da000-705d82b000 r--s 00000000 fc:00 128                            /system/fonts/RobotoCondensed-Italic.ttf
-705d82b000-705d875000 r--s 00000000 fc:00 164                            /system/fonts/RobotoCondensed-Regular.ttf
-705d875000-705d8c7000 r--s 00000000 fc:00 292                            /system/fonts/RobotoCondensed-LightItalic.ttf
-705d8c7000-705d919000 r--s 00000000 fc:00 85                             /system/fonts/Roboto-BoldItalic.ttf
-705d919000-705d964000 r--s 00000000 fc:00 175                            /system/fonts/Roboto-Bold.ttf
-705d964000-705d9b5000 r--s 00000000 fc:00 266                            /system/fonts/Roboto-BlackItalic.ttf
-705d9b5000-705da00000 r--s 00000000 fc:00 187                            /system/fonts/Roboto-Black.ttf
-705da00000-705dc00000 rw-p 00000000 00:00 0                              [anon:libc_malloc]
-705dc1d000-705dc6e000 r--s 00000000 fc:00 148                            /system/fonts/Roboto-MediumItalic.ttf
-705dc6e000-705dcb9000 r--s 00000000 fc:00 284                            /system/fonts/Roboto-Medium.ttf
-705dcb9000-705dd0a000 r--s 00000000 fc:00 105                            /system/fonts/Roboto-Italic.ttf
-705dd0a000-705dd55000 r--s 00000000 fc:00 156                            /system/fonts/Roboto-Regular.ttf
-705dd55000-705dda7000 r--s 00000000 fc:00 217                            /system/fonts/Roboto-LightItalic.ttf
-705dda7000-705ddf8000 r--s 00000000 fc:00 166                            /system/fonts/Roboto-ThinItalic.ttf
-705ddf8000-705ddf9000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705ddf9000-705ddfa000 ---p 00000000 00:00 0 
-705ddfa000-705def6000 rw-p 00000000 00:00 0 
-705def6000-705f5ec000 r--s 00000000 fc:00 1350                           /system/usr/icu/icudt60l.dat
-705f5ec000-705f5ed000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705f5ed000-705f5ee000 ---p 00000000 00:00 0 
-705f5ee000-705f6ea000 rw-p 00000000 00:00 0 
-705f6ea000-705f7e8000 r--p 00000000 00:10 20636                          /dev/binder
-705f7e8000-705f7e9000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705f7e9000-705f7ea000 ---p 00000000 00:00 0 
-705f7ea000-705f8ee000 rw-p 00000000 00:00 0 
-705f8ee000-705f8ef000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705f8ef000-705f8f0000 ---p 00000000 00:00 0 
-705f8f0000-705f9f4000 rw-p 00000000 00:00 0 
-705f9f4000-705f9f5000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705f9f5000-705f9f6000 ---p 00000000 00:00 0 
-705f9f6000-705fafa000 rw-p 00000000 00:00 0 
-705fafa000-705fafb000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705fafb000-705fafc000 ---p 00000000 00:00 0 
-705fafc000-705fc00000 rw-p 00000000 00:00 0 
-705fc00000-705fe00000 rw-p 00000000 00:00 0                              [anon:libc_malloc]
-705fe01000-705fe4c000 r--s 00000000 fc:00 97                             /system/fonts/Roboto-Light.ttf
-705fe4c000-705fe4d000 ---p 00000000 00:00 0                              [anon:thread stack guard]
-705fe4d000-705fe4e000 ---p 00000000 00:00 0 
-705fe4e000-705ff4a000 rw-p 00000000 00:00 0 
-705ff4a000-705ff4b000 ---p 00000000 00:05 10270991                       [anon:dalvik-Jit thread pool worker thread 0]
-705ff4b000-705ff4c000 ---p 00001000 00:05 10270991                       [anon:dalvik-Jit thread pool worker thread 0]
-705ff4c000-706004b000 rw-p 00002000 00:05 10270991                       [anon:dalvik-Jit thread pool worker thread 0]
-706004b000-706010f000 r-xp 00000000 fc:00 2390                           /system/lib64/libvixl-arm64.so
-706010f000-7060120000 ---p 00000000 00:00 0 
-7060120000-7060125000 r--p 000cb000 fc:00 2390                           /system/lib64/libvixl-arm64.so
-7060125000-7060126000 rw-p 000d0000 fc:00 2390                           /system/lib64/libvixl-arm64.so
-7060126000-706012d000 rw-p 00000000 00:00 0                              [anon:.bss]
-7060135000-7060151000 r--s 00000000 fc:01 1180                           /vendor/overlay/framework-res__auto_generated_rro.apk
-7060151000-7060263000 r-xp 00000000 fc:00 2669                           /system/lib64/libvixl-arm.so
-7060263000-7060275000 ---p 00000000 00:00 0 
-7060275000-706027a000 r--p 0011b000 fc:00 2669                           /system/lib64/libvixl-arm.so
-706027a000-706027b000 rw-p 00120000 fc:00 2669                           /system/lib64/libvixl-arm.so
-706028b000-706056c000 r-xp 00000000 fc:00 2972                           /system/lib64/libart-compiler.so
-706056c000-7060580000 ---p 00000000 00:00 0 
-7060580000-7060598000 r--p 002e8000 fc:00 2972                           /system/lib64/libart-compiler.so
-7060598000-7060599000 rw-p 00300000 fc:00 2972                           /system/lib64/libart-compiler.so
-7060599000-70605a0000 rw-p 00000000 00:00 0                              [anon:.bss]
-70605b0000-70605d0000 r--s 00000000 00:10 16571                          /dev/__properties__/u:object_r:config_prop:s0
-70605d0000-7060619000 r-xp 00000000 fc:00 2702                           /system/lib64/libssl.so
-7060619000-706062d000 ---p 00000000 00:00 0 
-706062d000-7060630000 r--p 0004d000 fc:00 2702                           /system/lib64/libssl.so
-7060630000-7060631000 rw-p 00050000 fc:00 2702                           /system/lib64/libssl.so
-7060647000-7060667000 r--s 00000000 00:10 16595                          /dev/__properties__/u:object_r:exported3_radio_prop:s0
-7060667000-706069d000 r-xp 00000000 fc:00 2371                           /system/lib64/libopenjdk.so
-706069d000-70606b2000 ---p 00000000 00:00 0 
-70606b2000-70606b4000 r--p 0003e000 fc:00 2371                           /system/lib64/libopenjdk.so
-70606b4000-70606b6000 rw-p 00040000 fc:00 2371                           /system/lib64/libopenjdk.so
-70606bb000-70606db000 r--s 00000000 00:10 16608                          /dev/__properties__/u:object_r:exported_system_prop:s0
-70606db000-70606e3000 r-xp 00000000 fc:00 2538                           /system/lib64/libopenjdkjvm.so
-70606e3000-70606fa000 ---p 00000000 00:00 0 
-70606fa000-70606fb000 r--p 0000f000 fc:00 2538                           /system/lib64/libopenjdkjvm.so
-70606fb000-70606fc000 rw-p 00010000 fc:00 2538                           /system/lib64/libopenjdkjvm.so
-7060701000-7060722000 r--s 00000000 fc:00 227                            /system/fonts/NotoSansAnatolianHieroglyphs-Regular.otf
-7060722000-7061e18000 r--s 00000000 fc:00 1350                           /system/usr/icu/icudt60l.dat
-7061e18000-7061e5d000 r-xp 00000000 fc:00 2368                           /system/lib64/libjavacore.so
-7061e5d000-7061e71000 ---p 00000000 00:00 0 
-7061e71000-7061e73000 r--p 0004e000 fc:00 2368                           /system/lib64/libjavacore.so
-7061e73000-7061e75000 rw-p 00050000 fc:00 2368                           /system/lib64/libjavacore.so
-7061e75000-7061e76000 rw-p 00000000 00:00 0                              [anon:.bss]
-7061e77000-7061e96000 r--s 00000000 fc:00 186                            /system/fonts/NotoSansYi-Regular.ttf
-7061e96000-7061e99000 r-xp 00000000 fc:00 2953                           /system/lib64/libwebviewchromium_plat_support.so
-7061e99000-7061eb5000 ---p 00000000 00:00 0 
-7061eb5000-7061eb6000 r--p 0000f000 fc:00 2953                           /system/lib64/libwebviewchromium_plat_support.so
-7061eb6000-7061eb7000 rw-p 00010000 fc:00 2953                           /system/lib64/libwebviewchromium_plat_support.so
-7061ebc000-7061edd000 r--s 00000000 fc:00 100                            /system/fonts/NotoSansBamum-Regular.ttf
-7061edd000-7061eed000 r-xp 00000000 fc:00 2945                           /system/lib64/libRS.so
-7061eed000-7061efc000 ---p 00000000 00:00 0 
-7061efc000-7061efd000 r--p 0000f000 fc:00 2945                           /system/lib64/libRS.so
-7061efd000-7061efe000 rw-p 00010000 fc:00 2945                           /system/lib64/libRS.so
-7061f05000-7061f6b000 r-xp 00000000 fc:00 2423                           /system/lib64/android.hardware.renderscript@1.0.so
-7061f6b000-7061f7a000 ---p 00000000 00:00 0 
-7061f7a000-7061f7f000 r--p 0006b000 fc:00 2423                           /system/lib64/android.hardware.renderscript@1.0.so
-7061f7f000-7061f80000 rw-p 00070000 fc:00 2423                           /system/lib64/android.hardware.renderscript@1.0.so
-7061f99000-7061f9b000 r-xp 00000000 fc:00 2614                           /system/lib64/libOpenSLES.so
-7061f9b000-7061fb8000 ---p 00000000 00:00 0 
-7061fb8000-7061fb9000 r--p 0000f000 fc:00 2614                           /system/lib64/libOpenSLES.so
-7061fb9000-7061fba000 rw-p 00010000 fc:00 2614                           /system/lib64/libOpenSLES.so
-7061fc6000-7061fc8000 r-xp 00000000 fc:00 2963                           /system/lib64/libOpenMAXAL.so
-7061fc8000-7061fe5000 ---p 00000000 00:00 0 
-7061fe5000-7061fe6000 r--p 0000f000 fc:00 2963                           /system/lib64/libOpenMAXAL.so
-7061fe6000-7061fe7000 rw-p 00010000 fc:00 2963                           /system/lib64/libOpenMAXAL.so
-7061fe7000-7062000000 r--s 00000000 fc:00 143                            /system/fonts/NotoSansBhaiksuki-Regular.otf
-7062000000-7062003000 r-xp 00000000 fc:00 2447                           /system/lib64/libtextclassifier_hash.so
-7062003000-706201f000 ---p 00000000 00:00 0 
-706201f000-7062020000 r--p 0000f000 fc:00 2447                           /system/lib64/libtextclassifier_hash.so
-7062020000-7062021000 rw-p 00010000 fc:00 2447                           /system/lib64/libtextclassifier_hash.so
-7062022000-7062042000 rw-p 00000000 00:05 10269731                       [anon:dalvik-CompilerMetadata]
-7062042000-7062077000 r-xp 00000000 fc:00 2372                           /system/lib64/android.hardware.neuralnetworks@1.0.so
-7062077000-7062095000 ---p 00000000 00:00 0 
-7062095000-706209b000 r--p 0003a000 fc:00 2372                           /system/lib64/android.hardware.neuralnetworks@1.0.so
-706209b000-706209c000 rw-p 00040000 fc:00 2372                           /system/lib64/android.hardware.neuralnetworks@1.0.so
-70620a9000-70620c9000 rw-p 00000000 00:05 10269730                       [anon:dalvik-CompilerMetadata]
-70620c9000-70620e3000 r-xp 00000000 fc:00 2956                           /system/lib64/android.hardware.neuralnetworks@1.1.so
-70620e3000-70620f4000 ---p 00000000 00:00 0 
-70620f4000-70620f7000 r--p 0001d000 fc:00 2956                           /system/lib64/android.hardware.neuralnetworks@1.1.so
-70620f7000-70620f8000 rw-p 00020000 fc:00 2956                           /system/lib64/android.hardware.neuralnetworks@1.1.so
-706210b000-70621d0000 r-xp 00000000 fc:00 2387                           /system/lib64/libneuralnetworks.so
-70621d0000-70621e3000 ---p 00000000 00:00 0 
-70621e3000-70621e5000 r--p 000ce000 fc:00 2387                           /system/lib64/libneuralnetworks.so
-70621e5000-70621e7000 rw-p 000d0000 fc:00 2387                           /system/lib64/libneuralnetworks.so
-70621e7000-7062372000 rw-p 00000000 00:00 0                              [anon:.bss]
-7062373000-7062395000 r--s 00000000 fc:00 274                            /system/fonts/NotoSerifMyanmar-Bold.otf
-7062395000-7062398000 r-xp 00000000 fc:00 2937                           /system/lib64/libjnigraphics.so
-7062398000-70623b4000 ---p 00000000 00:00 0 
-70623b4000-70623b5000 r--p 0000f000 fc:00 2937                           /system/lib64/libjnigraphics.so
-70623b5000-70623b6000 rw-p 00010000 fc:00 2937                           /system/lib64/libjnigraphics.so
-70623c8000-70623e0000 r-xp 00000000 fc:00 2662                           /system/lib64/libGLESv3.so
-70623e0000-70623f7000 ---p 00000000 00:00 0 
-70623f7000-70623f8000 r--p 0001f000 fc:00 2662                           /system/lib64/libGLESv3.so
-70623f8000-70623f9000 rw-p 00020000 fc:00 2662                           /system/lib64/libGLESv3.so
-70623fc000-706241c000 rw-p 00000000 00:05 10269729                       [anon:dalvik-CompilerMetadata]
-706241c000-7062444000 r-xp 00000000 fc:00 2603                           /system/lib64/libexif.so
-7062444000-706245f000 ---p 00000000 00:00 0 
-706245f000-7062472000 r--p 0002d000 fc:00 2603                           /system/lib64/libexif.so
-7062472000-7062473000 rw-p 00040000 fc:00 2603                           /system/lib64/libexif.so
-7062474000-7062490000 r--s 00000000 fc:00 286                            /system/fonts/NotoSansMongolian-Regular.ttf
-7062490000-7062491000 r-xp 00000000 fc:00 2357                           /system/lib64/libasyncio.so
-7062491000-70624af000 ---p 00000000 00:00 0 
-70624af000-70624b0000 r--p 0000f000 fc:00 2357                           /system/lib64/libasyncio.so
-70624b0000-70624b1000 rw-p 00010000 fc:00 2357                           /system/lib64/libasyncio.so
-70624b5000-70624cf000 r--s 00000000 fc:00 221                            /system/fonts/NotoSansMyanmarUI-Bold.ttf
-70624cf000-7062508000 r-xp 00000000 fc:00 2401                           /system/lib64/libmtp.so
-7062508000-7062522000 ---p 00000000 00:00 0 
-7062522000-7062525000 r--p 0003d000 fc:00 2401                           /system/lib64/libmtp.so
-7062525000-706252c000 rw-p 00040000 fc:00 2401                           /system/lib64/libmtp.so
-7062530000-7062550000 rw-p 00000000 00:05 10269728                       [anon:dalvik-CompilerMetadata]
-7062550000-7062572000 r--s 00000000 fc:00 234                            /system/fonts/NotoSerifMyanmar-Regular.otf
-7062572000-706259e000 r-xp 00000000 fc:00 2620                           /system/lib64/libmediandk.so
-706259e000-70625b9000 ---p 00000000 00:00 0 
-70625b9000-70625bc000 r--p 0002d000 fc:00 2620                           /system/lib64/libmediandk.so
-70625bc000-70625c0000 rw-p 00030000 fc:00 2620                           /system/lib64/libmediandk.so
-70625c2000-70625d1000 r-xp 00000000 fc:00 2613                           /system/lib64/libmidi.so
-70625d1000-70625ef000 ---p 00000000 00:00 0 
-70625ef000-70625f1000 r--p 0000e000 fc:00 2613                           /system/lib64/libmidi.so
-70625f1000-70625f2000 rw-p 00010000 fc:00 2613                           /system/lib64/libmidi.so
-7062600000-7062621000 r-xp 00000000 fc:00 2366                           /system/lib64/libmediadrmmetrics_lite.so
-7062621000-706263d000 ---p 00000000 00:00 0 
-706263d000-706263f000 r--p 0002e000 fc:00 2366                           /system/lib64/libmediadrmmetrics_lite.so
-706263f000-7062640000 rw-p 00030000 fc:00 2366                           /system/lib64/libmediadrmmetrics_lite.so
-706264b000-706266b000 rw-p 00000000 00:05 10269727                       [anon:dalvik-CompilerMetadata]
-706266b000-70626d4000 r-xp 00000000 fc:00 2727                           /system/lib64/libmedia_jni.so
-70626d4000-70626eb000 ---p 00000000 00:00 0 
-70626eb000-70626f2000 r--p 00069000 fc:00 2727                           /system/lib64/libmedia_jni.so
-70626f2000-70626f3000 rw-p 00070000 fc:00 2727                           /system/lib64/libmedia_jni.so
-7062703000-7062732000 r-xp 00000000 fc:00 2399                           /system/lib64/libcamera2ndk.so
-7062732000-7062748000 ---p 00000000 00:00 0 
-7062748000-706274b000 r--p 0003d000 fc:00 2399                           /system/lib64/libcamera2ndk.so
-706274b000-7062750000 rw-p 00040000 fc:00 2399                           /system/lib64/libcamera2ndk.so
-7062768000-7062788000 rw-p 00000000 00:05 10269726                       [anon:dalvik-CompilerMetadata]
-7062788000-70627ee000 r-xp 00000000 fc:00 2974                           /system/lib64/android.hardware.drm@1.0.so
-70627ee000-7062805000 ---p 00000000 00:00 0 
-7062805000-706280d000 r--p 00068000 fc:00 2974                           /system/lib64/android.hardware.drm@1.0.so
-706280d000-706280e000 rw-p 00070000 fc:00 2974                           /system/lib64/android.hardware.drm@1.0.so
-706281a000-706281b000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-706281b000-706281f000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-706281f000-7062843000 r--s 00000000 fc:00 142                            /system/fonts/NotoSansKhmer-VF.ttf
-7062843000-7062886000 r-xp 00000000 fc:00 2637                           /system/lib64/android.hardware.drm@1.1.so
-7062886000-70628a5000 ---p 00000000 00:00 0 
-70628a5000-70628ab000 r--p 0004a000 fc:00 2637                           /system/lib64/android.hardware.drm@1.1.so
-70628ab000-70628ac000 rw-p 00050000 fc:00 2637                           /system/lib64/android.hardware.drm@1.1.so
-70628b0000-70628b1000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70628b1000-70628b5000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70628b5000-70628db000 r--s 00000000 fc:00 137                            /system/fonts/NotoSansSinhala-Bold.ttf
-70628db000-7062907000 r-xp 00000000 fc:00 2478                           /system/lib64/libmediadrm.so
-7062907000-7062918000 ---p 00000000 00:00 0 
-7062918000-7062920000 r--p 00038000 fc:00 2478                           /system/lib64/libmediadrm.so
-7062920000-7062921000 rw-p 00040000 fc:00 2478                           /system/lib64/libmediadrm.so
-7062922000-7062929000 rw-p 00000000 fc:00 583                            /system/etc/event-log-tags
-7062929000-7062951000 r--s 00000000 fc:00 296                            /system/fonts/NotoSansSinhala-Regular.ttf
-7062951000-7062997000 r-xp 00000000 fc:00 2448                           /system/lib64/libaaudio.so
-7062997000-70629ac000 ---p 00000000 00:00 0 
-70629ac000-70629b2000 r--p 0004a000 fc:00 2448                           /system/lib64/libaaudio.so
-70629b2000-70629ba000 rw-p 00050000 fc:00 2448                           /system/lib64/libaaudio.so
-70629ba000-70629bb000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70629bb000-70629bf000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70629bf000-70629c0000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70629c0000-70629c3000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70629c3000-70629c4000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70629c4000-70629c5000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70629c5000-70629c9000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70629c9000-70629e3000 r-xp 00000000 fc:00 2940                           /system/lib64/libandroid.so
-70629e3000-70629f3000 ---p 00000000 00:00 0 
-70629f3000-70629f6000 r--p 0001d000 fc:00 2940                           /system/lib64/libandroid.so
-70629f6000-70629f7000 rw-p 00020000 fc:00 2940                           /system/lib64/libandroid.so
-70629f8000-70629f9000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70629f9000-70629fc000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70629fc000-70629fd000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70629fd000-7062a3e000 r--s 00000000 fc:00 216                            /system/fonts/NotoSerif-BoldItalic.ttf
-7062a3e000-7062b06000 rw-p 00000000 00:05 10270984                       [anon:dalvik-indirect ref table]
-7062b06000-7062bce000 rw-p 00000000 00:05 10270983                       [anon:dalvik-indirect ref table]
-7062bce000-7062dce000 rw-p 00000000 00:05 10270726                       [anon:dalvik-rb copying gc mark stack]
-7062dce000-70635ce000 rw-p 00000000 00:05 10270725                       [anon:dalvik-concurrent copying gc mark stack]
-70635ce000-7063dcf000 rw-p 00000000 00:05 10270724                       [anon:dalvik-live stack]
-7063dcf000-70645d0000 rw-p 00000000 00:05 10270723                       [anon:dalvik-allocation stack]
-70645d0000-70649d1000 rw-p 00000000 00:05 10270721                       [anon:dalvik-card table]
-70649d1000-7064ad1000 rw-p 00000000 00:05 10267648                       [anon:dalvik-large object free list space allocation info map]
-7064ad1000-7065ad1000 rw-p 00000000 00:05 10267644                       [anon:dalvik-region space live bitmap]
-7065ad1000-7065bd1000 rw-p 00000000 00:05 10267642                       [anon:dalvik-allocspace zygote / non moving space mark-bitmap 0]
-7065bd1000-7065cd1000 rw-p 00000000 00:05 10267641                       [anon:dalvik-allocspace zygote / non moving space live-bitmap 0]
-7065cd1000-7065cd2000 r-xp 00000000 fc:00 2946                           /system/lib64/libsigchain.so
-7065cd2000-7065cf0000 ---p 00000000 00:00 0 
-7065cf0000-7065cf1000 r--p 0000f000 fc:00 2946                           /system/lib64/libsigchain.so
-7065cf1000-7065cf2000 rw-p 00010000 fc:00 2946                           /system/lib64/libsigchain.so
-7065cf4000-7065d0f000 r--s 00000000 fc:00 190                            /system/fonts/NotoSansMyanmar-Bold.ttf
-7065d0f000-7065d22000 r-xp 00000000 fc:00 2405                           /system/lib64/liblz4.so
-7065d22000-7065d3e000 ---p 00000000 00:00 0 
-7065d3e000-7065d3f000 r--p 0001f000 fc:00 2405                           /system/lib64/liblz4.so
-7065d3f000-7065d40000 rw-p 00020000 fc:00 2405                           /system/lib64/liblz4.so
-7065d40000-7065d5a000 r--s 00000000 fc:00 222                            /system/fonts/NotoSansMyanmarUI-Regular.ttf
-7065d5a000-7065d5e000 r-xp 00000000 fc:00 2609                           /system/lib64/libtombstoned_client.so
-7065d5e000-7065d79000 ---p 00000000 00:00 0 
-7065d79000-7065d7a000 r--p 0000f000 fc:00 2609                           /system/lib64/libtombstoned_client.so
-7065d7a000-7065d7b000 rw-p 00010000 fc:00 2609                           /system/lib64/libtombstoned_client.so
-7065d7f000-7065d80000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-7065d80000-7065d84000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-7065d84000-706636e000 r-xp 00000000 fc:00 2671                           /system/lib64/libart.so
-706636e000-706638d000 ---p 00000000 00:00 0 
-706638d000-706639e000 r--p 005ef000 fc:00 2671                           /system/lib64/libart.so
-706639e000-70663a1000 rw-p 00600000 fc:00 2671                           /system/lib64/libart.so
-70663a1000-70663a4000 rw-p 00000000 00:00 0                              [anon:.bss]
-70663a6000-70663c6000 rw-p 00000000 00:05 10269725                       [anon:dalvik-CompilerMetadata]
-70663c6000-70663c8000 r-xp 00000000 fc:00 2673                           /system/lib64/libmetricslogger.so
-70663c8000-70663e5000 ---p 00000000 00:00 0 
-70663e5000-70663e6000 r--p 0000f000 fc:00 2673                           /system/lib64/libmetricslogger.so
-70663e6000-70663e7000 rw-p 00010000 fc:00 2673                           /system/lib64/libmetricslogger.so
-70663e7000-7066400000 r--s 00000000 fc:00 110                            /system/fonts/NotoSansLepcha-Regular.ttf
-7066400000-7066800000 rw-p 00000000 00:00 0                              [anon:libc_malloc]
-7066803000-706681e000 r--s 00000000 fc:00 297                            /system/fonts/NotoSansMyanmar-Regular.ttf
-706681e000-7066821000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066821000-7066822000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066822000-7066b1d000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066b1d000-7066b1e000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066b1e000-7066ba0000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066ba0000-7066ba1000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066ba1000-7066ba2000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066ba2000-7066ba5000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066ba5000-7066ba6000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-7066ba6000-70e681e000 r--p 00000000 00:00 0                              [anon:cfi shadow]
-70e681e000-70e6854000 r-xp 00000000 fc:00 2431                           /system/lib64/libstagefright_foundation.so
-70e6854000-70e6865000 ---p 00000000 00:00 0 
-70e6865000-70e6867000 r--p 0003e000 fc:00 2431                           /system/lib64/libstagefright_foundation.so
-70e6867000-70e686c000 rw-p 00040000 fc:00 2431                           /system/lib64/libstagefright_foundation.so
-70e686d000-70e686e000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e686e000-70e6871000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70e6871000-70e6873000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e6873000-70e6876000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70e6876000-70e6877000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e6877000-70e688c000 r--s 00000000 fc:00 301                            /system/fonts/NotoSansSinhalaUI-Bold.otf
-70e688c000-70e688e000 r-xp 00000000 fc:00 2943                           /system/lib64/libion.so
-70e688e000-70e68ab000 ---p 00000000 00:00 0 
-70e68ab000-70e68ac000 r--p 0000f000 fc:00 2943                           /system/lib64/libion.so
-70e68ac000-70e68ad000 rw-p 00010000 fc:00 2943                           /system/lib64/libion.so
-70e68ad000-70e68af000 rw-p 00000000 00:05 10282496                       [anon:dalvik-indirect ref table]
-70e68af000-70e68b1000 rw-p 00000000 00:05 10282493                       [anon:dalvik-indirect ref table]
-70e68b1000-70e68ee000 r--s 00000000 fc:00 256                            /system/fonts/NotoSerif-Italic.ttf
-70e68ee000-70e6910000 r-xp 00000000 fc:00 2502                           /system/lib64/libhidlbase.so
-70e6910000-70e692c000 ---p 00000000 00:00 0 
-70e692c000-70e692e000 r--p 0002e000 fc:00 2502                           /system/lib64/libhidlbase.so
-70e692e000-70e692f000 rw-p 00030000 fc:00 2502                           /system/lib64/libhidlbase.so
-70e6930000-70e693f000 r--s 00000000 fc:00 1082                           /system/usr/hyphen-data/hyph-en-us.hyb
-70e693f000-70e6954000 r--s 00000000 fc:00 138                            /system/fonts/NotoSansSinhalaUI-Regular.otf
-70e6954000-70e6978000 r-xp 00000000 fc:00 2482                           /system/lib64/libui.so
-70e6978000-70e6992000 ---p 00000000 00:00 0 
-70e6992000-70e6994000 r--p 0002e000 fc:00 2482                           /system/lib64/libui.so
-70e6994000-70e6995000 rw-p 00030000 fc:00 2482                           /system/lib64/libui.so
-70e6996000-70e69a2000 r--s 00000000 fc:00 1117                           /system/usr/hyphen-data/hyph-en-gb.hyb
-70e69a2000-70e69b7000 r--s 00000000 fc:00 202                            /system/fonts/NotoSerifSinhala-Bold.otf
-70e69b7000-70e69cb000 r--s 00000000 fc:00 124                            /system/fonts/NotoSansOriyaUI-Bold.ttf
-70e69cb000-70e69e1000 r-xp 00000000 fc:00 2537                           /system/lib64/liblog.so
-70e69e1000-70e69fa000 ---p 00000000 00:00 0 
-70e69fa000-70e69fb000 r--p 0001f000 fc:00 2537                           /system/lib64/liblog.so
-70e69fb000-70e69fc000 rw-p 00020000 fc:00 2537                           /system/lib64/liblog.so
-70e69fc000-70e69fe000 rw-p 00000000 00:05 10266158                       [anon:dalvik-indirect ref table]
-70e69fe000-70e69ff000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e69ff000-70e6a02000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70e6a02000-70e6a03000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e6a03000-70e6a05000 r-xp 00000000 fc:00 2489                           /system/lib64/android.hidl.token@1.0-utils.so
-70e6a05000-70e6a22000 ---p 00000000 00:00 0 
-70e6a22000-70e6a23000 r--p 0000f000 fc:00 2489                           /system/lib64/android.hidl.token@1.0-utils.so
-70e6a23000-70e6a24000 rw-p 00010000 fc:00 2489                           /system/lib64/android.hidl.token@1.0-utils.so
-70e6a25000-70e6a2e000 r--s 00000000 fc:00 1120                           /system/usr/hyphen-data/hyph-ga.hyb
-70e6a2e000-70e6a42000 r--s 00000000 fc:00 109                            /system/fonts/NotoSansOriyaUI-Regular.ttf
-70e6a42000-70e6a59000 r-xp 00000000 fc:00 2446                           /system/lib64/android.hardware.graphics.mapper@2.0.so
-70e6a59000-70e6a6e000 ---p 00000000 00:00 0 
-70e6a6e000-70e6a70000 r--p 0001e000 fc:00 2446                           /system/lib64/android.hardware.graphics.mapper@2.0.so
-70e6a70000-70e6a71000 rw-p 00020000 fc:00 2446                           /system/lib64/android.hardware.graphics.mapper@2.0.so
-70e6a72000-70e6a78000 r--s 00000000 fc:00 1084                           /system/usr/hyphen-data/hyph-et.hyb
-70e6a78000-70e6a9d000 r--s 00000000 fc:00 207                            /system/fonts/NotoSerifTelugu-Bold.ttf
-70e6a9d000-70e6a9f000 r-xp 00000000 fc:00 2330                           /system/lib64/android.hardware.configstore-utils.so
-70e6a9f000-70e6abc000 ---p 00000000 00:00 0 
-70e6abc000-70e6abd000 r--p 0000f000 fc:00 2330                           /system/lib64/android.hardware.configstore-utils.so
-70e6abd000-70e6abe000 rw-p 00010000 fc:00 2330                           /system/lib64/android.hardware.configstore-utils.so
-70e6abe000-70e6ac0000 r--s f8042000 00:10 20630                          /dev/kgsl-3d0
-70e6ac0000-70e6adc000 r--s 00000000 fc:00 172                            /system/fonts/NotoSansTeluguUI-Bold.ttf
-70e6adc000-70e6ae0000 r-xp 00000000 fc:00 2555                           /system/lib64/libstagefright_omx_utils.so
-70e6ae0000-70e6afb000 ---p 00000000 00:00 0 
-70e6afb000-70e6afc000 r--p 0000f000 fc:00 2555                           /system/lib64/libstagefright_omx_utils.so
-70e6afc000-70e6afd000 rw-p 00010000 fc:00 2555                           /system/lib64/libstagefright_omx_utils.so
-70e6afd000-70e6afe000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70e6afe000-70e6b02000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70e6b02000-70e6b27000 r--s 00000000 fc:00 271                            /system/fonts/NotoSerifTelugu-Regular.ttf
-70e6b27000-70e6b61000 r-xp 00000000 fc:00 2695                           /system/lib64/libdexfile.so
-70e6b61000-70e6b73000 ---p 00000000 00:00 0 
-70e6b73000-70e6b75000 r--p 0003e000 fc:00 2695                           /system/lib64/libdexfile.so
-70e6b75000-70e6b76000 rw-p 00040000 fc:00 2695                           /system/lib64/libdexfile.so
-70e6b76000-70e6b78000 rw-p 00000000 00:05 10253452                       [anon:dalvik-indirect ref table]
-70e6b78000-70e6b85000 r--s 00000000 fc:00 1080                           /system/usr/hyphen-data/hyph-cu.hyb
-70e6b85000-70e6b96000 r-xp 00000000 fc:00 2957                           /system/lib64/libaudioutils.so
-70e6b96000-70e6bb4000 ---p 00000000 00:00 0 
-70e6bb4000-70e6bb5000 r--p 0001f000 fc:00 2957                           /system/lib64/libaudioutils.so
-70e6bb5000-70e6bb6000 rw-p 00020000 fc:00 2957                           /system/lib64/libaudioutils.so
-70e6bb6000-70e6bb7000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e6bb7000-70e6bba000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70e6bba000-70e6bbb000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70e6bbb000-70e6bd7000 r--s 00000000 fc:00 132                            /system/fonts/NotoSansTeluguUI-Regular.ttf
-70e6bd7000-70e6bdc000 r-xp 00000000 fc:00 2409                           /system/lib64/libprocessgroup.so
-70e6bdc000-70e6bf6000 ---p 00000000 00:00 0 
-70e6bf6000-70e6bf7000 r--p 0000f000 fc:00 2409                           /system/lib64/libprocessgroup.so
-70e6bf7000-70e6bf8000 rw-p 00010000 fc:00 2409                           /system/lib64/libprocessgroup.so
-70e6bf8000-70e6c09000 r--s 00000000 fc:00 79                             /system/fonts/NotoSansNewa-Regular.otf
-70e6c09000-70e6c1c000 r-xp 00000000 fc:00 2329                           /system/lib64/android.hidl.memory.token@1.0.so
-70e6c1c000-70e6c36000 ---p 00000000 00:00 0 
-70e6c36000-70e6c38000 r--p 0001e000 fc:00 2329                           /system/lib64/android.hidl.memory.token@1.0.so
-70e6c38000-70e6c39000 rw-p 00020000 fc:00 2329                           /system/lib64/android.hidl.memory.token@1.0.so
-70e6c3a000-70e6c4f000 r--s 00000000 fc:00 253                            /system/fonts/NotoSansOriya-Bold.ttf
-70e6c4f000-70e6c6b000 r-xp 00000000 fc:00 2407                           /system/lib64/libutils.so
-70e6c6b000-70e6c7e000 ---p 00000000 00:00 0 
-70e6c7e000-70e6c7f000 r--p 0001f000 fc:00 2407                           /system/lib64/libutils.so
-70e6c7f000-70e6c80000 rw-p 00020000 fc:00 2407                           /system/lib64/libutils.so
-70e6c80000-70e6c9d000 r-xp 00000000 fc:00 2934                           /system/lib64/libtinyxml2.so
-70e6c9d000-70e6cba000 ---p 00000000 00:00 0 
-70e6cba000-70e6cbc000 r--p 0001e000 fc:00 2934                           /system/lib64/libtinyxml2.so
-70e6cbc000-70e6cbf000 rw-p 00020000 fc:00 2934                           /system/lib64/libtinyxml2.so
-70e6cbf000-70e6ccf000 r--s 00000000 fc:00 80                             /system/fonts/NotoSansMarchen-Regular.otf
-70e6ccf000-70e6ce0000 r-xp 00000000 fc:00 2655                           /system/lib64/libbase.so
-70e6ce0000-70e6cfe000 ---p 00000000 00:00 0 
-70e6cfe000-70e6cff000 r--p 0001f000 fc:00 2655                           /system/lib64/libbase.so
-70e6cff000-70e6d00000 rw-p 00020000 fc:00 2655                           /system/lib64/libbase.so
-70e6d00000-70e6d09000 r--s 00000000 fc:00 1113                           /system/usr/hyphen-data/hyph-cy.hyb
-70e6d09000-70e6d50000 r-xp 00000000 fc:00 2495                           /system/lib64/libRScpp.so
-70e6d50000-70e6d68000 ---p 00000000 00:00 0 
-70e6d68000-70e6d69000 r--p 0004f000 fc:00 2495                           /system/lib64/libRScpp.so
-70e6d69000-70e6d6a000 rw-p 00050000 fc:00 2495                           /system/lib64/libRScpp.so
-70e6d6b000-70e6d6d000 r--s 00088000 103:1d 1736830                       /data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/base.apk
-70e6d6d000-70e6d7d000 r--s 00000000 fc:00 238                            /system/fonts/NotoSansVai-Regular.ttf
-70e6d7d000-70e6d98000 r--s 00000000 fc:00 276                            /system/fonts/NotoSansTelugu-Bold.ttf
-70e6d98000-70e6f2b000 r-xp 00000000 fc:00 2961                           /system/lib64/libicuuc.so
-70e6f2b000-70e6f47000 ---p 00000000 00:00 0 
-70e6f47000-70e6f5c000 r--p 0019b000 fc:00 2961                           /system/lib64/libicuuc.so
-70e6f5c000-70e6f5d000 rw-p 001b0000 fc:00 2961                           /system/lib64/libicuuc.so
-70e6f5d000-70e6f5e000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e6f5f000-70e6f68000 r--s 00000000 fc:00 159                            /system/fonts/NotoSansLinearA-Regular.otf
-70e6f68000-70e6f84000 r--s 00000000 fc:00 170                            /system/fonts/NotoSansTelugu-Regular.ttf
-70e6f84000-70e7058000 r-xp 00000000 fc:00 2356                           /system/lib64/libc.so
-70e7058000-70e706e000 ---p 00000000 00:00 0 
-70e706e000-70e7074000 r--p 000da000 fc:00 2356                           /system/lib64/libc.so
-70e7074000-70e7076000 rw-p 000e0000 fc:00 2356                           /system/lib64/libc.so
-70e7076000-70e7077000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e7077000-70e7078000 r--p 00000000 00:00 0                              [anon:.bss]
-70e7078000-70e7080000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e7080000-70e7087000 r--s 00000000 fc:00 102                            /system/fonts/NotoSansSharada-Regular.otf
-70e7087000-70e708e000 r-xp 00000000 fc:00 2378                           /system/lib64/libheif.so
-70e708e000-70e70a4000 ---p 00000000 00:00 0 
-70e70a4000-70e70a6000 r--p 0000e000 fc:00 2378                           /system/lib64/libheif.so
-70e70a6000-70e70a7000 rw-p 00010000 fc:00 2378                           /system/lib64/libheif.so
-70e70a7000-70e70a9000 r--s 00000000 fc:00 1116                           /system/usr/hyphen-data/hyph-sl.hyb
-70e70a9000-70e70ab000 r--s 00000000 fc:00 1147                           /system/usr/hyphen-data/hyph-mn-cyrl.hyb
-70e70ab000-70e70c5000 r--s 00000000 fc:00 291                            /system/fonts/NotoSansBengaliUI-Bold.ttf
-70e70c5000-70e70ea000 r-xp 00000000 fc:00 2545                           /system/lib64/libEGL.so
-70e70ea000-70e7109000 ---p 00000000 00:00 0 
-70e7109000-70e710d000 r--p 0002c000 fc:00 2545                           /system/lib64/libEGL.so
-70e710d000-70e710e000 rw-p 00030000 fc:00 2545                           /system/lib64/libEGL.so
-70e710e000-70e7115000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e7115000-70e7119000 r--s 00000000 fc:00 1143                           /system/usr/hyphen-data/hyph-es.hyb
-70e7119000-70e712e000 r--s 00000000 fc:00 71                             /system/fonts/NotoSansOriya-Regular.ttf
-70e712e000-70e717a000 r--s 00000000 fc:00 272                            /system/fonts/Roboto-Thin.ttf
-70e717a000-70e71db000 r-xp 00000000 fc:00 2393                           /system/lib64/libpdx_default_transport.so
-70e71db000-70e71f7000 ---p 00000000 00:00 0 
-70e71f7000-70e71f9000 r--p 0006e000 fc:00 2393                           /system/lib64/libpdx_default_transport.so
-70e71f9000-70e71fa000 rw-p 00070000 fc:00 2393                           /system/lib64/libpdx_default_transport.so
-70e71fa000-70e71fb000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e71fc000-70e71fe000 r--s 00000000 fc:00 1107                           /system/usr/hyphen-data/hyph-fr.hyb
-70e71fe000-70e7200000 r--s 00000000 fc:00 1097                           /system/usr/hyphen-data/hyph-da.hyb
-70e7200000-70e7223000 r-xp 00000000 fc:00 2380                           /system/lib64/libminikin.so
-70e7223000-70e723e000 ---p 00000000 00:00 0 
-70e723e000-70e723f000 r--p 0002f000 fc:00 2380                           /system/lib64/libminikin.so
-70e723f000-70e7240000 rw-p 00030000 fc:00 2380                           /system/lib64/libminikin.so
-70e7241000-70e724d000 r--s 00000000 fc:00 179                            /system/fonts/NotoSansTaiTham-Regular.ttf
-70e724d000-70e725c000 r-xp 00000000 fc:00 2527                           /system/lib64/libmediautils.so
-70e725c000-70e7279000 ---p 00000000 00:00 0 
-70e7279000-70e727b000 r--p 0001e000 fc:00 2527                           /system/lib64/libmediautils.so
-70e727b000-70e727c000 rw-p 00020000 fc:00 2527                           /system/lib64/libmediautils.so
-70e727d000-70e7283000 r--s 00000000 fc:00 136                            /system/fonts/NotoSansMiao-Regular.otf
-70e7283000-70e74d2000 r-xp 00000000 fc:00 2349                           /system/lib64/libicui18n.so
-70e74d2000-70e74e6000 ---p 00000000 00:00 0 
-70e74e6000-70e74fa000 r--p 0025c000 fc:00 2349                           /system/lib64/libicui18n.so
-70e74fa000-70e74fb000 rw-p 00270000 fc:00 2349                           /system/lib64/libicui18n.so
-70e74fc000-70e74ff000 r--s 00000000 103:1d 1474562                       /data/resource-cache/vendor@overlay@framework-res__auto_generated_rro.apk@idmap
-70e74ff000-70e750c000 r--s 00000000 fc:00 126                            /system/fonts/NotoSansSyriacWestern-Regular.ttf
-70e750c000-70e751b000 r-xp 00000000 fc:00 2466                           /system/lib64/libmediaextractor.so
-70e751b000-70e753a000 ---p 00000000 00:00 0 
-70e753a000-70e753b000 r--p 0000f000 fc:00 2466                           /system/lib64/libmediaextractor.so
-70e753b000-70e753c000 rw-p 00010000 fc:00 2466                           /system/lib64/libmediaextractor.so
-70e753d000-70e7540000 r--s 00000000 fc:00 107                            /system/fonts/NotoSansPauCinHau-Regular.otf
-70e7540000-70e7593000 r-xp 00000000 fc:00 2363                           /system/lib64/libandroidfw.so
-70e7593000-70e75ac000 ---p 00000000 00:00 0 
-70e75ac000-70e75af000 r--p 0005d000 fc:00 2363                           /system/lib64/libandroidfw.so
-70e75af000-70e75b0000 rw-p 00060000 fc:00 2363                           /system/lib64/libandroidfw.so
-70e75b0000-70e75b2000 r--s 00000000 fc:00 1083                           /system/usr/hyphen-data/hyph-be.hyb
-70e75b2000-70e75cd000 r--s 00000000 fc:00 270                            /system/fonts/NotoSansBengaliUI-Regular.ttf
-70e75cd000-70e75cf000 r-xp 00000000 fc:00 2701                           /system/lib64/libmemtrack.so
-70e75cf000-70e75ec000 ---p 00000000 00:00 0 
-70e75ec000-70e75ed000 r--p 0000f000 fc:00 2701                           /system/lib64/libmemtrack.so
-70e75ed000-70e75ee000 rw-p 00010000 fc:00 2701                           /system/lib64/libmemtrack.so
-70e75ee000-70e75f0000 r--s 00000000 fc:00 209                            /system/fonts/NotoSansSoraSompeng-Regular.otf
-70e75f0000-70e760d000 r--s 00000000 fc:00 243                            /system/fonts/NotoSerifBengali-Bold.ttf
-70e760d000-70e7613000 r-xp 00000000 fc:00 2667                           /system/lib64/libutilscallstack.so
-70e7613000-70e762c000 ---p 00000000 00:00 0 
-70e762c000-70e762d000 r--p 0000f000 fc:00 2667                           /system/lib64/libutilscallstack.so
-70e762d000-70e762e000 rw-p 00010000 fc:00 2667                           /system/lib64/libutilscallstack.so
-70e762e000-70e7632000 r--s 00000000 fc:00 99                             /system/fonts/NotoSansPahawhHmong-Regular.otf
-70e7632000-70e764f000 r--s 00000000 fc:00 205                            /system/fonts/NotoSerifBengali-Regular.ttf
-70e764f000-70e7661000 r-xp 00000000 fc:00 2710                           /system/lib64/libcutils.so
-70e7661000-70e767d000 ---p 00000000 00:00 0 
-70e767d000-70e767f000 r--p 0001e000 fc:00 2710                           /system/lib64/libcutils.so
-70e767f000-70e7680000 rw-p 00020000 fc:00 2710                           /system/lib64/libcutils.so
-70e7680000-70e7683000 r--s 00000000 fc:00 257                            /system/fonts/NotoSansPalmyrene-Regular.otf
-70e7683000-70e7697000 r--s 00000000 fc:00 78                             /system/fonts/NotoSansKannadaUI-Bold.ttf
-70e7697000-70e769a000 r-xp 00000000 fc:00 2362                           /system/lib64/libstagefright_http_support.so
-70e769a000-70e76b6000 ---p 00000000 00:00 0 
-70e76b6000-70e76b7000 r--p 0000f000 fc:00 2362                           /system/lib64/libstagefright_http_support.so
-70e76b7000-70e76b8000 rw-p 00010000 fc:00 2362                           /system/lib64/libstagefright_http_support.so
-70e76b8000-70e76b9000 rw-p 00000000 00:00 0                              [anon:linker_alloc_lob]
-70e76b9000-70e76be000 r--s 00000000 fc:00 165                            /system/fonts/NotoSansMeroitic-Regular.otf
-70e76be000-70e76cb000 r--s 00000000 fc:00 112                            /system/fonts/NotoSansSyriacEastern-Regular.ttf
-70e76cb000-70e76de000 r-xp 00000000 fc:00 2343                           /system/lib64/libsensor.so
-70e76de000-70e76f5000 ---p 00000000 00:00 0 
-70e76f5000-70e76f8000 r--p 0001d000 fc:00 2343                           /system/lib64/libsensor.so
-70e76f8000-70e76f9000 rw-p 00020000 fc:00 2343                           /system/lib64/libsensor.so
-70e76f9000-70e76fc000 r--s 00000000 fc:00 157                            /system/fonts/NotoSansOldPermic-Regular.otf
-70e76fc000-70e7708000 r--s 00000000 fc:00 189                            /system/fonts/NotoSansSyriacEstrangela-Regular.ttf
-70e7708000-70e771d000 r-xp 00000000 fc:00 2339                           /system/lib64/android.hidl.token@1.0.so
-70e771d000-70e7735000 ---p 00000000 00:00 0 
-70e7735000-70e7737000 r--p 0001e000 fc:00 2339                           /system/lib64/android.hidl.token@1.0.so
-70e7737000-70e7738000 rw-p 00020000 fc:00 2339                           /system/lib64/android.hidl.token@1.0.so
-70e7738000-70e7739000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70e7739000-70e773b000 r--s 00000000 fc:00 267                            /system/fonts/NotoSansOldNorthArabian-Regular.otf
-70e773b000-70e7740000 r--s 00000000 fc:00 208                            /system/fonts/NotoSansManichaean-Regular.otf
-70e7740000-70e775c000 r--s 00000000 fc:00 118                            /system/fonts/NotoSansGujaratiUI-Bold.ttf
-70e775c000-70e7767000 r-xp 00000000 fc:00 2525                           /system/lib64/libappfuse.so
-70e7767000-70e777b000 ---p 00000000 00:00 0 
-70e777b000-70e777c000 r--p 0000f000 fc:00 2525                           /system/lib64/libappfuse.so
-70e777c000-70e777d000 rw-p 00010000 fc:00 2525                           /system/lib64/libappfuse.so
-70e777e000-70e7795000 r--s 00000000 fc:00 250                            /system/fonts/NotoSerifKannada-Bold.ttf
-70e7795000-70e7798000 r-xp 00000000 fc:00 2413                           /system/lib64/libpackagelistparser.so
-70e7798000-70e77b4000 ---p 00000000 00:00 0 
-70e77b4000-70e77b5000 r--p 0000f000 fc:00 2413                           /system/lib64/libpackagelistparser.so
-70e77b5000-70e77b6000 rw-p 00010000 fc:00 2413                           /system/lib64/libpackagelistparser.so
-70e77b6000-70e77b8000 r--s 00000000 fc:00 147                            /system/fonts/NotoSansNabataean-Regular.otf
-70e77b8000-70e77ba000 r--s 00000000 fc:00 146                            /system/fonts/NotoSansMultani-Regular.otf
-70e77ba000-70e77c1000 r--s 00000000 fc:00 214                            /system/fonts/NotoSansPhagsPa-Regular.ttf
-70e77c1000-70e77de000 r--s 00000000 fc:00 90                             /system/fonts/NotoSansGujaratiUI-Regular.ttf
-70e77de000-70e77e0000 r-xp 00000000 fc:00 2430                           /system/lib64/libdl.so
-70e77e0000-70e77fd000 ---p 00000000 00:00 0 
-70e77fd000-70e77fe000 r--p 0000f000 fc:00 2430                           /system/lib64/libdl.so
-70e77fe000-70e77ff000 r--p 00000000 00:00 0                              [anon:.bss]
-70e7800000-70e7809000 r--s 00000000 fc:00 258                            /system/fonts/NotoSansSymbols-Regular-Subsetted2.ttf
-70e7809000-70e7857000 r-xp 00000000 fc:00 2560                           /system/lib64/libjpeg.so
-70e7857000-70e7868000 ---p 00000000 00:00 0 
-70e7868000-70e7869000 r--p 0004f000 fc:00 2560                           /system/lib64/libjpeg.so
-70e7869000-70e786a000 rw-p 00050000 fc:00 2560                           /system/lib64/libjpeg.so
-70e786a000-70e7887000 r--s 00000000 fc:00 237                            /system/fonts/NotoSansGujarati-Bold.ttf
-70e7887000-70e788a000 r-xp 00000000 fc:00 2608                           /system/lib64/libnetd_client.so
-70e788a000-70e78a6000 ---p 00000000 00:00 0 
-70e78a6000-70e78a7000 r--p 0000f000 fc:00 2608                           /system/lib64/libnetd_client.so
-70e78a7000-70e78a8000 rw-p 00010000 fc:00 2608                           /system/lib64/libnetd_client.so
-70e78a8000-70e78aa000 r--s 00000000 fc:00 290                            /system/fonts/NotoSansMro-Regular.otf
-70e78aa000-70e78b9000 r--s 00000000 fc:00 84                             /system/fonts/NotoSansLinearB-Regular.ttf
-70e78b9000-70e78d7000 r--s 00000000 fc:00 287                            /system/fonts/NotoSansGujarati-Regular.ttf
-70e78d7000-70e78d8000 r-xp 00000000 fc:00 2651                           /system/lib64/libvndksupport.so
-70e78d8000-70e78f6000 ---p 00000000 00:00 0 
-70e78f6000-70e78f7000 r--p 0000f000 fc:00 2651                           /system/lib64/libvndksupport.so
-70e78f7000-70e78f8000 rw-p 00010000 fc:00 2651                           /system/lib64/libvndksupport.so
-70e78f9000-70e78fc000 r--s 00000000 fc:00 178                            /system/fonts/NotoSansTaiLe-Regular.ttf
-70e78fc000-70e7900000 r--s 00000000 fc:00 163                            /system/fonts/NotoSansTifinagh-Regular.ttf
-70e7900000-70e7906000 r-xp 00000000 fc:00 2659                           /system/lib64/libnativeloader.so
-70e7906000-70e791f000 ---p 00000000 00:00 0 
-70e791f000-70e7920000 r--p 0000f000 fc:00 2659                           /system/lib64/libnativeloader.so
-70e7920000-70e7921000 rw-p 00010000 fc:00 2659                           /system/lib64/libnativeloader.so
-70e7921000-70e7923000 r--s 00000000 fc:00 268                            /system/fonts/NotoSansHatran-Regular.otf
-70e7923000-70e7927000 r--s 00000000 fc:00 195                            /system/fonts/NotoSansTaiViet-Regular.ttf
-70e7927000-70e7945000 r--s 00000000 fc:00 139                            /system/fonts/NotoSansDevanagariUI-Bold.ttf
-70e7945000-70e79a3000 r-xp 00000000 fc:00 2450                           /system/lib64/libharfbuzz_ng.so
-70e79a3000-70e79b3000 ---p 00000000 00:00 0 
-70e79b3000-70e79b5000 r--p 0005e000 fc:00 2450                           /system/lib64/libharfbuzz_ng.so
-70e79b5000-70e79b6000 rw-p 00060000 fc:00 2450                           /system/lib64/libharfbuzz_ng.so
-70e79b6000-70e79c5000 r--s 00000000 fc:00 111                            /system/fonts/NotoSansKaithi-Regular.ttf
-70e79c5000-70e7a92000 r-xp 00000000 fc:00 2332                           /system/lib64/libc++.so
-70e7a92000-70e7aae000 ---p 00000000 00:00 0 
-70e7aae000-70e7ab8000 r--p 000d6000 fc:00 2332                           /system/lib64/libc++.so
-70e7ab8000-70e7ab9000 rw-p 000e0000 fc:00 2332                           /system/lib64/libc++.so
-70e7ab9000-70e7abc000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e7abc000-70e7abe000 r--s 00000000 fc:00 73                             /system/fonts/NotoSansBassaVah-Regular.otf
-70e7abe000-70e7ac8000 r--s 00000000 fc:00 254                            /system/fonts/NotoSansJavanese-Regular.ttf
-70e7ac8000-70e7acb000 r-xp 00000000 fc:00 2660                           /system/lib64/libnativebridge.so
-70e7acb000-70e7ae7000 ---p 00000000 00:00 0 
-70e7ae7000-70e7ae8000 r--p 0000f000 fc:00 2660                           /system/lib64/libnativebridge.so
-70e7ae8000-70e7ae9000 rw-p 00010000 fc:00 2660                           /system/lib64/libnativebridge.so
-70e7ae9000-70e7aee000 r--s 00000000 fc:00 158                            /system/fonts/NotoSansSaurashtra-Regular.ttf
-70e7aee000-70e7b0f000 r--s 00000000 fc:00 82                             /system/fonts/NotoSansDevanagari-Bold.ttf
-70e7b0f000-70e7b2e000 r-xp 00000000 fc:00 2612                           /system/lib64/libpcre2.so
-70e7b2e000-70e7b3e000 ---p 00000000 00:00 0 
-70e7b3e000-70e7b3f000 r--p 0001f000 fc:00 2612                           /system/lib64/libpcre2.so
-70e7b3f000-70e7b40000 rw-p 00020000 fc:00 2612                           /system/lib64/libpcre2.so
-70e7b40000-70e7bcc000 r-xp 00000000 fc:00 2975                           /system/lib64/libgui.so
-70e7bcc000-70e7be2000 ---p 00000000 00:00 0 
-70e7be2000-70e7bf5000 r--p 0008d000 fc:00 2975                           /system/lib64/libgui.so
-70e7bf5000-70e7bf6000 rw-p 000a0000 fc:00 2975                           /system/lib64/libgui.so
-70e7bf6000-70e7bf7000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70e7bf7000-70e7bf9000 r--s 00000000 fc:00 228                            /system/fonts/NotoSansUgaritic-Regular.ttf
-70e7bf9000-70e7c08000 r--s 00000000 fc:00 89                             /system/fonts/NotoSansCherokee-Regular.ttf
-70e7c08000-70e7dea000 r-xp 00000000 fc:00 2441                           /system/lib64/libandroid_runtime.so
-70e7dea000-70e7e04000 ---p 00000000 00:00 0 
-70e7e04000-70e7e23000 r--p 001e1000 fc:00 2441                           /system/lib64/libandroid_runtime.so
-70e7e23000-70e7e24000 rw-p 00200000 fc:00 2441                           /system/lib64/libandroid_runtime.so
-70e7e24000-70e7e28000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e7e29000-70e7e66000 r--s 00000000 fc:00 74                             /system/fonts/NotoSerif-Bold.ttf
-70e7e66000-70e7ed0000 r-xp 00000000 fc:00 2547                           /system/lib64/libclang_rt.ubsan_standalone-aarch64-android.so
-70e7ed0000-70e7edf000 ---p 00000000 00:00 0 
-70e7edf000-70e7ee1000 r--p 00069000 fc:00 2547                           /system/lib64/libclang_rt.ubsan_standalone-aarch64-android.so
-70e7ee1000-70e7ee4000 rw-p 0006b000 fc:00 2547                           /system/lib64/libclang_rt.ubsan_standalone-aarch64-android.so
-70e7ee4000-70e89f6000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e89f6000-70e89fa000 r--s 00000000 fc:00 127                            /system/fonts/NotoSansSylotiNagri-Regular.ttf
-70e89fa000-70e8a06000 r--s 00000000 fc:00 93                             /system/fonts/NotoSansCanadianAboriginal-Regular.ttf
-70e8a06000-70e8a1b000 r-xp 00000000 fc:00 2460                           /system/lib64/android.hardware.graphics.allocator@2.0.so
-70e8a1b000-70e8a33000 ---p 00000000 00:00 0 
-70e8a33000-70e8a35000 r--p 0001e000 fc:00 2460                           /system/lib64/android.hardware.graphics.allocator@2.0.so
-70e8a35000-70e8a36000 rw-p 00020000 fc:00 2460                           /system/lib64/android.hardware.graphics.allocator@2.0.so
-70e8a36000-70e8a55000 r--s 00000000 fc:00 145                            /system/fonts/NotoSansDevanagariUI-Regular.ttf
-70e8a55000-70e8a61000 r-xp 00000000 fc:00 2540                           /system/lib64/libstagefright_xmlparser.so
-70e8a61000-70e8a74000 ---p 00000000 00:00 0 
-70e8a74000-70e8a75000 r--p 0000f000 fc:00 2540                           /system/lib64/libstagefright_xmlparser.so
-70e8a75000-70e8a76000 rw-p 00010000 fc:00 2540                           /system/lib64/libstagefright_xmlparser.so
-70e8a76000-70e8a78000 r--s 00000000 fc:00 293                            /system/fonts/NotoSansTagbanwa-Regular.ttf
-70e8a78000-70e8a8f000 r--s 00000000 fc:00 161                            /system/fonts/NotoSerifKannada-Regular.ttf
-70e8a8f000-70e8b23000 r-xp 00000000 fc:00 2633                           /system/lib64/libaudioclient.so
-70e8b23000-70e8b37000 ---p 00000000 00:00 0 
-70e8b37000-70e8b49000 r--p 0009e000 fc:00 2633                           /system/lib64/libaudioclient.so
-70e8b49000-70e8b55000 rw-p 000b0000 fc:00 2633                           /system/lib64/libaudioclient.so
-70e8b55000-70e8b9f000 r--s 00000000 fc:00 83                             /system/fonts/RobotoCondensed-Light.ttf
-70e8b9f000-70e8ba1000 r-xp 00000000 fc:00 2520                           /system/lib64/libhardware_legacy.so
-70e8ba1000-70e8bbe000 ---p 00000000 00:00 0 
-70e8bbe000-70e8bbf000 r--p 0000f000 fc:00 2520                           /system/lib64/libhardware_legacy.so
-70e8bbf000-70e8bc0000 rw-p 00010000 fc:00 2520                           /system/lib64/libhardware_legacy.so
-70e8bc0000-70e8be0000 r-xp 00000000 fc:00 2410                           /system/lib64/android.hidl.memory@1.0.so
-70e8be0000-70e8bfa000 ---p 00000000 00:00 0 
-70e8bfa000-70e8bfd000 r--p 0002d000 fc:00 2410                           /system/lib64/android.hidl.memory@1.0.so
-70e8bfd000-70e8bfe000 rw-p 00030000 fc:00 2410                           /system/lib64/android.hidl.memory@1.0.so
-70e8bfe000-70e8bff000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70e8bff000-70e8c02000 r--s 00000000 fc:00 273                            /system/fonts/NotoSansSundanese-Regular.ttf
-70e8c02000-70e8c0f000 r--s 00000000 fc:00 115                            /system/fonts/NotoSansAdlam-Regular.ttf
-70e8c0f000-70e8c18000 r-xp 00000000 fc:00 2350                           /system/lib64/libnetdutils.so
-70e8c18000-70e8c2e000 ---p 00000000 00:00 0 
-70e8c2e000-70e8c2f000 r--p 0000f000 fc:00 2350                           /system/lib64/libnetdutils.so
-70e8c2f000-70e8c30000 rw-p 00010000 fc:00 2350                           /system/lib64/libnetdutils.so
-70e8c30000-70e8c44000 r--s 00000000 fc:00 283                            /system/fonts/NotoSansKannadaUI-Regular.ttf
-70e8c44000-70e8c45000 r-xp 00000000 fc:00 2926                           /system/lib64/libhidlallocatorutils.so
-70e8c45000-70e8c63000 ---p 00000000 00:00 0 
-70e8c63000-70e8c64000 r--p 0000f000 fc:00 2926                           /system/lib64/libhidlallocatorutils.so
-70e8c64000-70e8c65000 rw-p 00010000 fc:00 2926                           /system/lib64/libhidlallocatorutils.so
-70e8c65000-70e8c67000 r--s 00000000 fc:00 65                             /system/fonts/NotoSansTagalog-Regular.ttf
-70e8c67000-70e8c70000 r--s 00000000 fc:00 294                            /system/fonts/NotoSansChakma-Regular.ttf
-70e8c70000-70e8c92000 r--s 00000000 fc:00 116                            /system/fonts/NotoSansDevanagari-Regular.ttf
-70e8c92000-70e8c94000 r-xp 00000000 fc:00 2501                           /system/lib64/libsync.so
-70e8c94000-70e8cb1000 ---p 00000000 00:00 0 
-70e8cb1000-70e8cb2000 r--p 0000f000 fc:00 2501                           /system/lib64/libsync.so
-70e8cb2000-70e8cb3000 rw-p 00010000 fc:00 2501                           /system/lib64/libsync.so
-70e8cb3000-70e8cc6000 r--s 00000000 fc:00 196                            /system/fonts/NotoSerifSinhala-Regular.otf
-70e8cc6000-70e8d5c000 r-xp 00000000 fc:00 2403                           /system/lib64/libmedia.so
-70e8d5c000-70e8d70000 ---p 00000000 00:00 0 
-70e8d70000-70e8d88000 r--p 00098000 fc:00 2403                           /system/lib64/libmedia.so
-70e8d88000-70e8d95000 rw-p 000b0000 fc:00 2403                           /system/lib64/libmedia.so
-70e8d95000-70e8d96000 r--p 00000000 00:00 0                              [anon:atexit handlers]
-70e8d96000-70e8d99000 r--s 00000000 fc:00 247                            /system/fonts/NotoSansSamaritan-Regular.ttf
-70e8d99000-70e8dad000 r--s 00000000 fc:00 108                            /system/fonts/NotoSansKannada-Bold.ttf
-70e8dad000-70e8dcd000 r--s 00000000 fc:00 303                            /system/fonts/NotoSerifEthiopic-Bold.otf
-70e8dcd000-70e8de5000 r-xp 00000000 fc:00 2954                           /system/lib64/libGLESv2.so
-70e8de5000-70e8dfc000 ---p 00000000 00:00 0 
-70e8dfc000-70e8dfd000 r--p 0001f000 fc:00 2954                           /system/lib64/libGLESv2.so
-70e8dfd000-70e8dfe000 rw-p 00020000 fc:00 2954                           /system/lib64/libGLESv2.so
-70e8dfe000-70e8e06000 r--s 00000000 fc:00 265                            /system/fonts/NotoSansBalinese-Regular.ttf
-70e8e06000-70e8e0e000 r--s 00000000 fc:00 219                            /system/fonts/NotoSansLaoUI-Bold.ttf
-70e8e0e000-70e8e12000 r-xp 00000000 fc:00 2617                           /system/lib64/libdebuggerd_client.so
-70e8e12000-70e8e2d000 ---p 00000000 00:00 0 
-70e8e2d000-70e8e2e000 r--p 0000f000 fc:00 2617                           /system/lib64/libdebuggerd_client.so
-70e8e2e000-70e8e2f000 rw-p 00010000 fc:00 2617                           /system/lib64/libdebuggerd_client.so
-70e8e2f000-70e8e4b000 r--s 00000000 fc:00 211                            /system/fonts/NotoSerifEthiopic-Regular.otf
-70e8e4b000-70e8e5e000 r-xp 00000000 fc:00 2484                           /system/lib64/android.hardware.memtrack@1.0.so
-70e8e5e000-70e8e78000 ---p 00000000 00:00 0 
-70e8e78000-70e8e7a000 r--p 0001e000 fc:00 2484                           /system/lib64/android.hardware.memtrack@1.0.so
-70e8e7a000-70e8e7b000 rw-p 00020000 fc:00 2484                           /system/lib64/android.hardware.memtrack@1.0.so
-70e8e7b000-70e8e7d000 r--s 00000000 fc:00 261                            /system/fonts/NotoSansShavian-Regular.ttf
-70e8e7d000-70e8e80000 r--s 00000000 fc:00 204                            /system/fonts/NotoSansRunic-Regular.ttf
-70e8e80000-70e8ea1000 r-xp 00000000 fc:00 2512                           /system/lib64/android.hardware.configstore@1.0.so
-70e8ea1000-70e8ebb000 ---p 00000000 00:00 0 
-70e8ebb000-70e8ebe000 r--p 0002d000 fc:00 2512                           /system/lib64/android.hardware.configstore@1.0.so
-70e8ebe000-70e8ebf000 rw-p 00030000 fc:00 2512                           /system/lib64/android.hardware.configstore@1.0.so
-70e8ebf000-70e8ee3000 r--s 00000000 fc:00 226                            /system/fonts/NotoSansEthiopic-Bold.ttf
-70e8ee3000-70e8f1a000 r-xp 00000000 fc:00 2337                           /system/lib64/libm.so
-70e8f1a000-70e8f32000 ---p 00000000 00:00 0 
-70e8f32000-70e8f33000 r--p 0003f000 fc:00 2337                           /system/lib64/libm.so
-70e8f33000-70e8f34000 rw-p 00040000 fc:00 2337                           /system/lib64/libm.so
-70e8f34000-70e8f36000 r--s 00000000 fc:00 133                            /system/fonts/NotoSansRejang-Regular.ttf
-70e8f36000-70e8f38000 r--s 00000000 fc:00 69                             /system/fonts/NotoSansPhoenician-Regular.ttf
-70e8f38000-70e8f40000 r--s 00000000 fc:00 245                            /system/fonts/NotoSansLaoUI-Regular.ttf
-70e8f40000-70e8f45000 r-xp 00000000 fc:00 2341                           /system/lib64/libstagefright_codecbase.so
-70e8f45000-70e8f5f000 ---p 00000000 00:00 0 
-70e8f5f000-70e8f60000 r--p 0000f000 fc:00 2341                           /system/lib64/libstagefright_codecbase.so
-70e8f60000-70e8f61000 rw-p 00010000 fc:00 2341                           /system/lib64/libstagefright_codecbase.so
-70e8f61000-70e8f62000 r--p 00000000 00:00 0                              [anon:atexit handlers]
-70e8f62000-70e8f66000 r--s 00000000 fc:00 225                            /system/fonts/NotoSansOldPersian-Regular.ttf
-70e8f66000-70e8f89000 r--s 00000000 fc:00 167                            /system/fonts/NotoSansEthiopic-Regular.ttf
-70e8f89000-70e8f92000 r-xp 00000000 fc:00 2515                           /system/lib64/libGLESv1_CM.so
-70e8f92000-70e8fa8000 ---p 00000000 00:00 0 
-70e8fa8000-70e8fa9000 r--p 0000f000 fc:00 2515                           /system/lib64/libGLESv1_CM.so
-70e8fa9000-70e8faa000 rw-p 00010000 fc:00 2515                           /system/lib64/libGLESv1_CM.so
-70e8faa000-70e8fad000 r--s 00000000 fc:00 206                            /system/fonts/NotoSansOsage-Regular.ttf
-70e8fad000-70e8fb5000 r--s 00000000 fc:00 121                            /system/fonts/NotoSerifLao-Bold.ttf
-70e8fb5000-70e8fd3000 r--s 00000000 fc:00 68                             /system/fonts/NotoNaskhArabicUI-Bold.ttf
-70e8fd3000-70e9010000 r-xp 00000000 fc:00 2600                           /system/lib64/android.hardware.cas@1.0.so
-70e9010000-70e9026000 ---p 00000000 00:00 0 
-70e9026000-70e902c000 r--p 0004a000 fc:00 2600                           /system/lib64/android.hardware.cas@1.0.so
-70e902c000-70e902d000 rw-p 00050000 fc:00 2600                           /system/lib64/android.hardware.cas@1.0.so
-70e902d000-70e902e000 r--s 00000000 00:05 31475                          /dev/ashmem/5c7d41a6-003d-45a5-9e3b-2d34c5829a2d (deleted)
-70e902e000-70e9043000 r--s 00000000 fc:00 120                            /system/fonts/NotoSansKannada-Regular.ttf
-70e9043000-70e9067000 r-xp 00000000 fc:00 2729                           /system/lib64/libexpat.so
-70e9067000-70e9081000 ---p 00000000 00:00 0 
-70e9081000-70e9083000 r--p 0002e000 fc:00 2729                           /system/lib64/libexpat.so
-70e9083000-70e9084000 rw-p 00030000 fc:00 2729                           /system/lib64/libexpat.so
-70e9084000-70e9086000 r--s 00000000 fc:00 155                            /system/fonts/NotoSansOsmanya-Regular.ttf
-70e9086000-70e90c3000 r--s 00000000 fc:00 91                             /system/fonts/NotoSerif-Regular.ttf
-70e90c3000-70e91ce000 r-xp 00000000 fc:00 2647                           /system/lib64/libcrypto.so
-70e91ce000-70e91e2000 ---p 00000000 00:00 0 
-70e91e2000-70e91f3000 r--p 0010f000 fc:00 2647                           /system/lib64/libcrypto.so
-70e91f3000-70e91f4000 rw-p 00120000 fc:00 2647                           /system/lib64/libcrypto.so
-70e91f4000-70e91f5000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e91f5000-70e91fa000 r--s 00000000 fc:00 149                            /system/fonts/NotoSansNKo-Regular.ttf
-70e91fa000-70e9202000 r--s 00000000 fc:00 198                            /system/fonts/NotoSerifLao-Regular.ttf
-70e9202000-70e921b000 r-xp 00000000 fc:00 2682                           /system/lib64/libmedia_helper.so
-70e921b000-70e922d000 ---p 00000000 00:00 0 
-70e922d000-70e9230000 r--p 0001d000 fc:00 2682                           /system/lib64/libmedia_helper.so
-70e9230000-70e9231000 rw-p 00020000 fc:00 2682                           /system/lib64/libmedia_helper.so
-70e9231000-70e924a000 r--s 00000000 fc:00 232                            /system/fonts/NotoSansBengali-Bold.ttf
-70e924a000-70e9256000 r-xp 00000000 fc:00 2467                           /system/lib64/libsoundtrigger.so
-70e9256000-70e9272000 ---p 00000000 00:00 0 
-70e9272000-70e9276000 r--p 0000c000 fc:00 2467                           /system/lib64/libsoundtrigger.so
-70e9276000-70e9277000 rw-p 00010000 fc:00 2467                           /system/lib64/libsoundtrigger.so
-70e9277000-70e9278000 r--s 00000000 fc:01 1177                           /vendor/overlay/Pixel/PixelThemeOverlay.apk
-70e9278000-70e927c000 r--s 00000000 fc:00 215                            /system/fonts/NotoSansNewTaiLue-Regular.ttf
-70e927c000-70e929a000 r--s 00000000 fc:00 235                            /system/fonts/NotoNaskhArabicUI-Regular.ttf
-70e929a000-70e929b000 r-xp 00000000 fc:00 2375                           /system/lib64/android.hardware.graphics.common@1.1.so
-70e929b000-70e92b9000 ---p 00000000 00:00 0 
-70e92b9000-70e92ba000 r--p 0000f000 fc:00 2375                           /system/lib64/android.hardware.graphics.common@1.1.so
-70e92ba000-70e92bb000 rw-p 00010000 fc:00 2375                           /system/lib64/android.hardware.graphics.common@1.1.so
-70e92bb000-70e92da000 r--s 00000000 fc:00 281                            /system/fonts/GoogleSans-BoldItalic.ttf
-70e92da000-70e9302000 r-xp 00000000 fc:00 2529                           /system/lib64/libinput.so
-70e9302000-70e931b000 ---p 00000000 00:00 0 
-70e931b000-70e9322000 r--p 00029000 fc:00 2529                           /system/lib64/libinput.so
-70e9322000-70e9323000 rw-p 00030000 fc:00 2529                           /system/lib64/libinput.so
-70e9323000-70e9340000 r--s 00000000 fc:00 130                            /system/fonts/NotoNaskhArabic-Bold.ttf
-70e9340000-70e934b000 r-xp 00000000 fc:00 2451                           /system/lib64/libbpf.so
-70e934b000-70e935f000 ---p 00000000 00:00 0 
-70e935f000-70e9360000 r--p 0000f000 fc:00 2451                           /system/lib64/libbpf.so
-70e9360000-70e9361000 rw-p 00010000 fc:00 2451                           /system/lib64/libbpf.so
-70e9361000-70e9367000 r--s 00000000 fc:00 96                             /system/fonts/NotoSansKharoshthi-Regular.ttf
-70e9367000-70e9385000 r--s 00000000 fc:00 151                            /system/fonts/GoogleSans-Bold.ttf
-70e9385000-70e93b8000 r-xp 00000000 fc:00 2494                           /system/lib64/libpng.so
-70e93b8000-70e93d4000 ---p 00000000 00:00 0 
-70e93d4000-70e93d5000 r--p 0003f000 fc:00 2494                           /system/lib64/libpng.so
-70e93d5000-70e93d6000 rw-p 00040000 fc:00 2494                           /system/lib64/libpng.so
-70e93d6000-70e93d7000 r--s 00004000 fc:01 1177                           /vendor/overlay/Pixel/PixelThemeOverlay.apk
-70e93d7000-70e93d9000 r--s 00000000 fc:00 295                            /system/fonts/NotoSansOldTurkic-Regular.ttf
-70e93d9000-70e93e5000 r--s 00000000 fc:00 86                             /system/fonts/NotoSerifKhmer-Bold.otf
-70e93e5000-70e9404000 r--s 00000000 fc:00 240                            /system/fonts/GoogleSans-MediumItalic.ttf
-70e9404000-70e9409000 r-xp 00000000 fc:00 2404                           /system/lib64/libhidlmemory.so
-70e9409000-70e9423000 ---p 00000000 00:00 0 
-70e9423000-70e9424000 r--p 0000f000 fc:00 2404                           /system/lib64/libhidlmemory.so
-70e9424000-70e9425000 rw-p 00010000 fc:00 2404                           /system/lib64/libhidlmemory.so
-70e9425000-70e943e000 r--s 00000000 fc:00 185                            /system/fonts/NotoSansBengali-Regular.ttf
-70e943e000-70e945c000 r--s 00000000 fc:00 129                            /system/fonts/GoogleSans-Medium.ttf
-70e945c000-70e960c000 r-xp 00000000 fc:00 2398                           /system/lib64/libstagefright.so
-70e960c000-70e9625000 ---p 00000000 00:00 0 
-70e9625000-70e9638000 r--p 001bd000 fc:00 2398                           /system/lib64/libstagefright.so
-70e9638000-70e966c000 rw-p 001d0000 fc:00 2398                           /system/lib64/libstagefright.so
-70e966c000-70e966d000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e966d000-70e966e000 r--s 00000000 103:1d 1474566                       /data/resource-cache/vendor@overlay@Pixel@PixelThemeOverlay.apk@idmap
-70e966e000-70e9672000 r--s 00000000 fc:00 241                            /system/fonts/NotoSansMeeteiMayek-Regular.ttf
-70e9672000-70e9680000 r--s 00000000 fc:00 150                            /system/fonts/NotoSansMalayalamUI-Bold.ttf
-70e9680000-70e96a7000 r-xp 00000000 fc:00 2365                           /system/lib64/libhwbinder.so
-70e96a7000-70e96bd000 ---p 00000000 00:00 0 
-70e96bd000-70e96bf000 r--p 0002e000 fc:00 2365                           /system/lib64/libhwbinder.so
-70e96bf000-70e96c0000 rw-p 00030000 fc:00 2365                           /system/lib64/libhwbinder.so
-70e96c0000-70e96c1000 r--s 00088000 103:1d 1736830                       /data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/base.apk
-70e96c1000-70e96cb000 r--s 00000000 fc:00 94                             /system/fonts/NotoSansKhmerUI-Regular.ttf
-70e96cb000-70e96d9000 r--s 00000000 fc:00 275                            /system/fonts/NotoSansMalayalamUI-Regular.ttf
-70e96d9000-70e96dd000 r-xp 00000000 fc:00 2386                           /system/lib64/libusbhost.so
-70e96dd000-70e96f8000 ---p 00000000 00:00 0 
-70e96f8000-70e96f9000 r--p 0000f000 fc:00 2386                           /system/lib64/libusbhost.so
-70e96f9000-70e96fa000 rw-p 00010000 fc:00 2386                           /system/lib64/libusbhost.so
-70e96fa000-70e96fb000 r--p 00000000 00:05 10266154                       [anon:dalvik-classes.dex extracted in memory from /data/app/com.google.sample.tunnel-HGGRU03Gu1Mwkf_-RnFmvw==/base.apk]
-70e96fb000-70e9701000 r--s 00000000 fc:00 280                            /system/fonts/NotoSansCoptic-Regular.ttf
-70e9701000-70e9720000 r-xp 00000000 fc:00 2490                           /system/lib64/libstagefright_bufferqueue_helper.so
-70e9720000-70e973b000 ---p 00000000 00:00 0 
-70e973b000-70e973e000 r--p 0002d000 fc:00 2490                           /system/lib64/libstagefright_bufferqueue_helper.so
-70e973e000-70e9740000 rw-p 00030000 fc:00 2490                           /system/lib64/libstagefright_bufferqueue_helper.so
-70e9740000-70e9742000 r--s 00000000 fc:00 141                            /system/fonts/NotoSansOldSouthArabian-Regular.ttf
-70e9742000-70e974c000 r--s 00000000 fc:00 229                            /system/fonts/NotoSerifKhmer-Regular.otf
-70e974c000-70e9759000 r--s 00000000 fc:00 260                            /system/fonts/NotoSerifMalayalam-Bold.ttf
-70e9759000-70e97c7000 r-xp 00000000 fc:00 2428                           /system/lib64/libstagefright_omx.so
-70e97c7000-70e97dc000 ---p 00000000 00:00 0 
-70e97dc000-70e97e6000 r--p 00076000 fc:00 2428                           /system/lib64/libstagefright_omx.so
-70e97e6000-70e97ed000 rw-p 00080000 fc:00 2428                           /system/lib64/libstagefright_omx.so
-70e97ed000-70e97fa000 r--s 00000000 fc:00 66                             /system/fonts/NotoSerifMalayalam-Regular.ttf
-70e97fa000-70e9819000 r--s 00000000 fc:00 183                            /system/fonts/GoogleSans-Italic.ttf
-70e9819000-70e9856000 r-xp 00000000 fc:00 2434                           /system/lib64/libprotobuf-cpp-lite.so
-70e9856000-70e9867000 ---p 00000000 00:00 0 
-70e9867000-70e9869000 r--p 0003e000 fc:00 2434                           /system/lib64/libprotobuf-cpp-lite.so
-70e9869000-70e986a000 rw-p 00040000 fc:00 2434                           /system/lib64/libprotobuf-cpp-lite.so
-70e986a000-70e9873000 r--s 00000000 fc:00 134                            /system/fonts/NotoSansKhmerUI-Bold.ttf
-70e9873000-70e9891000 r--s 00000000 fc:00 81                             /system/fonts/GoogleSans-Regular.ttf
-70e9891000-70e989e000 r-xp 00000000 fc:00 2377                           /system/lib64/libmediametrics.so
-70e989e000-70e98ae000 ---p 00000000 00:00 0 
-70e98ae000-70e98b0000 r--p 0000e000 fc:00 2377                           /system/lib64/libmediametrics.so
-70e98b0000-70e98b1000 rw-p 00010000 fc:00 2377                           /system/lib64/libmediametrics.so
-70e98b1000-70e98b9000 r--s 00000000 fc:00 152                            /system/fonts/NotoSansLao-Bold.ttf
-70e98b9000-70e98c7000 r--s 00000000 fc:00 279                            /system/fonts/NotoSansMalayalam-Bold.ttf
-70e98c7000-70e98ca000 r-xp 00000000 fc:00 2952                           /system/lib64/libETC1.so
-70e98ca000-70e98e6000 ---p 00000000 00:00 0 
-70e98e6000-70e98e7000 r--p 0000f000 fc:00 2952                           /system/lib64/libETC1.so
-70e98e7000-70e98e8000 rw-p 00010000 fc:00 2952                           /system/lib64/libETC1.so
-70e98e8000-70e98e9000 r--s 00000000 fc:00 1121                           /system/usr/hyphen-data/hyph-und-ethi.hyb
-70e98e9000-70e98ef000 r--s 00000000 fc:00 64                             /system/fonts/NotoSansBrahmi-Regular.ttf
-70e98ef000-70e990f000 rw-p 00000000 00:05 10271012                       [anon:dalvik-CompilerMetadata]
-70e990f000-70e9926000 r-xp 00000000 fc:00 2526                           /system/lib64/libbacktrace.so
-70e9926000-70e993e000 ---p 00000000 00:00 0 
-70e993e000-70e993f000 r--p 0001f000 fc:00 2526                           /system/lib64/libbacktrace.so
-70e993f000-70e9940000 rw-p 00020000 fc:00 2526                           /system/lib64/libbacktrace.so
-70e9940000-70e9941000 r--s 00000000 fc:00 1129                           /system/usr/hyphen-data/hyph-tk.hyb
-70e9941000-70e99a4000 r-xp 00000000 fc:00 2528                           /system/lib64/libcamera_client.so
-70e99a4000-70e99bc000 ---p 00000000 00:00 0 
-70e99bc000-70e99c9000 r--p 00063000 fc:00 2528                           /system/lib64/libcamera_client.so
-70e99c9000-70e99d0000 rw-p 00070000 fc:00 2528                           /system/lib64/libcamera_client.so
-70e99d0000-70e99d1000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70e99d1000-70e99d3000 r--s 00000000 fc:00 200                            /system/fonts/NotoSansOldItalic-Regular.ttf
-70e99d3000-70e99e1000 r--s 00000000 fc:00 153                            /system/fonts/NotoSansMalayalam-Regular.ttf
-70e99e1000-70e9a01000 rw-p 00000000 00:05 10271011                       [anon:dalvik-CompilerMetadata]
-70e9a01000-70e9a1e000 r-xp 00000000 fc:00 2542                           /system/lib64/libimg_utils.so
-70e9a1e000-70e9a39000 ---p 00000000 00:00 0 
-70e9a39000-70e9a3c000 r--p 0001d000 fc:00 2542                           /system/lib64/libimg_utils.so
-70e9a3c000-70e9a3f000 rw-p 00020000 fc:00 2542                           /system/lib64/libimg_utils.so
-70e9a3f000-70e9a5c000 r--s 00000000 fc:00 262                            /system/fonts/NotoNaskhArabic-Regular.ttf
-70e9a5c000-70e9a69000 r-xp 00000000 fc:00 2706                           /system/lib64/libziparchive.so
-70e9a69000-70e9a7b000 ---p 00000000 00:00 0 
-70e9a7b000-70e9a7c000 r--p 0000f000 fc:00 2706                           /system/lib64/libziparchive.so
-70e9a7c000-70e9a7d000 rw-p 00010000 fc:00 2706                           /system/lib64/libziparchive.so
-70e9a7d000-70e9a85000 r--s 00000000 fc:00 119                            /system/fonts/NotoSansLao-Regular.ttf
-70e9a85000-70e9a8e000 r--s 00000000 fc:00 77                             /system/fonts/NotoSansTamilUI-Bold.ttf
-70e9a8e000-70e9a97000 r--s 00000000 fc:00 160                            /system/fonts/NotoSansTamilUI-Regular.ttf
-70e9a97000-70e9a9d000 r-xp 00000000 fc:00 2536                           /system/lib64/libnativehelper.so
-70e9a9d000-70e9ab6000 ---p 00000000 00:00 0 
-70e9ab6000-70e9ab7000 r--p 0000f000 fc:00 2536                           /system/lib64/libnativehelper.so
-70e9ab7000-70e9ab8000 rw-p 00010000 fc:00 2536                           /system/lib64/libnativehelper.so
-70e9ab8000-70e9ab9000 r--s 00000000 fc:00 1134                           /system/usr/hyphen-data/hyph-te.hyb
-70e9ab9000-70e9ac2000 r--s 00000000 fc:00 246                            /system/fonts/NotoSerifTamil-Bold.ttf
-70e9ac2000-70e9acb000 r--s 00000000 fc:00 302                            /system/fonts/NotoSerifTamil-Regular.ttf
-70e9acb000-70e9af4000 r-xp 00000000 fc:00 2950                           /system/lib64/libmemunreachable.so
-70e9af4000-70e9b09000 ---p 00000000 00:00 0 
-70e9b09000-70e9b0b000 r--p 0002e000 fc:00 2950                           /system/lib64/libmemunreachable.so
-70e9b0b000-70e9b0c000 rw-p 00030000 fc:00 2950                           /system/lib64/libmemunreachable.so
-70e9b0c000-70e9b0d000 r--s 00000000 fc:00 1088                           /system/usr/hyphen-data/hyph-ta.hyb
-70e9b0d000-70e9b0f000 r--s 00000000 fc:00 72                             /system/fonts/NotoSansOlChiki-Regular.ttf
-70e9b0f000-70e9b2f000 rw-p 00000000 00:05 10271010                       [anon:dalvik-CompilerMetadata]
-70e9b2f000-70e9b4f000 r--s 00000000 00:10 16633                          /dev/__properties__/u:object_r:persist_debug_prop:s0
-70e9b4f000-70e9b65000 r-xp 00000000 fc:00 2920                           /system/lib64/android.hardware.cas.native@1.0.so
-70e9b65000-70e9b7b000 ---p 00000000 00:00 0 
-70e9b7b000-70e9b7d000 r--p 0001e000 fc:00 2920                           /system/lib64/android.hardware.cas.native@1.0.so
-70e9b7d000-70e9b7e000 rw-p 00020000 fc:00 2920                           /system/lib64/android.hardware.cas.native@1.0.so
-70e9b7e000-70e9b7f000 r--s 00000000 fc:00 1145                           /system/usr/hyphen-data/hyph-pt.hyb
-70e9b7f000-70e9b83000 r--s 00000000 fc:00 277                            /system/fonts/NotoSansMandaic-Regular.ttf
-70e9b83000-70e9bdb000 r-xp 00000000 fc:00 2334                           /system/lib64/libsonivox.so
-70e9bdb000-70e9bf2000 ---p 00000000 00:00 0 
-70e9bf2000-70e9bf3000 r--p 0005f000 fc:00 2334                           /system/lib64/libsonivox.so
-70e9bf3000-70e9bf4000 rw-p 00060000 fc:00 2334                           /system/lib64/libsonivox.so
-70e9bf4000-70e9bfb000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e9bfb000-70e9c01000 r--s 00000000 fc:00 123                            /system/fonts/NotoSansCham-Bold.ttf
-70e9c01000-70e9c0a000 r--s 00000000 fc:00 255                            /system/fonts/NotoSansTamil-Bold.ttf
-70e9c0a000-70e9c13000 r--s 00000000 fc:00 135                            /system/fonts/NotoSansTamil-Regular.ttf
-70e9c13000-70e9c15000 r-xp 00000000 fc:00 2519                           /system/lib64/libgraphicsenv.so
-70e9c15000-70e9c32000 ---p 00000000 00:00 0 
-70e9c32000-70e9c33000 r--p 0000f000 fc:00 2519                           /system/lib64/libgraphicsenv.so
-70e9c33000-70e9c34000 rw-p 00010000 fc:00 2519                           /system/lib64/libgraphicsenv.so
-70e9c34000-70e9c3a000 r--s 00000000 fc:00 259                            /system/fonts/NotoSansCham-Regular.ttf
-70e9c3a000-70e9c42000 r--s 00000000 fc:00 114                            /system/fonts/NotoSansGurmukhiUI-Bold.ttf
-70e9c42000-70e9c4a000 r--s 00000000 fc:00 122                            /system/fonts/NotoSansGurmukhiUI-Regular.ttf
-70e9c4a000-70e9c5f000 r-xp 00000000 fc:00 2348                           /system/lib64/android.hidl.allocator@1.0.so
-70e9c5f000-70e9c77000 ---p 00000000 00:00 0 
-70e9c77000-70e9c79000 r--p 0001e000 fc:00 2348                           /system/lib64/android.hidl.allocator@1.0.so
-70e9c79000-70e9c7a000 rw-p 00020000 fc:00 2348                           /system/lib64/android.hidl.allocator@1.0.so
-70e9c7a000-70e9c7b000 r--s 00000000 fc:00 1095                           /system/usr/hyphen-data/hyph-pa.hyb
-70e9c7b000-70e9c83000 r--s 00000000 fc:00 298                            /system/fonts/NotoSerifGurmukhi-Bold.otf
-70e9c83000-70e9d01000 r-xp 00000000 fc:00 2665                           /system/lib64/libbinder.so
-70e9d01000-70e9d1e000 ---p 00000000 00:00 0 
-70e9d1e000-70e9d2e000 r--p 00080000 fc:00 2665                           /system/lib64/libbinder.so
-70e9d2e000-70e9d2f000 rw-p 00090000 fc:00 2665                           /system/lib64/libbinder.so
-70e9d2f000-70e9d4f000 rw-p 00000000 00:05 10271009                       [anon:dalvik-CompilerMetadata]
-70e9d4f000-70e9d53000 r-xp 00000000 fc:00 2454                           /system/lib64/libaudiomanager.so
-70e9d53000-70e9d6e000 ---p 00000000 00:00 0 
-70e9d6e000-70e9d6f000 r--p 0000f000 fc:00 2454                           /system/lib64/libaudiomanager.so
-70e9d6f000-70e9d70000 rw-p 00010000 fc:00 2454                           /system/lib64/libaudiomanager.so
-70e9d70000-70e9d71000 r--s 00000000 fc:00 1087                           /system/usr/hyphen-data/hyph-or.hyb
-70e9d71000-70e9d91000 rw-p 00000000 00:05 10271008                       [anon:dalvik-CompilerMetadata]
-70e9d91000-70e9e21000 r-xp 00000000 fc:00 2627                           /system/lib64/libft2.so
-70e9e21000-70e9e37000 ---p 00000000 00:00 0 
-70e9e37000-70e9e3c000 r--p 0009b000 fc:00 2627                           /system/lib64/libft2.so
-70e9e3c000-70e9e3d000 rw-p 000a0000 fc:00 2627                           /system/lib64/libft2.so
-70e9e3d000-70e9e3e000 r--s 00000000 fc:00 1142                           /system/usr/hyphen-data/hyph-mr.hyb
-70e9e3e000-70e9e45000 r--s 00000000 fc:00 88                             /system/fonts/NotoSerifGurmukhi-Regular.otf
-70e9e45000-70e9e65000 r--s 00000000 00:10 16594                          /dev/__properties__/u:object_r:exported3_default_prop:s0
-70e9e65000-70e9e7f000 r-xp 00000000 fc:00 2643                           /system/lib64/libunwind.so
-70e9e7f000-70e9e94000 ---p 00000000 00:00 0 
-70e9e94000-70e9e95000 r--p 0001f000 fc:00 2643                           /system/lib64/libunwind.so
-70e9e95000-70e9e96000 rw-p 00020000 fc:00 2643                           /system/lib64/libunwind.so
-70e9e96000-70e9eff000 rw-p 00000000 00:00 0                              [anon:.bss]
-70e9eff000-70e9f00000 r--s 00000000 fc:00 1130                           /system/usr/hyphen-data/hyph-ml.hyb
-70e9f00000-70e9f02000 r--s 00000000 fc:00 75                             /system/fonts/NotoSansOgham-Regular.ttf
-70e9f02000-70e9f0a000 r--s 00000000 fc:00 193                            /system/fonts/NotoSansGurmukhi-Bold.ttf
-70e9f0a000-70ea022000 r-xp 00000000 fc:00 2328                           /system/lib64/libsqlite.so
-70ea022000-70ea033000 ---p 00000000 00:00 0 
-70ea033000-70ea036000 r--p 0011d000 fc:00 2328                           /system/lib64/libsqlite.so
-70ea036000-70ea038000 rw-p 00120000 fc:00 2328                           /system/lib64/libsqlite.so
-70ea038000-70ea03c000 r--s 00000000 fc:00 285                            /system/fonts/NotoSansGlagolitic-Regular.ttf
-70ea03c000-70ea04c000 r--s 00000000 fc:00 184                            /system/fonts/NotoSerifGujarati-Bold.ttf
-70ea04c000-70ea060000 r-xp 00000000 fc:00 2731                           /system/lib64/libstatslog.so
-70ea060000-70ea07b000 ---p 00000000 00:00 0 
-70ea07b000-70ea07c000 r--p 0001f000 fc:00 2731                           /system/lib64/libstatslog.so
-70ea07c000-70ea07d000 rw-p 00020000 fc:00 2731                           /system/lib64/libstatslog.so
-70ea07d000-70ea081000 r--s 00000000 fc:00 182                            /system/fonts/NotoSansBatak-Regular.ttf
-70ea081000-70ea091000 r--s 00000000 fc:00 264                            /system/fonts/NotoSerifGujarati-Regular.ttf
-70ea091000-70ea160000 r-xp 00000000 fc:00 2728                           /system/lib64/libdng_sdk.so
-70ea160000-70ea173000 ---p 00000000 00:00 0 
-70ea173000-70ea17a000 r--p 000d9000 fc:00 2728                           /system/lib64/libdng_sdk.so
-70ea17a000-70ea17b000 rw-p 000e0000 fc:00 2728                           /system/lib64/libdng_sdk.so
-70ea17b000-70ea198000 r--s 00000000 fc:00 223                            /system/fonts/DancingScript-Bold.ttf
-70ea198000-70ea19c000 r-xp 00000000 fc:00 2344                           /system/lib64/libnativewindow.so
-70ea19c000-70ea1b7000 ---p 00000000 00:00 0 
-70ea1b7000-70ea1b8000 r--p 0000f000 fc:00 2344                           /system/lib64/libnativewindow.so
-70ea1b8000-70ea1b9000 rw-p 00010000 fc:00 2344                           /system/lib64/libnativewindow.so
-70ea1b9000-70ea1bd000 r--s 00000000 fc:00 98                             /system/fonts/NotoSansAhom-Regular.otf
-70ea1bd000-70ea1d1000 r--s 00000000 fc:00 104                            /system/fonts/NotoSerifDevanagari-Bold.ttf
-70ea1d1000-70ea1d4000 r-xp 00000000 fc:00 2923                           /system/lib64/libstdc++.so
-70ea1d4000-70ea1f0000 ---p 00000000 00:00 0 
-70ea1f0000-70ea1f1000 r--p 0000f000 fc:00 2923                           /system/lib64/libstdc++.so
-70ea1f1000-70ea1f2000 rw-p 00010000 fc:00 2923                           /system/lib64/libstdc++.so
-70ea1f2000-70ea1f4000 r--s 00000000 fc:00 117                            /system/fonts/NotoSansLydian-Regular.ttf
-70ea1f4000-70ea211000 r--s 00000000 fc:00 239                            /system/fonts/DancingScript-Regular.ttf
-70ea211000-70ea24a000 r-xp 00000000 fc:00 2933                           /system/lib64/android.hardware.graphics.bufferqueue@1.0.so
-70ea24a000-70ea268000 ---p 00000000 00:00 0 
-70ea268000-70ea26c000 r--p 0003c000 fc:00 2933                           /system/lib64/android.hardware.graphics.bufferqueue@1.0.so
-70ea26c000-70ea26d000 rw-p 00040000 fc:00 2933                           /system/lib64/android.hardware.graphics.bufferqueue@1.0.so
-70ea26d000-70ea26f000 r--s 00000000 fc:00 244                            /system/fonts/NotoSansLycian-Regular.ttf
-70ea26f000-70ea273000 r--s 00000000 fc:00 173                            /system/fonts/NotoSansThaana-Bold.ttf
-70ea273000-70ea287000 r--s 00000000 fc:00 106                            /system/fonts/NotoSerifDevanagari-Regular.ttf
-70ea287000-70ea29e000 r-xp 00000000 fc:00 2938                           /system/lib64/libpiex.so
-70ea29e000-70ea2b6000 ---p 00000000 00:00 0 
-70ea2b6000-70ea2b7000 r--p 0001f000 fc:00 2938                           /system/lib64/libpiex.so
-70ea2b7000-70ea2b8000 rw-p 00020000 fc:00 2938                           /system/lib64/libpiex.so
-70ea2b8000-70ea2c0000 r--s 00000000 fc:00 113                            /system/fonts/NotoSansGurmukhi-Regular.ttf
-70ea2c0000-70ea2c6000 r--s 00000000 fc:00 263                            /system/fonts/NotoSerifGeorgian-Bold.ttf
-70ea2c6000-70ea2cc000 r--s 00000000 fc:00 249                            /system/fonts/NotoSerifGeorgian-Regular.ttf
-70ea2cc000-70ea9b4000 r-xp 00000000 fc:00 2532                           /system/lib64/libhwui.so
-70ea9b4000-70ea9d3000 ---p 00000000 00:00 0 
-70ea9d3000-70eaa0b000 r--p 006e8000 fc:00 2532                           /system/lib64/libhwui.so
-70eaa0b000-70eaa0c000 rw-p 00720000 fc:00 2532                           /system/lib64/libhwui.so
-70eaa0c000-70eaa11000 rw-p 00000000 00:00 0                              [anon:.bss]
-70eaa11000-70eaa12000 r--s 00000000 fc:00 1110                           /system/usr/hyphen-data/hyph-la.hyb
-70eaa12000-70eaa16000 r--s 00000000 fc:00 87                             /system/fonts/NotoSansThaana-Regular.ttf
-70eaa16000-70eaa1b000 r--s 00000000 fc:00 218                            /system/fonts/NotoSansGeorgian-Bold.ttf
-70eaa1b000-70eaa20000 r--s 00000000 fc:00 125                            /system/fonts/NotoSansGeorgian-Regular.ttf
-70eaa20000-70eaa40000 rw-p 00000000 00:05 10271007                       [anon:dalvik-CompilerMetadata]
-70eaa40000-70eaaa0000 r-xp 00000000 fc:00 2384                           /system/lib64/libhidltransport.so
-70eaaa0000-70eaabe000 ---p 00000000 00:00 0 
-70eaabe000-70eaac6000 r--p 00068000 fc:00 2384                           /system/lib64/libhidltransport.so
-70eaac6000-70eaac7000 rw-p 00070000 fc:00 2384                           /system/lib64/libhidltransport.so
-70eaac7000-70eaacb000 r--s 00000000 fc:00 192                            /system/fonts/NotoSerifArmenian-Bold.ttf
-70eaacb000-70eaad0000 r--s 00000000 fc:00 210                            /system/fonts/NotoSansThaiUI-Bold.ttf
-70eaad0000-70eaaf0000 rw-p 00000000 00:05 10271006                       [anon:dalvik-CompilerMetadata]
-70eaaf0000-70eab10000 rw-p 00000000 00:05 10271005                       [anon:dalvik-CompilerMetadata]
-70eab10000-70eab57000 r-xp 00000000 fc:00 2546                           /system/lib64/libmedia_omx.so
-70eab57000-70eab6d000 ---p 00000000 00:00 0 
-70eab6d000-70eab7a000 r--p 00053000 fc:00 2546                           /system/lib64/libmedia_omx.so
-70eab7a000-70eab7f000 rw-p 00060000 fc:00 2546                           /system/lib64/libmedia_omx.so
-70eab7f000-70eab80000 r--s 00000000 fc:00 1119                           /system/usr/hyphen-data/hyph-kn.hyb
-70eab80000-70eab86000 r--s 00000000 fc:00 224                            /system/fonts/NotoSansThaiUI-Regular.ttf
-70eab86000-70eab8b000 r--s 00000000 fc:00 300                            /system/fonts/NotoSerifThai-Bold.ttf
-70eab8b000-70eabab000 rw-p 00000000 00:05 10271004                       [anon:dalvik-CompilerMetadata]
-70eabab000-70eac21000 r-xp 00000000 fc:00 2385                           /system/lib64/libvintf.so
-70eac21000-70eac31000 ---p 00000000 00:00 0 
-70eac31000-70eac36000 r--p 0007b000 fc:00 2385                           /system/lib64/libvintf.so
-70eac36000-70eac37000 rw-p 00080000 fc:00 2385                           /system/lib64/libvintf.so
-70eac37000-70eac39000 rw-p 00000000 00:00 0                              [anon:.bss]
-70eac39000-70eac3a000 r--s 00000000 fc:00 1104                           /system/usr/hyphen-data/hyph-hy.hyb
-70eac3a000-70eac3f000 r--s 00000000 fc:00 212                            /system/fonts/NotoSerifThai-Regular.ttf
-70eac3f000-70eac44000 r--s 00000000 fc:00 220                            /system/fonts/NotoSansThai-Bold.ttf
-70eac44000-70eacb2000 r-xp 00000000 fc:00 2606                           /system/lib64/android.hardware.media.omx@1.0.so
-70eacb2000-70eaccf000 ---p 00000000 00:00 0 
-70eaccf000-70eacd8000 r--p 00077000 fc:00 2606                           /system/lib64/android.hardware.media.omx@1.0.so
-70eacd8000-70eacd9000 rw-p 00080000 fc:00 2606                           /system/lib64/android.hardware.media.omx@1.0.so
-70eacd9000-70eacdf000 r--s 00000000 fc:00 169                            /system/fonts/NotoSansThai-Regular.ttf
-70eacdf000-70eace9000 r--s 00000000 fc:00 140                            /system/fonts/CarroisGothicSC-Regular.ttf
-70eace9000-70ead09000 rw-p 00000000 00:05 10271003                       [anon:dalvik-CompilerMetadata]
-70ead09000-70ead22000 r-xp 00000000 fc:00 2539                           /system/lib64/android.hardware.graphics.mapper@2.1.so
-70ead22000-70ead34000 ---p 00000000 00:00 0 
-70ead34000-70ead37000 r--p 0001d000 fc:00 2539                           /system/lib64/android.hardware.graphics.mapper@2.1.so
-70ead37000-70ead38000 rw-p 00020000 fc:00 2539                           /system/lib64/android.hardware.graphics.mapper@2.1.so
-70ead38000-70ead47000 r--s 00000000 fc:00 188                            /system/fonts/ComingSoon.ttf
-70ead47000-70ead5d000 r-xp 00000000 fc:00 2379                           /system/lib64/libselinux.so
-70ead5d000-70ead76000 ---p 00000000 00:00 0 
-70ead76000-70ead77000 r--p 0001f000 fc:00 2379                           /system/lib64/libselinux.so
-70ead77000-70ead78000 rw-p 00020000 fc:00 2379                           /system/lib64/libselinux.so
-70ead78000-70ead79000 rw-p 00000000 00:00 0                              [anon:.bss]
-70ead79000-70ead7d000 r--s 00000000 fc:00 282                            /system/fonts/NotoSerifArmenian-Regular.ttf
-70ead7d000-70ead82000 r--s 00000000 fc:00 288                            /system/fonts/NotoSerifHebrew-Bold.ttf
-70ead82000-70ead83000 r-xp 00000000 fc:00 2680                           /system/lib64/android.hardware.media@1.0.so
-70ead83000-70eada1000 ---p 00000000 00:00 0 
-70eada1000-70eada2000 r--p 0000f000 fc:00 2680                           /system/lib64/android.hardware.media@1.0.so
-70eada2000-70eada3000 rw-p 00010000 fc:00 2680                           /system/lib64/android.hardware.media@1.0.so
-70eada3000-70eada8000 r--s 00000000 fc:00 248                            /system/fonts/NotoSerifHebrew-Regular.ttf
-70eada8000-70eadb9000 r--s 00000000 fc:00 252                            /system/fonts/CutiveMono.ttf
-70eadb9000-70eadd9000 r--s 00000000 00:10 16641                          /dev/__properties__/u:object_r:radio_prop:s0
-70eadd9000-70eadda000 r-xp 00000000 fc:00 2533                           /system/lib64/android.hardware.graphics.common@1.0.so
-70eadda000-70eadf8000 ---p 00000000 00:00 0 
-70eadf8000-70eadf9000 r--p 0000f000 fc:00 2533                           /system/lib64/android.hardware.graphics.common@1.0.so
-70eadf9000-70eadfa000 rw-p 00010000 fc:00 2533                           /system/lib64/android.hardware.graphics.common@1.0.so
-70eadfa000-70eadfb000 r--s 00000000 fc:00 1126                           /system/usr/hyphen-data/hyph-hr.hyb
-70eadfb000-70eadfd000 r--s 00000000 fc:00 194                            /system/fonts/NotoSansLisu-Regular.ttf
-70eadfd000-70eae18000 r--s 00000000 fc:00 201                            /system/fonts/DroidSansMono.ttf
-70eae18000-70eae3b000 r-xp 00000000 fc:00 2925                           /system/lib64/liblzma.so
-70eae3b000-70eae57000 ---p 00000000 00:00 0 
-70eae57000-70eae58000 r--p 0002f000 fc:00 2925                           /system/lib64/liblzma.so
-70eae58000-70eae59000 rw-p 00030000 fc:00 2925                           /system/lib64/liblzma.so
-70eae59000-70eae5f000 rw-p 00000000 00:00 0                              [anon:.bss]
-70eae5f000-70eae62000 r--s 00000000 fc:00 103                            /system/fonts/NotoSansLimbu-Regular.ttf
-70eae62000-70eae67000 r--s 00000000 fc:00 236                            /system/fonts/NotoSansHebrew-Bold.ttf
-70eae67000-70eae84000 r--s 001c2000 fc:00 990                            /system/framework/ext.jar
-70eae84000-70eaea4000 rw-p 00000000 00:05 10269720                       [anon:dalvik-LinearAlloc]
-70eaea4000-70eaede000 r-xp 00000000 fc:00 2924                           /system/lib64/libwilhelm.so
-70eaede000-70eaefa000 ---p 00000000 00:00 0 
-70eaefa000-70eaeff000 r--p 0003b000 fc:00 2924                           /system/lib64/libwilhelm.so
-70eaeff000-70eaf00000 rw-p 00040000 fc:00 2924                           /system/lib64/libwilhelm.so
-70eaf00000-70eaf03000 r--s 00000000 fc:00 242                            /system/fonts/NotoSansElbasan-Regular.otf
-70eaf03000-70eaf21000 r-xp 00000000 fc:00 2415                           /system/lib64/libdrmframework.so
-70eaf21000-70eaf38000 ---p 00000000 00:00 0 
-70eaf38000-70eaf3d000 r--p 0002b000 fc:00 2415                           /system/lib64/libdrmframework.so
-70eaf3d000-70eaf3e000 rw-p 00030000 fc:00 2415                           /system/lib64/libdrmframework.so
-70eaf3e000-70eaf43000 r--s 00000000 fc:00 70                             /system/fonts/NotoSansHebrew-Regular.ttf
-70eaf43000-70eaf44000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eaf44000-70eaf48000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eaf48000-70eaf49000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eaf49000-70eaf4c000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eaf4c000-70eaf4d000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eaf4d000-70eaf4e000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eaf4e000-70eaf52000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eaf52000-70eaf98000 r-xp 00000000 fc:00 2426                           /system/lib64/libunwindstack.so
-70eaf98000-70eafb6000 ---p 00000000 00:00 0 
-70eafb6000-70eafbd000 r--p 00049000 fc:00 2426                           /system/lib64/libunwindstack.so
-70eafbd000-70eafbe000 rw-p 00050000 fc:00 2426                           /system/lib64/libunwindstack.so
-70eafbe000-70eafc0000 r--s 00000000 fc:00 162                            /system/fonts/NotoSansKayahLi-Regular.ttf
-70eafc0000-70eafe4000 r-xp 00000000 fc:00 2944                           /system/lib64/libvulkan.so
-70eafe4000-70eaffc000 ---p 00000000 00:00 0 
-70eaffc000-70eaffe000 r--p 0002e000 fc:00 2944                           /system/lib64/libvulkan.so
-70eaffe000-70eafff000 rw-p 00030000 fc:00 2944                           /system/lib64/libvulkan.so
-70eafff000-70eb001000 r--s 00000000 fc:00 180                            /system/fonts/NotoSansInscriptionalParthian-Regular.ttf
-70eb001000-70eb01d000 r-xp 00000000 fc:00 2400                           /system/lib64/libbufferhubqueue.so
-70eb01d000-70eb030000 ---p 00000000 00:00 0 
-70eb030000-70eb031000 r--p 0001f000 fc:00 2400                           /system/lib64/libbufferhubqueue.so
-70eb031000-70eb032000 rw-p 00020000 fc:00 2400                           /system/lib64/libbufferhubqueue.so
-70eb032000-70eb036000 r--s 00000000 fc:00 269                            /system/fonts/NotoSansArmenian-Bold.ttf
-70eb036000-70eb037000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb037000-70eb03a000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb03a000-70eb03b000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb03b000-70eb03c000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eb03c000-70eb040000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eb040000-70eb042000 r-xp 00000000 fc:00 2935                           /system/lib64/libhardware.so
-70eb042000-70eb05f000 ---p 00000000 00:00 0 
-70eb05f000-70eb060000 r--p 0000f000 fc:00 2935                           /system/lib64/libhardware.so
-70eb060000-70eb061000 rw-p 00010000 fc:00 2935                           /system/lib64/libhardware.so
-70eb061000-70eb063000 r--s 00000000 fc:00 171                            /system/fonts/NotoSansInscriptionalPahlavi-Regular.ttf
-70eb063000-70eb064000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb064000-70eb067000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb067000-70eb068000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb068000-70eb069000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eb069000-70eb06d000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eb06d000-70eb06e000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb06e000-70eb071000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb071000-70eb072000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb072000-70eb073000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eb073000-70eb077000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eb077000-70eb078000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb078000-70eb07b000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb07b000-70eb07c000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb07c000-70eb07d000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eb07d000-70eb081000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eb081000-70eb082000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb082000-70eb085000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb085000-70eb086000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb086000-70eb09d000 r-xp 00000000 fc:00 2604                           /system/lib64/libz.so
-70eb09d000-70eb0b5000 ---p 00000000 00:00 0 
-70eb0b5000-70eb0b6000 r--p 0001f000 fc:00 2604                           /system/lib64/libz.so
-70eb0b6000-70eb0b7000 rw-p 00020000 fc:00 2604                           /system/lib64/libz.so
-70eb0b7000-70eb0bb000 r--s 00000000 fc:00 289                            /system/fonts/NotoSansArmenian-Regular.ttf
-70eb0bb000-70eb0bc000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eb0bc000-70eb0c0000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eb0c0000-70eb0c1000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb0c1000-70eb0c4000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb0c4000-70eb0c5000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb0c5000-70eb0c6000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70eb0c6000-70eb0ca000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70eb0ca000-70eb0cb000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb0cb000-70eb0ce000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70eb0ce000-70eb0cf000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70eb0cf000-70eb0ef000 rw-p 00000000 00:05 10270988                       [anon:dalvik-LinearAlloc]
-70eb0ef000-70eb5bb000 r-xp 00000000 fc:00 2374                           /system/lib64/libpdfium.so
-70eb5bb000-70eb5cf000 ---p 00000000 00:00 0 
-70eb5cf000-70eb5e6000 r--p 004d9000 fc:00 2374                           /system/lib64/libpdfium.so
-70eb5e6000-70eb5ea000 rw-p 004f0000 fc:00 2374                           /system/lib64/libpdfium.so
-70eb5ea000-70eb5f1000 rw-p 00000000 00:00 0                              [anon:.bss]
-70eb5f1000-70eb5f2000 r--s 00000000 fc:00 1094                           /system/usr/hyphen-data/hyph-hi.hyb
-70eb5f2000-70eb5f6000 rw-p 00000000 00:05 10270982                       [anon:dalvik-thread local mark stack]
-70eb5f6000-70eb5fa000 rw-p 00000000 00:05 10270981                       [anon:dalvik-thread local mark stack]
-70eb5fa000-70eb5fe000 rw-p 00000000 00:05 10270980                       [anon:dalvik-thread local mark stack]
-70eb5fe000-70eb602000 rw-p 00000000 00:05 10270979                       [anon:dalvik-thread local mark stack]
-70eb602000-70eb606000 rw-p 00000000 00:05 10270978                       [anon:dalvik-thread local mark stack]
-70eb606000-70eb60a000 rw-p 00000000 00:05 10270977                       [anon:dalvik-thread local mark stack]
-70eb60a000-70eb60e000 rw-p 00000000 00:05 10270976                       [anon:dalvik-thread local mark stack]
-70eb60e000-70eb612000 rw-p 00000000 00:05 10270975                       [anon:dalvik-thread local mark stack]
-70eb612000-70eb616000 rw-p 00000000 00:05 10270974                       [anon:dalvik-thread local mark stack]
-70eb616000-70eb61a000 r-xp 00000000 fc:00 2479                           /system/lib64/libspeexresampler.so
-70eb61a000-70eb635000 ---p 00000000 00:00 0 
-70eb635000-70eb636000 r--p 0000f000 fc:00 2479                           /system/lib64/libspeexresampler.so
-70eb636000-70eb637000 rw-p 00010000 fc:00 2479                           /system/lib64/libspeexresampler.so
-70eb637000-70eb639000 r--s 00000000 fc:00 299                            /system/fonts/NotoSansImperialAramaic-Regular.ttf
-70eb639000-70eb63d000 rw-p 00000000 00:05 10270973                       [anon:dalvik-thread local mark stack]
-70eb63d000-70eb641000 rw-p 00000000 00:05 10270972                       [anon:dalvik-thread local mark stack]
-70eb641000-70eb645000 rw-p 00000000 00:05 10270971                       [anon:dalvik-thread local mark stack]
-70eb645000-70eb649000 rw-p 00000000 00:05 10270970                       [anon:dalvik-thread local mark stack]
-70eb649000-70eb64d000 rw-p 00000000 00:05 10270969                       [anon:dalvik-thread local mark stack]
-70eb64d000-70eb651000 rw-p 00000000 00:05 10270968                       [anon:dalvik-thread local mark stack]
-70eb651000-70eb655000 rw-p 00000000 00:05 10270967                       [anon:dalvik-thread local mark stack]
-70eb655000-70eb659000 rw-p 00000000 00:05 10270966                       [anon:dalvik-thread local mark stack]
-70eb659000-70eb65d000 rw-p 00000000 00:05 10270965                       [anon:dalvik-thread local mark stack]
-70eb65d000-70eb661000 rw-p 00000000 00:05 10270964                       [anon:dalvik-thread local mark stack]
-70eb661000-70eb6c5000 r-xp 00000000 fc:00 2461                           /system/lib64/libhidl-gen-utils.so
-70eb6c5000-70eb6df000 ---p 00000000 00:00 0 
-70eb6df000-70eb6e1000 r--p 0006e000 fc:00 2461                           /system/lib64/libhidl-gen-utils.so
-70eb6e1000-70eb6e2000 rw-p 00070000 fc:00 2461                           /system/lib64/libhidl-gen-utils.so
-70eb6e2000-70eb6e6000 rw-p 00000000 00:05 10270963                       [anon:dalvik-thread local mark stack]
-70eb6e6000-70eb6ea000 rw-p 00000000 00:05 10270962                       [anon:dalvik-thread local mark stack]
-70eb6ea000-70eb6ee000 rw-p 00000000 00:05 10270961                       [anon:dalvik-thread local mark stack]
-70eb6ee000-70eb6f2000 rw-p 00000000 00:05 10270960                       [anon:dalvik-thread local mark stack]
-70eb6f2000-70eb6f6000 rw-p 00000000 00:05 10270959                       [anon:dalvik-thread local mark stack]
-70eb6f6000-70eb6fa000 rw-p 00000000 00:05 10270958                       [anon:dalvik-thread local mark stack]
-70eb6fa000-70eb6fe000 rw-p 00000000 00:05 10270957                       [anon:dalvik-thread local mark stack]
-70eb6fe000-70eb702000 rw-p 00000000 00:05 10270956                       [anon:dalvik-thread local mark stack]
-70eb702000-70eb706000 rw-p 00000000 00:05 10270955                       [anon:dalvik-thread local mark stack]
-70eb706000-70eb70a000 rw-p 00000000 00:05 10270954                       [anon:dalvik-thread local mark stack]
-70eb70a000-70eb70e000 rw-p 00000000 00:05 10270953                       [anon:dalvik-thread local mark stack]
-70eb70e000-70eb712000 rw-p 00000000 00:05 10270952                       [anon:dalvik-thread local mark stack]
-70eb712000-70eb71a000 r-xp 00000000 fc:00 2652                           /system/lib64/libcamera_metadata.so
-70eb71a000-70eb72f000 ---p 00000000 00:00 0 
-70eb72f000-70eb730000 r--p 0000f000 fc:00 2652                           /system/lib64/libcamera_metadata.so
-70eb730000-70eb732000 rw-p 00010000 fc:00 2652                           /system/lib64/libcamera_metadata.so
-70eb732000-70eb734000 r--s 00000000 fc:00 131                            /system/fonts/NotoSansHanunoo-Regular.ttf
-70eb734000-70eb738000 rw-p 00000000 00:05 10270951                       [anon:dalvik-thread local mark stack]
-70eb738000-70eb73c000 rw-p 00000000 00:05 10270950                       [anon:dalvik-thread local mark stack]
-70eb73c000-70eb740000 rw-p 00000000 00:05 10270949                       [anon:dalvik-thread local mark stack]
-70eb740000-70eb744000 rw-p 00000000 00:05 10270948                       [anon:dalvik-thread local mark stack]
-70eb744000-70eb748000 rw-p 00000000 00:05 10270947                       [anon:dalvik-thread local mark stack]
-70eb748000-70eb74c000 rw-p 00000000 00:05 10270946                       [anon:dalvik-thread local mark stack]
-70eb74c000-70eb750000 rw-p 00000000 00:05 10270945                       [anon:dalvik-thread local mark stack]
-70eb750000-70eb754000 rw-p 00000000 00:05 10270944                       [anon:dalvik-thread local mark stack]
-70eb754000-70eb758000 rw-p 00000000 00:05 10270943                       [anon:dalvik-thread local mark stack]
-70eb758000-70eb75c000 rw-p 00000000 00:05 10270942                       [anon:dalvik-thread local mark stack]
-70eb75c000-70eb760000 rw-p 00000000 00:05 10270941                       [anon:dalvik-thread local mark stack]
-70eb760000-70eb764000 rw-p 00000000 00:05 10270940                       [anon:dalvik-thread local mark stack]
-70eb764000-70eb767000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb767000-70eb768000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb768000-70eb76c000 rw-p 00000000 00:05 10270939                       [anon:dalvik-thread local mark stack]
-70eb76c000-70eb770000 rw-p 00000000 00:05 10270938                       [anon:dalvik-thread local mark stack]
-70eb770000-70eb771000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb771000-70eb774000 r--s 00000000 fc:00 231                            /system/fonts/NotoSansDeseret-Regular.ttf
-70eb774000-70eb778000 rw-p 00000000 00:05 10270937                       [anon:dalvik-thread local mark stack]
-70eb778000-70eb77c000 rw-p 00000000 00:05 10270936                       [anon:dalvik-thread local mark stack]
-70eb77c000-70eb780000 rw-p 00000000 00:05 10270935                       [anon:dalvik-thread local mark stack]
-70eb780000-70eb784000 rw-p 00000000 00:05 10270934                       [anon:dalvik-thread local mark stack]
-70eb784000-70eb788000 rw-p 00000000 00:05 10270933                       [anon:dalvik-thread local mark stack]
-70eb788000-70eb78c000 rw-p 00000000 00:05 10270932                       [anon:dalvik-thread local mark stack]
-70eb78c000-70eb790000 rw-p 00000000 00:05 10270931                       [anon:dalvik-thread local mark stack]
-70eb790000-70eb794000 rw-p 00000000 00:05 10270930                       [anon:dalvik-thread local mark stack]
-70eb794000-70eb798000 rw-p 00000000 00:05 10270929                       [anon:dalvik-thread local mark stack]
-70eb798000-70eb79c000 rw-p 00000000 00:05 10270928                       [anon:dalvik-thread local mark stack]
-70eb79c000-70eb7a0000 rw-p 00000000 00:05 10270927                       [anon:dalvik-thread local mark stack]
-70eb7a0000-70eb7a1000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7a1000-70eb7a3000 r--s 00000000 fc:00 176                            /system/fonts/NotoSansGothic-Regular.ttf
-70eb7a3000-70eb7a7000 rw-p 00000000 00:05 10270926                       [anon:dalvik-thread local mark stack]
-70eb7a7000-70eb7a8000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7a8000-70eb7a9000 r--s 00000000 fc:00 1109                           /system/usr/hyphen-data/hyph-gu.hyb
-70eb7a9000-70eb7ad000 rw-p 00000000 00:05 10270925                       [anon:dalvik-thread local mark stack]
-70eb7ad000-70eb7ae000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7ae000-70eb7af000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7af000-70eb7b0000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7b0000-70eb7b2000 r--s 00000000 fc:00 191                            /system/fonts/NotoSansCypriot-Regular.ttf
-70eb7b2000-70eb7b6000 rw-p 00000000 00:05 10270924                       [anon:dalvik-thread local mark stack]
-70eb7b6000-70eb7ba000 rw-p 00000000 00:05 10270923                       [anon:dalvik-thread local mark stack]
-70eb7ba000-70eb7be000 rw-p 00000000 00:05 10270922                       [anon:dalvik-thread local mark stack]
-70eb7be000-70eb7c2000 rw-p 00000000 00:05 10270921                       [anon:dalvik-thread local mark stack]
-70eb7c2000-70eb7c6000 rw-p 00000000 00:05 10270920                       [anon:dalvik-thread local mark stack]
-70eb7c6000-70eb7ca000 rw-p 00000000 00:05 10270919                       [anon:dalvik-thread local mark stack]
-70eb7ca000-70eb7ce000 rw-p 00000000 00:05 10270918                       [anon:dalvik-thread local mark stack]
-70eb7ce000-70eb7d2000 rw-p 00000000 00:05 10270917                       [anon:dalvik-thread local mark stack]
-70eb7d2000-70eb7d6000 rw-p 00000000 00:05 10270916                       [anon:dalvik-thread local mark stack]
-70eb7d6000-70eb7d7000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70eb7d7000-70eb7db000 rw-p 00000000 00:05 10270915                       [anon:dalvik-thread local mark stack]
-70eb7db000-70eb7df000 rw-p 00000000 00:05 10270914                       [anon:dalvik-thread local mark stack]
-70eb7df000-70eb7e3000 rw-p 00000000 00:05 10270913                       [anon:dalvik-thread local mark stack]
-70eb7e3000-70eb7e7000 rw-p 00000000 00:05 10270912                       [anon:dalvik-thread local mark stack]
-70eb7e7000-70eb7e8000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7e8000-70eb7ea000 r--s 00000000 fc:00 174                            /system/fonts/NotoSansCarian-Regular.ttf
-70eb7ea000-70eb7ee000 rw-p 00000000 00:05 10270911                       [anon:dalvik-thread local mark stack]
-70eb7ee000-70eb7f2000 rw-p 00000000 00:05 10270910                       [anon:dalvik-thread local mark stack]
-70eb7f2000-70eb7f6000 rw-p 00000000 00:05 10270909                       [anon:dalvik-thread local mark stack]
-70eb7f6000-70eb7f7000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb7f7000-70eb7f8000 r--s 00000000 fc:00 1096                           /system/usr/hyphen-data/hyph-eu.hyb
-70eb7f8000-70eb7fc000 rw-p 00000000 00:05 10270908                       [anon:dalvik-thread local mark stack]
-70eb7fc000-70eb800000 rw-p 00000000 00:05 10270907                       [anon:dalvik-thread local mark stack]
-70eb800000-70eb804000 rw-p 00000000 00:05 10270906                       [anon:dalvik-thread local mark stack]
-70eb804000-70eb808000 rw-p 00000000 00:05 10270905                       [anon:dalvik-thread local mark stack]
-70eb808000-70eb80c000 rw-p 00000000 00:05 10270904                       [anon:dalvik-thread local mark stack]
-70eb80c000-70eb810000 rw-p 00000000 00:05 10270903                       [anon:dalvik-thread local mark stack]
-70eb810000-70eb814000 rw-p 00000000 00:05 10270902                       [anon:dalvik-thread local mark stack]
-70eb814000-70eb815000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70eb815000-70eb819000 rw-p 00000000 00:05 10270901                       [anon:dalvik-thread local mark stack]
-70eb819000-70eb81d000 rw-p 00000000 00:05 10270900                       [anon:dalvik-thread local mark stack]
-70eb81d000-70eb81e000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb81e000-70eb822000 rw-p 00000000 00:05 10270899                       [anon:dalvik-thread local mark stack]
-70eb822000-70eb826000 rw-p 00000000 00:05 10270898                       [anon:dalvik-thread local mark stack]
-70eb826000-70eb82a000 rw-p 00000000 00:05 10270897                       [anon:dalvik-thread local mark stack]
-70eb82a000-70eb82e000 rw-p 00000000 00:05 10270896                       [anon:dalvik-thread local mark stack]
-70eb82e000-70eb832000 rw-p 00000000 00:05 10270895                       [anon:dalvik-thread local mark stack]
-70eb832000-70eb836000 rw-p 00000000 00:05 10270894                       [anon:dalvik-thread local mark stack]
-70eb836000-70eb837000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb837000-70eb83b000 rw-p 00000000 00:05 10270893                       [anon:dalvik-thread local mark stack]
-70eb83b000-70eb83f000 rw-p 00000000 00:05 10270892                       [anon:dalvik-thread local mark stack]
-70eb83f000-70eb843000 rw-p 00000000 00:05 10270891                       [anon:dalvik-thread local mark stack]
-70eb843000-70eb847000 rw-p 00000000 00:05 10270890                       [anon:dalvik-thread local mark stack]
-70eb847000-70eb84b000 rw-p 00000000 00:05 10270889                       [anon:dalvik-thread local mark stack]
-70eb84b000-70eb84f000 rw-p 00000000 00:05 10270888                       [anon:dalvik-thread local mark stack]
-70eb84f000-70eb850000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb850000-70eb854000 rw-p 00000000 00:05 10270887                       [anon:dalvik-thread local mark stack]
-70eb854000-70eb858000 rw-p 00000000 00:05 10270886                       [anon:dalvik-thread local mark stack]
-70eb858000-70eb85c000 rw-p 00000000 00:05 10270885                       [anon:dalvik-thread local mark stack]
-70eb85c000-70eb860000 rw-p 00000000 00:05 10270884                       [anon:dalvik-thread local mark stack]
-70eb860000-70eb864000 rw-p 00000000 00:05 10270883                       [anon:dalvik-thread local mark stack]
-70eb864000-70eb868000 rw-p 00000000 00:05 10270882                       [anon:dalvik-thread local mark stack]
-70eb868000-70eb869000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb869000-70eb86d000 rw-p 00000000 00:05 10270881                       [anon:dalvik-thread local mark stack]
-70eb86d000-70eb871000 rw-p 00000000 00:05 10270880                       [anon:dalvik-thread local mark stack]
-70eb871000-70eb875000 rw-p 00000000 00:05 10270879                       [anon:dalvik-thread local mark stack]
-70eb875000-70eb879000 rw-p 00000000 00:05 10270878                       [anon:dalvik-thread local mark stack]
-70eb879000-70eb87d000 rw-p 00000000 00:05 10270877                       [anon:dalvik-thread local mark stack]
-70eb87d000-70eb881000 rw-p 00000000 00:05 10270876                       [anon:dalvik-thread local mark stack]
-70eb881000-70eb885000 rw-p 00000000 00:05 10270875                       [anon:dalvik-thread local mark stack]
-70eb885000-70eb889000 rw-p 00000000 00:05 10270874                       [anon:dalvik-thread local mark stack]
-70eb889000-70eb88d000 rw-p 00000000 00:05 10270873                       [anon:dalvik-thread local mark stack]
-70eb88d000-70eb891000 rw-p 00000000 00:05 10270872                       [anon:dalvik-thread local mark stack]
-70eb891000-70eb892000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb892000-70eb896000 rw-p 00000000 00:05 10270871                       [anon:dalvik-thread local mark stack]
-70eb896000-70eb89a000 rw-p 00000000 00:05 10270870                       [anon:dalvik-thread local mark stack]
-70eb89a000-70eb89b000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70eb89b000-70eb89c000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70eb89c000-70eb8a0000 rw-p 00000000 00:05 10270869                       [anon:dalvik-thread local mark stack]
-70eb8a0000-70eb8a4000 rw-p 00000000 00:05 10270868                       [anon:dalvik-thread local mark stack]
-70eb8a4000-70eb8a5000 r--p 00000000 00:00 0                              [anon:atexit handlers]
-70eb8a5000-70eb8a9000 rw-p 00000000 00:05 10270867                       [anon:dalvik-thread local mark stack]
-70eb8a9000-70eb8ad000 rw-p 00000000 00:05 10270866                       [anon:dalvik-thread local mark stack]
-70eb8ad000-70eb8b1000 rw-p 00000000 00:05 10270865                       [anon:dalvik-thread local mark stack]
-70eb8b1000-70eb8b5000 rw-p 00000000 00:05 10270864                       [anon:dalvik-thread local mark stack]
-70eb8b5000-70eb8b9000 rw-p 00000000 00:05 10270863                       [anon:dalvik-thread local mark stack]
-70eb8b9000-70eb8bd000 rw-p 00000000 00:05 10270862                       [anon:dalvik-thread local mark stack]
-70eb8bd000-70eb8be000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb8be000-70eb8c1000 r--s 00000000 fc:00 168                            /system/fonts/NotoSansAvestan-Regular.ttf
-70eb8c1000-70eb8c5000 rw-p 00000000 00:05 10270861                       [anon:dalvik-thread local mark stack]
-70eb8c5000-70eb8c9000 rw-p 00000000 00:05 10270860                       [anon:dalvik-thread local mark stack]
-70eb8c9000-70eb8cd000 rw-p 00000000 00:05 10270859                       [anon:dalvik-thread local mark stack]
-70eb8cd000-70eb8d1000 rw-p 00000000 00:05 10270858                       [anon:dalvik-thread local mark stack]
-70eb8d1000-70eb8d5000 rw-p 00000000 00:05 10270857                       [anon:dalvik-thread local mark stack]
-70eb8d5000-70eb8d7000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb8d7000-70eb8db000 rw-p 00000000 00:05 10270856                       [anon:dalvik-thread local mark stack]
-70eb8db000-70eb8df000 rw-p 00000000 00:05 10270855                       [anon:dalvik-thread local mark stack]
-70eb8df000-70eb8e3000 rw-p 00000000 00:05 10270854                       [anon:dalvik-thread local mark stack]
-70eb8e3000-70eb8e7000 rw-p 00000000 00:05 10270853                       [anon:dalvik-thread local mark stack]
-70eb8e7000-70eb8eb000 rw-p 00000000 00:05 10270852                       [anon:dalvik-thread local mark stack]
-70eb8eb000-70eb8ec000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb8ec000-70eb8ed000 r--s 00000000 fc:00 1099                           /system/usr/hyphen-data/hyph-bn.hyb
-70eb8ed000-70eb8f1000 rw-p 00000000 00:05 10270851                       [anon:dalvik-thread local mark stack]
-70eb8f1000-70eb8f5000 rw-p 00000000 00:05 10270850                       [anon:dalvik-thread local mark stack]
-70eb8f5000-70eb8f9000 rw-p 00000000 00:05 10270849                       [anon:dalvik-thread local mark stack]
-70eb8f9000-70eb8fd000 rw-p 00000000 00:05 10270848                       [anon:dalvik-thread local mark stack]
-70eb8fd000-70eb901000 rw-p 00000000 00:05 10270847                       [anon:dalvik-thread local mark stack]
-70eb901000-70eb905000 rw-p 00000000 00:05 10270846                       [anon:dalvik-thread local mark stack]
-70eb905000-70eb909000 rw-p 00000000 00:05 10270845                       [anon:dalvik-thread local mark stack]
-70eb909000-70eb90d000 rw-p 00000000 00:05 10270844                       [anon:dalvik-thread local mark stack]
-70eb90d000-70eb911000 rw-p 00000000 00:05 10270843                       [anon:dalvik-thread local mark stack]
-70eb911000-70eb915000 rw-p 00000000 00:05 10270842                       [anon:dalvik-thread local mark stack]
-70eb915000-70eb916000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb916000-70eb917000 r--s 00000000 fc:00 1114                           /system/usr/hyphen-data/hyph-bg.hyb
-70eb917000-70eb91b000 rw-p 00000000 00:05 10270841                       [anon:dalvik-thread local mark stack]
-70eb91b000-70eb91c000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb91c000-70eb91d000 r--s 00000000 fc:00 1133                           /system/usr/hyphen-data/hyph-as.hyb
-70eb91d000-70eb921000 rw-p 00000000 00:05 10270840                       [anon:dalvik-thread local mark stack]
-70eb921000-70eb925000 rw-p 00000000 00:05 10270839                       [anon:dalvik-thread local mark stack]
-70eb925000-70eb926000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70eb926000-70eb927000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb927000-70eb929000 r--s 00000000 fc:00 203                            /system/fonts/NotoSansBuhid-Regular.ttf
-70eb929000-70eb92d000 rw-p 00000000 00:05 10270838                       [anon:dalvik-thread local mark stack]
-70eb92d000-70eb931000 rw-p 00000000 00:05 10270837                       [anon:dalvik-thread local mark stack]
-70eb931000-70eb935000 rw-p 00000000 00:05 10270836                       [anon:dalvik-thread local mark stack]
-70eb935000-70eb939000 rw-p 00000000 00:05 10270835                       [anon:dalvik-thread local mark stack]
-70eb939000-70eb93d000 rw-p 00000000 00:05 10270834                       [anon:dalvik-thread local mark stack]
-70eb93d000-70eb941000 rw-p 00000000 00:05 10270833                       [anon:dalvik-thread local mark stack]
-70eb941000-70eb945000 rw-p 00000000 00:05 10270832                       [anon:dalvik-thread local mark stack]
-70eb945000-70eb949000 rw-p 00000000 00:05 10270831                       [anon:dalvik-thread local mark stack]
-70eb949000-70eb94d000 rw-p 00000000 00:05 10270830                       [anon:dalvik-thread local mark stack]
-70eb94d000-70eb951000 rw-p 00000000 00:05 10270829                       [anon:dalvik-thread local mark stack]
-70eb951000-70eb991000 rw-p 00000000 00:05 10270722                       [anon:dalvik-mark stack]
-70eb991000-70eb992000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb992000-70eb996000 rw-p 00000000 00:05 10270828                       [anon:dalvik-thread local mark stack]
-70eb996000-70eb99a000 rw-p 00000000 00:05 10270827                       [anon:dalvik-thread local mark stack]
-70eb99a000-70eb99e000 rw-p 00000000 00:05 10270826                       [anon:dalvik-thread local mark stack]
-70eb99e000-70eb9a2000 rw-p 00000000 00:05 10270825                       [anon:dalvik-thread local mark stack]
-70eb9a2000-70eb9a4000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb9a4000-70eb9a8000 rw-p 00000000 00:05 10270824                       [anon:dalvik-thread local mark stack]
-70eb9a8000-70eb9ac000 rw-p 00000000 00:05 10270823                       [anon:dalvik-thread local mark stack]
-70eb9ac000-70eb9b0000 rw-p 00000000 00:05 10270822                       [anon:dalvik-thread local mark stack]
-70eb9b0000-70eb9b1000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb9b1000-70eb9b2000 r--s 00021000 fc:01 1180                           /vendor/overlay/framework-res__auto_generated_rro.apk
-70eb9b2000-70eb9b6000 rw-p 00000000 00:05 10270821                       [anon:dalvik-thread local mark stack]
-70eb9b6000-70eb9ba000 rw-p 00000000 00:05 10270820                       [anon:dalvik-thread local mark stack]
-70eb9ba000-70eb9be000 rw-p 00000000 00:05 10270819                       [anon:dalvik-thread local mark stack]
-70eb9be000-70eb9c2000 rw-p 00000000 00:05 10270818                       [anon:dalvik-thread local mark stack]
-70eb9c2000-70eb9c6000 rw-p 00000000 00:05 10270817                       [anon:dalvik-thread local mark stack]
-70eb9c6000-70eb9ca000 rw-p 00000000 00:05 10270816                       [anon:dalvik-thread local mark stack]
-70eb9ca000-70eb9ce000 rw-p 00000000 00:05 10270815                       [anon:dalvik-thread local mark stack]
-70eb9ce000-70eb9cf000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb9cf000-70eb9d1000 r--s 00000000 fc:00 213                            /system/fonts/NotoSansBuginese-Regular.ttf
-70eb9d1000-70eb9d5000 rw-p 00000000 00:05 10270814                       [anon:dalvik-thread local mark stack]
-70eb9d5000-70eb9d9000 rw-p 00000000 00:05 10270813                       [anon:dalvik-thread local mark stack]
-70eb9d9000-70eb9dd000 rw-p 00000000 00:05 10270812                       [anon:dalvik-thread local mark stack]
-70eb9dd000-70eb9e1000 rw-p 00000000 00:05 10270811                       [anon:dalvik-thread local mark stack]
-70eb9e1000-70eb9e5000 rw-p 00000000 00:05 10270810                       [anon:dalvik-thread local mark stack]
-70eb9e5000-70eb9e9000 rw-p 00000000 00:05 10270809                       [anon:dalvik-thread local mark stack]
-70eb9e9000-70eb9ed000 rw-p 00000000 00:05 10270808                       [anon:dalvik-thread local mark stack]
-70eb9ed000-70eb9f1000 rw-p 00000000 00:05 10270807                       [anon:dalvik-thread local mark stack]
-70eb9f1000-70eb9f5000 rw-p 00000000 00:05 10270806                       [anon:dalvik-thread local mark stack]
-70eb9f5000-70eb9f6000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eb9f6000-70eb9f8000 rw-p 00000000 00:05 10271002                       [anon:dalvik-indirect ref table]
-70eb9f8000-70eb9fc000 rw-p 00000000 00:05 10270805                       [anon:dalvik-thread local mark stack]
-70eb9fc000-70eb9fd000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eb9fd000-70eb9ff000 rw-p 00000000 00:05 10270999                       [anon:dalvik-indirect ref table]
-70eb9ff000-70eba00000 r--s 00000000 fc:00 983                            /system/framework/com.google.vr.platform.jar
-70eba00000-70eba04000 rw-p 00000000 00:05 10270804                       [anon:dalvik-thread local mark stack]
-70eba04000-70eba08000 rw-p 00000000 00:05 10270803                       [anon:dalvik-thread local mark stack]
-70eba08000-70eba0c000 rw-p 00000000 00:05 10270802                       [anon:dalvik-thread local mark stack]
-70eba0c000-70eba10000 rw-p 00000000 00:05 10270801                       [anon:dalvik-thread local mark stack]
-70eba10000-70eba14000 rw-p 00000000 00:05 10270800                       [anon:dalvik-thread local mark stack]
-70eba14000-70eba18000 rw-p 00000000 00:05 10270799                       [anon:dalvik-thread local mark stack]
-70eba18000-70eba1c000 rw-p 00000000 00:05 10270798                       [anon:dalvik-thread local mark stack]
-70eba1c000-70eba20000 rw-p 00000000 00:05 10270797                       [anon:dalvik-thread local mark stack]
-70eba20000-70eba24000 rw-p 00000000 00:05 10270796                       [anon:dalvik-thread local mark stack]
-70eba24000-70eba28000 rw-p 00000000 00:05 10270795                       [anon:dalvik-thread local mark stack]
-70eba28000-70eba2c000 rw-p 00000000 00:05 10270794                       [anon:dalvik-thread local mark stack]
-70eba2c000-70eba2d000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eba2d000-70eba2e000 r--s 00000000 fc:00 881                            /system/framework/android.test.base.jar
-70eba2e000-70eba2f000 r--s 00000000 fc:00 707                            /system/framework/framework-oahl-backward-compatibility.jar
-70eba2f000-70eba30000 r--s 00000000 fc:00 705                            /system/framework/android.hidl.manager-V1.0-java.jar
-70eba30000-70eba34000 rw-p 00000000 00:05 10270793                       [anon:dalvik-thread local mark stack]
-70eba34000-70eba38000 rw-p 00000000 00:05 10270792                       [anon:dalvik-thread local mark stack]
-70eba38000-70eba3c000 rw-p 00000000 00:05 10270791                       [anon:dalvik-thread local mark stack]
-70eba3c000-70eba40000 rw-p 00000000 00:05 10270790                       [anon:dalvik-thread local mark stack]
-70eba40000-70eba44000 rw-p 00000000 00:05 10270789                       [anon:dalvik-thread local mark stack]
-70eba44000-70eba48000 rw-p 00000000 00:05 10270788                       [anon:dalvik-thread local mark stack]
-70eba48000-70eba4c000 rw-p 00000000 00:05 10270787                       [anon:dalvik-thread local mark stack]
-70eba4c000-70eba50000 rw-p 00000000 00:05 10270786                       [anon:dalvik-thread local mark stack]
-70eba50000-70eba52000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70eba52000-70eba53000 r--s 00000000 fc:00 971                            /system/framework/android.hidl.base-V1.0-java.jar
-70eba53000-70eba57000 rw-p 00000000 00:05 10270785                       [anon:dalvik-thread local mark stack]
-70eba57000-70eba5b000 rw-p 00000000 00:05 10270784                       [anon:dalvik-thread local mark stack]
-70eba5b000-70eba5f000 rw-p 00000000 00:05 10270783                       [anon:dalvik-thread local mark stack]
-70eba5f000-70eba63000 rw-p 00000000 00:05 10270782                       [anon:dalvik-thread local mark stack]
-70eba63000-70eba64000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70eba64000-70eba65000 r--s 00000000 fc:00 889                            /system/framework/ims-common.jar
-70eba65000-70eba69000 rw-p 00000000 00:05 10270781                       [anon:dalvik-thread local mark stack]
-70eba69000-70eba6d000 rw-p 00000000 00:05 10270780                       [anon:dalvik-thread local mark stack]
-70eba6d000-70eba71000 rw-p 00000000 00:05 10270779                       [anon:dalvik-thread local mark stack]
-70eba71000-70eba75000 rw-p 00000000 00:05 10270778                       [anon:dalvik-thread local mark stack]
-70eba75000-70eba95000 rw-p 00000000 00:05 10267647                       [anon:dalvik-large marked objects]
-70eba95000-70ebab5000 rw-p 00000000 00:05 10267646                       [anon:dalvik-large live objects]
-70ebab5000-70ebab6000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebab6000-70ebab7000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebab7000-70ebabb000 rw-p 00000000 00:05 10270777                       [anon:dalvik-thread local mark stack]
-70ebabb000-70ebadb000 r--s 00000000 00:10 16603                          /dev/__properties__/u:object_r:exported_fingerprint_prop:s0
-70ebadb000-70ebadc000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebadc000-70ebadd000 r--s 00000000 fc:00 878                            /system/framework/voip-common.jar
-70ebadd000-70ebadf000 rw-p 00000000 00:05 10270995                       [anon:dalvik-indirect ref table]
-70ebadf000-70ebae3000 rw-p 00000000 00:05 10270776                       [anon:dalvik-thread local mark stack]
-70ebae3000-70ebae7000 rw-p 00000000 00:05 10270775                       [anon:dalvik-thread local mark stack]
-70ebae7000-70ebaeb000 rw-p 00000000 00:05 10270774                       [anon:dalvik-thread local mark stack]
-70ebaeb000-70ebaef000 rw-p 00000000 00:05 10270773                       [anon:dalvik-thread local mark stack]
-70ebaef000-70ebb0f000 r--s 00000000 00:10 16582                          /dev/__properties__/u:object_r:debug_prop:s0
-70ebb0f000-70ebb10000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebb10000-70ebb11000 r--s 00000000 fc:00 703                            /system/framework/telephony-common.jar
-70ebb11000-70ebb13000 rw-p 00000000 00:05 10270994                       [anon:dalvik-indirect ref table]
-70ebb13000-70ebb17000 rw-p 00000000 00:05 10270772                       [anon:dalvik-thread local mark stack]
-70ebb17000-70ebb19000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebb19000-70ebb1d000 rw-p 00000000 00:05 10270771                       [anon:dalvik-thread local mark stack]
-70ebb1d000-70ebb3d000 r--s 00000000 00:10 16600                          /dev/__properties__/u:object_r:exported_default_prop:s0
-70ebb3d000-70ebb5d000 r--s 00000000 00:10 16650                          /dev/__properties__/u:object_r:system_prop:s0
-70ebb5d000-70ebb7d000 r--s 00000000 00:10 16610                          /dev/__properties__/u:object_r:exported_vold_prop:s0
-70ebb7d000-70ebb9d000 r--s 00000000 00:10 16598                          /dev/__properties__/u:object_r:exported_config_prop:s0
-70ebb9d000-70ebb9e000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebb9e000-70ebba2000 rw-p 00000000 00:05 10270770                       [anon:dalvik-thread local mark stack]
-70ebba2000-70ebba6000 rw-p 00000000 00:05 10270769                       [anon:dalvik-thread local mark stack]
-70ebba6000-70ebba7000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebba7000-70ebba8000 r--s 00000000 fc:00 1004                           /system/framework/framework.jar
-70ebba8000-70ebbac000 rw-p 00000000 00:05 10270768                       [anon:dalvik-thread local mark stack]
-70ebbac000-70ebbb0000 rw-p 00000000 00:05 10270767                       [anon:dalvik-thread local mark stack]
-70ebbb0000-70ebbb4000 rw-p 00000000 00:05 10270766                       [anon:dalvik-thread local mark stack]
-70ebbb4000-70ebbb8000 rw-p 00000000 00:05 10270765                       [anon:dalvik-thread local mark stack]
-70ebbb8000-70ebbbc000 rw-p 00000000 00:05 10270764                       [anon:dalvik-thread local mark stack]
-70ebbbc000-70ebbc0000 rw-p 00000000 00:05 10270763                       [anon:dalvik-thread local mark stack]
-70ebbc0000-70ebbc4000 rw-p 00000000 00:05 10270762                       [anon:dalvik-thread local mark stack]
-70ebbc4000-70ebbe4000 r--s 00000000 00:10 16581                          /dev/__properties__/u:object_r:dalvik_prop:s0
-70ebbe4000-70ebbe5000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebbe5000-70ebbe6000 r--s 00004000 fc:00 877                            /system/framework/apache-xml.jar
-70ebbe6000-70ebbe8000 rw-p 00000000 00:05 10270993                       [anon:dalvik-indirect ref table]
-70ebbe8000-70ebbec000 rw-p 00000000 00:05 10270761                       [anon:dalvik-thread local mark stack]
-70ebbec000-70ebbf0000 rw-p 00000000 00:05 10270760                       [anon:dalvik-thread local mark stack]
-70ebbf0000-70ebbf4000 rw-p 00000000 00:05 10270759                       [anon:dalvik-thread local mark stack]
-70ebbf4000-70ebbf8000 rw-p 00000000 00:05 10270758                       [anon:dalvik-thread local mark stack]
-70ebbf8000-70ebbf9000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebbf9000-70ebbfa000 r--s 00000000 fc:00 968                            /system/framework/bouncycastle.jar
-70ebbfa000-70ebbfc000 rw-p 00000000 00:05 10270992                       [anon:dalvik-indirect ref table]
-70ebbfc000-70ebc00000 rw-p 00000000 00:05 10270757                       [anon:dalvik-thread local mark stack]
-70ebc00000-70ebc04000 rw-p 00000000 00:05 10270756                       [anon:dalvik-thread local mark stack]
-70ebc04000-70ebc08000 rw-p 00000000 00:05 10270755                       [anon:dalvik-thread local mark stack]
-70ebc08000-70ebc0c000 rw-p 00000000 00:05 10270754                       [anon:dalvik-thread local mark stack]
-70ebc0c000-70ebc10000 rw-p 00000000 00:05 10270753                       [anon:dalvik-thread local mark stack]
-70ebc10000-70ebc14000 rw-p 00000000 00:05 10270752                       [anon:dalvik-thread local mark stack]
-70ebc14000-70ebc15000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc15000-70ebc16000 r--s 00000000 fc:00 960                            /system/framework/okhttp.jar
-70ebc16000-70ebc1a000 rw-p 00000000 00:05 10270751                       [anon:dalvik-thread local mark stack]
-70ebc1a000-70ebc1e000 rw-p 00000000 00:05 10270750                       [anon:dalvik-thread local mark stack]
-70ebc1e000-70ebc3e000 r--s 00000000 00:10 16584                          /dev/__properties__/u:object_r:default_prop:s0
-70ebc3e000-70ebc3f000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc3f000-70ebc40000 r--s 00000000 fc:00 974                            /system/framework/conscrypt.jar
-70ebc40000-70ebc42000 rw-p 00000000 00:05 10269719                       [anon:dalvik-indirect ref table]
-70ebc42000-70ebc46000 rw-p 00000000 00:05 10270749                       [anon:dalvik-thread local mark stack]
-70ebc46000-70ebc4a000 rw-p 00000000 00:05 10270748                       [anon:dalvik-thread local mark stack]
-70ebc4a000-70ebc4e000 rw-p 00000000 00:05 10270747                       [anon:dalvik-thread local mark stack]
-70ebc4e000-70ebc4f000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc4f000-70ebc51000 rw-p 00000000 00:05 10269718                       [anon:dalvik-indirect ref table]
-70ebc51000-70ebc55000 rw-p 00000000 00:05 10270746                       [anon:dalvik-thread local mark stack]
-70ebc55000-70ebc59000 rw-p 00000000 00:05 10270745                       [anon:dalvik-thread local mark stack]
-70ebc59000-70ebc5d000 rw-p 00000000 00:05 10270744                       [anon:dalvik-thread local mark stack]
-70ebc5d000-70ebc7d000 r--s 00000000 00:10 16599                          /dev/__properties__/u:object_r:exported_dalvik_prop:s0
-70ebc7d000-70ebc7e000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc7e000-70ebc7f000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc7f000-70ebc80000 r--s 00004000 fc:00 963                            /system/framework/core-libart.jar
-70ebc80000-70ebc81000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc81000-70ebc85000 rw-p 00000000 00:05 10270743                       [anon:dalvik-thread local mark stack]
-70ebc85000-70ebc89000 rw-p 00000000 00:05 10270742                       [anon:dalvik-thread local mark stack]
-70ebc89000-70ebc8a000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebc8a000-70ebc8c000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc8c000-70ebc8d000 r--s 0001e000 fc:00 699                            /system/framework/core-oj.jar
-70ebc8d000-70ebc91000 rw-p 00000000 00:05 10270741                       [anon:dalvik-thread local mark stack]
-70ebc91000-70ebc95000 rw-p 00000000 00:05 10270740                       [anon:dalvik-thread local mark stack]
-70ebc95000-70ebc99000 rw-p 00000000 00:05 10270739                       [anon:dalvik-thread local mark stack]
-70ebc99000-70ebc9b000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc9b000-70ebc9c000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebc9c000-70ebca0000 rw-p 00000000 00:05 10270738                       [anon:dalvik-thread local mark stack]
-70ebca0000-70ebca4000 rw-p 00000000 00:05 10270737                       [anon:dalvik-thread local mark stack]
-70ebca4000-70ebca8000 rw-p 00000000 00:05 10270736                       [anon:dalvik-thread local mark stack]
-70ebca8000-70ebcac000 rw-p 00000000 00:05 10270735                       [anon:dalvik-thread local mark stack]
-70ebcac000-70ebcb0000 rw-p 00000000 00:05 10270734                       [anon:dalvik-thread local mark stack]
-70ebcb0000-70ebcd0000 r--s 00000000 00:10 16592                          /dev/__properties__/u:object_r:exported2_system_prop:s0
-70ebcd0000-70ebcd1000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebcd1000-70ebcd5000 rw-p 00000000 00:05 10270733                       [anon:dalvik-thread local mark stack]
-70ebcd5000-70ebcd9000 rw-p 00000000 00:05 10270732                       [anon:dalvik-thread local mark stack]
-70ebcd9000-70ebcdd000 rw-p 00000000 00:05 10270731                       [anon:dalvik-thread local mark stack]
-70ebcdd000-70ebce1000 rw-p 00000000 00:05 10270730                       [anon:dalvik-thread local mark stack]
-70ebce1000-70ebce5000 rw-p 00000000 00:05 10270729                       [anon:dalvik-thread local mark stack]
-70ebce5000-70ebce9000 rw-p 00000000 00:05 10270728                       [anon:dalvik-thread local mark stack]
-70ebce9000-70ebcea000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebcea000-70ebcec000 rw-p 00000000 00:05 10270987                       [anon:dalvik-indirect ref table]
-70ebcec000-70ebcf9000 r--p 00646000 103:1d 639532                        /data/dalvik-cache/arm64/system@framework@boot-framework.art
-70ebcf9000-70ebd19000 r--s 00000000 00:10 16620                          /dev/__properties__/u:object_r:log_tag_prop:s0
-70ebd19000-70ebd39000 r--s 00000000 00:10 16621                          /dev/__properties__/u:object_r:logd_prop:s0
-70ebd39000-70ebd3a000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd3a000-70ebd3b000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd3b000-70ebd3f000 rw-p 00000000 00:05 10270727                       [anon:dalvik-thread local mark stack]
-70ebd3f000-70ebd40000 r--p 00002000 103:1d 639556                        /data/dalvik-cache/arm64/system@framework@boot-com.google.vr.platform.art
-70ebd40000-70ebd41000 r--p 00005000 103:1d 639553                        /data/dalvik-cache/arm64/system@framework@boot-android.test.base.art
-70ebd41000-70ebd42000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd42000-70ebd43000 r--p 00001000 103:1d 639550                        /data/dalvik-cache/arm64/system@framework@boot-framework-oahl-backward-compatibility.art
-70ebd43000-70ebd44000 r--p 00005000 103:1d 639547                        /data/dalvik-cache/arm64/system@framework@boot-android.hidl.manager-V1.0-java.art
-70ebd44000-70ebd45000 r--p 00003000 103:1d 639544                        /data/dalvik-cache/arm64/system@framework@boot-android.hidl.base-V1.0-java.art
-70ebd45000-70ebd46000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd46000-70ebd47000 r--p 0000f000 103:1d 639541                        /data/dalvik-cache/arm64/system@framework@boot-ims-common.art
-70ebd47000-70ebd48000 r--p 0000d000 103:1d 639538                        /data/dalvik-cache/arm64/system@framework@boot-voip-common.art
-70ebd48000-70ebd4a000 r--p 0005e000 103:1d 639535                        /data/dalvik-cache/arm64/system@framework@boot-telephony-common.art
-70ebd4a000-70ebd4b000 r--p 00040000 103:1d 639529                        /data/dalvik-cache/arm64/system@framework@boot-ext.art
-70ebd4b000-70ebd4c000 r--p 0004a000 103:1d 639526                        /data/dalvik-cache/arm64/system@framework@boot-apache-xml.art
-70ebd4c000-70ebd4d000 r--p 00046000 103:1d 639523                        /data/dalvik-cache/arm64/system@framework@boot-bouncycastle.art
-70ebd4d000-70ebd4e000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd4e000-70ebd53000 r--p 00225000 103:1d 639511                        /data/dalvik-cache/arm64/system@framework@boot.art
-70ebd53000-70ebd5a000 rw-p 00000000 fc:00 583                            /system/etc/event-log-tags
-70ebd5a000-70ebd5b000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd5b000-70ebd5c000 r--p 0002e000 103:1d 639520                        /data/dalvik-cache/arm64/system@framework@boot-okhttp.art
-70ebd5c000-70ebd5d000 r--p 00035000 103:1d 639517                        /data/dalvik-cache/arm64/system@framework@boot-conscrypt.art
-70ebd5d000-70ebd5f000 r--p 000d0000 103:1d 639514                        /data/dalvik-cache/arm64/system@framework@boot-core-libart.art
-70ebd5f000-70ebd62000 r--p 00000000 00:00 0                              [anon:atexit handlers]
-70ebd62000-70ebd63000 rw-p 00000000 00:00 0 
-70ebd63000-70ebd83000 r--s 00000000 00:10 16590                          /dev/__properties__/u:object_r:exported2_default_prop:s0
-70ebd83000-70ebd84000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebd84000-70ebd89000 rw-p 00000000 00:00 0 
-70ebd89000-70ebda9000 r--s 00000000 00:10 16669                          /dev/__properties__/properties_serial
-70ebda9000-70ebdb3000 r--s 00000000 00:10 16560                          /dev/__properties__/property_info
-70ebdb3000-70ebdb4000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70ebdb4000-70ebdb5000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebdb5000-70ebdb7000 rw-p 00000000 00:00 0                              [anon:System property context nodes]
-70ebdb7000-70ebdb8000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70ebdb8000-70ebdba000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebdba000-70ebdbb000 rw-p 00000000 00:00 0                              [anon:linker_alloc]
-70ebdbb000-70ebdbd000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebdbd000-70ebdbe000 r--p 00000000 00:00 0                              [anon:atexit handlers]
-70ebdbe000-70ebdbf000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebdbf000-70ebdc0000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebdc0000-70ebdc1000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70ebdc1000-70ebdc2000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebdc2000-70ebdc3000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70ebdc3000-70ebdc5000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebdc5000-70ebde5000 r--s 00000000 00:10 16600                          /dev/__properties__/u:object_r:exported_default_prop:s0
-70ebde5000-70ebde6000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebde6000-70ebde8000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebde8000-70ebe08000 r--s 00000000 00:10 16582                          /dev/__properties__/u:object_r:debug_prop:s0
-70ebe08000-70ebe09000 ---p 00000000 00:00 0 
-70ebe09000-70ebe0a000 rw-p 00000000 00:00 0 
-70ebe0a000-70ebe0b000 ---p 00000000 00:00 0 
-70ebe0b000-70ebe2b000 r--s 00000000 00:10 16669                          /dev/__properties__/properties_serial
-70ebe2b000-70ebe2d000 rw-p 00000000 00:00 0                              [anon:System property context nodes]
-70ebe2d000-70ebf55000 r-xp 00000000 fc:00 3184                           /system/bin/linker64
-70ebf55000-70ebf5f000 r--s 00000000 00:10 16560                          /dev/__properties__/property_info
-70ebf5f000-70ebf60000 r--p 00000000 00:00 0                              [anon:linker_alloc]
-70ebf60000-70ebf61000 rw-p 00000000 00:00 0                              [anon:linker_alloc_vector]
-70ebf61000-70ebf62000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebf62000-70ebf63000 rw-p 00000000 00:00 0                              [anon:arc4random data]
-70ebf63000-70ebf64000 rw-p 00000000 00:00 0                              [anon:linker_alloc_small_objects]
-70ebf64000-70ebf65000 r--p 00000000 00:00 0                              [anon:atexit handlers]
-70ebf65000-70ebf66000 ---p 00000000 00:00 0                              [anon:thread signal stack guard]
-70ebf66000-70ebf6a000 rw-p 00000000 00:00 0                              [anon:thread signal stack]
-70ebf6a000-70ebf6b000 rw-p 00000000 00:00 0                              [anon:arc4random data]
-70ebf6b000-70ebf6c000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70ebf6c000-70ebf6f000 rw-p 00000000 00:00 0                              [anon:bionic TLS]
-70ebf6f000-70ebf70000 ---p 00000000 00:00 0                              [anon:bionic TLS guard]
-70ebf70000-70ebf71000 r--p 00000000 00:00 0                              [vvar]
-70ebf71000-70ebf72000 r-xp 00000000 00:00 0                              [vdso]
-70ebf72000-70ebf7d000 r--p 00135000 fc:00 3184                           /system/bin/linker64
-70ebf7d000-70ebf7e000 rw-p 00140000 fc:00 3184                           /system/bin/linker64
-70ebf7e000-70ebf81000 rw-p 00000000 00:00 0 
-70ebf81000-70ebf82000 r--p 00000000 00:00 0 
-70ebf82000-70ebf89000 rw-p 00000000 00:00 0 
-7fc7df1000-7fc7df2000 ---p 00000000 00:00 0 
-7fc7df2000-7fc85f1000 rw-p 00000000 00:00 0                              [stack]
diff --git a/libsparse/Android.bp b/libsparse/Android.bp
index 135904b..5b6ce41 100644
--- a/libsparse/Android.bp
+++ b/libsparse/Android.bp
@@ -4,8 +4,10 @@
     name: "libsparse",
     host_supported: true,
     ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     unique_host_soname: true,
+    vendor_available: true,
     srcs: [
         "backed_block.cpp",
         "output_file.cpp",
@@ -26,6 +28,10 @@
             enabled: true,
         },
     },
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.virt",
+    ],
 }
 
 cc_binary {
diff --git a/libsparse/backed_block.cpp b/libsparse/backed_block.cpp
index f3d8022..6229e7c 100644
--- a/libsparse/backed_block.cpp
+++ b/libsparse/backed_block.cpp
@@ -25,7 +25,7 @@
 
 struct backed_block {
   unsigned int block;
-  unsigned int len;
+  uint64_t len;
   enum backed_block_type type;
   union {
     struct {
@@ -60,7 +60,7 @@
   return bb->next;
 }
 
-unsigned int backed_block_len(struct backed_block* bb) {
+uint64_t backed_block_len(struct backed_block* bb) {
   return bb->len;
 }
 
@@ -270,7 +270,7 @@
 }
 
 /* Queues a fill block of memory to be written to the specified data blocks */
-int backed_block_add_fill(struct backed_block_list* bbl, unsigned int fill_val, unsigned int len,
+int backed_block_add_fill(struct backed_block_list* bbl, unsigned int fill_val, uint64_t len,
                           unsigned int block) {
   struct backed_block* bb = reinterpret_cast<backed_block*>(calloc(1, sizeof(struct backed_block)));
   if (bb == nullptr) {
@@ -287,7 +287,7 @@
 }
 
 /* Queues a block of memory to be written to the specified data blocks */
-int backed_block_add_data(struct backed_block_list* bbl, void* data, unsigned int len,
+int backed_block_add_data(struct backed_block_list* bbl, void* data, uint64_t len,
                           unsigned int block) {
   struct backed_block* bb = reinterpret_cast<backed_block*>(calloc(1, sizeof(struct backed_block)));
   if (bb == nullptr) {
@@ -305,7 +305,7 @@
 
 /* Queues a chunk of a file on disk to be written to the specified data blocks */
 int backed_block_add_file(struct backed_block_list* bbl, const char* filename, int64_t offset,
-                          unsigned int len, unsigned int block) {
+                          uint64_t len, unsigned int block) {
   struct backed_block* bb = reinterpret_cast<backed_block*>(calloc(1, sizeof(struct backed_block)));
   if (bb == nullptr) {
     return -ENOMEM;
@@ -322,7 +322,7 @@
 }
 
 /* Queues a chunk of a fd to be written to the specified data blocks */
-int backed_block_add_fd(struct backed_block_list* bbl, int fd, int64_t offset, unsigned int len,
+int backed_block_add_fd(struct backed_block_list* bbl, int fd, int64_t offset, uint64_t len,
                         unsigned int block) {
   struct backed_block* bb = reinterpret_cast<backed_block*>(calloc(1, sizeof(struct backed_block)));
   if (bb == nullptr) {
diff --git a/libsparse/backed_block.h b/libsparse/backed_block.h
index 3a75460..71a8969 100644
--- a/libsparse/backed_block.h
+++ b/libsparse/backed_block.h
@@ -29,18 +29,18 @@
   BACKED_BLOCK_FILL,
 };
 
-int backed_block_add_data(struct backed_block_list* bbl, void* data, unsigned int len,
+int backed_block_add_data(struct backed_block_list* bbl, void* data, uint64_t len,
                           unsigned int block);
-int backed_block_add_fill(struct backed_block_list* bbl, unsigned int fill_val, unsigned int len,
+int backed_block_add_fill(struct backed_block_list* bbl, unsigned int fill_val, uint64_t len,
                           unsigned int block);
 int backed_block_add_file(struct backed_block_list* bbl, const char* filename, int64_t offset,
-                          unsigned int len, unsigned int block);
-int backed_block_add_fd(struct backed_block_list* bbl, int fd, int64_t offset, unsigned int len,
+                          uint64_t len, unsigned int block);
+int backed_block_add_fd(struct backed_block_list* bbl, int fd, int64_t offset, uint64_t len,
                         unsigned int block);
 
 struct backed_block* backed_block_iter_new(struct backed_block_list* bbl);
 struct backed_block* backed_block_iter_next(struct backed_block* bb);
-unsigned int backed_block_len(struct backed_block* bb);
+uint64_t backed_block_len(struct backed_block* bb);
 unsigned int backed_block_block(struct backed_block* bb);
 void* backed_block_data(struct backed_block* bb);
 const char* backed_block_filename(struct backed_block* bb);
diff --git a/libsparse/include/sparse/sparse.h b/libsparse/include/sparse/sparse.h
index 3d5fb0c..2f75349 100644
--- a/libsparse/include/sparse/sparse.h
+++ b/libsparse/include/sparse/sparse.h
@@ -75,8 +75,7 @@
  *
  * Returns 0 on success, negative errno on error.
  */
-int sparse_file_add_data(struct sparse_file *s,
-		void *data, unsigned int len, unsigned int block);
+int sparse_file_add_data(struct sparse_file* s, void* data, uint64_t len, unsigned int block);
 
 /**
  * sparse_file_add_fill - associate a fill chunk with a sparse file
@@ -93,8 +92,8 @@
  *
  * Returns 0 on success, negative errno on error.
  */
-int sparse_file_add_fill(struct sparse_file *s,
-		uint32_t fill_val, unsigned int len, unsigned int block);
+int sparse_file_add_fill(struct sparse_file* s, uint32_t fill_val, uint64_t len,
+                         unsigned int block);
 
 /**
  * sparse_file_add_file - associate a chunk of a file with a sparse file
@@ -116,9 +115,8 @@
  *
  * Returns 0 on success, negative errno on error.
  */
-int sparse_file_add_file(struct sparse_file *s,
-		const char *filename, int64_t file_offset, unsigned int len,
-		unsigned int block);
+int sparse_file_add_file(struct sparse_file* s, const char* filename, int64_t file_offset,
+                         uint64_t len, unsigned int block);
 
 /**
  * sparse_file_add_file - associate a chunk of a file with a sparse file
@@ -143,8 +141,8 @@
  *
  * Returns 0 on success, negative errno on error.
  */
-int sparse_file_add_fd(struct sparse_file *s,
-		int fd, int64_t file_offset, unsigned int len, unsigned int block);
+int sparse_file_add_fd(struct sparse_file* s, int fd, int64_t file_offset, uint64_t len,
+                       unsigned int block);
 
 /**
  * sparse_file_write - write a sparse file to a file
diff --git a/libsparse/output_file.cpp b/libsparse/output_file.cpp
index e35cb0d..b2c5407 100644
--- a/libsparse/output_file.cpp
+++ b/libsparse/output_file.cpp
@@ -35,8 +35,9 @@
 #include "sparse_crc32.h"
 #include "sparse_format.h"
 
+#include <android-base/mapped_file.h>
+
 #ifndef _WIN32
-#include <sys/mman.h>
 #define O_BINARY 0
 #else
 #define ftruncate64 ftruncate
@@ -45,7 +46,6 @@
 #if defined(__APPLE__) && defined(__MACH__)
 #define lseek64 lseek
 #define ftruncate64 ftruncate
-#define mmap64 mmap
 #define off64_t off_t
 #endif
 
@@ -65,9 +65,9 @@
 };
 
 struct sparse_file_ops {
-  int (*write_data_chunk)(struct output_file* out, unsigned int len, void* data);
-  int (*write_fill_chunk)(struct output_file* out, unsigned int len, uint32_t fill_val);
-  int (*write_skip_chunk)(struct output_file* out, int64_t len);
+  int (*write_data_chunk)(struct output_file* out, uint64_t len, void* data);
+  int (*write_fill_chunk)(struct output_file* out, uint64_t len, uint32_t fill_val);
+  int (*write_skip_chunk)(struct output_file* out, uint64_t len);
   int (*write_end_chunk)(struct output_file* out);
 };
 
@@ -316,7 +316,7 @@
   return 0;
 }
 
-static int write_sparse_skip_chunk(struct output_file* out, int64_t skip_len) {
+static int write_sparse_skip_chunk(struct output_file* out, uint64_t skip_len) {
   chunk_header_t chunk_header;
   int ret;
 
@@ -340,9 +340,10 @@
   return 0;
 }
 
-static int write_sparse_fill_chunk(struct output_file* out, unsigned int len, uint32_t fill_val) {
+static int write_sparse_fill_chunk(struct output_file* out, uint64_t len, uint32_t fill_val) {
   chunk_header_t chunk_header;
-  int rnd_up_len, count;
+  uint64_t rnd_up_len;
+  int count;
   int ret;
 
   /* Round up the fill length to a multiple of the block size */
@@ -370,9 +371,9 @@
   return 0;
 }
 
-static int write_sparse_data_chunk(struct output_file* out, unsigned int len, void* data) {
+static int write_sparse_data_chunk(struct output_file* out, uint64_t len, void* data) {
   chunk_header_t chunk_header;
-  int rnd_up_len, zero_len;
+  uint64_t rnd_up_len, zero_len;
   int ret;
 
   /* Round up the data length to a multiple of the block size */
@@ -437,9 +438,9 @@
     .write_end_chunk = write_sparse_end_chunk,
 };
 
-static int write_normal_data_chunk(struct output_file* out, unsigned int len, void* data) {
+static int write_normal_data_chunk(struct output_file* out, uint64_t len, void* data) {
   int ret;
-  unsigned int rnd_up_len = ALIGN(len, out->block_size);
+  uint64_t rnd_up_len = ALIGN(len, out->block_size);
 
   ret = out->ops->write(out, data, len);
   if (ret < 0) {
@@ -453,10 +454,10 @@
   return ret;
 }
 
-static int write_normal_fill_chunk(struct output_file* out, unsigned int len, uint32_t fill_val) {
+static int write_normal_fill_chunk(struct output_file* out, uint64_t len, uint32_t fill_val) {
   int ret;
   unsigned int i;
-  unsigned int write_len;
+  uint64_t write_len;
 
   /* Initialize fill_buf with the fill_val */
   for (i = 0; i < out->block_size / sizeof(uint32_t); i++) {
@@ -464,7 +465,7 @@
   }
 
   while (len) {
-    write_len = std::min(len, out->block_size);
+    write_len = std::min(len, (uint64_t)out->block_size);
     ret = out->ops->write(out, out->fill_buf, write_len);
     if (ret < 0) {
       return ret;
@@ -476,7 +477,7 @@
   return 0;
 }
 
-static int write_normal_skip_chunk(struct output_file* out, int64_t len) {
+static int write_normal_skip_chunk(struct output_file* out, uint64_t len) {
   return out->ops->skip(out, len);
 }
 
@@ -639,66 +640,24 @@
 }
 
 /* Write a contiguous region of data blocks from a memory buffer */
-int write_data_chunk(struct output_file* out, unsigned int len, void* data) {
+int write_data_chunk(struct output_file* out, uint64_t len, void* data) {
   return out->sparse_ops->write_data_chunk(out, len, data);
 }
 
 /* Write a contiguous region of data blocks with a fill value */
-int write_fill_chunk(struct output_file* out, unsigned int len, uint32_t fill_val) {
+int write_fill_chunk(struct output_file* out, uint64_t len, uint32_t fill_val) {
   return out->sparse_ops->write_fill_chunk(out, len, fill_val);
 }
 
-int write_fd_chunk(struct output_file* out, unsigned int len, int fd, int64_t offset) {
-  int ret;
-  int64_t aligned_offset;
-  int aligned_diff;
-  uint64_t buffer_size;
-  char* ptr;
+int write_fd_chunk(struct output_file* out, uint64_t len, int fd, int64_t offset) {
+  auto m = android::base::MappedFile::FromFd(fd, offset, len, PROT_READ);
+  if (!m) return -errno;
 
-  aligned_offset = offset & ~(4096 - 1);
-  aligned_diff = offset - aligned_offset;
-  buffer_size = (uint64_t)len + (uint64_t)aligned_diff;
-
-#ifndef _WIN32
-  if (buffer_size > SIZE_MAX) return -E2BIG;
-  char* data =
-      reinterpret_cast<char*>(mmap64(nullptr, buffer_size, PROT_READ, MAP_SHARED, fd, aligned_offset));
-  if (data == MAP_FAILED) {
-    return -errno;
-  }
-  ptr = data + aligned_diff;
-#else
-  off64_t pos;
-  char* data = reinterpret_cast<char*>(malloc(len));
-  if (!data) {
-    return -errno;
-  }
-  pos = lseek64(fd, offset, SEEK_SET);
-  if (pos < 0) {
-    free(data);
-    return -errno;
-  }
-  ret = read_all(fd, data, len);
-  if (ret < 0) {
-    free(data);
-    return ret;
-  }
-  ptr = data;
-#endif
-
-  ret = out->sparse_ops->write_data_chunk(out, len, ptr);
-
-#ifndef _WIN32
-  munmap(data, buffer_size);
-#else
-  free(data);
-#endif
-
-  return ret;
+  return out->sparse_ops->write_data_chunk(out, m->size(), m->data());
 }
 
 /* Write a contiguous region of data blocks from a file */
-int write_file_chunk(struct output_file* out, unsigned int len, const char* file, int64_t offset) {
+int write_file_chunk(struct output_file* out, uint64_t len, const char* file, int64_t offset) {
   int ret;
 
   int file_fd = open(file, O_RDONLY | O_BINARY);
@@ -713,6 +672,6 @@
   return ret;
 }
 
-int write_skip_chunk(struct output_file* out, int64_t len) {
+int write_skip_chunk(struct output_file* out, uint64_t len) {
   return out->sparse_ops->write_skip_chunk(out, len);
 }
diff --git a/libsparse/output_file.h b/libsparse/output_file.h
index 278430b..ecbcdf3 100644
--- a/libsparse/output_file.h
+++ b/libsparse/output_file.h
@@ -30,11 +30,11 @@
 struct output_file* output_file_open_callback(int (*write)(void*, const void*, size_t), void* priv,
                                               unsigned int block_size, int64_t len, int gz,
                                               int sparse, int chunks, int crc);
-int write_data_chunk(struct output_file* out, unsigned int len, void* data);
-int write_fill_chunk(struct output_file* out, unsigned int len, uint32_t fill_val);
-int write_file_chunk(struct output_file* out, unsigned int len, const char* file, int64_t offset);
-int write_fd_chunk(struct output_file* out, unsigned int len, int fd, int64_t offset);
-int write_skip_chunk(struct output_file* out, int64_t len);
+int write_data_chunk(struct output_file* out, uint64_t len, void* data);
+int write_fill_chunk(struct output_file* out, uint64_t len, uint32_t fill_val);
+int write_file_chunk(struct output_file* out, uint64_t len, const char* file, int64_t offset);
+int write_fd_chunk(struct output_file* out, uint64_t len, int fd, int64_t offset);
+int write_skip_chunk(struct output_file* out, uint64_t len);
 void output_file_close(struct output_file* out);
 
 int read_all(int fd, void* buf, size_t len);
diff --git a/libsparse/sparse.cpp b/libsparse/sparse.cpp
index 8622b4c..396e7eb 100644
--- a/libsparse/sparse.cpp
+++ b/libsparse/sparse.cpp
@@ -50,21 +50,21 @@
   free(s);
 }
 
-int sparse_file_add_data(struct sparse_file* s, void* data, unsigned int len, unsigned int block) {
+int sparse_file_add_data(struct sparse_file* s, void* data, uint64_t len, unsigned int block) {
   return backed_block_add_data(s->backed_block_list, data, len, block);
 }
 
-int sparse_file_add_fill(struct sparse_file* s, uint32_t fill_val, unsigned int len,
+int sparse_file_add_fill(struct sparse_file* s, uint32_t fill_val, uint64_t len,
                          unsigned int block) {
   return backed_block_add_fill(s->backed_block_list, fill_val, len, block);
 }
 
 int sparse_file_add_file(struct sparse_file* s, const char* filename, int64_t file_offset,
-                         unsigned int len, unsigned int block) {
+                         uint64_t len, unsigned int block) {
   return backed_block_add_file(s->backed_block_list, filename, file_offset, len, block);
 }
 
-int sparse_file_add_fd(struct sparse_file* s, int fd, int64_t file_offset, unsigned int len,
+int sparse_file_add_fd(struct sparse_file* s, int fd, int64_t file_offset, uint64_t len,
                        unsigned int block) {
   return backed_block_add_fd(s->backed_block_list, fd, file_offset, len, block);
 }
diff --git a/libstats/pull/Android.bp b/libstats/pull/Android.bp
deleted file mode 100644
index a8b4a4f..0000000
--- a/libstats/pull/Android.bp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Copyright (C) 2019 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.
-//
-
-// ==========================================================
-// Native library to register a pull atom callback with statsd
-// ==========================================================
-cc_defaults {
-    name: "libstatspull_defaults",
-    srcs: [
-        "stats_pull_atom_callback.cpp",
-    ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-    export_include_dirs: ["include"],
-    shared_libs: [
-        "libbinder_ndk",
-        "liblog",
-        "libstatssocket",
-    ],
-    static_libs: [
-        "libutils",
-        "statsd-aidl-ndk_platform",
-    ],
-}
-cc_library_shared {
-    name: "libstatspull",
-    defaults: [
-        "libstatspull_defaults"
-    ],
-    // enumerate stable entry points for APEX use
-    stubs: {
-        symbol_file: "libstatspull.map.txt",
-        versions: [
-            "30",
-        ],
-    },
-    apex_available: [
-        "com.android.os.statsd",
-        "test_com.android.os.statsd",
-    ],
-
-    stl: "libc++_static",
-
-    // TODO(b/151102177): Enable it when the build error is fixed.
-    header_abi_checker: {
-        enabled: false,
-    },
-}
-
-// ONLY USE IN TESTS.
-cc_library_static {
-    name: "libstatspull_private",
-    defaults: [
-        "libstatspull_defaults",
-    ],
-    visibility: [
-        "//frameworks/base/apex/statsd/tests/libstatspull",
-    ],
-}
-
-// Note: These unit tests only test PullAtomMetadata.
-// For full E2E tests of libstatspull, use LibStatsPullTests
-cc_test {
-    name: "libstatspull_test",
-    srcs: [
-        "tests/pull_atom_metadata_test.cpp",
-    ],
-    shared_libs: [
-        "libstatspull",
-        "libstatssocket",
-    ],
-    test_suites: ["general-tests", "mts"],
-    test_config: "libstatspull_test.xml",
-
-    //TODO(b/153588990): Remove when the build system properly separates 
-    //32bit and 64bit architectures.
-    compile_multilib: "both",
-    multilib: {
-        lib64: {
-            suffix: "64",
-        },
-        lib32: {
-            suffix: "32",
-        },
-    },
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wno-missing-field-initializers",
-        "-Wno-unused-variable",
-        "-Wno-unused-function",
-        "-Wno-unused-parameter",
-    ],
-    require_root: true,
-}
diff --git a/libstats/pull/OWNERS b/libstats/pull/OWNERS
deleted file mode 100644
index 7855774..0000000
--- a/libstats/pull/OWNERS
+++ /dev/null
@@ -1,7 +0,0 @@
-joeo@google.com
-muhammadq@google.com
-ruchirr@google.com
-singhtejinder@google.com
-tsaichristine@google.com
-yaochen@google.com
-yro@google.com
diff --git a/libstats/pull/TEST_MAPPING b/libstats/pull/TEST_MAPPING
deleted file mode 100644
index 76f4f02..0000000
--- a/libstats/pull/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "presubmit" : [
-    {
-      "name" : "libstatspull_test"
-    }
-  ]
-}
\ No newline at end of file
diff --git a/libstats/pull/include/stats_pull_atom_callback.h b/libstats/pull/include/stats_pull_atom_callback.h
deleted file mode 100644
index 17df584..0000000
--- a/libstats/pull/include/stats_pull_atom_callback.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2019, 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.
- */
-#pragma once
-
-#include <stats_event.h>
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Opaque struct representing the metadata for registering an AStatsManager_PullAtomCallback.
- */
-struct AStatsManager_PullAtomMetadata;
-typedef struct AStatsManager_PullAtomMetadata AStatsManager_PullAtomMetadata;
-
-/**
- * Allocate and initialize new PullAtomMetadata.
- *
- * Must call AStatsManager_PullAtomMetadata_release to free the memory.
- */
-AStatsManager_PullAtomMetadata* AStatsManager_PullAtomMetadata_obtain();
-
-/**
- * Frees the memory held by this PullAtomMetadata
- *
- * After calling this, the PullAtomMetadata must not be used or modified in any way.
- */
-void AStatsManager_PullAtomMetadata_release(AStatsManager_PullAtomMetadata* metadata);
-
-/**
- * Set the cool down time of the pull in milliseconds. If two successive pulls are issued
- * within the cool down, a cached version of the first will be used for the second. The minimum
- * allowed cool down is one second.
- */
-void AStatsManager_PullAtomMetadata_setCoolDownMillis(AStatsManager_PullAtomMetadata* metadata,
-                                                      int64_t cool_down_millis);
-
-/**
- * Get the cool down time of the pull in milliseconds.
- */
-int64_t AStatsManager_PullAtomMetadata_getCoolDownMillis(AStatsManager_PullAtomMetadata* metadata);
-
-/**
- * Set the maximum time the pull can take in milliseconds.
- * The maximum allowed timeout is 10 seconds.
- */
-void AStatsManager_PullAtomMetadata_setTimeoutMillis(AStatsManager_PullAtomMetadata* metadata,
-                                                     int64_t timeout_millis);
-
-/**
- * Get the maximum time the pull can take in milliseconds.
- */
-int64_t AStatsManager_PullAtomMetadata_getTimeoutMillis(AStatsManager_PullAtomMetadata* metadata);
-
-/**
- * Set the additive fields of this pulled atom.
- *
- * This is only applicable for atoms which have a uid field. When tasks are run in
- * isolated processes, the data will be attributed to the host uid. Additive fields
- * will be combined when the non-additive fields are the same.
- */
-void AStatsManager_PullAtomMetadata_setAdditiveFields(AStatsManager_PullAtomMetadata* metadata,
-                                                      int32_t* additive_fields, int32_t num_fields);
-
-/**
- * Get the number of additive fields for this pulled atom. This is intended to be called before
- * AStatsManager_PullAtomMetadata_getAdditiveFields to determine the size of the array.
- */
-int32_t AStatsManager_PullAtomMetadata_getNumAdditiveFields(
-        AStatsManager_PullAtomMetadata* metadata);
-
-/**
- * Get the additive fields of this pulled atom.
- *
- * \param fields an output parameter containing the additive fields for this PullAtomMetadata.
- *               Fields is an array and it is assumed that it is at least as large as the number of
- *               additive fields, which can be obtained by calling
- *               AStatsManager_PullAtomMetadata_getNumAdditiveFields.
- */
-void AStatsManager_PullAtomMetadata_getAdditiveFields(AStatsManager_PullAtomMetadata* metadata,
-                                                      int32_t* fields);
-
-/**
- * Return codes for the result of a pull.
- */
-typedef int32_t AStatsManager_PullAtomCallbackReturn;
-enum {
-    // Value indicating that this pull was successful and that the result should be used.
-    AStatsManager_PULL_SUCCESS = 0,
-    // Value indicating that this pull was unsuccessful and that the result should not be used.
-    AStatsManager_PULL_SKIP = 1,
-};
-
-/**
- * Opaque struct representing a list of AStatsEvent objects.
- */
-struct AStatsEventList;
-typedef struct AStatsEventList AStatsEventList;
-
-/**
- * Appends and returns an AStatsEvent to the end of the AStatsEventList.
- *
- * If an AStatsEvent is obtained in this manner, the memory is internally managed and
- * AStatsEvent_release does not need to be called. The lifetime of the AStatsEvent is that of the
- * AStatsEventList.
- *
- * The AStatsEvent does still need to be built by calling AStatsEvent_build.
- */
-AStatsEvent* AStatsEventList_addStatsEvent(AStatsEventList* pull_data);
-
-/**
- * Callback interface for pulling atoms requested by the stats service.
- *
- * \param atom_tag the tag of the atom to pull.
- * \param data an output parameter in which the caller should fill the results of the pull. This
- *             param cannot be NULL and it's lifetime is as long as the execution of the callback.
- *             It must not be accessed or modified after returning from the callback.
- * \param cookie the opaque pointer passed in AStatsManager_registerPullAtomCallback.
- * \return AStatsManager_PULL_SUCCESS if the pull was successful, or AStatsManager_PULL_SKIP if not.
- */
-typedef AStatsManager_PullAtomCallbackReturn (*AStatsManager_PullAtomCallback)(
-        int32_t atom_tag, AStatsEventList* data, void* cookie);
-/**
- * Sets a callback for an atom when that atom is to be pulled. The stats service will
- * invoke the callback when the stats service determines that this atom needs to be
- * pulled.
- *
- * Requires the REGISTER_STATS_PULL_ATOM permission.
- *
- * \param atom_tag          The tag of the atom for this pull atom callback.
- * \param metadata          Optional metadata specifying the timeout, cool down time, and
- *                          additive fields for mapping isolated to host uids.
- *                          This param is nullable, in which case defaults will be used.
- * \param callback          The callback to be invoked when the stats service pulls the atom.
- * \param cookie            A pointer that will be passed back to the callback.
- *                          It has no meaning to statsd.
- */
-void AStatsManager_setPullAtomCallback(int32_t atom_tag, AStatsManager_PullAtomMetadata* metadata,
-                                       AStatsManager_PullAtomCallback callback, void* cookie);
-
-/**
- * Clears a callback for an atom when that atom is to be pulled. Note that any ongoing
- * pulls will still occur.
- *
- * Requires the REGISTER_STATS_PULL_ATOM permission.
- *
- * \param atomTag           The tag of the atom of which to unregister
- */
-void AStatsManager_clearPullAtomCallback(int32_t atom_tag);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/libstats/pull/libstatspull.map.txt b/libstats/pull/libstatspull.map.txt
deleted file mode 100644
index e0e851a..0000000
--- a/libstats/pull/libstatspull.map.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-LIBSTATSPULL {
-    global:
-        AStatsManager_PullAtomMetadata_obtain; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_release; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_setCoolDownMillis; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_getCoolDownMillis; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_setTimeoutMillis; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_getTimeoutMillis; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_setAdditiveFields; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_getNumAdditiveFields; # apex # introduced=30
-        AStatsManager_PullAtomMetadata_getAdditiveFields; # apex # introduced=30
-        AStatsEventList_addStatsEvent; # apex # introduced=30
-        AStatsManager_setPullAtomCallback; # apex # introduced=30
-        AStatsManager_clearPullAtomCallback; # apex # introduced=30
-    local:
-        *;
-};
diff --git a/libstats/pull/libstatspull_test.xml b/libstats/pull/libstatspull_test.xml
deleted file mode 100644
index 233fc1f..0000000
--- a/libstats/pull/libstatspull_test.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-<configuration description="Runs libstatspull_test.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-native" />
-    <option name="test-suite-tag" value="mts" />
-
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
-
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-       <option name="cleanup" value="true" />
-       <option name="push" value="libstatspull_test->/data/local/tmp/libstatspull_test" />
-       <option name="append-bitness" value="true" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="libstatspull_test" />
-    </test>
-
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.google.android.os.statsd" />
-    </object>
-</configuration>
diff --git a/libstats/pull/stats_pull_atom_callback.cpp b/libstats/pull/stats_pull_atom_callback.cpp
deleted file mode 100644
index 478cae7..0000000
--- a/libstats/pull/stats_pull_atom_callback.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2019, 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.
- */
-
-#include <map>
-#include <thread>
-#include <vector>
-
-#include <stats_event.h>
-#include <stats_pull_atom_callback.h>
-
-#include <aidl/android/os/BnPullAtomCallback.h>
-#include <aidl/android/os/IPullAtomResultReceiver.h>
-#include <aidl/android/os/IStatsd.h>
-#include <aidl/android/util/StatsEventParcel.h>
-#include <android/binder_auto_utils.h>
-#include <android/binder_ibinder.h>
-#include <android/binder_manager.h>
-
-using Status = ::ndk::ScopedAStatus;
-using aidl::android::os::BnPullAtomCallback;
-using aidl::android::os::IPullAtomResultReceiver;
-using aidl::android::os::IStatsd;
-using aidl::android::util::StatsEventParcel;
-using ::ndk::SharedRefBase;
-
-struct AStatsEventList {
-    std::vector<AStatsEvent*> data;
-};
-
-AStatsEvent* AStatsEventList_addStatsEvent(AStatsEventList* pull_data) {
-    AStatsEvent* event = AStatsEvent_obtain();
-    pull_data->data.push_back(event);
-    return event;
-}
-
-static const int64_t DEFAULT_COOL_DOWN_MILLIS = 1000LL;  // 1 second.
-static const int64_t DEFAULT_TIMEOUT_MILLIS = 2000LL;    // 2 seconds.
-
-struct AStatsManager_PullAtomMetadata {
-    int64_t cool_down_millis;
-    int64_t timeout_millis;
-    std::vector<int32_t> additive_fields;
-};
-
-AStatsManager_PullAtomMetadata* AStatsManager_PullAtomMetadata_obtain() {
-    AStatsManager_PullAtomMetadata* metadata = new AStatsManager_PullAtomMetadata();
-    metadata->cool_down_millis = DEFAULT_COOL_DOWN_MILLIS;
-    metadata->timeout_millis = DEFAULT_TIMEOUT_MILLIS;
-    metadata->additive_fields = std::vector<int32_t>();
-    return metadata;
-}
-
-void AStatsManager_PullAtomMetadata_release(AStatsManager_PullAtomMetadata* metadata) {
-    delete metadata;
-}
-
-void AStatsManager_PullAtomMetadata_setCoolDownMillis(AStatsManager_PullAtomMetadata* metadata,
-                                                      int64_t cool_down_millis) {
-    metadata->cool_down_millis = cool_down_millis;
-}
-
-int64_t AStatsManager_PullAtomMetadata_getCoolDownMillis(AStatsManager_PullAtomMetadata* metadata) {
-    return metadata->cool_down_millis;
-}
-
-void AStatsManager_PullAtomMetadata_setTimeoutMillis(AStatsManager_PullAtomMetadata* metadata,
-                                                     int64_t timeout_millis) {
-    metadata->timeout_millis = timeout_millis;
-}
-
-int64_t AStatsManager_PullAtomMetadata_getTimeoutMillis(AStatsManager_PullAtomMetadata* metadata) {
-    return metadata->timeout_millis;
-}
-
-void AStatsManager_PullAtomMetadata_setAdditiveFields(AStatsManager_PullAtomMetadata* metadata,
-                                                      int32_t* additive_fields,
-                                                      int32_t num_fields) {
-    metadata->additive_fields.assign(additive_fields, additive_fields + num_fields);
-}
-
-int32_t AStatsManager_PullAtomMetadata_getNumAdditiveFields(
-        AStatsManager_PullAtomMetadata* metadata) {
-    return metadata->additive_fields.size();
-}
-
-void AStatsManager_PullAtomMetadata_getAdditiveFields(AStatsManager_PullAtomMetadata* metadata,
-                                                      int32_t* fields) {
-    std::copy(metadata->additive_fields.begin(), metadata->additive_fields.end(), fields);
-}
-
-class StatsPullAtomCallbackInternal : public BnPullAtomCallback {
-  public:
-    StatsPullAtomCallbackInternal(const AStatsManager_PullAtomCallback callback, void* cookie,
-                                  const int64_t coolDownMillis, const int64_t timeoutMillis,
-                                  const std::vector<int32_t> additiveFields)
-        : mCallback(callback),
-          mCookie(cookie),
-          mCoolDownMillis(coolDownMillis),
-          mTimeoutMillis(timeoutMillis),
-          mAdditiveFields(additiveFields) {}
-
-    Status onPullAtom(int32_t atomTag,
-                      const std::shared_ptr<IPullAtomResultReceiver>& resultReceiver) override {
-        AStatsEventList statsEventList;
-        int successInt = mCallback(atomTag, &statsEventList, mCookie);
-        bool success = successInt == AStatsManager_PULL_SUCCESS;
-
-        // Convert stats_events into StatsEventParcels.
-        std::vector<StatsEventParcel> parcels;
-        for (int i = 0; i < statsEventList.data.size(); i++) {
-            size_t size;
-            uint8_t* buffer = AStatsEvent_getBuffer(statsEventList.data[i], &size);
-
-            StatsEventParcel p;
-            // vector.assign() creates a copy, but this is inevitable unless
-            // stats_event.h/c uses a vector as opposed to a buffer.
-            p.buffer.assign(buffer, buffer + size);
-            parcels.push_back(std::move(p));
-        }
-
-        Status status = resultReceiver->pullFinished(atomTag, success, parcels);
-        if (!status.isOk()) {
-            std::vector<StatsEventParcel> emptyParcels;
-            resultReceiver->pullFinished(atomTag, /*success=*/false, emptyParcels);
-        }
-        for (int i = 0; i < statsEventList.data.size(); i++) {
-            AStatsEvent_release(statsEventList.data[i]);
-        }
-        return Status::ok();
-    }
-
-    int64_t getCoolDownMillis() const { return mCoolDownMillis; }
-    int64_t getTimeoutMillis() const { return mTimeoutMillis; }
-    const std::vector<int32_t>& getAdditiveFields() const { return mAdditiveFields; }
-
-  private:
-    const AStatsManager_PullAtomCallback mCallback;
-    void* mCookie;
-    const int64_t mCoolDownMillis;
-    const int64_t mTimeoutMillis;
-    const std::vector<int32_t> mAdditiveFields;
-};
-
-static std::mutex pullAtomMutex;
-static std::shared_ptr<IStatsd> sStatsd = nullptr;
-
-static std::map<int32_t, std::shared_ptr<StatsPullAtomCallbackInternal>> mPullers;
-static std::shared_ptr<IStatsd> getStatsService();
-
-static void binderDied(void* /*cookie*/) {
-    {
-        std::lock_guard<std::mutex> lock(pullAtomMutex);
-        sStatsd = nullptr;
-    }
-
-    std::shared_ptr<IStatsd> statsService = getStatsService();
-    if (statsService == nullptr) {
-        return;
-    }
-
-    // Since we do not want to make an IPC with the lock held, we first create a
-    // copy of the data with the lock held before iterating through the map.
-    std::map<int32_t, std::shared_ptr<StatsPullAtomCallbackInternal>> pullersCopy;
-    {
-        std::lock_guard<std::mutex> lock(pullAtomMutex);
-        pullersCopy = mPullers;
-    }
-    for (const auto& it : pullersCopy) {
-        statsService->registerNativePullAtomCallback(it.first, it.second->getCoolDownMillis(),
-                                                     it.second->getTimeoutMillis(),
-                                                     it.second->getAdditiveFields(), it.second);
-    }
-}
-
-static ::ndk::ScopedAIBinder_DeathRecipient sDeathRecipient(
-        AIBinder_DeathRecipient_new(binderDied));
-
-static std::shared_ptr<IStatsd> getStatsService() {
-    std::lock_guard<std::mutex> lock(pullAtomMutex);
-    if (!sStatsd) {
-        // Fetch statsd
-        ::ndk::SpAIBinder binder(AServiceManager_getService("stats"));
-        sStatsd = IStatsd::fromBinder(binder);
-        if (sStatsd) {
-            AIBinder_linkToDeath(binder.get(), sDeathRecipient.get(), /*cookie=*/nullptr);
-        }
-    }
-    return sStatsd;
-}
-
-void registerStatsPullAtomCallbackBlocking(int32_t atomTag,
-                                           std::shared_ptr<StatsPullAtomCallbackInternal> cb) {
-    const std::shared_ptr<IStatsd> statsService = getStatsService();
-    if (statsService == nullptr) {
-        // Statsd not available
-        return;
-    }
-
-    statsService->registerNativePullAtomCallback(
-            atomTag, cb->getCoolDownMillis(), cb->getTimeoutMillis(), cb->getAdditiveFields(), cb);
-}
-
-void unregisterStatsPullAtomCallbackBlocking(int32_t atomTag) {
-    const std::shared_ptr<IStatsd> statsService = getStatsService();
-    if (statsService == nullptr) {
-        // Statsd not available
-        return;
-    }
-
-    statsService->unregisterNativePullAtomCallback(atomTag);
-}
-
-void AStatsManager_setPullAtomCallback(int32_t atom_tag, AStatsManager_PullAtomMetadata* metadata,
-                                       AStatsManager_PullAtomCallback callback, void* cookie) {
-    int64_t coolDownMillis =
-            metadata == nullptr ? DEFAULT_COOL_DOWN_MILLIS : metadata->cool_down_millis;
-    int64_t timeoutMillis = metadata == nullptr ? DEFAULT_TIMEOUT_MILLIS : metadata->timeout_millis;
-
-    std::vector<int32_t> additiveFields;
-    if (metadata != nullptr) {
-        additiveFields = metadata->additive_fields;
-    }
-
-    std::shared_ptr<StatsPullAtomCallbackInternal> callbackBinder =
-            SharedRefBase::make<StatsPullAtomCallbackInternal>(callback, cookie, coolDownMillis,
-                                                               timeoutMillis, additiveFields);
-
-    {
-        std::lock_guard<std::mutex> lg(pullAtomMutex);
-        // Always add to the map. If statsd is dead, we will add them when it comes back.
-        mPullers[atom_tag] = callbackBinder;
-    }
-
-    std::thread registerThread(registerStatsPullAtomCallbackBlocking, atom_tag, callbackBinder);
-    registerThread.detach();
-}
-
-void AStatsManager_clearPullAtomCallback(int32_t atom_tag) {
-    {
-        std::lock_guard<std::mutex> lg(pullAtomMutex);
-        // Always remove the puller from our map.
-        // If statsd is down, we will not register it when it comes back.
-        mPullers.erase(atom_tag);
-    }
-    std::thread unregisterThread(unregisterStatsPullAtomCallbackBlocking, atom_tag);
-    unregisterThread.detach();
-}
diff --git a/libstats/pull/tests/pull_atom_metadata_test.cpp b/libstats/pull/tests/pull_atom_metadata_test.cpp
deleted file mode 100644
index abc8e47..0000000
--- a/libstats/pull/tests/pull_atom_metadata_test.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2020, 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <stats_pull_atom_callback.h>
-
-namespace {
-
-static const int64_t DEFAULT_COOL_DOWN_MILLIS = 1000LL;  // 1 second.
-static const int64_t DEFAULT_TIMEOUT_MILLIS = 2000LL;    // 2 seconds.
-
-}  // anonymous namespace
-
-TEST(AStatsManager_PullAtomMetadataTest, TestEmpty) {
-    AStatsManager_PullAtomMetadata* metadata = AStatsManager_PullAtomMetadata_obtain();
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getCoolDownMillis(metadata), DEFAULT_COOL_DOWN_MILLIS);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getTimeoutMillis(metadata), DEFAULT_TIMEOUT_MILLIS);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getNumAdditiveFields(metadata), 0);
-    AStatsManager_PullAtomMetadata_release(metadata);
-}
-
-TEST(AStatsManager_PullAtomMetadataTest, TestSetTimeoutMillis) {
-    int64_t timeoutMillis = 500;
-    AStatsManager_PullAtomMetadata* metadata = AStatsManager_PullAtomMetadata_obtain();
-    AStatsManager_PullAtomMetadata_setTimeoutMillis(metadata, timeoutMillis);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getCoolDownMillis(metadata), DEFAULT_COOL_DOWN_MILLIS);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getTimeoutMillis(metadata), timeoutMillis);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getNumAdditiveFields(metadata), 0);
-    AStatsManager_PullAtomMetadata_release(metadata);
-}
-
-TEST(AStatsManager_PullAtomMetadataTest, TestSetCoolDownMillis) {
-    int64_t coolDownMillis = 10000;
-    AStatsManager_PullAtomMetadata* metadata = AStatsManager_PullAtomMetadata_obtain();
-    AStatsManager_PullAtomMetadata_setCoolDownMillis(metadata, coolDownMillis);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getCoolDownMillis(metadata), coolDownMillis);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getTimeoutMillis(metadata), DEFAULT_TIMEOUT_MILLIS);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getNumAdditiveFields(metadata), 0);
-    AStatsManager_PullAtomMetadata_release(metadata);
-}
-
-TEST(AStatsManager_PullAtomMetadataTest, TestSetAdditiveFields) {
-    const int numFields = 3;
-    int inputFields[numFields] = {2, 4, 6};
-    AStatsManager_PullAtomMetadata* metadata = AStatsManager_PullAtomMetadata_obtain();
-    AStatsManager_PullAtomMetadata_setAdditiveFields(metadata, inputFields, numFields);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getCoolDownMillis(metadata), DEFAULT_COOL_DOWN_MILLIS);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getTimeoutMillis(metadata), DEFAULT_TIMEOUT_MILLIS);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getNumAdditiveFields(metadata), numFields);
-    int outputFields[numFields];
-    AStatsManager_PullAtomMetadata_getAdditiveFields(metadata, outputFields);
-    for (int i = 0; i < numFields; i++) {
-        EXPECT_EQ(inputFields[i], outputFields[i]);
-    }
-    AStatsManager_PullAtomMetadata_release(metadata);
-}
-
-TEST(AStatsManager_PullAtomMetadataTest, TestSetAllElements) {
-    int64_t timeoutMillis = 500;
-    int64_t coolDownMillis = 10000;
-    const int numFields = 3;
-    int inputFields[numFields] = {2, 4, 6};
-
-    AStatsManager_PullAtomMetadata* metadata = AStatsManager_PullAtomMetadata_obtain();
-    AStatsManager_PullAtomMetadata_setTimeoutMillis(metadata, timeoutMillis);
-    AStatsManager_PullAtomMetadata_setCoolDownMillis(metadata, coolDownMillis);
-    AStatsManager_PullAtomMetadata_setAdditiveFields(metadata, inputFields, numFields);
-
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getCoolDownMillis(metadata), coolDownMillis);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getTimeoutMillis(metadata), timeoutMillis);
-    EXPECT_EQ(AStatsManager_PullAtomMetadata_getNumAdditiveFields(metadata), numFields);
-    int outputFields[numFields];
-    AStatsManager_PullAtomMetadata_getAdditiveFields(metadata, outputFields);
-    for (int i = 0; i < numFields; i++) {
-        EXPECT_EQ(inputFields[i], outputFields[i]);
-    }
-    AStatsManager_PullAtomMetadata_release(metadata);
-}
diff --git a/libstats/push_compat/Android.bp b/libstats/push_compat/Android.bp
index a63a5b6..43ae69d 100644
--- a/libstats/push_compat/Android.bp
+++ b/libstats/push_compat/Android.bp
@@ -32,7 +32,10 @@
         "-DWRITE_TO_STATSD=1",
         "-DWRITE_TO_LOGD=0",
     ],
-    header_libs: ["libstatssocket_headers"],
+    header_libs: [
+        "libcutils_headers",
+        "libstatssocket_headers",
+    ],
     static_libs: [
         "libbase",
     ],
diff --git a/libstats/socket/Android.bp b/libstats/socket/Android.bp
deleted file mode 100644
index bf79ea2..0000000
--- a/libstats/socket/Android.bp
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// Copyright (C) 2018 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.
-//
-
-// =========================================================================
-// Native library to write stats log to statsd socket on Android R and later
-// =========================================================================
-cc_defaults {
-    name: "libstatssocket_defaults",
-    srcs: [
-        "stats_buffer_writer.c",
-        "stats_event.c",
-        "stats_socket.c",
-        "statsd_writer.c",
-    ],
-    export_include_dirs: ["include"],
-    static_libs: [
-        "libcutils", // does not expose a stable C API
-    ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-}
-
-cc_library {
-    name: "libstatssocket",
-    defaults: [
-        "libstatssocket_defaults",
-    ],
-    host_supported: true,
-    target: {
-        // On android, libstatssocket should only be linked as a shared lib
-        android: {
-            static: {
-                enabled: false,
-            },
-        },
-        host: {
-            shared: {
-                enabled: false,
-            },
-        },
-    },
-    stl: "libc++_static",
-
-    // enumerate stable entry points for APEX use
-    stubs: {
-        symbol_file: "libstatssocket.map.txt",
-        versions: [
-            "30",
-        ],
-    },
-    apex_available: [
-        "com.android.os.statsd",
-        "test_com.android.os.statsd",
-    ],
-}
-
-//TODO (b/149842105): Figure out if there is a better solution for this.
-cc_test_library {
-    name: "libstatssocket_private",
-    defaults: [
-        "libstatssocket_defaults",
-    ],
-    visibility: [
-        "//frameworks/base/apex/statsd/tests/libstatspull",
-        "//frameworks/base/cmds/statsd",
-    ],
-}
-
-cc_library_headers {
-    name: "libstatssocket_headers",
-    export_include_dirs: ["include"],
-    host_supported: true,
-    apex_available: ["com.android.resolv"],
-    min_sdk_version: "29",
-}
-
-cc_test {
-    name: "libstatssocket_test",
-    srcs: [
-        "tests/stats_event_test.cpp",
-        "tests/stats_writer_test.cpp",
-    ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-    static_libs: [
-        "libgmock",
-        "libstatssocket_private",
-    ],
-    shared_libs: [
-        "libcutils",
-        "libutils",
-    ],
-    test_suites: ["device-tests", "mts"],
-    test_config: "libstatssocket_test.xml",
-    //TODO(b/153588990): Remove when the build system properly separates.
-    //32bit and 64bit architectures.
-    compile_multilib: "both",
-    multilib: {
-        lib64: {
-            suffix: "64",
-        },
-        lib32: {
-            suffix: "32",
-        },
-    },
-    require_root: true,
-}
diff --git a/libstats/socket/TEST_MAPPING b/libstats/socket/TEST_MAPPING
deleted file mode 100644
index 0224998..0000000
--- a/libstats/socket/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "presubmit" : [
-    {
-      "name" : "libstatssocket_test"
-    }
-  ]
-}
\ No newline at end of file
diff --git a/libstats/socket/include/stats_buffer_writer.h b/libstats/socket/include/stats_buffer_writer.h
deleted file mode 100644
index 5b41f0e..0000000
--- a/libstats/socket/include/stats_buffer_writer.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __CPLUSPLUS
-void stats_log_close();
-int stats_log_is_closed();
-int write_buffer_to_statsd(void* buffer, size_t size, uint32_t atomId);
-#ifdef __cplusplus
-}
-#endif  // __CPLUSPLUS
diff --git a/libstats/socket/include/stats_event.h b/libstats/socket/include/stats_event.h
deleted file mode 100644
index 3d3baf9..0000000
--- a/libstats/socket/include/stats_event.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef ANDROID_STATS_LOG_STATS_EVENT_H
-#define ANDROID_STATS_LOG_STATS_EVENT_H
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * Functionality to build and store the buffer sent over the statsd socket.
- * This code defines and encapsulates the socket protocol.
- *
- * Usage:
- *      AStatsEvent* event = AStatsEvent_obtain();
- *
- *      AStatsEvent_setAtomId(event, atomId);
- *      AStatsEvent_addBoolAnnotation(event, 5, false); // atom-level annotation
- *      AStatsEvent_writeInt32(event, 24);
- *      AStatsEvent_addBoolAnnotation(event, 1, true); // annotation for preceding atom field
- *      AStatsEvent_addInt32Annotation(event, 2, 128);
- *      AStatsEvent_writeFloat(event, 2.0);
- *
- *      AStatsEvent_write(event);
- *      AStatsEvent_release(event);
- *
- * Note that calls to add atom fields and annotations should be made in the
- * order that they are defined in the atom.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __CPLUSPLUS
-
-/**
- * Opaque struct use to represent a StatsEvent. It builds and stores the data that is sent to
- * statsd.
- */
-struct AStatsEvent;
-typedef struct AStatsEvent AStatsEvent;
-
-/**
- * Returns a new AStatsEvent. If you call this function, you must call AStatsEvent_release to free
- * the allocated memory.
- */
-AStatsEvent* AStatsEvent_obtain();
-
-/**
- * Builds and finalizes the AStatsEvent for a pulled event.
- * This should only be called for pulled AStatsEvents.
- *
- * After this function, the StatsEvent must not be modified in any way other than calling release or
- * write.
- *
- * Build can be called multiple times without error.
- * If the event has been built before, this function is a no-op.
- */
-void AStatsEvent_build(AStatsEvent* event);
-
-/**
- * Writes the StatsEvent to the stats log.
- *
- * After calling this, AStatsEvent_release must be called,
- * and is the only function that can be safely called.
- */
-int AStatsEvent_write(AStatsEvent* event);
-
-/**
- * Frees the memory held by this StatsEvent.
- *
- * After calling this, the StatsEvent must not be used or modified in any way.
- */
-void AStatsEvent_release(AStatsEvent* event);
-
-/**
- * Sets the atom id for this StatsEvent.
- *
- * This function should be called immediately after AStatsEvent_obtain. It may
- * be called additional times as well, but subsequent calls will have no effect.
- **/
-void AStatsEvent_setAtomId(AStatsEvent* event, uint32_t atomId);
-
-/**
- * Writes an int32_t field to this StatsEvent.
- **/
-void AStatsEvent_writeInt32(AStatsEvent* event, int32_t value);
-
-/**
- * Writes an int64_t field to this StatsEvent.
- **/
-void AStatsEvent_writeInt64(AStatsEvent* event, int64_t value);
-
-/**
- * Writes a float field to this StatsEvent.
- **/
-void AStatsEvent_writeFloat(AStatsEvent* event, float value);
-
-/**
- * Write a bool field to this StatsEvent.
- **/
-void AStatsEvent_writeBool(AStatsEvent* event, bool value);
-
-/**
- * Write a byte array field to this StatsEvent.
- **/
-void AStatsEvent_writeByteArray(AStatsEvent* event, const uint8_t* buf, size_t numBytes);
-
-/**
- * Write a string field to this StatsEvent.
- *
- * The string must be null-terminated.
- **/
-void AStatsEvent_writeString(AStatsEvent* event, const char* value);
-
-/**
- * Write an attribution chain field to this StatsEvent.
- *
- * The sizes of uids and tags must be equal. The AttributionNode at position i is
- * made up of uids[i] and tags[i].
- *
- * \param uids array of uids in the attribution chain.
- * \param tags array of tags in the attribution chain. Each tag must be null-terminated.
- * \param numNodes the number of AttributionNodes in the attribution chain. This is the length of
- *                 the uids and the tags.
- **/
-void AStatsEvent_writeAttributionChain(AStatsEvent* event, const uint32_t* uids,
-                                       const char* const* tags, uint8_t numNodes);
-
-/**
- * Write a bool annotation for the previous field written.
- **/
-void AStatsEvent_addBoolAnnotation(AStatsEvent* event, uint8_t annotationId, bool value);
-
-/**
- * Write an integer annotation for the previous field written.
- **/
-void AStatsEvent_addInt32Annotation(AStatsEvent* event, uint8_t annotationId, int32_t value);
-
-// Internal/test APIs. Should not be exposed outside of the APEX.
-void AStatsEvent_overwriteTimestamp(AStatsEvent* event, uint64_t timestampNs);
-uint32_t AStatsEvent_getAtomId(AStatsEvent* event);
-// Size is an output parameter.
-uint8_t* AStatsEvent_getBuffer(AStatsEvent* event, size_t* size);
-uint32_t AStatsEvent_getErrors(AStatsEvent* event);
-
-#ifdef __cplusplus
-}
-#endif  // __CPLUSPLUS
-
-#endif  // ANDROID_STATS_LOG_STATS_EVENT_H
diff --git a/libstats/socket/include/stats_socket.h b/libstats/socket/include/stats_socket.h
deleted file mode 100644
index 5a75fc0..0000000
--- a/libstats/socket/include/stats_socket.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-/**
- * Helpers to manage the statsd socket.
- **/
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __CPLUSPLUS
-
-/**
- * Closes the statsd socket file descriptor.
- **/
-void AStatsSocket_close();
-#ifdef __cplusplus
-}
-#endif  // __CPLUSPLUS
diff --git a/libstats/socket/libstatssocket.map.txt b/libstats/socket/libstatssocket.map.txt
deleted file mode 100644
index 5c13904..0000000
--- a/libstats/socket/libstatssocket.map.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-LIBSTATSSOCKET {
-    global:
-        AStatsEvent_obtain; # apex # introduced=30
-        AStatsEvent_build; # apex # introduced=30
-        AStatsEvent_write; # apex # introduced=30
-        AStatsEvent_release; # apex # introduced=30
-        AStatsEvent_setAtomId; # apex # introduced=30
-        AStatsEvent_writeInt32; # apex # introduced=30
-        AStatsEvent_writeInt64; # apex # introduced=30
-        AStatsEvent_writeFloat; # apex # introduced=30
-        AStatsEvent_writeBool; # apex # introduced=30
-        AStatsEvent_writeByteArray; # apex # introduced=30
-        AStatsEvent_writeString; # apex # introduced=30
-        AStatsEvent_writeAttributionChain; # apex # introduced=30
-        AStatsEvent_addBoolAnnotation; # apex # introduced=30
-        AStatsEvent_addInt32Annotation; # apex # introduced=30
-        AStatsSocket_close; # apex # introduced=30
-    local:
-        *;
-};
diff --git a/libstats/socket/libstatssocket_test.xml b/libstats/socket/libstatssocket_test.xml
deleted file mode 100644
index d2694d1..0000000
--- a/libstats/socket/libstatssocket_test.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-<configuration description="Runs libstatssocket_test.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-native" />
-    <option name="test-suite-tag" value="mts" />
-
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
-
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-       <option name="cleanup" value="true" />
-       <option name="push" value="libstatssocket_test->/data/local/tmp/libstatssocket_test" />
-       <option name="append-bitness" value="true" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="libstatssocket_test" />
-    </test>
-
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.google.android.os.statsd" />
-    </object>
-</configuration>
-
diff --git a/libstats/socket/stats_buffer_writer.c b/libstats/socket/stats_buffer_writer.c
deleted file mode 100644
index 549acdc..0000000
--- a/libstats/socket/stats_buffer_writer.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "include/stats_buffer_writer.h"
-#ifdef __ANDROID__
-#include <cutils/properties.h>
-#endif
-#include <errno.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include "statsd_writer.h"
-
-static const uint32_t kStatsEventTag = 1937006964;
-
-extern struct android_log_transport_write statsdLoggerWrite;
-
-static int __write_to_statsd_init(struct iovec* vec, size_t nr);
-static int (*__write_to_statsd)(struct iovec* vec, size_t nr) = __write_to_statsd_init;
-
-void note_log_drop(int error, int atomId) {
-    statsdLoggerWrite.noteDrop(error, atomId);
-}
-
-void stats_log_close() {
-    statsd_writer_init_lock();
-    __write_to_statsd = __write_to_statsd_init;
-    if (statsdLoggerWrite.close) {
-        (*statsdLoggerWrite.close)();
-    }
-    statsd_writer_init_unlock();
-}
-
-int stats_log_is_closed() {
-    return statsdLoggerWrite.isClosed && (*statsdLoggerWrite.isClosed)();
-}
-
-int write_buffer_to_statsd(void* buffer, size_t size, uint32_t atomId) {
-    int ret = 1;
-
-    struct iovec vecs[2];
-    vecs[0].iov_base = (void*)&kStatsEventTag;
-    vecs[0].iov_len = sizeof(kStatsEventTag);
-    vecs[1].iov_base = buffer;
-    vecs[1].iov_len = size;
-
-    ret = __write_to_statsd(vecs, 2);
-
-    if (ret < 0) {
-        note_log_drop(ret, atomId);
-    }
-
-    return ret;
-}
-
-static int __write_to_stats_daemon(struct iovec* vec, size_t nr) {
-    int save_errno;
-    struct timespec ts;
-    size_t len, i;
-
-    for (len = i = 0; i < nr; ++i) {
-        len += vec[i].iov_len;
-    }
-    if (!len) {
-        return -EINVAL;
-    }
-
-    save_errno = errno;
-#if defined(__ANDROID__)
-    clock_gettime(CLOCK_REALTIME, &ts);
-#else
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    ts.tv_sec = tv.tv_sec;
-    ts.tv_nsec = tv.tv_usec * 1000;
-#endif
-
-    int ret = (int)(*statsdLoggerWrite.write)(&ts, vec, nr);
-    errno = save_errno;
-    return ret;
-}
-
-static int __write_to_statsd_initialize_locked() {
-    if (!statsdLoggerWrite.open || ((*statsdLoggerWrite.open)() < 0)) {
-        if (statsdLoggerWrite.close) {
-            (*statsdLoggerWrite.close)();
-            return -ENODEV;
-        }
-    }
-    return 1;
-}
-
-static int __write_to_statsd_init(struct iovec* vec, size_t nr) {
-    int ret, save_errno = errno;
-
-    statsd_writer_init_lock();
-
-    if (__write_to_statsd == __write_to_statsd_init) {
-        ret = __write_to_statsd_initialize_locked();
-        if (ret < 0) {
-            statsd_writer_init_unlock();
-            errno = save_errno;
-            return ret;
-        }
-
-        __write_to_statsd = __write_to_stats_daemon;
-    }
-
-    statsd_writer_init_unlock();
-
-    ret = __write_to_statsd(vec, nr);
-    errno = save_errno;
-    return ret;
-}
diff --git a/libstats/socket/stats_event.c b/libstats/socket/stats_event.c
deleted file mode 100644
index f3e8087..0000000
--- a/libstats/socket/stats_event.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "include/stats_event.h"
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "stats_buffer_writer.h"
-
-#define LOGGER_ENTRY_MAX_PAYLOAD 4068
-// Max payload size is 4 bytes less as 4 bytes are reserved for stats_eventTag.
-// See android_util_Stats_Log.cpp
-#define MAX_PUSH_EVENT_PAYLOAD (LOGGER_ENTRY_MAX_PAYLOAD - 4)
-
-#define MAX_PULL_EVENT_PAYLOAD (50 * 1024)  // 50 KB
-
-/* POSITIONS */
-#define POS_NUM_ELEMENTS 1
-#define POS_TIMESTAMP (POS_NUM_ELEMENTS + sizeof(uint8_t))
-#define POS_ATOM_ID (POS_TIMESTAMP + sizeof(uint8_t) + sizeof(uint64_t))
-
-/* LIMITS */
-#define MAX_ANNOTATION_COUNT 15
-#define MAX_BYTE_VALUE 127  // parsing side requires that lengths fit in 7 bits
-
-/* ERRORS */
-#define ERROR_NO_TIMESTAMP 0x1
-#define ERROR_NO_ATOM_ID 0x2
-#define ERROR_OVERFLOW 0x4
-#define ERROR_ATTRIBUTION_CHAIN_TOO_LONG 0x8
-#define ERROR_TOO_MANY_KEY_VALUE_PAIRS 0x10
-#define ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD 0x20
-#define ERROR_INVALID_ANNOTATION_ID 0x40
-#define ERROR_ANNOTATION_ID_TOO_LARGE 0x80
-#define ERROR_TOO_MANY_ANNOTATIONS 0x100
-#define ERROR_TOO_MANY_FIELDS 0x200
-#define ERROR_INVALID_VALUE_TYPE 0x400
-#define ERROR_STRING_NOT_NULL_TERMINATED 0x800
-#define ERROR_ATOM_ID_INVALID_POSITION 0x2000
-
-/* TYPE IDS */
-#define INT32_TYPE 0x00
-#define INT64_TYPE 0x01
-#define STRING_TYPE 0x02
-#define LIST_TYPE 0x03
-#define FLOAT_TYPE 0x04
-#define BOOL_TYPE 0x05
-#define BYTE_ARRAY_TYPE 0x06
-#define OBJECT_TYPE 0x07
-#define KEY_VALUE_PAIRS_TYPE 0x08
-#define ATTRIBUTION_CHAIN_TYPE 0x09
-#define ERROR_TYPE 0x0F
-
-// The AStatsEvent struct holds the serialized encoding of an event
-// within a buf. Also includes other required fields.
-struct AStatsEvent {
-    uint8_t* buf;
-    // Location of last field within the buf. Here, field denotes either a
-    // metadata field (e.g. timestamp) or an atom field.
-    size_t lastFieldPos;
-    // Number of valid bytes within the buffer.
-    size_t numBytesWritten;
-    uint32_t numElements;
-    uint32_t atomId;
-    uint32_t errors;
-    bool built;
-    size_t bufSize;
-};
-
-static int64_t get_elapsed_realtime_ns() {
-    struct timespec t;
-    t.tv_sec = t.tv_nsec = 0;
-    clock_gettime(CLOCK_BOOTTIME, &t);
-    return (int64_t)t.tv_sec * 1000000000LL + t.tv_nsec;
-}
-
-AStatsEvent* AStatsEvent_obtain() {
-    AStatsEvent* event = malloc(sizeof(AStatsEvent));
-    event->lastFieldPos = 0;
-    event->numBytesWritten = 2;  // reserve first 2 bytes for root event type and number of elements
-    event->numElements = 0;
-    event->atomId = 0;
-    event->errors = 0;
-    event->built = false;
-    event->bufSize = MAX_PUSH_EVENT_PAYLOAD;
-    event->buf = (uint8_t*)calloc(event->bufSize, 1);
-
-    event->buf[0] = OBJECT_TYPE;
-    AStatsEvent_writeInt64(event, get_elapsed_realtime_ns());  // write the timestamp
-
-    return event;
-}
-
-void AStatsEvent_release(AStatsEvent* event) {
-    free(event->buf);
-    free(event);
-}
-
-void AStatsEvent_setAtomId(AStatsEvent* event, uint32_t atomId) {
-    if (event->atomId != 0) return;
-    if (event->numElements != 1) {
-        event->errors |= ERROR_ATOM_ID_INVALID_POSITION;
-        return;
-    }
-
-    event->atomId = atomId;
-    AStatsEvent_writeInt32(event, atomId);
-}
-
-// Overwrites the timestamp populated in AStatsEvent_obtain with a custom
-// timestamp. Should only be called from test code.
-void AStatsEvent_overwriteTimestamp(AStatsEvent* event, uint64_t timestampNs) {
-    memcpy(&event->buf[POS_TIMESTAMP + sizeof(uint8_t)], &timestampNs, sizeof(timestampNs));
-    // Do not increment numElements because we already accounted for the timestamp
-    // within AStatsEvent_obtain.
-}
-
-// Side-effect: modifies event->errors if the buffer would overflow
-static bool overflows(AStatsEvent* event, size_t size) {
-    const size_t totalBytesNeeded = event->numBytesWritten + size;
-    if (totalBytesNeeded > MAX_PULL_EVENT_PAYLOAD) {
-        event->errors |= ERROR_OVERFLOW;
-        return true;
-    }
-
-    // Expand buffer if needed.
-    if (event->bufSize < MAX_PULL_EVENT_PAYLOAD && totalBytesNeeded > event->bufSize) {
-        do {
-            event->bufSize *= 2;
-        } while (event->bufSize <= totalBytesNeeded);
-
-        if (event->bufSize > MAX_PULL_EVENT_PAYLOAD) {
-            event->bufSize = MAX_PULL_EVENT_PAYLOAD;
-        }
-
-        event->buf = (uint8_t*)realloc(event->buf, event->bufSize);
-    }
-    return false;
-}
-
-// Side-effect: all append functions increment event->numBytesWritten if there is
-// sufficient space within the buffer to place the value
-static void append_byte(AStatsEvent* event, uint8_t value) {
-    if (!overflows(event, sizeof(value))) {
-        event->buf[event->numBytesWritten] = value;
-        event->numBytesWritten += sizeof(value);
-    }
-}
-
-static void append_bool(AStatsEvent* event, bool value) {
-    append_byte(event, (uint8_t)value);
-}
-
-static void append_int32(AStatsEvent* event, int32_t value) {
-    if (!overflows(event, sizeof(value))) {
-        memcpy(&event->buf[event->numBytesWritten], &value, sizeof(value));
-        event->numBytesWritten += sizeof(value);
-    }
-}
-
-static void append_int64(AStatsEvent* event, int64_t value) {
-    if (!overflows(event, sizeof(value))) {
-        memcpy(&event->buf[event->numBytesWritten], &value, sizeof(value));
-        event->numBytesWritten += sizeof(value);
-    }
-}
-
-static void append_float(AStatsEvent* event, float value) {
-    if (!overflows(event, sizeof(value))) {
-        memcpy(&event->buf[event->numBytesWritten], &value, sizeof(value));
-        event->numBytesWritten += sizeof(float);
-    }
-}
-
-static void append_byte_array(AStatsEvent* event, const uint8_t* buf, size_t size) {
-    if (!overflows(event, size)) {
-        memcpy(&event->buf[event->numBytesWritten], buf, size);
-        event->numBytesWritten += size;
-    }
-}
-
-// Side-effect: modifies event->errors if buf is not properly null-terminated
-static void append_string(AStatsEvent* event, const char* buf) {
-    size_t size = strnlen(buf, MAX_PULL_EVENT_PAYLOAD);
-    if (size == MAX_PULL_EVENT_PAYLOAD) {
-        event->errors |= ERROR_STRING_NOT_NULL_TERMINATED;
-        return;
-    }
-
-    append_int32(event, size);
-    append_byte_array(event, (uint8_t*)buf, size);
-}
-
-static void start_field(AStatsEvent* event, uint8_t typeId) {
-    event->lastFieldPos = event->numBytesWritten;
-    append_byte(event, typeId);
-    event->numElements++;
-}
-
-void AStatsEvent_writeInt32(AStatsEvent* event, int32_t value) {
-    start_field(event, INT32_TYPE);
-    append_int32(event, value);
-}
-
-void AStatsEvent_writeInt64(AStatsEvent* event, int64_t value) {
-    start_field(event, INT64_TYPE);
-    append_int64(event, value);
-}
-
-void AStatsEvent_writeFloat(AStatsEvent* event, float value) {
-    start_field(event, FLOAT_TYPE);
-    append_float(event, value);
-}
-
-void AStatsEvent_writeBool(AStatsEvent* event, bool value) {
-    start_field(event, BOOL_TYPE);
-    append_bool(event, value);
-}
-
-void AStatsEvent_writeByteArray(AStatsEvent* event, const uint8_t* buf, size_t numBytes) {
-    start_field(event, BYTE_ARRAY_TYPE);
-    append_int32(event, numBytes);
-    append_byte_array(event, buf, numBytes);
-}
-
-// Value is assumed to be encoded using UTF8
-void AStatsEvent_writeString(AStatsEvent* event, const char* value) {
-    start_field(event, STRING_TYPE);
-    append_string(event, value);
-}
-
-// Tags are assumed to be encoded using UTF8
-void AStatsEvent_writeAttributionChain(AStatsEvent* event, const uint32_t* uids,
-                                       const char* const* tags, uint8_t numNodes) {
-    if (numNodes > MAX_BYTE_VALUE) {
-        event->errors |= ERROR_ATTRIBUTION_CHAIN_TOO_LONG;
-        return;
-    }
-
-    start_field(event, ATTRIBUTION_CHAIN_TYPE);
-    append_byte(event, numNodes);
-
-    for (uint8_t i = 0; i < numNodes; i++) {
-        append_int32(event, uids[i]);
-        append_string(event, tags[i]);
-    }
-}
-
-// Side-effect: modifies event->errors if field has too many annotations
-static void increment_annotation_count(AStatsEvent* event) {
-    uint8_t fieldType = event->buf[event->lastFieldPos] & 0x0F;
-    uint32_t oldAnnotationCount = (event->buf[event->lastFieldPos] & 0xF0) >> 4;
-    uint32_t newAnnotationCount = oldAnnotationCount + 1;
-
-    if (newAnnotationCount > MAX_ANNOTATION_COUNT) {
-        event->errors |= ERROR_TOO_MANY_ANNOTATIONS;
-        return;
-    }
-
-    event->buf[event->lastFieldPos] = (((uint8_t)newAnnotationCount << 4) & 0xF0) | fieldType;
-}
-
-void AStatsEvent_addBoolAnnotation(AStatsEvent* event, uint8_t annotationId, bool value) {
-    if (event->numElements < 2) {
-        event->errors |= ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD;
-        return;
-    } else if (annotationId > MAX_BYTE_VALUE) {
-        event->errors |= ERROR_ANNOTATION_ID_TOO_LARGE;
-        return;
-    }
-
-    append_byte(event, annotationId);
-    append_byte(event, BOOL_TYPE);
-    append_bool(event, value);
-    increment_annotation_count(event);
-}
-
-void AStatsEvent_addInt32Annotation(AStatsEvent* event, uint8_t annotationId, int32_t value) {
-    if (event->numElements < 2) {
-        event->errors |= ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD;
-        return;
-    } else if (annotationId > MAX_BYTE_VALUE) {
-        event->errors |= ERROR_ANNOTATION_ID_TOO_LARGE;
-        return;
-    }
-
-    append_byte(event, annotationId);
-    append_byte(event, INT32_TYPE);
-    append_int32(event, value);
-    increment_annotation_count(event);
-}
-
-uint32_t AStatsEvent_getAtomId(AStatsEvent* event) {
-    return event->atomId;
-}
-
-uint8_t* AStatsEvent_getBuffer(AStatsEvent* event, size_t* size) {
-    if (size) *size = event->numBytesWritten;
-    return event->buf;
-}
-
-uint32_t AStatsEvent_getErrors(AStatsEvent* event) {
-    return event->errors;
-}
-
-static void build_internal(AStatsEvent* event, const bool push) {
-    if (event->numElements > MAX_BYTE_VALUE) event->errors |= ERROR_TOO_MANY_FIELDS;
-    if (0 == event->atomId) event->errors |= ERROR_NO_ATOM_ID;
-    if (push && event->numBytesWritten > MAX_PUSH_EVENT_PAYLOAD) event->errors |= ERROR_OVERFLOW;
-
-    // If there are errors, rewrite buffer.
-    if (event->errors) {
-        // Discard everything after the atom id (including atom-level
-        // annotations). This leaves only two elements (timestamp and atom id).
-        event->numElements = 2;
-        // Reset number of atom-level annotations to 0.
-        event->buf[POS_ATOM_ID] = INT32_TYPE;
-        // Now, write errors to the buffer immediately after the atom id.
-        event->numBytesWritten = POS_ATOM_ID + sizeof(uint8_t) + sizeof(uint32_t);
-        start_field(event, ERROR_TYPE);
-        append_int32(event, event->errors);
-    }
-
-    event->buf[POS_NUM_ELEMENTS] = event->numElements;
-}
-
-void AStatsEvent_build(AStatsEvent* event) {
-    if (event->built) return;
-
-    build_internal(event, false /* push */);
-
-    event->built = true;
-}
-
-int AStatsEvent_write(AStatsEvent* event) {
-    build_internal(event, true /* push */);
-    return write_buffer_to_statsd(event->buf, event->numBytesWritten, event->atomId);
-}
diff --git a/libstats/socket/stats_socket.c b/libstats/socket/stats_socket.c
deleted file mode 100644
index 09f8967..0000000
--- a/libstats/socket/stats_socket.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include "include/stats_socket.h"
-#include "stats_buffer_writer.h"
-
-void AStatsSocket_close() {
-    stats_log_close();
-}
diff --git a/libstats/socket/statsd_writer.c b/libstats/socket/statsd_writer.c
deleted file mode 100644
index 73b7a7e..0000000
--- a/libstats/socket/statsd_writer.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2018, 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.
- */
-#include "statsd_writer.h"
-
-#include <cutils/fs.h>
-#include <cutils/sockets.h>
-#include <cutils/threads.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <poll.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-#include <stdarg.h>
-#include <stdatomic.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <time.h>
-#include <unistd.h>
-
-static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
-static atomic_int dropped = 0;
-static atomic_int log_error = 0;
-static atomic_int atom_tag = 0;
-
-void statsd_writer_init_lock() {
-    /*
-     * If we trigger a signal handler in the middle of locked activity and the
-     * signal handler logs a message, we could get into a deadlock state.
-     */
-    pthread_mutex_lock(&log_init_lock);
-}
-
-int statd_writer_trylock() {
-    return pthread_mutex_trylock(&log_init_lock);
-}
-
-void statsd_writer_init_unlock() {
-    pthread_mutex_unlock(&log_init_lock);
-}
-
-static int statsdAvailable();
-static int statsdOpen();
-static void statsdClose();
-static int statsdWrite(struct timespec* ts, struct iovec* vec, size_t nr);
-static void statsdNoteDrop();
-static int statsdIsClosed();
-
-struct android_log_transport_write statsdLoggerWrite = {
-        .name = "statsd",
-        .sock = -EBADF,
-        .available = statsdAvailable,
-        .open = statsdOpen,
-        .close = statsdClose,
-        .write = statsdWrite,
-        .noteDrop = statsdNoteDrop,
-        .isClosed = statsdIsClosed,
-};
-
-/* log_init_lock assumed */
-static int statsdOpen() {
-    int i, ret = 0;
-
-    i = atomic_load(&statsdLoggerWrite.sock);
-    if (i < 0) {
-        int flags = SOCK_DGRAM;
-#ifdef SOCK_CLOEXEC
-        flags |= SOCK_CLOEXEC;
-#endif
-#ifdef SOCK_NONBLOCK
-        flags |= SOCK_NONBLOCK;
-#endif
-        int sock = TEMP_FAILURE_RETRY(socket(PF_UNIX, flags, 0));
-        if (sock < 0) {
-            ret = -errno;
-        } else {
-            int sndbuf = 1 * 1024 * 1024;  // set max send buffer size 1MB
-            socklen_t bufLen = sizeof(sndbuf);
-            // SO_RCVBUF does not have an effect on unix domain socket, but SO_SNDBUF does.
-            // Proceed to connect even setsockopt fails.
-            setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, bufLen);
-            struct sockaddr_un un;
-            memset(&un, 0, sizeof(struct sockaddr_un));
-            un.sun_family = AF_UNIX;
-            strcpy(un.sun_path, "/dev/socket/statsdw");
-
-            if (TEMP_FAILURE_RETRY(
-                        connect(sock, (struct sockaddr*)&un, sizeof(struct sockaddr_un))) < 0) {
-                ret = -errno;
-                switch (ret) {
-                    case -ENOTCONN:
-                    case -ECONNREFUSED:
-                    case -ENOENT:
-                        i = atomic_exchange(&statsdLoggerWrite.sock, ret);
-                    /* FALLTHRU */
-                    default:
-                        break;
-                }
-                close(sock);
-            } else {
-                ret = atomic_exchange(&statsdLoggerWrite.sock, sock);
-                if ((ret >= 0) && (ret != sock)) {
-                    close(ret);
-                }
-                ret = 0;
-            }
-        }
-    }
-
-    return ret;
-}
-
-static void __statsdClose(int negative_errno) {
-    int sock = atomic_exchange(&statsdLoggerWrite.sock, negative_errno);
-    if (sock >= 0) {
-        close(sock);
-    }
-}
-
-static void statsdClose() {
-    __statsdClose(-EBADF);
-}
-
-static int statsdAvailable() {
-    if (atomic_load(&statsdLoggerWrite.sock) < 0) {
-        if (access("/dev/socket/statsdw", W_OK) == 0) {
-            return 0;
-        }
-        return -EBADF;
-    }
-    return 1;
-}
-
-static void statsdNoteDrop(int error, int tag) {
-    atomic_fetch_add_explicit(&dropped, 1, memory_order_relaxed);
-    atomic_exchange_explicit(&log_error, error, memory_order_relaxed);
-    atomic_exchange_explicit(&atom_tag, tag, memory_order_relaxed);
-}
-
-static int statsdIsClosed() {
-    if (atomic_load(&statsdLoggerWrite.sock) < 0) {
-        return 1;
-    }
-    return 0;
-}
-
-static int statsdWrite(struct timespec* ts, struct iovec* vec, size_t nr) {
-    ssize_t ret;
-    int sock;
-    static const unsigned headerLength = 1;
-    struct iovec newVec[nr + headerLength];
-    android_log_header_t header;
-    size_t i, payloadSize;
-
-    sock = atomic_load(&statsdLoggerWrite.sock);
-    if (sock < 0) switch (sock) {
-            case -ENOTCONN:
-            case -ECONNREFUSED:
-            case -ENOENT:
-                break;
-            default:
-                return -EBADF;
-        }
-    /*
-     *  struct {
-     *      // what we provide to socket
-     *      android_log_header_t header;
-     *      // caller provides
-     *      union {
-     *          struct {
-     *              char     prio;
-     *              char     payload[];
-     *          } string;
-     *          struct {
-     *              uint32_t tag
-     *              char     payload[];
-     *          } binary;
-     *      };
-     *  };
-     */
-
-    header.tid = gettid();
-    header.realtime.tv_sec = ts->tv_sec;
-    header.realtime.tv_nsec = ts->tv_nsec;
-
-    newVec[0].iov_base = (unsigned char*)&header;
-    newVec[0].iov_len = sizeof(header);
-
-    // If we dropped events before, try to tell statsd.
-    if (sock >= 0) {
-        int32_t snapshot = atomic_exchange_explicit(&dropped, 0, memory_order_relaxed);
-        if (snapshot) {
-            android_log_event_long_t buffer;
-            header.id = LOG_ID_STATS;
-            // store the last log error in the tag field. This tag field is not used by statsd.
-            buffer.header.tag = atomic_load(&log_error);
-            buffer.payload.type = EVENT_TYPE_LONG;
-            // format:
-            // |atom_tag|dropped_count|
-            int64_t composed_long = atomic_load(&atom_tag);
-            // Send 2 int32's via an int64.
-            composed_long = ((composed_long << 32) | ((int64_t)snapshot));
-            buffer.payload.data = composed_long;
-
-            newVec[headerLength].iov_base = &buffer;
-            newVec[headerLength].iov_len = sizeof(buffer);
-
-            ret = TEMP_FAILURE_RETRY(writev(sock, newVec, 2));
-            if (ret != (ssize_t)(sizeof(header) + sizeof(buffer))) {
-                atomic_fetch_add_explicit(&dropped, snapshot, memory_order_relaxed);
-            }
-        }
-    }
-
-    header.id = LOG_ID_STATS;
-
-    for (payloadSize = 0, i = headerLength; i < nr + headerLength; i++) {
-        newVec[i].iov_base = vec[i - headerLength].iov_base;
-        payloadSize += newVec[i].iov_len = vec[i - headerLength].iov_len;
-
-        if (payloadSize > LOGGER_ENTRY_MAX_PAYLOAD) {
-            newVec[i].iov_len -= payloadSize - LOGGER_ENTRY_MAX_PAYLOAD;
-            if (newVec[i].iov_len) {
-                ++i;
-            }
-            break;
-        }
-    }
-
-    /*
-     * The write below could be lost, but will never block.
-     *
-     * ENOTCONN occurs if statsd has died.
-     * ENOENT occurs if statsd is not running and socket is missing.
-     * ECONNREFUSED occurs if we can not reconnect to statsd.
-     * EAGAIN occurs if statsd is overloaded.
-     */
-    if (sock < 0) {
-        ret = sock;
-    } else {
-        ret = TEMP_FAILURE_RETRY(writev(sock, newVec, i));
-        if (ret < 0) {
-            ret = -errno;
-        }
-    }
-    switch (ret) {
-        case -ENOTCONN:
-        case -ECONNREFUSED:
-        case -ENOENT:
-            if (statd_writer_trylock()) {
-                return ret; /* in a signal handler? try again when less stressed
-                             */
-            }
-            __statsdClose(ret);
-            ret = statsdOpen();
-            statsd_writer_init_unlock();
-
-            if (ret < 0) {
-                return ret;
-            }
-
-            ret = TEMP_FAILURE_RETRY(writev(atomic_load(&statsdLoggerWrite.sock), newVec, i));
-            if (ret < 0) {
-                ret = -errno;
-            }
-        /* FALLTHRU */
-        default:
-            break;
-    }
-
-    if (ret > (ssize_t)sizeof(header)) {
-        ret -= sizeof(header);
-    }
-
-    return ret;
-}
diff --git a/libstats/socket/statsd_writer.h b/libstats/socket/statsd_writer.h
deleted file mode 100644
index 562bda5..0000000
--- a/libstats/socket/statsd_writer.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2018, 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.
- */
-
-#ifndef ANDROID_STATS_LOG_STATS_WRITER_H
-#define ANDROID_STATS_LOG_STATS_WRITER_H
-
-#include <pthread.h>
-#include <stdatomic.h>
-#include <sys/socket.h>
-
-/**
- * Internal lock should not be exposed. This is bad design.
- * TODO: rewrite it in c++ code and encapsulate the functionality in a
- * StatsdWriter class.
- */
-void statsd_writer_init_lock();
-int statsd_writer_init_trylock();
-void statsd_writer_init_unlock();
-
-struct android_log_transport_write {
-    const char* name; /* human name to describe the transport */
-    atomic_int sock;
-    int (*available)(); /* Does not cause resources to be taken */
-    int (*open)();      /* can be called multiple times, reusing current resources */
-    void (*close)();    /* free up resources */
-    /* write log to transport, returns number of bytes propagated, or -errno */
-    int (*write)(struct timespec* ts, struct iovec* vec, size_t nr);
-    /* note one log drop */
-    void (*noteDrop)(int error, int tag);
-    /* checks if the socket is closed */
-    int (*isClosed)();
-};
-
-#endif  // ANDROID_STATS_LOG_STATS_WRITER_H
diff --git a/libstats/socket/tests/stats_event_test.cpp b/libstats/socket/tests/stats_event_test.cpp
deleted file mode 100644
index 9a1fac8..0000000
--- a/libstats/socket/tests/stats_event_test.cpp
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include "stats_event.h"
-#include <gtest/gtest.h>
-#include <utils/SystemClock.h>
-
-// Keep in sync with stats_event.c. Consider moving to separate header file to avoid duplication.
-/* ERRORS */
-#define ERROR_NO_TIMESTAMP 0x1
-#define ERROR_NO_ATOM_ID 0x2
-#define ERROR_OVERFLOW 0x4
-#define ERROR_ATTRIBUTION_CHAIN_TOO_LONG 0x8
-#define ERROR_TOO_MANY_KEY_VALUE_PAIRS 0x10
-#define ERROR_ANNOTATION_DOES_NOT_FOLLOW_FIELD 0x20
-#define ERROR_INVALID_ANNOTATION_ID 0x40
-#define ERROR_ANNOTATION_ID_TOO_LARGE 0x80
-#define ERROR_TOO_MANY_ANNOTATIONS 0x100
-#define ERROR_TOO_MANY_FIELDS 0x200
-#define ERROR_INVALID_VALUE_TYPE 0x400
-#define ERROR_STRING_NOT_NULL_TERMINATED 0x800
-#define ERROR_ATOM_ID_INVALID_POSITION 0x2000
-
-/* TYPE IDS */
-#define INT32_TYPE 0x00
-#define INT64_TYPE 0x01
-#define STRING_TYPE 0x02
-#define LIST_TYPE 0x03
-#define FLOAT_TYPE 0x04
-#define BOOL_TYPE 0x05
-#define BYTE_ARRAY_TYPE 0x06
-#define OBJECT_TYPE 0x07
-#define KEY_VALUE_PAIRS_TYPE 0x08
-#define ATTRIBUTION_CHAIN_TYPE 0x09
-#define ERROR_TYPE 0x0F
-
-using std::string;
-using std::vector;
-
-// Side-effect: this function moves the start of the buffer past the read value
-template <class T>
-T readNext(uint8_t** buffer) {
-    T value;
-    if ((reinterpret_cast<uintptr_t>(*buffer) % alignof(T)) == 0) {
-        value = *(T*)(*buffer);
-    } else {
-        memcpy(&value, *buffer, sizeof(T));
-    }
-    *buffer += sizeof(T);
-    return value;
-}
-
-void checkTypeHeader(uint8_t** buffer, uint8_t typeId, uint8_t numAnnotations = 0) {
-    uint8_t typeHeader = (numAnnotations << 4) | typeId;
-    EXPECT_EQ(readNext<uint8_t>(buffer), typeHeader);
-}
-
-template <class T>
-void checkScalar(uint8_t** buffer, T expectedValue) {
-    EXPECT_EQ(readNext<T>(buffer), expectedValue);
-}
-
-void checkString(uint8_t** buffer, const string& expectedString) {
-    uint32_t size = readNext<uint32_t>(buffer);
-    string parsedString((char*)(*buffer), size);
-    EXPECT_EQ(parsedString, expectedString);
-    *buffer += size;  // move buffer past string we just read
-}
-
-void checkByteArray(uint8_t** buffer, const vector<uint8_t>& expectedByteArray) {
-    uint32_t size = readNext<uint32_t>(buffer);
-    vector<uint8_t> parsedByteArray(*buffer, *buffer + size);
-    EXPECT_EQ(parsedByteArray, expectedByteArray);
-    *buffer += size;  // move buffer past byte array we just read
-}
-
-template <class T>
-void checkAnnotation(uint8_t** buffer, uint8_t annotationId, uint8_t typeId, T annotationValue) {
-    EXPECT_EQ(readNext<uint8_t>(buffer), annotationId);
-    EXPECT_EQ(readNext<uint8_t>(buffer), typeId);
-    checkScalar<T>(buffer, annotationValue);
-}
-
-void checkMetadata(uint8_t** buffer, uint8_t numElements, int64_t startTime, int64_t endTime,
-                   uint32_t atomId, uint8_t numAtomLevelAnnotations = 0) {
-    // All events start with OBJECT_TYPE id.
-    checkTypeHeader(buffer, OBJECT_TYPE);
-
-    // We increment by 2 because the number of elements listed in the
-    // serialization accounts for the timestamp and atom id as well.
-    checkScalar(buffer, static_cast<uint8_t>(numElements + 2));
-
-    // Check timestamp
-    checkTypeHeader(buffer, INT64_TYPE);
-    int64_t timestamp = readNext<int64_t>(buffer);
-    EXPECT_GE(timestamp, startTime);
-    EXPECT_LE(timestamp, endTime);
-
-    // Check atom id
-    checkTypeHeader(buffer, INT32_TYPE, numAtomLevelAnnotations);
-    checkScalar(buffer, atomId);
-}
-
-TEST(StatsEventTest, TestScalars) {
-    uint32_t atomId = 100;
-    int32_t int32Value = -5;
-    int64_t int64Value = -2 * android::elapsedRealtimeNano();
-    float floatValue = 2.0;
-    bool boolValue = false;
-
-    int64_t startTime = android::elapsedRealtimeNano();
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_writeInt32(event, int32Value);
-    AStatsEvent_writeInt64(event, int64Value);
-    AStatsEvent_writeFloat(event, floatValue);
-    AStatsEvent_writeBool(event, boolValue);
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, /*numElements=*/4, startTime, endTime, atomId);
-
-    // check int32 element
-    checkTypeHeader(&buffer, INT32_TYPE);
-    checkScalar(&buffer, int32Value);
-
-    // check int64 element
-    checkTypeHeader(&buffer, INT64_TYPE);
-    checkScalar(&buffer, int64Value);
-
-    // check float element
-    checkTypeHeader(&buffer, FLOAT_TYPE);
-    checkScalar(&buffer, floatValue);
-
-    // check bool element
-    checkTypeHeader(&buffer, BOOL_TYPE);
-    checkScalar(&buffer, boolValue);
-
-    EXPECT_EQ(buffer, bufferEnd);  // ensure that we have read the entire buffer
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestStrings) {
-    uint32_t atomId = 100;
-    string str = "test_string";
-
-    int64_t startTime = android::elapsedRealtimeNano();
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_writeString(event, str.c_str());
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, /*numElements=*/1, startTime, endTime, atomId);
-
-    checkTypeHeader(&buffer, STRING_TYPE);
-    checkString(&buffer, str);
-
-    EXPECT_EQ(buffer, bufferEnd);  // ensure that we have read the entire buffer
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestByteArrays) {
-    uint32_t atomId = 100;
-    vector<uint8_t> message = {'b', 'y', 't', '\0', 'e', 's'};
-
-    int64_t startTime = android::elapsedRealtimeNano();
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_writeByteArray(event, message.data(), message.size());
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, /*numElements=*/1, startTime, endTime, atomId);
-
-    checkTypeHeader(&buffer, BYTE_ARRAY_TYPE);
-    checkByteArray(&buffer, message);
-
-    EXPECT_EQ(buffer, bufferEnd);  // ensure that we have read the entire buffer
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestAttributionChains) {
-    uint32_t atomId = 100;
-
-    uint8_t numNodes = 50;
-    uint32_t uids[numNodes];
-    vector<string> tags(numNodes);  // storage that cTag elements point to
-    const char* cTags[numNodes];
-    for (int i = 0; i < (int)numNodes; i++) {
-        uids[i] = i;
-        tags.push_back("test" + std::to_string(i));
-        cTags[i] = tags[i].c_str();
-    }
-
-    int64_t startTime = android::elapsedRealtimeNano();
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_writeAttributionChain(event, uids, cTags, numNodes);
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, /*numElements=*/1, startTime, endTime, atomId);
-
-    checkTypeHeader(&buffer, ATTRIBUTION_CHAIN_TYPE);
-    checkScalar(&buffer, numNodes);
-    for (int i = 0; i < numNodes; i++) {
-        checkScalar(&buffer, uids[i]);
-        checkString(&buffer, tags[i]);
-    }
-
-    EXPECT_EQ(buffer, bufferEnd);  // ensure that we have read the entire buffer
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestFieldAnnotations) {
-    uint32_t atomId = 100;
-
-    // first element information
-    bool boolValue = false;
-    uint8_t boolAnnotation1Id = 1;
-    uint8_t boolAnnotation2Id = 2;
-    bool boolAnnotation1Value = true;
-    int32_t boolAnnotation2Value = 3;
-
-    // second element information
-    float floatValue = -5.0;
-    uint8_t floatAnnotation1Id = 3;
-    uint8_t floatAnnotation2Id = 4;
-    int32_t floatAnnotation1Value = 8;
-    bool floatAnnotation2Value = false;
-
-    int64_t startTime = android::elapsedRealtimeNano();
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_writeBool(event, boolValue);
-    AStatsEvent_addBoolAnnotation(event, boolAnnotation1Id, boolAnnotation1Value);
-    AStatsEvent_addInt32Annotation(event, boolAnnotation2Id, boolAnnotation2Value);
-    AStatsEvent_writeFloat(event, floatValue);
-    AStatsEvent_addInt32Annotation(event, floatAnnotation1Id, floatAnnotation1Value);
-    AStatsEvent_addBoolAnnotation(event, floatAnnotation2Id, floatAnnotation2Value);
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, /*numElements=*/2, startTime, endTime, atomId);
-
-    // check first element
-    checkTypeHeader(&buffer, BOOL_TYPE, /*numAnnotations=*/2);
-    checkScalar(&buffer, boolValue);
-    checkAnnotation(&buffer, boolAnnotation1Id, BOOL_TYPE, boolAnnotation1Value);
-    checkAnnotation(&buffer, boolAnnotation2Id, INT32_TYPE, boolAnnotation2Value);
-
-    // check second element
-    checkTypeHeader(&buffer, FLOAT_TYPE, /*numAnnotations=*/2);
-    checkScalar(&buffer, floatValue);
-    checkAnnotation(&buffer, floatAnnotation1Id, INT32_TYPE, floatAnnotation1Value);
-    checkAnnotation(&buffer, floatAnnotation2Id, BOOL_TYPE, floatAnnotation2Value);
-
-    EXPECT_EQ(buffer, bufferEnd);  // ensure that we have read the entire buffer
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestAtomLevelAnnotations) {
-    uint32_t atomId = 100;
-    // atom-level annotation information
-    uint8_t boolAnnotationId = 1;
-    uint8_t int32AnnotationId = 2;
-    bool boolAnnotationValue = false;
-    int32_t int32AnnotationValue = 5;
-
-    float fieldValue = -3.5;
-
-    int64_t startTime = android::elapsedRealtimeNano();
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_addBoolAnnotation(event, boolAnnotationId, boolAnnotationValue);
-    AStatsEvent_addInt32Annotation(event, int32AnnotationId, int32AnnotationValue);
-    AStatsEvent_writeFloat(event, fieldValue);
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, /*numElements=*/1, startTime, endTime, atomId,
-                  /*numAtomLevelAnnotations=*/2);
-
-    // check atom-level annotations
-    checkAnnotation(&buffer, boolAnnotationId, BOOL_TYPE, boolAnnotationValue);
-    checkAnnotation(&buffer, int32AnnotationId, INT32_TYPE, int32AnnotationValue);
-
-    // check first element
-    checkTypeHeader(&buffer, FLOAT_TYPE);
-    checkScalar(&buffer, fieldValue);
-
-    EXPECT_EQ(buffer, bufferEnd);  // ensure that we have read the entire buffer
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestNoAtomIdError) {
-    AStatsEvent* event = AStatsEvent_obtain();
-    // Don't set the atom id in order to trigger the error.
-    AStatsEvent_build(event);
-
-    uint32_t errors = AStatsEvent_getErrors(event);
-    EXPECT_EQ(errors & ERROR_NO_ATOM_ID, ERROR_NO_ATOM_ID);
-
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestPushOverflowError) {
-    const char* str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-    const int writeCount = 120;  // Number of times to write str in the event.
-
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, 100);
-
-    // Add str to the event 120 times. Each str takes >35 bytes so this will
-    // overflow the 4068 byte buffer.
-    // We want to keep writeCount less than 127 to avoid hitting
-    // ERROR_TOO_MANY_FIELDS.
-    for (int i = 0; i < writeCount; i++) {
-        AStatsEvent_writeString(event, str);
-    }
-    AStatsEvent_write(event);
-
-    uint32_t errors = AStatsEvent_getErrors(event);
-    EXPECT_EQ(errors & ERROR_OVERFLOW, ERROR_OVERFLOW);
-
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestPullOverflowError) {
-    const uint32_t atomId = 10100;
-    const vector<uint8_t> bytes(430 /* number of elements */, 1 /* value of each element */);
-    const int writeCount = 120;  // Number of times to write bytes in the event.
-
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-
-    // Add bytes to the event 120 times. Size of bytes is 430 so this will
-    // overflow the 50 KB pulled event buffer.
-    // We want to keep writeCount less than 127 to avoid hitting
-    // ERROR_TOO_MANY_FIELDS.
-    for (int i = 0; i < writeCount; i++) {
-        AStatsEvent_writeByteArray(event, bytes.data(), bytes.size());
-    }
-    AStatsEvent_build(event);
-
-    uint32_t errors = AStatsEvent_getErrors(event);
-    EXPECT_EQ(errors & ERROR_OVERFLOW, ERROR_OVERFLOW);
-
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestLargePull) {
-    const uint32_t atomId = 100;
-    const string str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-    const int writeCount = 120;  // Number of times to write str in the event.
-    const int64_t startTime = android::elapsedRealtimeNano();
-
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-
-    // Add str to the event 120 times.
-    // We want to keep writeCount less than 127 to avoid hitting
-    // ERROR_TOO_MANY_FIELDS.
-    for (int i = 0; i < writeCount; i++) {
-        AStatsEvent_writeString(event, str.c_str());
-    }
-    AStatsEvent_build(event);
-    int64_t endTime = android::elapsedRealtimeNano();
-
-    size_t bufferSize;
-    uint8_t* buffer = AStatsEvent_getBuffer(event, &bufferSize);
-    uint8_t* bufferEnd = buffer + bufferSize;
-
-    checkMetadata(&buffer, writeCount, startTime, endTime, atomId);
-
-    // Check all instances of str have been written.
-    for (int i = 0; i < writeCount; i++) {
-        checkTypeHeader(&buffer, STRING_TYPE);
-        checkString(&buffer, str);
-    }
-
-    EXPECT_EQ(buffer, bufferEnd);  // Ensure that we have read the entire buffer.
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestAtomIdInvalidPositionError) {
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_writeInt32(event, 0);
-    AStatsEvent_setAtomId(event, 100);
-    AStatsEvent_writeBool(event, true);
-    AStatsEvent_build(event);
-
-    uint32_t errors = AStatsEvent_getErrors(event);
-    EXPECT_EQ(errors & ERROR_ATOM_ID_INVALID_POSITION, ERROR_ATOM_ID_INVALID_POSITION);
-
-    AStatsEvent_release(event);
-}
-
-TEST(StatsEventTest, TestOverwriteTimestamp) {
-    uint32_t atomId = 100;
-    int64_t expectedTimestamp = 0x123456789;
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, atomId);
-    AStatsEvent_overwriteTimestamp(event, expectedTimestamp);
-    AStatsEvent_build(event);
-
-    uint8_t* buffer = AStatsEvent_getBuffer(event, NULL);
-
-    // Make sure that the timestamp is being overwritten.
-    checkMetadata(&buffer, /*numElements=*/0, /*startTime=*/expectedTimestamp,
-                  /*endTime=*/expectedTimestamp, atomId);
-
-    EXPECT_EQ(AStatsEvent_getErrors(event), 0);
-    AStatsEvent_release(event);
-}
diff --git a/libstats/socket/tests/stats_writer_test.cpp b/libstats/socket/tests/stats_writer_test.cpp
deleted file mode 100644
index 749599f..0000000
--- a/libstats/socket/tests/stats_writer_test.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-#include "stats_buffer_writer.h"
-#include "stats_event.h"
-#include "stats_socket.h"
-
-TEST(StatsWriterTest, TestSocketClose) {
-    AStatsEvent* event = AStatsEvent_obtain();
-    AStatsEvent_setAtomId(event, 100);
-    AStatsEvent_writeInt32(event, 5);
-    int successResult = AStatsEvent_write(event);
-    AStatsEvent_release(event);
-
-    // In the case of a successful write, we return the number of bytes written.
-    EXPECT_GT(successResult, 0);
-    EXPECT_FALSE(stats_log_is_closed());
-
-    AStatsSocket_close();
-
-    EXPECT_TRUE(stats_log_is_closed());
-}
diff --git a/libsync/Android.bp b/libsync/Android.bp
index c996e1b..4828892 100644
--- a/libsync/Android.bp
+++ b/libsync/Android.bp
@@ -25,10 +25,17 @@
     recovery_available: true,
     native_bridge_supported: true,
     defaults: ["libsync_defaults"],
+    llndk_stubs: "libsync.llndk",
+    stubs: {
+        symbol_file: "libsync.map.txt",
+        versions: [
+            "26",
+        ],
+    },
 }
 
 llndk_library {
-    name: "libsync",
+    name: "libsync.llndk",
     symbol_file: "libsync.map.txt",
     export_include_dirs: ["include"],
 }
diff --git a/libsync/OWNERS b/libsync/OWNERS
index dc61733..e75b15b 100644
--- a/libsync/OWNERS
+++ b/libsync/OWNERS
@@ -1,3 +1,3 @@
-ghackmann@google.com
+chrisforbes@google.com
+hridya@google.com
 jessehall@google.com
-marissaw@google.com
diff --git a/libsync/include/ndk/sync.h b/libsync/include/ndk/sync.h
index 2a59e35..38ccb68 100644
--- a/libsync/include/ndk/sync.h
+++ b/libsync/include/ndk/sync.h
@@ -33,8 +33,6 @@
 
 __BEGIN_DECLS
 
-#if __ANDROID_API__ >= 26
-
 /* Fences indicate the status of an asynchronous task. They are initially
  * in unsignaled state (0), and make a one-time transition to either signaled
  * (1) or error (< 0) state. A sync file is a collection of one or more fences;
@@ -101,8 +99,6 @@
  */
 void sync_file_info_free(struct sync_file_info* info) __INTRODUCED_IN(26);
 
-#endif /* __ANDROID_API__ >= 26 */
-
 __END_DECLS
 
 #endif /* ANDROID_SYNC_H */
diff --git a/libsync/libsync.map.txt b/libsync/libsync.map.txt
index 91c3528..aac6b57 100644
--- a/libsync/libsync.map.txt
+++ b/libsync/libsync.map.txt
@@ -19,7 +19,7 @@
     sync_merge; # introduced=26
     sync_file_info; # introduced=26
     sync_file_info_free; # introduced=26
-    sync_wait; # llndk
+    sync_wait; # llndk apex
     sync_fence_info; # llndk
     sync_pt_info; # llndk
     sync_fence_info_free; # llndk
diff --git a/libsystem/Android.bp b/libsystem/Android.bp
index db61669..b37b8ec 100644
--- a/libsystem/Android.bp
+++ b/libsystem/Android.bp
@@ -1,7 +1,9 @@
 cc_library_headers {
     name: "libsystem_headers",
     vendor_available: true,
+    product_available: true,
     recovery_available: true,
+    vendor_ramdisk_available: true,
     host_supported: true,
     native_bridge_supported: true,
     apex_available: [
diff --git a/libsystem/OWNERS b/libsystem/OWNERS
index fdea804..4f800d4 100644
--- a/libsystem/OWNERS
+++ b/libsystem/OWNERS
@@ -1,7 +1,6 @@
 # graphics/composer
 adyabr@google.com
 lpy@google.com
-marissaw@google.com
 stoza@google.com
 vhau@google.com
 
diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp
index 9c1621b..3b6cfd8 100644
--- a/libsysutils/src/NetlinkEvent.cpp
+++ b/libsysutils/src/NetlinkEvent.cpp
@@ -185,7 +185,6 @@
     if (!checkRtNetlinkLength(nh, sizeof(*ifaddr)))
         return false;
 
-    // Sanity check.
     int type = nh->nlmsg_type;
     if (type != RTM_NEWADDR && type != RTM_DELADDR) {
         SLOGE("parseIfAddrMessage on incorrect message type 0x%x\n", type);
@@ -349,7 +348,6 @@
     uint8_t type = nh->nlmsg_type;
     const char *msgname = rtMessageName(type);
 
-    // Sanity check.
     if (type != RTM_NEWROUTE && type != RTM_DELROUTE) {
         SLOGE("%s: incorrect message type %d (%s)\n", __func__, type, msgname);
         return false;
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index fe2f3d6..e90afcd 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -201,50 +201,31 @@
         return 0;
     }
 
-    int ret = 0;
-    int e = 0; // SLOGW and sigaction are not inert regarding errno
     int current = 0;
 
-    struct sigaction new_action, old_action;
-    memset(&new_action, 0, sizeof(new_action));
-    new_action.sa_handler = SIG_IGN;
-    sigaction(SIGPIPE, &new_action, &old_action);
-
     for (;;) {
-        ssize_t rc = TEMP_FAILURE_RETRY(
-            writev(mSocket, iov + current, iovcnt - current));
-
-        if (rc > 0) {
-            size_t written = rc;
-            while ((current < iovcnt) && (written >= iov[current].iov_len)) {
-                written -= iov[current].iov_len;
-                current++;
-            }
-            if (current == iovcnt) {
-                break;
-            }
-            iov[current].iov_base = (char *)iov[current].iov_base + written;
-            iov[current].iov_len -= written;
-            continue;
-        }
+        ssize_t rc = TEMP_FAILURE_RETRY(writev(mSocket, iov + current, iovcnt - current));
 
         if (rc == 0) {
-            e = EIO;
+            errno = EIO;
             SLOGW("0 length write :(");
-        } else {
-            e = errno;
-            SLOGW("write error (%s)", strerror(e));
+            return -1;
+        } else if (rc < 0) {
+            SLOGW("write error (%s)", strerror(errno));
+            return -1;
         }
-        ret = -1;
-        break;
-    }
 
-    sigaction(SIGPIPE, &old_action, &new_action);
-
-    if (e != 0) {
-        errno = e;
+        size_t written = rc;
+        while (current < iovcnt && written >= iov[current].iov_len) {
+            written -= iov[current].iov_len;
+            current++;
+        }
+        if (current == iovcnt) {
+            return 0;
+        }
+        iov[current].iov_base = (char*)iov[current].iov_base + written;
+        iov[current].iov_len -= written;
     }
-    return ret;
 }
 
 void SocketClient::incRef() {
diff --git a/libunwindstack/.clang-format b/libunwindstack/.clang-format
deleted file mode 120000
index fd0645f..0000000
--- a/libunwindstack/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-2
\ No newline at end of file
diff --git a/libunwindstack/Android.bp b/libunwindstack/Android.bp
deleted file mode 100644
index 9b974c2..0000000
--- a/libunwindstack/Android.bp
+++ /dev/null
@@ -1,412 +0,0 @@
-//
-// Copyright (C) 2017 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.
-//
-
-cc_defaults {
-    name: "libunwindstack_flags",
-
-    host_supported: true,
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-    ],
-
-    target: {
-        darwin: {
-            enabled: false,
-        },
-        linux_bionic: {
-            enabled: true,
-        },
-    },
-}
-
-cc_defaults {
-    name: "libunwindstack_defaults",
-    defaults: ["libunwindstack_flags"],
-    export_include_dirs: ["include"],
-
-    srcs: [
-        "ArmExidx.cpp",
-        "DexFiles.cpp",
-        "DwarfCfa.cpp",
-        "DwarfEhFrameWithHdr.cpp",
-        "DwarfMemory.cpp",
-        "DwarfOp.cpp",
-        "DwarfSection.cpp",
-        "Elf.cpp",
-        "ElfInterface.cpp",
-        "ElfInterfaceArm.cpp",
-        "Global.cpp",
-        "JitDebug.cpp",
-        "Log.cpp",
-        "MapInfo.cpp",
-        "Maps.cpp",
-        "Memory.cpp",
-        "LocalUnwinder.cpp",
-        "Regs.cpp",
-        "RegsArm.cpp",
-        "RegsArm64.cpp",
-        "RegsX86.cpp",
-        "RegsX86_64.cpp",
-        "RegsMips.cpp",
-        "RegsMips64.cpp",
-        "Unwinder.cpp",
-        "Symbols.cpp",
-    ],
-
-    cflags: [
-        "-Wexit-time-destructors",
-    ],
-
-    target: {
-        // Always disable optimizations for host to make it easier to debug.
-        host: {
-            cflags: [
-                "-O0",
-                "-g",
-            ],
-        },
-    },
-
-    arch: {
-        x86: {
-            srcs: ["AsmGetRegsX86.S"],
-        },
-        x86_64: {
-            srcs: ["AsmGetRegsX86_64.S"],
-        },
-        mips: {
-            srcs: ["AsmGetRegsMips.S"],
-        },
-        mips64: {
-            srcs: ["AsmGetRegsMips64.S"],
-        },
-    },
-
-    static_libs: [
-        "libprocinfo",
-    ],
-
-    shared_libs: [
-        "libbase",
-        "liblog",
-        "liblzma",
-    ],
-}
-
-cc_library {
-    name: "libunwindstack",
-    vendor_available: true,
-    recovery_available: true,
-    // TODO(b/153609531): remove when no longer needed.
-    native_bridge_supported: true,
-    vndk: {
-        enabled: true,
-        support_system_process: true,
-    },
-    defaults: ["libunwindstack_defaults"],
-
-    srcs: ["DexFile.cpp"],
-    cflags: ["-DDEXFILE_SUPPORT"],
-    shared_libs: ["libdexfile_support"],
-
-    target: {
-        vendor: {
-            cflags: ["-UDEXFILE_SUPPORT"],
-            exclude_srcs: ["DexFile.cpp"],
-            exclude_shared_libs: ["libdexfile_support"],
-        },
-        recovery: {
-            cflags: ["-UDEXFILE_SUPPORT"],
-            exclude_srcs: ["DexFile.cpp"],
-            exclude_shared_libs: ["libdexfile_support"],
-        },
-        native_bridge: {
-            cflags: ["-UDEXFILE_SUPPORT"],
-            exclude_srcs: ["DexFile.cpp"],
-            exclude_shared_libs: ["libdexfile_support"],
-        },
-    },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.art.debug",
-        "com.android.art.release",
-    ],
-}
-
-// Static library without DEX support to avoid dependencies on the ART APEX.
-cc_library_static {
-    name: "libunwindstack_no_dex",
-    recovery_available: true,
-    defaults: ["libunwindstack_defaults"],
-
-    visibility: [
-        "//system/core/debuggerd",
-        "//system/core/init",
-        "//system/core/libbacktrace",
-    ],
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.runtime",
-    ],
-}
-
-//-------------------------------------------------------------------------
-// Unit Tests
-//-------------------------------------------------------------------------
-cc_test_library {
-    name: "libunwindstack_local",
-    defaults: ["libunwindstack_flags"],
-    srcs: ["tests/TestLocal.cpp"],
-
-    cflags: [
-        "-O0",
-        "-g",
-    ],
-
-    shared_libs: [
-        "libunwindstack",
-    ],
-    relative_install_path: "libunwindstack_test",
-}
-
-cc_defaults {
-    name: "libunwindstack_testlib_flags",
-    defaults: ["libunwindstack_flags"],
-
-    srcs: [
-        "tests/ArmExidxDecodeTest.cpp",
-        "tests/ArmExidxExtractTest.cpp",
-        "tests/DexFileTest.cpp",
-        "tests/DexFilesTest.cpp",
-        "tests/DwarfCfaLogTest.cpp",
-        "tests/DwarfCfaTest.cpp",
-        "tests/DwarfDebugFrameTest.cpp",
-        "tests/DwarfEhFrameTest.cpp",
-        "tests/DwarfEhFrameWithHdrTest.cpp",
-        "tests/DwarfMemoryTest.cpp",
-        "tests/DwarfOpLogTest.cpp",
-        "tests/DwarfOpTest.cpp",
-        "tests/DwarfSectionTest.cpp",
-        "tests/DwarfSectionImplTest.cpp",
-        "tests/ElfCacheTest.cpp",
-        "tests/ElfFake.cpp",
-        "tests/ElfInterfaceArmTest.cpp",
-        "tests/ElfInterfaceTest.cpp",
-        "tests/ElfTest.cpp",
-        "tests/ElfTestUtils.cpp",
-        "tests/IsolatedSettings.cpp",
-        "tests/JitDebugTest.cpp",
-        "tests/LocalUpdatableMapsTest.cpp",
-        "tests/LogFake.cpp",
-        "tests/MapInfoCreateMemoryTest.cpp",
-        "tests/MapInfoGetBuildIDTest.cpp",
-        "tests/MapInfoGetElfTest.cpp",
-        "tests/MapInfoGetLoadBiasTest.cpp",
-        "tests/MapInfoTest.cpp",
-        "tests/MapsTest.cpp",
-        "tests/MemoryBufferTest.cpp",
-        "tests/MemoryCacheTest.cpp",
-        "tests/MemoryFake.cpp",
-        "tests/MemoryFileTest.cpp",
-        "tests/MemoryLocalTest.cpp",
-        "tests/MemoryOfflineBufferTest.cpp",
-        "tests/MemoryOfflineTest.cpp",
-        "tests/MemoryRangeTest.cpp",
-        "tests/MemoryRangesTest.cpp",
-        "tests/MemoryRemoteTest.cpp",
-        "tests/MemoryTest.cpp",
-        "tests/RegsInfoTest.cpp",
-        "tests/RegsIterateTest.cpp",
-        "tests/RegsStepIfSignalHandlerTest.cpp",
-        "tests/RegsTest.cpp",
-        "tests/SymbolsTest.cpp",
-        "tests/TestUtils.cpp",
-        "tests/UnwindOfflineTest.cpp",
-        "tests/UnwindTest.cpp",
-        "tests/UnwinderTest.cpp",
-        "tests/VerifyBionicTerminationTest.cpp",
-    ],
-
-    cflags: [
-        "-O0",
-        "-g",
-    ],
-
-    shared_libs: [
-        "libbase",
-        "liblog",
-        "liblzma",
-        "libunwindstack",
-        "libdexfile_support",
-    ],
-
-    static_libs: [
-        "libgmock",
-    ],
-
-    test_suites: ["device-tests"],
-    data: [
-        "tests/files/elf32.xz",
-        "tests/files/elf64.xz",
-        "tests/files/offline/art_quick_osr_stub_arm/*",
-        "tests/files/offline/bad_eh_frame_hdr_arm64/*",
-        "tests/files/offline/debug_frame_first_x86/*",
-        "tests/files/offline/debug_frame_load_bias_arm/*",
-        "tests/files/offline/eh_frame_bias_x86/*",
-        "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
-        "tests/files/offline/empty_arm64/*",
-        "tests/files/offline/invalid_elf_offset_arm/*",
-        "tests/files/offline/jit_debug_arm/*",
-        "tests/files/offline/jit_debug_x86/*",
-        "tests/files/offline/jit_map_arm/*",
-        "tests/files/offline/gnu_debugdata_arm/*",
-        "tests/files/offline/load_bias_different_section_bias_arm64/*",
-        "tests/files/offline/load_bias_ro_rx_x86_64/*",
-        "tests/files/offline/offset_arm/*",
-        "tests/files/offline/shared_lib_in_apk_arm64/*",
-        "tests/files/offline/shared_lib_in_apk_memory_only_arm64/*",
-        "tests/files/offline/shared_lib_in_apk_single_map_arm64/*",
-        "tests/files/offline/signal_load_bias_arm/*",
-        "tests/files/offline/straddle_arm/*",
-        "tests/files/offline/straddle_arm64/*",
-    ],
-}
-
-cc_test {
-    name: "libunwindstack_test",
-    defaults: ["libunwindstack_testlib_flags"],
-    isolated: true,
-
-    srcs: [
-        "tests/LocalUnwinderTest.cpp",
-    ],
-    required: [
-        "libunwindstack_local",
-    ],
-}
-
-// Skip LocalUnwinderTest until atest understands required properly.
-cc_test {
-    name: "libunwindstack_unit_test",
-    defaults: ["libunwindstack_testlib_flags"],
-    isolated: true,
-}
-
-//-------------------------------------------------------------------------
-// Tools
-//-------------------------------------------------------------------------
-cc_defaults {
-    name: "libunwindstack_tools",
-    defaults: ["libunwindstack_flags"],
-
-    shared_libs: [
-        "libunwindstack",
-        "libbase",
-        "liblzma",
-    ],
-    target: {
-        // Always disable optimizations for host to make it easier to debug.
-        host: {
-            cflags: [
-                "-O0",
-                "-g",
-            ],
-        },
-    },
-}
-
-cc_binary {
-    name: "unwind",
-    defaults: ["libunwindstack_tools"],
-
-    srcs: [
-        "tools/unwind.cpp",
-    ],
-}
-
-cc_binary {
-    name: "unwind_info",
-    defaults: ["libunwindstack_tools"],
-
-    srcs: [
-        "tools/unwind_info.cpp",
-    ],
-}
-
-cc_binary {
-    name: "unwind_symbols",
-    defaults: ["libunwindstack_tools"],
-
-    srcs: [
-        "tools/unwind_symbols.cpp",
-    ],
-}
-
-cc_binary {
-    name: "unwind_for_offline",
-    defaults: ["libunwindstack_tools"],
-
-    srcs: [
-        "tools/unwind_for_offline.cpp",
-    ],
-}
-
-cc_binary {
-    name: "unwind_reg_info",
-    defaults: ["libunwindstack_tools"],
-
-    srcs: [
-        "tools/unwind_reg_info.cpp",
-    ],
-}
-
-//-------------------------------------------------------------------------
-// Benchmarks
-//-------------------------------------------------------------------------
-cc_benchmark {
-    name: "unwind_benchmarks",
-    host_supported: true,
-    defaults: ["libunwindstack_flags"],
-
-    // Disable optimizations so that all of the calls are not optimized away.
-    cflags: [
-        "-O0",
-    ],
-
-    srcs: [
-        "benchmarks/unwind_benchmarks.cpp",
-    ],
-
-    shared_libs: [
-        "libbase",
-        "libunwindstack",
-    ],
-}
-
-// Generates the elf data for use in the tests for .gnu_debugdata frames.
-// Once these files are generated, use the xz command to compress the data.
-cc_binary_host {
-    name: "gen_gnudebugdata",
-    defaults: ["libunwindstack_flags"],
-
-    srcs: [
-        "tests/GenGnuDebugdata.cpp",
-    ],
-}
diff --git a/libunwindstack/AndroidVersions.md b/libunwindstack/AndroidVersions.md
deleted file mode 100644
index 234f639..0000000
--- a/libunwindstack/AndroidVersions.md
+++ /dev/null
@@ -1,116 +0,0 @@
-# Unwinder Support Per Android Release
-This document describes the changes in the way the libunwindstack
-unwinder works on different Android versions. It does not describe
-every change in the code made between different versions, but is
-meant to allow an app developer to know what might be supported
-on different versions. It also describes the different way an unwind
-will display on different versions of Android.
-
-## Android P
-libunwindstack was first introduced in Android P.
-
-* Supports up to and including Dwarf 4 unwinding information.
-  See http://dwarfstd.org/ for Dwarf standards.
-* Supports Arm exidx unwinding.
-* Supports the gdb JIT unwinding interface, which is how ART creates unwinding
-  information for the JIT'd Java frames.
-* Supports special frames added to represent an ART Java interpreter frame.
-  ART has marked the dex pc using cfi information that the unwinder
-  understands and handles by adding a new frame in the stacktrace.
-
-## Note
-By default, lld creates two separate maps of the elf in memory, one read-only
-and one read/executable. The libunwindstack on P and the unwinder on older
-versions of Android will not unwind properly in this case. For apps that
-target Android P or older, make sure that `-Wl,--no-rosegment` is
-included in linker arguments when using lld.
-
-## Android Q
-* Fix bug (b/109824792) that handled load bias data incorrectly when
-  FDEs use pc relative addressing in the eh\_frame\_hdr.
-  Unfortunately, this wasn't fixed correctly in Q since it assumes
-  that the bias is coming from the program header for the executable
-  load. The real fix was to use the bias from the actual section data and
-  is not completely fixed until Android R. For apps targeting Android Q,
-  if it is being compiled with the llvm linker lld, it might be necessary
-  to add the linker option `-Wl,-zseparate-code` to avoid creating an elf
-  created this way.
-* Change the way the exidx section offset is found (b/110704153). Before
-  the p\_vaddr value from the program header minus the load bias was used
-  to find the start of the exidx data. Changed to use the p\_offset since
-  it doesn't require any load bias manipulations.
-* Fix bug handling of dwarf sections without any header (b/110235461).
-  Previously, the code assumed that FDEs are non-overlapping, and the FDEs
-  are always in sorted order from low pc to high pc. Thus the code would
-  read the entire set of CIEs/FDEs and then do a binary search to find
-  the appropriate FDE for a given pc. Now the code does a sequential read
-  and stops when it finds the FDE for a pc. It also understands the
-  overlapping FDEs, so find the first FDE that matches a pc. In practice,
-  elf files with this format only ever occurs if the file was generated
-  without an eh\_frame/eh\_frame\_hdr section and only a debug\_frame. The
-  other way this has been observed is when running simpleperf to unwind since
-  sometimes there is not enough information in the eh\_frame for all points
-  in the executable. On Android P, this would result in some incorrect
-  unwinds coming from simpleperf. Nearly all crashes from Android P should
-  be correct since the eh\_frame information was enough to do the unwind
-  properly.
-* Be permissive of badly formed elf files. Previously, any detected error
-  would result in unwinds stopping even if there is enough valid information
-  to do an unwind.
-  * The code now allows program header/section header offsets to point
-    to unreadable memory. As long as the code can find the unwind tables,
-    that is good enough.
-  * The code allows program headers/section headers to be missing.
-  * Allow a symbol table section header to point to invalid symbol table
-    values.
-* Support for the linker read-only segment option (b/109657296).
-  This is a feature of lld whereby there are two sections that
-  contain elf data. The first is read-only and contains the elf header data,
-  and the second is read-execute or execute only that
-  contains the executable code from the elf. Before this, the unwinder
-  always assumed that there was only a single read-execute section that
-  contained the elf header data and the executable code.
-* Build ID information for elf objects added. This will display the
-  NT\_GNU\_BUILD\_ID note found in elf files. This information can be used
-  to identify the exact version of a shared library to help get symbol
-  information when looking at a crash.
-* Add support for displaying the soname from an apk frame. Previously,
-  a frame map name would be only the apk, but now if the shared library
-  in the apk has set a soname, the map name will be `app.apk!libexample.so`
-  instead of only `app.apk`.
-* Minimal support for Dwarf 5. This merely treats a Dwarf 5 version
-  elf file as Dwarf 4. It does not support the new dwarf ops in Dwarf 5.
-  Since the new ops are not likely to be used very often, this allows
-  continuing to unwind even when encountering Dwarf 5 elf files.
-* Fix bug in pc handling of signal frames (b/130302288). In the previous
-  version, the pc would be wrong in the signal frame. The rest of the
-  unwind was correct, only the frame in the signal handler was incorrect
-  in Android P.
-* Detect when an elf file is not readable so that a message can be
-  displayed indicating that. This can happen when an app puts the shared
-  libraries in non-standard locations that are not readable due to
-  security restrictions (selinux rules).
-
-## Android R
-* Display the offsets for Java interpreter frames. If this frame came
-  from a non-zero offset map, no offset is printed. Previously, the
-  line would look like:
-
-    #17 pc 00500d7a  GoogleCamera.apk (com.google.camera.AndroidPriorityThread.run+10)
-
-  to:
-
-    #17 pc 00500d7a  GoogleCamera.apk (offset 0x11d0000) (com.google.camera.AndroidPriorityThread.run+10)
-* Fix bug where the load bias was set from the first PT\_LOAD program
-  header that has a zero p\_offset value. Now it is set from the first
-  executable PT\_LOAD program header. This has only ever been a problem
-  for host executables compiled for the x86\_64 architecture.
-* Switched to the libc++ demangler for function names. Previously, the
-  demangler used was not complete, so some less common demangled function
-  names would not be properly demangled or the function name would not be
-  demangled at all.
-* Fix bug in load bias handling. If the unwind information in the eh\_frame
-  or eh\_frame\_hdr does not have the same bias as the executable section,
-  and uses pc relative FDEs, the unwind will be incorrect. This tends
-  to truncate unwinds since the unwinder could not find the correct unwind
-  information for a given pc.
diff --git a/libunwindstack/ArmExidx.cpp b/libunwindstack/ArmExidx.cpp
deleted file mode 100644
index 818f5d1..0000000
--- a/libunwindstack/ArmExidx.cpp
+++ /dev/null
@@ -1,862 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <deque>
-#include <string>
-
-#include <android-base/stringprintf.h>
-
-#include <unwindstack/Log.h>
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsArm.h>
-
-#include "ArmExidx.h"
-#include "Check.h"
-
-namespace unwindstack {
-
-static constexpr uint8_t LOG_CFA_REG = 64;
-
-void ArmExidx::LogRawData() {
-  std::string log_str("Raw Data:");
-  for (const uint8_t data : data_) {
-    log_str += android::base::StringPrintf(" 0x%02x", data);
-  }
-  log(log_indent_, log_str.c_str());
-}
-
-bool ArmExidx::ExtractEntryData(uint32_t entry_offset) {
-  data_.clear();
-  status_ = ARM_STATUS_NONE;
-
-  if (entry_offset & 1) {
-    // The offset needs to be at least two byte aligned.
-    status_ = ARM_STATUS_INVALID_ALIGNMENT;
-    return false;
-  }
-
-  // Each entry is a 32 bit prel31 offset followed by 32 bits
-  // of unwind information. If bit 31 of the unwind data is zero,
-  // then this is a prel31 offset to the start of the unwind data.
-  // If the unwind data is 1, then this is a cant unwind entry.
-  // Otherwise, this data is the compact form of the unwind information.
-  uint32_t data;
-  if (!elf_memory_->Read32(entry_offset + 4, &data)) {
-    status_ = ARM_STATUS_READ_FAILED;
-    status_address_ = entry_offset + 4;
-    return false;
-  }
-  if (data == 1) {
-    // This is a CANT UNWIND entry.
-    status_ = ARM_STATUS_NO_UNWIND;
-    if (log_type_ != ARM_LOG_NONE) {
-      if (log_type_ == ARM_LOG_FULL) {
-        log(log_indent_, "Raw Data: 0x00 0x00 0x00 0x01");
-      }
-      log(log_indent_, "[cantunwind]");
-    }
-    return false;
-  }
-
-  if (data & (1UL << 31)) {
-    // This is a compact table entry.
-    if ((data >> 24) & 0xf) {
-      // This is a non-zero index, this code doesn't support
-      // other formats.
-      status_ = ARM_STATUS_INVALID_PERSONALITY;
-      return false;
-    }
-    data_.push_back((data >> 16) & 0xff);
-    data_.push_back((data >> 8) & 0xff);
-    uint8_t last_op = data & 0xff;
-    data_.push_back(last_op);
-    if (last_op != ARM_OP_FINISH) {
-      // If this didn't end with a finish op, add one.
-      data_.push_back(ARM_OP_FINISH);
-    }
-    if (log_type_ == ARM_LOG_FULL) {
-      LogRawData();
-    }
-    return true;
-  }
-
-  // Get the address of the ops.
-  // Sign extend the data value if necessary.
-  int32_t signed_data = static_cast<int32_t>(data << 1) >> 1;
-  uint32_t addr = (entry_offset + 4) + signed_data;
-  if (!elf_memory_->Read32(addr, &data)) {
-    status_ = ARM_STATUS_READ_FAILED;
-    status_address_ = addr;
-    return false;
-  }
-
-  size_t num_table_words;
-  if (data & (1UL << 31)) {
-    // Compact model.
-    switch ((data >> 24) & 0xf) {
-    case 0:
-      num_table_words = 0;
-      data_.push_back((data >> 16) & 0xff);
-      break;
-    case 1:
-    case 2:
-      num_table_words = (data >> 16) & 0xff;
-      addr += 4;
-      break;
-    default:
-      // Only a personality of 0, 1, 2 is valid.
-      status_ = ARM_STATUS_INVALID_PERSONALITY;
-      return false;
-    }
-    data_.push_back((data >> 8) & 0xff);
-    data_.push_back(data & 0xff);
-  } else {
-    // Generic model.
-
-    // Skip the personality routine data, it doesn't contain any data
-    // needed to decode the unwind information.
-    addr += 4;
-    if (!elf_memory_->Read32(addr, &data)) {
-      status_ = ARM_STATUS_READ_FAILED;
-      status_address_ = addr;
-      return false;
-    }
-    num_table_words = (data >> 24) & 0xff;
-    data_.push_back((data >> 16) & 0xff);
-    data_.push_back((data >> 8) & 0xff);
-    data_.push_back(data & 0xff);
-    addr += 4;
-  }
-
-  if (num_table_words > 5) {
-    status_ = ARM_STATUS_MALFORMED;
-    return false;
-  }
-
-  for (size_t i = 0; i < num_table_words; i++) {
-    if (!elf_memory_->Read32(addr, &data)) {
-      status_ = ARM_STATUS_READ_FAILED;
-      status_address_ = addr;
-      return false;
-    }
-    data_.push_back((data >> 24) & 0xff);
-    data_.push_back((data >> 16) & 0xff);
-    data_.push_back((data >> 8) & 0xff);
-    data_.push_back(data & 0xff);
-    addr += 4;
-  }
-
-  if (data_.back() != ARM_OP_FINISH) {
-    // If this didn't end with a finish op, add one.
-    data_.push_back(ARM_OP_FINISH);
-  }
-
-  if (log_type_ == ARM_LOG_FULL) {
-    LogRawData();
-  }
-  return true;
-}
-
-inline bool ArmExidx::GetByte(uint8_t* byte) {
-  if (data_.empty()) {
-    status_ = ARM_STATUS_TRUNCATED;
-    return false;
-  }
-  *byte = data_.front();
-  data_.pop_front();
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10_00(uint8_t byte) {
-  CHECK((byte >> 4) == 0x8);
-
-  uint16_t registers = (byte & 0xf) << 8;
-  if (!GetByte(&byte)) {
-    return false;
-  }
-
-  registers |= byte;
-  if (registers == 0) {
-    // 10000000 00000000: Refuse to unwind
-    if (log_type_ != ARM_LOG_NONE) {
-      log(log_indent_, "Refuse to unwind");
-    }
-    status_ = ARM_STATUS_NO_UNWIND;
-    return false;
-  }
-  // 1000iiii iiiiiiii: Pop up to 12 integer registers under masks {r15-r12}, {r11-r4}
-  registers <<= 4;
-
-  if (log_type_ != ARM_LOG_NONE) {
-    if (log_type_ == ARM_LOG_FULL) {
-      bool add_comma = false;
-      std::string msg = "pop {";
-      for (size_t reg = 4; reg < 16; reg++) {
-        if (registers & (1 << reg)) {
-          if (add_comma) {
-            msg += ", ";
-          }
-          msg += android::base::StringPrintf("r%zu", reg);
-          add_comma = true;
-        }
-      }
-      log(log_indent_, "%s}", msg.c_str());
-    } else {
-      uint32_t cfa_offset = __builtin_popcount(registers) * 4;
-      log_cfa_offset_ += cfa_offset;
-      for (size_t reg = 4; reg < 16; reg++) {
-        if (registers & (1 << reg)) {
-          log_regs_[reg] = cfa_offset;
-          cfa_offset -= 4;
-        }
-      }
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-
-  for (size_t reg = 4; reg < 16; reg++) {
-    if (registers & (1 << reg)) {
-      if (!process_memory_->Read32(cfa_, &(*regs_)[reg])) {
-        status_ = ARM_STATUS_READ_FAILED;
-        status_address_ = cfa_;
-        return false;
-      }
-      cfa_ += 4;
-    }
-  }
-
-  // If the sp register is modified, change the cfa value.
-  if (registers & (1 << ARM_REG_SP)) {
-    cfa_ = (*regs_)[ARM_REG_SP];
-  }
-
-  // Indicate if the pc register was set.
-  if (registers & (1 << ARM_REG_PC)) {
-    pc_set_ = true;
-  }
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10_01(uint8_t byte) {
-  CHECK((byte >> 4) == 0x9);
-
-  uint8_t bits = byte & 0xf;
-  if (bits == 13 || bits == 15) {
-    // 10011101: Reserved as prefix for ARM register to register moves
-    // 10011111: Reserved as prefix for Intel Wireless MMX register to register moves
-    if (log_type_ != ARM_LOG_NONE) {
-      log(log_indent_, "[Reserved]");
-    }
-    status_ = ARM_STATUS_RESERVED;
-    return false;
-  }
-  // 1001nnnn: Set vsp = r[nnnn] (nnnn != 13, 15)
-  if (log_type_ != ARM_LOG_NONE) {
-    if (log_type_ == ARM_LOG_FULL) {
-      log(log_indent_, "vsp = r%d", bits);
-    } else {
-      log_regs_[LOG_CFA_REG] = bits;
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-  // It is impossible for bits to be larger than the total number of
-  // arm registers, so don't bother checking if bits is a valid register.
-  cfa_ = (*regs_)[bits];
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10_10(uint8_t byte) {
-  CHECK((byte >> 4) == 0xa);
-
-  // 10100nnn: Pop r4-r[4+nnn]
-  // 10101nnn: Pop r4-r[4+nnn], r14
-  if (log_type_ != ARM_LOG_NONE) {
-    uint8_t end_reg = byte & 0x7;
-    if (log_type_ == ARM_LOG_FULL) {
-      std::string msg = "pop {r4";
-      if (end_reg) {
-        msg += android::base::StringPrintf("-r%d", 4 + end_reg);
-      }
-      if (byte & 0x8) {
-        log(log_indent_, "%s, r14}", msg.c_str());
-      } else {
-        log(log_indent_, "%s}", msg.c_str());
-      }
-    } else {
-      end_reg += 4;
-      uint32_t cfa_offset = (end_reg - 3) * 4;
-      if (byte & 0x8) {
-        cfa_offset += 4;
-      }
-      log_cfa_offset_ += cfa_offset;
-
-      for (uint8_t reg = 4; reg <= end_reg; reg++) {
-        log_regs_[reg] = cfa_offset;
-        cfa_offset -= 4;
-      }
-
-      if (byte & 0x8) {
-        log_regs_[14] = cfa_offset;
-      }
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-
-  for (size_t i = 4; i <= 4 + (byte & 0x7); i++) {
-    if (!process_memory_->Read32(cfa_, &(*regs_)[i])) {
-      status_ = ARM_STATUS_READ_FAILED;
-      status_address_ = cfa_;
-      return false;
-    }
-    cfa_ += 4;
-  }
-  if (byte & 0x8) {
-    if (!process_memory_->Read32(cfa_, &(*regs_)[ARM_REG_R14])) {
-      status_ = ARM_STATUS_READ_FAILED;
-      status_address_ = cfa_;
-      return false;
-    }
-    cfa_ += 4;
-  }
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10_11_0000() {
-  // 10110000: Finish
-  if (log_type_ != ARM_LOG_NONE) {
-    if (log_type_ == ARM_LOG_FULL) {
-      log(log_indent_, "finish");
-    }
-
-    if (log_skip_execution_) {
-      status_ = ARM_STATUS_FINISH;
-      return false;
-    }
-  }
-  status_ = ARM_STATUS_FINISH;
-  return false;
-}
-
-inline bool ArmExidx::DecodePrefix_10_11_0001() {
-  uint8_t byte;
-  if (!GetByte(&byte)) {
-    return false;
-  }
-
-  if (byte == 0) {
-    // 10110001 00000000: Spare
-    if (log_type_ != ARM_LOG_NONE) {
-      log(log_indent_, "Spare");
-    }
-    status_ = ARM_STATUS_SPARE;
-    return false;
-  }
-  if (byte >> 4) {
-    // 10110001 xxxxyyyy: Spare (xxxx != 0000)
-    if (log_type_ != ARM_LOG_NONE) {
-      log(log_indent_, "Spare");
-    }
-    status_ = ARM_STATUS_SPARE;
-    return false;
-  }
-
-  // 10110001 0000iiii: Pop integer registers under mask {r3, r2, r1, r0}
-  if (log_type_ != ARM_LOG_NONE) {
-    if (log_type_ == ARM_LOG_FULL) {
-      bool add_comma = false;
-      std::string msg = "pop {";
-      for (size_t i = 0; i < 4; i++) {
-        if (byte & (1 << i)) {
-          if (add_comma) {
-            msg += ", ";
-          }
-          msg += android::base::StringPrintf("r%zu", i);
-          add_comma = true;
-        }
-      }
-      log(log_indent_, "%s}", msg.c_str());
-    } else {
-      byte &= 0xf;
-      uint32_t cfa_offset = __builtin_popcount(byte) * 4;
-      log_cfa_offset_ += cfa_offset;
-      for (size_t reg = 0; reg < 4; reg++) {
-        if (byte & (1 << reg)) {
-          log_regs_[reg] = cfa_offset;
-          cfa_offset -= 4;
-        }
-      }
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-
-  for (size_t reg = 0; reg < 4; reg++) {
-    if (byte & (1 << reg)) {
-      if (!process_memory_->Read32(cfa_, &(*regs_)[reg])) {
-        status_ = ARM_STATUS_READ_FAILED;
-        status_address_ = cfa_;
-        return false;
-      }
-      cfa_ += 4;
-    }
-  }
-  return true;
-}
-
-inline void ArmExidx::AdjustRegisters(int32_t offset) {
-  for (auto& entry : log_regs_) {
-    if (entry.first >= LOG_CFA_REG) {
-      break;
-    }
-    entry.second += offset;
-  }
-}
-
-inline bool ArmExidx::DecodePrefix_10_11_0010() {
-  // 10110010 uleb128: vsp = vsp + 0x204 + (uleb128 << 2)
-  uint32_t result = 0;
-  uint32_t shift = 0;
-  uint8_t byte;
-  do {
-    if (!GetByte(&byte)) {
-      return false;
-    }
-
-    result |= (byte & 0x7f) << shift;
-    shift += 7;
-  } while (byte & 0x80);
-  result <<= 2;
-  if (log_type_ != ARM_LOG_NONE) {
-    int32_t cfa_offset = 0x204 + result;
-    if (log_type_ == ARM_LOG_FULL) {
-      log(log_indent_, "vsp = vsp + %d", cfa_offset);
-    } else {
-      log_cfa_offset_ += cfa_offset;
-    }
-    AdjustRegisters(cfa_offset);
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-  cfa_ += 0x204 + result;
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10_11_0011() {
-  // 10110011 sssscccc: Pop VFP double precision registers D[ssss]-D[ssss+cccc] by FSTMFDX
-  uint8_t byte;
-  if (!GetByte(&byte)) {
-    return false;
-  }
-
-  if (log_type_ != ARM_LOG_NONE) {
-    uint8_t start_reg = byte >> 4;
-    uint8_t end_reg = start_reg + (byte & 0xf);
-
-    if (log_type_ == ARM_LOG_FULL) {
-      std::string msg = android::base::StringPrintf("pop {d%d", start_reg);
-      if (end_reg) {
-        msg += android::base::StringPrintf("-d%d", end_reg);
-      }
-      log(log_indent_, "%s}", msg.c_str());
-    } else {
-      log(log_indent_, "Unsupported DX register display");
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-  cfa_ += (byte & 0xf) * 8 + 12;
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10_11_01nn() {
-  // 101101nn: Spare
-  if (log_type_ != ARM_LOG_NONE) {
-    log(log_indent_, "Spare");
-  }
-  status_ = ARM_STATUS_SPARE;
-  return false;
-}
-
-inline bool ArmExidx::DecodePrefix_10_11_1nnn(uint8_t byte) {
-  CHECK((byte & ~0x07) == 0xb8);
-
-  // 10111nnn: Pop VFP double-precision registers D[8]-D[8+nnn] by FSTMFDX
-  if (log_type_ != ARM_LOG_NONE) {
-    if (log_type_ == ARM_LOG_FULL) {
-      uint8_t last_reg = (byte & 0x7);
-      std::string msg = "pop {d8";
-      if (last_reg) {
-        msg += android::base::StringPrintf("-d%d", last_reg + 8);
-      }
-      log(log_indent_, "%s}", msg.c_str());
-    } else {
-      log(log_indent_, "Unsupported DX register display");
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-  // Only update the cfa.
-  cfa_ += (byte & 0x7) * 8 + 12;
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_10(uint8_t byte) {
-  CHECK((byte >> 6) == 0x2);
-
-  switch ((byte >> 4) & 0x3) {
-  case 0:
-    return DecodePrefix_10_00(byte);
-  case 1:
-    return DecodePrefix_10_01(byte);
-  case 2:
-    return DecodePrefix_10_10(byte);
-  default:
-    switch (byte & 0xf) {
-    case 0:
-      return DecodePrefix_10_11_0000();
-    case 1:
-      return DecodePrefix_10_11_0001();
-    case 2:
-      return DecodePrefix_10_11_0010();
-    case 3:
-      return DecodePrefix_10_11_0011();
-    default:
-      if (byte & 0x8) {
-        return DecodePrefix_10_11_1nnn(byte);
-      } else {
-        return DecodePrefix_10_11_01nn();
-      }
-    }
-  }
-}
-
-inline bool ArmExidx::DecodePrefix_11_000(uint8_t byte) {
-  CHECK((byte & ~0x07) == 0xc0);
-
-  uint8_t bits = byte & 0x7;
-  if (bits == 6) {
-    if (!GetByte(&byte)) {
-      return false;
-    }
-
-    // 11000110 sssscccc: Intel Wireless MMX pop wR[ssss]-wR[ssss+cccc]
-    if (log_type_ != ARM_LOG_NONE) {
-      if (log_type_ == ARM_LOG_FULL) {
-        uint8_t start_reg = byte >> 4;
-        std::string msg = android::base::StringPrintf("pop {wR%d", start_reg);
-        uint8_t end_reg = byte & 0xf;
-        if (end_reg) {
-          msg += android::base::StringPrintf("-wR%d", start_reg + end_reg);
-        }
-        log(log_indent_, "%s}", msg.c_str());
-      } else {
-        log(log_indent_, "Unsupported wRX register display");
-      }
-
-      if (log_skip_execution_) {
-        return true;
-      }
-    }
-    // Only update the cfa.
-    cfa_ += (byte & 0xf) * 8 + 8;
-  } else if (bits == 7) {
-    if (!GetByte(&byte)) {
-      return false;
-    }
-
-    if (byte == 0) {
-      // 11000111 00000000: Spare
-      if (log_type_ != ARM_LOG_NONE) {
-        log(log_indent_, "Spare");
-      }
-      status_ = ARM_STATUS_SPARE;
-      return false;
-    } else if ((byte >> 4) == 0) {
-      // 11000111 0000iiii: Intel Wireless MMX pop wCGR registers {wCGR0,1,2,3}
-      if (log_type_ != ARM_LOG_NONE) {
-        if (log_type_ == ARM_LOG_FULL) {
-          bool add_comma = false;
-          std::string msg = "pop {";
-          for (size_t i = 0; i < 4; i++) {
-            if (byte & (1 << i)) {
-              if (add_comma) {
-                msg += ", ";
-              }
-              msg += android::base::StringPrintf("wCGR%zu", i);
-              add_comma = true;
-            }
-          }
-          log(log_indent_, "%s}", msg.c_str());
-        } else {
-          log(log_indent_, "Unsupported wCGR register display");
-        }
-
-        if (log_skip_execution_) {
-          return true;
-        }
-      }
-      // Only update the cfa.
-      cfa_ += __builtin_popcount(byte) * 4;
-    } else {
-      // 11000111 xxxxyyyy: Spare (xxxx != 0000)
-      if (log_type_ != ARM_LOG_NONE) {
-        log(log_indent_, "Spare");
-      }
-      status_ = ARM_STATUS_SPARE;
-      return false;
-    }
-  } else {
-    // 11000nnn: Intel Wireless MMX pop wR[10]-wR[10+nnn] (nnn != 6, 7)
-    if (log_type_ != ARM_LOG_NONE) {
-      if (log_type_ == ARM_LOG_FULL) {
-        std::string msg = "pop {wR10";
-        uint8_t nnn = byte & 0x7;
-        if (nnn) {
-          msg += android::base::StringPrintf("-wR%d", 10 + nnn);
-        }
-        log(log_indent_, "%s}", msg.c_str());
-      } else {
-        log(log_indent_, "Unsupported wRX register display");
-      }
-
-      if (log_skip_execution_) {
-        return true;
-      }
-    }
-    // Only update the cfa.
-    cfa_ += (byte & 0x7) * 8 + 8;
-  }
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_11_001(uint8_t byte) {
-  CHECK((byte & ~0x07) == 0xc8);
-
-  uint8_t bits = byte & 0x7;
-  if (bits == 0) {
-    // 11001000 sssscccc: Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] by VPUSH
-    if (!GetByte(&byte)) {
-      return false;
-    }
-
-    if (log_type_ != ARM_LOG_NONE) {
-      if (log_type_ == ARM_LOG_FULL) {
-        uint8_t start_reg = byte >> 4;
-        std::string msg = android::base::StringPrintf("pop {d%d", 16 + start_reg);
-        uint8_t end_reg = byte & 0xf;
-        if (end_reg) {
-          msg += android::base::StringPrintf("-d%d", 16 + start_reg + end_reg);
-        }
-        log(log_indent_, "%s}", msg.c_str());
-      } else {
-        log(log_indent_, "Unsupported DX register display");
-      }
-
-      if (log_skip_execution_) {
-        return true;
-      }
-    }
-    // Only update the cfa.
-    cfa_ += (byte & 0xf) * 8 + 8;
-  } else if (bits == 1) {
-    // 11001001 sssscccc: Pop VFP double precision registers D[ssss]-D[ssss+cccc] by VPUSH
-    if (!GetByte(&byte)) {
-      return false;
-    }
-
-    if (log_type_ != ARM_LOG_NONE) {
-      if (log_type_ == ARM_LOG_FULL) {
-        uint8_t start_reg = byte >> 4;
-        std::string msg = android::base::StringPrintf("pop {d%d", start_reg);
-        uint8_t end_reg = byte & 0xf;
-        if (end_reg) {
-          msg += android::base::StringPrintf("-d%d", start_reg + end_reg);
-        }
-        log(log_indent_, "%s}", msg.c_str());
-      } else {
-        log(log_indent_, "Unsupported DX register display");
-      }
-
-      if (log_skip_execution_) {
-        return true;
-      }
-    }
-    // Only update the cfa.
-    cfa_ += (byte & 0xf) * 8 + 8;
-  } else {
-    // 11001yyy: Spare (yyy != 000, 001)
-    if (log_type_ != ARM_LOG_NONE) {
-      log(log_indent_, "Spare");
-    }
-    status_ = ARM_STATUS_SPARE;
-    return false;
-  }
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_11_010(uint8_t byte) {
-  CHECK((byte & ~0x07) == 0xd0);
-
-  // 11010nnn: Pop VFP double precision registers D[8]-D[8+nnn] by VPUSH
-  if (log_type_ != ARM_LOG_NONE) {
-    if (log_type_ == ARM_LOG_FULL) {
-      std::string msg = "pop {d8";
-      uint8_t end_reg = byte & 0x7;
-      if (end_reg) {
-        msg += android::base::StringPrintf("-d%d", 8 + end_reg);
-      }
-      log(log_indent_, "%s}", msg.c_str());
-    } else {
-      log(log_indent_, "Unsupported DX register display");
-    }
-
-    if (log_skip_execution_) {
-      return true;
-    }
-  }
-  cfa_ += (byte & 0x7) * 8 + 8;
-  return true;
-}
-
-inline bool ArmExidx::DecodePrefix_11(uint8_t byte) {
-  CHECK((byte >> 6) == 0x3);
-
-  switch ((byte >> 3) & 0x7) {
-  case 0:
-    return DecodePrefix_11_000(byte);
-  case 1:
-    return DecodePrefix_11_001(byte);
-  case 2:
-    return DecodePrefix_11_010(byte);
-  default:
-    // 11xxxyyy: Spare (xxx != 000, 001, 010)
-    if (log_type_ != ARM_LOG_NONE) {
-      log(log_indent_, "Spare");
-    }
-    status_ = ARM_STATUS_SPARE;
-    return false;
-  }
-}
-
-bool ArmExidx::Decode() {
-  status_ = ARM_STATUS_NONE;
-  uint8_t byte;
-  if (!GetByte(&byte)) {
-    return false;
-  }
-
-  switch (byte >> 6) {
-  case 0:
-    // 00xxxxxx: vsp = vsp + (xxxxxxx << 2) + 4
-    if (log_type_ != ARM_LOG_NONE) {
-      int32_t cfa_offset = ((byte & 0x3f) << 2) + 4;
-      if (log_type_ == ARM_LOG_FULL) {
-        log(log_indent_, "vsp = vsp + %d", cfa_offset);
-      } else {
-        log_cfa_offset_ += cfa_offset;
-      }
-      AdjustRegisters(cfa_offset);
-
-      if (log_skip_execution_) {
-        break;
-      }
-    }
-    cfa_ += ((byte & 0x3f) << 2) + 4;
-    break;
-  case 1:
-    // 01xxxxxx: vsp = vsp - (xxxxxxx << 2) + 4
-    if (log_type_ != ARM_LOG_NONE) {
-      uint32_t cfa_offset = ((byte & 0x3f) << 2) + 4;
-      if (log_type_ == ARM_LOG_FULL) {
-        log(log_indent_, "vsp = vsp - %d", cfa_offset);
-      } else {
-        log_cfa_offset_ -= cfa_offset;
-      }
-      AdjustRegisters(-cfa_offset);
-
-      if (log_skip_execution_) {
-        break;
-      }
-    }
-    cfa_ -= ((byte & 0x3f) << 2) + 4;
-    break;
-  case 2:
-    return DecodePrefix_10(byte);
-  default:
-    return DecodePrefix_11(byte);
-  }
-  return true;
-}
-
-bool ArmExidx::Eval() {
-  pc_set_ = false;
-  while (Decode());
-  return status_ == ARM_STATUS_FINISH;
-}
-
-void ArmExidx::LogByReg() {
-  if (log_type_ != ARM_LOG_BY_REG) {
-    return;
-  }
-
-  uint8_t cfa_reg;
-  if (log_regs_.count(LOG_CFA_REG) == 0) {
-    cfa_reg = 13;
-  } else {
-    cfa_reg = log_regs_[LOG_CFA_REG];
-  }
-
-  if (log_cfa_offset_ != 0) {
-    char sign = (log_cfa_offset_ > 0) ? '+' : '-';
-    log(log_indent_, "cfa = r%zu %c %d", cfa_reg, sign, abs(log_cfa_offset_));
-  } else {
-    log(log_indent_, "cfa = r%zu", cfa_reg);
-  }
-
-  for (const auto& entry : log_regs_) {
-    if (entry.first >= LOG_CFA_REG) {
-      break;
-    }
-    if (entry.second == 0) {
-      log(log_indent_, "r%zu = [cfa]", entry.first);
-    } else {
-      char sign = (entry.second > 0) ? '-' : '+';
-      log(log_indent_, "r%zu = [cfa %c %d]", entry.first, sign, abs(entry.second));
-    }
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/ArmExidx.h b/libunwindstack/ArmExidx.h
deleted file mode 100644
index d9fc371..0000000
--- a/libunwindstack/ArmExidx.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_ARM_EXIDX_H
-#define _LIBUNWINDSTACK_ARM_EXIDX_H
-
-#include <stdint.h>
-
-#include <deque>
-#include <map>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-class RegsArm;
-
-enum ArmStatus : size_t {
-  ARM_STATUS_NONE = 0,
-  ARM_STATUS_NO_UNWIND,
-  ARM_STATUS_FINISH,
-  ARM_STATUS_RESERVED,
-  ARM_STATUS_SPARE,
-  ARM_STATUS_TRUNCATED,
-  ARM_STATUS_READ_FAILED,
-  ARM_STATUS_MALFORMED,
-  ARM_STATUS_INVALID_ALIGNMENT,
-  ARM_STATUS_INVALID_PERSONALITY,
-};
-
-enum ArmOp : uint8_t {
-  ARM_OP_FINISH = 0xb0,
-};
-
-enum ArmLogType : uint8_t {
-  ARM_LOG_NONE,
-  ARM_LOG_FULL,
-  ARM_LOG_BY_REG,
-};
-
-class ArmExidx {
- public:
-  ArmExidx(RegsArm* regs, Memory* elf_memory, Memory* process_memory)
-      : regs_(regs), elf_memory_(elf_memory), process_memory_(process_memory) {}
-  virtual ~ArmExidx() {}
-
-  void LogRawData();
-
-  void LogByReg();
-
-  bool ExtractEntryData(uint32_t entry_offset);
-
-  bool Eval();
-
-  bool Decode();
-
-  std::deque<uint8_t>* data() { return &data_; }
-
-  ArmStatus status() { return status_; }
-  uint64_t status_address() { return status_address_; }
-
-  RegsArm* regs() { return regs_; }
-
-  uint32_t cfa() { return cfa_; }
-  void set_cfa(uint32_t cfa) { cfa_ = cfa; }
-
-  bool pc_set() { return pc_set_; }
-  void set_pc_set(bool pc_set) { pc_set_ = pc_set; }
-
-  void set_log(ArmLogType log_type) { log_type_ = log_type; }
-  void set_log_skip_execution(bool skip_execution) { log_skip_execution_ = skip_execution; }
-  void set_log_indent(uint8_t indent) { log_indent_ = indent; }
-
- private:
-  bool GetByte(uint8_t* byte);
-  void AdjustRegisters(int32_t offset);
-
-  bool DecodePrefix_10_00(uint8_t byte);
-  bool DecodePrefix_10_01(uint8_t byte);
-  bool DecodePrefix_10_10(uint8_t byte);
-  bool DecodePrefix_10_11_0000();
-  bool DecodePrefix_10_11_0001();
-  bool DecodePrefix_10_11_0010();
-  bool DecodePrefix_10_11_0011();
-  bool DecodePrefix_10_11_01nn();
-  bool DecodePrefix_10_11_1nnn(uint8_t byte);
-  bool DecodePrefix_10(uint8_t byte);
-
-  bool DecodePrefix_11_000(uint8_t byte);
-  bool DecodePrefix_11_001(uint8_t byte);
-  bool DecodePrefix_11_010(uint8_t byte);
-  bool DecodePrefix_11(uint8_t byte);
-
-  RegsArm* regs_ = nullptr;
-  uint32_t cfa_ = 0;
-  std::deque<uint8_t> data_;
-  ArmStatus status_ = ARM_STATUS_NONE;
-  uint64_t status_address_ = 0;
-
-  Memory* elf_memory_;
-  Memory* process_memory_;
-
-  ArmLogType log_type_ = ARM_LOG_NONE;
-  uint8_t log_indent_ = 0;
-  bool log_skip_execution_ = false;
-  bool pc_set_ = false;
-  int32_t log_cfa_offset_ = 0;
-  std::map<uint8_t, int32_t> log_regs_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_ARM_EXIDX_H
diff --git a/libunwindstack/AsmGetRegsMips.S b/libunwindstack/AsmGetRegsMips.S
deleted file mode 100644
index 183d0a9..0000000
--- a/libunwindstack/AsmGetRegsMips.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-  .text
-  .type     AsmGetRegs, %function
-  .globl    AsmGetRegs
-  .ent      AsmGetRegs
-  .balign   16
-AsmGetRegs:
-  .cfi_startproc
-  .cfi_def_cfa $sp, 0
-  .set push
-  .set noreorder
-  .cpload $t9
-  sw   $zero, 0($a0)
-  .set noat
-  sw   $at, 4($a0)
-  .set at
-  sw   $v0, 8($a0)
-  sw   $v1, 12($a0)
-  sw   $a0, 16($a0)
-  sw   $a1, 20($a0)
-  sw   $a2, 24($a0)
-  sw   $a3, 28($a0)
-  sw   $t0, 32($a0)
-  sw   $t1, 36($a0)
-  sw   $t2, 40($a0)
-  sw   $t3, 44($a0)
-  sw   $t4, 48($a0)
-  sw   $t5, 52($a0)
-  sw   $t6, 56($a0)
-  sw   $t7, 60($a0)
-  sw   $s0, 64($a0)
-  sw   $s1, 68($a0)
-  sw   $s2, 72($a0)
-  sw   $s3, 76($a0)
-  sw   $s4, 80($a0)
-  sw   $s5, 84($a0)
-  sw   $s6, 88($a0)
-  sw   $s7, 92($a0)
-  sw   $t8, 96($a0)
-  sw   $t9, 100($a0)
-  sw   $k0, 104($a0)
-  sw   $k1, 108($a0)
-  sw   $gp, 112($a0)
-  sw   $sp, 116($a0)
-  sw   $s8, 120($a0)
-  sw   $ra, 124($a0)
-  jalr $zero, $ra
-  sw   $ra, 128($a0)   // set PC to the calling function
-
-  .set pop
-  .cfi_endproc
-  .size     AsmGetRegs, .-AsmGetRegs
-  .end      AsmGetRegs
diff --git a/libunwindstack/AsmGetRegsMips64.S b/libunwindstack/AsmGetRegsMips64.S
deleted file mode 100644
index 7a244f6..0000000
--- a/libunwindstack/AsmGetRegsMips64.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-  .text
-  .type     AsmGetRegs, %function
-  .globl    AsmGetRegs
-  .ent      AsmGetRegs
-  .balign    16
-AsmGetRegs:
-  .cfi_startproc
-  .cfi_def_cfa $sp, 0
-  .set push
-  .set noreorder
-  .cpload $t9
-  sd   $zero, 0($a0)
-  .set noat
-  sd   $at, 8($a0)
-  .set at
-  sd   $v0, 16($a0)
-  sd   $v1, 24($a0)
-  sd   $a0, 32($a0)
-  sd   $a1, 40($a0)
-  sd   $a2, 48($a0)
-  sd   $a3, 56($a0)
-  sd   $a4, 64($a0)
-  sd   $a5, 72($a0)
-  sd   $a6, 80($a0)
-  sd   $a7, 88($a0)
-  sd   $t0, 96($a0)
-  sd   $t1, 104($a0)
-  sd   $t2, 112($a0)
-  sd   $t3, 120($a0)
-  sd   $s0, 128($a0)
-  sd   $s1, 136($a0)
-  sd   $s2, 144($a0)
-  sd   $s3, 152($a0)
-  sd   $s4, 160($a0)
-  sd   $s5, 168($a0)
-  sd   $s6, 176($a0)
-  sd   $s7, 184($a0)
-  sd   $t8, 192($a0)
-  sd   $t9, 200($a0)
-  sd   $k0, 208($a0)
-  sd   $k1, 216($a0)
-  sd   $gp, 224($a0)
-  sd   $sp, 232($a0)
-  sd   $s8, 240($a0)
-  sd   $ra, 248($a0)
-  jalr $zero, $ra
-  sd   $ra, 256($a0)   // set PC to the calling function
-
-  .set pop
-  .cfi_endproc
-  .size AsmGetRegs, .-AsmGetRegs
-  .end      AsmGetRegs
diff --git a/libunwindstack/AsmGetRegsX86.S b/libunwindstack/AsmGetRegsX86.S
deleted file mode 100644
index 021e628..0000000
--- a/libunwindstack/AsmGetRegsX86.S
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-  .text
-  .global AsmGetRegs
-  .balign 16
-  .type AsmGetRegs, @function
-AsmGetRegs:
-  .cfi_startproc
-  mov 4(%esp), %eax
-  movl $0, (%eax)
-  movl %ecx, 4(%eax)
-  movl %edx, 8(%eax)
-  movl %ebx, 12(%eax)
-
-  /* ESP */
-  leal 4(%esp), %ecx
-  movl %ecx, 16(%eax)
-
-  movl %ebp, 20(%eax)
-  movl %esi, 24(%eax)
-  movl %edi, 28(%eax)
-
-  /* EIP */
-  movl (%esp), %ecx
-  movl %ecx, 32(%eax)
-
-  mov  %cs, 36(%eax)
-  mov  %ss, 40(%eax)
-  mov  %ds, 44(%eax)
-  mov  %es, 48(%eax)
-  mov  %fs, 52(%eax)
-  mov  %gs, 56(%eax)
-  ret
-
-  .cfi_endproc
-  .size AsmGetRegs, .-AsmGetRegs
diff --git a/libunwindstack/AsmGetRegsX86_64.S b/libunwindstack/AsmGetRegsX86_64.S
deleted file mode 100644
index 4cd3b6f..0000000
--- a/libunwindstack/AsmGetRegsX86_64.S
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-  .text
-  .global AsmGetRegs
-  .balign 16
-  .type AsmGetRegs, @function
-AsmGetRegs:
-  .cfi_startproc
-  movq %rax, (%rdi)
-  movq %rdx, 8(%rdi)
-  movq %rcx, 16(%rdi)
-  movq %rbx, 24(%rdi)
-  movq %rsi, 32(%rdi)
-  movq %rdi, 40(%rdi)
-  movq %rbp, 48(%rdi)
-
-  /* RSP */
-  lea 8(%rsp), %rax
-  movq %rax, 56(%rdi)
-
-  movq %r8, 64(%rdi)
-  movq %r9, 72(%rdi)
-  movq %r10, 80(%rdi)
-  movq %r11, 88(%rdi)
-  movq %r12, 96(%rdi)
-  movq %r13, 104(%rdi)
-  movq %r14, 112(%rdi)
-  movq %r15, 120(%rdi)
-
-  /* RIP */
-  movq (%rsp), %rax
-  movq %rax, 128(%rdi)
-  ret
-
-  .cfi_endproc
-  .size AsmGetRegs, .-AsmGetRegs
diff --git a/libunwindstack/Check.h b/libunwindstack/Check.h
deleted file mode 100644
index 9643d76..0000000
--- a/libunwindstack/Check.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_CHECK_H
-#define _LIBUNWINDSTACK_CHECK_H
-
-#include <stdlib.h>
-
-#include <unwindstack/Log.h>
-
-namespace unwindstack {
-
-#define CHECK(assertion)                                   \
-  if (__builtin_expect(!(assertion), false)) {             \
-    log(0, "%s:%d: %s\n", __FILE__, __LINE__, #assertion); \
-    abort();                                               \
-  }
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_CHECK_H
diff --git a/libunwindstack/DexFile.cpp b/libunwindstack/DexFile.cpp
deleted file mode 100644
index bf63abf..0000000
--- a/libunwindstack/DexFile.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-
-#define LOG_TAG "unwind"
-#include <log/log.h>
-
-#include <android-base/unique_fd.h>
-#include <art_api/dex_file_support.h>
-
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-
-#include "DexFile.h"
-
-namespace unwindstack {
-
-static bool CheckDexSupport() {
-  if (std::string err_msg; !art_api::dex::TryLoadLibdexfileExternal(&err_msg)) {
-    ALOGW("Failed to initialize DEX file support: %s", err_msg.c_str());
-    return false;
-  }
-  return true;
-}
-
-static bool HasDexSupport() {
-  static bool has_dex_support = CheckDexSupport();
-  return has_dex_support;
-}
-
-std::unique_ptr<DexFile> DexFile::Create(uint64_t dex_file_offset_in_memory, Memory* memory,
-                                         MapInfo* info) {
-  if (!info->name.empty()) {
-    std::unique_ptr<DexFile> dex_file =
-        DexFileFromFile::Create(dex_file_offset_in_memory - info->start + info->offset, info->name);
-    if (dex_file) {
-      return dex_file;
-    }
-  }
-  return DexFileFromMemory::Create(dex_file_offset_in_memory, memory, info->name);
-}
-
-bool DexFile::GetMethodInformation(uint64_t dex_offset, std::string* method_name,
-                                   uint64_t* method_offset) {
-  art_api::dex::MethodInfo method_info = GetMethodInfoForOffset(dex_offset, false);
-  if (method_info.offset == 0) {
-    return false;
-  }
-  *method_name = method_info.name;
-  *method_offset = dex_offset - method_info.offset;
-  return true;
-}
-
-std::unique_ptr<DexFileFromFile> DexFileFromFile::Create(uint64_t dex_file_offset_in_file,
-                                                         const std::string& file) {
-  if (UNLIKELY(!HasDexSupport())) {
-    return nullptr;
-  }
-
-  android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(file.c_str(), O_RDONLY | O_CLOEXEC)));
-  if (fd == -1) {
-    return nullptr;
-  }
-
-  std::string error_msg;
-  std::unique_ptr<art_api::dex::DexFile> art_dex_file =
-      OpenFromFd(fd, dex_file_offset_in_file, file, &error_msg);
-  if (art_dex_file == nullptr) {
-    return nullptr;
-  }
-
-  return std::unique_ptr<DexFileFromFile>(new DexFileFromFile(art_dex_file));
-}
-
-std::unique_ptr<DexFileFromMemory> DexFileFromMemory::Create(uint64_t dex_file_offset_in_memory,
-                                                             Memory* memory,
-                                                             const std::string& name) {
-  if (UNLIKELY(!HasDexSupport())) {
-    return nullptr;
-  }
-
-  std::vector<uint8_t> backing_memory;
-
-  for (size_t size = 0;;) {
-    std::string error_msg;
-    std::unique_ptr<art_api::dex::DexFile> art_dex_file =
-        OpenFromMemory(backing_memory.data(), &size, name, &error_msg);
-
-    if (art_dex_file != nullptr) {
-      return std::unique_ptr<DexFileFromMemory>(
-          new DexFileFromMemory(art_dex_file, std::move(backing_memory)));
-    }
-
-    if (!error_msg.empty()) {
-      return nullptr;
-    }
-
-    backing_memory.resize(size);
-    if (!memory->ReadFully(dex_file_offset_in_memory, backing_memory.data(),
-                           backing_memory.size())) {
-      return nullptr;
-    }
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/DexFile.h b/libunwindstack/DexFile.h
deleted file mode 100644
index 4e8369f..0000000
--- a/libunwindstack/DexFile.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DEX_FILE_H
-#define _LIBUNWINDSTACK_DEX_FILE_H
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <art_api/dex_file_support.h>
-
-namespace unwindstack {
-
-class DexFile : protected art_api::dex::DexFile {
- public:
-  virtual ~DexFile() = default;
-
-  bool GetMethodInformation(uint64_t dex_offset, std::string* method_name, uint64_t* method_offset);
-
-  static std::unique_ptr<DexFile> Create(uint64_t dex_file_offset_in_memory, Memory* memory,
-                                         MapInfo* info);
-
- protected:
-  DexFile(std::unique_ptr<art_api::dex::DexFile>& art_dex_file)
-      : art_api::dex::DexFile(art_dex_file) {}
-};
-
-class DexFileFromFile : public DexFile {
- public:
-  static std::unique_ptr<DexFileFromFile> Create(uint64_t dex_file_offset_in_file,
-                                                 const std::string& file);
-
- private:
-  DexFileFromFile(std::unique_ptr<art_api::dex::DexFile>& art_dex_file) : DexFile(art_dex_file) {}
-};
-
-class DexFileFromMemory : public DexFile {
- public:
-  static std::unique_ptr<DexFileFromMemory> Create(uint64_t dex_file_offset_in_memory,
-                                                   Memory* memory, const std::string& name);
-
- private:
-  DexFileFromMemory(std::unique_ptr<art_api::dex::DexFile>& art_dex_file,
-                    std::vector<uint8_t>&& memory)
-      : DexFile(art_dex_file), memory_(std::move(memory)) {}
-
-  std::vector<uint8_t> memory_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DEX_FILE_H
diff --git a/libunwindstack/DexFiles.cpp b/libunwindstack/DexFiles.cpp
deleted file mode 100644
index 2057fad..0000000
--- a/libunwindstack/DexFiles.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-
-#include <unwindstack/DexFiles.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#if defined(DEXFILE_SUPPORT)
-#include "DexFile.h"
-#endif
-
-namespace unwindstack {
-
-#if !defined(DEXFILE_SUPPORT)
-// Empty class definition.
-class DexFile {
- public:
-  DexFile() = default;
-  virtual ~DexFile() = default;
-};
-#endif
-
-struct DEXFileEntry32 {
-  uint32_t next;
-  uint32_t prev;
-  uint32_t dex_file;
-};
-
-struct DEXFileEntry64 {
-  uint64_t next;
-  uint64_t prev;
-  uint64_t dex_file;
-};
-
-DexFiles::DexFiles(std::shared_ptr<Memory>& memory) : Global(memory) {}
-
-DexFiles::DexFiles(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs)
-    : Global(memory, search_libs) {}
-
-DexFiles::~DexFiles() {}
-
-void DexFiles::ProcessArch() {
-  switch (arch()) {
-    case ARCH_ARM:
-    case ARCH_MIPS:
-    case ARCH_X86:
-      read_entry_ptr_func_ = &DexFiles::ReadEntryPtr32;
-      read_entry_func_ = &DexFiles::ReadEntry32;
-      break;
-
-    case ARCH_ARM64:
-    case ARCH_MIPS64:
-    case ARCH_X86_64:
-      read_entry_ptr_func_ = &DexFiles::ReadEntryPtr64;
-      read_entry_func_ = &DexFiles::ReadEntry64;
-      break;
-
-    case ARCH_UNKNOWN:
-      abort();
-  }
-}
-
-uint64_t DexFiles::ReadEntryPtr32(uint64_t addr) {
-  uint32_t entry;
-  const uint32_t field_offset = 12;  // offset of first_entry_ in the descriptor struct.
-  if (!memory_->ReadFully(addr + field_offset, &entry, sizeof(entry))) {
-    return 0;
-  }
-  return entry;
-}
-
-uint64_t DexFiles::ReadEntryPtr64(uint64_t addr) {
-  uint64_t entry;
-  const uint32_t field_offset = 16;  // offset of first_entry_ in the descriptor struct.
-  if (!memory_->ReadFully(addr + field_offset, &entry, sizeof(entry))) {
-    return 0;
-  }
-  return entry;
-}
-
-bool DexFiles::ReadEntry32() {
-  DEXFileEntry32 entry;
-  if (!memory_->ReadFully(entry_addr_, &entry, sizeof(entry)) || entry.dex_file == 0) {
-    entry_addr_ = 0;
-    return false;
-  }
-
-  addrs_.push_back(entry.dex_file);
-  entry_addr_ = entry.next;
-  return true;
-}
-
-bool DexFiles::ReadEntry64() {
-  DEXFileEntry64 entry;
-  if (!memory_->ReadFully(entry_addr_, &entry, sizeof(entry)) || entry.dex_file == 0) {
-    entry_addr_ = 0;
-    return false;
-  }
-
-  addrs_.push_back(entry.dex_file);
-  entry_addr_ = entry.next;
-  return true;
-}
-
-bool DexFiles::ReadVariableData(uint64_t ptr_offset) {
-  entry_addr_ = (this->*read_entry_ptr_func_)(ptr_offset);
-  return entry_addr_ != 0;
-}
-
-void DexFiles::Init(Maps* maps) {
-  if (initialized_) {
-    return;
-  }
-  initialized_ = true;
-  entry_addr_ = 0;
-
-  FindAndReadVariable(maps, "__dex_debug_descriptor");
-}
-
-#if defined(DEXFILE_SUPPORT)
-DexFile* DexFiles::GetDexFile(uint64_t dex_file_offset, MapInfo* info) {
-  // Lock while processing the data.
-  DexFile* dex_file;
-  auto entry = files_.find(dex_file_offset);
-  if (entry == files_.end()) {
-    std::unique_ptr<DexFile> new_dex_file = DexFile::Create(dex_file_offset, memory_.get(), info);
-    dex_file = new_dex_file.get();
-    files_[dex_file_offset] = std::move(new_dex_file);
-  } else {
-    dex_file = entry->second.get();
-  }
-  return dex_file;
-}
-#else
-DexFile* DexFiles::GetDexFile(uint64_t, MapInfo*) {
-  return nullptr;
-}
-#endif
-
-bool DexFiles::GetAddr(size_t index, uint64_t* addr) {
-  if (index < addrs_.size()) {
-    *addr = addrs_[index];
-    return true;
-  }
-  if (entry_addr_ != 0 && (this->*read_entry_func_)()) {
-    *addr = addrs_.back();
-    return true;
-  }
-  return false;
-}
-
-#if defined(DEXFILE_SUPPORT)
-void DexFiles::GetMethodInformation(Maps* maps, MapInfo* info, uint64_t dex_pc,
-                                    std::string* method_name, uint64_t* method_offset) {
-  std::lock_guard<std::mutex> guard(lock_);
-  if (!initialized_) {
-    Init(maps);
-  }
-
-  size_t index = 0;
-  uint64_t addr;
-  while (GetAddr(index++, &addr)) {
-    if (addr < info->start || addr >= info->end) {
-      continue;
-    }
-
-    DexFile* dex_file = GetDexFile(addr, info);
-    if (dex_file != nullptr &&
-        dex_file->GetMethodInformation(dex_pc - addr, method_name, method_offset)) {
-      break;
-    }
-  }
-}
-#else
-void DexFiles::GetMethodInformation(Maps*, MapInfo*, uint64_t, std::string*, uint64_t*) {}
-#endif
-
-}  // namespace unwindstack
diff --git a/libunwindstack/DwarfCfa.cpp b/libunwindstack/DwarfCfa.cpp
deleted file mode 100644
index c128b9b..0000000
--- a/libunwindstack/DwarfCfa.cpp
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <inttypes.h>
-#include <stdint.h>
-
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/Log.h>
-
-#include "DwarfCfa.h"
-#include "DwarfEncoding.h"
-#include "DwarfOp.h"
-
-namespace unwindstack {
-
-template <typename AddressType>
-constexpr typename DwarfCfa<AddressType>::process_func DwarfCfa<AddressType>::kCallbackTable[64];
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::GetLocationInfo(uint64_t pc, uint64_t start_offset, uint64_t end_offset,
-                                            dwarf_loc_regs_t* loc_regs) {
-  if (cie_loc_regs_ != nullptr) {
-    for (const auto& entry : *cie_loc_regs_) {
-      (*loc_regs)[entry.first] = entry.second;
-    }
-  }
-  last_error_.code = DWARF_ERROR_NONE;
-  last_error_.address = 0;
-
-  memory_->set_cur_offset(start_offset);
-  uint64_t cfa_offset;
-  cur_pc_ = fde_->pc_start;
-  loc_regs->pc_start = cur_pc_;
-  while (true) {
-    if (cur_pc_ > pc) {
-      loc_regs->pc_end = cur_pc_;
-      return true;
-    }
-    if ((cfa_offset = memory_->cur_offset()) >= end_offset) {
-      loc_regs->pc_end = fde_->pc_end;
-      return true;
-    }
-    loc_regs->pc_start = cur_pc_;
-    operands_.clear();
-    // Read the cfa information.
-    uint8_t cfa_value;
-    if (!memory_->ReadBytes(&cfa_value, 1)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_->cur_offset();
-      return false;
-    }
-    uint8_t cfa_low = cfa_value & 0x3f;
-    // Check the 2 high bits.
-    switch (cfa_value >> 6) {
-      case 1:
-        cur_pc_ += cfa_low * fde_->cie->code_alignment_factor;
-        break;
-      case 2: {
-        uint64_t offset;
-        if (!memory_->ReadULEB128(&offset)) {
-          last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-          last_error_.address = memory_->cur_offset();
-          return false;
-        }
-        SignedType signed_offset =
-            static_cast<SignedType>(offset) * fde_->cie->data_alignment_factor;
-        (*loc_regs)[cfa_low] = {.type = DWARF_LOCATION_OFFSET,
-                                .values = {static_cast<uint64_t>(signed_offset)}};
-        break;
-      }
-      case 3: {
-        if (cie_loc_regs_ == nullptr) {
-          log(0, "restore while processing cie");
-          last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-          return false;
-        }
-
-        auto reg_entry = cie_loc_regs_->find(cfa_low);
-        if (reg_entry == cie_loc_regs_->end()) {
-          loc_regs->erase(cfa_low);
-        } else {
-          (*loc_regs)[cfa_low] = reg_entry->second;
-        }
-        break;
-      }
-      case 0: {
-        const auto handle_func = DwarfCfa<AddressType>::kCallbackTable[cfa_low];
-        if (handle_func == nullptr) {
-          last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-          return false;
-        }
-
-        const auto cfa = &DwarfCfaInfo::kTable[cfa_low];
-        for (size_t i = 0; i < cfa->num_operands; i++) {
-          if (cfa->operands[i] == DW_EH_PE_block) {
-            uint64_t block_length;
-            if (!memory_->ReadULEB128(&block_length)) {
-              last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-              last_error_.address = memory_->cur_offset();
-              return false;
-            }
-            operands_.push_back(block_length);
-            memory_->set_cur_offset(memory_->cur_offset() + block_length);
-            continue;
-          }
-          uint64_t value;
-          if (!memory_->ReadEncodedValue<AddressType>(cfa->operands[i], &value)) {
-            last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-            last_error_.address = memory_->cur_offset();
-            return false;
-          }
-          operands_.push_back(value);
-        }
-
-        if (!(this->*handle_func)(loc_regs)) {
-          return false;
-        }
-        break;
-      }
-    }
-  }
-}
-
-template <typename AddressType>
-std::string DwarfCfa<AddressType>::GetOperandString(uint8_t operand, uint64_t value,
-                                                    uint64_t* cur_pc) {
-  std::string string;
-  switch (operand) {
-    case DwarfCfaInfo::DWARF_DISPLAY_REGISTER:
-      string = " register(" + std::to_string(value) + ")";
-      break;
-    case DwarfCfaInfo::DWARF_DISPLAY_SIGNED_NUMBER:
-      string += " " + std::to_string(static_cast<SignedType>(value));
-      break;
-    case DwarfCfaInfo::DWARF_DISPLAY_ADVANCE_LOC:
-      *cur_pc += value;
-      FALLTHROUGH_INTENDED;
-      // Fall through to log the value.
-    case DwarfCfaInfo::DWARF_DISPLAY_NUMBER:
-      string += " " + std::to_string(value);
-      break;
-    case DwarfCfaInfo::DWARF_DISPLAY_SET_LOC:
-      *cur_pc = value;
-      FALLTHROUGH_INTENDED;
-      // Fall through to log the value.
-    case DwarfCfaInfo::DWARF_DISPLAY_ADDRESS:
-      if (std::is_same<AddressType, uint32_t>::value) {
-        string += android::base::StringPrintf(" 0x%" PRIx32, static_cast<uint32_t>(value));
-      } else {
-        string += android::base::StringPrintf(" 0x%" PRIx64, static_cast<uint64_t>(value));
-      }
-      break;
-    default:
-      string = " unknown";
-  }
-  return string;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::LogOffsetRegisterString(uint32_t indent, uint64_t cfa_offset,
-                                                    uint8_t reg) {
-  uint64_t offset;
-  if (!memory_->ReadULEB128(&offset)) {
-    return false;
-  }
-  uint64_t end_offset = memory_->cur_offset();
-  memory_->set_cur_offset(cfa_offset);
-
-  std::string raw_data = "Raw Data:";
-  for (uint64_t i = cfa_offset; i < end_offset; i++) {
-    uint8_t value;
-    if (!memory_->ReadBytes(&value, 1)) {
-      return false;
-    }
-    raw_data += android::base::StringPrintf(" 0x%02x", value);
-  }
-  log(indent, "DW_CFA_offset register(%d) %" PRId64, reg, offset);
-  log(indent, "%s", raw_data.c_str());
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::LogInstruction(uint32_t indent, uint64_t cfa_offset, uint8_t op,
-                                           uint64_t* cur_pc) {
-  const auto* cfa = &DwarfCfaInfo::kTable[op];
-  if (cfa->name[0] == '\0') {
-    log(indent, "Illegal");
-    log(indent, "Raw Data: 0x%02x", op);
-    return true;
-  }
-
-  std::string log_string(cfa->name);
-  std::vector<std::string> expression_lines;
-  for (size_t i = 0; i < cfa->num_operands; i++) {
-    if (cfa->operands[i] == DW_EH_PE_block) {
-      // This is a Dwarf Expression.
-      uint64_t end_offset;
-      if (!memory_->ReadULEB128(&end_offset)) {
-        return false;
-      }
-      log_string += " " + std::to_string(end_offset);
-      end_offset += memory_->cur_offset();
-
-      DwarfOp<AddressType> op(memory_, nullptr);
-      op.GetLogInfo(memory_->cur_offset(), end_offset, &expression_lines);
-      memory_->set_cur_offset(end_offset);
-    } else {
-      uint64_t value;
-      if (!memory_->ReadEncodedValue<AddressType>(cfa->operands[i], &value)) {
-        return false;
-      }
-      log_string += GetOperandString(cfa->display_operands[i], value, cur_pc);
-    }
-  }
-  log(indent, "%s", log_string.c_str());
-
-  // Get the raw bytes of the data.
-  uint64_t end_offset = memory_->cur_offset();
-  memory_->set_cur_offset(cfa_offset);
-  std::string raw_data("Raw Data:");
-  for (uint64_t i = 0; i < end_offset - cfa_offset; i++) {
-    uint8_t value;
-    if (!memory_->ReadBytes(&value, 1)) {
-      return false;
-    }
-
-    // Only show 10 raw bytes per line.
-    if ((i % 10) == 0 && i != 0) {
-      log(indent, "%s", raw_data.c_str());
-      raw_data.clear();
-    }
-    if (raw_data.empty()) {
-      raw_data = "Raw Data:";
-    }
-    raw_data += android::base::StringPrintf(" 0x%02x", value);
-  }
-  if (!raw_data.empty()) {
-    log(indent, "%s", raw_data.c_str());
-  }
-
-  // Log any of the expression data.
-  for (const auto& line : expression_lines) {
-    log(indent + 1, "%s", line.c_str());
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::Log(uint32_t indent, uint64_t pc, uint64_t start_offset,
-                                uint64_t end_offset) {
-  memory_->set_cur_offset(start_offset);
-  uint64_t cfa_offset;
-  uint64_t cur_pc = fde_->pc_start;
-  uint64_t old_pc = cur_pc;
-  while ((cfa_offset = memory_->cur_offset()) < end_offset && cur_pc <= pc) {
-    // Read the cfa information.
-    uint8_t cfa_value;
-    if (!memory_->ReadBytes(&cfa_value, 1)) {
-      return false;
-    }
-
-    // Check the 2 high bits.
-    uint8_t cfa_low = cfa_value & 0x3f;
-    switch (cfa_value >> 6) {
-      case 0:
-        if (!LogInstruction(indent, cfa_offset, cfa_low, &cur_pc)) {
-          return false;
-        }
-        break;
-      case 1:
-        log(indent, "DW_CFA_advance_loc %d", cfa_low);
-        log(indent, "Raw Data: 0x%02x", cfa_value);
-        cur_pc += cfa_low * fde_->cie->code_alignment_factor;
-        break;
-      case 2:
-        if (!LogOffsetRegisterString(indent, cfa_offset, cfa_low)) {
-          return false;
-        }
-        break;
-      case 3:
-        log(indent, "DW_CFA_restore register(%d)", cfa_low);
-        log(indent, "Raw Data: 0x%02x", cfa_value);
-        break;
-    }
-    if (cur_pc != old_pc) {
-      log(0, "");
-      log(indent, "PC 0x%" PRIx64, cur_pc);
-    }
-    old_pc = cur_pc;
-  }
-  return true;
-}
-
-// Static data.
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_nop(dwarf_loc_regs_t*) {
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_set_loc(dwarf_loc_regs_t*) {
-  AddressType cur_pc = cur_pc_;
-  AddressType new_pc = operands_[0];
-  if (new_pc < cur_pc) {
-    if (std::is_same<AddressType, uint32_t>::value) {
-      log(0, "Warning: PC is moving backwards: old 0x%" PRIx32 " new 0x%" PRIx32, cur_pc, new_pc);
-    } else {
-      log(0, "Warning: PC is moving backwards: old 0x%" PRIx64 " new 0x%" PRIx64, cur_pc, new_pc);
-    }
-  }
-  cur_pc_ = new_pc;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_advance_loc(dwarf_loc_regs_t*) {
-  cur_pc_ += operands_[0] * fde_->cie->code_alignment_factor;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_offset(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_OFFSET, .values = {operands_[1]}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_restore(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  if (cie_loc_regs_ == nullptr) {
-    log(0, "restore while processing cie");
-    last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-    return false;
-  }
-  auto reg_entry = cie_loc_regs_->find(reg);
-  if (reg_entry == cie_loc_regs_->end()) {
-    loc_regs->erase(reg);
-  } else {
-    (*loc_regs)[reg] = reg_entry->second;
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_undefined(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_UNDEFINED};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_same_value(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  loc_regs->erase(reg);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_register(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  AddressType reg_dst = operands_[1];
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_REGISTER, .values = {reg_dst}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_remember_state(dwarf_loc_regs_t* loc_regs) {
-  loc_reg_state_.push(*loc_regs);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_restore_state(dwarf_loc_regs_t* loc_regs) {
-  if (loc_reg_state_.size() == 0) {
-    log(0, "Warning: Attempt to restore without remember.");
-    return true;
-  }
-  *loc_regs = loc_reg_state_.top();
-  loc_reg_state_.pop();
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_def_cfa(dwarf_loc_regs_t* loc_regs) {
-  (*loc_regs)[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {operands_[0], operands_[1]}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_def_cfa_register(dwarf_loc_regs_t* loc_regs) {
-  auto cfa_location = loc_regs->find(CFA_REG);
-  if (cfa_location == loc_regs->end() || cfa_location->second.type != DWARF_LOCATION_REGISTER) {
-    log(0, "Attempt to set new register, but cfa is not already set to a register.");
-    last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-    return false;
-  }
-
-  cfa_location->second.values[0] = operands_[0];
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_def_cfa_offset(dwarf_loc_regs_t* loc_regs) {
-  // Changing the offset if this is not a register is illegal.
-  auto cfa_location = loc_regs->find(CFA_REG);
-  if (cfa_location == loc_regs->end() || cfa_location->second.type != DWARF_LOCATION_REGISTER) {
-    log(0, "Attempt to set offset, but cfa is not set to a register.");
-    last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-    return false;
-  }
-  cfa_location->second.values[1] = operands_[0];
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_def_cfa_expression(dwarf_loc_regs_t* loc_regs) {
-  // There is only one type of expression for CFA evaluation and the DWARF
-  // specification is unclear whether it returns the address or the
-  // dereferenced value. GDB expects the value, so will we.
-  (*loc_regs)[CFA_REG] = {.type = DWARF_LOCATION_VAL_EXPRESSION,
-                          .values = {operands_[0], memory_->cur_offset()}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_expression(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_EXPRESSION,
-                      .values = {operands_[1], memory_->cur_offset()}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_offset_extended_sf(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  SignedType value = static_cast<SignedType>(operands_[1]) * fde_->cie->data_alignment_factor;
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_OFFSET, .values = {static_cast<uint64_t>(value)}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_def_cfa_sf(dwarf_loc_regs_t* loc_regs) {
-  SignedType offset = static_cast<SignedType>(operands_[1]) * fde_->cie->data_alignment_factor;
-  (*loc_regs)[CFA_REG] = {.type = DWARF_LOCATION_REGISTER,
-                          .values = {operands_[0], static_cast<uint64_t>(offset)}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_def_cfa_offset_sf(dwarf_loc_regs_t* loc_regs) {
-  // Changing the offset if this is not a register is illegal.
-  auto cfa_location = loc_regs->find(CFA_REG);
-  if (cfa_location == loc_regs->end() || cfa_location->second.type != DWARF_LOCATION_REGISTER) {
-    log(0, "Attempt to set offset, but cfa is not set to a register.");
-    last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-    return false;
-  }
-  SignedType offset = static_cast<SignedType>(operands_[0]) * fde_->cie->data_alignment_factor;
-  cfa_location->second.values[1] = static_cast<uint64_t>(offset);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_val_offset(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  SignedType offset = static_cast<SignedType>(operands_[1]) * fde_->cie->data_alignment_factor;
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_VAL_OFFSET, .values = {static_cast<uint64_t>(offset)}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_val_offset_sf(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  SignedType offset = static_cast<SignedType>(operands_[1]) * fde_->cie->data_alignment_factor;
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_VAL_OFFSET, .values = {static_cast<uint64_t>(offset)}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_val_expression(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_VAL_EXPRESSION,
-                      .values = {operands_[1], memory_->cur_offset()}};
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfCfa<AddressType>::cfa_gnu_negative_offset_extended(dwarf_loc_regs_t* loc_regs) {
-  AddressType reg = operands_[0];
-  SignedType offset = -static_cast<SignedType>(operands_[1]);
-  (*loc_regs)[reg] = {.type = DWARF_LOCATION_OFFSET, .values = {static_cast<uint64_t>(offset)}};
-  return true;
-}
-
-const DwarfCfaInfo::Info DwarfCfaInfo::kTable[64] = {
-    {
-        // 0x00 DW_CFA_nop
-        "DW_CFA_nop",
-        2,
-        0,
-        {},
-        {},
-    },
-    {
-        "DW_CFA_set_loc",  // 0x01 DW_CFA_set_loc
-        2,
-        1,
-        {DW_EH_PE_absptr},
-        {DWARF_DISPLAY_SET_LOC},
-    },
-    {
-        "DW_CFA_advance_loc1",  // 0x02 DW_CFA_advance_loc1
-        2,
-        1,
-        {DW_EH_PE_udata1},
-        {DWARF_DISPLAY_ADVANCE_LOC},
-    },
-    {
-        "DW_CFA_advance_loc2",  // 0x03 DW_CFA_advance_loc2
-        2,
-        1,
-        {DW_EH_PE_udata2},
-        {DWARF_DISPLAY_ADVANCE_LOC},
-    },
-    {
-        "DW_CFA_advance_loc4",  // 0x04 DW_CFA_advance_loc4
-        2,
-        1,
-        {DW_EH_PE_udata4},
-        {DWARF_DISPLAY_ADVANCE_LOC},
-    },
-    {
-        "DW_CFA_offset_extended",  // 0x05 DW_CFA_offset_extended
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_NUMBER},
-    },
-    {
-        "DW_CFA_restore_extended",  // 0x06 DW_CFA_restore_extended
-        2,
-        1,
-        {DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER},
-    },
-    {
-        "DW_CFA_undefined",  // 0x07 DW_CFA_undefined
-        2,
-        1,
-        {DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER},
-    },
-    {
-        "DW_CFA_same_value",  // 0x08 DW_CFA_same_value
-        2,
-        1,
-        {DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER},
-    },
-    {
-        "DW_CFA_register",  // 0x09 DW_CFA_register
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_REGISTER},
-    },
-    {
-        "DW_CFA_remember_state",  // 0x0a DW_CFA_remember_state
-        2,
-        0,
-        {},
-        {},
-    },
-    {
-        "DW_CFA_restore_state",  // 0x0b DW_CFA_restore_state
-        2,
-        0,
-        {},
-        {},
-    },
-    {
-        "DW_CFA_def_cfa",  // 0x0c DW_CFA_def_cfa
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_NUMBER},
-    },
-    {
-        "DW_CFA_def_cfa_register",  // 0x0d DW_CFA_def_cfa_register
-        2,
-        1,
-        {DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER},
-    },
-    {
-        "DW_CFA_def_cfa_offset",  // 0x0e DW_CFA_def_cfa_offset
-        2,
-        1,
-        {DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_NUMBER},
-    },
-    {
-        "DW_CFA_def_cfa_expression",  // 0x0f DW_CFA_def_cfa_expression
-        2,
-        1,
-        {DW_EH_PE_block},
-        {DWARF_DISPLAY_EVAL_BLOCK},
-    },
-    {
-        "DW_CFA_expression",  // 0x10 DW_CFA_expression
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_block},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_EVAL_BLOCK},
-    },
-    {
-        "DW_CFA_offset_extended_sf",  // 0x11 DW_CFA_offset_extend_sf
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_sleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_SIGNED_NUMBER},
-    },
-    {
-        "DW_CFA_def_cfa_sf",  // 0x12 DW_CFA_def_cfa_sf
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_sleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_SIGNED_NUMBER},
-    },
-    {
-        "DW_CFA_def_cfa_offset_sf",  // 0x13 DW_CFA_def_cfa_offset_sf
-        2,
-        1,
-        {DW_EH_PE_sleb128},
-        {DWARF_DISPLAY_SIGNED_NUMBER},
-    },
-    {
-        "DW_CFA_val_offset",  // 0x14 DW_CFA_val_offset
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_NUMBER},
-    },
-    {
-        "DW_CFA_val_offset_sf",  // 0x15 DW_CFA_val_offset_sf
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_sleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_SIGNED_NUMBER},
-    },
-    {
-        "DW_CFA_val_expression",  // 0x16 DW_CFA_val_expression
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_block},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_EVAL_BLOCK},
-    },
-    {"", 0, 0, {}, {}},  // 0x17 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x18 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x19 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x1a illegal cfa
-    {"", 0, 0, {}, {}},  // 0x1b illegal cfa
-    {"", 0, 0, {}, {}},  // 0x1c DW_CFA_lo_user (Treat as illegal)
-    {"", 0, 0, {}, {}},  // 0x1d illegal cfa
-    {"", 0, 0, {}, {}},  // 0x1e illegal cfa
-    {"", 0, 0, {}, {}},  // 0x1f illegal cfa
-    {"", 0, 0, {}, {}},  // 0x20 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x21 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x22 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x23 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x24 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x25 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x26 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x27 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x28 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x29 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x2a illegal cfa
-    {"", 0, 0, {}, {}},  // 0x2b illegal cfa
-    {"", 0, 0, {}, {}},  // 0x2c illegal cfa
-    {"", 0, 0, {}, {}},  // 0x2d DW_CFA_GNU_window_save (Treat as illegal)
-    {
-        "DW_CFA_GNU_args_size",  // 0x2e DW_CFA_GNU_args_size
-        2,
-        1,
-        {DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_NUMBER},
-    },
-    {
-        "DW_CFA_GNU_negative_offset_extended",  // 0x2f DW_CFA_GNU_negative_offset_extended
-        2,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
-        {DWARF_DISPLAY_REGISTER, DWARF_DISPLAY_NUMBER},
-    },
-    {"", 0, 0, {}, {}},  // 0x31 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x32 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x33 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x34 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x35 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x36 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x37 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x38 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x39 illegal cfa
-    {"", 0, 0, {}, {}},  // 0x3a illegal cfa
-    {"", 0, 0, {}, {}},  // 0x3b illegal cfa
-    {"", 0, 0, {}, {}},  // 0x3c illegal cfa
-    {"", 0, 0, {}, {}},  // 0x3d illegal cfa
-    {"", 0, 0, {}, {}},  // 0x3e illegal cfa
-    {"", 0, 0, {}, {}},  // 0x3f DW_CFA_hi_user (Treat as illegal)
-};
-
-// Explicitly instantiate DwarfCfa.
-template class DwarfCfa<uint32_t>;
-template class DwarfCfa<uint64_t>;
-
-}  // namespace unwindstack
diff --git a/libunwindstack/DwarfCfa.h b/libunwindstack/DwarfCfa.h
deleted file mode 100644
index 569c17c..0000000
--- a/libunwindstack/DwarfCfa.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_CFA_H
-#define _LIBUNWINDSTACK_DWARF_CFA_H
-
-#include <stdint.h>
-
-#include <stack>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/DwarfStructs.h>
-
-namespace unwindstack {
-
-// DWARF Standard home: http://dwarfstd.org/
-// This code is based on DWARF 4: http://http://dwarfstd.org/doc/DWARF4.pdf
-// See section 6.4.2.1 for a description of the DW_CFA_xxx values.
-
-class DwarfCfaInfo {
- public:
-  enum DisplayType : uint8_t {
-    DWARF_DISPLAY_NONE = 0,
-    DWARF_DISPLAY_REGISTER,
-    DWARF_DISPLAY_NUMBER,
-    DWARF_DISPLAY_SIGNED_NUMBER,
-    DWARF_DISPLAY_EVAL_BLOCK,
-    DWARF_DISPLAY_ADDRESS,
-    DWARF_DISPLAY_SET_LOC,
-    DWARF_DISPLAY_ADVANCE_LOC,
-  };
-
-  struct Info {
-    // It may seem cleaner to just change the type of 'name' to 'const char *'.
-    // However, having a pointer here would require relocation at runtime,
-    // causing 'kTable' to be placed in data.rel.ro section instead of rodata
-    // section, adding memory pressure to the system.  Note that this is only
-    // safe because this is only used in C++ code.  C++ standard, unlike C
-    // standard, mandates the array size to be large enough to hold the NULL
-    // terminator when initialized with a string literal.
-    const char name[36];
-    uint8_t supported_version;
-    uint8_t num_operands;
-    uint8_t operands[2];
-    uint8_t display_operands[2];
-  };
-
-  const static Info kTable[64];
-};
-
-template <typename AddressType>
-class DwarfCfa {
-  // Signed version of AddressType
-  typedef typename std::make_signed<AddressType>::type SignedType;
-
- public:
-  DwarfCfa(DwarfMemory* memory, const DwarfFde* fde) : memory_(memory), fde_(fde) {}
-  virtual ~DwarfCfa() = default;
-
-  bool GetLocationInfo(uint64_t pc, uint64_t start_offset, uint64_t end_offset,
-                       dwarf_loc_regs_t* loc_regs);
-
-  bool Log(uint32_t indent, uint64_t pc, uint64_t start_offset, uint64_t end_offset);
-
-  const DwarfErrorData& last_error() { return last_error_; }
-  DwarfErrorCode LastErrorCode() { return last_error_.code; }
-  uint64_t LastErrorAddress() { return last_error_.address; }
-
-  AddressType cur_pc() { return cur_pc_; }
-
-  void set_cie_loc_regs(const dwarf_loc_regs_t* cie_loc_regs) { cie_loc_regs_ = cie_loc_regs; }
-
- protected:
-  std::string GetOperandString(uint8_t operand, uint64_t value, uint64_t* cur_pc);
-
-  bool LogOffsetRegisterString(uint32_t indent, uint64_t cfa_offset, uint8_t reg);
-
-  bool LogInstruction(uint32_t indent, uint64_t cfa_offset, uint8_t op, uint64_t* cur_pc);
-
- private:
-  DwarfErrorData last_error_;
-  DwarfMemory* memory_;
-  const DwarfFde* fde_;
-
-  AddressType cur_pc_;
-  const dwarf_loc_regs_t* cie_loc_regs_ = nullptr;
-  std::vector<AddressType> operands_;
-  std::stack<dwarf_loc_regs_t> loc_reg_state_;
-
-  // CFA processing functions.
-  bool cfa_nop(dwarf_loc_regs_t*);
-  bool cfa_set_loc(dwarf_loc_regs_t*);
-  bool cfa_advance_loc(dwarf_loc_regs_t*);
-  bool cfa_offset(dwarf_loc_regs_t*);
-  bool cfa_restore(dwarf_loc_regs_t*);
-  bool cfa_undefined(dwarf_loc_regs_t*);
-  bool cfa_same_value(dwarf_loc_regs_t*);
-  bool cfa_register(dwarf_loc_regs_t*);
-  bool cfa_remember_state(dwarf_loc_regs_t*);
-  bool cfa_restore_state(dwarf_loc_regs_t*);
-  bool cfa_def_cfa(dwarf_loc_regs_t*);
-  bool cfa_def_cfa_register(dwarf_loc_regs_t*);
-  bool cfa_def_cfa_offset(dwarf_loc_regs_t*);
-  bool cfa_def_cfa_expression(dwarf_loc_regs_t*);
-  bool cfa_expression(dwarf_loc_regs_t*);
-  bool cfa_offset_extended_sf(dwarf_loc_regs_t*);
-  bool cfa_def_cfa_sf(dwarf_loc_regs_t*);
-  bool cfa_def_cfa_offset_sf(dwarf_loc_regs_t*);
-  bool cfa_val_offset(dwarf_loc_regs_t*);
-  bool cfa_val_offset_sf(dwarf_loc_regs_t*);
-  bool cfa_val_expression(dwarf_loc_regs_t*);
-  bool cfa_gnu_negative_offset_extended(dwarf_loc_regs_t*);
-
-  using process_func = bool (DwarfCfa::*)(dwarf_loc_regs_t*);
-  constexpr static process_func kCallbackTable[64] = {
-      // 0x00 DW_CFA_nop
-      &DwarfCfa::cfa_nop,
-      // 0x01 DW_CFA_set_loc
-      &DwarfCfa::cfa_set_loc,
-      // 0x02 DW_CFA_advance_loc1
-      &DwarfCfa::cfa_advance_loc,
-      // 0x03 DW_CFA_advance_loc2
-      &DwarfCfa::cfa_advance_loc,
-      // 0x04 DW_CFA_advance_loc4
-      &DwarfCfa::cfa_advance_loc,
-      // 0x05 DW_CFA_offset_extended
-      &DwarfCfa::cfa_offset,
-      // 0x06 DW_CFA_restore_extended
-      &DwarfCfa::cfa_restore,
-      // 0x07 DW_CFA_undefined
-      &DwarfCfa::cfa_undefined,
-      // 0x08 DW_CFA_same_value
-      &DwarfCfa::cfa_same_value,
-      // 0x09 DW_CFA_register
-      &DwarfCfa::cfa_register,
-      // 0x0a DW_CFA_remember_state
-      &DwarfCfa::cfa_remember_state,
-      // 0x0b DW_CFA_restore_state
-      &DwarfCfa::cfa_restore_state,
-      // 0x0c DW_CFA_def_cfa
-      &DwarfCfa::cfa_def_cfa,
-      // 0x0d DW_CFA_def_cfa_register
-      &DwarfCfa::cfa_def_cfa_register,
-      // 0x0e DW_CFA_def_cfa_offset
-      &DwarfCfa::cfa_def_cfa_offset,
-      // 0x0f DW_CFA_def_cfa_expression
-      &DwarfCfa::cfa_def_cfa_expression,
-      // 0x10 DW_CFA_expression
-      &DwarfCfa::cfa_expression,
-      // 0x11 DW_CFA_offset_extended_sf
-      &DwarfCfa::cfa_offset_extended_sf,
-      // 0x12 DW_CFA_def_cfa_sf
-      &DwarfCfa::cfa_def_cfa_sf,
-      // 0x13 DW_CFA_def_cfa_offset_sf
-      &DwarfCfa::cfa_def_cfa_offset_sf,
-      // 0x14 DW_CFA_val_offset
-      &DwarfCfa::cfa_val_offset,
-      // 0x15 DW_CFA_val_offset_sf
-      &DwarfCfa::cfa_val_offset_sf,
-      // 0x16 DW_CFA_val_expression
-      &DwarfCfa::cfa_val_expression,
-      // 0x17 illegal cfa
-      nullptr,
-      // 0x18 illegal cfa
-      nullptr,
-      // 0x19 illegal cfa
-      nullptr,
-      // 0x1a illegal cfa
-      nullptr,
-      // 0x1b illegal cfa
-      nullptr,
-      // 0x1c DW_CFA_lo_user (Treat this as illegal)
-      nullptr,
-      // 0x1d illegal cfa
-      nullptr,
-      // 0x1e illegal cfa
-      nullptr,
-      // 0x1f illegal cfa
-      nullptr,
-      // 0x20 illegal cfa
-      nullptr,
-      // 0x21 illegal cfa
-      nullptr,
-      // 0x22 illegal cfa
-      nullptr,
-      // 0x23 illegal cfa
-      nullptr,
-      // 0x24 illegal cfa
-      nullptr,
-      // 0x25 illegal cfa
-      nullptr,
-      // 0x26 illegal cfa
-      nullptr,
-      // 0x27 illegal cfa
-      nullptr,
-      // 0x28 illegal cfa
-      nullptr,
-      // 0x29 illegal cfa
-      nullptr,
-      // 0x2a illegal cfa
-      nullptr,
-      // 0x2b illegal cfa
-      nullptr,
-      // 0x2c illegal cfa
-      nullptr,
-      // 0x2d DW_CFA_GNU_window_save (Treat this as illegal)
-      nullptr,
-      // 0x2e DW_CFA_GNU_args_size
-      &DwarfCfa::cfa_nop,
-      // 0x2f DW_CFA_GNU_negative_offset_extended
-      &DwarfCfa::cfa_gnu_negative_offset_extended,
-      // 0x30 illegal cfa
-      nullptr,
-      // 0x31 illegal cfa
-      nullptr,
-      // 0x32 illegal cfa
-      nullptr,
-      // 0x33 illegal cfa
-      nullptr,
-      // 0x34 illegal cfa
-      nullptr,
-      // 0x35 illegal cfa
-      nullptr,
-      // 0x36 illegal cfa
-      nullptr,
-      // 0x37 illegal cfa
-      nullptr,
-      // 0x38 illegal cfa
-      nullptr,
-      // 0x39 illegal cfa
-      nullptr,
-      // 0x3a illegal cfa
-      nullptr,
-      // 0x3b illegal cfa
-      nullptr,
-      // 0x3c illegal cfa
-      nullptr,
-      // 0x3d illegal cfa
-      nullptr,
-      // 0x3e illegal cfa
-      nullptr,
-      // 0x3f DW_CFA_hi_user (Treat this as illegal)
-      nullptr,
-  };
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_CFA_H
diff --git a/libunwindstack/DwarfDebugFrame.h b/libunwindstack/DwarfDebugFrame.h
deleted file mode 100644
index 635cefd..0000000
--- a/libunwindstack/DwarfDebugFrame.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_DEBUG_FRAME_H
-#define _LIBUNWINDSTACK_DWARF_DEBUG_FRAME_H
-
-#include <stdint.h>
-
-#include <vector>
-
-#include <unwindstack/DwarfSection.h>
-
-namespace unwindstack {
-
-template <typename AddressType>
-class DwarfDebugFrame : public DwarfSectionImpl<AddressType> {
- public:
-  DwarfDebugFrame(Memory* memory) : DwarfSectionImpl<AddressType>(memory) {
-    this->cie32_value_ = static_cast<uint32_t>(-1);
-    this->cie64_value_ = static_cast<uint64_t>(-1);
-  }
-  virtual ~DwarfDebugFrame() = default;
-
-  uint64_t GetCieOffsetFromFde32(uint32_t pointer) override {
-    return this->entries_offset_ + pointer;
-  }
-
-  uint64_t GetCieOffsetFromFde64(uint64_t pointer) override {
-    return this->entries_offset_ + pointer;
-  }
-
-  uint64_t AdjustPcFromFde(uint64_t pc) override { return pc; }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_DEBUG_FRAME_H
diff --git a/libunwindstack/DwarfEhFrame.h b/libunwindstack/DwarfEhFrame.h
deleted file mode 100644
index 7a41e45..0000000
--- a/libunwindstack/DwarfEhFrame.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_EH_FRAME_H
-#define _LIBUNWINDSTACK_DWARF_EH_FRAME_H
-
-#include <stdint.h>
-
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-template <typename AddressType>
-class DwarfEhFrame : public DwarfSectionImpl<AddressType> {
- public:
-  DwarfEhFrame(Memory* memory) : DwarfSectionImpl<AddressType>(memory) {}
-  virtual ~DwarfEhFrame() = default;
-
-  uint64_t GetCieOffsetFromFde32(uint32_t pointer) override {
-    return this->memory_.cur_offset() - pointer - 4;
-  }
-
-  uint64_t GetCieOffsetFromFde64(uint64_t pointer) override {
-    return this->memory_.cur_offset() - pointer - 8;
-  }
-
-  uint64_t AdjustPcFromFde(uint64_t pc) override {
-    // The eh_frame uses relative pcs.
-    return pc + this->memory_.cur_offset() - 4;
-  }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_EH_FRAME_H
diff --git a/libunwindstack/DwarfEhFrameWithHdr.cpp b/libunwindstack/DwarfEhFrameWithHdr.cpp
deleted file mode 100644
index 1358e51..0000000
--- a/libunwindstack/DwarfEhFrameWithHdr.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfStructs.h>
-#include <unwindstack/Memory.h>
-
-#include "Check.h"
-#include "DwarfEhFrameWithHdr.h"
-#include "DwarfEncoding.h"
-
-namespace unwindstack {
-
-static inline bool IsEncodingRelative(uint8_t encoding) {
-  encoding >>= 4;
-  return encoding > 0 && encoding <= DW_EH_PE_funcrel;
-}
-
-template <typename AddressType>
-bool DwarfEhFrameWithHdr<AddressType>::EhFrameInit(uint64_t offset, uint64_t size,
-                                                   int64_t section_bias) {
-  return DwarfSectionImpl<AddressType>::Init(offset, size, section_bias);
-}
-
-template <typename AddressType>
-bool DwarfEhFrameWithHdr<AddressType>::Init(uint64_t offset, uint64_t, int64_t section_bias) {
-  memory_.clear_func_offset();
-  memory_.clear_text_offset();
-  memory_.set_data_offset(offset);
-  memory_.set_cur_offset(offset);
-
-  hdr_section_bias_ = section_bias;
-
-  // Read the first four bytes all at once.
-  uint8_t data[4];
-  if (!memory_.ReadBytes(data, 4)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  version_ = data[0];
-  if (version_ != 1) {
-    // Unknown version.
-    last_error_.code = DWARF_ERROR_UNSUPPORTED_VERSION;
-    return false;
-  }
-
-  uint8_t ptr_encoding = data[1];
-  uint8_t fde_count_encoding = data[2];
-  table_encoding_ = data[3];
-  table_entry_size_ = memory_.template GetEncodedSize<AddressType>(table_encoding_);
-
-  // If we can't perform a binary search on the entries, it's not worth
-  // using this object. The calling code will fall back to the DwarfEhFrame
-  // object in this case.
-  if (table_entry_size_ == 0) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-
-  memory_.set_pc_offset(memory_.cur_offset());
-  uint64_t ptr_offset;
-  if (!memory_.template ReadEncodedValue<AddressType>(ptr_encoding, &ptr_offset)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  memory_.set_pc_offset(memory_.cur_offset());
-  if (!memory_.template ReadEncodedValue<AddressType>(fde_count_encoding, &fde_count_)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  if (fde_count_ == 0) {
-    last_error_.code = DWARF_ERROR_NO_FDES;
-    return false;
-  }
-
-  hdr_entries_offset_ = memory_.cur_offset();
-  hdr_entries_data_offset_ = offset;
-
-  return true;
-}
-
-template <typename AddressType>
-const DwarfFde* DwarfEhFrameWithHdr<AddressType>::GetFdeFromPc(uint64_t pc) {
-  uint64_t fde_offset;
-  if (!GetFdeOffsetFromPc(pc, &fde_offset)) {
-    return nullptr;
-  }
-  const DwarfFde* fde = this->GetFdeFromOffset(fde_offset);
-  if (fde == nullptr) {
-    return nullptr;
-  }
-
-  // There is a possibility that this entry points to a zero length FDE
-  // due to a bug. If this happens, try and find the non-zero length FDE
-  // from eh_frame directly. See b/142483624.
-  if (fde->pc_start == fde->pc_end) {
-    fde = DwarfSectionImpl<AddressType>::GetFdeFromPc(pc);
-    if (fde == nullptr) {
-      return nullptr;
-    }
-  }
-
-  // Guaranteed pc >= pc_start, need to check pc in the fde range.
-  if (pc < fde->pc_end) {
-    return fde;
-  }
-  last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-  return nullptr;
-}
-
-template <typename AddressType>
-const typename DwarfEhFrameWithHdr<AddressType>::FdeInfo*
-DwarfEhFrameWithHdr<AddressType>::GetFdeInfoFromIndex(size_t index) {
-  auto entry = fde_info_.find(index);
-  if (entry != fde_info_.end()) {
-    return &fde_info_[index];
-  }
-  FdeInfo* info = &fde_info_[index];
-
-  memory_.set_data_offset(hdr_entries_data_offset_);
-  memory_.set_cur_offset(hdr_entries_offset_ + 2 * index * table_entry_size_);
-  memory_.set_pc_offset(0);
-  uint64_t value;
-  if (!memory_.template ReadEncodedValue<AddressType>(table_encoding_, &value) ||
-      !memory_.template ReadEncodedValue<AddressType>(table_encoding_, &info->offset)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    fde_info_.erase(index);
-    return nullptr;
-  }
-
-  // Relative encodings require adding in the load bias.
-  if (IsEncodingRelative(table_encoding_)) {
-    value += hdr_section_bias_;
-  }
-  info->pc = value;
-  return info;
-}
-
-template <typename AddressType>
-bool DwarfEhFrameWithHdr<AddressType>::GetFdeOffsetFromPc(uint64_t pc, uint64_t* fde_offset) {
-  if (fde_count_ == 0) {
-    return false;
-  }
-
-  size_t first = 0;
-  size_t last = fde_count_;
-  while (first < last) {
-    size_t current = (first + last) / 2;
-    const FdeInfo* info = GetFdeInfoFromIndex(current);
-    if (info == nullptr) {
-      return false;
-    }
-    if (pc == info->pc) {
-      *fde_offset = info->offset;
-      return true;
-    }
-    if (pc < info->pc) {
-      last = current;
-    } else {
-      first = current + 1;
-    }
-  }
-  if (last != 0) {
-    const FdeInfo* info = GetFdeInfoFromIndex(last - 1);
-    if (info == nullptr) {
-      return false;
-    }
-    *fde_offset = info->offset;
-    return true;
-  }
-  return false;
-}
-
-template <typename AddressType>
-void DwarfEhFrameWithHdr<AddressType>::GetFdes(std::vector<const DwarfFde*>* fdes) {
-  for (size_t i = 0; i < fde_count_; i++) {
-    const FdeInfo* info = GetFdeInfoFromIndex(i);
-    if (info == nullptr) {
-      break;
-    }
-    const DwarfFde* fde = this->GetFdeFromOffset(info->offset);
-    if (fde == nullptr) {
-      break;
-    }
-
-    // There is a possibility that this entry points to a zero length FDE
-    // due to a bug. If this happens, try and find the non-zero length FDE
-    // from eh_frame directly. See b/142483624.
-    if (fde->pc_start == fde->pc_end) {
-      const DwarfFde* fde_real = DwarfSectionImpl<AddressType>::GetFdeFromPc(fde->pc_start);
-      if (fde_real != nullptr) {
-        fde = fde_real;
-      }
-    }
-    fdes->push_back(fde);
-  }
-}
-
-// Explicitly instantiate DwarfEhFrameWithHdr
-template class DwarfEhFrameWithHdr<uint32_t>;
-template class DwarfEhFrameWithHdr<uint64_t>;
-
-}  // namespace unwindstack
diff --git a/libunwindstack/DwarfEhFrameWithHdr.h b/libunwindstack/DwarfEhFrameWithHdr.h
deleted file mode 100644
index f7c010c..0000000
--- a/libunwindstack/DwarfEhFrameWithHdr.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_EH_FRAME_WITH_HDR_H
-#define _LIBUNWINDSTACK_DWARF_EH_FRAME_WITH_HDR_H
-
-#include <stdint.h>
-
-#include <unordered_map>
-
-#include <unwindstack/DwarfSection.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-
-template <typename AddressType>
-class DwarfEhFrameWithHdr : public DwarfSectionImpl<AddressType> {
- public:
-  // Add these so that the protected members of DwarfSectionImpl
-  // can be accessed without needing a this->.
-  using DwarfSectionImpl<AddressType>::memory_;
-  using DwarfSectionImpl<AddressType>::last_error_;
-
-  struct FdeInfo {
-    AddressType pc;
-    uint64_t offset;
-  };
-
-  DwarfEhFrameWithHdr(Memory* memory) : DwarfSectionImpl<AddressType>(memory) {}
-  virtual ~DwarfEhFrameWithHdr() = default;
-
-  uint64_t GetCieOffsetFromFde32(uint32_t pointer) override {
-    return memory_.cur_offset() - pointer - 4;
-  }
-
-  uint64_t GetCieOffsetFromFde64(uint64_t pointer) override {
-    return memory_.cur_offset() - pointer - 8;
-  }
-
-  uint64_t AdjustPcFromFde(uint64_t pc) override {
-    // The eh_frame uses relative pcs.
-    return pc + memory_.cur_offset() - 4;
-  }
-
-  bool EhFrameInit(uint64_t offset, uint64_t size, int64_t section_bias);
-  bool Init(uint64_t offset, uint64_t size, int64_t section_bias) override;
-
-  const DwarfFde* GetFdeFromPc(uint64_t pc) override;
-
-  bool GetFdeOffsetFromPc(uint64_t pc, uint64_t* fde_offset);
-
-  const FdeInfo* GetFdeInfoFromIndex(size_t index);
-
-  void GetFdes(std::vector<const DwarfFde*>* fdes) override;
-
- protected:
-  uint8_t version_ = 0;
-  uint8_t table_encoding_ = 0;
-  size_t table_entry_size_ = 0;
-
-  uint64_t hdr_entries_offset_ = 0;
-  uint64_t hdr_entries_data_offset_ = 0;
-  uint64_t hdr_section_bias_ = 0;
-
-  uint64_t fde_count_ = 0;
-  std::unordered_map<uint64_t, FdeInfo> fde_info_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_EH_FRAME_WITH_HDR_H
diff --git a/libunwindstack/DwarfEncoding.h b/libunwindstack/DwarfEncoding.h
deleted file mode 100644
index 20db222..0000000
--- a/libunwindstack/DwarfEncoding.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_ENCODING_H
-#define _LIBUNWINDSTACK_DWARF_ENCODING_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum DwarfEncoding : uint8_t {
-  DW_EH_PE_omit = 0xff,
-
-  DW_EH_PE_absptr = 0x00,
-  DW_EH_PE_uleb128 = 0x01,
-  DW_EH_PE_udata2 = 0x02,
-  DW_EH_PE_udata4 = 0x03,
-  DW_EH_PE_udata8 = 0x04,
-  DW_EH_PE_sleb128 = 0x09,
-  DW_EH_PE_sdata2 = 0x0a,
-  DW_EH_PE_sdata4 = 0x0b,
-  DW_EH_PE_sdata8 = 0x0c,
-
-  DW_EH_PE_pcrel = 0x10,
-  DW_EH_PE_textrel = 0x20,
-  DW_EH_PE_datarel = 0x30,
-  DW_EH_PE_funcrel = 0x40,
-  DW_EH_PE_aligned = 0x50,
-
-  // The following are special values used to encode CFA and OP operands.
-  DW_EH_PE_udata1 = 0x0d,
-  DW_EH_PE_sdata1 = 0x0e,
-  DW_EH_PE_block = 0x0f,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_ENCODING_H
diff --git a/libunwindstack/DwarfMemory.cpp b/libunwindstack/DwarfMemory.cpp
deleted file mode 100644
index 2e388c6..0000000
--- a/libunwindstack/DwarfMemory.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <string>
-
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/Memory.h>
-
-#include "Check.h"
-#include "DwarfEncoding.h"
-
-namespace unwindstack {
-
-bool DwarfMemory::ReadBytes(void* dst, size_t num_bytes) {
-  if (!memory_->ReadFully(cur_offset_, dst, num_bytes)) {
-    return false;
-  }
-  cur_offset_ += num_bytes;
-  return true;
-}
-
-template <typename SignedType>
-bool DwarfMemory::ReadSigned(uint64_t* value) {
-  SignedType signed_value;
-  if (!ReadBytes(&signed_value, sizeof(SignedType))) {
-    return false;
-  }
-  *value = static_cast<int64_t>(signed_value);
-  return true;
-}
-
-bool DwarfMemory::ReadULEB128(uint64_t* value) {
-  uint64_t cur_value = 0;
-  uint64_t shift = 0;
-  uint8_t byte;
-  do {
-    if (!ReadBytes(&byte, 1)) {
-      return false;
-    }
-    cur_value += static_cast<uint64_t>(byte & 0x7f) << shift;
-    shift += 7;
-  } while (byte & 0x80);
-  *value = cur_value;
-  return true;
-}
-
-bool DwarfMemory::ReadSLEB128(int64_t* value) {
-  uint64_t cur_value = 0;
-  uint64_t shift = 0;
-  uint8_t byte;
-  do {
-    if (!ReadBytes(&byte, 1)) {
-      return false;
-    }
-    cur_value += static_cast<uint64_t>(byte & 0x7f) << shift;
-    shift += 7;
-  } while (byte & 0x80);
-  if (byte & 0x40) {
-    // Negative value, need to sign extend.
-    cur_value |= static_cast<uint64_t>(-1) << shift;
-  }
-  *value = static_cast<int64_t>(cur_value);
-  return true;
-}
-
-template <typename AddressType>
-size_t DwarfMemory::GetEncodedSize(uint8_t encoding) {
-  switch (encoding & 0x0f) {
-    case DW_EH_PE_absptr:
-      return sizeof(AddressType);
-    case DW_EH_PE_udata1:
-    case DW_EH_PE_sdata1:
-      return 1;
-    case DW_EH_PE_udata2:
-    case DW_EH_PE_sdata2:
-      return 2;
-    case DW_EH_PE_udata4:
-    case DW_EH_PE_sdata4:
-      return 4;
-    case DW_EH_PE_udata8:
-    case DW_EH_PE_sdata8:
-      return 8;
-    case DW_EH_PE_uleb128:
-    case DW_EH_PE_sleb128:
-    default:
-      return 0;
-  }
-}
-
-bool DwarfMemory::AdjustEncodedValue(uint8_t encoding, uint64_t* value) {
-  CHECK((encoding & 0x0f) == 0);
-
-  // Handle the encoding.
-  switch (encoding) {
-    case DW_EH_PE_absptr:
-      // Nothing to do.
-      break;
-    case DW_EH_PE_pcrel:
-      if (pc_offset_ == INT64_MAX) {
-        // Unsupported encoding.
-        return false;
-      }
-      *value += pc_offset_;
-      break;
-    case DW_EH_PE_textrel:
-      if (text_offset_ == static_cast<uint64_t>(-1)) {
-        // Unsupported encoding.
-        return false;
-      }
-      *value += text_offset_;
-      break;
-    case DW_EH_PE_datarel:
-      if (data_offset_ == static_cast<uint64_t>(-1)) {
-        // Unsupported encoding.
-        return false;
-      }
-      *value += data_offset_;
-      break;
-    case DW_EH_PE_funcrel:
-      if (func_offset_ == static_cast<uint64_t>(-1)) {
-        // Unsupported encoding.
-        return false;
-      }
-      *value += func_offset_;
-      break;
-    default:
-      return false;
-  }
-
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfMemory::ReadEncodedValue(uint8_t encoding, uint64_t* value) {
-  if (encoding == DW_EH_PE_omit) {
-    *value = 0;
-    return true;
-  } else if (encoding == DW_EH_PE_aligned) {
-    if (__builtin_add_overflow(cur_offset_, sizeof(AddressType) - 1, &cur_offset_)) {
-      return false;
-    }
-    cur_offset_ &= -sizeof(AddressType);
-
-    if (sizeof(AddressType) != sizeof(uint64_t)) {
-      *value = 0;
-    }
-    return ReadBytes(value, sizeof(AddressType));
-  }
-
-  // Get the data.
-  switch (encoding & 0x0f) {
-    case DW_EH_PE_absptr:
-      if (sizeof(AddressType) != sizeof(uint64_t)) {
-        *value = 0;
-      }
-      if (!ReadBytes(value, sizeof(AddressType))) {
-        return false;
-      }
-      break;
-    case DW_EH_PE_uleb128:
-      if (!ReadULEB128(value)) {
-        return false;
-      }
-      break;
-    case DW_EH_PE_sleb128:
-      int64_t signed_value;
-      if (!ReadSLEB128(&signed_value)) {
-        return false;
-      }
-      *value = static_cast<uint64_t>(signed_value);
-      break;
-    case DW_EH_PE_udata1: {
-      uint8_t value8;
-      if (!ReadBytes(&value8, 1)) {
-        return false;
-      }
-      *value = value8;
-    } break;
-    case DW_EH_PE_sdata1:
-      if (!ReadSigned<int8_t>(value)) {
-        return false;
-      }
-      break;
-    case DW_EH_PE_udata2: {
-      uint16_t value16;
-      if (!ReadBytes(&value16, 2)) {
-        return false;
-      }
-      *value = value16;
-    } break;
-    case DW_EH_PE_sdata2:
-      if (!ReadSigned<int16_t>(value)) {
-        return false;
-      }
-      break;
-    case DW_EH_PE_udata4: {
-      uint32_t value32;
-      if (!ReadBytes(&value32, 4)) {
-        return false;
-      }
-      *value = value32;
-    } break;
-    case DW_EH_PE_sdata4:
-      if (!ReadSigned<int32_t>(value)) {
-        return false;
-      }
-      break;
-    case DW_EH_PE_udata8:
-      if (!ReadBytes(value, sizeof(uint64_t))) {
-        return false;
-      }
-      break;
-    case DW_EH_PE_sdata8:
-      if (!ReadSigned<int64_t>(value)) {
-        return false;
-      }
-      break;
-    default:
-      return false;
-  }
-
-  return AdjustEncodedValue(encoding & 0x70, value);
-}
-
-// Instantiate all of the needed template functions.
-template bool DwarfMemory::ReadSigned<int8_t>(uint64_t*);
-template bool DwarfMemory::ReadSigned<int16_t>(uint64_t*);
-template bool DwarfMemory::ReadSigned<int32_t>(uint64_t*);
-template bool DwarfMemory::ReadSigned<int64_t>(uint64_t*);
-
-template size_t DwarfMemory::GetEncodedSize<uint32_t>(uint8_t);
-template size_t DwarfMemory::GetEncodedSize<uint64_t>(uint8_t);
-
-template bool DwarfMemory::ReadEncodedValue<uint32_t>(uint8_t, uint64_t*);
-template bool DwarfMemory::ReadEncodedValue<uint64_t>(uint8_t, uint64_t*);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/DwarfOp.cpp b/libunwindstack/DwarfOp.cpp
deleted file mode 100644
index 393eb3e..0000000
--- a/libunwindstack/DwarfOp.cpp
+++ /dev/null
@@ -1,1941 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <deque>
-#include <string>
-#include <vector>
-
-#include <android-base/stringprintf.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-#include "DwarfOp.h"
-
-namespace unwindstack {
-
-enum DwarfOpHandleFunc : uint8_t {
-  OP_ILLEGAL = 0,
-  OP_DEREF,
-  OP_DEREF_SIZE,
-  OP_PUSH,
-  OP_DUP,
-  OP_DROP,
-  OP_OVER,
-  OP_PICK,
-  OP_SWAP,
-  OP_ROT,
-  OP_ABS,
-  OP_AND,
-  OP_DIV,
-  OP_MINUS,
-  OP_MOD,
-  OP_MUL,
-  OP_NEG,
-  OP_NOT,
-  OP_OR,
-  OP_PLUS,
-  OP_PLUS_UCONST,
-  OP_SHL,
-  OP_SHR,
-  OP_SHRA,
-  OP_XOR,
-  OP_BRA,
-  OP_EQ,
-  OP_GE,
-  OP_GT,
-  OP_LE,
-  OP_LT,
-  OP_NE,
-  OP_SKIP,
-  OP_LIT,
-  OP_REG,
-  OP_REGX,
-  OP_BREG,
-  OP_BREGX,
-  OP_NOP,
-  OP_NOT_IMPLEMENTED,
-};
-
-struct OpCallback {
-  // It may seem tempting to "clean this up" by replacing "const char[26]" with
-  // "const char*", but doing so would place the entire callback table in
-  // .data.rel.ro section, instead of .rodata section, and thus increase
-  // dirty memory usage.  Libunwindstack is used by the linker and therefore
-  // loaded for every running process, so every bit of memory counts.
-  // Unlike C standard, C++ standard guarantees this array is big enough to
-  // store the names, or else we would get a compilation error.
-  const char name[26];
-
-  // Similarily for this field, we do NOT want to directly store function
-  // pointers here. Not only would that cause the callback table to be placed
-  // in .data.rel.ro section, but it would be duplicated for each AddressType.
-  // Instead, we use DwarfOpHandleFunc enum to decouple the callback table from
-  // the function pointers.
-  DwarfOpHandleFunc handle_func;
-
-  uint8_t num_required_stack_values;
-  uint8_t num_operands;
-  uint8_t operands[2];
-};
-
-constexpr static OpCallback kCallbackTable[256] = {
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0x00 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0x01 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0x02 illegal op
-    {
-        // 0x03 DW_OP_addr
-        "DW_OP_addr",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_absptr},
-    },
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0x04 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0x05 illegal op
-    {
-        // 0x06 DW_OP_deref
-        "DW_OP_deref",
-        OP_DEREF,
-        1,
-        0,
-        {},
-    },
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0x07 illegal op
-    {
-        // 0x08 DW_OP_const1u
-        "DW_OP_const1u",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_udata1},
-    },
-    {
-        // 0x09 DW_OP_const1s
-        "DW_OP_const1s",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_sdata1},
-    },
-    {
-        // 0x0a DW_OP_const2u
-        "DW_OP_const2u",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_udata2},
-    },
-    {
-        // 0x0b DW_OP_const2s
-        "DW_OP_const2s",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_sdata2},
-    },
-    {
-        // 0x0c DW_OP_const4u
-        "DW_OP_const4u",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_udata4},
-    },
-    {
-        // 0x0d DW_OP_const4s
-        "DW_OP_const4s",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_sdata4},
-    },
-    {
-        // 0x0e DW_OP_const8u
-        "DW_OP_const8u",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_udata8},
-    },
-    {
-        // 0x0f DW_OP_const8s
-        "DW_OP_const8s",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_sdata8},
-    },
-    {
-        // 0x10 DW_OP_constu
-        "DW_OP_constu",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_uleb128},
-    },
-    {
-        // 0x11 DW_OP_consts
-        "DW_OP_consts",
-        OP_PUSH,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x12 DW_OP_dup
-        "DW_OP_dup",
-        OP_DUP,
-        1,
-        0,
-        {},
-    },
-    {
-        // 0x13 DW_OP_drop
-        "DW_OP_drop",
-        OP_DROP,
-        1,
-        0,
-        {},
-    },
-    {
-        // 0x14 DW_OP_over
-        "DW_OP_over",
-        OP_OVER,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x15 DW_OP_pick
-        "DW_OP_pick",
-        OP_PICK,
-        0,
-        1,
-        {DW_EH_PE_udata1},
-    },
-    {
-        // 0x16 DW_OP_swap
-        "DW_OP_swap",
-        OP_SWAP,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x17 DW_OP_rot
-        "DW_OP_rot",
-        OP_ROT,
-        3,
-        0,
-        {},
-    },
-    {
-        // 0x18 DW_OP_xderef
-        "DW_OP_xderef",
-        OP_NOT_IMPLEMENTED,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x19 DW_OP_abs
-        "DW_OP_abs",
-        OP_ABS,
-        1,
-        0,
-        {},
-    },
-    {
-        // 0x1a DW_OP_and
-        "DW_OP_and",
-        OP_AND,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x1b DW_OP_div
-        "DW_OP_div",
-        OP_DIV,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x1c DW_OP_minus
-        "DW_OP_minus",
-        OP_MINUS,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x1d DW_OP_mod
-        "DW_OP_mod",
-        OP_MOD,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x1e DW_OP_mul
-        "DW_OP_mul",
-        OP_MUL,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x1f DW_OP_neg
-        "DW_OP_neg",
-        OP_NEG,
-        1,
-        0,
-        {},
-    },
-    {
-        // 0x20 DW_OP_not
-        "DW_OP_not",
-        OP_NOT,
-        1,
-        0,
-        {},
-    },
-    {
-        // 0x21 DW_OP_or
-        "DW_OP_or",
-        OP_OR,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x22 DW_OP_plus
-        "DW_OP_plus",
-        OP_PLUS,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x23 DW_OP_plus_uconst
-        "DW_OP_plus_uconst",
-        OP_PLUS_UCONST,
-        1,
-        1,
-        {DW_EH_PE_uleb128},
-    },
-    {
-        // 0x24 DW_OP_shl
-        "DW_OP_shl",
-        OP_SHL,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x25 DW_OP_shr
-        "DW_OP_shr",
-        OP_SHR,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x26 DW_OP_shra
-        "DW_OP_shra",
-        OP_SHRA,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x27 DW_OP_xor
-        "DW_OP_xor",
-        OP_XOR,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x28 DW_OP_bra
-        "DW_OP_bra",
-        OP_BRA,
-        1,
-        1,
-        {DW_EH_PE_sdata2},
-    },
-    {
-        // 0x29 DW_OP_eq
-        "DW_OP_eq",
-        OP_EQ,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x2a DW_OP_ge
-        "DW_OP_ge",
-        OP_GE,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x2b DW_OP_gt
-        "DW_OP_gt",
-        OP_GT,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x2c DW_OP_le
-        "DW_OP_le",
-        OP_LE,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x2d DW_OP_lt
-        "DW_OP_lt",
-        OP_LT,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x2e DW_OP_ne
-        "DW_OP_ne",
-        OP_NE,
-        2,
-        0,
-        {},
-    },
-    {
-        // 0x2f DW_OP_skip
-        "DW_OP_skip",
-        OP_SKIP,
-        0,
-        1,
-        {DW_EH_PE_sdata2},
-    },
-    {
-        // 0x30 DW_OP_lit0
-        "DW_OP_lit0",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x31 DW_OP_lit1
-        "DW_OP_lit1",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x32 DW_OP_lit2
-        "DW_OP_lit2",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x33 DW_OP_lit3
-        "DW_OP_lit3",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x34 DW_OP_lit4
-        "DW_OP_lit4",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x35 DW_OP_lit5
-        "DW_OP_lit5",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x36 DW_OP_lit6
-        "DW_OP_lit6",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x37 DW_OP_lit7
-        "DW_OP_lit7",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x38 DW_OP_lit8
-        "DW_OP_lit8",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x39 DW_OP_lit9
-        "DW_OP_lit9",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x3a DW_OP_lit10
-        "DW_OP_lit10",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x3b DW_OP_lit11
-        "DW_OP_lit11",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x3c DW_OP_lit12
-        "DW_OP_lit12",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x3d DW_OP_lit13
-        "DW_OP_lit13",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x3e DW_OP_lit14
-        "DW_OP_lit14",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x3f DW_OP_lit15
-        "DW_OP_lit15",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x40 DW_OP_lit16
-        "DW_OP_lit16",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x41 DW_OP_lit17
-        "DW_OP_lit17",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x42 DW_OP_lit18
-        "DW_OP_lit18",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x43 DW_OP_lit19
-        "DW_OP_lit19",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x44 DW_OP_lit20
-        "DW_OP_lit20",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x45 DW_OP_lit21
-        "DW_OP_lit21",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x46 DW_OP_lit22
-        "DW_OP_lit22",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x47 DW_OP_lit23
-        "DW_OP_lit23",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x48 DW_OP_lit24
-        "DW_OP_lit24",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x49 DW_OP_lit25
-        "DW_OP_lit25",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x4a DW_OP_lit26
-        "DW_OP_lit26",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x4b DW_OP_lit27
-        "DW_OP_lit27",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x4c DW_OP_lit28
-        "DW_OP_lit28",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x4d DW_OP_lit29
-        "DW_OP_lit29",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x4e DW_OP_lit30
-        "DW_OP_lit30",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x4f DW_OP_lit31
-        "DW_OP_lit31",
-        OP_LIT,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x50 DW_OP_reg0
-        "DW_OP_reg0",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x51 DW_OP_reg1
-        "DW_OP_reg1",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x52 DW_OP_reg2
-        "DW_OP_reg2",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x53 DW_OP_reg3
-        "DW_OP_reg3",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x54 DW_OP_reg4
-        "DW_OP_reg4",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x55 DW_OP_reg5
-        "DW_OP_reg5",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x56 DW_OP_reg6
-        "DW_OP_reg6",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x57 DW_OP_reg7
-        "DW_OP_reg7",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x58 DW_OP_reg8
-        "DW_OP_reg8",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x59 DW_OP_reg9
-        "DW_OP_reg9",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x5a DW_OP_reg10
-        "DW_OP_reg10",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x5b DW_OP_reg11
-        "DW_OP_reg11",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x5c DW_OP_reg12
-        "DW_OP_reg12",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x5d DW_OP_reg13
-        "DW_OP_reg13",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x5e DW_OP_reg14
-        "DW_OP_reg14",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x5f DW_OP_reg15
-        "DW_OP_reg15",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x60 DW_OP_reg16
-        "DW_OP_reg16",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x61 DW_OP_reg17
-        "DW_OP_reg17",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x62 DW_OP_reg18
-        "DW_OP_reg18",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x63 DW_OP_reg19
-        "DW_OP_reg19",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x64 DW_OP_reg20
-        "DW_OP_reg20",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x65 DW_OP_reg21
-        "DW_OP_reg21",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x66 DW_OP_reg22
-        "DW_OP_reg22",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x67 DW_OP_reg23
-        "DW_OP_reg23",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x68 DW_OP_reg24
-        "DW_OP_reg24",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x69 DW_OP_reg25
-        "DW_OP_reg25",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x6a DW_OP_reg26
-        "DW_OP_reg26",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x6b DW_OP_reg27
-        "DW_OP_reg27",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x6c DW_OP_reg28
-        "DW_OP_reg28",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x6d DW_OP_reg29
-        "DW_OP_reg29",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x6e DW_OP_reg30
-        "DW_OP_reg30",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x6f DW_OP_reg31
-        "DW_OP_reg31",
-        OP_REG,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x70 DW_OP_breg0
-        "DW_OP_breg0",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x71 DW_OP_breg1
-        "DW_OP_breg1",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x72 DW_OP_breg2
-        "DW_OP_breg2",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x73 DW_OP_breg3
-        "DW_OP_breg3",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x74 DW_OP_breg4
-        "DW_OP_breg4",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x75 DW_OP_breg5
-        "DW_OP_breg5",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x76 DW_OP_breg6
-        "DW_OP_breg6",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x77 DW_OP_breg7
-        "DW_OP_breg7",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x78 DW_OP_breg8
-        "DW_OP_breg8",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x79 DW_OP_breg9
-        "DW_OP_breg9",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x7a DW_OP_breg10
-        "DW_OP_breg10",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x7b DW_OP_breg11
-        "DW_OP_breg11",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x7c DW_OP_breg12
-        "DW_OP_breg12",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x7d DW_OP_breg13
-        "DW_OP_breg13",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x7e DW_OP_breg14
-        "DW_OP_breg14",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x7f DW_OP_breg15
-        "DW_OP_breg15",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x80 DW_OP_breg16
-        "DW_OP_breg16",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x81 DW_OP_breg17
-        "DW_OP_breg17",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x82 DW_OP_breg18
-        "DW_OP_breg18",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x83 DW_OP_breg19
-        "DW_OP_breg19",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x84 DW_OP_breg20
-        "DW_OP_breg20",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x85 DW_OP_breg21
-        "DW_OP_breg21",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x86 DW_OP_breg22
-        "DW_OP_breg22",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x87 DW_OP_breg23
-        "DW_OP_breg23",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x88 DW_OP_breg24
-        "DW_OP_breg24",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x89 DW_OP_breg25
-        "DW_OP_breg25",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x8a DW_OP_breg26
-        "DW_OP_breg26",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x8b DW_OP_breg27
-        "DW_OP_breg27",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x8c DW_OP_breg28
-        "DW_OP_breg28",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x8d DW_OP_breg29
-        "DW_OP_breg29",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x8e DW_OP_breg30
-        "DW_OP_breg30",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x8f DW_OP_breg31
-        "DW_OP_breg31",
-        OP_BREG,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x90 DW_OP_regx
-        "DW_OP_regx",
-        OP_REGX,
-        0,
-        1,
-        {DW_EH_PE_uleb128},
-    },
-    {
-        // 0x91 DW_OP_fbreg
-        "DW_OP_fbreg",
-        OP_NOT_IMPLEMENTED,
-        0,
-        1,
-        {DW_EH_PE_sleb128},
-    },
-    {
-        // 0x92 DW_OP_bregx
-        "DW_OP_bregx",
-        OP_BREGX,
-        0,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_sleb128},
-    },
-    {
-        // 0x93 DW_OP_piece
-        "DW_OP_piece",
-        OP_NOT_IMPLEMENTED,
-        0,
-        1,
-        {DW_EH_PE_uleb128},
-    },
-    {
-        // 0x94 DW_OP_deref_size
-        "DW_OP_deref_size",
-        OP_DEREF_SIZE,
-        1,
-        1,
-        {DW_EH_PE_udata1},
-    },
-    {
-        // 0x95 DW_OP_xderef_size
-        "DW_OP_xderef_size",
-        OP_NOT_IMPLEMENTED,
-        0,
-        1,
-        {DW_EH_PE_udata1},
-    },
-    {
-        // 0x96 DW_OP_nop
-        "DW_OP_nop",
-        OP_NOP,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x97 DW_OP_push_object_address
-        "DW_OP_push_object_address",
-        OP_NOT_IMPLEMENTED,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x98 DW_OP_call2
-        "DW_OP_call2",
-        OP_NOT_IMPLEMENTED,
-        0,
-        1,
-        {DW_EH_PE_udata2},
-    },
-    {
-        // 0x99 DW_OP_call4
-        "DW_OP_call4",
-        OP_NOT_IMPLEMENTED,
-        0,
-        1,
-        {DW_EH_PE_udata4},
-    },
-    {
-        // 0x9a DW_OP_call_ref
-        "DW_OP_call_ref",
-        OP_NOT_IMPLEMENTED,
-        0,
-        0,  // Has a different sized operand (4 bytes or 8 bytes).
-        {},
-    },
-    {
-        // 0x9b DW_OP_form_tls_address
-        "DW_OP_form_tls_address",
-        OP_NOT_IMPLEMENTED,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x9c DW_OP_call_frame_cfa
-        "DW_OP_call_frame_cfa",
-        OP_NOT_IMPLEMENTED,
-        0,
-        0,
-        {},
-    },
-    {
-        // 0x9d DW_OP_bit_piece
-        "DW_OP_bit_piece",
-        OP_NOT_IMPLEMENTED,
-        0,
-        2,
-        {DW_EH_PE_uleb128, DW_EH_PE_uleb128},
-    },
-    {
-        // 0x9e DW_OP_implicit_value
-        "DW_OP_implicit_value",
-        OP_NOT_IMPLEMENTED,
-        0,
-        1,
-        {DW_EH_PE_uleb128},
-    },
-    {
-        // 0x9f DW_OP_stack_value
-        "DW_OP_stack_value",
-        OP_NOT_IMPLEMENTED,
-        1,
-        0,
-        {},
-    },
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa0 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa1 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa2 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa3 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa4 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa5 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa6 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa7 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa8 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xa9 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xaa illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xab illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xac illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xad illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xae illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xaf illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb0 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb1 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb2 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb3 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb4 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb5 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb6 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb7 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb8 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xb9 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xba illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xbb illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xbc illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xbd illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xbe illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xbf illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc0 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc1 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc2 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc3 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc4 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc5 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc6 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc7 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc8 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xc9 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xca illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xcb illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xcc illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xcd illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xce illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xcf illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd0 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd1 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd2 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd3 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd4 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd5 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd6 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd7 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd8 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xd9 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xda illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xdb illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xdc illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xdd illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xde illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xdf illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe0 DW_OP_lo_user
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe1 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe2 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe3 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe4 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe5 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe6 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe7 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe8 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xe9 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xea illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xeb illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xec illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xed illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xee illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xef illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf0 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf1 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf2 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf3 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf4 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf5 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf6 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf7 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf8 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xf9 illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xfa illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xfb illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xfc illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xfd illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xfe illegal op
-    {"", OP_ILLEGAL, 0, 0, {}},  // 0xff DW_OP_hi_user
-};
-
-template <typename AddressType>
-const typename DwarfOp<AddressType>::OpHandleFuncPtr DwarfOp<AddressType>::kOpHandleFuncList[] = {
-    [OP_ILLEGAL] = nullptr,
-    [OP_DEREF] = &DwarfOp<AddressType>::op_deref,
-    [OP_DEREF_SIZE] = &DwarfOp<AddressType>::op_deref_size,
-    [OP_PUSH] = &DwarfOp<AddressType>::op_push,
-    [OP_DUP] = &DwarfOp<AddressType>::op_dup,
-    [OP_DROP] = &DwarfOp<AddressType>::op_drop,
-    [OP_OVER] = &DwarfOp<AddressType>::op_over,
-    [OP_PICK] = &DwarfOp<AddressType>::op_pick,
-    [OP_SWAP] = &DwarfOp<AddressType>::op_swap,
-    [OP_ROT] = &DwarfOp<AddressType>::op_rot,
-    [OP_ABS] = &DwarfOp<AddressType>::op_abs,
-    [OP_AND] = &DwarfOp<AddressType>::op_and,
-    [OP_DIV] = &DwarfOp<AddressType>::op_div,
-    [OP_MINUS] = &DwarfOp<AddressType>::op_minus,
-    [OP_MOD] = &DwarfOp<AddressType>::op_mod,
-    [OP_MUL] = &DwarfOp<AddressType>::op_mul,
-    [OP_NEG] = &DwarfOp<AddressType>::op_neg,
-    [OP_NOT] = &DwarfOp<AddressType>::op_not,
-    [OP_OR] = &DwarfOp<AddressType>::op_or,
-    [OP_PLUS] = &DwarfOp<AddressType>::op_plus,
-    [OP_PLUS_UCONST] = &DwarfOp<AddressType>::op_plus_uconst,
-    [OP_SHL] = &DwarfOp<AddressType>::op_shl,
-    [OP_SHR] = &DwarfOp<AddressType>::op_shr,
-    [OP_SHRA] = &DwarfOp<AddressType>::op_shra,
-    [OP_XOR] = &DwarfOp<AddressType>::op_xor,
-    [OP_BRA] = &DwarfOp<AddressType>::op_bra,
-    [OP_EQ] = &DwarfOp<AddressType>::op_eq,
-    [OP_GE] = &DwarfOp<AddressType>::op_ge,
-    [OP_GT] = &DwarfOp<AddressType>::op_gt,
-    [OP_LE] = &DwarfOp<AddressType>::op_le,
-    [OP_LT] = &DwarfOp<AddressType>::op_lt,
-    [OP_NE] = &DwarfOp<AddressType>::op_ne,
-    [OP_SKIP] = &DwarfOp<AddressType>::op_skip,
-    [OP_LIT] = &DwarfOp<AddressType>::op_lit,
-    [OP_REG] = &DwarfOp<AddressType>::op_reg,
-    [OP_REGX] = &DwarfOp<AddressType>::op_regx,
-    [OP_BREG] = &DwarfOp<AddressType>::op_breg,
-    [OP_BREGX] = &DwarfOp<AddressType>::op_bregx,
-    [OP_NOP] = &DwarfOp<AddressType>::op_nop,
-    [OP_NOT_IMPLEMENTED] = &DwarfOp<AddressType>::op_not_implemented,
-};
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::Eval(uint64_t start, uint64_t end) {
-  is_register_ = false;
-  stack_.clear();
-  memory_->set_cur_offset(start);
-  dex_pc_set_ = false;
-
-  // Unroll the first Decode calls to be able to check for a special
-  // sequence of ops and values that indicate this is the dex pc.
-  // The pattern is:
-  //   OP_const4u (0x0c)  'D' 'E' 'X' '1'
-  //   OP_drop (0x13)
-  if (memory_->cur_offset() < end) {
-    if (!Decode()) {
-      return false;
-    }
-  } else {
-    return true;
-  }
-  bool check_for_drop;
-  if (cur_op_ == 0x0c && operands_.back() == 0x31584544) {
-    check_for_drop = true;
-  } else {
-    check_for_drop = false;
-  }
-  if (memory_->cur_offset() < end) {
-    if (!Decode()) {
-      return false;
-    }
-  } else {
-    return true;
-  }
-
-  if (check_for_drop && cur_op_ == 0x13) {
-    dex_pc_set_ = true;
-  }
-
-  uint32_t iterations = 2;
-  while (memory_->cur_offset() < end) {
-    if (!Decode()) {
-      return false;
-    }
-    // To protect against a branch that creates an infinite loop,
-    // terminate if the number of iterations gets too high.
-    if (iterations++ == 1000) {
-      last_error_.code = DWARF_ERROR_TOO_MANY_ITERATIONS;
-      return false;
-    }
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::Decode() {
-  last_error_.code = DWARF_ERROR_NONE;
-  if (!memory_->ReadBytes(&cur_op_, 1)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_->cur_offset();
-    return false;
-  }
-
-  const auto* op = &kCallbackTable[cur_op_];
-  if (op->handle_func == OP_ILLEGAL) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-
-  const auto handle_func = kOpHandleFuncList[op->handle_func];
-
-  // Make sure that the required number of stack elements is available.
-  if (stack_.size() < op->num_required_stack_values) {
-    last_error_.code = DWARF_ERROR_STACK_INDEX_NOT_VALID;
-    return false;
-  }
-
-  operands_.clear();
-  for (size_t i = 0; i < op->num_operands; i++) {
-    uint64_t value;
-    if (!memory_->ReadEncodedValue<AddressType>(op->operands[i], &value)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_->cur_offset();
-      return false;
-    }
-    operands_.push_back(value);
-  }
-  return (this->*handle_func)();
-}
-
-template <typename AddressType>
-void DwarfOp<AddressType>::GetLogInfo(uint64_t start, uint64_t end,
-                                      std::vector<std::string>* lines) {
-  memory_->set_cur_offset(start);
-  while (memory_->cur_offset() < end) {
-    uint8_t cur_op;
-    if (!memory_->ReadBytes(&cur_op, 1)) {
-      return;
-    }
-
-    std::string raw_string(android::base::StringPrintf("Raw Data: 0x%02x", cur_op));
-    std::string log_string;
-    const auto* op = &kCallbackTable[cur_op];
-    if (op->handle_func == OP_ILLEGAL) {
-      log_string = "Illegal";
-    } else {
-      log_string = op->name;
-      uint64_t start_offset = memory_->cur_offset();
-      for (size_t i = 0; i < op->num_operands; i++) {
-        uint64_t value;
-        if (!memory_->ReadEncodedValue<AddressType>(op->operands[i], &value)) {
-          return;
-        }
-        log_string += ' ' + std::to_string(value);
-      }
-      uint64_t end_offset = memory_->cur_offset();
-
-      memory_->set_cur_offset(start_offset);
-      for (size_t i = start_offset; i < end_offset; i++) {
-        uint8_t byte;
-        if (!memory_->ReadBytes(&byte, 1)) {
-          return;
-        }
-        raw_string += android::base::StringPrintf(" 0x%02x", byte);
-      }
-      memory_->set_cur_offset(end_offset);
-    }
-    lines->push_back(std::move(log_string));
-    lines->push_back(std::move(raw_string));
-  }
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_deref() {
-  // Read the address and dereference it.
-  AddressType addr = StackPop();
-  AddressType value;
-  if (!regular_memory()->ReadFully(addr, &value, sizeof(value))) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = addr;
-    return false;
-  }
-  stack_.push_front(value);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_deref_size() {
-  AddressType bytes_to_read = OperandAt(0);
-  if (bytes_to_read > sizeof(AddressType) || bytes_to_read == 0) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-  // Read the address and dereference it.
-  AddressType addr = StackPop();
-  AddressType value = 0;
-  if (!regular_memory()->ReadFully(addr, &value, bytes_to_read)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = addr;
-    return false;
-  }
-  stack_.push_front(value);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_push() {
-  // Push all of the operands.
-  for (auto operand : operands_) {
-    stack_.push_front(operand);
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_dup() {
-  stack_.push_front(StackAt(0));
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_drop() {
-  StackPop();
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_over() {
-  stack_.push_front(StackAt(1));
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_pick() {
-  AddressType index = OperandAt(0);
-  if (index > StackSize()) {
-    last_error_.code = DWARF_ERROR_STACK_INDEX_NOT_VALID;
-    return false;
-  }
-  stack_.push_front(StackAt(index));
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_swap() {
-  AddressType old_value = stack_[0];
-  stack_[0] = stack_[1];
-  stack_[1] = old_value;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_rot() {
-  AddressType top = stack_[0];
-  stack_[0] = stack_[1];
-  stack_[1] = stack_[2];
-  stack_[2] = top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_abs() {
-  SignedType signed_value = static_cast<SignedType>(stack_[0]);
-  if (signed_value < 0) {
-    signed_value = -signed_value;
-  }
-  stack_[0] = static_cast<AddressType>(signed_value);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_and() {
-  AddressType top = StackPop();
-  stack_[0] &= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_div() {
-  AddressType top = StackPop();
-  if (top == 0) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-  SignedType signed_divisor = static_cast<SignedType>(top);
-  SignedType signed_dividend = static_cast<SignedType>(stack_[0]);
-  stack_[0] = static_cast<AddressType>(signed_dividend / signed_divisor);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_minus() {
-  AddressType top = StackPop();
-  stack_[0] -= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_mod() {
-  AddressType top = StackPop();
-  if (top == 0) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-  stack_[0] %= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_mul() {
-  AddressType top = StackPop();
-  stack_[0] *= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_neg() {
-  SignedType signed_value = static_cast<SignedType>(stack_[0]);
-  stack_[0] = static_cast<AddressType>(-signed_value);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_not() {
-  stack_[0] = ~stack_[0];
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_or() {
-  AddressType top = StackPop();
-  stack_[0] |= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_plus() {
-  AddressType top = StackPop();
-  stack_[0] += top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_plus_uconst() {
-  stack_[0] += OperandAt(0);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_shl() {
-  AddressType top = StackPop();
-  stack_[0] <<= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_shr() {
-  AddressType top = StackPop();
-  stack_[0] >>= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_shra() {
-  AddressType top = StackPop();
-  SignedType signed_value = static_cast<SignedType>(stack_[0]) >> top;
-  stack_[0] = static_cast<AddressType>(signed_value);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_xor() {
-  AddressType top = StackPop();
-  stack_[0] ^= top;
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_bra() {
-  // Requires one stack element.
-  AddressType top = StackPop();
-  int16_t offset = static_cast<int16_t>(OperandAt(0));
-  uint64_t cur_offset;
-  if (top != 0) {
-    cur_offset = memory_->cur_offset() + offset;
-  } else {
-    cur_offset = memory_->cur_offset() - offset;
-  }
-  memory_->set_cur_offset(cur_offset);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_eq() {
-  AddressType top = StackPop();
-  stack_[0] = bool_to_dwarf_bool(stack_[0] == top);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_ge() {
-  AddressType top = StackPop();
-  stack_[0] = bool_to_dwarf_bool(stack_[0] >= top);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_gt() {
-  AddressType top = StackPop();
-  stack_[0] = bool_to_dwarf_bool(stack_[0] > top);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_le() {
-  AddressType top = StackPop();
-  stack_[0] = bool_to_dwarf_bool(stack_[0] <= top);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_lt() {
-  AddressType top = StackPop();
-  stack_[0] = bool_to_dwarf_bool(stack_[0] < top);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_ne() {
-  AddressType top = StackPop();
-  stack_[0] = bool_to_dwarf_bool(stack_[0] != top);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_skip() {
-  int16_t offset = static_cast<int16_t>(OperandAt(0));
-  uint64_t cur_offset = memory_->cur_offset() + offset;
-  memory_->set_cur_offset(cur_offset);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_lit() {
-  stack_.push_front(cur_op() - 0x30);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_reg() {
-  is_register_ = true;
-  stack_.push_front(cur_op() - 0x50);
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_regx() {
-  is_register_ = true;
-  stack_.push_front(OperandAt(0));
-  return true;
-}
-
-// It's not clear for breg/bregx, if this op should read the current
-// value of the register, or where we think that register is located.
-// For simplicity, the code will read the value before doing the unwind.
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_breg() {
-  uint16_t reg = cur_op() - 0x70;
-  if (reg >= regs_info_->Total()) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-  stack_.push_front(regs_info_->Get(reg) + OperandAt(0));
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_bregx() {
-  AddressType reg = OperandAt(0);
-  if (reg >= regs_info_->Total()) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-  stack_.push_front(regs_info_->Get(reg) + OperandAt(1));
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_nop() {
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfOp<AddressType>::op_not_implemented() {
-  last_error_.code = DWARF_ERROR_NOT_IMPLEMENTED;
-  return false;
-}
-
-// Explicitly instantiate DwarfOp.
-template class DwarfOp<uint32_t>;
-template class DwarfOp<uint64_t>;
-
-}  // namespace unwindstack
diff --git a/libunwindstack/DwarfOp.h b/libunwindstack/DwarfOp.h
deleted file mode 100644
index ac9fd2d..0000000
--- a/libunwindstack/DwarfOp.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_OP_H
-#define _LIBUNWINDSTACK_DWARF_OP_H
-
-#include <stdint.h>
-
-#include <deque>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include <unwindstack/DwarfError.h>
-
-#include "DwarfEncoding.h"
-#include "RegsInfo.h"
-
-namespace unwindstack {
-
-// Forward declarations.
-class DwarfMemory;
-class Memory;
-template <typename AddressType>
-class RegsImpl;
-
-template <typename AddressType>
-class DwarfOp {
-  // Signed version of AddressType
-  typedef typename std::make_signed<AddressType>::type SignedType;
-
- public:
-  DwarfOp(DwarfMemory* memory, Memory* regular_memory)
-      : memory_(memory), regular_memory_(regular_memory) {}
-  virtual ~DwarfOp() = default;
-
-  bool Decode();
-
-  bool Eval(uint64_t start, uint64_t end);
-
-  void GetLogInfo(uint64_t start, uint64_t end, std::vector<std::string>* lines);
-
-  AddressType StackAt(size_t index) { return stack_[index]; }
-  size_t StackSize() { return stack_.size(); }
-
-  void set_regs_info(RegsInfo<AddressType>* regs_info) { regs_info_ = regs_info; }
-
-  const DwarfErrorData& last_error() { return last_error_; }
-  DwarfErrorCode LastErrorCode() { return last_error_.code; }
-  uint64_t LastErrorAddress() { return last_error_.address; }
-
-  bool dex_pc_set() { return dex_pc_set_; }
-
-  bool is_register() { return is_register_; }
-
-  uint8_t cur_op() { return cur_op_; }
-
-  Memory* regular_memory() { return regular_memory_; }
-
- protected:
-  AddressType OperandAt(size_t index) { return operands_[index]; }
-  size_t OperandsSize() { return operands_.size(); }
-
-  AddressType StackPop() {
-    AddressType value = stack_.front();
-    stack_.pop_front();
-    return value;
-  }
-
- private:
-  DwarfMemory* memory_;
-  Memory* regular_memory_;
-
-  RegsInfo<AddressType>* regs_info_;
-  bool dex_pc_set_ = false;
-  bool is_register_ = false;
-  DwarfErrorData last_error_{DWARF_ERROR_NONE, 0};
-  uint8_t cur_op_;
-  std::vector<AddressType> operands_;
-  std::deque<AddressType> stack_;
-
-  inline AddressType bool_to_dwarf_bool(bool value) { return value ? 1 : 0; }
-
-  // Op processing functions.
-  bool op_deref();
-  bool op_deref_size();
-  bool op_push();
-  bool op_dup();
-  bool op_drop();
-  bool op_over();
-  bool op_pick();
-  bool op_swap();
-  bool op_rot();
-  bool op_abs();
-  bool op_and();
-  bool op_div();
-  bool op_minus();
-  bool op_mod();
-  bool op_mul();
-  bool op_neg();
-  bool op_not();
-  bool op_or();
-  bool op_plus();
-  bool op_plus_uconst();
-  bool op_shl();
-  bool op_shr();
-  bool op_shra();
-  bool op_xor();
-  bool op_bra();
-  bool op_eq();
-  bool op_ge();
-  bool op_gt();
-  bool op_le();
-  bool op_lt();
-  bool op_ne();
-  bool op_skip();
-  bool op_lit();
-  bool op_reg();
-  bool op_regx();
-  bool op_breg();
-  bool op_bregx();
-  bool op_nop();
-  bool op_not_implemented();
-
-  using OpHandleFuncPtr = bool (DwarfOp::*)();
-  static const OpHandleFuncPtr kOpHandleFuncList[];
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_OP_H
diff --git a/libunwindstack/DwarfSection.cpp b/libunwindstack/DwarfSection.cpp
deleted file mode 100644
index 18bd490..0000000
--- a/libunwindstack/DwarfSection.cpp
+++ /dev/null
@@ -1,807 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/DwarfStructs.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-#include "DwarfCfa.h"
-#include "DwarfDebugFrame.h"
-#include "DwarfEhFrame.h"
-#include "DwarfEncoding.h"
-#include "DwarfOp.h"
-#include "RegsInfo.h"
-
-namespace unwindstack {
-
-DwarfSection::DwarfSection(Memory* memory) : memory_(memory) {}
-
-bool DwarfSection::Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished) {
-  // Lookup the pc in the cache.
-  auto it = loc_regs_.upper_bound(pc);
-  if (it == loc_regs_.end() || pc < it->second.pc_start) {
-    last_error_.code = DWARF_ERROR_NONE;
-    const DwarfFde* fde = GetFdeFromPc(pc);
-    if (fde == nullptr || fde->cie == nullptr) {
-      last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-      return false;
-    }
-
-    // Now get the location information for this pc.
-    dwarf_loc_regs_t loc_regs;
-    if (!GetCfaLocationInfo(pc, fde, &loc_regs)) {
-      return false;
-    }
-    loc_regs.cie = fde->cie;
-
-    // Store it in the cache.
-    it = loc_regs_.emplace(loc_regs.pc_end, std::move(loc_regs)).first;
-  }
-
-  // Now eval the actual registers.
-  return Eval(it->second.cie, process_memory, it->second, regs, finished);
-}
-
-template <typename AddressType>
-const DwarfCie* DwarfSectionImpl<AddressType>::GetCieFromOffset(uint64_t offset) {
-  auto cie_entry = cie_entries_.find(offset);
-  if (cie_entry != cie_entries_.end()) {
-    return &cie_entry->second;
-  }
-  DwarfCie* cie = &cie_entries_[offset];
-  memory_.set_data_offset(entries_offset_);
-  memory_.set_cur_offset(offset);
-  if (!FillInCieHeader(cie) || !FillInCie(cie)) {
-    // Erase the cached entry.
-    cie_entries_.erase(offset);
-    return nullptr;
-  }
-  return cie;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::FillInCieHeader(DwarfCie* cie) {
-  cie->lsda_encoding = DW_EH_PE_omit;
-  uint32_t length32;
-  if (!memory_.ReadBytes(&length32, sizeof(length32))) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-  if (length32 == static_cast<uint32_t>(-1)) {
-    // 64 bit Cie
-    uint64_t length64;
-    if (!memory_.ReadBytes(&length64, sizeof(length64))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-
-    cie->cfa_instructions_end = memory_.cur_offset() + length64;
-    cie->fde_address_encoding = DW_EH_PE_sdata8;
-
-    uint64_t cie_id;
-    if (!memory_.ReadBytes(&cie_id, sizeof(cie_id))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    if (cie_id != cie64_value_) {
-      // This is not a Cie, something has gone horribly wrong.
-      last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-      return false;
-    }
-  } else {
-    // 32 bit Cie
-    cie->cfa_instructions_end = memory_.cur_offset() + length32;
-    cie->fde_address_encoding = DW_EH_PE_sdata4;
-
-    uint32_t cie_id;
-    if (!memory_.ReadBytes(&cie_id, sizeof(cie_id))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    if (cie_id != cie32_value_) {
-      // This is not a Cie, something has gone horribly wrong.
-      last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-      return false;
-    }
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::FillInCie(DwarfCie* cie) {
-  if (!memory_.ReadBytes(&cie->version, sizeof(cie->version))) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  if (cie->version != 1 && cie->version != 3 && cie->version != 4 && cie->version != 5) {
-    // Unrecognized version.
-    last_error_.code = DWARF_ERROR_UNSUPPORTED_VERSION;
-    return false;
-  }
-
-  // Read the augmentation string.
-  char aug_value;
-  do {
-    if (!memory_.ReadBytes(&aug_value, 1)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    cie->augmentation_string.push_back(aug_value);
-  } while (aug_value != '\0');
-
-  if (cie->version == 4 || cie->version == 5) {
-    // Skip the Address Size field since we only use it for validation.
-    memory_.set_cur_offset(memory_.cur_offset() + 1);
-
-    // Segment Size
-    if (!memory_.ReadBytes(&cie->segment_size, 1)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-  }
-
-  // Code Alignment Factor
-  if (!memory_.ReadULEB128(&cie->code_alignment_factor)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  // Data Alignment Factor
-  if (!memory_.ReadSLEB128(&cie->data_alignment_factor)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  if (cie->version == 1) {
-    // Return Address is a single byte.
-    uint8_t return_address_register;
-    if (!memory_.ReadBytes(&return_address_register, 1)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    cie->return_address_register = return_address_register;
-  } else if (!memory_.ReadULEB128(&cie->return_address_register)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  if (cie->augmentation_string[0] != 'z') {
-    cie->cfa_instructions_offset = memory_.cur_offset();
-    return true;
-  }
-
-  uint64_t aug_length;
-  if (!memory_.ReadULEB128(&aug_length)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-  cie->cfa_instructions_offset = memory_.cur_offset() + aug_length;
-
-  for (size_t i = 1; i < cie->augmentation_string.size(); i++) {
-    switch (cie->augmentation_string[i]) {
-      case 'L':
-        if (!memory_.ReadBytes(&cie->lsda_encoding, 1)) {
-          last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-          last_error_.address = memory_.cur_offset();
-          return false;
-        }
-        break;
-      case 'P': {
-        uint8_t encoding;
-        if (!memory_.ReadBytes(&encoding, 1)) {
-          last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-          last_error_.address = memory_.cur_offset();
-          return false;
-        }
-        memory_.set_pc_offset(pc_offset_);
-        if (!memory_.ReadEncodedValue<AddressType>(encoding, &cie->personality_handler)) {
-          last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-          last_error_.address = memory_.cur_offset();
-          return false;
-        }
-      } break;
-      case 'R':
-        if (!memory_.ReadBytes(&cie->fde_address_encoding, 1)) {
-          last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-          last_error_.address = memory_.cur_offset();
-          return false;
-        }
-        break;
-    }
-  }
-  return true;
-}
-
-template <typename AddressType>
-const DwarfFde* DwarfSectionImpl<AddressType>::GetFdeFromOffset(uint64_t offset) {
-  auto fde_entry = fde_entries_.find(offset);
-  if (fde_entry != fde_entries_.end()) {
-    return &fde_entry->second;
-  }
-  DwarfFde* fde = &fde_entries_[offset];
-  memory_.set_data_offset(entries_offset_);
-  memory_.set_cur_offset(offset);
-  if (!FillInFdeHeader(fde) || !FillInFde(fde)) {
-    fde_entries_.erase(offset);
-    return nullptr;
-  }
-  return fde;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::FillInFdeHeader(DwarfFde* fde) {
-  uint32_t length32;
-  if (!memory_.ReadBytes(&length32, sizeof(length32))) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  if (length32 == static_cast<uint32_t>(-1)) {
-    // 64 bit Fde.
-    uint64_t length64;
-    if (!memory_.ReadBytes(&length64, sizeof(length64))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    fde->cfa_instructions_end = memory_.cur_offset() + length64;
-
-    uint64_t value64;
-    if (!memory_.ReadBytes(&value64, sizeof(value64))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    if (value64 == cie64_value_) {
-      // This is a Cie, this means something has gone wrong.
-      last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-      return false;
-    }
-
-    // Get the Cie pointer, which is necessary to properly read the rest of
-    // of the Fde information.
-    fde->cie_offset = GetCieOffsetFromFde64(value64);
-  } else {
-    // 32 bit Fde.
-    fde->cfa_instructions_end = memory_.cur_offset() + length32;
-
-    uint32_t value32;
-    if (!memory_.ReadBytes(&value32, sizeof(value32))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    if (value32 == cie32_value_) {
-      // This is a Cie, this means something has gone wrong.
-      last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-      return false;
-    }
-
-    // Get the Cie pointer, which is necessary to properly read the rest of
-    // of the Fde information.
-    fde->cie_offset = GetCieOffsetFromFde32(value32);
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::FillInFde(DwarfFde* fde) {
-  uint64_t cur_offset = memory_.cur_offset();
-
-  const DwarfCie* cie = GetCieFromOffset(fde->cie_offset);
-  if (cie == nullptr) {
-    return false;
-  }
-  fde->cie = cie;
-
-  if (cie->segment_size != 0) {
-    // Skip over the segment selector for now.
-    cur_offset += cie->segment_size;
-  }
-  memory_.set_cur_offset(cur_offset);
-
-  // The load bias only applies to the start.
-  memory_.set_pc_offset(section_bias_);
-  bool valid = memory_.ReadEncodedValue<AddressType>(cie->fde_address_encoding, &fde->pc_start);
-  fde->pc_start = AdjustPcFromFde(fde->pc_start);
-
-  memory_.set_pc_offset(0);
-  if (!valid || !memory_.ReadEncodedValue<AddressType>(cie->fde_address_encoding, &fde->pc_end)) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-  fde->pc_end += fde->pc_start;
-
-  if (cie->augmentation_string.size() > 0 && cie->augmentation_string[0] == 'z') {
-    // Augmentation Size
-    uint64_t aug_length;
-    if (!memory_.ReadULEB128(&aug_length)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-    uint64_t cur_offset = memory_.cur_offset();
-
-    memory_.set_pc_offset(pc_offset_);
-    if (!memory_.ReadEncodedValue<AddressType>(cie->lsda_encoding, &fde->lsda_address)) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-
-    // Set our position to after all of the augmentation data.
-    memory_.set_cur_offset(cur_offset + aug_length);
-  }
-  fde->cfa_instructions_offset = memory_.cur_offset();
-
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::EvalExpression(const DwarfLocation& loc, Memory* regular_memory,
-                                                   AddressType* value,
-                                                   RegsInfo<AddressType>* regs_info,
-                                                   bool* is_dex_pc) {
-  DwarfOp<AddressType> op(&memory_, regular_memory);
-  op.set_regs_info(regs_info);
-
-  // Need to evaluate the op data.
-  uint64_t end = loc.values[1];
-  uint64_t start = end - loc.values[0];
-  if (!op.Eval(start, end)) {
-    last_error_ = op.last_error();
-    return false;
-  }
-  if (op.StackSize() == 0) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_STATE;
-    return false;
-  }
-  // We don't support an expression that evaluates to a register number.
-  if (op.is_register()) {
-    last_error_.code = DWARF_ERROR_NOT_IMPLEMENTED;
-    return false;
-  }
-  *value = op.StackAt(0);
-  if (is_dex_pc != nullptr && op.dex_pc_set()) {
-    *is_dex_pc = true;
-  }
-  return true;
-}
-
-template <typename AddressType>
-struct EvalInfo {
-  const dwarf_loc_regs_t* loc_regs;
-  const DwarfCie* cie;
-  Memory* regular_memory;
-  AddressType cfa;
-  bool return_address_undefined = false;
-  RegsInfo<AddressType> regs_info;
-};
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::EvalRegister(const DwarfLocation* loc, uint32_t reg,
-                                                 AddressType* reg_ptr, void* info) {
-  EvalInfo<AddressType>* eval_info = reinterpret_cast<EvalInfo<AddressType>*>(info);
-  Memory* regular_memory = eval_info->regular_memory;
-  switch (loc->type) {
-    case DWARF_LOCATION_OFFSET:
-      if (!regular_memory->ReadFully(eval_info->cfa + loc->values[0], reg_ptr, sizeof(AddressType))) {
-        last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-        last_error_.address = eval_info->cfa + loc->values[0];
-        return false;
-      }
-      break;
-    case DWARF_LOCATION_VAL_OFFSET:
-      *reg_ptr = eval_info->cfa + loc->values[0];
-      break;
-    case DWARF_LOCATION_REGISTER: {
-      uint32_t cur_reg = loc->values[0];
-      if (cur_reg >= eval_info->regs_info.Total()) {
-        last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-        return false;
-      }
-      *reg_ptr = eval_info->regs_info.Get(cur_reg) + loc->values[1];
-      break;
-    }
-    case DWARF_LOCATION_EXPRESSION:
-    case DWARF_LOCATION_VAL_EXPRESSION: {
-      AddressType value;
-      bool is_dex_pc = false;
-      if (!EvalExpression(*loc, regular_memory, &value, &eval_info->regs_info, &is_dex_pc)) {
-        return false;
-      }
-      if (loc->type == DWARF_LOCATION_EXPRESSION) {
-        if (!regular_memory->ReadFully(value, reg_ptr, sizeof(AddressType))) {
-          last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-          last_error_.address = value;
-          return false;
-        }
-      } else {
-        *reg_ptr = value;
-        if (is_dex_pc) {
-          eval_info->regs_info.regs->set_dex_pc(value);
-        }
-      }
-      break;
-    }
-    case DWARF_LOCATION_UNDEFINED:
-      if (reg == eval_info->cie->return_address_register) {
-        eval_info->return_address_undefined = true;
-      }
-      break;
-    default:
-      break;
-  }
-
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_memory,
-                                         const dwarf_loc_regs_t& loc_regs, Regs* regs,
-                                         bool* finished) {
-  RegsImpl<AddressType>* cur_regs = reinterpret_cast<RegsImpl<AddressType>*>(regs);
-  if (cie->return_address_register >= cur_regs->total_regs()) {
-    last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-    return false;
-  }
-
-  // Get the cfa value;
-  auto cfa_entry = loc_regs.find(CFA_REG);
-  if (cfa_entry == loc_regs.end()) {
-    last_error_.code = DWARF_ERROR_CFA_NOT_DEFINED;
-    return false;
-  }
-
-  // Always set the dex pc to zero when evaluating.
-  cur_regs->set_dex_pc(0);
-
-  EvalInfo<AddressType> eval_info{.loc_regs = &loc_regs,
-                                  .cie = cie,
-                                  .regular_memory = regular_memory,
-                                  .regs_info = RegsInfo<AddressType>(cur_regs)};
-  const DwarfLocation* loc = &cfa_entry->second;
-  // Only a few location types are valid for the cfa.
-  switch (loc->type) {
-    case DWARF_LOCATION_REGISTER:
-      if (loc->values[0] >= cur_regs->total_regs()) {
-        last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-        return false;
-      }
-      eval_info.cfa = (*cur_regs)[loc->values[0]];
-      eval_info.cfa += loc->values[1];
-      break;
-    case DWARF_LOCATION_VAL_EXPRESSION: {
-      AddressType value;
-      if (!EvalExpression(*loc, regular_memory, &value, &eval_info.regs_info, nullptr)) {
-        return false;
-      }
-      // There is only one type of valid expression for CFA evaluation.
-      eval_info.cfa = value;
-      break;
-    }
-    default:
-      last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
-      return false;
-  }
-
-  for (const auto& entry : loc_regs) {
-    uint32_t reg = entry.first;
-    // Already handled the CFA register.
-    if (reg == CFA_REG) continue;
-
-    AddressType* reg_ptr;
-    if (reg >= cur_regs->total_regs()) {
-      // Skip this unknown register.
-      continue;
-    }
-
-    reg_ptr = eval_info.regs_info.Save(reg);
-    if (!EvalRegister(&entry.second, reg, reg_ptr, &eval_info)) {
-      return false;
-    }
-  }
-
-  // Find the return address location.
-  if (eval_info.return_address_undefined) {
-    cur_regs->set_pc(0);
-  } else {
-    cur_regs->set_pc((*cur_regs)[cie->return_address_register]);
-  }
-
-  // If the pc was set to zero, consider this the final frame.
-  *finished = (cur_regs->pc() == 0) ? true : false;
-
-  cur_regs->set_sp(eval_info.cfa);
-
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::GetCfaLocationInfo(uint64_t pc, const DwarfFde* fde,
-                                                       dwarf_loc_regs_t* loc_regs) {
-  DwarfCfa<AddressType> cfa(&memory_, fde);
-
-  // Look for the cached copy of the cie data.
-  auto reg_entry = cie_loc_regs_.find(fde->cie_offset);
-  if (reg_entry == cie_loc_regs_.end()) {
-    if (!cfa.GetLocationInfo(pc, fde->cie->cfa_instructions_offset, fde->cie->cfa_instructions_end,
-                             loc_regs)) {
-      last_error_ = cfa.last_error();
-      return false;
-    }
-    cie_loc_regs_[fde->cie_offset] = *loc_regs;
-  }
-  cfa.set_cie_loc_regs(&cie_loc_regs_[fde->cie_offset]);
-  if (!cfa.GetLocationInfo(pc, fde->cfa_instructions_offset, fde->cfa_instructions_end, loc_regs)) {
-    last_error_ = cfa.last_error();
-    return false;
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::Log(uint8_t indent, uint64_t pc, const DwarfFde* fde) {
-  DwarfCfa<AddressType> cfa(&memory_, fde);
-
-  // Always print the cie information.
-  const DwarfCie* cie = fde->cie;
-  if (!cfa.Log(indent, pc, cie->cfa_instructions_offset, cie->cfa_instructions_end)) {
-    last_error_ = cfa.last_error();
-    return false;
-  }
-  if (!cfa.Log(indent, pc, fde->cfa_instructions_offset, fde->cfa_instructions_end)) {
-    last_error_ = cfa.last_error();
-    return false;
-  }
-  return true;
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::Init(uint64_t offset, uint64_t size, int64_t section_bias) {
-  section_bias_ = section_bias;
-  entries_offset_ = offset;
-  next_entries_offset_ = offset;
-  entries_end_ = offset + size;
-
-  memory_.clear_func_offset();
-  memory_.clear_text_offset();
-  memory_.set_cur_offset(offset);
-  pc_offset_ = offset;
-
-  return true;
-}
-
-// Create a cached version of the fde information such that it is a std::map
-// that is indexed by end pc and contains a pair that represents the start pc
-// followed by the fde object. The fde pointers are owned by fde_entries_
-// and not by the map object.
-// It is possible for an fde to be represented by multiple entries in
-// the map. This can happen if the the start pc and end pc overlap already
-// existing entries. For example, if there is already an entry of 0x400, 0x200,
-// and an fde has a start pc of 0x100 and end pc of 0x500, two new entries
-// will be added: 0x200, 0x100 and 0x500, 0x400.
-template <typename AddressType>
-void DwarfSectionImpl<AddressType>::InsertFde(const DwarfFde* fde) {
-  uint64_t start = fde->pc_start;
-  uint64_t end = fde->pc_end;
-  auto it = fdes_.upper_bound(start);
-  while (it != fdes_.end() && start < end && it->second.first < end) {
-    if (start < it->second.first) {
-      fdes_[it->second.first] = std::make_pair(start, fde);
-    }
-    start = it->first;
-    ++it;
-  }
-  if (start < end) {
-    fdes_[end] = std::make_pair(start, fde);
-  }
-}
-
-template <typename AddressType>
-bool DwarfSectionImpl<AddressType>::GetNextCieOrFde(const DwarfFde** fde_entry) {
-  uint64_t start_offset = next_entries_offset_;
-
-  memory_.set_data_offset(entries_offset_);
-  memory_.set_cur_offset(next_entries_offset_);
-  uint32_t value32;
-  if (!memory_.ReadBytes(&value32, sizeof(value32))) {
-    last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-    last_error_.address = memory_.cur_offset();
-    return false;
-  }
-
-  uint64_t cie_offset;
-  uint8_t cie_fde_encoding;
-  bool entry_is_cie = false;
-  if (value32 == static_cast<uint32_t>(-1)) {
-    // 64 bit entry.
-    uint64_t value64;
-    if (!memory_.ReadBytes(&value64, sizeof(value64))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-
-    next_entries_offset_ = memory_.cur_offset() + value64;
-    // Read the Cie Id of a Cie or the pointer of the Fde.
-    if (!memory_.ReadBytes(&value64, sizeof(value64))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-
-    if (value64 == cie64_value_) {
-      entry_is_cie = true;
-      cie_fde_encoding = DW_EH_PE_sdata8;
-    } else {
-      cie_offset = GetCieOffsetFromFde64(value64);
-    }
-  } else {
-    next_entries_offset_ = memory_.cur_offset() + value32;
-
-    // 32 bit Cie
-    if (!memory_.ReadBytes(&value32, sizeof(value32))) {
-      last_error_.code = DWARF_ERROR_MEMORY_INVALID;
-      last_error_.address = memory_.cur_offset();
-      return false;
-    }
-
-    if (value32 == cie32_value_) {
-      entry_is_cie = true;
-      cie_fde_encoding = DW_EH_PE_sdata4;
-    } else {
-      cie_offset = GetCieOffsetFromFde32(value32);
-    }
-  }
-
-  if (entry_is_cie) {
-    auto entry = cie_entries_.find(start_offset);
-    if (entry == cie_entries_.end()) {
-      DwarfCie* cie = &cie_entries_[start_offset];
-      cie->lsda_encoding = DW_EH_PE_omit;
-      cie->cfa_instructions_end = next_entries_offset_;
-      cie->fde_address_encoding = cie_fde_encoding;
-
-      if (!FillInCie(cie)) {
-        cie_entries_.erase(start_offset);
-        return false;
-      }
-    }
-    *fde_entry = nullptr;
-  } else {
-    auto entry = fde_entries_.find(start_offset);
-    if (entry != fde_entries_.end()) {
-      *fde_entry = &entry->second;
-    } else {
-      DwarfFde* fde = &fde_entries_[start_offset];
-      fde->cfa_instructions_end = next_entries_offset_;
-      fde->cie_offset = cie_offset;
-
-      if (!FillInFde(fde)) {
-        fde_entries_.erase(start_offset);
-        return false;
-      }
-      *fde_entry = fde;
-    }
-  }
-  return true;
-}
-
-template <typename AddressType>
-void DwarfSectionImpl<AddressType>::GetFdes(std::vector<const DwarfFde*>* fdes) {
-  // Loop through the already cached entries.
-  uint64_t entry_offset = entries_offset_;
-  while (entry_offset < next_entries_offset_) {
-    auto cie_it = cie_entries_.find(entry_offset);
-    if (cie_it != cie_entries_.end()) {
-      entry_offset = cie_it->second.cfa_instructions_end;
-    } else {
-      auto fde_it = fde_entries_.find(entry_offset);
-      if (fde_it == fde_entries_.end()) {
-        // No fde or cie at this entry, should not be possible.
-        return;
-      }
-      entry_offset = fde_it->second.cfa_instructions_end;
-      fdes->push_back(&fde_it->second);
-    }
-  }
-
-  while (next_entries_offset_ < entries_end_) {
-    const DwarfFde* fde;
-    if (!GetNextCieOrFde(&fde)) {
-      break;
-    }
-    if (fde != nullptr) {
-      InsertFde(fde);
-      fdes->push_back(fde);
-    }
-
-    if (next_entries_offset_ < memory_.cur_offset()) {
-      // Simply consider the processing done in this case.
-      break;
-    }
-  }
-}
-
-template <typename AddressType>
-const DwarfFde* DwarfSectionImpl<AddressType>::GetFdeFromPc(uint64_t pc) {
-  // Search in the list of fdes we already have.
-  auto it = fdes_.upper_bound(pc);
-  if (it != fdes_.end()) {
-    if (pc >= it->second.first) {
-      return it->second.second;
-    }
-  }
-
-  // The section might have overlapping pcs in fdes, so it is necessary
-  // to do a linear search of the fdes by pc. As fdes are read, a cached
-  // search map is created.
-  while (next_entries_offset_ < entries_end_) {
-    const DwarfFde* fde;
-    if (!GetNextCieOrFde(&fde)) {
-      return nullptr;
-    }
-    if (fde != nullptr) {
-      InsertFde(fde);
-      if (pc >= fde->pc_start && pc < fde->pc_end) {
-        return fde;
-      }
-    }
-
-    if (next_entries_offset_ < memory_.cur_offset()) {
-      // Simply consider the processing done in this case.
-      break;
-    }
-  }
-  return nullptr;
-}
-
-// Explicitly instantiate DwarfSectionImpl
-template class DwarfSectionImpl<uint32_t>;
-template class DwarfSectionImpl<uint64_t>;
-
-// Explicitly instantiate DwarfDebugFrame
-template class DwarfDebugFrame<uint32_t>;
-template class DwarfDebugFrame<uint64_t>;
-
-// Explicitly instantiate DwarfEhFrame
-template class DwarfEhFrame<uint32_t>;
-template class DwarfEhFrame<uint64_t>;
-
-}  // namespace unwindstack
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp
deleted file mode 100644
index f01b092..0000000
--- a/libunwindstack/Elf.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <string.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <utility>
-
-#define LOG_TAG "unwind"
-#include <log/log.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-#include "ElfInterfaceArm.h"
-#include "Symbols.h"
-
-namespace unwindstack {
-
-bool Elf::cache_enabled_;
-std::unordered_map<std::string, std::pair<std::shared_ptr<Elf>, bool>>* Elf::cache_;
-std::mutex* Elf::cache_lock_;
-
-bool Elf::Init() {
-  load_bias_ = 0;
-  if (!memory_) {
-    return false;
-  }
-
-  interface_.reset(CreateInterfaceFromMemory(memory_.get()));
-  if (!interface_) {
-    return false;
-  }
-
-  valid_ = interface_->Init(&load_bias_);
-  if (valid_) {
-    interface_->InitHeaders();
-    InitGnuDebugdata();
-  } else {
-    interface_.reset(nullptr);
-  }
-  return valid_;
-}
-
-// It is expensive to initialize the .gnu_debugdata section. Provide a method
-// to initialize this data separately.
-void Elf::InitGnuDebugdata() {
-  if (!valid_ || interface_->gnu_debugdata_offset() == 0) {
-    return;
-  }
-
-  gnu_debugdata_memory_.reset(interface_->CreateGnuDebugdataMemory());
-  gnu_debugdata_interface_.reset(CreateInterfaceFromMemory(gnu_debugdata_memory_.get()));
-  ElfInterface* gnu = gnu_debugdata_interface_.get();
-  if (gnu == nullptr) {
-    return;
-  }
-
-  // Ignore the load_bias from the compressed section, the correct load bias
-  // is in the uncompressed data.
-  int64_t load_bias;
-  if (gnu->Init(&load_bias)) {
-    gnu->InitHeaders();
-    interface_->SetGnuDebugdataInterface(gnu);
-  } else {
-    // Free all of the memory associated with the gnu_debugdata section.
-    gnu_debugdata_memory_.reset(nullptr);
-    gnu_debugdata_interface_.reset(nullptr);
-  }
-}
-
-void Elf::Invalidate() {
-  interface_.reset(nullptr);
-  valid_ = false;
-}
-
-std::string Elf::GetSoname() {
-  std::lock_guard<std::mutex> guard(lock_);
-  if (!valid_) {
-    return "";
-  }
-  return interface_->GetSoname();
-}
-
-uint64_t Elf::GetRelPc(uint64_t pc, const MapInfo* map_info) {
-  return pc - map_info->start + load_bias_ + map_info->elf_offset;
-}
-
-bool Elf::GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset) {
-  std::lock_guard<std::mutex> guard(lock_);
-  return valid_ && (interface_->GetFunctionName(addr, name, func_offset) ||
-                    (gnu_debugdata_interface_ &&
-                     gnu_debugdata_interface_->GetFunctionName(addr, name, func_offset)));
-}
-
-bool Elf::GetGlobalVariableOffset(const std::string& name, uint64_t* memory_offset) {
-  if (!valid_) {
-    return false;
-  }
-
-  uint64_t vaddr;
-  if (!interface_->GetGlobalVariable(name, &vaddr) &&
-      (gnu_debugdata_interface_ == nullptr ||
-       !gnu_debugdata_interface_->GetGlobalVariable(name, &vaddr))) {
-    return false;
-  }
-
-  // Check the .data section.
-  uint64_t vaddr_start = interface_->data_vaddr_start();
-  if (vaddr >= vaddr_start && vaddr < interface_->data_vaddr_end()) {
-    *memory_offset = vaddr - vaddr_start + interface_->data_offset();
-    return true;
-  }
-
-  // Check the .dynamic section.
-  vaddr_start = interface_->dynamic_vaddr_start();
-  if (vaddr >= vaddr_start && vaddr < interface_->dynamic_vaddr_end()) {
-    *memory_offset = vaddr - vaddr_start + interface_->dynamic_offset();
-    return true;
-  }
-
-  return false;
-}
-
-std::string Elf::GetBuildID() {
-  if (!valid_) {
-    return "";
-  }
-  return interface_->GetBuildID();
-}
-
-void Elf::GetLastError(ErrorData* data) {
-  if (valid_) {
-    *data = interface_->last_error();
-  }
-}
-
-ErrorCode Elf::GetLastErrorCode() {
-  if (valid_) {
-    return interface_->LastErrorCode();
-  }
-  return ERROR_INVALID_ELF;
-}
-
-uint64_t Elf::GetLastErrorAddress() {
-  if (valid_) {
-    return interface_->LastErrorAddress();
-  }
-  return 0;
-}
-
-// The relative pc expectd by this function is relative to the start of the elf.
-bool Elf::StepIfSignalHandler(uint64_t rel_pc, Regs* regs, Memory* process_memory) {
-  if (!valid_) {
-    return false;
-  }
-
-  // Convert the rel_pc to an elf_offset.
-  if (rel_pc < static_cast<uint64_t>(load_bias_)) {
-    return false;
-  }
-  return regs->StepIfSignalHandler(rel_pc - load_bias_, this, process_memory);
-}
-
-// The relative pc is always relative to the start of the map from which it comes.
-bool Elf::Step(uint64_t rel_pc, Regs* regs, Memory* process_memory, bool* finished) {
-  if (!valid_) {
-    return false;
-  }
-
-  // Lock during the step which can update information in the object.
-  std::lock_guard<std::mutex> guard(lock_);
-  return interface_->Step(rel_pc, regs, process_memory, finished);
-}
-
-bool Elf::IsValidElf(Memory* memory) {
-  if (memory == nullptr) {
-    return false;
-  }
-
-  // Verify that this is a valid elf file.
-  uint8_t e_ident[SELFMAG + 1];
-  if (!memory->ReadFully(0, e_ident, SELFMAG)) {
-    return false;
-  }
-
-  if (memcmp(e_ident, ELFMAG, SELFMAG) != 0) {
-    return false;
-  }
-  return true;
-}
-
-bool Elf::GetInfo(Memory* memory, uint64_t* size) {
-  if (!IsValidElf(memory)) {
-    return false;
-  }
-  *size = 0;
-
-  uint8_t class_type;
-  if (!memory->ReadFully(EI_CLASS, &class_type, 1)) {
-    return false;
-  }
-
-  // Get the maximum size of the elf data from the header.
-  if (class_type == ELFCLASS32) {
-    ElfInterface32::GetMaxSize(memory, size);
-  } else if (class_type == ELFCLASS64) {
-    ElfInterface64::GetMaxSize(memory, size);
-  } else {
-    return false;
-  }
-  return true;
-}
-
-bool Elf::IsValidPc(uint64_t pc) {
-  if (!valid_ || (load_bias_ > 0 && pc < static_cast<uint64_t>(load_bias_))) {
-    return false;
-  }
-
-  if (interface_->IsValidPc(pc)) {
-    return true;
-  }
-
-  if (gnu_debugdata_interface_ != nullptr && gnu_debugdata_interface_->IsValidPc(pc)) {
-    return true;
-  }
-
-  return false;
-}
-
-ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) {
-  if (!IsValidElf(memory)) {
-    return nullptr;
-  }
-
-  std::unique_ptr<ElfInterface> interface;
-  if (!memory->ReadFully(EI_CLASS, &class_type_, 1)) {
-    return nullptr;
-  }
-  if (class_type_ == ELFCLASS32) {
-    Elf32_Half e_machine;
-    if (!memory->ReadFully(EI_NIDENT + sizeof(Elf32_Half), &e_machine, sizeof(e_machine))) {
-      return nullptr;
-    }
-
-    machine_type_ = e_machine;
-    if (e_machine == EM_ARM) {
-      arch_ = ARCH_ARM;
-      interface.reset(new ElfInterfaceArm(memory));
-    } else if (e_machine == EM_386) {
-      arch_ = ARCH_X86;
-      interface.reset(new ElfInterface32(memory));
-    } else if (e_machine == EM_MIPS) {
-      arch_ = ARCH_MIPS;
-      interface.reset(new ElfInterface32(memory));
-    } else {
-      // Unsupported.
-      ALOGI("32 bit elf that is neither arm nor x86 nor mips: e_machine = %d\n", e_machine);
-      return nullptr;
-    }
-  } else if (class_type_ == ELFCLASS64) {
-    Elf64_Half e_machine;
-    if (!memory->ReadFully(EI_NIDENT + sizeof(Elf64_Half), &e_machine, sizeof(e_machine))) {
-      return nullptr;
-    }
-
-    machine_type_ = e_machine;
-    if (e_machine == EM_AARCH64) {
-      arch_ = ARCH_ARM64;
-    } else if (e_machine == EM_X86_64) {
-      arch_ = ARCH_X86_64;
-    } else if (e_machine == EM_MIPS) {
-      arch_ = ARCH_MIPS64;
-    } else {
-      // Unsupported.
-      ALOGI("64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = %d\n",
-            e_machine);
-      return nullptr;
-    }
-    interface.reset(new ElfInterface64(memory));
-  }
-
-  return interface.release();
-}
-
-int64_t Elf::GetLoadBias(Memory* memory) {
-  if (!IsValidElf(memory)) {
-    return 0;
-  }
-
-  uint8_t class_type;
-  if (!memory->Read(EI_CLASS, &class_type, 1)) {
-    return 0;
-  }
-
-  if (class_type == ELFCLASS32) {
-    return ElfInterface::GetLoadBias<Elf32_Ehdr, Elf32_Phdr>(memory);
-  } else if (class_type == ELFCLASS64) {
-    return ElfInterface::GetLoadBias<Elf64_Ehdr, Elf64_Phdr>(memory);
-  }
-  return 0;
-}
-
-void Elf::SetCachingEnabled(bool enable) {
-  if (!cache_enabled_ && enable) {
-    cache_enabled_ = true;
-    cache_ = new std::unordered_map<std::string, std::pair<std::shared_ptr<Elf>, bool>>;
-    cache_lock_ = new std::mutex;
-  } else if (cache_enabled_ && !enable) {
-    cache_enabled_ = false;
-    delete cache_;
-    delete cache_lock_;
-  }
-}
-
-void Elf::CacheLock() {
-  cache_lock_->lock();
-}
-
-void Elf::CacheUnlock() {
-  cache_lock_->unlock();
-}
-
-void Elf::CacheAdd(MapInfo* info) {
-  // If elf_offset != 0, then cache both name:offset and name.
-  // The cached name is used to do lookups if multiple maps for the same
-  // named elf file exist.
-  // For example, if there are two maps boot.odex:1000 and boot.odex:2000
-  // where each reference the entire boot.odex, the cache will properly
-  // use the same cached elf object.
-
-  if (info->offset == 0 || info->elf_offset != 0) {
-    (*cache_)[info->name] = std::make_pair(info->elf, true);
-  }
-
-  if (info->offset != 0) {
-    // The second element in the pair indicates whether elf_offset should
-    // be set to offset when getting out of the cache.
-    (*cache_)[info->name + ':' + std::to_string(info->offset)] =
-        std::make_pair(info->elf, info->elf_offset != 0);
-  }
-}
-
-bool Elf::CacheAfterCreateMemory(MapInfo* info) {
-  if (info->name.empty() || info->offset == 0 || info->elf_offset == 0) {
-    return false;
-  }
-
-  auto entry = cache_->find(info->name);
-  if (entry == cache_->end()) {
-    return false;
-  }
-
-  // In this case, the whole file is the elf, and the name has already
-  // been cached. Add an entry at name:offset to get this directly out
-  // of the cache next time.
-  info->elf = entry->second.first;
-  (*cache_)[info->name + ':' + std::to_string(info->offset)] = std::make_pair(info->elf, true);
-  return true;
-}
-
-bool Elf::CacheGet(MapInfo* info) {
-  std::string name(info->name);
-  if (info->offset != 0) {
-    name += ':' + std::to_string(info->offset);
-  }
-  auto entry = cache_->find(name);
-  if (entry != cache_->end()) {
-    info->elf = entry->second.first;
-    if (entry->second.second) {
-      info->elf_offset = info->offset;
-    }
-    return true;
-  }
-  return false;
-}
-
-std::string Elf::GetBuildID(Memory* memory) {
-  if (!IsValidElf(memory)) {
-    return "";
-  }
-
-  uint8_t class_type;
-  if (!memory->Read(EI_CLASS, &class_type, 1)) {
-    return "";
-  }
-
-  if (class_type == ELFCLASS32) {
-    return ElfInterface::ReadBuildIDFromMemory<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr>(memory);
-  } else if (class_type == ELFCLASS64) {
-    return ElfInterface::ReadBuildIDFromMemory<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr>(memory);
-  }
-  return "";
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/ElfInterface.cpp b/libunwindstack/ElfInterface.cpp
deleted file mode 100644
index 341275d..0000000
--- a/libunwindstack/ElfInterface.cpp
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <elf.h>
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <utility>
-
-#include <7zCrc.h>
-#include <Xz.h>
-#include <XzCrc64.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Regs.h>
-
-#include "DwarfDebugFrame.h"
-#include "DwarfEhFrame.h"
-#include "DwarfEhFrameWithHdr.h"
-#include "MemoryBuffer.h"
-#include "Symbols.h"
-
-namespace unwindstack {
-
-ElfInterface::~ElfInterface() {
-  for (auto symbol : symbols_) {
-    delete symbol;
-  }
-}
-
-bool ElfInterface::IsValidPc(uint64_t pc) {
-  if (!pt_loads_.empty()) {
-    for (auto& entry : pt_loads_) {
-      uint64_t start = entry.second.table_offset;
-      uint64_t end = start + entry.second.table_size;
-      if (pc >= start && pc < end) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  // No PT_LOAD data, look for a fde for this pc in the section data.
-  if (debug_frame_ != nullptr && debug_frame_->GetFdeFromPc(pc) != nullptr) {
-    return true;
-  }
-
-  if (eh_frame_ != nullptr && eh_frame_->GetFdeFromPc(pc) != nullptr) {
-    return true;
-  }
-
-  return false;
-}
-
-Memory* ElfInterface::CreateGnuDebugdataMemory() {
-  if (gnu_debugdata_offset_ == 0 || gnu_debugdata_size_ == 0) {
-    return nullptr;
-  }
-
-  // TODO: Only call these initialization functions once.
-  CrcGenerateTable();
-  Crc64GenerateTable();
-
-  // Verify the request is not larger than the max size_t value.
-  if (gnu_debugdata_size_ > SIZE_MAX) {
-    return nullptr;
-  }
-  size_t initial_buffer_size;
-  if (__builtin_mul_overflow(5, gnu_debugdata_size_, &initial_buffer_size)) {
-    return nullptr;
-  }
-
-  size_t buffer_increment;
-  if (__builtin_mul_overflow(2, gnu_debugdata_size_, &buffer_increment)) {
-    return nullptr;
-  }
-
-  std::unique_ptr<uint8_t[]> src(new (std::nothrow) uint8_t[gnu_debugdata_size_]);
-  if (src.get() == nullptr) {
-    return nullptr;
-  }
-
-  std::unique_ptr<MemoryBuffer> dst(new MemoryBuffer);
-  if (!dst->Resize(initial_buffer_size)) {
-    return nullptr;
-  }
-
-  if (!memory_->ReadFully(gnu_debugdata_offset_, src.get(), gnu_debugdata_size_)) {
-    return nullptr;
-  }
-
-  ISzAlloc alloc;
-  CXzUnpacker state;
-  alloc.Alloc = [](ISzAllocPtr, size_t size) { return malloc(size); };
-  alloc.Free = [](ISzAllocPtr, void* ptr) { return free(ptr); };
-  XzUnpacker_Construct(&state, &alloc);
-
-  int return_val;
-  size_t src_offset = 0;
-  size_t dst_offset = 0;
-  ECoderStatus status;
-  do {
-    size_t src_remaining = gnu_debugdata_size_ - src_offset;
-    size_t dst_remaining = dst->Size() - dst_offset;
-    if (dst_remaining < buffer_increment) {
-      size_t new_size;
-      if (__builtin_add_overflow(dst->Size(), buffer_increment, &new_size) ||
-          !dst->Resize(new_size)) {
-        XzUnpacker_Free(&state);
-        return nullptr;
-      }
-      dst_remaining += buffer_increment;
-    }
-    return_val = XzUnpacker_Code(&state, dst->GetPtr(dst_offset), &dst_remaining, &src[src_offset],
-                                 &src_remaining, true, CODER_FINISH_ANY, &status);
-    src_offset += src_remaining;
-    dst_offset += dst_remaining;
-  } while (return_val == SZ_OK && status == CODER_STATUS_NOT_FINISHED);
-  XzUnpacker_Free(&state);
-  if (return_val != SZ_OK || !XzUnpacker_IsStreamWasFinished(&state)) {
-    return nullptr;
-  }
-
-  // Shrink back down to the exact size.
-  if (!dst->Resize(dst_offset)) {
-    return nullptr;
-  }
-
-  return dst.release();
-}
-
-template <typename AddressType>
-void ElfInterface::InitHeadersWithTemplate() {
-  if (eh_frame_hdr_offset_ != 0) {
-    DwarfEhFrameWithHdr<AddressType>* eh_frame_hdr = new DwarfEhFrameWithHdr<AddressType>(memory_);
-    eh_frame_.reset(eh_frame_hdr);
-    if (!eh_frame_hdr->EhFrameInit(eh_frame_offset_, eh_frame_size_, eh_frame_section_bias_) ||
-        !eh_frame_->Init(eh_frame_hdr_offset_, eh_frame_hdr_size_, eh_frame_hdr_section_bias_)) {
-      eh_frame_.reset(nullptr);
-    }
-  }
-
-  if (eh_frame_.get() == nullptr && eh_frame_offset_ != 0) {
-    // If there is an eh_frame section without an eh_frame_hdr section,
-    // or using the frame hdr object failed to init.
-    eh_frame_.reset(new DwarfEhFrame<AddressType>(memory_));
-    if (!eh_frame_->Init(eh_frame_offset_, eh_frame_size_, eh_frame_section_bias_)) {
-      eh_frame_.reset(nullptr);
-    }
-  }
-
-  if (eh_frame_.get() == nullptr) {
-    eh_frame_hdr_offset_ = 0;
-    eh_frame_hdr_section_bias_ = 0;
-    eh_frame_hdr_size_ = static_cast<uint64_t>(-1);
-    eh_frame_offset_ = 0;
-    eh_frame_section_bias_ = 0;
-    eh_frame_size_ = static_cast<uint64_t>(-1);
-  }
-
-  if (debug_frame_offset_ != 0) {
-    debug_frame_.reset(new DwarfDebugFrame<AddressType>(memory_));
-    if (!debug_frame_->Init(debug_frame_offset_, debug_frame_size_, debug_frame_section_bias_)) {
-      debug_frame_.reset(nullptr);
-      debug_frame_offset_ = 0;
-      debug_frame_size_ = static_cast<uint64_t>(-1);
-    }
-  }
-}
-
-template <typename EhdrType, typename PhdrType, typename ShdrType>
-bool ElfInterface::ReadAllHeaders(int64_t* load_bias) {
-  EhdrType ehdr;
-  if (!memory_->ReadFully(0, &ehdr, sizeof(ehdr))) {
-    last_error_.code = ERROR_MEMORY_INVALID;
-    last_error_.address = 0;
-    return false;
-  }
-
-  // If we have enough information that this is an elf file, then allow
-  // malformed program and section headers.
-  ReadProgramHeaders<EhdrType, PhdrType>(ehdr, load_bias);
-  ReadSectionHeaders<EhdrType, ShdrType>(ehdr);
-  return true;
-}
-
-template <typename EhdrType, typename PhdrType>
-int64_t ElfInterface::GetLoadBias(Memory* memory) {
-  EhdrType ehdr;
-  if (!memory->ReadFully(0, &ehdr, sizeof(ehdr))) {
-    return false;
-  }
-
-  uint64_t offset = ehdr.e_phoff;
-  for (size_t i = 0; i < ehdr.e_phnum; i++, offset += ehdr.e_phentsize) {
-    PhdrType phdr;
-    if (!memory->ReadFully(offset, &phdr, sizeof(phdr))) {
-      return 0;
-    }
-
-    // Find the first executable load when looking for the load bias.
-    if (phdr.p_type == PT_LOAD && (phdr.p_flags & PF_X)) {
-      return static_cast<uint64_t>(phdr.p_vaddr) - phdr.p_offset;
-    }
-  }
-  return 0;
-}
-
-template <typename EhdrType, typename PhdrType>
-void ElfInterface::ReadProgramHeaders(const EhdrType& ehdr, int64_t* load_bias) {
-  uint64_t offset = ehdr.e_phoff;
-  bool first_exec_load_header = true;
-  for (size_t i = 0; i < ehdr.e_phnum; i++, offset += ehdr.e_phentsize) {
-    PhdrType phdr;
-    if (!memory_->ReadFully(offset, &phdr, sizeof(phdr))) {
-      return;
-    }
-
-    switch (phdr.p_type) {
-    case PT_LOAD:
-    {
-      if ((phdr.p_flags & PF_X) == 0) {
-        continue;
-      }
-
-      pt_loads_[phdr.p_offset] = LoadInfo{phdr.p_offset, phdr.p_vaddr,
-                                          static_cast<size_t>(phdr.p_memsz)};
-      // Only set the load bias from the first executable load header.
-      if (first_exec_load_header) {
-        *load_bias = static_cast<uint64_t>(phdr.p_vaddr) - phdr.p_offset;
-      }
-      first_exec_load_header = false;
-      break;
-    }
-
-    case PT_GNU_EH_FRAME:
-      // This is really the pointer to the .eh_frame_hdr section.
-      eh_frame_hdr_offset_ = phdr.p_offset;
-      eh_frame_hdr_section_bias_ = static_cast<uint64_t>(phdr.p_vaddr) - phdr.p_offset;
-      eh_frame_hdr_size_ = phdr.p_memsz;
-      break;
-
-    case PT_DYNAMIC:
-      dynamic_offset_ = phdr.p_offset;
-      dynamic_vaddr_start_ = phdr.p_vaddr;
-      if (__builtin_add_overflow(dynamic_vaddr_start_, phdr.p_memsz, &dynamic_vaddr_end_)) {
-        dynamic_offset_ = 0;
-        dynamic_vaddr_start_ = 0;
-        dynamic_vaddr_end_ = 0;
-      }
-      break;
-
-    default:
-      HandleUnknownType(phdr.p_type, phdr.p_offset, phdr.p_filesz);
-      break;
-    }
-  }
-}
-
-template <typename NhdrType>
-std::string ElfInterface::ReadBuildID() {
-  // Ensure there is no overflow in any of the calulations below.
-  uint64_t tmp;
-  if (__builtin_add_overflow(gnu_build_id_offset_, gnu_build_id_size_, &tmp)) {
-    return "";
-  }
-
-  uint64_t offset = 0;
-  while (offset < gnu_build_id_size_) {
-    if (gnu_build_id_size_ - offset < sizeof(NhdrType)) {
-      return "";
-    }
-    NhdrType hdr;
-    if (!memory_->ReadFully(gnu_build_id_offset_ + offset, &hdr, sizeof(hdr))) {
-      return "";
-    }
-    offset += sizeof(hdr);
-
-    if (gnu_build_id_size_ - offset < hdr.n_namesz) {
-      return "";
-    }
-    if (hdr.n_namesz > 0) {
-      std::string name(hdr.n_namesz, '\0');
-      if (!memory_->ReadFully(gnu_build_id_offset_ + offset, &(name[0]), hdr.n_namesz)) {
-        return "";
-      }
-
-      // Trim trailing \0 as GNU is stored as a C string in the ELF file.
-      if (name.back() == '\0')
-        name.resize(name.size() - 1);
-
-      // Align hdr.n_namesz to next power multiple of 4. See man 5 elf.
-      offset += (hdr.n_namesz + 3) & ~3;
-
-      if (name == "GNU" && hdr.n_type == NT_GNU_BUILD_ID) {
-        if (gnu_build_id_size_ - offset < hdr.n_descsz || hdr.n_descsz == 0) {
-          return "";
-        }
-        std::string build_id(hdr.n_descsz, '\0');
-        if (memory_->ReadFully(gnu_build_id_offset_ + offset, &build_id[0], hdr.n_descsz)) {
-          return build_id;
-        }
-        return "";
-      }
-    }
-    // Align hdr.n_descsz to next power multiple of 4. See man 5 elf.
-    offset += (hdr.n_descsz + 3) & ~3;
-  }
-  return "";
-}
-
-template <typename EhdrType, typename ShdrType>
-void ElfInterface::ReadSectionHeaders(const EhdrType& ehdr) {
-  uint64_t offset = ehdr.e_shoff;
-  uint64_t sec_offset = 0;
-  uint64_t sec_size = 0;
-
-  // Get the location of the section header names.
-  // If something is malformed in the header table data, we aren't going
-  // to terminate, we'll simply ignore this part.
-  ShdrType shdr;
-  if (ehdr.e_shstrndx < ehdr.e_shnum) {
-    uint64_t sh_offset = offset + ehdr.e_shstrndx * ehdr.e_shentsize;
-    if (memory_->ReadFully(sh_offset, &shdr, sizeof(shdr))) {
-      sec_offset = shdr.sh_offset;
-      sec_size = shdr.sh_size;
-    }
-  }
-
-  // Skip the first header, it's always going to be NULL.
-  offset += ehdr.e_shentsize;
-  for (size_t i = 1; i < ehdr.e_shnum; i++, offset += ehdr.e_shentsize) {
-    if (!memory_->ReadFully(offset, &shdr, sizeof(shdr))) {
-      return;
-    }
-
-    if (shdr.sh_type == SHT_SYMTAB || shdr.sh_type == SHT_DYNSYM) {
-      // Need to go get the information about the section that contains
-      // the string terminated names.
-      ShdrType str_shdr;
-      if (shdr.sh_link >= ehdr.e_shnum) {
-        continue;
-      }
-      uint64_t str_offset = ehdr.e_shoff + shdr.sh_link * ehdr.e_shentsize;
-      if (!memory_->ReadFully(str_offset, &str_shdr, sizeof(str_shdr))) {
-        continue;
-      }
-      if (str_shdr.sh_type != SHT_STRTAB) {
-        continue;
-      }
-      symbols_.push_back(new Symbols(shdr.sh_offset, shdr.sh_size, shdr.sh_entsize,
-                                     str_shdr.sh_offset, str_shdr.sh_size));
-    } else if (shdr.sh_type == SHT_PROGBITS && sec_size != 0) {
-      // Look for the .debug_frame and .gnu_debugdata.
-      if (shdr.sh_name < sec_size) {
-        std::string name;
-        if (memory_->ReadString(sec_offset + shdr.sh_name, &name)) {
-          if (name == ".debug_frame") {
-            debug_frame_offset_ = shdr.sh_offset;
-            debug_frame_size_ = shdr.sh_size;
-            debug_frame_section_bias_ = static_cast<uint64_t>(shdr.sh_addr) - shdr.sh_offset;
-          } else if (name == ".gnu_debugdata") {
-            gnu_debugdata_offset_ = shdr.sh_offset;
-            gnu_debugdata_size_ = shdr.sh_size;
-          } else if (name == ".eh_frame") {
-            eh_frame_offset_ = shdr.sh_offset;
-            eh_frame_section_bias_ = static_cast<uint64_t>(shdr.sh_addr) - shdr.sh_offset;
-            eh_frame_size_ = shdr.sh_size;
-          } else if (eh_frame_hdr_offset_ == 0 && name == ".eh_frame_hdr") {
-            eh_frame_hdr_offset_ = shdr.sh_offset;
-            eh_frame_hdr_section_bias_ = static_cast<uint64_t>(shdr.sh_addr) - shdr.sh_offset;
-            eh_frame_hdr_size_ = shdr.sh_size;
-          } else if (name == ".data") {
-            data_offset_ = shdr.sh_offset;
-            data_vaddr_start_ = shdr.sh_addr;
-            if (__builtin_add_overflow(data_vaddr_start_, shdr.sh_size, &data_vaddr_end_)) {
-              data_offset_ = 0;
-              data_vaddr_start_ = 0;
-              data_vaddr_end_ = 0;
-            }
-          }
-        }
-      }
-    } else if (shdr.sh_type == SHT_STRTAB) {
-      // In order to read soname, keep track of address to offset mapping.
-      strtabs_.push_back(std::make_pair<uint64_t, uint64_t>(static_cast<uint64_t>(shdr.sh_addr),
-                                                            static_cast<uint64_t>(shdr.sh_offset)));
-    } else if (shdr.sh_type == SHT_NOTE) {
-      if (shdr.sh_name < sec_size) {
-        std::string name;
-        if (memory_->ReadString(sec_offset + shdr.sh_name, &name) &&
-            name == ".note.gnu.build-id") {
-          gnu_build_id_offset_ = shdr.sh_offset;
-          gnu_build_id_size_ = shdr.sh_size;
-        }
-      }
-    }
-  }
-}
-
-template <typename DynType>
-std::string ElfInterface::GetSonameWithTemplate() {
-  if (soname_type_ == SONAME_INVALID) {
-    return "";
-  }
-  if (soname_type_ == SONAME_VALID) {
-    return soname_;
-  }
-
-  soname_type_ = SONAME_INVALID;
-
-  uint64_t soname_offset = 0;
-  uint64_t strtab_addr = 0;
-  uint64_t strtab_size = 0;
-
-  // Find the soname location from the dynamic headers section.
-  DynType dyn;
-  uint64_t offset = dynamic_offset_;
-  uint64_t max_offset = offset + dynamic_vaddr_end_ - dynamic_vaddr_start_;
-  for (uint64_t offset = dynamic_offset_; offset < max_offset; offset += sizeof(DynType)) {
-    if (!memory_->ReadFully(offset, &dyn, sizeof(dyn))) {
-      last_error_.code = ERROR_MEMORY_INVALID;
-      last_error_.address = offset;
-      return "";
-    }
-
-    if (dyn.d_tag == DT_STRTAB) {
-      strtab_addr = dyn.d_un.d_ptr;
-    } else if (dyn.d_tag == DT_STRSZ) {
-      strtab_size = dyn.d_un.d_val;
-    } else if (dyn.d_tag == DT_SONAME) {
-      soname_offset = dyn.d_un.d_val;
-    } else if (dyn.d_tag == DT_NULL) {
-      break;
-    }
-  }
-
-  // Need to map the strtab address to the real offset.
-  for (const auto& entry : strtabs_) {
-    if (entry.first == strtab_addr) {
-      soname_offset = entry.second + soname_offset;
-      if (soname_offset >= entry.second + strtab_size) {
-        return "";
-      }
-      if (!memory_->ReadString(soname_offset, &soname_)) {
-        return "";
-      }
-      soname_type_ = SONAME_VALID;
-      return soname_;
-    }
-  }
-  return "";
-}
-
-template <typename SymType>
-bool ElfInterface::GetFunctionNameWithTemplate(uint64_t addr, std::string* name,
-                                               uint64_t* func_offset) {
-  if (symbols_.empty()) {
-    return false;
-  }
-
-  for (const auto symbol : symbols_) {
-    if (symbol->GetName<SymType>(addr, memory_, name, func_offset)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-template <typename SymType>
-bool ElfInterface::GetGlobalVariableWithTemplate(const std::string& name, uint64_t* memory_address) {
-  if (symbols_.empty()) {
-    return false;
-  }
-
-  for (const auto symbol : symbols_) {
-    if (symbol->GetGlobal<SymType>(memory_, name, memory_address)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool ElfInterface::Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished) {
-  last_error_.code = ERROR_NONE;
-  last_error_.address = 0;
-
-  // Try the debug_frame first since it contains the most specific unwind
-  // information.
-  DwarfSection* debug_frame = debug_frame_.get();
-  if (debug_frame != nullptr && debug_frame->Step(pc, regs, process_memory, finished)) {
-    return true;
-  }
-
-  // Try the eh_frame next.
-  DwarfSection* eh_frame = eh_frame_.get();
-  if (eh_frame != nullptr && eh_frame->Step(pc, regs, process_memory, finished)) {
-    return true;
-  }
-
-  if (gnu_debugdata_interface_ != nullptr &&
-      gnu_debugdata_interface_->Step(pc, regs, process_memory, finished)) {
-    return true;
-  }
-
-  // Set the error code based on the first error encountered.
-  DwarfSection* section = nullptr;
-  if (debug_frame_ != nullptr) {
-    section = debug_frame_.get();
-  } else if (eh_frame_ != nullptr) {
-    section = eh_frame_.get();
-  } else if (gnu_debugdata_interface_ != nullptr) {
-    last_error_ = gnu_debugdata_interface_->last_error();
-    return false;
-  } else {
-    return false;
-  }
-
-  // Convert the DWARF ERROR to an external error.
-  DwarfErrorCode code = section->LastErrorCode();
-  switch (code) {
-    case DWARF_ERROR_NONE:
-      last_error_.code = ERROR_NONE;
-      break;
-
-    case DWARF_ERROR_MEMORY_INVALID:
-      last_error_.code = ERROR_MEMORY_INVALID;
-      last_error_.address = section->LastErrorAddress();
-      break;
-
-    case DWARF_ERROR_ILLEGAL_VALUE:
-    case DWARF_ERROR_ILLEGAL_STATE:
-    case DWARF_ERROR_STACK_INDEX_NOT_VALID:
-    case DWARF_ERROR_TOO_MANY_ITERATIONS:
-    case DWARF_ERROR_CFA_NOT_DEFINED:
-    case DWARF_ERROR_NO_FDES:
-      last_error_.code = ERROR_UNWIND_INFO;
-      break;
-
-    case DWARF_ERROR_NOT_IMPLEMENTED:
-    case DWARF_ERROR_UNSUPPORTED_VERSION:
-      last_error_.code = ERROR_UNSUPPORTED;
-      break;
-  }
-  return false;
-}
-
-// This is an estimation of the size of the elf file using the location
-// of the section headers and size. This assumes that the section headers
-// are at the end of the elf file. If the elf has a load bias, the size
-// will be too large, but this is acceptable.
-template <typename EhdrType>
-void ElfInterface::GetMaxSizeWithTemplate(Memory* memory, uint64_t* size) {
-  EhdrType ehdr;
-  if (!memory->ReadFully(0, &ehdr, sizeof(ehdr))) {
-    return;
-  }
-  if (ehdr.e_shnum == 0) {
-    return;
-  }
-  *size = ehdr.e_shoff + ehdr.e_shentsize * ehdr.e_shnum;
-}
-
-template <typename EhdrType, typename ShdrType>
-bool GetBuildIDInfo(Memory* memory, uint64_t* build_id_offset, uint64_t* build_id_size) {
-  EhdrType ehdr;
-  if (!memory->ReadFully(0, &ehdr, sizeof(ehdr))) {
-    return false;
-  }
-
-  uint64_t offset = ehdr.e_shoff;
-  uint64_t sec_offset;
-  uint64_t sec_size;
-  ShdrType shdr;
-  if (ehdr.e_shstrndx >= ehdr.e_shnum) {
-    return false;
-  }
-
-  uint64_t sh_offset = offset + ehdr.e_shstrndx * ehdr.e_shentsize;
-  if (!memory->ReadFully(sh_offset, &shdr, sizeof(shdr))) {
-    return false;
-  }
-  sec_offset = shdr.sh_offset;
-  sec_size = shdr.sh_size;
-
-  // Skip the first header, it's always going to be NULL.
-  offset += ehdr.e_shentsize;
-  for (size_t i = 1; i < ehdr.e_shnum; i++, offset += ehdr.e_shentsize) {
-    if (!memory->ReadFully(offset, &shdr, sizeof(shdr))) {
-      return false;
-    }
-    std::string name;
-    if (shdr.sh_type == SHT_NOTE && shdr.sh_name < sec_size &&
-        memory->ReadString(sec_offset + shdr.sh_name, &name) && name == ".note.gnu.build-id") {
-      *build_id_offset = shdr.sh_offset;
-      *build_id_size = shdr.sh_size;
-      return true;
-    }
-  }
-
-  return false;
-}
-
-template <typename EhdrType, typename ShdrType, typename NhdrType>
-std::string ElfInterface::ReadBuildIDFromMemory(Memory* memory) {
-  uint64_t note_offset;
-  uint64_t note_size;
-  if (!GetBuildIDInfo<EhdrType, ShdrType>(memory, &note_offset, &note_size)) {
-    return "";
-  }
-
-  // Ensure there is no overflow in any of the calculations below.
-  uint64_t tmp;
-  if (__builtin_add_overflow(note_offset, note_size, &tmp)) {
-    return "";
-  }
-
-  uint64_t offset = 0;
-  while (offset < note_size) {
-    if (note_size - offset < sizeof(NhdrType)) {
-      return "";
-    }
-    NhdrType hdr;
-    if (!memory->ReadFully(note_offset + offset, &hdr, sizeof(hdr))) {
-      return "";
-    }
-    offset += sizeof(hdr);
-
-    if (note_size - offset < hdr.n_namesz) {
-      return "";
-    }
-    if (hdr.n_namesz > 0) {
-      std::string name(hdr.n_namesz, '\0');
-      if (!memory->ReadFully(note_offset + offset, &(name[0]), hdr.n_namesz)) {
-        return "";
-      }
-
-      // Trim trailing \0 as GNU is stored as a C string in the ELF file.
-      if (name.back() == '\0') name.resize(name.size() - 1);
-
-      // Align hdr.n_namesz to next power multiple of 4. See man 5 elf.
-      offset += (hdr.n_namesz + 3) & ~3;
-
-      if (name == "GNU" && hdr.n_type == NT_GNU_BUILD_ID) {
-        if (note_size - offset < hdr.n_descsz || hdr.n_descsz == 0) {
-          return "";
-        }
-        std::string build_id(hdr.n_descsz - 1, '\0');
-        if (memory->ReadFully(note_offset + offset, &build_id[0], hdr.n_descsz)) {
-          return build_id;
-        }
-        return "";
-      }
-    }
-    // Align hdr.n_descsz to next power multiple of 4. See man 5 elf.
-    offset += (hdr.n_descsz + 3) & ~3;
-  }
-  return "";
-}
-
-// Instantiate all of the needed template functions.
-template void ElfInterface::InitHeadersWithTemplate<uint32_t>();
-template void ElfInterface::InitHeadersWithTemplate<uint64_t>();
-
-template bool ElfInterface::ReadAllHeaders<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr>(int64_t*);
-template bool ElfInterface::ReadAllHeaders<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr>(int64_t*);
-
-template void ElfInterface::ReadProgramHeaders<Elf32_Ehdr, Elf32_Phdr>(const Elf32_Ehdr&, int64_t*);
-template void ElfInterface::ReadProgramHeaders<Elf64_Ehdr, Elf64_Phdr>(const Elf64_Ehdr&, int64_t*);
-
-template void ElfInterface::ReadSectionHeaders<Elf32_Ehdr, Elf32_Shdr>(const Elf32_Ehdr&);
-template void ElfInterface::ReadSectionHeaders<Elf64_Ehdr, Elf64_Shdr>(const Elf64_Ehdr&);
-
-template std::string ElfInterface::ReadBuildID<Elf32_Nhdr>();
-template std::string ElfInterface::ReadBuildID<Elf64_Nhdr>();
-
-template std::string ElfInterface::GetSonameWithTemplate<Elf32_Dyn>();
-template std::string ElfInterface::GetSonameWithTemplate<Elf64_Dyn>();
-
-template bool ElfInterface::GetFunctionNameWithTemplate<Elf32_Sym>(uint64_t, std::string*,
-                                                                   uint64_t*);
-template bool ElfInterface::GetFunctionNameWithTemplate<Elf64_Sym>(uint64_t, std::string*,
-                                                                   uint64_t*);
-
-template bool ElfInterface::GetGlobalVariableWithTemplate<Elf32_Sym>(const std::string&, uint64_t*);
-template bool ElfInterface::GetGlobalVariableWithTemplate<Elf64_Sym>(const std::string&, uint64_t*);
-
-template void ElfInterface::GetMaxSizeWithTemplate<Elf32_Ehdr>(Memory*, uint64_t*);
-template void ElfInterface::GetMaxSizeWithTemplate<Elf64_Ehdr>(Memory*, uint64_t*);
-
-template int64_t ElfInterface::GetLoadBias<Elf32_Ehdr, Elf32_Phdr>(Memory*);
-template int64_t ElfInterface::GetLoadBias<Elf64_Ehdr, Elf64_Phdr>(Memory*);
-
-template std::string ElfInterface::ReadBuildIDFromMemory<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr>(
-    Memory*);
-template std::string ElfInterface::ReadBuildIDFromMemory<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr>(
-    Memory*);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/ElfInterfaceArm.cpp b/libunwindstack/ElfInterfaceArm.cpp
deleted file mode 100644
index 76f2dc8..0000000
--- a/libunwindstack/ElfInterfaceArm.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <stdint.h>
-
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsArm.h>
-
-#include "ArmExidx.h"
-#include "ElfInterfaceArm.h"
-
-namespace unwindstack {
-
-bool ElfInterfaceArm::Init(int64_t* load_bias) {
-  if (!ElfInterface32::Init(load_bias)) {
-    return false;
-  }
-  load_bias_ = *load_bias;
-  return true;
-}
-
-bool ElfInterfaceArm::FindEntry(uint32_t pc, uint64_t* entry_offset) {
-  if (start_offset_ == 0 || total_entries_ == 0) {
-    last_error_.code = ERROR_UNWIND_INFO;
-    return false;
-  }
-
-  size_t first = 0;
-  size_t last = total_entries_;
-  while (first < last) {
-    size_t current = (first + last) / 2;
-    uint32_t addr = addrs_[current];
-    if (addr == 0) {
-      if (!GetPrel31Addr(start_offset_ + current * 8, &addr)) {
-        return false;
-      }
-      addrs_[current] = addr;
-    }
-    if (pc == addr) {
-      *entry_offset = start_offset_ + current * 8;
-      return true;
-    }
-    if (pc < addr) {
-      last = current;
-    } else {
-      first = current + 1;
-    }
-  }
-  if (last != 0) {
-    *entry_offset = start_offset_ + (last - 1) * 8;
-    return true;
-  }
-  last_error_.code = ERROR_UNWIND_INFO;
-  return false;
-}
-
-bool ElfInterfaceArm::GetPrel31Addr(uint32_t offset, uint32_t* addr) {
-  uint32_t data;
-  if (!memory_->Read32(offset, &data)) {
-    last_error_.code = ERROR_MEMORY_INVALID;
-    last_error_.address = offset;
-    return false;
-  }
-
-  // Sign extend the value if necessary.
-  int32_t value = (static_cast<int32_t>(data) << 1) >> 1;
-  *addr = offset + value;
-  return true;
-}
-
-#if !defined(PT_ARM_EXIDX)
-#define PT_ARM_EXIDX 0x70000001
-#endif
-
-void ElfInterfaceArm::HandleUnknownType(uint32_t type, uint64_t ph_offset, uint64_t ph_filesz) {
-  if (type != PT_ARM_EXIDX) {
-    return;
-  }
-
-  // The offset already takes into account the load bias.
-  start_offset_ = ph_offset;
-
-  // Always use filesz instead of memsz. In most cases they are the same,
-  // but some shared libraries wind up setting one correctly and not the other.
-  total_entries_ = ph_filesz / 8;
-}
-
-bool ElfInterfaceArm::Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished) {
-  // Dwarf unwind information is precise about whether a pc is covered or not,
-  // but arm unwind information only has ranges of pc. In order to avoid
-  // incorrectly doing a bad unwind using arm unwind information for a
-  // different function, always try and unwind with the dwarf information first.
-  return ElfInterface32::Step(pc, regs, process_memory, finished) ||
-         StepExidx(pc, regs, process_memory, finished);
-}
-
-bool ElfInterfaceArm::StepExidx(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished) {
-  // Adjust the load bias to get the real relative pc.
-  if (pc < load_bias_) {
-    last_error_.code = ERROR_UNWIND_INFO;
-    return false;
-  }
-  pc -= load_bias_;
-
-  RegsArm* regs_arm = reinterpret_cast<RegsArm*>(regs);
-  uint64_t entry_offset;
-  if (!FindEntry(pc, &entry_offset)) {
-    return false;
-  }
-
-  ArmExidx arm(regs_arm, memory_, process_memory);
-  arm.set_cfa(regs_arm->sp());
-  bool return_value = false;
-  if (arm.ExtractEntryData(entry_offset) && arm.Eval()) {
-    // If the pc was not set, then use the LR registers for the PC.
-    if (!arm.pc_set()) {
-      (*regs_arm)[ARM_REG_PC] = (*regs_arm)[ARM_REG_LR];
-    }
-    (*regs_arm)[ARM_REG_SP] = arm.cfa();
-    return_value = true;
-
-    // If the pc was set to zero, consider this the final frame.
-    *finished = (regs_arm->pc() == 0) ? true : false;
-  }
-
-  if (arm.status() == ARM_STATUS_NO_UNWIND) {
-    *finished = true;
-    return true;
-  }
-
-  if (!return_value) {
-    switch (arm.status()) {
-      case ARM_STATUS_NONE:
-      case ARM_STATUS_NO_UNWIND:
-      case ARM_STATUS_FINISH:
-        last_error_.code = ERROR_NONE;
-        break;
-
-      case ARM_STATUS_RESERVED:
-      case ARM_STATUS_SPARE:
-      case ARM_STATUS_TRUNCATED:
-      case ARM_STATUS_MALFORMED:
-      case ARM_STATUS_INVALID_ALIGNMENT:
-      case ARM_STATUS_INVALID_PERSONALITY:
-        last_error_.code = ERROR_UNWIND_INFO;
-        break;
-
-      case ARM_STATUS_READ_FAILED:
-        last_error_.code = ERROR_MEMORY_INVALID;
-        last_error_.address = arm.status_address();
-        break;
-    }
-  }
-  return return_value;
-}
-
-bool ElfInterfaceArm::GetFunctionName(uint64_t addr, std::string* name, uint64_t* offset) {
-  // For ARM, thumb function symbols have bit 0 set, but the address passed
-  // in here might not have this bit set and result in a failure to find
-  // the thumb function names. Adjust the address and offset to account
-  // for this possible case.
-  if (ElfInterface32::GetFunctionName(addr | 1, name, offset)) {
-    *offset &= ~1;
-    return true;
-  }
-  return false;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/ElfInterfaceArm.h b/libunwindstack/ElfInterfaceArm.h
deleted file mode 100644
index 1d71cac..0000000
--- a/libunwindstack/ElfInterfaceArm.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_ELF_INTERFACE_ARM_H
-#define _LIBUNWINDSTACK_ELF_INTERFACE_ARM_H
-
-#include <elf.h>
-#include <stdint.h>
-
-#include <iterator>
-#include <unordered_map>
-
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class ElfInterfaceArm : public ElfInterface32 {
- public:
-  ElfInterfaceArm(Memory* memory) : ElfInterface32(memory) {}
-  virtual ~ElfInterfaceArm() = default;
-
-  class iterator : public std::iterator<std::bidirectional_iterator_tag, uint32_t> {
-   public:
-    iterator(ElfInterfaceArm* interface, size_t index) : interface_(interface), index_(index) { }
-
-    iterator& operator++() { index_++; return *this; }
-    iterator& operator++(int increment) { index_ += increment; return *this; }
-    iterator& operator--() { index_--; return *this; }
-    iterator& operator--(int decrement) { index_ -= decrement; return *this; }
-
-    bool operator==(const iterator& rhs) { return this->index_ == rhs.index_; }
-    bool operator!=(const iterator& rhs) { return this->index_ != rhs.index_; }
-
-    uint32_t operator*() {
-      uint32_t addr = interface_->addrs_[index_];
-      if (addr == 0) {
-        if (!interface_->GetPrel31Addr(interface_->start_offset_ + index_ * 8, &addr)) {
-          return 0;
-        }
-        interface_->addrs_[index_] = addr;
-      }
-      return addr;
-    }
-
-   private:
-    ElfInterfaceArm* interface_ = nullptr;
-    size_t index_ = 0;
-  };
-
-  iterator begin() { return iterator(this, 0); }
-  iterator end() { return iterator(this, total_entries_); }
-
-  bool Init(int64_t* section_bias) override;
-
-  bool GetPrel31Addr(uint32_t offset, uint32_t* addr);
-
-  bool FindEntry(uint32_t pc, uint64_t* entry_offset);
-
-  void HandleUnknownType(uint32_t type, uint64_t ph_offset, uint64_t ph_filesz) override;
-
-  bool Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished) override;
-
-  bool StepExidx(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished);
-
-  bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* offset) override;
-
-  uint64_t start_offset() { return start_offset_; }
-
-  size_t total_entries() { return total_entries_; }
-
-  void set_load_bias(uint64_t load_bias) { load_bias_ = load_bias; }
-
- protected:
-  uint64_t start_offset_ = 0;
-  size_t total_entries_ = 0;
-  uint64_t load_bias_ = 0;
-
-  std::unordered_map<size_t, uint32_t> addrs_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_ELF_INTERFACE_ARM_H
diff --git a/libunwindstack/Global.cpp b/libunwindstack/Global.cpp
deleted file mode 100644
index ee6c8a5..0000000
--- a/libunwindstack/Global.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <string>
-#include <vector>
-
-#include <unwindstack/Global.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-Global::Global(std::shared_ptr<Memory>& memory) : memory_(memory) {}
-Global::Global(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs)
-    : memory_(memory), search_libs_(search_libs) {}
-
-void Global::SetArch(ArchEnum arch) {
-  if (arch_ == ARCH_UNKNOWN) {
-    arch_ = arch;
-    ProcessArch();
-  }
-}
-
-bool Global::Searchable(const std::string& name) {
-  if (search_libs_.empty()) {
-    return true;
-  }
-
-  if (name.empty()) {
-    return false;
-  }
-
-  const char* base_name = basename(name.c_str());
-  for (const std::string& lib : search_libs_) {
-    if (base_name == lib) {
-      return true;
-    }
-  }
-  return false;
-}
-
-void Global::FindAndReadVariable(Maps* maps, const char* var_str) {
-  std::string variable(var_str);
-  // When looking for global variables, do not arbitrarily search every
-  // readable map. Instead look for a specific pattern that must exist.
-  // The pattern should be a readable map, followed by a read-write
-  // map with a non-zero offset.
-  // For example:
-  //   f0000-f1000 0 r-- /system/lib/libc.so
-  //   f1000-f2000 1000 r-x /system/lib/libc.so
-  //   f2000-f3000 2000 rw- /system/lib/libc.so
-  // This also works:
-  //   f0000-f2000 0 r-- /system/lib/libc.so
-  //   f2000-f3000 2000 rw- /system/lib/libc.so
-  // It is also possible to see empty maps after the read-only like so:
-  //   f0000-f1000 0 r-- /system/lib/libc.so
-  //   f1000-f2000 0 ---
-  //   f2000-f3000 1000 r-x /system/lib/libc.so
-  //   f3000-f4000 2000 rw- /system/lib/libc.so
-  MapInfo* map_zero = nullptr;
-  for (const auto& info : *maps) {
-    if (info->offset != 0 && (info->flags & (PROT_READ | PROT_WRITE)) == (PROT_READ | PROT_WRITE) &&
-        map_zero != nullptr && Searchable(info->name) && info->name == map_zero->name) {
-      Elf* elf = map_zero->GetElf(memory_, arch());
-      uint64_t ptr;
-      if (elf->GetGlobalVariableOffset(variable, &ptr) && ptr != 0) {
-        uint64_t offset_end = info->offset + info->end - info->start;
-        if (ptr >= info->offset && ptr < offset_end) {
-          ptr = info->start + ptr - info->offset;
-          if (ReadVariableData(ptr)) {
-            break;
-          }
-        }
-      }
-    } else if (info->offset == 0 && !info->name.empty()) {
-      map_zero = info.get();
-    }
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/JitDebug.cpp b/libunwindstack/JitDebug.cpp
deleted file mode 100644
index 8a85607..0000000
--- a/libunwindstack/JitDebug.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <sys/mman.h>
-
-#include <memory>
-#include <vector>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/Maps.h>
-
-#include "MemoryRange.h"
-
-// This implements the JIT Compilation Interface.
-// See https://sourceware.org/gdb/onlinedocs/gdb/JIT-Interface.html
-
-namespace unwindstack {
-
-struct JITCodeEntry32Pack {
-  uint32_t next;
-  uint32_t prev;
-  uint32_t symfile_addr;
-  uint64_t symfile_size;
-} __attribute__((packed));
-
-struct JITCodeEntry32Pad {
-  uint32_t next;
-  uint32_t prev;
-  uint32_t symfile_addr;
-  uint32_t pad;
-  uint64_t symfile_size;
-};
-
-struct JITCodeEntry64 {
-  uint64_t next;
-  uint64_t prev;
-  uint64_t symfile_addr;
-  uint64_t symfile_size;
-};
-
-struct JITDescriptorHeader {
-  uint32_t version;
-  uint32_t action_flag;
-};
-
-struct JITDescriptor32 {
-  JITDescriptorHeader header;
-  uint32_t relevant_entry;
-  uint32_t first_entry;
-};
-
-struct JITDescriptor64 {
-  JITDescriptorHeader header;
-  uint64_t relevant_entry;
-  uint64_t first_entry;
-};
-
-JitDebug::JitDebug(std::shared_ptr<Memory>& memory) : Global(memory) {}
-
-JitDebug::JitDebug(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs)
-    : Global(memory, search_libs) {}
-
-JitDebug::~JitDebug() {
-  for (auto* elf : elf_list_) {
-    delete elf;
-  }
-}
-
-uint64_t JitDebug::ReadDescriptor32(uint64_t addr) {
-  JITDescriptor32 desc;
-  if (!memory_->ReadFully(addr, &desc, sizeof(desc))) {
-    return 0;
-  }
-
-  if (desc.header.version != 1 || desc.first_entry == 0) {
-    // Either unknown version, or no jit entries.
-    return 0;
-  }
-
-  return desc.first_entry;
-}
-
-uint64_t JitDebug::ReadDescriptor64(uint64_t addr) {
-  JITDescriptor64 desc;
-  if (!memory_->ReadFully(addr, &desc, sizeof(desc))) {
-    return 0;
-  }
-
-  if (desc.header.version != 1 || desc.first_entry == 0) {
-    // Either unknown version, or no jit entries.
-    return 0;
-  }
-
-  return desc.first_entry;
-}
-
-uint64_t JitDebug::ReadEntry32Pack(uint64_t* start, uint64_t* size) {
-  JITCodeEntry32Pack code;
-  if (!memory_->ReadFully(entry_addr_, &code, sizeof(code))) {
-    return 0;
-  }
-
-  *start = code.symfile_addr;
-  *size = code.symfile_size;
-  return code.next;
-}
-
-uint64_t JitDebug::ReadEntry32Pad(uint64_t* start, uint64_t* size) {
-  JITCodeEntry32Pad code;
-  if (!memory_->ReadFully(entry_addr_, &code, sizeof(code))) {
-    return 0;
-  }
-
-  *start = code.symfile_addr;
-  *size = code.symfile_size;
-  return code.next;
-}
-
-uint64_t JitDebug::ReadEntry64(uint64_t* start, uint64_t* size) {
-  JITCodeEntry64 code;
-  if (!memory_->ReadFully(entry_addr_, &code, sizeof(code))) {
-    return 0;
-  }
-
-  *start = code.symfile_addr;
-  *size = code.symfile_size;
-  return code.next;
-}
-
-void JitDebug::ProcessArch() {
-  switch (arch()) {
-    case ARCH_X86:
-      read_descriptor_func_ = &JitDebug::ReadDescriptor32;
-      read_entry_func_ = &JitDebug::ReadEntry32Pack;
-      break;
-
-    case ARCH_ARM:
-    case ARCH_MIPS:
-      read_descriptor_func_ = &JitDebug::ReadDescriptor32;
-      read_entry_func_ = &JitDebug::ReadEntry32Pad;
-      break;
-
-    case ARCH_ARM64:
-    case ARCH_X86_64:
-    case ARCH_MIPS64:
-      read_descriptor_func_ = &JitDebug::ReadDescriptor64;
-      read_entry_func_ = &JitDebug::ReadEntry64;
-      break;
-    case ARCH_UNKNOWN:
-      abort();
-  }
-}
-
-bool JitDebug::ReadVariableData(uint64_t ptr) {
-  entry_addr_ = (this->*read_descriptor_func_)(ptr);
-  return entry_addr_ != 0;
-}
-
-void JitDebug::Init(Maps* maps) {
-  if (initialized_) {
-    return;
-  }
-  // Regardless of what happens below, consider the init finished.
-  initialized_ = true;
-
-  FindAndReadVariable(maps, "__jit_debug_descriptor");
-}
-
-Elf* JitDebug::GetElf(Maps* maps, uint64_t pc) {
-  // Use a single lock, this object should be used so infrequently that
-  // a fine grain lock is unnecessary.
-  std::lock_guard<std::mutex> guard(lock_);
-  if (!initialized_) {
-    Init(maps);
-  }
-
-  // Search the existing elf object first.
-  for (Elf* elf : elf_list_) {
-    if (elf->IsValidPc(pc)) {
-      return elf;
-    }
-  }
-
-  while (entry_addr_ != 0) {
-    uint64_t start;
-    uint64_t size;
-    entry_addr_ = (this->*read_entry_func_)(&start, &size);
-
-    Elf* elf = new Elf(new MemoryRange(memory_, start, size, 0));
-    elf->Init();
-    if (!elf->valid()) {
-      // The data is not formatted in a way we understand, do not attempt
-      // to process any other entries.
-      entry_addr_ = 0;
-      delete elf;
-      return nullptr;
-    }
-    elf_list_.push_back(elf);
-
-    if (elf->IsValidPc(pc)) {
-      return elf;
-    }
-  }
-  return nullptr;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/LocalUnwinder.cpp b/libunwindstack/LocalUnwinder.cpp
deleted file mode 100644
index 5d81200..0000000
--- a/libunwindstack/LocalUnwinder.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/LocalUnwinder.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
-
-namespace unwindstack {
-
-bool LocalUnwinder::Init() {
-  pthread_rwlock_init(&maps_rwlock_, nullptr);
-
-  // Create the maps.
-  maps_.reset(new unwindstack::LocalUpdatableMaps());
-  if (!maps_->Parse()) {
-    maps_.reset();
-    return false;
-  }
-
-  process_memory_ = unwindstack::Memory::CreateProcessMemory(getpid());
-
-  return true;
-}
-
-bool LocalUnwinder::ShouldSkipLibrary(const std::string& map_name) {
-  for (const std::string& skip_library : skip_libraries_) {
-    if (skip_library == map_name) {
-      return true;
-    }
-  }
-  return false;
-}
-
-MapInfo* LocalUnwinder::GetMapInfo(uint64_t pc) {
-  pthread_rwlock_rdlock(&maps_rwlock_);
-  MapInfo* map_info = maps_->Find(pc);
-  pthread_rwlock_unlock(&maps_rwlock_);
-
-  if (map_info == nullptr) {
-    pthread_rwlock_wrlock(&maps_rwlock_);
-    // This is guaranteed not to invalidate any previous MapInfo objects so
-    // we don't need to worry about any MapInfo* values already in use.
-    if (maps_->Reparse()) {
-      map_info = maps_->Find(pc);
-    }
-    pthread_rwlock_unlock(&maps_rwlock_);
-  }
-
-  return map_info;
-}
-
-bool LocalUnwinder::Unwind(std::vector<LocalFrameData>* frame_info, size_t max_frames) {
-  std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::CreateFromLocal());
-  unwindstack::RegsGetLocal(regs.get());
-  ArchEnum arch = regs->Arch();
-
-  size_t num_frames = 0;
-  bool adjust_pc = false;
-  while (true) {
-    uint64_t cur_pc = regs->pc();
-    uint64_t cur_sp = regs->sp();
-
-    MapInfo* map_info = GetMapInfo(cur_pc);
-    if (map_info == nullptr) {
-      break;
-    }
-
-    Elf* elf = map_info->GetElf(process_memory_, arch);
-    uint64_t rel_pc = elf->GetRelPc(cur_pc, map_info);
-    uint64_t step_pc = rel_pc;
-    uint64_t pc_adjustment;
-    if (adjust_pc) {
-      pc_adjustment = regs->GetPcAdjustment(rel_pc, elf);
-    } else {
-      pc_adjustment = 0;
-    }
-    step_pc -= pc_adjustment;
-
-    bool finished = false;
-    if (elf->StepIfSignalHandler(rel_pc, regs.get(), process_memory_.get())) {
-      step_pc = rel_pc;
-    } else if (!elf->Step(step_pc, regs.get(), process_memory_.get(), &finished)) {
-      finished = true;
-    }
-
-    // Skip any locations that are within this library.
-    if (num_frames != 0 || !ShouldSkipLibrary(map_info->name)) {
-      // Add frame information.
-      std::string func_name;
-      uint64_t func_offset;
-      if (elf->GetFunctionName(rel_pc, &func_name, &func_offset)) {
-        frame_info->emplace_back(map_info, cur_pc - pc_adjustment, rel_pc - pc_adjustment,
-                                 func_name, func_offset);
-      } else {
-        frame_info->emplace_back(map_info, cur_pc - pc_adjustment, rel_pc - pc_adjustment, "", 0);
-      }
-      num_frames++;
-    }
-
-    if (finished || frame_info->size() == max_frames ||
-        (cur_pc == regs->pc() && cur_sp == regs->sp())) {
-      break;
-    }
-    adjust_pc = true;
-  }
-  return num_frames != 0;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/Log.cpp b/libunwindstack/Log.cpp
deleted file mode 100644
index 436e23c..0000000
--- a/libunwindstack/Log.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#include <string>
-
-#define LOG_TAG "unwind"
-#include <log/log.h>
-
-#include <android-base/stringprintf.h>
-
-#include <unwindstack/Log.h>
-
-namespace unwindstack {
-
-static bool g_print_to_stdout = false;
-
-void log_to_stdout(bool enable) {
-  g_print_to_stdout = enable;
-}
-
-// Send the data to the log.
-void log(uint8_t indent, const char* format, ...) {
-  std::string real_format;
-  if (indent > 0) {
-    real_format = android::base::StringPrintf("%*s%s", 2 * indent, " ", format);
-  } else {
-    real_format = format;
-  }
-  va_list args;
-  va_start(args, format);
-  if (g_print_to_stdout) {
-    real_format += '\n';
-    vprintf(real_format.c_str(), args);
-  } else {
-    LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, real_format.c_str(), args);
-  }
-  va_end(args);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp
deleted file mode 100644
index 31f3144..0000000
--- a/libunwindstack/MapInfo.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-
-#include <android-base/stringprintf.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-
-#include "MemoryFileAtOffset.h"
-#include "MemoryRange.h"
-
-namespace unwindstack {
-
-bool MapInfo::InitFileMemoryFromPreviousReadOnlyMap(MemoryFileAtOffset* memory) {
-  // One last attempt, see if the previous map is read-only with the
-  // same name and stretches across this map.
-  if (prev_real_map == nullptr || prev_real_map->flags != PROT_READ) {
-    return false;
-  }
-
-  uint64_t map_size = end - prev_real_map->end;
-  if (!memory->Init(name, prev_real_map->offset, map_size)) {
-    return false;
-  }
-
-  uint64_t max_size;
-  if (!Elf::GetInfo(memory, &max_size) || max_size < map_size) {
-    return false;
-  }
-
-  if (!memory->Init(name, prev_real_map->offset, max_size)) {
-    return false;
-  }
-
-  elf_offset = offset - prev_real_map->offset;
-  elf_start_offset = prev_real_map->offset;
-  return true;
-}
-
-Memory* MapInfo::GetFileMemory() {
-  std::unique_ptr<MemoryFileAtOffset> memory(new MemoryFileAtOffset);
-  if (offset == 0) {
-    if (memory->Init(name, 0)) {
-      return memory.release();
-    }
-    return nullptr;
-  }
-
-  // These are the possibilities when the offset is non-zero.
-  // - There is an elf file embedded in a file, and the offset is the
-  //   the start of the elf in the file.
-  // - There is an elf file embedded in a file, and the offset is the
-  //   the start of the executable part of the file. The actual start
-  //   of the elf is in the read-only segment preceeding this map.
-  // - The whole file is an elf file, and the offset needs to be saved.
-  //
-  // Map in just the part of the file for the map. If this is not
-  // a valid elf, then reinit as if the whole file is an elf file.
-  // If the offset is a valid elf, then determine the size of the map
-  // and reinit to that size. This is needed because the dynamic linker
-  // only maps in a portion of the original elf, and never the symbol
-  // file data.
-  uint64_t map_size = end - start;
-  if (!memory->Init(name, offset, map_size)) {
-    return nullptr;
-  }
-
-  // Check if the start of this map is an embedded elf.
-  uint64_t max_size = 0;
-  if (Elf::GetInfo(memory.get(), &max_size)) {
-    elf_start_offset = offset;
-    if (max_size > map_size) {
-      if (memory->Init(name, offset, max_size)) {
-        return memory.release();
-      }
-      // Try to reinit using the default map_size.
-      if (memory->Init(name, offset, map_size)) {
-        return memory.release();
-      }
-      elf_start_offset = 0;
-      return nullptr;
-    }
-    return memory.release();
-  }
-
-  // No elf at offset, try to init as if the whole file is an elf.
-  if (memory->Init(name, 0) && Elf::IsValidElf(memory.get())) {
-    elf_offset = offset;
-    // Need to check how to set the elf start offset. If this map is not
-    // the r-x map of a r-- map, then use the real offset value. Otherwise,
-    // use 0.
-    if (prev_real_map == nullptr || prev_real_map->offset != 0 ||
-        prev_real_map->flags != PROT_READ || prev_real_map->name != name) {
-      elf_start_offset = offset;
-    }
-    return memory.release();
-  }
-
-  // See if the map previous to this one contains a read-only map
-  // that represents the real start of the elf data.
-  if (InitFileMemoryFromPreviousReadOnlyMap(memory.get())) {
-    return memory.release();
-  }
-
-  // Failed to find elf at start of file or at read-only map, return
-  // file object from the current map.
-  if (memory->Init(name, offset, map_size)) {
-    return memory.release();
-  }
-  return nullptr;
-}
-
-Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) {
-  if (end <= start) {
-    return nullptr;
-  }
-
-  elf_offset = 0;
-
-  // Fail on device maps.
-  if (flags & MAPS_FLAGS_DEVICE_MAP) {
-    return nullptr;
-  }
-
-  // First try and use the file associated with the info.
-  if (!name.empty()) {
-    Memory* memory = GetFileMemory();
-    if (memory != nullptr) {
-      return memory;
-    }
-  }
-
-  if (process_memory == nullptr) {
-    return nullptr;
-  }
-
-  // Need to verify that this elf is valid. It's possible that
-  // only part of the elf file to be mapped into memory is in the executable
-  // map. In this case, there will be another read-only map that includes the
-  // first part of the elf file. This is done if the linker rosegment
-  // option is used.
-  std::unique_ptr<MemoryRange> memory(new MemoryRange(process_memory, start, end - start, 0));
-  if (Elf::IsValidElf(memory.get())) {
-    memory_backed_elf = true;
-    return memory.release();
-  }
-
-  // Find the read-only map by looking at the previous map. The linker
-  // doesn't guarantee that this invariant will always be true. However,
-  // if that changes, there is likely something else that will change and
-  // break something.
-  if (offset == 0 || name.empty() || prev_real_map == nullptr || prev_real_map->name != name ||
-      prev_real_map->offset >= offset) {
-    return nullptr;
-  }
-
-  // Make sure that relative pc values are corrected properly.
-  elf_offset = offset - prev_real_map->offset;
-  // Use this as the elf start offset, otherwise, you always get offsets into
-  // the r-x section, which is not quite the right information.
-  elf_start_offset = prev_real_map->offset;
-
-  MemoryRanges* ranges = new MemoryRanges;
-  ranges->Insert(new MemoryRange(process_memory, prev_real_map->start,
-                                 prev_real_map->end - prev_real_map->start, 0));
-  ranges->Insert(new MemoryRange(process_memory, start, end - start, elf_offset));
-
-  memory_backed_elf = true;
-  return ranges;
-}
-
-Elf* MapInfo::GetElf(const std::shared_ptr<Memory>& process_memory, ArchEnum expected_arch) {
-  {
-    // Make sure no other thread is trying to add the elf to this map.
-    std::lock_guard<std::mutex> guard(mutex_);
-
-    if (elf.get() != nullptr) {
-      return elf.get();
-    }
-
-    bool locked = false;
-    if (Elf::CachingEnabled() && !name.empty()) {
-      Elf::CacheLock();
-      locked = true;
-      if (Elf::CacheGet(this)) {
-        Elf::CacheUnlock();
-        return elf.get();
-      }
-    }
-
-    Memory* memory = CreateMemory(process_memory);
-    if (locked) {
-      if (Elf::CacheAfterCreateMemory(this)) {
-        delete memory;
-        Elf::CacheUnlock();
-        return elf.get();
-      }
-    }
-    elf.reset(new Elf(memory));
-    // If the init fails, keep the elf around as an invalid object so we
-    // don't try to reinit the object.
-    elf->Init();
-    if (elf->valid() && expected_arch != elf->arch()) {
-      // Make the elf invalid, mismatch between arch and expected arch.
-      elf->Invalidate();
-    }
-
-    if (locked) {
-      Elf::CacheAdd(this);
-      Elf::CacheUnlock();
-    }
-  }
-
-  if (!elf->valid()) {
-    elf_start_offset = offset;
-  } else if (prev_real_map != nullptr && elf_start_offset != offset &&
-             prev_real_map->offset == elf_start_offset && prev_real_map->name == name) {
-    // If there is a read-only map then a read-execute map that represents the
-    // same elf object, make sure the previous map is using the same elf
-    // object if it hasn't already been set.
-    std::lock_guard<std::mutex> guard(prev_real_map->mutex_);
-    if (prev_real_map->elf.get() == nullptr) {
-      prev_real_map->elf = elf;
-      prev_real_map->memory_backed_elf = memory_backed_elf;
-    }
-  }
-  return elf.get();
-}
-
-bool MapInfo::GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset) {
-  {
-    // Make sure no other thread is trying to update this elf object.
-    std::lock_guard<std::mutex> guard(mutex_);
-    if (elf == nullptr) {
-      return false;
-    }
-  }
-  // No longer need the lock, once the elf object is created, it is not deleted
-  // until this object is deleted.
-  return elf->GetFunctionName(addr, name, func_offset);
-}
-
-uint64_t MapInfo::GetLoadBias(const std::shared_ptr<Memory>& process_memory) {
-  int64_t cur_load_bias = load_bias.load();
-  if (cur_load_bias != INT64_MAX) {
-    return cur_load_bias;
-  }
-
-  {
-    // Make sure no other thread is trying to add the elf to this map.
-    std::lock_guard<std::mutex> guard(mutex_);
-    if (elf != nullptr) {
-      if (elf->valid()) {
-        cur_load_bias = elf->GetLoadBias();
-        load_bias = cur_load_bias;
-        return cur_load_bias;
-      } else {
-        load_bias = 0;
-        return 0;
-      }
-    }
-  }
-
-  // Call lightweight static function that will only read enough of the
-  // elf data to get the load bias.
-  std::unique_ptr<Memory> memory(CreateMemory(process_memory));
-  cur_load_bias = Elf::GetLoadBias(memory.get());
-  load_bias = cur_load_bias;
-  return cur_load_bias;
-}
-
-MapInfo::~MapInfo() {
-  uintptr_t id = build_id.load();
-  if (id != 0) {
-    delete reinterpret_cast<std::string*>(id);
-  }
-}
-
-std::string MapInfo::GetBuildID() {
-  uintptr_t id = build_id.load();
-  if (id != 0) {
-    return *reinterpret_cast<std::string*>(id);
-  }
-
-  // No need to lock, at worst if multiple threads do this at the same
-  // time it should be detected and only one thread should win and
-  // save the data.
-  std::unique_ptr<std::string> cur_build_id(new std::string);
-
-  // Now need to see if the elf object exists.
-  // Make sure no other thread is trying to add the elf to this map.
-  mutex_.lock();
-  Elf* elf_obj = elf.get();
-  mutex_.unlock();
-  if (elf_obj != nullptr) {
-    *cur_build_id = elf_obj->GetBuildID();
-  } else {
-    // This will only work if we can get the file associated with this memory.
-    // If this is only available in memory, then the section name information
-    // is not present and we will not be able to find the build id info.
-    std::unique_ptr<Memory> memory(GetFileMemory());
-    if (memory != nullptr) {
-      *cur_build_id = Elf::GetBuildID(memory.get());
-    }
-  }
-
-  id = reinterpret_cast<uintptr_t>(cur_build_id.get());
-  uintptr_t expected_id = 0;
-  if (build_id.compare_exchange_weak(expected_id, id)) {
-    // Value saved, so make sure the memory is not freed.
-    cur_build_id.release();
-  }
-  return *reinterpret_cast<std::string*>(id);
-}
-
-std::string MapInfo::GetPrintableBuildID() {
-  std::string raw_build_id = GetBuildID();
-  if (raw_build_id.empty()) {
-    return "";
-  }
-  std::string printable_build_id;
-  for (const char& c : raw_build_id) {
-    // Use %hhx to avoid sign extension on abis that have signed chars.
-    printable_build_id += android::base::StringPrintf("%02hhx", c);
-  }
-  return printable_build_id;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/Maps.cpp b/libunwindstack/Maps.cpp
deleted file mode 100644
index 670d904..0000000
--- a/libunwindstack/Maps.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <android-base/unique_fd.h>
-#include <procinfo/process_map.h>
-
-#include <algorithm>
-#include <cctype>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-MapInfo* Maps::Find(uint64_t pc) {
-  if (maps_.empty()) {
-    return nullptr;
-  }
-  size_t first = 0;
-  size_t last = maps_.size();
-  while (first < last) {
-    size_t index = (first + last) / 2;
-    const auto& cur = maps_[index];
-    if (pc >= cur->start && pc < cur->end) {
-      return cur.get();
-    } else if (pc < cur->start) {
-      last = index;
-    } else {
-      first = index + 1;
-    }
-  }
-  return nullptr;
-}
-
-bool Maps::Parse() {
-  MapInfo* prev_map = nullptr;
-  MapInfo* prev_real_map = nullptr;
-  return android::procinfo::ReadMapFile(
-      GetMapsFile(),
-      [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t, const char* name) {
-        // Mark a device map in /dev/ and not in /dev/ashmem/ specially.
-        if (strncmp(name, "/dev/", 5) == 0 && strncmp(name + 5, "ashmem/", 7) != 0) {
-          flags |= unwindstack::MAPS_FLAGS_DEVICE_MAP;
-        }
-        maps_.emplace_back(new MapInfo(prev_map, prev_real_map, start, end, pgoff, flags, name));
-        prev_map = maps_.back().get();
-        if (!prev_map->IsBlank()) {
-          prev_real_map = prev_map;
-        }
-      });
-}
-
-void Maps::Add(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags,
-               const std::string& name, uint64_t load_bias) {
-  MapInfo* prev_map = maps_.empty() ? nullptr : maps_.back().get();
-  MapInfo* prev_real_map = prev_map;
-  while (prev_real_map != nullptr && prev_real_map->IsBlank()) {
-    prev_real_map = prev_real_map->prev_map;
-  }
-
-  auto map_info =
-      std::make_unique<MapInfo>(prev_map, prev_real_map, start, end, offset, flags, name);
-  map_info->load_bias = load_bias;
-  maps_.emplace_back(std::move(map_info));
-}
-
-void Maps::Sort() {
-  std::sort(maps_.begin(), maps_.end(),
-            [](const std::unique_ptr<MapInfo>& a, const std::unique_ptr<MapInfo>& b) {
-              return a->start < b->start; });
-
-  // Set the prev_map values on the info objects.
-  MapInfo* prev_map = nullptr;
-  MapInfo* prev_real_map = nullptr;
-  for (const auto& map_info : maps_) {
-    map_info->prev_map = prev_map;
-    map_info->prev_real_map = prev_real_map;
-    prev_map = map_info.get();
-    if (!prev_map->IsBlank()) {
-      prev_real_map = prev_map;
-    }
-  }
-}
-
-bool BufferMaps::Parse() {
-  std::string content(buffer_);
-  MapInfo* prev_map = nullptr;
-  MapInfo* prev_real_map = nullptr;
-  return android::procinfo::ReadMapFileContent(
-      &content[0],
-      [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t, const char* name) {
-        // Mark a device map in /dev/ and not in /dev/ashmem/ specially.
-        if (strncmp(name, "/dev/", 5) == 0 && strncmp(name + 5, "ashmem/", 7) != 0) {
-          flags |= unwindstack::MAPS_FLAGS_DEVICE_MAP;
-        }
-        maps_.emplace_back(new MapInfo(prev_map, prev_real_map, start, end, pgoff, flags, name));
-        prev_map = maps_.back().get();
-        if (!prev_map->IsBlank()) {
-          prev_real_map = prev_map;
-        }
-      });
-}
-
-const std::string RemoteMaps::GetMapsFile() const {
-  return "/proc/" + std::to_string(pid_) + "/maps";
-}
-
-const std::string LocalUpdatableMaps::GetMapsFile() const {
-  return "/proc/self/maps";
-}
-
-bool LocalUpdatableMaps::Reparse() {
-  // New maps will be added at the end without deleting the old ones.
-  size_t last_map_idx = maps_.size();
-  if (!Parse()) {
-    maps_.resize(last_map_idx);
-    return false;
-  }
-
-  size_t total_entries = maps_.size();
-  size_t search_map_idx = 0;
-  for (size_t new_map_idx = last_map_idx; new_map_idx < maps_.size(); new_map_idx++) {
-    auto& new_map_info = maps_[new_map_idx];
-    uint64_t start = new_map_info->start;
-    uint64_t end = new_map_info->end;
-    uint64_t flags = new_map_info->flags;
-    std::string* name = &new_map_info->name;
-    for (size_t old_map_idx = search_map_idx; old_map_idx < last_map_idx; old_map_idx++) {
-      auto& info = maps_[old_map_idx];
-      if (start == info->start && end == info->end && flags == info->flags && *name == info->name) {
-        // No need to check
-        search_map_idx = old_map_idx + 1;
-        if (new_map_idx + 1 < maps_.size()) {
-          maps_[new_map_idx + 1]->prev_map = info.get();
-          maps_[new_map_idx + 1]->prev_real_map =
-              info->IsBlank() ? info->prev_real_map : info.get();
-        }
-        maps_[new_map_idx] = nullptr;
-        total_entries--;
-        break;
-      } else if (info->start > start) {
-        // Stop, there isn't going to be a match.
-        search_map_idx = old_map_idx;
-        break;
-      }
-
-      // Never delete these maps, they may be in use. The assumption is
-      // that there will only every be a handful of these so waiting
-      // to destroy them is not too expensive.
-      saved_maps_.emplace_back(std::move(info));
-      search_map_idx = old_map_idx + 1;
-      maps_[old_map_idx] = nullptr;
-      total_entries--;
-    }
-    if (search_map_idx >= last_map_idx) {
-      break;
-    }
-  }
-
-  // Now move out any of the maps that never were found.
-  for (size_t i = search_map_idx; i < last_map_idx; i++) {
-    saved_maps_.emplace_back(std::move(maps_[i]));
-    maps_[i] = nullptr;
-    total_entries--;
-  }
-
-  // Sort all of the values such that the nullptrs wind up at the end, then
-  // resize them away.
-  std::sort(maps_.begin(), maps_.end(), [](const auto& a, const auto& b) {
-    if (a == nullptr) {
-      return false;
-    } else if (b == nullptr) {
-      return true;
-    }
-    return a->start < b->start;
-  });
-  maps_.resize(total_entries);
-
-  return true;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/Memory.cpp b/libunwindstack/Memory.cpp
deleted file mode 100644
index 8de3d98..0000000
--- a/libunwindstack/Memory.cpp
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <memory>
-
-#include <android-base/unique_fd.h>
-
-#include <unwindstack/Memory.h>
-
-#include "Check.h"
-#include "MemoryBuffer.h"
-#include "MemoryCache.h"
-#include "MemoryFileAtOffset.h"
-#include "MemoryLocal.h"
-#include "MemoryOffline.h"
-#include "MemoryOfflineBuffer.h"
-#include "MemoryRange.h"
-#include "MemoryRemote.h"
-
-namespace unwindstack {
-
-static size_t ProcessVmRead(pid_t pid, uint64_t remote_src, void* dst, size_t len) {
-
-  // Split up the remote read across page boundaries.
-  // From the manpage:
-  //   A partial read/write may result if one of the remote_iov elements points to an invalid
-  //   memory region in the remote process.
-  //
-  //   Partial transfers apply at the granularity of iovec elements.  These system calls won't
-  //   perform a partial transfer that splits a single iovec element.
-  constexpr size_t kMaxIovecs = 64;
-  struct iovec src_iovs[kMaxIovecs];
-
-  uint64_t cur = remote_src;
-  size_t total_read = 0;
-  while (len > 0) {
-    struct iovec dst_iov = {
-        .iov_base = &reinterpret_cast<uint8_t*>(dst)[total_read], .iov_len = len,
-    };
-
-    size_t iovecs_used = 0;
-    while (len > 0) {
-      if (iovecs_used == kMaxIovecs) {
-        break;
-      }
-
-      // struct iovec uses void* for iov_base.
-      if (cur >= UINTPTR_MAX) {
-        errno = EFAULT;
-        return total_read;
-      }
-
-      src_iovs[iovecs_used].iov_base = reinterpret_cast<void*>(cur);
-
-      uintptr_t misalignment = cur & (getpagesize() - 1);
-      size_t iov_len = getpagesize() - misalignment;
-      iov_len = std::min(iov_len, len);
-
-      len -= iov_len;
-      if (__builtin_add_overflow(cur, iov_len, &cur)) {
-        errno = EFAULT;
-        return total_read;
-      }
-
-      src_iovs[iovecs_used].iov_len = iov_len;
-      ++iovecs_used;
-    }
-
-    ssize_t rc = process_vm_readv(pid, &dst_iov, 1, src_iovs, iovecs_used, 0);
-    if (rc == -1) {
-      return total_read;
-    }
-    total_read += rc;
-  }
-  return total_read;
-}
-
-static bool PtraceReadLong(pid_t pid, uint64_t addr, long* value) {
-  // ptrace() returns -1 and sets errno when the operation fails.
-  // To disambiguate -1 from a valid result, we clear errno beforehand.
-  errno = 0;
-  *value = ptrace(PTRACE_PEEKTEXT, pid, reinterpret_cast<void*>(addr), nullptr);
-  if (*value == -1 && errno) {
-    return false;
-  }
-  return true;
-}
-
-static size_t PtraceRead(pid_t pid, uint64_t addr, void* dst, size_t bytes) {
-  // Make sure that there is no overflow.
-  uint64_t max_size;
-  if (__builtin_add_overflow(addr, bytes, &max_size)) {
-    return 0;
-  }
-
-  size_t bytes_read = 0;
-  long data;
-  size_t align_bytes = addr & (sizeof(long) - 1);
-  if (align_bytes != 0) {
-    if (!PtraceReadLong(pid, addr & ~(sizeof(long) - 1), &data)) {
-      return 0;
-    }
-    size_t copy_bytes = std::min(sizeof(long) - align_bytes, bytes);
-    memcpy(dst, reinterpret_cast<uint8_t*>(&data) + align_bytes, copy_bytes);
-    addr += copy_bytes;
-    dst = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(dst) + copy_bytes);
-    bytes -= copy_bytes;
-    bytes_read += copy_bytes;
-  }
-
-  for (size_t i = 0; i < bytes / sizeof(long); i++) {
-    if (!PtraceReadLong(pid, addr, &data)) {
-      return bytes_read;
-    }
-    memcpy(dst, &data, sizeof(long));
-    dst = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(dst) + sizeof(long));
-    addr += sizeof(long);
-    bytes_read += sizeof(long);
-  }
-
-  size_t left_over = bytes & (sizeof(long) - 1);
-  if (left_over) {
-    if (!PtraceReadLong(pid, addr, &data)) {
-      return bytes_read;
-    }
-    memcpy(dst, &data, left_over);
-    bytes_read += left_over;
-  }
-  return bytes_read;
-}
-
-bool Memory::ReadFully(uint64_t addr, void* dst, size_t size) {
-  size_t rc = Read(addr, dst, size);
-  return rc == size;
-}
-
-bool Memory::ReadString(uint64_t addr, std::string* string, uint64_t max_read) {
-  string->clear();
-  uint64_t bytes_read = 0;
-  while (bytes_read < max_read) {
-    uint8_t value;
-    if (!ReadFully(addr, &value, sizeof(value))) {
-      return false;
-    }
-    if (value == '\0') {
-      return true;
-    }
-    string->push_back(value);
-    addr++;
-    bytes_read++;
-  }
-  return false;
-}
-
-std::unique_ptr<Memory> Memory::CreateFileMemory(const std::string& path, uint64_t offset) {
-  auto memory = std::make_unique<MemoryFileAtOffset>();
-
-  if (memory->Init(path, offset)) {
-    return memory;
-  }
-
-  return nullptr;
-}
-
-std::shared_ptr<Memory> Memory::CreateProcessMemory(pid_t pid) {
-  if (pid == getpid()) {
-    return std::shared_ptr<Memory>(new MemoryLocal());
-  }
-  return std::shared_ptr<Memory>(new MemoryRemote(pid));
-}
-
-std::shared_ptr<Memory> Memory::CreateProcessMemoryCached(pid_t pid) {
-  if (pid == getpid()) {
-    return std::shared_ptr<Memory>(new MemoryCache(new MemoryLocal()));
-  }
-  return std::shared_ptr<Memory>(new MemoryCache(new MemoryRemote(pid)));
-}
-
-std::shared_ptr<Memory> Memory::CreateOfflineMemory(const uint8_t* data, uint64_t start,
-                                                    uint64_t end) {
-  return std::shared_ptr<Memory>(new MemoryOfflineBuffer(data, start, end));
-}
-
-size_t MemoryBuffer::Read(uint64_t addr, void* dst, size_t size) {
-  if (addr >= size_) {
-    return 0;
-  }
-
-  size_t bytes_left = size_ - static_cast<size_t>(addr);
-  const unsigned char* actual_base = static_cast<const unsigned char*>(raw_) + addr;
-  size_t actual_len = std::min(bytes_left, size);
-
-  memcpy(dst, actual_base, actual_len);
-  return actual_len;
-}
-
-uint8_t* MemoryBuffer::GetPtr(size_t offset) {
-  if (offset < size_) {
-    return &raw_[offset];
-  }
-  return nullptr;
-}
-
-MemoryFileAtOffset::~MemoryFileAtOffset() {
-  Clear();
-}
-
-void MemoryFileAtOffset::Clear() {
-  if (data_) {
-    munmap(&data_[-offset_], size_ + offset_);
-    data_ = nullptr;
-  }
-}
-
-bool MemoryFileAtOffset::Init(const std::string& file, uint64_t offset, uint64_t size) {
-  // Clear out any previous data if it exists.
-  Clear();
-
-  android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(file.c_str(), O_RDONLY | O_CLOEXEC)));
-  if (fd == -1) {
-    return false;
-  }
-  struct stat buf;
-  if (fstat(fd, &buf) == -1) {
-    return false;
-  }
-  if (offset >= static_cast<uint64_t>(buf.st_size)) {
-    return false;
-  }
-
-  offset_ = offset & (getpagesize() - 1);
-  uint64_t aligned_offset = offset & ~(getpagesize() - 1);
-  if (aligned_offset > static_cast<uint64_t>(buf.st_size) ||
-      offset > static_cast<uint64_t>(buf.st_size)) {
-    return false;
-  }
-
-  size_ = buf.st_size - aligned_offset;
-  uint64_t max_size;
-  if (!__builtin_add_overflow(size, offset_, &max_size) && max_size < size_) {
-    // Truncate the mapped size.
-    size_ = max_size;
-  }
-  void* map = mmap(nullptr, size_, PROT_READ, MAP_PRIVATE, fd, aligned_offset);
-  if (map == MAP_FAILED) {
-    return false;
-  }
-
-  data_ = &reinterpret_cast<uint8_t*>(map)[offset_];
-  size_ -= offset_;
-
-  return true;
-}
-
-size_t MemoryFileAtOffset::Read(uint64_t addr, void* dst, size_t size) {
-  if (addr >= size_) {
-    return 0;
-  }
-
-  size_t bytes_left = size_ - static_cast<size_t>(addr);
-  const unsigned char* actual_base = static_cast<const unsigned char*>(data_) + addr;
-  size_t actual_len = std::min(bytes_left, size);
-
-  memcpy(dst, actual_base, actual_len);
-  return actual_len;
-}
-
-size_t MemoryRemote::Read(uint64_t addr, void* dst, size_t size) {
-#if !defined(__LP64__)
-  // Cannot read an address greater than 32 bits in a 32 bit context.
-  if (addr > UINT32_MAX) {
-    return 0;
-  }
-#endif
-
-  size_t (*read_func)(pid_t, uint64_t, void*, size_t) =
-      reinterpret_cast<size_t (*)(pid_t, uint64_t, void*, size_t)>(read_redirect_func_.load());
-  if (read_func != nullptr) {
-    return read_func(pid_, addr, dst, size);
-  } else {
-    // Prefer process_vm_read, try it first. If it doesn't work, use the
-    // ptrace function. If at least one of them returns at least some data,
-    // set that as the permanent function to use.
-    // This assumes that if process_vm_read works once, it will continue
-    // to work.
-    size_t bytes = ProcessVmRead(pid_, addr, dst, size);
-    if (bytes > 0) {
-      read_redirect_func_ = reinterpret_cast<uintptr_t>(ProcessVmRead);
-      return bytes;
-    }
-    bytes = PtraceRead(pid_, addr, dst, size);
-    if (bytes > 0) {
-      read_redirect_func_ = reinterpret_cast<uintptr_t>(PtraceRead);
-    }
-    return bytes;
-  }
-}
-
-size_t MemoryLocal::Read(uint64_t addr, void* dst, size_t size) {
-  return ProcessVmRead(getpid(), addr, dst, size);
-}
-
-MemoryRange::MemoryRange(const std::shared_ptr<Memory>& memory, uint64_t begin, uint64_t length,
-                         uint64_t offset)
-    : memory_(memory), begin_(begin), length_(length), offset_(offset) {}
-
-size_t MemoryRange::Read(uint64_t addr, void* dst, size_t size) {
-  if (addr < offset_) {
-    return 0;
-  }
-
-  uint64_t read_offset = addr - offset_;
-  if (read_offset >= length_) {
-    return 0;
-  }
-
-  uint64_t read_length = std::min(static_cast<uint64_t>(size), length_ - read_offset);
-  uint64_t read_addr;
-  if (__builtin_add_overflow(read_offset, begin_, &read_addr)) {
-    return 0;
-  }
-
-  return memory_->Read(read_addr, dst, read_length);
-}
-
-void MemoryRanges::Insert(MemoryRange* memory) {
-  maps_.emplace(memory->offset() + memory->length(), memory);
-}
-
-size_t MemoryRanges::Read(uint64_t addr, void* dst, size_t size) {
-  auto entry = maps_.upper_bound(addr);
-  if (entry != maps_.end()) {
-    return entry->second->Read(addr, dst, size);
-  }
-  return 0;
-}
-
-bool MemoryOffline::Init(const std::string& file, uint64_t offset) {
-  auto memory_file = std::make_shared<MemoryFileAtOffset>();
-  if (!memory_file->Init(file, offset)) {
-    return false;
-  }
-
-  // The first uint64_t value is the start of memory.
-  uint64_t start;
-  if (!memory_file->ReadFully(0, &start, sizeof(start))) {
-    return false;
-  }
-
-  uint64_t size = memory_file->Size();
-  if (__builtin_sub_overflow(size, sizeof(start), &size)) {
-    return false;
-  }
-
-  memory_ = std::make_unique<MemoryRange>(memory_file, sizeof(start), size, start);
-  return true;
-}
-
-size_t MemoryOffline::Read(uint64_t addr, void* dst, size_t size) {
-  if (!memory_) {
-    return 0;
-  }
-
-  return memory_->Read(addr, dst, size);
-}
-
-MemoryOfflineBuffer::MemoryOfflineBuffer(const uint8_t* data, uint64_t start, uint64_t end)
-    : data_(data), start_(start), end_(end) {}
-
-void MemoryOfflineBuffer::Reset(const uint8_t* data, uint64_t start, uint64_t end) {
-  data_ = data;
-  start_ = start;
-  end_ = end;
-}
-
-size_t MemoryOfflineBuffer::Read(uint64_t addr, void* dst, size_t size) {
-  if (addr < start_ || addr >= end_) {
-    return 0;
-  }
-
-  size_t read_length = std::min(size, static_cast<size_t>(end_ - addr));
-  memcpy(dst, &data_[addr - start_], read_length);
-  return read_length;
-}
-
-MemoryOfflineParts::~MemoryOfflineParts() {
-  for (auto memory : memories_) {
-    delete memory;
-  }
-}
-
-size_t MemoryOfflineParts::Read(uint64_t addr, void* dst, size_t size) {
-  if (memories_.empty()) {
-    return 0;
-  }
-
-  // Do a read on each memory object, no support for reading across the
-  // different memory objects.
-  for (MemoryOffline* memory : memories_) {
-    size_t bytes = memory->Read(addr, dst, size);
-    if (bytes != 0) {
-      return bytes;
-    }
-  }
-  return 0;
-}
-
-size_t MemoryCache::Read(uint64_t addr, void* dst, size_t size) {
-  // Only bother caching and looking at the cache if this is a small read for now.
-  if (size > 64) {
-    return impl_->Read(addr, dst, size);
-  }
-
-  uint64_t addr_page = addr >> kCacheBits;
-  auto entry = cache_.find(addr_page);
-  uint8_t* cache_dst;
-  if (entry != cache_.end()) {
-    cache_dst = entry->second;
-  } else {
-    cache_dst = cache_[addr_page];
-    if (!impl_->ReadFully(addr_page << kCacheBits, cache_dst, kCacheSize)) {
-      // Erase the entry.
-      cache_.erase(addr_page);
-      return impl_->Read(addr, dst, size);
-    }
-  }
-  size_t max_read = ((addr_page + 1) << kCacheBits) - addr;
-  if (size <= max_read) {
-    memcpy(dst, &cache_dst[addr & kCacheMask], size);
-    return size;
-  }
-
-  // The read crossed into another cached entry, since a read can only cross
-  // into one extra cached page, duplicate the code rather than looping.
-  memcpy(dst, &cache_dst[addr & kCacheMask], max_read);
-  dst = &reinterpret_cast<uint8_t*>(dst)[max_read];
-  addr_page++;
-
-  entry = cache_.find(addr_page);
-  if (entry != cache_.end()) {
-    cache_dst = entry->second;
-  } else {
-    cache_dst = cache_[addr_page];
-    if (!impl_->ReadFully(addr_page << kCacheBits, cache_dst, kCacheSize)) {
-      // Erase the entry.
-      cache_.erase(addr_page);
-      return impl_->Read(addr_page << kCacheBits, dst, size - max_read) + max_read;
-    }
-  }
-  memcpy(dst, cache_dst, size - max_read);
-  return size;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/MemoryBuffer.h b/libunwindstack/MemoryBuffer.h
deleted file mode 100644
index a91e59f..0000000
--- a/libunwindstack/MemoryBuffer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_BUFFER_H
-#define _LIBUNWINDSTACK_MEMORY_BUFFER_H
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryBuffer : public Memory {
- public:
-  MemoryBuffer() = default;
-  virtual ~MemoryBuffer() { free(raw_); }
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
-  uint8_t* GetPtr(size_t offset);
-
-  bool Resize(size_t size) {
-    raw_ = reinterpret_cast<uint8_t*>(realloc(raw_, size));
-    if (raw_ == nullptr) {
-      size_ = 0;
-      return false;
-    }
-    size_ = size;
-    return true;
-  }
-
-  uint64_t Size() { return size_; }
-
- private:
-  uint8_t* raw_ = nullptr;
-  size_t size_ = 0;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_BUFFER_H
diff --git a/libunwindstack/MemoryCache.h b/libunwindstack/MemoryCache.h
deleted file mode 100644
index 769d907..0000000
--- a/libunwindstack/MemoryCache.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_CACHE_H
-#define _LIBUNWINDSTACK_MEMORY_CACHE_H
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryCache : public Memory {
- public:
-  MemoryCache(Memory* memory) : impl_(memory) {}
-  virtual ~MemoryCache() = default;
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
-  void Clear() override { cache_.clear(); }
-
- private:
-  constexpr static size_t kCacheBits = 12;
-  constexpr static size_t kCacheMask = (1 << kCacheBits) - 1;
-  constexpr static size_t kCacheSize = 1 << kCacheBits;
-  std::unordered_map<uint64_t, uint8_t[kCacheSize]> cache_;
-
-  std::unique_ptr<Memory> impl_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_CACHE_H
diff --git a/libunwindstack/MemoryFileAtOffset.h b/libunwindstack/MemoryFileAtOffset.h
deleted file mode 100644
index d136eb4..0000000
--- a/libunwindstack/MemoryFileAtOffset.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_FILE_AT_OFFSET_H
-#define _LIBUNWINDSTACK_MEMORY_FILE_AT_OFFSET_H
-
-#include <stdint.h>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryFileAtOffset : public Memory {
- public:
-  MemoryFileAtOffset() = default;
-  virtual ~MemoryFileAtOffset();
-
-  bool Init(const std::string& file, uint64_t offset, uint64_t size = UINT64_MAX);
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
-  size_t Size() { return size_; }
-
-  void Clear() override;
-
- protected:
-  size_t size_ = 0;
-  size_t offset_ = 0;
-  uint8_t* data_ = nullptr;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_FILE_AT_OFFSET_H
diff --git a/libunwindstack/MemoryLocal.h b/libunwindstack/MemoryLocal.h
deleted file mode 100644
index 29aaf12..0000000
--- a/libunwindstack/MemoryLocal.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_LOCAL_H
-#define _LIBUNWINDSTACK_MEMORY_LOCAL_H
-
-#include <stdint.h>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryLocal : public Memory {
- public:
-  MemoryLocal() = default;
-  virtual ~MemoryLocal() = default;
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_LOCAL_H
diff --git a/libunwindstack/MemoryOffline.h b/libunwindstack/MemoryOffline.h
deleted file mode 100644
index 789f1a2..0000000
--- a/libunwindstack/MemoryOffline.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_OFFLINE_H
-#define _LIBUNWINDSTACK_MEMORY_OFFLINE_H
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <unwindstack/Memory.h>
-
-#include "MemoryRange.h"
-
-namespace unwindstack {
-
-class MemoryOffline : public Memory {
- public:
-  MemoryOffline() = default;
-  virtual ~MemoryOffline() = default;
-
-  bool Init(const std::string& file, uint64_t offset);
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
- private:
-  std::unique_ptr<MemoryRange> memory_;
-};
-
-class MemoryOfflineParts : public Memory {
- public:
-  MemoryOfflineParts() = default;
-  virtual ~MemoryOfflineParts();
-
-  void Add(MemoryOffline* memory) { memories_.push_back(memory); }
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
- private:
-  std::vector<MemoryOffline*> memories_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_OFFLINE_H
diff --git a/libunwindstack/MemoryOfflineBuffer.h b/libunwindstack/MemoryOfflineBuffer.h
deleted file mode 100644
index 64c49a1..0000000
--- a/libunwindstack/MemoryOfflineBuffer.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_OFFLINE_BUFFER_H
-#define _LIBUNWINDSTACK_MEMORY_OFFLINE_BUFFER_H
-
-#include <stdint.h>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryOfflineBuffer : public Memory {
- public:
-  MemoryOfflineBuffer(const uint8_t* data, uint64_t start, uint64_t end);
-  virtual ~MemoryOfflineBuffer() = default;
-
-  void Reset(const uint8_t* data, uint64_t start, uint64_t end);
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
- private:
-  const uint8_t* data_;
-  uint64_t start_;
-  uint64_t end_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_OFFLINE_BUFFER_H
diff --git a/libunwindstack/MemoryRange.h b/libunwindstack/MemoryRange.h
deleted file mode 100644
index 3b4ab5c..0000000
--- a/libunwindstack/MemoryRange.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_RANGE_H
-#define _LIBUNWINDSTACK_MEMORY_RANGE_H
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <string>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-// MemoryRange maps one address range onto another.
-// The range [src_begin, src_begin + length) in the underlying Memory is mapped onto offset,
-// such that range.read(offset) is equivalent to underlying.read(src_begin).
-class MemoryRange : public Memory {
- public:
-  MemoryRange(const std::shared_ptr<Memory>& memory, uint64_t begin, uint64_t length,
-              uint64_t offset);
-  virtual ~MemoryRange() = default;
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
-  uint64_t offset() { return offset_; }
-  uint64_t length() { return length_; }
-
- private:
-  std::shared_ptr<Memory> memory_;
-  uint64_t begin_;
-  uint64_t length_;
-  uint64_t offset_;
-};
-
-class MemoryRanges : public Memory {
- public:
-  MemoryRanges() = default;
-  virtual ~MemoryRanges() = default;
-
-  void Insert(MemoryRange* memory);
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
- private:
-  std::map<uint64_t, std::unique_ptr<MemoryRange>> maps_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_RANGE_H
diff --git a/libunwindstack/MemoryRemote.h b/libunwindstack/MemoryRemote.h
deleted file mode 100644
index db367d6..0000000
--- a/libunwindstack/MemoryRemote.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_REMOTE_H
-#define _LIBUNWINDSTACK_MEMORY_REMOTE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <atomic>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryRemote : public Memory {
- public:
-  MemoryRemote(pid_t pid) : pid_(pid), read_redirect_func_(0) {}
-  virtual ~MemoryRemote() = default;
-
-  size_t Read(uint64_t addr, void* dst, size_t size) override;
-
-  pid_t pid() { return pid_; }
-
- private:
-  pid_t pid_;
-  std::atomic_uintptr_t read_redirect_func_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_REMOTE_H
diff --git a/libunwindstack/OWNERS b/libunwindstack/OWNERS
deleted file mode 100644
index 6f7e4a3..0000000
--- a/libunwindstack/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-cferris@google.com
diff --git a/libunwindstack/Regs.cpp b/libunwindstack/Regs.cpp
deleted file mode 100644
index c7dec52..0000000
--- a/libunwindstack/Regs.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-#include <sys/ptrace.h>
-#include <sys/uio.h>
-
-#include <vector>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/RegsMips.h>
-#include <unwindstack/RegsMips64.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/RegsX86_64.h>
-#include <unwindstack/UserArm.h>
-#include <unwindstack/UserArm64.h>
-#include <unwindstack/UserMips.h>
-#include <unwindstack/UserMips64.h>
-#include <unwindstack/UserX86.h>
-#include <unwindstack/UserX86_64.h>
-
-namespace unwindstack {
-
-// The largest user structure.
-constexpr size_t MAX_USER_REGS_SIZE = sizeof(mips64_user_regs) + 10;
-
-// This function assumes that reg_data is already aligned to a 64 bit value.
-// If not this could crash with an unaligned access.
-Regs* Regs::RemoteGet(pid_t pid) {
-  // Make the buffer large enough to contain the largest registers type.
-  std::vector<uint64_t> buffer(MAX_USER_REGS_SIZE / sizeof(uint64_t));
-  struct iovec io;
-  io.iov_base = buffer.data();
-  io.iov_len = buffer.size() * sizeof(uint64_t);
-
-  if (ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, reinterpret_cast<void*>(&io)) == -1) {
-    return nullptr;
-  }
-
-  switch (io.iov_len) {
-  case sizeof(x86_user_regs):
-    return RegsX86::Read(buffer.data());
-  case sizeof(x86_64_user_regs):
-    return RegsX86_64::Read(buffer.data());
-  case sizeof(arm_user_regs):
-    return RegsArm::Read(buffer.data());
-  case sizeof(arm64_user_regs):
-    return RegsArm64::Read(buffer.data());
-  case sizeof(mips_user_regs):
-    return RegsMips::Read(buffer.data());
-  case sizeof(mips64_user_regs):
-    return RegsMips64::Read(buffer.data());
-  }
-  return nullptr;
-}
-
-Regs* Regs::CreateFromUcontext(ArchEnum arch, void* ucontext) {
-  switch (arch) {
-    case ARCH_X86:
-      return RegsX86::CreateFromUcontext(ucontext);
-    case ARCH_X86_64:
-      return RegsX86_64::CreateFromUcontext(ucontext);
-    case ARCH_ARM:
-      return RegsArm::CreateFromUcontext(ucontext);
-    case ARCH_ARM64:
-      return RegsArm64::CreateFromUcontext(ucontext);
-    case ARCH_MIPS:
-      return RegsMips::CreateFromUcontext(ucontext);
-    case ARCH_MIPS64:
-      return RegsMips64::CreateFromUcontext(ucontext);
-    case ARCH_UNKNOWN:
-    default:
-      return nullptr;
-  }
-}
-
-ArchEnum Regs::CurrentArch() {
-#if defined(__arm__)
-  return ARCH_ARM;
-#elif defined(__aarch64__)
-  return ARCH_ARM64;
-#elif defined(__i386__)
-  return ARCH_X86;
-#elif defined(__x86_64__)
-  return ARCH_X86_64;
-#elif defined(__mips__) && !defined(__LP64__)
-  return ARCH_MIPS;
-#elif defined(__mips__) && defined(__LP64__)
-  return ARCH_MIPS64;
-#else
-  abort();
-#endif
-}
-
-Regs* Regs::CreateFromLocal() {
-  Regs* regs;
-#if defined(__arm__)
-  regs = new RegsArm();
-#elif defined(__aarch64__)
-  regs = new RegsArm64();
-#elif defined(__i386__)
-  regs = new RegsX86();
-#elif defined(__x86_64__)
-  regs = new RegsX86_64();
-#elif defined(__mips__) && !defined(__LP64__)
-  regs = new RegsMips();
-#elif defined(__mips__) && defined(__LP64__)
-  regs = new RegsMips64();
-#else
-  abort();
-#endif
-  return regs;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/RegsArm.cpp b/libunwindstack/RegsArm.cpp
deleted file mode 100644
index 1b1f7eb..0000000
--- a/libunwindstack/RegsArm.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/UcontextArm.h>
-#include <unwindstack/UserArm.h>
-
-namespace unwindstack {
-
-RegsArm::RegsArm() : RegsImpl<uint32_t>(ARM_REG_LAST, Location(LOCATION_REGISTER, ARM_REG_LR)) {}
-
-ArchEnum RegsArm::Arch() {
-  return ARCH_ARM;
-}
-
-uint64_t RegsArm::pc() {
-  return regs_[ARM_REG_PC];
-}
-
-uint64_t RegsArm::sp() {
-  return regs_[ARM_REG_SP];
-}
-
-void RegsArm::set_pc(uint64_t pc) {
-  regs_[ARM_REG_PC] = pc;
-}
-
-void RegsArm::set_sp(uint64_t sp) {
-  regs_[ARM_REG_SP] = sp;
-}
-
-uint64_t RegsArm::GetPcAdjustment(uint64_t rel_pc, Elf* elf) {
-  if (!elf->valid()) {
-    return 2;
-  }
-
-  uint64_t load_bias = elf->GetLoadBias();
-  if (rel_pc < load_bias) {
-    if (rel_pc < 2) {
-      return 0;
-    }
-    return 2;
-  }
-  uint64_t adjusted_rel_pc = rel_pc - load_bias;
-  if (adjusted_rel_pc < 5) {
-    if (adjusted_rel_pc < 2) {
-      return 0;
-    }
-    return 2;
-  }
-
-  if (adjusted_rel_pc & 1) {
-    // This is a thumb instruction, it could be 2 or 4 bytes.
-    uint32_t value;
-    if (!elf->memory()->ReadFully(adjusted_rel_pc - 5, &value, sizeof(value)) ||
-        (value & 0xe000f000) != 0xe000f000) {
-      return 2;
-    }
-  }
-  return 4;
-}
-
-bool RegsArm::SetPcFromReturnAddress(Memory*) {
-  uint32_t lr = regs_[ARM_REG_LR];
-  if (regs_[ARM_REG_PC] == lr) {
-    return false;
-  }
-
-  regs_[ARM_REG_PC] = lr;
-  return true;
-}
-
-void RegsArm::IterateRegisters(std::function<void(const char*, uint64_t)> fn) {
-  fn("r0", regs_[ARM_REG_R0]);
-  fn("r1", regs_[ARM_REG_R1]);
-  fn("r2", regs_[ARM_REG_R2]);
-  fn("r3", regs_[ARM_REG_R3]);
-  fn("r4", regs_[ARM_REG_R4]);
-  fn("r5", regs_[ARM_REG_R5]);
-  fn("r6", regs_[ARM_REG_R6]);
-  fn("r7", regs_[ARM_REG_R7]);
-  fn("r8", regs_[ARM_REG_R8]);
-  fn("r9", regs_[ARM_REG_R9]);
-  fn("r10", regs_[ARM_REG_R10]);
-  fn("r11", regs_[ARM_REG_R11]);
-  fn("ip", regs_[ARM_REG_R12]);
-  fn("sp", regs_[ARM_REG_SP]);
-  fn("lr", regs_[ARM_REG_LR]);
-  fn("pc", regs_[ARM_REG_PC]);
-}
-
-Regs* RegsArm::Read(void* remote_data) {
-  arm_user_regs* user = reinterpret_cast<arm_user_regs*>(remote_data);
-
-  RegsArm* regs = new RegsArm();
-  memcpy(regs->RawData(), &user->regs[0], ARM_REG_LAST * sizeof(uint32_t));
-  return regs;
-}
-
-Regs* RegsArm::CreateFromUcontext(void* ucontext) {
-  arm_ucontext_t* arm_ucontext = reinterpret_cast<arm_ucontext_t*>(ucontext);
-
-  RegsArm* regs = new RegsArm();
-  memcpy(regs->RawData(), &arm_ucontext->uc_mcontext.regs[0], ARM_REG_LAST * sizeof(uint32_t));
-  return regs;
-}
-
-bool RegsArm::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) {
-  uint32_t data;
-  Memory* elf_memory = elf->memory();
-  // Read from elf memory since it is usually more expensive to read from
-  // process memory.
-  if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) {
-    return false;
-  }
-
-  uint64_t offset = 0;
-  if (data == 0xe3a07077 || data == 0xef900077 || data == 0xdf002777) {
-    uint64_t sp = regs_[ARM_REG_SP];
-    // non-RT sigreturn call.
-    // __restore:
-    //
-    // Form 1 (arm):
-    // 0x77 0x70              mov r7, #0x77
-    // 0xa0 0xe3              svc 0x00000000
-    //
-    // Form 2 (arm):
-    // 0x77 0x00 0x90 0xef    svc 0x00900077
-    //
-    // Form 3 (thumb):
-    // 0x77 0x27              movs r7, #77
-    // 0x00 0xdf              svc 0
-    if (!process_memory->ReadFully(sp, &data, sizeof(data))) {
-      return false;
-    }
-    if (data == 0x5ac3c35a) {
-      // SP + uc_mcontext offset + r0 offset.
-      offset = sp + 0x14 + 0xc;
-    } else {
-      // SP + r0 offset
-      offset = sp + 0xc;
-    }
-  } else if (data == 0xe3a070ad || data == 0xef9000ad || data == 0xdf0027ad) {
-    uint64_t sp = regs_[ARM_REG_SP];
-    // RT sigreturn call.
-    // __restore_rt:
-    //
-    // Form 1 (arm):
-    // 0xad 0x70      mov r7, #0xad
-    // 0xa0 0xe3      svc 0x00000000
-    //
-    // Form 2 (arm):
-    // 0xad 0x00 0x90 0xef    svc 0x009000ad
-    //
-    // Form 3 (thumb):
-    // 0xad 0x27              movs r7, #ad
-    // 0x00 0xdf              svc 0
-    if (!process_memory->ReadFully(sp, &data, sizeof(data))) {
-      return false;
-    }
-    if (data == sp + 8) {
-      // SP + 8 + sizeof(siginfo_t) + uc_mcontext_offset + r0 offset
-      offset = sp + 8 + 0x80 + 0x14 + 0xc;
-    } else {
-      // SP + sizeof(siginfo_t) + uc_mcontext_offset + r0 offset
-      offset = sp + 0x80 + 0x14 + 0xc;
-    }
-  }
-  if (offset == 0) {
-    return false;
-  }
-
-  if (!process_memory->ReadFully(offset, regs_.data(), sizeof(uint32_t) * ARM_REG_LAST)) {
-    return false;
-  }
-  return true;
-}
-
-Regs* RegsArm::Clone() {
-  return new RegsArm(*this);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/RegsArm64.cpp b/libunwindstack/RegsArm64.cpp
deleted file mode 100644
index 00b3367..0000000
--- a/libunwindstack/RegsArm64.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineArm64.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/UcontextArm64.h>
-#include <unwindstack/UserArm64.h>
-
-namespace unwindstack {
-
-RegsArm64::RegsArm64()
-    : RegsImpl<uint64_t>(ARM64_REG_LAST, Location(LOCATION_REGISTER, ARM64_REG_LR)) {}
-
-ArchEnum RegsArm64::Arch() {
-  return ARCH_ARM64;
-}
-
-uint64_t RegsArm64::pc() {
-  return regs_[ARM64_REG_PC];
-}
-
-uint64_t RegsArm64::sp() {
-  return regs_[ARM64_REG_SP];
-}
-
-void RegsArm64::set_pc(uint64_t pc) {
-  regs_[ARM64_REG_PC] = pc;
-}
-
-void RegsArm64::set_sp(uint64_t sp) {
-  regs_[ARM64_REG_SP] = sp;
-}
-
-uint64_t RegsArm64::GetPcAdjustment(uint64_t rel_pc, Elf*) {
-  if (rel_pc < 4) {
-    return 0;
-  }
-  return 4;
-}
-
-bool RegsArm64::SetPcFromReturnAddress(Memory*) {
-  uint64_t lr = regs_[ARM64_REG_LR];
-  if (regs_[ARM64_REG_PC] == lr) {
-    return false;
-  }
-
-  regs_[ARM64_REG_PC] = lr;
-  return true;
-}
-
-void RegsArm64::IterateRegisters(std::function<void(const char*, uint64_t)> fn) {
-  fn("x0", regs_[ARM64_REG_R0]);
-  fn("x1", regs_[ARM64_REG_R1]);
-  fn("x2", regs_[ARM64_REG_R2]);
-  fn("x3", regs_[ARM64_REG_R3]);
-  fn("x4", regs_[ARM64_REG_R4]);
-  fn("x5", regs_[ARM64_REG_R5]);
-  fn("x6", regs_[ARM64_REG_R6]);
-  fn("x7", regs_[ARM64_REG_R7]);
-  fn("x8", regs_[ARM64_REG_R8]);
-  fn("x9", regs_[ARM64_REG_R9]);
-  fn("x10", regs_[ARM64_REG_R10]);
-  fn("x11", regs_[ARM64_REG_R11]);
-  fn("x12", regs_[ARM64_REG_R12]);
-  fn("x13", regs_[ARM64_REG_R13]);
-  fn("x14", regs_[ARM64_REG_R14]);
-  fn("x15", regs_[ARM64_REG_R15]);
-  fn("x16", regs_[ARM64_REG_R16]);
-  fn("x17", regs_[ARM64_REG_R17]);
-  fn("x18", regs_[ARM64_REG_R18]);
-  fn("x19", regs_[ARM64_REG_R19]);
-  fn("x20", regs_[ARM64_REG_R20]);
-  fn("x21", regs_[ARM64_REG_R21]);
-  fn("x22", regs_[ARM64_REG_R22]);
-  fn("x23", regs_[ARM64_REG_R23]);
-  fn("x24", regs_[ARM64_REG_R24]);
-  fn("x25", regs_[ARM64_REG_R25]);
-  fn("x26", regs_[ARM64_REG_R26]);
-  fn("x27", regs_[ARM64_REG_R27]);
-  fn("x28", regs_[ARM64_REG_R28]);
-  fn("x29", regs_[ARM64_REG_R29]);
-  fn("lr", regs_[ARM64_REG_LR]);
-  fn("sp", regs_[ARM64_REG_SP]);
-  fn("pc", regs_[ARM64_REG_PC]);
-  fn("pst", regs_[ARM64_REG_PSTATE]);
-}
-
-Regs* RegsArm64::Read(void* remote_data) {
-  arm64_user_regs* user = reinterpret_cast<arm64_user_regs*>(remote_data);
-
-  RegsArm64* regs = new RegsArm64();
-  memcpy(regs->RawData(), &user->regs[0], (ARM64_REG_R30 + 1) * sizeof(uint64_t));
-  uint64_t* reg_data = reinterpret_cast<uint64_t*>(regs->RawData());
-  reg_data[ARM64_REG_SP] = user->sp;
-  reg_data[ARM64_REG_PC] = user->pc;
-  reg_data[ARM64_REG_PSTATE] = user->pstate;
-  return regs;
-}
-
-Regs* RegsArm64::CreateFromUcontext(void* ucontext) {
-  arm64_ucontext_t* arm64_ucontext = reinterpret_cast<arm64_ucontext_t*>(ucontext);
-
-  RegsArm64* regs = new RegsArm64();
-  memcpy(regs->RawData(), &arm64_ucontext->uc_mcontext.regs[0], ARM64_REG_LAST * sizeof(uint64_t));
-  return regs;
-}
-
-bool RegsArm64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) {
-  uint64_t data;
-  Memory* elf_memory = elf->memory();
-  // Read from elf memory since it is usually more expensive to read from
-  // process memory.
-  if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) {
-    return false;
-  }
-
-  // Look for the kernel sigreturn function.
-  // __kernel_rt_sigreturn:
-  // 0xd2801168     mov x8, #0x8b
-  // 0xd4000001     svc #0x0
-  if (data != 0xd4000001d2801168ULL) {
-    return false;
-  }
-
-  // SP + sizeof(siginfo_t) + uc_mcontext offset + X0 offset.
-  if (!process_memory->ReadFully(regs_[ARM64_REG_SP] + 0x80 + 0xb0 + 0x08, regs_.data(),
-                                 sizeof(uint64_t) * ARM64_REG_LAST)) {
-    return false;
-  }
-  return true;
-}
-
-Regs* RegsArm64::Clone() {
-  return new RegsArm64(*this);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/RegsInfo.h b/libunwindstack/RegsInfo.h
deleted file mode 100644
index e445a91..0000000
--- a/libunwindstack/RegsInfo.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_INFO_H
-#define _LIBUNWINDSTACK_REGS_INFO_H
-
-#include <stdint.h>
-
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-template <typename AddressType>
-struct RegsInfo {
-  static constexpr size_t MAX_REGISTERS = 64;
-
-  RegsInfo(RegsImpl<AddressType>* regs) : regs(regs) {}
-
-  RegsImpl<AddressType>* regs = nullptr;
-  uint64_t saved_reg_map = 0;
-  AddressType saved_regs[MAX_REGISTERS];
-
-  inline AddressType Get(uint32_t reg) {
-    if (IsSaved(reg)) {
-      return saved_regs[reg];
-    }
-    return (*regs)[reg];
-  }
-
-  inline AddressType* Save(uint32_t reg) {
-    if (reg >= MAX_REGISTERS) {
-      // This should never happen since all currently supported
-      // architectures have < 64 total registers.
-      abort();
-    }
-    saved_reg_map |= 1ULL << reg;
-    saved_regs[reg] = (*regs)[reg];
-    return &(*regs)[reg];
-  }
-
-  inline bool IsSaved(uint32_t reg) {
-    if (reg > MAX_REGISTERS) {
-      // This should never happen since all currently supported
-      // architectures have < 64 total registers.
-      abort();
-    }
-    return saved_reg_map & (1ULL << reg);
-  }
-
-  inline uint16_t Total() { return regs->total_regs(); }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_INFO_H
diff --git a/libunwindstack/RegsMips.cpp b/libunwindstack/RegsMips.cpp
deleted file mode 100644
index ebefe42..0000000
--- a/libunwindstack/RegsMips.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineMips.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsMips.h>
-#include <unwindstack/UcontextMips.h>
-#include <unwindstack/UserMips.h>
-
-namespace unwindstack {
-
-RegsMips::RegsMips()
-    : RegsImpl<uint32_t>(MIPS_REG_LAST, Location(LOCATION_REGISTER, MIPS_REG_RA)) {}
-
-ArchEnum RegsMips::Arch() {
-  return ARCH_MIPS;
-}
-
-uint64_t RegsMips::pc() {
-  return regs_[MIPS_REG_PC];
-}
-
-uint64_t RegsMips::sp() {
-  return regs_[MIPS_REG_SP];
-}
-
-void RegsMips::set_pc(uint64_t pc) {
-  regs_[MIPS_REG_PC] = static_cast<uint32_t>(pc);
-}
-
-void RegsMips::set_sp(uint64_t sp) {
-  regs_[MIPS_REG_SP] = static_cast<uint32_t>(sp);
-}
-
-uint64_t RegsMips::GetPcAdjustment(uint64_t rel_pc, Elf*) {
-  if (rel_pc < 8) {
-    return 0;
-  }
-  // For now, just assume no compact branches
-  return 8;
-}
-
-bool RegsMips::SetPcFromReturnAddress(Memory*) {
-  uint32_t ra = regs_[MIPS_REG_RA];
-  if (regs_[MIPS_REG_PC] == ra) {
-    return false;
-  }
-
-  regs_[MIPS_REG_PC] = ra;
-  return true;
-}
-
-void RegsMips::IterateRegisters(std::function<void(const char*, uint64_t)> fn) {
-  fn("r0", regs_[MIPS_REG_R0]);
-  fn("r1", regs_[MIPS_REG_R1]);
-  fn("r2", regs_[MIPS_REG_R2]);
-  fn("r3", regs_[MIPS_REG_R3]);
-  fn("r4", regs_[MIPS_REG_R4]);
-  fn("r5", regs_[MIPS_REG_R5]);
-  fn("r6", regs_[MIPS_REG_R6]);
-  fn("r7", regs_[MIPS_REG_R7]);
-  fn("r8", regs_[MIPS_REG_R8]);
-  fn("r9", regs_[MIPS_REG_R9]);
-  fn("r10", regs_[MIPS_REG_R10]);
-  fn("r11", regs_[MIPS_REG_R11]);
-  fn("r12", regs_[MIPS_REG_R12]);
-  fn("r13", regs_[MIPS_REG_R13]);
-  fn("r14", regs_[MIPS_REG_R14]);
-  fn("r15", regs_[MIPS_REG_R15]);
-  fn("r16", regs_[MIPS_REG_R16]);
-  fn("r17", regs_[MIPS_REG_R17]);
-  fn("r18", regs_[MIPS_REG_R18]);
-  fn("r19", regs_[MIPS_REG_R19]);
-  fn("r20", regs_[MIPS_REG_R20]);
-  fn("r21", regs_[MIPS_REG_R21]);
-  fn("r22", regs_[MIPS_REG_R22]);
-  fn("r23", regs_[MIPS_REG_R23]);
-  fn("r24", regs_[MIPS_REG_R24]);
-  fn("r25", regs_[MIPS_REG_R25]);
-  fn("r26", regs_[MIPS_REG_R26]);
-  fn("r27", regs_[MIPS_REG_R27]);
-  fn("r28", regs_[MIPS_REG_R28]);
-  fn("sp", regs_[MIPS_REG_SP]);
-  fn("r30", regs_[MIPS_REG_R30]);
-  fn("ra", regs_[MIPS_REG_RA]);
-  fn("pc", regs_[MIPS_REG_PC]);
-}
-
-Regs* RegsMips::Read(void* remote_data) {
-  mips_user_regs* user = reinterpret_cast<mips_user_regs*>(remote_data);
-  RegsMips* regs = new RegsMips();
-  uint32_t* reg_data = reinterpret_cast<uint32_t*>(regs->RawData());
-
-  memcpy(regs->RawData(), &user->regs[MIPS32_EF_R0], (MIPS_REG_R31 + 1) * sizeof(uint32_t));
-
-  reg_data[MIPS_REG_PC] = user->regs[MIPS32_EF_CP0_EPC];
-  return regs;
-}
-
-Regs* RegsMips::CreateFromUcontext(void* ucontext) {
-  mips_ucontext_t* mips_ucontext = reinterpret_cast<mips_ucontext_t*>(ucontext);
-
-  RegsMips* regs = new RegsMips();
-  // Copy 64 bit sc_regs over to 32 bit regs
-  for (int i = 0; i < 32; i++) {
-      (*regs)[MIPS_REG_R0 + i] = mips_ucontext->uc_mcontext.sc_regs[i];
-  }
-  (*regs)[MIPS_REG_PC] = mips_ucontext->uc_mcontext.sc_pc;
-  return regs;
-}
-
-bool RegsMips::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) {
-  uint64_t data;
-  uint64_t offset = 0;
-  Memory* elf_memory = elf->memory();
-  // Read from elf memory since it is usually more expensive to read from
-  // process memory.
-  if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) {
-    return false;
-  }
-
-  // Look for the kernel sigreturn functions.
-  // __vdso_rt_sigreturn:
-  // 0x24021061     li  v0, 0x1061
-  // 0x0000000c     syscall
-  // __vdso_sigreturn:
-  // 0x24021017     li  v0, 0x1017
-  // 0x0000000c     syscall
-  if (data == 0x0000000c24021061ULL) {
-    // vdso_rt_sigreturn => read rt_sigframe
-    // offset = siginfo offset + sizeof(siginfo) + uc_mcontext offset + sc_pc offset
-    offset = 24 + 128 + 24 + 8;
-  } else if (data == 0x0000000c24021017LL) {
-    // vdso_sigreturn => read sigframe
-    // offset = sigcontext offset + sc_pc offset
-    offset = 24 + 8;
-  } else {
-    return false;
-  }
-
-  // read sc_pc and sc_regs[32] from stack
-  uint64_t values[MIPS_REG_LAST];
-  if (!process_memory->ReadFully(regs_[MIPS_REG_SP] + offset, values, sizeof(values))) {
-    return false;
-  }
-
-  // Copy 64 bit sc_pc over to 32 bit regs_[MIPS_REG_PC]
-  regs_[MIPS_REG_PC] = values[0];
-
-  // Copy 64 bit sc_regs over to 32 bit regs
-  for (int i = 0; i < 32; i++) {
-      regs_[MIPS_REG_R0 + i] = values[1 + i];
-  }
-  return true;
-}
-
-Regs* RegsMips::Clone() {
-  return new RegsMips(*this);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/RegsMips64.cpp b/libunwindstack/RegsMips64.cpp
deleted file mode 100644
index be2fd22..0000000
--- a/libunwindstack/RegsMips64.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineMips64.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsMips64.h>
-#include <unwindstack/UcontextMips64.h>
-#include <unwindstack/UserMips64.h>
-
-namespace unwindstack {
-
-RegsMips64::RegsMips64()
-    : RegsImpl<uint64_t>(MIPS64_REG_LAST, Location(LOCATION_REGISTER, MIPS64_REG_RA)) {}
-
-ArchEnum RegsMips64::Arch() {
-  return ARCH_MIPS64;
-}
-
-uint64_t RegsMips64::pc() {
-  return regs_[MIPS64_REG_PC];
-}
-
-uint64_t RegsMips64::sp() {
-  return regs_[MIPS64_REG_SP];
-}
-
-void RegsMips64::set_pc(uint64_t pc) {
-  regs_[MIPS64_REG_PC] = pc;
-}
-
-void RegsMips64::set_sp(uint64_t sp) {
-  regs_[MIPS64_REG_SP] = sp;
-}
-
-uint64_t RegsMips64::GetPcAdjustment(uint64_t rel_pc, Elf*) {
-  if (rel_pc < 8) {
-    return 0;
-  }
-  // For now, just assume no compact branches
-  return 8;
-}
-
-bool RegsMips64::SetPcFromReturnAddress(Memory*) {
-  uint64_t ra = regs_[MIPS64_REG_RA];
-  if (regs_[MIPS64_REG_PC] == ra) {
-    return false;
-  }
-
-  regs_[MIPS64_REG_PC] = ra;
-  return true;
-}
-
-void RegsMips64::IterateRegisters(std::function<void(const char*, uint64_t)> fn) {
-  fn("r0", regs_[MIPS64_REG_R0]);
-  fn("r1", regs_[MIPS64_REG_R1]);
-  fn("r2", regs_[MIPS64_REG_R2]);
-  fn("r3", regs_[MIPS64_REG_R3]);
-  fn("r4", regs_[MIPS64_REG_R4]);
-  fn("r5", regs_[MIPS64_REG_R5]);
-  fn("r6", regs_[MIPS64_REG_R6]);
-  fn("r7", regs_[MIPS64_REG_R7]);
-  fn("r8", regs_[MIPS64_REG_R8]);
-  fn("r9", regs_[MIPS64_REG_R9]);
-  fn("r10", regs_[MIPS64_REG_R10]);
-  fn("r11", regs_[MIPS64_REG_R11]);
-  fn("r12", regs_[MIPS64_REG_R12]);
-  fn("r13", regs_[MIPS64_REG_R13]);
-  fn("r14", regs_[MIPS64_REG_R14]);
-  fn("r15", regs_[MIPS64_REG_R15]);
-  fn("r16", regs_[MIPS64_REG_R16]);
-  fn("r17", regs_[MIPS64_REG_R17]);
-  fn("r18", regs_[MIPS64_REG_R18]);
-  fn("r19", regs_[MIPS64_REG_R19]);
-  fn("r20", regs_[MIPS64_REG_R20]);
-  fn("r21", regs_[MIPS64_REG_R21]);
-  fn("r22", regs_[MIPS64_REG_R22]);
-  fn("r23", regs_[MIPS64_REG_R23]);
-  fn("r24", regs_[MIPS64_REG_R24]);
-  fn("r25", regs_[MIPS64_REG_R25]);
-  fn("r26", regs_[MIPS64_REG_R26]);
-  fn("r27", regs_[MIPS64_REG_R27]);
-  fn("r28", regs_[MIPS64_REG_R28]);
-  fn("sp", regs_[MIPS64_REG_SP]);
-  fn("r30", regs_[MIPS64_REG_R30]);
-  fn("ra", regs_[MIPS64_REG_RA]);
-  fn("pc", regs_[MIPS64_REG_PC]);
-}
-
-Regs* RegsMips64::Read(void* remote_data) {
-  mips64_user_regs* user = reinterpret_cast<mips64_user_regs*>(remote_data);
-  RegsMips64* regs = new RegsMips64();
-  uint64_t* reg_data = reinterpret_cast<uint64_t*>(regs->RawData());
-
-  memcpy(regs->RawData(), &user->regs[MIPS64_EF_R0], (MIPS64_REG_R31 + 1) * sizeof(uint64_t));
-
-  reg_data[MIPS64_REG_PC] = user->regs[MIPS64_EF_CP0_EPC];
-  return regs;
-}
-
-Regs* RegsMips64::CreateFromUcontext(void* ucontext) {
-  mips64_ucontext_t* mips64_ucontext = reinterpret_cast<mips64_ucontext_t*>(ucontext);
-
-  RegsMips64* regs = new RegsMips64();
-  // Copy 64 bit sc_regs over to 64 bit regs
-  memcpy(regs->RawData(), &mips64_ucontext->uc_mcontext.sc_regs[0], 32 * sizeof(uint64_t));
-  (*regs)[MIPS64_REG_PC] = mips64_ucontext->uc_mcontext.sc_pc;
-  return regs;
-}
-
-bool RegsMips64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) {
-  uint64_t data;
-  Memory* elf_memory = elf->memory();
-  // Read from elf memory since it is usually more expensive to read from
-  // process memory.
-  if (!elf_memory->Read(elf_offset, &data, sizeof(data))) {
-    return false;
-  }
-
-  // Look for the kernel sigreturn function.
-  // __vdso_rt_sigreturn:
-  // 0x2402145b     li  v0, 0x145b
-  // 0x0000000c     syscall
-  if (data != 0x0000000c2402145bULL) {
-    return false;
-  }
-
-  // vdso_rt_sigreturn => read rt_sigframe
-  // offset = siginfo offset + sizeof(siginfo) + uc_mcontext offset
-  // read 64 bit sc_regs[32] from stack into 64 bit regs_
-  uint64_t sp = regs_[MIPS64_REG_SP];
-  if (!process_memory->Read(sp + 24 + 128 + 40, regs_.data(),
-                            sizeof(uint64_t) * (MIPS64_REG_LAST - 1))) {
-    return false;
-  }
-
-  // offset = siginfo offset + sizeof(siginfo) + uc_mcontext offset + sc_pc offset
-  // read 64 bit sc_pc from stack into 64 bit regs_[MIPS64_REG_PC]
-  if (!process_memory->Read(sp + 24 + 128 + 40 + 576, &regs_[MIPS64_REG_PC], sizeof(uint64_t))) {
-    return false;
-  }
-  return true;
-}
-
-Regs* RegsMips64::Clone() {
-  return new RegsMips64(*this);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/RegsX86.cpp b/libunwindstack/RegsX86.cpp
deleted file mode 100644
index 5538fc0..0000000
--- a/libunwindstack/RegsX86.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineX86.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/UcontextX86.h>
-#include <unwindstack/UserX86.h>
-
-namespace unwindstack {
-
-RegsX86::RegsX86() : RegsImpl<uint32_t>(X86_REG_LAST, Location(LOCATION_SP_OFFSET, -4)) {}
-
-ArchEnum RegsX86::Arch() {
-  return ARCH_X86;
-}
-
-uint64_t RegsX86::pc() {
-  return regs_[X86_REG_PC];
-}
-
-uint64_t RegsX86::sp() {
-  return regs_[X86_REG_SP];
-}
-
-void RegsX86::set_pc(uint64_t pc) {
-  regs_[X86_REG_PC] = static_cast<uint32_t>(pc);
-}
-
-void RegsX86::set_sp(uint64_t sp) {
-  regs_[X86_REG_SP] = static_cast<uint32_t>(sp);
-}
-
-uint64_t RegsX86::GetPcAdjustment(uint64_t rel_pc, Elf*) {
-  if (rel_pc == 0) {
-    return 0;
-  }
-  return 1;
-}
-
-bool RegsX86::SetPcFromReturnAddress(Memory* process_memory) {
-  // Attempt to get the return address from the top of the stack.
-  uint32_t new_pc;
-  if (!process_memory->ReadFully(regs_[X86_REG_SP], &new_pc, sizeof(new_pc)) ||
-      new_pc == regs_[X86_REG_PC]) {
-    return false;
-  }
-
-  regs_[X86_REG_PC] = new_pc;
-  return true;
-}
-
-void RegsX86::IterateRegisters(std::function<void(const char*, uint64_t)> fn) {
-  fn("eax", regs_[X86_REG_EAX]);
-  fn("ebx", regs_[X86_REG_EBX]);
-  fn("ecx", regs_[X86_REG_ECX]);
-  fn("edx", regs_[X86_REG_EDX]);
-  fn("ebp", regs_[X86_REG_EBP]);
-  fn("edi", regs_[X86_REG_EDI]);
-  fn("esi", regs_[X86_REG_ESI]);
-  fn("esp", regs_[X86_REG_ESP]);
-  fn("eip", regs_[X86_REG_EIP]);
-}
-
-Regs* RegsX86::Read(void* user_data) {
-  x86_user_regs* user = reinterpret_cast<x86_user_regs*>(user_data);
-
-  RegsX86* regs = new RegsX86();
-  (*regs)[X86_REG_EAX] = user->eax;
-  (*regs)[X86_REG_EBX] = user->ebx;
-  (*regs)[X86_REG_ECX] = user->ecx;
-  (*regs)[X86_REG_EDX] = user->edx;
-  (*regs)[X86_REG_EBP] = user->ebp;
-  (*regs)[X86_REG_EDI] = user->edi;
-  (*regs)[X86_REG_ESI] = user->esi;
-  (*regs)[X86_REG_ESP] = user->esp;
-  (*regs)[X86_REG_EIP] = user->eip;
-
-  return regs;
-}
-
-void RegsX86::SetFromUcontext(x86_ucontext_t* ucontext) {
-  // Put the registers in the expected order.
-  regs_[X86_REG_EDI] = ucontext->uc_mcontext.edi;
-  regs_[X86_REG_ESI] = ucontext->uc_mcontext.esi;
-  regs_[X86_REG_EBP] = ucontext->uc_mcontext.ebp;
-  regs_[X86_REG_ESP] = ucontext->uc_mcontext.esp;
-  regs_[X86_REG_EBX] = ucontext->uc_mcontext.ebx;
-  regs_[X86_REG_EDX] = ucontext->uc_mcontext.edx;
-  regs_[X86_REG_ECX] = ucontext->uc_mcontext.ecx;
-  regs_[X86_REG_EAX] = ucontext->uc_mcontext.eax;
-  regs_[X86_REG_EIP] = ucontext->uc_mcontext.eip;
-}
-
-Regs* RegsX86::CreateFromUcontext(void* ucontext) {
-  x86_ucontext_t* x86_ucontext = reinterpret_cast<x86_ucontext_t*>(ucontext);
-
-  RegsX86* regs = new RegsX86();
-  regs->SetFromUcontext(x86_ucontext);
-  return regs;
-}
-
-bool RegsX86::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) {
-  uint64_t data;
-  Memory* elf_memory = elf->memory();
-  // Read from elf memory since it is usually more expensive to read from
-  // process memory.
-  if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) {
-    return false;
-  }
-
-  if (data == 0x80cd00000077b858ULL) {
-    // Without SA_SIGINFO set, the return sequence is:
-    //
-    //   __restore:
-    //   0x58                            pop %eax
-    //   0xb8 0x77 0x00 0x00 0x00        movl 0x77,%eax
-    //   0xcd 0x80                       int 0x80
-    //
-    // SP points at arguments:
-    //   int signum
-    //   struct sigcontext (same format as mcontext)
-    struct x86_mcontext_t context;
-    if (!process_memory->ReadFully(regs_[X86_REG_SP] + 4, &context, sizeof(context))) {
-      return false;
-    }
-    regs_[X86_REG_EBP] = context.ebp;
-    regs_[X86_REG_ESP] = context.esp;
-    regs_[X86_REG_EBX] = context.ebx;
-    regs_[X86_REG_EDX] = context.edx;
-    regs_[X86_REG_ECX] = context.ecx;
-    regs_[X86_REG_EAX] = context.eax;
-    regs_[X86_REG_EIP] = context.eip;
-    return true;
-  } else if ((data & 0x00ffffffffffffffULL) == 0x0080cd000000adb8ULL) {
-    // With SA_SIGINFO set, the return sequence is:
-    //
-    //   __restore_rt:
-    //   0xb8 0xad 0x00 0x00 0x00        movl 0xad,%eax
-    //   0xcd 0x80                       int 0x80
-    //
-    // SP points at arguments:
-    //   int signum
-    //   siginfo*
-    //   ucontext*
-
-    // Get the location of the sigcontext data.
-    uint32_t ptr;
-    if (!process_memory->ReadFully(regs_[X86_REG_SP] + 8, &ptr, sizeof(ptr))) {
-      return false;
-    }
-    // Only read the portion of the data structure we care about.
-    x86_ucontext_t x86_ucontext;
-    if (!process_memory->ReadFully(ptr + 0x14, &x86_ucontext.uc_mcontext, sizeof(x86_mcontext_t))) {
-      return false;
-    }
-    SetFromUcontext(&x86_ucontext);
-    return true;
-  }
-  return false;
-}
-
-Regs* RegsX86::Clone() {
-  return new RegsX86(*this);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/RegsX86_64.cpp b/libunwindstack/RegsX86_64.cpp
deleted file mode 100644
index 5b9aa58..0000000
--- a/libunwindstack/RegsX86_64.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineX86_64.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/RegsX86_64.h>
-#include <unwindstack/UcontextX86_64.h>
-#include <unwindstack/UserX86_64.h>
-
-namespace unwindstack {
-
-RegsX86_64::RegsX86_64() : RegsImpl<uint64_t>(X86_64_REG_LAST, Location(LOCATION_SP_OFFSET, -8)) {}
-
-ArchEnum RegsX86_64::Arch() {
-  return ARCH_X86_64;
-}
-
-uint64_t RegsX86_64::pc() {
-  return regs_[X86_64_REG_PC];
-}
-
-uint64_t RegsX86_64::sp() {
-  return regs_[X86_64_REG_SP];
-}
-
-void RegsX86_64::set_pc(uint64_t pc) {
-  regs_[X86_64_REG_PC] = pc;
-}
-
-void RegsX86_64::set_sp(uint64_t sp) {
-  regs_[X86_64_REG_SP] = sp;
-}
-
-uint64_t RegsX86_64::GetPcAdjustment(uint64_t rel_pc, Elf*) {
-  if (rel_pc == 0) {
-    return 0;
-  }
-  return 1;
-}
-
-bool RegsX86_64::SetPcFromReturnAddress(Memory* process_memory) {
-  // Attempt to get the return address from the top of the stack.
-  uint64_t new_pc;
-  if (!process_memory->ReadFully(regs_[X86_64_REG_SP], &new_pc, sizeof(new_pc)) ||
-      new_pc == regs_[X86_64_REG_PC]) {
-    return false;
-  }
-
-  regs_[X86_64_REG_PC] = new_pc;
-  return true;
-}
-
-void RegsX86_64::IterateRegisters(std::function<void(const char*, uint64_t)> fn) {
-  fn("rax", regs_[X86_64_REG_RAX]);
-  fn("rbx", regs_[X86_64_REG_RBX]);
-  fn("rcx", regs_[X86_64_REG_RCX]);
-  fn("rdx", regs_[X86_64_REG_RDX]);
-  fn("r8", regs_[X86_64_REG_R8]);
-  fn("r9", regs_[X86_64_REG_R9]);
-  fn("r10", regs_[X86_64_REG_R10]);
-  fn("r11", regs_[X86_64_REG_R11]);
-  fn("r12", regs_[X86_64_REG_R12]);
-  fn("r13", regs_[X86_64_REG_R13]);
-  fn("r14", regs_[X86_64_REG_R14]);
-  fn("r15", regs_[X86_64_REG_R15]);
-  fn("rdi", regs_[X86_64_REG_RDI]);
-  fn("rsi", regs_[X86_64_REG_RSI]);
-  fn("rbp", regs_[X86_64_REG_RBP]);
-  fn("rsp", regs_[X86_64_REG_RSP]);
-  fn("rip", regs_[X86_64_REG_RIP]);
-}
-
-Regs* RegsX86_64::Read(void* remote_data) {
-  x86_64_user_regs* user = reinterpret_cast<x86_64_user_regs*>(remote_data);
-
-  RegsX86_64* regs = new RegsX86_64();
-  (*regs)[X86_64_REG_RAX] = user->rax;
-  (*regs)[X86_64_REG_RBX] = user->rbx;
-  (*regs)[X86_64_REG_RCX] = user->rcx;
-  (*regs)[X86_64_REG_RDX] = user->rdx;
-  (*regs)[X86_64_REG_R8] = user->r8;
-  (*regs)[X86_64_REG_R9] = user->r9;
-  (*regs)[X86_64_REG_R10] = user->r10;
-  (*regs)[X86_64_REG_R11] = user->r11;
-  (*regs)[X86_64_REG_R12] = user->r12;
-  (*regs)[X86_64_REG_R13] = user->r13;
-  (*regs)[X86_64_REG_R14] = user->r14;
-  (*regs)[X86_64_REG_R15] = user->r15;
-  (*regs)[X86_64_REG_RDI] = user->rdi;
-  (*regs)[X86_64_REG_RSI] = user->rsi;
-  (*regs)[X86_64_REG_RBP] = user->rbp;
-  (*regs)[X86_64_REG_RSP] = user->rsp;
-  (*regs)[X86_64_REG_RIP] = user->rip;
-
-  return regs;
-}
-
-void RegsX86_64::SetFromUcontext(x86_64_ucontext_t* ucontext) {
-  // R8-R15
-  memcpy(&regs_[X86_64_REG_R8], &ucontext->uc_mcontext.r8, 8 * sizeof(uint64_t));
-
-  // Rest of the registers.
-  regs_[X86_64_REG_RDI] = ucontext->uc_mcontext.rdi;
-  regs_[X86_64_REG_RSI] = ucontext->uc_mcontext.rsi;
-  regs_[X86_64_REG_RBP] = ucontext->uc_mcontext.rbp;
-  regs_[X86_64_REG_RBX] = ucontext->uc_mcontext.rbx;
-  regs_[X86_64_REG_RDX] = ucontext->uc_mcontext.rdx;
-  regs_[X86_64_REG_RAX] = ucontext->uc_mcontext.rax;
-  regs_[X86_64_REG_RCX] = ucontext->uc_mcontext.rcx;
-  regs_[X86_64_REG_RSP] = ucontext->uc_mcontext.rsp;
-  regs_[X86_64_REG_RIP] = ucontext->uc_mcontext.rip;
-}
-
-Regs* RegsX86_64::CreateFromUcontext(void* ucontext) {
-  x86_64_ucontext_t* x86_64_ucontext = reinterpret_cast<x86_64_ucontext_t*>(ucontext);
-
-  RegsX86_64* regs = new RegsX86_64();
-  regs->SetFromUcontext(x86_64_ucontext);
-  return regs;
-}
-
-bool RegsX86_64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) {
-  uint64_t data;
-  Memory* elf_memory = elf->memory();
-  // Read from elf memory since it is usually more expensive to read from
-  // process memory.
-  if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data)) || data != 0x0f0000000fc0c748) {
-    return false;
-  }
-
-  uint16_t data2;
-  if (!elf_memory->ReadFully(elf_offset + 8, &data2, sizeof(data2)) || data2 != 0x0f05) {
-    return false;
-  }
-
-  // __restore_rt:
-  // 0x48 0xc7 0xc0 0x0f 0x00 0x00 0x00   mov $0xf,%rax
-  // 0x0f 0x05                            syscall
-  // 0x0f                                 nopl 0x0($rax)
-
-  // Read the mcontext data from the stack.
-  // sp points to the ucontext data structure, read only the mcontext part.
-  x86_64_ucontext_t x86_64_ucontext;
-  if (!process_memory->ReadFully(regs_[X86_64_REG_SP] + 0x28, &x86_64_ucontext.uc_mcontext,
-                                 sizeof(x86_64_mcontext_t))) {
-    return false;
-  }
-  SetFromUcontext(&x86_64_ucontext);
-  return true;
-}
-
-Regs* RegsX86_64::Clone() {
-  return new RegsX86_64(*this);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/Symbols.cpp b/libunwindstack/Symbols.cpp
deleted file mode 100644
index e3c15a2..0000000
--- a/libunwindstack/Symbols.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <elf.h>
-#include <stdint.h>
-
-#include <algorithm>
-#include <string>
-
-#include <unwindstack/Memory.h>
-
-#include "Check.h"
-#include "Symbols.h"
-
-namespace unwindstack {
-
-Symbols::Symbols(uint64_t offset, uint64_t size, uint64_t entry_size, uint64_t str_offset,
-                 uint64_t str_size)
-    : cur_offset_(offset),
-      offset_(offset),
-      end_(offset + size),
-      entry_size_(entry_size),
-      str_offset_(str_offset),
-      str_end_(str_offset_ + str_size) {}
-
-const Symbols::Info* Symbols::GetInfoFromCache(uint64_t addr) {
-  // Binary search the table.
-  size_t first = 0;
-  size_t last = symbols_.size();
-  while (first < last) {
-    size_t current = first + (last - first) / 2;
-    const Info* info = &symbols_[current];
-    if (addr < info->start_offset) {
-      last = current;
-    } else if (addr < info->end_offset) {
-      return info;
-    } else {
-      first = current + 1;
-    }
-  }
-  return nullptr;
-}
-
-template <typename SymType>
-bool Symbols::GetName(uint64_t addr, Memory* elf_memory, std::string* name, uint64_t* func_offset) {
-  if (symbols_.size() != 0) {
-    const Info* info = GetInfoFromCache(addr);
-    if (info) {
-      CHECK(addr >= info->start_offset && addr <= info->end_offset);
-      *func_offset = addr - info->start_offset;
-      return elf_memory->ReadString(info->str_offset, name, str_end_ - info->str_offset);
-    }
-  }
-
-  bool symbol_added = false;
-  bool return_value = false;
-  while (cur_offset_ + entry_size_ <= end_) {
-    SymType entry;
-    if (!elf_memory->ReadFully(cur_offset_, &entry, sizeof(entry))) {
-      // Stop all processing, something looks like it is corrupted.
-      cur_offset_ = UINT64_MAX;
-      return false;
-    }
-    cur_offset_ += entry_size_;
-
-    if (entry.st_shndx != SHN_UNDEF && ELF32_ST_TYPE(entry.st_info) == STT_FUNC) {
-      // Treat st_value as virtual address.
-      uint64_t start_offset = entry.st_value;
-      uint64_t end_offset = start_offset + entry.st_size;
-
-      // Cache the value.
-      symbols_.emplace_back(start_offset, end_offset, str_offset_ + entry.st_name);
-      symbol_added = true;
-
-      if (addr >= start_offset && addr < end_offset) {
-        *func_offset = addr - start_offset;
-        uint64_t offset = str_offset_ + entry.st_name;
-        if (offset < str_end_) {
-          return_value = elf_memory->ReadString(offset, name, str_end_ - offset);
-        }
-        break;
-      }
-    }
-  }
-
-  if (symbol_added) {
-    std::sort(symbols_.begin(), symbols_.end(),
-              [](const Info& a, const Info& b) { return a.start_offset < b.start_offset; });
-  }
-  return return_value;
-}
-
-template <typename SymType>
-bool Symbols::GetGlobal(Memory* elf_memory, const std::string& name, uint64_t* memory_address) {
-  uint64_t cur_offset = offset_;
-  while (cur_offset + entry_size_ <= end_) {
-    SymType entry;
-    if (!elf_memory->ReadFully(cur_offset, &entry, sizeof(entry))) {
-      return false;
-    }
-    cur_offset += entry_size_;
-
-    if (entry.st_shndx != SHN_UNDEF && ELF32_ST_TYPE(entry.st_info) == STT_OBJECT &&
-        ELF32_ST_BIND(entry.st_info) == STB_GLOBAL) {
-      uint64_t str_offset = str_offset_ + entry.st_name;
-      if (str_offset < str_end_) {
-        std::string symbol;
-        if (elf_memory->ReadString(str_offset, &symbol, str_end_ - str_offset) && symbol == name) {
-          *memory_address = entry.st_value;
-          return true;
-        }
-      }
-    }
-  }
-  return false;
-}
-
-// Instantiate all of the needed template functions.
-template bool Symbols::GetName<Elf32_Sym>(uint64_t, Memory*, std::string*, uint64_t*);
-template bool Symbols::GetName<Elf64_Sym>(uint64_t, Memory*, std::string*, uint64_t*);
-
-template bool Symbols::GetGlobal<Elf32_Sym>(Memory*, const std::string&, uint64_t*);
-template bool Symbols::GetGlobal<Elf64_Sym>(Memory*, const std::string&, uint64_t*);
-}  // namespace unwindstack
diff --git a/libunwindstack/Symbols.h b/libunwindstack/Symbols.h
deleted file mode 100644
index 7fcd067..0000000
--- a/libunwindstack/Symbols.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_SYMBOLS_H
-#define _LIBUNWINDSTACK_SYMBOLS_H
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-namespace unwindstack {
-
-// Forward declaration.
-class Memory;
-
-class Symbols {
-  struct Info {
-    Info(uint64_t start_offset, uint64_t end_offset, uint64_t str_offset)
-        : start_offset(start_offset), end_offset(end_offset), str_offset(str_offset) {}
-    uint64_t start_offset;
-    uint64_t end_offset;
-    uint64_t str_offset;
-  };
-
- public:
-  Symbols(uint64_t offset, uint64_t size, uint64_t entry_size, uint64_t str_offset,
-          uint64_t str_size);
-  virtual ~Symbols() = default;
-
-  const Info* GetInfoFromCache(uint64_t addr);
-
-  template <typename SymType>
-  bool GetName(uint64_t addr, Memory* elf_memory, std::string* name, uint64_t* func_offset);
-
-  template <typename SymType>
-  bool GetGlobal(Memory* elf_memory, const std::string& name, uint64_t* memory_address);
-
-  void ClearCache() {
-    symbols_.clear();
-    cur_offset_ = offset_;
-  }
-
- private:
-  uint64_t cur_offset_;
-  uint64_t offset_;
-  uint64_t end_;
-  uint64_t entry_size_;
-  uint64_t str_offset_;
-  uint64_t str_end_;
-
-  std::vector<Info> symbols_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_SYMBOLS_H
diff --git a/libunwindstack/TEST_MAPPING b/libunwindstack/TEST_MAPPING
deleted file mode 100644
index 909f897..0000000
--- a/libunwindstack/TEST_MAPPING
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-  "presubmit": [
-    {
-      "name": "libunwindstack_unit_test"
-    },
-    {
-      "name": "CtsSimpleperfTestCases"
-    }
-  ]
-}
diff --git a/libunwindstack/Unwinder.cpp b/libunwindstack/Unwinder.cpp
deleted file mode 100644
index 1bb0319..0000000
--- a/libunwindstack/Unwinder.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#define _GNU_SOURCE 1
-#include <elf.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <algorithm>
-
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Unwinder.h>
-
-#include <unwindstack/DexFiles.h>
-
-// Use the demangler from libc++.
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int* status);
-
-namespace unwindstack {
-
-// Inject extra 'virtual' frame that represents the dex pc data.
-// The dex pc is a magic register defined in the Mterp interpreter,
-// and thus it will be restored/observed in the frame after it.
-// Adding the dex frame first here will create something like:
-//   #7 pc 0015fa20 core.vdex   java.util.Arrays.binarySearch+8
-//   #8 pc 006b1ba1 libartd.so  ExecuteMterpImpl+14625
-//   #9 pc 0039a1ef libartd.so  art::interpreter::Execute+719
-void Unwinder::FillInDexFrame() {
-  size_t frame_num = frames_.size();
-  frames_.resize(frame_num + 1);
-  FrameData* frame = &frames_.at(frame_num);
-  frame->num = frame_num;
-
-  uint64_t dex_pc = regs_->dex_pc();
-  frame->pc = dex_pc;
-  frame->sp = regs_->sp();
-
-  MapInfo* info = maps_->Find(dex_pc);
-  if (info != nullptr) {
-    frame->map_start = info->start;
-    frame->map_end = info->end;
-    // Since this is a dex file frame, the elf_start_offset is not set
-    // by any of the normal code paths. Use the offset of the map since
-    // that matches the actual offset.
-    frame->map_elf_start_offset = info->offset;
-    frame->map_exact_offset = info->offset;
-    frame->map_load_bias = info->load_bias;
-    frame->map_flags = info->flags;
-    if (resolve_names_) {
-      frame->map_name = info->name;
-    }
-    frame->rel_pc = dex_pc - info->start;
-  } else {
-    frame->rel_pc = dex_pc;
-    return;
-  }
-
-  if (!resolve_names_) {
-    return;
-  }
-
-#if defined(DEXFILE_SUPPORT)
-  if (dex_files_ == nullptr) {
-    return;
-  }
-
-  dex_files_->GetMethodInformation(maps_, info, dex_pc, &frame->function_name,
-                                   &frame->function_offset);
-#endif
-}
-
-FrameData* Unwinder::FillInFrame(MapInfo* map_info, Elf* elf, uint64_t rel_pc,
-                                 uint64_t pc_adjustment) {
-  size_t frame_num = frames_.size();
-  frames_.resize(frame_num + 1);
-  FrameData* frame = &frames_.at(frame_num);
-  frame->num = frame_num;
-  frame->sp = regs_->sp();
-  frame->rel_pc = rel_pc - pc_adjustment;
-  frame->pc = regs_->pc() - pc_adjustment;
-
-  if (map_info == nullptr) {
-    // Nothing else to update.
-    return nullptr;
-  }
-
-  if (resolve_names_) {
-    frame->map_name = map_info->name;
-    if (embedded_soname_ && map_info->elf_start_offset != 0 && !frame->map_name.empty()) {
-      std::string soname = elf->GetSoname();
-      if (!soname.empty()) {
-        frame->map_name += '!' + soname;
-      }
-    }
-  }
-  frame->map_elf_start_offset = map_info->elf_start_offset;
-  frame->map_exact_offset = map_info->offset;
-  frame->map_start = map_info->start;
-  frame->map_end = map_info->end;
-  frame->map_flags = map_info->flags;
-  frame->map_load_bias = elf->GetLoadBias();
-  return frame;
-}
-
-static bool ShouldStop(const std::vector<std::string>* map_suffixes_to_ignore,
-                       std::string& map_name) {
-  if (map_suffixes_to_ignore == nullptr) {
-    return false;
-  }
-  auto pos = map_name.find_last_of('.');
-  if (pos == std::string::npos) {
-    return false;
-  }
-
-  return std::find(map_suffixes_to_ignore->begin(), map_suffixes_to_ignore->end(),
-                   map_name.substr(pos + 1)) != map_suffixes_to_ignore->end();
-}
-
-void Unwinder::Unwind(const std::vector<std::string>* initial_map_names_to_skip,
-                      const std::vector<std::string>* map_suffixes_to_ignore) {
-  frames_.clear();
-  last_error_.code = ERROR_NONE;
-  last_error_.address = 0;
-  elf_from_memory_not_file_ = false;
-
-  ArchEnum arch = regs_->Arch();
-
-  bool return_address_attempt = false;
-  bool adjust_pc = false;
-  for (; frames_.size() < max_frames_;) {
-    uint64_t cur_pc = regs_->pc();
-    uint64_t cur_sp = regs_->sp();
-
-    MapInfo* map_info = maps_->Find(regs_->pc());
-    uint64_t pc_adjustment = 0;
-    uint64_t step_pc;
-    uint64_t rel_pc;
-    Elf* elf;
-    if (map_info == nullptr) {
-      step_pc = regs_->pc();
-      rel_pc = step_pc;
-      last_error_.code = ERROR_INVALID_MAP;
-    } else {
-      if (ShouldStop(map_suffixes_to_ignore, map_info->name)) {
-        break;
-      }
-      elf = map_info->GetElf(process_memory_, arch);
-      // If this elf is memory backed, and there is a valid file, then set
-      // an indicator that we couldn't open the file.
-      if (!elf_from_memory_not_file_ && map_info->memory_backed_elf && !map_info->name.empty() &&
-          map_info->name[0] != '[' && !android::base::StartsWith(map_info->name, "/memfd:")) {
-        elf_from_memory_not_file_ = true;
-      }
-      step_pc = regs_->pc();
-      rel_pc = elf->GetRelPc(step_pc, map_info);
-      // Everyone except elf data in gdb jit debug maps uses the relative pc.
-      if (!(map_info->flags & MAPS_FLAGS_JIT_SYMFILE_MAP)) {
-        step_pc = rel_pc;
-      }
-      if (adjust_pc) {
-        pc_adjustment = regs_->GetPcAdjustment(rel_pc, elf);
-      } else {
-        pc_adjustment = 0;
-      }
-      step_pc -= pc_adjustment;
-
-      // If the pc is in an invalid elf file, try and get an Elf object
-      // using the jit debug information.
-      if (!elf->valid() && jit_debug_ != nullptr) {
-        uint64_t adjusted_jit_pc = regs_->pc() - pc_adjustment;
-        Elf* jit_elf = jit_debug_->GetElf(maps_, adjusted_jit_pc);
-        if (jit_elf != nullptr) {
-          // The jit debug information requires a non relative adjusted pc.
-          step_pc = adjusted_jit_pc;
-          elf = jit_elf;
-        }
-      }
-    }
-
-    FrameData* frame = nullptr;
-    if (map_info == nullptr || initial_map_names_to_skip == nullptr ||
-        std::find(initial_map_names_to_skip->begin(), initial_map_names_to_skip->end(),
-                  basename(map_info->name.c_str())) == initial_map_names_to_skip->end()) {
-      if (regs_->dex_pc() != 0) {
-        // Add a frame to represent the dex file.
-        FillInDexFrame();
-        // Clear the dex pc so that we don't repeat this frame later.
-        regs_->set_dex_pc(0);
-
-        // Make sure there is enough room for the real frame.
-        if (frames_.size() == max_frames_) {
-          last_error_.code = ERROR_MAX_FRAMES_EXCEEDED;
-          break;
-        }
-      }
-
-      frame = FillInFrame(map_info, elf, rel_pc, pc_adjustment);
-
-      // Once a frame is added, stop skipping frames.
-      initial_map_names_to_skip = nullptr;
-    }
-    adjust_pc = true;
-
-    bool stepped = false;
-    bool in_device_map = false;
-    bool finished = false;
-    if (map_info != nullptr) {
-      if (map_info->flags & MAPS_FLAGS_DEVICE_MAP) {
-        // Do not stop here, fall through in case we are
-        // in the speculative unwind path and need to remove
-        // some of the speculative frames.
-        in_device_map = true;
-      } else {
-        MapInfo* sp_info = maps_->Find(regs_->sp());
-        if (sp_info != nullptr && sp_info->flags & MAPS_FLAGS_DEVICE_MAP) {
-          // Do not stop here, fall through in case we are
-          // in the speculative unwind path and need to remove
-          // some of the speculative frames.
-          in_device_map = true;
-        } else {
-          if (elf->StepIfSignalHandler(rel_pc, regs_, process_memory_.get())) {
-            stepped = true;
-            if (frame != nullptr) {
-              // Need to adjust the relative pc because the signal handler
-              // pc should not be adjusted.
-              frame->rel_pc = rel_pc;
-              frame->pc += pc_adjustment;
-              step_pc = rel_pc;
-            }
-          } else if (elf->Step(step_pc, regs_, process_memory_.get(), &finished)) {
-            stepped = true;
-          }
-          elf->GetLastError(&last_error_);
-        }
-      }
-    }
-
-    if (frame != nullptr) {
-      if (!resolve_names_ ||
-          !elf->GetFunctionName(step_pc, &frame->function_name, &frame->function_offset)) {
-        frame->function_name = "";
-        frame->function_offset = 0;
-      }
-    }
-
-    if (finished) {
-      break;
-    }
-
-    if (!stepped) {
-      if (return_address_attempt) {
-        // Only remove the speculative frame if there are more than two frames
-        // or the pc in the first frame is in a valid map.
-        // This allows for a case where the code jumps into the middle of
-        // nowhere, but there is no other unwind information after that.
-        if (frames_.size() > 2 || (frames_.size() > 0 && maps_->Find(frames_[0].pc) != nullptr)) {
-          // Remove the speculative frame.
-          frames_.pop_back();
-        }
-        break;
-      } else if (in_device_map) {
-        // Do not attempt any other unwinding, pc or sp is in a device
-        // map.
-        break;
-      } else {
-        // Steping didn't work, try this secondary method.
-        if (!regs_->SetPcFromReturnAddress(process_memory_.get())) {
-          break;
-        }
-        return_address_attempt = true;
-      }
-    } else {
-      return_address_attempt = false;
-      if (max_frames_ == frames_.size()) {
-        last_error_.code = ERROR_MAX_FRAMES_EXCEEDED;
-      }
-    }
-
-    // If the pc and sp didn't change, then consider everything stopped.
-    if (cur_pc == regs_->pc() && cur_sp == regs_->sp()) {
-      last_error_.code = ERROR_REPEATED_FRAME;
-      break;
-    }
-  }
-}
-
-std::string Unwinder::FormatFrame(const FrameData& frame) const {
-  std::string data;
-  if (regs_->Is32Bit()) {
-    data += android::base::StringPrintf("  #%02zu pc %08" PRIx64, frame.num, frame.rel_pc);
-  } else {
-    data += android::base::StringPrintf("  #%02zu pc %016" PRIx64, frame.num, frame.rel_pc);
-  }
-
-  if (frame.map_start == frame.map_end) {
-    // No valid map associated with this frame.
-    data += "  <unknown>";
-  } else if (!frame.map_name.empty()) {
-    data += "  " + frame.map_name;
-  } else {
-    data += android::base::StringPrintf("  <anonymous:%" PRIx64 ">", frame.map_start);
-  }
-
-  if (frame.map_elf_start_offset != 0) {
-    data += android::base::StringPrintf(" (offset 0x%" PRIx64 ")", frame.map_elf_start_offset);
-  }
-
-  if (!frame.function_name.empty()) {
-    char* demangled_name = __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, nullptr);
-    if (demangled_name == nullptr) {
-      data += " (" + frame.function_name;
-    } else {
-      data += " (";
-      data += demangled_name;
-      free(demangled_name);
-    }
-    if (frame.function_offset != 0) {
-      data += android::base::StringPrintf("+%" PRId64, frame.function_offset);
-    }
-    data += ')';
-  }
-
-  MapInfo* map_info = maps_->Find(frame.map_start);
-  if (map_info != nullptr && display_build_id_) {
-    std::string build_id = map_info->GetPrintableBuildID();
-    if (!build_id.empty()) {
-      data += " (BuildId: " + build_id + ')';
-    }
-  }
-  return data;
-}
-
-std::string Unwinder::FormatFrame(size_t frame_num) const {
-  if (frame_num >= frames_.size()) {
-    return "";
-  }
-  return FormatFrame(frames_[frame_num]);
-}
-
-void Unwinder::SetJitDebug(JitDebug* jit_debug, ArchEnum arch) {
-  jit_debug->SetArch(arch);
-  jit_debug_ = jit_debug;
-}
-
-void Unwinder::SetDexFiles(DexFiles* dex_files, ArchEnum arch) {
-  dex_files->SetArch(arch);
-  dex_files_ = dex_files;
-}
-
-bool UnwinderFromPid::Init(ArchEnum arch) {
-  if (pid_ == getpid()) {
-    maps_ptr_.reset(new LocalMaps());
-  } else {
-    maps_ptr_.reset(new RemoteMaps(pid_));
-  }
-  if (!maps_ptr_->Parse()) {
-    return false;
-  }
-  maps_ = maps_ptr_.get();
-
-  process_memory_ = Memory::CreateProcessMemoryCached(pid_);
-
-  jit_debug_ptr_.reset(new JitDebug(process_memory_));
-  jit_debug_ = jit_debug_ptr_.get();
-  SetJitDebug(jit_debug_, arch);
-#if defined(DEXFILE_SUPPORT)
-  dex_files_ptr_.reset(new DexFiles(process_memory_));
-  dex_files_ = dex_files_ptr_.get();
-  SetDexFiles(dex_files_, arch);
-#endif
-
-  return true;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/benchmarks/unwind_benchmarks.cpp b/libunwindstack/benchmarks/unwind_benchmarks.cpp
deleted file mode 100644
index de9137a..0000000
--- a/libunwindstack/benchmarks/unwind_benchmarks.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-
-#include <memory>
-
-#include <benchmark/benchmark.h>
-
-#include <android-base/strings.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
-#include <unwindstack/Unwinder.h>
-
-size_t Call6(std::shared_ptr<unwindstack::Memory>& process_memory, unwindstack::Maps* maps) {
-  std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::CreateFromLocal());
-  unwindstack::RegsGetLocal(regs.get());
-  unwindstack::Unwinder unwinder(32, maps, regs.get(), process_memory);
-  unwinder.Unwind();
-  return unwinder.NumFrames();
-}
-
-size_t Call5(std::shared_ptr<unwindstack::Memory>& process_memory, unwindstack::Maps* maps) {
-  return Call6(process_memory, maps);
-}
-
-size_t Call4(std::shared_ptr<unwindstack::Memory>& process_memory, unwindstack::Maps* maps) {
-  return Call5(process_memory, maps);
-}
-
-size_t Call3(std::shared_ptr<unwindstack::Memory>& process_memory, unwindstack::Maps* maps) {
-  return Call4(process_memory, maps);
-}
-
-size_t Call2(std::shared_ptr<unwindstack::Memory>& process_memory, unwindstack::Maps* maps) {
-  return Call3(process_memory, maps);
-}
-
-size_t Call1(std::shared_ptr<unwindstack::Memory>& process_memory, unwindstack::Maps* maps) {
-  return Call2(process_memory, maps);
-}
-
-static void BM_uncached_unwind(benchmark::State& state) {
-  auto process_memory = unwindstack::Memory::CreateProcessMemory(getpid());
-  unwindstack::LocalMaps maps;
-  if (!maps.Parse()) {
-    state.SkipWithError("Failed to parse local maps.");
-  }
-
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(Call1(process_memory, &maps));
-  }
-}
-BENCHMARK(BM_uncached_unwind);
-
-static void BM_cached_unwind(benchmark::State& state) {
-  auto process_memory = unwindstack::Memory::CreateProcessMemoryCached(getpid());
-  unwindstack::LocalMaps maps;
-  if (!maps.Parse()) {
-    state.SkipWithError("Failed to parse local maps.");
-  }
-
-  for (auto _ : state) {
-    benchmark::DoNotOptimize(Call1(process_memory, &maps));
-  }
-}
-BENCHMARK(BM_cached_unwind);
-
-static void Initialize(benchmark::State& state, unwindstack::Maps& maps,
-                       unwindstack::MapInfo** build_id_map_info) {
-  if (!maps.Parse()) {
-    state.SkipWithError("Failed to parse local maps.");
-    return;
-  }
-
-  // Find the libc.so share library and use that for benchmark purposes.
-  *build_id_map_info = nullptr;
-  for (auto& map_info : maps) {
-    if (map_info->offset == 0 && map_info->GetBuildID() != "") {
-      *build_id_map_info = map_info.get();
-      break;
-    }
-  }
-
-  if (*build_id_map_info == nullptr) {
-    state.SkipWithError("Failed to find a map with a BuildID.");
-  }
-}
-
-static void BM_get_build_id_from_elf(benchmark::State& state) {
-  unwindstack::LocalMaps maps;
-  unwindstack::MapInfo* build_id_map_info;
-  Initialize(state, maps, &build_id_map_info);
-
-  unwindstack::Elf* elf = build_id_map_info->GetElf(std::shared_ptr<unwindstack::Memory>(),
-                                                    unwindstack::Regs::CurrentArch());
-  if (!elf->valid()) {
-    state.SkipWithError("Cannot get valid elf from map.");
-  }
-
-  for (auto _ : state) {
-    uintptr_t id = build_id_map_info->build_id;
-    if (id != 0) {
-      delete reinterpret_cast<std::string*>(id);
-      build_id_map_info->build_id = 0;
-    }
-    benchmark::DoNotOptimize(build_id_map_info->GetBuildID());
-  }
-}
-BENCHMARK(BM_get_build_id_from_elf);
-
-static void BM_get_build_id_from_file(benchmark::State& state) {
-  unwindstack::LocalMaps maps;
-  unwindstack::MapInfo* build_id_map_info;
-  Initialize(state, maps, &build_id_map_info);
-
-  for (auto _ : state) {
-    uintptr_t id = build_id_map_info->build_id;
-    if (id != 0) {
-      delete reinterpret_cast<std::string*>(id);
-      build_id_map_info->build_id = 0;
-    }
-    benchmark::DoNotOptimize(build_id_map_info->GetBuildID());
-  }
-}
-BENCHMARK(BM_get_build_id_from_file);
-
-BENCHMARK_MAIN();
diff --git a/libunwindstack/include/unwindstack/DexFiles.h b/libunwindstack/include/unwindstack/DexFiles.h
deleted file mode 100644
index 67a9640..0000000
--- a/libunwindstack/include/unwindstack/DexFiles.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DEX_FILES_H
-#define _LIBUNWINDSTACK_DEX_FILES_H
-
-#include <stdint.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include <unwindstack/Global.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class DexFile;
-class Maps;
-struct MapInfo;
-enum ArchEnum : uint8_t;
-
-class DexFiles : public Global {
- public:
-  explicit DexFiles(std::shared_ptr<Memory>& memory);
-  DexFiles(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs);
-  virtual ~DexFiles();
-
-  DexFile* GetDexFile(uint64_t dex_file_offset, MapInfo* info);
-
-  void GetMethodInformation(Maps* maps, MapInfo* info, uint64_t dex_pc, std::string* method_name,
-                            uint64_t* method_offset);
-
- private:
-  void Init(Maps* maps);
-
-  bool GetAddr(size_t index, uint64_t* addr);
-
-  uint64_t ReadEntryPtr32(uint64_t addr);
-
-  uint64_t ReadEntryPtr64(uint64_t addr);
-
-  bool ReadEntry32();
-
-  bool ReadEntry64();
-
-  bool ReadVariableData(uint64_t ptr_offset) override;
-
-  void ProcessArch() override;
-
-  std::mutex lock_;
-  bool initialized_ = false;
-  std::unordered_map<uint64_t, std::unique_ptr<DexFile>> files_;
-
-  uint64_t entry_addr_ = 0;
-  uint64_t (DexFiles::*read_entry_ptr_func_)(uint64_t) = nullptr;
-  bool (DexFiles::*read_entry_func_)() = nullptr;
-  std::vector<uint64_t> addrs_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DEX_FILES_H
diff --git a/libunwindstack/include/unwindstack/DwarfError.h b/libunwindstack/include/unwindstack/DwarfError.h
deleted file mode 100644
index 763e2cb..0000000
--- a/libunwindstack/include/unwindstack/DwarfError.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_ERROR_H
-#define _LIBUNWINDSTACK_DWARF_ERROR_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum DwarfErrorCode : uint8_t {
-  DWARF_ERROR_NONE,
-  DWARF_ERROR_MEMORY_INVALID,
-  DWARF_ERROR_ILLEGAL_VALUE,
-  DWARF_ERROR_ILLEGAL_STATE,
-  DWARF_ERROR_STACK_INDEX_NOT_VALID,
-  DWARF_ERROR_NOT_IMPLEMENTED,
-  DWARF_ERROR_TOO_MANY_ITERATIONS,
-  DWARF_ERROR_CFA_NOT_DEFINED,
-  DWARF_ERROR_UNSUPPORTED_VERSION,
-  DWARF_ERROR_NO_FDES,
-};
-
-struct DwarfErrorData {
-  DwarfErrorCode code;
-  uint64_t address;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_ERROR_H
diff --git a/libunwindstack/include/unwindstack/DwarfLocation.h b/libunwindstack/include/unwindstack/DwarfLocation.h
deleted file mode 100644
index 3d50ccf..0000000
--- a/libunwindstack/include/unwindstack/DwarfLocation.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_LOCATION_H
-#define _LIBUNWINDSTACK_DWARF_LOCATION_H
-
-#include <stdint.h>
-
-#include <unordered_map>
-
-namespace unwindstack {
-
-struct DwarfCie;
-
-enum DwarfLocationEnum : uint8_t {
-  DWARF_LOCATION_INVALID = 0,
-  DWARF_LOCATION_UNDEFINED,
-  DWARF_LOCATION_OFFSET,
-  DWARF_LOCATION_VAL_OFFSET,
-  DWARF_LOCATION_REGISTER,
-  DWARF_LOCATION_EXPRESSION,
-  DWARF_LOCATION_VAL_EXPRESSION,
-};
-
-struct DwarfLocation {
-  DwarfLocationEnum type;
-  uint64_t values[2];
-};
-
-struct DwarfLocations : public std::unordered_map<uint32_t, DwarfLocation> {
-  const DwarfCie* cie;
-  // The range of PCs where the locations are valid (end is exclusive).
-  uint64_t pc_start = 0;
-  uint64_t pc_end = 0;
-};
-typedef DwarfLocations dwarf_loc_regs_t;
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_LOCATION_H
diff --git a/libunwindstack/include/unwindstack/DwarfMemory.h b/libunwindstack/include/unwindstack/DwarfMemory.h
deleted file mode 100644
index c45699a..0000000
--- a/libunwindstack/include/unwindstack/DwarfMemory.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_MEMORY_H
-#define _LIBUNWINDSTACK_DWARF_MEMORY_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-
-class DwarfMemory {
- public:
-  DwarfMemory(Memory* memory) : memory_(memory) {}
-  virtual ~DwarfMemory() = default;
-
-  bool ReadBytes(void* dst, size_t num_bytes);
-
-  template <typename SignedType>
-  bool ReadSigned(uint64_t* value);
-
-  bool ReadULEB128(uint64_t* value);
-
-  bool ReadSLEB128(int64_t* value);
-
-  template <typename AddressType>
-  size_t GetEncodedSize(uint8_t encoding);
-
-  bool AdjustEncodedValue(uint8_t encoding, uint64_t* value);
-
-  template <typename AddressType>
-  bool ReadEncodedValue(uint8_t encoding, uint64_t* value);
-
-  uint64_t cur_offset() { return cur_offset_; }
-  void set_cur_offset(uint64_t cur_offset) { cur_offset_ = cur_offset; }
-
-  void set_pc_offset(int64_t offset) { pc_offset_ = offset; }
-  void clear_pc_offset() { pc_offset_ = INT64_MAX; }
-
-  void set_data_offset(uint64_t offset) { data_offset_ = offset; }
-  void clear_data_offset() { data_offset_ = static_cast<uint64_t>(-1); }
-
-  void set_func_offset(uint64_t offset) { func_offset_ = offset; }
-  void clear_func_offset() { func_offset_ = static_cast<uint64_t>(-1); }
-
-  void set_text_offset(uint64_t offset) { text_offset_ = offset; }
-  void clear_text_offset() { text_offset_ = static_cast<uint64_t>(-1); }
-
- private:
-  Memory* memory_;
-  uint64_t cur_offset_ = 0;
-
-  int64_t pc_offset_ = INT64_MAX;
-  uint64_t data_offset_ = static_cast<uint64_t>(-1);
-  uint64_t func_offset_ = static_cast<uint64_t>(-1);
-  uint64_t text_offset_ = static_cast<uint64_t>(-1);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_MEMORY_H
diff --git a/libunwindstack/include/unwindstack/DwarfSection.h b/libunwindstack/include/unwindstack/DwarfSection.h
deleted file mode 100644
index c244749..0000000
--- a/libunwindstack/include/unwindstack/DwarfSection.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_SECTION_H
-#define _LIBUNWINDSTACK_DWARF_SECTION_H
-
-#include <stdint.h>
-
-#include <iterator>
-#include <map>
-#include <unordered_map>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/DwarfStructs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-class Regs;
-template <typename AddressType>
-struct RegsInfo;
-
-class DwarfSection {
- public:
-  DwarfSection(Memory* memory);
-  virtual ~DwarfSection() = default;
-
-  class iterator : public std::iterator<std::bidirectional_iterator_tag, DwarfFde*> {
-   public:
-    iterator(DwarfSection* section, size_t index) : index_(index) {
-      section->GetFdes(&fdes_);
-      if (index_ == static_cast<size_t>(-1)) {
-        index_ = fdes_.size();
-      }
-    }
-
-    iterator& operator++() {
-      index_++;
-      return *this;
-    }
-    iterator& operator++(int increment) {
-      index_ += increment;
-      return *this;
-    }
-    iterator& operator--() {
-      index_--;
-      return *this;
-    }
-    iterator& operator--(int decrement) {
-      index_ -= decrement;
-      return *this;
-    }
-
-    bool operator==(const iterator& rhs) { return this->index_ == rhs.index_; }
-    bool operator!=(const iterator& rhs) { return this->index_ != rhs.index_; }
-
-    const DwarfFde* operator*() {
-      if (index_ > fdes_.size()) return nullptr;
-      return fdes_[index_];
-    }
-
-   private:
-    std::vector<const DwarfFde*> fdes_;
-    size_t index_ = 0;
-  };
-
-  iterator begin() { return iterator(this, 0); }
-  iterator end() { return iterator(this, static_cast<size_t>(-1)); }
-
-  DwarfErrorCode LastErrorCode() { return last_error_.code; }
-  uint64_t LastErrorAddress() { return last_error_.address; }
-
-  virtual bool Init(uint64_t offset, uint64_t size, int64_t section_bias) = 0;
-
-  virtual bool Eval(const DwarfCie*, Memory*, const dwarf_loc_regs_t&, Regs*, bool*) = 0;
-
-  virtual bool Log(uint8_t indent, uint64_t pc, const DwarfFde* fde) = 0;
-
-  virtual void GetFdes(std::vector<const DwarfFde*>* fdes) = 0;
-
-  virtual const DwarfFde* GetFdeFromPc(uint64_t pc) = 0;
-
-  virtual bool GetCfaLocationInfo(uint64_t pc, const DwarfFde* fde, dwarf_loc_regs_t* loc_regs) = 0;
-
-  virtual uint64_t GetCieOffsetFromFde32(uint32_t pointer) = 0;
-
-  virtual uint64_t GetCieOffsetFromFde64(uint64_t pointer) = 0;
-
-  virtual uint64_t AdjustPcFromFde(uint64_t pc) = 0;
-
-  bool Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* finished);
-
- protected:
-  DwarfMemory memory_;
-  DwarfErrorData last_error_{DWARF_ERROR_NONE, 0};
-
-  uint32_t cie32_value_ = 0;
-  uint64_t cie64_value_ = 0;
-
-  std::unordered_map<uint64_t, DwarfFde> fde_entries_;
-  std::unordered_map<uint64_t, DwarfCie> cie_entries_;
-  std::unordered_map<uint64_t, dwarf_loc_regs_t> cie_loc_regs_;
-  std::map<uint64_t, dwarf_loc_regs_t> loc_regs_;  // Single row indexed by pc_end.
-};
-
-template <typename AddressType>
-class DwarfSectionImpl : public DwarfSection {
- public:
-  DwarfSectionImpl(Memory* memory) : DwarfSection(memory) {}
-  virtual ~DwarfSectionImpl() = default;
-
-  bool Init(uint64_t offset, uint64_t size, int64_t section_bias) override;
-
-  const DwarfCie* GetCieFromOffset(uint64_t offset);
-
-  const DwarfFde* GetFdeFromOffset(uint64_t offset);
-
-  const DwarfFde* GetFdeFromPc(uint64_t pc) override;
-
-  void GetFdes(std::vector<const DwarfFde*>* fdes) override;
-
-  bool EvalRegister(const DwarfLocation* loc, uint32_t reg, AddressType* reg_ptr, void* info);
-
-  bool Eval(const DwarfCie* cie, Memory* regular_memory, const dwarf_loc_regs_t& loc_regs,
-            Regs* regs, bool* finished) override;
-
-  bool GetCfaLocationInfo(uint64_t pc, const DwarfFde* fde, dwarf_loc_regs_t* loc_regs) override;
-
-  bool Log(uint8_t indent, uint64_t pc, const DwarfFde* fde) override;
-
- protected:
-  bool GetNextCieOrFde(const DwarfFde** fde_entry);
-
-  bool FillInCieHeader(DwarfCie* cie);
-
-  bool FillInCie(DwarfCie* cie);
-
-  bool FillInFdeHeader(DwarfFde* fde);
-
-  bool FillInFde(DwarfFde* fde);
-
-  bool EvalExpression(const DwarfLocation& loc, Memory* regular_memory, AddressType* value,
-                      RegsInfo<AddressType>* regs_info, bool* is_dex_pc);
-
-  void InsertFde(const DwarfFde* fde);
-
-  int64_t section_bias_ = 0;
-  uint64_t entries_offset_ = 0;
-  uint64_t entries_end_ = 0;
-  uint64_t next_entries_offset_ = 0;
-  uint64_t pc_offset_ = 0;
-
-  std::map<uint64_t, std::pair<uint64_t, const DwarfFde*>> fdes_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_SECTION_H
diff --git a/libunwindstack/include/unwindstack/DwarfStructs.h b/libunwindstack/include/unwindstack/DwarfStructs.h
deleted file mode 100644
index 4b481f0..0000000
--- a/libunwindstack/include/unwindstack/DwarfStructs.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DWARF_STRUCTS_H
-#define _LIBUNWINDSTACK_DWARF_STRUCTS_H
-
-#include <stdint.h>
-
-#include <vector>
-
-namespace unwindstack {
-
-struct DwarfCie {
-  uint8_t version = 0;
-  uint8_t fde_address_encoding = 0;
-  uint8_t lsda_encoding = 0;
-  uint8_t segment_size = 0;
-  std::vector<char> augmentation_string;
-  uint64_t personality_handler = 0;
-  uint64_t cfa_instructions_offset = 0;
-  uint64_t cfa_instructions_end = 0;
-  uint64_t code_alignment_factor = 0;
-  int64_t data_alignment_factor = 0;
-  uint64_t return_address_register = 0;
-};
-
-struct DwarfFde {
-  uint64_t cie_offset = 0;
-  uint64_t cfa_instructions_offset = 0;
-  uint64_t cfa_instructions_end = 0;
-  uint64_t pc_start = 0;
-  uint64_t pc_end = 0;
-  uint64_t lsda_address = 0;
-  const DwarfCie* cie = nullptr;
-};
-
-constexpr uint16_t CFA_REG = static_cast<uint16_t>(-1);
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DWARF_STRUCTS_H
diff --git a/libunwindstack/include/unwindstack/Elf.h b/libunwindstack/include/unwindstack/Elf.h
deleted file mode 100644
index 472ed92..0000000
--- a/libunwindstack/include/unwindstack/Elf.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_ELF_H
-#define _LIBUNWINDSTACK_ELF_H
-
-#include <stddef.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <unordered_map>
-#include <utility>
-
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Memory.h>
-
-#if !defined(EM_AARCH64)
-#define EM_AARCH64 183
-#endif
-
-namespace unwindstack {
-
-// Forward declaration.
-struct MapInfo;
-class Regs;
-
-enum ArchEnum : uint8_t {
-  ARCH_UNKNOWN = 0,
-  ARCH_ARM,
-  ARCH_ARM64,
-  ARCH_X86,
-  ARCH_X86_64,
-  ARCH_MIPS,
-  ARCH_MIPS64,
-};
-
-class Elf {
- public:
-  Elf(Memory* memory) : memory_(memory) {}
-  virtual ~Elf() = default;
-
-  bool Init();
-
-  void InitGnuDebugdata();
-
-  void Invalidate();
-
-  std::string GetSoname();
-
-  bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset);
-
-  bool GetGlobalVariableOffset(const std::string& name, uint64_t* memory_offset);
-
-  uint64_t GetRelPc(uint64_t pc, const MapInfo* map_info);
-
-  bool StepIfSignalHandler(uint64_t rel_pc, Regs* regs, Memory* process_memory);
-
-  bool Step(uint64_t rel_pc, Regs* regs, Memory* process_memory, bool* finished);
-
-  ElfInterface* CreateInterfaceFromMemory(Memory* memory);
-
-  std::string GetBuildID();
-
-  int64_t GetLoadBias() { return load_bias_; }
-
-  bool IsValidPc(uint64_t pc);
-
-  void GetLastError(ErrorData* data);
-  ErrorCode GetLastErrorCode();
-  uint64_t GetLastErrorAddress();
-
-  bool valid() { return valid_; }
-
-  uint32_t machine_type() { return machine_type_; }
-
-  uint8_t class_type() { return class_type_; }
-
-  ArchEnum arch() { return arch_; }
-
-  Memory* memory() { return memory_.get(); }
-
-  ElfInterface* interface() { return interface_.get(); }
-
-  ElfInterface* gnu_debugdata_interface() { return gnu_debugdata_interface_.get(); }
-
-  static bool IsValidElf(Memory* memory);
-
-  static bool GetInfo(Memory* memory, uint64_t* size);
-
-  static int64_t GetLoadBias(Memory* memory);
-
-  static std::string GetBuildID(Memory* memory);
-
-  static void SetCachingEnabled(bool enable);
-  static bool CachingEnabled() { return cache_enabled_; }
-
-  static void CacheLock();
-  static void CacheUnlock();
-  static void CacheAdd(MapInfo* info);
-  static bool CacheGet(MapInfo* info);
-  static bool CacheAfterCreateMemory(MapInfo* info);
-
- protected:
-  bool valid_ = false;
-  int64_t load_bias_ = 0;
-  std::unique_ptr<ElfInterface> interface_;
-  std::unique_ptr<Memory> memory_;
-  uint32_t machine_type_;
-  uint8_t class_type_;
-  ArchEnum arch_;
-  // Protect calls that can modify internal state of the interface object.
-  std::mutex lock_;
-
-  std::unique_ptr<Memory> gnu_debugdata_memory_;
-  std::unique_ptr<ElfInterface> gnu_debugdata_interface_;
-
-  static bool cache_enabled_;
-  static std::unordered_map<std::string, std::pair<std::shared_ptr<Elf>, bool>>* cache_;
-  static std::mutex* cache_lock_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_ELF_H
diff --git a/libunwindstack/include/unwindstack/ElfInterface.h b/libunwindstack/include/unwindstack/ElfInterface.h
deleted file mode 100644
index 0c39b23..0000000
--- a/libunwindstack/include/unwindstack/ElfInterface.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_ELF_INTERFACE_H
-#define _LIBUNWINDSTACK_ELF_INTERFACE_H
-
-#include <elf.h>
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/Error.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-class Regs;
-class Symbols;
-
-struct LoadInfo {
-  uint64_t offset;
-  uint64_t table_offset;
-  size_t table_size;
-};
-
-enum : uint8_t {
-  SONAME_UNKNOWN = 0,
-  SONAME_VALID,
-  SONAME_INVALID,
-};
-
-class ElfInterface {
- public:
-  ElfInterface(Memory* memory) : memory_(memory) {}
-  virtual ~ElfInterface();
-
-  virtual bool Init(int64_t* load_bias) = 0;
-
-  virtual void InitHeaders() = 0;
-
-  virtual std::string GetSoname() = 0;
-
-  virtual bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* offset) = 0;
-
-  virtual bool GetGlobalVariable(const std::string& name, uint64_t* memory_address) = 0;
-
-  virtual std::string GetBuildID() = 0;
-
-  virtual bool Step(uint64_t rel_pc, Regs* regs, Memory* process_memory, bool* finished);
-
-  virtual bool IsValidPc(uint64_t pc);
-
-  Memory* CreateGnuDebugdataMemory();
-
-  Memory* memory() { return memory_; }
-
-  const std::unordered_map<uint64_t, LoadInfo>& pt_loads() { return pt_loads_; }
-
-  void SetGnuDebugdataInterface(ElfInterface* interface) { gnu_debugdata_interface_ = interface; }
-
-  uint64_t dynamic_offset() { return dynamic_offset_; }
-  uint64_t dynamic_vaddr_start() { return dynamic_vaddr_start_; }
-  uint64_t dynamic_vaddr_end() { return dynamic_vaddr_end_; }
-  uint64_t data_offset() { return data_offset_; }
-  uint64_t data_vaddr_start() { return data_vaddr_start_; }
-  uint64_t data_vaddr_end() { return data_vaddr_end_; }
-  uint64_t eh_frame_hdr_offset() { return eh_frame_hdr_offset_; }
-  int64_t eh_frame_hdr_section_bias() { return eh_frame_hdr_section_bias_; }
-  uint64_t eh_frame_hdr_size() { return eh_frame_hdr_size_; }
-  uint64_t eh_frame_offset() { return eh_frame_offset_; }
-  int64_t eh_frame_section_bias() { return eh_frame_section_bias_; }
-  uint64_t eh_frame_size() { return eh_frame_size_; }
-  uint64_t debug_frame_offset() { return debug_frame_offset_; }
-  int64_t debug_frame_section_bias() { return debug_frame_section_bias_; }
-  uint64_t debug_frame_size() { return debug_frame_size_; }
-  uint64_t gnu_debugdata_offset() { return gnu_debugdata_offset_; }
-  uint64_t gnu_debugdata_size() { return gnu_debugdata_size_; }
-  uint64_t gnu_build_id_offset() { return gnu_build_id_offset_; }
-  uint64_t gnu_build_id_size() { return gnu_build_id_size_; }
-
-  DwarfSection* eh_frame() { return eh_frame_.get(); }
-  DwarfSection* debug_frame() { return debug_frame_.get(); }
-
-  const ErrorData& last_error() { return last_error_; }
-  ErrorCode LastErrorCode() { return last_error_.code; }
-  uint64_t LastErrorAddress() { return last_error_.address; }
-
-  template <typename EhdrType, typename PhdrType>
-  static int64_t GetLoadBias(Memory* memory);
-
-  template <typename EhdrType, typename ShdrType, typename NhdrType>
-  static std::string ReadBuildIDFromMemory(Memory* memory);
-
- protected:
-  template <typename AddressType>
-  void InitHeadersWithTemplate();
-
-  template <typename EhdrType, typename PhdrType, typename ShdrType>
-  bool ReadAllHeaders(int64_t* load_bias);
-
-  template <typename EhdrType, typename PhdrType>
-  void ReadProgramHeaders(const EhdrType& ehdr, int64_t* load_bias);
-
-  template <typename EhdrType, typename ShdrType>
-  void ReadSectionHeaders(const EhdrType& ehdr);
-
-  template <typename DynType>
-  std::string GetSonameWithTemplate();
-
-  template <typename SymType>
-  bool GetFunctionNameWithTemplate(uint64_t addr, std::string* name, uint64_t* func_offset);
-
-  template <typename SymType>
-  bool GetGlobalVariableWithTemplate(const std::string& name, uint64_t* memory_address);
-
-  virtual void HandleUnknownType(uint32_t, uint64_t, uint64_t) {}
-
-  template <typename EhdrType>
-  static void GetMaxSizeWithTemplate(Memory* memory, uint64_t* size);
-
-  template <typename NhdrType>
-  std::string ReadBuildID();
-
-  Memory* memory_;
-  std::unordered_map<uint64_t, LoadInfo> pt_loads_;
-
-  // Stored elf data.
-  uint64_t dynamic_offset_ = 0;
-  uint64_t dynamic_vaddr_start_ = 0;
-  uint64_t dynamic_vaddr_end_ = 0;
-
-  uint64_t data_offset_ = 0;
-  uint64_t data_vaddr_start_ = 0;
-  uint64_t data_vaddr_end_ = 0;
-
-  uint64_t eh_frame_hdr_offset_ = 0;
-  int64_t eh_frame_hdr_section_bias_ = 0;
-  uint64_t eh_frame_hdr_size_ = 0;
-
-  uint64_t eh_frame_offset_ = 0;
-  int64_t eh_frame_section_bias_ = 0;
-  uint64_t eh_frame_size_ = 0;
-
-  uint64_t debug_frame_offset_ = 0;
-  int64_t debug_frame_section_bias_ = 0;
-  uint64_t debug_frame_size_ = 0;
-
-  uint64_t gnu_debugdata_offset_ = 0;
-  uint64_t gnu_debugdata_size_ = 0;
-
-  uint64_t gnu_build_id_offset_ = 0;
-  uint64_t gnu_build_id_size_ = 0;
-
-  uint8_t soname_type_ = SONAME_UNKNOWN;
-  std::string soname_;
-
-  ErrorData last_error_{ERROR_NONE, 0};
-
-  std::unique_ptr<DwarfSection> eh_frame_;
-  std::unique_ptr<DwarfSection> debug_frame_;
-  // The Elf object owns the gnu_debugdata interface object.
-  ElfInterface* gnu_debugdata_interface_ = nullptr;
-
-  std::vector<Symbols*> symbols_;
-  std::vector<std::pair<uint64_t, uint64_t>> strtabs_;
-};
-
-class ElfInterface32 : public ElfInterface {
- public:
-  ElfInterface32(Memory* memory) : ElfInterface(memory) {}
-  virtual ~ElfInterface32() = default;
-
-  bool Init(int64_t* load_bias) override {
-    return ElfInterface::ReadAllHeaders<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr>(load_bias);
-  }
-
-  void InitHeaders() override { ElfInterface::InitHeadersWithTemplate<uint32_t>(); }
-
-  std::string GetSoname() override { return ElfInterface::GetSonameWithTemplate<Elf32_Dyn>(); }
-
-  bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset) override {
-    return ElfInterface::GetFunctionNameWithTemplate<Elf32_Sym>(addr, name, func_offset);
-  }
-
-  bool GetGlobalVariable(const std::string& name, uint64_t* memory_address) override {
-    return ElfInterface::GetGlobalVariableWithTemplate<Elf32_Sym>(name, memory_address);
-  }
-
-  std::string GetBuildID() override { return ElfInterface::ReadBuildID<Elf32_Nhdr>(); }
-
-  static void GetMaxSize(Memory* memory, uint64_t* size) {
-    GetMaxSizeWithTemplate<Elf32_Ehdr>(memory, size);
-  }
-};
-
-class ElfInterface64 : public ElfInterface {
- public:
-  ElfInterface64(Memory* memory) : ElfInterface(memory) {}
-  virtual ~ElfInterface64() = default;
-
-  bool Init(int64_t* load_bias) override {
-    return ElfInterface::ReadAllHeaders<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr>(load_bias);
-  }
-
-  void InitHeaders() override { ElfInterface::InitHeadersWithTemplate<uint64_t>(); }
-
-  std::string GetSoname() override { return ElfInterface::GetSonameWithTemplate<Elf64_Dyn>(); }
-
-  bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset) override {
-    return ElfInterface::GetFunctionNameWithTemplate<Elf64_Sym>(addr, name, func_offset);
-  }
-
-  bool GetGlobalVariable(const std::string& name, uint64_t* memory_address) override {
-    return ElfInterface::GetGlobalVariableWithTemplate<Elf64_Sym>(name, memory_address);
-  }
-
-  std::string GetBuildID() override { return ElfInterface::ReadBuildID<Elf64_Nhdr>(); }
-
-  static void GetMaxSize(Memory* memory, uint64_t* size) {
-    GetMaxSizeWithTemplate<Elf64_Ehdr>(memory, size);
-  }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_ELF_INTERFACE_H
diff --git a/libunwindstack/include/unwindstack/Error.h b/libunwindstack/include/unwindstack/Error.h
deleted file mode 100644
index 72ec454..0000000
--- a/libunwindstack/include/unwindstack/Error.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_ERROR_H
-#define _LIBUNWINDSTACK_ERROR_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum ErrorCode : uint8_t {
-  ERROR_NONE,                 // No error.
-  ERROR_MEMORY_INVALID,       // Memory read failed.
-  ERROR_UNWIND_INFO,          // Unable to use unwind information to unwind.
-  ERROR_UNSUPPORTED,          // Encountered unsupported feature.
-  ERROR_INVALID_MAP,          // Unwind in an invalid map.
-  ERROR_MAX_FRAMES_EXCEEDED,  // The number of frames exceed the total allowed.
-  ERROR_REPEATED_FRAME,       // The last frame has the same pc/sp as the next.
-  ERROR_INVALID_ELF,          // Unwind in an invalid elf.
-};
-
-struct ErrorData {
-  ErrorCode code;
-  uint64_t address;  // Only valid when code is ERROR_MEMORY_INVALID.
-                     // Indicates the failing address.
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_ERROR_H
diff --git a/libunwindstack/include/unwindstack/Global.h b/libunwindstack/include/unwindstack/Global.h
deleted file mode 100644
index b9bb141..0000000
--- a/libunwindstack/include/unwindstack/Global.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_GLOBAL_H
-#define _LIBUNWINDSTACK_GLOBAL_H
-
-#include <stdint.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Maps;
-struct MapInfo;
-
-class Global {
- public:
-  explicit Global(std::shared_ptr<Memory>& memory);
-  Global(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs);
-  virtual ~Global() = default;
-
-  void SetArch(ArchEnum arch);
-
-  ArchEnum arch() { return arch_; }
-
- protected:
-  bool Searchable(const std::string& name);
-  void FindAndReadVariable(Maps* maps, const char* variable);
-
-  virtual bool ReadVariableData(uint64_t offset) = 0;
-
-  virtual void ProcessArch() = 0;
-
-  ArchEnum arch_ = ARCH_UNKNOWN;
-
-  std::shared_ptr<Memory> memory_;
-  std::vector<std::string> search_libs_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_GLOBAL_H
diff --git a/libunwindstack/include/unwindstack/JitDebug.h b/libunwindstack/include/unwindstack/JitDebug.h
deleted file mode 100644
index 8b7b4b5..0000000
--- a/libunwindstack/include/unwindstack/JitDebug.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_JIT_DEBUG_H
-#define _LIBUNWINDSTACK_JIT_DEBUG_H
-
-#include <stdint.h>
-
-#include <memory>
-#include <mutex>
-#include <string>
-#include <vector>
-
-#include <unwindstack/Global.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Elf;
-class Maps;
-enum ArchEnum : uint8_t;
-
-class JitDebug : public Global {
- public:
-  explicit JitDebug(std::shared_ptr<Memory>& memory);
-  JitDebug(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs);
-  virtual ~JitDebug();
-
-  Elf* GetElf(Maps* maps, uint64_t pc);
-
- private:
-  void Init(Maps* maps);
-
-  uint64_t (JitDebug::*read_descriptor_func_)(uint64_t) = nullptr;
-  uint64_t (JitDebug::*read_entry_func_)(uint64_t*, uint64_t*) = nullptr;
-
-  uint64_t ReadDescriptor32(uint64_t);
-  uint64_t ReadDescriptor64(uint64_t);
-
-  uint64_t ReadEntry32Pack(uint64_t* start, uint64_t* size);
-  uint64_t ReadEntry32Pad(uint64_t* start, uint64_t* size);
-  uint64_t ReadEntry64(uint64_t* start, uint64_t* size);
-
-  bool ReadVariableData(uint64_t ptr_offset) override;
-
-  void ProcessArch() override;
-
-  uint64_t entry_addr_ = 0;
-  bool initialized_ = false;
-  std::vector<Elf*> elf_list_;
-
-  std::mutex lock_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_JIT_DEBUG_H
diff --git a/libunwindstack/include/unwindstack/LocalUnwinder.h b/libunwindstack/include/unwindstack/LocalUnwinder.h
deleted file mode 100644
index 80bb53e..0000000
--- a/libunwindstack/include/unwindstack/LocalUnwinder.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_LOCAL_UNWINDER_H
-#define _LIBUNWINDSTACK_LOCAL_UNWINDER_H
-
-#include <pthread.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <unwindstack/Error.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Elf;
-struct MapInfo;
-
-struct LocalFrameData {
-  LocalFrameData(MapInfo* map_info, uint64_t pc, uint64_t rel_pc, const std::string& function_name,
-                 uint64_t function_offset)
-      : map_info(map_info),
-        pc(pc),
-        rel_pc(rel_pc),
-        function_name(function_name),
-        function_offset(function_offset) {}
-
-  MapInfo* map_info;
-  uint64_t pc;
-  uint64_t rel_pc;
-  std::string function_name;
-  uint64_t function_offset;
-};
-
-// This is a specialized class that should only be used for doing local unwinds.
-// The Unwind call can be made as multiple times on the same object, and it can
-// be called by multiple threads at the same time.
-// It is designed to be used in debugging circumstances to get a stack trace
-// as fast as possible.
-class LocalUnwinder {
- public:
-  LocalUnwinder() = default;
-  LocalUnwinder(const std::vector<std::string>& skip_libraries) : skip_libraries_(skip_libraries) {}
-  ~LocalUnwinder() = default;
-
-  bool Init();
-
-  bool Unwind(std::vector<LocalFrameData>* frame_info, size_t max_frames);
-
-  bool ShouldSkipLibrary(const std::string& map_name);
-
-  MapInfo* GetMapInfo(uint64_t pc);
-
-  ErrorCode LastErrorCode() { return last_error_.code; }
-  uint64_t LastErrorAddress() { return last_error_.address; }
-
- private:
-  pthread_rwlock_t maps_rwlock_;
-  std::unique_ptr<LocalUpdatableMaps> maps_ = nullptr;
-  std::shared_ptr<Memory> process_memory_;
-  std::vector<std::string> skip_libraries_;
-  ErrorData last_error_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_LOCAL_UNWINDER_H
diff --git a/libunwindstack/include/unwindstack/Log.h b/libunwindstack/include/unwindstack/Log.h
deleted file mode 100644
index aa1219c..0000000
--- a/libunwindstack/include/unwindstack/Log.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_LOG_H
-#define _LIBUNWINDSTACK_LOG_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-void log_to_stdout(bool enable);
-void log(uint8_t indent, const char* format, ...);
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_LOG_H
diff --git a/libunwindstack/include/unwindstack/MachineArm.h b/libunwindstack/include/unwindstack/MachineArm.h
deleted file mode 100644
index 3f902b1..0000000
--- a/libunwindstack/include/unwindstack/MachineArm.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MACHINE_ARM_H
-#define _LIBUNWINDSTACK_MACHINE_ARM_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum ArmReg : uint16_t {
-  ARM_REG_R0 = 0,
-  ARM_REG_R1,
-  ARM_REG_R2,
-  ARM_REG_R3,
-  ARM_REG_R4,
-  ARM_REG_R5,
-  ARM_REG_R6,
-  ARM_REG_R7,
-  ARM_REG_R8,
-  ARM_REG_R9,
-  ARM_REG_R10,
-  ARM_REG_R11,
-  ARM_REG_R12,
-  ARM_REG_R13,
-  ARM_REG_R14,
-  ARM_REG_R15,
-  ARM_REG_LAST,
-
-  ARM_REG_SP = ARM_REG_R13,
-  ARM_REG_LR = ARM_REG_R14,
-  ARM_REG_PC = ARM_REG_R15,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MACHINE_ARM_H
diff --git a/libunwindstack/include/unwindstack/MachineArm64.h b/libunwindstack/include/unwindstack/MachineArm64.h
deleted file mode 100644
index e953335..0000000
--- a/libunwindstack/include/unwindstack/MachineArm64.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MACHINE_ARM64_H
-#define _LIBUNWINDSTACK_MACHINE_ARM64_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum Arm64Reg : uint16_t {
-  ARM64_REG_R0 = 0,
-  ARM64_REG_R1,
-  ARM64_REG_R2,
-  ARM64_REG_R3,
-  ARM64_REG_R4,
-  ARM64_REG_R5,
-  ARM64_REG_R6,
-  ARM64_REG_R7,
-  ARM64_REG_R8,
-  ARM64_REG_R9,
-  ARM64_REG_R10,
-  ARM64_REG_R11,
-  ARM64_REG_R12,
-  ARM64_REG_R13,
-  ARM64_REG_R14,
-  ARM64_REG_R15,
-  ARM64_REG_R16,
-  ARM64_REG_R17,
-  ARM64_REG_R18,
-  ARM64_REG_R19,
-  ARM64_REG_R20,
-  ARM64_REG_R21,
-  ARM64_REG_R22,
-  ARM64_REG_R23,
-  ARM64_REG_R24,
-  ARM64_REG_R25,
-  ARM64_REG_R26,
-  ARM64_REG_R27,
-  ARM64_REG_R28,
-  ARM64_REG_R29,
-  ARM64_REG_R30,
-  ARM64_REG_R31,
-  ARM64_REG_PC,
-  ARM64_REG_PSTATE,
-  ARM64_REG_LAST,
-
-  ARM64_REG_SP = ARM64_REG_R31,
-  ARM64_REG_LR = ARM64_REG_R30,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MACHINE_ARM64_H
diff --git a/libunwindstack/include/unwindstack/MachineMips.h b/libunwindstack/include/unwindstack/MachineMips.h
deleted file mode 100644
index 2dfb1e9..0000000
--- a/libunwindstack/include/unwindstack/MachineMips.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MACHINE_MIPS_H
-#define _LIBUNWINDSTACK_MACHINE_MIPS_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum MipsReg : uint16_t {
-  MIPS_REG_R0 = 0,
-  MIPS_REG_R1,
-  MIPS_REG_R2,
-  MIPS_REG_R3,
-  MIPS_REG_R4,
-  MIPS_REG_R5,
-  MIPS_REG_R6,
-  MIPS_REG_R7,
-  MIPS_REG_R8,
-  MIPS_REG_R9,
-  MIPS_REG_R10,
-  MIPS_REG_R11,
-  MIPS_REG_R12,
-  MIPS_REG_R13,
-  MIPS_REG_R14,
-  MIPS_REG_R15,
-  MIPS_REG_R16,
-  MIPS_REG_R17,
-  MIPS_REG_R18,
-  MIPS_REG_R19,
-  MIPS_REG_R20,
-  MIPS_REG_R21,
-  MIPS_REG_R22,
-  MIPS_REG_R23,
-  MIPS_REG_R24,
-  MIPS_REG_R25,
-  MIPS_REG_R26,
-  MIPS_REG_R27,
-  MIPS_REG_R28,
-  MIPS_REG_R29,
-  MIPS_REG_R30,
-  MIPS_REG_R31,
-  MIPS_REG_PC,
-  MIPS_REG_LAST,
-
-  MIPS_REG_SP = MIPS_REG_R29,
-  MIPS_REG_RA = MIPS_REG_R31,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MACHINE_MIPS_H
\ No newline at end of file
diff --git a/libunwindstack/include/unwindstack/MachineMips64.h b/libunwindstack/include/unwindstack/MachineMips64.h
deleted file mode 100644
index 34addf2..0000000
--- a/libunwindstack/include/unwindstack/MachineMips64.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MACHINE_MIPS64_H
-#define _LIBUNWINDSTACK_MACHINE_MIPS64_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-enum Mips64Reg : uint16_t {
-  MIPS64_REG_R0 = 0,
-  MIPS64_REG_R1,
-  MIPS64_REG_R2,
-  MIPS64_REG_R3,
-  MIPS64_REG_R4,
-  MIPS64_REG_R5,
-  MIPS64_REG_R6,
-  MIPS64_REG_R7,
-  MIPS64_REG_R8,
-  MIPS64_REG_R9,
-  MIPS64_REG_R10,
-  MIPS64_REG_R11,
-  MIPS64_REG_R12,
-  MIPS64_REG_R13,
-  MIPS64_REG_R14,
-  MIPS64_REG_R15,
-  MIPS64_REG_R16,
-  MIPS64_REG_R17,
-  MIPS64_REG_R18,
-  MIPS64_REG_R19,
-  MIPS64_REG_R20,
-  MIPS64_REG_R21,
-  MIPS64_REG_R22,
-  MIPS64_REG_R23,
-  MIPS64_REG_R24,
-  MIPS64_REG_R25,
-  MIPS64_REG_R26,
-  MIPS64_REG_R27,
-  MIPS64_REG_R28,
-  MIPS64_REG_R29,
-  MIPS64_REG_R30,
-  MIPS64_REG_R31,
-  MIPS64_REG_PC,
-  MIPS64_REG_LAST,
-
-  MIPS64_REG_SP = MIPS64_REG_R29,
-  MIPS64_REG_RA = MIPS64_REG_R31,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MACHINE_MIPS64_H
\ No newline at end of file
diff --git a/libunwindstack/include/unwindstack/MachineX86.h b/libunwindstack/include/unwindstack/MachineX86.h
deleted file mode 100644
index 02adb98..0000000
--- a/libunwindstack/include/unwindstack/MachineX86.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MACHINE_X86_H
-#define _LIBUNWINDSTACK_MACHINE_X86_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-// Matches the numbers for the registers as generated by compilers.
-// If this is changed, then unwinding will fail.
-enum X86Reg : uint16_t {
-  X86_REG_EAX = 0,
-  X86_REG_ECX = 1,
-  X86_REG_EDX = 2,
-  X86_REG_EBX = 3,
-  X86_REG_ESP = 4,
-  X86_REG_EBP = 5,
-  X86_REG_ESI = 6,
-  X86_REG_EDI = 7,
-  X86_REG_EIP = 8,
-  X86_REG_EFL = 9,
-  X86_REG_CS = 10,
-  X86_REG_SS = 11,
-  X86_REG_DS = 12,
-  X86_REG_ES = 13,
-  X86_REG_FS = 14,
-  X86_REG_GS = 15,
-  X86_REG_LAST,
-
-  X86_REG_SP = X86_REG_ESP,
-  X86_REG_PC = X86_REG_EIP,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MACHINE_X86_H
diff --git a/libunwindstack/include/unwindstack/MachineX86_64.h b/libunwindstack/include/unwindstack/MachineX86_64.h
deleted file mode 100644
index af33fea..0000000
--- a/libunwindstack/include/unwindstack/MachineX86_64.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MACHINE_X86_64_H
-#define _LIBUNWINDSTACK_MACHINE_X86_64_H
-
-#include <stdint.h>
-
-namespace unwindstack {
-
-// Matches the numbers for the registers as generated by compilers.
-// If this is changed, then unwinding will fail.
-enum X86_64Reg : uint16_t {
-  X86_64_REG_RAX = 0,
-  X86_64_REG_RDX = 1,
-  X86_64_REG_RCX = 2,
-  X86_64_REG_RBX = 3,
-  X86_64_REG_RSI = 4,
-  X86_64_REG_RDI = 5,
-  X86_64_REG_RBP = 6,
-  X86_64_REG_RSP = 7,
-  X86_64_REG_R8 = 8,
-  X86_64_REG_R9 = 9,
-  X86_64_REG_R10 = 10,
-  X86_64_REG_R11 = 11,
-  X86_64_REG_R12 = 12,
-  X86_64_REG_R13 = 13,
-  X86_64_REG_R14 = 14,
-  X86_64_REG_R15 = 15,
-  X86_64_REG_RIP = 16,
-  X86_64_REG_LAST,
-
-  X86_64_REG_SP = X86_64_REG_RSP,
-  X86_64_REG_PC = X86_64_REG_RIP,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MACHINE_X86_64_H
diff --git a/libunwindstack/include/unwindstack/MapInfo.h b/libunwindstack/include/unwindstack/MapInfo.h
deleted file mode 100644
index 052e79f..0000000
--- a/libunwindstack/include/unwindstack/MapInfo.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MAP_INFO_H
-#define _LIBUNWINDSTACK_MAP_INFO_H
-
-#include <stdint.h>
-
-#include <atomic>
-#include <memory>
-#include <mutex>
-#include <string>
-
-#include <unwindstack/Elf.h>
-
-namespace unwindstack {
-
-class MemoryFileAtOffset;
-
-struct MapInfo {
-  MapInfo(MapInfo* prev_map, MapInfo* prev_real_map, uint64_t start, uint64_t end, uint64_t offset,
-          uint64_t flags, const char* name)
-      : start(start),
-        end(end),
-        offset(offset),
-        flags(flags),
-        name(name),
-        prev_map(prev_map),
-        prev_real_map(prev_real_map),
-        load_bias(INT64_MAX),
-        build_id(0) {}
-  MapInfo(MapInfo* prev_map, MapInfo* prev_real_map, uint64_t start, uint64_t end, uint64_t offset,
-          uint64_t flags, const std::string& name)
-      : start(start),
-        end(end),
-        offset(offset),
-        flags(flags),
-        name(name),
-        prev_map(prev_map),
-        prev_real_map(prev_real_map),
-        load_bias(INT64_MAX),
-        build_id(0) {}
-  ~MapInfo();
-
-  uint64_t start = 0;
-  uint64_t end = 0;
-  uint64_t offset = 0;
-  uint16_t flags = 0;
-  std::string name;
-  std::shared_ptr<Elf> elf;
-  // The offset of the beginning of this mapping to the beginning of the
-  // ELF file.
-  // elf_offset == offset - elf_start_offset.
-  // This value is only non-zero if the offset is non-zero but there is
-  // no elf signature found at that offset.
-  uint64_t elf_offset = 0;
-  // This value is the offset into the file of the map in memory that is the
-  // start of the elf. This is not equal to offset when the linker splits
-  // shared libraries into a read-only and read-execute map.
-  uint64_t elf_start_offset = 0;
-
-  MapInfo* prev_map = nullptr;
-  // This is the previous map that is not empty with a 0 offset. For
-  // example, this set of maps:
-  //  1000-2000  r--p 000000 00:00 0 libc.so
-  //  2000-3000  ---p 000000 00:00 0 libc.so
-  //  3000-4000  r-xp 003000 00:00 0 libc.so
-  // The last map's prev_map would point to the 2000-3000 map, while the
-  // prev_real_map would point to the 1000-2000 map.
-  MapInfo* prev_real_map = nullptr;
-
-  std::atomic_int64_t load_bias;
-
-  // This is a pointer to a new'd std::string.
-  // Using an atomic value means that we don't need to lock and will
-  // make it easier to move to a fine grained lock in the future.
-  std::atomic_uintptr_t build_id;
-
-  // Set to true if the elf file data is coming from memory.
-  bool memory_backed_elf = false;
-
-  // This function guarantees it will never return nullptr.
-  Elf* GetElf(const std::shared_ptr<Memory>& process_memory, ArchEnum expected_arch);
-
-  uint64_t GetLoadBias(const std::shared_ptr<Memory>& process_memory);
-
-  Memory* CreateMemory(const std::shared_ptr<Memory>& process_memory);
-
-  bool GetFunctionName(uint64_t addr, std::string* name, uint64_t* func_offset);
-
-  // Returns the raw build id read from the elf data.
-  std::string GetBuildID();
-
-  // Returns the printable version of the build id (hex dump of raw data).
-  std::string GetPrintableBuildID();
-
-  inline bool IsBlank() { return offset == 0 && flags == 0 && name.empty(); }
-
- private:
-  MapInfo(const MapInfo&) = delete;
-  void operator=(const MapInfo&) = delete;
-
-  Memory* GetFileMemory();
-  bool InitFileMemoryFromPreviousReadOnlyMap(MemoryFileAtOffset* memory);
-
-  // Protect the creation of the elf object.
-  std::mutex mutex_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MAP_INFO_H
diff --git a/libunwindstack/include/unwindstack/Maps.h b/libunwindstack/include/unwindstack/Maps.h
deleted file mode 100644
index e53f367..0000000
--- a/libunwindstack/include/unwindstack/Maps.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MAPS_H
-#define _LIBUNWINDSTACK_MAPS_H
-
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <unwindstack/MapInfo.h>
-
-namespace unwindstack {
-
-// Special flag to indicate a map is in /dev/. However, a map in
-// /dev/ashmem/... does not set this flag.
-static constexpr int MAPS_FLAGS_DEVICE_MAP = 0x8000;
-// Special flag to indicate that this map represents an elf file
-// created by ART for use with the gdb jit debug interface.
-// This should only ever appear in offline maps data.
-static constexpr int MAPS_FLAGS_JIT_SYMFILE_MAP = 0x4000;
-
-class Maps {
- public:
-  virtual ~Maps() = default;
-
-  Maps() = default;
-
-  // Maps are not copyable but movable, because they own pointers to MapInfo
-  // objects.
-  Maps(const Maps&) = delete;
-  Maps& operator=(const Maps&) = delete;
-  Maps(Maps&&) = default;
-  Maps& operator=(Maps&&) = default;
-
-  MapInfo* Find(uint64_t pc);
-
-  virtual bool Parse();
-
-  virtual const std::string GetMapsFile() const { return ""; }
-
-  void Add(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags, const std::string& name,
-           uint64_t load_bias);
-
-  void Sort();
-
-  typedef std::vector<std::unique_ptr<MapInfo>>::iterator iterator;
-  iterator begin() { return maps_.begin(); }
-  iterator end() { return maps_.end(); }
-
-  typedef std::vector<std::unique_ptr<MapInfo>>::const_iterator const_iterator;
-  const_iterator begin() const { return maps_.begin(); }
-  const_iterator end() const { return maps_.end(); }
-
-  size_t Total() { return maps_.size(); }
-
-  MapInfo* Get(size_t index) {
-    if (index >= maps_.size()) return nullptr;
-    return maps_[index].get();
-  }
-
- protected:
-  std::vector<std::unique_ptr<MapInfo>> maps_;
-};
-
-class RemoteMaps : public Maps {
- public:
-  RemoteMaps(pid_t pid) : pid_(pid) {}
-  virtual ~RemoteMaps() = default;
-
-  virtual const std::string GetMapsFile() const override;
-
- private:
-  pid_t pid_;
-};
-
-class LocalMaps : public RemoteMaps {
- public:
-  LocalMaps() : RemoteMaps(getpid()) {}
-  virtual ~LocalMaps() = default;
-};
-
-class LocalUpdatableMaps : public Maps {
- public:
-  LocalUpdatableMaps() : Maps() {}
-  virtual ~LocalUpdatableMaps() = default;
-
-  bool Reparse();
-
-  const std::string GetMapsFile() const override;
-
- protected:
-  std::vector<std::unique_ptr<MapInfo>> saved_maps_;
-};
-
-class BufferMaps : public Maps {
- public:
-  BufferMaps(const char* buffer) : buffer_(buffer) {}
-  virtual ~BufferMaps() = default;
-
-  bool Parse() override;
-
- private:
-  const char* buffer_;
-};
-
-class FileMaps : public Maps {
- public:
-  FileMaps(const std::string& file) : file_(file) {}
-  virtual ~FileMaps() = default;
-
-  const std::string GetMapsFile() const override { return file_; }
-
- protected:
-  const std::string file_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MAPS_H
diff --git a/libunwindstack/include/unwindstack/Memory.h b/libunwindstack/include/unwindstack/Memory.h
deleted file mode 100644
index 3106564..0000000
--- a/libunwindstack/include/unwindstack/Memory.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_MEMORY_H
-#define _LIBUNWINDSTACK_MEMORY_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <string>
-
-namespace unwindstack {
-
-class Memory {
- public:
-  Memory() = default;
-  virtual ~Memory() = default;
-
-  static std::shared_ptr<Memory> CreateProcessMemory(pid_t pid);
-  static std::shared_ptr<Memory> CreateProcessMemoryCached(pid_t pid);
-  static std::shared_ptr<Memory> CreateOfflineMemory(const uint8_t* data, uint64_t start,
-                                                     uint64_t end);
-  static std::unique_ptr<Memory> CreateFileMemory(const std::string& path, uint64_t offset);
-
-  virtual bool ReadString(uint64_t addr, std::string* string, uint64_t max_read = UINT64_MAX);
-
-  virtual void Clear() {}
-
-  virtual size_t Read(uint64_t addr, void* dst, size_t size) = 0;
-
-  bool ReadFully(uint64_t addr, void* dst, size_t size);
-
-  inline bool Read32(uint64_t addr, uint32_t* dst) {
-    return ReadFully(addr, dst, sizeof(uint32_t));
-  }
-
-  inline bool Read64(uint64_t addr, uint64_t* dst) {
-    return ReadFully(addr, dst, sizeof(uint64_t));
-  }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_MEMORY_H
diff --git a/libunwindstack/include/unwindstack/Regs.h b/libunwindstack/include/unwindstack/Regs.h
deleted file mode 100644
index 4f761b4..0000000
--- a/libunwindstack/include/unwindstack/Regs.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_H
-#define _LIBUNWINDSTACK_REGS_H
-
-#include <stdint.h>
-#include <unistd.h>
-
-#include <functional>
-#include <string>
-#include <vector>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Elf;
-enum ArchEnum : uint8_t;
-class Memory;
-
-class Regs {
- public:
-  enum LocationEnum : uint8_t {
-    LOCATION_UNKNOWN = 0,
-    LOCATION_REGISTER,
-    LOCATION_SP_OFFSET,
-  };
-
-  struct Location {
-    Location(LocationEnum type, int16_t value) : type(type), value(value) {}
-
-    LocationEnum type;
-    int16_t value;
-  };
-
-  Regs(uint16_t total_regs, const Location& return_loc)
-      : total_regs_(total_regs), return_loc_(return_loc) {}
-  virtual ~Regs() = default;
-
-  virtual ArchEnum Arch() = 0;
-
-  virtual bool Is32Bit() = 0;
-
-  virtual void* RawData() = 0;
-  virtual uint64_t pc() = 0;
-  virtual uint64_t sp() = 0;
-
-  virtual void set_pc(uint64_t pc) = 0;
-  virtual void set_sp(uint64_t sp) = 0;
-
-  uint64_t dex_pc() { return dex_pc_; }
-  void set_dex_pc(uint64_t dex_pc) { dex_pc_ = dex_pc; }
-
-  virtual uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) = 0;
-
-  virtual bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) = 0;
-
-  virtual bool SetPcFromReturnAddress(Memory* process_memory) = 0;
-
-  virtual void IterateRegisters(std::function<void(const char*, uint64_t)>) = 0;
-
-  uint16_t total_regs() { return total_regs_; }
-
-  virtual Regs* Clone() = 0;
-
-  static ArchEnum CurrentArch();
-  static Regs* RemoteGet(pid_t pid);
-  static Regs* CreateFromUcontext(ArchEnum arch, void* ucontext);
-  static Regs* CreateFromLocal();
-
- protected:
-  uint16_t total_regs_;
-  Location return_loc_;
-  uint64_t dex_pc_ = 0;
-};
-
-template <typename AddressType>
-class RegsImpl : public Regs {
- public:
-  RegsImpl(uint16_t total_regs, Location return_loc)
-      : Regs(total_regs, return_loc), regs_(total_regs) {}
-  virtual ~RegsImpl() = default;
-
-  bool Is32Bit() override { return sizeof(AddressType) == sizeof(uint32_t); }
-
-  inline AddressType& operator[](size_t reg) { return regs_[reg]; }
-
-  void* RawData() override { return regs_.data(); }
-
-  virtual void IterateRegisters(std::function<void(const char*, uint64_t)> fn) override {
-    for (size_t i = 0; i < regs_.size(); ++i) {
-      fn(std::to_string(i).c_str(), regs_[i]);
-    }
-  }
-
- protected:
-  std::vector<AddressType> regs_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_H
diff --git a/libunwindstack/include/unwindstack/RegsArm.h b/libunwindstack/include/unwindstack/RegsArm.h
deleted file mode 100644
index aa029be..0000000
--- a/libunwindstack/include/unwindstack/RegsArm.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_ARM_H
-#define _LIBUNWINDSTACK_REGS_ARM_H
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-
-class RegsArm : public RegsImpl<uint32_t> {
- public:
-  RegsArm();
-  virtual ~RegsArm() = default;
-
-  ArchEnum Arch() override final;
-
-  uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override;
-
-  bool SetPcFromReturnAddress(Memory* process_memory) override;
-
-  bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
-
-  uint64_t pc() override;
-  uint64_t sp() override;
-
-  void set_pc(uint64_t pc) override;
-  void set_sp(uint64_t sp) override;
-
-  Regs* Clone() override final;
-
-  static Regs* Read(void* data);
-
-  static Regs* CreateFromUcontext(void* ucontext);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_ARM_H
diff --git a/libunwindstack/include/unwindstack/RegsArm64.h b/libunwindstack/include/unwindstack/RegsArm64.h
deleted file mode 100644
index 5cd7e5b..0000000
--- a/libunwindstack/include/unwindstack/RegsArm64.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_ARM64_H
-#define _LIBUNWINDSTACK_REGS_ARM64_H
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-
-class RegsArm64 : public RegsImpl<uint64_t> {
- public:
-  RegsArm64();
-  virtual ~RegsArm64() = default;
-
-  ArchEnum Arch() override final;
-
-  uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override;
-
-  bool SetPcFromReturnAddress(Memory* process_memory) override;
-
-  bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
-
-  uint64_t pc() override;
-  uint64_t sp() override;
-
-  void set_pc(uint64_t pc) override;
-  void set_sp(uint64_t sp) override;
-
-  Regs* Clone() override final;
-
-  static Regs* Read(void* data);
-
-  static Regs* CreateFromUcontext(void* ucontext);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_ARM64_H
diff --git a/libunwindstack/include/unwindstack/RegsGetLocal.h b/libunwindstack/include/unwindstack/RegsGetLocal.h
deleted file mode 100644
index f0b5e3a..0000000
--- a/libunwindstack/include/unwindstack/RegsGetLocal.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_GET_LOCAL_H
-#define _LIBUNWINDSTACK_REGS_GET_LOCAL_H
-
-namespace unwindstack {
-
-#if defined(__arm__)
-
-inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) {
-  asm volatile(
-      ".align 2\n"
-      "bx pc\n"
-      "nop\n"
-      ".code 32\n"
-      "stmia %[base], {r0-r12}\n"
-      "add %[base], #52\n"
-      "mov r1, r13\n"
-      "mov r2, r14\n"
-      "mov r3, r15\n"
-      "stmia %[base], {r1-r3}\n"
-      "orr %[base], pc, #1\n"
-      "bx %[base]\n"
-      : [base] "+r"(reg_data)
-      :
-      : "memory");
-}
-
-#elif defined(__aarch64__)
-
-inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) {
-  asm volatile(
-      "1:\n"
-      "stp x0, x1, [%[base], #0]\n"
-      "stp x2, x3, [%[base], #16]\n"
-      "stp x4, x5, [%[base], #32]\n"
-      "stp x6, x7, [%[base], #48]\n"
-      "stp x8, x9, [%[base], #64]\n"
-      "stp x10, x11, [%[base], #80]\n"
-      "stp x12, x13, [%[base], #96]\n"
-      "stp x14, x15, [%[base], #112]\n"
-      "stp x16, x17, [%[base], #128]\n"
-      "stp x18, x19, [%[base], #144]\n"
-      "stp x20, x21, [%[base], #160]\n"
-      "stp x22, x23, [%[base], #176]\n"
-      "stp x24, x25, [%[base], #192]\n"
-      "stp x26, x27, [%[base], #208]\n"
-      "stp x28, x29, [%[base], #224]\n"
-      "str x30, [%[base], #240]\n"
-      "mov x12, sp\n"
-      "adr x13, 1b\n"
-      "stp x12, x13, [%[base], #248]\n"
-      : [base] "+r"(reg_data)
-      :
-      : "x12", "x13", "memory");
-}
-
-#elif defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-
-extern "C" void AsmGetRegs(void* regs);
-
-#endif
-
-inline __attribute__((__always_inline__)) void RegsGetLocal(Regs* regs) {
-  AsmGetRegs(regs->RawData());
-}
-
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_GET_LOCAL_H
diff --git a/libunwindstack/include/unwindstack/RegsMips.h b/libunwindstack/include/unwindstack/RegsMips.h
deleted file mode 100644
index 8164a15..0000000
--- a/libunwindstack/include/unwindstack/RegsMips.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_MIPS_H
-#define _LIBUNWINDSTACK_REGS_MIPS_H
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-
-class RegsMips : public RegsImpl<uint32_t> {
- public:
-  RegsMips();
-  virtual ~RegsMips() = default;
-
-  ArchEnum Arch() override final;
-
-  uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override;
-
-  bool SetPcFromReturnAddress(Memory* process_memory) override;
-
-  bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
-
-  uint64_t pc() override;
-  uint64_t sp() override;
-
-  void set_pc(uint64_t pc) override;
-  void set_sp(uint64_t sp) override;
-
-  Regs* Clone() override final;
-
-  static Regs* Read(void* data);
-
-  static Regs* CreateFromUcontext(void* ucontext);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_MIPS_H
diff --git a/libunwindstack/include/unwindstack/RegsMips64.h b/libunwindstack/include/unwindstack/RegsMips64.h
deleted file mode 100644
index c982542..0000000
--- a/libunwindstack/include/unwindstack/RegsMips64.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_MIPS64_H
-#define _LIBUNWINDSTACK_REGS_MIPS64_H
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-
-class RegsMips64 : public RegsImpl<uint64_t> {
- public:
-  RegsMips64();
-  virtual ~RegsMips64() = default;
-
-  ArchEnum Arch() override final;
-
-  uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override;
-
-  bool SetPcFromReturnAddress(Memory* process_memory) override;
-
-  bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
-
-  uint64_t pc() override;
-  uint64_t sp() override;
-
-  void set_pc(uint64_t pc) override;
-  void set_sp(uint64_t sp) override;
-
-  Regs* Clone() override final;
-
-  static Regs* Read(void* data);
-
-  static Regs* CreateFromUcontext(void* ucontext);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_MIPS64_H
diff --git a/libunwindstack/include/unwindstack/RegsX86.h b/libunwindstack/include/unwindstack/RegsX86.h
deleted file mode 100644
index 2323a4f..0000000
--- a/libunwindstack/include/unwindstack/RegsX86.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_X86_H
-#define _LIBUNWINDSTACK_REGS_X86_H
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-struct x86_ucontext_t;
-
-class RegsX86 : public RegsImpl<uint32_t> {
- public:
-  RegsX86();
-  virtual ~RegsX86() = default;
-
-  ArchEnum Arch() override final;
-
-  uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override;
-
-  bool SetPcFromReturnAddress(Memory* process_memory) override;
-
-  bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
-
-  void SetFromUcontext(x86_ucontext_t* ucontext);
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
-
-  uint64_t pc() override;
-  uint64_t sp() override;
-
-  void set_pc(uint64_t pc) override;
-  void set_sp(uint64_t sp) override;
-
-  Regs* Clone() override final;
-
-  static Regs* Read(void* data);
-
-  static Regs* CreateFromUcontext(void* ucontext);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_X86_H
diff --git a/libunwindstack/include/unwindstack/RegsX86_64.h b/libunwindstack/include/unwindstack/RegsX86_64.h
deleted file mode 100644
index 3e919a4..0000000
--- a/libunwindstack/include/unwindstack/RegsX86_64.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_REGS_X86_64_H
-#define _LIBUNWINDSTACK_REGS_X86_64_H
-
-#include <stdint.h>
-
-#include <functional>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Memory;
-struct x86_64_ucontext_t;
-
-class RegsX86_64 : public RegsImpl<uint64_t> {
- public:
-  RegsX86_64();
-  virtual ~RegsX86_64() = default;
-
-  ArchEnum Arch() override final;
-
-  uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override;
-
-  bool SetPcFromReturnAddress(Memory* process_memory) override;
-
-  bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
-
-  void SetFromUcontext(x86_64_ucontext_t* ucontext);
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
-
-  uint64_t pc() override;
-  uint64_t sp() override;
-
-  void set_pc(uint64_t pc) override;
-  void set_sp(uint64_t sp) override;
-
-  Regs* Clone() override final;
-
-  static Regs* Read(void* data);
-
-  static Regs* CreateFromUcontext(void* ucontext);
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_REGS_X86_64_H
diff --git a/libunwindstack/include/unwindstack/UcontextArm.h b/libunwindstack/include/unwindstack/UcontextArm.h
deleted file mode 100644
index 7d1ec3b..0000000
--- a/libunwindstack/include/unwindstack/UcontextArm.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_UCONTEXT_ARM_H
-#define _LIBUNWINDSTACK_UCONTEXT_ARM_H
-
-#include <stdint.h>
-
-#include <unwindstack/MachineArm.h>
-
-namespace unwindstack {
-
-struct arm_stack_t {
-  uint32_t ss_sp;    // void __user*
-  int32_t ss_flags;  // int
-  uint32_t ss_size;  // size_t
-};
-
-struct arm_mcontext_t {
-  uint32_t trap_no;             // unsigned long
-  uint32_t error_code;          // unsigned long
-  uint32_t oldmask;             // unsigned long
-  uint32_t regs[ARM_REG_LAST];  // unsigned long
-  uint32_t cpsr;                // unsigned long
-  uint32_t fault_address;       // unsigned long
-};
-
-struct arm_ucontext_t {
-  uint32_t uc_flags;  // unsigned long
-  uint32_t uc_link;   // struct ucontext*
-  arm_stack_t uc_stack;
-  arm_mcontext_t uc_mcontext;
-  // Nothing else is used, so don't define it.
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UCONTEXT_ARM_H
diff --git a/libunwindstack/include/unwindstack/UcontextArm64.h b/libunwindstack/include/unwindstack/UcontextArm64.h
deleted file mode 100644
index a68be3b..0000000
--- a/libunwindstack/include/unwindstack/UcontextArm64.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_UCONTEXT_ARM64_H
-#define _LIBUNWINDSTACK_UCONTEXT_ARM64_H
-
-#include <stdint.h>
-
-#include <unwindstack/MachineArm64.h>
-
-namespace unwindstack {
-
-struct arm64_stack_t {
-  uint64_t ss_sp;    // void __user*
-  int32_t ss_flags;  // int
-  uint64_t ss_size;  // size_t
-};
-
-struct arm64_sigset_t {
-  uint64_t sig;  // unsigned long
-};
-
-struct arm64_mcontext_t {
-  uint64_t fault_address;         // __u64
-  uint64_t regs[ARM64_REG_LAST];  // __u64
-  uint64_t pstate;                // __u64
-  // Nothing else is used, so don't define it.
-};
-
-struct arm64_ucontext_t {
-  uint64_t uc_flags;  // unsigned long
-  uint64_t uc_link;   // struct ucontext*
-  arm64_stack_t uc_stack;
-  arm64_sigset_t uc_sigmask;
-  // The kernel adds extra padding after uc_sigmask to match glibc sigset_t on ARM64.
-  char __padding[128 - sizeof(arm64_sigset_t)];
-  // The full structure requires 16 byte alignment, but our partial structure
-  // doesn't, so force the alignment.
-  arm64_mcontext_t uc_mcontext __attribute__((aligned(16)));
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UCONTEXT_ARM64_H
diff --git a/libunwindstack/include/unwindstack/UcontextMips.h b/libunwindstack/include/unwindstack/UcontextMips.h
deleted file mode 100644
index 02e33b6..0000000
--- a/libunwindstack/include/unwindstack/UcontextMips.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_UCONTEXT_MIPS_H
-#define _LIBUNWINDSTACK_UCONTEXT_MIPS_H
-
-#include <stdint.h>
-
-#include <unwindstack/MachineMips.h>
-
-namespace unwindstack {
-
-struct mips_stack_t {
-  uint32_t ss_sp;    // void __user*
-  uint32_t ss_size;  // size_t
-  int32_t ss_flags;  // int
-};
-
-struct mips_mcontext_t {
-  uint32_t sc_regmask;
-  uint32_t sc_status;
-  uint64_t sc_pc;
-  uint64_t sc_regs[32];
-  // Nothing else is used, so don't define it.
-};
-
-struct mips_ucontext_t {
-  uint32_t uc_flags;  // unsigned long
-  uint32_t uc_link;   // struct ucontext*
-  mips_stack_t uc_stack;
-  mips_mcontext_t uc_mcontext;
-  // Nothing else is used, so don't define it.
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UCONTEXT_MIPS_H
diff --git a/libunwindstack/include/unwindstack/UcontextMips64.h b/libunwindstack/include/unwindstack/UcontextMips64.h
deleted file mode 100644
index 5b92a55..0000000
--- a/libunwindstack/include/unwindstack/UcontextMips64.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_UCONTEXT_MIPS64_H
-#define _LIBUNWINDSTACK_UCONTEXT_MIPS64_H
-
-#include <stdint.h>
-
-#include <unwindstack/MachineMips64.h>
-
-namespace unwindstack {
-
-struct mips64_stack_t {
-  uint64_t ss_sp;    // void __user*
-  uint64_t ss_size;  // size_t
-  int32_t ss_flags;  // int
-};
-
-struct mips64_mcontext_t {
-  uint64_t sc_regs[32];
-  uint64_t sc_fpregs[32];
-  uint64_t sc_mdhi;
-  uint64_t sc_hi1;
-  uint64_t sc_hi2;
-  uint64_t sc_hi3;
-  uint64_t sc_mdlo;
-  uint64_t sc_lo1;
-  uint64_t sc_lo2;
-  uint64_t sc_lo3;
-  uint64_t sc_pc;
-  // Nothing else is used, so don't define it.
-};
-
-struct mips64_ucontext_t {
-  uint64_t uc_flags;  // unsigned long
-  uint64_t uc_link;   // struct ucontext*
-  mips64_stack_t uc_stack;
-  mips64_mcontext_t uc_mcontext;
-  // Nothing else is used, so don't define it.
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UCONTEXT_MIPS64_H
diff --git a/libunwindstack/include/unwindstack/UcontextX86.h b/libunwindstack/include/unwindstack/UcontextX86.h
deleted file mode 100644
index c96ebb7..0000000
--- a/libunwindstack/include/unwindstack/UcontextX86.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_UCONTEXT_X86_H
-#define _LIBUNWINDSTACK_UCONTEXT_X86_H
-
-#include <stdint.h>
-
-#include <unwindstack/MachineX86.h>
-
-namespace unwindstack {
-
-struct x86_stack_t {
-  uint32_t ss_sp;    // void __user*
-  int32_t ss_flags;  // int
-  uint32_t ss_size;  // size_t
-};
-
-struct x86_mcontext_t {
-  uint32_t gs;
-  uint32_t fs;
-  uint32_t es;
-  uint32_t ds;
-  uint32_t edi;
-  uint32_t esi;
-  uint32_t ebp;
-  uint32_t esp;
-  uint32_t ebx;
-  uint32_t edx;
-  uint32_t ecx;
-  uint32_t eax;
-  uint32_t trapno;
-  uint32_t err;
-  uint32_t eip;
-  uint32_t cs;
-  uint32_t efl;
-  uint32_t uesp;
-  uint32_t ss;
-  // Only care about the registers, skip everything else.
-};
-
-struct x86_ucontext_t {
-  uint32_t uc_flags;  // unsigned long
-  uint32_t uc_link;   // struct ucontext*
-  x86_stack_t uc_stack;
-  x86_mcontext_t uc_mcontext;
-  // Nothing else is used, so don't define it.
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UCONTEXT_X86_H
diff --git a/libunwindstack/include/unwindstack/UcontextX86_64.h b/libunwindstack/include/unwindstack/UcontextX86_64.h
deleted file mode 100644
index 4e163e5..0000000
--- a/libunwindstack/include/unwindstack/UcontextX86_64.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_UCONTEXT_X86_64_H
-#define _LIBUNWINDSTACK_UCONTEXT_X86_64_H
-
-#include <stdint.h>
-
-#include <unwindstack/MachineX86_64.h>
-
-namespace unwindstack {
-
-struct x86_64_stack_t {
-  uint64_t ss_sp;    // void __user*
-  int32_t ss_flags;  // int
-  int32_t pad;
-  uint64_t ss_size;  // size_t
-};
-
-struct x86_64_mcontext_t {
-  uint64_t r8;
-  uint64_t r9;
-  uint64_t r10;
-  uint64_t r11;
-  uint64_t r12;
-  uint64_t r13;
-  uint64_t r14;
-  uint64_t r15;
-  uint64_t rdi;
-  uint64_t rsi;
-  uint64_t rbp;
-  uint64_t rbx;
-  uint64_t rdx;
-  uint64_t rax;
-  uint64_t rcx;
-  uint64_t rsp;
-  uint64_t rip;
-  uint64_t efl;
-  uint64_t csgsfs;
-  uint64_t err;
-  uint64_t trapno;
-  uint64_t oldmask;
-  uint64_t cr2;
-  // Only care about the registers, skip everything else.
-};
-
-struct x86_64_ucontext_t {
-  uint64_t uc_flags;  // unsigned long
-  uint64_t uc_link;   // struct ucontext*
-  x86_64_stack_t uc_stack;
-  x86_64_mcontext_t uc_mcontext;
-  // Nothing else is used, so don't define it.
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UCONTEXT_X86_64_H
diff --git a/libunwindstack/include/unwindstack/Unwinder.h b/libunwindstack/include/unwindstack/Unwinder.h
deleted file mode 100644
index 67762c0..0000000
--- a/libunwindstack/include/unwindstack/Unwinder.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_UNWINDER_H
-#define _LIBUNWINDSTACK_UNWINDER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <unwindstack/DexFiles.h>
-#include <unwindstack/Error.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-namespace unwindstack {
-
-// Forward declarations.
-class Elf;
-enum ArchEnum : uint8_t;
-
-struct FrameData {
-  size_t num;
-
-  uint64_t rel_pc;
-  uint64_t pc;
-  uint64_t sp;
-
-  std::string function_name;
-  uint64_t function_offset = 0;
-
-  std::string map_name;
-  // The offset from the first map representing the frame. When there are
-  // two maps (read-only and read-execute) this will be the offset from
-  // the read-only map. When there is only one map, this will be the
-  // same as the actual offset of the map and match map_exact_offset.
-  uint64_t map_elf_start_offset = 0;
-  // The actual offset from the map where the pc lies.
-  uint64_t map_exact_offset = 0;
-  uint64_t map_start = 0;
-  uint64_t map_end = 0;
-  uint64_t map_load_bias = 0;
-  int map_flags = 0;
-};
-
-class Unwinder {
- public:
-  Unwinder(size_t max_frames, Maps* maps, Regs* regs, std::shared_ptr<Memory> process_memory)
-      : max_frames_(max_frames), maps_(maps), regs_(regs), process_memory_(process_memory) {
-    frames_.reserve(max_frames);
-  }
-  Unwinder(size_t max_frames, Maps* maps, std::shared_ptr<Memory> process_memory)
-      : max_frames_(max_frames), maps_(maps), process_memory_(process_memory) {
-    frames_.reserve(max_frames);
-  }
-
-  virtual ~Unwinder() = default;
-
-  void Unwind(const std::vector<std::string>* initial_map_names_to_skip = nullptr,
-              const std::vector<std::string>* map_suffixes_to_ignore = nullptr);
-
-  size_t NumFrames() const { return frames_.size(); }
-
-  const std::vector<FrameData>& frames() { return frames_; }
-
-  std::vector<FrameData> ConsumeFrames() {
-    std::vector<FrameData> frames = std::move(frames_);
-    frames_.clear();
-    return frames;
-  }
-
-  std::string FormatFrame(size_t frame_num) const;
-  std::string FormatFrame(const FrameData& frame) const;
-
-  void SetJitDebug(JitDebug* jit_debug, ArchEnum arch);
-
-  void SetRegs(Regs* regs) { regs_ = regs; }
-  Maps* GetMaps() { return maps_; }
-  std::shared_ptr<Memory>& GetProcessMemory() { return process_memory_; }
-
-  // Disabling the resolving of names results in the function name being
-  // set to an empty string and the function offset being set to zero.
-  void SetResolveNames(bool resolve) { resolve_names_ = resolve; }
-
-  // Enable/disable soname printing the soname for a map name if the elf is
-  // embedded in a file. This is enabled by default.
-  // NOTE: This does nothing unless resolving names is enabled.
-  void SetEmbeddedSoname(bool embedded_soname) { embedded_soname_ = embedded_soname; }
-
-  void SetDisplayBuildID(bool display_build_id) { display_build_id_ = display_build_id; }
-
-  void SetDexFiles(DexFiles* dex_files, ArchEnum arch);
-
-  bool elf_from_memory_not_file() { return elf_from_memory_not_file_; }
-
-  ErrorCode LastErrorCode() { return last_error_.code; }
-  uint64_t LastErrorAddress() { return last_error_.address; }
-
- protected:
-  Unwinder(size_t max_frames) : max_frames_(max_frames) { frames_.reserve(max_frames); }
-
-  void FillInDexFrame();
-  FrameData* FillInFrame(MapInfo* map_info, Elf* elf, uint64_t rel_pc, uint64_t pc_adjustment);
-
-  size_t max_frames_;
-  Maps* maps_;
-  Regs* regs_;
-  std::vector<FrameData> frames_;
-  std::shared_ptr<Memory> process_memory_;
-  JitDebug* jit_debug_ = nullptr;
-  DexFiles* dex_files_ = nullptr;
-  bool resolve_names_ = true;
-  bool embedded_soname_ = true;
-  bool display_build_id_ = false;
-  // True if at least one elf file is coming from memory and not the related
-  // file. This is only true if there is an actual file backing up the elf.
-  bool elf_from_memory_not_file_ = false;
-  ErrorData last_error_;
-};
-
-class UnwinderFromPid : public Unwinder {
- public:
-  UnwinderFromPid(size_t max_frames, pid_t pid) : Unwinder(max_frames), pid_(pid) {}
-  virtual ~UnwinderFromPid() = default;
-
-  bool Init(ArchEnum arch);
-
- private:
-  pid_t pid_;
-  std::unique_ptr<Maps> maps_ptr_;
-  std::unique_ptr<JitDebug> jit_debug_ptr_;
-  std::unique_ptr<DexFiles> dex_files_ptr_;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_UNWINDER_H
diff --git a/libunwindstack/include/unwindstack/UserArm.h b/libunwindstack/include/unwindstack/UserArm.h
deleted file mode 100644
index 7388c03..0000000
--- a/libunwindstack/include/unwindstack/UserArm.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_USER_ARM_H
-#define _LIBUNWINDSTACK_USER_ARM_H
-
-namespace unwindstack {
-
-struct arm_user_regs {
-  uint32_t regs[18];
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_USER_ARM_H
diff --git a/libunwindstack/include/unwindstack/UserArm64.h b/libunwindstack/include/unwindstack/UserArm64.h
deleted file mode 100644
index d74983f..0000000
--- a/libunwindstack/include/unwindstack/UserArm64.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_USER_ARM64_H
-#define _LIBUNWINDSTACK_USER_ARM64_H
-
-namespace unwindstack {
-
-struct arm64_user_regs {
-  uint64_t regs[31];
-  uint64_t sp;
-  uint64_t pc;
-  uint64_t pstate;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_USER_ARM64_H
diff --git a/libunwindstack/include/unwindstack/UserMips.h b/libunwindstack/include/unwindstack/UserMips.h
deleted file mode 100644
index 184be4f..0000000
--- a/libunwindstack/include/unwindstack/UserMips.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_USER_MIPS_H
-#define _LIBUNWINDSTACK_USER_MIPS_H
-
-namespace unwindstack {
-
-enum Mips32UserReg : uint16_t {
-  MIPS32_EF_R0 = 6,
-  MIPS32_EF_CP0_EPC = 40,
-};
-
-struct mips_user_regs {
-  uint32_t regs[45];
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_USER_MIPS_H
diff --git a/libunwindstack/include/unwindstack/UserMips64.h b/libunwindstack/include/unwindstack/UserMips64.h
deleted file mode 100644
index c46befd..0000000
--- a/libunwindstack/include/unwindstack/UserMips64.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_USER_MIPS64_H
-#define _LIBUNWINDSTACK_USER_MIPS64_H
-
-namespace unwindstack {
-
-enum Mips64UserReg : uint16_t {
-  MIPS64_EF_R0 = 0,
-  MIPS64_EF_CP0_EPC = 34,
-};
-
-struct mips64_user_regs {
-  uint64_t regs[45];
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_USER_MIPS64_H
diff --git a/libunwindstack/include/unwindstack/UserX86.h b/libunwindstack/include/unwindstack/UserX86.h
deleted file mode 100644
index a040560..0000000
--- a/libunwindstack/include/unwindstack/UserX86.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_USER_X86_H
-#define _LIBUNWINDSTACK_USER_X86_H
-
-namespace unwindstack {
-
-struct x86_user_regs {
-  uint32_t ebx;
-  uint32_t ecx;
-  uint32_t edx;
-  uint32_t esi;
-  uint32_t edi;
-  uint32_t ebp;
-  uint32_t eax;
-  uint32_t xds;
-  uint32_t xes;
-  uint32_t xfs;
-  uint32_t xgs;
-  uint32_t orig_eax;
-  uint32_t eip;
-  uint32_t xcs;
-  uint32_t eflags;
-  uint32_t esp;
-  uint32_t xss;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_USER_X86_H
diff --git a/libunwindstack/include/unwindstack/UserX86_64.h b/libunwindstack/include/unwindstack/UserX86_64.h
deleted file mode 100644
index b80d201..0000000
--- a/libunwindstack/include/unwindstack/UserX86_64.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _LIBUNWINDSTACK_USER_X86_64_H
-#define _LIBUNWINDSTACK_USER_X86_64_H
-
-namespace unwindstack {
-
-struct x86_64_user_regs {
-  uint64_t r15;
-  uint64_t r14;
-  uint64_t r13;
-  uint64_t r12;
-  uint64_t rbp;
-  uint64_t rbx;
-  uint64_t r11;
-  uint64_t r10;
-  uint64_t r9;
-  uint64_t r8;
-  uint64_t rax;
-  uint64_t rcx;
-  uint64_t rdx;
-  uint64_t rsi;
-  uint64_t rdi;
-  uint64_t orig_rax;
-  uint64_t rip;
-  uint64_t cs;
-  uint64_t eflags;
-  uint64_t rsp;
-  uint64_t ss;
-  uint64_t fs_base;
-  uint64_t gs_base;
-  uint64_t ds;
-  uint64_t es;
-  uint64_t fs;
-  uint64_t gs;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_USER_X86_64_H
diff --git a/libunwindstack/tests/ArmExidxDecodeTest.cpp b/libunwindstack/tests/ArmExidxDecodeTest.cpp
deleted file mode 100644
index 69a7816..0000000
--- a/libunwindstack/tests/ArmExidxDecodeTest.cpp
+++ /dev/null
@@ -1,1668 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <deque>
-#include <ios>
-#include <memory>
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Log.h>
-#include <unwindstack/RegsArm.h>
-
-#include "ArmExidx.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class ArmExidxDecodeTest : public ::testing::TestWithParam<std::string> {
- protected:
-  void Init(Memory* process_memory = nullptr) {
-    if (process_memory == nullptr) {
-      process_memory = &process_memory_;
-    }
-
-    regs_arm_.reset(new RegsArm());
-    for (size_t i = 0; i < regs_arm_->total_regs(); i++) {
-      (*regs_arm_)[i] = 0;
-    }
-    regs_arm_->set_pc(0);
-    regs_arm_->set_sp(0);
-
-    exidx_.reset(new ArmExidx(regs_arm_.get(), &elf_memory_, process_memory));
-    if (log_ != ARM_LOG_NONE) {
-      exidx_->set_log(log_);
-      exidx_->set_log_indent(0);
-      exidx_->set_log_skip_execution(false);
-    }
-    data_ = exidx_->data();
-    exidx_->set_cfa(0x10000);
-  }
-
-  void SetUp() override {
-    if (GetParam() == "no_logging") {
-      log_ = ARM_LOG_NONE;
-    } else if (GetParam() == "register_logging") {
-      log_ = ARM_LOG_BY_REG;
-    } else {
-      log_ = ARM_LOG_FULL;
-    }
-    elf_memory_.Clear();
-    process_memory_.Clear();
-    ResetExidx();
-  }
-
-  void ResetExidx() {
-    ResetLogs();
-    Init();
-  }
-
-  std::unique_ptr<ArmExidx> exidx_;
-  std::unique_ptr<RegsArm> regs_arm_;
-  std::deque<uint8_t>* data_;
-
-  MemoryFake elf_memory_;
-  MemoryFake process_memory_;
-  ArmLogType log_;
-};
-
-TEST_P(ArmExidxDecodeTest, vsp_incr) {
-  // 00xxxxxx: vsp = vsp + (xxxxxx << 2) + 4
-  data_->push_back(0x00);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp + 4\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 4\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10004U, exidx_->cfa());
-
-  ResetExidx();
-  data_->clear();
-  data_->push_back(0x01);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp + 8\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 8\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->clear();
-  data_->push_back(0x3f);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp + 256\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 256\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10100U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, vsp_decr) {
-  // 01xxxxxx: vsp = vsp - (xxxxxx << 2) + 4
-  data_->push_back(0x40);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp - 4\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 - 4\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0xfffcU, exidx_->cfa());
-
-  ResetExidx();
-  data_->clear();
-  data_->push_back(0x41);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp - 8\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 - 8\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0xfff8U, exidx_->cfa());
-
-  ResetExidx();
-  data_->clear();
-  data_->push_back(0x7f);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp - 256\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 - 256\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0xff00U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, refuse_unwind) {
-  // 10000000 00000000: Refuse to unwind
-  data_->push_back(0x80);
-  data_->push_back(0x00);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Refuse to unwind\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(ARM_STATUS_NO_UNWIND, exidx_->status());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_up_to_12) {
-  // 1000iiii iiiiiiii: Pop up to 12 integer registers
-  data_->push_back(0x88);
-  data_->push_back(0x00);
-  process_memory_.SetData32(0x10000, 0x10);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_TRUE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r15}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 4\n"
-          "4 unwind r15 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10004U, exidx_->cfa());
-  ASSERT_EQ(0x10U, (*exidx_->regs())[15]);
-
-  ResetExidx();
-  data_->push_back(0x8f);
-  data_->push_back(0xff);
-  for (size_t i = 0; i < 12; i++) {
-    process_memory_.SetData32(0x10000 + i * 4, i + 0x20);
-  }
-  exidx_->set_pc_set(false);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_TRUE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15}\n",
-                GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 48\n"
-          "4 unwind r4 = [cfa - 48]\n"
-          "4 unwind r5 = [cfa - 44]\n"
-          "4 unwind r6 = [cfa - 40]\n"
-          "4 unwind r7 = [cfa - 36]\n"
-          "4 unwind r8 = [cfa - 32]\n"
-          "4 unwind r9 = [cfa - 28]\n"
-          "4 unwind r10 = [cfa - 24]\n"
-          "4 unwind r11 = [cfa - 20]\n"
-          "4 unwind r12 = [cfa - 16]\n"
-          "4 unwind r13 = [cfa - 12]\n"
-          "4 unwind r14 = [cfa - 8]\n"
-          "4 unwind r15 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  // Popping r13 results in a modified cfa.
-  ASSERT_EQ(0x29U, exidx_->cfa());
-
-  ASSERT_EQ(0x20U, (*exidx_->regs())[4]);
-  ASSERT_EQ(0x21U, (*exidx_->regs())[5]);
-  ASSERT_EQ(0x22U, (*exidx_->regs())[6]);
-  ASSERT_EQ(0x23U, (*exidx_->regs())[7]);
-  ASSERT_EQ(0x24U, (*exidx_->regs())[8]);
-  ASSERT_EQ(0x25U, (*exidx_->regs())[9]);
-  ASSERT_EQ(0x26U, (*exidx_->regs())[10]);
-  ASSERT_EQ(0x27U, (*exidx_->regs())[11]);
-  ASSERT_EQ(0x28U, (*exidx_->regs())[12]);
-  ASSERT_EQ(0x29U, (*exidx_->regs())[13]);
-  ASSERT_EQ(0x2aU, (*exidx_->regs())[14]);
-  ASSERT_EQ(0x2bU, (*exidx_->regs())[15]);
-
-  ResetExidx();
-  exidx_->set_cfa(0x10034);
-  data_->push_back(0x81);
-  data_->push_back(0x28);
-  process_memory_.SetData32(0x10034, 0x11);
-  process_memory_.SetData32(0x10038, 0x22);
-  process_memory_.SetData32(0x1003c, 0x33);
-  exidx_->set_pc_set(false);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r7, r9, r12}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 12\n"
-          "4 unwind r7 = [cfa - 12]\n"
-          "4 unwind r9 = [cfa - 8]\n"
-          "4 unwind r12 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10040U, exidx_->cfa());
-  ASSERT_EQ(0x11U, (*exidx_->regs())[7]);
-  ASSERT_EQ(0x22U, (*exidx_->regs())[9]);
-  ASSERT_EQ(0x33U, (*exidx_->regs())[12]);
-}
-
-TEST_P(ArmExidxDecodeTest, set_vsp_from_register) {
-  // 1001nnnn: Set vsp = r[nnnn] (nnnn != 13, 15)
-  exidx_->set_cfa(0x100);
-  for (size_t i = 0; i < 15; i++) {
-    (*regs_arm_)[i] = i + 1;
-  }
-
-  data_->push_back(0x90);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = r0\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r0\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(1U, exidx_->cfa());
-
-  ResetExidx();
-  exidx_->set_cfa(0x100);
-  for (size_t i = 0; i < 15; i++) {
-    (*regs_arm_)[i] = i + 1;
-  }
-  data_->push_back(0x93);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = r3\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r3\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(4U, exidx_->cfa());
-
-  ResetExidx();
-  exidx_->set_cfa(0x100);
-  for (size_t i = 0; i < 15; i++) {
-    (*regs_arm_)[i] = i + 1;
-  }
-  data_->push_back(0x9e);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = r14\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r14\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(15U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, reserved_prefix) {
-  // 10011101: Reserved as prefix for ARM register to register moves
-  data_->push_back(0x9d);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind [Reserved]\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(ARM_STATUS_RESERVED, exidx_->status());
-
-  // 10011111: Reserved as prefix for Intel Wireless MMX register to register moves
-  ResetExidx();
-  data_->push_back(0x9f);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind [Reserved]\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(ARM_STATUS_RESERVED, exidx_->status());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_registers) {
-  // 10100nnn: Pop r4-r[4+nnn]
-  data_->push_back(0xa0);
-  process_memory_.SetData32(0x10000, 0x14);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 4\n"
-          "4 unwind r4 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10004U, exidx_->cfa());
-  ASSERT_EQ(0x14U, (*exidx_->regs())[4]);
-
-  ResetExidx();
-  data_->push_back(0xa3);
-  process_memory_.SetData32(0x10000, 0x20);
-  process_memory_.SetData32(0x10004, 0x30);
-  process_memory_.SetData32(0x10008, 0x40);
-  process_memory_.SetData32(0x1000c, 0x50);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4-r7}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 16\n"
-          "4 unwind r4 = [cfa - 16]\n"
-          "4 unwind r5 = [cfa - 12]\n"
-          "4 unwind r6 = [cfa - 8]\n"
-          "4 unwind r7 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10010U, exidx_->cfa());
-  ASSERT_EQ(0x20U, (*exidx_->regs())[4]);
-  ASSERT_EQ(0x30U, (*exidx_->regs())[5]);
-  ASSERT_EQ(0x40U, (*exidx_->regs())[6]);
-  ASSERT_EQ(0x50U, (*exidx_->regs())[7]);
-
-  ResetExidx();
-  data_->push_back(0xa7);
-  process_memory_.SetData32(0x10000, 0x41);
-  process_memory_.SetData32(0x10004, 0x51);
-  process_memory_.SetData32(0x10008, 0x61);
-  process_memory_.SetData32(0x1000c, 0x71);
-  process_memory_.SetData32(0x10010, 0x81);
-  process_memory_.SetData32(0x10014, 0x91);
-  process_memory_.SetData32(0x10018, 0xa1);
-  process_memory_.SetData32(0x1001c, 0xb1);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4-r11}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 32\n"
-          "4 unwind r4 = [cfa - 32]\n"
-          "4 unwind r5 = [cfa - 28]\n"
-          "4 unwind r6 = [cfa - 24]\n"
-          "4 unwind r7 = [cfa - 20]\n"
-          "4 unwind r8 = [cfa - 16]\n"
-          "4 unwind r9 = [cfa - 12]\n"
-          "4 unwind r10 = [cfa - 8]\n"
-          "4 unwind r11 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10020U, exidx_->cfa());
-  ASSERT_EQ(0x41U, (*exidx_->regs())[4]);
-  ASSERT_EQ(0x51U, (*exidx_->regs())[5]);
-  ASSERT_EQ(0x61U, (*exidx_->regs())[6]);
-  ASSERT_EQ(0x71U, (*exidx_->regs())[7]);
-  ASSERT_EQ(0x81U, (*exidx_->regs())[8]);
-  ASSERT_EQ(0x91U, (*exidx_->regs())[9]);
-  ASSERT_EQ(0xa1U, (*exidx_->regs())[10]);
-  ASSERT_EQ(0xb1U, (*exidx_->regs())[11]);
-}
-
-TEST_P(ArmExidxDecodeTest, pop_registers_with_r14) {
-  // 10101nnn: Pop r4-r[4+nnn], r14
-  data_->push_back(0xa8);
-  process_memory_.SetData32(0x10000, 0x12);
-  process_memory_.SetData32(0x10004, 0x22);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4, r14}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 8\n"
-          "4 unwind r4 = [cfa - 8]\n"
-          "4 unwind r14 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-  ASSERT_EQ(0x12U, (*exidx_->regs())[4]);
-  ASSERT_EQ(0x22U, (*exidx_->regs())[14]);
-
-  ResetExidx();
-  data_->push_back(0xab);
-  process_memory_.SetData32(0x10000, 0x1);
-  process_memory_.SetData32(0x10004, 0x2);
-  process_memory_.SetData32(0x10008, 0x3);
-  process_memory_.SetData32(0x1000c, 0x4);
-  process_memory_.SetData32(0x10010, 0x5);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4-r7, r14}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 20\n"
-          "4 unwind r4 = [cfa - 20]\n"
-          "4 unwind r5 = [cfa - 16]\n"
-          "4 unwind r6 = [cfa - 12]\n"
-          "4 unwind r7 = [cfa - 8]\n"
-          "4 unwind r14 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10014U, exidx_->cfa());
-  ASSERT_EQ(0x1U, (*exidx_->regs())[4]);
-  ASSERT_EQ(0x2U, (*exidx_->regs())[5]);
-  ASSERT_EQ(0x3U, (*exidx_->regs())[6]);
-  ASSERT_EQ(0x4U, (*exidx_->regs())[7]);
-  ASSERT_EQ(0x5U, (*exidx_->regs())[14]);
-
-  ResetExidx();
-  data_->push_back(0xaf);
-  process_memory_.SetData32(0x10000, 0x1a);
-  process_memory_.SetData32(0x10004, 0x2a);
-  process_memory_.SetData32(0x10008, 0x3a);
-  process_memory_.SetData32(0x1000c, 0x4a);
-  process_memory_.SetData32(0x10010, 0x5a);
-  process_memory_.SetData32(0x10014, 0x6a);
-  process_memory_.SetData32(0x10018, 0x7a);
-  process_memory_.SetData32(0x1001c, 0x8a);
-  process_memory_.SetData32(0x10020, 0x9a);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r4-r11, r14}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 36\n"
-          "4 unwind r4 = [cfa - 36]\n"
-          "4 unwind r5 = [cfa - 32]\n"
-          "4 unwind r6 = [cfa - 28]\n"
-          "4 unwind r7 = [cfa - 24]\n"
-          "4 unwind r8 = [cfa - 20]\n"
-          "4 unwind r9 = [cfa - 16]\n"
-          "4 unwind r10 = [cfa - 12]\n"
-          "4 unwind r11 = [cfa - 8]\n"
-          "4 unwind r14 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10024U, exidx_->cfa());
-  ASSERT_EQ(0x1aU, (*exidx_->regs())[4]);
-  ASSERT_EQ(0x2aU, (*exidx_->regs())[5]);
-  ASSERT_EQ(0x3aU, (*exidx_->regs())[6]);
-  ASSERT_EQ(0x4aU, (*exidx_->regs())[7]);
-  ASSERT_EQ(0x5aU, (*exidx_->regs())[8]);
-  ASSERT_EQ(0x6aU, (*exidx_->regs())[9]);
-  ASSERT_EQ(0x7aU, (*exidx_->regs())[10]);
-  ASSERT_EQ(0x8aU, (*exidx_->regs())[11]);
-  ASSERT_EQ(0x9aU, (*exidx_->regs())[14]);
-}
-
-TEST_P(ArmExidxDecodeTest, finish) {
-  // 10110000: Finish
-  data_->push_back(0xb0);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind finish\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10000U, exidx_->cfa());
-  ASSERT_EQ(ARM_STATUS_FINISH, exidx_->status());
-}
-
-TEST_P(ArmExidxDecodeTest, spare) {
-  // 10110001 00000000: Spare
-  data_->push_back(0xb1);
-  data_->push_back(0x00);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10000U, exidx_->cfa());
-  ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-
-  // 10110001 xxxxyyyy: Spare (xxxx != 0000)
-  for (size_t x = 1; x < 16; x++) {
-    for (size_t y = 0; y < 16; y++) {
-      ResetExidx();
-      data_->push_back(0xb1);
-      data_->push_back((x << 4) | y);
-      ASSERT_FALSE(exidx_->Decode()) << "x, y = " << x << ", " << y;
-      ASSERT_EQ("", GetFakeLogBuf()) << "x, y = " << x << ", " << y;
-      switch (log_) {
-        case ARM_LOG_NONE:
-          ASSERT_EQ("", GetFakeLogPrint());
-          break;
-        case ARM_LOG_FULL:
-        case ARM_LOG_BY_REG:
-          ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint()) << "x, y = " << x << ", " << y;
-          break;
-      }
-      ASSERT_EQ(0x10000U, exidx_->cfa()) << "x, y = " << x << ", " << y;
-      ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-    }
-  }
-
-  // 101101nn: Spare
-  for (size_t n = 0; n < 4; n++) {
-    ResetExidx();
-    data_->push_back(0xb4 | n);
-    ASSERT_FALSE(exidx_->Decode()) << "n = " << n;
-    ASSERT_EQ("", GetFakeLogBuf()) << "n = " << n;
-    switch (log_) {
-      case ARM_LOG_NONE:
-        ASSERT_EQ("", GetFakeLogPrint());
-        break;
-      case ARM_LOG_FULL:
-      case ARM_LOG_BY_REG:
-        ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint()) << "n = " << n;
-        break;
-    }
-    ASSERT_EQ(0x10000U, exidx_->cfa()) << "n = " << n;
-    ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-  }
-
-  // 11000111 00000000: Spare
-  ResetExidx();
-  data_->push_back(0xc7);
-  data_->push_back(0x00);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10000U, exidx_->cfa());
-  ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-
-  // 11000111 xxxxyyyy: Spare (xxxx != 0000)
-  for (size_t x = 1; x < 16; x++) {
-    for (size_t y = 0; y < 16; y++) {
-      ResetExidx();
-      data_->push_back(0xc7);
-      data_->push_back(0x10);
-      ASSERT_FALSE(exidx_->Decode()) << "x, y = " << x << ", " << y;
-      ASSERT_EQ("", GetFakeLogBuf()) << "x, y = " << x << ", " << y;
-      switch (log_) {
-        case ARM_LOG_NONE:
-          ASSERT_EQ("", GetFakeLogPrint());
-          break;
-        case ARM_LOG_FULL:
-        case ARM_LOG_BY_REG:
-          ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint()) << "x, y = " << x << ", " << y;
-          break;
-      }
-      ASSERT_EQ(0x10000U, exidx_->cfa()) << "x, y = " << x << ", " << y;
-      ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-    }
-  }
-
-  // 11001yyy: Spare (yyy != 000, 001)
-  for (size_t y = 2; y < 8; y++) {
-    ResetExidx();
-    data_->push_back(0xc8 | y);
-    ASSERT_FALSE(exidx_->Decode()) << "y = " << y;
-    ASSERT_EQ("", GetFakeLogBuf()) << "y = " << y;
-    switch (log_) {
-      case ARM_LOG_NONE:
-        ASSERT_EQ("", GetFakeLogPrint());
-        break;
-      case ARM_LOG_FULL:
-      case ARM_LOG_BY_REG:
-        ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint()) << "y = " << y;
-        break;
-    }
-    ASSERT_EQ(0x10000U, exidx_->cfa()) << "y = " << y;
-    ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-  }
-
-  // 11xxxyyy: Spare (xxx != 000, 001, 010)
-  for (size_t x = 3; x < 8; x++) {
-    for (size_t y = 0; y < 8; y++) {
-      ResetExidx();
-      data_->push_back(0xc0 | (x << 3) | y);
-      ASSERT_FALSE(exidx_->Decode()) << "x, y = " << x << ", " << y;
-      ASSERT_EQ("", GetFakeLogBuf()) << "x, y = " << x << ", " << y;
-      switch (log_) {
-        case ARM_LOG_NONE:
-          ASSERT_EQ("", GetFakeLogPrint());
-          break;
-        case ARM_LOG_FULL:
-        case ARM_LOG_BY_REG:
-          ASSERT_EQ("4 unwind Spare\n", GetFakeLogPrint()) << "x, y = " << x << ", " << y;
-          break;
-      }
-      ASSERT_EQ(0x10000U, exidx_->cfa()) << "x, y = " << x << ", " << y;
-      ASSERT_EQ(ARM_STATUS_SPARE, exidx_->status());
-    }
-  }
-}
-
-TEST_P(ArmExidxDecodeTest, pop_registers_under_mask) {
-  // 10110001 0000iiii: Pop integer registers {r0, r1, r2, r3}
-  data_->push_back(0xb1);
-  data_->push_back(0x01);
-  process_memory_.SetData32(0x10000, 0x45);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r0}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 4\n"
-          "4 unwind r0 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10004U, exidx_->cfa());
-  ASSERT_EQ(0x45U, (*exidx_->regs())[0]);
-
-  ResetExidx();
-  data_->push_back(0xb1);
-  data_->push_back(0x0a);
-  process_memory_.SetData32(0x10000, 0x23);
-  process_memory_.SetData32(0x10004, 0x24);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r1, r3}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 8\n"
-          "4 unwind r1 = [cfa - 8]\n"
-          "4 unwind r3 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-  ASSERT_EQ(0x23U, (*exidx_->regs())[1]);
-  ASSERT_EQ(0x24U, (*exidx_->regs())[3]);
-
-  ResetExidx();
-  data_->push_back(0xb1);
-  data_->push_back(0x0f);
-  process_memory_.SetData32(0x10000, 0x65);
-  process_memory_.SetData32(0x10004, 0x54);
-  process_memory_.SetData32(0x10008, 0x43);
-  process_memory_.SetData32(0x1000c, 0x32);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {r0, r1, r2, r3}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 16\n"
-          "4 unwind r0 = [cfa - 16]\n"
-          "4 unwind r1 = [cfa - 12]\n"
-          "4 unwind r2 = [cfa - 8]\n"
-          "4 unwind r3 = [cfa - 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10010U, exidx_->cfa());
-  ASSERT_EQ(0x65U, (*exidx_->regs())[0]);
-  ASSERT_EQ(0x54U, (*exidx_->regs())[1]);
-  ASSERT_EQ(0x43U, (*exidx_->regs())[2]);
-  ASSERT_EQ(0x32U, (*exidx_->regs())[3]);
-}
-
-TEST_P(ArmExidxDecodeTest, vsp_large_incr) {
-  // 10110010 uleb128: vsp = vsp + 0x204 + (uleb128 << 2)
-  data_->push_back(0xb2);
-  data_->push_back(0x7f);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp + 1024\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 1024\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10400U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xb2);
-  data_->push_back(0xff);
-  data_->push_back(0x02);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp + 2048\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 2048\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10800U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xb2);
-  data_->push_back(0xff);
-  data_->push_back(0x82);
-  data_->push_back(0x30);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind vsp = vsp + 3147776\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 3147776\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x310800U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_vfp_fstmfdx) {
-  // 10110011 sssscccc: Pop VFP double precision registers D[ssss]-D[ssss+cccc] by FSTMFDX
-  data_->push_back(0xb3);
-  data_->push_back(0x00);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d0}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x1000cU, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xb3);
-  data_->push_back(0x48);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d4-d12}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x1004cU, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_vfp8_fstmfdx) {
-  // 10111nnn: Pop VFP double precision registers D[8]-D[8+nnn] by FSTMFDX
-  data_->push_back(0xb8);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d8}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x1000cU, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xbb);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d8-d11}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10024U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xbf);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d8-d15}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10044U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_mmx_wr10) {
-  // 11000nnn: Intel Wireless MMX pop wR[10]-wR[10+nnn] (nnn != 6, 7)
-  data_->push_back(0xc0);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wR10}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wRX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc2);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wR10-wR12}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wRX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10018U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc5);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wR10-wR15}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wRX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10030U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_mmx_wr) {
-  // 11000110 sssscccc: Intel Wireless MMX pop wR[ssss]-wR[ssss+cccc]
-  data_->push_back(0xc6);
-  data_->push_back(0x00);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wR0}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wRX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc6);
-  data_->push_back(0x25);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wR2-wR7}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wRX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10030U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc6);
-  data_->push_back(0xff);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wR15-wR30}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wRX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10080U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_mmx_wcgr) {
-  // 11000111 0000iiii: Intel Wireless MMX pop wCGR registes {wCGR0,1,2,3}
-  data_->push_back(0xc7);
-  data_->push_back(0x01);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wCGR0}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wCGR register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10004U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc7);
-  data_->push_back(0x0a);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wCGR1, wCGR3}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wCGR register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc7);
-  data_->push_back(0x0f);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {wCGR0, wCGR1, wCGR2, wCGR3}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported wCGR register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10010U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_vfp16_vpush) {
-  // 11001000 sssscccc: Pop VFP double precision registers d[16+ssss]-D[16+ssss+cccc] by VPUSH
-  data_->push_back(0xc8);
-  data_->push_back(0x00);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d16}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc8);
-  data_->push_back(0x14);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d17-d21}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10028U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc8);
-  data_->push_back(0xff);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d31-d46}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10080U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_vfp_vpush) {
-  // 11001001 sssscccc: Pop VFP double precision registers d[ssss]-D[ssss+cccc] by VPUSH
-  data_->push_back(0xc9);
-  data_->push_back(0x00);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d0}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc9);
-  data_->push_back(0x23);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d2-d5}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10020U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xc9);
-  data_->push_back(0xff);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d15-d30}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10080U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, pop_vfp8_vpush) {
-  // 11010nnn: Pop VFP double precision registers D[8]-D[8+nnn] by VPUSH
-  data_->push_back(0xd0);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d8}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10008U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xd2);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d8-d10}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10018U, exidx_->cfa());
-
-  ResetExidx();
-  data_->push_back(0xd7);
-  ASSERT_TRUE(exidx_->Decode());
-  ASSERT_FALSE(exidx_->pc_set());
-  ASSERT_EQ("", GetFakeLogBuf());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ("4 unwind pop {d8-d15}\n", GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      ASSERT_EQ("4 unwind Unsupported DX register display\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10040U, exidx_->cfa());
-}
-
-TEST_P(ArmExidxDecodeTest, expect_truncated) {
-  // This test verifies that any op that requires extra ops will
-  // fail if the data is not present.
-  data_->push_back(0x80);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xb1);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xb2);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xb3);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xc6);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xc7);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xc8);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-
-  data_->clear();
-  data_->push_back(0xc9);
-  ASSERT_FALSE(exidx_->Decode());
-  ASSERT_EQ(ARM_STATUS_TRUNCATED, exidx_->status());
-}
-
-TEST_P(ArmExidxDecodeTest, verify_no_truncated) {
-  // This test verifies that no pattern results in a crash or truncation.
-  MemoryFakeAlwaysReadZero memory_zero;
-  Init(&memory_zero);
-
-  for (size_t x = 0; x < 256; x++) {
-    if (x == 0xb2) {
-      // This opcode is followed by an uleb128, so just skip this one.
-      continue;
-    }
-    for (size_t y = 0; y < 256; y++) {
-      data_->clear();
-      data_->push_back(x);
-      data_->push_back(y);
-      if (!exidx_->Decode()) {
-        ASSERT_NE(ARM_STATUS_TRUNCATED, exidx_->status())
-            << "x y = 0x" << std::hex << x << " 0x" << y;
-        ASSERT_NE(ARM_STATUS_READ_FAILED, exidx_->status())
-            << "x y = 0x" << std::hex << x << " 0x" << y;
-      }
-    }
-  }
-}
-
-TEST_P(ArmExidxDecodeTest, eval_multiple_decodes) {
-  // vsp = vsp + 4
-  data_->push_back(0x00);
-  // vsp = vsp + 12
-  data_->push_back(0x02);
-  // Finish
-  data_->push_back(0xb0);
-
-  ASSERT_TRUE(exidx_->Eval());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ(
-          "4 unwind vsp = vsp + 4\n"
-          "4 unwind vsp = vsp + 12\n"
-          "4 unwind finish\n",
-          GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ("4 unwind cfa = r13 + 16\n", GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10010U, exidx_->cfa());
-  ASSERT_FALSE(exidx_->pc_set());
-}
-
-TEST_P(ArmExidxDecodeTest, eval_vsp_add_after_pop) {
-  // Pop {r15}
-  data_->push_back(0x88);
-  data_->push_back(0x00);
-  // vsp = vsp + 12
-  data_->push_back(0x02);
-  // Finish
-  data_->push_back(0xb0);
-  process_memory_.SetData32(0x10000, 0x10);
-
-  ASSERT_TRUE(exidx_->Eval());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ(
-          "4 unwind pop {r15}\n"
-          "4 unwind vsp = vsp + 12\n"
-          "4 unwind finish\n",
-          GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 16\n"
-          "4 unwind r15 = [cfa - 16]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10010U, exidx_->cfa());
-  ASSERT_TRUE(exidx_->pc_set());
-  ASSERT_EQ(0x10U, (*exidx_->regs())[15]);
-}
-
-TEST_P(ArmExidxDecodeTest, eval_vsp_add_large_after_pop) {
-  // Pop {r15}
-  data_->push_back(0x88);
-  data_->push_back(0x00);
-  // vsp = vsp + 1024
-  data_->push_back(0xb2);
-  data_->push_back(0x7f);
-  // Finish
-  data_->push_back(0xb0);
-  process_memory_.SetData32(0x10000, 0x10);
-
-  ASSERT_TRUE(exidx_->Eval());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ(
-          "4 unwind pop {r15}\n"
-          "4 unwind vsp = vsp + 1024\n"
-          "4 unwind finish\n",
-          GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 1028\n"
-          "4 unwind r15 = [cfa - 1028]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10404U, exidx_->cfa());
-  ASSERT_TRUE(exidx_->pc_set());
-  ASSERT_EQ(0x10U, (*exidx_->regs())[15]);
-}
-
-TEST_P(ArmExidxDecodeTest, eval_vsp_sub_after_pop) {
-  // Pop {r15}
-  data_->push_back(0x88);
-  data_->push_back(0x00);
-  // vsp = vsp - 4
-  data_->push_back(0x41);
-  // Finish
-  data_->push_back(0xb0);
-  process_memory_.SetData32(0x10000, 0x10);
-
-  ASSERT_TRUE(exidx_->Eval());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ(
-          "4 unwind pop {r15}\n"
-          "4 unwind vsp = vsp - 8\n"
-          "4 unwind finish\n",
-          GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 - 4\n"
-          "4 unwind r15 = [cfa + 4]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0xfffcU, exidx_->cfa());
-  ASSERT_TRUE(exidx_->pc_set());
-  ASSERT_EQ(0x10U, (*exidx_->regs())[15]);
-}
-
-TEST_P(ArmExidxDecodeTest, eval_pc_set) {
-  // vsp = vsp + 4
-  data_->push_back(0x00);
-  // vsp = vsp + 12
-  data_->push_back(0x02);
-  // Pop {r15}
-  data_->push_back(0x88);
-  data_->push_back(0x00);
-  // vsp = vsp + 12
-  data_->push_back(0x02);
-  // Finish
-  data_->push_back(0xb0);
-
-  process_memory_.SetData32(0x10010, 0x10);
-
-  ASSERT_TRUE(exidx_->Eval());
-  switch (log_) {
-    case ARM_LOG_NONE:
-      ASSERT_EQ("", GetFakeLogPrint());
-      break;
-    case ARM_LOG_FULL:
-      ASSERT_EQ(
-          "4 unwind vsp = vsp + 4\n"
-          "4 unwind vsp = vsp + 12\n"
-          "4 unwind pop {r15}\n"
-          "4 unwind vsp = vsp + 12\n"
-          "4 unwind finish\n",
-          GetFakeLogPrint());
-      break;
-    case ARM_LOG_BY_REG:
-      exidx_->LogByReg();
-      ASSERT_EQ(
-          "4 unwind cfa = r13 + 32\n"
-          "4 unwind r15 = [cfa - 16]\n",
-          GetFakeLogPrint());
-      break;
-  }
-  ASSERT_EQ(0x10020U, exidx_->cfa());
-  ASSERT_TRUE(exidx_->pc_set());
-  ASSERT_EQ(0x10U, (*exidx_->regs())[15]);
-}
-
-INSTANTIATE_TEST_SUITE_P(Unwindstack, ArmExidxDecodeTest,
-                         ::testing::Values("logging", "register_logging", "no_logging"));
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ArmExidxExtractTest.cpp b/libunwindstack/tests/ArmExidxExtractTest.cpp
deleted file mode 100644
index 79c799c..0000000
--- a/libunwindstack/tests/ArmExidxExtractTest.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <deque>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Log.h>
-
-#include "ArmExidx.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class ArmExidxExtractTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    ResetLogs();
-    elf_memory_.Clear();
-    exidx_ = new ArmExidx(nullptr, &elf_memory_, nullptr);
-    data_ = exidx_->data();
-    data_->clear();
-  }
-
-  void TearDown() override {
-    delete exidx_;
-  }
-
-  ArmExidx* exidx_ = nullptr;
-  std::deque<uint8_t>* data_;
-  MemoryFake elf_memory_;
-};
-
-TEST_F(ArmExidxExtractTest, bad_alignment) {
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x1001));
-  ASSERT_EQ(ARM_STATUS_INVALID_ALIGNMENT, exidx_->status());
-  ASSERT_TRUE(data_->empty());
-}
-
-TEST_F(ArmExidxExtractTest, cant_unwind) {
-  elf_memory_.SetData32(0x1000, 0x7fff2340);
-  elf_memory_.SetData32(0x1004, 1);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x1000));
-  ASSERT_EQ(ARM_STATUS_NO_UNWIND, exidx_->status());
-  ASSERT_TRUE(data_->empty());
-}
-
-TEST_F(ArmExidxExtractTest, compact) {
-  elf_memory_.SetData32(0x4000, 0x7ffa3000);
-  elf_memory_.SetData32(0x4004, 0x80a8b0b0);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x4000));
-  ASSERT_EQ(3U, data_->size());
-  ASSERT_EQ(0xa8, data_->at(0));
-  ASSERT_EQ(0xb0, data_->at(1));
-  ASSERT_EQ(0xb0, data_->at(2));
-
-  // Missing finish gets added.
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x534, 0x7ffa3000);
-  elf_memory_.SetData32(0x538, 0x80a1a2a3);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x534));
-  ASSERT_EQ(4U, data_->size());
-  ASSERT_EQ(0xa1, data_->at(0));
-  ASSERT_EQ(0xa2, data_->at(1));
-  ASSERT_EQ(0xa3, data_->at(2));
-  ASSERT_EQ(0xb0, data_->at(3));
-}
-
-TEST_F(ArmExidxExtractTest, compact_non_zero_personality) {
-  elf_memory_.SetData32(0x4000, 0x7ffa3000);
-
-  uint32_t compact_value = 0x80a8b0b0;
-  for (size_t i = 1; i < 16; i++) {
-    elf_memory_.SetData32(0x4004, compact_value | (i << 24));
-    ASSERT_FALSE(exidx_->ExtractEntryData(0x4000));
-    ASSERT_EQ(ARM_STATUS_INVALID_PERSONALITY, exidx_->status());
-  }
-}
-
-TEST_F(ArmExidxExtractTest, second_read_compact_personality_1_2) {
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x8100f3b0);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(2U, data_->size());
-  ASSERT_EQ(0xf3, data_->at(0));
-  ASSERT_EQ(0xb0, data_->at(1));
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x8200f3f4);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(3U, data_->size());
-  ASSERT_EQ(0xf3, data_->at(0));
-  ASSERT_EQ(0xf4, data_->at(1));
-  ASSERT_EQ(0xb0, data_->at(2));
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x8201f3f4);
-  elf_memory_.SetData32(0x6238, 0x102030b0);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(6U, data_->size());
-  ASSERT_EQ(0xf3, data_->at(0));
-  ASSERT_EQ(0xf4, data_->at(1));
-  ASSERT_EQ(0x10, data_->at(2));
-  ASSERT_EQ(0x20, data_->at(3));
-  ASSERT_EQ(0x30, data_->at(4));
-  ASSERT_EQ(0xb0, data_->at(5));
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x8103f3f4);
-  elf_memory_.SetData32(0x6238, 0x10203040);
-  elf_memory_.SetData32(0x623c, 0x50607080);
-  elf_memory_.SetData32(0x6240, 0x90a0c0d0);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(15U, data_->size());
-  ASSERT_EQ(0xf3, data_->at(0));
-  ASSERT_EQ(0xf4, data_->at(1));
-  ASSERT_EQ(0x10, data_->at(2));
-  ASSERT_EQ(0x20, data_->at(3));
-  ASSERT_EQ(0x30, data_->at(4));
-  ASSERT_EQ(0x40, data_->at(5));
-  ASSERT_EQ(0x50, data_->at(6));
-  ASSERT_EQ(0x60, data_->at(7));
-  ASSERT_EQ(0x70, data_->at(8));
-  ASSERT_EQ(0x80, data_->at(9));
-  ASSERT_EQ(0x90, data_->at(10));
-  ASSERT_EQ(0xa0, data_->at(11));
-  ASSERT_EQ(0xc0, data_->at(12));
-  ASSERT_EQ(0xd0, data_->at(13));
-  ASSERT_EQ(0xb0, data_->at(14));
-}
-
-TEST_F(ArmExidxExtractTest, second_read_compact_personality_illegal) {
-  elf_memory_.SetData32(0x5000, 0x7ffa1e48);
-  elf_memory_.SetData32(0x5004, 0x1230);
-  elf_memory_.SetData32(0x6234, 0x832132b0);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_INVALID_PERSONALITY, exidx_->status());
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x7ffa1e48);
-  elf_memory_.SetData32(0x5004, 0x1230);
-  elf_memory_.SetData32(0x6234, 0x842132b0);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_INVALID_PERSONALITY, exidx_->status());
-}
-
-TEST_F(ArmExidxExtractTest, second_read_offset_is_negative) {
-  elf_memory_.SetData32(0x5000, 0x7ffa1e48);
-  elf_memory_.SetData32(0x5004, 0x7fffb1e0);
-  elf_memory_.SetData32(0x1e4, 0x842132b0);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_INVALID_PERSONALITY, exidx_->status());
-}
-
-TEST_F(ArmExidxExtractTest, second_read_not_compact) {
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x1);
-  elf_memory_.SetData32(0x6238, 0x001122b0);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(3U, data_->size());
-  ASSERT_EQ(0x11, data_->at(0));
-  ASSERT_EQ(0x22, data_->at(1));
-  ASSERT_EQ(0xb0, data_->at(2));
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x2);
-  elf_memory_.SetData32(0x6238, 0x00112233);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(4U, data_->size());
-  ASSERT_EQ(0x11, data_->at(0));
-  ASSERT_EQ(0x22, data_->at(1));
-  ASSERT_EQ(0x33, data_->at(2));
-  ASSERT_EQ(0xb0, data_->at(3));
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x3);
-  elf_memory_.SetData32(0x6238, 0x01112233);
-  elf_memory_.SetData32(0x623c, 0x445566b0);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(7U, data_->size());
-  ASSERT_EQ(0x11, data_->at(0));
-  ASSERT_EQ(0x22, data_->at(1));
-  ASSERT_EQ(0x33, data_->at(2));
-  ASSERT_EQ(0x44, data_->at(3));
-  ASSERT_EQ(0x55, data_->at(4));
-  ASSERT_EQ(0x66, data_->at(5));
-  ASSERT_EQ(0xb0, data_->at(6));
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x3);
-  elf_memory_.SetData32(0x6238, 0x05112233);
-  elf_memory_.SetData32(0x623c, 0x01020304);
-  elf_memory_.SetData32(0x6240, 0x05060708);
-  elf_memory_.SetData32(0x6244, 0x090a0b0c);
-  elf_memory_.SetData32(0x6248, 0x0d0e0f10);
-  elf_memory_.SetData32(0x624c, 0x11121314);
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(24U, data_->size());
-  ASSERT_EQ(0x11, data_->at(0));
-  ASSERT_EQ(0x22, data_->at(1));
-  ASSERT_EQ(0x33, data_->at(2));
-  ASSERT_EQ(0x01, data_->at(3));
-  ASSERT_EQ(0x02, data_->at(4));
-  ASSERT_EQ(0x03, data_->at(5));
-  ASSERT_EQ(0x04, data_->at(6));
-  ASSERT_EQ(0x05, data_->at(7));
-  ASSERT_EQ(0x06, data_->at(8));
-  ASSERT_EQ(0x07, data_->at(9));
-  ASSERT_EQ(0x08, data_->at(10));
-  ASSERT_EQ(0x09, data_->at(11));
-  ASSERT_EQ(0x0a, data_->at(12));
-  ASSERT_EQ(0x0b, data_->at(13));
-  ASSERT_EQ(0x0c, data_->at(14));
-  ASSERT_EQ(0x0d, data_->at(15));
-  ASSERT_EQ(0x0e, data_->at(16));
-  ASSERT_EQ(0x0f, data_->at(17));
-  ASSERT_EQ(0x10, data_->at(18));
-  ASSERT_EQ(0x11, data_->at(19));
-  ASSERT_EQ(0x12, data_->at(20));
-  ASSERT_EQ(0x13, data_->at(21));
-  ASSERT_EQ(0x14, data_->at(22));
-  ASSERT_EQ(0xb0, data_->at(23));
-}
-
-TEST_F(ArmExidxExtractTest, read_failures) {
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_READ_FAILED, exidx_->status());
-  EXPECT_EQ(0x5004U, exidx_->status_address());
-
-  elf_memory_.SetData32(0x5000, 0x100);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_READ_FAILED, exidx_->status());
-  EXPECT_EQ(0x5004U, exidx_->status_address());
-
-  elf_memory_.SetData32(0x5004, 0x100);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_READ_FAILED, exidx_->status());
-  EXPECT_EQ(0x5104U, exidx_->status_address());
-
-  elf_memory_.SetData32(0x5104, 0x1);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_READ_FAILED, exidx_->status());
-  EXPECT_EQ(0x5108U, exidx_->status_address());
-
-  elf_memory_.SetData32(0x5108, 0x01010203);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_READ_FAILED, exidx_->status());
-  EXPECT_EQ(0x510cU, exidx_->status_address());
-}
-
-TEST_F(ArmExidxExtractTest, malformed) {
-  elf_memory_.SetData32(0x5000, 0x100);
-  elf_memory_.SetData32(0x5004, 0x100);
-  elf_memory_.SetData32(0x5104, 0x1);
-  elf_memory_.SetData32(0x5108, 0x06010203);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_MALFORMED, exidx_->status());
-
-  elf_memory_.Clear();
-  elf_memory_.SetData32(0x5000, 0x100);
-  elf_memory_.SetData32(0x5004, 0x100);
-  elf_memory_.SetData32(0x5104, 0x1);
-  elf_memory_.SetData32(0x5108, 0x81060203);
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ(ARM_STATUS_MALFORMED, exidx_->status());
-}
-
-TEST_F(ArmExidxExtractTest, cant_unwind_log) {
-  elf_memory_.SetData32(0x1000, 0x7fff2340);
-  elf_memory_.SetData32(0x1004, 1);
-
-  exidx_->set_log(ARM_LOG_FULL);
-  exidx_->set_log_indent(0);
-  exidx_->set_log_skip_execution(false);
-
-  ASSERT_FALSE(exidx_->ExtractEntryData(0x1000));
-  ASSERT_EQ(ARM_STATUS_NO_UNWIND, exidx_->status());
-
-  ASSERT_EQ("4 unwind Raw Data: 0x00 0x00 0x00 0x01\n"
-            "4 unwind [cantunwind]\n", GetFakeLogPrint());
-}
-
-TEST_F(ArmExidxExtractTest, raw_data_compact) {
-  elf_memory_.SetData32(0x4000, 0x7ffa3000);
-  elf_memory_.SetData32(0x4004, 0x80a8b0b0);
-
-  exidx_->set_log(ARM_LOG_FULL);
-  exidx_->set_log_indent(0);
-  exidx_->set_log_skip_execution(false);
-
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x4000));
-  ASSERT_EQ("4 unwind Raw Data: 0xa8 0xb0 0xb0\n", GetFakeLogPrint());
-}
-
-TEST_F(ArmExidxExtractTest, raw_data_non_compact) {
-  elf_memory_.SetData32(0x5000, 0x1234);
-  elf_memory_.SetData32(0x5004, 0x00001230);
-  elf_memory_.SetData32(0x6234, 0x2);
-  elf_memory_.SetData32(0x6238, 0x00112233);
-
-  exidx_->set_log(ARM_LOG_FULL);
-  exidx_->set_log_indent(0);
-  exidx_->set_log_skip_execution(false);
-
-  ASSERT_TRUE(exidx_->ExtractEntryData(0x5000));
-  ASSERT_EQ("4 unwind Raw Data: 0x11 0x22 0x33 0xb0\n", GetFakeLogPrint());
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DexFileData.h b/libunwindstack/tests/DexFileData.h
deleted file mode 100644
index 6975c68..0000000
--- a/libunwindstack/tests/DexFileData.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef _LIBUNWINDSTACK_DEXFILESDATA_H
-#define _LIBUNWINDSTACK_DEXFILESDATA_H
-
-namespace unwindstack {
-
-// Borrowed from art/dex/dex_file_test.cc.
-static constexpr uint32_t kDexData[] = {
-    0x0a786564, 0x00383330, 0xc98b3ab8, 0xf3749d94, 0xaecca4d8, 0xffc7b09a, 0xdca9ca7f, 0x5be5deab,
-    0x00000220, 0x00000070, 0x12345678, 0x00000000, 0x00000000, 0x0000018c, 0x00000008, 0x00000070,
-    0x00000004, 0x00000090, 0x00000002, 0x000000a0, 0x00000000, 0x00000000, 0x00000003, 0x000000b8,
-    0x00000001, 0x000000d0, 0x00000130, 0x000000f0, 0x00000122, 0x0000012a, 0x00000132, 0x00000146,
-    0x00000151, 0x00000154, 0x00000158, 0x0000016d, 0x00000001, 0x00000002, 0x00000004, 0x00000006,
-    0x00000004, 0x00000002, 0x00000000, 0x00000005, 0x00000002, 0x0000011c, 0x00000000, 0x00000000,
-    0x00010000, 0x00000007, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000,
-    0x00000003, 0x00000000, 0x0000017e, 0x00000000, 0x00010001, 0x00000001, 0x00000173, 0x00000004,
-    0x00021070, 0x000e0000, 0x00010001, 0x00000000, 0x00000178, 0x00000001, 0x0000000e, 0x00000001,
-    0x3c060003, 0x74696e69, 0x4c06003e, 0x6e69614d, 0x4c12003b, 0x6176616a, 0x6e616c2f, 0x624f2f67,
-    0x7463656a, 0x4d09003b, 0x2e6e6961, 0x6176616a, 0x00560100, 0x004c5602, 0x6a4c5b13, 0x2f617661,
-    0x676e616c, 0x7274532f, 0x3b676e69, 0x616d0400, 0x01006e69, 0x000e0700, 0x07000103, 0x0000000e,
-    0x81000002, 0x01f00480, 0x02880901, 0x0000000c, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
-    0x00000008, 0x00000070, 0x00000002, 0x00000004, 0x00000090, 0x00000003, 0x00000002, 0x000000a0,
-    0x00000005, 0x00000003, 0x000000b8, 0x00000006, 0x00000001, 0x000000d0, 0x00002001, 0x00000002,
-    0x000000f0, 0x00001001, 0x00000001, 0x0000011c, 0x00002002, 0x00000008, 0x00000122, 0x00002003,
-    0x00000002, 0x00000173, 0x00002000, 0x00000001, 0x0000017e, 0x00001000, 0x00000001, 0x0000018c,
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_DEXFILESDATA_H
diff --git a/libunwindstack/tests/DexFileTest.cpp b/libunwindstack/tests/DexFileTest.cpp
deleted file mode 100644
index dc935a3..0000000
--- a/libunwindstack/tests/DexFileTest.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <malloc.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <unordered_map>
-
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Memory.h>
-
-#include "DexFile.h"
-#include "DexFileData.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-TEST(DexFileTest, from_file_open_non_exist) {
-  EXPECT_TRUE(DexFileFromFile::Create(0, "/file/does/not/exist") == nullptr);
-}
-
-TEST(DexFileTest, from_file_open_too_small) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(size_t{10}, static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, 10))));
-
-  // Header too small.
-  EXPECT_TRUE(DexFileFromFile::Create(0, tf.path) == nullptr);
-
-  // Header correct, file too small.
-  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));
-  ASSERT_EQ(sizeof(kDexData) - 1,
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData) - 1))));
-  EXPECT_TRUE(DexFileFromFile::Create(0, tf.path) == nullptr);
-}
-
-TEST(DexFileTest, from_file_open) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(sizeof(kDexData),
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData)))));
-
-  EXPECT_TRUE(DexFileFromFile::Create(0, tf.path) != nullptr);
-}
-
-TEST(DexFileTest, from_file_open_non_zero_offset) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(0x100, lseek(tf.fd, 0x100, SEEK_SET));
-  ASSERT_EQ(sizeof(kDexData),
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData)))));
-
-  EXPECT_TRUE(DexFileFromFile::Create(0x100, tf.path) != nullptr);
-}
-
-static constexpr size_t kNumLeakLoops = 5000;
-static constexpr size_t kMaxAllowedLeakBytes = 1024;
-
-static void CheckForLeak(size_t loop, size_t* first_allocated_bytes, size_t* last_allocated_bytes) {
-  size_t allocated_bytes = mallinfo().uordblks;
-  if (*first_allocated_bytes == 0) {
-    *first_allocated_bytes = allocated_bytes;
-  } else if (*last_allocated_bytes > *first_allocated_bytes) {
-    // Check that the total memory did not increase too much over the first loop.
-    ASSERT_LE(*last_allocated_bytes - *first_allocated_bytes, kMaxAllowedLeakBytes)
-        << "Failed in loop " << loop << " first_allocated_bytes " << *first_allocated_bytes
-        << " last_allocated_bytes " << *last_allocated_bytes;
-  }
-  *last_allocated_bytes = allocated_bytes;
-}
-
-TEST(DexFileTest, from_file_no_leak) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(sizeof(kDexData),
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData)))));
-
-  size_t first_allocated_bytes = 0;
-  size_t last_allocated_bytes = 0;
-  for (size_t i = 0; i < kNumLeakLoops; i++) {
-    EXPECT_TRUE(DexFileFromFile::Create(0, tf.path) != nullptr);
-    ASSERT_NO_FATAL_FAILURE(CheckForLeak(i, &first_allocated_bytes, &last_allocated_bytes));
-  }
-}
-
-TEST(DexFileTest, from_memory_fail_too_small_for_header) {
-  MemoryFake memory;
-
-  memory.SetMemory(0x1000, kDexData, 10);
-
-  EXPECT_TRUE(DexFileFromMemory::Create(0x1000, &memory, "") == nullptr);
-}
-
-TEST(DexFileTest, from_memory_fail_too_small_for_data) {
-  MemoryFake memory;
-
-  memory.SetMemory(0x1000, kDexData, sizeof(kDexData) - 2);
-
-  EXPECT_TRUE(DexFileFromMemory::Create(0x1000, &memory, "") == nullptr);
-}
-
-TEST(DexFileTest, from_memory_open) {
-  MemoryFake memory;
-
-  memory.SetMemory(0x1000, kDexData, sizeof(kDexData));
-
-  EXPECT_TRUE(DexFileFromMemory::Create(0x1000, &memory, "") != nullptr);
-}
-
-TEST(DexFileTest, from_memory_no_leak) {
-  MemoryFake memory;
-
-  memory.SetMemory(0x1000, kDexData, sizeof(kDexData));
-
-  size_t first_allocated_bytes = 0;
-  size_t last_allocated_bytes = 0;
-  for (size_t i = 0; i < kNumLeakLoops; i++) {
-    EXPECT_TRUE(DexFileFromMemory::Create(0x1000, &memory, "") != nullptr);
-    ASSERT_NO_FATAL_FAILURE(CheckForLeak(i, &first_allocated_bytes, &last_allocated_bytes));
-  }
-}
-
-TEST(DexFileTest, create_using_file) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(0x500, lseek(tf.fd, 0x500, SEEK_SET));
-  ASSERT_EQ(sizeof(kDexData),
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData)))));
-
-  MemoryFake memory;
-  MapInfo info(nullptr, nullptr, 0, 0x10000, 0, 0x5, tf.path);
-  EXPECT_TRUE(DexFile::Create(0x500, &memory, &info) != nullptr);
-}
-
-TEST(DexFileTest, create_using_file_non_zero_start) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(0x500, lseek(tf.fd, 0x500, SEEK_SET));
-  ASSERT_EQ(sizeof(kDexData),
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData)))));
-
-  MemoryFake memory;
-  MapInfo info(nullptr, nullptr, 0x100, 0x10000, 0, 0x5, tf.path);
-  EXPECT_TRUE(DexFile::Create(0x600, &memory, &info) != nullptr);
-}
-
-TEST(DexFileTest, create_using_file_non_zero_offset) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(0x500, lseek(tf.fd, 0x500, SEEK_SET));
-  ASSERT_EQ(sizeof(kDexData),
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData)))));
-
-  MemoryFake memory;
-  MapInfo info(nullptr, nullptr, 0x100, 0x10000, 0x200, 0x5, tf.path);
-  EXPECT_TRUE(DexFile::Create(0x400, &memory, &info) != nullptr);
-}
-
-TEST(DexFileTest, create_using_memory_empty_file) {
-  MemoryFake memory;
-  memory.SetMemory(0x4000, kDexData, sizeof(kDexData));
-  MapInfo info(nullptr, nullptr, 0x100, 0x10000, 0x200, 0x5, "");
-  EXPECT_TRUE(DexFile::Create(0x4000, &memory, &info) != nullptr);
-}
-
-TEST(DexFileTest, create_using_memory_file_does_not_exist) {
-  MemoryFake memory;
-  memory.SetMemory(0x4000, kDexData, sizeof(kDexData));
-  MapInfo info(nullptr, nullptr, 0x100, 0x10000, 0x200, 0x5, "/does/not/exist");
-  EXPECT_TRUE(DexFile::Create(0x4000, &memory, &info) != nullptr);
-}
-
-TEST(DexFileTest, create_using_memory_file_is_malformed) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_EQ(sizeof(kDexData) - 10,
-            static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData) - 10))));
-
-  MemoryFake memory;
-  memory.SetMemory(0x4000, kDexData, sizeof(kDexData));
-  MapInfo info(nullptr, nullptr, 0x4000, 0x10000, 0x200, 0x5, "/does/not/exist");
-  std::unique_ptr<DexFile> dex_file = DexFile::Create(0x4000, &memory, &info);
-  ASSERT_TRUE(dex_file != nullptr);
-
-  // Check it came from memory by clearing memory and verifying it fails.
-  memory.Clear();
-  dex_file = DexFile::Create(0x4000, &memory, &info);
-  EXPECT_TRUE(dex_file == nullptr);
-}
-
-TEST(DexFileTest, get_method) {
-  MemoryFake memory;
-  memory.SetMemory(0x4000, kDexData, sizeof(kDexData));
-  MapInfo info(nullptr, nullptr, 0x100, 0x10000, 0x200, 0x5, "");
-  std::unique_ptr<DexFile> dex_file(DexFile::Create(0x4000, &memory, &info));
-  ASSERT_TRUE(dex_file != nullptr);
-
-  std::string method;
-  uint64_t method_offset;
-  ASSERT_TRUE(dex_file->GetMethodInformation(0x102, &method, &method_offset));
-  EXPECT_EQ("Main.<init>", method);
-  EXPECT_EQ(2U, method_offset);
-
-  ASSERT_TRUE(dex_file->GetMethodInformation(0x118, &method, &method_offset));
-  EXPECT_EQ("Main.main", method);
-  EXPECT_EQ(0U, method_offset);
-}
-
-TEST(DexFileTest, get_method_empty) {
-  MemoryFake memory;
-  memory.SetMemory(0x4000, kDexData, sizeof(kDexData));
-  MapInfo info(nullptr, nullptr, 0x100, 0x10000, 0x200, 0x5, "");
-  std::unique_ptr<DexFile> dex_file(DexFile::Create(0x4000, &memory, &info));
-  ASSERT_TRUE(dex_file != nullptr);
-
-  std::string method;
-  uint64_t method_offset;
-  EXPECT_FALSE(dex_file->GetMethodInformation(0x100000, &method, &method_offset));
-
-  EXPECT_FALSE(dex_file->GetMethodInformation(0x98, &method, &method_offset));
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DexFilesTest.cpp b/libunwindstack/tests/DexFilesTest.cpp
deleted file mode 100644
index 477cf8e..0000000
--- a/libunwindstack/tests/DexFilesTest.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <elf.h>
-#include <string.h>
-
-#include <memory>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DexFiles.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#include "DexFileData.h"
-#include "ElfFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class DexFilesTest : public ::testing::Test {
- protected:
-  void CreateFakeElf(MapInfo* map_info, uint64_t global_offset, uint64_t data_offset,
-                     uint64_t data_vaddr, uint64_t data_size) {
-    MemoryFake* memory = new MemoryFake;
-    ElfFake* elf = new ElfFake(memory);
-    elf->FakeSetValid(true);
-    ElfInterfaceFake* interface = new ElfInterfaceFake(memory);
-    elf->FakeSetInterface(interface);
-
-    interface->FakeSetGlobalVariable("__dex_debug_descriptor", global_offset);
-    interface->FakeSetDataOffset(data_offset);
-    interface->FakeSetDataVaddrStart(data_vaddr);
-    interface->FakeSetDataVaddrEnd(data_vaddr + data_size);
-    map_info->elf.reset(elf);
-  }
-
-  void Init(ArchEnum arch) {
-    dex_files_.reset(new DexFiles(process_memory_));
-    dex_files_->SetArch(arch);
-
-    maps_.reset(
-        new BufferMaps("1000-4000 ---s 00000000 00:00 0 /fake/elf\n"
-                       "4000-6000 r--s 00000000 00:00 0 /fake/elf\n"
-                       "6000-8000 -wxs 00002000 00:00 0 /fake/elf\n"
-                       "a000-c000 r--p 00000000 00:00 0 /fake/elf2\n"
-                       "c000-f000 rw-p 00002000 00:00 0 /fake/elf2\n"
-                       "f000-11000 r--p 00000000 00:00 0 /fake/elf3\n"
-                       "100000-110000 rw-p 00f1000 00:00 0 /fake/elf3\n"
-                       "200000-210000 rw-p 0002000 00:00 0 /fake/elf3\n"
-                       "300000-400000 rw-p 0003000 00:00 0 /fake/elf3\n"
-                       "500000-501000 r--p 0000000 00:00 0 /fake/elf4\n"
-                       "501000-502000 ---p 0000000 00:00 0\n"
-                       "503000-510000 rw-p 0003000 00:00 0 /fake/elf4\n"
-                       "510000-520000 rw-p 0010000 00:00 0 /fake/elf4\n"));
-    ASSERT_TRUE(maps_->Parse());
-
-    // Global variable in a section that is not readable.
-    MapInfo* map_info = maps_->Get(kMapGlobalNonReadable);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0x2800, 0x2000, 0x2000, 0x3000);
-
-    // Global variable not set by default.
-    map_info = maps_->Get(kMapGlobalSetToZero);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0x2800, 0x2000, 0x2000, 0x3000);
-
-    // Global variable set in this map.
-    map_info = maps_->Get(kMapGlobal);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0xf1800, 0xf1000, 0xf1000, 0x10000);
-
-    // Global variable set in this map, but there is an empty map before rw map.
-    map_info = maps_->Get(kMapGlobalAfterEmpty);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0x3800, 0x3000, 0x3000, 0xd000);
-  }
-
-  void SetUp() override {
-    memory_ = new MemoryFake;
-    process_memory_.reset(memory_);
-
-    Init(ARCH_ARM);
-  }
-
-  void WriteDescriptor32(uint64_t addr, uint32_t head);
-  void WriteDescriptor64(uint64_t addr, uint64_t head);
-  void WriteEntry32(uint64_t entry_addr, uint32_t next, uint32_t prev, uint32_t dex_file);
-  void WriteEntry64(uint64_t entry_addr, uint64_t next, uint64_t prev, uint64_t dex_file);
-  void WriteDex(uint64_t dex_file);
-
-  static constexpr size_t kMapGlobalNonReadable = 2;
-  static constexpr size_t kMapGlobalSetToZero = 3;
-  static constexpr size_t kMapGlobal = 5;
-  static constexpr size_t kMapGlobalRw = 6;
-  static constexpr size_t kMapDexFileEntries = 7;
-  static constexpr size_t kMapDexFiles = 8;
-  static constexpr size_t kMapGlobalAfterEmpty = 9;
-  static constexpr size_t kMapDexFilesAfterEmpty = 12;
-
-  std::shared_ptr<Memory> process_memory_;
-  MemoryFake* memory_;
-  std::unique_ptr<DexFiles> dex_files_;
-  std::unique_ptr<BufferMaps> maps_;
-};
-
-void DexFilesTest::WriteDescriptor32(uint64_t addr, uint32_t head) {
-  //   void* first_entry_
-  memory_->SetData32(addr + 12, head);
-}
-
-void DexFilesTest::WriteDescriptor64(uint64_t addr, uint64_t head) {
-  //   void* first_entry_
-  memory_->SetData64(addr + 16, head);
-}
-
-void DexFilesTest::WriteEntry32(uint64_t entry_addr, uint32_t next, uint32_t prev,
-                                uint32_t dex_file) {
-  // Format of the 32 bit DEXFileEntry structure:
-  //   uint32_t next
-  memory_->SetData32(entry_addr, next);
-  //   uint32_t prev
-  memory_->SetData32(entry_addr + 4, prev);
-  //   uint32_t dex_file
-  memory_->SetData32(entry_addr + 8, dex_file);
-}
-
-void DexFilesTest::WriteEntry64(uint64_t entry_addr, uint64_t next, uint64_t prev,
-                                uint64_t dex_file) {
-  // Format of the 64 bit DEXFileEntry structure:
-  //   uint64_t next
-  memory_->SetData64(entry_addr, next);
-  //   uint64_t prev
-  memory_->SetData64(entry_addr + 8, prev);
-  //   uint64_t dex_file
-  memory_->SetData64(entry_addr + 16, dex_file);
-}
-
-void DexFilesTest::WriteDex(uint64_t dex_file) {
-  memory_->SetMemory(dex_file, kDexData, sizeof(kDexData) * sizeof(uint32_t));
-}
-
-TEST_F(DexFilesTest, get_method_information_invalid) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFileEntries);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0, &method_name, &method_offset);
-  EXPECT_EQ("nothing", method_name);
-  EXPECT_EQ(0x124U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_32) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  WriteDescriptor32(0x100800, 0x200000);
-  WriteEntry32(0x200000, 0, 0, 0x300000);
-  WriteDex(0x300000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(0U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_64) {
-  Init(ARCH_ARM64);
-
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  WriteDescriptor64(0x100800, 0x200000);
-  WriteEntry64(0x200000, 0, 0, 0x301000);
-  WriteDex(0x301000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x301102, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(2U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_not_first_entry_32) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  WriteDescriptor32(0x100800, 0x200000);
-  WriteEntry32(0x200000, 0x200100, 0, 0x100000);
-  WriteEntry32(0x200100, 0, 0x200000, 0x300000);
-  WriteDex(0x300000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300104, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(4U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_not_first_entry_64) {
-  Init(ARCH_ARM64);
-
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  WriteDescriptor64(0x100800, 0x200000);
-  WriteEntry64(0x200000, 0x200100, 0, 0x100000);
-  WriteEntry64(0x200100, 0, 0x200000, 0x300000);
-  WriteDex(0x300000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300106, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(6U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_cached) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  WriteDescriptor32(0x100800, 0x200000);
-  WriteEntry32(0x200000, 0, 0, 0x300000);
-  WriteDex(0x300000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(0U, method_offset);
-
-  // Clear all memory and make sure that data is acquired from the cache.
-  memory_->Clear();
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(0U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_search_libs) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  WriteDescriptor32(0x100800, 0x200000);
-  WriteEntry32(0x200000, 0x200100, 0, 0x100000);
-  WriteEntry32(0x200100, 0, 0x200000, 0x300000);
-  WriteDex(0x300000);
-
-  // Only search a given named list of libs.
-  std::vector<std::string> libs{"libart.so"};
-  dex_files_.reset(new DexFiles(process_memory_, libs));
-  dex_files_->SetArch(ARCH_ARM);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300104, &method_name, &method_offset);
-  EXPECT_EQ("nothing", method_name);
-  EXPECT_EQ(0x124U, method_offset);
-
-  MapInfo* map_info = maps_->Get(kMapGlobal);
-  map_info->name = "/system/lib/libart.so";
-  dex_files_.reset(new DexFiles(process_memory_, libs));
-  dex_files_->SetArch(ARCH_ARM);
-  // Set the rw map to the same name or this will not scan this entry.
-  map_info = maps_->Get(kMapGlobalRw);
-  map_info->name = "/system/lib/libart.so";
-  // Make sure that clearing out copy of the libs doesn't affect the
-  // DexFiles object.
-  libs.clear();
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300104, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(4U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_global_skip_zero_32) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  // First global variable found, but value is zero.
-  WriteDescriptor32(0xc800, 0);
-
-  WriteDescriptor32(0x100800, 0x200000);
-  WriteEntry32(0x200000, 0, 0, 0x300000);
-  WriteDex(0x300000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(0U, method_offset);
-
-  // Verify that second is ignored when first is set to non-zero
-  dex_files_.reset(new DexFiles(process_memory_));
-  dex_files_->SetArch(ARCH_ARM);
-  method_name = "fail";
-  method_offset = 0x123;
-  WriteDescriptor32(0xc800, 0x100000);
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("fail", method_name);
-  EXPECT_EQ(0x123U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_global_skip_zero_64) {
-  Init(ARCH_ARM64);
-
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFiles);
-
-  // First global variable found, but value is zero.
-  WriteDescriptor64(0xc800, 0);
-
-  WriteDescriptor64(0x100800, 0x200000);
-  WriteEntry64(0x200000, 0, 0, 0x300000);
-  WriteDex(0x300000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(0U, method_offset);
-
-  // Verify that second is ignored when first is set to non-zero
-  dex_files_.reset(new DexFiles(process_memory_));
-  dex_files_->SetArch(ARCH_ARM64);
-  method_name = "fail";
-  method_offset = 0x123;
-  WriteDescriptor64(0xc800, 0x100000);
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x300100, &method_name, &method_offset);
-  EXPECT_EQ("fail", method_name);
-  EXPECT_EQ(0x123U, method_offset);
-}
-
-TEST_F(DexFilesTest, get_method_information_with_empty_map) {
-  std::string method_name = "nothing";
-  uint64_t method_offset = 0x124;
-  MapInfo* info = maps_->Get(kMapDexFilesAfterEmpty);
-
-  WriteDescriptor32(0x503800, 0x506000);
-  WriteEntry32(0x506000, 0, 0, 0x510000);
-  WriteDex(0x510000);
-
-  dex_files_->GetMethodInformation(maps_.get(), info, 0x510100, &method_name, &method_offset);
-  EXPECT_EQ("Main.<init>", method_name);
-  EXPECT_EQ(0U, method_offset);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfCfaLogTest.cpp b/libunwindstack/tests/DwarfCfaLogTest.cpp
deleted file mode 100644
index def4088..0000000
--- a/libunwindstack/tests/DwarfCfaLogTest.cpp
+++ /dev/null
@@ -1,779 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <memory>
-#include <type_traits>
-#include <unordered_map>
-
-#include <android-base/stringprintf.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/DwarfStructs.h>
-#include <unwindstack/Log.h>
-
-#include "DwarfCfa.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class DwarfCfaLogTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    ResetLogs();
-    memory_.Clear();
-
-    dmem_.reset(new DwarfMemory(&memory_));
-
-    cie_.cfa_instructions_offset = 0x1000;
-    cie_.cfa_instructions_end = 0x1030;
-    // These two values should be different to distinguish between
-    // operations that deal with code versus data.
-    cie_.code_alignment_factor = 4;
-    cie_.data_alignment_factor = 8;
-
-    fde_.cfa_instructions_offset = 0x2000;
-    fde_.cfa_instructions_end = 0x2030;
-    fde_.pc_start = 0x2000;
-    fde_.pc_end = 0x2000;
-    fde_.pc_end = 0x10000;
-    fde_.cie = &cie_;
-    cfa_.reset(new DwarfCfa<TypeParam>(dmem_.get(), &fde_));
-  }
-
-  MemoryFake memory_;
-  std::unique_ptr<DwarfMemory> dmem_;
-  std::unique_ptr<DwarfCfa<TypeParam>> cfa_;
-  DwarfCie cie_;
-  DwarfFde fde_;
-};
-TYPED_TEST_SUITE_P(DwarfCfaLogTest);
-
-// NOTE: All class variable references have to be prefaced with this->.
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_illegal) {
-  for (uint8_t i = 0x17; i < 0x3f; i++) {
-    if (i == 0x2e || i == 0x2f) {
-      // Skip gnu extension ops.
-      continue;
-    }
-    this->memory_.SetMemory(0x2000, std::vector<uint8_t>{i});
-
-    ResetLogs();
-    ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2000, 0x2001));
-    std::string expected = "4 unwind Illegal\n";
-    expected += android::base::StringPrintf("4 unwind Raw Data: 0x%02x\n", i);
-    ASSERT_EQ(expected, GetFakeLogPrint());
-    ASSERT_EQ("", GetFakeLogBuf());
-  }
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_nop) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x00});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2000, 0x2001));
-  std::string expected =
-      "4 unwind DW_CFA_nop\n"
-      "4 unwind Raw Data: 0x00\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_offset) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x83, 0x04});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2000, 0x2002));
-  std::string expected =
-      "4 unwind DW_CFA_offset register(3) 4\n"
-      "4 unwind Raw Data: 0x83 0x04\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x2100, std::vector<uint8_t>{0x83, 0x84, 0x01});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2100, 0x2103));
-  expected =
-      "4 unwind DW_CFA_offset register(3) 132\n"
-      "4 unwind Raw Data: 0x83 0x84 0x01\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_offset_extended) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x05, 0x03, 0x02});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x500, 0x503));
-  std::string expected =
-      "4 unwind DW_CFA_offset_extended register(3) 2\n"
-      "4 unwind Raw Data: 0x05 0x03 0x02\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x1500, std::vector<uint8_t>{0x05, 0x81, 0x01, 0x82, 0x12});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x1500, 0x1505));
-  expected =
-      "4 unwind DW_CFA_offset_extended register(129) 2306\n"
-      "4 unwind Raw Data: 0x05 0x81 0x01 0x82 0x12\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_offset_extended_sf) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x11, 0x05, 0x10});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x500, 0x503));
-  std::string expected =
-      "4 unwind DW_CFA_offset_extended_sf register(5) 16\n"
-      "4 unwind Raw Data: 0x11 0x05 0x10\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Check a negative value for the offset.
-  ResetLogs();
-  this->memory_.SetMemory(0x1500, std::vector<uint8_t>{0x11, 0x86, 0x01, 0xff, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x1500, 0x1505));
-  expected =
-      "4 unwind DW_CFA_offset_extended_sf register(134) -1\n"
-      "4 unwind Raw Data: 0x11 0x86 0x01 0xff 0x7f\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_restore) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0xc2});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2000, 0x2001));
-  std::string expected =
-      "4 unwind DW_CFA_restore register(2)\n"
-      "4 unwind Raw Data: 0xc2\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x3000, std::vector<uint8_t>{0x82, 0x04, 0xc2});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x3000, 0x3003));
-  expected =
-      "4 unwind DW_CFA_offset register(2) 4\n"
-      "4 unwind Raw Data: 0x82 0x04\n"
-      "4 unwind DW_CFA_restore register(2)\n"
-      "4 unwind Raw Data: 0xc2\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_restore_extended) {
-  this->memory_.SetMemory(0x4000, std::vector<uint8_t>{0x06, 0x08});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x4000, 0x4002));
-  std::string expected =
-      "4 unwind DW_CFA_restore_extended register(8)\n"
-      "4 unwind Raw Data: 0x06 0x08\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x05, 0x82, 0x02, 0x04, 0x06, 0x82, 0x02});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x5000, 0x5007));
-  expected =
-      "4 unwind DW_CFA_offset_extended register(258) 4\n"
-      "4 unwind Raw Data: 0x05 0x82 0x02 0x04\n"
-      "4 unwind DW_CFA_restore_extended register(258)\n"
-      "4 unwind Raw Data: 0x06 0x82 0x02\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_set_loc) {
-  uint8_t buffer[1 + sizeof(TypeParam)];
-  buffer[0] = 0x1;
-  TypeParam address;
-  std::string raw_data("Raw Data: 0x01 ");
-  std::string address_str;
-  if (std::is_same<TypeParam, uint32_t>::value) {
-    address = 0x81234578U;
-    address_str = "0x81234578";
-    raw_data += "0x78 0x45 0x23 0x81";
-  } else {
-    address = 0x8123456712345678ULL;
-    address_str = "0x8123456712345678";
-    raw_data += "0x78 0x56 0x34 0x12 0x67 0x45 0x23 0x81";
-  }
-  memcpy(&buffer[1], &address, sizeof(address));
-
-  this->memory_.SetMemory(0x50, buffer, sizeof(buffer));
-  ResetLogs();
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x50, 0x51 + sizeof(TypeParam)));
-  std::string expected = "4 unwind DW_CFA_set_loc " + address_str + "\n";
-  expected += "4 unwind " + raw_data + "\n";
-  expected += "4 unwind \n";
-  expected += "4 unwind PC " + address_str + "\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Check for a set going back.
-  ResetLogs();
-  this->fde_.pc_start = address + 0x10;
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x50, 0x51 + sizeof(TypeParam)));
-  expected = "4 unwind DW_CFA_set_loc " + address_str + "\n";
-  expected += "4 unwind " + raw_data + "\n";
-  expected += "4 unwind \n";
-  expected += "4 unwind PC " + address_str + "\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_advance_loc) {
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x44});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x201));
-  std::string expected =
-      "4 unwind DW_CFA_advance_loc 4\n"
-      "4 unwind Raw Data: 0x44\n"
-      "4 unwind \n"
-      "4 unwind PC 0x2010\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_advance_loc1) {
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x02, 0x04});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x202));
-  std::string expected =
-      "4 unwind DW_CFA_advance_loc1 4\n"
-      "4 unwind Raw Data: 0x02 0x04\n"
-      "4 unwind \n"
-      "4 unwind PC 0x2004\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_advance_loc2) {
-  this->memory_.SetMemory(0x600, std::vector<uint8_t>{0x03, 0x04, 0x03});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x600, 0x603));
-  std::string expected =
-      "4 unwind DW_CFA_advance_loc2 772\n"
-      "4 unwind Raw Data: 0x03 0x04 0x03\n"
-      "4 unwind \n"
-      "4 unwind PC 0x2304\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_advance_loc4) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x04, 0x04, 0x03, 0x02, 0x01});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x500, 0x505));
-  std::string expected =
-      "4 unwind DW_CFA_advance_loc4 16909060\n"
-      "4 unwind Raw Data: 0x04 0x04 0x03 0x02 0x01\n"
-      "4 unwind \n"
-      "4 unwind PC 0x1022304\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_undefined) {
-  this->memory_.SetMemory(0xa00, std::vector<uint8_t>{0x07, 0x09});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0xa00, 0xa02));
-  std::string expected =
-      "4 unwind DW_CFA_undefined register(9)\n"
-      "4 unwind Raw Data: 0x07 0x09\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  dwarf_loc_regs_t cie_loc_regs;
-  this->memory_.SetMemory(0x1a00, std::vector<uint8_t>{0x07, 0x81, 0x01});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x1a00, 0x1a03));
-  expected =
-      "4 unwind DW_CFA_undefined register(129)\n"
-      "4 unwind Raw Data: 0x07 0x81 0x01\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_same) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x08, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x102));
-  std::string expected =
-      "4 unwind DW_CFA_same_value register(127)\n"
-      "4 unwind Raw Data: 0x08 0x7f\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x2100, std::vector<uint8_t>{0x08, 0xff, 0x01});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2100, 0x2103));
-  expected =
-      "4 unwind DW_CFA_same_value register(255)\n"
-      "4 unwind Raw Data: 0x08 0xff 0x01\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_register) {
-  this->memory_.SetMemory(0x300, std::vector<uint8_t>{0x09, 0x02, 0x01});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x300, 0x303));
-  std::string expected =
-      "4 unwind DW_CFA_register register(2) register(1)\n"
-      "4 unwind Raw Data: 0x09 0x02 0x01\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x4300, std::vector<uint8_t>{0x09, 0xff, 0x01, 0xff, 0x03});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x4300, 0x4305));
-  expected =
-      "4 unwind DW_CFA_register register(255) register(511)\n"
-      "4 unwind Raw Data: 0x09 0xff 0x01 0xff 0x03\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_state) {
-  this->memory_.SetMemory(0x300, std::vector<uint8_t>{0x0a});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x300, 0x301));
-
-  std::string expected =
-      "4 unwind DW_CFA_remember_state\n"
-      "4 unwind Raw Data: 0x0a\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x4300, std::vector<uint8_t>{0x0b});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x4300, 0x4301));
-
-  expected =
-      "4 unwind DW_CFA_restore_state\n"
-      "4 unwind Raw Data: 0x0b\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_state_cfa_offset_restore) {
-  this->memory_.SetMemory(0x3000, std::vector<uint8_t>{0x0a, 0x0e, 0x40, 0x0b});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x3000, 0x3004));
-
-  std::string expected =
-      "4 unwind DW_CFA_remember_state\n"
-      "4 unwind Raw Data: 0x0a\n"
-      "4 unwind DW_CFA_def_cfa_offset 64\n"
-      "4 unwind Raw Data: 0x0e 0x40\n"
-      "4 unwind DW_CFA_restore_state\n"
-      "4 unwind Raw Data: 0x0b\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_def_cfa) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0c, 0x7f, 0x74});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x103));
-
-  std::string expected =
-      "4 unwind DW_CFA_def_cfa register(127) 116\n"
-      "4 unwind Raw Data: 0x0c 0x7f 0x74\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x0c, 0xff, 0x02, 0xf4, 0x04});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x205));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa register(383) 628\n"
-      "4 unwind Raw Data: 0x0c 0xff 0x02 0xf4 0x04\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_def_cfa_sf) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x12, 0x30, 0x25});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x103));
-
-  std::string expected =
-      "4 unwind DW_CFA_def_cfa_sf register(48) 37\n"
-      "4 unwind Raw Data: 0x12 0x30 0x25\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Test a negative value.
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x12, 0xa3, 0x01, 0xfa, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x205));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa_sf register(163) -6\n"
-      "4 unwind Raw Data: 0x12 0xa3 0x01 0xfa 0x7f\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_def_cfa_register) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0d, 0x72});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x102));
-
-  std::string expected =
-      "4 unwind DW_CFA_def_cfa_register register(114)\n"
-      "4 unwind Raw Data: 0x0d 0x72\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x0d, 0xf9, 0x20});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x203));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa_register register(4217)\n"
-      "4 unwind Raw Data: 0x0d 0xf9 0x20\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_def_cfa_offset) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0e, 0x59});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x102));
-
-  std::string expected =
-      "4 unwind DW_CFA_def_cfa_offset 89\n"
-      "4 unwind Raw Data: 0x0e 0x59\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x102));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa_offset 89\n"
-      "4 unwind Raw Data: 0x0e 0x59\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x0e, 0xd4, 0x0a});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x203));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa_offset 1364\n"
-      "4 unwind Raw Data: 0x0e 0xd4 0x0a\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_def_cfa_offset_sf) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x13, 0x23});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x102));
-
-  std::string expected =
-      "4 unwind DW_CFA_def_cfa_offset_sf 35\n"
-      "4 unwind Raw Data: 0x13 0x23\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x102));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa_offset_sf 35\n"
-      "4 unwind Raw Data: 0x13 0x23\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Negative offset.
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x13, 0xf6, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x203));
-
-  expected =
-      "4 unwind DW_CFA_def_cfa_offset_sf -10\n"
-      "4 unwind Raw Data: 0x13 0xf6 0x7f\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_def_cfa_expression) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0f, 0x04, 0x01, 0x02, 0x04, 0x05});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x106));
-
-  std::string expected =
-      "4 unwind DW_CFA_def_cfa_expression 4\n"
-      "4 unwind Raw Data: 0x0f 0x04 0x01 0x02 0x04 0x05\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0x01\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0x02\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0x04\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0x05\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  std::vector<uint8_t> ops{0x0f, 0x81, 0x01};
-  expected = "4 unwind Raw Data: 0x0f 0x81 0x01";
-  std::string op_string;
-  for (uint8_t i = 3; i < 132; i++) {
-    ops.push_back(0x05);
-    op_string +=
-        "4 unwind   Illegal\n"
-        "4 unwind   Raw Data: 0x05\n";
-    expected += " 0x05";
-    if (((i + 1) % 10) == 0) {
-      expected += "\n4 unwind Raw Data:";
-    }
-  }
-  expected += '\n';
-  this->memory_.SetMemory(0x200, ops);
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x284));
-
-  expected = "4 unwind DW_CFA_def_cfa_expression 129\n" + expected;
-  ASSERT_EQ(expected + op_string, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_expression) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x10, 0x04, 0x02, 0xc0, 0xc1});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x105));
-
-  std::string expected =
-      "4 unwind DW_CFA_expression register(4) 2\n"
-      "4 unwind Raw Data: 0x10 0x04 0x02 0xc0 0xc1\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0xc0\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0xc1\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  std::vector<uint8_t> ops{0x10, 0xff, 0x01, 0x82, 0x01};
-  expected = "4 unwind Raw Data: 0x10 0xff 0x01 0x82 0x01";
-  std::string op_string;
-  for (uint8_t i = 5; i < 135; i++) {
-    ops.push_back(0xa0 + (i - 5) % 96);
-    op_string += "4 unwind   Illegal\n";
-    op_string += android::base::StringPrintf("4 unwind   Raw Data: 0x%02x\n", ops.back());
-    expected += android::base::StringPrintf(" 0x%02x", ops.back());
-    if (((i + 1) % 10) == 0) {
-      expected += "\n4 unwind Raw Data:";
-    }
-  }
-  expected = "4 unwind DW_CFA_expression register(255) 130\n" + expected + "\n";
-
-  this->memory_.SetMemory(0x200, ops);
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x200, 0x287));
-
-  ASSERT_EQ(expected + op_string, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_val_offset) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x14, 0x45, 0x54});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x103));
-
-  std::string expected =
-      "4 unwind DW_CFA_val_offset register(69) 84\n"
-      "4 unwind Raw Data: 0x14 0x45 0x54\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x400, std::vector<uint8_t>{0x14, 0xa2, 0x02, 0xb4, 0x05});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x400, 0x405));
-
-  expected =
-      "4 unwind DW_CFA_val_offset register(290) 692\n"
-      "4 unwind Raw Data: 0x14 0xa2 0x02 0xb4 0x05\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_val_offset_sf) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x15, 0x56, 0x12});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x103));
-
-  std::string expected =
-      "4 unwind DW_CFA_val_offset_sf register(86) 18\n"
-      "4 unwind Raw Data: 0x15 0x56 0x12\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Negative value.
-  ResetLogs();
-  this->memory_.SetMemory(0xa00, std::vector<uint8_t>{0x15, 0xff, 0x01, 0xc0, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0xa00, 0xa05));
-
-  expected =
-      "4 unwind DW_CFA_val_offset_sf register(255) -64\n"
-      "4 unwind Raw Data: 0x15 0xff 0x01 0xc0 0x7f\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_val_expression) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x16, 0x05, 0x02, 0xb0, 0xb1});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x100, 0x105));
-
-  std::string expected =
-      "4 unwind DW_CFA_val_expression register(5) 2\n"
-      "4 unwind Raw Data: 0x16 0x05 0x02 0xb0 0xb1\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0xb0\n"
-      "4 unwind   Illegal\n"
-      "4 unwind   Raw Data: 0xb1\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  std::vector<uint8_t> ops{0x16, 0x83, 0x10, 0xa8, 0x01};
-  expected = "4 unwind Raw Data: 0x16 0x83 0x10 0xa8 0x01";
-  std::string op_string;
-  for (uint8_t i = 0; i < 168; i++) {
-    ops.push_back(0xa0 + (i % 96));
-    op_string += "4 unwind   Illegal\n";
-    op_string += android::base::StringPrintf("4 unwind   Raw Data: 0x%02x\n", ops.back());
-    expected += android::base::StringPrintf(" 0x%02x", ops.back());
-    if (((i + 6) % 10) == 0) {
-      expected += "\n4 unwind Raw Data:";
-    }
-  }
-  expected = "4 unwind DW_CFA_val_expression register(2051) 168\n" + expected + "\n";
-
-  this->memory_.SetMemory(0xa00, ops);
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0xa00, 0xaad));
-
-  ASSERT_EQ(expected + op_string, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_gnu_args_size) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x2e, 0x04});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x2000, 0x2002));
-
-  std::string expected =
-      "4 unwind DW_CFA_GNU_args_size 4\n"
-      "4 unwind Raw Data: 0x2e 0x04\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x2e, 0xa4, 0x80, 0x04});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x5000, 0x5004));
-
-  expected =
-      "4 unwind DW_CFA_GNU_args_size 65572\n"
-      "4 unwind Raw Data: 0x2e 0xa4 0x80 0x04\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_gnu_negative_offset_extended) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x2f, 0x08, 0x10});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x500, 0x503));
-
-  std::string expected =
-      "4 unwind DW_CFA_GNU_negative_offset_extended register(8) 16\n"
-      "4 unwind Raw Data: 0x2f 0x08 0x10\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x1500, std::vector<uint8_t>{0x2f, 0x81, 0x02, 0xff, 0x01});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x1500, 0x1505));
-
-  expected =
-      "4 unwind DW_CFA_GNU_negative_offset_extended register(257) 255\n"
-      "4 unwind Raw Data: 0x2f 0x81 0x02 0xff 0x01\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaLogTest, cfa_register_override) {
-  this->memory_.SetMemory(0x300, std::vector<uint8_t>{0x09, 0x02, 0x01, 0x09, 0x02, 0x04});
-
-  ASSERT_TRUE(this->cfa_->Log(0, this->fde_.pc_start, 0x300, 0x306));
-
-  std::string expected =
-      "4 unwind DW_CFA_register register(2) register(1)\n"
-      "4 unwind Raw Data: 0x09 0x02 0x01\n"
-      "4 unwind DW_CFA_register register(2) register(4)\n"
-      "4 unwind Raw Data: 0x09 0x02 0x04\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfCfaLogTest, cfa_illegal, cfa_nop, cfa_offset, cfa_offset_extended,
-                            cfa_offset_extended_sf, cfa_restore, cfa_restore_extended, cfa_set_loc,
-                            cfa_advance_loc, cfa_advance_loc1, cfa_advance_loc2, cfa_advance_loc4,
-                            cfa_undefined, cfa_same, cfa_register, cfa_state,
-                            cfa_state_cfa_offset_restore, cfa_def_cfa, cfa_def_cfa_sf,
-                            cfa_def_cfa_register, cfa_def_cfa_offset, cfa_def_cfa_offset_sf,
-                            cfa_def_cfa_expression, cfa_expression, cfa_val_offset,
-                            cfa_val_offset_sf, cfa_val_expression, cfa_gnu_args_size,
-                            cfa_gnu_negative_offset_extended, cfa_register_override);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfCfaLogTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfCfaLogTest, DwarfCfaLogTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfCfaTest.cpp b/libunwindstack/tests/DwarfCfaTest.cpp
deleted file mode 100644
index 9c6ab05..0000000
--- a/libunwindstack/tests/DwarfCfaTest.cpp
+++ /dev/null
@@ -1,968 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <memory>
-#include <unordered_map>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/DwarfStructs.h>
-#include <unwindstack/Log.h>
-
-#include "DwarfCfa.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class DwarfCfaTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    ResetLogs();
-    memory_.Clear();
-
-    dmem_.reset(new DwarfMemory(&memory_));
-
-    cie_.cfa_instructions_offset = 0x1000;
-    cie_.cfa_instructions_end = 0x1030;
-    // These two values should be different to distinguish between
-    // operations that deal with code versus data.
-    cie_.code_alignment_factor = 4;
-    cie_.data_alignment_factor = 8;
-
-    fde_.cfa_instructions_offset = 0x2000;
-    fde_.cfa_instructions_end = 0x2030;
-    fde_.pc_start = 0x2000;
-    fde_.cie = &cie_;
-
-    cfa_.reset(new DwarfCfa<TypeParam>(dmem_.get(), &fde_));
-  }
-
-  MemoryFake memory_;
-  std::unique_ptr<DwarfMemory> dmem_;
-  std::unique_ptr<DwarfCfa<TypeParam>> cfa_;
-  DwarfCie cie_;
-  DwarfFde fde_;
-};
-TYPED_TEST_SUITE_P(DwarfCfaTest);
-
-// NOTE: All test class variables need to be referenced as this->.
-
-TYPED_TEST_P(DwarfCfaTest, cfa_illegal) {
-  for (uint8_t i = 0x17; i < 0x3f; i++) {
-    if (i == 0x2e || i == 0x2f) {
-      // Skip gnu extension ops.
-      continue;
-    }
-    this->memory_.SetMemory(0x2000, std::vector<uint8_t>{i});
-    dwarf_loc_regs_t loc_regs;
-
-    ASSERT_FALSE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2001, &loc_regs));
-    ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->cfa_->LastErrorCode());
-    ASSERT_EQ(0x2001U, this->dmem_->cur_offset());
-
-    ASSERT_EQ("", GetFakeLogPrint());
-    ASSERT_EQ("", GetFakeLogBuf());
-  }
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_nop) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x00});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2001, &loc_regs));
-  ASSERT_EQ(0x2001U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-// This test needs to be examined.
-TYPED_TEST_P(DwarfCfaTest, cfa_offset) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x83, 0x04});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2002, &loc_regs));
-  ASSERT_EQ(0x2002U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(3);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(32U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x2100, std::vector<uint8_t>{0x83, 0x84, 0x01});
-  loc_regs.clear();
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2100, 0x2103, &loc_regs));
-  ASSERT_EQ(0x2103U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(3);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(1056U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_offset_extended) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x05, 0x03, 0x02});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x500, 0x503, &loc_regs));
-  ASSERT_EQ(0x503U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(3);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(2U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x1500, std::vector<uint8_t>{0x05, 0x81, 0x01, 0x82, 0x12});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x1500, 0x1505, &loc_regs));
-  ASSERT_EQ(0x1505U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(129);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(2306U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_offset_extended_sf) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x11, 0x05, 0x10});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x500, 0x503, &loc_regs));
-  ASSERT_EQ(0x503U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(5);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(0x80U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Check a negative value for the offset.
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x1500, std::vector<uint8_t>{0x11, 0x86, 0x01, 0xff, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x1500, 0x1505, &loc_regs));
-  ASSERT_EQ(0x1505U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(134);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(static_cast<uint64_t>(-8), location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_restore) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0xc2});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_FALSE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2001, &loc_regs));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->cfa_->LastErrorCode());
-  ASSERT_EQ(0x2001U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("4 unwind restore while processing cie\n", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  dwarf_loc_regs_t cie_loc_regs;
-  cie_loc_regs[2] = {.type = DWARF_LOCATION_REGISTER, .values = {0, 0}};
-  this->cfa_->set_cie_loc_regs(&cie_loc_regs);
-  this->memory_.SetMemory(0x3000, std::vector<uint8_t>{0x82, 0x04, 0xc2});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x3000, 0x3003, &loc_regs));
-  ASSERT_EQ(0x3003U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(2);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, location->second.type);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_restore_extended) {
-  this->memory_.SetMemory(0x4000, std::vector<uint8_t>{0x06, 0x08});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_FALSE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x4000, 0x4002, &loc_regs));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->cfa_->LastErrorCode());
-  ASSERT_EQ(0x4002U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("4 unwind restore while processing cie\n", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x05, 0x82, 0x02, 0x04, 0x06, 0x82, 0x02});
-  dwarf_loc_regs_t cie_loc_regs;
-  cie_loc_regs[258] = {.type = DWARF_LOCATION_REGISTER, .values = {0, 0}};
-  this->cfa_->set_cie_loc_regs(&cie_loc_regs);
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x5000, 0x5007, &loc_regs));
-  ASSERT_EQ(0x5007U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(258);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, location->second.type);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_set_loc) {
-  uint8_t buffer[1 + sizeof(TypeParam)];
-  buffer[0] = 0x1;
-  TypeParam address;
-  std::string raw_data("Raw Data: 0x01 ");
-  std::string address_str;
-  if (sizeof(TypeParam) == 4) {
-    address = 0x81234578U;
-    address_str = "0x81234578";
-    raw_data += "0x78 0x45 0x23 0x81";
-  } else {
-    address = 0x8123456712345678ULL;
-    address_str = "0x8123456712345678";
-    raw_data += "0x78 0x56 0x34 0x12 0x67 0x45 0x23 0x81";
-  }
-  memcpy(&buffer[1], &address, sizeof(address));
-
-  this->memory_.SetMemory(0x50, buffer, sizeof(buffer));
-  ResetLogs();
-  dwarf_loc_regs_t loc_regs;
-  ASSERT_TRUE(
-      this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x50, 0x51 + sizeof(TypeParam), &loc_regs));
-  ASSERT_EQ(0x51 + sizeof(TypeParam), this->dmem_->cur_offset());
-  ASSERT_EQ(address, this->cfa_->cur_pc());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Check for a set going back.
-  ResetLogs();
-  loc_regs.clear();
-  this->fde_.pc_start = address + 0x10;
-  ASSERT_TRUE(
-      this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x50, 0x51 + sizeof(TypeParam), &loc_regs));
-  ASSERT_EQ(0x51 + sizeof(TypeParam), this->dmem_->cur_offset());
-  ASSERT_EQ(address, this->cfa_->cur_pc());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  std::string cur_address_str(address_str);
-  cur_address_str[cur_address_str.size() - 2] = '8';
-  std::string expected = "4 unwind Warning: PC is moving backwards: old " + cur_address_str +
-                         " new " + address_str + "\n";
-  ASSERT_EQ(expected, GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_advance_loc1) {
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x02, 0x04});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x202, &loc_regs));
-  ASSERT_EQ(0x202U, this->dmem_->cur_offset());
-  ASSERT_EQ(this->fde_.pc_start + 0x10, this->cfa_->cur_pc());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_advance_loc2) {
-  this->memory_.SetMemory(0x600, std::vector<uint8_t>{0x03, 0x04, 0x03});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x600, 0x603, &loc_regs));
-  ASSERT_EQ(0x603U, this->dmem_->cur_offset());
-  ASSERT_EQ(this->fde_.pc_start + 0xc10U, this->cfa_->cur_pc());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_advance_loc4) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x04, 0x04, 0x03, 0x02, 0x01});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x500, 0x505, &loc_regs));
-  ASSERT_EQ(0x505U, this->dmem_->cur_offset());
-  ASSERT_EQ(this->fde_.pc_start + 0x4080c10, this->cfa_->cur_pc());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_undefined) {
-  this->memory_.SetMemory(0xa00, std::vector<uint8_t>{0x07, 0x09});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0xa00, 0xa02, &loc_regs));
-  ASSERT_EQ(0xa02U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(9);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_UNDEFINED, location->second.type);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x1a00, std::vector<uint8_t>{0x07, 0x81, 0x01});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x1a00, 0x1a03, &loc_regs));
-  ASSERT_EQ(0x1a03U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(129);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_UNDEFINED, location->second.type);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_same) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x08, 0x7f});
-  dwarf_loc_regs_t loc_regs;
-
-  loc_regs[127] = {.type = DWARF_LOCATION_REGISTER, .values = {0, 0}};
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(0x102U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-  ASSERT_EQ(0U, loc_regs.count(127));
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x2100, std::vector<uint8_t>{0x08, 0xff, 0x01});
-
-  loc_regs[255] = {.type = DWARF_LOCATION_REGISTER, .values = {0, 0}};
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2100, 0x2103, &loc_regs));
-  ASSERT_EQ(0x2103U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-  ASSERT_EQ(0U, loc_regs.count(255));
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_register) {
-  this->memory_.SetMemory(0x300, std::vector<uint8_t>{0x09, 0x02, 0x01});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x300, 0x303, &loc_regs));
-  ASSERT_EQ(0x303U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(2);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, location->second.type);
-  ASSERT_EQ(1U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x4300, std::vector<uint8_t>{0x09, 0xff, 0x01, 0xff, 0x03});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x4300, 0x4305, &loc_regs));
-  ASSERT_EQ(0x4305U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(255);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, location->second.type);
-  ASSERT_EQ(511U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_state) {
-  this->memory_.SetMemory(0x300, std::vector<uint8_t>{0x0a});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x300, 0x301, &loc_regs));
-  ASSERT_EQ(0x301U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x4300, std::vector<uint8_t>{0x0b});
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x4300, 0x4301, &loc_regs));
-  ASSERT_EQ(0x4301U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x85, 0x02, 0x0a, 0x86, 0x04, 0x0b});
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2005, &loc_regs));
-  ASSERT_EQ(0x2005U, this->dmem_->cur_offset());
-  ASSERT_EQ(2U, loc_regs.size());
-  ASSERT_NE(loc_regs.end(), loc_regs.find(5));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(6));
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2006, &loc_regs));
-  ASSERT_EQ(0x2006U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_NE(loc_regs.end(), loc_regs.find(5));
-
-  ResetLogs();
-  this->memory_.SetMemory(
-      0x6000, std::vector<uint8_t>{0x0a, 0x85, 0x02, 0x0a, 0x86, 0x04, 0x0a, 0x87, 0x01, 0x0a, 0x89,
-                                   0x05, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b});
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x6000, 0x600c, &loc_regs));
-  ASSERT_EQ(0x600cU, this->dmem_->cur_offset());
-  ASSERT_EQ(4U, loc_regs.size());
-  ASSERT_NE(loc_regs.end(), loc_regs.find(5));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(6));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(7));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(9));
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x6000, 0x600d, &loc_regs));
-  ASSERT_EQ(0x600dU, this->dmem_->cur_offset());
-  ASSERT_EQ(3U, loc_regs.size());
-  ASSERT_NE(loc_regs.end(), loc_regs.find(5));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(6));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(7));
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x6000, 0x600e, &loc_regs));
-  ASSERT_EQ(0x600eU, this->dmem_->cur_offset());
-  ASSERT_EQ(2U, loc_regs.size());
-  ASSERT_NE(loc_regs.end(), loc_regs.find(5));
-  ASSERT_NE(loc_regs.end(), loc_regs.find(6));
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x6000, 0x600f, &loc_regs));
-  ASSERT_EQ(0x600fU, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_NE(loc_regs.end(), loc_regs.find(5));
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x6000, 0x6010, &loc_regs));
-  ASSERT_EQ(0x6010U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x6000, 0x6011, &loc_regs));
-  ASSERT_EQ(0x6011U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-}
-
-// This test verifies that the cfa offset is saved and restored properly.
-// Even though the spec is not clear about whether the offset is also
-// restored, the gcc unwinder does, and libunwind does too.
-TYPED_TEST_P(DwarfCfaTest, cfa_state_cfa_offset_restore) {
-  this->memory_.SetMemory(0x3000, std::vector<uint8_t>{0x0a, 0x0e, 0x40, 0x0b});
-  dwarf_loc_regs_t loc_regs;
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {5, 100}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x3000, 0x3004, &loc_regs));
-  ASSERT_EQ(0x3004U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(5U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(100U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_def_cfa) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0c, 0x7f, 0x74});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x103, &loc_regs));
-  ASSERT_EQ(0x103U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0x7fU, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(0x74U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x0c, 0xff, 0x02, 0xf4, 0x04});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x205, &loc_regs));
-  ASSERT_EQ(0x205U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0x17fU, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(0x274U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_def_cfa_sf) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x12, 0x30, 0x25});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x103, &loc_regs));
-  ASSERT_EQ(0x103U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0x30U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(0x128U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Test a negative value.
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x12, 0xa3, 0x01, 0xfa, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x205, &loc_regs));
-  ASSERT_EQ(0x205U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0xa3U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(static_cast<uint64_t>(-48), loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_def_cfa_register) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0d, 0x72});
-  dwarf_loc_regs_t loc_regs;
-
-  // This fails because the cfa is not defined as a register.
-  ASSERT_FALSE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(0U, loc_regs.size());
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->cfa_->LastErrorCode());
-
-  ASSERT_EQ("4 unwind Attempt to set new register, but cfa is not already set to a register.\n",
-            GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {3, 20}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(0x102U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0x72U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(20U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x0d, 0xf9, 0x20});
-  loc_regs.clear();
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {3, 60}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x203, &loc_regs));
-  ASSERT_EQ(0x203U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0x1079U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(60U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_def_cfa_offset) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0e, 0x59});
-  dwarf_loc_regs_t loc_regs;
-
-  // This fails because the cfa is not defined as a register.
-  ASSERT_FALSE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(0U, loc_regs.size());
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->cfa_->LastErrorCode());
-
-  ASSERT_EQ("4 unwind Attempt to set offset, but cfa is not set to a register.\n",
-            GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {3}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(0x102U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(3U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(0x59U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x0e, 0xd4, 0x0a});
-  loc_regs.clear();
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {3}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x203, &loc_regs));
-  ASSERT_EQ(0x203U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(3U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(0x554U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_def_cfa_offset_sf) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x13, 0x23});
-  dwarf_loc_regs_t loc_regs;
-
-  // This fails because the cfa is not defined as a register.
-  ASSERT_FALSE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->cfa_->LastErrorCode());
-
-  ASSERT_EQ("4 unwind Attempt to set offset, but cfa is not set to a register.\n",
-            GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {3}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x102, &loc_regs));
-  ASSERT_EQ(0x102U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(3U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(0x118U, loc_regs[CFA_REG].values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Negative offset.
-  ResetLogs();
-  this->memory_.SetMemory(0x200, std::vector<uint8_t>{0x13, 0xf6, 0x7f});
-  loc_regs.clear();
-  loc_regs[CFA_REG] = {.type = DWARF_LOCATION_REGISTER, .values = {3}};
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x203, &loc_regs));
-  ASSERT_EQ(0x203U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, loc_regs[CFA_REG].type);
-  ASSERT_EQ(3U, loc_regs[CFA_REG].values[0]);
-  ASSERT_EQ(static_cast<TypeParam>(-80), static_cast<TypeParam>(loc_regs[CFA_REG].values[1]));
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_def_cfa_expression) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x0f, 0x04, 0x01, 0x02, 0x03, 0x04});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x106, &loc_regs));
-  ASSERT_EQ(0x106U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  std::vector<uint8_t> ops{0x0f, 0x81, 0x01};
-  for (uint8_t i = 3; i < 132; i++) {
-    ops.push_back(i - 1);
-  }
-  this->memory_.SetMemory(0x200, ops);
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x284, &loc_regs));
-  ASSERT_EQ(0x284U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  ASSERT_EQ(DWARF_LOCATION_VAL_EXPRESSION, loc_regs[CFA_REG].type);
-  ASSERT_EQ(0x81U, loc_regs[CFA_REG].values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_expression) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x10, 0x04, 0x02, 0x40, 0x20});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x105, &loc_regs));
-  ASSERT_EQ(0x105U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(4);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_EXPRESSION, location->second.type);
-  ASSERT_EQ(2U, location->second.values[0]);
-  ASSERT_EQ(0x105U, location->second.values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  std::vector<uint8_t> ops{0x10, 0xff, 0x01, 0x82, 0x01};
-  for (uint8_t i = 5; i < 135; i++) {
-    ops.push_back(i - 4);
-  }
-
-  this->memory_.SetMemory(0x200, ops);
-  loc_regs.clear();
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x200, 0x287, &loc_regs));
-  ASSERT_EQ(0x287U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(255);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_EXPRESSION, location->second.type);
-  ASSERT_EQ(130U, location->second.values[0]);
-  ASSERT_EQ(0x287U, location->second.values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_val_offset) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x14, 0x45, 0x54});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x103, &loc_regs));
-  ASSERT_EQ(0x103U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(69);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_VAL_OFFSET, location->second.type);
-  ASSERT_EQ(0x2a0U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x400, std::vector<uint8_t>{0x14, 0xa2, 0x02, 0xb4, 0x05});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x400, 0x405, &loc_regs));
-  ASSERT_EQ(0x405U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(290);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_VAL_OFFSET, location->second.type);
-  ASSERT_EQ(0x15a0U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_val_offset_sf) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x15, 0x56, 0x12});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x103, &loc_regs));
-  ASSERT_EQ(0x103U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(86);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_VAL_OFFSET, location->second.type);
-  ASSERT_EQ(0x90U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  // Negative value.
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0xa00, std::vector<uint8_t>{0x15, 0xff, 0x01, 0xc0, 0x7f});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0xa00, 0xa05, &loc_regs));
-  ASSERT_EQ(0xa05U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(255);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_VAL_OFFSET, location->second.type);
-  ASSERT_EQ(static_cast<uint64_t>(-512), location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_val_expression) {
-  this->memory_.SetMemory(0x100, std::vector<uint8_t>{0x16, 0x05, 0x02, 0x10, 0x20});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x100, 0x105, &loc_regs));
-  ASSERT_EQ(0x105U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(5);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_VAL_EXPRESSION, location->second.type);
-  ASSERT_EQ(2U, location->second.values[0]);
-  ASSERT_EQ(0x105U, location->second.values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  std::vector<uint8_t> ops{0x16, 0x83, 0x10, 0xa8, 0x01};
-  for (uint8_t i = 0; i < 168; i++) {
-    ops.push_back(i);
-  }
-
-  this->memory_.SetMemory(0xa00, ops);
-  loc_regs.clear();
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0xa00, 0xaad, &loc_regs));
-  ASSERT_EQ(0xaadU, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(2051);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_VAL_EXPRESSION, location->second.type);
-  ASSERT_EQ(168U, location->second.values[0]);
-  ASSERT_EQ(0xaadU, location->second.values[1]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_gnu_args_size) {
-  this->memory_.SetMemory(0x2000, std::vector<uint8_t>{0x2e, 0x04});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x2000, 0x2002, &loc_regs));
-  ASSERT_EQ(0x2002U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x2e, 0xa4, 0x80, 0x04});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x5000, 0x5004, &loc_regs));
-  ASSERT_EQ(0x5004U, this->dmem_->cur_offset());
-  ASSERT_EQ(0U, loc_regs.size());
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_gnu_negative_offset_extended) {
-  this->memory_.SetMemory(0x500, std::vector<uint8_t>{0x2f, 0x08, 0x10});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x500, 0x503, &loc_regs));
-  ASSERT_EQ(0x503U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(8);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(static_cast<uint64_t>(-16), location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-
-  ResetLogs();
-  loc_regs.clear();
-  this->memory_.SetMemory(0x1500, std::vector<uint8_t>{0x2f, 0x81, 0x02, 0xff, 0x01});
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x1500, 0x1505, &loc_regs));
-  ASSERT_EQ(0x1505U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  location = loc_regs.find(257);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_OFFSET, location->second.type);
-  ASSERT_EQ(static_cast<uint64_t>(-255), location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-TYPED_TEST_P(DwarfCfaTest, cfa_register_override) {
-  this->memory_.SetMemory(0x300, std::vector<uint8_t>{0x09, 0x02, 0x01, 0x09, 0x02, 0x04});
-  dwarf_loc_regs_t loc_regs;
-
-  ASSERT_TRUE(this->cfa_->GetLocationInfo(this->fde_.pc_start, 0x300, 0x306, &loc_regs));
-  ASSERT_EQ(0x306U, this->dmem_->cur_offset());
-  ASSERT_EQ(1U, loc_regs.size());
-  auto location = loc_regs.find(2);
-  ASSERT_NE(loc_regs.end(), location);
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, location->second.type);
-  ASSERT_EQ(4U, location->second.values[0]);
-
-  ASSERT_EQ("", GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfCfaTest, cfa_illegal, cfa_nop, cfa_offset, cfa_offset_extended,
-                            cfa_offset_extended_sf, cfa_restore, cfa_restore_extended, cfa_set_loc,
-                            cfa_advance_loc1, cfa_advance_loc2, cfa_advance_loc4, cfa_undefined,
-                            cfa_same, cfa_register, cfa_state, cfa_state_cfa_offset_restore,
-                            cfa_def_cfa, cfa_def_cfa_sf, cfa_def_cfa_register, cfa_def_cfa_offset,
-                            cfa_def_cfa_offset_sf, cfa_def_cfa_expression, cfa_expression,
-                            cfa_val_offset, cfa_val_offset_sf, cfa_val_expression,
-                            cfa_gnu_args_size, cfa_gnu_negative_offset_extended,
-                            cfa_register_override);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfCfaTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfCfaTest, DwarfCfaTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfDebugFrameTest.cpp b/libunwindstack/tests/DwarfDebugFrameTest.cpp
deleted file mode 100644
index fac8a0e..0000000
--- a/libunwindstack/tests/DwarfDebugFrameTest.cpp
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-
-#include "DwarfDebugFrame.h"
-#include "DwarfEncoding.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class DwarfDebugFrameTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-    debug_frame_ = new DwarfDebugFrame<TypeParam>(&memory_);
-    ResetLogs();
-  }
-
-  void TearDown() override { delete debug_frame_; }
-
-  MemoryFake memory_;
-  DwarfDebugFrame<TypeParam>* debug_frame_ = nullptr;
-};
-TYPED_TEST_SUITE_P(DwarfDebugFrameTest);
-
-// NOTE: All test class variables need to be referenced as this->.
-
-static void SetCie32(MemoryFake* memory, uint64_t offset, uint32_t length,
-                     std::vector<uint8_t> data) {
-  memory->SetData32(offset, length);
-  offset += 4;
-  // Indicates this is a cie.
-  memory->SetData32(offset, 0xffffffff);
-  offset += 4;
-  memory->SetMemory(offset, data);
-}
-
-static void SetCie64(MemoryFake* memory, uint64_t offset, uint64_t length,
-                     std::vector<uint8_t> data) {
-  memory->SetData32(offset, 0xffffffff);
-  offset += 4;
-  memory->SetData64(offset, length);
-  offset += 8;
-  // Indicates this is a cie.
-  memory->SetData64(offset, 0xffffffffffffffffUL);
-  offset += 8;
-  memory->SetMemory(offset, data);
-}
-
-static void SetFde32(MemoryFake* memory, uint64_t offset, uint32_t length, uint64_t cie_offset,
-                     uint32_t pc_start, uint32_t pc_length, uint64_t segment_length = 0,
-                     std::vector<uint8_t>* data = nullptr) {
-  memory->SetData32(offset, length);
-  offset += 4;
-  memory->SetData32(offset, cie_offset);
-  offset += 4 + segment_length;
-  memory->SetData32(offset, pc_start);
-  offset += 4;
-  memory->SetData32(offset, pc_length);
-  if (data != nullptr) {
-    offset += 4;
-    memory->SetMemory(offset, *data);
-  }
-}
-
-static void SetFde64(MemoryFake* memory, uint64_t offset, uint64_t length, uint64_t cie_offset,
-                     uint64_t pc_start, uint64_t pc_length, uint64_t segment_length = 0,
-                     std::vector<uint8_t>* data = nullptr) {
-  memory->SetData32(offset, 0xffffffff);
-  offset += 4;
-  memory->SetData64(offset, length);
-  offset += 8;
-  memory->SetData64(offset, cie_offset);
-  offset += 8 + segment_length;
-  memory->SetData64(offset, pc_start);
-  offset += 8;
-  memory->SetData64(offset, pc_length);
-  if (data != nullptr) {
-    offset += 8;
-    memory->SetMemory(offset, *data);
-  }
-}
-
-static void SetFourFdes32(MemoryFake* memory) {
-  SetCie32(memory, 0x5000, 0xfc, std::vector<uint8_t>{1, '\0', 0, 0, 1});
-
-  // FDE 32 information.
-  SetFde32(memory, 0x5100, 0xfc, 0, 0x1500, 0x200);
-  SetFde32(memory, 0x5200, 0xfc, 0, 0x2500, 0x300);
-
-  // CIE 32 information.
-  SetCie32(memory, 0x5300, 0xfc, std::vector<uint8_t>{1, '\0', 0, 0, 1});
-
-  // FDE 32 information.
-  SetFde32(memory, 0x5400, 0xfc, 0x300, 0x3500, 0x400);
-  SetFde32(memory, 0x5500, 0xfc, 0x300, 0x4500, 0x500);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdes32) {
-  SetFourFdes32(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  std::vector<const DwarfFde*> fdes;
-  this->debug_frame_->GetFdes(&fdes);
-
-  ASSERT_EQ(4U, fdes.size());
-
-  EXPECT_EQ(0x5000U, fdes[0]->cie_offset);
-  EXPECT_EQ(0x5110U, fdes[0]->cfa_instructions_offset);
-  EXPECT_EQ(0x5200U, fdes[0]->cfa_instructions_end);
-  EXPECT_EQ(0x1500U, fdes[0]->pc_start);
-  EXPECT_EQ(0x1700U, fdes[0]->pc_end);
-  EXPECT_EQ(0U, fdes[0]->lsda_address);
-  EXPECT_TRUE(fdes[0]->cie != nullptr);
-
-  EXPECT_EQ(0x5000U, fdes[1]->cie_offset);
-  EXPECT_EQ(0x5210U, fdes[1]->cfa_instructions_offset);
-  EXPECT_EQ(0x5300U, fdes[1]->cfa_instructions_end);
-  EXPECT_EQ(0x2500U, fdes[1]->pc_start);
-  EXPECT_EQ(0x2800U, fdes[1]->pc_end);
-  EXPECT_EQ(0U, fdes[1]->lsda_address);
-  EXPECT_TRUE(fdes[1]->cie != nullptr);
-
-  EXPECT_EQ(0x5300U, fdes[2]->cie_offset);
-  EXPECT_EQ(0x5410U, fdes[2]->cfa_instructions_offset);
-  EXPECT_EQ(0x5500U, fdes[2]->cfa_instructions_end);
-  EXPECT_EQ(0x3500U, fdes[2]->pc_start);
-  EXPECT_EQ(0x3900U, fdes[2]->pc_end);
-  EXPECT_EQ(0U, fdes[2]->lsda_address);
-  EXPECT_TRUE(fdes[2]->cie != nullptr);
-
-  EXPECT_EQ(0x5300U, fdes[3]->cie_offset);
-  EXPECT_EQ(0x5510U, fdes[3]->cfa_instructions_offset);
-  EXPECT_EQ(0x5600U, fdes[3]->cfa_instructions_end);
-  EXPECT_EQ(0x4500U, fdes[3]->pc_start);
-  EXPECT_EQ(0x4a00U, fdes[3]->pc_end);
-  EXPECT_EQ(0U, fdes[3]->lsda_address);
-  EXPECT_TRUE(fdes[3]->cie != nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdes32_after_GetFdeFromPc) {
-  SetFourFdes32(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x3600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x3500U, fde->pc_start);
-  EXPECT_EQ(0x3900U, fde->pc_end);
-
-  std::vector<const DwarfFde*> fdes;
-  this->debug_frame_->GetFdes(&fdes);
-  ASSERT_EQ(4U, fdes.size());
-
-  // Verify that they got added in the correct order.
-  EXPECT_EQ(0x1500U, fdes[0]->pc_start);
-  EXPECT_EQ(0x1700U, fdes[0]->pc_end);
-  EXPECT_EQ(0x2500U, fdes[1]->pc_start);
-  EXPECT_EQ(0x2800U, fdes[1]->pc_end);
-  EXPECT_EQ(0x3500U, fdes[2]->pc_start);
-  EXPECT_EQ(0x3900U, fdes[2]->pc_end);
-  EXPECT_EQ(0x4500U, fdes[3]->pc_start);
-  EXPECT_EQ(0x4a00U, fdes[3]->pc_end);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdes32_not_in_section) {
-  SetFourFdes32(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x500, 0));
-
-  std::vector<const DwarfFde*> fdes;
-  this->debug_frame_->GetFdes(&fdes);
-
-  ASSERT_EQ(3U, fdes.size());
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc32) {
-  SetFourFdes32(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x1600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x1500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x2600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x2500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x3600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x3500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc32_reverse) {
-  SetFourFdes32(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x3600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x3500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x2600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x2500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x1600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x1500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc32_not_in_section) {
-  SetFourFdes32(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x500, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-static void SetFourFdes64(MemoryFake* memory) {
-  // CIE 64 information.
-  SetCie64(memory, 0x5000, 0xf4, std::vector<uint8_t>{1, '\0', 0, 0, 1});
-
-  // FDE 64 information.
-  SetFde64(memory, 0x5100, 0xf4, 0, 0x1500, 0x200);
-  SetFde64(memory, 0x5200, 0xf4, 0, 0x2500, 0x300);
-
-  // CIE 64 information.
-  SetCie64(memory, 0x5300, 0xf4, std::vector<uint8_t>{1, '\0', 0, 0, 1});
-
-  // FDE 64 information.
-  SetFde64(memory, 0x5400, 0xf4, 0x300, 0x3500, 0x400);
-  SetFde64(memory, 0x5500, 0xf4, 0x300, 0x4500, 0x500);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdes64) {
-  SetFourFdes64(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  std::vector<const DwarfFde*> fdes;
-  this->debug_frame_->GetFdes(&fdes);
-
-  ASSERT_EQ(4U, fdes.size());
-
-  EXPECT_EQ(0x5000U, fdes[0]->cie_offset);
-  EXPECT_EQ(0x5124U, fdes[0]->cfa_instructions_offset);
-  EXPECT_EQ(0x5200U, fdes[0]->cfa_instructions_end);
-  EXPECT_EQ(0x1500U, fdes[0]->pc_start);
-  EXPECT_EQ(0x1700U, fdes[0]->pc_end);
-  EXPECT_EQ(0U, fdes[0]->lsda_address);
-  EXPECT_TRUE(fdes[0]->cie != nullptr);
-
-  EXPECT_EQ(0x5000U, fdes[1]->cie_offset);
-  EXPECT_EQ(0x5224U, fdes[1]->cfa_instructions_offset);
-  EXPECT_EQ(0x5300U, fdes[1]->cfa_instructions_end);
-  EXPECT_EQ(0x2500U, fdes[1]->pc_start);
-  EXPECT_EQ(0x2800U, fdes[1]->pc_end);
-  EXPECT_EQ(0U, fdes[1]->lsda_address);
-  EXPECT_TRUE(fdes[1]->cie != nullptr);
-
-  EXPECT_EQ(0x5300U, fdes[2]->cie_offset);
-  EXPECT_EQ(0x5424U, fdes[2]->cfa_instructions_offset);
-  EXPECT_EQ(0x5500U, fdes[2]->cfa_instructions_end);
-  EXPECT_EQ(0x3500U, fdes[2]->pc_start);
-  EXPECT_EQ(0x3900U, fdes[2]->pc_end);
-  EXPECT_EQ(0U, fdes[2]->lsda_address);
-  EXPECT_TRUE(fdes[2]->cie != nullptr);
-
-  EXPECT_EQ(0x5300U, fdes[3]->cie_offset);
-  EXPECT_EQ(0x5524U, fdes[3]->cfa_instructions_offset);
-  EXPECT_EQ(0x5600U, fdes[3]->cfa_instructions_end);
-  EXPECT_EQ(0x4500U, fdes[3]->pc_start);
-  EXPECT_EQ(0x4a00U, fdes[3]->pc_end);
-  EXPECT_EQ(0U, fdes[3]->lsda_address);
-  EXPECT_TRUE(fdes[3]->cie != nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdes64_after_GetFdeFromPc) {
-  SetFourFdes64(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x2600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x2500U, fde->pc_start);
-  EXPECT_EQ(0x2800U, fde->pc_end);
-
-  std::vector<const DwarfFde*> fdes;
-  this->debug_frame_->GetFdes(&fdes);
-  ASSERT_EQ(4U, fdes.size());
-
-  // Verify that they got added in the correct order.
-  EXPECT_EQ(0x1500U, fdes[0]->pc_start);
-  EXPECT_EQ(0x1700U, fdes[0]->pc_end);
-  EXPECT_EQ(0x2500U, fdes[1]->pc_start);
-  EXPECT_EQ(0x2800U, fdes[1]->pc_end);
-  EXPECT_EQ(0x3500U, fdes[2]->pc_start);
-  EXPECT_EQ(0x3900U, fdes[2]->pc_end);
-  EXPECT_EQ(0x4500U, fdes[3]->pc_start);
-  EXPECT_EQ(0x4a00U, fdes[3]->pc_end);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdes64_not_in_section) {
-  SetFourFdes64(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x500, 0));
-
-  std::vector<const DwarfFde*> fdes;
-  this->debug_frame_->GetFdes(&fdes);
-
-  ASSERT_EQ(3U, fdes.size());
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc64) {
-  SetFourFdes64(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x1600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x1500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x2600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x2500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x3600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x3500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc64_reverse) {
-  SetFourFdes64(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x600, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x3600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x3500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x2600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x2500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x1600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x1500U, fde->pc_start);
-
-  fde = this->debug_frame_->GetFdeFromPc(0);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc64_not_in_section) {
-  SetFourFdes64(&this->memory_);
-  ASSERT_TRUE(this->debug_frame_->Init(0x5000, 0x500, 0));
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFde32) {
-  SetCie32(&this->memory_, 0xf000, 0x100, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-  SetFde32(&this->memory_, 0x14000, 0x20, 0xf000, 0x9000, 0x100);
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromOffset(0x14000);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x14010U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x14024U, fde->cfa_instructions_end);
-  EXPECT_EQ(0x9000U, fde->pc_start);
-  EXPECT_EQ(0x9100U, fde->pc_end);
-  EXPECT_EQ(0xf000U, fde->cie_offset);
-  EXPECT_EQ(0U, fde->lsda_address);
-
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(1U, fde->cie->version);
-  EXPECT_EQ(DW_EH_PE_sdata4, fde->cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, fde->cie->lsda_encoding);
-  EXPECT_EQ(0U, fde->cie->segment_size);
-  EXPECT_EQ(1U, fde->cie->augmentation_string.size());
-  EXPECT_EQ('\0', fde->cie->augmentation_string[0]);
-  EXPECT_EQ(0U, fde->cie->personality_handler);
-  EXPECT_EQ(0xf00dU, fde->cie->cfa_instructions_offset);
-  EXPECT_EQ(0xf104U, fde->cie->cfa_instructions_end);
-  EXPECT_EQ(4U, fde->cie->code_alignment_factor);
-  EXPECT_EQ(8, fde->cie->data_alignment_factor);
-  EXPECT_EQ(0x20U, fde->cie->return_address_register);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFde64) {
-  SetCie64(&this->memory_, 0x6000, 0x100, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-  SetFde64(&this->memory_, 0x8000, 0x200, 0x6000, 0x5000, 0x300);
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromOffset(0x8000);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x8024U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x820cU, fde->cfa_instructions_end);
-  EXPECT_EQ(0x5000U, fde->pc_start);
-  EXPECT_EQ(0x5300U, fde->pc_end);
-  EXPECT_EQ(0x6000U, fde->cie_offset);
-  EXPECT_EQ(0U, fde->lsda_address);
-
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(1U, fde->cie->version);
-  EXPECT_EQ(DW_EH_PE_sdata8, fde->cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, fde->cie->lsda_encoding);
-  EXPECT_EQ(0U, fde->cie->segment_size);
-  EXPECT_EQ(1U, fde->cie->augmentation_string.size());
-  EXPECT_EQ('\0', fde->cie->augmentation_string[0]);
-  EXPECT_EQ(0U, fde->cie->personality_handler);
-  EXPECT_EQ(0x6019U, fde->cie->cfa_instructions_offset);
-  EXPECT_EQ(0x610cU, fde->cie->cfa_instructions_end);
-  EXPECT_EQ(4U, fde->cie->code_alignment_factor);
-  EXPECT_EQ(8, fde->cie->data_alignment_factor);
-  EXPECT_EQ(0x20U, fde->cie->return_address_register);
-}
-
-static void VerifyCieVersion(const DwarfCie* cie, uint8_t version, uint8_t segment_size,
-                             uint8_t fde_encoding, uint64_t return_address, uint64_t start_offset,
-                             uint64_t end_offset) {
-  EXPECT_EQ(version, cie->version);
-  EXPECT_EQ(fde_encoding, cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, cie->lsda_encoding);
-  EXPECT_EQ(segment_size, cie->segment_size);
-  EXPECT_EQ(1U, cie->augmentation_string.size());
-  EXPECT_EQ('\0', cie->augmentation_string[0]);
-  EXPECT_EQ(0U, cie->personality_handler);
-  EXPECT_EQ(4U, cie->code_alignment_factor);
-  EXPECT_EQ(8, cie->data_alignment_factor);
-  EXPECT_EQ(return_address, cie->return_address_register);
-  EXPECT_EQ(0x5000U + start_offset, cie->cfa_instructions_offset);
-  EXPECT_EQ(0x5000U + end_offset, cie->cfa_instructions_end);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset32_cie_cached) {
-  SetCie32(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 1, 0, DW_EH_PE_sdata4, 0x20, 0xd, 0x104);
-
-  std::vector<uint8_t> zero(0x100, 0);
-  this->memory_.SetMemory(0x5000, zero);
-  cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 1, 0, DW_EH_PE_sdata4, 0x20, 0xd, 0x104);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset64_cie_cached) {
-  SetCie64(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 1, 0, DW_EH_PE_sdata8, 0x20, 0x19, 0x10c);
-
-  std::vector<uint8_t> zero(0x100, 0);
-  this->memory_.SetMemory(0x5000, zero);
-  cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 1, 0, DW_EH_PE_sdata8, 0x20, 0x19, 0x10c);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset32_version1) {
-  SetCie32(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 1, 0, DW_EH_PE_sdata4, 0x20, 0xd, 0x104);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset64_version1) {
-  SetCie64(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 1, 0, DW_EH_PE_sdata8, 0x20, 0x19, 0x10c);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset32_version3) {
-  SetCie32(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{3, '\0', 4, 8, 0x81, 3});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 3, 0, DW_EH_PE_sdata4, 0x181, 0xe, 0x104);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset64_version3) {
-  SetCie64(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{3, '\0', 4, 8, 0x81, 3});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 3, 0, DW_EH_PE_sdata8, 0x181, 0x1a, 0x10c);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset32_version4) {
-  SetCie32(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{4, '\0', 0, 10, 4, 8, 0x81, 3});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 4, 10, DW_EH_PE_sdata4, 0x181, 0x10, 0x104);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset64_version4) {
-  SetCie64(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{4, '\0', 0, 10, 4, 8, 0x81, 3});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 4, 10, DW_EH_PE_sdata8, 0x181, 0x1c, 0x10c);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset32_version5) {
-  SetCie32(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{5, '\0', 0, 10, 4, 8, 0x81, 3});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 5, 10, DW_EH_PE_sdata4, 0x181, 0x10, 0x104);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset64_version5) {
-  SetCie64(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{5, '\0', 0, 10, 4, 8, 0x81, 3});
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  EXPECT_EQ(DWARF_ERROR_NONE, this->debug_frame_->LastErrorCode());
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieVersion(cie, 5, 10, DW_EH_PE_sdata8, 0x181, 0x1c, 0x10c);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset_version_invalid) {
-  SetCie32(&this->memory_, 0x5000, 0x100, std::vector<uint8_t>{0, '\0', 1, 2, 3, 4, 5, 6, 7});
-  ASSERT_TRUE(this->debug_frame_->GetCieFromOffset(0x5000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_UNSUPPORTED_VERSION, this->debug_frame_->LastErrorCode());
-  SetCie64(&this->memory_, 0x6000, 0x100, std::vector<uint8_t>{0, '\0', 1, 2, 3, 4, 5, 6, 7});
-  ASSERT_TRUE(this->debug_frame_->GetCieFromOffset(0x6000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_UNSUPPORTED_VERSION, this->debug_frame_->LastErrorCode());
-
-  SetCie32(&this->memory_, 0x7000, 0x100, std::vector<uint8_t>{6, '\0', 1, 2, 3, 4, 5, 6, 7});
-  ASSERT_TRUE(this->debug_frame_->GetCieFromOffset(0x7000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_UNSUPPORTED_VERSION, this->debug_frame_->LastErrorCode());
-  SetCie64(&this->memory_, 0x8000, 0x100, std::vector<uint8_t>{6, '\0', 1, 2, 3, 4, 5, 6, 7});
-  ASSERT_TRUE(this->debug_frame_->GetCieFromOffset(0x8000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_UNSUPPORTED_VERSION, this->debug_frame_->LastErrorCode());
-}
-
-static void VerifyCieAugment(const DwarfCie* cie, uint64_t inst_offset, uint64_t inst_end) {
-  EXPECT_EQ(1U, cie->version);
-  EXPECT_EQ(DW_EH_PE_udata2, cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_textrel | DW_EH_PE_udata2, cie->lsda_encoding);
-  EXPECT_EQ(0U, cie->segment_size);
-  EXPECT_EQ(5U, cie->augmentation_string.size());
-  EXPECT_EQ('z', cie->augmentation_string[0]);
-  EXPECT_EQ('L', cie->augmentation_string[1]);
-  EXPECT_EQ('P', cie->augmentation_string[2]);
-  EXPECT_EQ('R', cie->augmentation_string[3]);
-  EXPECT_EQ('\0', cie->augmentation_string[4]);
-  EXPECT_EQ(0x12345678U, cie->personality_handler);
-  EXPECT_EQ(4U, cie->code_alignment_factor);
-  EXPECT_EQ(8, cie->data_alignment_factor);
-  EXPECT_EQ(0x10U, cie->return_address_register);
-  EXPECT_EQ(inst_offset, cie->cfa_instructions_offset);
-  EXPECT_EQ(inst_end, cie->cfa_instructions_end);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset32_augment) {
-  SetCie32(&this->memory_, 0x5000, 0x100,
-           std::vector<uint8_t>{/* version */ 1,
-                                /* augment string */ 'z', 'L', 'P', 'R', '\0',
-                                /* code alignment factor */ 4,
-                                /* data alignment factor */ 8,
-                                /* return address register */ 0x10,
-                                /* augment length */ 0xf,
-                                /* L data */ DW_EH_PE_textrel | DW_EH_PE_udata2,
-                                /* P data */ DW_EH_PE_udata4, 0x78, 0x56, 0x34, 0x12,
-                                /* R data */ DW_EH_PE_udata2});
-
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieAugment(cie, 0x5021, 0x5104);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetCieFromOffset64_augment) {
-  SetCie64(&this->memory_, 0x5000, 0x100,
-           std::vector<uint8_t>{/* version */ 1,
-                                /* augment string */ 'z', 'L', 'P', 'R', '\0',
-                                /* code alignment factor */ 4,
-                                /* data alignment factor */ 8,
-                                /* return address register */ 0x10,
-                                /* augment length */ 0xf,
-                                /* L data */ DW_EH_PE_textrel | DW_EH_PE_udata2,
-                                /* P data */ DW_EH_PE_udata4, 0x78, 0x56, 0x34, 0x12,
-                                /* R data */ DW_EH_PE_udata2});
-
-  const DwarfCie* cie = this->debug_frame_->GetCieFromOffset(0x5000);
-  ASSERT_TRUE(cie != nullptr);
-  VerifyCieAugment(cie, 0x502d, 0x510c);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromOffset32_augment) {
-  SetCie32(&this->memory_, 0x5000, 0xfc,
-           std::vector<uint8_t>{/* version */ 4,
-                                /* augment string */ 'z', '\0',
-                                /* address size */ 8,
-                                /* segment size */ 0x10,
-                                /* code alignment factor */ 16,
-                                /* data alignment factor */ 32,
-                                /* return address register */ 10,
-                                /* augment length */ 0x0});
-
-  std::vector<uint8_t> data{/* augment length */ 0x80, 0x3};
-  SetFde32(&this->memory_, 0x5200, 0x300, 0x5000, 0x4300, 0x300, 0x10, &data);
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromOffset(0x5200);
-  ASSERT_TRUE(fde != nullptr);
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(4U, fde->cie->version);
-  EXPECT_EQ(0x5000U, fde->cie_offset);
-  EXPECT_EQ(0x53a2U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x5504U, fde->cfa_instructions_end);
-  EXPECT_EQ(0x4300U, fde->pc_start);
-  EXPECT_EQ(0x4600U, fde->pc_end);
-  EXPECT_EQ(0U, fde->lsda_address);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromOffset64_augment) {
-  SetCie64(&this->memory_, 0x5000, 0xfc,
-           std::vector<uint8_t>{/* version */ 4,
-                                /* augment string */ 'z', '\0',
-                                /* address size */ 8,
-                                /* segment size */ 0x10,
-                                /* code alignment factor */ 16,
-                                /* data alignment factor */ 32,
-                                /* return address register */ 10,
-                                /* augment length */ 0x0});
-
-  std::vector<uint8_t> data{/* augment length */ 0x80, 0x3};
-  SetFde64(&this->memory_, 0x5200, 0x300, 0x5000, 0x4300, 0x300, 0x10, &data);
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromOffset(0x5200);
-  ASSERT_TRUE(fde != nullptr);
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(4U, fde->cie->version);
-  EXPECT_EQ(0x5000U, fde->cie_offset);
-  EXPECT_EQ(0x53b6U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x550cU, fde->cfa_instructions_end);
-  EXPECT_EQ(0x4300U, fde->pc_start);
-  EXPECT_EQ(0x4600U, fde->pc_end);
-  EXPECT_EQ(0U, fde->lsda_address);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromOffset32_lsda_address) {
-  SetCie32(&this->memory_, 0x5000, 0xfc,
-           std::vector<uint8_t>{/* version */ 1,
-                                /* augment string */ 'z', 'L', '\0',
-                                /* address size */ 8,
-                                /* code alignment factor */ 16,
-                                /* data alignment factor */ 32,
-                                /* return address register */ 10,
-                                /* augment length */ 0x2,
-                                /* L data */ DW_EH_PE_udata2});
-
-  std::vector<uint8_t> data{/* augment length */ 0x80, 0x3,
-                            /* lsda address */ 0x20, 0x45};
-  SetFde32(&this->memory_, 0x5200, 0x300, 0x5000, 0x4300, 0x300, 0, &data);
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromOffset(0x5200);
-  ASSERT_TRUE(fde != nullptr);
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(1U, fde->cie->version);
-  EXPECT_EQ(0x5000U, fde->cie_offset);
-  EXPECT_EQ(0x5392U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x5504U, fde->cfa_instructions_end);
-  EXPECT_EQ(0x4300U, fde->pc_start);
-  EXPECT_EQ(0x4600U, fde->pc_end);
-  EXPECT_EQ(0x4520U, fde->lsda_address);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromOffset64_lsda_address) {
-  SetCie64(&this->memory_, 0x5000, 0xfc,
-           std::vector<uint8_t>{/* version */ 1,
-                                /* augment string */ 'z', 'L', '\0',
-                                /* address size */ 8,
-                                /* code alignment factor */ 16,
-                                /* data alignment factor */ 32,
-                                /* return address register */ 10,
-                                /* augment length */ 0x2,
-                                /* L data */ DW_EH_PE_udata2});
-
-  std::vector<uint8_t> data{/* augment length */ 0x80, 0x3,
-                            /* lsda address */ 0x20, 0x45};
-  SetFde64(&this->memory_, 0x5200, 0x300, 0x5000, 0x4300, 0x300, 0, &data);
-
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromOffset(0x5200);
-  ASSERT_TRUE(fde != nullptr);
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(1U, fde->cie->version);
-  EXPECT_EQ(0x5000U, fde->cie_offset);
-  EXPECT_EQ(0x53a6U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x550cU, fde->cfa_instructions_end);
-  EXPECT_EQ(0x4300U, fde->pc_start);
-  EXPECT_EQ(0x4600U, fde->pc_end);
-  EXPECT_EQ(0x4520U, fde->lsda_address);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc_interleaved) {
-  SetCie32(&this->memory_, 0x5000, 0xfc, std::vector<uint8_t>{1, '\0', 0, 0, 1});
-
-  // FDE 0 (0x100 - 0x200)
-  SetFde32(&this->memory_, 0x5100, 0xfc, 0, 0x100, 0x100);
-  // FDE 1 (0x300 - 0x500)
-  SetFde32(&this->memory_, 0x5200, 0xfc, 0, 0x300, 0x200);
-  // FDE 2 (0x700 - 0x800)
-  SetFde32(&this->memory_, 0x5300, 0xfc, 0, 0x700, 0x100);
-  // FDE 3 (0xa00 - 0xb00)
-  SetFde32(&this->memory_, 0x5400, 0xfc, 0, 0xa00, 0x100);
-  // FDE 4 (0x100 - 0xb00)
-  SetFde32(&this->memory_, 0x5500, 0xfc, 0, 0x150, 0xa00);
-  // FDE 5 (0x50 - 0xa0)
-  SetFde32(&this->memory_, 0x5600, 0xfc, 0, 0x50, 0x50);
-  // FDE 6 (0x0 - 0x50)
-  SetFde32(&this->memory_, 0x5700, 0xfc, 0, 0, 0x50);
-
-  this->debug_frame_->Init(0x5000, 0x800, 0);
-
-  // Force reading all entries so no entries are found.
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0xfffff);
-  ASSERT_TRUE(fde == nullptr);
-
-  //   0x50  - 0xa0  FDE 5
-  fde = this->debug_frame_->GetFdeFromPc(0x60);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x50U, fde->pc_start);
-  EXPECT_EQ(0xa0U, fde->pc_end);
-
-  //   0x0   - 0x50   FDE 6
-  fde = this->debug_frame_->GetFdeFromPc(0x10);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0U, fde->pc_start);
-  EXPECT_EQ(0x50U, fde->pc_end);
-
-  //   0x100 - 0x200  FDE 0
-  fde = this->debug_frame_->GetFdeFromPc(0x170);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x100U, fde->pc_start);
-  EXPECT_EQ(0x200U, fde->pc_end);
-
-  //   0x200 - 0x300  FDE 4
-  fde = this->debug_frame_->GetFdeFromPc(0x210);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x150U, fde->pc_start);
-  EXPECT_EQ(0xb50U, fde->pc_end);
-
-  //   0x300 - 0x500  FDE 1
-  fde = this->debug_frame_->GetFdeFromPc(0x310);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x300U, fde->pc_start);
-  EXPECT_EQ(0x500U, fde->pc_end);
-
-  //   0x700 - 0x800  FDE 2
-  fde = this->debug_frame_->GetFdeFromPc(0x790);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x700U, fde->pc_start);
-  EXPECT_EQ(0x800U, fde->pc_end);
-
-  //   0x800 - 0x900  FDE 4
-  fde = this->debug_frame_->GetFdeFromPc(0x850);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x150U, fde->pc_start);
-  EXPECT_EQ(0xb50U, fde->pc_end);
-
-  //   0xa00 - 0xb00  FDE 3
-  fde = this->debug_frame_->GetFdeFromPc(0xa35);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0xa00U, fde->pc_start);
-  EXPECT_EQ(0xb00U, fde->pc_end);
-
-  //   0xb00 - 0xb50  FDE 4
-  fde = this->debug_frame_->GetFdeFromPc(0xb20);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x150U, fde->pc_start);
-  EXPECT_EQ(0xb50U, fde->pc_end);
-}
-
-TYPED_TEST_P(DwarfDebugFrameTest, GetFdeFromPc_overlap) {
-  SetCie32(&this->memory_, 0x5000, 0xfc, std::vector<uint8_t>{1, '\0', 0, 0, 1});
-
-  // FDE 0 (0x100 - 0x200)
-  SetFde32(&this->memory_, 0x5100, 0xfc, 0, 0x100, 0x100);
-  // FDE 1 (0x50 - 0x550)
-  SetFde32(&this->memory_, 0x5200, 0xfc, 0, 0x50, 0x500);
-  // FDE 2 (0x00 - 0x800)
-  SetFde32(&this->memory_, 0x5300, 0xfc, 0, 0x0, 0x800);
-
-  this->debug_frame_->Init(0x5000, 0x400, 0);
-
-  // Force reading all entries so no entries are found.
-  const DwarfFde* fde = this->debug_frame_->GetFdeFromPc(0xfffff);
-  ASSERT_TRUE(fde == nullptr);
-
-  //   0x0  - 0x50  FDE 2
-  fde = this->debug_frame_->GetFdeFromPc(0x10);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x0U, fde->pc_start);
-  EXPECT_EQ(0x800U, fde->pc_end);
-
-  //   0x50  - 0x100  FDE 1
-  fde = this->debug_frame_->GetFdeFromPc(0x60);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x50U, fde->pc_start);
-  EXPECT_EQ(0x550U, fde->pc_end);
-
-  //   0x100 - 0x200  FDE 0
-  fde = this->debug_frame_->GetFdeFromPc(0x170);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x100U, fde->pc_start);
-  EXPECT_EQ(0x200U, fde->pc_end);
-
-  //   0x200 - 0x550  FDE 1
-  fde = this->debug_frame_->GetFdeFromPc(0x210);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x50U, fde->pc_start);
-  EXPECT_EQ(0x550U, fde->pc_end);
-
-  //   0x550 - 0x800  FDE 2
-  fde = this->debug_frame_->GetFdeFromPc(0x580);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x0U, fde->pc_start);
-  EXPECT_EQ(0x800U, fde->pc_end);
-
-  fde = this->debug_frame_->GetFdeFromPc(0x810);
-  ASSERT_TRUE(fde == nullptr);
-}
-
-REGISTER_TYPED_TEST_SUITE_P(
-    DwarfDebugFrameTest, GetFdes32, GetFdes32_after_GetFdeFromPc, GetFdes32_not_in_section,
-    GetFdeFromPc32, GetFdeFromPc32_reverse, GetFdeFromPc32_not_in_section, GetFdes64,
-    GetFdes64_after_GetFdeFromPc, GetFdes64_not_in_section, GetFdeFromPc64, GetFdeFromPc64_reverse,
-    GetFdeFromPc64_not_in_section, GetCieFde32, GetCieFde64, GetCieFromOffset32_cie_cached,
-    GetCieFromOffset64_cie_cached, GetCieFromOffset32_version1, GetCieFromOffset64_version1,
-    GetCieFromOffset32_version3, GetCieFromOffset64_version3, GetCieFromOffset32_version4,
-    GetCieFromOffset64_version4, GetCieFromOffset32_version5, GetCieFromOffset64_version5,
-    GetCieFromOffset_version_invalid, GetCieFromOffset32_augment, GetCieFromOffset64_augment,
-    GetFdeFromOffset32_augment, GetFdeFromOffset64_augment, GetFdeFromOffset32_lsda_address,
-    GetFdeFromOffset64_lsda_address, GetFdeFromPc_interleaved, GetFdeFromPc_overlap);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfDebugFrameTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfDebugFrameTest, DwarfDebugFrameTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfEhFrameTest.cpp b/libunwindstack/tests/DwarfEhFrameTest.cpp
deleted file mode 100644
index 46a25a4..0000000
--- a/libunwindstack/tests/DwarfEhFrameTest.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-
-#include "DwarfEhFrame.h"
-#include "DwarfEncoding.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class DwarfEhFrameTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-    eh_frame_ = new DwarfEhFrame<TypeParam>(&memory_);
-    ResetLogs();
-  }
-
-  void TearDown() override { delete eh_frame_; }
-
-  MemoryFake memory_;
-  DwarfEhFrame<TypeParam>* eh_frame_ = nullptr;
-};
-TYPED_TEST_SUITE_P(DwarfEhFrameTest);
-
-// NOTE: All test class variables need to be referenced as this->.
-
-// Only verify different cie/fde format. All other DwarfSection corner
-// cases are tested in DwarfDebugFrameTest.cpp.
-
-TYPED_TEST_P(DwarfEhFrameTest, GetFdeCieFromOffset32) {
-  // CIE 32 information.
-  this->memory_.SetData32(0x5000, 0xfc);
-  // Indicates this is a cie for eh_frame.
-  this->memory_.SetData32(0x5004, 0);
-  this->memory_.SetMemory(0x5008, std::vector<uint8_t>{1, '\0', 16, 32, 1});
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x5100, 0xfc);
-  this->memory_.SetData32(0x5104, 0x104);
-  this->memory_.SetData32(0x5108, 0x1500);
-  this->memory_.SetData32(0x510c, 0x200);
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromOffset(0x5100);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x5000U, fde->cie_offset);
-  EXPECT_EQ(0x5110U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x5200U, fde->cfa_instructions_end);
-  EXPECT_EQ(0x6608U, fde->pc_start);
-  EXPECT_EQ(0x6808U, fde->pc_end);
-  EXPECT_EQ(0U, fde->lsda_address);
-
-  const DwarfCie* cie = fde->cie;
-  ASSERT_TRUE(cie != nullptr);
-  EXPECT_EQ(1U, cie->version);
-  EXPECT_EQ(DW_EH_PE_sdata4, cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, cie->lsda_encoding);
-  EXPECT_EQ(0U, cie->segment_size);
-  EXPECT_EQ('\0', cie->augmentation_string[0]);
-  EXPECT_EQ(0U, cie->personality_handler);
-  EXPECT_EQ(0x500dU, cie->cfa_instructions_offset);
-  EXPECT_EQ(0x5100U, cie->cfa_instructions_end);
-  EXPECT_EQ(16U, cie->code_alignment_factor);
-  EXPECT_EQ(32U, cie->data_alignment_factor);
-  EXPECT_EQ(1U, cie->return_address_register);
-}
-
-TYPED_TEST_P(DwarfEhFrameTest, GetFdeCieFromOffset64) {
-  // CIE 64 information.
-  this->memory_.SetData32(0x5000, 0xffffffff);
-  this->memory_.SetData64(0x5004, 0xfc);
-  // Indicates this is a cie for eh_frame.
-  this->memory_.SetData64(0x500c, 0);
-  this->memory_.SetMemory(0x5014, std::vector<uint8_t>{1, '\0', 16, 32, 1});
-
-  // FDE 64 information.
-  this->memory_.SetData32(0x5100, 0xffffffff);
-  this->memory_.SetData64(0x5104, 0xfc);
-  this->memory_.SetData64(0x510c, 0x10c);
-  this->memory_.SetData64(0x5114, 0x1500);
-  this->memory_.SetData64(0x511c, 0x200);
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromOffset(0x5100);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x5000U, fde->cie_offset);
-  EXPECT_EQ(0x5124U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x5208U, fde->cfa_instructions_end);
-  EXPECT_EQ(0x6618U, fde->pc_start);
-  EXPECT_EQ(0x6818U, fde->pc_end);
-  EXPECT_EQ(0U, fde->lsda_address);
-
-  const DwarfCie* cie = fde->cie;
-  ASSERT_TRUE(cie != nullptr);
-  EXPECT_EQ(1U, cie->version);
-  EXPECT_EQ(DW_EH_PE_sdata8, cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, cie->lsda_encoding);
-  EXPECT_EQ(0U, cie->segment_size);
-  EXPECT_EQ('\0', cie->augmentation_string[0]);
-  EXPECT_EQ(0U, cie->personality_handler);
-  EXPECT_EQ(0x5019U, cie->cfa_instructions_offset);
-  EXPECT_EQ(0x5108U, cie->cfa_instructions_end);
-  EXPECT_EQ(16U, cie->code_alignment_factor);
-  EXPECT_EQ(32U, cie->data_alignment_factor);
-  EXPECT_EQ(1U, cie->return_address_register);
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfEhFrameTest, GetFdeCieFromOffset32, GetFdeCieFromOffset64);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfEhFrameTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfEhFrameTest, DwarfEhFrameTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp b/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp
deleted file mode 100644
index 6aa3867..0000000
--- a/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-
-#include "DwarfEhFrameWithHdr.h"
-#include "DwarfEncoding.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class TestDwarfEhFrameWithHdr : public DwarfEhFrameWithHdr<TypeParam> {
- public:
-  TestDwarfEhFrameWithHdr(Memory* memory) : DwarfEhFrameWithHdr<TypeParam>(memory) {}
-  ~TestDwarfEhFrameWithHdr() = default;
-
-  void TestSetTableEncoding(uint8_t encoding) { this->table_encoding_ = encoding; }
-  void TestSetHdrEntriesOffset(uint64_t offset) { this->hdr_entries_offset_ = offset; }
-  void TestSetHdrEntriesDataOffset(uint64_t offset) { this->hdr_entries_data_offset_ = offset; }
-  void TestSetTableEntrySize(size_t size) { this->table_entry_size_ = size; }
-
-  void TestSetFdeCount(uint64_t count) { this->fde_count_ = count; }
-  void TestSetFdeInfo(uint64_t index, const typename DwarfEhFrameWithHdr<TypeParam>::FdeInfo& info) {
-    this->fde_info_[index] = info;
-  }
-
-  uint8_t TestGetVersion() { return this->version_; }
-  uint8_t TestGetTableEncoding() { return this->table_encoding_; }
-  uint64_t TestGetTableEntrySize() { return this->table_entry_size_; }
-  uint64_t TestGetFdeCount() { return this->fde_count_; }
-  uint64_t TestGetHdrEntriesOffset() { return this->hdr_entries_offset_; }
-  uint64_t TestGetHdrEntriesDataOffset() { return this->hdr_entries_data_offset_; }
-};
-
-template <typename TypeParam>
-class DwarfEhFrameWithHdrTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-    eh_frame_ = new TestDwarfEhFrameWithHdr<TypeParam>(&memory_);
-    ResetLogs();
-  }
-
-  void TearDown() override { delete eh_frame_; }
-
-  MemoryFake memory_;
-  TestDwarfEhFrameWithHdr<TypeParam>* eh_frame_ = nullptr;
-};
-TYPED_TEST_SUITE_P(DwarfEhFrameWithHdrTest);
-
-// NOTE: All test class variables need to be referenced as this->.
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, Init) {
-  this->memory_.SetMemory(
-      0x1000, std::vector<uint8_t>{0x1, DW_EH_PE_udata2, DW_EH_PE_udata4, DW_EH_PE_sdata4});
-  this->memory_.SetData16(0x1004, 0x500);
-  this->memory_.SetData32(0x1006, 126);
-
-  ASSERT_TRUE(this->eh_frame_->Init(0x1000, 0x100, 0));
-  EXPECT_EQ(1U, this->eh_frame_->TestGetVersion());
-  EXPECT_EQ(DW_EH_PE_sdata4, this->eh_frame_->TestGetTableEncoding());
-  EXPECT_EQ(4U, this->eh_frame_->TestGetTableEntrySize());
-  EXPECT_EQ(126U, this->eh_frame_->TestGetFdeCount());
-  EXPECT_EQ(0x100aU, this->eh_frame_->TestGetHdrEntriesOffset());
-  EXPECT_EQ(0x1000U, this->eh_frame_->TestGetHdrEntriesDataOffset());
-
-  // Verify a zero table entry size fails to init.
-  this->memory_.SetData8(0x1003, 0x1);
-  ASSERT_FALSE(this->eh_frame_->Init(0x1000, 0x100, 0));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->eh_frame_->LastErrorCode());
-  // Reset the value back to the original.
-  this->memory_.SetData8(0x1003, DW_EH_PE_sdata4);
-
-  // Verify a zero fde count fails to init.
-  this->memory_.SetData32(0x1006, 0);
-  ASSERT_FALSE(this->eh_frame_->Init(0x1000, 0x100, 0));
-  ASSERT_EQ(DWARF_ERROR_NO_FDES, this->eh_frame_->LastErrorCode());
-
-  // Verify an unexpected version will cause a fail.
-  this->memory_.SetData32(0x1006, 126);
-  this->memory_.SetData8(0x1000, 0);
-  ASSERT_FALSE(this->eh_frame_->Init(0x1000, 0x100, 0));
-  ASSERT_EQ(DWARF_ERROR_UNSUPPORTED_VERSION, this->eh_frame_->LastErrorCode());
-  this->memory_.SetData8(0x1000, 2);
-  ASSERT_FALSE(this->eh_frame_->Init(0x1000, 0x100, 0));
-  ASSERT_EQ(DWARF_ERROR_UNSUPPORTED_VERSION, this->eh_frame_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, Init_non_zero_load_bias) {
-  this->memory_.SetMemory(0x1000, std::vector<uint8_t>{0x1, DW_EH_PE_udata2, DW_EH_PE_udata4,
-                                                       DW_EH_PE_pcrel | DW_EH_PE_sdata4});
-  this->memory_.SetData16(0x1004, 0x500);
-  this->memory_.SetData32(0x1006, 1);
-  this->memory_.SetData32(0x100a, 0x2500);
-  this->memory_.SetData32(0x100e, 0x1400);
-
-  // CIE 32 information.
-  this->memory_.SetData32(0x1300, 0xfc);
-  this->memory_.SetData32(0x1304, 0);
-  this->memory_.SetMemory(0x1308, std::vector<uint8_t>{1, 'z', 'R', '\0', 0, 0, 0, 0, 0x1b});
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x1400, 0xfc);
-  this->memory_.SetData32(0x1404, 0x104);
-  this->memory_.SetData32(0x1408, 0x10f8);
-  this->memory_.SetData32(0x140c, 0x200);
-  this->memory_.SetData16(0x1410, 0);
-
-  ASSERT_TRUE(this->eh_frame_->EhFrameInit(0x1300, 0x200, 0x2000));
-  ASSERT_TRUE(this->eh_frame_->Init(0x1000, 0x100, 0x2000));
-  EXPECT_EQ(1U, this->eh_frame_->TestGetVersion());
-  EXPECT_EQ(0x1b, this->eh_frame_->TestGetTableEncoding());
-  EXPECT_EQ(4U, this->eh_frame_->TestGetTableEntrySize());
-  EXPECT_EQ(1U, this->eh_frame_->TestGetFdeCount());
-  EXPECT_EQ(0x100aU, this->eh_frame_->TestGetHdrEntriesOffset());
-  EXPECT_EQ(0x1000U, this->eh_frame_->TestGetHdrEntriesDataOffset());
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-  EXPECT_EQ(0x4700U, fde->pc_end);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, Init_non_zero_load_bias_different_from_eh_frame_bias) {
-  this->memory_.SetMemory(0x1000, std::vector<uint8_t>{0x1, DW_EH_PE_udata2, DW_EH_PE_udata4,
-                                                       DW_EH_PE_pcrel | DW_EH_PE_sdata4});
-  this->memory_.SetData16(0x1004, 0x500);
-  this->memory_.SetData32(0x1006, 1);
-  this->memory_.SetData32(0x100a, 0x2500);
-  this->memory_.SetData32(0x100e, 0x1400);
-
-  // CIE 32 information.
-  this->memory_.SetData32(0x1300, 0xfc);
-  this->memory_.SetData32(0x1304, 0);
-  this->memory_.SetMemory(0x1308, std::vector<uint8_t>{1, 'z', 'R', '\0', 0, 0, 0, 0, 0x1b});
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x1400, 0xfc);
-  this->memory_.SetData32(0x1404, 0x104);
-  this->memory_.SetData32(0x1408, 0x20f8);
-  this->memory_.SetData32(0x140c, 0x200);
-  this->memory_.SetData16(0x1410, 0);
-
-  ASSERT_TRUE(this->eh_frame_->EhFrameInit(0x1300, 0x200, 0x1000));
-  ASSERT_TRUE(this->eh_frame_->Init(0x1000, 0x100, 0x2000));
-  EXPECT_EQ(1U, this->eh_frame_->TestGetVersion());
-  EXPECT_EQ(0x1b, this->eh_frame_->TestGetTableEncoding());
-  EXPECT_EQ(4U, this->eh_frame_->TestGetTableEntrySize());
-  EXPECT_EQ(1U, this->eh_frame_->TestGetFdeCount());
-  EXPECT_EQ(0x100aU, this->eh_frame_->TestGetHdrEntriesOffset());
-  EXPECT_EQ(0x1000U, this->eh_frame_->TestGetHdrEntriesDataOffset());
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-  EXPECT_EQ(0x4700U, fde->pc_end);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeFromPc_wtih_empty_fde) {
-  this->memory_.SetMemory(0x1000, std::vector<uint8_t>{0x1, DW_EH_PE_udata2, DW_EH_PE_udata4,
-                                                       DW_EH_PE_pcrel | DW_EH_PE_sdata4});
-  this->memory_.SetData16(0x1004, 0x500);
-  this->memory_.SetData32(0x1006, 1);
-  this->memory_.SetData32(0x100a, 0x2500);
-  this->memory_.SetData32(0x100e, 0x1400);
-
-  // CIE 32 information.
-  this->memory_.SetData32(0x1300, 0xfc);
-  this->memory_.SetData32(0x1304, 0);
-  this->memory_.SetMemory(0x1308, std::vector<uint8_t>{1, 'z', 'R', '\0', 0, 0, 0, 0, 0x1b});
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x1400, 0xfc);
-  this->memory_.SetData32(0x1404, 0x104);
-  this->memory_.SetData32(0x1408, 0x30f8);
-  this->memory_.SetData32(0x140c, 0);
-  this->memory_.SetData16(0x1410, 0);
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x1500, 0xfc);
-  this->memory_.SetData32(0x1504, 0x204);
-  this->memory_.SetData32(0x1508, 0x2ff8);
-  this->memory_.SetData32(0x150c, 0x200);
-  this->memory_.SetData16(0x1510, 0);
-
-  ASSERT_TRUE(this->eh_frame_->EhFrameInit(0x1300, 0x300, 0));
-  ASSERT_TRUE(this->eh_frame_->Init(0x1000, 0x100, 0));
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromPc(0x4600);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x4500U, fde->pc_start);
-  EXPECT_EQ(0x4700U, fde->pc_end);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdes_with_empty_fde) {
-  this->memory_.SetMemory(0x1000, std::vector<uint8_t>{0x1, DW_EH_PE_udata2, DW_EH_PE_udata4,
-                                                       DW_EH_PE_pcrel | DW_EH_PE_sdata4});
-  this->memory_.SetData16(0x1004, 0x500);
-  this->memory_.SetData32(0x1006, 1);
-  this->memory_.SetData32(0x100a, 0x2500);
-  this->memory_.SetData32(0x100e, 0x1400);
-
-  // CIE 32 information.
-  this->memory_.SetData32(0x1300, 0xfc);
-  this->memory_.SetData32(0x1304, 0);
-  this->memory_.SetMemory(0x1308, std::vector<uint8_t>{1, 'z', 'R', '\0', 0, 0, 0, 0, 0x1b});
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x1400, 0xfc);
-  this->memory_.SetData32(0x1404, 0x104);
-  this->memory_.SetData32(0x1408, 0x30f8);
-  this->memory_.SetData32(0x140c, 0);
-  this->memory_.SetData16(0x1410, 0);
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x1500, 0xfc);
-  this->memory_.SetData32(0x1504, 0x204);
-  this->memory_.SetData32(0x1508, 0x2ff8);
-  this->memory_.SetData32(0x150c, 0x200);
-  this->memory_.SetData16(0x1510, 0);
-
-  ASSERT_TRUE(this->eh_frame_->EhFrameInit(0x1300, 0x300, 0));
-  ASSERT_TRUE(this->eh_frame_->Init(0x1000, 0x100, 0));
-
-  std::vector<const DwarfFde*> fdes;
-  this->eh_frame_->GetFdes(&fdes);
-  ASSERT_FALSE(fdes.empty());
-  ASSERT_EQ(1U, fdes.size());
-  EXPECT_EQ(0x4500U, fdes[0]->pc_start);
-  EXPECT_EQ(0x4700U, fdes[0]->pc_end);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdes) {
-  this->memory_.SetMemory(
-      0x1000, std::vector<uint8_t>{1, DW_EH_PE_udata2, DW_EH_PE_udata4, DW_EH_PE_sdata4});
-  this->memory_.SetData16(0x1004, 0x500);
-  this->memory_.SetData32(0x1006, 4);
-
-  // Header information.
-  this->memory_.SetData32(0x100a, 0x4600);
-  this->memory_.SetData32(0x100e, 0x1500);
-  this->memory_.SetData32(0x1012, 0x5500);
-  this->memory_.SetData32(0x1016, 0x1400);
-  this->memory_.SetData32(0x101a, 0x6800);
-  this->memory_.SetData32(0x101e, 0x1700);
-  this->memory_.SetData32(0x1022, 0x7700);
-  this->memory_.SetData32(0x1026, 0x1600);
-
-  // CIE 32 information.
-  this->memory_.SetData32(0x1300, 0xfc);
-  this->memory_.SetData32(0x1304, 0);
-  this->memory_.SetMemory(0x1308, std::vector<uint8_t>{1, '\0', 0, 0, 0});
-
-  // FDE 32 information.
-  // pc 0x5500 - 0x5700
-  this->memory_.SetData32(0x1400, 0xfc);
-  this->memory_.SetData32(0x1404, 0x104);
-  this->memory_.SetData32(0x1408, 0x40f8);
-  this->memory_.SetData32(0x140c, 0x200);
-
-  // pc 0x4600 - 0x4800
-  this->memory_.SetData32(0x1500, 0xfc);
-  this->memory_.SetData32(0x1504, 0x204);
-  this->memory_.SetData32(0x1508, 0x30f8);
-  this->memory_.SetData32(0x150c, 0x200);
-
-  // pc 0x7700 - 0x7900
-  this->memory_.SetData32(0x1600, 0xfc);
-  this->memory_.SetData32(0x1604, 0x304);
-  this->memory_.SetData32(0x1608, 0x60f8);
-  this->memory_.SetData32(0x160c, 0x200);
-
-  // pc 0x6800 - 0x6a00
-  this->memory_.SetData32(0x1700, 0xfc);
-  this->memory_.SetData32(0x1704, 0x404);
-  this->memory_.SetData32(0x1708, 0x50f8);
-  this->memory_.SetData32(0x170c, 0x200);
-
-  ASSERT_TRUE(this->eh_frame_->Init(0x1000, 0x100, 0));
-
-  std::vector<const DwarfFde*> fdes;
-  this->eh_frame_->GetFdes(&fdes);
-  ASSERT_EQ(4U, fdes.size());
-
-  EXPECT_EQ(0x4600U, fdes[0]->pc_start);
-  EXPECT_EQ(0x4800U, fdes[0]->pc_end);
-  EXPECT_EQ(0x5500U, fdes[1]->pc_start);
-  EXPECT_EQ(0x5700U, fdes[1]->pc_end);
-  EXPECT_EQ(0x6800U, fdes[2]->pc_start);
-  EXPECT_EQ(0x6a00U, fdes[2]->pc_end);
-  EXPECT_EQ(0x7700U, fdes[3]->pc_start);
-  EXPECT_EQ(0x7900U, fdes[3]->pc_end);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeInfoFromIndex_expect_cache_fail) {
-  this->eh_frame_->TestSetTableEntrySize(0x10);
-  this->eh_frame_->TestSetTableEncoding(DW_EH_PE_udata4);
-  this->eh_frame_->TestSetHdrEntriesOffset(0x1000);
-
-  ASSERT_TRUE(this->eh_frame_->GetFdeInfoFromIndex(0) == nullptr);
-  ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->eh_frame_->LastErrorCode());
-  EXPECT_EQ(0x1000U, this->eh_frame_->LastErrorAddress());
-  ASSERT_TRUE(this->eh_frame_->GetFdeInfoFromIndex(0) == nullptr);
-  ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->eh_frame_->LastErrorCode());
-  EXPECT_EQ(0x1000U, this->eh_frame_->LastErrorAddress());
-}
-
-// We are assuming that pc rel, is really relative to the load_bias.
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeInfoFromIndex_read_pcrel) {
-  this->eh_frame_->TestSetTableEncoding(DW_EH_PE_pcrel | DW_EH_PE_udata4);
-  this->eh_frame_->TestSetHdrEntriesOffset(0x1000);
-  this->eh_frame_->TestSetHdrEntriesDataOffset(0x3000);
-  this->eh_frame_->TestSetTableEntrySize(0x10);
-
-  this->memory_.SetData32(0x1040, 0x340);
-  this->memory_.SetData32(0x1044, 0x500);
-
-  auto info = this->eh_frame_->GetFdeInfoFromIndex(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x340U, info->pc);
-  EXPECT_EQ(0x500U, info->offset);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeInfoFromIndex_read_datarel) {
-  this->eh_frame_->TestSetTableEncoding(DW_EH_PE_datarel | DW_EH_PE_udata4);
-  this->eh_frame_->TestSetHdrEntriesOffset(0x1000);
-  this->eh_frame_->TestSetHdrEntriesDataOffset(0x3000);
-  this->eh_frame_->TestSetTableEntrySize(0x10);
-
-  this->memory_.SetData32(0x1040, 0x340);
-  this->memory_.SetData32(0x1044, 0x500);
-
-  auto info = this->eh_frame_->GetFdeInfoFromIndex(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x3340U, info->pc);
-  EXPECT_EQ(0x3500U, info->offset);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeInfoFromIndex_cached) {
-  this->eh_frame_->TestSetTableEncoding(DW_EH_PE_udata4);
-  this->eh_frame_->TestSetHdrEntriesOffset(0x1000);
-  this->eh_frame_->TestSetTableEntrySize(0x10);
-
-  this->memory_.SetData32(0x1040, 0x340);
-  this->memory_.SetData32(0x1044, 0x500);
-
-  auto info = this->eh_frame_->GetFdeInfoFromIndex(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x340U, info->pc);
-  EXPECT_EQ(0x500U, info->offset);
-
-  // Clear the memory so that this will fail if it doesn't read cached data.
-  this->memory_.Clear();
-
-  info = this->eh_frame_->GetFdeInfoFromIndex(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x340U, info->pc);
-  EXPECT_EQ(0x500U, info->offset);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetFromPc_verify) {
-  this->eh_frame_->TestSetTableEntrySize(0x10);
-
-  typename DwarfEhFrameWithHdr<TypeParam>::FdeInfo info;
-  for (size_t i = 0; i < 10; i++) {
-    info.pc = 0x1000 * (i + 1);
-    info.offset = 0x5000 + i * 0x20;
-    this->eh_frame_->TestSetFdeInfo(i, info);
-  }
-
-  uint64_t fde_offset;
-  this->eh_frame_->TestSetFdeCount(10);
-  EXPECT_FALSE(this->eh_frame_->GetFdeOffsetFromPc(0x100, &fde_offset));
-  // Not an error, just not found.
-  ASSERT_EQ(DWARF_ERROR_NONE, this->eh_frame_->LastErrorCode());
-  // Even number of elements.
-  for (size_t i = 0; i < 10; i++) {
-    SCOPED_TRACE(testing::Message() << "Failed at index " << i);
-    TypeParam pc = 0x1000 * (i + 1);
-    EXPECT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(pc, &fde_offset));
-    EXPECT_EQ(0x5000 + i * 0x20, fde_offset);
-    EXPECT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(pc + 1, &fde_offset));
-    EXPECT_EQ(0x5000 + i * 0x20, fde_offset);
-    EXPECT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(pc + 0xfff, &fde_offset));
-    EXPECT_EQ(0x5000 + i * 0x20, fde_offset);
-  }
-
-  // Odd number of elements.
-  this->eh_frame_->TestSetFdeCount(9);
-  for (size_t i = 0; i < 9; i++) {
-    SCOPED_TRACE(testing::Message() << "Failed at index " << i);
-    TypeParam pc = 0x1000 * (i + 1);
-    EXPECT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(pc, &fde_offset));
-    EXPECT_EQ(0x5000 + i * 0x20, fde_offset);
-    EXPECT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(pc + 1, &fde_offset));
-    EXPECT_EQ(0x5000 + i * 0x20, fde_offset);
-    EXPECT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(pc + 0xfff, &fde_offset));
-    EXPECT_EQ(0x5000 + i * 0x20, fde_offset);
-  }
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetFromPc_index_fail) {
-  this->eh_frame_->TestSetTableEntrySize(0x10);
-  this->eh_frame_->TestSetFdeCount(10);
-
-  uint64_t fde_offset;
-  EXPECT_FALSE(this->eh_frame_->GetFdeOffsetFromPc(0x1000, &fde_offset));
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetFromPc_fail_fde_count) {
-  this->eh_frame_->TestSetFdeCount(0);
-
-  uint64_t fde_offset;
-  ASSERT_FALSE(this->eh_frame_->GetFdeOffsetFromPc(0x100, &fde_offset));
-  ASSERT_EQ(DWARF_ERROR_NONE, this->eh_frame_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetFromPc_search) {
-  this->eh_frame_->TestSetTableEntrySize(16);
-  this->eh_frame_->TestSetFdeCount(10);
-
-  typename DwarfEhFrameWithHdr<TypeParam>::FdeInfo info;
-  info.pc = 0x550;
-  info.offset = 0x10500;
-  this->eh_frame_->TestSetFdeInfo(5, info);
-  info.pc = 0x750;
-  info.offset = 0x10700;
-  this->eh_frame_->TestSetFdeInfo(7, info);
-  info.pc = 0x850;
-  info.offset = 0x10800;
-  this->eh_frame_->TestSetFdeInfo(8, info);
-
-  uint64_t fde_offset;
-  ASSERT_TRUE(this->eh_frame_->GetFdeOffsetFromPc(0x800, &fde_offset));
-  EXPECT_EQ(0x10700U, fde_offset);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetCieFde32) {
-  // CIE 32 information.
-  this->memory_.SetData32(0xf000, 0x100);
-  this->memory_.SetData32(0xf004, 0);
-  this->memory_.SetMemory(0xf008, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-
-  // FDE 32 information.
-  this->memory_.SetData32(0x14000, 0x20);
-  this->memory_.SetData32(0x14004, 0x5004);
-  this->memory_.SetData32(0x14008, 0x9000);
-  this->memory_.SetData32(0x1400c, 0x100);
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromOffset(0x14000);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x14010U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x14024U, fde->cfa_instructions_end);
-  EXPECT_EQ(0x1d008U, fde->pc_start);
-  EXPECT_EQ(0x1d108U, fde->pc_end);
-  EXPECT_EQ(0xf000U, fde->cie_offset);
-  EXPECT_EQ(0U, fde->lsda_address);
-
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(1U, fde->cie->version);
-  EXPECT_EQ(DW_EH_PE_sdata4, fde->cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, fde->cie->lsda_encoding);
-  EXPECT_EQ(0U, fde->cie->segment_size);
-  EXPECT_EQ(1U, fde->cie->augmentation_string.size());
-  EXPECT_EQ('\0', fde->cie->augmentation_string[0]);
-  EXPECT_EQ(0U, fde->cie->personality_handler);
-  EXPECT_EQ(0xf00dU, fde->cie->cfa_instructions_offset);
-  EXPECT_EQ(0xf104U, fde->cie->cfa_instructions_end);
-  EXPECT_EQ(4U, fde->cie->code_alignment_factor);
-  EXPECT_EQ(8, fde->cie->data_alignment_factor);
-  EXPECT_EQ(0x20U, fde->cie->return_address_register);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetCieFde64) {
-  // CIE 64 information.
-  this->memory_.SetData32(0x6000, 0xffffffff);
-  this->memory_.SetData64(0x6004, 0x100);
-  this->memory_.SetData64(0x600c, 0);
-  this->memory_.SetMemory(0x6014, std::vector<uint8_t>{1, '\0', 4, 8, 0x20});
-
-  // FDE 64 information.
-  this->memory_.SetData32(0x8000, 0xffffffff);
-  this->memory_.SetData64(0x8004, 0x200);
-  this->memory_.SetData64(0x800c, 0x200c);
-  this->memory_.SetData64(0x8014, 0x5000);
-  this->memory_.SetData64(0x801c, 0x300);
-
-  const DwarfFde* fde = this->eh_frame_->GetFdeFromOffset(0x8000);
-  ASSERT_TRUE(fde != nullptr);
-  EXPECT_EQ(0x8024U, fde->cfa_instructions_offset);
-  EXPECT_EQ(0x820cU, fde->cfa_instructions_end);
-  EXPECT_EQ(0xd018U, fde->pc_start);
-  EXPECT_EQ(0xd318U, fde->pc_end);
-  EXPECT_EQ(0x6000U, fde->cie_offset);
-  EXPECT_EQ(0U, fde->lsda_address);
-
-  ASSERT_TRUE(fde->cie != nullptr);
-  EXPECT_EQ(1U, fde->cie->version);
-  EXPECT_EQ(DW_EH_PE_sdata8, fde->cie->fde_address_encoding);
-  EXPECT_EQ(DW_EH_PE_omit, fde->cie->lsda_encoding);
-  EXPECT_EQ(0U, fde->cie->segment_size);
-  EXPECT_EQ(1U, fde->cie->augmentation_string.size());
-  EXPECT_EQ('\0', fde->cie->augmentation_string[0]);
-  EXPECT_EQ(0U, fde->cie->personality_handler);
-  EXPECT_EQ(0x6019U, fde->cie->cfa_instructions_offset);
-  EXPECT_EQ(0x610cU, fde->cie->cfa_instructions_end);
-  EXPECT_EQ(4U, fde->cie->code_alignment_factor);
-  EXPECT_EQ(8, fde->cie->data_alignment_factor);
-  EXPECT_EQ(0x20U, fde->cie->return_address_register);
-}
-
-TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeFromPc_fde_not_found) {
-  this->eh_frame_->TestSetTableEntrySize(16);
-  this->eh_frame_->TestSetFdeCount(1);
-
-  typename DwarfEhFrameWithHdr<TypeParam>::FdeInfo info;
-  info.pc = 0x550;
-  info.offset = 0x10500;
-  this->eh_frame_->TestSetFdeInfo(0, info);
-
-  ASSERT_EQ(nullptr, this->eh_frame_->GetFdeFromPc(0x800));
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfEhFrameWithHdrTest, Init, Init_non_zero_load_bias,
-                            Init_non_zero_load_bias_different_from_eh_frame_bias,
-                            GetFdeFromPc_wtih_empty_fde, GetFdes_with_empty_fde, GetFdes,
-                            GetFdeInfoFromIndex_expect_cache_fail, GetFdeInfoFromIndex_read_pcrel,
-                            GetFdeInfoFromIndex_read_datarel, GetFdeInfoFromIndex_cached,
-                            GetFdeOffsetFromPc_verify, GetFdeOffsetFromPc_index_fail,
-                            GetFdeOffsetFromPc_fail_fde_count, GetFdeOffsetFromPc_search,
-                            GetCieFde32, GetCieFde64, GetFdeFromPc_fde_not_found);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfEhFrameWithHdrTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfEhFrameWithHdrTest, DwarfEhFrameWithHdrTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfMemoryTest.cpp b/libunwindstack/tests/DwarfMemoryTest.cpp
deleted file mode 100644
index 650e965..0000000
--- a/libunwindstack/tests/DwarfMemoryTest.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <ios>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfMemory.h>
-
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class DwarfMemoryTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-    dwarf_mem_.reset(new DwarfMemory(&memory_));
-  }
-
-  template <typename AddressType>
-  void GetEncodedSizeTest(uint8_t value, size_t expected);
-  template <typename AddressType>
-  void ReadEncodedValue_omit();
-  template <typename AddressType>
-  void ReadEncodedValue_leb128();
-  template <typename AddressType>
-  void ReadEncodedValue_data1();
-  template <typename AddressType>
-  void ReadEncodedValue_data2();
-  template <typename AddressType>
-  void ReadEncodedValue_data4();
-  template <typename AddressType>
-  void ReadEncodedValue_data8();
-  template <typename AddressType>
-  void ReadEncodedValue_non_zero_adjust();
-  template <typename AddressType>
-  void ReadEncodedValue_overflow();
-  template <typename AddressType>
-  void ReadEncodedValue_high_bit_set();
-  template <typename AddressType>
-  void ReadEncodedValue_all();
-
-  MemoryFake memory_;
-  std::unique_ptr<DwarfMemory> dwarf_mem_;
-};
-
-TEST_F(DwarfMemoryTest, ReadBytes) {
-  memory_.SetMemory(0, std::vector<uint8_t>{0x10, 0x18, 0xff, 0xfe});
-
-  uint8_t byte;
-  ASSERT_TRUE(dwarf_mem_->ReadBytes(&byte, 1));
-  ASSERT_EQ(0x10U, byte);
-  ASSERT_TRUE(dwarf_mem_->ReadBytes(&byte, 1));
-  ASSERT_EQ(0x18U, byte);
-  ASSERT_TRUE(dwarf_mem_->ReadBytes(&byte, 1));
-  ASSERT_EQ(0xffU, byte);
-  ASSERT_TRUE(dwarf_mem_->ReadBytes(&byte, 1));
-  ASSERT_EQ(0xfeU, byte);
-  ASSERT_EQ(4U, dwarf_mem_->cur_offset());
-
-  dwarf_mem_->set_cur_offset(2);
-  ASSERT_TRUE(dwarf_mem_->ReadBytes(&byte, 1));
-  ASSERT_EQ(0xffU, byte);
-  ASSERT_EQ(3U, dwarf_mem_->cur_offset());
-}
-
-TEST_F(DwarfMemoryTest, ReadSigned_check) {
-  uint64_t value;
-
-  // Signed 8 byte reads.
-  memory_.SetData8(0, static_cast<uint8_t>(-10));
-  memory_.SetData8(1, 200);
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int8_t>(&value));
-  ASSERT_EQ(static_cast<int8_t>(-10), static_cast<int8_t>(value));
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int8_t>(&value));
-  ASSERT_EQ(static_cast<int8_t>(200), static_cast<int8_t>(value));
-
-  // Signed 16 byte reads.
-  memory_.SetData16(0x10, static_cast<uint16_t>(-1000));
-  memory_.SetData16(0x12, 50100);
-  dwarf_mem_->set_cur_offset(0x10);
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int16_t>(&value));
-  ASSERT_EQ(static_cast<int16_t>(-1000), static_cast<int16_t>(value));
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int16_t>(&value));
-  ASSERT_EQ(static_cast<int16_t>(50100), static_cast<int16_t>(value));
-
-  // Signed 32 byte reads.
-  memory_.SetData32(0x100, static_cast<uint32_t>(-1000000000));
-  memory_.SetData32(0x104, 3000000000);
-  dwarf_mem_->set_cur_offset(0x100);
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int32_t>(&value));
-  ASSERT_EQ(static_cast<int32_t>(-1000000000), static_cast<int32_t>(value));
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int32_t>(&value));
-  ASSERT_EQ(static_cast<int32_t>(3000000000), static_cast<int32_t>(value));
-
-  // Signed 64 byte reads.
-  memory_.SetData64(0x200, static_cast<uint64_t>(-2000000000000LL));
-  memory_.SetData64(0x208, 5000000000000LL);
-  dwarf_mem_->set_cur_offset(0x200);
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int64_t>(&value));
-  ASSERT_EQ(static_cast<int64_t>(-2000000000000), static_cast<int64_t>(value));
-  ASSERT_TRUE(dwarf_mem_->ReadSigned<int64_t>(&value));
-  ASSERT_EQ(static_cast<int64_t>(5000000000000), static_cast<int64_t>(value));
-}
-
-TEST_F(DwarfMemoryTest, ReadULEB128) {
-  memory_.SetMemory(0, std::vector<uint8_t>{0x01, 0x80, 0x24, 0xff, 0xc3, 0xff, 0x7f});
-
-  uint64_t value;
-  ASSERT_TRUE(dwarf_mem_->ReadULEB128(&value));
-  ASSERT_EQ(1U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(1U, value);
-
-  ASSERT_TRUE(dwarf_mem_->ReadULEB128(&value));
-  ASSERT_EQ(3U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x1200U, value);
-
-  ASSERT_TRUE(dwarf_mem_->ReadULEB128(&value));
-  ASSERT_EQ(7U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0xfffe1ffU, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadSLEB128) {
-  memory_.SetMemory(0, std::vector<uint8_t>{0x06, 0x40, 0x82, 0x34, 0x89, 0x64, 0xf9, 0xc3, 0x8f,
-                                            0x2f, 0xbf, 0xc3, 0xf7, 0x5f});
-
-  int64_t value;
-  ASSERT_TRUE(dwarf_mem_->ReadSLEB128(&value));
-  ASSERT_EQ(1U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(6U, value);
-
-  ASSERT_TRUE(dwarf_mem_->ReadSLEB128(&value));
-  ASSERT_EQ(2U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0xffffffffffffffc0ULL, static_cast<uint64_t>(value));
-
-  ASSERT_TRUE(dwarf_mem_->ReadSLEB128(&value));
-  ASSERT_EQ(4U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x1a02U, value);
-
-  ASSERT_TRUE(dwarf_mem_->ReadSLEB128(&value));
-  ASSERT_EQ(6U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0xfffffffffffff209ULL, static_cast<uint64_t>(value));
-
-  ASSERT_TRUE(dwarf_mem_->ReadSLEB128(&value));
-  ASSERT_EQ(10U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x5e3e1f9U, value);
-
-  ASSERT_TRUE(dwarf_mem_->ReadSLEB128(&value));
-  ASSERT_EQ(14U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0xfffffffffbfde1bfULL, static_cast<uint64_t>(value));
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::GetEncodedSizeTest(uint8_t value, size_t expected) {
-  for (size_t i = 0; i < 16; i++) {
-    uint8_t encoding = (i << 4) | value;
-    ASSERT_EQ(expected, dwarf_mem_->GetEncodedSize<AddressType>(encoding))
-        << "encoding 0x" << std::hex << static_cast<uint32_t>(encoding) << " test value 0x"
-        << static_cast<size_t>(value);
-  }
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_absptr_uint32_t) {
-  GetEncodedSizeTest<uint32_t>(0, sizeof(uint32_t));
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_absptr_uint64_t) {
-  GetEncodedSizeTest<uint64_t>(0, sizeof(uint64_t));
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_data1) {
-  // udata1
-  GetEncodedSizeTest<uint32_t>(0x0d, 1);
-  GetEncodedSizeTest<uint64_t>(0x0d, 1);
-
-  // sdata1
-  GetEncodedSizeTest<uint32_t>(0x0e, 1);
-  GetEncodedSizeTest<uint64_t>(0x0e, 1);
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_data2) {
-  // udata2
-  GetEncodedSizeTest<uint32_t>(0x02, 2);
-  GetEncodedSizeTest<uint64_t>(0x02, 2);
-
-  // sdata2
-  GetEncodedSizeTest<uint32_t>(0x0a, 2);
-  GetEncodedSizeTest<uint64_t>(0x0a, 2);
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_data4) {
-  // udata4
-  GetEncodedSizeTest<uint32_t>(0x03, 4);
-  GetEncodedSizeTest<uint64_t>(0x03, 4);
-
-  // sdata4
-  GetEncodedSizeTest<uint32_t>(0x0b, 4);
-  GetEncodedSizeTest<uint64_t>(0x0b, 4);
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_data8) {
-  // udata8
-  GetEncodedSizeTest<uint32_t>(0x04, 8);
-  GetEncodedSizeTest<uint64_t>(0x04, 8);
-
-  // sdata8
-  GetEncodedSizeTest<uint32_t>(0x0c, 8);
-  GetEncodedSizeTest<uint64_t>(0x0c, 8);
-}
-
-TEST_F(DwarfMemoryTest, GetEncodedSize_unknown) {
-  GetEncodedSizeTest<uint32_t>(0x01, 0);
-  GetEncodedSizeTest<uint64_t>(0x01, 0);
-
-  GetEncodedSizeTest<uint32_t>(0x09, 0);
-  GetEncodedSizeTest<uint64_t>(0x09, 0);
-
-  GetEncodedSizeTest<uint32_t>(0x0f, 0);
-  GetEncodedSizeTest<uint64_t>(0x0f, 0);
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_omit() {
-  uint64_t value = 123;
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0xff, &value));
-  ASSERT_EQ(0U, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_omit_uint32_t) {
-  ReadEncodedValue_omit<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_omit_uint64_t) {
-  ReadEncodedValue_omit<uint64_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_absptr_uint32_t) {
-  uint64_t value = 100;
-  ASSERT_FALSE(dwarf_mem_->ReadEncodedValue<uint32_t>(0x00, &value));
-
-  memory_.SetData32(0, 0x12345678);
-
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<uint32_t>(0x00, &value));
-  ASSERT_EQ(4U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x12345678U, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_absptr_uint64_t) {
-  uint64_t value = 100;
-  ASSERT_FALSE(dwarf_mem_->ReadEncodedValue<uint64_t>(0x00, &value));
-
-  memory_.SetData64(0, 0x12345678f1f2f3f4ULL);
-
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<uint64_t>(0x00, &value));
-  ASSERT_EQ(8U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x12345678f1f2f3f4ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_aligned_uint32_t) {
-  uint64_t value = 100;
-  dwarf_mem_->set_cur_offset(1);
-  ASSERT_FALSE(dwarf_mem_->ReadEncodedValue<uint32_t>(0x50, &value));
-
-  memory_.SetData32(4, 0x12345678);
-
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<uint32_t>(0x50, &value));
-  ASSERT_EQ(8U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x12345678U, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_aligned_uint64_t) {
-  uint64_t value = 100;
-  dwarf_mem_->set_cur_offset(1);
-  ASSERT_FALSE(dwarf_mem_->ReadEncodedValue<uint64_t>(0x50, &value));
-
-  memory_.SetData64(8, 0x12345678f1f2f3f4ULL);
-
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<uint64_t>(0x50, &value));
-  ASSERT_EQ(16U, dwarf_mem_->cur_offset());
-  ASSERT_EQ(0x12345678f1f2f3f4ULL, value);
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_leb128() {
-  memory_.SetMemory(0, std::vector<uint8_t>{0x80, 0x42});
-
-  uint64_t value = 100;
-  // uleb128
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x01, &value));
-  ASSERT_EQ(0x2100U, value);
-
-  dwarf_mem_->set_cur_offset(0);
-  // sleb128
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x09, &value));
-  ASSERT_EQ(0xffffffffffffe100ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_leb128_uint32_t) {
-  ReadEncodedValue_leb128<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_leb128_uint64_t) {
-  ReadEncodedValue_leb128<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_data1() {
-  memory_.SetData8(0, 0xe0);
-
-  uint64_t value = 0;
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x0d, &value));
-  ASSERT_EQ(0xe0U, value);
-
-  dwarf_mem_->set_cur_offset(0);
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x0e, &value));
-  ASSERT_EQ(0xffffffffffffffe0ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data1_uint32_t) {
-  ReadEncodedValue_data1<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data1_uint64_t) {
-  ReadEncodedValue_data1<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_data2() {
-  memory_.SetData16(0, 0xe000);
-
-  uint64_t value = 0;
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x02, &value));
-  ASSERT_EQ(0xe000U, value);
-
-  dwarf_mem_->set_cur_offset(0);
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x0a, &value));
-  ASSERT_EQ(0xffffffffffffe000ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data2_uint32_t) {
-  ReadEncodedValue_data2<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data2_uint64_t) {
-  ReadEncodedValue_data2<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_data4() {
-  memory_.SetData32(0, 0xe0000000);
-
-  uint64_t value = 0;
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x03, &value));
-  ASSERT_EQ(0xe0000000U, value);
-
-  dwarf_mem_->set_cur_offset(0);
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x0b, &value));
-  ASSERT_EQ(0xffffffffe0000000ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data4_uint32_t) {
-  ReadEncodedValue_data4<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data4_uint64_t) {
-  ReadEncodedValue_data4<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_data8() {
-  memory_.SetData64(0, 0xe000000000000000ULL);
-
-  uint64_t value = 0;
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x04, &value));
-  ASSERT_EQ(0xe000000000000000ULL, value);
-
-  dwarf_mem_->set_cur_offset(0);
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x0c, &value));
-  ASSERT_EQ(0xe000000000000000ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data8_uint32_t) {
-  ReadEncodedValue_data8<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_data8_uint64_t) {
-  ReadEncodedValue_data8<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_non_zero_adjust() {
-  memory_.SetData64(0, 0xe000000000000000ULL);
-
-  uint64_t value = 0;
-  dwarf_mem_->set_pc_offset(0x2000);
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0x14, &value));
-  ASSERT_EQ(0xe000000000002000ULL, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_non_zero_adjust_uint32_t) {
-  ReadEncodedValue_non_zero_adjust<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_non_zero_adjust_uint64_t) {
-  ReadEncodedValue_non_zero_adjust<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_overflow() {
-  memory_.SetData64(0, 0);
-
-  uint64_t value = 0;
-  dwarf_mem_->set_cur_offset(UINT64_MAX);
-  ASSERT_FALSE(dwarf_mem_->ReadEncodedValue<AddressType>(0x50, &value));
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_overflow_uint32_t) {
-  ReadEncodedValue_overflow<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_overflow_uint64_t) {
-  ReadEncodedValue_overflow<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_high_bit_set() {
-  uint64_t value;
-  memory_.SetData32(0, 0x15234);
-  ASSERT_FALSE(dwarf_mem_->ReadEncodedValue<AddressType>(0xc3, &value));
-
-  dwarf_mem_->set_func_offset(0x60000);
-  dwarf_mem_->set_cur_offset(0);
-  ASSERT_TRUE(dwarf_mem_->ReadEncodedValue<AddressType>(0xc3, &value));
-  ASSERT_EQ(0x75234U, value);
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_high_bit_set_uint32_t) {
-  ReadEncodedValue_high_bit_set<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_high_bit_set_uint64_t) {
-  ReadEncodedValue_high_bit_set<uint64_t>();
-}
-
-template <typename AddressType>
-void DwarfMemoryTest::ReadEncodedValue_all() {
-  MemoryFakeAlwaysReadZero memory;
-  DwarfMemory dwarf_mem(&memory);
-
-  for (size_t i = 0; i <= 0xff; i++) {
-    uint64_t value;
-    if (dwarf_mem.ReadEncodedValue<AddressType>(static_cast<uint8_t>(i), &value)) {
-      ASSERT_EQ(0U, value);
-    }
-  }
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_all_uint32_t) {
-  ReadEncodedValue_all<uint32_t>();
-}
-
-TEST_F(DwarfMemoryTest, ReadEncodedValue_all_uint64_t) {
-  ReadEncodedValue_all<uint64_t>();
-}
-
-TEST_F(DwarfMemoryTest, AdjustEncodedValue_absptr) {
-  uint64_t value = 0x1234;
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x00, &value));
-  ASSERT_EQ(0x1234U, value);
-}
-
-TEST_F(DwarfMemoryTest, AdjustEncodedValue_pcrel) {
-  uint64_t value = 0x1234;
-  ASSERT_FALSE(dwarf_mem_->AdjustEncodedValue(0x10, &value));
-
-  dwarf_mem_->set_pc_offset(0x2000);
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x10, &value));
-  ASSERT_EQ(0x3234U, value);
-
-  dwarf_mem_->set_pc_offset(static_cast<uint64_t>(-4));
-  value = 0x1234;
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x10, &value));
-  ASSERT_EQ(0x1230U, value);
-}
-
-TEST_F(DwarfMemoryTest, AdjustEncodedValue_textrel) {
-  uint64_t value = 0x8234;
-  ASSERT_FALSE(dwarf_mem_->AdjustEncodedValue(0x20, &value));
-
-  dwarf_mem_->set_text_offset(0x1000);
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x20, &value));
-  ASSERT_EQ(0x9234U, value);
-
-  dwarf_mem_->set_text_offset(static_cast<uint64_t>(-16));
-  value = 0x8234;
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x20, &value));
-  ASSERT_EQ(0x8224U, value);
-}
-
-TEST_F(DwarfMemoryTest, AdjustEncodedValue_datarel) {
-  uint64_t value = 0xb234;
-  ASSERT_FALSE(dwarf_mem_->AdjustEncodedValue(0x30, &value));
-
-  dwarf_mem_->set_data_offset(0x1200);
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x30, &value));
-  ASSERT_EQ(0xc434U, value);
-
-  dwarf_mem_->set_data_offset(static_cast<uint64_t>(-256));
-  value = 0xb234;
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x30, &value));
-  ASSERT_EQ(0xb134U, value);
-}
-
-TEST_F(DwarfMemoryTest, AdjustEncodedValue_funcrel) {
-  uint64_t value = 0x15234;
-  ASSERT_FALSE(dwarf_mem_->AdjustEncodedValue(0x40, &value));
-
-  dwarf_mem_->set_func_offset(0x60000);
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x40, &value));
-  ASSERT_EQ(0x75234U, value);
-
-  dwarf_mem_->set_func_offset(static_cast<uint64_t>(-4096));
-  value = 0x15234;
-  ASSERT_TRUE(dwarf_mem_->AdjustEncodedValue(0x40, &value));
-  ASSERT_EQ(0x14234U, value);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfOpLogTest.cpp b/libunwindstack/tests/DwarfOpLogTest.cpp
deleted file mode 100644
index 8dbf6e8..0000000
--- a/libunwindstack/tests/DwarfOpLogTest.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <ios>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Regs.h>
-
-#include "DwarfOp.h"
-
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class DwarfOpLogTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    op_memory_.Clear();
-    regular_memory_.Clear();
-    mem_.reset(new DwarfMemory(&op_memory_));
-    op_.reset(new DwarfOp<TypeParam>(mem_.get(), &regular_memory_));
-  }
-
-  MemoryFake op_memory_;
-  MemoryFake regular_memory_;
-
-  std::unique_ptr<DwarfMemory> mem_;
-  std::unique_ptr<DwarfOp<TypeParam>> op_;
-};
-TYPED_TEST_SUITE_P(DwarfOpLogTest);
-
-TYPED_TEST_P(DwarfOpLogTest, multiple_ops) {
-  // Multi operation opcodes.
-  std::vector<uint8_t> opcode_buffer = {
-      0x0a, 0x20, 0x10, 0x08, 0x03, 0x12, 0x27,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  std::vector<std::string> lines;
-  this->op_->GetLogInfo(0, opcode_buffer.size(), &lines);
-  std::vector<std::string> expected{
-      "DW_OP_const2u 4128", "Raw Data: 0x0a 0x20 0x10", "DW_OP_const1u 3", "Raw Data: 0x08 0x03",
-      "DW_OP_dup",          "Raw Data: 0x12",           "DW_OP_xor",       "Raw Data: 0x27"};
-  ASSERT_EQ(expected, lines);
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfOpLogTest, multiple_ops);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfOpLogTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfOpLogTest, DwarfOpLogTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfOpTest.cpp b/libunwindstack/tests/DwarfOpTest.cpp
deleted file mode 100644
index 0e2d91a..0000000
--- a/libunwindstack/tests/DwarfOpTest.cpp
+++ /dev/null
@@ -1,1586 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <ios>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/Log.h>
-
-#include "DwarfOp.h"
-
-#include "MemoryFake.h"
-#include "RegsFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class DwarfOpTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    op_memory_.Clear();
-    regular_memory_.Clear();
-    mem_.reset(new DwarfMemory(&op_memory_));
-    op_.reset(new DwarfOp<TypeParam>(mem_.get(), &regular_memory_));
-  }
-
-  MemoryFake op_memory_;
-  MemoryFake regular_memory_;
-
-  std::unique_ptr<DwarfMemory> mem_;
-  std::unique_ptr<DwarfOp<TypeParam>> op_;
-};
-TYPED_TEST_SUITE_P(DwarfOpTest);
-
-TYPED_TEST_P(DwarfOpTest, decode) {
-  // Memory error.
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
-  EXPECT_EQ(0U, this->op_->LastErrorAddress());
-
-  // No error.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x96});
-  this->mem_->set_cur_offset(0);
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_NONE, this->op_->LastErrorCode());
-  ASSERT_EQ(0x96U, this->op_->cur_op());
-  ASSERT_EQ(1U, this->mem_->cur_offset());
-}
-
-TYPED_TEST_P(DwarfOpTest, eval) {
-  // Memory error.
-  ASSERT_FALSE(this->op_->Eval(0, 2));
-  ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
-  EXPECT_EQ(0U, this->op_->LastErrorAddress());
-
-  // Register set.
-  // Do this first, to verify that subsequent calls reset the value.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x50});
-  ASSERT_TRUE(this->op_->Eval(0, 1));
-  ASSERT_TRUE(this->op_->is_register());
-  ASSERT_EQ(1U, this->mem_->cur_offset());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  // Multi operation opcodes.
-  std::vector<uint8_t> opcode_buffer = {
-      0x08, 0x04, 0x08, 0x03, 0x08, 0x02, 0x08, 0x01,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Eval(0, 8));
-  ASSERT_EQ(DWARF_ERROR_NONE, this->op_->LastErrorCode());
-  ASSERT_FALSE(this->op_->is_register());
-  ASSERT_EQ(8U, this->mem_->cur_offset());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(1U, this->op_->StackAt(0));
-  ASSERT_EQ(2U, this->op_->StackAt(1));
-  ASSERT_EQ(3U, this->op_->StackAt(2));
-  ASSERT_EQ(4U, this->op_->StackAt(3));
-
-  // Infinite loop.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x2f, 0xfd, 0xff});
-  ASSERT_FALSE(this->op_->Eval(0, 4));
-  ASSERT_EQ(DWARF_ERROR_TOO_MANY_ITERATIONS, this->op_->LastErrorCode());
-  ASSERT_FALSE(this->op_->is_register());
-  ASSERT_EQ(0U, this->op_->StackSize());
-}
-
-TYPED_TEST_P(DwarfOpTest, illegal_opcode) {
-  // Fill the buffer with all of the illegal opcodes.
-  std::vector<uint8_t> opcode_buffer = {0x00, 0x01, 0x02, 0x04, 0x05, 0x07};
-  for (size_t opcode = 0xa0; opcode < 256; opcode++) {
-    opcode_buffer.push_back(opcode);
-  }
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  for (size_t i = 0; i < opcode_buffer.size(); i++) {
-    ASSERT_FALSE(this->op_->Decode());
-    ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-    ASSERT_EQ(opcode_buffer[i], this->op_->cur_op());
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, not_implemented) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Push values so that any not implemented ops will return the right error.
-      0x08, 0x03, 0x08, 0x02, 0x08, 0x01,
-      // xderef
-      0x18,
-      // fbreg
-      0x91, 0x01,
-      // piece
-      0x93, 0x01,
-      // xderef_size
-      0x95, 0x01,
-      // push_object_address
-      0x97,
-      // call2
-      0x98, 0x01, 0x02,
-      // call4
-      0x99, 0x01, 0x02, 0x03, 0x04,
-      // call_ref
-      0x9a,
-      // form_tls_address
-      0x9b,
-      // call_frame_cfa
-      0x9c,
-      // bit_piece
-      0x9d, 0x01, 0x01,
-      // implicit_value
-      0x9e, 0x01,
-      // stack_value
-      0x9f,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  // Push the stack values.
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_TRUE(this->op_->Decode());
-
-  while (this->mem_->cur_offset() < opcode_buffer.size()) {
-    ASSERT_FALSE(this->op_->Decode());
-    ASSERT_EQ(DWARF_ERROR_NOT_IMPLEMENTED, this->op_->LastErrorCode());
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_addr) {
-  std::vector<uint8_t> opcode_buffer = {0x03, 0x12, 0x23, 0x34, 0x45};
-  if (sizeof(TypeParam) == 8) {
-    opcode_buffer.push_back(0x56);
-    opcode_buffer.push_back(0x67);
-    opcode_buffer.push_back(0x78);
-    opcode_buffer.push_back(0x89);
-  }
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x03, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x45342312U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x8978675645342312UL, this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_deref) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Try a dereference with nothing on the stack.
-      0x06,
-      // Add an address, then dereference.
-      0x0a, 0x10, 0x20, 0x06,
-      // Now do another dereference that should fail in memory.
-      0x06,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-  TypeParam value = 0x12345678;
-  this->regular_memory_.SetMemory(0x2010, &value, sizeof(value));
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x06, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(value, this->op_->StackAt(0));
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
-  ASSERT_EQ(0x12345678U, this->op_->LastErrorAddress());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_deref_size) {
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x94});
-  TypeParam value = 0x12345678;
-  this->regular_memory_.SetMemory(0x2010, &value, sizeof(value));
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  // Read all byte sizes up to the sizeof the type.
-  for (size_t i = 1; i < sizeof(TypeParam); i++) {
-    this->op_memory_.SetMemory(
-        0, std::vector<uint8_t>{0x0a, 0x10, 0x20, 0x94, static_cast<uint8_t>(i)});
-    ASSERT_TRUE(this->op_->Eval(0, 5)) << "Failed at size " << i;
-    ASSERT_EQ(1U, this->op_->StackSize()) << "Failed at size " << i;
-    ASSERT_EQ(0x94, this->op_->cur_op()) << "Failed at size " << i;
-    TypeParam expected_value = 0;
-    memcpy(&expected_value, &value, i);
-    ASSERT_EQ(expected_value, this->op_->StackAt(0)) << "Failed at size " << i;
-  }
-
-  // Zero byte read.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0a, 0x10, 0x20, 0x94, 0x00});
-  ASSERT_FALSE(this->op_->Eval(0, 5));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-
-  // Read too many bytes.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0a, 0x10, 0x20, 0x94, sizeof(TypeParam) + 1});
-  ASSERT_FALSE(this->op_->Eval(0, 5));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-
-  // Force bad memory read.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0a, 0x10, 0x40, 0x94, 0x01});
-  ASSERT_FALSE(this->op_->Eval(0, 5));
-  ASSERT_EQ(DWARF_ERROR_MEMORY_INVALID, this->op_->LastErrorCode());
-  EXPECT_EQ(0x4010U, this->op_->LastErrorAddress());
-}
-
-TYPED_TEST_P(DwarfOpTest, const_unsigned) {
-  std::vector<uint8_t> opcode_buffer = {
-      // const1u
-      0x08, 0x12, 0x08, 0xff,
-      // const2u
-      0x0a, 0x45, 0x12, 0x0a, 0x00, 0xff,
-      // const4u
-      0x0c, 0x12, 0x23, 0x34, 0x45, 0x0c, 0x03, 0x02, 0x01, 0xff,
-      // const8u
-      0x0e, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x0e, 0x87, 0x98, 0xa9, 0xba, 0xcb,
-      0xdc, 0xed, 0xfe,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  // const1u
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x08, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x12U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x08, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0xffU, this->op_->StackAt(0));
-
-  // const2u
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0a, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x1245U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0a, this->op_->cur_op());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(0xff00U, this->op_->StackAt(0));
-
-  // const4u
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0c, this->op_->cur_op());
-  ASSERT_EQ(5U, this->op_->StackSize());
-  ASSERT_EQ(0x45342312U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0c, this->op_->cur_op());
-  ASSERT_EQ(6U, this->op_->StackSize());
-  ASSERT_EQ(0xff010203U, this->op_->StackAt(0));
-
-  // const8u
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0e, this->op_->cur_op());
-  ASSERT_EQ(7U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x05060708U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x0102030405060708ULL, this->op_->StackAt(0));
-  }
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0e, this->op_->cur_op());
-  ASSERT_EQ(8U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0xbaa99887UL, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0xfeeddccbbaa99887ULL, this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, const_signed) {
-  std::vector<uint8_t> opcode_buffer = {
-      // const1s
-      0x09, 0x12, 0x09, 0xff,
-      // const2s
-      0x0b, 0x21, 0x32, 0x0b, 0x08, 0xff,
-      // const4s
-      0x0d, 0x45, 0x34, 0x23, 0x12, 0x0d, 0x01, 0x02, 0x03, 0xff,
-      // const8s
-      0x0f, 0x89, 0x78, 0x67, 0x56, 0x45, 0x34, 0x23, 0x12, 0x0f, 0x04, 0x03, 0x02, 0x01, 0xef,
-      0xef, 0xef, 0xff,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  // const1s
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x09, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x12U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x09, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-1), this->op_->StackAt(0));
-
-  // const2s
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0b, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x3221U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0b, this->op_->cur_op());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-248), this->op_->StackAt(0));
-
-  // const4s
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0d, this->op_->cur_op());
-  ASSERT_EQ(5U, this->op_->StackSize());
-  ASSERT_EQ(0x12233445U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0d, this->op_->cur_op());
-  ASSERT_EQ(6U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-16580095), this->op_->StackAt(0));
-
-  // const8s
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0f, this->op_->cur_op());
-  ASSERT_EQ(7U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x56677889ULL, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x1223344556677889ULL, this->op_->StackAt(0));
-  }
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x0f, this->op_->cur_op());
-  ASSERT_EQ(8U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x01020304U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(static_cast<TypeParam>(-4521264810949884LL), this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, const_uleb) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Single byte ULEB128
-      0x10, 0x22, 0x10, 0x7f,
-      // Multi byte ULEB128
-      0x10, 0xa2, 0x22, 0x10, 0xa2, 0x74, 0x10, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
-      0x09, 0x10, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x79,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  // Single byte ULEB128
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x10, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x22U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x10, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x7fU, this->op_->StackAt(0));
-
-  // Multi byte ULEB128
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x10, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x1122U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x10, this->op_->cur_op());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(0x3a22U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x10, this->op_->cur_op());
-  ASSERT_EQ(5U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x5080c101U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x9101c305080c101ULL, this->op_->StackAt(0));
-  }
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x10, this->op_->cur_op());
-  ASSERT_EQ(6U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x5080c101U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x79101c305080c101ULL, this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, const_sleb) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Single byte SLEB128
-      0x11, 0x22, 0x11, 0x7f,
-      // Multi byte SLEB128
-      0x11, 0xa2, 0x22, 0x11, 0xa2, 0x74, 0x11, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
-      0x09, 0x11,
-  };
-  if (sizeof(TypeParam) == 4) {
-    opcode_buffer.push_back(0xb8);
-    opcode_buffer.push_back(0xd3);
-    opcode_buffer.push_back(0x63);
-  } else {
-    opcode_buffer.push_back(0x81);
-    opcode_buffer.push_back(0x82);
-    opcode_buffer.push_back(0x83);
-    opcode_buffer.push_back(0x84);
-    opcode_buffer.push_back(0x85);
-    opcode_buffer.push_back(0x86);
-    opcode_buffer.push_back(0x87);
-    opcode_buffer.push_back(0x88);
-    opcode_buffer.push_back(0x79);
-  }
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  // Single byte SLEB128
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x11, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x22U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x11, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-1), this->op_->StackAt(0));
-
-  // Multi byte SLEB128
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x11, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x1122U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x11, this->op_->cur_op());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-1502), this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x11, this->op_->cur_op());
-  ASSERT_EQ(5U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x5080c101U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x9101c305080c101ULL, this->op_->StackAt(0));
-  }
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x11, this->op_->cur_op());
-  ASSERT_EQ(6U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(static_cast<TypeParam>(-464456), this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(static_cast<TypeParam>(-499868564803501823LL), this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_dup) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Should fail since nothing is on the stack.
-      0x12,
-      // Push on a value and dup.
-      0x08, 0x15, 0x12,
-      // Do it again.
-      0x08, 0x23, 0x12,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(0x12, this->op_->cur_op());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x12, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x15U, this->op_->StackAt(0));
-  ASSERT_EQ(0x15U, this->op_->StackAt(1));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x12, this->op_->cur_op());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(0x23U, this->op_->StackAt(0));
-  ASSERT_EQ(0x23U, this->op_->StackAt(1));
-  ASSERT_EQ(0x15U, this->op_->StackAt(2));
-  ASSERT_EQ(0x15U, this->op_->StackAt(3));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_drop) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Push a couple of values.
-      0x08, 0x10, 0x08, 0x20,
-      // Drop the values.
-      0x13, 0x13,
-      // Attempt to drop empty stack.
-      0x13,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x13, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x10U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x13, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(0x13, this->op_->cur_op());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_over) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Push a couple of values.
-      0x08, 0x1a, 0x08, 0xed,
-      // Copy a value.
-      0x14,
-      // Remove all but one element.
-      0x13, 0x13,
-      // Provoke a failure with this opcode.
-      0x14,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x14, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x1aU, this->op_->StackAt(0));
-  ASSERT_EQ(0xedU, this->op_->StackAt(1));
-  ASSERT_EQ(0x1aU, this->op_->StackAt(2));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(0x14, this->op_->cur_op());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_pick) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Push a few values.
-      0x08, 0x1a, 0x08, 0xed, 0x08, 0x34,
-      // Copy the value at offset 2.
-      0x15, 0x01,
-      // Copy the last value in the stack.
-      0x15, 0x03,
-      // Choose an invalid index.
-      0x15, 0x10,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x15, this->op_->cur_op());
-  ASSERT_EQ(4U, this->op_->StackSize());
-  ASSERT_EQ(0xedU, this->op_->StackAt(0));
-  ASSERT_EQ(0x34U, this->op_->StackAt(1));
-  ASSERT_EQ(0xedU, this->op_->StackAt(2));
-  ASSERT_EQ(0x1aU, this->op_->StackAt(3));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x15, this->op_->cur_op());
-  ASSERT_EQ(5U, this->op_->StackSize());
-  ASSERT_EQ(0x1aU, this->op_->StackAt(0));
-  ASSERT_EQ(0xedU, this->op_->StackAt(1));
-  ASSERT_EQ(0x34U, this->op_->StackAt(2));
-  ASSERT_EQ(0xedU, this->op_->StackAt(3));
-  ASSERT_EQ(0x1aU, this->op_->StackAt(4));
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(0x15, this->op_->cur_op());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_swap) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Push a couple of values.
-      0x08, 0x26, 0x08, 0xab,
-      // Swap values.
-      0x16,
-      // Pop a value to cause a failure.
-      0x13, 0x16,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0xabU, this->op_->StackAt(0));
-  ASSERT_EQ(0x26U, this->op_->StackAt(1));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x16, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x26U, this->op_->StackAt(0));
-  ASSERT_EQ(0xabU, this->op_->StackAt(1));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(0x16, this->op_->cur_op());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_rot) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Rotate that should cause a failure.
-      0x17, 0x08, 0x10,
-      // Only 1 value on stack, should fail.
-      0x17, 0x08, 0x20,
-      // Only 2 values on stack, should fail.
-      0x17, 0x08, 0x30,
-      // Should rotate properly.
-      0x17,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x30U, this->op_->StackAt(0));
-  ASSERT_EQ(0x20U, this->op_->StackAt(1));
-  ASSERT_EQ(0x10U, this->op_->StackAt(2));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x17, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(0x20U, this->op_->StackAt(0));
-  ASSERT_EQ(0x10U, this->op_->StackAt(1));
-  ASSERT_EQ(0x30U, this->op_->StackAt(2));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_abs) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Abs that should fail.
-      0x19,
-      // A value that is already positive.
-      0x08, 0x10, 0x19,
-      // A value that is negative.
-      0x11, 0x7f, 0x19,
-      // A value that is large and negative.
-      0x11, 0x81, 0x80, 0x80, 0x80,
-  };
-  if (sizeof(TypeParam) == 4) {
-    opcode_buffer.push_back(0x08);
-  } else {
-    opcode_buffer.push_back(0x80);
-    opcode_buffer.push_back(0x80);
-    opcode_buffer.push_back(0x01);
-  }
-  opcode_buffer.push_back(0x19);
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x10U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x19, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x10U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x19, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x1U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x19, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(2147483647U, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(4398046511105UL, this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_and) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x1b,
-      // Push a single value.
-      0x08, 0x20,
-      // One element stack, and op will fail.
-      0x1b,
-      // Push another value.
-      0x08, 0x02, 0x1b,
-      // Push on two negative values.
-      0x11, 0x7c, 0x11, 0x7f, 0x1b,
-      // Push one negative, one positive.
-      0x11, 0x10, 0x11, 0x7c, 0x1b,
-      // Divide by zero.
-      0x11, 0x10, 0x11, 0x00, 0x1b,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  // Two positive values.
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1b, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x10U, this->op_->StackAt(0));
-
-  // Two negative values.
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1b, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x04U, this->op_->StackAt(0));
-
-  // One negative value, one positive value.
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(4U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1b, this->op_->cur_op());
-  ASSERT_EQ(3U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-4), this->op_->StackAt(0));
-
-  // Divide by zero.
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(4U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(5U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_div) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x1a,
-      // Push a single value.
-      0x08, 0x48,
-      // One element stack, and op will fail.
-      0x1a,
-      // Push another value.
-      0x08, 0xf0, 0x1a,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1a, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x40U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_minus) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x1c,
-      // Push a single value.
-      0x08, 0x48,
-      // One element stack, and op will fail.
-      0x1c,
-      // Push another value.
-      0x08, 0x04, 0x1c,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1c, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x44U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_mod) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x1d,
-      // Push a single value.
-      0x08, 0x47,
-      // One element stack, and op will fail.
-      0x1d,
-      // Push another value.
-      0x08, 0x04, 0x1d,
-      // Try a mod of zero.
-      0x08, 0x01, 0x08, 0x00, 0x1d,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1d, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x03U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(3U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_mul) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x1e,
-      // Push a single value.
-      0x08, 0x48,
-      // One element stack, and op will fail.
-      0x1e,
-      // Push another value.
-      0x08, 0x04, 0x1e,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1e, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x120U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_neg) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x1f,
-      // Push a single value.
-      0x08, 0x48, 0x1f,
-      // Push a negative value.
-      0x11, 0x7f, 0x1f,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1f, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-72), this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x1f, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x01U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_not) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x20,
-      // Push a single value.
-      0x08, 0x4, 0x20,
-      // Push a negative value.
-      0x11, 0x7c, 0x20,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x20, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-5), this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x20, this->op_->cur_op());
-  ASSERT_EQ(2U, this->op_->StackSize());
-  ASSERT_EQ(0x03U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_or) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x21,
-      // Push a single value.
-      0x08, 0x48,
-      // One element stack, and op will fail.
-      0x21,
-      // Push another value.
-      0x08, 0xf4, 0x21,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x21, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0xfcU, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_plus) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x22,
-      // Push a single value.
-      0x08, 0xff,
-      // One element stack, and op will fail.
-      0x22,
-      // Push another value.
-      0x08, 0xf2, 0x22,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x22, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x1f1U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_plus_uconst) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x23,
-      // Push a single value.
-      0x08, 0x50, 0x23, 0x80, 0x51,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x23, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x28d0U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_shl) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x24,
-      // Push a single value.
-      0x08, 0x67,
-      // One element stack, and op will fail.
-      0x24,
-      // Push another value.
-      0x08, 0x03, 0x24,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x24, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x338U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_shr) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x25,
-      // Push a single value.
-      0x11, 0x70,
-      // One element stack, and op will fail.
-      0x25,
-      // Push another value.
-      0x08, 0x03, 0x25,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x25, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  if (sizeof(TypeParam) == 4) {
-    ASSERT_EQ(0x1ffffffeU, this->op_->StackAt(0));
-  } else {
-    ASSERT_EQ(0x1ffffffffffffffeULL, this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_shra) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x26,
-      // Push a single value.
-      0x11, 0x70,
-      // One element stack, and op will fail.
-      0x26,
-      // Push another value.
-      0x08, 0x03, 0x26,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x26, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(static_cast<TypeParam>(-2), this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_xor) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x27,
-      // Push a single value.
-      0x08, 0x11,
-      // One element stack, and op will fail.
-      0x27,
-      // Push another value.
-      0x08, 0x41, 0x27,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(2U, this->op_->StackSize());
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x27, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x50U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_bra) {
-  std::vector<uint8_t> opcode_buffer = {
-      // No stack, and op will fail.
-      0x28,
-      // Push on a non-zero value with a positive branch.
-      0x08, 0x11, 0x28, 0x02, 0x01,
-      // Push on a zero value with a positive branch.
-      0x08, 0x00, 0x28, 0x05, 0x00,
-      // Push on a non-zero value with a negative branch.
-      0x08, 0x11, 0x28, 0xfc, 0xff,
-      // Push on a zero value with a negative branch.
-      0x08, 0x00, 0x28, 0xf0, 0xff,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_FALSE(this->op_->Decode());
-  ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-  // Push on a non-zero value with a positive branch.
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  uint64_t offset = this->mem_->cur_offset() + 3;
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x28, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-  ASSERT_EQ(offset + 0x102, this->mem_->cur_offset());
-
-  // Push on a zero value with a positive branch.
-  this->mem_->set_cur_offset(offset);
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  offset = this->mem_->cur_offset() + 3;
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x28, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-  ASSERT_EQ(offset - 5, this->mem_->cur_offset());
-
-  // Push on a non-zero value with a negative branch.
-  this->mem_->set_cur_offset(offset);
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  offset = this->mem_->cur_offset() + 3;
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x28, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-  ASSERT_EQ(offset - 4, this->mem_->cur_offset());
-
-  // Push on a zero value with a negative branch.
-  this->mem_->set_cur_offset(offset);
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(1U, this->op_->StackSize());
-
-  offset = this->mem_->cur_offset() + 3;
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x28, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-  ASSERT_EQ(offset + 16, this->mem_->cur_offset());
-}
-
-TYPED_TEST_P(DwarfOpTest, compare_opcode_stack_error) {
-  // All of the ops require two stack elements. Loop through all of these
-  // ops with potential errors.
-  std::vector<uint8_t> opcode_buffer = {
-      0xff,  // Place holder for compare op.
-      0x08, 0x11,
-      0xff,  // Place holder for compare op.
-  };
-
-  for (uint8_t opcode = 0x29; opcode <= 0x2e; opcode++) {
-    opcode_buffer[0] = opcode;
-    opcode_buffer[3] = opcode;
-    this->op_memory_.SetMemory(0, opcode_buffer);
-
-    ASSERT_FALSE(this->op_->Eval(0, 1));
-    ASSERT_EQ(opcode, this->op_->cur_op());
-    ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-
-    ASSERT_FALSE(this->op_->Eval(1, 4));
-    ASSERT_EQ(opcode, this->op_->cur_op());
-    ASSERT_EQ(1U, this->op_->StackSize());
-    ASSERT_EQ(DWARF_ERROR_STACK_INDEX_NOT_VALID, this->op_->LastErrorCode());
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, compare_opcodes) {
-  // Have three different checks for each compare op:
-  //   - Both values the same.
-  //   - The first value larger than the second.
-  //   - The second value larger than the first.
-  std::vector<uint8_t> opcode_buffer = {
-      // Values the same.
-      0x08, 0x11, 0x08, 0x11,
-      0xff,  // Placeholder.
-      // First value larger.
-      0x08, 0x12, 0x08, 0x10,
-      0xff,  // Placeholder.
-      // Second value larger.
-      0x08, 0x10, 0x08, 0x12,
-      0xff,  // Placeholder.
-  };
-
-  // Opcode followed by the expected values on the stack.
-  std::vector<uint8_t> expected = {
-      0x29, 1, 0, 0,  // eq
-      0x2a, 1, 1, 0,  // ge
-      0x2b, 0, 1, 0,  // gt
-      0x2c, 1, 0, 1,  // le
-      0x2d, 0, 0, 1,  // lt
-      0x2e, 0, 1, 1,  // ne
-  };
-  for (size_t i = 0; i < expected.size(); i += 4) {
-    opcode_buffer[4] = expected[i];
-    opcode_buffer[9] = expected[i];
-    opcode_buffer[14] = expected[i];
-    this->op_memory_.SetMemory(0, opcode_buffer);
-
-    ASSERT_TRUE(this->op_->Eval(0, 15))
-        << "Op: 0x" << std::hex << static_cast<uint32_t>(expected[i]) << " failed";
-
-    ASSERT_EQ(3U, this->op_->StackSize());
-    ASSERT_EQ(expected[i + 1], this->op_->StackAt(2));
-    ASSERT_EQ(expected[i + 2], this->op_->StackAt(1));
-    ASSERT_EQ(expected[i + 3], this->op_->StackAt(0));
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_skip) {
-  std::vector<uint8_t> opcode_buffer = {
-      // Positive value.
-      0x2f, 0x10, 0x20,
-      // Negative value.
-      0x2f, 0xfd, 0xff,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  uint64_t offset = this->mem_->cur_offset() + 3;
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x2f, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-  ASSERT_EQ(offset + 0x2010, this->mem_->cur_offset());
-
-  this->mem_->set_cur_offset(offset);
-  offset = this->mem_->cur_offset() + 3;
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x2f, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-  ASSERT_EQ(offset - 3, this->mem_->cur_offset());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_lit) {
-  std::vector<uint8_t> opcode_buffer;
-
-  // Verify every lit opcode.
-  for (uint8_t op = 0x30; op <= 0x4f; op++) {
-    opcode_buffer.push_back(op);
-  }
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  for (size_t i = 0; i < opcode_buffer.size(); i++) {
-    uint32_t op = opcode_buffer[i];
-    ASSERT_TRUE(this->op_->Eval(i, i + 1)) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op, this->op_->cur_op());
-    ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op - 0x30U, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_reg) {
-  std::vector<uint8_t> opcode_buffer;
-
-  // Verify every reg opcode.
-  for (uint8_t op = 0x50; op <= 0x6f; op++) {
-    opcode_buffer.push_back(op);
-  }
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  for (size_t i = 0; i < opcode_buffer.size(); i++) {
-    uint32_t op = opcode_buffer[i];
-    ASSERT_TRUE(this->op_->Eval(i, i + 1)) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op, this->op_->cur_op());
-    ASSERT_TRUE(this->op_->is_register()) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op - 0x50U, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_regx) {
-  std::vector<uint8_t> opcode_buffer = {
-      0x90, 0x02, 0x90, 0x80, 0x15,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  ASSERT_TRUE(this->op_->Eval(0, 2));
-  ASSERT_EQ(0x90, this->op_->cur_op());
-  ASSERT_TRUE(this->op_->is_register());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x02U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Eval(2, 5));
-  ASSERT_EQ(0x90, this->op_->cur_op());
-  ASSERT_TRUE(this->op_->is_register());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0xa80U, this->op_->StackAt(0));
-}
-
-TYPED_TEST_P(DwarfOpTest, op_breg) {
-  std::vector<uint8_t> opcode_buffer;
-
-  // Verify every reg opcode.
-  for (uint8_t op = 0x70; op <= 0x8f; op++) {
-    // Positive value added to register.
-    opcode_buffer.push_back(op);
-    opcode_buffer.push_back(0x12);
-    // Negative value added to register.
-    opcode_buffer.push_back(op);
-    opcode_buffer.push_back(0x7e);
-  }
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  RegsImplFake<TypeParam> regs(32);
-  for (size_t i = 0; i < 32; i++) {
-    regs[i] = i + 10;
-  }
-  RegsInfo<TypeParam> regs_info(&regs);
-  this->op_->set_regs_info(&regs_info);
-
-  uint64_t offset = 0;
-  for (uint32_t op = 0x70; op <= 0x8f; op++) {
-    // Positive value added to register.
-    ASSERT_TRUE(this->op_->Eval(offset, offset + 2)) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op, this->op_->cur_op());
-    ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op - 0x70 + 10 + 0x12, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
-    offset += 2;
-
-    // Negative value added to register.
-    ASSERT_TRUE(this->op_->Eval(offset, offset + 2)) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op, this->op_->cur_op());
-    ASSERT_EQ(1U, this->op_->StackSize()) << "Failed op: 0x" << std::hex << op;
-    ASSERT_EQ(op - 0x70 + 10 - 2, this->op_->StackAt(0)) << "Failed op: 0x" << std::hex << op;
-    offset += 2;
-  }
-}
-
-TYPED_TEST_P(DwarfOpTest, op_breg_invalid_register) {
-  std::vector<uint8_t> opcode_buffer = {
-      0x7f, 0x12, 0x80, 0x12,
-  };
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  RegsImplFake<TypeParam> regs(16);
-  for (size_t i = 0; i < 16; i++) {
-    regs[i] = i + 10;
-  }
-  RegsInfo<TypeParam> regs_info(&regs);
-  this->op_->set_regs_info(&regs_info);
-
-  // Should pass since this references the last regsister.
-  ASSERT_TRUE(this->op_->Eval(0, 2));
-  ASSERT_EQ(0x7fU, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x2bU, this->op_->StackAt(0));
-
-  // Should fail since this references a non-existent register.
-  ASSERT_FALSE(this->op_->Eval(2, 4));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_bregx) {
-  std::vector<uint8_t> opcode_buffer = {// Positive value added to register.
-                                        0x92, 0x05, 0x20,
-                                        // Negative value added to register.
-                                        0x92, 0x06, 0x80, 0x7e,
-                                        // Illegal register.
-                                        0x92, 0x80, 0x15, 0x80, 0x02};
-  this->op_memory_.SetMemory(0, opcode_buffer);
-
-  RegsImplFake<TypeParam> regs(10);
-  regs[5] = 0x45;
-  regs[6] = 0x190;
-  RegsInfo<TypeParam> regs_info(&regs);
-  this->op_->set_regs_info(&regs_info);
-
-  ASSERT_TRUE(this->op_->Eval(0, 3));
-  ASSERT_EQ(0x92, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x65U, this->op_->StackAt(0));
-
-  ASSERT_TRUE(this->op_->Eval(3, 7));
-  ASSERT_EQ(0x92, this->op_->cur_op());
-  ASSERT_EQ(1U, this->op_->StackSize());
-  ASSERT_EQ(0x90U, this->op_->StackAt(0));
-
-  ASSERT_FALSE(this->op_->Eval(7, 12));
-  ASSERT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->op_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfOpTest, op_nop) {
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x96});
-
-  ASSERT_TRUE(this->op_->Decode());
-  ASSERT_EQ(0x96, this->op_->cur_op());
-  ASSERT_EQ(0U, this->op_->StackSize());
-}
-
-TYPED_TEST_P(DwarfOpTest, is_dex_pc) {
-  // Special sequence that indicates this is a dex pc.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0c, 'D', 'E', 'X', '1', 0x13});
-
-  ASSERT_TRUE(this->op_->Eval(0, 6));
-  EXPECT_TRUE(this->op_->dex_pc_set());
-
-  // Try without the last op.
-  ASSERT_TRUE(this->op_->Eval(0, 5));
-  EXPECT_FALSE(this->op_->dex_pc_set());
-
-  // Change the constant.
-  this->op_memory_.SetMemory(0, std::vector<uint8_t>{0x0c, 'D', 'E', 'X', '2', 0x13});
-  ASSERT_TRUE(this->op_->Eval(0, 6));
-  EXPECT_FALSE(this->op_->dex_pc_set());
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfOpTest, decode, eval, illegal_opcode, not_implemented, op_addr,
-                            op_deref, op_deref_size, const_unsigned, const_signed, const_uleb,
-                            const_sleb, op_dup, op_drop, op_over, op_pick, op_swap, op_rot, op_abs,
-                            op_and, op_div, op_minus, op_mod, op_mul, op_neg, op_not, op_or,
-                            op_plus, op_plus_uconst, op_shl, op_shr, op_shra, op_xor, op_bra,
-                            compare_opcode_stack_error, compare_opcodes, op_skip, op_lit, op_reg,
-                            op_regx, op_breg, op_breg_invalid_register, op_bregx, op_nop,
-                            is_dex_pc);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfOpTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfOpTest, DwarfOpTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfSectionImplTest.cpp b/libunwindstack/tests/DwarfSectionImplTest.cpp
deleted file mode 100644
index cac59b7..0000000
--- a/libunwindstack/tests/DwarfSectionImplTest.cpp
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfError.h>
-#include <unwindstack/DwarfSection.h>
-
-#include "DwarfEncoding.h"
-
-#include "LogFake.h"
-#include "MemoryFake.h"
-#include "RegsFake.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class TestDwarfSectionImpl : public DwarfSectionImpl<TypeParam> {
- public:
-  TestDwarfSectionImpl(Memory* memory) : DwarfSectionImpl<TypeParam>(memory) {}
-  virtual ~TestDwarfSectionImpl() = default;
-
-  bool Init(uint64_t, uint64_t, int64_t) override { return false; }
-
-  void GetFdes(std::vector<const DwarfFde*>*) override {}
-
-  const DwarfFde* GetFdeFromPc(uint64_t) override { return nullptr; }
-
-  uint64_t GetCieOffsetFromFde32(uint32_t) { return 0; }
-
-  uint64_t GetCieOffsetFromFde64(uint64_t) { return 0; }
-
-  uint64_t AdjustPcFromFde(uint64_t) override { return 0; }
-
-  void TestSetCachedCieLocRegs(uint64_t offset, const dwarf_loc_regs_t& loc_regs) {
-    this->cie_loc_regs_[offset] = loc_regs;
-  }
-  void TestClearCachedCieLocRegs() { this->cie_loc_regs_.clear(); }
-  void TestClearError() { this->last_error_.code = DWARF_ERROR_NONE; }
-};
-
-template <typename TypeParam>
-class DwarfSectionImplTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-    section_ = new TestDwarfSectionImpl<TypeParam>(&memory_);
-    ResetLogs();
-  }
-
-  void TearDown() override { delete section_; }
-
-  MemoryFake memory_;
-  TestDwarfSectionImpl<TypeParam>* section_ = nullptr;
-};
-TYPED_TEST_SUITE_P(DwarfSectionImplTest);
-
-// NOTE: All test class variables need to be referenced as this->.
-
-TYPED_TEST_P(DwarfSectionImplTest, GetCieFromOffset_fail_should_not_cache) {
-  ASSERT_TRUE(this->section_->GetCieFromOffset(0x4000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_MEMORY_INVALID, this->section_->LastErrorCode());
-  EXPECT_EQ(0x4000U, this->section_->LastErrorAddress());
-
-  this->section_->TestClearError();
-  ASSERT_TRUE(this->section_->GetCieFromOffset(0x4000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_MEMORY_INVALID, this->section_->LastErrorCode());
-  EXPECT_EQ(0x4000U, this->section_->LastErrorAddress());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, GetFdeFromOffset_fail_should_not_cache) {
-  ASSERT_TRUE(this->section_->GetFdeFromOffset(0x4000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_MEMORY_INVALID, this->section_->LastErrorCode());
-  EXPECT_EQ(0x4000U, this->section_->LastErrorAddress());
-
-  this->section_->TestClearError();
-  ASSERT_TRUE(this->section_->GetFdeFromOffset(0x4000) == nullptr);
-  EXPECT_EQ(DWARF_ERROR_MEMORY_INVALID, this->section_->LastErrorCode());
-  EXPECT_EQ(0x4000U, this->section_->LastErrorAddress());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr_eval_fail) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[9] = 0x3000;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x2, 0x5002}};
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_MEMORY_INVALID, this->section_->LastErrorCode());
-  EXPECT_EQ(0x5000U, this->section_->LastErrorAddress());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr_no_stack) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[9] = 0x3000;
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x96, 0x96, 0x96});
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x2, 0x5002}};
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_STATE, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[9] = 0x3000;
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
-  TypeParam cfa_value = 0x12345;
-  this->memory_.SetMemory(0x80000000, &cfa_value, sizeof(cfa_value));
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x4, 0x5004}};
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_val_expr) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[9] = 0x3000;
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x4, 0x5004}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  ASSERT_FALSE(finished);
-  EXPECT_EQ(0x80000000U, regs.sp());
-  EXPECT_EQ(0x20U, regs.pc());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_expr_is_register) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[9] = 0x3000;
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x50, 0x96, 0x96});
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x2, 0x5002}};
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_NOT_IMPLEMENTED, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_bad_regs) {
-  DwarfCie cie{.return_address_register = 60};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_no_cfa) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_CFA_NOT_DEFINED, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_bad) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {20, 0}};
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-
-  this->section_->TestClearError();
-  loc_regs.erase(CFA_REG);
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_INVALID, {0, 0}};
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-
-  this->section_->TestClearError();
-  loc_regs.erase(CFA_REG);
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_OFFSET, {0, 0}};
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-
-  this->section_->TestClearError();
-  loc_regs.erase(CFA_REG);
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_VAL_OFFSET, {0, 0}};
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_register_prev) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[9] = 0x3000;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {9, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x20U, regs.pc());
-  EXPECT_EQ(0x3000U, regs.sp());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_cfa_register_from_value) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[6] = 0x4000;
-  regs[9] = 0x3000;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {6, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x20U, regs.pc());
-  EXPECT_EQ(0x4000U, regs.sp());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_double_indirection) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[1] = 0x100;
-  regs[3] = 0x300;
-  regs[8] = 0x10;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[1] = DwarfLocation{DWARF_LOCATION_REGISTER, {3, 1}};
-  loc_regs[9] = DwarfLocation{DWARF_LOCATION_REGISTER, {1, 2}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(0x301U, regs[1]);
-  EXPECT_EQ(0x300U, regs[3]);
-  EXPECT_EQ(0x10U, regs[8]);
-  EXPECT_EQ(0x102U, regs[9]);
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_register_reference_chain) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[0] = 0x10;
-  regs[1] = 0x20;
-  regs[2] = 0x30;
-  regs[3] = 0x40;
-  regs[4] = 0x50;
-  regs[5] = 0x60;
-  regs[8] = 0x20;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[1] = DwarfLocation{DWARF_LOCATION_REGISTER, {0, 1}};
-  loc_regs[2] = DwarfLocation{DWARF_LOCATION_REGISTER, {1, 2}};
-  loc_regs[3] = DwarfLocation{DWARF_LOCATION_REGISTER, {2, 3}};
-  loc_regs[4] = DwarfLocation{DWARF_LOCATION_REGISTER, {3, 4}};
-  loc_regs[5] = DwarfLocation{DWARF_LOCATION_REGISTER, {4, 5}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(0x10U, regs[0]);
-  EXPECT_EQ(0x11U, regs[1]);
-  EXPECT_EQ(0x22U, regs[2]);
-  EXPECT_EQ(0x33U, regs[3]);
-  EXPECT_EQ(0x44U, regs[4]);
-  EXPECT_EQ(0x55U, regs[5]);
-  EXPECT_EQ(0x20U, regs[8]);
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_dex_pc) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[0] = 0x10;
-  regs[8] = 0x20;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[1] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x8, 0x5008}};
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 'D', 'E', 'X', '1', 0x13, 0x08, 0x11});
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(0x10U, regs[0]);
-  EXPECT_EQ(0x20U, regs[8]);
-  EXPECT_EQ(0x11U, regs.dex_pc());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_invalid_register) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[8] = 0x10;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[1] = DwarfLocation{DWARF_LOCATION_REGISTER, {10, 0}};
-  bool finished;
-  ASSERT_FALSE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_EQ(DWARF_ERROR_ILLEGAL_VALUE, this->section_->LastErrorCode());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_different_reg_locations) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  if (sizeof(TypeParam) == sizeof(uint64_t)) {
-    this->memory_.SetData64(0x2150, 0x12345678abcdef00ULL);
-  } else {
-    this->memory_.SetData32(0x2150, 0x12345678);
-  }
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[3] = 0x234;
-  regs[5] = 0x10;
-  regs[8] = 0x2100;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[1] = DwarfLocation{DWARF_LOCATION_VAL_OFFSET, {0x100, 0}};
-  loc_regs[2] = DwarfLocation{DWARF_LOCATION_OFFSET, {0x50, 0}};
-  loc_regs[3] = DwarfLocation{DWARF_LOCATION_UNDEFINED, {0, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x10U, regs.pc());
-  EXPECT_EQ(0x2100U, regs.sp());
-  EXPECT_EQ(0x2200U, regs[1]);
-  EXPECT_EQ(0x234U, regs[3]);
-  if (sizeof(TypeParam) == sizeof(uint64_t)) {
-    EXPECT_EQ(0x12345678abcdef00ULL, regs[2]);
-  } else {
-    EXPECT_EQ(0x12345678U, regs[2]);
-  }
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_return_address_undefined) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[8] = 0x10;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[5] = DwarfLocation{DWARF_LOCATION_UNDEFINED, {0, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_TRUE(finished);
-  EXPECT_EQ(0U, regs.pc());
-  EXPECT_EQ(0x10U, regs.sp());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_pc_zero) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0;
-  regs[8] = 0x10;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_TRUE(finished);
-  EXPECT_EQ(0U, regs.pc());
-  EXPECT_EQ(0x10U, regs.sp());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_return_address) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[8] = 0x10;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x20U, regs.pc());
-  EXPECT_EQ(0x10U, regs.sp());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_ignore_large_reg_loc) {
-  DwarfCie cie{.return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[5] = 0x20;
-  regs[8] = 0x10;
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  // This should not result in any errors.
-  loc_regs[20] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x20U, regs.pc());
-  EXPECT_EQ(0x10U, regs.sp());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_reg_expr) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[8] = 0x3000;
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
-  TypeParam cfa_value = 0x12345;
-  this->memory_.SetMemory(0x80000000, &cfa_value, sizeof(cfa_value));
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[5] = DwarfLocation{DWARF_LOCATION_EXPRESSION, {0x4, 0x5004}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x3000U, regs.sp());
-  EXPECT_EQ(0x12345U, regs.pc());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Eval_reg_val_expr) {
-  DwarfCie cie{.version = 3, .return_address_register = 5};
-  RegsImplFake<TypeParam> regs(10);
-  dwarf_loc_regs_t loc_regs;
-
-  regs.set_pc(0x100);
-  regs.set_sp(0x2000);
-  regs[8] = 0x3000;
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x0c, 0x00, 0x00, 0x00, 0x80});
-  loc_regs[CFA_REG] = DwarfLocation{DWARF_LOCATION_REGISTER, {8, 0}};
-  loc_regs[5] = DwarfLocation{DWARF_LOCATION_VAL_EXPRESSION, {0x4, 0x5004}};
-  bool finished;
-  ASSERT_TRUE(this->section_->Eval(&cie, &this->memory_, loc_regs, &regs, &finished));
-  EXPECT_FALSE(finished);
-  EXPECT_EQ(0x3000U, regs.sp());
-  EXPECT_EQ(0x80000000U, regs.pc());
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, GetCfaLocationInfo_cie_not_cached) {
-  DwarfCie cie{};
-  cie.cfa_instructions_offset = 0x3000;
-  cie.cfa_instructions_end = 0x3002;
-  DwarfFde fde{};
-  fde.cie = &cie;
-  fde.cie_offset = 0x8000;
-  fde.cfa_instructions_offset = 0x6000;
-  fde.cfa_instructions_end = 0x6002;
-
-  this->memory_.SetMemory(0x3000, std::vector<uint8_t>{0x09, 0x02, 0x01});
-  this->memory_.SetMemory(0x6000, std::vector<uint8_t>{0x09, 0x04, 0x03});
-
-  dwarf_loc_regs_t loc_regs;
-  ASSERT_TRUE(this->section_->GetCfaLocationInfo(0x100, &fde, &loc_regs));
-  ASSERT_EQ(2U, loc_regs.size());
-
-  auto entry = loc_regs.find(2);
-  ASSERT_NE(entry, loc_regs.end());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, entry->second.type);
-  ASSERT_EQ(1U, entry->second.values[0]);
-
-  entry = loc_regs.find(4);
-  ASSERT_NE(entry, loc_regs.end());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, entry->second.type);
-  ASSERT_EQ(3U, entry->second.values[0]);
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, GetCfaLocationInfo_cie_cached) {
-  DwarfCie cie{};
-  cie.cfa_instructions_offset = 0x3000;
-  cie.cfa_instructions_end = 0x3002;
-  DwarfFde fde{};
-  fde.cie = &cie;
-  fde.cie_offset = 0x8000;
-  fde.cfa_instructions_offset = 0x6000;
-  fde.cfa_instructions_end = 0x6002;
-
-  dwarf_loc_regs_t cie_loc_regs;
-  cie_loc_regs[6] = DwarfLocation{DWARF_LOCATION_REGISTER, {4, 0}};
-  this->section_->TestSetCachedCieLocRegs(0x8000, cie_loc_regs);
-  this->memory_.SetMemory(0x6000, std::vector<uint8_t>{0x09, 0x04, 0x03});
-
-  dwarf_loc_regs_t loc_regs;
-  ASSERT_TRUE(this->section_->GetCfaLocationInfo(0x100, &fde, &loc_regs));
-  ASSERT_EQ(2U, loc_regs.size());
-
-  auto entry = loc_regs.find(6);
-  ASSERT_NE(entry, loc_regs.end());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, entry->second.type);
-  ASSERT_EQ(4U, entry->second.values[0]);
-
-  entry = loc_regs.find(4);
-  ASSERT_NE(entry, loc_regs.end());
-  ASSERT_EQ(DWARF_LOCATION_REGISTER, entry->second.type);
-  ASSERT_EQ(3U, entry->second.values[0]);
-}
-
-TYPED_TEST_P(DwarfSectionImplTest, Log) {
-  DwarfCie cie{};
-  cie.cfa_instructions_offset = 0x5000;
-  cie.cfa_instructions_end = 0x5001;
-  DwarfFde fde{};
-  fde.cie = &cie;
-  fde.cfa_instructions_offset = 0x6000;
-  fde.cfa_instructions_end = 0x6001;
-
-  this->memory_.SetMemory(0x5000, std::vector<uint8_t>{0x00});
-  this->memory_.SetMemory(0x6000, std::vector<uint8_t>{0xc2});
-  ASSERT_TRUE(this->section_->Log(2, 0x1000, &fde));
-
-  ASSERT_EQ(
-      "4 unwind     DW_CFA_nop\n"
-      "4 unwind     Raw Data: 0x00\n"
-      "4 unwind     DW_CFA_restore register(2)\n"
-      "4 unwind     Raw Data: 0xc2\n",
-      GetFakeLogPrint());
-  ASSERT_EQ("", GetFakeLogBuf());
-}
-
-REGISTER_TYPED_TEST_SUITE_P(DwarfSectionImplTest, GetCieFromOffset_fail_should_not_cache,
-                            GetFdeFromOffset_fail_should_not_cache, Eval_cfa_expr_eval_fail,
-                            Eval_cfa_expr_no_stack, Eval_cfa_expr_is_register, Eval_cfa_expr,
-                            Eval_cfa_val_expr, Eval_bad_regs, Eval_no_cfa, Eval_cfa_bad,
-                            Eval_cfa_register_prev, Eval_cfa_register_from_value,
-                            Eval_double_indirection, Eval_register_reference_chain, Eval_dex_pc,
-                            Eval_invalid_register, Eval_different_reg_locations,
-                            Eval_return_address_undefined, Eval_pc_zero, Eval_return_address,
-                            Eval_ignore_large_reg_loc, Eval_reg_expr, Eval_reg_val_expr,
-                            GetCfaLocationInfo_cie_not_cached, GetCfaLocationInfo_cie_cached, Log);
-
-typedef ::testing::Types<uint32_t, uint64_t> DwarfSectionImplTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, DwarfSectionImplTest, DwarfSectionImplTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/DwarfSectionTest.cpp b/libunwindstack/tests/DwarfSectionTest.cpp
deleted file mode 100644
index 953dc75..0000000
--- a/libunwindstack/tests/DwarfSectionTest.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfSection.h>
-
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class MockDwarfSection : public DwarfSection {
- public:
-  MockDwarfSection(Memory* memory) : DwarfSection(memory) {}
-  virtual ~MockDwarfSection() = default;
-
-  MOCK_METHOD(bool, Init, (uint64_t, uint64_t, int64_t), (override));
-
-  MOCK_METHOD(bool, Eval, (const DwarfCie*, Memory*, const dwarf_loc_regs_t&, Regs*, bool*),
-              (override));
-
-  MOCK_METHOD(bool, Log, (uint8_t, uint64_t, const DwarfFde*), (override));
-
-  MOCK_METHOD(void, GetFdes, (std::vector<const DwarfFde*>*), (override));
-
-  MOCK_METHOD(const DwarfFde*, GetFdeFromPc, (uint64_t), (override));
-
-  MOCK_METHOD(bool, GetCfaLocationInfo, (uint64_t, const DwarfFde*, dwarf_loc_regs_t*), (override));
-
-  MOCK_METHOD(uint64_t, GetCieOffsetFromFde32, (uint32_t), (override));
-
-  MOCK_METHOD(uint64_t, GetCieOffsetFromFde64, (uint64_t), (override));
-
-  MOCK_METHOD(uint64_t, AdjustPcFromFde, (uint64_t), (override));
-};
-
-class DwarfSectionTest : public ::testing::Test {
- protected:
-  void SetUp() override { section_.reset(new MockDwarfSection(&memory_)); }
-
-  MemoryFake memory_;
-  std::unique_ptr<MockDwarfSection> section_;
-};
-
-TEST_F(DwarfSectionTest, Step_fail_fde) {
-  EXPECT_CALL(*section_, GetFdeFromPc(0x1000)).WillOnce(::testing::Return(nullptr));
-
-  bool finished;
-  ASSERT_FALSE(section_->Step(0x1000, nullptr, nullptr, &finished));
-}
-
-TEST_F(DwarfSectionTest, Step_fail_cie_null) {
-  DwarfFde fde{};
-  fde.pc_end = 0x2000;
-  fde.cie = nullptr;
-
-  EXPECT_CALL(*section_, GetFdeFromPc(0x1000)).WillOnce(::testing::Return(&fde));
-
-  bool finished;
-  ASSERT_FALSE(section_->Step(0x1000, nullptr, nullptr, &finished));
-}
-
-TEST_F(DwarfSectionTest, Step_fail_cfa_location) {
-  DwarfCie cie{};
-  DwarfFde fde{};
-  fde.pc_end = 0x2000;
-  fde.cie = &cie;
-
-  EXPECT_CALL(*section_, GetFdeFromPc(0x1000)).WillOnce(::testing::Return(&fde));
-  EXPECT_CALL(*section_, GetCfaLocationInfo(0x1000, &fde, ::testing::_))
-      .WillOnce(::testing::Return(false));
-
-  bool finished;
-  ASSERT_FALSE(section_->Step(0x1000, nullptr, nullptr, &finished));
-}
-
-TEST_F(DwarfSectionTest, Step_pass) {
-  DwarfCie cie{};
-  DwarfFde fde{};
-  fde.pc_end = 0x2000;
-  fde.cie = &cie;
-
-  EXPECT_CALL(*section_, GetFdeFromPc(0x1000)).WillOnce(::testing::Return(&fde));
-  EXPECT_CALL(*section_, GetCfaLocationInfo(0x1000, &fde, ::testing::_))
-      .WillOnce(::testing::Return(true));
-
-  MemoryFake process;
-  EXPECT_CALL(*section_, Eval(&cie, &process, ::testing::_, nullptr, ::testing::_))
-      .WillOnce(::testing::Return(true));
-
-  bool finished;
-  ASSERT_TRUE(section_->Step(0x1000, nullptr, &process, &finished));
-}
-
-static bool MockGetCfaLocationInfo(::testing::Unused, const DwarfFde* fde,
-                                   dwarf_loc_regs_t* loc_regs) {
-  loc_regs->pc_start = fde->pc_start;
-  loc_regs->pc_end = fde->pc_end;
-  return true;
-}
-
-TEST_F(DwarfSectionTest, Step_cache) {
-  DwarfCie cie{};
-  DwarfFde fde{};
-  fde.pc_start = 0x500;
-  fde.pc_end = 0x2000;
-  fde.cie = &cie;
-
-  EXPECT_CALL(*section_, GetFdeFromPc(0x1000)).WillOnce(::testing::Return(&fde));
-  EXPECT_CALL(*section_, GetCfaLocationInfo(0x1000, &fde, ::testing::_))
-      .WillOnce(::testing::Invoke(MockGetCfaLocationInfo));
-
-  MemoryFake process;
-  EXPECT_CALL(*section_, Eval(&cie, &process, ::testing::_, nullptr, ::testing::_))
-      .WillRepeatedly(::testing::Return(true));
-
-  bool finished;
-  ASSERT_TRUE(section_->Step(0x1000, nullptr, &process, &finished));
-  ASSERT_TRUE(section_->Step(0x1000, nullptr, &process, &finished));
-  ASSERT_TRUE(section_->Step(0x1500, nullptr, &process, &finished));
-}
-
-TEST_F(DwarfSectionTest, Step_cache_not_in_pc) {
-  DwarfCie cie{};
-  DwarfFde fde0{};
-  fde0.pc_start = 0x1000;
-  fde0.pc_end = 0x2000;
-  fde0.cie = &cie;
-  EXPECT_CALL(*section_, GetFdeFromPc(0x1000)).WillOnce(::testing::Return(&fde0));
-  EXPECT_CALL(*section_, GetCfaLocationInfo(0x1000, &fde0, ::testing::_))
-      .WillOnce(::testing::Invoke(MockGetCfaLocationInfo));
-
-  MemoryFake process;
-  EXPECT_CALL(*section_, Eval(&cie, &process, ::testing::_, nullptr, ::testing::_))
-      .WillRepeatedly(::testing::Return(true));
-
-  bool finished;
-  ASSERT_TRUE(section_->Step(0x1000, nullptr, &process, &finished));
-
-  DwarfFde fde1{};
-  fde1.pc_start = 0x500;
-  fde1.pc_end = 0x800;
-  fde1.cie = &cie;
-  EXPECT_CALL(*section_, GetFdeFromPc(0x600)).WillOnce(::testing::Return(&fde1));
-  EXPECT_CALL(*section_, GetCfaLocationInfo(0x600, &fde1, ::testing::_))
-      .WillOnce(::testing::Invoke(MockGetCfaLocationInfo));
-
-  ASSERT_TRUE(section_->Step(0x600, nullptr, &process, &finished));
-  ASSERT_TRUE(section_->Step(0x700, nullptr, &process, &finished));
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfCacheTest.cpp b/libunwindstack/tests/ElfCacheTest.cpp
deleted file mode 100644
index 5f13546..0000000
--- a/libunwindstack/tests/ElfCacheTest.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <elf.h>
-#include <unistd.h>
-
-#include <android-base/file.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-
-#include "ElfTestUtils.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class ElfCacheTest : public ::testing::Test {
- protected:
-  static void SetUpTestSuite() { memory_.reset(new MemoryFake); }
-
-  void SetUp() override { Elf::SetCachingEnabled(true); }
-
-  void TearDown() override { Elf::SetCachingEnabled(false); }
-
-  void WriteElfFile(uint64_t offset, TemporaryFile* tf, uint32_t type) {
-    ASSERT_TRUE(type == EM_ARM || type == EM_386 || type == EM_X86_64);
-    size_t ehdr_size;
-    Elf32_Ehdr ehdr32;
-    Elf64_Ehdr ehdr64;
-    void* ptr;
-    if (type == EM_ARM || type == EM_386) {
-      ehdr_size = sizeof(ehdr32);
-      ptr = &ehdr32;
-      TestInitEhdr(&ehdr32, ELFCLASS32, type);
-    } else {
-      ehdr_size = sizeof(ehdr64);
-      ptr = &ehdr64;
-      TestInitEhdr(&ehdr64, ELFCLASS64, type);
-    }
-
-    ASSERT_EQ(offset, static_cast<uint64_t>(lseek(tf->fd, offset, SEEK_SET)));
-    ASSERT_TRUE(android::base::WriteFully(tf->fd, ptr, ehdr_size));
-  }
-
-  void VerifyWithinSameMap(bool cache_enabled);
-  void VerifySameMap(bool cache_enabled);
-  void VerifyWithinSameMapNeverReadAtZero(bool cache_enabled);
-
-  static std::shared_ptr<Memory> memory_;
-};
-
-std::shared_ptr<Memory> ElfCacheTest::memory_;
-
-void ElfCacheTest::VerifySameMap(bool cache_enabled) {
-  if (!cache_enabled) {
-    Elf::SetCachingEnabled(false);
-  }
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  WriteElfFile(0, &tf, EM_ARM);
-  close(tf.fd);
-
-  uint64_t start = 0x1000;
-  uint64_t end = 0x20000;
-  MapInfo info1(nullptr, nullptr, start, end, 0, 0x5, tf.path);
-  MapInfo info2(nullptr, nullptr, start, end, 0, 0x5, tf.path);
-
-  Elf* elf1 = info1.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf1->valid());
-  Elf* elf2 = info2.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf2->valid());
-
-  if (cache_enabled) {
-    EXPECT_EQ(elf1, elf2);
-  } else {
-    EXPECT_NE(elf1, elf2);
-  }
-}
-
-TEST_F(ElfCacheTest, no_caching) {
-  VerifySameMap(false);
-}
-
-TEST_F(ElfCacheTest, caching_invalid_elf) {
-  VerifySameMap(true);
-}
-
-void ElfCacheTest::VerifyWithinSameMap(bool cache_enabled) {
-  if (!cache_enabled) {
-    Elf::SetCachingEnabled(false);
-  }
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  WriteElfFile(0, &tf, EM_ARM);
-  WriteElfFile(0x100, &tf, EM_386);
-  WriteElfFile(0x200, &tf, EM_X86_64);
-  lseek(tf.fd, 0x500, SEEK_SET);
-  uint8_t value = 0;
-  write(tf.fd, &value, 1);
-  close(tf.fd);
-
-  uint64_t start = 0x1000;
-  uint64_t end = 0x20000;
-  // Will have an elf at offset 0 in file.
-  MapInfo info0_1(nullptr, nullptr, start, end, 0, 0x5, tf.path);
-  MapInfo info0_2(nullptr, nullptr, start, end, 0, 0x5, tf.path);
-  // Will have an elf at offset 0x100 in file.
-  MapInfo info100_1(nullptr, nullptr, start, end, 0x100, 0x5, tf.path);
-  MapInfo info100_2(nullptr, nullptr, start, end, 0x100, 0x5, tf.path);
-  // Will have an elf at offset 0x200 in file.
-  MapInfo info200_1(nullptr, nullptr, start, end, 0x200, 0x5, tf.path);
-  MapInfo info200_2(nullptr, nullptr, start, end, 0x200, 0x5, tf.path);
-  // Will have an elf at offset 0 in file.
-  MapInfo info300_1(nullptr, nullptr, start, end, 0x300, 0x5, tf.path);
-  MapInfo info300_2(nullptr, nullptr, start, end, 0x300, 0x5, tf.path);
-
-  Elf* elf0_1 = info0_1.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf0_1->valid());
-  EXPECT_EQ(ARCH_ARM, elf0_1->arch());
-  Elf* elf0_2 = info0_2.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf0_2->valid());
-  EXPECT_EQ(ARCH_ARM, elf0_2->arch());
-  EXPECT_EQ(0U, info0_1.elf_offset);
-  EXPECT_EQ(0U, info0_2.elf_offset);
-  if (cache_enabled) {
-    EXPECT_EQ(elf0_1, elf0_2);
-  } else {
-    EXPECT_NE(elf0_1, elf0_2);
-  }
-
-  Elf* elf100_1 = info100_1.GetElf(memory_, ARCH_X86);
-  ASSERT_TRUE(elf100_1->valid());
-  EXPECT_EQ(ARCH_X86, elf100_1->arch());
-  Elf* elf100_2 = info100_2.GetElf(memory_, ARCH_X86);
-  ASSERT_TRUE(elf100_2->valid());
-  EXPECT_EQ(ARCH_X86, elf100_2->arch());
-  EXPECT_EQ(0U, info100_1.elf_offset);
-  EXPECT_EQ(0U, info100_2.elf_offset);
-  if (cache_enabled) {
-    EXPECT_EQ(elf100_1, elf100_2);
-  } else {
-    EXPECT_NE(elf100_1, elf100_2);
-  }
-
-  Elf* elf200_1 = info200_1.GetElf(memory_, ARCH_X86_64);
-  ASSERT_TRUE(elf200_1->valid());
-  EXPECT_EQ(ARCH_X86_64, elf200_1->arch());
-  Elf* elf200_2 = info200_2.GetElf(memory_, ARCH_X86_64);
-  ASSERT_TRUE(elf200_2->valid());
-  EXPECT_EQ(ARCH_X86_64, elf200_2->arch());
-  EXPECT_EQ(0U, info200_1.elf_offset);
-  EXPECT_EQ(0U, info200_2.elf_offset);
-  if (cache_enabled) {
-    EXPECT_EQ(elf200_1, elf200_2);
-  } else {
-    EXPECT_NE(elf200_1, elf200_2);
-  }
-
-  Elf* elf300_1 = info300_1.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf300_1->valid());
-  EXPECT_EQ(ARCH_ARM, elf300_1->arch());
-  Elf* elf300_2 = info300_2.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf300_2->valid());
-  EXPECT_EQ(ARCH_ARM, elf300_2->arch());
-  EXPECT_EQ(0x300U, info300_1.elf_offset);
-  EXPECT_EQ(0x300U, info300_2.elf_offset);
-  if (cache_enabled) {
-    EXPECT_EQ(elf300_1, elf300_2);
-    EXPECT_EQ(elf0_1, elf300_1);
-  } else {
-    EXPECT_NE(elf300_1, elf300_2);
-    EXPECT_NE(elf0_1, elf300_1);
-  }
-}
-
-TEST_F(ElfCacheTest, no_caching_valid_elf_offset_non_zero) {
-  VerifyWithinSameMap(false);
-}
-
-TEST_F(ElfCacheTest, caching_valid_elf_offset_non_zero) {
-  VerifyWithinSameMap(true);
-}
-
-// Verify that when reading from multiple non-zero offsets in the same map
-// that when cached, all of the elf objects are the same.
-void ElfCacheTest::VerifyWithinSameMapNeverReadAtZero(bool cache_enabled) {
-  if (!cache_enabled) {
-    Elf::SetCachingEnabled(false);
-  }
-
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-  WriteElfFile(0, &tf, EM_ARM);
-  lseek(tf.fd, 0x500, SEEK_SET);
-  uint8_t value = 0;
-  write(tf.fd, &value, 1);
-  close(tf.fd);
-
-  uint64_t start = 0x1000;
-  uint64_t end = 0x20000;
-  // Multiple info sections at different offsets will have non-zero elf offsets.
-  MapInfo info300_1(nullptr, nullptr, start, end, 0x300, 0x5, tf.path);
-  MapInfo info300_2(nullptr, nullptr, start, end, 0x300, 0x5, tf.path);
-  MapInfo info400_1(nullptr, nullptr, start, end, 0x400, 0x5, tf.path);
-  MapInfo info400_2(nullptr, nullptr, start, end, 0x400, 0x5, tf.path);
-
-  Elf* elf300_1 = info300_1.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf300_1->valid());
-  EXPECT_EQ(ARCH_ARM, elf300_1->arch());
-  Elf* elf300_2 = info300_2.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf300_2->valid());
-  EXPECT_EQ(ARCH_ARM, elf300_2->arch());
-  EXPECT_EQ(0x300U, info300_1.elf_offset);
-  EXPECT_EQ(0x300U, info300_2.elf_offset);
-  if (cache_enabled) {
-    EXPECT_EQ(elf300_1, elf300_2);
-  } else {
-    EXPECT_NE(elf300_1, elf300_2);
-  }
-
-  Elf* elf400_1 = info400_1.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf400_1->valid());
-  EXPECT_EQ(ARCH_ARM, elf400_1->arch());
-  Elf* elf400_2 = info400_2.GetElf(memory_, ARCH_ARM);
-  ASSERT_TRUE(elf400_2->valid());
-  EXPECT_EQ(ARCH_ARM, elf400_2->arch());
-  EXPECT_EQ(0x400U, info400_1.elf_offset);
-  EXPECT_EQ(0x400U, info400_2.elf_offset);
-  if (cache_enabled) {
-    EXPECT_EQ(elf400_1, elf400_2);
-    EXPECT_EQ(elf300_1, elf400_1);
-  } else {
-    EXPECT_NE(elf400_1, elf400_2);
-    EXPECT_NE(elf300_1, elf400_1);
-  }
-}
-
-TEST_F(ElfCacheTest, no_caching_valid_elf_offset_non_zero_never_read_at_zero) {
-  VerifyWithinSameMapNeverReadAtZero(false);
-}
-
-TEST_F(ElfCacheTest, caching_valid_elf_offset_non_zero_never_read_at_zero) {
-  VerifyWithinSameMapNeverReadAtZero(true);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfFake.cpp b/libunwindstack/tests/ElfFake.cpp
deleted file mode 100644
index 3d5ddd6..0000000
--- a/libunwindstack/tests/ElfFake.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <deque>
-#include <string>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-#include "ElfFake.h"
-#include "RegsFake.h"
-
-namespace unwindstack {
-
-std::deque<FunctionData> ElfInterfaceFake::functions_;
-std::deque<StepData> ElfInterfaceFake::steps_;
-
-bool ElfInterfaceFake::GetFunctionName(uint64_t, std::string* name, uint64_t* offset) {
-  if (functions_.empty()) {
-    return false;
-  }
-  auto entry = functions_.front();
-  functions_.pop_front();
-  *name = entry.name;
-  *offset = entry.offset;
-  return true;
-}
-
-bool ElfInterfaceFake::GetGlobalVariable(const std::string& global, uint64_t* offset) {
-  auto entry = globals_.find(global);
-  if (entry == globals_.end()) {
-    return false;
-  }
-  *offset = entry->second;
-  return true;
-}
-
-bool ElfInterfaceFake::Step(uint64_t, Regs* regs, Memory*, bool* finished) {
-  if (steps_.empty()) {
-    return false;
-  }
-  auto entry = steps_.front();
-  steps_.pop_front();
-
-  if (entry.pc == 0 && entry.sp == 0 && !entry.finished) {
-    // Pretend as though there is no frame.
-    return false;
-  }
-
-  RegsFake* fake_regs = reinterpret_cast<RegsFake*>(regs);
-  fake_regs->set_pc(entry.pc);
-  fake_regs->set_sp(entry.sp);
-  *finished = entry.finished;
-  return true;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfFake.h b/libunwindstack/tests/ElfFake.h
deleted file mode 100644
index fc90dab..0000000
--- a/libunwindstack/tests/ElfFake.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_TESTS_ELF_FAKE_H
-#define _LIBUNWINDSTACK_TESTS_ELF_FAKE_H
-
-#include <stdint.h>
-
-#include <deque>
-#include <string>
-#include <unordered_map>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-#include "ElfInterfaceArm.h"
-
-namespace unwindstack {
-
-struct StepData {
-  StepData(uint64_t pc, uint64_t sp, bool finished) : pc(pc), sp(sp), finished(finished) {}
-  uint64_t pc;
-  uint64_t sp;
-  bool finished;
-};
-
-struct FunctionData {
-  FunctionData(std::string name, uint64_t offset) : name(name), offset(offset) {}
-
-  std::string name;
-  uint64_t offset;
-};
-
-class ElfFake : public Elf {
- public:
-  ElfFake(Memory* memory) : Elf(memory) { valid_ = true; }
-  virtual ~ElfFake() = default;
-
-  void FakeSetValid(bool valid) { valid_ = valid; }
-
-  void FakeSetLoadBias(uint64_t load_bias) { load_bias_ = load_bias; }
-
-  void FakeSetInterface(ElfInterface* interface) { interface_.reset(interface); }
-  void FakeSetGnuDebugdataInterface(ElfInterface* interface) {
-    gnu_debugdata_interface_.reset(interface);
-  }
-};
-
-class ElfInterfaceFake : public ElfInterface {
- public:
-  ElfInterfaceFake(Memory* memory) : ElfInterface(memory) {}
-  virtual ~ElfInterfaceFake() = default;
-
-  bool Init(int64_t*) override { return false; }
-  void InitHeaders() override {}
-  std::string GetSoname() override { return fake_soname_; }
-
-  bool GetFunctionName(uint64_t, std::string*, uint64_t*) override;
-  bool GetGlobalVariable(const std::string&, uint64_t*) override;
-  std::string GetBuildID() override { return fake_build_id_; }
-
-  bool Step(uint64_t, Regs*, Memory*, bool*) override;
-
-  void FakeSetGlobalVariable(const std::string& global, uint64_t offset) {
-    globals_[global] = offset;
-  }
-
-  void FakeSetBuildID(std::string& build_id) { fake_build_id_ = build_id; }
-  void FakeSetBuildID(const char* build_id) { fake_build_id_ = build_id; }
-
-  void FakeSetSoname(const char* soname) { fake_soname_ = soname; }
-
-  static void FakePushFunctionData(const FunctionData data) { functions_.push_back(data); }
-  static void FakePushStepData(const StepData data) { steps_.push_back(data); }
-
-  static void FakeClear() {
-    functions_.clear();
-    steps_.clear();
-  }
-
-  void FakeSetErrorCode(ErrorCode code) { last_error_.code = code; }
-
-  void FakeSetErrorAddress(uint64_t address) { last_error_.address = address; }
-
-  void FakeSetDataOffset(uint64_t offset) { data_offset_ = offset; }
-  void FakeSetDataVaddrStart(uint64_t vaddr) { data_vaddr_start_ = vaddr; }
-  void FakeSetDataVaddrEnd(uint64_t vaddr) { data_vaddr_end_ = vaddr; }
-
-  void FakeSetDynamicOffset(uint64_t offset) { dynamic_offset_ = offset; }
-  void FakeSetDynamicVaddrStart(uint64_t vaddr) { dynamic_vaddr_start_ = vaddr; }
-  void FakeSetDynamicVaddrEnd(uint64_t vaddr) { dynamic_vaddr_end_ = vaddr; }
-
-  void FakeSetGnuDebugdataOffset(uint64_t offset) { gnu_debugdata_offset_ = offset; }
-  void FakeSetGnuDebugdataSize(uint64_t size) { gnu_debugdata_size_ = size; }
-
- private:
-  std::unordered_map<std::string, uint64_t> globals_;
-  std::string fake_build_id_;
-  std::string fake_soname_;
-
-  static std::deque<FunctionData> functions_;
-  static std::deque<StepData> steps_;
-};
-
-class ElfInterface32Fake : public ElfInterface32 {
- public:
-  ElfInterface32Fake(Memory* memory) : ElfInterface32(memory) {}
-  virtual ~ElfInterface32Fake() = default;
-
-  void FakeSetEhFrameOffset(uint64_t offset) { eh_frame_offset_ = offset; }
-  void FakeSetEhFrameSize(uint64_t size) { eh_frame_size_ = size; }
-  void FakeSetDebugFrameOffset(uint64_t offset) { debug_frame_offset_ = offset; }
-  void FakeSetDebugFrameSize(uint64_t size) { debug_frame_size_ = size; }
-};
-
-class ElfInterface64Fake : public ElfInterface64 {
- public:
-  ElfInterface64Fake(Memory* memory) : ElfInterface64(memory) {}
-  virtual ~ElfInterface64Fake() = default;
-
-  void FakeSetEhFrameOffset(uint64_t offset) { eh_frame_offset_ = offset; }
-  void FakeSetEhFrameSize(uint64_t size) { eh_frame_size_ = size; }
-  void FakeSetDebugFrameOffset(uint64_t offset) { debug_frame_offset_ = offset; }
-  void FakeSetDebugFrameSize(uint64_t size) { debug_frame_size_ = size; }
-};
-
-class ElfInterfaceArmFake : public ElfInterfaceArm {
- public:
-  ElfInterfaceArmFake(Memory* memory) : ElfInterfaceArm(memory) {}
-  virtual ~ElfInterfaceArmFake() = default;
-
-  void FakeSetStartOffset(uint64_t offset) { start_offset_ = offset; }
-  void FakeSetTotalEntries(size_t entries) { total_entries_ = entries; }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_TESTS_ELF_FAKE_H
diff --git a/libunwindstack/tests/ElfInterfaceArmTest.cpp b/libunwindstack/tests/ElfInterfaceArmTest.cpp
deleted file mode 100644
index 43c6a97..0000000
--- a/libunwindstack/tests/ElfInterfaceArmTest.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-
-#include <gtest/gtest.h>
-
-#include <vector>
-
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/RegsArm.h>
-
-#include "ElfInterfaceArm.h"
-
-#include "ElfFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class ElfInterfaceArmTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-    process_memory_.Clear();
-  }
-
-  MemoryFake memory_;
-  MemoryFake process_memory_;
-};
-
-TEST_F(ElfInterfaceArmTest, GetPrel32Addr) {
-  ElfInterfaceArmFake interface(&memory_);
-  memory_.SetData32(0x1000, 0x230000);
-
-  uint32_t value;
-  ASSERT_TRUE(interface.GetPrel31Addr(0x1000, &value));
-  ASSERT_EQ(0x231000U, value);
-
-  memory_.SetData32(0x1000, 0x80001000);
-  ASSERT_TRUE(interface.GetPrel31Addr(0x1000, &value));
-  ASSERT_EQ(0x2000U, value);
-
-  memory_.SetData32(0x1000, 0x70001000);
-  ASSERT_TRUE(interface.GetPrel31Addr(0x1000, &value));
-  ASSERT_EQ(0xf0002000U, value);
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_start_zero) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0);
-  interface.FakeSetTotalEntries(10);
-
-  uint64_t entry_offset;
-  ASSERT_FALSE(interface.FindEntry(0x1000, &entry_offset));
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_no_entries) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x100);
-  interface.FakeSetTotalEntries(0);
-
-  uint64_t entry_offset;
-  ASSERT_FALSE(interface.FindEntry(0x1000, &entry_offset));
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_no_valid_memory) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x100);
-  interface.FakeSetTotalEntries(2);
-
-  uint64_t entry_offset;
-  ASSERT_FALSE(interface.FindEntry(0x1000, &entry_offset));
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_ip_before_first) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(1);
-  memory_.SetData32(0x1000, 0x6000);
-
-  uint64_t entry_offset;
-  ASSERT_FALSE(interface.FindEntry(0x1000, &entry_offset));
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_single_entry_negative_value) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x8000);
-  interface.FakeSetTotalEntries(1);
-  memory_.SetData32(0x8000, 0x7fffff00);
-
-  uint64_t entry_offset;
-  ASSERT_TRUE(interface.FindEntry(0x7ff0, &entry_offset));
-  ASSERT_EQ(0x8000U, entry_offset);
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_two_entries) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(2);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1008, 0x7000);
-
-  uint64_t entry_offset;
-  ASSERT_TRUE(interface.FindEntry(0x7000, &entry_offset));
-  ASSERT_EQ(0x1000U, entry_offset);
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_last_check_single_entry) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(1);
-  memory_.SetData32(0x1000, 0x6000);
-
-  uint64_t entry_offset;
-  ASSERT_TRUE(interface.FindEntry(0x7000, &entry_offset));
-  ASSERT_EQ(0x1000U, entry_offset);
-
-  // To guarantee that we are using the cache on the second run,
-  // set the memory to a different value.
-  memory_.SetData32(0x1000, 0x8000);
-  ASSERT_TRUE(interface.FindEntry(0x7004, &entry_offset));
-  ASSERT_EQ(0x1000U, entry_offset);
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_last_check_multiple_entries) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(2);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1008, 0x8000);
-
-  uint64_t entry_offset;
-  ASSERT_TRUE(interface.FindEntry(0x9008, &entry_offset));
-  ASSERT_EQ(0x1008U, entry_offset);
-
-  // To guarantee that we are using the cache on the second run,
-  // set the memory to a different value.
-  memory_.SetData32(0x1000, 0x16000);
-  memory_.SetData32(0x1008, 0x18000);
-  ASSERT_TRUE(interface.FindEntry(0x9100, &entry_offset));
-  ASSERT_EQ(0x1008U, entry_offset);
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_multiple_entries_even) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(4);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1008, 0x7000);
-  memory_.SetData32(0x1010, 0x8000);
-  memory_.SetData32(0x1018, 0x9000);
-
-  uint64_t entry_offset;
-  ASSERT_TRUE(interface.FindEntry(0x9100, &entry_offset));
-  ASSERT_EQ(0x1010U, entry_offset);
-
-  // To guarantee that we are using the cache on the second run,
-  // set the memory to a different value.
-  memory_.SetData32(0x1000, 0x16000);
-  memory_.SetData32(0x1008, 0x17000);
-  memory_.SetData32(0x1010, 0x18000);
-  memory_.SetData32(0x1018, 0x19000);
-  ASSERT_TRUE(interface.FindEntry(0x9100, &entry_offset));
-  ASSERT_EQ(0x1010U, entry_offset);
-}
-
-TEST_F(ElfInterfaceArmTest, FindEntry_multiple_entries_odd) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(5);
-  memory_.SetData32(0x1000, 0x5000);
-  memory_.SetData32(0x1008, 0x6000);
-  memory_.SetData32(0x1010, 0x7000);
-  memory_.SetData32(0x1018, 0x8000);
-  memory_.SetData32(0x1020, 0x9000);
-
-  uint64_t entry_offset;
-  ASSERT_TRUE(interface.FindEntry(0x8100, &entry_offset));
-  ASSERT_EQ(0x1010U, entry_offset);
-
-  // To guarantee that we are using the cache on the second run,
-  // set the memory to a different value.
-  memory_.SetData32(0x1000, 0x15000);
-  memory_.SetData32(0x1008, 0x16000);
-  memory_.SetData32(0x1010, 0x17000);
-  memory_.SetData32(0x1018, 0x18000);
-  memory_.SetData32(0x1020, 0x19000);
-  ASSERT_TRUE(interface.FindEntry(0x8100, &entry_offset));
-  ASSERT_EQ(0x1010U, entry_offset);
-}
-
-TEST_F(ElfInterfaceArmTest, iterate) {
-  ElfInterfaceArmFake interface(&memory_);
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(5);
-  memory_.SetData32(0x1000, 0x5000);
-  memory_.SetData32(0x1008, 0x6000);
-  memory_.SetData32(0x1010, 0x7000);
-  memory_.SetData32(0x1018, 0x8000);
-  memory_.SetData32(0x1020, 0x9000);
-
-  std::vector<uint32_t> entries;
-  for (auto addr : interface) {
-    entries.push_back(addr);
-  }
-  ASSERT_EQ(5U, entries.size());
-  ASSERT_EQ(0x6000U, entries[0]);
-  ASSERT_EQ(0x7008U, entries[1]);
-  ASSERT_EQ(0x8010U, entries[2]);
-  ASSERT_EQ(0x9018U, entries[3]);
-  ASSERT_EQ(0xa020U, entries[4]);
-
-  // Make sure the iterate cached the entries.
-  memory_.SetData32(0x1000, 0x11000);
-  memory_.SetData32(0x1008, 0x12000);
-  memory_.SetData32(0x1010, 0x13000);
-  memory_.SetData32(0x1018, 0x14000);
-  memory_.SetData32(0x1020, 0x15000);
-
-  entries.clear();
-  for (auto addr : interface) {
-    entries.push_back(addr);
-  }
-  ASSERT_EQ(5U, entries.size());
-  ASSERT_EQ(0x6000U, entries[0]);
-  ASSERT_EQ(0x7008U, entries[1]);
-  ASSERT_EQ(0x8010U, entries[2]);
-  ASSERT_EQ(0x9018U, entries[3]);
-  ASSERT_EQ(0xa020U, entries[4]);
-}
-
-TEST_F(ElfInterfaceArmTest, HandleUnknownType_arm_exidx) {
-  ElfInterfaceArmFake interface(&memory_);
-
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(100);
-
-  // Verify that if the type is not the one we want, we don't set the values.
-  interface.HandleUnknownType(0x70000000, 0x2000, 320);
-  ASSERT_EQ(0x1000U, interface.start_offset());
-  ASSERT_EQ(100U, interface.total_entries());
-
-  // Everything is correct and present.
-  interface.HandleUnknownType(0x70000001, 0x2000, 320);
-  ASSERT_EQ(0x2000U, interface.start_offset());
-  ASSERT_EQ(40U, interface.total_entries());
-}
-
-TEST_F(ElfInterfaceArmTest, StepExidx) {
-  ElfInterfaceArmFake interface(&memory_);
-
-  // FindEntry fails.
-  bool finished;
-  ASSERT_FALSE(interface.StepExidx(0x7000, nullptr, nullptr, &finished));
-  EXPECT_EQ(ERROR_UNWIND_INFO, interface.LastErrorCode());
-
-  // ExtractEntry should fail.
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(2);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1008, 0x8000);
-
-  RegsArm regs;
-  regs[ARM_REG_SP] = 0x1000;
-  regs[ARM_REG_LR] = 0x20000;
-  regs.set_sp(regs[ARM_REG_SP]);
-  regs.set_pc(0x1234);
-  ASSERT_FALSE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_MEMORY_INVALID, interface.LastErrorCode());
-  EXPECT_EQ(0x1004U, interface.LastErrorAddress());
-
-  // Eval should fail.
-  memory_.SetData32(0x1004, 0x81000000);
-  ASSERT_FALSE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_UNWIND_INFO, interface.LastErrorCode());
-
-  // Everything should pass.
-  memory_.SetData32(0x1004, 0x80b0b0b0);
-  ASSERT_TRUE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_UNWIND_INFO, interface.LastErrorCode());
-  ASSERT_FALSE(finished);
-  ASSERT_EQ(0x1000U, regs.sp());
-  ASSERT_EQ(0x1000U, regs[ARM_REG_SP]);
-  ASSERT_EQ(0x20000U, regs.pc());
-  ASSERT_EQ(0x20000U, regs[ARM_REG_PC]);
-
-  // Load bias is non-zero.
-  interface.set_load_bias(0x1000);
-  ASSERT_TRUE(interface.StepExidx(0x8000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_UNWIND_INFO, interface.LastErrorCode());
-
-  // Pc too small.
-  interface.set_load_bias(0x9000);
-  ASSERT_FALSE(interface.StepExidx(0x8000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_UNWIND_INFO, interface.LastErrorCode());
-}
-
-TEST_F(ElfInterfaceArmTest, StepExidx_pc_set) {
-  ElfInterfaceArmFake interface(&memory_);
-
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(2);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1004, 0x808800b0);
-  memory_.SetData32(0x1008, 0x8000);
-  process_memory_.SetData32(0x10000, 0x10);
-
-  RegsArm regs;
-  regs[ARM_REG_SP] = 0x10000;
-  regs[ARM_REG_LR] = 0x20000;
-  regs.set_sp(regs[ARM_REG_SP]);
-  regs.set_pc(0x1234);
-
-  // Everything should pass.
-  bool finished;
-  ASSERT_TRUE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_NONE, interface.LastErrorCode());
-  ASSERT_FALSE(finished);
-  ASSERT_EQ(0x10004U, regs.sp());
-  ASSERT_EQ(0x10004U, regs[ARM_REG_SP]);
-  ASSERT_EQ(0x10U, regs.pc());
-  ASSERT_EQ(0x10U, regs[ARM_REG_PC]);
-}
-
-TEST_F(ElfInterfaceArmTest, StepExidx_cant_unwind) {
-  ElfInterfaceArmFake interface(&memory_);
-
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(1);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1004, 1);
-
-  RegsArm regs;
-  regs[ARM_REG_SP] = 0x10000;
-  regs[ARM_REG_LR] = 0x20000;
-  regs.set_sp(regs[ARM_REG_SP]);
-  regs.set_pc(0x1234);
-
-  bool finished;
-  ASSERT_TRUE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_NONE, interface.LastErrorCode());
-  ASSERT_TRUE(finished);
-  ASSERT_EQ(0x10000U, regs.sp());
-  ASSERT_EQ(0x10000U, regs[ARM_REG_SP]);
-  ASSERT_EQ(0x1234U, regs.pc());
-}
-
-TEST_F(ElfInterfaceArmTest, StepExidx_refuse_unwind) {
-  ElfInterfaceArmFake interface(&memory_);
-
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(1);
-  memory_.SetData32(0x1000, 0x6000);
-  memory_.SetData32(0x1004, 0x808000b0);
-
-  RegsArm regs;
-  regs[ARM_REG_SP] = 0x10000;
-  regs[ARM_REG_LR] = 0x20000;
-  regs.set_sp(regs[ARM_REG_SP]);
-  regs.set_pc(0x1234);
-
-  bool finished;
-  ASSERT_TRUE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_NONE, interface.LastErrorCode());
-  ASSERT_TRUE(finished);
-  ASSERT_EQ(0x10000U, regs.sp());
-  ASSERT_EQ(0x10000U, regs[ARM_REG_SP]);
-  ASSERT_EQ(0x1234U, regs.pc());
-}
-
-TEST_F(ElfInterfaceArmTest, StepExidx_pc_zero) {
-  ElfInterfaceArmFake interface(&memory_);
-
-  interface.FakeSetStartOffset(0x1000);
-  interface.FakeSetTotalEntries(1);
-  memory_.SetData32(0x1000, 0x6000);
-  // Set the pc using a pop r15 command.
-  memory_.SetData32(0x1004, 0x808800b0);
-
-  // pc value of zero.
-  process_memory_.SetData32(0x10000, 0);
-
-  RegsArm regs;
-  regs[ARM_REG_SP] = 0x10000;
-  regs[ARM_REG_LR] = 0x20000;
-  regs.set_sp(regs[ARM_REG_SP]);
-  regs.set_pc(0x1234);
-
-  bool finished;
-  ASSERT_TRUE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_NONE, interface.LastErrorCode());
-  ASSERT_TRUE(finished);
-  ASSERT_EQ(0U, regs.pc());
-
-  // Now set the pc from the lr register (pop r14).
-  memory_.SetData32(0x1004, 0x808400b0);
-
-  regs[ARM_REG_SP] = 0x10000;
-  regs[ARM_REG_LR] = 0x20000;
-  regs.set_sp(regs[ARM_REG_SP]);
-  regs.set_pc(0x1234);
-
-  ASSERT_TRUE(interface.StepExidx(0x7000, &regs, &process_memory_, &finished));
-  EXPECT_EQ(ERROR_NONE, interface.LastErrorCode());
-  ASSERT_TRUE(finished);
-  ASSERT_EQ(0U, regs.pc());
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfInterfaceTest.cpp b/libunwindstack/tests/ElfInterfaceTest.cpp
deleted file mode 100644
index 3cf90fe..0000000
--- a/libunwindstack/tests/ElfInterfaceTest.cpp
+++ /dev/null
@@ -1,1966 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-
-#include <memory>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/ElfInterface.h>
-
-#include "DwarfEncoding.h"
-#include "ElfInterfaceArm.h"
-
-#include "ElfFake.h"
-#include "MemoryFake.h"
-
-#if !defined(PT_ARM_EXIDX)
-#define PT_ARM_EXIDX 0x70000001
-#endif
-
-#if !defined(EM_AARCH64)
-#define EM_AARCH64 183
-#endif
-
-namespace unwindstack {
-
-class ElfInterfaceTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_.Clear();
-  }
-
-  void SetStringMemory(uint64_t offset, const char* string) {
-    memory_.SetMemory(offset, string, strlen(string) + 1);
-  }
-
-  template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-  void SinglePtLoad();
-
-  template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-  void MultipleExecutablePtLoads();
-
-  template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-  void MultipleExecutablePtLoadsIncrementsNotSizeOfPhdr();
-
-  template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-  void NonExecutablePtLoads();
-
-  template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-  void ManyPhdrs();
-
-  enum SonameTestEnum : uint8_t {
-    SONAME_NORMAL,
-    SONAME_DTNULL_AFTER,
-    SONAME_DTSIZE_SMALL,
-    SONAME_MISSING_MAP,
-  };
-
-  template <typename Ehdr, typename Phdr, typename Shdr, typename Dyn>
-  void SonameInit(SonameTestEnum test_type = SONAME_NORMAL);
-
-  template <typename ElfInterfaceType>
-  void Soname();
-
-  template <typename ElfInterfaceType>
-  void SonameAfterDtNull();
-
-  template <typename ElfInterfaceType>
-  void SonameSize();
-
-  template <typename ElfInterfaceType>
-  void SonameMissingMap();
-
-  template <typename ElfType>
-  void InitHeadersEhFrameTest();
-
-  template <typename ElfType>
-  void InitHeadersDebugFrame();
-
-  template <typename ElfType>
-  void InitHeadersEhFrameFail();
-
-  template <typename ElfType>
-  void InitHeadersDebugFrameFail();
-
-  template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-  void InitProgramHeadersMalformed();
-
-  template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-  void InitSectionHeadersMalformed();
-
-  template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-  void InitSectionHeadersMalformedSymData();
-
-  template <typename Ehdr, typename Shdr, typename Sym, typename ElfInterfaceType>
-  void InitSectionHeaders(uint64_t entry_size);
-
-  template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-  void InitSectionHeadersOffsets();
-
-  template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-  void InitSectionHeadersOffsetsEhFrameSectionBias(uint64_t addr, uint64_t offset,
-                                                   int64_t expected_bias);
-
-  template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-  void InitSectionHeadersOffsetsEhFrameHdrSectionBias(uint64_t addr, uint64_t offset,
-                                                      int64_t expected_bias);
-
-  template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-  void InitSectionHeadersOffsetsDebugFrameSectionBias(uint64_t addr, uint64_t offset,
-                                                      int64_t expected_bias);
-
-  template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-  void CheckGnuEhFrame(uint64_t addr, uint64_t offset, int64_t expected_bias);
-
-  template <typename Sym>
-  void InitSym(uint64_t offset, uint32_t value, uint32_t size, uint32_t name_offset,
-               uint64_t sym_offset, const char* name);
-
-  template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-  void BuildID();
-
-  template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-  void BuildIDTwoNotes();
-
-  template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-  void BuildIDSectionTooSmallForName();
-
-  template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-  void BuildIDSectionTooSmallForDesc();
-
-  template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-  void BuildIDSectionTooSmallForHeader();
-
-  template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-  void CheckLoadBiasInFirstPhdr(int64_t load_bias);
-
-  template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-  void CheckLoadBiasInFirstExecPhdr(uint64_t offset, uint64_t vaddr, int64_t load_bias);
-
-  MemoryFake memory_;
-};
-
-template <typename Sym>
-void ElfInterfaceTest::InitSym(uint64_t offset, uint32_t value, uint32_t size, uint32_t name_offset,
-                               uint64_t sym_offset, const char* name) {
-  Sym sym = {};
-  sym.st_info = STT_FUNC;
-  sym.st_value = value;
-  sym.st_size = size;
-  sym.st_name = name_offset;
-  sym.st_shndx = SHN_COMMON;
-
-  memory_.SetMemory(offset, &sym, sizeof(sym));
-  memory_.SetMemory(sym_offset + name_offset, name, strlen(name) + 1);
-}
-
-template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-void ElfInterfaceTest::SinglePtLoad() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 1;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0x2000, load_bias);
-
-  const std::unordered_map<uint64_t, LoadInfo>& pt_loads = elf->pt_loads();
-  ASSERT_EQ(1U, pt_loads.size());
-  LoadInfo load_data = pt_loads.at(0);
-  ASSERT_EQ(0U, load_data.offset);
-  ASSERT_EQ(0x2000U, load_data.table_offset);
-  ASSERT_EQ(0x10000U, load_data.table_size);
-}
-
-TEST_F(ElfInterfaceTest, single_pt_load_32) {
-  SinglePtLoad<Elf32_Ehdr, Elf32_Phdr, Elf32_Dyn, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, single_pt_load_64) {
-  SinglePtLoad<Elf64_Ehdr, Elf64_Phdr, Elf64_Dyn, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-void ElfInterfaceTest::MultipleExecutablePtLoads() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 3;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x1000;
-  phdr.p_vaddr = 0x2001;
-  phdr.p_memsz = 0x10001;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1001;
-  memory_.SetMemory(0x100 + sizeof(phdr), &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x2000;
-  phdr.p_vaddr = 0x2002;
-  phdr.p_memsz = 0x10002;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1002;
-  memory_.SetMemory(0x100 + 2 * sizeof(phdr), &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0x2000, load_bias);
-
-  const std::unordered_map<uint64_t, LoadInfo>& pt_loads = elf->pt_loads();
-  ASSERT_EQ(3U, pt_loads.size());
-
-  LoadInfo load_data = pt_loads.at(0);
-  ASSERT_EQ(0U, load_data.offset);
-  ASSERT_EQ(0x2000U, load_data.table_offset);
-  ASSERT_EQ(0x10000U, load_data.table_size);
-
-  load_data = pt_loads.at(0x1000);
-  ASSERT_EQ(0x1000U, load_data.offset);
-  ASSERT_EQ(0x2001U, load_data.table_offset);
-  ASSERT_EQ(0x10001U, load_data.table_size);
-
-  load_data = pt_loads.at(0x2000);
-  ASSERT_EQ(0x2000U, load_data.offset);
-  ASSERT_EQ(0x2002U, load_data.table_offset);
-  ASSERT_EQ(0x10002U, load_data.table_size);
-}
-
-TEST_F(ElfInterfaceTest, multiple_executable_pt_loads_32) {
-  MultipleExecutablePtLoads<Elf32_Ehdr, Elf32_Phdr, Elf32_Dyn, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, multiple_executable_pt_loads_64) {
-  MultipleExecutablePtLoads<Elf64_Ehdr, Elf64_Phdr, Elf64_Dyn, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-void ElfInterfaceTest::MultipleExecutablePtLoadsIncrementsNotSizeOfPhdr() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 3;
-  ehdr.e_phentsize = sizeof(Phdr) + 100;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x1000;
-  phdr.p_vaddr = 0x2001;
-  phdr.p_memsz = 0x10001;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1001;
-  memory_.SetMemory(0x100 + sizeof(phdr) + 100, &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x2000;
-  phdr.p_vaddr = 0x2002;
-  phdr.p_memsz = 0x10002;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1002;
-  memory_.SetMemory(0x100 + 2 * (sizeof(phdr) + 100), &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0x2000, load_bias);
-
-  const std::unordered_map<uint64_t, LoadInfo>& pt_loads = elf->pt_loads();
-  ASSERT_EQ(3U, pt_loads.size());
-
-  LoadInfo load_data = pt_loads.at(0);
-  ASSERT_EQ(0U, load_data.offset);
-  ASSERT_EQ(0x2000U, load_data.table_offset);
-  ASSERT_EQ(0x10000U, load_data.table_size);
-
-  load_data = pt_loads.at(0x1000);
-  ASSERT_EQ(0x1000U, load_data.offset);
-  ASSERT_EQ(0x2001U, load_data.table_offset);
-  ASSERT_EQ(0x10001U, load_data.table_size);
-
-  load_data = pt_loads.at(0x2000);
-  ASSERT_EQ(0x2000U, load_data.offset);
-  ASSERT_EQ(0x2002U, load_data.table_offset);
-  ASSERT_EQ(0x10002U, load_data.table_size);
-}
-
-TEST_F(ElfInterfaceTest, multiple_executable_pt_loads_increments_not_size_of_phdr_32) {
-  MultipleExecutablePtLoadsIncrementsNotSizeOfPhdr<Elf32_Ehdr, Elf32_Phdr, Elf32_Dyn,
-                                                   ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, multiple_executable_pt_loads_increments_not_size_of_phdr_64) {
-  MultipleExecutablePtLoadsIncrementsNotSizeOfPhdr<Elf64_Ehdr, Elf64_Phdr, Elf64_Dyn,
-                                                   ElfInterface64>();
-}
-
-template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-void ElfInterfaceTest::NonExecutablePtLoads() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 3;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x1000;
-  phdr.p_vaddr = 0x2001;
-  phdr.p_memsz = 0x10001;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1001;
-  memory_.SetMemory(0x100 + sizeof(phdr), &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x2000;
-  phdr.p_vaddr = 0x2002;
-  phdr.p_memsz = 0x10002;
-  phdr.p_flags = PF_R;
-  phdr.p_align = 0x1002;
-  memory_.SetMemory(0x100 + 2 * sizeof(phdr), &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0x1001, load_bias);
-
-  const std::unordered_map<uint64_t, LoadInfo>& pt_loads = elf->pt_loads();
-  ASSERT_EQ(1U, pt_loads.size());
-
-  LoadInfo load_data = pt_loads.at(0x1000);
-  ASSERT_EQ(0x1000U, load_data.offset);
-  ASSERT_EQ(0x2001U, load_data.table_offset);
-  ASSERT_EQ(0x10001U, load_data.table_size);
-}
-
-TEST_F(ElfInterfaceTest, non_executable_pt_loads_32) {
-  NonExecutablePtLoads<Elf32_Ehdr, Elf32_Phdr, Elf32_Dyn, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, non_executable_pt_loads_64) {
-  NonExecutablePtLoads<Elf64_Ehdr, Elf64_Phdr, Elf64_Dyn, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Phdr, typename Dyn, typename ElfInterfaceType>
-void ElfInterfaceTest::ManyPhdrs() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 7;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  uint64_t phdr_offset = 0x100;
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_GNU_EH_FRAME;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_DYNAMIC;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_INTERP;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_NOTE;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_SHLIB;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_GNU_EH_FRAME;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0x2000, load_bias);
-
-  const std::unordered_map<uint64_t, LoadInfo>& pt_loads = elf->pt_loads();
-  ASSERT_EQ(1U, pt_loads.size());
-
-  LoadInfo load_data = pt_loads.at(0);
-  ASSERT_EQ(0U, load_data.offset);
-  ASSERT_EQ(0x2000U, load_data.table_offset);
-  ASSERT_EQ(0x10000U, load_data.table_size);
-}
-
-TEST_F(ElfInterfaceTest, many_phdrs_32) {
-  ElfInterfaceTest::ManyPhdrs<Elf32_Ehdr, Elf32_Phdr, Elf32_Dyn, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, many_phdrs_64) {
-  ElfInterfaceTest::ManyPhdrs<Elf64_Ehdr, Elf64_Phdr, Elf64_Dyn, ElfInterface64>();
-}
-
-TEST_F(ElfInterfaceTest, arm32) {
-  ElfInterfaceArm elf_arm(&memory_);
-
-  Elf32_Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 1;
-  ehdr.e_phentsize = sizeof(Elf32_Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Elf32_Phdr phdr = {};
-  phdr.p_type = PT_ARM_EXIDX;
-  phdr.p_offset = 0x2000;
-  phdr.p_filesz = 16;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  // Add arm exidx entries.
-  memory_.SetData32(0x2000, 0x1000);
-  memory_.SetData32(0x2008, 0x1000);
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf_arm.Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-
-  std::vector<uint32_t> entries;
-  for (auto addr : elf_arm) {
-    entries.push_back(addr);
-  }
-  ASSERT_EQ(2U, entries.size());
-  ASSERT_EQ(0x3000U, entries[0]);
-  ASSERT_EQ(0x3008U, entries[1]);
-
-  ASSERT_EQ(0x2000U, elf_arm.start_offset());
-  ASSERT_EQ(2U, elf_arm.total_entries());
-}
-
-template <typename Ehdr, typename Phdr, typename Shdr, typename Dyn>
-void ElfInterfaceTest::SonameInit(SonameTestEnum test_type) {
-  Ehdr ehdr = {};
-  ehdr.e_shoff = 0x200;
-  ehdr.e_shnum = 2;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 1;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_STRTAB;
-  if (test_type == SONAME_MISSING_MAP) {
-    shdr.sh_addr = 0x20100;
-  } else {
-    shdr.sh_addr = 0x10100;
-  }
-  shdr.sh_offset = 0x10000;
-  memory_.SetMemory(0x200 + sizeof(shdr), &shdr, sizeof(shdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_DYNAMIC;
-  phdr.p_offset = 0x2000;
-  phdr.p_memsz = sizeof(Dyn) * 3;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  uint64_t offset = 0x2000;
-  Dyn dyn;
-
-  dyn.d_tag = DT_STRTAB;
-  dyn.d_un.d_ptr = 0x10100;
-  memory_.SetMemory(offset, &dyn, sizeof(dyn));
-  offset += sizeof(dyn);
-
-  dyn.d_tag = DT_STRSZ;
-  if (test_type == SONAME_DTSIZE_SMALL) {
-    dyn.d_un.d_val = 0x10;
-  } else {
-    dyn.d_un.d_val = 0x1000;
-  }
-  memory_.SetMemory(offset, &dyn, sizeof(dyn));
-  offset += sizeof(dyn);
-
-  if (test_type == SONAME_DTNULL_AFTER) {
-    dyn.d_tag = DT_NULL;
-    memory_.SetMemory(offset, &dyn, sizeof(dyn));
-    offset += sizeof(dyn);
-  }
-
-  dyn.d_tag = DT_SONAME;
-  dyn.d_un.d_val = 0x10;
-  memory_.SetMemory(offset, &dyn, sizeof(dyn));
-  offset += sizeof(dyn);
-
-  dyn.d_tag = DT_NULL;
-  memory_.SetMemory(offset, &dyn, sizeof(dyn));
-
-  SetStringMemory(0x10010, "fake_soname.so");
-}
-
-template <typename ElfInterfaceType>
-void ElfInterfaceTest::Soname() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-
-  ASSERT_EQ("fake_soname.so", elf->GetSoname());
-}
-
-TEST_F(ElfInterfaceTest, soname_32) {
-  SonameInit<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Dyn>();
-  Soname<ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, soname_64) {
-  SonameInit<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Dyn>();
-  Soname<ElfInterface64>();
-}
-
-template <typename ElfInterfaceType>
-void ElfInterfaceTest::SonameAfterDtNull() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-
-  ASSERT_EQ("", elf->GetSoname());
-}
-
-TEST_F(ElfInterfaceTest, soname_after_dt_null_32) {
-  SonameInit<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Dyn>(SONAME_DTNULL_AFTER);
-  SonameAfterDtNull<ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, soname_after_dt_null_64) {
-  SonameInit<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Dyn>(SONAME_DTNULL_AFTER);
-  SonameAfterDtNull<ElfInterface64>();
-}
-
-template <typename ElfInterfaceType>
-void ElfInterfaceTest::SonameSize() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-
-  ASSERT_EQ("", elf->GetSoname());
-}
-
-TEST_F(ElfInterfaceTest, soname_size_32) {
-  SonameInit<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Dyn>(SONAME_DTSIZE_SMALL);
-  SonameSize<ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, soname_size_64) {
-  SonameInit<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Dyn>(SONAME_DTSIZE_SMALL);
-  SonameSize<ElfInterface64>();
-}
-
-// Verify that there is no map from STRTAB in the dynamic section to a
-// STRTAB entry in the section headers.
-template <typename ElfInterfaceType>
-void ElfInterfaceTest::SonameMissingMap() {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-
-  ASSERT_EQ("", elf->GetSoname());
-}
-
-TEST_F(ElfInterfaceTest, soname_missing_map_32) {
-  SonameInit<Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr, Elf32_Dyn>(SONAME_MISSING_MAP);
-  SonameMissingMap<ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, soname_missing_map_64) {
-  SonameInit<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, Elf64_Dyn>(SONAME_MISSING_MAP);
-  SonameMissingMap<ElfInterface64>();
-}
-
-template <typename ElfType>
-void ElfInterfaceTest::InitHeadersEhFrameTest() {
-  ElfType elf(&memory_);
-
-  elf.FakeSetEhFrameOffset(0x10000);
-  elf.FakeSetEhFrameSize(0);
-  elf.FakeSetDebugFrameOffset(0);
-  elf.FakeSetDebugFrameSize(0);
-
-  memory_.SetMemory(0x10000,
-                    std::vector<uint8_t>{0x1, DW_EH_PE_udata2, DW_EH_PE_udata2, DW_EH_PE_udata2});
-  memory_.SetData32(0x10004, 0x500);
-  memory_.SetData32(0x10008, 250);
-
-  elf.InitHeaders();
-
-  EXPECT_FALSE(elf.eh_frame() == nullptr);
-  EXPECT_TRUE(elf.debug_frame() == nullptr);
-}
-
-TEST_F(ElfInterfaceTest, init_headers_eh_frame_32) {
-  InitHeadersEhFrameTest<ElfInterface32Fake>();
-}
-
-TEST_F(ElfInterfaceTest, init_headers_eh_frame_64) {
-  InitHeadersEhFrameTest<ElfInterface64Fake>();
-}
-
-template <typename ElfType>
-void ElfInterfaceTest::InitHeadersDebugFrame() {
-  ElfType elf(&memory_);
-
-  elf.FakeSetEhFrameOffset(0);
-  elf.FakeSetEhFrameSize(0);
-  elf.FakeSetDebugFrameOffset(0x5000);
-  elf.FakeSetDebugFrameSize(0x200);
-
-  memory_.SetData32(0x5000, 0xfc);
-  memory_.SetData32(0x5004, 0xffffffff);
-  memory_.SetMemory(0x5008, std::vector<uint8_t>{1, '\0', 4, 8, 2});
-
-  memory_.SetData32(0x5100, 0xfc);
-  memory_.SetData32(0x5104, 0);
-  memory_.SetData32(0x5108, 0x1500);
-  memory_.SetData32(0x510c, 0x200);
-
-  elf.InitHeaders();
-
-  EXPECT_TRUE(elf.eh_frame() == nullptr);
-  EXPECT_FALSE(elf.debug_frame() == nullptr);
-}
-
-TEST_F(ElfInterfaceTest, init_headers_debug_frame_32) {
-  InitHeadersDebugFrame<ElfInterface32Fake>();
-}
-
-TEST_F(ElfInterfaceTest, init_headers_debug_frame_64) {
-  InitHeadersDebugFrame<ElfInterface64Fake>();
-}
-
-template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitProgramHeadersMalformed() {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 3;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-}
-
-TEST_F(ElfInterfaceTest, init_program_headers_malformed_32) {
-  InitProgramHeadersMalformed<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, init_program_headers_malformed_64) {
-  InitProgramHeadersMalformed<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeadersMalformed() {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = 0x1000;
-  ehdr.e_shnum = 10;
-  ehdr.e_shentsize = sizeof(Shdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_malformed_32) {
-  InitSectionHeadersMalformed<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_malformed_64) {
-  InitSectionHeadersMalformed<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeadersMalformedSymData() {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x1000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 5;
-  ehdr.e_shentsize = sizeof(Shdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_SYMTAB;
-  shdr.sh_link = 4;
-  shdr.sh_addr = 0x5000;
-  shdr.sh_offset = 0x5000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = shdr.sh_entsize * 10;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_DYNSYM;
-  shdr.sh_link = 10;
-  shdr.sh_addr = 0x6000;
-  shdr.sh_offset = 0x6000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = shdr.sh_entsize * 10;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_DYNSYM;
-  shdr.sh_link = 2;
-  shdr.sh_addr = 0x6000;
-  shdr.sh_offset = 0x6000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = shdr.sh_entsize * 10;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for the entries.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(0U, elf->debug_frame_offset());
-  EXPECT_EQ(0U, elf->debug_frame_size());
-  EXPECT_EQ(0U, elf->gnu_debugdata_offset());
-  EXPECT_EQ(0U, elf->gnu_debugdata_size());
-
-  std::string name;
-  uint64_t name_offset;
-  ASSERT_FALSE(elf->GetFunctionName(0x90010, &name, &name_offset));
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_malformed_symdata_32) {
-  InitSectionHeadersMalformedSymData<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_malformed_symdata_64) {
-  InitSectionHeadersMalformedSymData<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename Sym, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeaders(uint64_t entry_size) {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x1000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 5;
-  ehdr.e_shentsize = entry_size;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_SYMTAB;
-  shdr.sh_link = 4;
-  shdr.sh_addr = 0x5000;
-  shdr.sh_offset = 0x5000;
-  shdr.sh_entsize = sizeof(Sym);
-  shdr.sh_size = shdr.sh_entsize * 10;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_DYNSYM;
-  shdr.sh_link = 4;
-  shdr.sh_addr = 0x6000;
-  shdr.sh_offset = 0x6000;
-  shdr.sh_entsize = sizeof(Sym);
-  shdr.sh_size = shdr.sh_entsize * 10;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_name = 0xa000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for the entries.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  InitSym<Sym>(0x5000, 0x90000, 0x1000, 0x100, 0xf000, "function_one");
-  InitSym<Sym>(0x6000, 0xd0000, 0x1000, 0x300, 0xf000, "function_two");
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(0U, elf->debug_frame_offset());
-  EXPECT_EQ(0U, elf->debug_frame_size());
-  EXPECT_EQ(0U, elf->gnu_debugdata_offset());
-  EXPECT_EQ(0U, elf->gnu_debugdata_size());
-
-  // Look in the first symbol table.
-  std::string name;
-  uint64_t name_offset;
-  ASSERT_TRUE(elf->GetFunctionName(0x90010, &name, &name_offset));
-  EXPECT_EQ("function_one", name);
-  EXPECT_EQ(16U, name_offset);
-  ASSERT_TRUE(elf->GetFunctionName(0xd0020, &name, &name_offset));
-  EXPECT_EQ("function_two", name);
-  EXPECT_EQ(32U, name_offset);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_32) {
-  InitSectionHeaders<Elf32_Ehdr, Elf32_Shdr, Elf32_Sym, ElfInterface32>(sizeof(Elf32_Shdr));
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_64) {
-  InitSectionHeaders<Elf64_Ehdr, Elf64_Shdr, Elf64_Sym, ElfInterface64>(sizeof(Elf64_Shdr));
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_non_std_entry_size_32) {
-  InitSectionHeaders<Elf32_Ehdr, Elf32_Shdr, Elf32_Sym, ElfInterface32>(0x100);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_non_std_entry_size_64) {
-  InitSectionHeaders<Elf64_Ehdr, Elf64_Shdr, Elf64_Sym, ElfInterface64>(0x100);
-}
-
-template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeadersOffsets() {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 7;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x200;
-  shdr.sh_addr = 0x5000;
-  shdr.sh_offset = 0x5000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x800;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x100;
-  shdr.sh_addr = 0x6000;
-  shdr.sh_offset = 0x6000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x500;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x300;
-  shdr.sh_addr = 0x7000;
-  shdr.sh_offset = 0x7000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x800;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x400;
-  shdr.sh_addr = 0xa000;
-  shdr.sh_offset = 0xa000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0xf00;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_addr = 0xb000;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = 0xf00;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf100, ".debug_frame", sizeof(".debug_frame"));
-  memory_.SetMemory(0xf200, ".gnu_debugdata", sizeof(".gnu_debugdata"));
-  memory_.SetMemory(0xf300, ".eh_frame", sizeof(".eh_frame"));
-  memory_.SetMemory(0xf400, ".eh_frame_hdr", sizeof(".eh_frame_hdr"));
-  memory_.SetMemory(0xf500, ".note.gnu.build-id", sizeof(".note.gnu.build-id"));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(0x6000U, elf->debug_frame_offset());
-  EXPECT_EQ(0, elf->debug_frame_section_bias());
-  EXPECT_EQ(0x500U, elf->debug_frame_size());
-
-  EXPECT_EQ(0x5000U, elf->gnu_debugdata_offset());
-  EXPECT_EQ(0x800U, elf->gnu_debugdata_size());
-
-  EXPECT_EQ(0x7000U, elf->eh_frame_offset());
-  EXPECT_EQ(0, elf->eh_frame_section_bias());
-  EXPECT_EQ(0x800U, elf->eh_frame_size());
-
-  EXPECT_EQ(0xa000U, elf->eh_frame_hdr_offset());
-  EXPECT_EQ(0, elf->eh_frame_hdr_section_bias());
-  EXPECT_EQ(0xf00U, elf->eh_frame_hdr_size());
-
-  EXPECT_EQ(0xb000U, elf->gnu_build_id_offset());
-  EXPECT_EQ(0xf00U, elf->gnu_build_id_size());
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_32) {
-  InitSectionHeadersOffsets<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_64) {
-  InitSectionHeadersOffsets<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeadersOffsetsEhFrameSectionBias(uint64_t addr, uint64_t offset,
-                                                                   int64_t expected_bias) {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t elf_offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = elf_offset;
-  ehdr.e_shnum = 4;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  elf_offset += ehdr.e_shentsize;
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x200;
-  shdr.sh_addr = 0x8000;
-  shdr.sh_offset = 0x8000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x800;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-  elf_offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-  elf_offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x100;
-  shdr.sh_addr = addr;
-  shdr.sh_offset = offset;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x500;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf100, ".eh_frame", sizeof(".eh_frame"));
-  memory_.SetMemory(0xf200, ".eh_frame_hdr", sizeof(".eh_frame_hdr"));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(offset, elf->eh_frame_offset());
-  EXPECT_EQ(expected_bias, elf->eh_frame_section_bias());
-  EXPECT_EQ(0x500U, elf->eh_frame_size());
-
-  EXPECT_EQ(0x8000U, elf->eh_frame_hdr_offset());
-  EXPECT_EQ(0, elf->eh_frame_hdr_section_bias());
-  EXPECT_EQ(0x800U, elf->eh_frame_hdr_size());
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_section_bias_zero_32) {
-  InitSectionHeadersOffsetsEhFrameSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(0x4000,
-                                                                                      0x4000, 0);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_section_bias_zero_64) {
-  InitSectionHeadersOffsetsEhFrameSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(0x6000,
-                                                                                      0x6000, 0);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_section_bias_positive_32) {
-  InitSectionHeadersOffsetsEhFrameSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(
-      0x5000, 0x4000, 0x1000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_section_bias_positive_64) {
-  InitSectionHeadersOffsetsEhFrameSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(
-      0x6000, 0x4000, 0x2000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_section_bias_negative_32) {
-  InitSectionHeadersOffsetsEhFrameSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(
-      0x3000, 0x4000, -0x1000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_section_bias_negative_64) {
-  InitSectionHeadersOffsetsEhFrameSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(
-      0x6000, 0x9000, -0x3000);
-}
-
-template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeadersOffsetsEhFrameHdrSectionBias(uint64_t addr,
-                                                                      uint64_t offset,
-                                                                      int64_t expected_bias) {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t elf_offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = elf_offset;
-  ehdr.e_shnum = 4;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  elf_offset += ehdr.e_shentsize;
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x200;
-  shdr.sh_addr = addr;
-  shdr.sh_offset = offset;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x800;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-  elf_offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-  elf_offset += ehdr.e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x100;
-  shdr.sh_addr = 0x5000;
-  shdr.sh_offset = 0x5000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x500;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf100, ".eh_frame", sizeof(".eh_frame"));
-  memory_.SetMemory(0xf200, ".eh_frame_hdr", sizeof(".eh_frame_hdr"));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(0x5000U, elf->eh_frame_offset());
-  EXPECT_EQ(0, elf->eh_frame_section_bias());
-  EXPECT_EQ(0x500U, elf->eh_frame_size());
-  EXPECT_EQ(offset, elf->eh_frame_hdr_offset());
-  EXPECT_EQ(expected_bias, elf->eh_frame_hdr_section_bias());
-  EXPECT_EQ(0x800U, elf->eh_frame_hdr_size());
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_hdr_section_bias_zero_32) {
-  InitSectionHeadersOffsetsEhFrameHdrSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(0x9000,
-                                                                                         0x9000, 0);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_hdr_section_bias_zero_64) {
-  InitSectionHeadersOffsetsEhFrameHdrSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(0xa000,
-                                                                                         0xa000, 0);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_hdr_section_bias_positive_32) {
-  InitSectionHeadersOffsetsEhFrameHdrSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(
-      0x9000, 0x4000, 0x5000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_hdr_section_bias_positive_64) {
-  InitSectionHeadersOffsetsEhFrameHdrSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(
-      0x6000, 0x1000, 0x5000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_hdr_section_bias_negative_32) {
-  InitSectionHeadersOffsetsEhFrameHdrSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(
-      0x3000, 0x5000, -0x2000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_eh_frame_hdr_section_bias_negative_64) {
-  InitSectionHeadersOffsetsEhFrameHdrSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(
-      0x5000, 0x9000, -0x4000);
-}
-
-template <typename Ehdr, typename Shdr, typename ElfInterfaceType>
-void ElfInterfaceTest::InitSectionHeadersOffsetsDebugFrameSectionBias(uint64_t addr,
-                                                                      uint64_t offset,
-                                                                      int64_t expected_bias) {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t elf_offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = elf_offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  elf_offset += ehdr.e_shentsize;
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_link = 2;
-  shdr.sh_name = 0x100;
-  shdr.sh_addr = addr;
-  shdr.sh_offset = offset;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x800;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-  elf_offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(elf_offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf100, ".debug_frame", sizeof(".debug_frame"));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(offset, elf->debug_frame_offset());
-  EXPECT_EQ(expected_bias, elf->debug_frame_section_bias());
-  EXPECT_EQ(0x800U, elf->debug_frame_size());
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_debug_frame_section_bias_zero_32) {
-  InitSectionHeadersOffsetsDebugFrameSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(0x5000,
-                                                                                         0x5000, 0);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_debug_frame_section_bias_zero_64) {
-  InitSectionHeadersOffsetsDebugFrameSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(0xa000,
-                                                                                         0xa000, 0);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_debug_frame_section_bias_positive_32) {
-  InitSectionHeadersOffsetsDebugFrameSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(
-      0x5000, 0x2000, 0x3000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_debug_frame_section_bias_positive_64) {
-  InitSectionHeadersOffsetsDebugFrameSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(
-      0x7000, 0x1000, 0x6000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_debug_frame_section_bias_negative_32) {
-  InitSectionHeadersOffsetsDebugFrameSectionBias<Elf32_Ehdr, Elf32_Shdr, ElfInterface32>(
-      0x6000, 0x7000, -0x1000);
-}
-
-TEST_F(ElfInterfaceTest, init_section_headers_offsets_debug_frame_section_bias_negative_64) {
-  InitSectionHeadersOffsetsDebugFrameSectionBias<Elf64_Ehdr, Elf64_Shdr, ElfInterface64>(
-      0x3000, 0x5000, -0x2000);
-}
-
-template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-void ElfInterfaceTest::CheckGnuEhFrame(uint64_t addr, uint64_t offset, int64_t expected_bias) {
-  std::unique_ptr<ElfInterface> elf(new ElfInterfaceType(&memory_));
-
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 2;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  uint64_t phdr_offset = 0x100;
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-  phdr_offset += sizeof(phdr);
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_GNU_EH_FRAME;
-  phdr.p_vaddr = addr;
-  phdr.p_offset = offset;
-  memory_.SetMemory(phdr_offset, &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_EQ(expected_bias, elf->eh_frame_hdr_section_bias());
-}
-
-TEST_F(ElfInterfaceTest, eh_frame_zero_section_bias_32) {
-  ElfInterfaceTest::CheckGnuEhFrame<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x4000, 0x4000, 0);
-}
-
-TEST_F(ElfInterfaceTest, eh_frame_zero_section_bias_64) {
-  ElfInterfaceTest::CheckGnuEhFrame<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x4000, 0x4000, 0);
-}
-
-TEST_F(ElfInterfaceTest, eh_frame_positive_section_bias_32) {
-  ElfInterfaceTest::CheckGnuEhFrame<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x4000, 0x1000, 0x3000);
-}
-
-TEST_F(ElfInterfaceTest, eh_frame_positive_section_bias_64) {
-  ElfInterfaceTest::CheckGnuEhFrame<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x4000, 0x1000, 0x3000);
-}
-
-TEST_F(ElfInterfaceTest, eh_frame_negative_section_bias_32) {
-  ElfInterfaceTest::CheckGnuEhFrame<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x4000, 0x5000,
-                                                                            -0x1000);
-}
-
-TEST_F(ElfInterfaceTest, eh_frame_negative_section_bias_64) {
-  ElfInterfaceTest::CheckGnuEhFrame<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x4000, 0x5000,
-                                                                            -0x1000);
-}
-
-TEST_F(ElfInterfaceTest, is_valid_pc_from_pt_load) {
-  std::unique_ptr<ElfInterface> elf(new ElfInterface32(&memory_));
-
-  Elf32_Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 1;
-  ehdr.e_phentsize = sizeof(Elf32_Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Elf32_Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0, load_bias);
-  EXPECT_TRUE(elf->IsValidPc(0));
-  EXPECT_TRUE(elf->IsValidPc(0x5000));
-  EXPECT_TRUE(elf->IsValidPc(0xffff));
-  EXPECT_FALSE(elf->IsValidPc(0x10000));
-}
-
-TEST_F(ElfInterfaceTest, is_valid_pc_from_pt_load_non_zero_load_bias) {
-  std::unique_ptr<ElfInterface> elf(new ElfInterface32(&memory_));
-
-  Elf32_Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 1;
-  ehdr.e_phentsize = sizeof(Elf32_Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Elf32_Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  EXPECT_EQ(0x2000, load_bias);
-  EXPECT_FALSE(elf->IsValidPc(0));
-  EXPECT_FALSE(elf->IsValidPc(0x1000));
-  EXPECT_FALSE(elf->IsValidPc(0x1fff));
-  EXPECT_TRUE(elf->IsValidPc(0x2000));
-  EXPECT_TRUE(elf->IsValidPc(0x5000));
-  EXPECT_TRUE(elf->IsValidPc(0x11fff));
-  EXPECT_FALSE(elf->IsValidPc(0x12000));
-}
-
-TEST_F(ElfInterfaceTest, is_valid_pc_from_debug_frame) {
-  std::unique_ptr<ElfInterface> elf(new ElfInterface32(&memory_));
-
-  uint64_t sh_offset = 0x100;
-
-  Elf32_Ehdr ehdr = {};
-  ehdr.e_shstrndx = 1;
-  ehdr.e_shoff = sh_offset;
-  ehdr.e_shentsize = sizeof(Elf32_Shdr);
-  ehdr.e_shnum = 3;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Elf32_Shdr shdr = {};
-  shdr.sh_type = SHT_NULL;
-  memory_.SetMemory(sh_offset, &shdr, sizeof(shdr));
-
-  sh_offset += sizeof(shdr);
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 1;
-  shdr.sh_offset = 0x500;
-  shdr.sh_size = 0x100;
-  memory_.SetMemory(sh_offset, &shdr, sizeof(shdr));
-  memory_.SetMemory(0x500, ".debug_frame");
-
-  sh_offset += sizeof(shdr);
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_name = 0;
-  shdr.sh_addr = 0x600;
-  shdr.sh_offset = 0x600;
-  shdr.sh_size = 0x200;
-  memory_.SetMemory(sh_offset, &shdr, sizeof(shdr));
-
-  // CIE 32.
-  memory_.SetData32(0x600, 0xfc);
-  memory_.SetData32(0x604, 0xffffffff);
-  memory_.SetMemory(0x608, std::vector<uint8_t>{1, '\0', 4, 4, 1});
-
-  // FDE 32.
-  memory_.SetData32(0x700, 0xfc);
-  memory_.SetData32(0x704, 0);
-  memory_.SetData32(0x708, 0x2100);
-  memory_.SetData32(0x70c, 0x200);
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  elf->InitHeaders();
-  EXPECT_EQ(0, load_bias);
-  EXPECT_FALSE(elf->IsValidPc(0));
-  EXPECT_FALSE(elf->IsValidPc(0x20ff));
-  EXPECT_TRUE(elf->IsValidPc(0x2100));
-  EXPECT_TRUE(elf->IsValidPc(0x2200));
-  EXPECT_TRUE(elf->IsValidPc(0x22ff));
-  EXPECT_FALSE(elf->IsValidPc(0x2300));
-}
-
-TEST_F(ElfInterfaceTest, is_valid_pc_from_eh_frame) {
-  std::unique_ptr<ElfInterface> elf(new ElfInterface32(&memory_));
-
-  uint64_t sh_offset = 0x100;
-
-  Elf32_Ehdr ehdr = {};
-  ehdr.e_shstrndx = 1;
-  ehdr.e_shoff = sh_offset;
-  ehdr.e_shentsize = sizeof(Elf32_Shdr);
-  ehdr.e_shnum = 3;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Elf32_Shdr shdr = {};
-  shdr.sh_type = SHT_NULL;
-  memory_.SetMemory(sh_offset, &shdr, sizeof(shdr));
-
-  sh_offset += sizeof(shdr);
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 1;
-  shdr.sh_offset = 0x500;
-  shdr.sh_size = 0x100;
-  memory_.SetMemory(sh_offset, &shdr, sizeof(shdr));
-  memory_.SetMemory(0x500, ".eh_frame");
-
-  sh_offset += sizeof(shdr);
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_name = 0;
-  shdr.sh_addr = 0x600;
-  shdr.sh_offset = 0x600;
-  shdr.sh_size = 0x200;
-  memory_.SetMemory(sh_offset, &shdr, sizeof(shdr));
-
-  // CIE 32.
-  memory_.SetData32(0x600, 0xfc);
-  memory_.SetData32(0x604, 0);
-  memory_.SetMemory(0x608, std::vector<uint8_t>{1, '\0', 4, 4, 1});
-
-  // FDE 32.
-  memory_.SetData32(0x700, 0xfc);
-  memory_.SetData32(0x704, 0x104);
-  memory_.SetData32(0x708, 0x20f8);
-  memory_.SetData32(0x70c, 0x200);
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  elf->InitHeaders();
-  EXPECT_EQ(0, load_bias);
-  EXPECT_FALSE(elf->IsValidPc(0));
-  EXPECT_FALSE(elf->IsValidPc(0x27ff));
-  EXPECT_TRUE(elf->IsValidPc(0x2800));
-  EXPECT_TRUE(elf->IsValidPc(0x2900));
-  EXPECT_TRUE(elf->IsValidPc(0x29ff));
-  EXPECT_FALSE(elf->IsValidPc(0x2a00));
-}
-
-template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-void ElfInterfaceTest::BuildID() {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  char note_section[128];
-  Nhdr note_header = {};
-  note_header.n_namesz = 4;  // "GNU"
-  note_header.n_descsz = 7;  // "BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section, &note_header, sizeof(note_header));
-  size_t note_offset = sizeof(note_header);
-  // The note information contains the GNU and trailing '\0'.
-  memcpy(&note_section[note_offset], "GNU", sizeof("GNU"));
-  note_offset += sizeof("GNU");
-  // This part of the note does not contain any trailing '\0'.
-  memcpy(&note_section[note_offset], "BUILDID", 7);
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = sizeof(note_section);
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf500, ".note.gnu.build-id", sizeof(".note.gnu.build-id"));
-  memory_.SetMemory(0xb000, note_section, sizeof(note_section));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  ASSERT_EQ("BUILDID", elf->GetBuildID());
-}
-
-TEST_F(ElfInterfaceTest, build_id_32) {
-  BuildID<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, build_id_64) {
-  BuildID<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-void ElfInterfaceTest::BuildIDTwoNotes() {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  char note_section[128];
-  Nhdr note_header = {};
-  note_header.n_namesz = 8;  // "WRONG" aligned to 4
-  note_header.n_descsz = 7;  // "BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section, &note_header, sizeof(note_header));
-  size_t note_offset = sizeof(note_header);
-  memcpy(&note_section[note_offset], "WRONG", sizeof("WRONG"));
-  note_offset += 8;
-  // This part of the note does not contain any trailing '\0'.
-  memcpy(&note_section[note_offset], "BUILDID", 7);
-  note_offset += 8;
-
-  note_header.n_namesz = 4;  // "GNU"
-  note_header.n_descsz = 7;  // "BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section[note_offset], &note_header, sizeof(note_header));
-  note_offset += sizeof(note_header);
-  // The note information contains the GNU and trailing '\0'.
-  memcpy(&note_section[note_offset], "GNU", sizeof("GNU"));
-  note_offset += sizeof("GNU");
-  // This part of the note does not contain any trailing '\0'.
-  memcpy(&note_section[note_offset], "BUILDID", 7);
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = sizeof(note_section);
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf500, ".note.gnu.build-id", sizeof(".note.gnu.build-id"));
-  memory_.SetMemory(0xb000, note_section, sizeof(note_section));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  ASSERT_EQ("BUILDID", elf->GetBuildID());
-}
-
-TEST_F(ElfInterfaceTest, build_id_two_notes_32) {
-  BuildIDTwoNotes<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, build_id_two_notes_64) {
-  BuildIDTwoNotes<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-void ElfInterfaceTest::BuildIDSectionTooSmallForName () {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  char note_section[128];
-  Nhdr note_header = {};
-  note_header.n_namesz = 4;  // "GNU"
-  note_header.n_descsz = 7;  // "BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section, &note_header, sizeof(note_header));
-  size_t note_offset = sizeof(note_header);
-  // The note information contains the GNU and trailing '\0'.
-  memcpy(&note_section[note_offset], "GNU", sizeof("GNU"));
-  note_offset += sizeof("GNU");
-  // This part of the note does not contain any trailing '\0'.
-  memcpy(&note_section[note_offset], "BUILDID", 7);
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = sizeof(note_header) + 1;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf500, ".note.gnu.build-id", sizeof(".note.gnu.build-id"));
-  memory_.SetMemory(0xb000, note_section, sizeof(note_section));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  ASSERT_EQ("", elf->GetBuildID());
-}
-
-TEST_F(ElfInterfaceTest, build_id_section_too_small_for_name_32) {
-  BuildIDSectionTooSmallForName<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, build_id_section_too_small_for_name_64) {
-  BuildIDSectionTooSmallForName<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-void ElfInterfaceTest::BuildIDSectionTooSmallForDesc () {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  char note_section[128];
-  Nhdr note_header = {};
-  note_header.n_namesz = 4;  // "GNU"
-  note_header.n_descsz = 7;  // "BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section, &note_header, sizeof(note_header));
-  size_t note_offset = sizeof(note_header);
-  // The note information contains the GNU and trailing '\0'.
-  memcpy(&note_section[note_offset], "GNU", sizeof("GNU"));
-  note_offset += sizeof("GNU");
-  // This part of the note does not contain any trailing '\0'.
-  memcpy(&note_section[note_offset], "BUILDID", 7);
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = sizeof(note_header) + sizeof("GNU") + 1;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf500, ".note.gnu.build-id", sizeof(".note.gnu.build-id"));
-  memory_.SetMemory(0xb000, note_section, sizeof(note_section));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  ASSERT_EQ("", elf->GetBuildID());
-}
-
-TEST_F(ElfInterfaceTest, build_id_section_too_small_for_desc_32) {
-  BuildIDSectionTooSmallForDesc<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, build_id_section_too_small_for_desc_64) {
-  BuildIDSectionTooSmallForDesc<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
-void ElfInterfaceTest::BuildIDSectionTooSmallForHeader () {
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-
-  uint64_t offset = 0x2000;
-
-  Ehdr ehdr = {};
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  offset += ehdr.e_shentsize;
-
-  char note_section[128];
-  Nhdr note_header = {};
-  note_header.n_namesz = 4;  // "GNU"
-  note_header.n_descsz = 7;  // "BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section, &note_header, sizeof(note_header));
-  size_t note_offset = sizeof(note_header);
-  // The note information contains the GNU and trailing '\0'.
-  memcpy(&note_section[note_offset], "GNU", sizeof("GNU"));
-  note_offset += sizeof("GNU");
-  // This part of the note does not contain any trailing '\0'.
-  memcpy(&note_section[note_offset], "BUILDID", 7);
-
-  Shdr shdr = {};
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = sizeof(note_header) - 1;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  memory_.SetMemory(offset, &shdr, sizeof(shdr));
-
-  memory_.SetMemory(0xf500, ".note.gnu.build-id", sizeof(".note.gnu.build-id"));
-  memory_.SetMemory(0xb000, note_section, sizeof(note_section));
-
-  int64_t load_bias = 0;
-  ASSERT_TRUE(elf->Init(&load_bias));
-  ASSERT_EQ("", elf->GetBuildID());
-}
-
-TEST_F(ElfInterfaceTest, build_id_section_too_small_for_header_32) {
-  BuildIDSectionTooSmallForHeader<Elf32_Ehdr, Elf32_Shdr, Elf32_Nhdr, ElfInterface32>();
-}
-
-TEST_F(ElfInterfaceTest, build_id_section_too_small_for_header_64) {
-  BuildIDSectionTooSmallForHeader<Elf64_Ehdr, Elf64_Shdr, Elf64_Nhdr, ElfInterface64>();
-}
-
-template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-void ElfInterfaceTest::CheckLoadBiasInFirstPhdr(int64_t load_bias) {
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 2;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0;
-  phdr.p_vaddr = load_bias;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x1000;
-  phdr.p_memsz = 0x2000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100 + sizeof(phdr), &phdr, sizeof(phdr));
-
-  int64_t static_load_bias = ElfInterface::GetLoadBias<Ehdr, Phdr>(&memory_);
-  ASSERT_EQ(load_bias, static_load_bias);
-
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-  int64_t init_load_bias = 0;
-  ASSERT_TRUE(elf->Init(&init_load_bias));
-  ASSERT_EQ(init_load_bias, static_load_bias);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_zero_32) {
-  CheckLoadBiasInFirstPhdr<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_zero_64) {
-  CheckLoadBiasInFirstPhdr<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_non_zero_32) {
-  CheckLoadBiasInFirstPhdr<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x1000);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_non_zero_64) {
-  CheckLoadBiasInFirstPhdr<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x1000);
-}
-
-template <typename Ehdr, typename Phdr, typename ElfInterfaceType>
-void ElfInterfaceTest::CheckLoadBiasInFirstExecPhdr(uint64_t offset, uint64_t vaddr,
-                                                    int64_t load_bias) {
-  Ehdr ehdr = {};
-  ehdr.e_phoff = 0x100;
-  ehdr.e_phnum = 3;
-  ehdr.e_phentsize = sizeof(Phdr);
-  memory_.SetMemory(0, &ehdr, sizeof(ehdr));
-
-  Phdr phdr = {};
-  phdr.p_type = PT_LOAD;
-  phdr.p_memsz = 0x10000;
-  phdr.p_flags = PF_R;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100, &phdr, sizeof(phdr));
-
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = offset;
-  phdr.p_vaddr = vaddr;
-  phdr.p_memsz = 0x2000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x100 + sizeof(phdr), &phdr, sizeof(phdr));
-
-  // Second executable load should be ignored for load bias computation.
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_offset = 0x1234;
-  phdr.p_vaddr = 0x2000;
-  phdr.p_memsz = 0x2000;
-  phdr.p_flags = PF_R | PF_X;
-  phdr.p_align = 0x1000;
-  memory_.SetMemory(0x200 + sizeof(phdr), &phdr, sizeof(phdr));
-
-  int64_t static_load_bias = ElfInterface::GetLoadBias<Ehdr, Phdr>(&memory_);
-  ASSERT_EQ(load_bias, static_load_bias);
-
-  std::unique_ptr<ElfInterfaceType> elf(new ElfInterfaceType(&memory_));
-  int64_t init_load_bias = 0;
-  ASSERT_TRUE(elf->Init(&init_load_bias));
-  ASSERT_EQ(init_load_bias, static_load_bias);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_exec_zero_32) {
-  CheckLoadBiasInFirstExecPhdr<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x1000, 0x1000, 0);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_exec_zero_64) {
-  CheckLoadBiasInFirstExecPhdr<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x1000, 0x1000, 0);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_exec_positive_32) {
-  CheckLoadBiasInFirstExecPhdr<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x1000, 0x4000, 0x3000);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_exec_positive_64) {
-  CheckLoadBiasInFirstExecPhdr<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x1000, 0x4000, 0x3000);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_exec_negative_32) {
-  CheckLoadBiasInFirstExecPhdr<Elf32_Ehdr, Elf32_Phdr, ElfInterface32>(0x5000, 0x1000, -0x4000);
-}
-
-TEST_F(ElfInterfaceTest, get_load_bias_exec_negative_64) {
-  CheckLoadBiasInFirstExecPhdr<Elf64_Ehdr, Elf64_Phdr, ElfInterface64>(0x5000, 0x1000, -0x4000);
-}
-
-TEST_F(ElfInterfaceTest, huge_gnu_debugdata_size) {
-  ElfInterfaceFake interface(nullptr);
-
-  interface.FakeSetGnuDebugdataOffset(0x1000);
-  interface.FakeSetGnuDebugdataSize(0xffffffffffffffffUL);
-  ASSERT_TRUE(interface.CreateGnuDebugdataMemory() == nullptr);
-
-  interface.FakeSetGnuDebugdataSize(0x4000000000000UL);
-  ASSERT_TRUE(interface.CreateGnuDebugdataMemory() == nullptr);
-
-  // This should exceed the size_t value of the first allocation.
-#if defined(__LP64__)
-  interface.FakeSetGnuDebugdataSize(0x3333333333333334ULL);
-#else
-  interface.FakeSetGnuDebugdataSize(0x33333334);
-#endif
-  ASSERT_TRUE(interface.CreateGnuDebugdataMemory() == nullptr);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfTest.cpp b/libunwindstack/tests/ElfTest.cpp
deleted file mode 100644
index 1f3ed81..0000000
--- a/libunwindstack/tests/ElfTest.cpp
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/RegsArm.h>
-
-#include "ElfFake.h"
-#include "ElfTestUtils.h"
-#include "LogFake.h"
-#include "MemoryFake.h"
-
-#if !defined(PT_ARM_EXIDX)
-#define PT_ARM_EXIDX 0x70000001
-#endif
-
-namespace unwindstack {
-
-class ElfTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_ = new MemoryFake;
-  }
-
-  void InitElf32(uint32_t machine_type) {
-    Elf32_Ehdr ehdr;
-    TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, machine_type);
-
-    ehdr.e_phoff = 0x100;
-    ehdr.e_ehsize = sizeof(ehdr);
-    ehdr.e_phentsize = sizeof(Elf32_Phdr);
-    ehdr.e_phnum = 1;
-    ehdr.e_shentsize = sizeof(Elf32_Shdr);
-    if (machine_type == EM_ARM) {
-      ehdr.e_flags = 0x5000200;
-      ehdr.e_phnum = 2;
-    }
-    memory_->SetMemory(0, &ehdr, sizeof(ehdr));
-
-    Elf32_Phdr phdr;
-    memset(&phdr, 0, sizeof(phdr));
-    phdr.p_type = PT_LOAD;
-    phdr.p_filesz = 0x10000;
-    phdr.p_memsz = 0x10000;
-    phdr.p_flags = PF_R | PF_X;
-    phdr.p_align = 0x1000;
-    memory_->SetMemory(0x100, &phdr, sizeof(phdr));
-
-    if (machine_type == EM_ARM) {
-      memset(&phdr, 0, sizeof(phdr));
-      phdr.p_type = PT_ARM_EXIDX;
-      phdr.p_offset = 0x30000;
-      phdr.p_vaddr = 0x30000;
-      phdr.p_paddr = 0x30000;
-      phdr.p_filesz = 16;
-      phdr.p_memsz = 16;
-      phdr.p_flags = PF_R;
-      phdr.p_align = 0x4;
-      memory_->SetMemory(0x100 + sizeof(phdr), &phdr, sizeof(phdr));
-    }
-  }
-
-  void InitElf64(uint32_t machine_type) {
-    Elf64_Ehdr ehdr;
-    TestInitEhdr<Elf64_Ehdr>(&ehdr, ELFCLASS64, machine_type);
-
-    ehdr.e_phoff = 0x100;
-    ehdr.e_flags = 0x5000200;
-    ehdr.e_ehsize = sizeof(ehdr);
-    ehdr.e_phentsize = sizeof(Elf64_Phdr);
-    ehdr.e_phnum = 1;
-    ehdr.e_shentsize = sizeof(Elf64_Shdr);
-    memory_->SetMemory(0, &ehdr, sizeof(ehdr));
-
-    Elf64_Phdr phdr;
-    memset(&phdr, 0, sizeof(phdr));
-    phdr.p_type = PT_LOAD;
-    phdr.p_filesz = 0x10000;
-    phdr.p_memsz = 0x10000;
-    phdr.p_flags = PF_R | PF_X;
-    phdr.p_align = 0x1000;
-    memory_->SetMemory(0x100, &phdr, sizeof(phdr));
-  }
-
-  void VerifyStepIfSignalHandler(uint64_t load_bias);
-
-  MemoryFake* memory_;
-};
-
-TEST_F(ElfTest, invalid_memory) {
-  Elf elf(memory_);
-
-  ASSERT_FALSE(elf.Init());
-  ASSERT_FALSE(elf.valid());
-}
-
-TEST_F(ElfTest, elf_invalid) {
-  Elf elf(memory_);
-
-  InitElf32(EM_386);
-
-  // Corrupt the ELF signature.
-  memory_->SetData32(0, 0x7f000000);
-
-  ASSERT_FALSE(elf.Init());
-  ASSERT_FALSE(elf.valid());
-  ASSERT_TRUE(elf.interface() == nullptr);
-
-  ASSERT_EQ("", elf.GetSoname());
-
-  std::string name;
-  uint64_t func_offset;
-  ASSERT_FALSE(elf.GetFunctionName(0, &name, &func_offset));
-
-  ASSERT_FALSE(elf.StepIfSignalHandler(0, nullptr, nullptr));
-  EXPECT_EQ(ERROR_INVALID_ELF, elf.GetLastErrorCode());
-
-  bool finished;
-  ASSERT_FALSE(elf.Step(0, nullptr, nullptr, &finished));
-  EXPECT_EQ(ERROR_INVALID_ELF, elf.GetLastErrorCode());
-}
-
-TEST_F(ElfTest, elf32_invalid_machine) {
-  Elf elf(memory_);
-
-  InitElf32(EM_PPC);
-
-  ResetLogs();
-  ASSERT_FALSE(elf.Init());
-
-  ASSERT_EQ("", GetFakeLogBuf());
-  ASSERT_EQ("4 unwind 32 bit elf that is neither arm nor x86 nor mips: e_machine = 20\n\n",
-            GetFakeLogPrint());
-}
-
-TEST_F(ElfTest, elf64_invalid_machine) {
-  Elf elf(memory_);
-
-  InitElf64(EM_PPC64);
-
-  ResetLogs();
-  ASSERT_FALSE(elf.Init());
-
-  ASSERT_EQ("", GetFakeLogBuf());
-  ASSERT_EQ("4 unwind 64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = 21\n\n",
-            GetFakeLogPrint());
-}
-
-TEST_F(ElfTest, elf_arm) {
-  Elf elf(memory_);
-
-  InitElf32(EM_ARM);
-
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.valid());
-  ASSERT_EQ(static_cast<uint32_t>(EM_ARM), elf.machine_type());
-  ASSERT_EQ(ELFCLASS32, elf.class_type());
-  ASSERT_TRUE(elf.interface() != nullptr);
-}
-
-TEST_F(ElfTest, elf_mips) {
-  Elf elf(memory_);
-
-  InitElf32(EM_MIPS);
-
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.valid());
-  ASSERT_EQ(static_cast<uint32_t>(EM_MIPS), elf.machine_type());
-  ASSERT_EQ(ELFCLASS32, elf.class_type());
-  ASSERT_TRUE(elf.interface() != nullptr);
-}
-
-TEST_F(ElfTest, elf_x86) {
-  Elf elf(memory_);
-
-  InitElf32(EM_386);
-
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.valid());
-  ASSERT_EQ(static_cast<uint32_t>(EM_386), elf.machine_type());
-  ASSERT_EQ(ELFCLASS32, elf.class_type());
-  ASSERT_TRUE(elf.interface() != nullptr);
-}
-
-TEST_F(ElfTest, elf_arm64) {
-  Elf elf(memory_);
-
-  InitElf64(EM_AARCH64);
-
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.valid());
-  ASSERT_EQ(static_cast<uint32_t>(EM_AARCH64), elf.machine_type());
-  ASSERT_EQ(ELFCLASS64, elf.class_type());
-  ASSERT_TRUE(elf.interface() != nullptr);
-}
-
-TEST_F(ElfTest, elf_x86_64) {
-  Elf elf(memory_);
-
-  InitElf64(EM_X86_64);
-
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.valid());
-  ASSERT_EQ(static_cast<uint32_t>(EM_X86_64), elf.machine_type());
-  ASSERT_EQ(ELFCLASS64, elf.class_type());
-  ASSERT_TRUE(elf.interface() != nullptr);
-}
-
-TEST_F(ElfTest, elf_mips64) {
-  Elf elf(memory_);
-
-  InitElf64(EM_MIPS);
-
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.valid());
-  ASSERT_EQ(static_cast<uint32_t>(EM_MIPS), elf.machine_type());
-  ASSERT_EQ(ELFCLASS64, elf.class_type());
-  ASSERT_TRUE(elf.interface() != nullptr);
-}
-
-TEST_F(ElfTest, gnu_debugdata_init32) {
-  TestInitGnuDebugdata<Elf32_Ehdr, Elf32_Shdr>(ELFCLASS32, EM_ARM, true,
-                                               [&](uint64_t offset, const void* ptr, size_t size) {
-                                                 memory_->SetMemory(offset, ptr, size);
-                                               });
-
-  Elf elf(memory_);
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.interface() != nullptr);
-  ASSERT_TRUE(elf.gnu_debugdata_interface() != nullptr);
-  EXPECT_EQ(0x1acU, elf.interface()->gnu_debugdata_offset());
-  EXPECT_EQ(0x8cU, elf.interface()->gnu_debugdata_size());
-}
-
-TEST_F(ElfTest, gnu_debugdata_init64) {
-  TestInitGnuDebugdata<Elf64_Ehdr, Elf64_Shdr>(ELFCLASS64, EM_AARCH64, true,
-                                               [&](uint64_t offset, const void* ptr, size_t size) {
-                                                 memory_->SetMemory(offset, ptr, size);
-                                               });
-
-  Elf elf(memory_);
-  ASSERT_TRUE(elf.Init());
-  ASSERT_TRUE(elf.interface() != nullptr);
-  ASSERT_TRUE(elf.gnu_debugdata_interface() != nullptr);
-  EXPECT_EQ(0x200U, elf.interface()->gnu_debugdata_offset());
-  EXPECT_EQ(0x90U, elf.interface()->gnu_debugdata_size());
-}
-
-TEST_F(ElfTest, rel_pc) {
-  ElfFake elf(memory_);
-
-  ElfInterfaceFake* interface = new ElfInterfaceFake(memory_);
-  elf.FakeSetInterface(interface);
-
-  elf.FakeSetValid(true);
-  MapInfo map_info(nullptr, nullptr, 0x1000, 0x2000, 0, 0, "");
-
-  ASSERT_EQ(0x101U, elf.GetRelPc(0x1101, &map_info));
-
-  elf.FakeSetValid(false);
-  ASSERT_EQ(0x101U, elf.GetRelPc(0x1101, &map_info));
-}
-
-void ElfTest::VerifyStepIfSignalHandler(uint64_t load_bias) {
-  ElfFake elf(memory_);
-
-  RegsArm regs;
-  regs[13] = 0x50000;
-  regs[15] = 0x8000;
-
-  ElfInterfaceFake* interface = new ElfInterfaceFake(memory_);
-  elf.FakeSetInterface(interface);
-  elf.FakeSetLoadBias(load_bias);
-
-  memory_->SetData32(0x3000, 0xdf0027ad);
-  MemoryFake process_memory;
-  process_memory.SetData32(0x50000, 0);
-  for (size_t i = 0; i < 16; i++) {
-    process_memory.SetData32(0x500a0 + i * sizeof(uint32_t), i);
-  }
-
-  elf.FakeSetValid(true);
-  ASSERT_TRUE(elf.StepIfSignalHandler(0x3000 + load_bias, &regs, &process_memory));
-  EXPECT_EQ(ERROR_NONE, elf.GetLastErrorCode());
-  EXPECT_EQ(15U, regs.pc());
-  EXPECT_EQ(13U, regs.sp());
-}
-
-TEST_F(ElfTest, step_in_signal_map) {
-  VerifyStepIfSignalHandler(0);
-}
-
-TEST_F(ElfTest, step_in_signal_map_non_zero_load_bias) {
-  VerifyStepIfSignalHandler(0x1000);
-}
-
-class ElfInterfaceMock : public ElfInterface {
- public:
-  ElfInterfaceMock(Memory* memory) : ElfInterface(memory) {}
-  virtual ~ElfInterfaceMock() = default;
-
-  bool Init(int64_t*) override { return false; }
-  void InitHeaders() override {}
-  std::string GetSoname() override { return ""; }
-  bool GetFunctionName(uint64_t, std::string*, uint64_t*) override { return false; }
-  std::string GetBuildID() override { return ""; }
-
-  MOCK_METHOD(bool, Step, (uint64_t, Regs*, Memory*, bool*), (override));
-  MOCK_METHOD(bool, GetGlobalVariable, (const std::string&, uint64_t*), (override));
-  MOCK_METHOD(bool, IsValidPc, (uint64_t), (override));
-
-  void MockSetDataOffset(uint64_t offset) { data_offset_ = offset; }
-  void MockSetDataVaddrStart(uint64_t vaddr) { data_vaddr_start_ = vaddr; }
-  void MockSetDataVaddrEnd(uint64_t vaddr) { data_vaddr_end_ = vaddr; }
-
-  void MockSetDynamicOffset(uint64_t offset) { dynamic_offset_ = offset; }
-  void MockSetDynamicVaddrStart(uint64_t vaddr) { dynamic_vaddr_start_ = vaddr; }
-  void MockSetDynamicVaddrEnd(uint64_t vaddr) { dynamic_vaddr_end_ = vaddr; }
-};
-
-TEST_F(ElfTest, step_in_interface) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  RegsArm regs;
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-  MemoryFake process_memory;
-
-  bool finished;
-  EXPECT_CALL(*interface, Step(0x1000, &regs, &process_memory, &finished))
-      .WillOnce(::testing::Return(true));
-
-  ASSERT_TRUE(elf.Step(0x1000, &regs, &process_memory, &finished));
-}
-
-TEST_F(ElfTest, get_global_invalid_elf) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(false);
-
-  std::string global("something");
-  uint64_t offset;
-  ASSERT_FALSE(elf.GetGlobalVariableOffset(global, &offset));
-}
-
-TEST_F(ElfTest, get_global_valid_not_in_interface) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-
-  std::string global("something");
-  EXPECT_CALL(*interface, GetGlobalVariable(global, ::testing::_))
-      .WillOnce(::testing::Return(false));
-
-  uint64_t offset;
-  ASSERT_FALSE(elf.GetGlobalVariableOffset(global, &offset));
-}
-
-TEST_F(ElfTest, get_global_vaddr_in_no_sections) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-
-  std::string global("something");
-  EXPECT_CALL(*interface, GetGlobalVariable(global, ::testing::_))
-      .WillOnce(::testing::DoAll(::testing::SetArgPointee<1>(0x300), ::testing::Return(true)));
-
-  uint64_t offset;
-  ASSERT_FALSE(elf.GetGlobalVariableOffset(global, &offset));
-}
-
-TEST_F(ElfTest, get_global_vaddr_in_data_section) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-  interface->MockSetDataVaddrStart(0x500);
-  interface->MockSetDataVaddrEnd(0x600);
-  interface->MockSetDataOffset(0xa000);
-
-  std::string global("something");
-  EXPECT_CALL(*interface, GetGlobalVariable(global, ::testing::_))
-      .WillOnce(::testing::DoAll(::testing::SetArgPointee<1>(0x580), ::testing::Return(true)));
-
-  uint64_t offset;
-  ASSERT_TRUE(elf.GetGlobalVariableOffset(global, &offset));
-  EXPECT_EQ(0xa080U, offset);
-}
-
-TEST_F(ElfTest, get_global_vaddr_in_dynamic_section) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-  interface->MockSetDataVaddrStart(0x500);
-  interface->MockSetDataVaddrEnd(0x600);
-  interface->MockSetDataOffset(0xa000);
-
-  interface->MockSetDynamicVaddrStart(0x800);
-  interface->MockSetDynamicVaddrEnd(0x900);
-  interface->MockSetDynamicOffset(0xc000);
-
-  std::string global("something");
-  EXPECT_CALL(*interface, GetGlobalVariable(global, ::testing::_))
-      .WillOnce(::testing::DoAll(::testing::SetArgPointee<1>(0x880), ::testing::Return(true)));
-
-  uint64_t offset;
-  ASSERT_TRUE(elf.GetGlobalVariableOffset(global, &offset));
-  EXPECT_EQ(0xc080U, offset);
-}
-
-TEST_F(ElfTest, is_valid_pc_elf_invalid) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(false);
-
-  EXPECT_FALSE(elf.IsValidPc(0x100));
-  EXPECT_FALSE(elf.IsValidPc(0x200));
-}
-
-TEST_F(ElfTest, is_valid_pc_interface) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-
-  EXPECT_CALL(*interface, IsValidPc(0x1500)).WillOnce(::testing::Return(true));
-
-  EXPECT_TRUE(elf.IsValidPc(0x1500));
-}
-
-TEST_F(ElfTest, is_valid_pc_from_gnu_debugdata) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-
-  ElfInterfaceMock* interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetInterface(interface);
-  ElfInterfaceMock* gnu_interface = new ElfInterfaceMock(memory_);
-  elf.FakeSetGnuDebugdataInterface(gnu_interface);
-
-  EXPECT_CALL(*interface, IsValidPc(0x1500)).WillOnce(::testing::Return(false));
-  EXPECT_CALL(*gnu_interface, IsValidPc(0x1500)).WillOnce(::testing::Return(true));
-
-  EXPECT_TRUE(elf.IsValidPc(0x1500));
-}
-
-TEST_F(ElfTest, error_code_not_valid) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(false);
-
-  ErrorData error{ERROR_MEMORY_INVALID, 0x100};
-  elf.GetLastError(&error);
-  EXPECT_EQ(ERROR_MEMORY_INVALID, error.code);
-  EXPECT_EQ(0x100U, error.address);
-}
-
-TEST_F(ElfTest, error_code_valid) {
-  ElfFake elf(memory_);
-  elf.FakeSetValid(true);
-  ElfInterfaceFake* interface = new ElfInterfaceFake(memory_);
-  elf.FakeSetInterface(interface);
-  interface->FakeSetErrorCode(ERROR_MEMORY_INVALID);
-  interface->FakeSetErrorAddress(0x1000);
-
-  ErrorData error{ERROR_NONE, 0};
-  elf.GetLastError(&error);
-  EXPECT_EQ(ERROR_MEMORY_INVALID, error.code);
-  EXPECT_EQ(0x1000U, error.address);
-  EXPECT_EQ(ERROR_MEMORY_INVALID, elf.GetLastErrorCode());
-  EXPECT_EQ(0x1000U, elf.GetLastErrorAddress());
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfTestUtils.cpp b/libunwindstack/tests/ElfTestUtils.cpp
deleted file mode 100644
index 69163ac..0000000
--- a/libunwindstack/tests/ElfTestUtils.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "ElfTestUtils.h"
-
-namespace unwindstack {
-
-template <typename Ehdr>
-void TestInitEhdr(Ehdr* ehdr, uint32_t elf_class, uint32_t machine_type) {
-  memset(ehdr, 0, sizeof(Ehdr));
-  memcpy(&ehdr->e_ident[0], ELFMAG, SELFMAG);
-  ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
-  ehdr->e_ident[EI_VERSION] = EV_CURRENT;
-  ehdr->e_ident[EI_OSABI] = ELFOSABI_SYSV;
-  ehdr->e_ident[EI_CLASS] = elf_class;
-  ehdr->e_type = ET_DYN;
-  ehdr->e_machine = machine_type;
-  ehdr->e_version = EV_CURRENT;
-  ehdr->e_ehsize = sizeof(Ehdr);
-}
-
-std::string TestGetFileDirectory() {
-  std::string exec(testing::internal::GetArgvs()[0]);
-  auto const value = exec.find_last_of('/');
-  if (value == std::string::npos) {
-    return "tests/files/";
-  }
-  return exec.substr(0, value + 1) + "tests/files/";
-}
-
-template <typename Ehdr, typename Shdr>
-void TestInitGnuDebugdata(uint32_t elf_class, uint32_t machine, bool init_gnu_debugdata,
-                          TestCopyFuncType copy_func) {
-  Ehdr ehdr;
-
-  TestInitEhdr(&ehdr, elf_class, machine);
-
-  uint64_t offset = sizeof(Ehdr);
-  ehdr.e_shoff = offset;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Shdr);
-  ehdr.e_shstrndx = 2;
-  copy_func(0, &ehdr, sizeof(ehdr));
-
-  Shdr shdr;
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_NULL;
-  copy_func(offset, &shdr, sizeof(shdr));
-  offset += ehdr.e_shentsize;
-
-  // Skip this header, it will contain the gnu_debugdata information.
-  uint64_t gnu_offset = offset;
-  offset += ehdr.e_shentsize;
-
-  uint64_t symtab_offset = sizeof(ehdr) + ehdr.e_shnum * ehdr.e_shentsize;
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_name = 1;
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_offset = symtab_offset;
-  shdr.sh_size = 0x100;
-  copy_func(offset, &shdr, sizeof(shdr));
-
-  char value = '\0';
-  uint64_t symname_offset = symtab_offset;
-  copy_func(symname_offset, &value, 1);
-  symname_offset++;
-  std::string name(".shstrtab");
-  copy_func(symname_offset, name.c_str(), name.size() + 1);
-  symname_offset += name.size() + 1;
-  name = ".gnu_debugdata";
-  copy_func(symname_offset, name.c_str(), name.size() + 1);
-
-  ssize_t bytes = 0x100;
-  offset = symtab_offset + 0x100;
-  if (init_gnu_debugdata) {
-    // Read in the compressed elf data and copy it in.
-    name = TestGetFileDirectory();
-    if (elf_class == ELFCLASS32) {
-      name += "elf32.xz";
-    } else {
-      name += "elf64.xz";
-    }
-    int fd = TEMP_FAILURE_RETRY(open(name.c_str(), O_RDONLY));
-    ASSERT_NE(-1, fd) << "Cannot open " + name;
-    // Assumes the file is less than 1024 bytes.
-    std::vector<uint8_t> buf(1024);
-    bytes = TEMP_FAILURE_RETRY(read(fd, buf.data(), buf.size()));
-    ASSERT_GT(bytes, 0);
-    // Make sure the file isn't too big.
-    ASSERT_NE(static_cast<size_t>(bytes), buf.size())
-        << "File " + name + " is too big, increase buffer size.";
-    close(fd);
-    buf.resize(bytes);
-    copy_func(offset, buf.data(), buf.size());
-  }
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_name = symname_offset - symtab_offset;
-  shdr.sh_addr = offset;
-  shdr.sh_offset = offset;
-  shdr.sh_size = bytes;
-  copy_func(gnu_offset, &shdr, sizeof(shdr));
-}
-
-template void TestInitEhdr<Elf32_Ehdr>(Elf32_Ehdr*, uint32_t, uint32_t);
-template void TestInitEhdr<Elf64_Ehdr>(Elf64_Ehdr*, uint32_t, uint32_t);
-
-template void TestInitGnuDebugdata<Elf32_Ehdr, Elf32_Shdr>(uint32_t, uint32_t, bool,
-                                                           TestCopyFuncType);
-template void TestInitGnuDebugdata<Elf64_Ehdr, Elf64_Shdr>(uint32_t, uint32_t, bool,
-                                                           TestCopyFuncType);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/ElfTestUtils.h b/libunwindstack/tests/ElfTestUtils.h
deleted file mode 100644
index 62cd59a..0000000
--- a/libunwindstack/tests/ElfTestUtils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_TESTS_ELF_TEST_UTILS_H
-#define _LIBUNWINDSTACK_TESTS_ELF_TEST_UTILS_H
-
-#include <functional>
-#include <string>
-
-namespace unwindstack {
-
-typedef std::function<void(uint64_t, const void*, size_t)> TestCopyFuncType;
-
-template <typename Ehdr>
-void TestInitEhdr(Ehdr* ehdr, uint32_t elf_class, uint32_t machine_type);
-
-template <typename Ehdr, typename Shdr>
-void TestInitGnuDebugdata(uint32_t elf_class, uint32_t machine_type, bool init_gnu_debudata,
-                          TestCopyFuncType copy_func);
-
-std::string TestGetFileDirectory();
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_TESTS_ELF_TEST_UTILS_H
diff --git a/libunwindstack/tests/GenGnuDebugdata.cpp b/libunwindstack/tests/GenGnuDebugdata.cpp
deleted file mode 100644
index 2644582..0000000
--- a/libunwindstack/tests/GenGnuDebugdata.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#if !defined(EM_AARCH64)
-#define EM_AARCH64 183
-#endif
-
-template <typename Ehdr>
-void InitEhdr(Ehdr* ehdr, uint32_t elf_class, uint32_t machine) {
-  memset(ehdr, 0, sizeof(Ehdr));
-  memcpy(&ehdr->e_ident[0], ELFMAG, SELFMAG);
-  ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
-  ehdr->e_ident[EI_VERSION] = EV_CURRENT;
-  ehdr->e_ident[EI_OSABI] = ELFOSABI_SYSV;
-  ehdr->e_ident[EI_CLASS] = elf_class;
-  ehdr->e_type = ET_DYN;
-  ehdr->e_machine = machine;
-  ehdr->e_version = EV_CURRENT;
-  ehdr->e_ehsize = sizeof(Ehdr);
-}
-
-template <typename Ehdr, typename Shdr>
-void GenElf(Ehdr* ehdr, int fd) {
-  uint64_t offset = sizeof(Ehdr);
-  ehdr->e_shoff = offset;
-  ehdr->e_shnum = 3;
-  ehdr->e_shentsize = sizeof(Shdr);
-  ehdr->e_shstrndx = 2;
-  TEMP_FAILURE_RETRY(write(fd, ehdr, sizeof(Ehdr)));
-
-  Shdr shdr;
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_name = 0;
-  shdr.sh_type = SHT_NULL;
-  TEMP_FAILURE_RETRY(write(fd, &shdr, sizeof(Shdr)));
-  offset += ehdr->e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_PROGBITS;
-  shdr.sh_name = 11;
-  shdr.sh_addr = 0x5000;
-  shdr.sh_offset = 0x5000;
-  shdr.sh_entsize = 0x100;
-  shdr.sh_size = 0x800;
-  TEMP_FAILURE_RETRY(write(fd, &shdr, sizeof(Shdr)));
-  offset += ehdr->e_shentsize;
-
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 1;
-  shdr.sh_offset = 0x200;
-  shdr.sh_size = 24;
-  TEMP_FAILURE_RETRY(write(fd, &shdr, sizeof(Shdr)));
-
-  // Write out the name entries information.
-  lseek(fd, 0x200, SEEK_SET);
-  std::string name;
-  TEMP_FAILURE_RETRY(write(fd, name.data(), name.size() + 1));
-  name = ".shstrtab";
-  TEMP_FAILURE_RETRY(write(fd, name.data(), name.size() + 1));
-  name = ".debug_frame";
-  TEMP_FAILURE_RETRY(write(fd, name.data(), name.size() + 1));
-}
-
-int main() {
-  int elf32_fd = TEMP_FAILURE_RETRY(open("elf32", O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644));
-  if (elf32_fd == -1) {
-    printf("Failed to create elf32: %s\n", strerror(errno));
-    return 1;
-  }
-
-  int elf64_fd = TEMP_FAILURE_RETRY(open("elf64", O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0644));
-  if (elf64_fd == -1) {
-    printf("Failed to create elf64: %s\n", strerror(errno));
-    return 1;
-  }
-
-  Elf32_Ehdr ehdr32;
-  InitEhdr<Elf32_Ehdr>(&ehdr32, ELFCLASS32, EM_ARM);
-  GenElf<Elf32_Ehdr, Elf32_Shdr>(&ehdr32, elf32_fd);
-  close(elf32_fd);
-
-  Elf64_Ehdr ehdr64;
-  InitEhdr<Elf64_Ehdr>(&ehdr64, ELFCLASS64, EM_AARCH64);
-  GenElf<Elf64_Ehdr, Elf64_Shdr>(&ehdr64, elf64_fd);
-  close(elf64_fd);
-}
diff --git a/libunwindstack/tests/IsolatedSettings.cpp b/libunwindstack/tests/IsolatedSettings.cpp
deleted file mode 100644
index dbd8bd6..0000000
--- a/libunwindstack/tests/IsolatedSettings.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-
-extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
-  static const char* initial_args[2] = {"--slow_threshold_ms=90000",
-                                        "--deadline_threshold_ms=120000"};
-  *args = initial_args;
-  *num_args = 2;
-  return true;
-}
diff --git a/libunwindstack/tests/JitDebugTest.cpp b/libunwindstack/tests/JitDebugTest.cpp
deleted file mode 100644
index 9b32a3a..0000000
--- a/libunwindstack/tests/JitDebugTest.cpp
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <elf.h>
-#include <string.h>
-
-#include <memory>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#include "ElfFake.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class JitDebugTest : public ::testing::Test {
- protected:
-  void CreateFakeElf(MapInfo* map_info, uint64_t global_offset, uint64_t data_offset,
-                     uint64_t data_vaddr, uint64_t data_size) {
-    MemoryFake* memory = new MemoryFake;
-    ElfFake* elf = new ElfFake(memory);
-    elf->FakeSetValid(true);
-    ElfInterfaceFake* interface = new ElfInterfaceFake(memory);
-    elf->FakeSetInterface(interface);
-    interface->FakeSetGlobalVariable("__jit_debug_descriptor", global_offset);
-    interface->FakeSetDataOffset(data_offset);
-    interface->FakeSetDataVaddrStart(data_vaddr);
-    interface->FakeSetDataVaddrEnd(data_vaddr + data_size);
-    map_info->elf.reset(elf);
-  }
-
-  void Init(ArchEnum arch) {
-    jit_debug_.reset(new JitDebug(process_memory_));
-    jit_debug_->SetArch(arch);
-
-    maps_.reset(
-        new BufferMaps("1000-4000 ---s 00000000 00:00 0 /fake/elf1\n"
-                       "4000-6000 r--s 00000000 00:00 0 /fake/elf1\n"
-                       "6000-8000 -wxs 00002000 00:00 0 /fake/elf1\n"
-                       "a000-c000 --xp 00000000 00:00 0 /fake/elf2\n"
-                       "c000-f000 rw-p 00002000 00:00 0 /fake/elf2\n"
-                       "f000-11000 r--p 00000000 00:00 0 /fake/elf3\n"
-                       "11000-12000 rw-p 00002000 00:00 0 /fake/elf3\n"
-                       "12000-14000 r--p 00000000 00:00 0 /fake/elf4\n"
-                       "100000-110000 rw-p 00ee000 00:00 0 /fake/elf4\n"
-                       "200000-210000 rw-p 01ee000 00:00 0 /fake/elf4\n"));
-    ASSERT_TRUE(maps_->Parse());
-
-    MapInfo* map_info = maps_->Get(3);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0x2800, 0x2000, 0x2000, 0x3000);
-
-    map_info = maps_->Get(5);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0x2800, 0x2000, 0x2000, 0x3000);
-
-    map_info = maps_->Get(7);
-    ASSERT_TRUE(map_info != nullptr);
-    CreateFakeElf(map_info, 0xee800, 0xee000, 0xee000, 0x10000);
-  }
-
-  void SetUp() override {
-    memory_ = new MemoryFake;
-    process_memory_.reset(memory_);
-
-    Init(ARCH_ARM);
-  }
-
-  template <typename EhdrType, typename ShdrType>
-  void CreateElf(uint64_t offset, uint8_t class_type, uint8_t machine_type, uint32_t pc,
-                 uint32_t size) {
-    EhdrType ehdr;
-    memset(&ehdr, 0, sizeof(ehdr));
-    uint64_t sh_offset = sizeof(ehdr);
-    memcpy(ehdr.e_ident, ELFMAG, SELFMAG);
-    ehdr.e_ident[EI_CLASS] = class_type;
-    ehdr.e_machine = machine_type;
-    ehdr.e_shstrndx = 1;
-    ehdr.e_shoff = sh_offset;
-    ehdr.e_shentsize = sizeof(ShdrType);
-    ehdr.e_shnum = 3;
-    memory_->SetMemory(offset, &ehdr, sizeof(ehdr));
-
-    ShdrType shdr;
-    memset(&shdr, 0, sizeof(shdr));
-    shdr.sh_type = SHT_NULL;
-    memory_->SetMemory(offset + sh_offset, &shdr, sizeof(shdr));
-
-    sh_offset += sizeof(shdr);
-    memset(&shdr, 0, sizeof(shdr));
-    shdr.sh_type = SHT_STRTAB;
-    shdr.sh_name = 1;
-    shdr.sh_offset = 0x500;
-    shdr.sh_size = 0x100;
-    memory_->SetMemory(offset + sh_offset, &shdr, sizeof(shdr));
-    memory_->SetMemory(offset + 0x500, ".debug_frame");
-
-    sh_offset += sizeof(shdr);
-    memset(&shdr, 0, sizeof(shdr));
-    shdr.sh_type = SHT_PROGBITS;
-    shdr.sh_name = 0;
-    shdr.sh_addr = 0x600;
-    shdr.sh_offset = 0x600;
-    shdr.sh_size = 0x200;
-    memory_->SetMemory(offset + sh_offset, &shdr, sizeof(shdr));
-
-    // Now add a single cie/fde.
-    uint64_t dwarf_offset = offset + 0x600;
-    if (class_type == ELFCLASS32) {
-      // CIE 32 information.
-      memory_->SetData32(dwarf_offset, 0xfc);
-      memory_->SetData32(dwarf_offset + 0x4, 0xffffffff);
-      memory_->SetData8(dwarf_offset + 0x8, 1);
-      memory_->SetData8(dwarf_offset + 0x9, '\0');
-      memory_->SetData8(dwarf_offset + 0xa, 0x4);
-      memory_->SetData8(dwarf_offset + 0xb, 0x4);
-      memory_->SetData8(dwarf_offset + 0xc, 0x1);
-
-      // FDE 32 information.
-      memory_->SetData32(dwarf_offset + 0x100, 0xfc);
-      memory_->SetData32(dwarf_offset + 0x104, 0);
-      memory_->SetData32(dwarf_offset + 0x108, pc);
-      memory_->SetData32(dwarf_offset + 0x10c, size);
-    } else {
-      // CIE 64 information.
-      memory_->SetData32(dwarf_offset, 0xffffffff);
-      memory_->SetData64(dwarf_offset + 4, 0xf4);
-      memory_->SetData64(dwarf_offset + 0xc, 0xffffffffffffffffULL);
-      memory_->SetData8(dwarf_offset + 0x14, 1);
-      memory_->SetData8(dwarf_offset + 0x15, '\0');
-      memory_->SetData8(dwarf_offset + 0x16, 0x4);
-      memory_->SetData8(dwarf_offset + 0x17, 0x4);
-      memory_->SetData8(dwarf_offset + 0x18, 0x1);
-
-      // FDE 64 information.
-      memory_->SetData32(dwarf_offset + 0x100, 0xffffffff);
-      memory_->SetData64(dwarf_offset + 0x104, 0xf4);
-      memory_->SetData64(dwarf_offset + 0x10c, 0);
-      memory_->SetData64(dwarf_offset + 0x114, pc);
-      memory_->SetData64(dwarf_offset + 0x11c, size);
-    }
-  }
-
-  void WriteDescriptor32(uint64_t addr, uint32_t entry);
-  void WriteDescriptor64(uint64_t addr, uint64_t entry);
-  void WriteEntry32Pack(uint64_t addr, uint32_t prev, uint32_t next, uint32_t elf_addr,
-                        uint64_t elf_size);
-  void WriteEntry32Pad(uint64_t addr, uint32_t prev, uint32_t next, uint32_t elf_addr,
-                       uint64_t elf_size);
-  void WriteEntry64(uint64_t addr, uint64_t prev, uint64_t next, uint64_t elf_addr,
-                    uint64_t elf_size);
-
-  std::shared_ptr<Memory> process_memory_;
-  MemoryFake* memory_;
-  std::unique_ptr<JitDebug> jit_debug_;
-  std::unique_ptr<BufferMaps> maps_;
-};
-
-void JitDebugTest::WriteDescriptor32(uint64_t addr, uint32_t entry) {
-  // Format of the 32 bit JITDescriptor structure:
-  //   uint32_t version
-  memory_->SetData32(addr, 1);
-  //   uint32_t action_flag
-  memory_->SetData32(addr + 4, 0);
-  //   uint32_t relevant_entry
-  memory_->SetData32(addr + 8, 0);
-  //   uint32_t first_entry
-  memory_->SetData32(addr + 12, entry);
-}
-
-void JitDebugTest::WriteDescriptor64(uint64_t addr, uint64_t entry) {
-  // Format of the 64 bit JITDescriptor structure:
-  //   uint32_t version
-  memory_->SetData32(addr, 1);
-  //   uint32_t action_flag
-  memory_->SetData32(addr + 4, 0);
-  //   uint64_t relevant_entry
-  memory_->SetData64(addr + 8, 0);
-  //   uint64_t first_entry
-  memory_->SetData64(addr + 16, entry);
-}
-
-void JitDebugTest::WriteEntry32Pack(uint64_t addr, uint32_t prev, uint32_t next, uint32_t elf_addr,
-                                    uint64_t elf_size) {
-  // Format of the 32 bit JITCodeEntry structure:
-  //   uint32_t next
-  memory_->SetData32(addr, next);
-  //   uint32_t prev
-  memory_->SetData32(addr + 4, prev);
-  //   uint32_t symfile_addr
-  memory_->SetData32(addr + 8, elf_addr);
-  //   uint64_t symfile_size
-  memory_->SetData64(addr + 12, elf_size);
-}
-
-void JitDebugTest::WriteEntry32Pad(uint64_t addr, uint32_t prev, uint32_t next, uint32_t elf_addr,
-                                   uint64_t elf_size) {
-  // Format of the 32 bit JITCodeEntry structure:
-  //   uint32_t next
-  memory_->SetData32(addr, next);
-  //   uint32_t prev
-  memory_->SetData32(addr + 4, prev);
-  //   uint32_t symfile_addr
-  memory_->SetData32(addr + 8, elf_addr);
-  //   uint32_t pad
-  memory_->SetData32(addr + 12, 0);
-  //   uint64_t symfile_size
-  memory_->SetData64(addr + 16, elf_size);
-}
-
-void JitDebugTest::WriteEntry64(uint64_t addr, uint64_t prev, uint64_t next, uint64_t elf_addr,
-                                uint64_t elf_size) {
-  // Format of the 64 bit JITCodeEntry structure:
-  //   uint64_t next
-  memory_->SetData64(addr, next);
-  //   uint64_t prev
-  memory_->SetData64(addr + 8, prev);
-  //   uint64_t symfile_addr
-  memory_->SetData64(addr + 16, elf_addr);
-  //   uint64_t symfile_size
-  memory_->SetData64(addr + 24, elf_size);
-}
-
-TEST_F(JitDebugTest, get_elf_invalid) {
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf == nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_no_global_variable) {
-  maps_.reset(new BufferMaps(""));
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf == nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_no_valid_descriptor_in_memory) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf == nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_no_valid_code_entry) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  WriteDescriptor32(0x11800, 0x200000);
-
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf == nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_invalid_descriptor_first_entry) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  WriteDescriptor32(0x11800, 0);
-
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf == nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_invalid_descriptor_version) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  WriteDescriptor32(0x11800, 0x20000);
-  // Set the version to an invalid value.
-  memory_->SetData32(0x11800, 2);
-
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf == nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_32) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  WriteDescriptor32(0x11800, 0x200000);
-  WriteEntry32Pad(0x200000, 0, 0, 0x4000, 0x1000);
-
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf != nullptr);
-
-  // Clear the memory and verify all of the data is cached.
-  memory_->Clear();
-  Elf* elf2 = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf2 != nullptr);
-  EXPECT_EQ(elf, elf2);
-}
-
-TEST_F(JitDebugTest, get_multiple_jit_debug_descriptors_valid) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x5000, ELFCLASS32, EM_ARM, 0x2000, 0x300);
-
-  WriteDescriptor32(0x11800, 0x200000);
-  WriteEntry32Pad(0x200000, 0, 0, 0x4000, 0x1000);
-  WriteDescriptor32(0x100800, 0x201000);
-  WriteEntry32Pad(0x201000, 0, 0, 0x5000, 0x1000);
-
-  ASSERT_TRUE(jit_debug_->GetElf(maps_.get(), 0x1500) != nullptr);
-  ASSERT_TRUE(jit_debug_->GetElf(maps_.get(), 0x2000) == nullptr);
-
-  // Now clear the descriptor entry for the first one.
-  WriteDescriptor32(0x11800, 0);
-  jit_debug_.reset(new JitDebug(process_memory_));
-  jit_debug_->SetArch(ARCH_ARM);
-
-  ASSERT_TRUE(jit_debug_->GetElf(maps_.get(), 0x1500) == nullptr);
-  ASSERT_TRUE(jit_debug_->GetElf(maps_.get(), 0x2000) != nullptr);
-}
-
-TEST_F(JitDebugTest, get_elf_x86) {
-  Init(ARCH_X86);
-
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  WriteDescriptor32(0x11800, 0x200000);
-  WriteEntry32Pack(0x200000, 0, 0, 0x4000, 0x1000);
-
-  jit_debug_->SetArch(ARCH_X86);
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf != nullptr);
-
-  // Clear the memory and verify all of the data is cached.
-  memory_->Clear();
-  Elf* elf2 = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf2 != nullptr);
-  EXPECT_EQ(elf, elf2);
-}
-
-TEST_F(JitDebugTest, get_elf_64) {
-  Init(ARCH_ARM64);
-
-  CreateElf<Elf64_Ehdr, Elf64_Shdr>(0x4000, ELFCLASS64, EM_AARCH64, 0x1500, 0x200);
-
-  WriteDescriptor64(0x11800, 0x200000);
-  WriteEntry64(0x200000, 0, 0, 0x4000, 0x1000);
-
-  Elf* elf = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf != nullptr);
-
-  // Clear the memory and verify all of the data is cached.
-  memory_->Clear();
-  Elf* elf2 = jit_debug_->GetElf(maps_.get(), 0x1500);
-  ASSERT_TRUE(elf2 != nullptr);
-  EXPECT_EQ(elf, elf2);
-}
-
-TEST_F(JitDebugTest, get_elf_multiple_entries) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x5000, ELFCLASS32, EM_ARM, 0x2300, 0x400);
-
-  WriteDescriptor32(0x11800, 0x200000);
-  WriteEntry32Pad(0x200000, 0, 0x200100, 0x4000, 0x1000);
-  WriteEntry32Pad(0x200100, 0x200100, 0, 0x5000, 0x1000);
-
-  Elf* elf_2 = jit_debug_->GetElf(maps_.get(), 0x2400);
-  ASSERT_TRUE(elf_2 != nullptr);
-
-  Elf* elf_1 = jit_debug_->GetElf(maps_.get(), 0x1600);
-  ASSERT_TRUE(elf_1 != nullptr);
-
-  // Clear the memory and verify all of the data is cached.
-  memory_->Clear();
-  EXPECT_EQ(elf_1, jit_debug_->GetElf(maps_.get(), 0x1500));
-  EXPECT_EQ(elf_1, jit_debug_->GetElf(maps_.get(), 0x16ff));
-  EXPECT_EQ(elf_2, jit_debug_->GetElf(maps_.get(), 0x2300));
-  EXPECT_EQ(elf_2, jit_debug_->GetElf(maps_.get(), 0x26ff));
-  EXPECT_EQ(nullptr, jit_debug_->GetElf(maps_.get(), 0x1700));
-  EXPECT_EQ(nullptr, jit_debug_->GetElf(maps_.get(), 0x2700));
-}
-
-TEST_F(JitDebugTest, get_elf_search_libs) {
-  CreateElf<Elf32_Ehdr, Elf32_Shdr>(0x4000, ELFCLASS32, EM_ARM, 0x1500, 0x200);
-
-  WriteDescriptor32(0x11800, 0x200000);
-  WriteEntry32Pad(0x200000, 0, 0, 0x4000, 0x1000);
-
-  // Only search a given named list of libs.
-  std::vector<std::string> libs{"libart.so"};
-  jit_debug_.reset(new JitDebug(process_memory_, libs));
-  jit_debug_->SetArch(ARCH_ARM);
-  EXPECT_TRUE(jit_debug_->GetElf(maps_.get(), 0x1500) == nullptr);
-
-  // Change the name of the map that includes the value and verify this works.
-  MapInfo* map_info = maps_->Get(5);
-  map_info->name = "/system/lib/libart.so";
-  map_info = maps_->Get(6);
-  map_info->name = "/system/lib/libart.so";
-  jit_debug_.reset(new JitDebug(process_memory_, libs));
-  // Make sure that clearing our copy of the libs doesn't affect the
-  // JitDebug object.
-  libs.clear();
-  jit_debug_->SetArch(ARCH_ARM);
-  EXPECT_TRUE(jit_debug_->GetElf(maps_.get(), 0x1500) != nullptr);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/LocalUnwinderTest.cpp b/libunwindstack/tests/LocalUnwinderTest.cpp
deleted file mode 100644
index 9936f7a..0000000
--- a/libunwindstack/tests/LocalUnwinderTest.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <dlfcn.h>
-#include <inttypes.h>
-#include <signal.h>
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <android-base/stringprintf.h>
-
-#include <unwindstack/LocalUnwinder.h>
-
-namespace unwindstack {
-
-static std::vector<LocalFrameData>* g_frame_info;
-static LocalUnwinder* g_unwinder;
-
-extern "C" void SignalLocalInnerFunction() {
-  g_unwinder->Unwind(g_frame_info, 256);
-}
-
-extern "C" void SignalLocalMiddleFunction() {
-  SignalLocalInnerFunction();
-}
-
-extern "C" void SignalLocalOuterFunction() {
-  SignalLocalMiddleFunction();
-}
-
-static void SignalLocalCallerHandler(int, siginfo_t*, void*) {
-  SignalLocalOuterFunction();
-}
-
-static std::string ErrorMsg(const std::vector<const char*>& function_names,
-                            const std::vector<LocalFrameData>& frame_info) {
-  std::string unwind;
-  size_t i = 0;
-  for (const auto& frame : frame_info) {
-    unwind += android::base::StringPrintf("#%02zu pc 0x%" PRIx64 " rel_pc 0x%" PRIx64, i++,
-                                          frame.pc, frame.rel_pc);
-    if (frame.map_info != nullptr) {
-      if (!frame.map_info->name.empty()) {
-        unwind += " " + frame.map_info->name;
-      } else {
-        unwind += android::base::StringPrintf(" 0x%" PRIx64 "-0x%" PRIx64, frame.map_info->start,
-                                              frame.map_info->end);
-      }
-      if (frame.map_info->offset != 0) {
-        unwind += android::base::StringPrintf(" offset 0x%" PRIx64, frame.map_info->offset);
-      }
-    }
-    if (!frame.function_name.empty()) {
-      unwind += " " + frame.function_name;
-      if (frame.function_offset != 0) {
-        unwind += android::base::StringPrintf("+%" PRId64, frame.function_offset);
-      }
-    }
-    unwind += '\n';
-  }
-
-  return std::string(
-             "Unwind completed without finding all frames\n"
-             "  Looking for function: ") +
-         function_names.front() + "\n" + "Unwind data:\n" + unwind;
-}
-
-// This test assumes that this code is compiled with optimizations turned
-// off. If this doesn't happen, then all of the calls will be optimized
-// away.
-extern "C" void LocalInnerFunction(LocalUnwinder* unwinder, bool unwind_through_signal) {
-  std::vector<LocalFrameData> frame_info;
-  g_frame_info = &frame_info;
-  g_unwinder = unwinder;
-  std::vector<const char*> expected_function_names;
-
-  if (unwind_through_signal) {
-    struct sigaction act, oldact;
-    memset(&act, 0, sizeof(act));
-    act.sa_sigaction = SignalLocalCallerHandler;
-    act.sa_flags = SA_RESTART | SA_ONSTACK;
-    ASSERT_EQ(0, sigaction(SIGUSR1, &act, &oldact));
-
-    raise(SIGUSR1);
-
-    ASSERT_EQ(0, sigaction(SIGUSR1, &oldact, nullptr));
-
-    expected_function_names = {"LocalOuterFunction",        "LocalMiddleFunction",
-                               "LocalInnerFunction",        "SignalLocalOuterFunction",
-                               "SignalLocalMiddleFunction", "SignalLocalInnerFunction"};
-  } else {
-    ASSERT_TRUE(unwinder->Unwind(&frame_info, 256));
-
-    expected_function_names = {"LocalOuterFunction", "LocalMiddleFunction", "LocalInnerFunction"};
-  }
-
-  for (auto& frame : frame_info) {
-    if (frame.function_name == expected_function_names.back()) {
-      expected_function_names.pop_back();
-      if (expected_function_names.empty()) {
-        break;
-      }
-    }
-  }
-
-  ASSERT_TRUE(expected_function_names.empty()) << ErrorMsg(expected_function_names, frame_info);
-}
-
-extern "C" void LocalMiddleFunction(LocalUnwinder* unwinder, bool unwind_through_signal) {
-  LocalInnerFunction(unwinder, unwind_through_signal);
-}
-
-extern "C" void LocalOuterFunction(LocalUnwinder* unwinder, bool unwind_through_signal) {
-  LocalMiddleFunction(unwinder, unwind_through_signal);
-}
-
-class LocalUnwinderTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    unwinder_.reset(new LocalUnwinder);
-    ASSERT_TRUE(unwinder_->Init());
-  }
-
-  std::unique_ptr<LocalUnwinder> unwinder_;
-};
-
-TEST_F(LocalUnwinderTest, local) {
-  LocalOuterFunction(unwinder_.get(), false);
-}
-
-TEST_F(LocalUnwinderTest, local_signal) {
-  LocalOuterFunction(unwinder_.get(), true);
-}
-
-TEST_F(LocalUnwinderTest, local_multiple) {
-  ASSERT_NO_FATAL_FAILURE(LocalOuterFunction(unwinder_.get(), false));
-
-  ASSERT_NO_FATAL_FAILURE(LocalOuterFunction(unwinder_.get(), true));
-
-  ASSERT_NO_FATAL_FAILURE(LocalOuterFunction(unwinder_.get(), false));
-
-  ASSERT_NO_FATAL_FAILURE(LocalOuterFunction(unwinder_.get(), true));
-}
-
-// This test verifies that doing an unwind before and after a dlopen
-// works. It's verifying that the maps read during the first unwind
-// do not cause a problem when doing the unwind using the code in
-// the dlopen'd code.
-TEST_F(LocalUnwinderTest, unwind_after_dlopen) {
-  // Prime the maps data.
-  ASSERT_NO_FATAL_FAILURE(LocalOuterFunction(unwinder_.get(), false));
-
-  std::string testlib(testing::internal::GetArgvs()[0]);
-  auto const value = testlib.find_last_of('/');
-  if (value != std::string::npos) {
-    testlib = testlib.substr(0, value + 1);
-  } else {
-    testlib = "";
-  }
-  testlib += "libunwindstack_local.so";
-
-  void* handle = dlopen(testlib.c_str(), RTLD_NOW);
-  ASSERT_TRUE(handle != nullptr);
-
-  void (*unwind_function)(void*, void*) =
-      reinterpret_cast<void (*)(void*, void*)>(dlsym(handle, "TestlibLevel1"));
-  ASSERT_TRUE(unwind_function != nullptr);
-
-  std::vector<LocalFrameData> frame_info;
-  unwind_function(unwinder_.get(), &frame_info);
-
-  ASSERT_EQ(0, dlclose(handle));
-
-  std::vector<const char*> expected_function_names{"TestlibLevel1", "TestlibLevel2",
-                                                   "TestlibLevel3", "TestlibLevel4"};
-
-  for (auto& frame : frame_info) {
-    if (frame.function_name == expected_function_names.back()) {
-      expected_function_names.pop_back();
-      if (expected_function_names.empty()) {
-        break;
-      }
-    }
-  }
-
-  ASSERT_TRUE(expected_function_names.empty()) << ErrorMsg(expected_function_names, frame_info);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/LocalUpdatableMapsTest.cpp b/libunwindstack/tests/LocalUpdatableMapsTest.cpp
deleted file mode 100644
index 99afb0b..0000000
--- a/libunwindstack/tests/LocalUpdatableMapsTest.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <stdint.h>
-#include <sys/mman.h>
-
-#include <string>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <android-base/file.h>
-#include <unwindstack/Maps.h>
-
-namespace unwindstack {
-
-class TestUpdatableMaps : public LocalUpdatableMaps {
- public:
-  TestUpdatableMaps() : LocalUpdatableMaps() {}
-  virtual ~TestUpdatableMaps() = default;
-
-  const std::string GetMapsFile() const override { return maps_file_; }
-
-  void TestSetMapsFile(const std::string& maps_file) { maps_file_ = maps_file; }
-
-  const std::vector<std::unique_ptr<MapInfo>>& TestGetSavedMaps() { return saved_maps_; }
-
- private:
-  std::string maps_file_;
-};
-
-class LocalUpdatableMapsTest : public ::testing::Test {
- protected:
-  static const std::string GetDefaultMapString() {
-    return "3000-4000 r-xp 00000 00:00 0\n8000-9000 r-xp 00000 00:00 0\n";
-  }
-
-  void SetUp() override {
-    TemporaryFile tf;
-    ASSERT_TRUE(android::base::WriteStringToFile(GetDefaultMapString(), tf.path));
-
-    maps_.TestSetMapsFile(tf.path);
-    ASSERT_TRUE(maps_.Parse());
-    ASSERT_EQ(2U, maps_.Total());
-
-    MapInfo* map_info = maps_.Get(0);
-    ASSERT_TRUE(map_info != nullptr);
-    EXPECT_EQ(0x3000U, map_info->start);
-    EXPECT_EQ(0x4000U, map_info->end);
-    EXPECT_EQ(0U, map_info->offset);
-    EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-    EXPECT_TRUE(map_info->name.empty());
-
-    map_info = maps_.Get(1);
-    ASSERT_TRUE(map_info != nullptr);
-    EXPECT_EQ(0x8000U, map_info->start);
-    EXPECT_EQ(0x9000U, map_info->end);
-    EXPECT_EQ(0U, map_info->offset);
-    EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-    EXPECT_TRUE(map_info->name.empty());
-  }
-
-  TestUpdatableMaps maps_;
-};
-
-TEST_F(LocalUpdatableMapsTest, same_map) {
-  TemporaryFile tf;
-  ASSERT_TRUE(android::base::WriteStringToFile(GetDefaultMapString(), tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(2U, maps_.Total());
-  EXPECT_EQ(0U, maps_.TestGetSavedMaps().size());
-
-  MapInfo* map_info = maps_.Get(0);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = maps_.Get(1);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x8000U, map_info->start);
-  EXPECT_EQ(0x9000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-}
-
-TEST_F(LocalUpdatableMapsTest, same_map_new_perms) {
-  TemporaryFile tf;
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("3000-4000 rwxp 00000 00:00 0\n"
-                                       "8000-9000 r-xp 00000 00:00 0\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(2U, maps_.Total());
-
-  MapInfo* map_info = maps_.Get(0);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = maps_.Get(1);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x8000U, map_info->start);
-  EXPECT_EQ(0x9000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  auto& saved_maps = maps_.TestGetSavedMaps();
-  ASSERT_EQ(1U, saved_maps.size());
-  map_info = saved_maps[0].get();
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-}
-
-TEST_F(LocalUpdatableMapsTest, same_map_new_name) {
-  TemporaryFile tf;
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("3000-4000 r-xp 00000 00:00 0 /fake/lib.so\n"
-                                       "8000-9000 r-xp 00000 00:00 0\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(2U, maps_.Total());
-
-  MapInfo* map_info = maps_.Get(0);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_EQ("/fake/lib.so", map_info->name);
-
-  map_info = maps_.Get(1);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x8000U, map_info->start);
-  EXPECT_EQ(0x9000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  auto& saved_maps = maps_.TestGetSavedMaps();
-  ASSERT_EQ(1U, saved_maps.size());
-  map_info = saved_maps[0].get();
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-}
-
-TEST_F(LocalUpdatableMapsTest, only_add_maps) {
-  TemporaryFile tf;
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("1000-2000 r-xp 00000 00:00 0\n"
-                                       "3000-4000 r-xp 00000 00:00 0\n"
-                                       "8000-9000 r-xp 00000 00:00 0\n"
-                                       "a000-f000 r-xp 00000 00:00 0\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(4U, maps_.Total());
-  EXPECT_EQ(0U, maps_.TestGetSavedMaps().size());
-
-  MapInfo* map_info = maps_.Get(0);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x1000U, map_info->start);
-  EXPECT_EQ(0x2000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = maps_.Get(1);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = maps_.Get(2);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x8000U, map_info->start);
-  EXPECT_EQ(0x9000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = maps_.Get(3);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0xa000U, map_info->start);
-  EXPECT_EQ(0xf000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-}
-
-TEST_F(LocalUpdatableMapsTest, all_new_maps) {
-  TemporaryFile tf;
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("1000-2000 r-xp 00000 00:00 0\n"
-                                       "a000-f000 r-xp 00000 00:00 0\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(2U, maps_.Total());
-
-  MapInfo* map_info = maps_.Get(0);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x1000U, map_info->start);
-  EXPECT_EQ(0x2000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = maps_.Get(1);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0xa000U, map_info->start);
-  EXPECT_EQ(0xf000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  auto& saved_maps = maps_.TestGetSavedMaps();
-  ASSERT_EQ(2U, saved_maps.size());
-  map_info = saved_maps[0].get();
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x3000U, map_info->start);
-  EXPECT_EQ(0x4000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-
-  map_info = saved_maps[1].get();
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x8000U, map_info->start);
-  EXPECT_EQ(0x9000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-}
-
-TEST_F(LocalUpdatableMapsTest, add_map_prev_name_updated) {
-  TemporaryFile tf;
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("3000-4000 rwxp 00000 00:00 0\n"
-                                       "8000-9000 r-xp 00000 00:00 0\n"
-                                       "9000-a000 r-xp 00000 00:00 0\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(3U, maps_.Total());
-
-  MapInfo* map_info = maps_.Get(2);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x9000U, map_info->start);
-  EXPECT_EQ(0xA000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_TRUE(map_info->name.empty());
-  EXPECT_EQ(maps_.Get(1), map_info->prev_map);
-}
-
-TEST_F(LocalUpdatableMapsTest, add_map_prev_real_name_updated) {
-  TemporaryFile tf;
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("3000-4000 r-xp 00000 00:00 0 /fake/lib.so\n"
-                                       "4000-5000 ---p 00000 00:00 0\n"
-                                       "7000-8000 r-xp 00000 00:00 0 /fake/lib1.so\n"
-                                       "8000-9000 ---p 00000 00:00 0\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(4U, maps_.Total());
-
-  MapInfo* map_info = maps_.Get(2);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x7000U, map_info->start);
-  EXPECT_EQ(0x8000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_EQ(maps_.Get(0), map_info->prev_real_map);
-  EXPECT_EQ(maps_.Get(1), map_info->prev_map);
-  EXPECT_EQ("/fake/lib1.so", map_info->name);
-
-  map_info = maps_.Get(3);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x8000U, map_info->start);
-  EXPECT_EQ(0x9000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_TRUE(map_info->IsBlank());
-  EXPECT_EQ(maps_.Get(2), map_info->prev_real_map);
-  EXPECT_EQ(maps_.Get(2), map_info->prev_map);
-  EXPECT_TRUE(map_info->name.empty());
-
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("3000-4000 r-xp 00000 00:00 0 /fake/lib.so\n"
-                                       "4000-5000 ---p 00000 00:00 0\n"
-                                       "7000-8000 r-xp 00000 00:00 0 /fake/lib1.so\n"
-                                       "8000-9000 ---p 00000 00:00 0\n"
-                                       "9000-a000 r-xp 00000 00:00 0 /fake/lib2.so\n"
-                                       "a000-b000 r-xp 00000 00:00 0 /fake/lib3.so\n",
-                                       tf.path));
-
-  maps_.TestSetMapsFile(tf.path);
-  ASSERT_TRUE(maps_.Reparse());
-  ASSERT_EQ(6U, maps_.Total());
-
-  map_info = maps_.Get(2);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x7000U, map_info->start);
-  EXPECT_EQ(0x8000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_EQ("/fake/lib1.so", map_info->name);
-  EXPECT_EQ(maps_.Get(1), map_info->prev_map);
-  EXPECT_EQ(maps_.Get(0), map_info->prev_real_map);
-
-  map_info = maps_.Get(4);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0x9000U, map_info->start);
-  EXPECT_EQ(0xA000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_EQ("/fake/lib2.so", map_info->name);
-  EXPECT_EQ(maps_.Get(3), map_info->prev_map);
-  EXPECT_EQ(maps_.Get(2), map_info->prev_real_map);
-
-  map_info = maps_.Get(5);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_EQ(0xA000U, map_info->start);
-  EXPECT_EQ(0xB000U, map_info->end);
-  EXPECT_EQ(0U, map_info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, map_info->flags);
-  EXPECT_EQ("/fake/lib3.so", map_info->name);
-  EXPECT_EQ(maps_.Get(4), map_info->prev_map);
-  EXPECT_EQ(maps_.Get(4), map_info->prev_real_map);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/LogFake.cpp b/libunwindstack/tests/LogFake.cpp
deleted file mode 100644
index 537ccaf..0000000
--- a/libunwindstack/tests/LogFake.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <errno.h>
-#include <stdarg.h>
-
-#include <string>
-
-#include <android-base/stringprintf.h>
-#include <log/log.h>
-
-#include "LogFake.h"
-
-// Forward declarations.
-struct EventTagMap;
-struct AndroidLogEntry;
-
-std::string g_fake_log_buf;
-
-std::string g_fake_log_print;
-
-namespace unwindstack {
-
-void ResetLogs() {
-  g_fake_log_buf = "";
-  g_fake_log_print = "";
-}
-
-std::string GetFakeLogBuf() {
-  return g_fake_log_buf;
-}
-
-std::string GetFakeLogPrint() {
-  return g_fake_log_print;
-}
-
-}  // namespace unwindstack
-
-extern "C" int __android_log_buf_write(int bufId, int prio, const char* tag, const char* msg) {
-  g_fake_log_buf += std::to_string(bufId) + ' ' + std::to_string(prio) + ' ';
-  g_fake_log_buf += tag;
-  g_fake_log_buf += ' ';
-  g_fake_log_buf += msg;
-  return 1;
-}
-
-extern "C" int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
-  va_list ap;
-  va_start(ap, fmt);
-  int val = __android_log_vprint(prio, tag, fmt, ap);
-  va_end(ap);
-
-  return val;
-}
-
-extern "C" int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) {
-  g_fake_log_print += std::to_string(prio) + ' ';
-  g_fake_log_print += tag;
-  g_fake_log_print += ' ';
-
-  android::base::StringAppendV(&g_fake_log_print, fmt, ap);
-
-  g_fake_log_print += '\n';
-
-  return 1;
-}
-
-extern "C" log_id_t android_name_to_log_id(const char*) {
-  return LOG_ID_SYSTEM;
-}
-
-extern "C" struct logger_list* android_logger_list_open(log_id_t, int, unsigned int, pid_t) {
-  errno = EACCES;
-  return nullptr;
-}
-
-extern "C" int android_logger_list_read(struct logger_list*, struct log_msg*) {
-  return 0;
-}
-
-extern "C" EventTagMap* android_openEventTagMap(const char*) {
-  return nullptr;
-}
-
-extern "C" int android_log_processBinaryLogBuffer(
-    struct logger_entry*,
-    AndroidLogEntry*, const EventTagMap*, char*, int) {
-  return 0;
-}
-
-extern "C" void android_logger_list_free(struct logger_list*) {
-}
diff --git a/libunwindstack/tests/LogFake.h b/libunwindstack/tests/LogFake.h
deleted file mode 100644
index e1dc50d..0000000
--- a/libunwindstack/tests/LogFake.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef _LIBUNWINDSTACK_TESTS_LOG_FAKE_H
-#define _LIBUNWINDSTACK_TESTS_LOG_FAKE_H
-
-#include <string>
-
-namespace unwindstack {
-
-void ResetLogs();
-std::string GetFakeLogBuf();
-std::string GetFakeLogPrint();
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_TESTS_LOG_FAKE_H
diff --git a/libunwindstack/tests/MapInfoCreateMemoryTest.cpp b/libunwindstack/tests/MapInfoCreateMemoryTest.cpp
deleted file mode 100644
index 6d8d58e..0000000
--- a/libunwindstack/tests/MapInfoCreateMemoryTest.cpp
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#include "ElfTestUtils.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class MapInfoCreateMemoryTest : public ::testing::Test {
- protected:
-  template <typename Ehdr, typename Shdr>
-  static void InitElf(int fd, uint64_t file_offset, uint64_t sh_offset, uint8_t class_type) {
-    std::vector<uint8_t> buffer(20000);
-    memset(buffer.data(), 0, buffer.size());
-
-    Ehdr ehdr;
-    memset(&ehdr, 0, sizeof(ehdr));
-    memcpy(ehdr.e_ident, ELFMAG, SELFMAG);
-    ehdr.e_ident[EI_CLASS] = class_type;
-    ehdr.e_shoff = sh_offset;
-    ehdr.e_shentsize = sizeof(Shdr) + 100;
-    ehdr.e_shnum = 4;
-    memcpy(&buffer[file_offset], &ehdr, sizeof(ehdr));
-
-    ASSERT_TRUE(android::base::WriteFully(fd, buffer.data(), buffer.size()));
-  }
-
-  void SetUp() override {
-    std::vector<uint8_t> buffer(12288, 0);
-    memcpy(buffer.data(), ELFMAG, SELFMAG);
-    buffer[EI_CLASS] = ELFCLASS32;
-    ASSERT_TRUE(android::base::WriteFully(elf_.fd, buffer.data(), 1024));
-
-    memset(buffer.data(), 0, buffer.size());
-    memcpy(&buffer[0x1000], ELFMAG, SELFMAG);
-    buffer[0x1000 + EI_CLASS] = ELFCLASS64;
-    buffer[0x2000] = 0xff;
-    ASSERT_TRUE(android::base::WriteFully(elf_at_1000_.fd, buffer.data(), buffer.size()));
-
-    InitElf<Elf32_Ehdr, Elf32_Shdr>(elf32_at_map_.fd, 0x1000, 0x2000, ELFCLASS32);
-    InitElf<Elf64_Ehdr, Elf64_Shdr>(elf64_at_map_.fd, 0x2000, 0x3000, ELFCLASS64);
-
-    memory_ = new MemoryFake;
-    process_memory_.reset(memory_);
-  }
-
-  MemoryFake* memory_;
-  std::shared_ptr<Memory> process_memory_;
-
-  TemporaryFile elf_;
-
-  TemporaryFile elf_at_1000_;
-
-  TemporaryFile elf32_at_map_;
-  TemporaryFile elf64_at_map_;
-};
-
-TEST_F(MapInfoCreateMemoryTest, end_le_start) {
-  MapInfo info(nullptr, nullptr, 0x100, 0x100, 0, 0, elf_.path);
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() == nullptr);
-
-  info.end = 0xff;
-  memory.reset(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() == nullptr);
-
-  // Make sure this test is valid.
-  info.end = 0x101;
-  memory.reset(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-}
-
-// Verify that if the offset is non-zero but there is no elf at the offset,
-// that the full file is used.
-TEST_F(MapInfoCreateMemoryTest, file_backed_non_zero_offset_full_file) {
-  MapInfo info(nullptr, nullptr, 0x100, 0x200, 0x100, 0, elf_.path);
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0x100U, info.elf_offset);
-  EXPECT_EQ(0x100U, info.elf_start_offset);
-
-  // Read the entire file.
-  std::vector<uint8_t> buffer(1024);
-  ASSERT_TRUE(memory->ReadFully(0, buffer.data(), 1024));
-  ASSERT_TRUE(memcmp(buffer.data(), ELFMAG, SELFMAG) == 0);
-  ASSERT_EQ(ELFCLASS32, buffer[EI_CLASS]);
-  for (size_t i = EI_CLASS + 1; i < buffer.size(); i++) {
-    ASSERT_EQ(0, buffer[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_FALSE(memory->ReadFully(1024, buffer.data(), 1));
-
-  // Now verify the elf start offset is set correctly based on the previous
-  // info.
-  MapInfo prev_info(nullptr, nullptr, 0, 0x100, 0x10, 0, "");
-  info.prev_map = &prev_info;
-  info.prev_real_map = &prev_info;
-
-  // No preconditions met, change each one until it should set the elf start
-  // offset to zero.
-  info.elf_offset = 0;
-  info.elf_start_offset = 0;
-  info.memory_backed_elf = false;
-  memory.reset(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0x100U, info.elf_offset);
-  EXPECT_EQ(0x100U, info.elf_start_offset);
-
-  prev_info.offset = 0;
-  info.elf_offset = 0;
-  info.elf_start_offset = 0;
-  info.memory_backed_elf = false;
-  memory.reset(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0x100U, info.elf_offset);
-  EXPECT_EQ(0x100U, info.elf_start_offset);
-
-  prev_info.flags = PROT_READ;
-  info.elf_offset = 0;
-  info.elf_start_offset = 0;
-  info.memory_backed_elf = false;
-  memory.reset(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0x100U, info.elf_offset);
-  EXPECT_EQ(0x100U, info.elf_start_offset);
-
-  prev_info.name = info.name;
-  info.elf_offset = 0;
-  info.elf_start_offset = 0;
-  info.memory_backed_elf = false;
-  memory.reset(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0x100U, info.elf_offset);
-  EXPECT_EQ(0U, info.elf_start_offset);
-}
-
-// Verify that if the offset is non-zero and there is an elf at that
-// offset, that only part of the file is used.
-TEST_F(MapInfoCreateMemoryTest, file_backed_non_zero_offset_partial_file) {
-  MapInfo info(nullptr, nullptr, 0x100, 0x200, 0x1000, 0, elf_at_1000_.path);
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0U, info.elf_offset);
-  EXPECT_EQ(0x1000U, info.elf_start_offset);
-
-  // Read the valid part of the file.
-  std::vector<uint8_t> buffer(0x100);
-  ASSERT_TRUE(memory->ReadFully(0, buffer.data(), 0x100));
-  ASSERT_TRUE(memcmp(buffer.data(), ELFMAG, SELFMAG) == 0);
-  ASSERT_EQ(ELFCLASS64, buffer[EI_CLASS]);
-  for (size_t i = EI_CLASS + 1; i < buffer.size(); i++) {
-    ASSERT_EQ(0, buffer[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_FALSE(memory->ReadFully(0x100, buffer.data(), 1));
-}
-
-// Verify that if the offset is non-zero and there is an elf at that
-// offset, that only part of the file is used. Further verify that if the
-// embedded elf is bigger than the initial map, the new object is larger
-// than the original map size. Do this for a 32 bit elf and a 64 bit elf.
-TEST_F(MapInfoCreateMemoryTest, file_backed_non_zero_offset_partial_file_whole_elf32) {
-  MapInfo info(nullptr, nullptr, 0x5000, 0x6000, 0x1000, 0, elf32_at_map_.path);
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0U, info.elf_offset);
-  EXPECT_EQ(0x1000U, info.elf_start_offset);
-
-  // Verify the memory is a valid elf.
-  uint8_t e_ident[SELFMAG + 1];
-  ASSERT_TRUE(memory->ReadFully(0, e_ident, SELFMAG));
-  ASSERT_EQ(0, memcmp(e_ident, ELFMAG, SELFMAG));
-
-  // Read past the end of what would normally be the size of the map.
-  ASSERT_TRUE(memory->ReadFully(0x1000, e_ident, 1));
-}
-
-TEST_F(MapInfoCreateMemoryTest, file_backed_non_zero_offset_partial_file_whole_elf64) {
-  MapInfo info(nullptr, nullptr, 0x7000, 0x8000, 0x2000, 0, elf64_at_map_.path);
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(info.memory_backed_elf);
-  ASSERT_EQ(0U, info.elf_offset);
-  EXPECT_EQ(0x2000U, info.elf_start_offset);
-
-  // Verify the memory is a valid elf.
-  uint8_t e_ident[SELFMAG + 1];
-  ASSERT_TRUE(memory->ReadFully(0, e_ident, SELFMAG));
-  ASSERT_EQ(0, memcmp(e_ident, ELFMAG, SELFMAG));
-
-  // Read past the end of what would normally be the size of the map.
-  ASSERT_TRUE(memory->ReadFully(0x1000, e_ident, 1));
-}
-
-// Verify that device file names will never result in Memory object creation.
-TEST_F(MapInfoCreateMemoryTest, check_device_maps) {
-  // Set up some memory so that a valid local memory object would
-  // be returned if the file mapping fails, but the device check is incorrect.
-  std::vector<uint8_t> buffer(1024);
-  uint64_t start = reinterpret_cast<uint64_t>(buffer.data());
-  MapInfo info(nullptr, nullptr, start, start + buffer.size(), 0, 0x8000, "/dev/something");
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() == nullptr);
-}
-
-TEST_F(MapInfoCreateMemoryTest, process_memory) {
-  MapInfo info(nullptr, nullptr, 0x2000, 0x3000, 0, PROT_READ, "");
-
-  Elf32_Ehdr ehdr = {};
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  std::vector<uint8_t> buffer(1024);
-  memcpy(buffer.data(), &ehdr, sizeof(ehdr));
-
-  // Verify that the the process_memory object is used, so seed it
-  // with memory.
-  for (size_t i = sizeof(ehdr); i < buffer.size(); i++) {
-    buffer[i] = i % 256;
-  }
-  memory_->SetMemory(info.start, buffer.data(), buffer.size());
-
-  std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_TRUE(info.memory_backed_elf);
-
-  memset(buffer.data(), 0, buffer.size());
-  ASSERT_TRUE(memory->ReadFully(0, buffer.data(), buffer.size()));
-  ASSERT_EQ(0, memcmp(&ehdr, buffer.data(), sizeof(ehdr)));
-  for (size_t i = sizeof(ehdr); i < buffer.size(); i++) {
-    ASSERT_EQ(i % 256, buffer[i]) << "Failed at byte " << i;
-  }
-
-  // Try to read outside of the map size.
-  ASSERT_FALSE(memory->ReadFully(buffer.size(), buffer.data(), 1));
-}
-
-TEST_F(MapInfoCreateMemoryTest, valid_rosegment_zero_offset) {
-  Maps maps;
-  maps.Add(0x500, 0x600, 0, PROT_READ, "something_else", 0);
-  maps.Add(0x1000, 0x2600, 0, PROT_READ, "/only/in/memory.so", 0);
-  maps.Add(0x3000, 0x5000, 0x4000, PROT_READ | PROT_EXEC, "/only/in/memory.so", 0);
-
-  Elf32_Ehdr ehdr = {};
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memory_->SetMemory(0x1000, &ehdr, sizeof(ehdr));
-  memory_->SetMemoryBlock(0x1000 + sizeof(ehdr), 0x1600 - sizeof(ehdr), 0xab);
-
-  // Set the memory in the r-x map.
-  memory_->SetMemoryBlock(0x3000, 0x2000, 0x5d);
-
-  MapInfo* map_info = maps.Find(0x3000);
-  ASSERT_TRUE(map_info != nullptr);
-
-  std::unique_ptr<Memory> mem(map_info->CreateMemory(process_memory_));
-  ASSERT_TRUE(mem.get() != nullptr);
-  EXPECT_TRUE(map_info->memory_backed_elf);
-  EXPECT_EQ(0x4000UL, map_info->elf_offset);
-  EXPECT_EQ(0x4000UL, map_info->offset);
-  EXPECT_EQ(0U, map_info->elf_start_offset);
-
-  // Verify that reading values from this memory works properly.
-  std::vector<uint8_t> buffer(0x4000);
-  size_t bytes = mem->Read(0, buffer.data(), buffer.size());
-  ASSERT_EQ(0x1600UL, bytes);
-  ASSERT_EQ(0, memcmp(&ehdr, buffer.data(), sizeof(ehdr)));
-  for (size_t i = sizeof(ehdr); i < bytes; i++) {
-    ASSERT_EQ(0xab, buffer[i]) << "Failed at byte " << i;
-  }
-
-  bytes = mem->Read(0x4000, buffer.data(), buffer.size());
-  ASSERT_EQ(0x2000UL, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x5d, buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MapInfoCreateMemoryTest, valid_rosegment_non_zero_offset) {
-  Maps maps;
-  maps.Add(0x500, 0x600, 0, PROT_READ, "something_else", 0);
-  maps.Add(0x1000, 0x2000, 0, PROT_READ, "/only/in/memory.apk", 0);
-  maps.Add(0x2000, 0x3000, 0x1000, PROT_READ | PROT_EXEC, "/only/in/memory.apk", 0);
-  maps.Add(0x3000, 0x4000, 0xa000, PROT_READ, "/only/in/memory.apk", 0);
-  maps.Add(0x4000, 0x5000, 0xb000, PROT_READ | PROT_EXEC, "/only/in/memory.apk", 0);
-
-  Elf32_Ehdr ehdr = {};
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-
-  // Setup an elf at offset 0x1000 in memory.
-  memory_->SetMemory(0x1000, &ehdr, sizeof(ehdr));
-  memory_->SetMemoryBlock(0x1000 + sizeof(ehdr), 0x2000 - sizeof(ehdr), 0x12);
-  memory_->SetMemoryBlock(0x2000, 0x1000, 0x23);
-
-  // Setup an elf at offset 0x3000 in memory..
-  memory_->SetMemory(0x3000, &ehdr, sizeof(ehdr));
-  memory_->SetMemoryBlock(0x3000 + sizeof(ehdr), 0x4000 - sizeof(ehdr), 0x34);
-  memory_->SetMemoryBlock(0x4000, 0x1000, 0x43);
-
-  MapInfo* map_info = maps.Find(0x4000);
-  ASSERT_TRUE(map_info != nullptr);
-
-  std::unique_ptr<Memory> mem(map_info->CreateMemory(process_memory_));
-  ASSERT_TRUE(mem.get() != nullptr);
-  EXPECT_TRUE(map_info->memory_backed_elf);
-  EXPECT_EQ(0x1000UL, map_info->elf_offset);
-  EXPECT_EQ(0xb000UL, map_info->offset);
-  EXPECT_EQ(0xa000UL, map_info->elf_start_offset);
-
-  // Verify that reading values from this memory works properly.
-  std::vector<uint8_t> buffer(0x4000);
-  size_t bytes = mem->Read(0, buffer.data(), buffer.size());
-  ASSERT_EQ(0x1000UL, bytes);
-  ASSERT_EQ(0, memcmp(&ehdr, buffer.data(), sizeof(ehdr)));
-  for (size_t i = sizeof(ehdr); i < bytes; i++) {
-    ASSERT_EQ(0x34, buffer[i]) << "Failed at byte " << i;
-  }
-
-  bytes = mem->Read(0x1000, buffer.data(), buffer.size());
-  ASSERT_EQ(0x1000UL, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x43, buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MapInfoCreateMemoryTest, rosegment_from_file) {
-  Maps maps;
-  maps.Add(0x500, 0x600, 0, PROT_READ, "something_else", 0);
-  maps.Add(0x1000, 0x2000, 0x1000, PROT_READ, elf_at_1000_.path, 0);
-  maps.Add(0x2000, 0x3000, 0x2000, PROT_READ | PROT_EXEC, elf_at_1000_.path, 0);
-
-  MapInfo* map_info = maps.Find(0x2000);
-  ASSERT_TRUE(map_info != nullptr);
-
-  // Set up the size
-  Elf64_Ehdr ehdr;
-  ASSERT_EQ(0x1000, lseek(elf_at_1000_.fd, 0x1000, SEEK_SET));
-  ASSERT_TRUE(android::base::ReadFully(elf_at_1000_.fd, &ehdr, sizeof(ehdr)));
-
-  // Will not give the elf memory, because the read-only entry does not
-  // extend over the executable segment.
-  std::unique_ptr<Memory> memory(map_info->CreateMemory(process_memory_));
-  ASSERT_TRUE(memory.get() != nullptr);
-  EXPECT_FALSE(map_info->memory_backed_elf);
-  std::vector<uint8_t> buffer(0x100);
-  EXPECT_EQ(0x2000U, map_info->offset);
-  EXPECT_EQ(0U, map_info->elf_offset);
-  EXPECT_EQ(0U, map_info->elf_start_offset);
-  ASSERT_TRUE(memory->ReadFully(0, buffer.data(), 0x100));
-  EXPECT_EQ(0xffU, buffer[0]);
-
-  // Now init the elf data enough so that the file memory object will be used.
-  ehdr.e_shoff = 0x4000;
-  ehdr.e_shnum = 1;
-  ehdr.e_shentsize = 0x100;
-  ASSERT_EQ(0x1000, lseek(elf_at_1000_.fd, 0x1000, SEEK_SET));
-  ASSERT_TRUE(android::base::WriteFully(elf_at_1000_.fd, &ehdr, sizeof(ehdr)));
-
-  map_info->memory_backed_elf = false;
-  memory.reset(map_info->CreateMemory(process_memory_));
-  EXPECT_FALSE(map_info->memory_backed_elf);
-  EXPECT_EQ(0x2000U, map_info->offset);
-  EXPECT_EQ(0x1000U, map_info->elf_offset);
-  EXPECT_EQ(0x1000U, map_info->elf_start_offset);
-  Elf64_Ehdr ehdr_mem;
-  ASSERT_TRUE(memory->ReadFully(0, &ehdr_mem, sizeof(ehdr_mem)));
-  EXPECT_TRUE(memcmp(&ehdr, &ehdr_mem, sizeof(ehdr)) == 0);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MapInfoGetBuildIDTest.cpp b/libunwindstack/tests/MapInfoGetBuildIDTest.cpp
deleted file mode 100644
index 6953e26..0000000
--- a/libunwindstack/tests/MapInfoGetBuildIDTest.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <elf.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#include <atomic>
-#include <memory>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include <android-base/test_utils.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#include "ElfFake.h"
-#include "ElfTestUtils.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class MapInfoGetBuildIDTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    tf_.reset(new TemporaryFile);
-
-    memory_ = new MemoryFake;
-    elf_ = new ElfFake(new MemoryFake);
-    elf_interface_ = new ElfInterfaceFake(memory_);
-    elf_->FakeSetInterface(elf_interface_);
-    elf_container_.reset(elf_);
-    map_info_.reset(
-        new MapInfo(nullptr, nullptr, 0x1000, 0x20000, 0, PROT_READ | PROT_WRITE, tf_->path));
-  }
-
-  void MultipleThreadTest(std::string expected_build_id);
-
-  MemoryFake* memory_;
-  ElfFake* elf_;
-  ElfInterfaceFake* elf_interface_;
-  std::unique_ptr<ElfFake> elf_container_;
-  std::unique_ptr<MapInfo> map_info_;
-  std::unique_ptr<TemporaryFile> tf_;
-};
-
-TEST_F(MapInfoGetBuildIDTest, no_elf_and_no_valid_elf_in_memory) {
-  MapInfo info(nullptr, nullptr, 0x1000, 0x2000, 0, PROT_READ, "");
-
-  EXPECT_EQ("", info.GetBuildID());
-  EXPECT_EQ("", info.GetPrintableBuildID());
-}
-
-TEST_F(MapInfoGetBuildIDTest, from_elf) {
-  map_info_->elf.reset(elf_container_.release());
-  elf_interface_->FakeSetBuildID("FAKE_BUILD_ID");
-
-  EXPECT_EQ("FAKE_BUILD_ID", map_info_->GetBuildID());
-  EXPECT_EQ("46414b455f4255494c445f4944", map_info_->GetPrintableBuildID());
-}
-
-TEST_F(MapInfoGetBuildIDTest, from_elf_no_sign_extension) {
-  map_info_->elf.reset(elf_container_.release());
-
-  std::string build_id = {static_cast<char>(0xfa), static_cast<char>(0xab), static_cast<char>(0x12),
-                          static_cast<char>(0x02)};
-  elf_interface_->FakeSetBuildID(build_id);
-
-  EXPECT_EQ("\xFA\xAB\x12\x2", map_info_->GetBuildID());
-  EXPECT_EQ("faab1202", map_info_->GetPrintableBuildID());
-}
-
-void MapInfoGetBuildIDTest::MultipleThreadTest(std::string expected_build_id) {
-  static constexpr size_t kNumConcurrentThreads = 100;
-
-  std::string build_id_values[kNumConcurrentThreads];
-  std::vector<std::thread*> threads;
-
-  std::atomic_bool wait;
-  wait = true;
-  // Create all of the threads and have them do the GetLoadBias at the same time
-  // to make it likely that a race will occur.
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    std::thread* thread = new std::thread([i, this, &wait, &build_id_values]() {
-      while (wait)
-        ;
-      build_id_values[i] = map_info_->GetBuildID();
-    });
-    threads.push_back(thread);
-  }
-
-  // Set them all going and wait for the threads to finish.
-  wait = false;
-  for (auto thread : threads) {
-    thread->join();
-    delete thread;
-  }
-
-  // Now verify that all of the elf files are exactly the same and valid.
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    EXPECT_EQ(expected_build_id, build_id_values[i]) << "Thread " << i << " mismatched.";
-  }
-}
-
-TEST_F(MapInfoGetBuildIDTest, multiple_thread_elf_exists) {
-  map_info_->elf.reset(elf_container_.release());
-  elf_interface_->FakeSetBuildID("FAKE_BUILD_ID");
-
-  MultipleThreadTest("FAKE_BUILD_ID");
-}
-
-static void InitElfData(int fd) {
-  Elf32_Ehdr ehdr;
-  TestInitEhdr(&ehdr, ELFCLASS32, EM_ARM);
-  ehdr.e_shoff = 0x2000;
-  ehdr.e_shnum = 3;
-  ehdr.e_shentsize = sizeof(Elf32_Shdr);
-  ehdr.e_shstrndx = 2;
-  off_t offset = 0;
-  ASSERT_EQ(offset, lseek(fd, offset, SEEK_SET));
-  ASSERT_EQ(static_cast<ssize_t>(sizeof(ehdr)), write(fd, &ehdr, sizeof(ehdr)));
-
-  char note_section[128];
-  Elf32_Nhdr note_header = {};
-  note_header.n_namesz = 4;   // "GNU"
-  note_header.n_descsz = 12;  // "ELF_BUILDID"
-  note_header.n_type = NT_GNU_BUILD_ID;
-  memcpy(&note_section, &note_header, sizeof(note_header));
-  size_t note_offset = sizeof(note_header);
-  memcpy(&note_section[note_offset], "GNU", sizeof("GNU"));
-  note_offset += sizeof("GNU");
-  memcpy(&note_section[note_offset], "ELF_BUILDID", sizeof("ELF_BUILDID"));
-  note_offset += sizeof("ELF_BUILDID");
-
-  Elf32_Shdr shdr = {};
-  shdr.sh_type = SHT_NOTE;
-  shdr.sh_name = 0x500;
-  shdr.sh_offset = 0xb000;
-  shdr.sh_size = sizeof(note_section);
-  offset += ehdr.e_shoff + sizeof(shdr);
-  ASSERT_EQ(offset, lseek(fd, offset, SEEK_SET));
-  ASSERT_EQ(static_cast<ssize_t>(sizeof(shdr)), write(fd, &shdr, sizeof(shdr)));
-
-  // The string data for section header names.
-  memset(&shdr, 0, sizeof(shdr));
-  shdr.sh_type = SHT_STRTAB;
-  shdr.sh_name = 0x20000;
-  shdr.sh_offset = 0xf000;
-  shdr.sh_size = 0x1000;
-  offset += sizeof(shdr);
-  ASSERT_EQ(offset, lseek(fd, offset, SEEK_SET));
-  ASSERT_EQ(static_cast<ssize_t>(sizeof(shdr)), write(fd, &shdr, sizeof(shdr)));
-
-  offset = 0xf500;
-  ASSERT_EQ(offset, lseek(fd, offset, SEEK_SET));
-  ASSERT_EQ(static_cast<ssize_t>(sizeof(".note.gnu.build-id")),
-            write(fd, ".note.gnu.build-id", sizeof(".note.gnu.build-id")));
-
-  offset = 0xb000;
-  ASSERT_EQ(offset, lseek(fd, offset, SEEK_SET));
-  ASSERT_EQ(static_cast<ssize_t>(sizeof(note_section)),
-            write(fd, note_section, sizeof(note_section)));
-}
-
-TEST_F(MapInfoGetBuildIDTest, from_memory) {
-  InitElfData(tf_->fd);
-
-  EXPECT_EQ("ELF_BUILDID", map_info_->GetBuildID());
-  EXPECT_EQ("454c465f4255494c444944", map_info_->GetPrintableBuildID());
-}
-
-TEST_F(MapInfoGetBuildIDTest, multiple_thread_elf_exists_in_memory) {
-  InitElfData(tf_->fd);
-
-  MultipleThreadTest("ELF_BUILDID");
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MapInfoGetElfTest.cpp b/libunwindstack/tests/MapInfoGetElfTest.cpp
deleted file mode 100644
index 7f97814..0000000
--- a/libunwindstack/tests/MapInfoGetElfTest.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <atomic>
-#include <memory>
-#include <thread>
-#include <vector>
-
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#include "ElfTestUtils.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class MapInfoGetElfTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_ = new MemoryFake;
-    process_memory_.reset(memory_);
-  }
-
-  template <typename Ehdr, typename Shdr>
-  static void InitElf(uint64_t sh_offset, Ehdr* ehdr, uint8_t class_type, uint8_t machine_type) {
-    memset(ehdr, 0, sizeof(*ehdr));
-    memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
-    ehdr->e_ident[EI_CLASS] = class_type;
-    ehdr->e_machine = machine_type;
-    ehdr->e_shoff = sh_offset;
-    ehdr->e_shentsize = sizeof(Shdr) + 100;
-    ehdr->e_shnum = 4;
-  }
-
-  const size_t kMapSize = 4096;
-
-  std::shared_ptr<Memory> process_memory_;
-  MemoryFake* memory_;
-
-  TemporaryFile elf_;
-};
-
-TEST_F(MapInfoGetElfTest, invalid) {
-  MapInfo info(nullptr, nullptr, 0x1000, 0x2000, 0, PROT_READ, "");
-
-  // The map is empty, but this should still create an invalid elf object.
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_FALSE(elf->valid());
-}
-
-TEST_F(MapInfoGetElfTest, valid32) {
-  MapInfo info(nullptr, nullptr, 0x3000, 0x4000, 0, PROT_READ, "");
-
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memory_->SetMemory(0x3000, &ehdr, sizeof(ehdr));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  EXPECT_EQ(static_cast<uint32_t>(EM_ARM), elf->machine_type());
-  EXPECT_EQ(ELFCLASS32, elf->class_type());
-
-  // Now verify that an empty process memory returns an invalid elf object.
-  info.elf.reset();
-  elf = info.GetElf(std::shared_ptr<Memory>(), ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_FALSE(elf->valid());
-}
-
-TEST_F(MapInfoGetElfTest, valid64) {
-  MapInfo info(nullptr, nullptr, 0x8000, 0x9000, 0, PROT_READ, "");
-
-  Elf64_Ehdr ehdr;
-  TestInitEhdr<Elf64_Ehdr>(&ehdr, ELFCLASS64, EM_AARCH64);
-  memory_->SetMemory(0x8000, &ehdr, sizeof(ehdr));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM64);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  EXPECT_EQ(static_cast<uint32_t>(EM_AARCH64), elf->machine_type());
-  EXPECT_EQ(ELFCLASS64, elf->class_type());
-}
-
-TEST_F(MapInfoGetElfTest, invalid_arch_mismatch) {
-  MapInfo info(nullptr, nullptr, 0x3000, 0x4000, 0, PROT_READ, "");
-
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memory_->SetMemory(0x3000, &ehdr, sizeof(ehdr));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_X86);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_FALSE(elf->valid());
-}
-
-TEST_F(MapInfoGetElfTest, gnu_debugdata_init32) {
-  MapInfo info(nullptr, nullptr, 0x2000, 0x3000, 0, PROT_READ, "");
-
-  TestInitGnuDebugdata<Elf32_Ehdr, Elf32_Shdr>(ELFCLASS32, EM_ARM, true,
-                                               [&](uint64_t offset, const void* ptr, size_t size) {
-                                                 memory_->SetMemory(0x2000 + offset, ptr, size);
-                                               });
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  EXPECT_EQ(static_cast<uint32_t>(EM_ARM), elf->machine_type());
-  EXPECT_EQ(ELFCLASS32, elf->class_type());
-  EXPECT_TRUE(elf->gnu_debugdata_interface() != nullptr);
-}
-
-TEST_F(MapInfoGetElfTest, gnu_debugdata_init64) {
-  MapInfo info(nullptr, nullptr, 0x5000, 0x8000, 0, PROT_READ, "");
-
-  TestInitGnuDebugdata<Elf64_Ehdr, Elf64_Shdr>(ELFCLASS64, EM_AARCH64, true,
-                                               [&](uint64_t offset, const void* ptr, size_t size) {
-                                                 memory_->SetMemory(0x5000 + offset, ptr, size);
-                                               });
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM64);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  EXPECT_EQ(static_cast<uint32_t>(EM_AARCH64), elf->machine_type());
-  EXPECT_EQ(ELFCLASS64, elf->class_type());
-  EXPECT_TRUE(elf->gnu_debugdata_interface() != nullptr);
-}
-
-TEST_F(MapInfoGetElfTest, end_le_start) {
-  MapInfo info(nullptr, nullptr, 0x1000, 0x1000, 0, PROT_READ, elf_.path);
-
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  ASSERT_TRUE(android::base::WriteFully(elf_.fd, &ehdr, sizeof(ehdr)));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_FALSE(elf->valid());
-
-  info.elf.reset();
-  info.end = 0xfff;
-  elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_FALSE(elf->valid());
-
-  // Make sure this test is valid.
-  info.elf.reset();
-  info.end = 0x2000;
-  elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-}
-
-// Verify that if the offset is non-zero but there is no elf at the offset,
-// that the full file is used.
-TEST_F(MapInfoGetElfTest, file_backed_non_zero_offset_full_file) {
-  MapInfo info(nullptr, nullptr, 0x1000, 0x2000, 0x100, PROT_READ, elf_.path);
-
-  std::vector<uint8_t> buffer(0x1000);
-  memset(buffer.data(), 0, buffer.size());
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memcpy(buffer.data(), &ehdr, sizeof(ehdr));
-  ASSERT_TRUE(android::base::WriteFully(elf_.fd, buffer.data(), buffer.size()));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  ASSERT_TRUE(elf->memory() != nullptr);
-  ASSERT_EQ(0x100U, info.elf_offset);
-
-  // Read the entire file.
-  memset(buffer.data(), 0, buffer.size());
-  ASSERT_TRUE(elf->memory()->ReadFully(0, buffer.data(), buffer.size()));
-  ASSERT_EQ(0, memcmp(buffer.data(), &ehdr, sizeof(ehdr)));
-  for (size_t i = sizeof(ehdr); i < buffer.size(); i++) {
-    ASSERT_EQ(0, buffer[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_FALSE(elf->memory()->ReadFully(buffer.size(), buffer.data(), 1));
-}
-
-// Verify that if the offset is non-zero and there is an elf at that
-// offset, that only part of the file is used.
-TEST_F(MapInfoGetElfTest, file_backed_non_zero_offset_partial_file) {
-  MapInfo info(nullptr, nullptr, 0x1000, 0x2000, 0x2000, PROT_READ, elf_.path);
-
-  std::vector<uint8_t> buffer(0x4000);
-  memset(buffer.data(), 0, buffer.size());
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memcpy(&buffer[info.offset], &ehdr, sizeof(ehdr));
-  ASSERT_TRUE(android::base::WriteFully(elf_.fd, buffer.data(), buffer.size()));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  ASSERT_TRUE(elf->memory() != nullptr);
-  ASSERT_EQ(0U, info.elf_offset);
-
-  // Read the valid part of the file.
-  ASSERT_TRUE(elf->memory()->ReadFully(0, buffer.data(), 0x1000));
-  ASSERT_EQ(0, memcmp(buffer.data(), &ehdr, sizeof(ehdr)));
-  for (size_t i = sizeof(ehdr); i < 0x1000; i++) {
-    ASSERT_EQ(0, buffer[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_FALSE(elf->memory()->ReadFully(0x1000, buffer.data(), 1));
-}
-
-// Verify that if the offset is non-zero and there is an elf at that
-// offset, that only part of the file is used. Further verify that if the
-// embedded elf is bigger than the initial map, the new object is larger
-// than the original map size. Do this for a 32 bit elf and a 64 bit elf.
-TEST_F(MapInfoGetElfTest, file_backed_non_zero_offset_partial_file_whole_elf32) {
-  MapInfo info(nullptr, nullptr, 0x5000, 0x6000, 0x1000, PROT_READ, elf_.path);
-
-  std::vector<uint8_t> buffer(0x4000);
-  memset(buffer.data(), 0, buffer.size());
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  ehdr.e_shoff = 0x2000;
-  ehdr.e_shentsize = sizeof(Elf32_Shdr) + 100;
-  ehdr.e_shnum = 4;
-  memcpy(&buffer[info.offset], &ehdr, sizeof(ehdr));
-  ASSERT_TRUE(android::base::WriteFully(elf_.fd, buffer.data(), buffer.size()));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  ASSERT_TRUE(elf->memory() != nullptr);
-  ASSERT_EQ(0U, info.elf_offset);
-
-  // Verify the memory is a valid elf.
-  memset(buffer.data(), 0, buffer.size());
-  ASSERT_TRUE(elf->memory()->ReadFully(0, buffer.data(), 0x1000));
-  ASSERT_EQ(0, memcmp(buffer.data(), &ehdr, sizeof(ehdr)));
-
-  // Read past the end of what would normally be the size of the map.
-  ASSERT_TRUE(elf->memory()->ReadFully(0x1000, buffer.data(), 1));
-}
-
-TEST_F(MapInfoGetElfTest, file_backed_non_zero_offset_partial_file_whole_elf64) {
-  MapInfo info(nullptr, nullptr, 0x7000, 0x8000, 0x1000, PROT_READ, elf_.path);
-
-  std::vector<uint8_t> buffer(0x4000);
-  memset(buffer.data(), 0, buffer.size());
-  Elf64_Ehdr ehdr;
-  TestInitEhdr<Elf64_Ehdr>(&ehdr, ELFCLASS64, EM_AARCH64);
-  ehdr.e_shoff = 0x2000;
-  ehdr.e_shentsize = sizeof(Elf64_Shdr) + 100;
-  ehdr.e_shnum = 4;
-  memcpy(&buffer[info.offset], &ehdr, sizeof(ehdr));
-  ASSERT_TRUE(android::base::WriteFully(elf_.fd, buffer.data(), buffer.size()));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_ARM64);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-  ASSERT_TRUE(elf->memory() != nullptr);
-  ASSERT_EQ(0U, info.elf_offset);
-
-  // Verify the memory is a valid elf.
-  memset(buffer.data(), 0, buffer.size());
-  ASSERT_TRUE(elf->memory()->ReadFully(0, buffer.data(), 0x1000));
-  ASSERT_EQ(0, memcmp(buffer.data(), &ehdr, sizeof(ehdr)));
-
-  // Read past the end of what would normally be the size of the map.
-  ASSERT_TRUE(elf->memory()->ReadFully(0x1000, buffer.data(), 1));
-}
-
-TEST_F(MapInfoGetElfTest, check_device_maps) {
-  MapInfo info(nullptr, nullptr, 0x7000, 0x8000, 0x1000, PROT_READ | MAPS_FLAGS_DEVICE_MAP,
-               "/dev/something");
-
-  // Create valid elf data in process memory for this to verify that only
-  // the name is causing invalid elf data.
-  Elf64_Ehdr ehdr;
-  TestInitEhdr<Elf64_Ehdr>(&ehdr, ELFCLASS64, EM_X86_64);
-  ehdr.e_shoff = 0x2000;
-  ehdr.e_shentsize = sizeof(Elf64_Shdr) + 100;
-  ehdr.e_shnum = 0;
-  memory_->SetMemory(0x7000, &ehdr, sizeof(ehdr));
-
-  Elf* elf = info.GetElf(process_memory_, ARCH_X86_64);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_FALSE(elf->valid());
-
-  // Set the name to nothing to verify that it still fails.
-  info.elf.reset();
-  info.name = "";
-  elf = info.GetElf(process_memory_, ARCH_X86_64);
-  ASSERT_FALSE(elf->valid());
-
-  // Change the flags and verify the elf is valid now.
-  info.elf.reset();
-  info.flags = PROT_READ;
-  elf = info.GetElf(process_memory_, ARCH_X86_64);
-  ASSERT_TRUE(elf->valid());
-}
-
-TEST_F(MapInfoGetElfTest, multiple_thread_get_elf) {
-  static constexpr size_t kNumConcurrentThreads = 100;
-
-  Elf64_Ehdr ehdr;
-  TestInitEhdr<Elf64_Ehdr>(&ehdr, ELFCLASS64, EM_X86_64);
-  ehdr.e_shoff = 0x2000;
-  ehdr.e_shentsize = sizeof(Elf64_Shdr) + 100;
-  ehdr.e_shnum = 0;
-  memory_->SetMemory(0x7000, &ehdr, sizeof(ehdr));
-
-  Elf* elf_in_threads[kNumConcurrentThreads];
-  std::vector<std::thread*> threads;
-
-  std::atomic_bool wait;
-  wait = true;
-  // Create all of the threads and have them do the GetElf at the same time
-  // to make it likely that a race will occur.
-  MapInfo info(nullptr, nullptr, 0x7000, 0x8000, 0x1000, PROT_READ, "");
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    std::thread* thread = new std::thread([i, this, &wait, &info, &elf_in_threads]() {
-      while (wait)
-        ;
-      Elf* elf = info.GetElf(process_memory_, ARCH_X86_64);
-      elf_in_threads[i] = elf;
-    });
-    threads.push_back(thread);
-  }
-  ASSERT_TRUE(info.elf == nullptr);
-
-  // Set them all going and wait for the threads to finish.
-  wait = false;
-  for (auto thread : threads) {
-    thread->join();
-    delete thread;
-  }
-
-  // Now verify that all of the elf files are exactly the same and valid.
-  Elf* elf = info.elf.get();
-  ASSERT_TRUE(elf != nullptr);
-  EXPECT_TRUE(elf->valid());
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    EXPECT_EQ(elf, elf_in_threads[i]) << "Thread " << i << " mismatched.";
-  }
-}
-
-// Verify that previous maps don't automatically get the same elf object.
-TEST_F(MapInfoGetElfTest, prev_map_elf_not_set) {
-  MapInfo info1(nullptr, nullptr, 0x1000, 0x2000, 0, PROT_READ, "/not/present");
-  MapInfo info2(&info1, &info1, 0x2000, 0x3000, 0, PROT_READ, elf_.path);
-
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memory_->SetMemory(0x2000, &ehdr, sizeof(ehdr));
-  Elf* elf = info2.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-
-  ASSERT_NE(elf, info1.GetElf(process_memory_, ARCH_ARM));
-}
-
-// Verify that a read-only map followed by a read-execute map will result
-// in the same elf object in both maps.
-TEST_F(MapInfoGetElfTest, read_only_followed_by_read_exec_share_elf) {
-  MapInfo r_info(nullptr, nullptr, 0x1000, 0x2000, 0, PROT_READ, elf_.path);
-  MapInfo rw_info(&r_info, &r_info, 0x2000, 0x3000, 0x1000, PROT_READ | PROT_EXEC, elf_.path);
-
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memory_->SetMemory(0x1000, &ehdr, sizeof(ehdr));
-  Elf* elf = rw_info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-
-  ASSERT_EQ(elf, r_info.GetElf(process_memory_, ARCH_ARM));
-}
-
-// Verify that a read-only map followed by an empty map, then followed by
-// a read-execute map will result in the same elf object in both maps.
-TEST_F(MapInfoGetElfTest, read_only_followed_by_empty_then_read_exec_share_elf) {
-  MapInfo r_info(nullptr, nullptr, 0x1000, 0x2000, 0, PROT_READ, elf_.path);
-  MapInfo empty(&r_info, &r_info, 0x2000, 0x3000, 0, 0, "");
-  MapInfo rw_info(&empty, &r_info, 0x3000, 0x4000, 0x2000, PROT_READ | PROT_EXEC, elf_.path);
-
-  Elf32_Ehdr ehdr;
-  TestInitEhdr<Elf32_Ehdr>(&ehdr, ELFCLASS32, EM_ARM);
-  memory_->SetMemory(0x1000, &ehdr, sizeof(ehdr));
-  Elf* elf = rw_info.GetElf(process_memory_, ARCH_ARM);
-  ASSERT_TRUE(elf != nullptr);
-  ASSERT_TRUE(elf->valid());
-
-  ASSERT_EQ(elf, r_info.GetElf(process_memory_, ARCH_ARM));
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MapInfoGetLoadBiasTest.cpp b/libunwindstack/tests/MapInfoGetLoadBiasTest.cpp
deleted file mode 100644
index 971d452..0000000
--- a/libunwindstack/tests/MapInfoGetLoadBiasTest.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <atomic>
-#include <memory>
-#include <thread>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/test_utils.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-
-#include "ElfFake.h"
-#include "ElfTestUtils.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class MapInfoGetLoadBiasTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_ = new MemoryFake;
-    process_memory_.reset(memory_);
-    elf_ = new ElfFake(new MemoryFake);
-    elf_container_.reset(elf_);
-    map_info_.reset(new MapInfo(nullptr, nullptr, 0x1000, 0x20000, 0, PROT_READ | PROT_WRITE, ""));
-  }
-
-  void MultipleThreadTest(uint64_t expected_load_bias);
-
-  std::shared_ptr<Memory> process_memory_;
-  MemoryFake* memory_;
-  ElfFake* elf_;
-  std::unique_ptr<ElfFake> elf_container_;
-  std::unique_ptr<MapInfo> map_info_;
-};
-
-TEST_F(MapInfoGetLoadBiasTest, no_elf_and_no_valid_elf_in_memory) {
-  MapInfo info(nullptr, nullptr, 0x1000, 0x2000, 0, PROT_READ, "");
-
-  EXPECT_EQ(0U, info.GetLoadBias(process_memory_));
-}
-
-TEST_F(MapInfoGetLoadBiasTest, load_bias_cached_from_elf) {
-  map_info_->elf.reset(elf_container_.release());
-
-  elf_->FakeSetLoadBias(0);
-  EXPECT_EQ(0U, map_info_->GetLoadBias(process_memory_));
-
-  elf_->FakeSetLoadBias(0x1000);
-  EXPECT_EQ(0U, map_info_->GetLoadBias(process_memory_));
-}
-
-TEST_F(MapInfoGetLoadBiasTest, elf_exists) {
-  map_info_->elf.reset(elf_container_.release());
-
-  elf_->FakeSetLoadBias(0);
-  EXPECT_EQ(0U, map_info_->GetLoadBias(process_memory_));
-
-  map_info_->load_bias = INT64_MAX;
-  elf_->FakeSetLoadBias(0x1000);
-  EXPECT_EQ(0x1000U, map_info_->GetLoadBias(process_memory_));
-}
-
-void MapInfoGetLoadBiasTest::MultipleThreadTest(uint64_t expected_load_bias) {
-  static constexpr size_t kNumConcurrentThreads = 100;
-
-  uint64_t load_bias_values[kNumConcurrentThreads];
-  std::vector<std::thread*> threads;
-
-  std::atomic_bool wait;
-  wait = true;
-  // Create all of the threads and have them do the GetLoadBias at the same time
-  // to make it likely that a race will occur.
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    std::thread* thread = new std::thread([i, this, &wait, &load_bias_values]() {
-      while (wait)
-        ;
-      load_bias_values[i] = map_info_->GetLoadBias(process_memory_);
-    });
-    threads.push_back(thread);
-  }
-
-  // Set them all going and wait for the threads to finish.
-  wait = false;
-  for (auto thread : threads) {
-    thread->join();
-    delete thread;
-  }
-
-  // Now verify that all of the elf files are exactly the same and valid.
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    EXPECT_EQ(expected_load_bias, load_bias_values[i]) << "Thread " << i << " mismatched.";
-  }
-}
-
-TEST_F(MapInfoGetLoadBiasTest, multiple_thread_elf_exists) {
-  map_info_->elf.reset(elf_container_.release());
-  elf_->FakeSetLoadBias(0x1000);
-
-  MultipleThreadTest(0x1000);
-}
-
-static void InitElfData(MemoryFake* memory, uint64_t offset) {
-  Elf32_Ehdr ehdr;
-  TestInitEhdr(&ehdr, ELFCLASS32, EM_ARM);
-  ehdr.e_phoff = 0x5000;
-  ehdr.e_phnum = 2;
-  ehdr.e_phentsize = sizeof(Elf32_Phdr);
-  memory->SetMemory(offset, &ehdr, sizeof(ehdr));
-
-  Elf32_Phdr phdr;
-  memset(&phdr, 0, sizeof(phdr));
-  phdr.p_type = PT_NULL;
-  memory->SetMemory(offset + 0x5000, &phdr, sizeof(phdr));
-  phdr.p_type = PT_LOAD;
-  phdr.p_flags = PF_X;
-  phdr.p_offset = 0;
-  phdr.p_vaddr = 0xe000;
-  memory->SetMemory(offset + 0x5000 + sizeof(phdr), &phdr, sizeof(phdr));
-}
-
-TEST_F(MapInfoGetLoadBiasTest, elf_exists_in_memory) {
-  InitElfData(memory_, map_info_->start);
-
-  EXPECT_EQ(0xe000U, map_info_->GetLoadBias(process_memory_));
-}
-
-TEST_F(MapInfoGetLoadBiasTest, elf_exists_in_memory_cached) {
-  InitElfData(memory_, map_info_->start);
-
-  EXPECT_EQ(0xe000U, map_info_->GetLoadBias(process_memory_));
-
-  memory_->Clear();
-  EXPECT_EQ(0xe000U, map_info_->GetLoadBias(process_memory_));
-}
-
-TEST_F(MapInfoGetLoadBiasTest, multiple_thread_elf_exists_in_memory) {
-  InitElfData(memory_, map_info_->start);
-
-  MultipleThreadTest(0xe000);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MapInfoTest.cpp b/libunwindstack/tests/MapInfoTest.cpp
deleted file mode 100644
index 98edc0e..0000000
--- a/libunwindstack/tests/MapInfoTest.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/Maps.h>
-
-#include "ElfFake.h"
-
-namespace unwindstack {
-
-TEST(MapInfoTest, maps_constructor_const_char) {
-  MapInfo prev_map(nullptr, nullptr, 0, 0, 0, 0, "");
-  MapInfo map_info(&prev_map, &prev_map, 1, 2, 3, 4, "map");
-
-  EXPECT_EQ(&prev_map, map_info.prev_map);
-  EXPECT_EQ(1UL, map_info.start);
-  EXPECT_EQ(2UL, map_info.end);
-  EXPECT_EQ(3UL, map_info.offset);
-  EXPECT_EQ(4UL, map_info.flags);
-  EXPECT_EQ("map", map_info.name);
-  EXPECT_EQ(INT64_MAX, map_info.load_bias);
-  EXPECT_EQ(0UL, map_info.elf_offset);
-  EXPECT_TRUE(map_info.elf.get() == nullptr);
-}
-
-TEST(MapInfoTest, maps_constructor_string) {
-  std::string name("string_map");
-  MapInfo prev_map(nullptr, nullptr, 0, 0, 0, 0, "");
-  MapInfo map_info(&prev_map, &prev_map, 1, 2, 3, 4, name);
-
-  EXPECT_EQ(&prev_map, map_info.prev_map);
-  EXPECT_EQ(1UL, map_info.start);
-  EXPECT_EQ(2UL, map_info.end);
-  EXPECT_EQ(3UL, map_info.offset);
-  EXPECT_EQ(4UL, map_info.flags);
-  EXPECT_EQ("string_map", map_info.name);
-  EXPECT_EQ(INT64_MAX, map_info.load_bias);
-  EXPECT_EQ(0UL, map_info.elf_offset);
-  EXPECT_TRUE(map_info.elf.get() == nullptr);
-}
-
-TEST(MapInfoTest, get_function_name) {
-  ElfFake* elf = new ElfFake(nullptr);
-  ElfInterfaceFake* interface = new ElfInterfaceFake(nullptr);
-  elf->FakeSetInterface(interface);
-  interface->FakePushFunctionData(FunctionData("function", 1000));
-
-  MapInfo map_info(nullptr, nullptr, 1, 2, 3, 4, "");
-  map_info.elf.reset(elf);
-
-  std::string name;
-  uint64_t offset;
-  ASSERT_TRUE(map_info.GetFunctionName(1000, &name, &offset));
-  EXPECT_EQ("function", name);
-  EXPECT_EQ(1000UL, offset);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MapsTest.cpp b/libunwindstack/tests/MapsTest.cpp
deleted file mode 100644
index 724eeb5..0000000
--- a/libunwindstack/tests/MapsTest.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <inttypes.h>
-#include <sys/mman.h>
-
-#include <android-base/file.h>
-#include <android-base/stringprintf.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/Maps.h>
-
-namespace unwindstack {
-
-static void VerifyLine(std::string line, MapInfo* info) {
-  BufferMaps maps(line.c_str());
-
-  if (info == nullptr) {
-    ASSERT_FALSE(maps.Parse()) << "Failed on: " + line;
-  } else {
-    ASSERT_TRUE(maps.Parse()) << "Failed on: " + line;
-    MapInfo* element = maps.Get(0);
-    ASSERT_TRUE(element != nullptr) << "Failed on: " + line;
-    info->start = element->start;
-    info->end = element->end;
-    info->offset = element->offset;
-    info->flags = element->flags;
-    info->name = element->name;
-    info->elf_offset = element->elf_offset;
-  }
-}
-
-TEST(MapsTest, map_add) {
-  Maps maps;
-
-  maps.Add(0x1000, 0x2000, 0, PROT_READ, "fake_map", 0);
-  maps.Add(0x3000, 0x4000, 0x10, 0, "", 0x1234);
-  maps.Add(0x5000, 0x6000, 1, 2, "fake_map2", static_cast<uint64_t>(-1));
-
-  ASSERT_EQ(3U, maps.Total());
-  MapInfo* info = maps.Get(0);
-  ASSERT_EQ(0x1000U, info->start);
-  ASSERT_EQ(0x2000U, info->end);
-  ASSERT_EQ(0U, info->offset);
-  ASSERT_EQ(PROT_READ, info->flags);
-  ASSERT_EQ("fake_map", info->name);
-  ASSERT_EQ(0U, info->elf_offset);
-  ASSERT_EQ(0U, info->load_bias.load());
-}
-
-TEST(MapsTest, map_move) {
-  Maps maps;
-
-  maps.Add(0x1000, 0x2000, 0, PROT_READ, "fake_map", 0);
-  maps.Add(0x3000, 0x4000, 0x10, 0, "", 0x1234);
-  maps.Add(0x5000, 0x6000, 1, 2, "fake_map2", static_cast<uint64_t>(-1));
-
-  Maps maps2 = std::move(maps);
-
-  ASSERT_EQ(3U, maps2.Total());
-  MapInfo* info = maps2.Get(0);
-  ASSERT_EQ(0x1000U, info->start);
-  ASSERT_EQ(0x2000U, info->end);
-  ASSERT_EQ(0U, info->offset);
-  ASSERT_EQ(PROT_READ, info->flags);
-  ASSERT_EQ("fake_map", info->name);
-  ASSERT_EQ(0U, info->elf_offset);
-  ASSERT_EQ(0U, info->load_bias.load());
-}
-
-TEST(MapsTest, verify_parse_line) {
-  MapInfo info(nullptr, nullptr, 0, 0, 0, 0, "");
-
-  VerifyLine("01-02 rwxp 03 04:05 06\n", &info);
-  EXPECT_EQ(1U, info.start);
-  EXPECT_EQ(2U, info.end);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, info.flags);
-  EXPECT_EQ(3U, info.offset);
-  EXPECT_EQ("", info.name);
-
-  VerifyLine("0a-0b ---s 0c 0d:0e 06 /fake/name\n", &info);
-  EXPECT_EQ(0xaU, info.start);
-  EXPECT_EQ(0xbU, info.end);
-  EXPECT_EQ(0U, info.flags);
-  EXPECT_EQ(0xcU, info.offset);
-  EXPECT_EQ("/fake/name", info.name);
-
-  VerifyLine("01-02   rwxp   03    04:05    06    /fake/name/again\n", &info);
-  EXPECT_EQ(1U, info.start);
-  EXPECT_EQ(2U, info.end);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, info.flags);
-  EXPECT_EQ(3U, info.offset);
-  EXPECT_EQ("/fake/name/again", info.name);
-
-  VerifyLine("-00 rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00- rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00-00 rwxp 00 :00 0\n", nullptr);
-  VerifyLine("00-00 rwxp 00 00:00 \n", nullptr);
-  VerifyLine("x-00 rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00 -00 rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00-x rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00-x rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00-00x rwxp 00 00:00 0\n", nullptr);
-  VerifyLine("00-00 rwxp0 00 00:00 0\n", nullptr);
-  VerifyLine("00-00 rwxp0 00 00:00 0\n", nullptr);
-  VerifyLine("00-00 rwp 00 00:00 0\n", nullptr);
-  VerifyLine("00-00 rwxp 0000:00 0\n", nullptr);
-  VerifyLine("00-00 rwxp 00 00 :00 0\n", nullptr);
-  VerifyLine("00-00 rwxp 00 00: 00 0\n", nullptr);
-  VerifyLine("00-00 rwxp 00 00:000\n", nullptr);
-  VerifyLine("00-00 rwxp 00 00:00 0/fake\n", nullptr);
-  VerifyLine("00-00 xxxx 00 00:00 0 /fake\n", nullptr);
-  VerifyLine("00-00 ywxp 00 00:00 0 /fake\n", nullptr);
-  VerifyLine("00-00 ryxp 00 00:00 0 /fake\n", nullptr);
-  VerifyLine("00-00 rwyp 00 00:00 0 /fake\n", nullptr);
-  VerifyLine("00-00 rwx- 00 00:00 0 /fake\n", nullptr);
-  VerifyLine("0\n", nullptr);
-  VerifyLine("00\n", nullptr);
-  VerifyLine("00-\n", nullptr);
-  VerifyLine("00-0\n", nullptr);
-  VerifyLine("00-00\n", nullptr);
-  VerifyLine("00-00 \n", nullptr);
-  VerifyLine("00-00 -\n", nullptr);
-  VerifyLine("00-00 r\n", nullptr);
-  VerifyLine("00-00 --\n", nullptr);
-  VerifyLine("00-00 rw\n", nullptr);
-  VerifyLine("00-00 ---\n", nullptr);
-  VerifyLine("00-00 rwx\n", nullptr);
-  VerifyLine("00-00 ---s\n", nullptr);
-  VerifyLine("00-00 ---p\n", nullptr);
-  VerifyLine("00-00 ---s 0\n", nullptr);
-  VerifyLine("00-00 ---p 0 \n", nullptr);
-  VerifyLine("00-00 ---p 0 0\n", nullptr);
-  VerifyLine("00-00 ---p 0 0:\n", nullptr);
-  VerifyLine("00-00 ---p 0 0:0\n", nullptr);
-  VerifyLine("00-00 ---p 0 0:0 \n", nullptr);
-
-  // Line to verify that the parser will detect a completely malformed line
-  // properly.
-  VerifyLine("7ffff7dda000-7ffff7dfd7ffff7ff3000-7ffff7ff4000 ---p 0000f000 fc:02 44171565\n",
-             nullptr);
-}
-
-TEST(MapsTest, verify_large_values) {
-  MapInfo info(nullptr, nullptr, 0, 0, 0, 0, "");
-#if defined(__LP64__)
-  VerifyLine("fabcdef012345678-f12345678abcdef8 rwxp f0b0d0f010305070 00:00 0\n", &info);
-  EXPECT_EQ(0xfabcdef012345678UL, info.start);
-  EXPECT_EQ(0xf12345678abcdef8UL, info.end);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, info.flags);
-  EXPECT_EQ(0xf0b0d0f010305070UL, info.offset);
-#else
-  VerifyLine("f2345678-fabcdef8 rwxp f0305070 00:00 0\n", &info);
-  EXPECT_EQ(0xf2345678UL, info.start);
-  EXPECT_EQ(0xfabcdef8UL, info.end);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, info.flags);
-  EXPECT_EQ(0xf0305070UL, info.offset);
-#endif
-}
-
-TEST(MapsTest, parse_permissions) {
-  BufferMaps maps(
-      "1000-2000 ---s 00000000 00:00 0\n"
-      "2000-3000 r--s 00000000 00:00 0\n"
-      "3000-4000 -w-s 00000000 00:00 0\n"
-      "4000-5000 --xp 00000000 00:00 0\n"
-      "5000-6000 rwxp 00000000 00:00 0\n");
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(5U, maps.Total());
-
-  MapInfo* info = maps.Get(0);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(PROT_NONE, info->flags);
-  EXPECT_EQ(0x1000U, info->start);
-  EXPECT_EQ(0x2000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ("", info->name);
-
-  info = maps.Get(1);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(PROT_READ, info->flags);
-  EXPECT_EQ(0x2000U, info->start);
-  EXPECT_EQ(0x3000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ("", info->name);
-
-  info = maps.Get(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(PROT_WRITE, info->flags);
-  EXPECT_EQ(0x3000U, info->start);
-  EXPECT_EQ(0x4000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ("", info->name);
-
-  info = maps.Get(3);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(PROT_EXEC, info->flags);
-  EXPECT_EQ(0x4000U, info->start);
-  EXPECT_EQ(0x5000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ("", info->name);
-
-  info = maps.Get(4);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, info->flags);
-  EXPECT_EQ(0x5000U, info->start);
-  EXPECT_EQ(0x6000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ("", info->name);
-
-  ASSERT_TRUE(maps.Get(5) == nullptr);
-}
-
-TEST(MapsTest, parse_name) {
-  BufferMaps maps(
-      "7b29b000-7b29e000 rw-p 00000000 00:00 0\n"
-      "7b29e000-7b29f000 rw-p 00000000 00:00 0 /system/lib/fake.so\n"
-      "7b29f000-7b2a0000 rw-p 00000000 00:00 0");
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(3U, maps.Total());
-
-  MapInfo* info = maps.Get(0);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ("", info->name);
-  EXPECT_EQ(0x7b29b000U, info->start);
-  EXPECT_EQ(0x7b29e000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, info->flags);
-
-  info = maps.Get(1);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ("/system/lib/fake.so", info->name);
-  EXPECT_EQ(0x7b29e000U, info->start);
-  EXPECT_EQ(0x7b29f000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, info->flags);
-
-  info = maps.Get(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ("", info->name);
-  EXPECT_EQ(0x7b29f000U, info->start);
-  EXPECT_EQ(0x7b2a0000U, info->end);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, info->flags);
-
-  ASSERT_TRUE(maps.Get(3) == nullptr);
-}
-
-TEST(MapsTest, parse_offset) {
-  BufferMaps maps(
-      "a000-e000 rw-p 00000000 00:00 0 /system/lib/fake.so\n"
-      "e000-f000 rw-p 00a12345 00:00 0 /system/lib/fake.so\n");
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(2U, maps.Total());
-
-  MapInfo* info = maps.Get(0);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0U, info->offset);
-  EXPECT_EQ(0xa000U, info->start);
-  EXPECT_EQ(0xe000U, info->end);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, info->flags);
-  EXPECT_EQ("/system/lib/fake.so", info->name);
-
-  info = maps.Get(1);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0xa12345U, info->offset);
-  EXPECT_EQ(0xe000U, info->start);
-  EXPECT_EQ(0xf000U, info->end);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, info->flags);
-  EXPECT_EQ("/system/lib/fake.so", info->name);
-
-  ASSERT_TRUE(maps.Get(2) == nullptr);
-}
-
-TEST(MapsTest, iterate) {
-  BufferMaps maps(
-      "a000-e000 rw-p 00000000 00:00 0 /system/lib/fake.so\n"
-      "e000-f000 rw-p 00a12345 00:00 0 /system/lib/fake.so\n");
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(2U, maps.Total());
-
-  Maps::iterator it = maps.begin();
-  EXPECT_EQ(0xa000U, (*it)->start);
-  EXPECT_EQ(0xe000U, (*it)->end);
-  ++it;
-  EXPECT_EQ(0xe000U, (*it)->start);
-  EXPECT_EQ(0xf000U, (*it)->end);
-  ++it;
-  EXPECT_EQ(maps.end(), it);
-}
-
-TEST(MapsTest, const_iterate) {
-  BufferMaps maps(
-      "a000-e000 rw-p 00000000 00:00 0 /system/lib/fake.so\n"
-      "e000-f000 rw-p 00a12345 00:00 0 /system/lib/fake.so\n");
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(2U, maps.Total());
-
-  Maps::const_iterator it = maps.begin();
-  EXPECT_EQ(0xa000U, (*it)->start);
-  EXPECT_EQ(0xe000U, (*it)->end);
-  ++it;
-  EXPECT_EQ(0xe000U, (*it)->start);
-  EXPECT_EQ(0xf000U, (*it)->end);
-  ++it;
-  EXPECT_EQ(maps.end(), it);
-}
-
-TEST(MapsTest, device) {
-  BufferMaps maps(
-      "a000-e000 rw-p 00000000 00:00 0 /dev/\n"
-      "f000-f100 rw-p 00000000 00:00 0 /dev/does_not_exist\n"
-      "f100-f200 rw-p 00000000 00:00 0 /dev/ashmem/does_not_exist\n"
-      "f200-f300 rw-p 00000000 00:00 0 /devsomething/does_not_exist\n");
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(4U, maps.Total());
-
-  MapInfo* info = maps.Get(0);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_TRUE(info->flags & 0x8000);
-  EXPECT_EQ("/dev/", info->name);
-
-  info = maps.Get(1);
-  EXPECT_TRUE(info->flags & 0x8000);
-  EXPECT_EQ("/dev/does_not_exist", info->name);
-
-  info = maps.Get(2);
-  EXPECT_FALSE(info->flags & 0x8000);
-  EXPECT_EQ("/dev/ashmem/does_not_exist", info->name);
-
-  info = maps.Get(3);
-  EXPECT_FALSE(info->flags & 0x8000);
-  EXPECT_EQ("/devsomething/does_not_exist", info->name);
-}
-
-TEST(MapsTest, file_smoke) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("7b29b000-7b29e000 r-xp a0000000 00:00 0   /fake.so\n"
-                                       "7b2b0000-7b2e0000 r-xp b0000000 00:00 0   /fake2.so\n"
-                                       "7b2e0000-7b2f0000 r-xp c0000000 00:00 0   /fake3.so\n",
-                                       tf.path, 0660, getuid(), getgid()));
-
-  FileMaps maps(tf.path);
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(3U, maps.Total());
-
-  MapInfo* info = maps.Get(0);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x7b29b000U, info->start);
-  EXPECT_EQ(0x7b29e000U, info->end);
-  EXPECT_EQ(0xa0000000U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, info->flags);
-  EXPECT_EQ("/fake.so", info->name);
-
-  info = maps.Get(1);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x7b2b0000U, info->start);
-  EXPECT_EQ(0x7b2e0000U, info->end);
-  EXPECT_EQ(0xb0000000U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, info->flags);
-  EXPECT_EQ("/fake2.so", info->name);
-
-  info = maps.Get(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x7b2e0000U, info->start);
-  EXPECT_EQ(0x7b2f0000U, info->end);
-  EXPECT_EQ(0xc0000000U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, info->flags);
-  EXPECT_EQ("/fake3.so", info->name);
-
-  ASSERT_TRUE(maps.Get(3) == nullptr);
-}
-
-TEST(MapsTest, file_no_map_name) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_TRUE(
-      android::base::WriteStringToFile("7b29b000-7b29e000 r-xp a0000000 00:00 0\n"
-                                       "7b2b0000-7b2e0000 r-xp b0000000 00:00 0   /fake2.so\n"
-                                       "7b2e0000-7b2f0000 r-xp c0000000 00:00 0 \n",
-                                       tf.path, 0660, getuid(), getgid()));
-
-  FileMaps maps(tf.path);
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(3U, maps.Total());
-
-  MapInfo* info = maps.Get(0);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x7b29b000U, info->start);
-  EXPECT_EQ(0x7b29e000U, info->end);
-  EXPECT_EQ(0xa0000000U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, info->flags);
-  EXPECT_EQ("", info->name);
-
-  info = maps.Get(1);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x7b2b0000U, info->start);
-  EXPECT_EQ(0x7b2e0000U, info->end);
-  EXPECT_EQ(0xb0000000U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, info->flags);
-  EXPECT_EQ("/fake2.so", info->name);
-
-  info = maps.Get(2);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x7b2e0000U, info->start);
-  EXPECT_EQ(0x7b2f0000U, info->end);
-  EXPECT_EQ(0xc0000000U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_EXEC, info->flags);
-  EXPECT_EQ("", info->name);
-
-  ASSERT_TRUE(maps.Get(3) == nullptr);
-}
-
-// Verify that a file that crosses a buffer is parsed correctly.
-static std::string CreateEntry(size_t index) {
-  return android::base::StringPrintf("%08zx-%08zx rwxp 0000 00:00 0\n", index * 4096,
-                                     (index + 1) * 4096);
-}
-
-TEST(MapsTest, file_buffer_cross) {
-  constexpr size_t kBufferSize = 2048;
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  // Compute how many to add in the first buffer.
-  size_t entry_len = CreateEntry(0).size();
-  size_t index;
-  std::string file_data;
-  for (index = 0; index < kBufferSize / entry_len; index++) {
-    file_data += CreateEntry(index);
-  }
-  // Add a long name to make sure that the first buffer does not contain a
-  // complete line.
-  // Remove the last newline.
-  size_t extra = 0;
-  size_t leftover = kBufferSize % entry_len;
-  size_t overlap1_index = 0;
-  std::string overlap1_name;
-  if (leftover == 0) {
-    // Exact match, add a long name to cross over the value.
-    overlap1_name = "/fake/name/is/long/on/purpose";
-    file_data.erase(file_data.size() - 1);
-    file_data += ' ' + overlap1_name + '\n';
-    extra = entry_len + overlap1_name.size() + 1;
-    overlap1_index = index;
-  }
-
-  // Compute how many need to go in to hit the buffer boundary exactly.
-  size_t bytes_left_in_buffer = kBufferSize - extra;
-  size_t entries_to_add = bytes_left_in_buffer / entry_len + index;
-  for (; index < entries_to_add; index++) {
-    file_data += CreateEntry(index);
-  }
-
-  // Now figure out how many bytes to add to get exactly to the buffer boundary.
-  leftover = bytes_left_in_buffer % entry_len;
-  std::string overlap2_name;
-  size_t overlap2_index = 0;
-  if (leftover != 0) {
-    file_data.erase(file_data.size() - 1);
-    file_data += ' ';
-    overlap2_name = std::string(leftover - 1, 'x');
-    file_data += overlap2_name + '\n';
-    overlap2_index = index - 1;
-  }
-
-  // Now add a few entries on the next page.
-  for (size_t start = index; index < start + 10; index++) {
-    file_data += CreateEntry(index);
-  }
-
-  ASSERT_TRUE(android::base::WriteStringToFile(file_data, tf.path, 0660, getuid(), getgid()));
-
-  FileMaps maps(tf.path);
-  ASSERT_TRUE(maps.Parse());
-  EXPECT_EQ(index, maps.Total());
-  // Verify all of the maps.
-  for (size_t i = 0; i < index; i++) {
-    MapInfo* info = maps.Get(i);
-    ASSERT_TRUE(info != nullptr) << "Failed verifying index " + std::to_string(i);
-    EXPECT_EQ(i * 4096, info->start) << "Failed verifying index " + std::to_string(i);
-    EXPECT_EQ((i + 1) * 4096, info->end) << "Failed verifying index " + std::to_string(i);
-    EXPECT_EQ(0U, info->offset) << "Failed verifying index " + std::to_string(i);
-    if (overlap1_index != 0 && i == overlap1_index) {
-      EXPECT_EQ(overlap1_name, info->name) << "Failed verifying overlap1 name " + std::to_string(i);
-    } else if (overlap2_index != 0 && i == overlap2_index) {
-      EXPECT_EQ(overlap2_name, info->name) << "Failed verifying overlap2 name " + std::to_string(i);
-    } else {
-      EXPECT_EQ("", info->name) << "Failed verifying index " + std::to_string(i);
-    }
-  }
-}
-
-TEST(MapsTest, file_should_fail) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  ASSERT_TRUE(android::base::WriteStringToFile(
-      "7ffff7dda000-7ffff7dfd7ffff7ff3000-7ffff7ff4000 ---p 0000f000 fc:02 44171565\n", tf.path,
-      0660, getuid(), getgid()));
-
-  FileMaps maps(tf.path);
-
-  ASSERT_FALSE(maps.Parse());
-}
-
-// Create a maps file that is extremely large.
-TEST(MapsTest, large_file) {
-  TemporaryFile tf;
-  ASSERT_TRUE(tf.fd != -1);
-
-  std::string file_data;
-  uint64_t start = 0x700000;
-  for (size_t i = 0; i < 5000; i++) {
-    file_data +=
-        android::base::StringPrintf("%" PRIx64 "-%" PRIx64 " r-xp 1000 00:0 0 /fake%zu.so\n",
-                                    start + i * 4096, start + (i + 1) * 4096, i);
-  }
-
-  ASSERT_TRUE(android::base::WriteStringToFile(file_data, tf.path, 0660, getuid(), getgid()));
-
-  FileMaps maps(tf.path);
-
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(5000U, maps.Total());
-  for (size_t i = 0; i < 5000; i++) {
-    MapInfo* info = maps.Get(i);
-    EXPECT_EQ(start + i * 4096, info->start) << "Failed at map " + std::to_string(i);
-    EXPECT_EQ(start + (i + 1) * 4096, info->end) << "Failed at map " + std::to_string(i);
-    std::string name = "/fake" + std::to_string(i) + ".so";
-    EXPECT_EQ(name, info->name) << "Failed at map " + std::to_string(i);
-  }
-}
-
-TEST(MapsTest, find) {
-  BufferMaps maps(
-      "1000-2000 r--p 00000010 00:00 0 /system/lib/fake1.so\n"
-      "3000-4000 -w-p 00000020 00:00 0 /system/lib/fake2.so\n"
-      "6000-8000 --xp 00000030 00:00 0 /system/lib/fake3.so\n"
-      "a000-b000 rw-p 00000040 00:00 0 /system/lib/fake4.so\n"
-      "e000-f000 rwxp 00000050 00:00 0 /system/lib/fake5.so\n");
-  ASSERT_TRUE(maps.Parse());
-  ASSERT_EQ(5U, maps.Total());
-
-  EXPECT_TRUE(maps.Find(0x500) == nullptr);
-  EXPECT_TRUE(maps.Find(0x2000) == nullptr);
-  EXPECT_TRUE(maps.Find(0x5010) == nullptr);
-  EXPECT_TRUE(maps.Find(0x9a00) == nullptr);
-  EXPECT_TRUE(maps.Find(0xf000) == nullptr);
-  EXPECT_TRUE(maps.Find(0xf010) == nullptr);
-
-  MapInfo* info = maps.Find(0x1000);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x1000U, info->start);
-  EXPECT_EQ(0x2000U, info->end);
-  EXPECT_EQ(0x10U, info->offset);
-  EXPECT_EQ(PROT_READ, info->flags);
-  EXPECT_EQ("/system/lib/fake1.so", info->name);
-
-  info = maps.Find(0x3020);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x3000U, info->start);
-  EXPECT_EQ(0x4000U, info->end);
-  EXPECT_EQ(0x20U, info->offset);
-  EXPECT_EQ(PROT_WRITE, info->flags);
-  EXPECT_EQ("/system/lib/fake2.so", info->name);
-
-  info = maps.Find(0x6020);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0x6000U, info->start);
-  EXPECT_EQ(0x8000U, info->end);
-  EXPECT_EQ(0x30U, info->offset);
-  EXPECT_EQ(PROT_EXEC, info->flags);
-  EXPECT_EQ("/system/lib/fake3.so", info->name);
-
-  info = maps.Find(0xafff);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0xa000U, info->start);
-  EXPECT_EQ(0xb000U, info->end);
-  EXPECT_EQ(0x40U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, info->flags);
-  EXPECT_EQ("/system/lib/fake4.so", info->name);
-
-  info = maps.Find(0xe500);
-  ASSERT_TRUE(info != nullptr);
-  EXPECT_EQ(0xe000U, info->start);
-  EXPECT_EQ(0xf000U, info->end);
-  EXPECT_EQ(0x50U, info->offset);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, info->flags);
-  EXPECT_EQ("/system/lib/fake5.so", info->name);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryBufferTest.cpp b/libunwindstack/tests/MemoryBufferTest.cpp
deleted file mode 100644
index a6c12aa..0000000
--- a/libunwindstack/tests/MemoryBufferTest.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "LogFake.h"
-#include "MemoryBuffer.h"
-
-namespace unwindstack {
-
-class MemoryBufferTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    ResetLogs();
-    memory_.reset(new MemoryBuffer);
-  }
-  std::unique_ptr<MemoryBuffer> memory_;
-};
-
-TEST_F(MemoryBufferTest, empty) {
-  ASSERT_EQ(0U, memory_->Size());
-  std::vector<uint8_t> buffer(1024);
-  ASSERT_FALSE(memory_->ReadFully(0, buffer.data(), 1));
-  ASSERT_EQ(nullptr, memory_->GetPtr(0));
-  ASSERT_EQ(nullptr, memory_->GetPtr(1));
-}
-
-TEST_F(MemoryBufferTest, write_read) {
-  memory_->Resize(256);
-  ASSERT_EQ(256U, memory_->Size());
-  ASSERT_TRUE(memory_->GetPtr(0) != nullptr);
-  ASSERT_TRUE(memory_->GetPtr(1) != nullptr);
-  ASSERT_TRUE(memory_->GetPtr(255) != nullptr);
-  ASSERT_TRUE(memory_->GetPtr(256) == nullptr);
-
-  uint8_t* data = memory_->GetPtr(0);
-  for (size_t i = 0; i < memory_->Size(); i++) {
-    data[i] = i;
-  }
-
-  std::vector<uint8_t> buffer(memory_->Size());
-  ASSERT_TRUE(memory_->ReadFully(0, buffer.data(), buffer.size()));
-  for (size_t i = 0; i < buffer.size(); i++) {
-    ASSERT_EQ(i, buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryBufferTest, read_failures) {
-  memory_->Resize(100);
-  std::vector<uint8_t> buffer(200);
-  ASSERT_FALSE(memory_->ReadFully(0, buffer.data(), 101));
-  ASSERT_FALSE(memory_->ReadFully(100, buffer.data(), 1));
-  ASSERT_FALSE(memory_->ReadFully(101, buffer.data(), 2));
-  ASSERT_FALSE(memory_->ReadFully(99, buffer.data(), 2));
-  ASSERT_TRUE(memory_->ReadFully(99, buffer.data(), 1));
-}
-
-TEST_F(MemoryBufferTest, read_failure_overflow) {
-  memory_->Resize(100);
-  std::vector<uint8_t> buffer(200);
-
-  ASSERT_FALSE(memory_->ReadFully(UINT64_MAX - 100, buffer.data(), 200));
-}
-
-TEST_F(MemoryBufferTest, Read) {
-  memory_->Resize(256);
-  ASSERT_EQ(256U, memory_->Size());
-  ASSERT_TRUE(memory_->GetPtr(0) != nullptr);
-  ASSERT_TRUE(memory_->GetPtr(1) != nullptr);
-  ASSERT_TRUE(memory_->GetPtr(255) != nullptr);
-  ASSERT_TRUE(memory_->GetPtr(256) == nullptr);
-
-  uint8_t* data = memory_->GetPtr(0);
-  for (size_t i = 0; i < memory_->Size(); i++) {
-    data[i] = i;
-  }
-
-  std::vector<uint8_t> buffer(memory_->Size());
-  ASSERT_EQ(128U, memory_->Read(128, buffer.data(), buffer.size()));
-  for (size_t i = 0; i < 128; i++) {
-    ASSERT_EQ(128 + i, buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryCacheTest.cpp b/libunwindstack/tests/MemoryCacheTest.cpp
deleted file mode 100644
index 3bd3e4d..0000000
--- a/libunwindstack/tests/MemoryCacheTest.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "MemoryCache.h"
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class MemoryCacheTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_ = new MemoryFake;
-    memory_cache_.reset(new MemoryCache(memory_));
-
-    memory_->SetMemoryBlock(0x8000, 4096, 0xab);
-    memory_->SetMemoryBlock(0x9000, 4096, 0xde);
-    memory_->SetMemoryBlock(0xa000, 3000, 0x50);
-  }
-
-  MemoryFake* memory_;
-  std::unique_ptr<MemoryCache> memory_cache_;
-
-  constexpr static size_t kMaxCachedSize = 64;
-};
-
-TEST_F(MemoryCacheTest, cached_read) {
-  for (size_t i = 1; i <= kMaxCachedSize; i++) {
-    std::vector<uint8_t> buffer(i);
-    ASSERT_TRUE(memory_cache_->ReadFully(0x8000 + i, buffer.data(), i))
-        << "Read failed at size " << i;
-    ASSERT_EQ(std::vector<uint8_t>(i, 0xab), buffer) << "Failed at size " << i;
-  }
-
-  // Verify the cached data is used.
-  memory_->SetMemoryBlock(0x8000, 4096, 0xff);
-  for (size_t i = 1; i <= kMaxCachedSize; i++) {
-    std::vector<uint8_t> buffer(i);
-    ASSERT_TRUE(memory_cache_->ReadFully(0x8000 + i, buffer.data(), i))
-        << "Read failed at size " << i;
-    ASSERT_EQ(std::vector<uint8_t>(i, 0xab), buffer) << "Failed at size " << i;
-  }
-}
-
-TEST_F(MemoryCacheTest, no_cached_read_after_clear) {
-  for (size_t i = 1; i <= kMaxCachedSize; i++) {
-    std::vector<uint8_t> buffer(i);
-    ASSERT_TRUE(memory_cache_->ReadFully(0x8000 + i, buffer.data(), i))
-        << "Read failed at size " << i;
-    ASSERT_EQ(std::vector<uint8_t>(i, 0xab), buffer) << "Failed at size " << i;
-  }
-
-  // Verify the cached data is not used after a reset.
-  memory_cache_->Clear();
-  memory_->SetMemoryBlock(0x8000, 4096, 0xff);
-  for (size_t i = 1; i <= kMaxCachedSize; i++) {
-    std::vector<uint8_t> buffer(i);
-    ASSERT_TRUE(memory_cache_->ReadFully(0x8000 + i, buffer.data(), i))
-        << "Read failed at size " << i;
-    ASSERT_EQ(std::vector<uint8_t>(i, 0xff), buffer) << "Failed at size " << i;
-  }
-}
-
-TEST_F(MemoryCacheTest, cached_read_across_caches) {
-  std::vector<uint8_t> expect(16, 0xab);
-  expect.resize(32, 0xde);
-
-  std::vector<uint8_t> buffer(32);
-  ASSERT_TRUE(memory_cache_->ReadFully(0x8ff0, buffer.data(), 32));
-  ASSERT_EQ(expect, buffer);
-
-  // Verify the cached data is used.
-  memory_->SetMemoryBlock(0x8000, 4096, 0xff);
-  memory_->SetMemoryBlock(0x9000, 4096, 0xff);
-  ASSERT_TRUE(memory_cache_->ReadFully(0x8ff0, buffer.data(), 32));
-  ASSERT_EQ(expect, buffer);
-}
-
-TEST_F(MemoryCacheTest, no_cache_read) {
-  for (size_t i = kMaxCachedSize + 1; i < 2 * kMaxCachedSize; i++) {
-    std::vector<uint8_t> buffer(i);
-    ASSERT_TRUE(memory_cache_->ReadFully(0x8000 + i, buffer.data(), i))
-        << "Read failed at size " << i;
-    ASSERT_EQ(std::vector<uint8_t>(i, 0xab), buffer) << "Failed at size " << i;
-  }
-
-  // Verify the cached data is not used.
-  memory_->SetMemoryBlock(0x8000, 4096, 0xff);
-  for (size_t i = kMaxCachedSize + 1; i < 2 * kMaxCachedSize; i++) {
-    std::vector<uint8_t> buffer(i);
-    ASSERT_TRUE(memory_cache_->ReadFully(0x8000 + i, buffer.data(), i))
-        << "Read failed at size " << i;
-    ASSERT_EQ(std::vector<uint8_t>(i, 0xff), buffer) << "Failed at size " << i;
-  }
-}
-
-TEST_F(MemoryCacheTest, read_for_cache_fail) {
-  std::vector<uint8_t> buffer(kMaxCachedSize);
-  ASSERT_TRUE(memory_cache_->ReadFully(0xa010, buffer.data(), kMaxCachedSize));
-  ASSERT_EQ(std::vector<uint8_t>(kMaxCachedSize, 0x50), buffer);
-
-  // Verify the cached data is not used.
-  memory_->SetMemoryBlock(0xa000, 3000, 0xff);
-  ASSERT_TRUE(memory_cache_->ReadFully(0xa010, buffer.data(), kMaxCachedSize));
-  ASSERT_EQ(std::vector<uint8_t>(kMaxCachedSize, 0xff), buffer);
-}
-
-TEST_F(MemoryCacheTest, read_for_cache_fail_cross) {
-  std::vector<uint8_t> expect(16, 0xde);
-  expect.resize(32, 0x50);
-
-  std::vector<uint8_t> buffer(32);
-  ASSERT_TRUE(memory_cache_->ReadFully(0x9ff0, buffer.data(), 32));
-  ASSERT_EQ(expect, buffer);
-
-  // Verify the cached data is not used for the second half but for the first.
-  memory_->SetMemoryBlock(0xa000, 3000, 0xff);
-  ASSERT_TRUE(memory_cache_->ReadFully(0x9ff0, buffer.data(), 32));
-  expect.resize(16);
-  expect.resize(32, 0xff);
-  ASSERT_EQ(expect, buffer);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryFake.cpp b/libunwindstack/tests/MemoryFake.cpp
deleted file mode 100644
index 5695dfc..0000000
--- a/libunwindstack/tests/MemoryFake.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-void MemoryFake::SetMemoryBlock(uint64_t addr, size_t length, uint8_t value) {
-  for (size_t i = 0; i < length; i++, addr++) {
-    auto entry = data_.find(addr);
-    if (entry != data_.end()) {
-      entry->second = value;
-    } else {
-      data_.insert({addr, value});
-    }
-  }
-}
-
-void MemoryFake::SetMemory(uint64_t addr, const void* memory, size_t length) {
-  const uint8_t* src = reinterpret_cast<const uint8_t*>(memory);
-  for (size_t i = 0; i < length; i++, addr++) {
-    auto value = data_.find(addr);
-    if (value != data_.end()) {
-      value->second = src[i];
-    } else {
-      data_.insert({ addr, src[i] });
-    }
-  }
-}
-
-size_t MemoryFake::Read(uint64_t addr, void* memory, size_t size) {
-  uint8_t* dst = reinterpret_cast<uint8_t*>(memory);
-  for (size_t i = 0; i < size; i++, addr++) {
-    auto value = data_.find(addr);
-    if (value == data_.end()) {
-      return i;
-    }
-    dst[i] = value->second;
-  }
-  return size;
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryFake.h b/libunwindstack/tests/MemoryFake.h
deleted file mode 100644
index 20610a5..0000000
--- a/libunwindstack/tests/MemoryFake.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_TESTS_MEMORY_FAKE_H
-#define _LIBUNWINDSTACK_TESTS_MEMORY_FAKE_H
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-#include <unordered_map>
-
-#include <unwindstack/Memory.h>
-
-namespace unwindstack {
-
-class MemoryFake : public Memory {
- public:
-  MemoryFake() = default;
-  virtual ~MemoryFake() = default;
-
-  size_t Read(uint64_t addr, void* buffer, size_t size) override;
-
-  void SetMemory(uint64_t addr, const void* memory, size_t length);
-
-  void SetMemoryBlock(uint64_t addr, size_t length, uint8_t value);
-
-  void SetData8(uint64_t addr, uint8_t value) {
-    SetMemory(addr, &value, sizeof(value));
-  }
-
-  void SetData16(uint64_t addr, uint16_t value) {
-    SetMemory(addr, &value, sizeof(value));
-  }
-
-  void SetData32(uint64_t addr, uint32_t value) {
-    SetMemory(addr, &value, sizeof(value));
-  }
-
-  void SetData64(uint64_t addr, uint64_t value) {
-    SetMemory(addr, &value, sizeof(value));
-  }
-
-  void SetMemory(uint64_t addr, std::vector<uint8_t> values) {
-    SetMemory(addr, values.data(), values.size());
-  }
-
-  void SetMemory(uint64_t addr, std::string string) {
-    SetMemory(addr, string.c_str(), string.size() + 1);
-  }
-
-  void Clear() { data_.clear(); }
-
- private:
-  std::unordered_map<uint64_t, uint8_t> data_;
-};
-
-class MemoryFakeAlwaysReadZero : public Memory {
- public:
-  MemoryFakeAlwaysReadZero() = default;
-  virtual ~MemoryFakeAlwaysReadZero() = default;
-
-  size_t Read(uint64_t, void* buffer, size_t size) override {
-    memset(buffer, 0, size);
-    return size;
-  }
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_TESTS_MEMORY_FAKE_H
diff --git a/libunwindstack/tests/MemoryFileTest.cpp b/libunwindstack/tests/MemoryFileTest.cpp
deleted file mode 100644
index 4124a49..0000000
--- a/libunwindstack/tests/MemoryFileTest.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <string>
-#include <vector>
-
-#include <android-base/test_utils.h>
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-
-#include "MemoryFileAtOffset.h"
-
-namespace unwindstack {
-
-class MemoryFileTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    tf_ = new TemporaryFile;
-  }
-
-  void TearDown() override {
-    delete tf_;
-  }
-
-  void WriteTestData() {
-    ASSERT_TRUE(android::base::WriteStringToFd("0123456789abcdefghijklmnopqrstuvxyz", tf_->fd));
-  }
-
-  MemoryFileAtOffset memory_;
-
-  TemporaryFile* tf_ = nullptr;
-};
-
-TEST_F(MemoryFileTest, init_offset_0) {
-  WriteTestData();
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 0));
-  std::vector<char> buffer(11);
-  ASSERT_TRUE(memory_.ReadFully(0, buffer.data(), 10));
-  buffer[10] = '\0';
-  ASSERT_STREQ("0123456789", buffer.data());
-}
-
-TEST_F(MemoryFileTest, init_offset_non_zero) {
-  WriteTestData();
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 10));
-  std::vector<char> buffer(11);
-  ASSERT_TRUE(memory_.ReadFully(0, buffer.data(), 10));
-  buffer[10] = '\0';
-  ASSERT_STREQ("abcdefghij", buffer.data());
-}
-
-TEST_F(MemoryFileTest, init_offset_non_zero_larger_than_pagesize) {
-  size_t pagesize = getpagesize();
-  std::string large_string;
-  for (size_t i = 0; i < pagesize; i++) {
-    large_string += '1';
-  }
-  large_string += "012345678901234abcdefgh";
-  ASSERT_TRUE(android::base::WriteStringToFd(large_string, tf_->fd));
-
-  ASSERT_TRUE(memory_.Init(tf_->path, pagesize + 15));
-  std::vector<char> buffer(9);
-  ASSERT_TRUE(memory_.ReadFully(0, buffer.data(), 8));
-  buffer[8] = '\0';
-  ASSERT_STREQ("abcdefgh", buffer.data());
-}
-
-TEST_F(MemoryFileTest, init_offset_pagesize_aligned) {
-  size_t pagesize = getpagesize();
-  std::string data;
-  for (size_t i = 0; i < 2 * pagesize; i++) {
-    data += static_cast<char>((i / pagesize) + '0');
-    data += static_cast<char>((i % 10) + '0');
-  }
-  ASSERT_TRUE(android::base::WriteStringToFd(data, tf_->fd));
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 2 * pagesize));
-  std::vector<char> buffer(11);
-  ASSERT_TRUE(memory_.ReadFully(0, buffer.data(), 10));
-  buffer[10] = '\0';
-  std::string expected_str;
-  for (size_t i = 0; i < 5; i++) {
-    expected_str += '1';
-    expected_str += static_cast<char>(((i + pagesize) % 10) + '0');
-  }
-  ASSERT_STREQ(expected_str.c_str(), buffer.data());
-}
-
-TEST_F(MemoryFileTest, init_offset_pagesize_aligned_plus_extra) {
-  size_t pagesize = getpagesize();
-  std::string data;
-  for (size_t i = 0; i < 2 * pagesize; i++) {
-    data += static_cast<char>((i / pagesize) + '0');
-    data += static_cast<char>((i % 10) + '0');
-  }
-  ASSERT_TRUE(android::base::WriteStringToFd(data, tf_->fd));
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 2 * pagesize + 10));
-  std::vector<char> buffer(11);
-  ASSERT_TRUE(memory_.ReadFully(0, buffer.data(), 10));
-  buffer[10] = '\0';
-  std::string expected_str;
-  for (size_t i = 0; i < 5; i++) {
-    expected_str += '1';
-    expected_str += static_cast<char>(((i + pagesize + 5) % 10) + '0');
-  }
-  ASSERT_STREQ(expected_str.c_str(), buffer.data());
-}
-
-TEST_F(MemoryFileTest, init_offset_greater_than_filesize) {
-  size_t pagesize = getpagesize();
-  std::string data;
-  uint64_t file_size = 2 * pagesize + pagesize / 2;
-  for (size_t i = 0; i < file_size; i++) {
-    data += static_cast<char>((i / pagesize) + '0');
-  }
-  ASSERT_TRUE(android::base::WriteStringToFd(data, tf_->fd));
-
-  // Check offset > file size fails and aligned_offset > file size.
-  ASSERT_FALSE(memory_.Init(tf_->path, file_size + 2 * pagesize));
-  // Check offset == filesize fails.
-  ASSERT_FALSE(memory_.Init(tf_->path, file_size));
-  // Check aligned_offset < filesize, but offset > filesize fails.
-  ASSERT_FALSE(memory_.Init(tf_->path, 2 * pagesize + pagesize / 2 + pagesize / 4));
-}
-
-TEST_F(MemoryFileTest, read_error) {
-  std::string data;
-  for (size_t i = 0; i < 5000; i++) {
-    data += static_cast<char>((i % 10) + '0');
-  }
-  ASSERT_TRUE(android::base::WriteStringToFd(data, tf_->fd));
-
-  std::vector<char> buffer(100);
-
-  // Read before init.
-  ASSERT_FALSE(memory_.ReadFully(0, buffer.data(), 10));
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 0));
-
-  ASSERT_FALSE(memory_.ReadFully(10000, buffer.data(), 10));
-  ASSERT_FALSE(memory_.ReadFully(5000, buffer.data(), 10));
-  ASSERT_FALSE(memory_.ReadFully(4990, buffer.data(), 11));
-  ASSERT_TRUE(memory_.ReadFully(4990, buffer.data(), 10));
-  ASSERT_FALSE(memory_.ReadFully(4999, buffer.data(), 2));
-  ASSERT_TRUE(memory_.ReadFully(4999, buffer.data(), 1));
-
-  // Check that overflow fails properly.
-  ASSERT_FALSE(memory_.ReadFully(UINT64_MAX - 100, buffer.data(), 200));
-}
-
-TEST_F(MemoryFileTest, read_past_file_within_mapping) {
-  size_t pagesize = getpagesize();
-
-  ASSERT_TRUE(pagesize > 100);
-  std::vector<uint8_t> buffer(pagesize - 100);
-  for (size_t i = 0; i < pagesize - 100; i++) {
-    buffer[i] = static_cast<uint8_t>((i % 0x5e) + 0x20);
-  }
-  ASSERT_TRUE(android::base::WriteFully(tf_->fd, buffer.data(), buffer.size()));
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 0));
-
-  for (size_t i = 0; i < 100; i++) {
-    uint8_t value;
-    ASSERT_FALSE(memory_.ReadFully(buffer.size() + i, &value, 1))
-        << "Should have failed at value " << i;
-  }
-}
-
-TEST_F(MemoryFileTest, map_partial_offset_aligned) {
-  size_t pagesize = getpagesize();
-  std::vector<uint8_t> buffer(pagesize * 10);
-  for (size_t i = 0; i < pagesize * 10; i++) {
-    buffer[i] = i / pagesize + 1;
-  }
-  ASSERT_TRUE(android::base::WriteFully(tf_->fd, buffer.data(), buffer.size()));
-
-  // Map in only two pages of the data, and after the first page.
-  ASSERT_TRUE(memory_.Init(tf_->path, pagesize, pagesize * 2));
-
-  std::vector<uint8_t> read_buffer(pagesize * 2);
-  // Make sure that reading after mapped data is a failure.
-  ASSERT_FALSE(memory_.ReadFully(pagesize * 2, read_buffer.data(), 1));
-  ASSERT_TRUE(memory_.ReadFully(0, read_buffer.data(), pagesize * 2));
-  for (size_t i = 0; i < pagesize; i++) {
-    ASSERT_EQ(2, read_buffer[i]) << "Failed at byte " << i;
-  }
-  for (size_t i = pagesize; i < pagesize * 2; i++) {
-    ASSERT_EQ(3, read_buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryFileTest, map_partial_offset_unaligned) {
-  size_t pagesize = getpagesize();
-  ASSERT_TRUE(pagesize > 0x100);
-  std::vector<uint8_t> buffer(pagesize * 10);
-  for (size_t i = 0; i < buffer.size(); i++) {
-    buffer[i] = i / pagesize + 1;
-  }
-  ASSERT_TRUE(android::base::WriteFully(tf_->fd, buffer.data(), buffer.size()));
-
-  // Map in only two pages of the data, and after the first page.
-  ASSERT_TRUE(memory_.Init(tf_->path, pagesize + 0x100, pagesize * 2));
-
-  std::vector<uint8_t> read_buffer(pagesize * 2);
-  // Make sure that reading after mapped data is a failure.
-  ASSERT_FALSE(memory_.ReadFully(pagesize * 2, read_buffer.data(), 1));
-  ASSERT_TRUE(memory_.ReadFully(0, read_buffer.data(), pagesize * 2));
-  for (size_t i = 0; i < pagesize - 0x100; i++) {
-    ASSERT_EQ(2, read_buffer[i]) << "Failed at byte " << i;
-  }
-  for (size_t i = pagesize - 0x100; i < 2 * pagesize - 0x100; i++) {
-    ASSERT_EQ(3, read_buffer[i]) << "Failed at byte " << i;
-  }
-  for (size_t i = 2 * pagesize - 0x100; i < pagesize * 2; i++) {
-    ASSERT_EQ(4, read_buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryFileTest, map_overflow) {
-  size_t pagesize = getpagesize();
-  ASSERT_TRUE(pagesize > 0x100);
-  std::vector<uint8_t> buffer(pagesize * 10);
-  for (size_t i = 0; i < buffer.size(); i++) {
-    buffer[i] = i / pagesize + 1;
-  }
-  ASSERT_TRUE(android::base::WriteFully(tf_->fd, buffer.data(), buffer.size()));
-
-  // Map in only two pages of the data, and after the first page.
-  ASSERT_TRUE(memory_.Init(tf_->path, pagesize + 0x100, UINT64_MAX));
-
-  std::vector<uint8_t> read_buffer(pagesize * 10);
-  ASSERT_FALSE(memory_.ReadFully(pagesize * 9 - 0x100 + 1, read_buffer.data(), 1));
-  ASSERT_TRUE(memory_.ReadFully(0, read_buffer.data(), pagesize * 9 - 0x100));
-}
-
-TEST_F(MemoryFileTest, init_reinit) {
-  size_t pagesize = getpagesize();
-  std::vector<uint8_t> buffer(pagesize * 2);
-  for (size_t i = 0; i < buffer.size(); i++) {
-    buffer[i] = i / pagesize + 1;
-  }
-  ASSERT_TRUE(android::base::WriteFully(tf_->fd, buffer.data(), buffer.size()));
-
-  ASSERT_TRUE(memory_.Init(tf_->path, 0));
-  std::vector<uint8_t> read_buffer(buffer.size());
-  ASSERT_TRUE(memory_.ReadFully(0, read_buffer.data(), pagesize));
-  for (size_t i = 0; i < pagesize; i++) {
-    ASSERT_EQ(1, read_buffer[i]) << "Failed at byte " << i;
-  }
-
-  // Now reinit.
-  ASSERT_TRUE(memory_.Init(tf_->path, pagesize));
-  ASSERT_TRUE(memory_.ReadFully(0, read_buffer.data(), pagesize));
-  for (size_t i = 0; i < pagesize; i++) {
-    ASSERT_EQ(2, read_buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryLocalTest.cpp b/libunwindstack/tests/MemoryLocalTest.cpp
deleted file mode 100644
index c9e5dc0..0000000
--- a/libunwindstack/tests/MemoryLocalTest.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "MemoryLocal.h"
-
-namespace unwindstack {
-
-TEST(MemoryLocalTest, read) {
-  std::vector<uint8_t> src(1024);
-  memset(src.data(), 0x4c, 1024);
-
-  MemoryLocal local;
-
-  std::vector<uint8_t> dst(1024);
-  ASSERT_TRUE(local.ReadFully(reinterpret_cast<uint64_t>(src.data()), dst.data(), 1024));
-  ASSERT_EQ(0, memcmp(src.data(), dst.data(), 1024));
-  for (size_t i = 0; i < 1024; i++) {
-    ASSERT_EQ(0x4cU, dst[i]);
-  }
-
-  memset(src.data(), 0x23, 512);
-  ASSERT_TRUE(local.ReadFully(reinterpret_cast<uint64_t>(src.data()), dst.data(), 1024));
-  ASSERT_EQ(0, memcmp(src.data(), dst.data(), 1024));
-  for (size_t i = 0; i < 512; i++) {
-    ASSERT_EQ(0x23U, dst[i]);
-  }
-  for (size_t i = 512; i < 1024; i++) {
-    ASSERT_EQ(0x4cU, dst[i]);
-  }
-}
-
-TEST(MemoryLocalTest, read_illegal) {
-  MemoryLocal local;
-
-  std::vector<uint8_t> dst(100);
-  ASSERT_FALSE(local.ReadFully(0, dst.data(), 1));
-  ASSERT_FALSE(local.ReadFully(0, dst.data(), 100));
-}
-
-TEST(MemoryLocalTest, read_overflow) {
-  MemoryLocal local;
-
-  // On 32 bit this test doesn't necessarily cause an overflow. The 64 bit
-  // version will always go through the overflow check.
-  std::vector<uint8_t> dst(100);
-  uint64_t value;
-  ASSERT_FALSE(local.ReadFully(reinterpret_cast<uint64_t>(&value), dst.data(), SIZE_MAX));
-}
-
-TEST(MemoryLocalTest, Read) {
-  char* mapping = static_cast<char*>(
-      mmap(nullptr, 2 * getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
-
-  ASSERT_NE(MAP_FAILED, mapping);
-
-  mprotect(mapping + getpagesize(), getpagesize(), PROT_NONE);
-  memset(mapping + getpagesize() - 1024, 0x4c, 1024);
-
-  MemoryLocal local;
-
-  std::vector<uint8_t> dst(4096);
-  ASSERT_EQ(1024U, local.Read(reinterpret_cast<uint64_t>(mapping + getpagesize() - 1024),
-                              dst.data(), 4096));
-  for (size_t i = 0; i < 1024; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_EQ(0, munmap(mapping, 2 * getpagesize()));
-}
-
-TEST(MemoryLocalTest, read_hole) {
-  void* mapping =
-      mmap(nullptr, 3 * 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-  ASSERT_NE(MAP_FAILED, mapping);
-  memset(mapping, 0xFF, 3 * 4096);
-  mprotect(static_cast<char*>(mapping) + 4096, 4096, PROT_NONE);
-
-  MemoryLocal local;
-  std::vector<uint8_t> dst(4096 * 3, 0xCC);
-  ASSERT_EQ(4096U, local.Read(reinterpret_cast<uintptr_t>(mapping), dst.data(), 4096 * 3));
-  for (size_t i = 0; i < 4096; ++i) {
-    ASSERT_EQ(0xFF, dst[i]);
-  }
-  for (size_t i = 4096; i < 4096 * 3; ++i) {
-    ASSERT_EQ(0xCC, dst[i]);
-  }
-  ASSERT_EQ(0, munmap(mapping, 3 * 4096));
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryOfflineBufferTest.cpp b/libunwindstack/tests/MemoryOfflineBufferTest.cpp
deleted file mode 100644
index 9531708..0000000
--- a/libunwindstack/tests/MemoryOfflineBufferTest.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "LogFake.h"
-#include "MemoryOfflineBuffer.h"
-
-namespace unwindstack {
-
-class MemoryOfflineBufferTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    ResetLogs();
-    memory_.reset(new MemoryOfflineBuffer(buffer_.data(), kStart, kEnd));
-  }
-
-  static void SetUpTestSuite() {
-    buffer_.resize(kLength);
-    for (size_t i = 0; i < kLength; i++) {
-      buffer_[i] = i % 189;
-    }
-  }
-
-  std::unique_ptr<MemoryOfflineBuffer> memory_;
-
-  static constexpr size_t kLength = 0x2000;
-  static constexpr uint64_t kStart = 0x1000;
-  static constexpr uint64_t kEnd = kStart + kLength;
-  static std::vector<uint8_t> buffer_;
-};
-
-std::vector<uint8_t> MemoryOfflineBufferTest::buffer_;
-
-static void VerifyBuffer(uint8_t* buffer, size_t start_value, size_t length) {
-  for (size_t i = 0; i < length; i++) {
-    ASSERT_EQ((start_value + i) % 189, buffer[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryOfflineBufferTest, read_out_of_bounds) {
-  std::vector<uint8_t> buffer(1024);
-  ASSERT_FALSE(memory_->ReadFully(0, buffer.data(), 1));
-  ASSERT_FALSE(memory_->ReadFully(0xfff, buffer.data(), 1));
-  ASSERT_FALSE(memory_->ReadFully(0xfff, buffer.data(), 2));
-  ASSERT_FALSE(memory_->ReadFully(0x3000, buffer.data(), 1));
-  ASSERT_FALSE(memory_->ReadFully(0x3001, buffer.data(), 1));
-}
-
-TEST_F(MemoryOfflineBufferTest, read) {
-  std::vector<uint8_t> buffer(1024);
-  ASSERT_TRUE(memory_->ReadFully(kStart, buffer.data(), 10));
-  ASSERT_NO_FATAL_FAILURE(VerifyBuffer(buffer.data(), 0, 10));
-
-  ASSERT_TRUE(memory_->ReadFully(kStart + 555, buffer.data(), 40));
-  ASSERT_NO_FATAL_FAILURE(VerifyBuffer(buffer.data(), 555, 40));
-
-  ASSERT_TRUE(memory_->ReadFully(kStart + kLength - 105, buffer.data(), 105));
-  ASSERT_NO_FATAL_FAILURE(VerifyBuffer(buffer.data(), kLength - 105, 105));
-}
-
-TEST_F(MemoryOfflineBufferTest, read_past_end) {
-  std::vector<uint8_t> buffer(1024);
-  ASSERT_EQ(100U, memory_->Read(kStart + kLength - 100, buffer.data(), buffer.size()));
-  VerifyBuffer(buffer.data(), kLength - 100, 100);
-}
-
-TEST_F(MemoryOfflineBufferTest, read_after_reset) {
-  std::vector<uint8_t> buffer(1024);
-  ASSERT_TRUE(memory_->ReadFully(kStart, buffer.data(), 100));
-  ASSERT_NO_FATAL_FAILURE(VerifyBuffer(buffer.data(), 0, 100));
-
-  memory_->Reset(&buffer_[10], 0x12000, 0x13000);
-  ASSERT_TRUE(memory_->ReadFully(0x12000, buffer.data(), 100));
-  ASSERT_NO_FATAL_FAILURE(VerifyBuffer(buffer.data(), 10, 100));
-
-  ASSERT_EQ(50U, memory_->Read(0x13000 - 50, buffer.data(), buffer.size()));
-  ASSERT_NO_FATAL_FAILURE(VerifyBuffer(buffer.data(), 0x1000 - 50 + 10, 50));
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryOfflineTest.cpp b/libunwindstack/tests/MemoryOfflineTest.cpp
deleted file mode 100644
index d0c441b..0000000
--- a/libunwindstack/tests/MemoryOfflineTest.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <android-base/file.h>
-
-#include "MemoryOffline.h"
-
-namespace unwindstack {
-
-class MemoryOfflineTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    for (size_t i = 0; i < 1024; ++i) {
-      data.push_back(i & 0xff);
-    }
-
-    ASSERT_TRUE(android::base::WriteFully(temp_file.fd, &offset, sizeof(offset)));
-    ASSERT_TRUE(android::base::WriteFully(temp_file.fd, data.data(), data.size()));
-
-    memory = std::make_unique<MemoryOffline>();
-    ASSERT_TRUE(memory != nullptr);
-
-    ASSERT_TRUE(memory->Init(temp_file.path, 0));
-  }
-
-  TemporaryFile temp_file;
-  uint64_t offset = 4096;
-  std::vector<char> data;
-  std::unique_ptr<MemoryOffline> memory;
-};
-
-TEST_F(MemoryOfflineTest, read_boundaries) {
-  char buf = '\0';
-  ASSERT_EQ(0U, memory->Read(offset - 1, &buf, 1));
-  ASSERT_EQ(0U, memory->Read(offset + data.size(), &buf, 1));
-  ASSERT_EQ(1U, memory->Read(offset, &buf, 1));
-  ASSERT_EQ(buf, data.front());
-  ASSERT_EQ(1U, memory->Read(offset + data.size() - 1, &buf, 1));
-  ASSERT_EQ(buf, data.back());
-}
-
-TEST_F(MemoryOfflineTest, read_values) {
-  std::vector<char> buf;
-  buf.resize(2 * data.size());
-  ASSERT_EQ(data.size(), memory->Read(offset, buf.data(), buf.size()));
-  buf.resize(data.size());
-  ASSERT_EQ(buf, data);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryRangeTest.cpp b/libunwindstack/tests/MemoryRangeTest.cpp
deleted file mode 100644
index 2d4f141..0000000
--- a/libunwindstack/tests/MemoryRangeTest.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "MemoryFake.h"
-#include "MemoryRange.h"
-
-namespace unwindstack {
-
-class MemoryRangeTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    process_memory_.reset();
-    memory_fake_ = new MemoryFake;
-    process_memory_.reset(memory_fake_);
-  }
-
-  std::shared_ptr<Memory> process_memory_;
-  MemoryFake* memory_fake_ = nullptr;
-};
-
-TEST_F(MemoryRangeTest, read_fully) {
-  memory_fake_->SetMemoryBlock(9000, 2048, 0x4c);
-
-  MemoryRange range(process_memory_, 9001, 1024, 0);
-
-  std::vector<uint8_t> dst(1024);
-  ASSERT_TRUE(range.ReadFully(0, dst.data(), dst.size()));
-  for (size_t i = 0; i < dst.size(); i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryRangeTest, read_fully_near_limit) {
-  memory_fake_->SetMemoryBlock(0, 8192, 0x4c);
-
-  MemoryRange range(process_memory_, 1000, 1024, 0);
-
-  std::vector<uint8_t> dst(1024);
-  ASSERT_TRUE(range.ReadFully(1020, dst.data(), 4));
-  for (size_t i = 0; i < 4; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-
-  // Verify that reads outside of the range will fail.
-  ASSERT_FALSE(range.ReadFully(1020, dst.data(), 5));
-  ASSERT_FALSE(range.ReadFully(1024, dst.data(), 1));
-  ASSERT_FALSE(range.ReadFully(1024, dst.data(), 1024));
-
-  // Verify that reading up to the end works.
-  ASSERT_TRUE(range.ReadFully(1020, dst.data(), 4));
-}
-
-TEST_F(MemoryRangeTest, read_fully_overflow) {
-  std::vector<uint8_t> buffer(100);
-
-  std::shared_ptr<Memory> process_memory(new MemoryFakeAlwaysReadZero);
-  std::unique_ptr<MemoryRange> overflow(new MemoryRange(process_memory, 100, 200, 0));
-  ASSERT_FALSE(overflow->ReadFully(UINT64_MAX - 10, buffer.data(), 100));
-}
-
-TEST_F(MemoryRangeTest, read) {
-  memory_fake_->SetMemoryBlock(0, 4096, 0x4c);
-
-  MemoryRange range(process_memory_, 1000, 1024, 0);
-
-  std::vector<uint8_t> dst(1024);
-  ASSERT_EQ(4U, range.Read(1020, dst.data(), dst.size()));
-  for (size_t i = 0; i < 4; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryRangeTest, read_non_zero_offset) {
-  memory_fake_->SetMemoryBlock(1000, 1024, 0x12);
-
-  MemoryRange range(process_memory_, 1000, 1024, 400);
-
-  std::vector<uint8_t> dst(1024);
-  ASSERT_EQ(1024U, range.Read(400, dst.data(), dst.size()));
-  for (size_t i = 0; i < dst.size(); i++) {
-    ASSERT_EQ(0x12U, dst[i]) << "Failed at byte " << i;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryRangesTest.cpp b/libunwindstack/tests/MemoryRangesTest.cpp
deleted file mode 100644
index e4e9fc4..0000000
--- a/libunwindstack/tests/MemoryRangesTest.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "MemoryFake.h"
-#include "MemoryRange.h"
-
-namespace unwindstack {
-
-class MemoryRangesTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    MemoryFake* memory = new MemoryFake;
-    process_memory_.reset(memory);
-    memory->SetMemoryBlock(1000, 5000, 0x15);
-    memory->SetMemoryBlock(6000, 12000, 0x26);
-    memory->SetMemoryBlock(14000, 20000, 0x37);
-    memory->SetMemoryBlock(20000, 22000, 0x48);
-
-    ranges_.reset(new MemoryRanges);
-    ranges_->Insert(new MemoryRange(process_memory_, 15000, 100, 4000));
-    ranges_->Insert(new MemoryRange(process_memory_, 10000, 2000, 2000));
-    ranges_->Insert(new MemoryRange(process_memory_, 3000, 1000, 0));
-    ranges_->Insert(new MemoryRange(process_memory_, 19000, 1000, 6000));
-    ranges_->Insert(new MemoryRange(process_memory_, 20000, 1000, 7000));
-  }
-
-  std::shared_ptr<Memory> process_memory_;
-  std::unique_ptr<MemoryRanges> ranges_;
-};
-
-TEST_F(MemoryRangesTest, read) {
-  std::vector<uint8_t> dst(2000);
-  size_t bytes = ranges_->Read(0, dst.data(), dst.size());
-  ASSERT_EQ(1000UL, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x15U, dst[i]) << "Failed at byte " << i;
-  }
-
-  bytes = ranges_->Read(2000, dst.data(), dst.size());
-  ASSERT_EQ(2000UL, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x26U, dst[i]) << "Failed at byte " << i;
-  }
-
-  bytes = ranges_->Read(4000, dst.data(), dst.size());
-  ASSERT_EQ(100UL, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x37U, dst[i]) << "Failed at byte " << i;
-  }
-}
-
-TEST_F(MemoryRangesTest, read_fail) {
-  std::vector<uint8_t> dst(4096);
-  ASSERT_EQ(0UL, ranges_->Read(1000, dst.data(), dst.size()));
-  ASSERT_EQ(0UL, ranges_->Read(5000, dst.data(), dst.size()));
-  ASSERT_EQ(0UL, ranges_->Read(8000, dst.data(), dst.size()));
-}
-
-TEST_F(MemoryRangesTest, read_across_ranges) {
-  // The MemoryRanges object does not support reading across a range,
-  // so this will only read in the first range.
-  std::vector<uint8_t> dst(4096);
-  size_t bytes = ranges_->Read(6000, dst.data(), dst.size());
-  ASSERT_EQ(1000UL, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x37U, dst[i]) << "Failed at byte " << i;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryRemoteTest.cpp b/libunwindstack/tests/MemoryRemoteTest.cpp
deleted file mode 100644
index c90dedc..0000000
--- a/libunwindstack/tests/MemoryRemoteTest.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <errno.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <vector>
-
-#include <android-base/test_utils.h>
-#include <android-base/file.h>
-#include <gtest/gtest.h>
-
-#include "MemoryRemote.h"
-
-#include "MemoryFake.h"
-#include "TestUtils.h"
-
-namespace unwindstack {
-
-class MemoryRemoteTest : public ::testing::Test {
- protected:
-  static bool Attach(pid_t pid) {
-    if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) {
-      return false;
-    }
-
-    return TestQuiescePid(pid);
-  }
-
-  static bool Detach(pid_t pid) {
-    return ptrace(PTRACE_DETACH, pid, 0, 0) == 0;
-  }
-
-  static constexpr size_t NS_PER_SEC = 1000000000ULL;
-};
-
-TEST_F(MemoryRemoteTest, read) {
-  std::vector<uint8_t> src(1024);
-  memset(src.data(), 0x4c, 1024);
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true);
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-
-  std::vector<uint8_t> dst(1024);
-  ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src.data()), dst.data(), 1024));
-  for (size_t i = 0; i < 1024; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_TRUE(Detach(pid));
-}
-
-TEST_F(MemoryRemoteTest, read_large) {
-  static constexpr size_t kTotalPages = 245;
-  std::vector<uint8_t> src(kTotalPages * getpagesize());
-  for (size_t i = 0; i < kTotalPages; i++) {
-    memset(&src[i * getpagesize()], i, getpagesize());
-  }
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true)
-      ;
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-
-  std::vector<uint8_t> dst(kTotalPages * getpagesize());
-  ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src.data()), dst.data(), src.size()));
-  for (size_t i = 0; i < kTotalPages * getpagesize(); i++) {
-    ASSERT_EQ(i / getpagesize(), dst[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_TRUE(Detach(pid));
-}
-
-TEST_F(MemoryRemoteTest, read_partial) {
-  char* mapping = static_cast<char*>(
-      mmap(nullptr, 4 * getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
-  ASSERT_NE(MAP_FAILED, mapping);
-  memset(mapping, 0x4c, 4 * getpagesize());
-  ASSERT_EQ(0, mprotect(mapping + getpagesize(), getpagesize(), PROT_NONE));
-  ASSERT_EQ(0, munmap(mapping + 3 * getpagesize(), getpagesize()));
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true)
-      ;
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  // Unmap from our process.
-  ASSERT_EQ(0, munmap(mapping, 3 * getpagesize()));
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-
-  std::vector<uint8_t> dst(4096);
-  size_t bytes =
-      remote.Read(reinterpret_cast<uint64_t>(mapping + getpagesize() - 1024), dst.data(), 4096);
-  // Some read methods can read PROT_NONE maps, allow that.
-  ASSERT_LE(1024U, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-
-  // Now verify that reading stops at the end of a map.
-  bytes =
-      remote.Read(reinterpret_cast<uint64_t>(mapping + 3 * getpagesize() - 1024), dst.data(), 4096);
-  ASSERT_EQ(1024U, bytes);
-  for (size_t i = 0; i < bytes; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_TRUE(Detach(pid));
-}
-
-TEST_F(MemoryRemoteTest, read_fail) {
-  int pagesize = getpagesize();
-  void* src = mmap(nullptr, pagesize * 2, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE,-1, 0);
-  memset(src, 0x4c, pagesize * 2);
-  ASSERT_NE(MAP_FAILED, src);
-  // Put a hole right after the first page.
-  ASSERT_EQ(0, munmap(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(src) + pagesize),
-                      pagesize));
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true);
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-
-  std::vector<uint8_t> dst(pagesize);
-  ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src), dst.data(), pagesize));
-  for (size_t i = 0; i < 1024; i++) {
-    ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
-  }
-
-  ASSERT_FALSE(remote.ReadFully(reinterpret_cast<uint64_t>(src) + pagesize, dst.data(), 1));
-  ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src) + pagesize - 1, dst.data(), 1));
-  ASSERT_FALSE(remote.ReadFully(reinterpret_cast<uint64_t>(src) + pagesize - 4, dst.data(), 8));
-
-  // Check overflow condition is caught properly.
-  ASSERT_FALSE(remote.ReadFully(UINT64_MAX - 100, dst.data(), 200));
-
-  ASSERT_EQ(0, munmap(src, pagesize));
-
-  ASSERT_TRUE(Detach(pid));
-}
-
-TEST_F(MemoryRemoteTest, read_overflow) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true)
-      ;
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-
-  // Check overflow condition is caught properly.
-  std::vector<uint8_t> dst(200);
-  ASSERT_FALSE(remote.ReadFully(UINT64_MAX - 100, dst.data(), 200));
-
-  ASSERT_TRUE(Detach(pid));
-}
-
-TEST_F(MemoryRemoteTest, read_illegal) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true);
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-
-  std::vector<uint8_t> dst(100);
-  ASSERT_FALSE(remote.ReadFully(0, dst.data(), 1));
-  ASSERT_FALSE(remote.ReadFully(0, dst.data(), 100));
-
-  ASSERT_TRUE(Detach(pid));
-}
-
-TEST_F(MemoryRemoteTest, read_mprotect_hole) {
-  size_t page_size = getpagesize();
-  void* mapping =
-      mmap(nullptr, 3 * getpagesize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-  ASSERT_NE(MAP_FAILED, mapping);
-  memset(mapping, 0xFF, 3 * page_size);
-  ASSERT_EQ(0, mprotect(static_cast<char*>(mapping) + page_size, page_size, PROT_NONE));
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true);
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_EQ(0, munmap(mapping, 3 * page_size));
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-  std::vector<uint8_t> dst(getpagesize() * 4, 0xCC);
-  size_t read_size = remote.Read(reinterpret_cast<uint64_t>(mapping), dst.data(), page_size * 3);
-  // Some read methods can read PROT_NONE maps, allow that.
-  ASSERT_LE(page_size, read_size);
-  for (size_t i = 0; i < read_size; ++i) {
-    ASSERT_EQ(0xFF, dst[i]);
-  }
-  for (size_t i = read_size; i < dst.size(); ++i) {
-    ASSERT_EQ(0xCC, dst[i]);
-  }
-}
-
-TEST_F(MemoryRemoteTest, read_munmap_hole) {
-  size_t page_size = getpagesize();
-  void* mapping =
-      mmap(nullptr, 3 * getpagesize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-  ASSERT_NE(MAP_FAILED, mapping);
-  memset(mapping, 0xFF, 3 * page_size);
-  ASSERT_EQ(0, munmap(static_cast<char*>(mapping) + page_size, page_size));
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true)
-      ;
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_EQ(0, munmap(mapping, page_size));
-  ASSERT_EQ(0, munmap(static_cast<char*>(mapping) + 2 * page_size, page_size));
-
-  ASSERT_TRUE(Attach(pid));
-
-  MemoryRemote remote(pid);
-  std::vector<uint8_t> dst(getpagesize() * 4, 0xCC);
-  size_t read_size = remote.Read(reinterpret_cast<uint64_t>(mapping), dst.data(), page_size * 3);
-  ASSERT_EQ(page_size, read_size);
-  for (size_t i = 0; i < read_size; ++i) {
-    ASSERT_EQ(0xFF, dst[i]);
-  }
-  for (size_t i = read_size; i < dst.size(); ++i) {
-    ASSERT_EQ(0xCC, dst[i]);
-  }
-}
-
-// Verify that the memory remote object chooses a memory read function
-// properly. Either process_vm_readv or ptrace.
-TEST_F(MemoryRemoteTest, read_choose_correctly) {
-  size_t page_size = getpagesize();
-  void* mapping =
-      mmap(nullptr, 2 * getpagesize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-  ASSERT_NE(MAP_FAILED, mapping);
-  memset(mapping, 0xFC, 2 * page_size);
-  ASSERT_EQ(0, mprotect(static_cast<char*>(mapping), page_size, PROT_NONE));
-
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    while (true)
-      ;
-    exit(1);
-  }
-  ASSERT_LT(0, pid);
-  TestScopedPidReaper reap(pid);
-
-  ASSERT_EQ(0, munmap(mapping, 2 * page_size));
-
-  ASSERT_TRUE(Attach(pid));
-
-  // We know that process_vm_readv of a mprotect'd PROT_NONE region will fail.
-  // Read from the PROT_NONE area first to force the choice of ptrace.
-  MemoryRemote remote_ptrace(pid);
-  uint32_t value;
-  size_t bytes = remote_ptrace.Read(reinterpret_cast<uint64_t>(mapping), &value, sizeof(value));
-  ASSERT_EQ(sizeof(value), bytes);
-  ASSERT_EQ(0xfcfcfcfcU, value);
-  bytes = remote_ptrace.Read(reinterpret_cast<uint64_t>(mapping) + page_size, &value, sizeof(value));
-  ASSERT_EQ(sizeof(value), bytes);
-  ASSERT_EQ(0xfcfcfcfcU, value);
-  bytes = remote_ptrace.Read(reinterpret_cast<uint64_t>(mapping), &value, sizeof(value));
-  ASSERT_EQ(sizeof(value), bytes);
-  ASSERT_EQ(0xfcfcfcfcU, value);
-
-  // Now verify that choosing process_vm_readv results in failing reads of
-  // the PROT_NONE part of the map. Read from a valid map first which
-  // should prefer process_vm_readv, and keep that as the read function.
-  MemoryRemote remote_readv(pid);
-  bytes = remote_readv.Read(reinterpret_cast<uint64_t>(mapping) + page_size, &value, sizeof(value));
-  ASSERT_EQ(sizeof(value), bytes);
-  ASSERT_EQ(0xfcfcfcfcU, value);
-  bytes = remote_readv.Read(reinterpret_cast<uint64_t>(mapping), &value, sizeof(value));
-  ASSERT_EQ(0U, bytes);
-  bytes = remote_readv.Read(reinterpret_cast<uint64_t>(mapping) + page_size, &value, sizeof(value));
-  ASSERT_EQ(sizeof(value), bytes);
-  ASSERT_EQ(0xfcfcfcfcU, value);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/MemoryTest.cpp b/libunwindstack/tests/MemoryTest.cpp
deleted file mode 100644
index 3655984..0000000
--- a/libunwindstack/tests/MemoryTest.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#include <string>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Memory.h>
-
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-TEST(MemoryTest, read32) {
-  MemoryFakeAlwaysReadZero memory;
-
-  uint32_t data = 0xffffffff;
-  ASSERT_TRUE(memory.Read32(0, &data));
-  ASSERT_EQ(0U, data);
-}
-
-TEST(MemoryTest, read64) {
-  MemoryFakeAlwaysReadZero memory;
-
-  uint64_t data = 0xffffffffffffffffULL;
-  ASSERT_TRUE(memory.Read64(0, &data));
-  ASSERT_EQ(0U, data);
-}
-
-struct FakeStruct {
-  int one;
-  bool two;
-  uint32_t three;
-  uint64_t four;
-};
-
-TEST(MemoryTest, read_string) {
-  std::string name("string_in_memory");
-
-  MemoryFake memory;
-
-  memory.SetMemory(100, name.c_str(), name.size() + 1);
-
-  std::string dst_name;
-  ASSERT_TRUE(memory.ReadString(100, &dst_name));
-  ASSERT_EQ("string_in_memory", dst_name);
-
-  ASSERT_TRUE(memory.ReadString(107, &dst_name));
-  ASSERT_EQ("in_memory", dst_name);
-
-  // Set size greater than string.
-  ASSERT_TRUE(memory.ReadString(107, &dst_name, 10));
-  ASSERT_EQ("in_memory", dst_name);
-
-  ASSERT_FALSE(memory.ReadString(107, &dst_name, 9));
-}
-
-TEST(MemoryTest, read_string_error) {
-  std::string name("short");
-
-  MemoryFake memory;
-
-  // Save everything except the terminating '\0'.
-  memory.SetMemory(0, name.c_str(), name.size());
-
-  std::string dst_name;
-  // Read from a non-existant address.
-  ASSERT_FALSE(memory.ReadString(100, &dst_name));
-
-  // This should fail because there is no terminating '\0'.
-  ASSERT_FALSE(memory.ReadString(0, &dst_name));
-
-  // This should pass because there is a terminating '\0'.
-  memory.SetData8(name.size(), '\0');
-  ASSERT_TRUE(memory.ReadString(0, &dst_name));
-  ASSERT_EQ("short", dst_name);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/RegsFake.h b/libunwindstack/tests/RegsFake.h
deleted file mode 100644
index 207d46e..0000000
--- a/libunwindstack/tests/RegsFake.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef _LIBUNWINDSTACK_TESTS_REGS_FAKE_H
-#define _LIBUNWINDSTACK_TESTS_REGS_FAKE_H
-
-#include <stdint.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-
-#include "Check.h"
-
-namespace unwindstack {
-
-class RegsFake : public Regs {
- public:
-  RegsFake(uint16_t total_regs) : Regs(total_regs, Regs::Location(Regs::LOCATION_UNKNOWN, 0)) {}
-  virtual ~RegsFake() = default;
-
-  ArchEnum Arch() override { return fake_arch_; }
-  void* RawData() override { return nullptr; }
-  uint64_t pc() override { return fake_pc_; }
-  uint64_t sp() override { return fake_sp_; }
-  void set_pc(uint64_t pc) override { fake_pc_ = pc; }
-  void set_sp(uint64_t sp) override { fake_sp_ = sp; }
-
-  bool SetPcFromReturnAddress(Memory*) override {
-    if (!fake_return_address_valid_) {
-      return false;
-    }
-    fake_pc_ = fake_return_address_;
-    return true;
-  }
-
-  void IterateRegisters(std::function<void(const char*, uint64_t)>) override {}
-
-  bool Is32Bit() {
-    CHECK(fake_arch_ != ARCH_UNKNOWN);
-    return fake_arch_ == ARCH_ARM || fake_arch_ == ARCH_X86 || fake_arch_ == ARCH_MIPS;
-  }
-
-  uint64_t GetPcAdjustment(uint64_t, Elf*) override { return 2; }
-
-  bool StepIfSignalHandler(uint64_t, Elf*, Memory*) override { return false; }
-
-  void FakeSetArch(ArchEnum arch) { fake_arch_ = arch; }
-  void FakeSetDexPc(uint64_t dex_pc) { dex_pc_ = dex_pc; }
-  void FakeSetReturnAddress(uint64_t return_address) { fake_return_address_ = return_address; }
-  void FakeSetReturnAddressValid(bool valid) { fake_return_address_valid_ = valid; }
-
-  Regs* Clone() override { return nullptr; }
-
- private:
-  ArchEnum fake_arch_ = ARCH_UNKNOWN;
-  uint64_t fake_pc_ = 0;
-  uint64_t fake_sp_ = 0;
-  bool fake_return_address_valid_ = false;
-  uint64_t fake_return_address_ = 0;
-};
-
-template <typename TypeParam>
-class RegsImplFake : public RegsImpl<TypeParam> {
- public:
-  RegsImplFake(uint16_t total_regs)
-      : RegsImpl<TypeParam>(total_regs, Regs::Location(Regs::LOCATION_UNKNOWN, 0)) {}
-  virtual ~RegsImplFake() = default;
-
-  ArchEnum Arch() override { return ARCH_UNKNOWN; }
-  uint64_t pc() override { return fake_pc_; }
-  uint64_t sp() override { return fake_sp_; }
-  void set_pc(uint64_t pc) override { fake_pc_ = pc; }
-  void set_sp(uint64_t sp) override { fake_sp_ = sp; }
-
-  uint64_t GetPcAdjustment(uint64_t, Elf*) override { return 0; }
-  bool SetPcFromReturnAddress(Memory*) override { return false; }
-  bool StepIfSignalHandler(uint64_t, Elf*, Memory*) override { return false; }
-
-  Regs* Clone() override { return nullptr; }
-
- private:
-  uint64_t fake_pc_ = 0;
-  uint64_t fake_sp_ = 0;
-};
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_TESTS_REGS_FAKE_H
diff --git a/libunwindstack/tests/RegsInfoTest.cpp b/libunwindstack/tests/RegsInfoTest.cpp
deleted file mode 100644
index a6bc2c5..0000000
--- a/libunwindstack/tests/RegsInfoTest.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Regs.h>
-
-#include "RegsFake.h"
-#include "RegsInfo.h"
-
-namespace unwindstack {
-
-TEST(RegsInfoTest, single_uint32_t) {
-  RegsImplFake<uint32_t> regs(10);
-  RegsInfo<uint32_t> info(&regs);
-
-  regs[1] = 0x100;
-  ASSERT_FALSE(info.IsSaved(1));
-  ASSERT_EQ(0x100U, info.Get(1));
-  ASSERT_EQ(10, info.Total());
-
-  uint32_t* value = info.Save(1);
-  ASSERT_EQ(value, &regs[1]);
-  regs[1] = 0x200;
-  ASSERT_TRUE(info.IsSaved(1));
-  ASSERT_EQ(0x100U, info.Get(1));
-  ASSERT_EQ(0x200U, regs[1]);
-}
-
-TEST(RegsInfoTest, single_uint64_t) {
-  RegsImplFake<uint64_t> regs(20);
-  RegsInfo<uint64_t> info(&regs);
-
-  regs[3] = 0x300;
-  ASSERT_FALSE(info.IsSaved(3));
-  ASSERT_EQ(0x300U, info.Get(3));
-  ASSERT_EQ(20, info.Total());
-
-  uint64_t* value = info.Save(3);
-  ASSERT_EQ(value, &regs[3]);
-  regs[3] = 0x400;
-  ASSERT_TRUE(info.IsSaved(3));
-  ASSERT_EQ(0x300U, info.Get(3));
-  ASSERT_EQ(0x400U, regs[3]);
-}
-
-TEST(RegsInfoTest, all) {
-  RegsImplFake<uint64_t> regs(64);
-  RegsInfo<uint64_t> info(&regs);
-
-  for (uint32_t i = 0; i < 64; i++) {
-    regs[i] = i * 0x100;
-    ASSERT_EQ(i * 0x100, info.Get(i)) << "Reg " + std::to_string(i) + " failed.";
-  }
-
-  for (uint32_t i = 0; i < 64; i++) {
-    ASSERT_FALSE(info.IsSaved(i)) << "Reg " + std::to_string(i) + " failed.";
-    uint64_t* reg = info.Save(i);
-    ASSERT_EQ(reg, &regs[i]) << "Reg " + std::to_string(i) + " failed.";
-    *reg = i * 0x1000 + 0x100;
-    ASSERT_EQ(i * 0x1000 + 0x100, regs[i]) << "Reg " + std::to_string(i) + " failed.";
-  }
-
-  for (uint32_t i = 0; i < 64; i++) {
-    ASSERT_TRUE(info.IsSaved(i)) << "Reg " + std::to_string(i) + " failed.";
-    ASSERT_EQ(i * 0x100, info.Get(i)) << "Reg " + std::to_string(i) + " failed.";
-  }
-}
-
-TEST(RegsInfoTest, invalid_register) {
-  RegsImplFake<uint64_t> regs(64);
-  RegsInfo<uint64_t> info(&regs);
-
-  EXPECT_DEATH(info.Save(RegsInfo<uint64_t>::MAX_REGISTERS), "");
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/RegsIterateTest.cpp b/libunwindstack/tests/RegsIterateTest.cpp
deleted file mode 100644
index 47e605a..0000000
--- a/libunwindstack/tests/RegsIterateTest.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <utility>
-#include <type_traits>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/MachineArm64.h>
-#include <unwindstack/MachineMips.h>
-#include <unwindstack/MachineMips64.h>
-#include <unwindstack/MachineX86.h>
-#include <unwindstack/MachineX86_64.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/RegsMips.h>
-#include <unwindstack/RegsMips64.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/RegsX86_64.h>
-
-namespace unwindstack {
-
-struct Register {
-  std::string expected_name;
-  uint64_t offset;
-
-  bool operator==(const Register& rhs) const {
-    return std::tie(expected_name, offset) == std::tie(rhs.expected_name, rhs.offset);
-  }
-};
-
-template<typename T>
-class RegsIterateTest : public ::testing::Test {
-};
-
-template<typename RegsType>
-std::vector<Register> ExpectedRegisters();
-
-template<>
-std::vector<Register> ExpectedRegisters<RegsArm>() {
-  std::vector<Register> result;
-  result.push_back({"r0", ARM_REG_R0});
-  result.push_back({"r1", ARM_REG_R1});
-  result.push_back({"r2", ARM_REG_R2});
-  result.push_back({"r3", ARM_REG_R3});
-  result.push_back({"r4", ARM_REG_R4});
-  result.push_back({"r5", ARM_REG_R5});
-  result.push_back({"r6", ARM_REG_R6});
-  result.push_back({"r7", ARM_REG_R7});
-  result.push_back({"r8", ARM_REG_R8});
-  result.push_back({"r9", ARM_REG_R9});
-  result.push_back({"r10", ARM_REG_R10});
-  result.push_back({"r11", ARM_REG_R11});
-  result.push_back({"ip", ARM_REG_R12});
-  result.push_back({"sp", ARM_REG_SP});
-  result.push_back({"lr", ARM_REG_LR});
-  result.push_back({"pc", ARM_REG_PC});
-  return result;
-}
-
-template<>
-std::vector<Register> ExpectedRegisters<RegsArm64>() {
-  std::vector<Register> result;
-  result.push_back({"x0", ARM64_REG_R0});
-  result.push_back({"x1", ARM64_REG_R1});
-  result.push_back({"x2", ARM64_REG_R2});
-  result.push_back({"x3", ARM64_REG_R3});
-  result.push_back({"x4", ARM64_REG_R4});
-  result.push_back({"x5", ARM64_REG_R5});
-  result.push_back({"x6", ARM64_REG_R6});
-  result.push_back({"x7", ARM64_REG_R7});
-  result.push_back({"x8", ARM64_REG_R8});
-  result.push_back({"x9", ARM64_REG_R9});
-  result.push_back({"x10", ARM64_REG_R10});
-  result.push_back({"x11", ARM64_REG_R11});
-  result.push_back({"x12", ARM64_REG_R12});
-  result.push_back({"x13", ARM64_REG_R13});
-  result.push_back({"x14", ARM64_REG_R14});
-  result.push_back({"x15", ARM64_REG_R15});
-  result.push_back({"x16", ARM64_REG_R16});
-  result.push_back({"x17", ARM64_REG_R17});
-  result.push_back({"x18", ARM64_REG_R18});
-  result.push_back({"x19", ARM64_REG_R19});
-  result.push_back({"x20", ARM64_REG_R20});
-  result.push_back({"x21", ARM64_REG_R21});
-  result.push_back({"x22", ARM64_REG_R22});
-  result.push_back({"x23", ARM64_REG_R23});
-  result.push_back({"x24", ARM64_REG_R24});
-  result.push_back({"x25", ARM64_REG_R25});
-  result.push_back({"x26", ARM64_REG_R26});
-  result.push_back({"x27", ARM64_REG_R27});
-  result.push_back({"x28", ARM64_REG_R28});
-  result.push_back({"x29", ARM64_REG_R29});
-  result.push_back({"lr", ARM64_REG_LR});
-  result.push_back({"sp", ARM64_REG_SP});
-  result.push_back({"pc", ARM64_REG_PC});
-  result.push_back({"pst", ARM64_REG_PSTATE});
-  return result;
-}
-
-template<>
-std::vector<Register> ExpectedRegisters<RegsX86>() {
-  std::vector<Register> result;
-  result.push_back({"eax", X86_REG_EAX});
-  result.push_back({"ebx", X86_REG_EBX});
-  result.push_back({"ecx", X86_REG_ECX});
-  result.push_back({"edx", X86_REG_EDX});
-  result.push_back({"ebp", X86_REG_EBP});
-  result.push_back({"edi", X86_REG_EDI});
-  result.push_back({"esi", X86_REG_ESI});
-  result.push_back({"esp", X86_REG_ESP});
-  result.push_back({"eip", X86_REG_EIP});
-  return result;
-}
-
-template<>
-std::vector<Register> ExpectedRegisters<RegsX86_64>() {
-  std::vector<Register> result;
-  result.push_back({"rax", X86_64_REG_RAX});
-  result.push_back({"rbx", X86_64_REG_RBX});
-  result.push_back({"rcx", X86_64_REG_RCX});
-  result.push_back({"rdx", X86_64_REG_RDX});
-  result.push_back({"r8", X86_64_REG_R8});
-  result.push_back({"r9", X86_64_REG_R9});
-  result.push_back({"r10", X86_64_REG_R10});
-  result.push_back({"r11", X86_64_REG_R11});
-  result.push_back({"r12", X86_64_REG_R12});
-  result.push_back({"r13", X86_64_REG_R13});
-  result.push_back({"r14", X86_64_REG_R14});
-  result.push_back({"r15", X86_64_REG_R15});
-  result.push_back({"rdi", X86_64_REG_RDI});
-  result.push_back({"rsi", X86_64_REG_RSI});
-  result.push_back({"rbp", X86_64_REG_RBP});
-  result.push_back({"rsp", X86_64_REG_RSP});
-  result.push_back({"rip", X86_64_REG_RIP});
-  return result;
-}
-
-template<>
-std::vector<Register> ExpectedRegisters<RegsMips>() {
-  std::vector<Register> result;
-  result.push_back({"r0", MIPS_REG_R0});
-  result.push_back({"r1", MIPS_REG_R1});
-  result.push_back({"r2", MIPS_REG_R2});
-  result.push_back({"r3", MIPS_REG_R3});
-  result.push_back({"r4", MIPS_REG_R4});
-  result.push_back({"r5", MIPS_REG_R5});
-  result.push_back({"r6", MIPS_REG_R6});
-  result.push_back({"r7", MIPS_REG_R7});
-  result.push_back({"r8", MIPS_REG_R8});
-  result.push_back({"r9", MIPS_REG_R9});
-  result.push_back({"r10", MIPS_REG_R10});
-  result.push_back({"r11", MIPS_REG_R11});
-  result.push_back({"r12", MIPS_REG_R12});
-  result.push_back({"r13", MIPS_REG_R13});
-  result.push_back({"r14", MIPS_REG_R14});
-  result.push_back({"r15", MIPS_REG_R15});
-  result.push_back({"r16", MIPS_REG_R16});
-  result.push_back({"r17", MIPS_REG_R17});
-  result.push_back({"r18", MIPS_REG_R18});
-  result.push_back({"r19", MIPS_REG_R19});
-  result.push_back({"r20", MIPS_REG_R20});
-  result.push_back({"r21", MIPS_REG_R21});
-  result.push_back({"r22", MIPS_REG_R22});
-  result.push_back({"r23", MIPS_REG_R23});
-  result.push_back({"r24", MIPS_REG_R24});
-  result.push_back({"r25", MIPS_REG_R25});
-  result.push_back({"r26", MIPS_REG_R26});
-  result.push_back({"r27", MIPS_REG_R27});
-  result.push_back({"r28", MIPS_REG_R28});
-  result.push_back({"sp", MIPS_REG_SP});
-  result.push_back({"r30", MIPS_REG_R30});
-  result.push_back({"ra", MIPS_REG_RA});
-  result.push_back({"pc", MIPS_REG_PC});
-
-  return result;
-}
-
-template<>
-std::vector<Register> ExpectedRegisters<RegsMips64>() {
-  std::vector<Register> result;
-  result.push_back({"r0", MIPS64_REG_R0});
-  result.push_back({"r1", MIPS64_REG_R1});
-  result.push_back({"r2", MIPS64_REG_R2});
-  result.push_back({"r3", MIPS64_REG_R3});
-  result.push_back({"r4", MIPS64_REG_R4});
-  result.push_back({"r5", MIPS64_REG_R5});
-  result.push_back({"r6", MIPS64_REG_R6});
-  result.push_back({"r7", MIPS64_REG_R7});
-  result.push_back({"r8", MIPS64_REG_R8});
-  result.push_back({"r9", MIPS64_REG_R9});
-  result.push_back({"r10", MIPS64_REG_R10});
-  result.push_back({"r11", MIPS64_REG_R11});
-  result.push_back({"r12", MIPS64_REG_R12});
-  result.push_back({"r13", MIPS64_REG_R13});
-  result.push_back({"r14", MIPS64_REG_R14});
-  result.push_back({"r15", MIPS64_REG_R15});
-  result.push_back({"r16", MIPS64_REG_R16});
-  result.push_back({"r17", MIPS64_REG_R17});
-  result.push_back({"r18", MIPS64_REG_R18});
-  result.push_back({"r19", MIPS64_REG_R19});
-  result.push_back({"r20", MIPS64_REG_R20});
-  result.push_back({"r21", MIPS64_REG_R21});
-  result.push_back({"r22", MIPS64_REG_R22});
-  result.push_back({"r23", MIPS64_REG_R23});
-  result.push_back({"r24", MIPS64_REG_R24});
-  result.push_back({"r25", MIPS64_REG_R25});
-  result.push_back({"r26", MIPS64_REG_R26});
-  result.push_back({"r27", MIPS64_REG_R27});
-  result.push_back({"r28", MIPS64_REG_R28});
-  result.push_back({"sp", MIPS64_REG_SP});
-  result.push_back({"r30", MIPS64_REG_R30});
-  result.push_back({"ra", MIPS64_REG_RA});
-  result.push_back({"pc", MIPS64_REG_PC});
-
-  return result;
-}
-
-using RegTypes = ::testing::Types<RegsArm, RegsArm64, RegsX86, RegsX86_64, RegsMips, RegsMips64>;
-TYPED_TEST_SUITE(RegsIterateTest, RegTypes);
-
-TYPED_TEST(RegsIterateTest, iterate) {
-  std::vector<Register> expected = ExpectedRegisters<TypeParam>();
-  TypeParam regs;
-  for (const auto& reg : expected) {
-    regs[reg.offset] = reg.offset;
-  }
-
-  std::vector<Register> actual;
-  regs.IterateRegisters([&actual](const char* name, uint64_t value) {
-    actual.push_back({name, value});
-  });
-
-  ASSERT_EQ(expected, actual);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/RegsStepIfSignalHandlerTest.cpp b/libunwindstack/tests/RegsStepIfSignalHandlerTest.cpp
deleted file mode 100644
index eac12ca..0000000
--- a/libunwindstack/tests/RegsStepIfSignalHandlerTest.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/MachineArm64.h>
-#include <unwindstack/MachineMips.h>
-#include <unwindstack/MachineMips64.h>
-#include <unwindstack/MachineX86.h>
-#include <unwindstack/MachineX86_64.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/RegsMips.h>
-#include <unwindstack/RegsMips64.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/RegsX86_64.h>
-
-#include "MemoryFake.h"
-
-namespace unwindstack {
-
-class RegsStepIfSignalHandlerTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    elf_memory_ = new MemoryFake;
-    elf_.reset(new Elf(elf_memory_));
-  }
-
-  void ArmStepIfSignalHandlerNonRt(uint32_t pc_data);
-  void ArmStepIfSignalHandlerRt(uint32_t pc_data);
-
-  MemoryFake* elf_memory_;
-  MemoryFake process_memory_;
-  std::unique_ptr<Elf> elf_;
-};
-
-void RegsStepIfSignalHandlerTest::ArmStepIfSignalHandlerNonRt(uint32_t pc_data) {
-  uint64_t addr = 0x1000;
-  RegsArm regs;
-  regs[ARM_REG_PC] = 0x5000;
-  regs[ARM_REG_SP] = addr;
-
-  elf_memory_->SetData32(0x5000, pc_data);
-
-  for (uint64_t index = 0; index <= 30; index++) {
-    process_memory_.SetData32(addr + index * 4, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x5000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x100U, regs[ARM_REG_SP]);
-  EXPECT_EQ(0x120U, regs[ARM_REG_PC]);
-  EXPECT_EQ(0x100U, regs.sp());
-  EXPECT_EQ(0x120U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, arm_step_if_signal_handler_non_rt) {
-  // Form 1
-  ArmStepIfSignalHandlerNonRt(0xe3a07077);
-
-  // Form 2
-  ArmStepIfSignalHandlerNonRt(0xef900077);
-
-  // Form 3
-  ArmStepIfSignalHandlerNonRt(0xdf002777);
-}
-
-void RegsStepIfSignalHandlerTest::ArmStepIfSignalHandlerRt(uint32_t pc_data) {
-  uint64_t addr = 0x1000;
-  RegsArm regs;
-  regs[ARM_REG_PC] = 0x5000;
-  regs[ARM_REG_SP] = addr;
-
-  elf_memory_->SetData32(0x5000, pc_data);
-
-  for (uint64_t index = 0; index <= 100; index++) {
-    process_memory_.SetData32(addr + index * 4, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x5000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x350U, regs[ARM_REG_SP]);
-  EXPECT_EQ(0x370U, regs[ARM_REG_PC]);
-  EXPECT_EQ(0x350U, regs.sp());
-  EXPECT_EQ(0x370U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, arm_step_if_signal_handler_rt) {
-  // Form 1
-  ArmStepIfSignalHandlerRt(0xe3a070ad);
-
-  // Form 2
-  ArmStepIfSignalHandlerRt(0xef9000ad);
-
-  // Form 3
-  ArmStepIfSignalHandlerRt(0xdf0027ad);
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, arm64_step_if_signal_handler) {
-  uint64_t addr = 0x1000;
-  RegsArm64 regs;
-  regs[ARM64_REG_PC] = 0x8000;
-  regs[ARM64_REG_SP] = addr;
-
-  elf_memory_->SetData64(0x8000, 0xd4000001d2801168ULL);
-
-  for (uint64_t index = 0; index <= 100; index++) {
-    process_memory_.SetData64(addr + index * 8, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x8000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x460U, regs[ARM64_REG_SP]);
-  EXPECT_EQ(0x470U, regs[ARM64_REG_PC]);
-  EXPECT_EQ(0x460U, regs.sp());
-  EXPECT_EQ(0x470U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, x86_step_if_signal_handler_no_siginfo) {
-  uint64_t addr = 0xa00;
-  RegsX86 regs;
-  regs[X86_REG_EIP] = 0x4100;
-  regs[X86_REG_ESP] = addr;
-
-  elf_memory_->SetData64(0x4100, 0x80cd00000077b858ULL);
-  for (uint64_t index = 0; index <= 25; index++) {
-    process_memory_.SetData32(addr + index * 4, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x4100, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x70U, regs[X86_REG_EBP]);
-  EXPECT_EQ(0x80U, regs[X86_REG_ESP]);
-  EXPECT_EQ(0x90U, regs[X86_REG_EBX]);
-  EXPECT_EQ(0xa0U, regs[X86_REG_EDX]);
-  EXPECT_EQ(0xb0U, regs[X86_REG_ECX]);
-  EXPECT_EQ(0xc0U, regs[X86_REG_EAX]);
-  EXPECT_EQ(0xf0U, regs[X86_REG_EIP]);
-  EXPECT_EQ(0x80U, regs.sp());
-  EXPECT_EQ(0xf0U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, x86_step_if_signal_handler_siginfo) {
-  uint64_t addr = 0xa00;
-  RegsX86 regs;
-  regs[X86_REG_EIP] = 0x4100;
-  regs[X86_REG_ESP] = addr;
-
-  elf_memory_->SetData64(0x4100, 0x0080cd000000adb8ULL);
-  addr += 8;
-  // Pointer to ucontext data.
-  process_memory_.SetData32(addr, 0x8100);
-
-  addr = 0x8100;
-  for (uint64_t index = 0; index <= 30; index++) {
-    process_memory_.SetData32(addr + index * 4, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x4100, elf_.get(), &process_memory_));
-  EXPECT_EQ(0xb0U, regs[X86_REG_EBP]);
-  EXPECT_EQ(0xc0U, regs[X86_REG_ESP]);
-  EXPECT_EQ(0xd0U, regs[X86_REG_EBX]);
-  EXPECT_EQ(0xe0U, regs[X86_REG_EDX]);
-  EXPECT_EQ(0xf0U, regs[X86_REG_ECX]);
-  EXPECT_EQ(0x100U, regs[X86_REG_EAX]);
-  EXPECT_EQ(0x130U, regs[X86_REG_EIP]);
-  EXPECT_EQ(0xc0U, regs.sp());
-  EXPECT_EQ(0x130U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, x86_64_step_if_signal_handler) {
-  uint64_t addr = 0x500;
-  RegsX86_64 regs;
-  regs[X86_64_REG_RIP] = 0x7000;
-  regs[X86_64_REG_RSP] = addr;
-
-  elf_memory_->SetData64(0x7000, 0x0f0000000fc0c748);
-  elf_memory_->SetData16(0x7008, 0x0f05);
-
-  for (uint64_t index = 0; index <= 30; index++) {
-    process_memory_.SetData64(addr + index * 8, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x7000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x140U, regs[X86_64_REG_RSP]);
-  EXPECT_EQ(0x150U, regs[X86_64_REG_RIP]);
-  EXPECT_EQ(0x140U, regs.sp());
-  EXPECT_EQ(0x150U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, mips_step_if_signal_handler_non_rt) {
-  uint64_t addr = 0x1000;
-  RegsMips regs;
-  regs[MIPS_REG_PC] = 0x8000;
-  regs[MIPS_REG_SP] = addr;
-
-  elf_memory_->SetData64(0x8000, 0x0000000c24021017ULL);
-
-  for (uint64_t index = 0; index <= 50; index++) {
-    process_memory_.SetData64(addr + index * 8, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x8000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x220U, regs[MIPS_REG_SP]);
-  EXPECT_EQ(0x040U, regs[MIPS_REG_PC]);
-  EXPECT_EQ(0x220U, regs.sp());
-  EXPECT_EQ(0x040U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, mips_step_if_signal_handler_rt) {
-  uint64_t addr = 0x1000;
-  RegsMips regs;
-  regs[MIPS_REG_PC] = 0x8000;
-  regs[MIPS_REG_SP] = addr;
-
-  elf_memory_->SetData64(0x8000, 0x0000000c24021061ULL);
-
-  for (uint64_t index = 0; index <= 100; index++) {
-    process_memory_.SetData64(addr + index * 8, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x8000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x350U, regs[MIPS_REG_SP]);
-  EXPECT_EQ(0x170U, regs[MIPS_REG_PC]);
-  EXPECT_EQ(0x350U, regs.sp());
-  EXPECT_EQ(0x170U, regs.pc());
-}
-
-TEST_F(RegsStepIfSignalHandlerTest, mips64_step_if_signal_handler) {
-  uint64_t addr = 0x1000;
-  RegsMips64 regs;
-  regs[MIPS64_REG_PC] = 0x8000;
-  regs[MIPS64_REG_SP] = addr;
-
-  elf_memory_->SetData64(0x8000, 0x0000000c2402145bULL);
-
-  for (uint64_t index = 0; index <= 100; index++) {
-    process_memory_.SetData64(addr + index * 8, index * 0x10);
-  }
-
-  ASSERT_TRUE(regs.StepIfSignalHandler(0x8000, elf_.get(), &process_memory_));
-  EXPECT_EQ(0x350U, regs[MIPS64_REG_SP]);
-  EXPECT_EQ(0x600U, regs[MIPS64_REG_PC]);
-  EXPECT_EQ(0x350U, regs.sp());
-  EXPECT_EQ(0x600U, regs.pc());
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/RegsTest.cpp b/libunwindstack/tests/RegsTest.cpp
deleted file mode 100644
index 0a33e2f..0000000
--- a/libunwindstack/tests/RegsTest.cpp
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/MapInfo.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/RegsX86_64.h>
-#include <unwindstack/RegsMips.h>
-#include <unwindstack/RegsMips64.h>
-
-#include "ElfFake.h"
-#include "MemoryFake.h"
-#include "RegsFake.h"
-
-namespace unwindstack {
-
-class RegsTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    memory_ = new MemoryFake;
-    elf_.reset(new ElfFake(memory_));
-    elf_interface_ = new ElfInterfaceFake(elf_->memory());
-    elf_->FakeSetInterface(elf_interface_);
-  }
-
-  ElfInterfaceFake* elf_interface_;
-  MemoryFake* memory_;
-  std::unique_ptr<ElfFake> elf_;
-};
-
-TEST_F(RegsTest, regs32) {
-  RegsImplFake<uint32_t> regs32(50);
-  ASSERT_EQ(50U, regs32.total_regs());
-
-  uint32_t* raw = reinterpret_cast<uint32_t*>(regs32.RawData());
-  for (size_t i = 0; i < 50; i++) {
-    raw[i] = 0xf0000000 + i;
-  }
-  regs32.set_pc(0xf0120340);
-  regs32.set_sp(0xa0ab0cd0);
-
-  for (size_t i = 0; i < 50; i++) {
-    ASSERT_EQ(0xf0000000U + i, regs32[i]) << "Failed comparing register " << i;
-  }
-
-  ASSERT_EQ(0xf0120340U, regs32.pc());
-  ASSERT_EQ(0xa0ab0cd0U, regs32.sp());
-
-  regs32[32] = 10;
-  ASSERT_EQ(10U, regs32[32]);
-}
-
-TEST_F(RegsTest, regs64) {
-  RegsImplFake<uint64_t> regs64(30);
-  ASSERT_EQ(30U, regs64.total_regs());
-
-  uint64_t* raw = reinterpret_cast<uint64_t*>(regs64.RawData());
-  for (size_t i = 0; i < 30; i++) {
-    raw[i] = 0xf123456780000000UL + i;
-  }
-  regs64.set_pc(0xf123456780102030UL);
-  regs64.set_sp(0xa123456780a0b0c0UL);
-
-  for (size_t i = 0; i < 30; i++) {
-    ASSERT_EQ(0xf123456780000000U + i, regs64[i]) << "Failed reading register " << i;
-  }
-
-  ASSERT_EQ(0xf123456780102030UL, regs64.pc());
-  ASSERT_EQ(0xa123456780a0b0c0UL, regs64.sp());
-
-  regs64[8] = 10;
-  ASSERT_EQ(10U, regs64[8]);
-}
-
-TEST_F(RegsTest, rel_pc) {
-  RegsArm64 arm64;
-  EXPECT_EQ(4U, arm64.GetPcAdjustment(0x10, elf_.get()));
-  EXPECT_EQ(4U, arm64.GetPcAdjustment(0x4, elf_.get()));
-  EXPECT_EQ(0U, arm64.GetPcAdjustment(0x3, elf_.get()));
-  EXPECT_EQ(0U, arm64.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(0U, arm64.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(0U, arm64.GetPcAdjustment(0x0, elf_.get()));
-
-  RegsX86 x86;
-  EXPECT_EQ(1U, x86.GetPcAdjustment(0x100, elf_.get()));
-  EXPECT_EQ(1U, x86.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(1U, x86.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(0U, x86.GetPcAdjustment(0x0, elf_.get()));
-
-  RegsX86_64 x86_64;
-  EXPECT_EQ(1U, x86_64.GetPcAdjustment(0x100, elf_.get()));
-  EXPECT_EQ(1U, x86_64.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(1U, x86_64.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(0U, x86_64.GetPcAdjustment(0x0, elf_.get()));
-
-  RegsMips mips;
-  EXPECT_EQ(8U, mips.GetPcAdjustment(0x10, elf_.get()));
-  EXPECT_EQ(8U, mips.GetPcAdjustment(0x8, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x7, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x6, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x5, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x4, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x3, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(0U, mips.GetPcAdjustment(0x0, elf_.get()));
-
-  RegsMips64 mips64;
-  EXPECT_EQ(8U, mips64.GetPcAdjustment(0x10, elf_.get()));
-  EXPECT_EQ(8U, mips64.GetPcAdjustment(0x8, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x7, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x6, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x5, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x4, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x3, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(0U, mips64.GetPcAdjustment(0x0, elf_.get()));
-}
-
-TEST_F(RegsTest, rel_pc_arm) {
-  RegsArm arm;
-
-  // Check fence posts.
-  elf_->FakeSetLoadBias(0);
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x5, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x4, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x3, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(0U, arm.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(0U, arm.GetPcAdjustment(0x0, elf_.get()));
-
-  elf_->FakeSetLoadBias(0x100);
-  EXPECT_EQ(0U, arm.GetPcAdjustment(0x1, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x2, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0xff, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x105, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x104, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x103, elf_.get()));
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x102, elf_.get()));
-  EXPECT_EQ(0U, arm.GetPcAdjustment(0x101, elf_.get()));
-  EXPECT_EQ(0U, arm.GetPcAdjustment(0x100, elf_.get()));
-
-  // Check thumb instructions handling.
-  elf_->FakeSetLoadBias(0);
-  memory_->SetData32(0x2000, 0);
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x2005, elf_.get()));
-  memory_->SetData32(0x2000, 0xe000f000);
-  EXPECT_EQ(4U, arm.GetPcAdjustment(0x2005, elf_.get()));
-
-  elf_->FakeSetLoadBias(0x400);
-  memory_->SetData32(0x2100, 0);
-  EXPECT_EQ(2U, arm.GetPcAdjustment(0x2505, elf_.get()));
-  memory_->SetData32(0x2100, 0xf111f111);
-  EXPECT_EQ(4U, arm.GetPcAdjustment(0x2505, elf_.get()));
-}
-
-TEST_F(RegsTest, elf_invalid) {
-  RegsArm regs_arm;
-  RegsArm64 regs_arm64;
-  RegsX86 regs_x86;
-  RegsX86_64 regs_x86_64;
-  RegsMips regs_mips;
-  RegsMips64 regs_mips64;
-  MapInfo map_info(nullptr, nullptr, 0x1000, 0x2000, 0, 0, "");
-  Elf* invalid_elf = new Elf(nullptr);
-  map_info.elf.reset(invalid_elf);
-
-  regs_arm.set_pc(0x1500);
-  EXPECT_EQ(0x500U, invalid_elf->GetRelPc(regs_arm.pc(), &map_info));
-  EXPECT_EQ(2U, regs_arm.GetPcAdjustment(0x500U, invalid_elf));
-  EXPECT_EQ(2U, regs_arm.GetPcAdjustment(0x511U, invalid_elf));
-
-  regs_arm64.set_pc(0x1600);
-  EXPECT_EQ(0x600U, invalid_elf->GetRelPc(regs_arm64.pc(), &map_info));
-  EXPECT_EQ(4U, regs_arm64.GetPcAdjustment(0x600U, invalid_elf));
-
-  regs_x86.set_pc(0x1700);
-  EXPECT_EQ(0x700U, invalid_elf->GetRelPc(regs_x86.pc(), &map_info));
-  EXPECT_EQ(1U, regs_x86.GetPcAdjustment(0x700U, invalid_elf));
-
-  regs_x86_64.set_pc(0x1800);
-  EXPECT_EQ(0x800U, invalid_elf->GetRelPc(regs_x86_64.pc(), &map_info));
-  EXPECT_EQ(1U, regs_x86_64.GetPcAdjustment(0x800U, invalid_elf));
-
-  regs_mips.set_pc(0x1900);
-  EXPECT_EQ(0x900U, invalid_elf->GetRelPc(regs_mips.pc(), &map_info));
-  EXPECT_EQ(8U, regs_mips.GetPcAdjustment(0x900U, invalid_elf));
-
-  regs_mips64.set_pc(0x1a00);
-  EXPECT_EQ(0xa00U, invalid_elf->GetRelPc(regs_mips64.pc(), &map_info));
-  EXPECT_EQ(8U, regs_mips64.GetPcAdjustment(0xa00U, invalid_elf));
-}
-
-TEST_F(RegsTest, arm_verify_sp_pc) {
-  RegsArm arm;
-  uint32_t* regs = reinterpret_cast<uint32_t*>(arm.RawData());
-  regs[13] = 0x100;
-  regs[15] = 0x200;
-  EXPECT_EQ(0x100U, arm.sp());
-  EXPECT_EQ(0x200U, arm.pc());
-}
-
-TEST_F(RegsTest, arm64_verify_sp_pc) {
-  RegsArm64 arm64;
-  uint64_t* regs = reinterpret_cast<uint64_t*>(arm64.RawData());
-  regs[31] = 0xb100000000ULL;
-  regs[32] = 0xc200000000ULL;
-  EXPECT_EQ(0xb100000000U, arm64.sp());
-  EXPECT_EQ(0xc200000000U, arm64.pc());
-}
-
-TEST_F(RegsTest, x86_verify_sp_pc) {
-  RegsX86 x86;
-  uint32_t* regs = reinterpret_cast<uint32_t*>(x86.RawData());
-  regs[4] = 0x23450000;
-  regs[8] = 0xabcd0000;
-  EXPECT_EQ(0x23450000U, x86.sp());
-  EXPECT_EQ(0xabcd0000U, x86.pc());
-}
-
-TEST_F(RegsTest, x86_64_verify_sp_pc) {
-  RegsX86_64 x86_64;
-  uint64_t* regs = reinterpret_cast<uint64_t*>(x86_64.RawData());
-  regs[7] = 0x1200000000ULL;
-  regs[16] = 0x4900000000ULL;
-  EXPECT_EQ(0x1200000000U, x86_64.sp());
-  EXPECT_EQ(0x4900000000U, x86_64.pc());
-}
-
-TEST_F(RegsTest, mips_verify_sp_pc) {
-  RegsMips mips;
-  uint32_t* regs = reinterpret_cast<uint32_t*>(mips.RawData());
-  regs[29] = 0x100;
-  regs[32] = 0x200;
-  EXPECT_EQ(0x100U, mips.sp());
-  EXPECT_EQ(0x200U, mips.pc());
-}
-
-TEST_F(RegsTest, mips64_verify_sp_pc) {
-  RegsMips64 mips64;
-  uint64_t* regs = reinterpret_cast<uint64_t*>(mips64.RawData());
-  regs[29] = 0xb100000000ULL;
-  regs[32] = 0xc200000000ULL;
-  EXPECT_EQ(0xb100000000U, mips64.sp());
-  EXPECT_EQ(0xc200000000U, mips64.pc());
-}
-
-TEST_F(RegsTest, machine_type) {
-  RegsArm arm_regs;
-  EXPECT_EQ(ARCH_ARM, arm_regs.Arch());
-
-  RegsArm64 arm64_regs;
-  EXPECT_EQ(ARCH_ARM64, arm64_regs.Arch());
-
-  RegsX86 x86_regs;
-  EXPECT_EQ(ARCH_X86, x86_regs.Arch());
-
-  RegsX86_64 x86_64_regs;
-  EXPECT_EQ(ARCH_X86_64, x86_64_regs.Arch());
-
-  RegsMips mips_regs;
-  EXPECT_EQ(ARCH_MIPS, mips_regs.Arch());
-
-  RegsMips64 mips64_regs;
-  EXPECT_EQ(ARCH_MIPS64, mips64_regs.Arch());
-}
-
-template <typename RegisterType>
-void clone_test(Regs* regs) {
-  RegisterType* register_values = reinterpret_cast<RegisterType*>(regs->RawData());
-  int num_regs = regs->total_regs();
-  for (int i = 0; i < num_regs; ++i) {
-    register_values[i] = i;
-  }
-
-  std::unique_ptr<Regs> clone(regs->Clone());
-  ASSERT_EQ(regs->total_regs(), clone->total_regs());
-  RegisterType* clone_values = reinterpret_cast<RegisterType*>(clone->RawData());
-  for (int i = 0; i < num_regs; ++i) {
-    EXPECT_EQ(register_values[i], clone_values[i]);
-    EXPECT_NE(&register_values[i], &clone_values[i]);
-  }
-}
-
-TEST_F(RegsTest, clone) {
-  std::vector<std::unique_ptr<Regs>> regs;
-  regs.emplace_back(new RegsArm());
-  regs.emplace_back(new RegsArm64());
-  regs.emplace_back(new RegsX86());
-  regs.emplace_back(new RegsX86_64());
-  regs.emplace_back(new RegsMips());
-  regs.emplace_back(new RegsMips64());
-
-  for (auto& r : regs) {
-    if (r->Is32Bit()) {
-      clone_test<uint32_t>(r.get());
-    } else {
-      clone_test<uint64_t>(r.get());
-    }
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/SymbolsTest.cpp b/libunwindstack/tests/SymbolsTest.cpp
deleted file mode 100644
index c58aeff..0000000
--- a/libunwindstack/tests/SymbolsTest.cpp
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/test_utils.h>
-#include <gtest/gtest.h>
-
-#include <unwindstack/Memory.h>
-
-#include "MemoryFake.h"
-#include "Symbols.h"
-
-namespace unwindstack {
-
-template <typename TypeParam>
-class SymbolsTest : public ::testing::Test {
- protected:
-  void SetUp() override { memory_.Clear(); }
-
-  void InitSym(TypeParam* sym, uint32_t st_value, uint32_t st_size, uint32_t st_name) {
-    memset(sym, 0, sizeof(*sym));
-    sym->st_info = STT_FUNC;
-    sym->st_value = st_value;
-    sym->st_size = st_size;
-    sym->st_name = st_name;
-    sym->st_shndx = SHN_COMMON;
-  }
-
-  MemoryFake memory_;
-};
-TYPED_TEST_SUITE_P(SymbolsTest);
-
-TYPED_TEST_P(SymbolsTest, function_bounds_check) {
-  Symbols symbols(0x1000, sizeof(TypeParam), sizeof(TypeParam), 0x2000, 0x100);
-
-  TypeParam sym;
-  this->InitSym(&sym, 0x5000, 0x10, 0x40);
-  uint64_t offset = 0x1000;
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-
-  std::string fake_name("fake_function");
-  this->memory_.SetMemory(0x2040, fake_name.c_str(), fake_name.size() + 1);
-
-  std::string name;
-  uint64_t func_offset;
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x5000, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("fake_function", name);
-  ASSERT_EQ(0U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x500f, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("fake_function", name);
-  ASSERT_EQ(0xfU, func_offset);
-
-  // Check one before and one after the function.
-  ASSERT_FALSE(symbols.GetName<TypeParam>(0x4fff, &this->memory_, &name, &func_offset));
-  ASSERT_FALSE(symbols.GetName<TypeParam>(0x5010, &this->memory_, &name, &func_offset));
-}
-
-TYPED_TEST_P(SymbolsTest, no_symbol) {
-  Symbols symbols(0x1000, sizeof(TypeParam), sizeof(TypeParam), 0x2000, 0x100);
-
-  TypeParam sym;
-  this->InitSym(&sym, 0x5000, 0x10, 0x40);
-  uint64_t offset = 0x1000;
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-
-  std::string fake_name("fake_function");
-  this->memory_.SetMemory(0x2040, fake_name.c_str(), fake_name.size() + 1);
-
-  // First verify that we can get the name.
-  std::string name;
-  uint64_t func_offset;
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x5000, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("fake_function", name);
-  ASSERT_EQ(0U, func_offset);
-
-  // Now modify the info field so it's no longer a function.
-  sym.st_info = 0;
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  // Clear the cache to force the symbol data to be re-read.
-  symbols.ClearCache();
-  ASSERT_FALSE(symbols.GetName<TypeParam>(0x5000, &this->memory_, &name, &func_offset));
-
-  // Set the function back, and set the shndx to UNDEF.
-  sym.st_info = STT_FUNC;
-  sym.st_shndx = SHN_UNDEF;
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  // Clear the cache to force the symbol data to be re-read.
-  symbols.ClearCache();
-  ASSERT_FALSE(symbols.GetName<TypeParam>(0x5000, &this->memory_, &name, &func_offset));
-}
-
-TYPED_TEST_P(SymbolsTest, multiple_entries) {
-  Symbols symbols(0x1000, sizeof(TypeParam) * 3, sizeof(TypeParam), 0x2000, 0x500);
-
-  TypeParam sym;
-  uint64_t offset = 0x1000;
-  std::string fake_name;
-
-  this->InitSym(&sym, 0x5000, 0x10, 0x40);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  fake_name = "function_one";
-  this->memory_.SetMemory(0x2040, fake_name.c_str(), fake_name.size() + 1);
-  offset += sizeof(sym);
-
-  this->InitSym(&sym, 0x3004, 0x200, 0x100);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  fake_name = "function_two";
-  this->memory_.SetMemory(0x2100, fake_name.c_str(), fake_name.size() + 1);
-  offset += sizeof(sym);
-
-  this->InitSym(&sym, 0xa010, 0x20, 0x230);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  fake_name = "function_three";
-  this->memory_.SetMemory(0x2230, fake_name.c_str(), fake_name.size() + 1);
-
-  std::string name;
-  uint64_t func_offset;
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x3005, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_two", name);
-  ASSERT_EQ(1U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x5004, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_one", name);
-  ASSERT_EQ(4U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0xa011, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_three", name);
-  ASSERT_EQ(1U, func_offset);
-
-  // Reget some of the others to verify getting one function name doesn't
-  // affect any of the next calls.
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x5008, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_one", name);
-  ASSERT_EQ(8U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x3008, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_two", name);
-  ASSERT_EQ(4U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0xa01a, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_three", name);
-  ASSERT_EQ(0xaU, func_offset);
-}
-
-TYPED_TEST_P(SymbolsTest, multiple_entries_nonstandard_size) {
-  uint64_t entry_size = sizeof(TypeParam) + 5;
-  Symbols symbols(0x1000, entry_size * 3, entry_size, 0x2000, 0x500);
-
-  TypeParam sym;
-  uint64_t offset = 0x1000;
-  std::string fake_name;
-
-  this->InitSym(&sym, 0x5000, 0x10, 0x40);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  fake_name = "function_one";
-  this->memory_.SetMemory(0x2040, fake_name.c_str(), fake_name.size() + 1);
-  offset += entry_size;
-
-  this->InitSym(&sym, 0x3004, 0x200, 0x100);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  fake_name = "function_two";
-  this->memory_.SetMemory(0x2100, fake_name.c_str(), fake_name.size() + 1);
-  offset += entry_size;
-
-  this->InitSym(&sym, 0xa010, 0x20, 0x230);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  fake_name = "function_three";
-  this->memory_.SetMemory(0x2230, fake_name.c_str(), fake_name.size() + 1);
-
-  std::string name;
-  uint64_t func_offset;
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x3005, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_two", name);
-  ASSERT_EQ(1U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x5004, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_one", name);
-  ASSERT_EQ(4U, func_offset);
-
-  name.clear();
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0xa011, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function_three", name);
-  ASSERT_EQ(1U, func_offset);
-}
-
-TYPED_TEST_P(SymbolsTest, symtab_value_out_of_bounds) {
-  Symbols symbols_end_at_100(0x1000, sizeof(TypeParam) * 2, sizeof(TypeParam), 0x2000, 0x100);
-  Symbols symbols_end_at_200(0x1000, sizeof(TypeParam) * 2, sizeof(TypeParam), 0x2000, 0x200);
-
-  TypeParam sym;
-  uint64_t offset = 0x1000;
-
-  this->InitSym(&sym, 0x5000, 0x10, 0xfb);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  offset += sizeof(sym);
-
-  this->InitSym(&sym, 0x3000, 0x10, 0x100);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-
-  // Put the name across the end of the tab.
-  std::string fake_name("fake_function");
-  this->memory_.SetMemory(0x20fb, fake_name.c_str(), fake_name.size() + 1);
-
-  std::string name;
-  uint64_t func_offset;
-  // Verify that we can get the function name properly for both entries.
-  ASSERT_TRUE(symbols_end_at_200.GetName<TypeParam>(0x5000, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("fake_function", name);
-  ASSERT_EQ(0U, func_offset);
-  ASSERT_TRUE(symbols_end_at_200.GetName<TypeParam>(0x3000, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("function", name);
-  ASSERT_EQ(0U, func_offset);
-
-  // Now use the symbol table that ends at 0x100.
-  ASSERT_FALSE(symbols_end_at_100.GetName<TypeParam>(0x5000, &this->memory_, &name, &func_offset));
-  ASSERT_FALSE(symbols_end_at_100.GetName<TypeParam>(0x3000, &this->memory_, &name, &func_offset));
-}
-
-// Verify the entire func table is cached.
-TYPED_TEST_P(SymbolsTest, symtab_read_cached) {
-  Symbols symbols(0x1000, 3 * sizeof(TypeParam), sizeof(TypeParam), 0xa000, 0x1000);
-
-  TypeParam sym;
-  uint64_t offset = 0x1000;
-
-  // Make sure that these entries are not in ascending order.
-  this->InitSym(&sym, 0x5000, 0x10, 0x100);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  offset += sizeof(sym);
-
-  this->InitSym(&sym, 0x2000, 0x300, 0x200);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  offset += sizeof(sym);
-
-  this->InitSym(&sym, 0x1000, 0x100, 0x300);
-  this->memory_.SetMemory(offset, &sym, sizeof(sym));
-  offset += sizeof(sym);
-
-  // Do call that should cache all of the entries (except the string data).
-  std::string name;
-  uint64_t func_offset;
-  ASSERT_FALSE(symbols.GetName<TypeParam>(0x6000, &this->memory_, &name, &func_offset));
-  this->memory_.Clear();
-  ASSERT_FALSE(symbols.GetName<TypeParam>(0x6000, &this->memory_, &name, &func_offset));
-
-  // Clear the memory and only put the symbol data string data in memory.
-  this->memory_.Clear();
-
-  std::string fake_name;
-  fake_name = "first_entry";
-  this->memory_.SetMemory(0xa100, fake_name.c_str(), fake_name.size() + 1);
-  fake_name = "second_entry";
-  this->memory_.SetMemory(0xa200, fake_name.c_str(), fake_name.size() + 1);
-  fake_name = "third_entry";
-  this->memory_.SetMemory(0xa300, fake_name.c_str(), fake_name.size() + 1);
-
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x5001, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("first_entry", name);
-  ASSERT_EQ(1U, func_offset);
-
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x2002, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("second_entry", name);
-  ASSERT_EQ(2U, func_offset);
-
-  ASSERT_TRUE(symbols.GetName<TypeParam>(0x1003, &this->memory_, &name, &func_offset));
-  ASSERT_EQ("third_entry", name);
-  ASSERT_EQ(3U, func_offset);
-}
-
-TYPED_TEST_P(SymbolsTest, get_global) {
-  uint64_t start_offset = 0x1000;
-  uint64_t str_offset = 0xa000;
-  Symbols symbols(start_offset, 4 * sizeof(TypeParam), sizeof(TypeParam), str_offset, 0x1000);
-
-  TypeParam sym;
-  memset(&sym, 0, sizeof(sym));
-  sym.st_shndx = SHN_COMMON;
-  sym.st_info = STT_OBJECT | (STB_GLOBAL << 4);
-  sym.st_name = 0x100;
-  this->memory_.SetMemory(start_offset, &sym, sizeof(sym));
-  this->memory_.SetMemory(str_offset + 0x100, "global_0");
-
-  start_offset += sizeof(sym);
-  memset(&sym, 0, sizeof(sym));
-  sym.st_shndx = SHN_COMMON;
-  sym.st_info = STT_FUNC;
-  sym.st_name = 0x200;
-  sym.st_value = 0x10000;
-  sym.st_size = 0x100;
-  this->memory_.SetMemory(start_offset, &sym, sizeof(sym));
-  this->memory_.SetMemory(str_offset + 0x200, "function_0");
-
-  start_offset += sizeof(sym);
-  memset(&sym, 0, sizeof(sym));
-  sym.st_shndx = SHN_COMMON;
-  sym.st_info = STT_OBJECT | (STB_GLOBAL << 4);
-  sym.st_name = 0x300;
-  this->memory_.SetMemory(start_offset, &sym, sizeof(sym));
-  this->memory_.SetMemory(str_offset + 0x300, "global_1");
-
-  start_offset += sizeof(sym);
-  memset(&sym, 0, sizeof(sym));
-  sym.st_shndx = SHN_COMMON;
-  sym.st_info = STT_FUNC;
-  sym.st_name = 0x400;
-  sym.st_value = 0x12000;
-  sym.st_size = 0x100;
-  this->memory_.SetMemory(start_offset, &sym, sizeof(sym));
-  this->memory_.SetMemory(str_offset + 0x400, "function_1");
-
-  uint64_t offset;
-  EXPECT_TRUE(symbols.GetGlobal<TypeParam>(&this->memory_, "global_0", &offset));
-  EXPECT_TRUE(symbols.GetGlobal<TypeParam>(&this->memory_, "global_1", &offset));
-  EXPECT_TRUE(symbols.GetGlobal<TypeParam>(&this->memory_, "global_0", &offset));
-  EXPECT_TRUE(symbols.GetGlobal<TypeParam>(&this->memory_, "global_1", &offset));
-
-  EXPECT_FALSE(symbols.GetGlobal<TypeParam>(&this->memory_, "function_0", &offset));
-  EXPECT_FALSE(symbols.GetGlobal<TypeParam>(&this->memory_, "function_1", &offset));
-
-  std::string name;
-  EXPECT_TRUE(symbols.GetName<TypeParam>(0x10002, &this->memory_, &name, &offset));
-  EXPECT_EQ("function_0", name);
-  EXPECT_EQ(2U, offset);
-
-  EXPECT_TRUE(symbols.GetName<TypeParam>(0x12004, &this->memory_, &name, &offset));
-  EXPECT_EQ("function_1", name);
-  EXPECT_EQ(4U, offset);
-}
-
-REGISTER_TYPED_TEST_SUITE_P(SymbolsTest, function_bounds_check, no_symbol, multiple_entries,
-                            multiple_entries_nonstandard_size, symtab_value_out_of_bounds,
-                            symtab_read_cached, get_global);
-
-typedef ::testing::Types<Elf32_Sym, Elf64_Sym> SymbolsTestTypes;
-INSTANTIATE_TYPED_TEST_SUITE_P(Libunwindstack, SymbolsTest, SymbolsTestTypes);
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/TestLocal.cpp b/libunwindstack/tests/TestLocal.cpp
deleted file mode 100644
index fa0baff..0000000
--- a/libunwindstack/tests/TestLocal.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <unwindstack/LocalUnwinder.h>
-
-#include <vector>
-
-extern "C" void TestlibLevel4(void* unwinder_data, void* frame_data) {
-  unwindstack::LocalUnwinder* unwinder =
-      reinterpret_cast<unwindstack::LocalUnwinder*>(unwinder_data);
-  std::vector<unwindstack::LocalFrameData>* frame_info =
-      reinterpret_cast<std::vector<unwindstack::LocalFrameData>*>(frame_data);
-  unwinder->Unwind(frame_info, 256);
-}
-
-extern "C" void TestlibLevel3(void* unwinder_data, void* frame_data) {
-  TestlibLevel4(unwinder_data, frame_data);
-}
-
-extern "C" void TestlibLevel2(void* unwinder_data, void* frame_data) {
-  TestlibLevel3(unwinder_data, frame_data);
-}
-
-extern "C" void TestlibLevel1(void* unwinder_data, void* frame_data) {
-  TestlibLevel2(unwinder_data, frame_data);
-}
diff --git a/libunwindstack/tests/TestUtils.cpp b/libunwindstack/tests/TestUtils.cpp
deleted file mode 100644
index e76f5f8..0000000
--- a/libunwindstack/tests/TestUtils.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <malloc.h>
-#include <stdint.h>
-
-#include <gtest/gtest.h>
-
-namespace unwindstack {
-
-void TestCheckForLeaks(void (*unwind_func)(void*), void* data) {
-  static constexpr size_t kNumLeakLoops = 200;
-  static constexpr size_t kMaxAllowedLeakBytes = 32 * 1024;
-
-  size_t first_allocated_bytes = 0;
-  size_t last_allocated_bytes = 0;
-  for (size_t i = 0; i < kNumLeakLoops; i++) {
-    unwind_func(data);
-
-    size_t allocated_bytes = mallinfo().uordblks;
-    if (first_allocated_bytes == 0) {
-      first_allocated_bytes = allocated_bytes;
-    } else if (last_allocated_bytes > first_allocated_bytes) {
-      // Check that the memory did not increase too much over the first loop.
-      ASSERT_LE(last_allocated_bytes - first_allocated_bytes, kMaxAllowedLeakBytes);
-    }
-    last_allocated_bytes = allocated_bytes;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/TestUtils.h b/libunwindstack/tests/TestUtils.h
deleted file mode 100644
index a4d7b9b..0000000
--- a/libunwindstack/tests/TestUtils.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LIBUNWINDSTACK_TESTS_TEST_UTILS_H
-#define _LIBUNWINDSTACK_TESTS_TEST_UTILS_H
-
-#include <signal.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-namespace unwindstack {
-
-class TestScopedPidReaper {
- public:
-  TestScopedPidReaper(pid_t pid) : pid_(pid) {}
-  ~TestScopedPidReaper() {
-    kill(pid_, SIGKILL);
-    waitpid(pid_, nullptr, 0);
-  }
-
- private:
-  pid_t pid_;
-};
-
-inline bool TestQuiescePid(pid_t pid) {
-  siginfo_t si;
-  bool ready = false;
-  // Wait for up to 5 seconds.
-  for (size_t i = 0; i < 5000; i++) {
-    if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) {
-      ready = true;
-      break;
-    }
-    usleep(1000);
-  }
-  return ready;
-}
-
-void TestCheckForLeaks(void (*unwind_func)(void*), void* data);
-
-}  // namespace unwindstack
-
-#endif  // _LIBUNWINDSTACK_TESTS_TEST_UTILS_H
diff --git a/libunwindstack/tests/UnwindOfflineTest.cpp b/libunwindstack/tests/UnwindOfflineTest.cpp
deleted file mode 100644
index c2bd836..0000000
--- a/libunwindstack/tests/UnwindOfflineTest.cpp
+++ /dev/null
@@ -1,1739 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#include <gtest/gtest.h>
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include <android-base/file.h>
-
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/MachineArm.h>
-#include <unwindstack/MachineArm64.h>
-#include <unwindstack/MachineX86.h>
-#include <unwindstack/MachineX86_64.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/RegsX86_64.h>
-#include <unwindstack/Unwinder.h>
-
-#include "ElfTestUtils.h"
-#include "MemoryOffline.h"
-#include "TestUtils.h"
-
-namespace unwindstack {
-
-static void AddMemory(std::string file_name, MemoryOfflineParts* parts) {
-  MemoryOffline* memory = new MemoryOffline;
-  ASSERT_TRUE(memory->Init(file_name.c_str(), 0));
-  parts->Add(memory);
-}
-
-class UnwindOfflineTest : public ::testing::Test {
- protected:
-  void TearDown() override {
-    if (cwd_ != nullptr) {
-      ASSERT_EQ(0, chdir(cwd_));
-    }
-    free(cwd_);
-  }
-
-  void Init(const char* file_dir, ArchEnum arch, bool add_stack = true) {
-    dir_ = TestGetFileDirectory() + "offline/" + file_dir;
-
-    std::string data;
-    ASSERT_TRUE(android::base::ReadFileToString((dir_ + "maps.txt"), &data));
-
-    maps_.reset(new BufferMaps(data.c_str()));
-    ASSERT_TRUE(maps_->Parse());
-
-    if (add_stack) {
-      std::string stack_name(dir_ + "stack.data");
-      struct stat st;
-      if (stat(stack_name.c_str(), &st) == 0 && S_ISREG(st.st_mode)) {
-        std::unique_ptr<MemoryOffline> stack_memory(new MemoryOffline);
-        ASSERT_TRUE(stack_memory->Init((dir_ + "stack.data").c_str(), 0));
-        process_memory_.reset(stack_memory.release());
-      } else {
-        std::unique_ptr<MemoryOfflineParts> stack_memory(new MemoryOfflineParts);
-        for (size_t i = 0;; i++) {
-          stack_name = dir_ + "stack" + std::to_string(i) + ".data";
-          if (stat(stack_name.c_str(), &st) == -1 || !S_ISREG(st.st_mode)) {
-            ASSERT_TRUE(i != 0) << "No stack data files found.";
-            break;
-          }
-          AddMemory(stack_name, stack_memory.get());
-        }
-        process_memory_.reset(stack_memory.release());
-      }
-    }
-
-    switch (arch) {
-      case ARCH_ARM: {
-        RegsArm* regs = new RegsArm;
-        regs_.reset(regs);
-        ReadRegs<uint32_t>(regs, arm_regs_);
-        break;
-      }
-      case ARCH_ARM64: {
-        RegsArm64* regs = new RegsArm64;
-        regs_.reset(regs);
-        ReadRegs<uint64_t>(regs, arm64_regs_);
-        break;
-      }
-      case ARCH_X86: {
-        RegsX86* regs = new RegsX86;
-        regs_.reset(regs);
-        ReadRegs<uint32_t>(regs, x86_regs_);
-        break;
-      }
-      case ARCH_X86_64: {
-        RegsX86_64* regs = new RegsX86_64;
-        regs_.reset(regs);
-        ReadRegs<uint64_t>(regs, x86_64_regs_);
-        break;
-      }
-      default:
-        ASSERT_TRUE(false) << "Unknown arch " << std::to_string(arch);
-    }
-    cwd_ = getcwd(nullptr, 0);
-    // Make dir_ an absolute directory.
-    if (dir_.empty() || dir_[0] != '/') {
-      dir_ = std::string(cwd_) + '/' + dir_;
-    }
-    ASSERT_EQ(0, chdir(dir_.c_str()));
-  }
-
-  template <typename AddressType>
-  void ReadRegs(RegsImpl<AddressType>* regs,
-                const std::unordered_map<std::string, uint32_t>& name_to_reg) {
-    FILE* fp = fopen((dir_ + "regs.txt").c_str(), "r");
-    ASSERT_TRUE(fp != nullptr);
-    while (!feof(fp)) {
-      uint64_t value;
-      char reg_name[100];
-      ASSERT_EQ(2, fscanf(fp, "%s %" SCNx64 "\n", reg_name, &value));
-      std::string name(reg_name);
-      if (!name.empty()) {
-        // Remove the : from the end.
-        name.resize(name.size() - 1);
-      }
-      auto entry = name_to_reg.find(name);
-      ASSERT_TRUE(entry != name_to_reg.end()) << "Unknown register named " << name;
-      (*regs)[entry->second] = value;
-    }
-    fclose(fp);
-  }
-
-  static std::unordered_map<std::string, uint32_t> arm_regs_;
-  static std::unordered_map<std::string, uint32_t> arm64_regs_;
-  static std::unordered_map<std::string, uint32_t> x86_regs_;
-  static std::unordered_map<std::string, uint32_t> x86_64_regs_;
-
-  char* cwd_ = nullptr;
-  std::string dir_;
-  std::unique_ptr<Regs> regs_;
-  std::unique_ptr<Maps> maps_;
-  std::shared_ptr<Memory> process_memory_;
-};
-
-std::unordered_map<std::string, uint32_t> UnwindOfflineTest::arm_regs_ = {
-    {"r0", ARM_REG_R0},  {"r1", ARM_REG_R1}, {"r2", ARM_REG_R2},   {"r3", ARM_REG_R3},
-    {"r4", ARM_REG_R4},  {"r5", ARM_REG_R5}, {"r6", ARM_REG_R6},   {"r7", ARM_REG_R7},
-    {"r8", ARM_REG_R8},  {"r9", ARM_REG_R9}, {"r10", ARM_REG_R10}, {"r11", ARM_REG_R11},
-    {"ip", ARM_REG_R12}, {"sp", ARM_REG_SP}, {"lr", ARM_REG_LR},   {"pc", ARM_REG_PC},
-};
-
-std::unordered_map<std::string, uint32_t> UnwindOfflineTest::arm64_regs_ = {
-    {"x0", ARM64_REG_R0},      {"x1", ARM64_REG_R1},   {"x2", ARM64_REG_R2},
-    {"x3", ARM64_REG_R3},      {"x4", ARM64_REG_R4},   {"x5", ARM64_REG_R5},
-    {"x6", ARM64_REG_R6},      {"x7", ARM64_REG_R7},   {"x8", ARM64_REG_R8},
-    {"x9", ARM64_REG_R9},      {"x10", ARM64_REG_R10}, {"x11", ARM64_REG_R11},
-    {"x12", ARM64_REG_R12},    {"x13", ARM64_REG_R13}, {"x14", ARM64_REG_R14},
-    {"x15", ARM64_REG_R15},    {"x16", ARM64_REG_R16}, {"x17", ARM64_REG_R17},
-    {"x18", ARM64_REG_R18},    {"x19", ARM64_REG_R19}, {"x20", ARM64_REG_R20},
-    {"x21", ARM64_REG_R21},    {"x22", ARM64_REG_R22}, {"x23", ARM64_REG_R23},
-    {"x24", ARM64_REG_R24},    {"x25", ARM64_REG_R25}, {"x26", ARM64_REG_R26},
-    {"x27", ARM64_REG_R27},    {"x28", ARM64_REG_R28}, {"x29", ARM64_REG_R29},
-    {"sp", ARM64_REG_SP},      {"lr", ARM64_REG_LR},   {"pc", ARM64_REG_PC},
-    {"pst", ARM64_REG_PSTATE},
-};
-
-std::unordered_map<std::string, uint32_t> UnwindOfflineTest::x86_regs_ = {
-    {"eax", X86_REG_EAX}, {"ebx", X86_REG_EBX}, {"ecx", X86_REG_ECX},
-    {"edx", X86_REG_EDX}, {"ebp", X86_REG_EBP}, {"edi", X86_REG_EDI},
-    {"esi", X86_REG_ESI}, {"esp", X86_REG_ESP}, {"eip", X86_REG_EIP},
-};
-
-std::unordered_map<std::string, uint32_t> UnwindOfflineTest::x86_64_regs_ = {
-    {"rax", X86_64_REG_RAX}, {"rbx", X86_64_REG_RBX}, {"rcx", X86_64_REG_RCX},
-    {"rdx", X86_64_REG_RDX}, {"r8", X86_64_REG_R8},   {"r9", X86_64_REG_R9},
-    {"r10", X86_64_REG_R10}, {"r11", X86_64_REG_R11}, {"r12", X86_64_REG_R12},
-    {"r13", X86_64_REG_R13}, {"r14", X86_64_REG_R14}, {"r15", X86_64_REG_R15},
-    {"rdi", X86_64_REG_RDI}, {"rsi", X86_64_REG_RSI}, {"rbp", X86_64_REG_RBP},
-    {"rsp", X86_64_REG_RSP}, {"rip", X86_64_REG_RIP},
-};
-
-static std::string DumpFrames(Unwinder& unwinder) {
-  std::string str;
-  for (size_t i = 0; i < unwinder.NumFrames(); i++) {
-    str += unwinder.FormatFrame(i) + "\n";
-  }
-  return str;
-}
-
-TEST_F(UnwindOfflineTest, pc_straddle_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("straddle_arm/", ARCH_ARM));
-
-  std::unique_ptr<Regs> regs_copy(regs_->Clone());
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(4U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0001a9f8  libc.so (abort+64)\n"
-      "  #01 pc 00006a1b  libbase.so (android::base::DefaultAborter(char const*)+6)\n"
-      "  #02 pc 00007441  libbase.so (android::base::LogMessage::~LogMessage()+748)\n"
-      "  #03 pc 00015147  /does/not/exist/libhidlbase.so\n",
-      frame_info);
-  EXPECT_EQ(0xf31ea9f8U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xe9c866f8U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xf2da0a1bU, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xe9c86728U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xf2da1441U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xe9c86730U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xf3367147U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xe9c86778U, unwinder.frames()[3].sp);
-
-  // Display build ids now.
-  unwinder.SetRegs(regs_copy.get());
-  unwinder.SetDisplayBuildID(true);
-  unwinder.Unwind();
-
-  frame_info = DumpFrames(unwinder);
-  ASSERT_EQ(4U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0001a9f8  libc.so (abort+64) (BuildId: 2dd0d4ba881322a0edabeed94808048c)\n"
-      "  #01 pc 00006a1b  libbase.so (android::base::DefaultAborter(char const*)+6) (BuildId: "
-      "ed43842c239cac1a618e600ea91c4cbd)\n"
-      "  #02 pc 00007441  libbase.so (android::base::LogMessage::~LogMessage()+748) (BuildId: "
-      "ed43842c239cac1a618e600ea91c4cbd)\n"
-      "  #03 pc 00015147  /does/not/exist/libhidlbase.so\n",
-      frame_info);
-}
-
-TEST_F(UnwindOfflineTest, pc_in_gnu_debugdata_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("gnu_debugdata_arm/", ARCH_ARM));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(2U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0006dc49  libandroid_runtime.so "
-      "(android::AndroidRuntime::javaThreadShell(void*)+80)\n"
-      "  #01 pc 0006dce5  libandroid_runtime.so "
-      "(android::AndroidRuntime::javaCreateThreadEtc(int (*)(void*), void*, char const*, int, "
-      "unsigned int, void**))\n",
-      frame_info);
-  EXPECT_EQ(0xf1f6dc49U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xd8fe6930U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xf1f6dce5U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xd8fe6958U, unwinder.frames()[1].sp);
-}
-
-TEST_F(UnwindOfflineTest, pc_straddle_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("straddle_arm64/", ARCH_ARM64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(6U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0000000000429fd8  libunwindstack_test (SignalInnerFunction+24)\n"
-      "  #01 pc 000000000042a078  libunwindstack_test (SignalMiddleFunction+8)\n"
-      "  #02 pc 000000000042a08c  libunwindstack_test (SignalOuterFunction+8)\n"
-      "  #03 pc 000000000042d8fc  libunwindstack_test "
-      "(unwindstack::RemoteThroughSignal(int, unsigned int)+20)\n"
-      "  #04 pc 000000000042d8d8  libunwindstack_test "
-      "(unwindstack::UnwindTest_remote_through_signal_Test::TestBody()+32)\n"
-      "  #05 pc 0000000000455d70  libunwindstack_test (testing::Test::Run()+392)\n",
-      frame_info);
-  EXPECT_EQ(0x64d09d4fd8U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7fe0d84040U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x64d09d5078U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7fe0d84070U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x64d09d508cU, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7fe0d84080U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x64d09d88fcU, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7fe0d84090U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x64d09d88d8U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7fe0d840f0U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x64d0a00d70U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7fe0d84110U, unwinder.frames()[5].sp);
-}
-
-TEST_F(UnwindOfflineTest, jit_debug_x86) {
-  ASSERT_NO_FATAL_FAILURE(Init("jit_debug_x86/", ARCH_X86));
-
-  MemoryOfflineParts* memory = new MemoryOfflineParts;
-  AddMemory(dir_ + "descriptor.data", memory);
-  AddMemory(dir_ + "stack.data", memory);
-  for (size_t i = 0; i < 7; i++) {
-    AddMemory(dir_ + "entry" + std::to_string(i) + ".data", memory);
-    AddMemory(dir_ + "jit" + std::to_string(i) + ".data", memory);
-  }
-  process_memory_.reset(memory);
-
-  JitDebug jit_debug(process_memory_);
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.SetJitDebug(&jit_debug, regs_->Arch());
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(69U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00068fb8  libarttestd.so (art::CauseSegfault()+72)\n"
-      "  #01 pc 00067f00  libarttestd.so (Java_Main_unwindInProcess+10032)\n"
-      "  #02 pc 000021a8  137-cfi.odex (boolean Main.unwindInProcess(boolean, int, "
-      "boolean)+136)\n"
-      "  #03 pc 0000fe80  anonymous:ee74c000 (boolean Main.bar(boolean)+64)\n"
-      "  #04 pc 006ad4d2  libartd.so (art_quick_invoke_stub+338)\n"
-      "  #05 pc 00146ab5  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+885)\n"
-      "  #06 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #07 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #08 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #09 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #10 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #11 pc 0000fe03  anonymous:ee74c000 (int Main.compare(Main, Main)+51)\n"
-      "  #12 pc 006ad4d2  libartd.so (art_quick_invoke_stub+338)\n"
-      "  #13 pc 00146ab5  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+885)\n"
-      "  #14 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #15 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #16 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #17 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #18 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #19 pc 0000fd3b  anonymous:ee74c000 (int Main.compare(java.lang.Object, "
-      "java.lang.Object)+107)\n"
-      "  #20 pc 006ad4d2  libartd.so (art_quick_invoke_stub+338)\n"
-      "  #21 pc 00146ab5  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+885)\n"
-      "  #22 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #23 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #24 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #25 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #26 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #27 pc 0000fbdb  anonymous:ee74c000 (int "
-      "java.util.Arrays.binarySearch0(java.lang.Object[], int, int, java.lang.Object, "
-      "java.util.Comparator)+331)\n"
-      "  #28 pc 006ad6a2  libartd.so (art_quick_invoke_static_stub+418)\n"
-      "  #29 pc 00146acb  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+907)\n"
-      "  #30 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #31 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #32 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #33 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #34 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #35 pc 0000f624  anonymous:ee74c000 (boolean Main.foo()+164)\n"
-      "  #36 pc 006ad4d2  libartd.so (art_quick_invoke_stub+338)\n"
-      "  #37 pc 00146ab5  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+885)\n"
-      "  #38 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #39 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #40 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #41 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #42 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #43 pc 0000eedb  anonymous:ee74c000 (void Main.runPrimary()+59)\n"
-      "  #44 pc 006ad4d2  libartd.so (art_quick_invoke_stub+338)\n"
-      "  #45 pc 00146ab5  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+885)\n"
-      "  #46 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #47 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #48 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #49 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #50 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #51 pc 0000ac21  anonymous:ee74c000 (void Main.main(java.lang.String[])+97)\n"
-      "  #52 pc 006ad6a2  libartd.so (art_quick_invoke_static_stub+418)\n"
-      "  #53 pc 00146acb  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+907)\n"
-      "  #54 pc 0039cf0d  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+653)\n"
-      "  #55 pc 00392552  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+354)\n"
-      "  #56 pc 0039399a  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+234)\n"
-      "  #57 pc 00684362  libartd.so (artQuickToInterpreterBridge+1058)\n"
-      "  #58 pc 006b35bd  libartd.so (art_quick_to_interpreter_bridge+77)\n"
-      "  #59 pc 006ad6a2  libartd.so (art_quick_invoke_static_stub+418)\n"
-      "  #60 pc 00146acb  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+907)\n"
-      "  #61 pc 005aac95  libartd.so "
-      "(art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, "
-      "art::ArgArray*, art::JValue*, char const*)+85)\n"
-      "  #62 pc 005aab5a  libartd.so "
-      "(art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, "
-      "_jmethodID*, char*)+362)\n"
-      "  #63 pc 0048a3dd  libartd.so "
-      "(art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+125)\n"
-      "  #64 pc 0018448c  libartd.so "
-      "(art::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, char*, "
-      "art::Primitive::Type, art::InvokeType)+1964)\n"
-      "  #65 pc 0017cf06  libartd.so "
-      "(art::CheckJNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+70)\n"
-      "  #66 pc 00001d8c  dalvikvm32 "
-      "(_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+60)\n"
-      "  #67 pc 00001a80  dalvikvm32 (main+1312)\n"
-      "  #68 pc 00018275  libc.so\n",
-      frame_info);
-  EXPECT_EQ(0xeb89bfb8U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xffeb5280U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xeb89af00U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xffeb52a0U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xec6061a8U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xffeb5ce0U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xee75be80U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xffeb5d30U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xf728e4d2U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xffeb5d60U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0xf6d27ab5U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xffeb5d80U, unwinder.frames()[5].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xffeb5e20U, unwinder.frames()[6].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xffeb5ec0U, unwinder.frames()[7].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[8].pc);
-  EXPECT_EQ(0xffeb5f40U, unwinder.frames()[8].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[9].pc);
-  EXPECT_EQ(0xffeb5fb0U, unwinder.frames()[9].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[10].pc);
-  EXPECT_EQ(0xffeb6110U, unwinder.frames()[10].sp);
-  EXPECT_EQ(0xee75be03U, unwinder.frames()[11].pc);
-  EXPECT_EQ(0xffeb6160U, unwinder.frames()[11].sp);
-  EXPECT_EQ(0xf728e4d2U, unwinder.frames()[12].pc);
-  EXPECT_EQ(0xffeb6180U, unwinder.frames()[12].sp);
-  EXPECT_EQ(0xf6d27ab5U, unwinder.frames()[13].pc);
-  EXPECT_EQ(0xffeb61b0U, unwinder.frames()[13].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[14].pc);
-  EXPECT_EQ(0xffeb6250U, unwinder.frames()[14].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[15].pc);
-  EXPECT_EQ(0xffeb62f0U, unwinder.frames()[15].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[16].pc);
-  EXPECT_EQ(0xffeb6370U, unwinder.frames()[16].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[17].pc);
-  EXPECT_EQ(0xffeb63e0U, unwinder.frames()[17].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[18].pc);
-  EXPECT_EQ(0xffeb6530U, unwinder.frames()[18].sp);
-  EXPECT_EQ(0xee75bd3bU, unwinder.frames()[19].pc);
-  EXPECT_EQ(0xffeb6580U, unwinder.frames()[19].sp);
-  EXPECT_EQ(0xf728e4d2U, unwinder.frames()[20].pc);
-  EXPECT_EQ(0xffeb65b0U, unwinder.frames()[20].sp);
-  EXPECT_EQ(0xf6d27ab5U, unwinder.frames()[21].pc);
-  EXPECT_EQ(0xffeb65e0U, unwinder.frames()[21].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[22].pc);
-  EXPECT_EQ(0xffeb6680U, unwinder.frames()[22].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[23].pc);
-  EXPECT_EQ(0xffeb6720U, unwinder.frames()[23].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[24].pc);
-  EXPECT_EQ(0xffeb67a0U, unwinder.frames()[24].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[25].pc);
-  EXPECT_EQ(0xffeb6810U, unwinder.frames()[25].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[26].pc);
-  EXPECT_EQ(0xffeb6960U, unwinder.frames()[26].sp);
-  EXPECT_EQ(0xee75bbdbU, unwinder.frames()[27].pc);
-  EXPECT_EQ(0xffeb69b0U, unwinder.frames()[27].sp);
-  EXPECT_EQ(0xf728e6a2U, unwinder.frames()[28].pc);
-  EXPECT_EQ(0xffeb69f0U, unwinder.frames()[28].sp);
-  EXPECT_EQ(0xf6d27acbU, unwinder.frames()[29].pc);
-  EXPECT_EQ(0xffeb6a20U, unwinder.frames()[29].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[30].pc);
-  EXPECT_EQ(0xffeb6ac0U, unwinder.frames()[30].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[31].pc);
-  EXPECT_EQ(0xffeb6b60U, unwinder.frames()[31].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[32].pc);
-  EXPECT_EQ(0xffeb6be0U, unwinder.frames()[32].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[33].pc);
-  EXPECT_EQ(0xffeb6c50U, unwinder.frames()[33].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[34].pc);
-  EXPECT_EQ(0xffeb6dd0U, unwinder.frames()[34].sp);
-  EXPECT_EQ(0xee75b624U, unwinder.frames()[35].pc);
-  EXPECT_EQ(0xffeb6e20U, unwinder.frames()[35].sp);
-  EXPECT_EQ(0xf728e4d2U, unwinder.frames()[36].pc);
-  EXPECT_EQ(0xffeb6e50U, unwinder.frames()[36].sp);
-  EXPECT_EQ(0xf6d27ab5U, unwinder.frames()[37].pc);
-  EXPECT_EQ(0xffeb6e70U, unwinder.frames()[37].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[38].pc);
-  EXPECT_EQ(0xffeb6f10U, unwinder.frames()[38].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[39].pc);
-  EXPECT_EQ(0xffeb6fb0U, unwinder.frames()[39].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[40].pc);
-  EXPECT_EQ(0xffeb7030U, unwinder.frames()[40].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[41].pc);
-  EXPECT_EQ(0xffeb70a0U, unwinder.frames()[41].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[42].pc);
-  EXPECT_EQ(0xffeb71f0U, unwinder.frames()[42].sp);
-  EXPECT_EQ(0xee75aedbU, unwinder.frames()[43].pc);
-  EXPECT_EQ(0xffeb7240U, unwinder.frames()[43].sp);
-  EXPECT_EQ(0xf728e4d2U, unwinder.frames()[44].pc);
-  EXPECT_EQ(0xffeb72a0U, unwinder.frames()[44].sp);
-  EXPECT_EQ(0xf6d27ab5U, unwinder.frames()[45].pc);
-  EXPECT_EQ(0xffeb72c0U, unwinder.frames()[45].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[46].pc);
-  EXPECT_EQ(0xffeb7360U, unwinder.frames()[46].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[47].pc);
-  EXPECT_EQ(0xffeb7400U, unwinder.frames()[47].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[48].pc);
-  EXPECT_EQ(0xffeb7480U, unwinder.frames()[48].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[49].pc);
-  EXPECT_EQ(0xffeb74f0U, unwinder.frames()[49].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[50].pc);
-  EXPECT_EQ(0xffeb7680U, unwinder.frames()[50].sp);
-  EXPECT_EQ(0xee756c21U, unwinder.frames()[51].pc);
-  EXPECT_EQ(0xffeb76d0U, unwinder.frames()[51].sp);
-  EXPECT_EQ(0xf728e6a2U, unwinder.frames()[52].pc);
-  EXPECT_EQ(0xffeb76f0U, unwinder.frames()[52].sp);
-  EXPECT_EQ(0xf6d27acbU, unwinder.frames()[53].pc);
-  EXPECT_EQ(0xffeb7710U, unwinder.frames()[53].sp);
-  EXPECT_EQ(0xf6f7df0dU, unwinder.frames()[54].pc);
-  EXPECT_EQ(0xffeb77b0U, unwinder.frames()[54].sp);
-  EXPECT_EQ(0xf6f73552U, unwinder.frames()[55].pc);
-  EXPECT_EQ(0xffeb7850U, unwinder.frames()[55].sp);
-  EXPECT_EQ(0xf6f7499aU, unwinder.frames()[56].pc);
-  EXPECT_EQ(0xffeb78d0U, unwinder.frames()[56].sp);
-  EXPECT_EQ(0xf7265362U, unwinder.frames()[57].pc);
-  EXPECT_EQ(0xffeb7940U, unwinder.frames()[57].sp);
-  EXPECT_EQ(0xf72945bdU, unwinder.frames()[58].pc);
-  EXPECT_EQ(0xffeb7a80U, unwinder.frames()[58].sp);
-  EXPECT_EQ(0xf728e6a2U, unwinder.frames()[59].pc);
-  EXPECT_EQ(0xffeb7ad0U, unwinder.frames()[59].sp);
-  EXPECT_EQ(0xf6d27acbU, unwinder.frames()[60].pc);
-  EXPECT_EQ(0xffeb7af0U, unwinder.frames()[60].sp);
-  EXPECT_EQ(0xf718bc95U, unwinder.frames()[61].pc);
-  EXPECT_EQ(0xffeb7b90U, unwinder.frames()[61].sp);
-  EXPECT_EQ(0xf718bb5aU, unwinder.frames()[62].pc);
-  EXPECT_EQ(0xffeb7c50U, unwinder.frames()[62].sp);
-  EXPECT_EQ(0xf706b3ddU, unwinder.frames()[63].pc);
-  EXPECT_EQ(0xffeb7d10U, unwinder.frames()[63].sp);
-  EXPECT_EQ(0xf6d6548cU, unwinder.frames()[64].pc);
-  EXPECT_EQ(0xffeb7d70U, unwinder.frames()[64].sp);
-  EXPECT_EQ(0xf6d5df06U, unwinder.frames()[65].pc);
-  EXPECT_EQ(0xffeb7df0U, unwinder.frames()[65].sp);
-  EXPECT_EQ(0x56574d8cU, unwinder.frames()[66].pc);
-  EXPECT_EQ(0xffeb7e40U, unwinder.frames()[66].sp);
-  EXPECT_EQ(0x56574a80U, unwinder.frames()[67].pc);
-  EXPECT_EQ(0xffeb7e70U, unwinder.frames()[67].sp);
-  EXPECT_EQ(0xf7363275U, unwinder.frames()[68].pc);
-  EXPECT_EQ(0xffeb7ef0U, unwinder.frames()[68].sp);
-}
-
-TEST_F(UnwindOfflineTest, jit_debug_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("jit_debug_arm/", ARCH_ARM));
-
-  MemoryOfflineParts* memory = new MemoryOfflineParts;
-  AddMemory(dir_ + "descriptor.data", memory);
-  AddMemory(dir_ + "descriptor1.data", memory);
-  AddMemory(dir_ + "stack.data", memory);
-  for (size_t i = 0; i < 7; i++) {
-    AddMemory(dir_ + "entry" + std::to_string(i) + ".data", memory);
-    AddMemory(dir_ + "jit" + std::to_string(i) + ".data", memory);
-  }
-  process_memory_.reset(memory);
-
-  JitDebug jit_debug(process_memory_);
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.SetJitDebug(&jit_debug, regs_->Arch());
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(76U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00018a5e  libarttestd.so (Java_Main_unwindInProcess+866)\n"
-      "  #01 pc 0000212d  137-cfi.odex (boolean Main.unwindInProcess(boolean, int, "
-      "boolean)+92)\n"
-      "  #02 pc 00011cb1  anonymous:e2796000 (boolean Main.bar(boolean)+72)\n"
-      "  #03 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #04 pc 00467129  libartd.so (art_quick_invoke_stub+228)\n"
-      "  #05 pc 000bf7a9  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+864)\n"
-      "  #06 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #07 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #08 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #09 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #10 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #11 pc 00011c31  anonymous:e2796000 (int Main.compare(Main, Main)+64)\n"
-      "  #12 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #13 pc 00467129  libartd.so (art_quick_invoke_stub+228)\n"
-      "  #14 pc 000bf7a9  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+864)\n"
-      "  #15 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #16 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #17 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #18 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #19 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #20 pc 00011b77  anonymous:e2796000 (int Main.compare(java.lang.Object, "
-      "java.lang.Object)+118)\n"
-      "  #21 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #22 pc 00467129  libartd.so (art_quick_invoke_stub+228)\n"
-      "  #23 pc 000bf7a9  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+864)\n"
-      "  #24 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #25 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #26 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #27 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #28 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #29 pc 00011a29  anonymous:e2796000 (int "
-      "java.util.Arrays.binarySearch0(java.lang.Object[], int, int, java.lang.Object, "
-      "java.util.Comparator)+304)\n"
-      "  #30 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #31 pc 0046722f  libartd.so (art_quick_invoke_static_stub+226)\n"
-      "  #32 pc 000bf7bb  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+882)\n"
-      "  #33 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #34 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #35 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #36 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #37 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #38 pc 0001139b  anonymous:e2796000 (boolean Main.foo()+178)\n"
-      "  #39 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #40 pc 00467129  libartd.so (art_quick_invoke_stub+228)\n"
-      "  #41 pc 000bf7a9  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+864)\n"
-      "  #42 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #43 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #44 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #45 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #46 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #47 pc 00010aa7  anonymous:e2796000 (void Main.runPrimary()+70)\n"
-      "  #48 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #49 pc 00467129  libartd.so (art_quick_invoke_stub+228)\n"
-      "  #50 pc 000bf7a9  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+864)\n"
-      "  #51 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #52 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #53 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #54 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #55 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #56 pc 0000ba99  anonymous:e2796000 (void Main.main(java.lang.String[])+144)\n"
-      "  #57 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #58 pc 0046722f  libartd.so (art_quick_invoke_static_stub+226)\n"
-      "  #59 pc 000bf7bb  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+882)\n"
-      "  #60 pc 00247833  libartd.so "
-      "(art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, "
-      "art::ShadowFrame*, unsigned short, art::JValue*)+382)\n"
-      "  #61 pc 0022e935  libartd.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+244)\n"
-      "  #62 pc 0022f71d  libartd.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+128)\n"
-      "  #63 pc 00442865  libartd.so (artQuickToInterpreterBridge+796)\n"
-      "  #64 pc 004666ff  libartd.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #65 pc 00462175  libartd.so (art_quick_invoke_stub_internal+68)\n"
-      "  #66 pc 0046722f  libartd.so (art_quick_invoke_static_stub+226)\n"
-      "  #67 pc 000bf7bb  libartd.so "
-      "(art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char "
-      "const*)+882)\n"
-      "  #68 pc 003b292d  libartd.so "
-      "(art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, "
-      "art::ArgArray*, art::JValue*, char const*)+52)\n"
-      "  #69 pc 003b26c3  libartd.so "
-      "(art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, "
-      "_jmethodID*, std::__va_list)+210)\n"
-      "  #70 pc 00308411  libartd.so "
-      "(art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+76)\n"
-      "  #71 pc 000e6a9f  libartd.so "
-      "(art::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, "
-      "std::__va_list, art::Primitive::Type, art::InvokeType)+1486)\n"
-      "  #72 pc 000e19b9  libartd.so "
-      "(art::CheckJNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+40)\n"
-      "  #73 pc 0000159f  dalvikvm32 "
-      "(_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+30)\n"
-      "  #74 pc 00001349  dalvikvm32 (main+896)\n"
-      "  #75 pc 000850c9  libc.so\n",
-      frame_info);
-  EXPECT_EQ(0xdfe66a5eU, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xff85d180U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xe044712dU, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xff85d200U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xe27a7cb1U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xff85d290U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xff85d2b0U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xed761129U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xff85d2e8U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0xed3b97a9U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xff85d370U, unwinder.frames()[5].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xff85d3d8U, unwinder.frames()[6].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xff85d428U, unwinder.frames()[7].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[8].pc);
-  EXPECT_EQ(0xff85d470U, unwinder.frames()[8].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[9].pc);
-  EXPECT_EQ(0xff85d4b0U, unwinder.frames()[9].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[10].pc);
-  EXPECT_EQ(0xff85d5d0U, unwinder.frames()[10].sp);
-  EXPECT_EQ(0xe27a7c31U, unwinder.frames()[11].pc);
-  EXPECT_EQ(0xff85d640U, unwinder.frames()[11].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[12].pc);
-  EXPECT_EQ(0xff85d660U, unwinder.frames()[12].sp);
-  EXPECT_EQ(0xed761129U, unwinder.frames()[13].pc);
-  EXPECT_EQ(0xff85d698U, unwinder.frames()[13].sp);
-  EXPECT_EQ(0xed3b97a9U, unwinder.frames()[14].pc);
-  EXPECT_EQ(0xff85d720U, unwinder.frames()[14].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[15].pc);
-  EXPECT_EQ(0xff85d788U, unwinder.frames()[15].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[16].pc);
-  EXPECT_EQ(0xff85d7d8U, unwinder.frames()[16].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[17].pc);
-  EXPECT_EQ(0xff85d820U, unwinder.frames()[17].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[18].pc);
-  EXPECT_EQ(0xff85d860U, unwinder.frames()[18].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[19].pc);
-  EXPECT_EQ(0xff85d970U, unwinder.frames()[19].sp);
-  EXPECT_EQ(0xe27a7b77U, unwinder.frames()[20].pc);
-  EXPECT_EQ(0xff85d9e0U, unwinder.frames()[20].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[21].pc);
-  EXPECT_EQ(0xff85da10U, unwinder.frames()[21].sp);
-  EXPECT_EQ(0xed761129U, unwinder.frames()[22].pc);
-  EXPECT_EQ(0xff85da48U, unwinder.frames()[22].sp);
-  EXPECT_EQ(0xed3b97a9U, unwinder.frames()[23].pc);
-  EXPECT_EQ(0xff85dad0U, unwinder.frames()[23].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[24].pc);
-  EXPECT_EQ(0xff85db38U, unwinder.frames()[24].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[25].pc);
-  EXPECT_EQ(0xff85db88U, unwinder.frames()[25].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[26].pc);
-  EXPECT_EQ(0xff85dbd0U, unwinder.frames()[26].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[27].pc);
-  EXPECT_EQ(0xff85dc10U, unwinder.frames()[27].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[28].pc);
-  EXPECT_EQ(0xff85dd20U, unwinder.frames()[28].sp);
-  EXPECT_EQ(0xe27a7a29U, unwinder.frames()[29].pc);
-  EXPECT_EQ(0xff85dd90U, unwinder.frames()[29].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[30].pc);
-  EXPECT_EQ(0xff85ddc0U, unwinder.frames()[30].sp);
-  EXPECT_EQ(0xed76122fU, unwinder.frames()[31].pc);
-  EXPECT_EQ(0xff85de08U, unwinder.frames()[31].sp);
-  EXPECT_EQ(0xed3b97bbU, unwinder.frames()[32].pc);
-  EXPECT_EQ(0xff85de90U, unwinder.frames()[32].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[33].pc);
-  EXPECT_EQ(0xff85def8U, unwinder.frames()[33].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[34].pc);
-  EXPECT_EQ(0xff85df48U, unwinder.frames()[34].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[35].pc);
-  EXPECT_EQ(0xff85df90U, unwinder.frames()[35].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[36].pc);
-  EXPECT_EQ(0xff85dfd0U, unwinder.frames()[36].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[37].pc);
-  EXPECT_EQ(0xff85e110U, unwinder.frames()[37].sp);
-  EXPECT_EQ(0xe27a739bU, unwinder.frames()[38].pc);
-  EXPECT_EQ(0xff85e180U, unwinder.frames()[38].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[39].pc);
-  EXPECT_EQ(0xff85e1b0U, unwinder.frames()[39].sp);
-  EXPECT_EQ(0xed761129U, unwinder.frames()[40].pc);
-  EXPECT_EQ(0xff85e1e0U, unwinder.frames()[40].sp);
-  EXPECT_EQ(0xed3b97a9U, unwinder.frames()[41].pc);
-  EXPECT_EQ(0xff85e268U, unwinder.frames()[41].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[42].pc);
-  EXPECT_EQ(0xff85e2d0U, unwinder.frames()[42].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[43].pc);
-  EXPECT_EQ(0xff85e320U, unwinder.frames()[43].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[44].pc);
-  EXPECT_EQ(0xff85e368U, unwinder.frames()[44].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[45].pc);
-  EXPECT_EQ(0xff85e3a8U, unwinder.frames()[45].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[46].pc);
-  EXPECT_EQ(0xff85e4c0U, unwinder.frames()[46].sp);
-  EXPECT_EQ(0xe27a6aa7U, unwinder.frames()[47].pc);
-  EXPECT_EQ(0xff85e530U, unwinder.frames()[47].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[48].pc);
-  EXPECT_EQ(0xff85e5a0U, unwinder.frames()[48].sp);
-  EXPECT_EQ(0xed761129U, unwinder.frames()[49].pc);
-  EXPECT_EQ(0xff85e5d8U, unwinder.frames()[49].sp);
-  EXPECT_EQ(0xed3b97a9U, unwinder.frames()[50].pc);
-  EXPECT_EQ(0xff85e660U, unwinder.frames()[50].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[51].pc);
-  EXPECT_EQ(0xff85e6c8U, unwinder.frames()[51].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[52].pc);
-  EXPECT_EQ(0xff85e718U, unwinder.frames()[52].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[53].pc);
-  EXPECT_EQ(0xff85e760U, unwinder.frames()[53].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[54].pc);
-  EXPECT_EQ(0xff85e7a0U, unwinder.frames()[54].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[55].pc);
-  EXPECT_EQ(0xff85e8f0U, unwinder.frames()[55].sp);
-  EXPECT_EQ(0xe27a1a99U, unwinder.frames()[56].pc);
-  EXPECT_EQ(0xff85e960U, unwinder.frames()[56].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[57].pc);
-  EXPECT_EQ(0xff85e990U, unwinder.frames()[57].sp);
-  EXPECT_EQ(0xed76122fU, unwinder.frames()[58].pc);
-  EXPECT_EQ(0xff85e9c8U, unwinder.frames()[58].sp);
-  EXPECT_EQ(0xed3b97bbU, unwinder.frames()[59].pc);
-  EXPECT_EQ(0xff85ea50U, unwinder.frames()[59].sp);
-  EXPECT_EQ(0xed541833U, unwinder.frames()[60].pc);
-  EXPECT_EQ(0xff85eab8U, unwinder.frames()[60].sp);
-  EXPECT_EQ(0xed528935U, unwinder.frames()[61].pc);
-  EXPECT_EQ(0xff85eb08U, unwinder.frames()[61].sp);
-  EXPECT_EQ(0xed52971dU, unwinder.frames()[62].pc);
-  EXPECT_EQ(0xff85eb50U, unwinder.frames()[62].sp);
-  EXPECT_EQ(0xed73c865U, unwinder.frames()[63].pc);
-  EXPECT_EQ(0xff85eb90U, unwinder.frames()[63].sp);
-  EXPECT_EQ(0xed7606ffU, unwinder.frames()[64].pc);
-  EXPECT_EQ(0xff85ec90U, unwinder.frames()[64].sp);
-  EXPECT_EQ(0xed75c175U, unwinder.frames()[65].pc);
-  EXPECT_EQ(0xff85ed00U, unwinder.frames()[65].sp);
-  EXPECT_EQ(0xed76122fU, unwinder.frames()[66].pc);
-  EXPECT_EQ(0xff85ed38U, unwinder.frames()[66].sp);
-  EXPECT_EQ(0xed3b97bbU, unwinder.frames()[67].pc);
-  EXPECT_EQ(0xff85edc0U, unwinder.frames()[67].sp);
-  EXPECT_EQ(0xed6ac92dU, unwinder.frames()[68].pc);
-  EXPECT_EQ(0xff85ee28U, unwinder.frames()[68].sp);
-  EXPECT_EQ(0xed6ac6c3U, unwinder.frames()[69].pc);
-  EXPECT_EQ(0xff85eeb8U, unwinder.frames()[69].sp);
-  EXPECT_EQ(0xed602411U, unwinder.frames()[70].pc);
-  EXPECT_EQ(0xff85ef48U, unwinder.frames()[70].sp);
-  EXPECT_EQ(0xed3e0a9fU, unwinder.frames()[71].pc);
-  EXPECT_EQ(0xff85ef90U, unwinder.frames()[71].sp);
-  EXPECT_EQ(0xed3db9b9U, unwinder.frames()[72].pc);
-  EXPECT_EQ(0xff85f008U, unwinder.frames()[72].sp);
-  EXPECT_EQ(0xab0d459fU, unwinder.frames()[73].pc);
-  EXPECT_EQ(0xff85f038U, unwinder.frames()[73].sp);
-  EXPECT_EQ(0xab0d4349U, unwinder.frames()[74].pc);
-  EXPECT_EQ(0xff85f050U, unwinder.frames()[74].sp);
-  EXPECT_EQ(0xedb0d0c9U, unwinder.frames()[75].pc);
-  EXPECT_EQ(0xff85f0c0U, unwinder.frames()[75].sp);
-}
-
-struct LeakType {
-  LeakType(Maps* maps, Regs* regs, std::shared_ptr<Memory>& process_memory)
-      : maps(maps), regs(regs), process_memory(process_memory) {}
-
-  Maps* maps;
-  Regs* regs;
-  std::shared_ptr<Memory>& process_memory;
-};
-
-static void OfflineUnwind(void* data) {
-  LeakType* leak_data = reinterpret_cast<LeakType*>(data);
-
-  std::unique_ptr<Regs> regs_copy(leak_data->regs->Clone());
-  JitDebug jit_debug(leak_data->process_memory);
-  Unwinder unwinder(128, leak_data->maps, regs_copy.get(), leak_data->process_memory);
-  unwinder.SetJitDebug(&jit_debug, regs_copy->Arch());
-  unwinder.Unwind();
-  ASSERT_EQ(76U, unwinder.NumFrames());
-}
-
-TEST_F(UnwindOfflineTest, unwind_offline_check_for_leaks) {
-  ASSERT_NO_FATAL_FAILURE(Init("jit_debug_arm/", ARCH_ARM));
-
-  MemoryOfflineParts* memory = new MemoryOfflineParts;
-  AddMemory(dir_ + "descriptor.data", memory);
-  AddMemory(dir_ + "descriptor1.data", memory);
-  AddMemory(dir_ + "stack.data", memory);
-  for (size_t i = 0; i < 7; i++) {
-    AddMemory(dir_ + "entry" + std::to_string(i) + ".data", memory);
-    AddMemory(dir_ + "jit" + std::to_string(i) + ".data", memory);
-  }
-  process_memory_.reset(memory);
-
-  LeakType data(maps_.get(), regs_.get(), process_memory_);
-  TestCheckForLeaks(OfflineUnwind, &data);
-}
-
-// The eh_frame_hdr data is present but set to zero fdes. This should
-// fallback to iterating over the cies/fdes and ignore the eh_frame_hdr.
-// No .gnu_debugdata section in the elf file, so no symbols.
-TEST_F(UnwindOfflineTest, bad_eh_frame_hdr_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("bad_eh_frame_hdr_arm64/", ARCH_ARM64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(5U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0000000000000550  waiter64\n"
-      "  #01 pc 0000000000000568  waiter64\n"
-      "  #02 pc 000000000000057c  waiter64\n"
-      "  #03 pc 0000000000000590  waiter64\n"
-      "  #04 pc 00000000000a8e98  libc.so (__libc_init+88)\n",
-      frame_info);
-  EXPECT_EQ(0x60a9fdf550U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7fdd141990U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x60a9fdf568U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7fdd1419a0U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x60a9fdf57cU, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7fdd1419b0U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x60a9fdf590U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7fdd1419c0U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x7542d68e98U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7fdd1419d0U, unwinder.frames()[4].sp);
-}
-
-// The elf has bad eh_frame unwind information for the pcs. If eh_frame
-// is used first, the unwind will not match the expected output.
-TEST_F(UnwindOfflineTest, debug_frame_first_x86) {
-  ASSERT_NO_FATAL_FAILURE(Init("debug_frame_first_x86/", ARCH_X86));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(5U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00000685  waiter (call_level3+53)\n"
-      "  #01 pc 000006b7  waiter (call_level2+23)\n"
-      "  #02 pc 000006d7  waiter (call_level1+23)\n"
-      "  #03 pc 000006f7  waiter (main+23)\n"
-      "  #04 pc 00018275  libc.so\n",
-      frame_info);
-  EXPECT_EQ(0x56598685U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xffcf9e38U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x565986b7U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xffcf9e50U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x565986d7U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xffcf9e60U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x565986f7U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xffcf9e70U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xf744a275U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xffcf9e80U, unwinder.frames()[4].sp);
-}
-
-// Make sure that a pc that is at the beginning of an fde unwinds correctly.
-TEST_F(UnwindOfflineTest, eh_frame_hdr_begin_x86_64) {
-  ASSERT_NO_FATAL_FAILURE(Init("eh_frame_hdr_begin_x86_64/", ARCH_X86_64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(5U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0000000000000a80  unwind_test64 (calling3)\n"
-      "  #01 pc 0000000000000dd9  unwind_test64 (calling2+633)\n"
-      "  #02 pc 000000000000121e  unwind_test64 (calling1+638)\n"
-      "  #03 pc 00000000000013ed  unwind_test64 (main+13)\n"
-      "  #04 pc 00000000000202b0  libc.so\n",
-      frame_info);
-  EXPECT_EQ(0x561550b17a80U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7ffcc8596ce8U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x561550b17dd9U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7ffcc8596cf0U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x561550b1821eU, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7ffcc8596f40U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x561550b183edU, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7ffcc8597190U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x7f4de62162b0U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7ffcc85971a0U, unwinder.frames()[4].sp);
-}
-
-TEST_F(UnwindOfflineTest, art_quick_osr_stub_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("art_quick_osr_stub_arm/", ARCH_ARM));
-
-  MemoryOfflineParts* memory = new MemoryOfflineParts;
-  AddMemory(dir_ + "descriptor.data", memory);
-  AddMemory(dir_ + "stack.data", memory);
-  for (size_t i = 0; i < 2; i++) {
-    AddMemory(dir_ + "entry" + std::to_string(i) + ".data", memory);
-    AddMemory(dir_ + "jit" + std::to_string(i) + ".data", memory);
-  }
-  process_memory_.reset(memory);
-
-  JitDebug jit_debug(process_memory_);
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.SetJitDebug(&jit_debug, regs_->Arch());
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(25U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0000c788  <anonymous:d0250000> "
-      "(com.example.simpleperf.simpleperfexamplewithnative.MixActivity.access$000)\n"
-      "  #01 pc 0000cdd5  <anonymous:d0250000> "
-      "(com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run+60)\n"
-      "  #02 pc 004135bb  libart.so (art_quick_osr_stub+42)\n"
-      "  #03 pc 002657a5  libart.so "
-      "(art::jit::Jit::MaybeDoOnStackReplacement(art::Thread*, art::ArtMethod*, unsigned int, int, "
-      "art::JValue*)+876)\n"
-      "  #04 pc 004021a7  libart.so (MterpMaybeDoOnStackReplacement+86)\n"
-      "  #05 pc 00412474  libart.so (ExecuteMterpImpl+66164)\n"
-      "  #06 pc cd8365b0  <unknown>\n"  // symbol in dex file
-      "  #07 pc 001d7f1b  libart.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+374)\n"
-      "  #08 pc 001dc593  libart.so "
-      "(art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, "
-      "art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+154)\n"
-      "  #09 pc 001f4d01  libart.so "
-      "(bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, "
-      "art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+732)\n"
-      "  #10 pc 003fe427  libart.so (MterpInvokeInterface+1354)\n"
-      "  #11 pc 00405b94  libart.so (ExecuteMterpImpl+14740)\n"
-      "  #12 pc 7004873e  <unknown>\n"  // symbol in dex file
-      "  #13 pc 001d7f1b  libart.so "
-      "(art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, "
-      "art::ShadowFrame&, art::JValue, bool)+374)\n"
-      "  #14 pc 001dc4d5  libart.so "
-      "(art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor "
-      "const&, art::ShadowFrame*)+92)\n"
-      "  #15 pc 003f25ab  libart.so (artQuickToInterpreterBridge+970)\n"
-      "  #16 pc 00417aff  libart.so (art_quick_to_interpreter_bridge+30)\n"
-      "  #17 pc 00413575  libart.so (art_quick_invoke_stub_internal+68)\n"
-      "  #18 pc 00418531  libart.so (art_quick_invoke_stub+236)\n"
-      "  #19 pc 000b468d  libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned "
-      "int, art::JValue*, char const*)+136)\n"
-      "  #20 pc 00362f49  libart.so "
-      "(art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable "
-      "const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char "
-      "const*)+52)\n"
-      "  #21 pc 00363cd9  libart.so "
-      "(art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, "
-      "_jobject*, _jmethodID*, jvalue*)+332)\n"
-      "  #22 pc 003851dd  libart.so (art::Thread::CreateCallback(void*)+868)\n"
-      "  #23 pc 00062925  libc.so (__pthread_start(void*)+22)\n"
-      "  #24 pc 0001de39  libc.so (__start_thread+24)\n",
-      frame_info);
-  EXPECT_EQ(0xd025c788U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xcd4ff140U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xd025cdd5U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xcd4ff140U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xe4a755bbU, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xcd4ff160U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xe48c77a5U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xcd4ff190U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xe4a641a7U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xcd4ff298U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0xe4a74474U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xcd4ff2b8U, unwinder.frames()[5].sp);
-  EXPECT_EQ(0xcd8365b0U, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xcd4ff2e0U, unwinder.frames()[6].sp);
-  EXPECT_EQ(0xe4839f1bU, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xcd4ff2e0U, unwinder.frames()[7].sp);
-  EXPECT_EQ(0xe483e593U, unwinder.frames()[8].pc);
-  EXPECT_EQ(0xcd4ff330U, unwinder.frames()[8].sp);
-  EXPECT_EQ(0xe4856d01U, unwinder.frames()[9].pc);
-  EXPECT_EQ(0xcd4ff380U, unwinder.frames()[9].sp);
-  EXPECT_EQ(0xe4a60427U, unwinder.frames()[10].pc);
-  EXPECT_EQ(0xcd4ff430U, unwinder.frames()[10].sp);
-  EXPECT_EQ(0xe4a67b94U, unwinder.frames()[11].pc);
-  EXPECT_EQ(0xcd4ff498U, unwinder.frames()[11].sp);
-  EXPECT_EQ(0x7004873eU, unwinder.frames()[12].pc);
-  EXPECT_EQ(0xcd4ff4c0U, unwinder.frames()[12].sp);
-  EXPECT_EQ(0xe4839f1bU, unwinder.frames()[13].pc);
-  EXPECT_EQ(0xcd4ff4c0U, unwinder.frames()[13].sp);
-  EXPECT_EQ(0xe483e4d5U, unwinder.frames()[14].pc);
-  EXPECT_EQ(0xcd4ff510U, unwinder.frames()[14].sp);
-  EXPECT_EQ(0xe4a545abU, unwinder.frames()[15].pc);
-  EXPECT_EQ(0xcd4ff538U, unwinder.frames()[15].sp);
-  EXPECT_EQ(0xe4a79affU, unwinder.frames()[16].pc);
-  EXPECT_EQ(0xcd4ff640U, unwinder.frames()[16].sp);
-  EXPECT_EQ(0xe4a75575U, unwinder.frames()[17].pc);
-  EXPECT_EQ(0xcd4ff6b0U, unwinder.frames()[17].sp);
-  EXPECT_EQ(0xe4a7a531U, unwinder.frames()[18].pc);
-  EXPECT_EQ(0xcd4ff6e8U, unwinder.frames()[18].sp);
-  EXPECT_EQ(0xe471668dU, unwinder.frames()[19].pc);
-  EXPECT_EQ(0xcd4ff770U, unwinder.frames()[19].sp);
-  EXPECT_EQ(0xe49c4f49U, unwinder.frames()[20].pc);
-  EXPECT_EQ(0xcd4ff7c8U, unwinder.frames()[20].sp);
-  EXPECT_EQ(0xe49c5cd9U, unwinder.frames()[21].pc);
-  EXPECT_EQ(0xcd4ff850U, unwinder.frames()[21].sp);
-  EXPECT_EQ(0xe49e71ddU, unwinder.frames()[22].pc);
-  EXPECT_EQ(0xcd4ff8e8U, unwinder.frames()[22].sp);
-  EXPECT_EQ(0xe7df3925U, unwinder.frames()[23].pc);
-  EXPECT_EQ(0xcd4ff958U, unwinder.frames()[23].sp);
-  EXPECT_EQ(0xe7daee39U, unwinder.frames()[24].pc);
-  EXPECT_EQ(0xcd4ff960U, unwinder.frames()[24].sp);
-}
-
-TEST_F(UnwindOfflineTest, jit_map_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("jit_map_arm/", ARCH_ARM));
-
-  maps_->Add(0xd025c788, 0xd025c9f0, 0, PROT_READ | PROT_EXEC | MAPS_FLAGS_JIT_SYMFILE_MAP,
-             "jit_map0.so", 0);
-  maps_->Add(0xd025cd98, 0xd025cff4, 0, PROT_READ | PROT_EXEC | MAPS_FLAGS_JIT_SYMFILE_MAP,
-             "jit_map1.so", 0);
-  maps_->Sort();
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(6U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00000000  jit_map0.so "
-      "(com.example.simpleperf.simpleperfexamplewithnative.MixActivity.access$000)\n"
-      "  #01 pc 0000003d  jit_map1.so "
-      "(com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run+60)\n"
-      "  #02 pc 004135bb  libart.so (art_quick_osr_stub+42)\n"
-
-      "  #03 pc 003851dd  libart.so (art::Thread::CreateCallback(void*)+868)\n"
-      "  #04 pc 00062925  libc.so (__pthread_start(void*)+22)\n"
-      "  #05 pc 0001de39  libc.so (__start_thread+24)\n",
-      frame_info);
-
-  EXPECT_EQ(0xd025c788U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xcd4ff140U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xd025cdd5U, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xcd4ff140U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xe4a755bbU, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xcd4ff160U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xe49e71ddU, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xcd4ff8e8U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xe7df3925U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xcd4ff958U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0xe7daee39U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xcd4ff960U, unwinder.frames()[5].sp);
-}
-
-TEST_F(UnwindOfflineTest, offset_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("offset_arm/", ARCH_ARM));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(19U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0032bfa0  libunwindstack_test (SignalInnerFunction+40)\n"
-      "  #01 pc 0032bfeb  libunwindstack_test (SignalMiddleFunction+2)\n"
-      "  #02 pc 0032bff3  libunwindstack_test (SignalOuterFunction+2)\n"
-      "  #03 pc 0032fed3  libunwindstack_test "
-      "(unwindstack::SignalCallerHandler(int, siginfo*, void*)+26)\n"
-      "  #04 pc 0002652c  libc.so (__restore)\n"
-      "  #05 pc 00000000  <unknown>\n"
-      "  #06 pc 0032c2d9  libunwindstack_test (InnerFunction+736)\n"
-      "  #07 pc 0032cc4f  libunwindstack_test (MiddleFunction+42)\n"
-      "  #08 pc 0032cc81  libunwindstack_test (OuterFunction+42)\n"
-      "  #09 pc 0032e547  libunwindstack_test "
-      "(unwindstack::RemoteThroughSignal(int, unsigned int)+270)\n"
-      "  #10 pc 0032ed99  libunwindstack_test "
-      "(unwindstack::UnwindTest_remote_through_signal_with_invalid_func_Test::TestBody()+16)\n"
-      "  #11 pc 00354453  libunwindstack_test (testing::Test::Run()+154)\n"
-      "  #12 pc 00354de7  libunwindstack_test (testing::TestInfo::Run()+194)\n"
-      "  #13 pc 00355105  libunwindstack_test (testing::TestCase::Run()+180)\n"
-      "  #14 pc 0035a215  libunwindstack_test "
-      "(testing::internal::UnitTestImpl::RunAllTests()+664)\n"
-      "  #15 pc 00359f4f  libunwindstack_test (testing::UnitTest::Run()+110)\n"
-      "  #16 pc 0034d3db  libunwindstack_test (main+38)\n"
-      "  #17 pc 00092c0d  libc.so (__libc_init+48)\n"
-      "  #18 pc 0004202f  libunwindstack_test (_start_main+38)\n",
-      frame_info);
-
-  EXPECT_EQ(0x2e55fa0U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xf43d2cccU, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x2e55febU, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xf43d2ce0U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x2e55ff3U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xf43d2ce8U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x2e59ed3U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xf43d2cf0U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xf413652cU, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xf43d2d10U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xffcc0ee0U, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x2e562d9U, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xffcc0ee0U, unwinder.frames()[6].sp);
-  EXPECT_EQ(0x2e56c4fU, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xffcc1060U, unwinder.frames()[7].sp);
-  EXPECT_EQ(0x2e56c81U, unwinder.frames()[8].pc);
-  EXPECT_EQ(0xffcc1078U, unwinder.frames()[8].sp);
-  EXPECT_EQ(0x2e58547U, unwinder.frames()[9].pc);
-  EXPECT_EQ(0xffcc1090U, unwinder.frames()[9].sp);
-  EXPECT_EQ(0x2e58d99U, unwinder.frames()[10].pc);
-  EXPECT_EQ(0xffcc1438U, unwinder.frames()[10].sp);
-  EXPECT_EQ(0x2e7e453U, unwinder.frames()[11].pc);
-  EXPECT_EQ(0xffcc1448U, unwinder.frames()[11].sp);
-  EXPECT_EQ(0x2e7ede7U, unwinder.frames()[12].pc);
-  EXPECT_EQ(0xffcc1458U, unwinder.frames()[12].sp);
-  EXPECT_EQ(0x2e7f105U, unwinder.frames()[13].pc);
-  EXPECT_EQ(0xffcc1490U, unwinder.frames()[13].sp);
-  EXPECT_EQ(0x2e84215U, unwinder.frames()[14].pc);
-  EXPECT_EQ(0xffcc14c0U, unwinder.frames()[14].sp);
-  EXPECT_EQ(0x2e83f4fU, unwinder.frames()[15].pc);
-  EXPECT_EQ(0xffcc1510U, unwinder.frames()[15].sp);
-  EXPECT_EQ(0x2e773dbU, unwinder.frames()[16].pc);
-  EXPECT_EQ(0xffcc1528U, unwinder.frames()[16].sp);
-  EXPECT_EQ(0xf41a2c0dU, unwinder.frames()[17].pc);
-  EXPECT_EQ(0xffcc1540U, unwinder.frames()[17].sp);
-  EXPECT_EQ(0x2b6c02fU, unwinder.frames()[18].pc);
-  EXPECT_EQ(0xffcc1558U, unwinder.frames()[18].sp);
-}
-
-// Test using a non-zero load bias library that has the fde entries
-// encoded as 0xb, which is not set as pc relative.
-TEST_F(UnwindOfflineTest, debug_frame_load_bias_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("debug_frame_load_bias_arm/", ARCH_ARM));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(8U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0005138c  libc.so (__ioctl+8)\n"
-      "  #01 pc 0002140f  libc.so (ioctl+30)\n"
-      "  #02 pc 00039535  libbinder.so (android::IPCThreadState::talkWithDriver(bool)+204)\n"
-      "  #03 pc 00039633  libbinder.so (android::IPCThreadState::getAndExecuteCommand()+10)\n"
-      "  #04 pc 00039b57  libbinder.so (android::IPCThreadState::joinThreadPool(bool)+38)\n"
-      "  #05 pc 00000c21  mediaserver (main+104)\n"
-      "  #06 pc 00084b89  libc.so (__libc_init+48)\n"
-      "  #07 pc 00000b77  mediaserver (_start_main+38)\n",
-      frame_info);
-
-  EXPECT_EQ(0xf0be238cU, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xffd4a638U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xf0bb240fU, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xffd4a638U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xf1a75535U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xffd4a650U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xf1a75633U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xffd4a6b0U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xf1a75b57U, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xffd4a6d0U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x8d1cc21U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xffd4a6e8U, unwinder.frames()[5].sp);
-  EXPECT_EQ(0xf0c15b89U, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xffd4a700U, unwinder.frames()[6].sp);
-  EXPECT_EQ(0x8d1cb77U, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xffd4a718U, unwinder.frames()[7].sp);
-}
-
-TEST_F(UnwindOfflineTest, shared_lib_in_apk_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("shared_lib_in_apk_arm64/", ARCH_ARM64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(7U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 000000000014ccbc  linker64 (__dl_syscall+28)\n"
-      "  #01 pc 000000000005426c  linker64 "
-      "(__dl__ZL24debuggerd_signal_handleriP7siginfoPv+1128)\n"
-      "  #02 pc 00000000000008c0  vdso.so (__kernel_rt_sigreturn)\n"
-      "  #03 pc 00000000000846f4  libc.so (abort+172)\n"
-      "  #04 pc 0000000000084ad4  libc.so (__assert2+36)\n"
-      "  #05 pc 000000000003d5b4  ANGLEPrebuilt.apk!libfeature_support_angle.so (offset 0x4000) "
-      "(ANGLEGetUtilityAPI+56)\n"
-      "  #06 pc 000000000007fe68  libc.so (__libc_init)\n",
-      frame_info);
-
-  EXPECT_EQ(0x7e82c4fcbcULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7df8ca3bf0ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x7e82b5726cULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7df8ca3bf0ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x7e82b018c0ULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7df8ca3da0ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x7e7eecc6f4ULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7dabf3db60ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x7e7eeccad4ULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7dabf3dc40ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x7dabc405b4ULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7dabf3dc50ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x7e7eec7e68ULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0x7dabf3dc70ULL, unwinder.frames()[6].sp);
-  // Ignore top frame since the test code was modified to end in __libc_init.
-}
-
-TEST_F(UnwindOfflineTest, shared_lib_in_apk_memory_only_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("shared_lib_in_apk_memory_only_arm64/", ARCH_ARM64));
-  // Add the memory that represents the shared library.
-  MemoryOfflineParts* memory = reinterpret_cast<MemoryOfflineParts*>(process_memory_.get());
-  AddMemory(dir_ + "lib_mem.data", memory);
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(7U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 000000000014ccbc  linker64 (__dl_syscall+28)\n"
-      "  #01 pc 000000000005426c  linker64 "
-      "(__dl__ZL24debuggerd_signal_handleriP7siginfoPv+1128)\n"
-      "  #02 pc 00000000000008c0  vdso.so (__kernel_rt_sigreturn)\n"
-      "  #03 pc 00000000000846f4  libc.so (abort+172)\n"
-      "  #04 pc 0000000000084ad4  libc.so (__assert2+36)\n"
-      "  #05 pc 000000000003d5b4  ANGLEPrebuilt.apk (offset 0x21d5000)\n"
-      "  #06 pc 000000000007fe68  libc.so (__libc_init)\n",
-      frame_info);
-
-  EXPECT_EQ(0x7e82c4fcbcULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7df8ca3bf0ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x7e82b5726cULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7df8ca3bf0ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x7e82b018c0ULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7df8ca3da0ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x7e7eecc6f4ULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7dabf3db60ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x7e7eeccad4ULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7dabf3dc40ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x7dabc405b4ULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7dabf3dc50ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x7e7eec7e68ULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0x7dabf3dc70ULL, unwinder.frames()[6].sp);
-  // Ignore top frame since the test code was modified to end in __libc_init.
-}
-
-TEST_F(UnwindOfflineTest, shared_lib_in_apk_single_map_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("shared_lib_in_apk_single_map_arm64/", ARCH_ARM64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(13U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00000000000814bc  libc.so (syscall+28)\n"
-      "  #01 pc 00000000008cdf5c  test.apk (offset 0x5000)\n"
-      "  #02 pc 00000000008cde9c  test.apk (offset 0x5000)\n"
-      "  #03 pc 00000000008cdd70  test.apk (offset 0x5000)\n"
-      "  #04 pc 00000000008ce408  test.apk (offset 0x5000)\n"
-      "  #05 pc 00000000008ce8d8  test.apk (offset 0x5000)\n"
-      "  #06 pc 00000000008ce814  test.apk (offset 0x5000)\n"
-      "  #07 pc 00000000008bcf60  test.apk (offset 0x5000)\n"
-      "  #08 pc 0000000000133024  test.apk (offset 0x5000)\n"
-      "  #09 pc 0000000000134ad0  test.apk (offset 0x5000)\n"
-      "  #10 pc 0000000000134b64  test.apk (offset 0x5000)\n"
-      "  #11 pc 00000000000e406c  libc.so (__pthread_start(void*)+36)\n"
-      "  #12 pc 0000000000085e18  libc.so (__start_thread+64)\n",
-      frame_info);
-
-  EXPECT_EQ(0x7cbe0b14bcULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7be4f077d0ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x7be6715f5cULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7be4f077d0ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x7be6715e9cULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7be4f07800ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x7be6715d70ULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7be4f07840ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x7be6716408ULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7be4f07860ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x7be67168d8ULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7be4f07880ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x7be6716814ULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0x7be4f078f0ULL, unwinder.frames()[6].sp);
-  EXPECT_EQ(0x7be6704f60ULL, unwinder.frames()[7].pc);
-  EXPECT_EQ(0x7be4f07910ULL, unwinder.frames()[7].sp);
-  EXPECT_EQ(0x7be5f7b024ULL, unwinder.frames()[8].pc);
-  EXPECT_EQ(0x7be4f07950ULL, unwinder.frames()[8].sp);
-  EXPECT_EQ(0x7be5f7cad0ULL, unwinder.frames()[9].pc);
-  EXPECT_EQ(0x7be4f07aa0ULL, unwinder.frames()[9].sp);
-  EXPECT_EQ(0x7be5f7cb64ULL, unwinder.frames()[10].pc);
-  EXPECT_EQ(0x7be4f07ce0ULL, unwinder.frames()[10].sp);
-  EXPECT_EQ(0x7cbe11406cULL, unwinder.frames()[11].pc);
-  EXPECT_EQ(0x7be4f07d00ULL, unwinder.frames()[11].sp);
-  EXPECT_EQ(0x7cbe0b5e18ULL, unwinder.frames()[12].pc);
-  EXPECT_EQ(0x7be4f07d20ULL, unwinder.frames()[12].sp);
-}
-
-TEST_F(UnwindOfflineTest, invalid_elf_offset_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("invalid_elf_offset_arm/", ARCH_ARM, false));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(1U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ("  #00 pc 00aa7508  invalid.apk (offset 0x12e4000)\n", frame_info);
-  EXPECT_EQ(0xc898f508, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xc2044218, unwinder.frames()[0].sp);
-}
-
-TEST_F(UnwindOfflineTest, load_bias_ro_rx_x86_64) {
-  ASSERT_NO_FATAL_FAILURE(Init("load_bias_ro_rx_x86_64/", ARCH_X86_64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(17U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00000000000e9dd4  libc.so (__write+20)\n"
-      "  #01 pc 000000000007ab9c  libc.so (_IO_file_write+44)\n"
-      "  #02 pc 0000000000079f3e  libc.so\n"
-      "  #03 pc 000000000007bce8  libc.so (_IO_do_write+24)\n"
-      "  #04 pc 000000000007b26e  libc.so (_IO_file_xsputn+270)\n"
-      "  #05 pc 000000000004f7f9  libc.so (_IO_vfprintf+1945)\n"
-      "  #06 pc 0000000000057cb5  libc.so (_IO_printf+165)\n"
-      "  #07 pc 0000000000ed1796  perfetto_unittests "
-      "(testing::internal::PrettyUnitTestResultPrinter::OnTestIterationStart(testing::UnitTest "
-      "const&, int)+374)\n"
-      "  #08 pc 0000000000ed30fd  perfetto_unittests "
-      "(testing::internal::TestEventRepeater::OnTestIterationStart(testing::UnitTest const&, "
-      "int)+125)\n"
-      "  #09 pc 0000000000ed5e25  perfetto_unittests "
-      "(testing::internal::UnitTestImpl::RunAllTests()+581)\n"
-      "  #10 pc 0000000000ef63f3  perfetto_unittests "
-      "(bool "
-      "testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, "
-      "bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char "
-      "const*)+131)\n"
-      "  #11 pc 0000000000ee2a21  perfetto_unittests "
-      "(bool "
-      "testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, "
-      "bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char "
-      "const*)+113)\n"
-      "  #12 pc 0000000000ed5bb9  perfetto_unittests (testing::UnitTest::Run()+185)\n"
-      "  #13 pc 0000000000e900f0  perfetto_unittests (RUN_ALL_TESTS()+16)\n"
-      "  #14 pc 0000000000e900d8  perfetto_unittests (main+56)\n"
-      "  #15 pc 000000000002352a  libc.so (__libc_start_main+234)\n"
-      "  #16 pc 0000000000919029  perfetto_unittests (_start+41)\n",
-      frame_info);
-
-  EXPECT_EQ(0x7f9326a57dd4ULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7ffd224153c8ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x7f93269e8b9cULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7ffd224153d0ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x7f93269e7f3eULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7ffd22415400ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x7f93269e9ce8ULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7ffd22415440ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x7f93269e926eULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7ffd22415450ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x7f93269bd7f9ULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7ffd22415490ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x7f93269c5cb5ULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0x7ffd22415a10ULL, unwinder.frames()[6].sp);
-  EXPECT_EQ(0xed1796ULL, unwinder.frames()[7].pc);
-  EXPECT_EQ(0x7ffd22415af0ULL, unwinder.frames()[7].sp);
-  EXPECT_EQ(0xed30fdULL, unwinder.frames()[8].pc);
-  EXPECT_EQ(0x7ffd22415b70ULL, unwinder.frames()[8].sp);
-  EXPECT_EQ(0xed5e25ULL, unwinder.frames()[9].pc);
-  EXPECT_EQ(0x7ffd22415bb0ULL, unwinder.frames()[9].sp);
-  EXPECT_EQ(0xef63f3ULL, unwinder.frames()[10].pc);
-  EXPECT_EQ(0x7ffd22415c60ULL, unwinder.frames()[10].sp);
-  EXPECT_EQ(0xee2a21ULL, unwinder.frames()[11].pc);
-  EXPECT_EQ(0x7ffd22415cc0ULL, unwinder.frames()[11].sp);
-  EXPECT_EQ(0xed5bb9ULL, unwinder.frames()[12].pc);
-  EXPECT_EQ(0x7ffd22415d40ULL, unwinder.frames()[12].sp);
-  EXPECT_EQ(0xe900f0ULL, unwinder.frames()[13].pc);
-  EXPECT_EQ(0x7ffd22415d90ULL, unwinder.frames()[13].sp);
-  EXPECT_EQ(0xe900d8ULL, unwinder.frames()[14].pc);
-  EXPECT_EQ(0x7ffd22415da0ULL, unwinder.frames()[14].sp);
-  EXPECT_EQ(0x7f932699152aULL, unwinder.frames()[15].pc);
-  EXPECT_EQ(0x7ffd22415dd0ULL, unwinder.frames()[15].sp);
-  EXPECT_EQ(0x919029ULL, unwinder.frames()[16].pc);
-  EXPECT_EQ(0x7ffd22415e90ULL, unwinder.frames()[16].sp);
-}
-
-TEST_F(UnwindOfflineTest, load_bias_different_section_bias_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("load_bias_different_section_bias_arm64/", ARCH_ARM64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(12U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00000000000d59bc  linker64 (__dl_syscall+28)\n"
-      "  #01 pc 00000000000554e8  linker64 (__dl__ZL24debuggerd_signal_handleriP7siginfoPv+1148)\n"
-      "  #02 pc 00000000000008c0  vdso (__kernel_rt_sigreturn)\n"
-      "  #03 pc 000000000007f3e8  libc.so (abort+168)\n"
-      "  #04 pc 00000000000459fc  test (std::__ndk1::__throw_bad_cast()+4)\n"
-      "  #05 pc 0000000000056d80  test (testing::Test::Run()+88)\n"
-      "  #06 pc 000000000005724c  test (testing::TestInfo::Run()+112)\n"
-      "  #07 pc 0000000000057558  test (testing::TestSuite::Run()+116)\n"
-      "  #08 pc 000000000005bffc  test (testing::internal::UnitTestImpl::RunAllTests()+464)\n"
-      "  #09 pc 000000000005bd9c  test (testing::UnitTest::Run()+116)\n"
-      "  #10 pc 00000000000464e4  test (main+144)\n"
-      "  #11 pc 000000000007aa34  libc.so (__libc_init+108)\n",
-      frame_info);
-
-  EXPECT_EQ(0x7112cb99bcULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7112bdbbf0ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x7112c394e8ULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7112bdbbf0ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x7112be28c0ULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7112bdbda0ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x71115ab3e8ULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7fdd4a3f00ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x5f739dc9fcULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7fdd4a3fe0ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x5f739edd80ULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7fdd4a3ff0ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x5f739ee24cULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0x7fdd4a4010ULL, unwinder.frames()[6].sp);
-  EXPECT_EQ(0x5f739ee558ULL, unwinder.frames()[7].pc);
-  EXPECT_EQ(0x7fdd4a4040ULL, unwinder.frames()[7].sp);
-  EXPECT_EQ(0x5f739f2ffcULL, unwinder.frames()[8].pc);
-  EXPECT_EQ(0x7fdd4a4070ULL, unwinder.frames()[8].sp);
-  EXPECT_EQ(0x5f739f2d9cULL, unwinder.frames()[9].pc);
-  EXPECT_EQ(0x7fdd4a4100ULL, unwinder.frames()[9].sp);
-  EXPECT_EQ(0x5f739dd4e4ULL, unwinder.frames()[10].pc);
-  EXPECT_EQ(0x7fdd4a4130ULL, unwinder.frames()[10].sp);
-  EXPECT_EQ(0x71115a6a34ULL, unwinder.frames()[11].pc);
-  EXPECT_EQ(0x7fdd4a4170ULL, unwinder.frames()[11].sp);
-}
-
-TEST_F(UnwindOfflineTest, eh_frame_bias_x86) {
-  ASSERT_NO_FATAL_FAILURE(Init("eh_frame_bias_x86/", ARCH_X86));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(11U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc ffffe430  vdso.so (__kernel_vsyscall+16)\n"
-      "  #01 pc 00082a4b  libc.so (__epoll_pwait+43)\n"
-      "  #02 pc 000303a3  libc.so (epoll_pwait+115)\n"
-      "  #03 pc 000303ed  libc.so (epoll_wait+45)\n"
-      "  #04 pc 00010ea2  tombstoned (epoll_dispatch+226)\n"
-      "  #05 pc 0000c5e7  tombstoned (event_base_loop+1095)\n"
-      "  #06 pc 0000c193  tombstoned (event_base_dispatch+35)\n"
-      "  #07 pc 00005c77  tombstoned (main+884)\n"
-      "  #08 pc 00015f66  libc.so (__libc_init+102)\n"
-      "  #09 pc 0000360e  tombstoned (_start+98)\n"
-      "  #10 pc 00000001  <unknown>\n",
-      frame_info);
-
-  EXPECT_EQ(0xffffe430ULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xfffe1a30ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xeb585a4bULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xfffe1a40ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xeb5333a3ULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xfffe1a60ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xeb5333edULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xfffe1ab0ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xeb841ea2ULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xfffe1ae0ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0xeb83d5e7ULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xfffe1b30ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0xeb83d193ULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xfffe1bd0ULL, unwinder.frames()[6].sp);
-  EXPECT_EQ(0xeb836c77ULL, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xfffe1c00ULL, unwinder.frames()[7].sp);
-  EXPECT_EQ(0xeb518f66ULL, unwinder.frames()[8].pc);
-  EXPECT_EQ(0xfffe1d00ULL, unwinder.frames()[8].sp);
-  EXPECT_EQ(0xeb83460eULL, unwinder.frames()[9].pc);
-  EXPECT_EQ(0xfffe1d40ULL, unwinder.frames()[9].sp);
-  EXPECT_EQ(0x00000001ULL, unwinder.frames()[10].pc);
-  EXPECT_EQ(0xfffe1d74ULL, unwinder.frames()[10].sp);
-}
-
-TEST_F(UnwindOfflineTest, signal_load_bias_arm) {
-  ASSERT_NO_FATAL_FAILURE(Init("signal_load_bias_arm/", ARCH_ARM));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(17U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 0029ef9e  libunwindstack_unit_test (SignalInnerFunction+10)\n"
-      "  #01 pc 0029efa7  libunwindstack_unit_test (SignalMiddleFunction+2)\n"
-      "  #02 pc 0029efaf  libunwindstack_unit_test (SignalOuterFunction+2)\n"
-      "  #03 pc 002a280b  libunwindstack_unit_test (unwindstack::SignalCallerHandler(int, "
-      "siginfo*, void*)+10)\n"
-      "  #04 pc 00058bd4  libc.so (__restore)\n"
-      "  #05 pc 0029f01e  libunwindstack_unit_test (InnerFunction+106)\n"
-      "  #06 pc 0029f633  libunwindstack_unit_test (MiddleFunction+16)\n"
-      "  #07 pc 0029f64b  libunwindstack_unit_test (OuterFunction+16)\n"
-      "  #08 pc 002a1711  libunwindstack_unit_test (unwindstack::RemoteThroughSignal(int, unsigned "
-      "int)+260)\n"
-      "  #09 pc 002a1603  libunwindstack_unit_test "
-      "(unwindstack::UnwindTest_remote_through_signal_Test::TestBody()+10)\n"
-      "  #10 pc 002c8fe3  libunwindstack_unit_test (testing::Test::Run()+130)\n"
-      "  #11 pc 002c9b25  libunwindstack_unit_test (testing::TestInfo::Run()+184)\n"
-      "  #12 pc 002c9e27  libunwindstack_unit_test (testing::TestSuite::Run()+202)\n"
-      "  #13 pc 002d193d  libunwindstack_unit_test "
-      "(testing::internal::UnitTestImpl::RunAllTests()+660)\n"
-      "  #14 pc 002d160b  libunwindstack_unit_test (testing::UnitTest::Run()+134)\n"
-      "  #15 pc 002de035  libunwindstack_unit_test (IsolateMain+680)\n"
-      "  #16 pc 00058155  libc.so (__libc_init+68)\n",
-      frame_info);
-
-  EXPECT_EQ(0xb6955f9eULL, unwinder.frames()[0].pc);
-  EXPECT_EQ(0xf2790ce8ULL, unwinder.frames()[0].sp);
-  EXPECT_EQ(0xb6955fa7ULL, unwinder.frames()[1].pc);
-  EXPECT_EQ(0xf2790ce8ULL, unwinder.frames()[1].sp);
-  EXPECT_EQ(0xb6955fafULL, unwinder.frames()[2].pc);
-  EXPECT_EQ(0xf2790cf0ULL, unwinder.frames()[2].sp);
-  EXPECT_EQ(0xb695980bULL, unwinder.frames()[3].pc);
-  EXPECT_EQ(0xf2790cf8ULL, unwinder.frames()[3].sp);
-  EXPECT_EQ(0xf23febd4ULL, unwinder.frames()[4].pc);
-  EXPECT_EQ(0xf2790d10ULL, unwinder.frames()[4].sp);
-  EXPECT_EQ(0xb695601eULL, unwinder.frames()[5].pc);
-  EXPECT_EQ(0xffe67798ULL, unwinder.frames()[5].sp);
-  EXPECT_EQ(0xb6956633ULL, unwinder.frames()[6].pc);
-  EXPECT_EQ(0xffe67890ULL, unwinder.frames()[6].sp);
-  EXPECT_EQ(0xb695664bULL, unwinder.frames()[7].pc);
-  EXPECT_EQ(0xffe678a0ULL, unwinder.frames()[7].sp);
-  EXPECT_EQ(0xb6958711ULL, unwinder.frames()[8].pc);
-  EXPECT_EQ(0xffe678b0ULL, unwinder.frames()[8].sp);
-  EXPECT_EQ(0xb6958603ULL, unwinder.frames()[9].pc);
-  EXPECT_EQ(0xffe67ac8ULL, unwinder.frames()[9].sp);
-  EXPECT_EQ(0xb697ffe3ULL, unwinder.frames()[10].pc);
-  EXPECT_EQ(0xffe67ad8ULL, unwinder.frames()[10].sp);
-  EXPECT_EQ(0xb6980b25ULL, unwinder.frames()[11].pc);
-  EXPECT_EQ(0xffe67ae8ULL, unwinder.frames()[11].sp);
-  EXPECT_EQ(0xb6980e27ULL, unwinder.frames()[12].pc);
-  EXPECT_EQ(0xffe67b18ULL, unwinder.frames()[12].sp);
-  EXPECT_EQ(0xb698893dULL, unwinder.frames()[13].pc);
-  EXPECT_EQ(0xffe67b48ULL, unwinder.frames()[13].sp);
-  EXPECT_EQ(0xb698860bULL, unwinder.frames()[14].pc);
-  EXPECT_EQ(0xffe67bb0ULL, unwinder.frames()[14].sp);
-  EXPECT_EQ(0xb6995035ULL, unwinder.frames()[15].pc);
-  EXPECT_EQ(0xffe67bd0ULL, unwinder.frames()[15].sp);
-  EXPECT_EQ(0xf23fe155ULL, unwinder.frames()[16].pc);
-  EXPECT_EQ(0xffe67d10ULL, unwinder.frames()[16].sp);
-}
-
-TEST_F(UnwindOfflineTest, empty_arm64) {
-  ASSERT_NO_FATAL_FAILURE(Init("empty_arm64/", ARCH_ARM64));
-
-  Unwinder unwinder(128, maps_.get(), regs_.get(), process_memory_);
-  unwinder.Unwind();
-
-  std::string frame_info(DumpFrames(unwinder));
-  ASSERT_EQ(7U, unwinder.NumFrames()) << "Unwind:\n" << frame_info;
-  EXPECT_EQ(
-      "  #00 pc 00000000000963a4  libc.so (__ioctl+4)\n"
-      "  #01 pc 000000000005344c  libc.so (ioctl+140)\n"
-      "  #02 pc 0000000000050ce4  libbinder.so "
-      "(android::IPCThreadState::talkWithDriver(bool)+308)\n"
-      "  #03 pc 0000000000050e98  libbinder.so "
-      "(android::IPCThreadState::getAndExecuteCommand()+24)\n"
-      "  #04 pc 00000000000516ac  libbinder.so (android::IPCThreadState::joinThreadPool(bool)+60)\n"
-      "  #05 pc 00000000000443b0  netd (main+1056)\n"
-      "  #06 pc 0000000000045594  libc.so (__libc_init+108)\n",
-      frame_info);
-
-  EXPECT_EQ(0x72a02203a4U, unwinder.frames()[0].pc);
-  EXPECT_EQ(0x7ffb6c0b50U, unwinder.frames()[0].sp);
-  EXPECT_EQ(0x72a01dd44cU, unwinder.frames()[1].pc);
-  EXPECT_EQ(0x7ffb6c0b50U, unwinder.frames()[1].sp);
-  EXPECT_EQ(0x729f759ce4U, unwinder.frames()[2].pc);
-  EXPECT_EQ(0x7ffb6c0c50U, unwinder.frames()[2].sp);
-  EXPECT_EQ(0x729f759e98U, unwinder.frames()[3].pc);
-  EXPECT_EQ(0x7ffb6c0ce0U, unwinder.frames()[3].sp);
-  EXPECT_EQ(0x729f75a6acU, unwinder.frames()[4].pc);
-  EXPECT_EQ(0x7ffb6c0d10U, unwinder.frames()[4].sp);
-  EXPECT_EQ(0x5d478af3b0U, unwinder.frames()[5].pc);
-  EXPECT_EQ(0x7ffb6c0d40U, unwinder.frames()[5].sp);
-  EXPECT_EQ(0x72a01cf594U, unwinder.frames()[6].pc);
-  EXPECT_EQ(0x7ffb6c0f30U, unwinder.frames()[6].sp);
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/UnwindTest.cpp b/libunwindstack/tests/UnwindTest.cpp
deleted file mode 100644
index f76a101..0000000
--- a/libunwindstack/tests/UnwindTest.cpp
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <errno.h>
-#include <signal.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/ptrace.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-
-#include <gtest/gtest.h>
-
-#include <atomic>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include <android-base/stringprintf.h>
-#include <android-base/threads.h>
-
-#include <unwindstack/Maps.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
-#include <unwindstack/Unwinder.h>
-
-#include "MemoryRemote.h"
-#include "TestUtils.h"
-
-namespace unwindstack {
-
-enum TestTypeEnum : uint8_t {
-  TEST_TYPE_LOCAL_UNWINDER = 0,
-  TEST_TYPE_LOCAL_UNWINDER_FROM_PID,
-  TEST_TYPE_LOCAL_WAIT_FOR_FINISH,
-  TEST_TYPE_REMOTE,
-  TEST_TYPE_REMOTE_WITH_INVALID_CALL,
-};
-
-static std::atomic_bool g_ready;
-static volatile bool g_ready_for_remote;
-static volatile bool g_signal_ready_for_remote;
-static std::atomic_bool g_finish;
-static std::atomic_uintptr_t g_ucontext;
-
-static void ResetGlobals() {
-  g_ready = false;
-  g_ready_for_remote = false;
-  g_signal_ready_for_remote = false;
-  g_finish = false;
-  g_ucontext = 0;
-}
-
-static std::vector<const char*> kFunctionOrder{"OuterFunction", "MiddleFunction", "InnerFunction"};
-
-static std::vector<const char*> kFunctionSignalOrder{"OuterFunction",        "MiddleFunction",
-                                                     "InnerFunction",        "SignalOuterFunction",
-                                                     "SignalMiddleFunction", "SignalInnerFunction"};
-
-static void SignalHandler(int, siginfo_t*, void* sigcontext) {
-  g_ucontext = reinterpret_cast<uintptr_t>(sigcontext);
-  while (!g_finish.load()) {
-  }
-}
-
-extern "C" void SignalInnerFunction() {
-  g_signal_ready_for_remote = true;
-  // Avoid any function calls because not every instruction will be
-  // unwindable.
-  // This method of looping is only used when testing a remote unwind.
-  while (true) {
-  }
-}
-
-extern "C" void SignalMiddleFunction() {
-  SignalInnerFunction();
-}
-
-extern "C" void SignalOuterFunction() {
-  SignalMiddleFunction();
-}
-
-static void SignalCallerHandler(int, siginfo_t*, void*) {
-  SignalOuterFunction();
-}
-
-static std::string ErrorMsg(const std::vector<const char*>& function_names, Unwinder* unwinder) {
-  std::string unwind;
-  for (size_t i = 0; i < unwinder->NumFrames(); i++) {
-    unwind += unwinder->FormatFrame(i) + '\n';
-  }
-
-  return std::string(
-             "Unwind completed without finding all frames\n"
-             "  Looking for function: ") +
-         function_names.front() + "\n" + "Unwind data:\n" + unwind;
-}
-
-static void VerifyUnwind(Unwinder* unwinder, std::vector<const char*> expected_function_names) {
-  unwinder->Unwind();
-
-  for (auto& frame : unwinder->frames()) {
-    if (frame.function_name == expected_function_names.back()) {
-      expected_function_names.pop_back();
-      if (expected_function_names.empty()) {
-        break;
-      }
-    }
-  }
-
-  ASSERT_TRUE(expected_function_names.empty()) << ErrorMsg(expected_function_names, unwinder);
-}
-
-static void VerifyUnwind(pid_t pid, Maps* maps, Regs* regs,
-                         std::vector<const char*> expected_function_names) {
-  auto process_memory(Memory::CreateProcessMemory(pid));
-
-  Unwinder unwinder(512, maps, regs, process_memory);
-  VerifyUnwind(&unwinder, expected_function_names);
-}
-
-// This test assumes that this code is compiled with optimizations turned
-// off. If this doesn't happen, then all of the calls will be optimized
-// away.
-extern "C" void InnerFunction(TestTypeEnum test_type) {
-  if (test_type == TEST_TYPE_LOCAL_WAIT_FOR_FINISH) {
-    while (!g_finish.load()) {
-    }
-    return;
-  }
-  if (test_type == TEST_TYPE_REMOTE || test_type == TEST_TYPE_REMOTE_WITH_INVALID_CALL) {
-    g_ready_for_remote = true;
-    g_ready = true;
-    if (test_type == TEST_TYPE_REMOTE_WITH_INVALID_CALL) {
-      void (*crash_func)() = nullptr;
-      crash_func();
-    }
-    // Avoid any function calls because not every instruction will be
-    // unwindable.
-    // This method of looping is only used when testing a remote unwind.
-    while (true) {
-    }
-    return;
-  }
-
-  std::unique_ptr<Unwinder> unwinder;
-  std::unique_ptr<Regs> regs(Regs::CreateFromLocal());
-  RegsGetLocal(regs.get());
-  std::unique_ptr<Maps> maps;
-
-  if (test_type == TEST_TYPE_LOCAL_UNWINDER) {
-    maps.reset(new LocalMaps());
-    ASSERT_TRUE(maps->Parse());
-    auto process_memory(Memory::CreateProcessMemory(getpid()));
-    unwinder.reset(new Unwinder(512, maps.get(), regs.get(), process_memory));
-  } else {
-    UnwinderFromPid* unwinder_from_pid = new UnwinderFromPid(512, getpid());
-    ASSERT_TRUE(unwinder_from_pid->Init(regs->Arch()));
-    unwinder_from_pid->SetRegs(regs.get());
-    unwinder.reset(unwinder_from_pid);
-  }
-  VerifyUnwind(unwinder.get(), kFunctionOrder);
-}
-
-extern "C" void MiddleFunction(TestTypeEnum test_type) {
-  InnerFunction(test_type);
-}
-
-extern "C" void OuterFunction(TestTypeEnum test_type) {
-  MiddleFunction(test_type);
-}
-
-class UnwindTest : public ::testing::Test {
- public:
-  void SetUp() override { ResetGlobals(); }
-};
-
-TEST_F(UnwindTest, local) {
-  OuterFunction(TEST_TYPE_LOCAL_UNWINDER);
-}
-
-TEST_F(UnwindTest, local_use_from_pid) {
-  OuterFunction(TEST_TYPE_LOCAL_UNWINDER_FROM_PID);
-}
-
-static void LocalUnwind(void* data) {
-  TestTypeEnum* test_type = reinterpret_cast<TestTypeEnum*>(data);
-  OuterFunction(*test_type);
-}
-
-TEST_F(UnwindTest, local_check_for_leak) {
-  TestTypeEnum test_type = TEST_TYPE_LOCAL_UNWINDER;
-  TestCheckForLeaks(LocalUnwind, &test_type);
-}
-
-TEST_F(UnwindTest, local_use_from_pid_check_for_leak) {
-  TestTypeEnum test_type = TEST_TYPE_LOCAL_UNWINDER_FROM_PID;
-  TestCheckForLeaks(LocalUnwind, &test_type);
-}
-
-void WaitForRemote(pid_t pid, uint64_t addr, bool leave_attached, bool* completed) {
-  *completed = false;
-  // Need to sleep before attempting first ptrace. Without this, on the
-  // host it becomes impossible to attach and ptrace sets errno to EPERM.
-  usleep(1000);
-  for (size_t i = 0; i < 1000; i++) {
-    if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) {
-      ASSERT_TRUE(TestQuiescePid(pid))
-          << "Waiting for process to quiesce failed: " << strerror(errno);
-
-      MemoryRemote memory(pid);
-      // Read the remote value to see if we are ready.
-      bool value;
-      if (memory.ReadFully(addr, &value, sizeof(value)) && value) {
-        *completed = true;
-      }
-      if (!*completed || !leave_attached) {
-        ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0));
-      }
-      if (*completed) {
-        break;
-      }
-    } else {
-      ASSERT_EQ(ESRCH, errno) << "ptrace attach failed with unexpected error: " << strerror(errno);
-    }
-    usleep(5000);
-  }
-}
-
-TEST_F(UnwindTest, remote) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    OuterFunction(TEST_TYPE_REMOTE);
-    exit(0);
-  }
-  ASSERT_NE(-1, pid);
-  TestScopedPidReaper reap(pid);
-
-  bool completed;
-  WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), true, &completed);
-  ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
-
-  RemoteMaps maps(pid);
-  ASSERT_TRUE(maps.Parse());
-  std::unique_ptr<Regs> regs(Regs::RemoteGet(pid));
-  ASSERT_TRUE(regs.get() != nullptr);
-
-  VerifyUnwind(pid, &maps, regs.get(), kFunctionOrder);
-
-  ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
-      << "ptrace detach failed with unexpected error: " << strerror(errno);
-}
-
-TEST_F(UnwindTest, unwind_from_pid_remote) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    OuterFunction(TEST_TYPE_REMOTE);
-    exit(0);
-  }
-  ASSERT_NE(-1, pid);
-  TestScopedPidReaper reap(pid);
-
-  bool completed;
-  WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), true, &completed);
-  ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
-
-  std::unique_ptr<Regs> regs(Regs::RemoteGet(pid));
-  ASSERT_TRUE(regs.get() != nullptr);
-
-  UnwinderFromPid unwinder(512, pid);
-  ASSERT_TRUE(unwinder.Init(regs->Arch()));
-  unwinder.SetRegs(regs.get());
-
-  VerifyUnwind(&unwinder, kFunctionOrder);
-
-  // Verify that calling the same object works again.
-
-  ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
-      << "ptrace detach failed with unexpected error: " << strerror(errno);
-}
-
-static void RemoteCheckForLeaks(void (*unwind_func)(void*)) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    OuterFunction(TEST_TYPE_REMOTE);
-    exit(0);
-  }
-  ASSERT_NE(-1, pid);
-  TestScopedPidReaper reap(pid);
-
-  bool completed;
-  WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), true, &completed);
-  ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
-
-  TestCheckForLeaks(unwind_func, &pid);
-
-  ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
-      << "ptrace detach failed with unexpected error: " << strerror(errno);
-}
-
-static void RemoteUnwind(void* data) {
-  pid_t* pid = reinterpret_cast<pid_t*>(data);
-
-  RemoteMaps maps(*pid);
-  ASSERT_TRUE(maps.Parse());
-  std::unique_ptr<Regs> regs(Regs::RemoteGet(*pid));
-  ASSERT_TRUE(regs.get() != nullptr);
-
-  VerifyUnwind(*pid, &maps, regs.get(), kFunctionOrder);
-}
-
-TEST_F(UnwindTest, remote_check_for_leaks) {
-  RemoteCheckForLeaks(RemoteUnwind);
-}
-
-static void RemoteUnwindFromPid(void* data) {
-  pid_t* pid = reinterpret_cast<pid_t*>(data);
-
-  std::unique_ptr<Regs> regs(Regs::RemoteGet(*pid));
-  ASSERT_TRUE(regs.get() != nullptr);
-
-  UnwinderFromPid unwinder(512, *pid);
-  ASSERT_TRUE(unwinder.Init(regs->Arch()));
-  unwinder.SetRegs(regs.get());
-
-  VerifyUnwind(&unwinder, kFunctionOrder);
-}
-
-TEST_F(UnwindTest, remote_unwind_for_pid_check_for_leaks) {
-  RemoteCheckForLeaks(RemoteUnwindFromPid);
-}
-
-TEST_F(UnwindTest, from_context) {
-  std::atomic_int tid(0);
-  std::thread thread([&]() {
-    tid = syscall(__NR_gettid);
-    OuterFunction(TEST_TYPE_LOCAL_WAIT_FOR_FINISH);
-  });
-
-  struct sigaction act, oldact;
-  memset(&act, 0, sizeof(act));
-  act.sa_sigaction = SignalHandler;
-  act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
-  ASSERT_EQ(0, sigaction(SIGUSR1, &act, &oldact));
-  // Wait for the tid to get set.
-  for (size_t i = 0; i < 100; i++) {
-    if (tid.load() != 0) {
-      break;
-    }
-    usleep(1000);
-  }
-  ASSERT_NE(0, tid.load());
-  ASSERT_EQ(0, tgkill(getpid(), tid.load(), SIGUSR1)) << "Error: " << strerror(errno);
-
-  // Wait for context data.
-  void* ucontext;
-  for (size_t i = 0; i < 2000; i++) {
-    ucontext = reinterpret_cast<void*>(g_ucontext.load());
-    if (ucontext != nullptr) {
-      break;
-    }
-    usleep(1000);
-  }
-  ASSERT_TRUE(ucontext != nullptr) << "Timed out waiting for thread to respond to signal.";
-
-  LocalMaps maps;
-  ASSERT_TRUE(maps.Parse());
-  std::unique_ptr<Regs> regs(Regs::CreateFromUcontext(Regs::CurrentArch(), ucontext));
-
-  VerifyUnwind(getpid(), &maps, regs.get(), kFunctionOrder);
-
-  ASSERT_EQ(0, sigaction(SIGUSR1, &oldact, nullptr));
-
-  g_finish = true;
-  thread.join();
-}
-
-static void RemoteThroughSignal(int signal, unsigned int sa_flags) {
-  pid_t pid;
-  if ((pid = fork()) == 0) {
-    struct sigaction act, oldact;
-    memset(&act, 0, sizeof(act));
-    act.sa_sigaction = SignalCallerHandler;
-    act.sa_flags = SA_RESTART | SA_ONSTACK | sa_flags;
-    ASSERT_EQ(0, sigaction(signal, &act, &oldact));
-
-    OuterFunction(signal != SIGSEGV ? TEST_TYPE_REMOTE : TEST_TYPE_REMOTE_WITH_INVALID_CALL);
-    exit(0);
-  }
-  ASSERT_NE(-1, pid);
-  TestScopedPidReaper reap(pid);
-
-  bool completed;
-  if (signal != SIGSEGV) {
-    WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), false, &completed);
-    ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
-    ASSERT_EQ(0, kill(pid, SIGUSR1));
-  }
-  WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_signal_ready_for_remote), true, &completed);
-  ASSERT_TRUE(completed) << "Timed out waiting for remote process to be in signal handler.";
-
-  RemoteMaps maps(pid);
-  ASSERT_TRUE(maps.Parse());
-  std::unique_ptr<Regs> regs(Regs::RemoteGet(pid));
-  ASSERT_TRUE(regs.get() != nullptr);
-
-  VerifyUnwind(pid, &maps, regs.get(), kFunctionSignalOrder);
-
-  ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
-      << "ptrace detach failed with unexpected error: " << strerror(errno);
-}
-
-TEST_F(UnwindTest, remote_through_signal) {
-  RemoteThroughSignal(SIGUSR1, 0);
-}
-
-TEST_F(UnwindTest, remote_through_signal_sa_siginfo) {
-  RemoteThroughSignal(SIGUSR1, SA_SIGINFO);
-}
-
-TEST_F(UnwindTest, remote_through_signal_with_invalid_func) {
-  RemoteThroughSignal(SIGSEGV, 0);
-}
-
-TEST_F(UnwindTest, remote_through_signal_sa_siginfo_with_invalid_func) {
-  RemoteThroughSignal(SIGSEGV, SA_SIGINFO);
-}
-
-// Verify that using the same map while unwinding multiple threads at the
-// same time doesn't cause problems.
-TEST_F(UnwindTest, multiple_threads_unwind_same_map) {
-  static constexpr size_t kNumConcurrentThreads = 100;
-
-  LocalMaps maps;
-  ASSERT_TRUE(maps.Parse());
-  auto process_memory(Memory::CreateProcessMemory(getpid()));
-
-  std::vector<std::thread*> threads;
-
-  std::atomic_bool wait;
-  wait = true;
-  size_t frames[kNumConcurrentThreads];
-  for (size_t i = 0; i < kNumConcurrentThreads; i++) {
-    std::thread* thread = new std::thread([i, &frames, &maps, &process_memory, &wait]() {
-      while (wait)
-        ;
-      std::unique_ptr<Regs> regs(Regs::CreateFromLocal());
-      RegsGetLocal(regs.get());
-
-      Unwinder unwinder(512, &maps, regs.get(), process_memory);
-      unwinder.Unwind();
-      frames[i] = unwinder.NumFrames();
-      ASSERT_LE(3U, frames[i]) << "Failed for thread " << i;
-    });
-    threads.push_back(thread);
-  }
-  wait = false;
-  for (auto thread : threads) {
-    thread->join();
-    delete thread;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/UnwinderTest.cpp b/libunwindstack/tests/UnwinderTest.cpp
deleted file mode 100644
index ef1950c..0000000
--- a/libunwindstack/tests/UnwinderTest.cpp
+++ /dev/null
@@ -1,1477 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <elf.h>
-#include <stdint.h>
-#include <sys/mman.h>
-
-#include <memory>
-#include <set>
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsArm.h>
-#include <unwindstack/RegsArm64.h>
-#include <unwindstack/RegsX86.h>
-#include <unwindstack/RegsX86_64.h>
-#include <unwindstack/RegsMips.h>
-#include <unwindstack/RegsMips64.h>
-#include <unwindstack/Unwinder.h>
-
-#include "ElfFake.h"
-#include "MemoryFake.h"
-#include "RegsFake.h"
-
-namespace unwindstack {
-
-class UnwinderTest : public ::testing::Test {
- protected:
-  static void AddMapInfo(uint64_t start, uint64_t end, uint64_t offset, uint64_t flags,
-                         const char* name, Elf* elf = nullptr) {
-    std::string str_name(name);
-    maps_->Add(start, end, offset, flags, name, static_cast<uint64_t>(-1));
-    if (elf != nullptr) {
-      const auto& map_info = *--maps_->end();
-      map_info->elf.reset(elf);
-    }
-  }
-
-  static void SetUpTestSuite() {
-    maps_.reset(new Maps);
-
-    ElfFake* elf = new ElfFake(new MemoryFake);
-    ElfInterfaceFake* interface_fake = new ElfInterfaceFake(nullptr);
-    interface_fake->FakeSetBuildID("FAKE");
-    elf->FakeSetInterface(interface_fake);
-    AddMapInfo(0x1000, 0x8000, 0, PROT_READ | PROT_WRITE, "/system/fake/libc.so", elf);
-
-    AddMapInfo(0x10000, 0x12000, 0, PROT_READ | PROT_WRITE, "[stack]");
-
-    AddMapInfo(0x13000, 0x15000, 0, PROT_READ | PROT_WRITE | MAPS_FLAGS_DEVICE_MAP,
-               "/dev/fake_device");
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0x20000, 0x22000, 0, PROT_READ | PROT_WRITE, "/system/fake/libunwind.so", elf);
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0x23000, 0x24000, 0, PROT_READ | PROT_WRITE, "/fake/libanother.so", elf);
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0x33000, 0x34000, 0, PROT_READ | PROT_WRITE, "/fake/compressed.so", elf);
-
-    elf = new ElfFake(new MemoryFake);
-    ElfInterfaceFake* interface = new ElfInterfaceFake(nullptr);
-    interface->FakeSetSoname("lib_fake.so");
-    elf->FakeSetInterface(interface);
-    AddMapInfo(0x43000, 0x44000, 0x1d000, PROT_READ | PROT_WRITE, "/fake/fake.apk", elf);
-    MapInfo* map_info = maps_->Find(0x43000);
-    ASSERT_TRUE(map_info != nullptr);
-    map_info->elf_start_offset = 0x1d000;
-
-    AddMapInfo(0x53000, 0x54000, 0, PROT_READ | PROT_WRITE, "/fake/fake.oat");
-
-    AddMapInfo(0xa3000, 0xa4000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "/fake/fake.vdex");
-    const auto& info = *--maps_->end();
-    info->load_bias = 0;
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    elf->FakeSetLoadBias(0x5000);
-    AddMapInfo(0xa5000, 0xa6000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "/fake/fake_load_bias.so",
-               elf);
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0xa7000, 0xa8000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "/fake/fake_offset.oat",
-               elf);
-    const auto& info2 = *--maps_->end();
-    info2->elf_offset = 0x8000;
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0xc0000, 0xc1000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "/fake/unreadable.so", elf);
-    const auto& info3 = *--maps_->end();
-    info3->memory_backed_elf = true;
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0xc1000, 0xc2000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "[vdso]", elf);
-    const auto& info4 = *--maps_->end();
-    info4->memory_backed_elf = true;
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0xc2000, 0xc3000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "", elf);
-    const auto& info5 = *--maps_->end();
-    info5->memory_backed_elf = true;
-
-    elf = new ElfFake(new MemoryFake);
-    elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
-    AddMapInfo(0xc3000, 0xc4000, 0, PROT_READ | PROT_WRITE | PROT_EXEC, "/memfd:/jit-cache", elf);
-    const auto& info6 = *--maps_->end();
-    info6->memory_backed_elf = true;
-
-    AddMapInfo(0xd0000, 0xd1000, 0x1000, PROT_READ | PROT_WRITE | PROT_EXEC, "/fake/fake.apk");
-    const auto& info7 = *--maps_->end();
-    info7->load_bias = 0;
-
-    process_memory_.reset(new MemoryFake);
-  }
-
-  void SetUp() override {
-    ElfInterfaceFake::FakeClear();
-    regs_.FakeSetArch(ARCH_ARM);
-    regs_.FakeSetReturnAddressValid(false);
-  }
-
-  static std::unique_ptr<Maps> maps_;
-  static RegsFake regs_;
-  static std::shared_ptr<Memory> process_memory_;
-};
-
-std::unique_ptr<Maps> UnwinderTest::maps_;
-RegsFake UnwinderTest::regs_(5);
-std::shared_ptr<Memory> UnwinderTest::process_memory_(nullptr);
-
-TEST_F(UnwinderTest, multiple_frames) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x1102, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x1202, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(3U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x100U, frame->rel_pc);
-  EXPECT_EQ(0x1100U, frame->pc);
-  EXPECT_EQ(0x10010U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[2];
-  EXPECT_EQ(2U, frame->num);
-  EXPECT_EQ(0x200U, frame->rel_pc);
-  EXPECT_EQ(0x1200U, frame->pc);
-  EXPECT_EQ(0x10020U, frame->sp);
-  EXPECT_EQ("Frame2", frame->function_name);
-  EXPECT_EQ(2U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, multiple_frames_dont_resolve_names) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x1102, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x1202, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.SetResolveNames(false);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(3U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x100U, frame->rel_pc);
-  EXPECT_EQ(0x1100U, frame->pc);
-  EXPECT_EQ(0x10010U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[2];
-  EXPECT_EQ(2U, frame->num);
-  EXPECT_EQ(0x200U, frame->rel_pc);
-  EXPECT_EQ(0x1200U, frame->pc);
-  EXPECT_EQ(0x10020U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, non_zero_load_bias) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0xa5500);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x5500U, frame->rel_pc);
-  EXPECT_EQ(0xa5500U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake_load_bias.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xa5000U, frame->map_start);
-  EXPECT_EQ(0xa6000U, frame->map_end);
-  EXPECT_EQ(0x5000U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, non_zero_elf_offset) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0xa7500);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x8500U, frame->rel_pc);
-  EXPECT_EQ(0xa7500U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake_offset.oat", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xa7000U, frame->map_start);
-  EXPECT_EQ(0xa8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, non_zero_map_offset) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0x43000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x43000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.apk!lib_fake.so", frame->map_name);
-  EXPECT_EQ(0x1d000U, frame->map_elf_start_offset);
-  EXPECT_EQ(0x1d000U, frame->map_exact_offset);
-  EXPECT_EQ(0x43000U, frame->map_start);
-  EXPECT_EQ(0x44000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, disable_embedded_soname) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0x43000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.SetEmbeddedSoname(false);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x43000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.apk", frame->map_name);
-  EXPECT_EQ(0x1d000U, frame->map_elf_start_offset);
-  EXPECT_EQ(0x1d000U, frame->map_exact_offset);
-  EXPECT_EQ(0x43000U, frame->map_start);
-  EXPECT_EQ(0x44000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify that no attempt to continue after the step indicates it is done.
-TEST_F(UnwinderTest, no_frames_after_finished) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame3", 3));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame4", 4));
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x1000, 0x10000, true));
-  ElfInterfaceFake::FakePushStepData(StepData(0x1102, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x1202, 0x10020, false));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify the maximum frames to save.
-TEST_F(UnwinderTest, max_frames) {
-  for (size_t i = 0; i < 30; i++) {
-    ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame" + std::to_string(i), i));
-    ElfInterfaceFake::FakePushStepData(StepData(0x1102 + i * 0x100, 0x10010 + i * 0x10, false));
-  }
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-
-  Unwinder unwinder(20, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_MAX_FRAMES_EXCEEDED, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(20U, unwinder.NumFrames());
-
-  for (size_t i = 0; i < 20; i++) {
-    auto* frame = &unwinder.frames()[i];
-    EXPECT_EQ(i, frame->num);
-    EXPECT_EQ(i * 0x100, frame->rel_pc) << "Failed at frame " << i;
-    EXPECT_EQ(0x1000 + i * 0x100, frame->pc) << "Failed at frame " << i;
-    EXPECT_EQ(0x10000 + 0x10 * i, frame->sp) << "Failed at frame " << i;
-    EXPECT_EQ("Frame" + std::to_string(i), frame->function_name) << "Failed at frame " << i;
-    EXPECT_EQ(i, frame->function_offset) << "Failed at frame " << i;
-    EXPECT_EQ("/system/fake/libc.so", frame->map_name) << "Failed at frame " << i;
-    EXPECT_EQ(0U, frame->map_elf_start_offset) << "Failed at frame " << i;
-    EXPECT_EQ(0U, frame->map_exact_offset) << "Failed at frame " << i;
-    EXPECT_EQ(0x1000U, frame->map_start) << "Failed at frame " << i;
-    EXPECT_EQ(0x8000U, frame->map_end) << "Failed at frame " << i;
-    EXPECT_EQ(0U, frame->map_load_bias) << "Failed at frame " << i;
-    EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags) << "Failed at frame " << i;
-  }
-}
-
-// Verify that initial map names frames are removed.
-TEST_F(UnwinderTest, verify_frames_skipped) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-
-  regs_.set_pc(0x20000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x23002, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x23102, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x20002, 0x10030, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x21002, 0x10040, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x1002, 0x10050, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x21002, 0x10060, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x23002, 0x10070, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  std::vector<std::string> skip_libs{"libunwind.so", "libanother.so"};
-  unwinder.Unwind(&skip_libs);
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(3U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10050U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x1000U, frame->rel_pc);
-  EXPECT_EQ(0x21000U, frame->pc);
-  EXPECT_EQ(0x10060U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libunwind.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x20000U, frame->map_start);
-  EXPECT_EQ(0x22000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[2];
-  EXPECT_EQ(2U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x23000U, frame->pc);
-  EXPECT_EQ(0x10070U, frame->sp);
-  EXPECT_EQ("Frame2", frame->function_name);
-  EXPECT_EQ(2U, frame->function_offset);
-  EXPECT_EQ("/fake/libanother.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x23000U, frame->map_start);
-  EXPECT_EQ(0x24000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify SP in a non-existant map is okay.
-TEST_F(UnwinderTest, sp_not_in_map) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x63000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x21002, 0x50020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x63000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x1000U, frame->rel_pc);
-  EXPECT_EQ(0x21000U, frame->pc);
-  EXPECT_EQ(0x50020U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libunwind.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x20000U, frame->map_start);
-  EXPECT_EQ(0x22000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify PC in a device stops the unwind.
-TEST_F(UnwinderTest, pc_in_device_stops_unwind) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-
-  regs_.set_pc(0x13000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x23002, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x23102, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-}
-
-// Verify SP in a device stops the unwind.
-TEST_F(UnwinderTest, sp_in_device_stops_unwind) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x13000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x23002, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x23102, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-}
-
-// Verify a no map info frame gets a frame.
-TEST_F(UnwinderTest, pc_without_map) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0x41000);
-  regs_.set_sp(0x13000);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_INVALID_MAP, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x41000U, frame->rel_pc);
-  EXPECT_EQ(0x41000U, frame->pc);
-  EXPECT_EQ(0x13000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0U, frame->map_start);
-  EXPECT_EQ(0U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(0, frame->map_flags);
-}
-
-// Verify that a speculative frame is added.
-TEST_F(UnwinderTest, speculative_frame) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-
-  // Fake as if code called a nullptr function.
-  regs_.set_pc(0);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetReturnAddress(0x1202);
-  regs_.FakeSetReturnAddressValid(true);
-
-  ElfInterfaceFake::FakePushStepData(StepData(0x23102, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(3U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0U, frame->map_start);
-  EXPECT_EQ(0U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(0, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x200U, frame->rel_pc);
-  EXPECT_EQ(0x1200U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[2];
-  EXPECT_EQ(2U, frame->num);
-  EXPECT_EQ(0x100U, frame->rel_pc);
-  EXPECT_EQ(0x23100U, frame->pc);
-  EXPECT_EQ(0x10020U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/fake/libanother.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x23000U, frame->map_start);
-  EXPECT_EQ(0x24000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify that a speculative frame is added then removed because no other
-// frames are added.
-TEST_F(UnwinderTest, speculative_frame_removed) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-
-  // Fake as if code called a nullptr function.
-  regs_.set_pc(0x20000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0x10010, false));
-  regs_.FakeSetReturnAddress(0x12);
-  regs_.FakeSetReturnAddressValid(true);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_INVALID_MAP, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x20000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libunwind.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x20000U, frame->map_start);
-  EXPECT_EQ(0x22000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0U, frame->pc);
-  EXPECT_EQ(0x10010U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0U, frame->map_start);
-  EXPECT_EQ(0U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(0, frame->map_flags);
-}
-
-// Verify that a speculative frame is added and left if there are only
-// two frames and the pc is in the middle nowhere.
-TEST_F(UnwinderTest, speculative_frame_not_removed_pc_bad) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-
-  // Fake as if code called a nullptr function.
-  regs_.set_pc(0);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetReturnAddress(0x1202);
-  regs_.FakeSetReturnAddressValid(true);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0U, frame->map_start);
-  EXPECT_EQ(0U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(0, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x200U, frame->rel_pc);
-  EXPECT_EQ(0x1200U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify that a speculative frame does not cause a crash when it wasn't
-// really added due to a filter.
-TEST_F(UnwinderTest, speculative_frame_check_with_no_frames) {
-  regs_.set_pc(0x23000);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetReturnAddress(0x23100);
-  regs_.FakeSetReturnAddressValid(true);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-
-  std::vector<std::string> skip_names{"libanother.so"};
-  unwinder.Unwind(&skip_names);
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(0U, unwinder.NumFrames());
-}
-
-// Verify that an unwind stops when a frame is in given suffix.
-TEST_F(UnwinderTest, map_ignore_suffixes) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame3", 3));
-
-  // Fake as if code called a nullptr function.
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x43402, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x53502, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  std::vector<std::string> suffixes{"oat"};
-  unwinder.Unwind(nullptr, &suffixes);
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-  // Make sure the elf was not initialized.
-  MapInfo* map_info = maps_->Find(0x53000);
-  ASSERT_TRUE(map_info != nullptr);
-  EXPECT_TRUE(map_info->elf == nullptr);
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0x43400U, frame->pc);
-  EXPECT_EQ(0x10010U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.apk!lib_fake.so", frame->map_name);
-  EXPECT_EQ(0x1d000U, frame->map_elf_start_offset);
-  EXPECT_EQ(0x1d000U, frame->map_exact_offset);
-  EXPECT_EQ(0x43000U, frame->map_start);
-  EXPECT_EQ(0x44000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-// Verify that an unwind stops when the sp and pc don't change.
-TEST_F(UnwinderTest, sp_pc_do_not_change) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame2", 2));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame3", 3));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame4", 4));
-
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0x33402, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x33502, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x33502, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x33502, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0x33502, 0x10020, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_REPEATED_FRAME, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(3U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0x33400U, frame->pc);
-  EXPECT_EQ(0x10010U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/fake/compressed.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x33000U, frame->map_start);
-  EXPECT_EQ(0x34000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[2];
-  EXPECT_EQ(2U, frame->num);
-  EXPECT_EQ(0x500U, frame->rel_pc);
-  EXPECT_EQ(0x33500U, frame->pc);
-  EXPECT_EQ(0x10020U, frame->sp);
-  EXPECT_EQ("Frame2", frame->function_name);
-  EXPECT_EQ(2U, frame->function_offset);
-  EXPECT_EQ("/fake/compressed.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x33000U, frame->map_start);
-  EXPECT_EQ(0x34000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, dex_pc_in_map) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetDexPc(0xa3400);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0xa3400U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.vdex", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xa3000U, frame->map_start);
-  EXPECT_EQ(0xa4000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, dex_pc_in_map_non_zero_offset) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetDexPc(0xd0400);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0xd0400U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.apk", frame->map_name);
-  EXPECT_EQ(0x1000U, frame->map_elf_start_offset);
-  EXPECT_EQ(0x1000U, frame->map_exact_offset);
-  EXPECT_EQ(0xd0000U, frame->map_start);
-  EXPECT_EQ(0xd1000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, dex_pc_not_in_map) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetDexPc(0x50000);
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(2U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x50000U, frame->rel_pc);
-  EXPECT_EQ(0x50000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0U, frame->map_start);
-  EXPECT_EQ(0U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(0, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, dex_pc_multiple_frames) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame1", 1));
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetDexPc(0xa3400);
-  ElfInterfaceFake::FakePushStepData(StepData(0x33402, 0x10010, false));
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(3U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0xa3400U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.vdex", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xa3000U, frame->map_start);
-  EXPECT_EQ(0xa4000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-
-  frame = &unwinder.frames()[1];
-  EXPECT_EQ(1U, frame->num);
-  EXPECT_EQ(0U, frame->rel_pc);
-  EXPECT_EQ(0x1000U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/system/fake/libc.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x1000U, frame->map_start);
-  EXPECT_EQ(0x8000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-
-  frame = &unwinder.frames()[2];
-  EXPECT_EQ(2U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0x33400U, frame->pc);
-  EXPECT_EQ(0x10010U, frame->sp);
-  EXPECT_EQ("Frame1", frame->function_name);
-  EXPECT_EQ(1U, frame->function_offset);
-  EXPECT_EQ("/fake/compressed.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0x33000U, frame->map_start);
-  EXPECT_EQ(0x34000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, dex_pc_max_frames) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-  regs_.set_pc(0x1000);
-  regs_.set_sp(0x10000);
-  regs_.FakeSetDexPc(0xa3400);
-
-  Unwinder unwinder(1, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_MAX_FRAMES_EXCEEDED, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x400U, frame->rel_pc);
-  EXPECT_EQ(0xa3400U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/fake.vdex", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xa3000U, frame->map_start);
-  EXPECT_EQ(0xa4000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, elf_from_memory_not_file) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0xc0050);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_TRUE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x50U, frame->rel_pc);
-  EXPECT_EQ(0xc0050U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/fake/unreadable.so", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xc0000U, frame->map_start);
-  EXPECT_EQ(0xc1000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, elf_from_memory_but_no_valid_file_with_bracket) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0xc1050);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x50U, frame->rel_pc);
-  EXPECT_EQ(0xc1050U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("[vdso]", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xc1000U, frame->map_start);
-  EXPECT_EQ(0xc2000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, elf_from_memory_but_empty_filename) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0xc2050);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x50U, frame->rel_pc);
-  EXPECT_EQ(0xc2050U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xc2000U, frame->map_start);
-  EXPECT_EQ(0xc3000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-TEST_F(UnwinderTest, elf_from_memory_but_from_memfd) {
-  ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
-
-  regs_.set_pc(0xc3050);
-  regs_.set_sp(0x10000);
-  ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
-
-  Unwinder unwinder(64, maps_.get(), &regs_, process_memory_);
-  unwinder.Unwind();
-  EXPECT_EQ(ERROR_NONE, unwinder.LastErrorCode());
-  EXPECT_FALSE(unwinder.elf_from_memory_not_file());
-
-  ASSERT_EQ(1U, unwinder.NumFrames());
-
-  auto* frame = &unwinder.frames()[0];
-  EXPECT_EQ(0U, frame->num);
-  EXPECT_EQ(0x50U, frame->rel_pc);
-  EXPECT_EQ(0xc3050U, frame->pc);
-  EXPECT_EQ(0x10000U, frame->sp);
-  EXPECT_EQ("Frame0", frame->function_name);
-  EXPECT_EQ(0U, frame->function_offset);
-  EXPECT_EQ("/memfd:/jit-cache", frame->map_name);
-  EXPECT_EQ(0U, frame->map_elf_start_offset);
-  EXPECT_EQ(0U, frame->map_exact_offset);
-  EXPECT_EQ(0xc3000U, frame->map_start);
-  EXPECT_EQ(0xc4000U, frame->map_end);
-  EXPECT_EQ(0U, frame->map_load_bias);
-  EXPECT_EQ(PROT_READ | PROT_WRITE | PROT_EXEC, frame->map_flags);
-}
-
-// Verify format frame code.
-TEST_F(UnwinderTest, format_frame) {
-  RegsFake regs_arm(10);
-  regs_arm.FakeSetArch(ARCH_ARM);
-  Unwinder unwinder32(10, maps_.get(), &regs_arm, process_memory_);
-
-  RegsFake regs_arm64(10);
-  regs_arm64.FakeSetArch(ARCH_ARM64);
-  Unwinder unwinder64(10, maps_.get(), &regs_arm64, process_memory_);
-
-  FrameData frame;
-  frame.num = 1;
-  frame.rel_pc = 0x1000;
-  frame.pc = 0x4000;
-  frame.sp = 0x1000;
-  frame.function_name = "function";
-  frame.function_offset = 100;
-  frame.map_name = "/fake/libfake.so";
-  frame.map_elf_start_offset = 0x2000;
-  frame.map_start = 0x3000;
-  frame.map_end = 0x6000;
-  frame.map_flags = PROT_READ;
-
-  EXPECT_EQ("  #01 pc 0000000000001000  /fake/libfake.so (offset 0x2000) (function+100)",
-            unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so (offset 0x2000) (function+100)",
-            unwinder32.FormatFrame(frame));
-
-  frame.map_elf_start_offset = 0;
-  EXPECT_EQ("  #01 pc 0000000000001000  /fake/libfake.so (function+100)",
-            unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so (function+100)", unwinder32.FormatFrame(frame));
-
-  frame.function_offset = 0;
-  EXPECT_EQ("  #01 pc 0000000000001000  /fake/libfake.so (function)",
-            unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so (function)", unwinder32.FormatFrame(frame));
-
-  // Verify the function name is demangled.
-  frame.function_name = "_ZN4funcEv";
-  EXPECT_EQ("  #01 pc 0000000000001000  /fake/libfake.so (func())", unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so (func())", unwinder32.FormatFrame(frame));
-
-  frame.function_name = "";
-  EXPECT_EQ("  #01 pc 0000000000001000  /fake/libfake.so", unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so", unwinder32.FormatFrame(frame));
-
-  frame.map_name = "";
-  EXPECT_EQ("  #01 pc 0000000000001000  <anonymous:3000>", unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  <anonymous:3000>", unwinder32.FormatFrame(frame));
-
-  frame.map_start = 0;
-  frame.map_end = 0;
-  EXPECT_EQ("  #01 pc 0000000000001000  <unknown>", unwinder64.FormatFrame(frame));
-  EXPECT_EQ("  #01 pc 00001000  <unknown>", unwinder32.FormatFrame(frame));
-}
-
-TEST_F(UnwinderTest, format_frame_build_id) {
-  RegsFake regs(10);
-  regs.FakeSetArch(ARCH_ARM);
-  Unwinder unwinder(10, maps_.get(), &regs, process_memory_);
-
-  FrameData frame;
-  frame.num = 1;
-  frame.rel_pc = 0x1000;
-  frame.pc = 0x4000;
-  frame.sp = 0x1000;
-  frame.function_name = "function";
-  frame.function_offset = 100;
-  frame.map_name = "/fake/libfake.so";
-  frame.map_elf_start_offset = 0;
-  frame.map_start = 0x3000;
-  frame.map_end = 0x6000;
-  frame.map_flags = PROT_READ;
-
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so (function+100)", unwinder.FormatFrame(frame));
-  unwinder.SetDisplayBuildID(true);
-  EXPECT_EQ("  #01 pc 00001000  /fake/libfake.so (function+100) (BuildId: 46414b45)",
-            unwinder.FormatFrame(frame));
-}
-
-static std::string ArchToString(ArchEnum arch) {
-  if (arch == ARCH_ARM) {
-    return "Arm";
-  } else if (arch == ARCH_ARM64) {
-    return "Arm64";
-  } else if (arch == ARCH_X86) {
-    return "X86";
-  } else if (arch == ARCH_X86_64) {
-    return "X86_64";
-  } else {
-    return "Unknown";
-  }
-}
-
-// Verify format frame code.
-TEST_F(UnwinderTest, format_frame_by_arch) {
-  std::vector<Regs*> reg_list;
-  RegsArm* arm = new RegsArm;
-  arm->set_pc(0x2300);
-  arm->set_sp(0x10000);
-  reg_list.push_back(arm);
-
-  RegsArm64* arm64 = new RegsArm64;
-  arm64->set_pc(0x2300);
-  arm64->set_sp(0x10000);
-  reg_list.push_back(arm64);
-
-  RegsX86* x86 = new RegsX86;
-  x86->set_pc(0x2300);
-  x86->set_sp(0x10000);
-  reg_list.push_back(x86);
-
-  RegsX86_64* x86_64 = new RegsX86_64;
-  x86_64->set_pc(0x2300);
-  x86_64->set_sp(0x10000);
-  reg_list.push_back(x86_64);
-
-  RegsMips* mips = new RegsMips;
-  mips->set_pc(0x2300);
-  mips->set_sp(0x10000);
-  reg_list.push_back(mips);
-
-  RegsMips64* mips64 = new RegsMips64;
-  mips64->set_pc(0x2300);
-  mips64->set_sp(0x10000);
-  reg_list.push_back(mips64);
-
-  for (auto regs : reg_list) {
-    ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 10));
-
-    Unwinder unwinder(64, maps_.get(), regs, process_memory_);
-    unwinder.Unwind();
-
-    ASSERT_EQ(1U, unwinder.NumFrames());
-    std::string expected;
-    switch (regs->Arch()) {
-      case ARCH_ARM:
-      case ARCH_X86:
-      case ARCH_MIPS:
-        expected = "  #00 pc 00001300  /system/fake/libc.so (Frame0+10)";
-        break;
-      case ARCH_ARM64:
-      case ARCH_X86_64:
-      case ARCH_MIPS64:
-        expected = "  #00 pc 0000000000001300  /system/fake/libc.so (Frame0+10)";
-        break;
-      default:
-        expected = "";
-    }
-    EXPECT_EQ(expected, unwinder.FormatFrame(0))
-        << "Mismatch of frame format for regs arch " << ArchToString(regs->Arch());
-    delete regs;
-  }
-}
-
-}  // namespace unwindstack
diff --git a/libunwindstack/tests/VerifyBionicTerminationTest.cpp b/libunwindstack/tests/VerifyBionicTerminationTest.cpp
deleted file mode 100644
index 6a3e91a..0000000
--- a/libunwindstack/tests/VerifyBionicTerminationTest.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#define _GNU_SOURCE 1
-#include <stdint.h>
-#include <string.h>
-
-#include <string>
-
-#if defined(__BIONIC__)
-
-#include <gtest/gtest.h>
-
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/RegsGetLocal.h>
-#include <unwindstack/Unwinder.h>
-
-// This test is specific to bionic to verify that __libc_init is
-// properly setting the return address to undefined so that the
-// unwind properly terminates.
-
-namespace unwindstack {
-
-static std::string DumpFrames(const UnwinderFromPid& unwinder) {
-  std::string unwind;
-  for (size_t i = 0; i < unwinder.NumFrames(); i++) {
-    unwind += unwinder.FormatFrame(i) + '\n';
-  }
-  return unwind;
-}
-
-static DwarfLocationEnum GetReturnAddressLocation(uint64_t rel_pc, DwarfSection* section) {
-  if (section == nullptr) {
-    return DWARF_LOCATION_INVALID;
-  }
-
-  const DwarfFde* fde = section->GetFdeFromPc(rel_pc);
-  if (fde == nullptr || fde->cie == nullptr) {
-    return DWARF_LOCATION_INVALID;
-  }
-  dwarf_loc_regs_t regs;
-  if (!section->GetCfaLocationInfo(rel_pc, fde, &regs)) {
-    return DWARF_LOCATION_INVALID;
-  }
-
-  auto reg_entry = regs.find(fde->cie->return_address_register);
-  if (reg_entry == regs.end()) {
-    return DWARF_LOCATION_INVALID;
-  }
-  return reg_entry->second.type;
-}
-
-static void VerifyReturnAddress(const FrameData& frame) {
-  // Now go and find information about the register data and verify that the relative pc results in
-  // an undefined register.
-  Elf elf(Memory::CreateFileMemory(frame.map_name, 0).release());
-  ASSERT_TRUE(elf.Init()) << "Failed to init elf object from " << frame.map_name;
-  ASSERT_TRUE(elf.valid()) << "Elf " << frame.map_name << " is not valid.";
-  ElfInterface* interface = elf.interface();
-
-  // Only check the eh_frame and the debug_frame since the undefined register
-  // is set using a cfi directive.
-  // Check debug_frame first, then eh_frame since debug_frame always
-  // contains the most specific data.
-  DwarfLocationEnum location = GetReturnAddressLocation(frame.rel_pc, interface->debug_frame());
-  if (location == DWARF_LOCATION_UNDEFINED) {
-    return;
-  }
-
-  location = GetReturnAddressLocation(frame.rel_pc, interface->eh_frame());
-  ASSERT_EQ(DWARF_LOCATION_UNDEFINED, location);
-}
-
-// This test assumes that it starts from the main thread, and that the
-// libc.so on device will include symbols so that function names can
-// be resolved.
-TEST(VerifyBionicTermination, local_terminate) {
-  std::unique_ptr<Regs> regs(Regs::CreateFromLocal());
-
-  UnwinderFromPid unwinder(512, getpid());
-  ASSERT_TRUE(unwinder.Init(regs->Arch()));
-  unwinder.SetRegs(regs.get());
-
-  RegsGetLocal(regs.get());
-  unwinder.Unwind();
-  ASSERT_LT(0U, unwinder.NumFrames());
-
-  SCOPED_TRACE(DumpFrames(unwinder));
-
-  // Look for the frame that includes __libc_init, there should only
-  // be one and it should be the last.
-  bool found = false;
-  const std::vector<FrameData>& frames = unwinder.frames();
-  for (size_t i = 0; i < unwinder.NumFrames(); i++) {
-    const FrameData& frame = frames[i];
-    if (frame.function_name == "__libc_init" && !frame.map_name.empty() &&
-        std::string("libc.so") == basename(frame.map_name.c_str())) {
-      ASSERT_EQ(unwinder.NumFrames(), i + 1) << "__libc_init is not last frame.";
-      ASSERT_NO_FATAL_FAILURE(VerifyReturnAddress(frame));
-      found = true;
-    }
-  }
-  ASSERT_TRUE(found) << "Unable to find libc.so:__libc_init frame\n";
-}
-
-}  // namespace unwindstack
-
-#endif
diff --git a/libunwindstack/tests/files/elf32.xz b/libunwindstack/tests/files/elf32.xz
deleted file mode 100644
index f25d433..0000000
--- a/libunwindstack/tests/files/elf32.xz
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/elf64.xz b/libunwindstack/tests/files/elf64.xz
deleted file mode 100644
index eb1618e..0000000
--- a/libunwindstack/tests/files/elf64.xz
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/descriptor.data b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/descriptor.data
deleted file mode 100644
index 300646b..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/descriptor.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/entry0.data b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/entry0.data
deleted file mode 100644
index 999cb79..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/entry0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/entry1.data b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/entry1.data
deleted file mode 100644
index 6aa1c82..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/entry1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/jit0.data b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/jit0.data
deleted file mode 100644
index 19d7b65..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/jit0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/jit1.data b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/jit1.data
deleted file mode 100644
index edcd3e1..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/jit1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/libart.so b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/libart.so
deleted file mode 100644
index 09ba495..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/libart.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/libc.so b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/libc.so
deleted file mode 100644
index 39c9025..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/maps.txt b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/maps.txt
deleted file mode 100644
index 1ff12db..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/maps.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-d0250000-d2600000 r-xp 0 00:00 0 <anonymous:d0250000>
-e466e000-e4ae8000 r-xp 0 00:00 0 libart.so
-e4af1000-e4af2000 rw-p 482000 00:00 0 libart.so
-e7d91000-e7e31000 r-xp 0 00:00 0 libc.so
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/regs.txt b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/regs.txt
deleted file mode 100644
index 0b51814..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: e814103c
-r1: 12dcf218
-r2: 1a90df75
-r3: ffffffbf
-r4: 0
-r5: 12dc0800
-r6: 12dcf218
-r7: 1a90df75
-r8: 0
-r9: dd23cc00
-r10: 1c
-r11: cd4ff16c
-ip: 0
-sp: cd4ff140
-lr: d025cdd7
-pc: d025c788
diff --git a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/stack.data b/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/stack.data
deleted file mode 100644
index f00917b..0000000
--- a/libunwindstack/tests/files/offline/art_quick_osr_stub_arm/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/libc.so b/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/libc.so
deleted file mode 100644
index 78449bf..0000000
--- a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/maps.txt b/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/maps.txt
deleted file mode 100644
index 7cada15..0000000
--- a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/maps.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-60a9fdf000-60a9fe0000 r-xp 0 00:00 0   waiter64
-7542cc0000-7542d8e000 r-xp 0 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/regs.txt b/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/regs.txt
deleted file mode 100644
index c24adbe..0000000
--- a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/regs.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-pc: 60a9fdf550
-sp: 7fdd141990
-lr: 60a9fdf56c
-x29: 7fdd1419a0
diff --git a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/stack.data b/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/stack.data
deleted file mode 100644
index b56d420..0000000
--- a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/waiter64 b/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/waiter64
deleted file mode 100644
index 81bda1d..0000000
--- a/libunwindstack/tests/files/offline/bad_eh_frame_hdr_arm64/waiter64
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_first_x86/libc.so b/libunwindstack/tests/files/offline/debug_frame_first_x86/libc.so
deleted file mode 100644
index 9c78790..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_first_x86/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_first_x86/maps.txt b/libunwindstack/tests/files/offline/debug_frame_first_x86/maps.txt
deleted file mode 100644
index 74fc89f..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_first_x86/maps.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-56598000-56599000 r-xp 0 00:00 0   waiter
-f7432000-f75e3000 r-xp 0 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/debug_frame_first_x86/regs.txt b/libunwindstack/tests/files/offline/debug_frame_first_x86/regs.txt
deleted file mode 100644
index 48f4440..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_first_x86/regs.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-eax: 1d88ef8c
-ebx: 56599fe8
-ecx: 3
-edx: ffcf9ea4
-ebp: ffcf9e48
-edi: f75e5000
-esi: 1
-esp: ffcf9e38
-eip: 56598685
diff --git a/libunwindstack/tests/files/offline/debug_frame_first_x86/stack.data b/libunwindstack/tests/files/offline/debug_frame_first_x86/stack.data
deleted file mode 100644
index 0cf7d55..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_first_x86/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_first_x86/waiter b/libunwindstack/tests/files/offline/debug_frame_first_x86/waiter
deleted file mode 100644
index b1fc024..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_first_x86/waiter
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/libbinder.so b/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/libbinder.so
deleted file mode 100644
index 4b7bf44..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/libbinder.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/libc.so b/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/libc.so
deleted file mode 100644
index 013858e..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/maps.txt b/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/maps.txt
deleted file mode 100644
index 10f1325..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/maps.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-8d1c000-8d1f000 r-xp 0 00:00 0   mediaserver
-f0b91000-f0c2c000 r-xp 0 00:00 0   libc.so
-f1a41000-f1a97000 r-xp 0 00:00 0   libbinder.so
diff --git a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/mediaserver b/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/mediaserver
deleted file mode 100644
index 9e4a83f..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/mediaserver
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/regs.txt b/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/regs.txt
deleted file mode 100644
index f147247..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: 3
-r1: c0306201
-r2: ffd4a658
-r3: 0
-r4: f0c36d8c
-r5: ffd4a658
-r6: f0168000
-r7: 36
-r8: ffd4a678
-r9: f016802c
-r10: ffd4a660
-r11: 0
-ip: 0
-sp: ffd4a638
-lr: f0bb2413
-pc: f0be238c
diff --git a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/stack.data b/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/stack.data
deleted file mode 100644
index 847c819..0000000
--- a/libunwindstack/tests/files/offline/debug_frame_load_bias_arm/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_bias_x86/libc.so b/libunwindstack/tests/files/offline/eh_frame_bias_x86/libc.so
deleted file mode 100644
index f3eb615..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_bias_x86/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_bias_x86/maps.txt b/libunwindstack/tests/files/offline/eh_frame_bias_x86/maps.txt
deleted file mode 100644
index 7d52483..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_bias_x86/maps.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-eb503000-eb5e8000 r-xp 0 00:00 0   libc.so
-eb831000-eb852000 r-xp 0 00:00 0   tombstoned
-ffffe000-fffff000 r-xp 0 00:00 0   vdso.so
diff --git a/libunwindstack/tests/files/offline/eh_frame_bias_x86/regs.txt b/libunwindstack/tests/files/offline/eh_frame_bias_x86/regs.txt
deleted file mode 100644
index 821928e..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_bias_x86/regs.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-eax: fffffffc
-ebx: 4
-ecx: eb290180
-edx: 20
-ebp: 8
-edi: 0
-esi: ffffffff
-esp: fffe1a30
-eip: ffffe430
diff --git a/libunwindstack/tests/files/offline/eh_frame_bias_x86/stack.data b/libunwindstack/tests/files/offline/eh_frame_bias_x86/stack.data
deleted file mode 100644
index b95bfac..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_bias_x86/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_bias_x86/tombstoned b/libunwindstack/tests/files/offline/eh_frame_bias_x86/tombstoned
deleted file mode 100644
index aefdb6b..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_bias_x86/tombstoned
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_bias_x86/vdso.so b/libunwindstack/tests/files/offline/eh_frame_bias_x86/vdso.so
deleted file mode 100644
index c71dcfb..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_bias_x86/vdso.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/libc.so b/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/libc.so
deleted file mode 100644
index 46b6f45..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/maps.txt b/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/maps.txt
deleted file mode 100644
index ac2e564..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/maps.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-561550b17000-561550b1a000 r-xp 0 00:00 0   unwind_test64
-7f4de61f6000-7f4de638b000 r-xp 0 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/regs.txt b/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/regs.txt
deleted file mode 100644
index 38af274..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/regs.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-rax: 92134c6fbbdc12ff
-rbx: 0
-rcx: 92134c6fbbdc1200
-rdx: 92134c6fbbdc1200
-r8: 561552153034
-r12: 561550b17930
-r13: 7ffcc8597270
-rsi: 561552153034
-rbp: 7ffcc8596f30
-rsp: 7ffcc8596ce8
-rip: 561550b17a80
diff --git a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/stack.data b/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/stack.data
deleted file mode 100644
index cc7882b..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/unwind_test64 b/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/unwind_test64
deleted file mode 100644
index ab0ef8f..0000000
--- a/libunwindstack/tests/files/offline/eh_frame_hdr_begin_x86_64/unwind_test64
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/empty_arm64/libbinder.so b/libunwindstack/tests/files/offline/empty_arm64/libbinder.so
deleted file mode 100644
index f30384c..0000000
--- a/libunwindstack/tests/files/offline/empty_arm64/libbinder.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/empty_arm64/libc.so b/libunwindstack/tests/files/offline/empty_arm64/libc.so
deleted file mode 100644
index b05dcaf..0000000
--- a/libunwindstack/tests/files/offline/empty_arm64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/empty_arm64/maps.txt b/libunwindstack/tests/files/offline/empty_arm64/maps.txt
deleted file mode 100644
index edb83c6..0000000
--- a/libunwindstack/tests/files/offline/empty_arm64/maps.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-5d4786b000-5d47893000 r--p 0 00:00 0   netd
-5d47893000-5d47894000 ---p 0 00:00 0
-5d47894000-5d47901000 --xp 29000 00:00 0   netd
-729f709000-729f750000 r--p 0 00:00 0   libbinder.so
-729f750000-729f751000 ---p 0 00:00 0
-729f751000-729f794000 --xp 48000 00:00 0   libbinder.so
-72a018a000-72a01c2000 r--p 0 00:00 0   libc.so
-72a01c2000-72a01c3000 ---p 0 00:00 0
-72a01c3000-72a023b000 --xp 39000 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/empty_arm64/netd b/libunwindstack/tests/files/offline/empty_arm64/netd
deleted file mode 100644
index 8a72e94..0000000
--- a/libunwindstack/tests/files/offline/empty_arm64/netd
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/empty_arm64/regs.txt b/libunwindstack/tests/files/offline/empty_arm64/regs.txt
deleted file mode 100644
index 3d4279f..0000000
--- a/libunwindstack/tests/files/offline/empty_arm64/regs.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-x0: 1d
-x1: c0306201
-x2: 7ffb6c0c50
-x3: 0
-x4: 0
-x5: 0
-x6: 0
-x7: 0
-x8: 1d
-x9: 7ffb6c0c00
-x10: 7ffb6c0c50
-x11: 7ffb6c0bd0
-x12: ffffff80ffffffd0
-x13: 0
-x14: 72a0240ce2
-x15: 20
-x16: 729f7a54e8
-x17: 72a01dd3c0
-x18: 72a0ac2000
-x19: 72a0666000
-x20: 719769b610
-x21: 719769b730
-x22: c0306201
-x23: fffffff7
-x24: 72a0666000
-x25: 0
-x26: 0
-x27: 0
-x28: 0
-x29: 7ffb6c0c30
-sp: 7ffb6c0b50
-lr: 72a01dd450
-pc: 72a02203a4
-pst: a0000000
diff --git a/libunwindstack/tests/files/offline/empty_arm64/stack.data b/libunwindstack/tests/files/offline/empty_arm64/stack.data
deleted file mode 100644
index 6d6108c..0000000
--- a/libunwindstack/tests/files/offline/empty_arm64/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/gnu_debugdata_arm/libandroid_runtime.so b/libunwindstack/tests/files/offline/gnu_debugdata_arm/libandroid_runtime.so
deleted file mode 100644
index e4283e6..0000000
--- a/libunwindstack/tests/files/offline/gnu_debugdata_arm/libandroid_runtime.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/gnu_debugdata_arm/maps.txt b/libunwindstack/tests/files/offline/gnu_debugdata_arm/maps.txt
deleted file mode 100644
index 1bcddb6..0000000
--- a/libunwindstack/tests/files/offline/gnu_debugdata_arm/maps.txt
+++ /dev/null
@@ -1 +0,0 @@
-f1f10000-f2049000 r-xp 00000000 00:00 0   libandroid_runtime.so
diff --git a/libunwindstack/tests/files/offline/gnu_debugdata_arm/regs.txt b/libunwindstack/tests/files/offline/gnu_debugdata_arm/regs.txt
deleted file mode 100644
index c6a93dc..0000000
--- a/libunwindstack/tests/files/offline/gnu_debugdata_arm/regs.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-pc: f1f6dc49
-sp: d8fe6930
diff --git a/libunwindstack/tests/files/offline/gnu_debugdata_arm/stack.data b/libunwindstack/tests/files/offline/gnu_debugdata_arm/stack.data
deleted file mode 100644
index 19cdf2d..0000000
--- a/libunwindstack/tests/files/offline/gnu_debugdata_arm/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/invalid_elf_offset_arm/maps.txt b/libunwindstack/tests/files/offline/invalid_elf_offset_arm/maps.txt
deleted file mode 100644
index 022404c..0000000
--- a/libunwindstack/tests/files/offline/invalid_elf_offset_arm/maps.txt
+++ /dev/null
@@ -1 +0,0 @@
-c7ee8000-c8c52fff r-xp  12e4000    00:00 0  invalid.apk
diff --git a/libunwindstack/tests/files/offline/invalid_elf_offset_arm/regs.txt b/libunwindstack/tests/files/offline/invalid_elf_offset_arm/regs.txt
deleted file mode 100644
index b7f10ef..0000000
--- a/libunwindstack/tests/files/offline/invalid_elf_offset_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: c0434c00
-r1: 2a4c9fbc
-r2: 00000000
-r3: c83ef1f9
-r4: 00000004
-r5: c2044904
-r6: 00000000
-r7: c20443b8
-r8: 000b33ff
-r9: c20444b0
-r10: cac90740
-r11: 00000000
-ip: ed891ca4
-sp: c2044218
-lr: ed807265
-pc: c898f508
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/137-cfi.odex b/libunwindstack/tests/files/offline/jit_debug_arm/137-cfi.odex
deleted file mode 100644
index 35a6bc5..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/137-cfi.odex
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/dalvikvm32 b/libunwindstack/tests/files/offline/jit_debug_arm/dalvikvm32
deleted file mode 100644
index def299e..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/dalvikvm32
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/descriptor.data b/libunwindstack/tests/files/offline/jit_debug_arm/descriptor.data
deleted file mode 100644
index 7b876b5..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/descriptor.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/descriptor1.data b/libunwindstack/tests/files/offline/jit_debug_arm/descriptor1.data
deleted file mode 100644
index 3c468d6..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/descriptor1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry0.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry0.data
deleted file mode 100644
index 2c7689b..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry1.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry1.data
deleted file mode 100644
index 22a35b8..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry2.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry2.data
deleted file mode 100644
index 61f3927..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry2.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry3.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry3.data
deleted file mode 100644
index 1a37628..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry3.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry4.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry4.data
deleted file mode 100644
index 7ef62ca..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry4.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry5.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry5.data
deleted file mode 100644
index 6d27c89..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry5.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/entry6.data b/libunwindstack/tests/files/offline/jit_debug_arm/entry6.data
deleted file mode 100644
index bfbceea..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/entry6.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit0.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit0.data
deleted file mode 100644
index b78848e..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit1.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit1.data
deleted file mode 100644
index 8f927ac..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit2.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit2.data
deleted file mode 100644
index 1d1dfca..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit2.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit3.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit3.data
deleted file mode 100644
index 89aeb43..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit3.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit4.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit4.data
deleted file mode 100644
index e076934..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit4.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit5.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit5.data
deleted file mode 100644
index 17d6041..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit5.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/jit6.data b/libunwindstack/tests/files/offline/jit_debug_arm/jit6.data
deleted file mode 100644
index aaff037..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/jit6.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/libart.so b/libunwindstack/tests/files/offline/jit_debug_arm/libart.so
deleted file mode 100644
index 0527893..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/libart.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/libartd.so b/libunwindstack/tests/files/offline/jit_debug_arm/libartd.so
deleted file mode 100644
index 8559056..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/libartd.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/libarttestd.so b/libunwindstack/tests/files/offline/jit_debug_arm/libarttestd.so
deleted file mode 100644
index 06dbf10..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/libarttestd.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/libc.so b/libunwindstack/tests/files/offline/jit_debug_arm/libc.so
deleted file mode 100644
index 9894e66..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/maps.txt b/libunwindstack/tests/files/offline/jit_debug_arm/maps.txt
deleted file mode 100644
index 3b87f2f..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/maps.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-ab0d3000-ab0d8000 r-xp 0 00:00 0   dalvikvm32
-dfe4e000-dfe7b000 r-xp 0 00:00 0   libarttestd.so
-e0445000-e0447000 r--p 0 00:00 0   137-cfi.odex
-e0447000-e0448000 r-xp 2000 00:00 0   137-cfi.odex
-e2796000-e4796000 r-xp 0 00:00 0   anonymous:e2796000
-e648e000-e690f000 r-xp 0 00:00 0  libart.so
-e6918000-e6919000 rw-p 489000 00:00 0  libart.so
-ed306000-ed801000 r-xp 0 00:00 0   libartd.so
-ed80a000-ed80b000 rw-p 503000 00:00 0   libartd.so
-eda88000-edb23000 r-xp 0 00:00 0   libc.so
-ede4e000-ede50000 r-xp 0 00:00 0   anonymous:ede4e000
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/regs.txt b/libunwindstack/tests/files/offline/jit_debug_arm/regs.txt
deleted file mode 100644
index 0e20066..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: dfe7c0f8
-r1: 0
-r2: 0
-r3: 40000000
-r4: e051ffb4
-r5: 0
-r6: e051ffc0
-r7: ede514e8
-r8: ff85d1a8
-r9: ed9210c0
-r10: 58
-r11: 0
-ip: edb26d04
-sp: ff85d180
-lr: edaff5af
-pc: dfe66a5e
diff --git a/libunwindstack/tests/files/offline/jit_debug_arm/stack.data b/libunwindstack/tests/files/offline/jit_debug_arm/stack.data
deleted file mode 100644
index b2ff14e..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_arm/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/137-cfi.odex b/libunwindstack/tests/files/offline/jit_debug_x86/137-cfi.odex
deleted file mode 100644
index 870ac0a..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/137-cfi.odex
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/dalvikvm32 b/libunwindstack/tests/files/offline/jit_debug_x86/dalvikvm32
deleted file mode 100644
index 76ffad9..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/dalvikvm32
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/descriptor.data b/libunwindstack/tests/files/offline/jit_debug_x86/descriptor.data
deleted file mode 100644
index 466dae2..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/descriptor.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry0.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry0.data
deleted file mode 100644
index 3a725e8..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry1.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry1.data
deleted file mode 100644
index 767550f..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry2.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry2.data
deleted file mode 100644
index e7e492e..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry2.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry3.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry3.data
deleted file mode 100644
index 65f9cd4..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry3.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry4.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry4.data
deleted file mode 100644
index 30aa28c..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry4.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry5.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry5.data
deleted file mode 100644
index 3c89673..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry5.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/entry6.data b/libunwindstack/tests/files/offline/jit_debug_x86/entry6.data
deleted file mode 100644
index 9c9b83c..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/entry6.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit0.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit0.data
deleted file mode 100644
index eaad142..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit1.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit1.data
deleted file mode 100644
index d534816..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit2.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit2.data
deleted file mode 100644
index dbeb886..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit2.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit3.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit3.data
deleted file mode 100644
index bf2142d..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit3.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit4.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit4.data
deleted file mode 100644
index e2ba1b0..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit4.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit5.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit5.data
deleted file mode 100644
index c27ba54..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit5.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/jit6.data b/libunwindstack/tests/files/offline/jit_debug_x86/jit6.data
deleted file mode 100644
index 5fc8fae..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/jit6.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/libartd.so b/libunwindstack/tests/files/offline/jit_debug_x86/libartd.so
deleted file mode 100644
index 92ed991..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/libartd.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/libarttestd.so b/libunwindstack/tests/files/offline/jit_debug_x86/libarttestd.so
deleted file mode 100644
index 5efae02..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/libarttestd.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/libc.so b/libunwindstack/tests/files/offline/jit_debug_x86/libc.so
deleted file mode 100644
index 9c78790..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/maps.txt b/libunwindstack/tests/files/offline/jit_debug_x86/maps.txt
deleted file mode 100644
index c22b5de..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/maps.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-56573000-56577000 r-xp 0 00:00 0   dalvikvm32
-eb833000-eb8cc000 r-xp 0 00:00 0   libarttestd.so
-ec604000-ec606000 r--p 0 00:00 0   137-cfi.odex
-ec606000-ec607000 r-xp 2000 00:00 0   137-cfi.odex
-ee74c000-f074c000 r-xp 0 00:00 0   anonymous:ee74c000
-f6be1000-f732b000 r-xp 0 00:00 0   libartd.so
-f7334000-f7335000 rw-p 752000 00:00 0   libartd.so
-f734b000-f74fc000 r-xp 0 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/regs.txt b/libunwindstack/tests/files/offline/jit_debug_x86/regs.txt
deleted file mode 100644
index f68305b..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/regs.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-eax: eb8cccd0
-ebx: eb8cccd0
-ecx: ff
-edx: ffeb2ca8
-ebp: ffeb5298
-edi: ffeb5c08
-esi: ffeb5c00
-esp: ffeb5280
-eip: eb89bfb8
diff --git a/libunwindstack/tests/files/offline/jit_debug_x86/stack.data b/libunwindstack/tests/files/offline/jit_debug_x86/stack.data
deleted file mode 100644
index c345762..0000000
--- a/libunwindstack/tests/files/offline/jit_debug_x86/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/jit_map0.so b/libunwindstack/tests/files/offline/jit_map_arm/jit_map0.so
deleted file mode 100644
index e667883..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/jit_map0.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/jit_map1.so b/libunwindstack/tests/files/offline/jit_map_arm/jit_map1.so
deleted file mode 100644
index 9a1d714..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/jit_map1.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/libart.so b/libunwindstack/tests/files/offline/jit_map_arm/libart.so
deleted file mode 100644
index 09ba495..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/libart.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/libc.so b/libunwindstack/tests/files/offline/jit_map_arm/libc.so
deleted file mode 100644
index 39c9025..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/maps.txt b/libunwindstack/tests/files/offline/jit_map_arm/maps.txt
deleted file mode 100644
index 5aaec54..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/maps.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-e466e000-e4ae8000 r-xp 0 00:00 0 libart.so
-e7d91000-e7e31000 r-xp 0 00:00 0 libc.so
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/regs.txt b/libunwindstack/tests/files/offline/jit_map_arm/regs.txt
deleted file mode 100644
index 0b51814..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: e814103c
-r1: 12dcf218
-r2: 1a90df75
-r3: ffffffbf
-r4: 0
-r5: 12dc0800
-r6: 12dcf218
-r7: 1a90df75
-r8: 0
-r9: dd23cc00
-r10: 1c
-r11: cd4ff16c
-ip: 0
-sp: cd4ff140
-lr: d025cdd7
-pc: d025c788
diff --git a/libunwindstack/tests/files/offline/jit_map_arm/stack.data b/libunwindstack/tests/files/offline/jit_map_arm/stack.data
deleted file mode 100644
index fb8feeb..0000000
--- a/libunwindstack/tests/files/offline/jit_map_arm/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/libc.so b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/libc.so
deleted file mode 100644
index 7bb7156..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/linker64 b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/linker64
deleted file mode 100644
index 00a3896..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/linker64
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/maps.txt b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/maps.txt
deleted file mode 100644
index a2babee..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/maps.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-5f73997000-5f739dc000 r--p 0 00:00 0   test
-5f739dc000-5f73a43000 r-xp 44000 00:00 0   test
-711152c000-711156e000 r--p 0 00:00 0   libc.so
-711156e000-7111611000 --xp 42000 00:00 0   libc.so
-7112be2000-7112be4000 r-xp 0 00:00 0   vdso
-7112be4000-7112c1c000 r--p 0 00:00 0   linker64
-7112c1c000-7112ce1000 r-xp 38000 00:00 0   linker64
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/regs.txt b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/regs.txt
deleted file mode 100644
index 3c601e1..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/regs.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-x0: 7112bdbc24
-x1: 0
-x2: ffffffff
-x3: 0
-x4: 0
-x5: 0
-x6: 0
-x7: 7f7f7f7f7f7f7f7f
-x8: 62
-x9: a78826643b37f4a1
-x10: 7112bdbc20
-x11: 4100
-x12: 7112bdbb70
-x13: 18
-x14: 1d6518077
-x15: 2a43148faf732a
-x16: 16fc0
-x17: 71115f61a0
-x18: 7111d6a000
-x19: 7112cef1b0
-x20: 7112bdbda0
-x21: 59616d61
-x22: 1
-x23: 7112bdbc24
-x24: 4b0e
-x25: 62
-x26: 2
-x27: 0
-x28: 7111934020
-x29: 7112bdbd90
-sp: 7112bdbbf0
-lr: 7112c394ec
-pc: 7112cb99bc
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/stack0.data b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/stack0.data
deleted file mode 100644
index 1674733..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/stack0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/stack1.data b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/stack1.data
deleted file mode 100644
index 6d7b48a..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/stack1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/test b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/test
deleted file mode 100644
index 3a75b8f..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/test
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/vdso b/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/vdso
deleted file mode 100644
index 4940916..0000000
--- a/libunwindstack/tests/files/offline/load_bias_different_section_bias_arm64/vdso
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/libc.so b/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/libc.so
deleted file mode 100644
index 63383d0..0000000
--- a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/maps.txt b/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/maps.txt
deleted file mode 100644
index ba5a31b..0000000
--- a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/maps.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-200000-919000 r--p 0 00:00 0   perfetto_unittests
-919000-1a0c000 r-xp 719000 00:00 0   perfetto_unittests
-7f932696e000-7f9326b23000 r-xp 0 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/perfetto_unittests b/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/perfetto_unittests
deleted file mode 100644
index a30e599..0000000
--- a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/perfetto_unittests
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/regs.txt b/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/regs.txt
deleted file mode 100644
index 6cb4055..0000000
--- a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/regs.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-rax: 3b
-rbx: 3b
-rcx: 7f9326a57dd4
-rdx: 3b
-r8: 7ffd22415b09
-r9: 7ffd224155e0
-r10: 0
-r11: 246
-r12: 7f9326d28760
-r13: 3b
-r14: 7f9326d23760
-r15: 3b
-rdi: 1
-rsi: 2678850
-rbp: 2678850
-rsp: 7ffd224153c8
-rip: 7f9326a57dd4
diff --git a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/stack.data b/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/stack.data
deleted file mode 100644
index 4edfe07..0000000
--- a/libunwindstack/tests/files/offline/load_bias_ro_rx_x86_64/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/offset_arm/libc.so b/libunwindstack/tests/files/offline/offset_arm/libc.so
deleted file mode 100644
index 9f5c8ca..0000000
--- a/libunwindstack/tests/files/offline/offset_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/offset_arm/libunwindstack_test b/libunwindstack/tests/files/offline/offset_arm/libunwindstack_test
deleted file mode 100644
index 7a30bfa..0000000
--- a/libunwindstack/tests/files/offline/offset_arm/libunwindstack_test
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/offset_arm/maps.txt b/libunwindstack/tests/files/offline/offset_arm/maps.txt
deleted file mode 100644
index 768dd9f..0000000
--- a/libunwindstack/tests/files/offline/offset_arm/maps.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-2b2a000-2b6c000 r--p 0 00:00 0   libunwindstack_test
-2b6c000-2e92000 r-xp 42000 00:00 0   libunwindstack_test
-f4110000-f4135000 r--p 0 00:00 0   libc.so
-f4135000-f41a9000 r-xp 25000 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/offset_arm/regs.txt b/libunwindstack/tests/files/offline/offset_arm/regs.txt
deleted file mode 100644
index 1f4ac8f..0000000
--- a/libunwindstack/tests/files/offline/offset_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: 5
-r1: 5
-r2: 4
-r3: 1
-r4: 73804b6b
-r5: f3c9c000
-r6: 2ea09ac
-r7: 10624dd3
-r8: f41b5d8c
-r9: f3c9c000
-r10: 6f17
-r11: f3c94048
-ip: 2ea0807
-sp: f43d2ccc
-lr: 2e55fef
-pc: 2e55fa0
diff --git a/libunwindstack/tests/files/offline/offset_arm/stack0.data b/libunwindstack/tests/files/offline/offset_arm/stack0.data
deleted file mode 100644
index 23a9874..0000000
--- a/libunwindstack/tests/files/offline/offset_arm/stack0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/offset_arm/stack1.data b/libunwindstack/tests/files/offline/offset_arm/stack1.data
deleted file mode 100644
index 49bdd1e..0000000
--- a/libunwindstack/tests/files/offline/offset_arm/stack1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/ANGLEPrebuilt.apk b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/ANGLEPrebuilt.apk
deleted file mode 100644
index 0277359..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/ANGLEPrebuilt.apk
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/libc.so b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/libc.so
deleted file mode 100644
index 20008fd..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/linker64 b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/linker64
deleted file mode 100644
index b90933b..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/linker64
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/maps.txt b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/maps.txt
deleted file mode 100644
index c4fc067..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/maps.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-7dabc03000-7dabc3f000 r--p 4000 00:00 0   ANGLEPrebuilt.apk
-7dabc3f000-7dabcf0000 r-xp 40000 00:00 0   ANGLEPrebuilt.apk
-7e7ee48000-7e7ee88000 r--p 0 00:00 0   libc.so
-7e7ee88000-7e7ef32000 r-xp 40000 00:00 0   libc.so
-7e82b01000-7e82b03000 r-xp 0 00:00 0   vdso.so
-7e82b03000-7e82b3c000 r--p 0 00:00 0   linker64
-7e82b3c000-7e82c77000 r-xp 39000 00:00 0   linker64
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/regs.txt b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/regs.txt
deleted file mode 100644
index 1e2ea32..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/regs.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-x0: 7df8ca3c24
-x1: 0
-x2: ffffffff
-x3: 0
-x4: 0
-x5: 0
-x6: 0
-x7: 7f7f7f7f7f7f7f7f
-x8: 62
-x9: 20dd5829922a93ac
-x10: 7e82b57420
-x11: 4100
-x12: 7df8ca3b70
-x13: 7df8ca3b98
-x14: 73d015e5
-x15: 39a36122467299
-x16: 76ac
-x17: 0
-x18: 7df8cfc000
-x19: 7dabf3e7a0
-x20: 7df8ca3da0
-x21: 59616d61
-x22: 1
-x23: 7df8ca3c24
-x24: 1894
-x25: 62
-x26: 2
-x27: 0
-x28: 7dabf3e790
-x29: 7df8ca3d90
-sp: 7df8ca3bf0
-lr: 7e82b57270
-pc: 7e82c4fcbc
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/stack0.data b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/stack0.data
deleted file mode 100644
index ec07e15..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/stack0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/stack1.data b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/stack1.data
deleted file mode 100644
index 825bb1a..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/stack1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/vdso.so b/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/vdso.so
deleted file mode 100644
index 205ebd4..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_arm64/vdso.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/lib_mem.data b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/lib_mem.data
deleted file mode 100644
index f39d127..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/lib_mem.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/libc.so b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/libc.so
deleted file mode 100644
index 20008fd..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/linker64 b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/linker64
deleted file mode 100644
index b90933b..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/linker64
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/maps.txt b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/maps.txt
deleted file mode 100644
index 386d57a..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/maps.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-7dabc03000-7dabc3f000 r--p 21d5000 00:00 0   ANGLEPrebuilt.apk
-7dabc3f000-7dabcf0000 r-xp 2211000 00:00 0   ANGLEPrebuilt.apk
-7e7ee48000-7e7ee88000 r--p 0 00:00 0   libc.so
-7e7ee88000-7e7ef32000 r-xp 40000 00:00 0   libc.so
-7e82b01000-7e82b03000 r-xp 0 00:00 0   vdso.so
-7e82b03000-7e82b3c000 r--p 0 00:00 0   linker64
-7e82b3c000-7e82c77000 r-xp 39000 00:00 0   linker64
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/regs.txt b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/regs.txt
deleted file mode 100644
index 1e2ea32..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/regs.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-x0: 7df8ca3c24
-x1: 0
-x2: ffffffff
-x3: 0
-x4: 0
-x5: 0
-x6: 0
-x7: 7f7f7f7f7f7f7f7f
-x8: 62
-x9: 20dd5829922a93ac
-x10: 7e82b57420
-x11: 4100
-x12: 7df8ca3b70
-x13: 7df8ca3b98
-x14: 73d015e5
-x15: 39a36122467299
-x16: 76ac
-x17: 0
-x18: 7df8cfc000
-x19: 7dabf3e7a0
-x20: 7df8ca3da0
-x21: 59616d61
-x22: 1
-x23: 7df8ca3c24
-x24: 1894
-x25: 62
-x26: 2
-x27: 0
-x28: 7dabf3e790
-x29: 7df8ca3d90
-sp: 7df8ca3bf0
-lr: 7e82b57270
-pc: 7e82c4fcbc
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/stack0.data b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/stack0.data
deleted file mode 100644
index ec07e15..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/stack0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/stack1.data b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/stack1.data
deleted file mode 100644
index 825bb1a..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/stack1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/vdso.so b/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/vdso.so
deleted file mode 100644
index 205ebd4..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_memory_only_arm64/vdso.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/libc.so b/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/libc.so
deleted file mode 100644
index cac1dd9..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/maps.txt b/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/maps.txt
deleted file mode 100644
index 2c5ca62..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/maps.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-7be5e48000-7be6b2b000 r-xp 5000 00:00 0   test.apk
-7cbe030000-7cbe070000 r--p 0 00:00 0   libc.so
-7cbe070000-7cbe11a000 r-xp 40000 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/regs.txt b/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/regs.txt
deleted file mode 100644
index 090aeda..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/regs.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-x0: 7c326f6568
-x1: 80
-x2: 0
-x3: 0
-x4: 0
-x5: 0
-x6: 0
-x7: 7f7f7f7f7f7f7f7f
-x8: 62
-x9: 1
-x10: 1
-x11: 0
-x12: ffffffffc4653600
-x13: 17645696f
-x14: 2742ed97ca77a3
-x15: 3ab49084
-x16: 7be6b6bdb8
-x17: 7cbe0b14a0
-x18: 7c2b02a000
-x19: 0
-x20: 7c326f6568
-x21: 7be69c827c
-x22: 7be69c8272
-x23: 1
-x24: 7be74f7100
-x25: 881
-x26: 7be4f07a00
-x27: c479c000
-x28: 7be4f07998
-x29: 7be4f079b4
-sp: 7be4f077d0
-lr: 7be6715f60
-pc: 7cbe0b14bc
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/stack.data b/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/stack.data
deleted file mode 100644
index 27d5bf3..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/test.apk b/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/test.apk
deleted file mode 100644
index 70a9c71..0000000
--- a/libunwindstack/tests/files/offline/shared_lib_in_apk_single_map_arm64/test.apk
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/signal_load_bias_arm/libc.so b/libunwindstack/tests/files/offline/signal_load_bias_arm/libc.so
deleted file mode 100644
index f046624..0000000
--- a/libunwindstack/tests/files/offline/signal_load_bias_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/signal_load_bias_arm/libunwindstack_unit_test b/libunwindstack/tests/files/offline/signal_load_bias_arm/libunwindstack_unit_test
deleted file mode 100644
index f460dd6..0000000
--- a/libunwindstack/tests/files/offline/signal_load_bias_arm/libunwindstack_unit_test
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/signal_load_bias_arm/maps.txt b/libunwindstack/tests/files/offline/signal_load_bias_arm/maps.txt
deleted file mode 100644
index 165ae49..0000000
--- a/libunwindstack/tests/files/offline/signal_load_bias_arm/maps.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-b66b7000-b670c000 r--p 0 00:00 0   libunwindstack_unit_test
-b670c000-b69a8000 r-xp 54000 00:00 0   libunwindstack_unit_test
-f23a6000-f23d0000 r--p 0 00:00 0   libc.so
-f23d0000-f2451000 r-xp 29000 00:00 0   libc.so
diff --git a/libunwindstack/tests/files/offline/signal_load_bias_arm/regs.txt b/libunwindstack/tests/files/offline/signal_load_bias_arm/regs.txt
deleted file mode 100644
index e03f8fd..0000000
--- a/libunwindstack/tests/files/offline/signal_load_bias_arm/regs.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-r0: b69b7c84
-r1: 1
-r2: 1
-r3: 1
-r4: f1e52bd0
-r5: f1e11000
-r6: f1e52bd0
-r7: f1e52a38
-r8: f1e11000
-r9: 5de82a8f
-r10: f1e06030
-r11: f1e6d080
-ip: ffe67a88
-sp: f2790ce8
-lr: b6955fab
-pc: b6955f9e
diff --git a/libunwindstack/tests/files/offline/signal_load_bias_arm/stack0.data b/libunwindstack/tests/files/offline/signal_load_bias_arm/stack0.data
deleted file mode 100644
index d9f23f8..0000000
--- a/libunwindstack/tests/files/offline/signal_load_bias_arm/stack0.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/signal_load_bias_arm/stack1.data b/libunwindstack/tests/files/offline/signal_load_bias_arm/stack1.data
deleted file mode 100644
index 6011883..0000000
--- a/libunwindstack/tests/files/offline/signal_load_bias_arm/stack1.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/straddle_arm/libbase.so b/libunwindstack/tests/files/offline/straddle_arm/libbase.so
deleted file mode 100644
index d1f16ee..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm/libbase.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/straddle_arm/libc.so b/libunwindstack/tests/files/offline/straddle_arm/libc.so
deleted file mode 100644
index 4dc19ca..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm/libc.so
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/straddle_arm/maps.txt b/libunwindstack/tests/files/offline/straddle_arm/maps.txt
deleted file mode 100644
index 8c26479..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm/maps.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-f2d9a000-f2da7fff r-xp 00000000 00:00 0   libbase.so
-f3002000-f3005fff rw-p 00000000 00:00 0   [stack:25941]
-f31d0000-f326bfff r-xp 00000000 00:00 0   libc.so
-f3352000-f336bfff r-xp 00000000 00:00 0   /does/not/exist/libhidlbase.so
diff --git a/libunwindstack/tests/files/offline/straddle_arm/regs.txt b/libunwindstack/tests/files/offline/straddle_arm/regs.txt
deleted file mode 100644
index 3baedf3..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm/regs.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-pc: f31ea9f8
-sp: e9c866f8
-lr: f31f179f
diff --git a/libunwindstack/tests/files/offline/straddle_arm/stack.data b/libunwindstack/tests/files/offline/straddle_arm/stack.data
deleted file mode 100644
index 83aeb4a..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/straddle_arm64/libunwindstack_test b/libunwindstack/tests/files/offline/straddle_arm64/libunwindstack_test
deleted file mode 100644
index 092fc3a..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm64/libunwindstack_test
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tests/files/offline/straddle_arm64/maps.txt b/libunwindstack/tests/files/offline/straddle_arm64/maps.txt
deleted file mode 100644
index bdf29b5..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm64/maps.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-00000064d05ab000-00000064d0a6cfff r-xp 00000000 00:00 0  libunwindstack_test
-0000007fe0d64000-0000007fe0d84fff rw-p 00000000 00:00 0  [stack]
diff --git a/libunwindstack/tests/files/offline/straddle_arm64/regs.txt b/libunwindstack/tests/files/offline/straddle_arm64/regs.txt
deleted file mode 100644
index ff8a936..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm64/regs.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-pc: 00000064d09d4fd8
-sp: 0000007fe0d84040
-lr: 00000064d09d507c
-x29: 0000007fe0d84070
diff --git a/libunwindstack/tests/files/offline/straddle_arm64/stack.data b/libunwindstack/tests/files/offline/straddle_arm64/stack.data
deleted file mode 100644
index 824d0e2..0000000
--- a/libunwindstack/tests/files/offline/straddle_arm64/stack.data
+++ /dev/null
Binary files differ
diff --git a/libunwindstack/tools/unwind.cpp b/libunwindstack/tools/unwind.cpp
deleted file mode 100644
index 1812e50..0000000
--- a/libunwindstack/tools/unwind.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <unwindstack/DexFiles.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/Unwinder.h>
-
-static bool Attach(pid_t pid) {
-  if (ptrace(PTRACE_SEIZE, pid, 0, 0) == -1) {
-    return false;
-  }
-
-  if (ptrace(PTRACE_INTERRUPT, pid, 0, 0) == -1) {
-    ptrace(PTRACE_DETACH, pid, 0, 0);
-    return false;
-  }
-
-  // Allow at least 1 second to attach properly.
-  for (size_t i = 0; i < 1000; i++) {
-    siginfo_t si;
-    if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) {
-      return true;
-    }
-    usleep(1000);
-  }
-  printf("%d: Failed to stop.\n", pid);
-  return false;
-}
-
-void DoUnwind(pid_t pid) {
-  unwindstack::Regs* regs = unwindstack::Regs::RemoteGet(pid);
-  if (regs == nullptr) {
-    printf("Unable to get remote reg data\n");
-    return;
-  }
-
-  printf("ABI: ");
-  switch (regs->Arch()) {
-    case unwindstack::ARCH_ARM:
-      printf("arm");
-      break;
-    case unwindstack::ARCH_X86:
-      printf("x86");
-      break;
-    case unwindstack::ARCH_ARM64:
-      printf("arm64");
-      break;
-    case unwindstack::ARCH_X86_64:
-      printf("x86_64");
-      break;
-    case unwindstack::ARCH_MIPS:
-      printf("mips");
-      break;
-    case unwindstack::ARCH_MIPS64:
-      printf("mips64");
-      break;
-    default:
-      printf("unknown\n");
-      return;
-  }
-  printf("\n");
-
-  unwindstack::UnwinderFromPid unwinder(1024, pid);
-  if (!unwinder.Init(regs->Arch())) {
-    printf("Failed to init unwinder object.\n");
-    return;
-  }
-
-  unwinder.SetRegs(regs);
-  unwinder.Unwind();
-
-  // Print the frames.
-  for (size_t i = 0; i < unwinder.NumFrames(); i++) {
-    printf("%s\n", unwinder.FormatFrame(i).c_str());
-  }
-}
-
-int main(int argc, char** argv) {
-  if (argc != 2) {
-    printf("Usage: unwind <PID>\n");
-    return 1;
-  }
-
-  pid_t pid = atoi(argv[1]);
-  if (!Attach(pid)) {
-    printf("Failed to attach to pid %d: %s\n", pid, strerror(errno));
-    return 1;
-  }
-
-  DoUnwind(pid);
-
-  ptrace(PTRACE_DETACH, pid, 0, 0);
-
-  return 0;
-}
diff --git a/libunwindstack/tools/unwind_for_offline.cpp b/libunwindstack/tools/unwind_for_offline.cpp
deleted file mode 100644
index 64b58a8..0000000
--- a/libunwindstack/tools/unwind_for_offline.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#define _GNU_SOURCE 1
-#include <errno.h>
-#include <inttypes.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <algorithm>
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/JitDebug.h>
-#include <unwindstack/Maps.h>
-#include <unwindstack/Memory.h>
-#include <unwindstack/Regs.h>
-#include <unwindstack/Unwinder.h>
-
-#include <android-base/stringprintf.h>
-
-struct map_info_t {
-  uint64_t start;
-  uint64_t end;
-  uint64_t offset;
-  uint64_t flags;
-  std::string name;
-};
-
-static bool Attach(pid_t pid) {
-  if (ptrace(PTRACE_SEIZE, pid, 0, 0) == -1) {
-    return false;
-  }
-
-  if (ptrace(PTRACE_INTERRUPT, pid, 0, 0) == -1) {
-    ptrace(PTRACE_DETACH, pid, 0, 0);
-    return false;
-  }
-
-  // Allow at least 1 second to attach properly.
-  for (size_t i = 0; i < 1000; i++) {
-    siginfo_t si;
-    if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) {
-      return true;
-    }
-    usleep(1000);
-  }
-  printf("%d: Failed to stop.\n", pid);
-  return false;
-}
-
-bool SaveRegs(unwindstack::Regs* regs) {
-  std::unique_ptr<FILE, decltype(&fclose)> fp(fopen("regs.txt", "w+"), &fclose);
-  if (fp == nullptr) {
-    perror("Failed to create file regs.txt");
-    return false;
-  }
-  regs->IterateRegisters([&fp](const char* name, uint64_t value) {
-    fprintf(fp.get(), "%s: %" PRIx64 "\n", name, value);
-  });
-
-  return true;
-}
-
-bool SaveStack(pid_t pid, const std::vector<std::pair<uint64_t, uint64_t>>& stacks) {
-  for (size_t i = 0; i < stacks.size(); i++) {
-    std::string file_name;
-    if (stacks.size() != 1) {
-      file_name = "stack" + std::to_string(i) + ".data";
-    } else {
-      file_name = "stack.data";
-    }
-
-    // Do this first, so if it fails, we don't create the file.
-    uint64_t sp_start = stacks[i].first;
-    uint64_t sp_end = stacks[i].second;
-    std::vector<uint8_t> buffer(sp_end - sp_start);
-    auto process_memory = unwindstack::Memory::CreateProcessMemory(pid);
-    if (!process_memory->Read(sp_start, buffer.data(), buffer.size())) {
-      printf("Unable to read stack data.\n");
-      return false;
-    }
-
-    printf("Saving the stack 0x%" PRIx64 "-0x%" PRIx64 "\n", sp_start, sp_end);
-
-    std::unique_ptr<FILE, decltype(&fclose)> fp(fopen(file_name.c_str(), "w+"), &fclose);
-    if (fp == nullptr) {
-      perror("Failed to create stack.data");
-      return false;
-    }
-
-    size_t bytes = fwrite(&sp_start, 1, sizeof(sp_start), fp.get());
-    if (bytes != sizeof(sp_start)) {
-      printf("Failed to write sp_start data: sizeof(sp_start) %zu, written %zu\n", sizeof(sp_start),
-             bytes);
-      return false;
-    }
-
-    bytes = fwrite(buffer.data(), 1, buffer.size(), fp.get());
-    if (bytes != buffer.size()) {
-      printf("Failed to write all stack data: stack size %zu, written %zu\n", buffer.size(), bytes);
-      return false;
-    }
-  }
-
-  return true;
-}
-
-bool CreateElfFromMemory(std::shared_ptr<unwindstack::Memory>& memory, map_info_t* info) {
-  std::string cur_name;
-  if (info->name.empty()) {
-    cur_name = android::base::StringPrintf("anonymous_%" PRIx64, info->start);
-  } else {
-    cur_name = android::base::StringPrintf("%s_%" PRIx64, basename(info->name.c_str()), info->start);
-  }
-
-  std::vector<uint8_t> buffer(info->end - info->start);
-  // If this is a mapped in file, it might not be possible to read the entire
-  // map, so read all that is readable.
-  size_t bytes = memory->Read(info->start, buffer.data(), buffer.size());
-  if (bytes == 0) {
-    printf("Cannot read data from address %" PRIx64 " length %zu\n", info->start, buffer.size());
-    return false;
-  }
-
-  std::unique_ptr<FILE, decltype(&fclose)> output(fopen(cur_name.c_str(), "w+"), &fclose);
-  if (output == nullptr) {
-    perror((std::string("Cannot create ") + cur_name).c_str());
-    return false;
-  }
-
-  size_t bytes_written = fwrite(buffer.data(), 1, bytes, output.get());
-  if (bytes_written != bytes) {
-    printf("Failed to write all data to file: bytes read %zu, written %zu\n", bytes, bytes_written);
-    return false;
-  }
-
-  // Replace the name with the new name.
-  info->name = cur_name;
-
-  return true;
-}
-
-bool CopyElfFromFile(map_info_t* info, bool* file_copied) {
-  std::string cur_name = basename(info->name.c_str());
-  if (*file_copied) {
-    info->name = cur_name;
-    return true;
-  }
-
-  std::unique_ptr<FILE, decltype(&fclose)> fp(fopen(info->name.c_str(), "r"), &fclose);
-  if (fp == nullptr) {
-    perror((std::string("Cannot open ") + info->name).c_str());
-    return false;
-  }
-
-  std::unique_ptr<FILE, decltype(&fclose)> output(fopen(cur_name.c_str(), "w+"), &fclose);
-  if (output == nullptr) {
-    perror((std::string("Cannot create file " + cur_name)).c_str());
-    return false;
-  }
-  std::vector<uint8_t> buffer(10000);
-  size_t bytes;
-  while ((bytes = fread(buffer.data(), 1, buffer.size(), fp.get())) > 0) {
-    size_t bytes_written = fwrite(buffer.data(), 1, bytes, output.get());
-    if (bytes_written != bytes) {
-      printf("Bytes written doesn't match bytes read: read %zu, written %zu\n", bytes,
-             bytes_written);
-      return false;
-    }
-  }
-
-  // Replace the name with the new name.
-  info->name = cur_name;
-
-  return true;
-}
-
-map_info_t* FillInAndGetMapInfo(std::unordered_map<uint64_t, map_info_t>& maps_by_start,
-                                unwindstack::MapInfo* map_info) {
-  auto info = &maps_by_start[map_info->start];
-  info->start = map_info->start;
-  info->end = map_info->end;
-  info->offset = map_info->offset;
-  info->name = map_info->name;
-  info->flags = map_info->flags;
-
-  return info;
-}
-
-void SaveMapInformation(std::shared_ptr<unwindstack::Memory>& process_memory, map_info_t* info,
-                        bool* file_copied) {
-  if (CopyElfFromFile(info, file_copied)) {
-    return;
-  }
-  *file_copied = false;
-
-  // Try to create the elf from memory, this will handle cases where
-  // the data only exists in memory such as vdso data on x86.
-  if (CreateElfFromMemory(process_memory, info)) {
-    return;
-  }
-
-  printf("Cannot save memory or file for map ");
-  if (!info->name.empty()) {
-    printf("%s\n", info->name.c_str());
-  } else {
-    printf("anonymous:%" PRIx64 "\n", info->start);
-  }
-}
-
-int SaveData(pid_t pid) {
-  unwindstack::Regs* regs = unwindstack::Regs::RemoteGet(pid);
-  if (regs == nullptr) {
-    printf("Unable to get remote reg data.\n");
-    return 1;
-  }
-
-  // Save the current state of the registers.
-  if (!SaveRegs(regs)) {
-    return 1;
-  }
-
-  // Do an unwind so we know how much of the stack to save, and what
-  // elf files are involved.
-  unwindstack::UnwinderFromPid unwinder(1024, pid);
-  if (!unwinder.Init(regs->Arch())) {
-    printf("Unable to init unwinder object.\n");
-    return 1;
-  }
-  unwinder.SetRegs(regs);
-  uint64_t sp = regs->sp();
-  unwinder.Unwind();
-
-  std::unordered_map<uint64_t, map_info_t> maps_by_start;
-  std::vector<std::pair<uint64_t, uint64_t>> stacks;
-  unwindstack::Maps* maps = unwinder.GetMaps();
-  uint64_t sp_map_start = 0;
-  unwindstack::MapInfo* map_info = maps->Find(sp);
-  if (map_info != nullptr) {
-    stacks.emplace_back(std::make_pair(sp, map_info->end));
-    sp_map_start = map_info->start;
-  }
-
-  for (const auto& frame : unwinder.frames()) {
-    map_info = maps->Find(frame.sp);
-    if (map_info != nullptr && sp_map_start != map_info->start) {
-      stacks.emplace_back(std::make_pair(frame.sp, map_info->end));
-      sp_map_start = map_info->start;
-    }
-
-    if (maps_by_start.count(frame.map_start) == 0) {
-      map_info = maps->Find(frame.map_start);
-      if (map_info == nullptr) {
-        continue;
-      }
-
-      auto info = FillInAndGetMapInfo(maps_by_start, map_info);
-      bool file_copied = false;
-      SaveMapInformation(unwinder.GetProcessMemory(), info, &file_copied);
-
-      // If you are using a a linker that creates two maps (one read-only, one
-      // read-executable), it's necessary to capture the previous map
-      // information if needed.
-      unwindstack::MapInfo* prev_map = map_info->prev_map;
-      if (prev_map != nullptr && map_info->offset != 0 && prev_map->offset == 0 &&
-          prev_map->flags == PROT_READ && map_info->name == prev_map->name &&
-          maps_by_start.count(prev_map->start) == 0) {
-        info = FillInAndGetMapInfo(maps_by_start, prev_map);
-        SaveMapInformation(unwinder.GetProcessMemory(), info, &file_copied);
-      }
-    }
-  }
-
-  for (size_t i = 0; i < unwinder.NumFrames(); i++) {
-    printf("%s\n", unwinder.FormatFrame(i).c_str());
-  }
-
-  if (!SaveStack(pid, stacks)) {
-    return 1;
-  }
-
-  std::vector<std::pair<uint64_t, map_info_t>> sorted_maps(maps_by_start.begin(),
-                                                           maps_by_start.end());
-  std::sort(sorted_maps.begin(), sorted_maps.end(),
-            [](auto& a, auto& b) { return a.first < b.first; });
-
-  std::unique_ptr<FILE, decltype(&fclose)> fp(fopen("maps.txt", "w+"), &fclose);
-  if (fp == nullptr) {
-    perror("Failed to create maps.txt");
-    return false;
-  }
-
-  for (auto& element : sorted_maps) {
-    char perms[5] = {"---p"};
-    map_info_t& map = element.second;
-    if (map.flags & PROT_READ) {
-      perms[0] = 'r';
-    }
-    if (map.flags & PROT_WRITE) {
-      perms[1] = 'w';
-    }
-    if (map.flags & PROT_EXEC) {
-      perms[2] = 'x';
-    }
-    fprintf(fp.get(), "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " 00:00 0", map.start, map.end, perms,
-            map.offset);
-    if (!map.name.empty()) {
-      fprintf(fp.get(), "   %s", map.name.c_str());
-    }
-    fprintf(fp.get(), "\n");
-  }
-
-  return 0;
-}
-
-int main(int argc, char** argv) {
-  if (argc != 2) {
-    printf("Usage: unwind_for_offline <PID>\n");
-    return 1;
-  }
-
-  pid_t pid = atoi(argv[1]);
-  if (!Attach(pid)) {
-    printf("Failed to attach to pid %d: %s\n", pid, strerror(errno));
-    return 1;
-  }
-
-  int return_code = SaveData(pid);
-
-  ptrace(PTRACE_DETACH, pid, 0, 0);
-
-  return return_code;
-}
diff --git a/libunwindstack/tools/unwind_info.cpp b/libunwindstack/tools/unwind_info.cpp
deleted file mode 100644
index 7a6d8ba..0000000
--- a/libunwindstack/tools/unwind_info.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/DwarfStructs.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Memory.h>
-
-#include "ArmExidx.h"
-#include "ElfInterfaceArm.h"
-
-namespace unwindstack {
-
-void DumpArm(Elf* elf, ElfInterfaceArm* interface) {
-  if (interface == nullptr) {
-    printf("No ARM Unwind Information.\n\n");
-    return;
-  }
-
-  printf("ARM Unwind Information:\n");
-  uint64_t load_bias = elf->GetLoadBias();
-  for (const auto& entry : interface->pt_loads()) {
-    printf(" PC Range 0x%" PRIx64 " - 0x%" PRIx64 "\n", entry.second.offset + load_bias,
-           entry.second.offset + entry.second.table_size + load_bias);
-    for (auto pc : *interface) {
-      std::string name;
-      printf("  PC 0x%" PRIx64, pc + load_bias);
-      uint64_t func_offset;
-      if (elf->GetFunctionName(pc + load_bias, &name, &func_offset) && !name.empty()) {
-        printf(" <%s>", name.c_str());
-      }
-      printf("\n");
-      uint64_t entry;
-      if (!interface->FindEntry(pc, &entry)) {
-        printf("    Cannot find entry for address.\n");
-        continue;
-      }
-      ArmExidx arm(nullptr, interface->memory(), nullptr);
-      arm.set_log(ARM_LOG_FULL);
-      arm.set_log_skip_execution(true);
-      arm.set_log_indent(2);
-      if (!arm.ExtractEntryData(entry)) {
-        if (arm.status() != ARM_STATUS_NO_UNWIND) {
-          printf("    Error trying to extract data.\n");
-        }
-        continue;
-      }
-      if (arm.data()->size() > 0) {
-        if (!arm.Eval() && arm.status() != ARM_STATUS_NO_UNWIND) {
-          printf("      Error trying to evaluate dwarf data.\n");
-        }
-      }
-    }
-  }
-  printf("\n");
-}
-
-void DumpDwarfSection(Elf* elf, DwarfSection* section, uint64_t) {
-  for (const DwarfFde* fde : *section) {
-    // Sometimes there are entries that have empty length, skip those since
-    // they don't contain any interesting information.
-    if (fde == nullptr || fde->pc_start == fde->pc_end) {
-      continue;
-    }
-    printf("\n  PC 0x%" PRIx64 "-0x%" PRIx64, fde->pc_start, fde->pc_end);
-    std::string name;
-    uint64_t func_offset;
-    if (elf->GetFunctionName(fde->pc_start, &name, &func_offset) && !name.empty()) {
-      printf(" <%s>", name.c_str());
-    }
-    printf("\n");
-    if (!section->Log(2, UINT64_MAX, fde)) {
-      printf("Failed to process cfa information for entry at 0x%" PRIx64 "\n", fde->pc_start);
-    }
-  }
-}
-
-int GetElfInfo(const char* file, uint64_t offset) {
-  // Send all log messages to stdout.
-  log_to_stdout(true);
-
-  Elf elf(Memory::CreateFileMemory(file, offset).release());
-  if (!elf.Init() || !elf.valid()) {
-    printf("%s is not a valid elf file.\n", file);
-    return 1;
-  }
-
-  std::string soname(elf.GetSoname());
-  if (!soname.empty()) {
-    printf("Soname: %s\n", soname.c_str());
-  }
-
-  std::string build_id = elf.GetBuildID();
-  if (!build_id.empty()) {
-    printf("Build ID: ");
-    for (size_t i = 0; i < build_id.size(); ++i) {
-      printf("%02hhx", build_id[i]);
-    }
-    printf("\n");
-  }
-
-  ElfInterface* interface = elf.interface();
-  if (elf.machine_type() == EM_ARM) {
-    DumpArm(&elf, reinterpret_cast<ElfInterfaceArm*>(interface));
-    printf("\n");
-  }
-
-  if (interface->eh_frame() != nullptr) {
-    printf("eh_frame information:\n");
-    DumpDwarfSection(&elf, interface->eh_frame(), elf.GetLoadBias());
-    printf("\n");
-  } else {
-    printf("\nno eh_frame information\n");
-  }
-
-  if (interface->debug_frame() != nullptr) {
-    printf("\ndebug_frame information:\n");
-    DumpDwarfSection(&elf, interface->debug_frame(), elf.GetLoadBias());
-    printf("\n");
-  } else {
-    printf("\nno debug_frame information\n");
-  }
-
-  // If there is a gnu_debugdata interface, dump the information for that.
-  ElfInterface* gnu_debugdata_interface = elf.gnu_debugdata_interface();
-  if (gnu_debugdata_interface != nullptr) {
-    if (gnu_debugdata_interface->eh_frame() != nullptr) {
-      printf("\ngnu_debugdata (eh_frame):\n");
-      DumpDwarfSection(&elf, gnu_debugdata_interface->eh_frame(), 0);
-      printf("\n");
-    }
-    if (gnu_debugdata_interface->debug_frame() != nullptr) {
-      printf("\ngnu_debugdata (debug_frame):\n");
-      DumpDwarfSection(&elf, gnu_debugdata_interface->debug_frame(), 0);
-      printf("\n");
-    }
-  } else {
-    printf("\nno valid gnu_debugdata information\n");
-  }
-
-  return 0;
-}
-
-}  // namespace unwindstack
-
-int main(int argc, char** argv) {
-  if (argc != 2 && argc != 3) {
-    printf("Usage: unwind_info ELF_FILE [OFFSET]\n");
-    printf("  ELF_FILE\n");
-    printf("    The path to an elf file.\n");
-    printf("  OFFSET\n");
-    printf("    Use the offset into the ELF file as the beginning of the elf.\n");
-    return 1;
-  }
-
-  struct stat st;
-  if (stat(argv[1], &st) == -1) {
-    printf("Cannot stat %s: %s\n", argv[1], strerror(errno));
-    return 1;
-  }
-  if (!S_ISREG(st.st_mode)) {
-    printf("%s is not a regular file.\n", argv[1]);
-    return 1;
-  }
-
-  uint64_t offset = 0;
-  if (argc == 3) {
-    char* end;
-    offset = strtoull(argv[2], &end, 16);
-    if (*end != '\0') {
-      printf("Malformed OFFSET value: %s\n", argv[2]);
-      return 1;
-    }
-  }
-
-  return unwindstack::GetElfInfo(argv[1], offset);
-}
diff --git a/libunwindstack/tools/unwind_reg_info.cpp b/libunwindstack/tools/unwind_reg_info.cpp
deleted file mode 100644
index 0cbcac5..0000000
--- a/libunwindstack/tools/unwind_reg_info.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <unwindstack/DwarfLocation.h>
-#include <unwindstack/DwarfMemory.h>
-#include <unwindstack/DwarfSection.h>
-#include <unwindstack/DwarfStructs.h>
-#include <unwindstack/Elf.h>
-#include <unwindstack/ElfInterface.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Memory.h>
-
-#include "ArmExidx.h"
-#include "DwarfOp.h"
-#include "ElfInterfaceArm.h"
-
-namespace unwindstack {
-
-void PrintSignedValue(int64_t value) {
-  if (value < 0) {
-    printf("- %" PRId64, -value);
-  } else if (value > 0) {
-    printf("+ %" PRId64, value);
-  }
-}
-
-void PrintExpression(Memory* memory, uint8_t class_type, uint64_t end, uint64_t length) {
-  std::vector<std::string> lines;
-  DwarfMemory dwarf_memory(memory);
-  if (class_type == ELFCLASS32) {
-    DwarfOp<uint32_t> op(&dwarf_memory, nullptr);
-    op.GetLogInfo(end - length, end, &lines);
-  } else {
-    DwarfOp<uint64_t> op(&dwarf_memory, nullptr);
-    op.GetLogInfo(end - length, end, &lines);
-  }
-  for (auto& line : lines) {
-    printf("    %s\n", line.c_str());
-  }
-}
-
-void PrintRegInformation(DwarfSection* section, Memory* memory, uint64_t pc, uint8_t class_type) {
-  const DwarfFde* fde = section->GetFdeFromPc(pc);
-  if (fde == nullptr) {
-    printf("  No fde found.\n");
-    return;
-  }
-
-  dwarf_loc_regs_t regs;
-  if (!section->GetCfaLocationInfo(pc, fde, &regs)) {
-    printf("  Cannot get location information.\n");
-    return;
-  }
-
-  std::vector<std::pair<uint32_t, DwarfLocation>> loc_regs;
-  for (auto& loc : regs) {
-    loc_regs.push_back(loc);
-  }
-  std::sort(loc_regs.begin(), loc_regs.end(), [](auto a, auto b) {
-    if (a.first == CFA_REG) {
-      return true;
-    } else if (b.first == CFA_REG) {
-      return false;
-    }
-    return a.first < b.first;
-  });
-
-  for (auto& entry : loc_regs) {
-    const DwarfLocation* loc = &entry.second;
-    if (entry.first == CFA_REG) {
-      printf("  cfa = ");
-    } else {
-      printf("  r%d = ", entry.first);
-    }
-    switch (loc->type) {
-      case DWARF_LOCATION_OFFSET:
-        printf("[cfa ");
-        PrintSignedValue(loc->values[0]);
-        printf("]\n");
-        break;
-
-      case DWARF_LOCATION_VAL_OFFSET:
-        printf("cfa ");
-        PrintSignedValue(loc->values[0]);
-        printf("\n");
-        break;
-
-      case DWARF_LOCATION_REGISTER:
-        printf("r%" PRId64 " ", loc->values[0]);
-        PrintSignedValue(loc->values[1]);
-        printf("\n");
-        break;
-
-      case DWARF_LOCATION_EXPRESSION: {
-        printf("EXPRESSION\n");
-        PrintExpression(memory, class_type, loc->values[1], loc->values[0]);
-        break;
-      }
-
-      case DWARF_LOCATION_VAL_EXPRESSION: {
-        printf("VAL EXPRESSION\n");
-        PrintExpression(memory, class_type, loc->values[1], loc->values[0]);
-        break;
-      }
-
-      case DWARF_LOCATION_UNDEFINED:
-        printf("undefine\n");
-        break;
-
-      case DWARF_LOCATION_INVALID:
-        printf("INVALID\n");
-        break;
-    }
-  }
-}
-
-void PrintArmRegInformation(ElfInterfaceArm* interface, uint64_t pc) {
-  printf("\nArm exidx:\n");
-  uint64_t entry_offset;
-  if (!interface->FindEntry(pc, &entry_offset)) {
-    return;
-  }
-
-  ArmExidx arm(nullptr, interface->memory(), nullptr);
-
-  log_to_stdout(true);
-  arm.set_log(ARM_LOG_BY_REG);
-  arm.set_log_skip_execution(true);
-  arm.set_log_indent(1);
-  if (!arm.ExtractEntryData(entry_offset)) {
-    if (arm.status() != ARM_STATUS_NO_UNWIND) {
-      printf("  Error trying to extract data.\n");
-    }
-    return;
-  }
-  if (arm.data()->size() != 0 && arm.Eval()) {
-    arm.LogByReg();
-  } else {
-    printf("  Error tring to evaluate exidx data.\n");
-  }
-}
-
-int GetInfo(const char* file, uint64_t offset, uint64_t pc) {
-  Elf elf(Memory::CreateFileMemory(file, offset).release());
-  if (!elf.Init() || !elf.valid()) {
-    printf("%s is not a valid elf file.\n", file);
-    return 1;
-  }
-
-  ElfInterface* interface = elf.interface();
-  uint64_t load_bias = elf.GetLoadBias();
-  if (pc < load_bias) {
-    printf("PC is less than load bias.\n");
-    return 1;
-  }
-
-  std::string soname(elf.GetSoname());
-  if (!soname.empty()) {
-    printf("Soname: %s\n\n", soname.c_str());
-  }
-
-  printf("PC 0x%" PRIx64, pc);
-  std::string function_name;
-  uint64_t function_offset;
-  if (elf.GetFunctionName(pc, &function_name, &function_offset)) {
-    printf(" (%s)", function_name.c_str());
-  }
-  printf(":\n");
-
-  if (elf.machine_type() == EM_ARM) {
-    PrintArmRegInformation(reinterpret_cast<ElfInterfaceArm*>(interface), pc - load_bias);
-  }
-
-  DwarfSection* section = interface->eh_frame();
-  if (section != nullptr) {
-    printf("\neh_frame:\n");
-    PrintRegInformation(section, elf.memory(), pc, elf.class_type());
-  } else {
-    printf("\nno eh_frame information\n");
-  }
-
-  section = interface->debug_frame();
-  if (section != nullptr) {
-    printf("\ndebug_frame:\n");
-    PrintRegInformation(section, elf.memory(), pc, elf.class_type());
-    printf("\n");
-  } else {
-    printf("\nno debug_frame information\n");
-  }
-
-  // If there is a gnu_debugdata interface, dump the information for that.
-  ElfInterface* gnu_debugdata_interface = elf.gnu_debugdata_interface();
-  if (gnu_debugdata_interface != nullptr) {
-    section = gnu_debugdata_interface->eh_frame();
-    if (section != nullptr) {
-      printf("\ngnu_debugdata (eh_frame):\n");
-      PrintRegInformation(section, gnu_debugdata_interface->memory(), pc, elf.class_type());
-      printf("\n");
-    } else {
-      printf("\nno gnu_debugdata (eh_frame)\n");
-    }
-
-    section = gnu_debugdata_interface->debug_frame();
-    if (section != nullptr) {
-      printf("\ngnu_debugdata (debug_frame):\n");
-      PrintRegInformation(section, gnu_debugdata_interface->memory(), pc, elf.class_type());
-      printf("\n");
-    } else {
-      printf("\nno gnu_debugdata (debug_frame)\n");
-    }
-  } else {
-    printf("\nno valid gnu_debugdata information\n");
-  }
-
-  return 0;
-}
-
-}  // namespace unwindstack
-
-int main(int argc, char** argv) {
-  if (argc != 3 && argc != 4) {
-    printf("Usage: unwind_reg_info ELF_FILE PC [OFFSET]\n");
-    printf("  ELF_FILE\n");
-    printf("    The path to an elf file.\n");
-    printf("  PC\n");
-    printf("    The pc for which the register information should be obtained.\n");
-    printf("  OFFSET\n");
-    printf("    Use the offset into the ELF file as the beginning of the elf.\n");
-    return 1;
-  }
-
-  struct stat st;
-  if (stat(argv[1], &st) == -1) {
-    printf("Cannot stat %s: %s\n", argv[1], strerror(errno));
-    return 1;
-  }
-  if (!S_ISREG(st.st_mode)) {
-    printf("%s is not a regular file.\n", argv[1]);
-    return 1;
-  }
-
-  uint64_t pc = 0;
-  char* end;
-  pc = strtoull(argv[2], &end, 16);
-  if (*end != '\0') {
-    printf("Malformed OFFSET value: %s\n", argv[2]);
-    return 1;
-  }
-
-  uint64_t offset = 0;
-  if (argc == 4) {
-    char* end;
-    offset = strtoull(argv[3], &end, 16);
-    if (*end != '\0') {
-      printf("Malformed OFFSET value: %s\n", argv[3]);
-      return 1;
-    }
-  }
-
-  return unwindstack::GetInfo(argv[1], offset, pc);
-}
diff --git a/libunwindstack/tools/unwind_symbols.cpp b/libunwindstack/tools/unwind_symbols.cpp
deleted file mode 100644
index 8df2284..0000000
--- a/libunwindstack/tools/unwind_symbols.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <elf.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <unwindstack/Elf.h>
-#include <unwindstack/Log.h>
-#include <unwindstack/Memory.h>
-
-int main(int argc, char** argv) {
-  if (argc != 2 && argc != 3) {
-    printf("Usage: unwind_symbols <ELF_FILE> [<FUNC_ADDRESS>]\n");
-    printf("  Dump all function symbols in ELF_FILE. If FUNC_ADDRESS is\n");
-    printf("  specified, then get the function at that address.\n");
-    printf("  FUNC_ADDRESS must be a hex number.\n");
-    return 1;
-  }
-
-  struct stat st;
-  if (stat(argv[1], &st) == -1) {
-    printf("Cannot stat %s: %s\n", argv[1], strerror(errno));
-    return 1;
-  }
-  if (!S_ISREG(st.st_mode)) {
-    printf("%s is not a regular file.\n", argv[1]);
-    return 1;
-  }
-
-  uint64_t func_addr;
-  if (argc == 3) {
-    char* name;
-    func_addr = strtoull(argv[2], &name, 16);
-    if (*name != '\0') {
-      printf("%s is not a hex number.\n", argv[2]);
-      return 1;
-    }
-  }
-
-  // Send all log messages to stdout.
-  unwindstack::log_to_stdout(true);
-
-  unwindstack::Elf elf(unwindstack::Memory::CreateFileMemory(argv[1], 0).release());
-  if (!elf.Init() || !elf.valid()) {
-    printf("%s is not a valid elf file.\n", argv[1]);
-    return 1;
-  }
-
-  std::string soname(elf.GetSoname());
-  if (!soname.empty()) {
-    printf("Soname: %s\n\n", soname.c_str());
-  }
-
-  switch (elf.machine_type()) {
-    case EM_ARM:
-      printf("ABI: arm\n");
-      break;
-    case EM_AARCH64:
-      printf("ABI: arm64\n");
-      break;
-    case EM_386:
-      printf("ABI: x86\n");
-      break;
-    case EM_X86_64:
-      printf("ABI: x86_64\n");
-      break;
-    default:
-      printf("ABI: unknown\n");
-      return 1;
-  }
-
-  std::string name;
-  if (argc == 3) {
-    std::string cur_name;
-    uint64_t func_offset;
-    if (!elf.GetFunctionName(func_addr, &cur_name, &func_offset)) {
-      printf("No known function at 0x%" PRIx64 "\n", func_addr);
-      return 1;
-    }
-    printf("<0x%" PRIx64 ">", func_addr - func_offset);
-    if (func_offset != 0) {
-      printf("+%" PRId64, func_offset);
-    }
-    printf(": %s\n", cur_name.c_str());
-    return 0;
-  }
-
-  // This is a crude way to get the symbols in order.
-  for (const auto& entry : elf.interface()->pt_loads()) {
-    uint64_t start = entry.second.offset;
-    uint64_t end = entry.second.table_size;
-    for (uint64_t addr = start; addr < end; addr += 4) {
-      std::string cur_name;
-      uint64_t func_offset;
-      if (elf.GetFunctionName(addr, &cur_name, &func_offset)) {
-        if (cur_name != name) {
-          printf("<0x%" PRIx64 "> Function: %s\n", addr - func_offset, cur_name.c_str());
-        }
-        name = cur_name;
-      }
-    }
-  }
-
-  return 0;
-}
diff --git a/libusbhost/usbhost.c b/libusbhost/usbhost.c
index 415488f..3bed0e3 100644
--- a/libusbhost/usbhost.c
+++ b/libusbhost/usbhost.c
@@ -597,6 +597,11 @@
     if (iter->curr_desc >= iter->config_end)
         return NULL;
     next = (struct usb_descriptor_header*)iter->curr_desc;
+    // Corrupt descriptor with zero length, cannot continue iterating
+    if (next->bLength == 0) {
+       D("usb_descriptor_iter_next got zero length USB descriptor, ending iteration\n");
+       return NULL;
+    }
     iter->curr_desc += next->bLength;
     return next;
 }
diff --git a/libutils/Android.bp b/libutils/Android.bp
index 85f4280..1e7cbdb 100644
--- a/libutils/Android.bp
+++ b/libutils/Android.bp
@@ -15,7 +15,9 @@
 cc_library_headers {
     name: "libutils_headers",
     vendor_available: true,
+    product_available: true,
     recovery_available: true,
+    vendor_ramdisk_available: true,
     host_supported: true,
     native_bridge_supported: true,
     apex_available: [
@@ -43,7 +45,13 @@
             header_libs: ["libbacktrace_headers"],
             export_header_lib_headers: ["libbacktrace_headers"],
         },
+        linux_glibc: {
+            header_libs: ["libbacktrace_headers"],
+            export_header_lib_headers: ["libbacktrace_headers"],
+        },
         linux_bionic: {
+            header_libs: ["libbacktrace_headers"],
+            export_header_lib_headers: ["libbacktrace_headers"],
             enabled: true,
         },
         windows: {
@@ -55,6 +63,7 @@
 cc_defaults {
     name: "libutils_defaults",
     vendor_available: true,
+    product_available: true,
     recovery_available: true,
     vndk: {
         enabled: true,
@@ -78,11 +87,8 @@
         "libcutils",
         "liblog",
     ],
-
-    arch: {
-        mips: {
-            cflags: ["-DALIGN_DOUBLE"],
-        },
+    sanitize: {
+        misc_undefined: ["integer"],
     },
 
     target: {
@@ -135,7 +141,6 @@
         "JenkinsHash.cpp",
         "NativeHandle.cpp",
         "Printer.cpp",
-        "PropertyMap.cpp",
         "RefBase.cpp",
         "SharedBuffer.cpp",
         "StopWatch.cpp",
@@ -182,15 +187,9 @@
         "CallStack.cpp",
     ],
 
-    arch: {
-        mips: {
-            cflags: ["-DALIGN_DOUBLE"],
-        },
-    },
-
     shared_libs: [
-         "libutils",
-         "libbacktrace",
+        "libutils",
+        "libbacktrace",
     ],
 
     target: {
@@ -208,6 +207,94 @@
     },
 }
 
+cc_defaults {
+    name: "libutils_fuzz_defaults",
+    host_supported: true,
+    shared_libs: [
+        "libutils",
+        "libbase",
+        "liblog",
+    ],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_bitset",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["BitSet_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_filemap",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["FileMap_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_string8",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["String8_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_string16",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["String16_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_vector",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["Vector_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_printer",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["Printer_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_callstack",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["CallStack_fuzz.cpp"],
+    shared_libs: [
+        "libutilscallstack",
+    ],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_process_callstack",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["ProcessCallStack_fuzz.cpp"],
+    shared_libs: [
+        "libutilscallstack",
+    ],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_stopwatch",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["StopWatch_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_refbase",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["RefBase_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_lrucache",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["LruCache_fuzz.cpp"],
+}
+
+cc_fuzz {
+    name: "libutils_fuzz_looper",
+    defaults: ["libutils_fuzz_defaults"],
+    srcs: ["Looper_fuzz.cpp"],
+}
+
 cc_test {
     name: "libutils_test",
     host_supported: true,
@@ -218,9 +305,11 @@
         "LruCache_test.cpp",
         "Mutex_test.cpp",
         "SharedBuffer_test.cpp",
+        "Singleton_test.cpp",
         "String8_test.cpp",
         "String16_test.cpp",
         "StrongPointer_test.cpp",
+        "Timers_test.cpp",
         "Unicode_test.cpp",
         "Vector_test.cpp",
     ],
@@ -253,6 +342,11 @@
         },
     },
 
+    data_libs: [
+        "libutils_test_singleton1",
+        "libutils_test_singleton2",
+    ],
+
     cflags: [
         "-Wall",
         "-Wextra",
@@ -263,29 +357,10 @@
     test_suites: ["device-tests"],
 }
 
-// TODO: the test infrastructure isn't yet capable of running this,
-// so it's broken out into its own test so that the main libutils_tests
-// can be in presubmit even if this can't.
-
-cc_test {
-    name: "libutils_singleton_test",
-    srcs: ["Singleton_test.cpp"],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-    shared_libs: ["libbase"],
-
-    required: [
-        ":libutils_test_singleton1",
-        ":libutils_test_singleton2",
-    ],
-}
-
 cc_test_library {
     name: "libutils_test_singleton1",
     host_supported: true,
-    relative_install_path: "libutils_test",
+    installable: false,
     srcs: ["Singleton_test1.cpp"],
     cflags: [
         "-Wall",
@@ -296,7 +371,7 @@
 cc_test_library {
     name: "libutils_test_singleton2",
     host_supported: true,
-    relative_install_path: "libutils_test",
+    installable: false,
     srcs: ["Singleton_test2.cpp"],
     cflags: [
         "-Wall",
diff --git a/libutils/BitSet_fuzz.cpp b/libutils/BitSet_fuzz.cpp
new file mode 100644
index 0000000..2e6043c
--- /dev/null
+++ b/libutils/BitSet_fuzz.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2020 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.
+ */
+#include <functional>
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/BitSet.h"
+static constexpr uint8_t MAX_OPERATIONS = 50;
+
+// We need to handle both 32 and 64 bit bitsets, so we use a function template
+// here. Sadly, std::function can't be generic, so we generate a vector of
+// std::functions using this function.
+template <typename T>
+std::vector<std::function<void(T, uint32_t)>> getOperationsForType() {
+    return {
+            [](T bs, uint32_t val) -> void { bs.markBit(val); },
+            [](T bs, uint32_t val) -> void { bs.valueForBit(val); },
+            [](T bs, uint32_t val) -> void { bs.hasBit(val); },
+            [](T bs, uint32_t val) -> void { bs.clearBit(val); },
+            [](T bs, uint32_t val) -> void { bs.getIndexOfBit(val); },
+            [](T bs, uint32_t) -> void { bs.clearFirstMarkedBit(); },
+            [](T bs, uint32_t) -> void { bs.markFirstUnmarkedBit(); },
+            [](T bs, uint32_t) -> void { bs.clearLastMarkedBit(); },
+            [](T bs, uint32_t) -> void { bs.clear(); },
+            [](T bs, uint32_t) -> void { bs.count(); },
+            [](T bs, uint32_t) -> void { bs.isEmpty(); },
+            [](T bs, uint32_t) -> void { bs.isFull(); },
+            [](T bs, uint32_t) -> void { bs.firstMarkedBit(); },
+            [](T bs, uint32_t) -> void { bs.lastMarkedBit(); },
+    };
+}
+
+// Our operations for 32 and 64 bit bitsets
+static const std::vector<std::function<void(android::BitSet32, uint32_t)>> thirtyTwoBitOps =
+        getOperationsForType<android::BitSet32>();
+static const std::vector<std::function<void(android::BitSet64, uint32_t)>> sixtyFourBitOps =
+        getOperationsForType<android::BitSet64>();
+
+void runOperationFor32Bit(android::BitSet32 bs, uint32_t bit, uint8_t operation) {
+    thirtyTwoBitOps[operation](bs, bit);
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    uint32_t thirty_two_base = dataProvider.ConsumeIntegral<uint32_t>();
+    uint64_t sixty_four_base = dataProvider.ConsumeIntegral<uint64_t>();
+    android::BitSet32 b1 = android::BitSet32(thirty_two_base);
+    android::BitSet64 b2 = android::BitSet64(sixty_four_base);
+
+    size_t opsRun = 0;
+    while (dataProvider.remaining_bytes() > 0 && opsRun++ < MAX_OPERATIONS) {
+        uint32_t bit = dataProvider.ConsumeIntegral<uint32_t>();
+        uint8_t op = dataProvider.ConsumeIntegral<uint8_t>();
+        thirtyTwoBitOps[op % thirtyTwoBitOps.size()](b1, bit);
+        sixtyFourBitOps[op % sixtyFourBitOps.size()](b2, bit);
+    }
+    return 0;
+}
diff --git a/libutils/CallStack_fuzz.cpp b/libutils/CallStack_fuzz.cpp
new file mode 100644
index 0000000..e89b5b7
--- /dev/null
+++ b/libutils/CallStack_fuzz.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include <memory.h>
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/CallStack.h"
+
+static constexpr int MAX_STRING_SIZE = 500;
+static constexpr int MAX_IGNORE_DEPTH = 200;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    size_t ignoreDepth = dataProvider.ConsumeIntegralInRange<size_t>(0, MAX_IGNORE_DEPTH);
+    int logPriority = dataProvider.ConsumeIntegral<int>();
+    pid_t tid = dataProvider.ConsumeIntegral<pid_t>();
+    std::string logTag = dataProvider.ConsumeRandomLengthString(MAX_STRING_SIZE);
+    std::string prefix = dataProvider.ConsumeRandomLengthString(MAX_STRING_SIZE);
+
+    const char* logTagChars = logTag.c_str();
+    const char* prefixChars = prefix.c_str();
+
+    android::CallStack::CallStackUPtr callStack = android::CallStack::getCurrent(ignoreDepth);
+    android::CallStack* callstackPtr = callStack.get();
+    android::CallStack::logStack(logTagChars, callstackPtr,
+                                 static_cast<android_LogPriority>(logPriority));
+    android::CallStack::stackToString(prefixChars);
+
+    callstackPtr->log(logTagChars, static_cast<android_LogPriority>(logPriority), prefixChars);
+    callstackPtr->clear();
+    callstackPtr->getCurrent(ignoreDepth);
+    callstackPtr->log(logTagChars, static_cast<android_LogPriority>(logPriority), prefixChars);
+    callstackPtr->update(ignoreDepth, tid);
+    callstackPtr->log(logTagChars, static_cast<android_LogPriority>(logPriority), prefixChars);
+
+    return 0;
+}
diff --git a/libutils/FileMap_fuzz.cpp b/libutils/FileMap_fuzz.cpp
new file mode 100644
index 0000000..d800564
--- /dev/null
+++ b/libutils/FileMap_fuzz.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2020 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.
+ */
+#include <iostream>
+
+#include "android-base/file.h"
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/FileMap.h"
+
+static constexpr uint16_t MAX_STR_SIZE = 256;
+static constexpr uint8_t MAX_FILENAME_SIZE = 32;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    TemporaryFile tf;
+    // Generate file contents
+    std::string contents = dataProvider.ConsumeRandomLengthString(MAX_STR_SIZE);
+    // If we have string contents, dump them into the file.
+    // Otherwise, just leave it as an empty file.
+    if (contents.length() > 0) {
+        const char* bytes = contents.c_str();
+        android::base::WriteStringToFd(bytes, tf.fd);
+    }
+    android::FileMap m;
+    // Generate create() params
+    std::string orig_name = dataProvider.ConsumeRandomLengthString(MAX_FILENAME_SIZE);
+    size_t length = dataProvider.ConsumeIntegralInRange<size_t>(1, SIZE_MAX);
+    off64_t offset = dataProvider.ConsumeIntegralInRange<off64_t>(1, INT64_MAX);
+    bool read_only = dataProvider.ConsumeBool();
+    m.create(orig_name.c_str(), tf.fd, offset, length, read_only);
+    m.getDataOffset();
+    m.getFileName();
+    m.getDataLength();
+    m.getDataPtr();
+    int enum_index = dataProvider.ConsumeIntegral<int>();
+    m.advise(static_cast<android::FileMap::MapAdvice>(enum_index));
+    return 0;
+}
diff --git a/libutils/FuzzFormatTypes.h b/libutils/FuzzFormatTypes.h
new file mode 100644
index 0000000..aa9e503
--- /dev/null
+++ b/libutils/FuzzFormatTypes.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#pragma once
+#include <string>
+
+static const std::string kFormatChars = std::string("duoxXfFeEgGaAcsp");
+static constexpr int32_t kMaxFormatFlagValue = INT16_MAX;
+enum FormatChar : uint8_t {
+    SIGNED_DECIMAL = 0,
+    UNSIGNED_DECIMAL = 1,
+    UNSIGNED_OCTAL = 2,
+    UNSIGNED_HEX_LOWER = 3,
+    UNSIGNED_HEX_UPPER = 4,
+    // Uppercase/lowercase floating point impacts 'inf', 'infinity', and 'nan'
+    FLOAT_LOWER = 5,
+    FLOAT_UPPER = 6,
+    // Upper/lower impacts the "e" in exponents.
+    EXPONENT_LOWER = 7,
+    EXPONENT_UPPER = 8,
+    // %g will use %e or %f, whichever is shortest
+    SHORT_EXP_LOWER = 9,
+    // %G will use %E or %F, whichever is shortest
+    SHORT_EXP_UPPER = 10,
+    HEX_FLOAT_LOWER = 11,
+    HEX_FLOAT_UPPER = 12,
+    CHAR = 13,
+    STRING = 14,
+    POINTER = 15,
+    // Used by libfuzzer
+    kMaxValue = POINTER
+};
+
+bool canApplyFlag(FormatChar formatChar, char modifier) {
+    if (modifier == '#') {
+        return formatChar == UNSIGNED_OCTAL || formatChar == UNSIGNED_HEX_LOWER ||
+               formatChar == UNSIGNED_HEX_UPPER || formatChar == FLOAT_LOWER ||
+               formatChar == FLOAT_UPPER || formatChar == SHORT_EXP_LOWER ||
+               formatChar == SHORT_EXP_UPPER;
+    } else if (modifier == '.') {
+        return formatChar == SIGNED_DECIMAL || formatChar == UNSIGNED_DECIMAL ||
+               formatChar == UNSIGNED_OCTAL || formatChar == UNSIGNED_HEX_LOWER ||
+               formatChar == UNSIGNED_HEX_UPPER || formatChar == FLOAT_LOWER ||
+               formatChar == FLOAT_UPPER || formatChar == SHORT_EXP_LOWER ||
+               formatChar == SHORT_EXP_UPPER || formatChar == STRING;
+    }
+    return true;
+}
diff --git a/libutils/Looper_fuzz.cpp b/libutils/Looper_fuzz.cpp
new file mode 100644
index 0000000..c3ae54e
--- /dev/null
+++ b/libutils/Looper_fuzz.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include <sys/select.h>
+
+#include <iostream>
+
+#include <utils/Looper.h>
+
+#include "Looper_test_pipe.h"
+#include "fuzzer/FuzzedDataProvider.h"
+
+using android::Looper;
+using android::sp;
+
+// We don't want this to bog down fuzzing
+static constexpr int MAX_POLL_DELAY = 50;
+static constexpr int MAX_OPERATIONS = 500;
+
+void doNothing() {}
+void* doNothingPointer = reinterpret_cast<void*>(doNothing);
+
+static int noopCallback(int, int, void*) {
+    return 0;
+}
+
+std::vector<std::function<void(FuzzedDataProvider*, sp<Looper>, Pipe)>> operations = {
+        [](FuzzedDataProvider* dataProvider, sp<Looper> looper, Pipe) -> void {
+            looper->pollOnce(dataProvider->ConsumeIntegralInRange<int>(0, MAX_POLL_DELAY));
+        },
+        [](FuzzedDataProvider* dataProvider, sp<Looper> looper, Pipe) -> void {
+            looper->pollAll(dataProvider->ConsumeIntegralInRange<int>(0, MAX_POLL_DELAY));
+        },
+        // events and callback are nullptr
+        [](FuzzedDataProvider* dataProvider, sp<Looper> looper, Pipe pipeObj) -> void {
+            looper->addFd(pipeObj.receiveFd, dataProvider->ConsumeIntegral<int>(),
+                          dataProvider->ConsumeIntegral<int>(), nullptr, nullptr);
+        },
+        // Events is nullptr
+        [](FuzzedDataProvider* dataProvider, sp<Looper> looper, Pipe pipeObj) -> void {
+            looper->addFd(pipeObj.receiveFd, dataProvider->ConsumeIntegral<int>(),
+                          dataProvider->ConsumeIntegral<int>(), noopCallback, nullptr);
+        },
+        // callback is nullptr
+        [](FuzzedDataProvider* dataProvider, sp<Looper> looper, Pipe pipeObj) -> void {
+            looper->addFd(pipeObj.receiveFd, dataProvider->ConsumeIntegral<int>(),
+                          dataProvider->ConsumeIntegral<int>(), nullptr, doNothingPointer);
+        },
+        // callback and events both set
+        [](FuzzedDataProvider* dataProvider, sp<Looper> looper, Pipe pipeObj) -> void {
+            looper->addFd(pipeObj.receiveFd, dataProvider->ConsumeIntegral<int>(),
+                          dataProvider->ConsumeIntegral<int>(), noopCallback, doNothingPointer);
+        },
+
+        [](FuzzedDataProvider*, sp<Looper> looper, Pipe) -> void { looper->wake(); },
+        [](FuzzedDataProvider*, sp<Looper>, Pipe pipeObj) -> void { pipeObj.writeSignal(); }};
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    Pipe pipeObj;
+    FuzzedDataProvider dataProvider(data, size);
+    sp<Looper> looper = new Looper(dataProvider.ConsumeBool());
+
+    size_t opsRun = 0;
+    while (dataProvider.remaining_bytes() > 0 && opsRun++ < MAX_OPERATIONS) {
+        uint8_t op = dataProvider.ConsumeIntegralInRange<uint8_t>(0, operations.size() - 1);
+        operations[op](&dataProvider, looper, pipeObj);
+    }
+    // Clear our pointer
+    looper.clear();
+    return 0;
+}
diff --git a/libutils/Looper_test.cpp b/libutils/Looper_test.cpp
index 37bdf05..34f424b 100644
--- a/libutils/Looper_test.cpp
+++ b/libutils/Looper_test.cpp
@@ -2,12 +2,13 @@
 // Copyright 2010 The Android Open Source Project
 //
 
-#include <utils/Looper.h>
-#include <utils/Timers.h>
-#include <utils/StopWatch.h>
 #include <gtest/gtest.h>
-#include <unistd.h>
 #include <time.h>
+#include <unistd.h>
+#include <utils/Looper.h>
+#include <utils/StopWatch.h>
+#include <utils/Timers.h>
+#include "Looper_test_pipe.h"
 
 #include <utils/threads.h>
 
@@ -24,41 +25,6 @@
     MSG_TEST4 = 4,
 };
 
-class Pipe {
-public:
-    int sendFd;
-    int receiveFd;
-
-    Pipe() {
-        int fds[2];
-        ::pipe(fds);
-
-        receiveFd = fds[0];
-        sendFd = fds[1];
-    }
-
-    ~Pipe() {
-        if (sendFd != -1) {
-            ::close(sendFd);
-        }
-
-        if (receiveFd != -1) {
-            ::close(receiveFd);
-        }
-    }
-
-    status_t writeSignal() {
-        ssize_t nWritten = ::write(sendFd, "*", 1);
-        return nWritten == 1 ? 0 : -errno;
-    }
-
-    status_t readSignal() {
-        char buf[1];
-        ssize_t nRead = ::read(receiveFd, buf, 1);
-        return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno;
-    }
-};
-
 class DelayedTask : public Thread {
     int mDelayMillis;
 
diff --git a/libutils/Looper_test_pipe.h b/libutils/Looper_test_pipe.h
new file mode 100644
index 0000000..77b7b8b
--- /dev/null
+++ b/libutils/Looper_test_pipe.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#pragma once
+#include <unistd.h>
+/**
+ * A pipe class for use when testing or fuzzing Looper
+ */
+class Pipe {
+  public:
+    int sendFd;
+    int receiveFd;
+
+    Pipe() {
+        int fds[2];
+        ::pipe(fds);
+
+        receiveFd = fds[0];
+        sendFd = fds[1];
+    }
+
+    ~Pipe() {
+        if (sendFd != -1) {
+            ::close(sendFd);
+        }
+
+        if (receiveFd != -1) {
+            ::close(receiveFd);
+        }
+    }
+
+    android::status_t writeSignal() {
+        ssize_t nWritten = ::write(sendFd, "*", 1);
+        return nWritten == 1 ? 0 : -errno;
+    }
+
+    android::status_t readSignal() {
+        char buf[1];
+        ssize_t nRead = ::read(receiveFd, buf, 1);
+        return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno;
+    }
+};
diff --git a/libutils/LruCache_fuzz.cpp b/libutils/LruCache_fuzz.cpp
new file mode 100644
index 0000000..f8bacfc
--- /dev/null
+++ b/libutils/LruCache_fuzz.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include <functional>
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/LruCache.h"
+#include "utils/StrongPointer.h"
+
+typedef android::LruCache<size_t, size_t> FuzzCache;
+
+static constexpr uint32_t MAX_CACHE_ENTRIES = 800;
+
+class NoopRemovedCallback : public android::OnEntryRemoved<size_t, size_t> {
+  public:
+    void operator()(size_t&, size_t&) {
+        // noop
+    }
+};
+
+static NoopRemovedCallback callback;
+
+static const std::vector<std::function<void(FuzzedDataProvider*, FuzzCache*)>> operations = {
+        [](FuzzedDataProvider*, FuzzCache* cache) -> void { cache->removeOldest(); },
+        [](FuzzedDataProvider*, FuzzCache* cache) -> void { cache->peekOldestValue(); },
+        [](FuzzedDataProvider*, FuzzCache* cache) -> void { cache->clear(); },
+        [](FuzzedDataProvider*, FuzzCache* cache) -> void { cache->size(); },
+        [](FuzzedDataProvider*, FuzzCache* cache) -> void {
+            android::LruCache<size_t, size_t>::Iterator iter(*cache);
+            while (iter.next()) {
+                iter.key();
+                iter.value();
+            }
+        },
+        [](FuzzedDataProvider* dataProvider, FuzzCache* cache) -> void {
+            size_t key = dataProvider->ConsumeIntegral<size_t>();
+            size_t val = dataProvider->ConsumeIntegral<size_t>();
+            cache->put(key, val);
+        },
+        [](FuzzedDataProvider* dataProvider, FuzzCache* cache) -> void {
+            size_t key = dataProvider->ConsumeIntegral<size_t>();
+            cache->get(key);
+        },
+        [](FuzzedDataProvider* dataProvider, FuzzCache* cache) -> void {
+            size_t key = dataProvider->ConsumeIntegral<size_t>();
+            cache->remove(key);
+        },
+        [](FuzzedDataProvider*, FuzzCache* cache) -> void {
+            cache->setOnEntryRemovedListener(&callback);
+        }};
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    FuzzCache cache(MAX_CACHE_ENTRIES);
+    while (dataProvider.remaining_bytes() > 0) {
+        uint8_t op = dataProvider.ConsumeIntegral<uint8_t>() % operations.size();
+        operations[op](&dataProvider, &cache);
+    }
+
+    return 0;
+}
diff --git a/libutils/Printer_fuzz.cpp b/libutils/Printer_fuzz.cpp
new file mode 100755
index 0000000..0180d41
--- /dev/null
+++ b/libutils/Printer_fuzz.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include "android-base/file.h"
+#include "android/log.h"
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/Printer.h"
+#include "utils/String8.h"
+static constexpr int MAX_STR_SIZE = 1000;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    android::String8 outStr = android::String8();
+    // Line indent/formatting
+    uint indent = dataProvider.ConsumeIntegral<uint>();
+    std::string prefix = dataProvider.ConsumeRandomLengthString(MAX_STR_SIZE);
+    std::string line = dataProvider.ConsumeRandomLengthString(MAX_STR_SIZE);
+
+    // Misc properties
+    std::string logTag = dataProvider.ConsumeRandomLengthString(MAX_STR_SIZE);
+    android_LogPriority priority =
+            static_cast<android_LogPriority>(dataProvider.ConsumeIntegral<int>());
+    bool ignoreBlankLines = dataProvider.ConsumeBool();
+
+    TemporaryFile tf;
+    android::FdPrinter filePrinter = android::FdPrinter(tf.fd, indent, prefix.c_str());
+    android::String8Printer stringPrinter = android::String8Printer(&outStr);
+    android::PrefixPrinter printer = android::PrefixPrinter(stringPrinter, prefix.c_str());
+    android::LogPrinter logPrinter =
+            android::LogPrinter(logTag.c_str(), priority, prefix.c_str(), ignoreBlankLines);
+
+    printer.printLine(line.c_str());
+    printer.printFormatLine("%s", line.c_str());
+    logPrinter.printLine(line.c_str());
+    logPrinter.printFormatLine("%s", line.c_str());
+    filePrinter.printLine(line.c_str());
+    filePrinter.printFormatLine("%s", line.c_str());
+    return 0;
+}
diff --git a/libutils/ProcessCallStack_fuzz.cpp b/libutils/ProcessCallStack_fuzz.cpp
new file mode 100644
index 0000000..30136cd
--- /dev/null
+++ b/libutils/ProcessCallStack_fuzz.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include <atomic>
+#include <thread>
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/ProcessCallStack.h"
+using android::ProcessCallStack;
+
+static constexpr int MAX_NAME_SIZE = 1000;
+static constexpr int MAX_LOG_META_SIZE = 1000;
+static constexpr uint8_t MAX_THREADS = 10;
+
+std::atomic_bool ranCallStackUpdate(false);
+void loop() {
+    while (!ranCallStackUpdate.load()) {
+        std::this_thread::sleep_for(std::chrono::milliseconds(50));
+    }
+}
+
+void spawnThreads(FuzzedDataProvider* dataProvider) {
+    std::vector<std::thread> threads = std::vector<std::thread>();
+
+    // Get the number of threads to generate
+    uint8_t count = dataProvider->ConsumeIntegralInRange<uint8_t>(1, MAX_THREADS);
+
+    // Generate threads
+    for (uint8_t i = 0; i < count; i++) {
+        std::string threadName =
+                dataProvider->ConsumeRandomLengthString(MAX_NAME_SIZE).append(std::to_string(i));
+        std::thread th = std::thread(loop);
+        pthread_setname_np(th.native_handle(), threadName.c_str());
+        threads.push_back(move(th));
+    }
+
+    // Collect thread information
+    ProcessCallStack callStack = ProcessCallStack();
+    callStack.update();
+
+    // Tell our patiently waiting threads they can be done now.
+    ranCallStackUpdate.store(true);
+
+    std::string logTag = dataProvider->ConsumeRandomLengthString(MAX_LOG_META_SIZE);
+    std::string prefix = dataProvider->ConsumeRandomLengthString(MAX_LOG_META_SIZE);
+    // Both of these, along with dump, all call print() under the hood,
+    // Which is covered by the Printer fuzzer.
+    callStack.log(logTag.c_str());
+    callStack.toString(prefix.c_str());
+
+    // Check size
+    callStack.size();
+
+    // wait for any remaining threads
+    for (auto& thread : threads) {
+        thread.join();
+    }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    spawnThreads(&dataProvider);
+    return 0;
+}
diff --git a/libutils/PropertyMap.cpp b/libutils/PropertyMap.cpp
deleted file mode 100644
index f00272a..0000000
--- a/libutils/PropertyMap.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#define LOG_TAG "PropertyMap"
-
-#include <utils/PropertyMap.h>
-
-// Enables debug output for the parser.
-#define DEBUG_PARSER 0
-
-// Enables debug output for parser performance.
-#define DEBUG_PARSER_PERFORMANCE 0
-
-
-namespace android {
-
-static const char* WHITESPACE = " \t\r";
-static const char* WHITESPACE_OR_PROPERTY_DELIMITER = " \t\r=";
-
-
-// --- PropertyMap ---
-
-PropertyMap::PropertyMap() {
-}
-
-PropertyMap::~PropertyMap() {
-}
-
-void PropertyMap::clear() {
-    mProperties.clear();
-}
-
-void PropertyMap::addProperty(const String8& key, const String8& value) {
-    mProperties.add(key, value);
-}
-
-bool PropertyMap::hasProperty(const String8& key) const {
-    return mProperties.indexOfKey(key) >= 0;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, String8& outValue) const {
-    ssize_t index = mProperties.indexOfKey(key);
-    if (index < 0) {
-        return false;
-    }
-
-    outValue = mProperties.valueAt(index);
-    return true;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, bool& outValue) const {
-    int32_t intValue;
-    if (!tryGetProperty(key, intValue)) {
-        return false;
-    }
-
-    outValue = intValue;
-    return true;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, int32_t& outValue) const {
-    String8 stringValue;
-    if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) {
-        return false;
-    }
-
-    char* end;
-    int value = strtol(stringValue.string(), & end, 10);
-    if (*end != '\0') {
-        ALOGW("Property key '%s' has invalid value '%s'.  Expected an integer.",
-                key.string(), stringValue.string());
-        return false;
-    }
-    outValue = value;
-    return true;
-}
-
-bool PropertyMap::tryGetProperty(const String8& key, float& outValue) const {
-    String8 stringValue;
-    if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) {
-        return false;
-    }
-
-    char* end;
-    float value = strtof(stringValue.string(), & end);
-    if (*end != '\0') {
-        ALOGW("Property key '%s' has invalid value '%s'.  Expected a float.",
-                key.string(), stringValue.string());
-        return false;
-    }
-    outValue = value;
-    return true;
-}
-
-void PropertyMap::addAll(const PropertyMap* map) {
-    for (size_t i = 0; i < map->mProperties.size(); i++) {
-        mProperties.add(map->mProperties.keyAt(i), map->mProperties.valueAt(i));
-    }
-}
-
-status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) {
-    *outMap = nullptr;
-
-    Tokenizer* tokenizer;
-    status_t status = Tokenizer::open(filename, &tokenizer);
-    if (status) {
-        ALOGE("Error %d opening property file %s.", status, filename.string());
-    } else {
-        PropertyMap* map = new PropertyMap();
-        if (!map) {
-            ALOGE("Error allocating property map.");
-            status = NO_MEMORY;
-        } else {
-#if DEBUG_PARSER_PERFORMANCE
-            nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC);
-#endif
-            Parser parser(map, tokenizer);
-            status = parser.parse();
-#if DEBUG_PARSER_PERFORMANCE
-            nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime;
-            ALOGD("Parsed property file '%s' %d lines in %0.3fms.",
-                    tokenizer->getFilename().string(), tokenizer->getLineNumber(),
-                    elapsedTime / 1000000.0);
-#endif
-            if (status) {
-                delete map;
-            } else {
-                *outMap = map;
-            }
-        }
-        delete tokenizer;
-    }
-    return status;
-}
-
-
-// --- PropertyMap::Parser ---
-
-PropertyMap::Parser::Parser(PropertyMap* map, Tokenizer* tokenizer) :
-        mMap(map), mTokenizer(tokenizer) {
-}
-
-PropertyMap::Parser::~Parser() {
-}
-
-status_t PropertyMap::Parser::parse() {
-    while (!mTokenizer->isEof()) {
-#if DEBUG_PARSER
-        ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
-                mTokenizer->peekRemainderOfLine().string());
-#endif
-
-        mTokenizer->skipDelimiters(WHITESPACE);
-
-        if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') {
-            String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER);
-            if (keyToken.isEmpty()) {
-                ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string());
-                return BAD_VALUE;
-            }
-
-            mTokenizer->skipDelimiters(WHITESPACE);
-
-            if (mTokenizer->nextChar() != '=') {
-                ALOGE("%s: Expected '=' between property key and value.",
-                        mTokenizer->getLocation().string());
-                return BAD_VALUE;
-            }
-
-            mTokenizer->skipDelimiters(WHITESPACE);
-
-            String8 valueToken = mTokenizer->nextToken(WHITESPACE);
-            if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) {
-                ALOGE("%s: Found reserved character '\\' or '\"' in property value.",
-                        mTokenizer->getLocation().string());
-                return BAD_VALUE;
-            }
-
-            mTokenizer->skipDelimiters(WHITESPACE);
-            if (!mTokenizer->isEol()) {
-                ALOGE("%s: Expected end of line, got '%s'.",
-                        mTokenizer->getLocation().string(),
-                        mTokenizer->peekRemainderOfLine().string());
-                return BAD_VALUE;
-            }
-
-            if (mMap->hasProperty(keyToken)) {
-                ALOGE("%s: Duplicate property value for key '%s'.",
-                        mTokenizer->getLocation().string(), keyToken.string());
-                return BAD_VALUE;
-            }
-
-            mMap->addProperty(keyToken, valueToken);
-        }
-
-        mTokenizer->nextLine();
-    }
-    return OK;
-}
-
-} // namespace android
diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp
index ae10789..8e45226 100644
--- a/libutils/RefBase.cpp
+++ b/libutils/RefBase.cpp
@@ -21,9 +21,9 @@
 
 #include <android-base/macros.h>
 
-#include <utils/RefBase.h>
+#include <log/log.h>
 
-#include <utils/CallStack.h>
+#include <utils/RefBase.h>
 
 #include <utils/Mutex.h>
 
@@ -55,6 +55,17 @@
 // case.
 #define DEBUG_REFBASE_DESTRUCTION 1
 
+#if !defined(_WIN32) && !defined(__APPLE__)
+// CallStack is only supported on linux type platforms.
+#define CALLSTACK_ENABLED 1
+#else
+#define CALLSTACK_ENABLED 0
+#endif
+
+#if CALLSTACK_ENABLED
+#include <utils/CallStack.h>
+#endif
+
 // ---------------------------------------------------------------------------
 
 namespace android {
@@ -185,7 +196,7 @@
         , mRetain(false)
     {
     }
-    
+
     ~weakref_impl()
     {
         bool dumpStack = false;
@@ -196,7 +207,7 @@
             while (refs) {
                 char inc = refs->ref >= 0 ? '+' : '-';
                 ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
-#if DEBUG_REFS_CALLSTACK_ENABLED
+#if DEBUG_REFS_CALLSTACK_ENABLED && CALLSTACK_ENABLED
                 CallStack::logStack(LOG_TAG, refs->stack.get());
 #endif
                 refs = refs->next;
@@ -210,7 +221,7 @@
             while (refs) {
                 char inc = refs->ref >= 0 ? '+' : '-';
                 ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref);
-#if DEBUG_REFS_CALLSTACK_ENABLED
+#if DEBUG_REFS_CALLSTACK_ENABLED && CALLSTACK_ENABLED
                 CallStack::logStack(LOG_TAG, refs->stack.get());
 #endif
                 refs = refs->next;
@@ -218,7 +229,9 @@
         }
         if (dumpStack) {
             ALOGE("above errors at:");
+#if CALLSTACK_ENABLED
             CallStack::logStack(LOG_TAG);
+#endif
         }
     }
 
@@ -261,8 +274,7 @@
         renameRefsId(mWeakRefs, old_id, new_id);
     }
 
-    void trackMe(bool track, bool retain)
-    { 
+    void trackMe(bool track, bool retain) {
         mTrackEnabled = track;
         mRetain = retain;
     }
@@ -306,7 +318,7 @@
     {
         ref_entry* next;
         const void* id;
-#if DEBUG_REFS_CALLSTACK_ENABLED
+#if DEBUG_REFS_CALLSTACK_ENABLED && CALLSTACK_ENABLED
         CallStack::CallStackUPtr stack;
 #endif
         int32_t ref;
@@ -323,7 +335,7 @@
             // decrement the reference count.
             ref->ref = mRef;
             ref->id = id;
-#if DEBUG_REFS_CALLSTACK_ENABLED
+#if DEBUG_REFS_CALLSTACK_ENABLED && CALLSTACK_ENABLED
             ref->stack = CallStack::getCurrent(2);
 #endif
             ref->next = *refs;
@@ -335,7 +347,7 @@
     {
         if (mTrackEnabled) {
             AutoMutex _l(mMutex);
-            
+
             ref_entry* const head = *refs;
             ref_entry* ref = head;
             while (ref != NULL) {
@@ -359,7 +371,9 @@
                 ref = ref->next;
             }
 
+#if CALLSTACK_ENABLED
             CallStack::logStack(LOG_TAG);
+#endif
         }
     }
 
@@ -385,7 +399,7 @@
             snprintf(buf, sizeof(buf), "\t%c ID %p (ref %d):\n",
                      inc, refs->id, refs->ref);
             out->append(buf);
-#if DEBUG_REFS_CALLSTACK_ENABLED
+#if DEBUG_REFS_CALLSTACK_ENABLED && CALLSTACK_ENABLED
             out->append(CallStack::stackToString("\t\t", refs->stack.get()));
 #else
             out->append("\t\t(call stacks disabled)");
@@ -412,7 +426,7 @@
 {
     weakref_impl* const refs = mRefs;
     refs->incWeak(id);
-    
+
     refs->addStrongRef(id);
     const int32_t c = refs->mStrong.fetch_add(1, std::memory_order_relaxed);
     ALOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs);
@@ -468,7 +482,7 @@
     // TODO: Better document assumptions.
     weakref_impl* const refs = mRefs;
     refs->incWeak(id);
-    
+
     refs->addStrongRef(id);
     const int32_t c = refs->mStrong.fetch_add(1, std::memory_order_relaxed);
     ALOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow",
@@ -550,7 +564,7 @@
 bool RefBase::weakref_type::attemptIncStrong(const void* id)
 {
     incWeak(id);
-    
+
     weakref_impl* const impl = static_cast<weakref_impl*>(this);
     int32_t curCount = impl->mStrong.load(std::memory_order_relaxed);
 
@@ -567,7 +581,7 @@
         // the strong count has changed on us, we need to re-assert our
         // situation. curCount was updated by compare_exchange_weak.
     }
-    
+
     if (curCount <= 0 || curCount == INITIAL_STRONG_VALUE) {
         // we're now in the harder case of either:
         // - there never was a strong reference on us
@@ -624,7 +638,7 @@
             }
         }
     }
-    
+
     impl->addStrongRef(id);
 
 #if PRINT_REFS
@@ -719,7 +733,10 @@
         // Treating this as fatal is prone to causing boot loops. For debugging, it's
         // better to treat as non-fatal.
         ALOGD("RefBase: Explicit destruction, weak count = %d (in %p)", mRefs->mWeak.load(), this);
+
+#if CALLSTACK_ENABLED
         CallStack::logStack(LOG_TAG);
+#endif
 #else
         LOG_ALWAYS_FATAL("RefBase: Explicit destruction, weak count = %d", mRefs->mWeak.load());
 #endif
diff --git a/libutils/RefBase_fuzz.cpp b/libutils/RefBase_fuzz.cpp
new file mode 100644
index 0000000..69288b3
--- /dev/null
+++ b/libutils/RefBase_fuzz.cpp
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#define LOG_TAG "RefBaseFuzz"
+
+#include <thread>
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/Log.h"
+#include "utils/RWLock.h"
+#include "utils/RefBase.h"
+#include "utils/StrongPointer.h"
+
+using android::RefBase;
+using android::RWLock;
+using android::sp;
+using android::wp;
+
+static constexpr int kMaxOperations = 100;
+static constexpr int kMaxThreads = 10;
+struct RefBaseSubclass : public RefBase {
+  public:
+    RefBaseSubclass(bool* deletedCheck, RWLock& deletedMtx)
+        : mDeleted(deletedCheck), mRwLock(deletedMtx) {
+        RWLock::AutoWLock lock(mRwLock);
+        *mDeleted = false;
+        extendObjectLifetime(OBJECT_LIFETIME_WEAK);
+    }
+
+    virtual ~RefBaseSubclass() {
+        RWLock::AutoWLock lock(mRwLock);
+        *mDeleted = true;
+    }
+
+  private:
+    bool* mDeleted;
+    android::RWLock& mRwLock;
+};
+
+// A thread-specific state object for ref
+struct RefThreadState {
+    size_t strongCount = 0;
+    size_t weakCount = 0;
+};
+
+RWLock gRefDeletedLock;
+bool gRefDeleted = false;
+bool gHasModifiedRefs = false;
+RefBaseSubclass* ref;
+RefBase::weakref_type* weakRefs;
+
+// These operations don't need locks as they explicitly check per-thread counts before running
+// they also have the potential to write to gRefDeleted, so must not be locked.
+const std::vector<std::function<void(RefThreadState*)>> kUnlockedOperations = {
+        [](RefThreadState* refState) -> void {
+            if (refState->strongCount > 0) {
+                ref->decStrong(nullptr);
+                gHasModifiedRefs = true;
+                refState->strongCount--;
+            }
+        },
+        [](RefThreadState* refState) -> void {
+            if (refState->weakCount > 0) {
+                weakRefs->decWeak(nullptr);
+                gHasModifiedRefs = true;
+                refState->weakCount--;
+            }
+        },
+};
+
+const std::vector<std::function<void(RefThreadState*)>> kMaybeLockedOperations = {
+        // Read-only operations
+        [](RefThreadState*) -> void { ref->getStrongCount(); },
+        [](RefThreadState*) -> void { weakRefs->getWeakCount(); },
+        [](RefThreadState*) -> void { ref->printRefs(); },
+
+        // Read/write operations
+        [](RefThreadState* refState) -> void {
+            ref->incStrong(nullptr);
+            gHasModifiedRefs = true;
+            refState->strongCount++;
+        },
+        [](RefThreadState* refState) -> void {
+            ref->forceIncStrong(nullptr);
+            gHasModifiedRefs = true;
+            refState->strongCount++;
+        },
+        [](RefThreadState* refState) -> void {
+            ref->createWeak(nullptr);
+            gHasModifiedRefs = true;
+            refState->weakCount++;
+        },
+        [](RefThreadState* refState) -> void {
+            // This will increment weak internally, then attempt to
+            // promote it to strong. If it fails, it decrements weak.
+            // If it succeeds, the weak is converted to strong.
+            // Both cases net no weak reference change.
+            if (weakRefs->attemptIncStrong(nullptr)) {
+                refState->strongCount++;
+                gHasModifiedRefs = true;
+            }
+        },
+        [](RefThreadState* refState) -> void {
+            if (weakRefs->attemptIncWeak(nullptr)) {
+                refState->weakCount++;
+                gHasModifiedRefs = true;
+            }
+        },
+        [](RefThreadState* refState) -> void {
+            weakRefs->incWeak(nullptr);
+            gHasModifiedRefs = true;
+            refState->weakCount++;
+        },
+};
+
+void loop(const std::vector<uint8_t>& fuzzOps) {
+    RefThreadState state;
+    uint8_t lockedOpSize = kMaybeLockedOperations.size();
+    uint8_t totalOperationTypes = lockedOpSize + kUnlockedOperations.size();
+    for (auto op : fuzzOps) {
+        auto opVal = op % totalOperationTypes;
+        if (opVal >= lockedOpSize) {
+            kUnlockedOperations[opVal % lockedOpSize](&state);
+        } else {
+            // We only need to lock if we have no strong or weak count
+            bool shouldLock = state.strongCount == 0 && state.weakCount == 0;
+            if (shouldLock) {
+                gRefDeletedLock.readLock();
+                // If ref has deleted itself, we can no longer fuzz on this thread.
+                if (gRefDeleted) {
+                    // Unlock since we're exiting the loop here.
+                    gRefDeletedLock.unlock();
+                    return;
+                }
+            }
+            // Execute the locked operation
+            kMaybeLockedOperations[opVal](&state);
+            // Unlock if we locked.
+            if (shouldLock) {
+                gRefDeletedLock.unlock();
+            }
+        }
+    }
+
+    // Instead of explicitly freeing this, we're going to remove our weak and
+    // strong references.
+    for (; state.weakCount > 0; state.weakCount--) {
+        weakRefs->decWeak(nullptr);
+    }
+
+    // Clean up any strong references
+    for (; state.strongCount > 0; state.strongCount--) {
+        ref->decStrong(nullptr);
+    }
+}
+
+void spawnThreads(FuzzedDataProvider* dataProvider) {
+    std::vector<std::thread> threads = std::vector<std::thread>();
+
+    // Get the number of threads to generate
+    uint8_t count = dataProvider->ConsumeIntegralInRange<uint8_t>(1, kMaxThreads);
+    // Generate threads
+    for (uint8_t i = 0; i < count; i++) {
+        uint8_t opCount = dataProvider->ConsumeIntegralInRange<uint8_t>(1, kMaxOperations);
+        std::vector<uint8_t> threadOperations = dataProvider->ConsumeBytes<uint8_t>(opCount);
+        std::thread tmpThread = std::thread(loop, threadOperations);
+        threads.push_back(move(tmpThread));
+    }
+
+    for (auto& th : threads) {
+        th.join();
+    }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    gHasModifiedRefs = false;
+    ref = new RefBaseSubclass(&gRefDeleted, gRefDeletedLock);
+    weakRefs = ref->getWeakRefs();
+    // Since we are modifying flags, (flags & OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_WEAK
+    // is true. The destructor for RefBase should clean up weakrefs because of this.
+    FuzzedDataProvider dataProvider(data, size);
+    spawnThreads(&dataProvider);
+    LOG_ALWAYS_FATAL_IF(!gHasModifiedRefs && gRefDeleted, "ref(%p) was prematurely deleted!", ref);
+    // We need to explicitly delete this object
+    // if no refs have been added or deleted.
+    if (!gHasModifiedRefs && !gRefDeleted) {
+        delete ref;
+    }
+    LOG_ALWAYS_FATAL_IF(gHasModifiedRefs && !gRefDeleted,
+                        "ref(%p) should be deleted, is it leaking?", ref);
+    return 0;
+}
diff --git a/libutils/SharedBuffer_test.cpp b/libutils/SharedBuffer_test.cpp
index 33a4e0c..3f960d2 100644
--- a/libutils/SharedBuffer_test.cpp
+++ b/libutils/SharedBuffer_test.cpp
@@ -23,36 +23,45 @@
 
 #include "SharedBuffer.h"
 
-TEST(SharedBufferTest, TestAlloc) {
-  EXPECT_DEATH(android::SharedBuffer::alloc(SIZE_MAX), "");
-  EXPECT_DEATH(android::SharedBuffer::alloc(SIZE_MAX - sizeof(android::SharedBuffer)), "");
+extern "C" void __hwasan_init() __attribute__((weak));
+#define SKIP_WITH_HWASAN \
+    if (&__hwasan_init != 0) GTEST_SKIP()
 
-  // Make sure we don't die here.
-  // Check that null is returned, as we are asking for the whole address space.
-  android::SharedBuffer* buf =
-      android::SharedBuffer::alloc(SIZE_MAX - sizeof(android::SharedBuffer) - 1);
-  ASSERT_EQ(nullptr, buf);
-
-  buf = android::SharedBuffer::alloc(0);
-  ASSERT_NE(nullptr, buf);
-  ASSERT_EQ(0U, buf->size());
-  buf->release();
+TEST(SharedBufferTest, alloc_death) {
+    EXPECT_DEATH(android::SharedBuffer::alloc(SIZE_MAX), "");
+    EXPECT_DEATH(android::SharedBuffer::alloc(SIZE_MAX - sizeof(android::SharedBuffer)), "");
 }
 
-TEST(SharedBufferTest, TestEditResize) {
-  android::SharedBuffer* buf = android::SharedBuffer::alloc(10);
-  EXPECT_DEATH(buf->editResize(SIZE_MAX - sizeof(android::SharedBuffer)), "");
-  buf = android::SharedBuffer::alloc(10);
-  EXPECT_DEATH(buf->editResize(SIZE_MAX), "");
+TEST(SharedBufferTest, alloc_null) {
+    // Big enough to fail, not big enough to abort.
+    SKIP_WITH_HWASAN;  // hwasan has a 2GiB allocation limit.
+    ASSERT_EQ(nullptr, android::SharedBuffer::alloc(SIZE_MAX / 2));
+}
 
-  buf = android::SharedBuffer::alloc(10);
-  // Make sure we don't die here.
-  // Check that null is returned, as we are asking for the whole address space.
-  buf = buf->editResize(SIZE_MAX - sizeof(android::SharedBuffer) - 1);
-  ASSERT_EQ(nullptr, buf);
+TEST(SharedBufferTest, alloc_zero_size) {
+    android::SharedBuffer* buf = android::SharedBuffer::alloc(0);
+    ASSERT_NE(nullptr, buf);
+    ASSERT_EQ(0U, buf->size());
+    buf->release();
+}
 
-  buf = android::SharedBuffer::alloc(10);
-  buf = buf->editResize(0);
-  ASSERT_EQ(0U, buf->size());
-  buf->release();
+TEST(SharedBufferTest, editResize_death) {
+    android::SharedBuffer* buf = android::SharedBuffer::alloc(10);
+    EXPECT_DEATH(buf->editResize(SIZE_MAX - sizeof(android::SharedBuffer)), "");
+    buf = android::SharedBuffer::alloc(10);
+    EXPECT_DEATH(buf->editResize(SIZE_MAX), "");
+}
+
+TEST(SharedBufferTest, editResize_null) {
+    // Big enough to fail, not big enough to abort.
+    SKIP_WITH_HWASAN;  // hwasan has a 2GiB allocation limit.
+    android::SharedBuffer* buf = android::SharedBuffer::alloc(10);
+    ASSERT_EQ(nullptr, buf->editResize(SIZE_MAX / 2));
+}
+
+TEST(SharedBufferTest, editResize_zero_size) {
+    android::SharedBuffer* buf = android::SharedBuffer::alloc(10);
+    buf = buf->editResize(0);
+    ASSERT_EQ(0U, buf->size());
+    buf->release();
 }
diff --git a/libutils/StopWatch_fuzz.cpp b/libutils/StopWatch_fuzz.cpp
new file mode 100644
index 0000000..63d8a28
--- /dev/null
+++ b/libutils/StopWatch_fuzz.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/StopWatch.h"
+
+static constexpr int MAX_OPERATIONS = 100;
+static constexpr int MAX_NAME_LEN = 2048;
+
+static const std::vector<std::function<void(android::StopWatch)>> operations = {
+        [](android::StopWatch stopWatch) -> void { stopWatch.reset(); },
+        [](android::StopWatch stopWatch) -> void { stopWatch.lap(); },
+        [](android::StopWatch stopWatch) -> void { stopWatch.elapsedTime(); },
+        [](android::StopWatch stopWatch) -> void { stopWatch.name(); },
+};
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    std::string nameStr = dataProvider.ConsumeRandomLengthString(MAX_NAME_LEN);
+    int clockVal = dataProvider.ConsumeIntegral<int>();
+    android::StopWatch stopWatch = android::StopWatch(nameStr.c_str(), clockVal);
+    std::vector<uint8_t> opsToRun = dataProvider.ConsumeRemainingBytes<uint8_t>();
+    int opsRun = 0;
+    for (auto it : opsToRun) {
+        if (opsRun++ >= MAX_OPERATIONS) {
+            break;
+        }
+        it = it % operations.size();
+        operations[it](stopWatch);
+    }
+    return 0;
+}
diff --git a/libutils/String16.cpp b/libutils/String16.cpp
index 539953a..70bf5a0 100644
--- a/libutils/String16.cpp
+++ b/libutils/String16.cpp
@@ -90,19 +90,6 @@
 {
 }
 
-String16::String16(StaticLinkage)
-    : mString(nullptr)
-{
-    // this constructor is used when we can't rely on the static-initializers
-    // having run. In this case we always allocate an empty string. It's less
-    // efficient than using getEmptyString(), but we assume it's uncommon.
-
-    SharedBuffer* buf = static_cast<SharedBuffer*>(alloc(sizeof(char16_t)));
-    char16_t* data = static_cast<char16_t*>(buf->data());
-    data[0] = 0;
-    mString = data;
-}
-
 String16::String16(const String16& o)
     : mString(o.mString)
 {
diff --git a/libutils/String16_fuzz.cpp b/libutils/String16_fuzz.cpp
new file mode 100644
index 0000000..63c2800
--- /dev/null
+++ b/libutils/String16_fuzz.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2020 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.
+ */
+#include <iostream>
+
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/String16.h"
+static constexpr int MAX_STRING_BYTES = 256;
+static constexpr uint8_t MAX_OPERATIONS = 50;
+
+std::vector<std::function<void(FuzzedDataProvider&, android::String16, android::String16)>>
+        operations = {
+
+                // Bytes and size
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16) -> void {
+                    str1.string();
+                }),
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16) -> void {
+                    str1.isStaticString();
+                }),
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16) -> void {
+                    str1.size();
+                }),
+
+                // Casing
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16) -> void {
+                    str1.makeLower();
+                }),
+
+                // Comparison
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
+                    str1.startsWith(str2);
+                }),
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
+                    str1.contains(str2.string());
+                }),
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
+                    str1.compare(str2);
+                }),
+
+                // Append and format
+                ([](FuzzedDataProvider&, android::String16 str1, android::String16 str2) -> void {
+                    str1.append(str2);
+                }),
+                ([](FuzzedDataProvider& dataProvider, android::String16 str1,
+                    android::String16 str2) -> void {
+                    int pos = dataProvider.ConsumeIntegralInRange<int>(0, str1.size());
+                    str1.insert(pos, str2.string());
+                }),
+
+                // Find and replace operations
+                ([](FuzzedDataProvider& dataProvider, android::String16 str1,
+                    android::String16) -> void {
+                    char16_t findChar = dataProvider.ConsumeIntegral<char16_t>();
+                    str1.findFirst(findChar);
+                }),
+                ([](FuzzedDataProvider& dataProvider, android::String16 str1,
+                    android::String16) -> void {
+                    char16_t findChar = dataProvider.ConsumeIntegral<char16_t>();
+                    str1.findLast(findChar);
+                }),
+                ([](FuzzedDataProvider& dataProvider, android::String16 str1,
+                    android::String16) -> void {
+                    char16_t findChar = dataProvider.ConsumeIntegral<char16_t>();
+                    char16_t replaceChar = dataProvider.ConsumeIntegral<char16_t>();
+                    str1.replaceAll(findChar, replaceChar);
+                }),
+                ([](FuzzedDataProvider& dataProvider, android::String16 str1,
+                    android::String16) -> void {
+                    size_t len = dataProvider.ConsumeIntegral<size_t>();
+                    size_t begin = dataProvider.ConsumeIntegral<size_t>();
+                    str1.remove(len, begin);
+                }),
+};
+
+void callFunc(uint8_t index, FuzzedDataProvider& dataProvider, android::String16 str1,
+              android::String16 str2) {
+    operations[index](dataProvider, str1, str2);
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    // We're generating two char vectors.
+    // First, generate lengths.
+    const size_t kVecOneLen = dataProvider.ConsumeIntegralInRange<size_t>(1, MAX_STRING_BYTES);
+    const size_t kVecTwoLen = dataProvider.ConsumeIntegralInRange<size_t>(1, MAX_STRING_BYTES);
+
+    // Next, populate the vectors
+    std::vector<char> vec = dataProvider.ConsumeBytesWithTerminator<char>(kVecOneLen);
+    std::vector<char> vec_two = dataProvider.ConsumeBytesWithTerminator<char>(kVecTwoLen);
+
+    // Get pointers to their data
+    char* char_one = vec.data();
+    char* char_two = vec_two.data();
+
+    // Create UTF16 representations
+    android::String16 str_one_utf16 = android::String16(char_one);
+    android::String16 str_two_utf16 = android::String16(char_two);
+
+    // Run operations against strings
+    int opsRun = 0;
+    while (dataProvider.remaining_bytes() > 0 && opsRun++ < MAX_OPERATIONS) {
+        uint8_t op = dataProvider.ConsumeIntegralInRange<uint8_t>(0, operations.size() - 1);
+        callFunc(op, dataProvider, str_one_utf16, str_two_utf16);
+    }
+
+    str_one_utf16.remove(0, str_one_utf16.size());
+    str_two_utf16.remove(0, str_two_utf16.size());
+    return 0;
+}
diff --git a/libutils/String16_test.cpp b/libutils/String16_test.cpp
index f1f24c3..2505f44 100644
--- a/libutils/String16_test.cpp
+++ b/libutils/String16_test.cpp
@@ -215,4 +215,16 @@
     EXPECT_TRUE(tmp.isStaticString());
 }
 
+TEST(String16Test, OverreadUtf8Conversion) {
+    char tmp[] = {'a', static_cast<char>(0xe0), '\0'};
+    String16 another(tmp);
+    EXPECT_TRUE(another.size() == 0);
+}
+
+TEST(String16Test, ValidUtf8Conversion) {
+    String16 another("abcdef");
+    EXPECT_EQ(6U, another.size());
+    EXPECT_STR16EQ(another, u"abcdef");
+}
+
 }  // namespace android
diff --git a/libutils/String8.cpp b/libutils/String8.cpp
index 9d50e0b..3dc2026 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -125,19 +125,6 @@
 {
 }
 
-String8::String8(StaticLinkage)
-    : mString(nullptr)
-{
-    // this constructor is used when we can't rely on the static-initializers
-    // having run. In this case we always allocate an empty string. It's less
-    // efficient than using getEmptyString(), but we assume it's uncommon.
-
-    char* data = static_cast<char*>(
-            SharedBuffer::alloc(sizeof(char))->data());
-    data[0] = 0;
-    mString = data;
-}
-
 String8::String8(const String8& o)
     : mString(o.mString)
 {
@@ -443,7 +430,7 @@
     char* buf = lockBuffer(len);
     buf += start;
     while (length > 0) {
-        *buf = tolower(*buf);
+        *buf = static_cast<char>(tolower(*buf));
         buf++;
         length--;
     }
@@ -467,7 +454,7 @@
     char* buf = lockBuffer(len);
     buf += start;
     while (length > 0) {
-        *buf = toupper(*buf);
+        *buf = static_cast<char>(toupper(*buf));
         buf++;
         length--;
     }
diff --git a/libutils/String8_fuzz.cpp b/libutils/String8_fuzz.cpp
new file mode 100644
index 0000000..b02683c
--- /dev/null
+++ b/libutils/String8_fuzz.cpp
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2020 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.
+ */
+#include <functional>
+#include <iostream>
+#include <memory>
+
+#include "FuzzFormatTypes.h"
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/String8.h"
+
+static constexpr int MAX_STRING_BYTES = 256;
+static constexpr uint8_t MAX_OPERATIONS = 50;
+// Interestingly, 2147483614 (INT32_MAX - 33) seems to be the max value that is handled for format
+// flags. Unfortunately we need to use a smaller value so we avoid consuming too much memory.
+
+void fuzzFormat(FuzzedDataProvider* dataProvider, android::String8* str1, bool shouldAppend);
+std::vector<std::function<void(FuzzedDataProvider*, android::String8*, android::String8*)>>
+        operations = {
+                // Bytes and size
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->bytes();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->isEmpty();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->length();
+                },
+
+                // Casing
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->toUpper();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->toLower();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8* str2) -> void {
+                    str1->removeAll(str2->c_str());
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8* str2) -> void {
+                    const android::String8& constRef(*str2);
+                    str1->compare(constRef);
+                },
+
+                // Append and format
+                [](FuzzedDataProvider*, android::String8* str1, android::String8* str2) -> void {
+                    str1->append(str2->c_str());
+                },
+                [](FuzzedDataProvider* dataProvider, android::String8* str1, android::String8*)
+                        -> void { fuzzFormat(dataProvider, str1, dataProvider->ConsumeBool()); },
+
+                // Find operation
+                [](FuzzedDataProvider* dataProvider, android::String8* str1,
+                   android::String8* str2) -> void {
+                    // We need to get a value from our fuzzer here.
+                    int start_index = dataProvider->ConsumeIntegralInRange<int>(0, str1->size());
+                    str1->find(str2->c_str(), start_index);
+                },
+
+                // Path handling
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->getBasePath();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->getPathExtension();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->getPathLeaf();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->getPathDir();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    str1->convertToResPath();
+                },
+                [](FuzzedDataProvider*, android::String8* str1, android::String8*) -> void {
+                    std::shared_ptr<android::String8> path_out_str =
+                            std::make_shared<android::String8>();
+                    str1->walkPath(path_out_str.get());
+                    path_out_str->clear();
+                },
+                [](FuzzedDataProvider* dataProvider, android::String8* str1,
+                   android::String8*) -> void {
+                    str1->setPathName(dataProvider->ConsumeBytesWithTerminator<char>(5).data());
+                },
+                [](FuzzedDataProvider* dataProvider, android::String8* str1,
+                   android::String8*) -> void {
+                    str1->appendPath(dataProvider->ConsumeBytesWithTerminator<char>(5).data());
+                },
+};
+
+void fuzzFormat(FuzzedDataProvider* dataProvider, android::String8* str1, bool shouldAppend) {
+    FormatChar formatType = dataProvider->ConsumeEnum<FormatChar>();
+
+    std::string formatString("%");
+    // Width specifier
+    if (dataProvider->ConsumeBool()) {
+        // Left pad with zeroes
+        if (dataProvider->ConsumeBool()) {
+            formatString.push_back('0');
+        }
+        // Right justify (or left justify if negative)
+        int32_t justify = dataProvider->ConsumeIntegralInRange<int32_t>(-kMaxFormatFlagValue,
+                                                                        kMaxFormatFlagValue);
+        formatString += std::to_string(justify);
+    }
+
+    // The # specifier only works with o, x, X, a, A, e, E, f, F, g, and G
+    if (canApplyFlag(formatType, '#') && dataProvider->ConsumeBool()) {
+        formatString.push_back('#');
+    }
+
+    // Precision specifier
+    if (canApplyFlag(formatType, '.') && dataProvider->ConsumeBool()) {
+        formatString.push_back('.');
+        formatString +=
+                std::to_string(dataProvider->ConsumeIntegralInRange<int>(0, kMaxFormatFlagValue));
+    }
+
+    formatString.push_back(kFormatChars.at(static_cast<uint8_t>(formatType)));
+
+    switch (formatType) {
+        case SIGNED_DECIMAL: {
+            int val = dataProvider->ConsumeIntegral<int>();
+            if (shouldAppend) {
+                str1->appendFormat(formatString.c_str(), val);
+            } else {
+                str1->format(formatString.c_str(), dataProvider->ConsumeIntegral<int>());
+            }
+            break;
+        }
+
+        case UNSIGNED_DECIMAL:
+        case UNSIGNED_OCTAL:
+        case UNSIGNED_HEX_LOWER:
+        case UNSIGNED_HEX_UPPER: {
+            // Unsigned integers for u, o, x, and X
+            uint val = dataProvider->ConsumeIntegral<uint>();
+            if (shouldAppend) {
+                str1->appendFormat(formatString.c_str(), val);
+            } else {
+                str1->format(formatString.c_str(), val);
+            }
+            break;
+        }
+
+        case FLOAT_LOWER:
+        case FLOAT_UPPER:
+        case EXPONENT_LOWER:
+        case EXPONENT_UPPER:
+        case SHORT_EXP_LOWER:
+        case SHORT_EXP_UPPER:
+        case HEX_FLOAT_LOWER:
+        case HEX_FLOAT_UPPER: {
+            // Floating points for f, F, e, E, g, G, a, and A
+            float val = dataProvider->ConsumeFloatingPoint<float>();
+            if (shouldAppend) {
+                str1->appendFormat(formatString.c_str(), val);
+            } else {
+                str1->format(formatString.c_str(), val);
+            }
+            break;
+        }
+
+        case CHAR: {
+            char val = dataProvider->ConsumeIntegral<char>();
+            if (shouldAppend) {
+                str1->appendFormat(formatString.c_str(), val);
+            } else {
+                str1->format(formatString.c_str(), val);
+            }
+            break;
+        }
+
+        case STRING: {
+            std::string val = dataProvider->ConsumeRandomLengthString(MAX_STRING_BYTES);
+            if (shouldAppend) {
+                str1->appendFormat(formatString.c_str(), val.c_str());
+            } else {
+                str1->format(formatString.c_str(), val.c_str());
+            }
+            break;
+        }
+        case POINTER: {
+            uintptr_t val = dataProvider->ConsumeIntegral<uintptr_t>();
+            if (shouldAppend) {
+                str1->appendFormat(formatString.c_str(), val);
+            } else {
+                str1->format(formatString.c_str(), val);
+            }
+            break;
+        }
+    }
+}
+
+void callFunc(uint8_t index, FuzzedDataProvider* dataProvider, android::String8* str1,
+              android::String8* str2) {
+    operations[index](dataProvider, str1, str2);
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    // Generate vector lengths
+    const size_t kVecOneLen = dataProvider.ConsumeIntegralInRange<size_t>(1, MAX_STRING_BYTES);
+    const size_t kVecTwoLen = dataProvider.ConsumeIntegralInRange<size_t>(1, MAX_STRING_BYTES);
+    // Populate vectors
+    std::vector<char> vec = dataProvider.ConsumeBytesWithTerminator<char>(kVecOneLen);
+    std::vector<char> vec_two = dataProvider.ConsumeBytesWithTerminator<char>(kVecTwoLen);
+    // Create UTF-8 pointers
+    android::String8 str_one_utf8 = android::String8(vec.data());
+    android::String8 str_two_utf8 = android::String8(vec_two.data());
+    // Run operations against strings
+    int opsRun = 0;
+    while (dataProvider.remaining_bytes() > 0 && opsRun++ < MAX_OPERATIONS) {
+        uint8_t op = dataProvider.ConsumeIntegralInRange<uint8_t>(0, operations.size() - 1);
+        operations[op](&dataProvider, &str_one_utf8, &str_two_utf8);
+    }
+    // Just to be extra sure these can be freed, we're going to explicitly clear
+    // them
+    str_one_utf8.clear();
+    str_two_utf8.clear();
+    return 0;
+}
diff --git a/libutils/String8_test.cpp b/libutils/String8_test.cpp
index 3947a5f..9efcc6f 100644
--- a/libutils/String8_test.cpp
+++ b/libutils/String8_test.cpp
@@ -96,4 +96,9 @@
     EXPECT_EQ(10U, string8.length());
 }
 
+TEST_F(String8Test, ValidUtf16Conversion) {
+    char16_t tmp[] = u"abcdef";
+    String8 valid = String8(String16(tmp));
+    EXPECT_STREQ(valid, "abcdef");
+}
 }
diff --git a/libutils/StrongPointer_test.cpp b/libutils/StrongPointer_test.cpp
index 7b2e37f..d37c1de 100644
--- a/libutils/StrongPointer_test.cpp
+++ b/libutils/StrongPointer_test.cpp
@@ -36,10 +36,8 @@
 
 TEST(StrongPointer, move) {
     bool isDeleted;
-    SPFoo* foo = new SPFoo(&isDeleted);
-    ASSERT_EQ(0, foo->getStrongCount());
-    ASSERT_FALSE(isDeleted) << "Already deleted...?";
-    sp<SPFoo> sp1(foo);
+    sp<SPFoo> sp1 = sp<SPFoo>::make(&isDeleted);
+    SPFoo* foo = sp1.get();
     ASSERT_EQ(1, foo->getStrongCount());
     {
         sp<SPFoo> sp2 = std::move(sp1);
@@ -65,7 +63,7 @@
 
 TEST(StrongPointer, PointerComparison) {
     bool isDeleted;
-    sp<SPFoo> foo = new SPFoo(&isDeleted);
+    sp<SPFoo> foo = sp<SPFoo>::make(&isDeleted);
     ASSERT_EQ(foo.get(), foo);
     ASSERT_EQ(foo, foo.get());
     ASSERT_NE(nullptr, foo);
diff --git a/libutils/SystemClock.cpp b/libutils/SystemClock.cpp
index 73ec1be..9c71141 100644
--- a/libutils/SystemClock.cpp
+++ b/libutils/SystemClock.cpp
@@ -39,8 +39,15 @@
  */
 int64_t uptimeMillis()
 {
-    int64_t when = systemTime(SYSTEM_TIME_MONOTONIC);
-    return (int64_t) nanoseconds_to_milliseconds(when);
+    return nanoseconds_to_milliseconds(uptimeNanos());
+}
+
+/*
+ * public static native long uptimeNanos();
+ */
+int64_t uptimeNanos()
+{
+    return systemTime(SYSTEM_TIME_MONOTONIC);
 }
 
 /*
diff --git a/libutils/SystemClock_test.cpp b/libutils/SystemClock_test.cpp
index 5ad060b..7449dad 100644
--- a/libutils/SystemClock_test.cpp
+++ b/libutils/SystemClock_test.cpp
@@ -29,16 +29,24 @@
 
 TEST(SystemClock, SystemClock) {
     auto startUptimeMs = android::uptimeMillis();
+    auto startUptimeNs = android::uptimeNanos();
     auto startRealtimeMs = android::elapsedRealtime();
     auto startRealtimeNs = android::elapsedRealtimeNano();
 
     ASSERT_GT(startUptimeMs, 0)
             << "uptimeMillis() reported an impossible uptime";
+    ASSERT_GT(startUptimeNs, 0)
+            << "uptimeNanos() reported an impossible uptime";
     ASSERT_GE(startRealtimeMs, startUptimeMs)
             << "elapsedRealtime() thinks we've suspended for negative time";
-    ASSERT_GE(startRealtimeNs, startUptimeMs * MS_IN_NS)
+    ASSERT_GE(startRealtimeNs, startUptimeNs)
             << "elapsedRealtimeNano() thinks we've suspended for negative time";
 
+    ASSERT_GE(startUptimeNs, startUptimeMs * MS_IN_NS)
+            << "uptimeMillis() and uptimeNanos() are inconsistent";
+    ASSERT_LT(startUptimeNs, (startUptimeMs + SLACK_MS) * MS_IN_NS)
+            << "uptimeMillis() and uptimeNanos() are inconsistent";
+
     ASSERT_GE(startRealtimeNs, startRealtimeMs * MS_IN_NS)
             << "elapsedRealtime() and elapsedRealtimeNano() are inconsistent";
     ASSERT_LT(startRealtimeNs, (startRealtimeMs + SLACK_MS) * MS_IN_NS)
@@ -51,6 +59,7 @@
     ASSERT_EQ(nanosleepErr, 0) << "nanosleep() failed: " << strerror(errno);
 
     auto endUptimeMs = android::uptimeMillis();
+    auto endUptimeNs = android::uptimeNanos();
     auto endRealtimeMs = android::elapsedRealtime();
     auto endRealtimeNs = android::elapsedRealtimeNano();
 
@@ -58,6 +67,10 @@
             << "uptimeMillis() advanced too little after nanosleep()";
     EXPECT_LT(endUptimeMs - startUptimeMs, SLEEP_MS + SLACK_MS)
             << "uptimeMillis() advanced too much after nanosleep()";
+    EXPECT_GE(endUptimeNs - startUptimeNs, SLEEP_NS)
+            << "uptimeNanos() advanced too little after nanosleep()";
+    EXPECT_LT(endUptimeNs - startUptimeNs, SLEEP_NS + SLACK_NS)
+            << "uptimeNanos() advanced too much after nanosleep()";
     EXPECT_GE(endRealtimeMs - startRealtimeMs, SLEEP_MS)
             << "elapsedRealtime() advanced too little after nanosleep()";
     EXPECT_LT(endRealtimeMs - startRealtimeMs, SLEEP_MS + SLACK_MS)
@@ -67,6 +80,11 @@
     EXPECT_LT(endRealtimeNs - startRealtimeNs, SLEEP_NS + SLACK_NS)
             << "elapsedRealtimeNano() advanced too much after nanosleep()";
 
+    EXPECT_GE(endUptimeNs, endUptimeMs * MS_IN_NS)
+            << "uptimeMillis() and uptimeNanos() are inconsistent after nanosleep()";
+    EXPECT_LT(endUptimeNs, (endUptimeMs + SLACK_MS) * MS_IN_NS)
+            << "uptimeMillis() and uptimeNanos() are inconsistent after nanosleep()";
+
     EXPECT_GE(endRealtimeNs, endRealtimeMs * MS_IN_NS)
             << "elapsedRealtime() and elapsedRealtimeNano() are inconsistent after nanosleep()";
     EXPECT_LT(endRealtimeNs, (endRealtimeMs + SLACK_MS) * MS_IN_NS)
diff --git a/libutils/Timers.cpp b/libutils/Timers.cpp
index 1172ae7..fd3f4a9 100644
--- a/libutils/Timers.cpp
+++ b/libutils/Timers.cpp
@@ -20,31 +20,37 @@
 #include <utils/Timers.h>
 
 #include <limits.h>
+#include <stdlib.h>
 #include <time.h>
 
-// host linux support requires Linux 2.6.39+
+#include <android-base/macros.h>
+
+static constexpr size_t clock_id_max = 5;
+
+static void checkClockId(int clock) {
+    if (clock < 0 || clock >= clock_id_max) abort();
+}
+
 #if defined(__linux__)
-nsecs_t systemTime(int clock)
-{
-    static const clockid_t clocks[] = {
-            CLOCK_REALTIME,
-            CLOCK_MONOTONIC,
-            CLOCK_PROCESS_CPUTIME_ID,
-            CLOCK_THREAD_CPUTIME_ID,
-            CLOCK_BOOTTIME
-    };
-    struct timespec t;
-    t.tv_sec = t.tv_nsec = 0;
+nsecs_t systemTime(int clock) {
+    checkClockId(clock);
+    static constexpr clockid_t clocks[] = {CLOCK_REALTIME, CLOCK_MONOTONIC,
+                                           CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID,
+                                           CLOCK_BOOTTIME};
+    static_assert(clock_id_max == arraysize(clocks));
+    timespec t = {};
     clock_gettime(clocks[clock], &t);
     return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec;
 }
 #else
-nsecs_t systemTime(int /*clock*/)
-{
+nsecs_t systemTime(int clock) {
+    // TODO: is this ever called with anything but REALTIME on mac/windows?
+    checkClockId(clock);
+
     // Clock support varies widely across hosts. Mac OS doesn't support
-    // CLOCK_BOOTTIME, and Windows is windows.
-    struct timeval t;
-    t.tv_sec = t.tv_usec = 0;
+    // CLOCK_BOOTTIME (and doesn't even have clock_gettime until 10.12).
+    // Windows is windows.
+    timeval t = {};
     gettimeofday(&t, nullptr);
     return nsecs_t(t.tv_sec)*1000000000LL + nsecs_t(t.tv_usec)*1000LL;
 }
diff --git a/libutils/Timers_test.cpp b/libutils/Timers_test.cpp
new file mode 100644
index 0000000..ec0051e
--- /dev/null
+++ b/libutils/Timers_test.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <utils/Timers.h>
+
+#include <gtest/gtest.h>
+
+TEST(Timers, systemTime_invalid) {
+    EXPECT_EXIT(systemTime(-1), testing::KilledBySignal(SIGABRT), "");
+    systemTime(SYSTEM_TIME_REALTIME);
+    systemTime(SYSTEM_TIME_MONOTONIC);
+    systemTime(SYSTEM_TIME_PROCESS);
+    systemTime(SYSTEM_TIME_THREAD);
+    systemTime(SYSTEM_TIME_BOOTTIME);
+    EXPECT_EXIT(systemTime(SYSTEM_TIME_BOOTTIME + 1), testing::KilledBySignal(SIGABRT), "");
+}
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp
index b08e061..843a81a 100644
--- a/libutils/Unicode.cpp
+++ b/libutils/Unicode.cpp
@@ -162,9 +162,9 @@
     if (index >= src_len) {
         return -1;
     }
-    size_t dummy_index;
+    size_t unused_index;
     if (next_index == nullptr) {
-        next_index = &dummy_index;
+        next_index = &unused_index;
     }
     size_t num_read;
     int32_t ret = utf32_at_internal(src + index, &num_read);
@@ -359,49 +359,6 @@
 // UTF-8
 // --------------------------------------------------------------------------
 
-ssize_t utf8_length(const char *src)
-{
-    const char *cur = src;
-    size_t ret = 0;
-    while (*cur != '\0') {
-        const char first_char = *cur++;
-        if ((first_char & 0x80) == 0) { // ASCII
-            ret += 1;
-            continue;
-        }
-        // (UTF-8's character must not be like 10xxxxxx,
-        //  but 110xxxxx, 1110xxxx, ... or 1111110x)
-        if ((first_char & 0x40) == 0) {
-            return -1;
-        }
-
-        int32_t mask, to_ignore_mask;
-        size_t num_to_read = 0;
-        char32_t utf32 = 0;
-        for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0x80;
-             num_to_read < 5 && (first_char & mask);
-             num_to_read++, to_ignore_mask |= mask, mask >>= 1) {
-            if ((*cur & 0xC0) != 0x80) { // must be 10xxxxxx
-                return -1;
-            }
-            // 0x3F == 00111111
-            utf32 = (utf32 << 6) + (*cur++ & 0x3F);
-        }
-        // "first_char" must be (110xxxxx - 11110xxx)
-        if (num_to_read == 5) {
-            return -1;
-        }
-        to_ignore_mask |= mask;
-        utf32 |= ((~to_ignore_mask) & first_char) << (6 * (num_to_read - 1));
-        if (utf32 > kUnicodeMaxCodepoint) {
-            return -1;
-        }
-
-        ret += num_to_read;
-    }
-    return ret;
-}
-
 ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len)
 {
     if (src == nullptr || src_len == 0) {
diff --git a/libutils/Vector_fuzz.cpp b/libutils/Vector_fuzz.cpp
new file mode 100644
index 0000000..f6df051
--- /dev/null
+++ b/libutils/Vector_fuzz.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2020 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.
+ */
+#include "fuzzer/FuzzedDataProvider.h"
+#include "utils/Vector.h"
+static constexpr uint16_t MAX_VEC_SIZE = 5000;
+
+void runVectorFuzz(const uint8_t* data, size_t size) {
+    FuzzedDataProvider dataProvider(data, size);
+    android::Vector<uint8_t> vec = android::Vector<uint8_t>();
+    // We want to test handling of sizeof as well.
+    android::Vector<uint32_t> vec32 = android::Vector<uint32_t>();
+
+    // We're going to generate two vectors of this size
+    size_t vectorSize = dataProvider.ConsumeIntegralInRange<size_t>(0, MAX_VEC_SIZE);
+    vec.setCapacity(vectorSize);
+    vec32.setCapacity(vectorSize);
+    for (size_t i = 0; i < vectorSize; i++) {
+        uint8_t count = dataProvider.ConsumeIntegralInRange<uint8_t>(1, 5);
+        vec.insertAt((uint8_t)i, i, count);
+        vec32.insertAt((uint32_t)i, i, count);
+        vec.push_front(i);
+        vec32.push(i);
+    }
+
+    // Now we'll perform some test operations with any remaining data
+    // Index to perform operations at
+    size_t index = dataProvider.ConsumeIntegralInRange<size_t>(0, vec.size());
+    std::vector<uint8_t> remainingVec = dataProvider.ConsumeRemainingBytes<uint8_t>();
+    // Insert an array and vector
+    vec.insertArrayAt(remainingVec.data(), index, remainingVec.size());
+    android::Vector<uint8_t> vecCopy = android::Vector<uint8_t>(vec);
+    vec.insertVectorAt(vecCopy, index);
+    // Same thing for 32 bit vector
+    android::Vector<uint32_t> vec32Copy = android::Vector<uint32_t>(vec32);
+    vec32.insertArrayAt(vec32Copy.array(), index, vec32.size());
+    vec32.insertVectorAt(vec32Copy, index);
+    // Replace single character
+    if (remainingVec.size() > 0) {
+        vec.replaceAt(remainingVec[0], index);
+        vec32.replaceAt(static_cast<uint32_t>(remainingVec[0]), index);
+    } else {
+        vec.replaceAt(0, index);
+        vec32.replaceAt(0, index);
+    }
+    // Add any remaining bytes
+    for (uint8_t i : remainingVec) {
+        vec.add(i);
+        vec32.add(static_cast<uint32_t>(i));
+    }
+    // Shrink capactiy
+    vec.setCapacity(remainingVec.size());
+    vec32.setCapacity(remainingVec.size());
+    // Iterate through each pointer
+    size_t sum = 0;
+    for (auto& it : vec) {
+        sum += it;
+    }
+    for (auto& it : vec32) {
+        sum += it;
+    }
+    // Cleanup
+    vec.clear();
+    vecCopy.clear();
+    vec32.clear();
+    vec32Copy.clear();
+}
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    runVectorFuzz(data, size);
+    return 0;
+}
diff --git a/libutils/include/utils/BitSet.h b/libutils/include/utils/BitSet.h
index 8abfb1a..0fb1a6a 100644
--- a/libutils/include/utils/BitSet.h
+++ b/libutils/include/utils/BitSet.h
@@ -21,9 +21,12 @@
 #include <utils/TypeHelpers.h>
 
 /*
- * Contains some bit manipulation helpers.
+ * A class to provide efficient manipulation of bitsets.
  *
- * DO NOT USE: std::bitset<32> or std::bitset<64> preferred
+ * Consider using std::bitset<32> or std::bitset<64> if all you want is a class to do basic bit
+ * manipulation (i.e. AND / OR / XOR / flip / etc). These classes are only needed if you want to
+ * efficiently perform operations like finding the first set bit in a bitset and you want to
+ * avoid using the built-in functions (e.g. __builtin_clz) on std::bitset::to_ulong.
  */
 
 namespace android {
@@ -46,7 +49,9 @@
     // Returns the number of marked bits in the set.
     inline uint32_t count() const { return count(value); }
 
-    static inline uint32_t count(uint32_t value) { return __builtin_popcountl(value); }
+    static inline uint32_t count(uint32_t value) {
+        return static_cast<uint32_t>(__builtin_popcountl(value));
+    }
 
     // Returns true if the bit set does not contain any marked bits.
     inline bool isEmpty() const { return isEmpty(value); }
@@ -128,7 +133,7 @@
     }
 
     static inline uint32_t getIndexOfBit(uint32_t value, uint32_t n) {
-        return __builtin_popcountl(value & ~(0xffffffffUL >> n));
+        return static_cast<uint32_t>(__builtin_popcountl(value & ~(0xffffffffUL >> n)));
     }
 
     inline bool operator== (const BitSet32& other) const { return value == other.value; }
@@ -153,17 +158,17 @@
     // input, which is only guaranteed to be 16b, not 32. The compiler should optimize this away.
     static inline uint32_t clz_checked(uint32_t value) {
         if (sizeof(unsigned int) == sizeof(uint32_t)) {
-            return __builtin_clz(value);
+            return static_cast<uint32_t>(__builtin_clz(value));
         } else {
-            return __builtin_clzl(value);
+            return static_cast<uint32_t>(__builtin_clzl(value));
         }
     }
 
     static inline uint32_t ctz_checked(uint32_t value) {
         if (sizeof(unsigned int) == sizeof(uint32_t)) {
-            return __builtin_ctz(value);
+            return static_cast<uint32_t>(__builtin_ctz(value));
         } else {
-            return __builtin_ctzl(value);
+            return static_cast<uint32_t>(__builtin_ctzl(value));
         }
     }
 };
@@ -188,7 +193,9 @@
     // Returns the number of marked bits in the set.
     inline uint32_t count() const { return count(value); }
 
-    static inline uint32_t count(uint64_t value) { return __builtin_popcountll(value); }
+    static inline uint32_t count(uint64_t value) {
+        return static_cast<uint32_t>(__builtin_popcountll(value));
+    }
 
     // Returns true if the bit set does not contain any marked bits.
     inline bool isEmpty() const { return isEmpty(value); }
@@ -219,26 +226,32 @@
     // Result is undefined if all bits are unmarked.
     inline uint32_t firstMarkedBit() const { return firstMarkedBit(value); }
 
-    static inline uint32_t firstMarkedBit(uint64_t value) { return __builtin_clzll(value); }
+    static inline uint32_t firstMarkedBit(uint64_t value) {
+        return static_cast<uint32_t>(__builtin_clzll(value));
+    }
 
     // Finds the first unmarked bit in the set.
     // Result is undefined if all bits are marked.
     inline uint32_t firstUnmarkedBit() const { return firstUnmarkedBit(value); }
 
-    static inline uint32_t firstUnmarkedBit(uint64_t value) { return __builtin_clzll(~ value); }
+    static inline uint32_t firstUnmarkedBit(uint64_t value) {
+        return static_cast<uint32_t>(__builtin_clzll(~value));
+    }
 
     // Finds the last marked bit in the set.
     // Result is undefined if all bits are unmarked.
     inline uint32_t lastMarkedBit() const { return lastMarkedBit(value); }
 
-    static inline uint32_t lastMarkedBit(uint64_t value) { return 63 - __builtin_ctzll(value); }
+    static inline uint32_t lastMarkedBit(uint64_t value) {
+        return static_cast<uint32_t>(63 - __builtin_ctzll(value));
+    }
 
     // Finds the first marked bit in the set and clears it.  Returns the bit index.
     // Result is undefined if all bits are unmarked.
     inline uint32_t clearFirstMarkedBit() { return clearFirstMarkedBit(value); }
 
     static inline uint32_t clearFirstMarkedBit(uint64_t& value) {
-        uint64_t n = firstMarkedBit(value);
+        uint32_t n = firstMarkedBit(value);
         clearBit(value, n);
         return n;
     }
@@ -248,7 +261,7 @@
     inline uint32_t markFirstUnmarkedBit() { return markFirstUnmarkedBit(value); }
 
     static inline uint32_t markFirstUnmarkedBit(uint64_t& value) {
-        uint64_t n = firstUnmarkedBit(value);
+        uint32_t n = firstUnmarkedBit(value);
         markBit(value, n);
         return n;
     }
@@ -258,7 +271,7 @@
     inline uint32_t clearLastMarkedBit() { return clearLastMarkedBit(value); }
 
     static inline uint32_t clearLastMarkedBit(uint64_t& value) {
-        uint64_t n = lastMarkedBit(value);
+        uint32_t n = lastMarkedBit(value);
         clearBit(value, n);
         return n;
     }
@@ -268,7 +281,7 @@
     inline uint32_t getIndexOfBit(uint32_t n) const { return getIndexOfBit(value, n); }
 
     static inline uint32_t getIndexOfBit(uint64_t value, uint32_t n) {
-        return __builtin_popcountll(value & ~(0xffffffffffffffffULL >> n));
+        return static_cast<uint32_t>(__builtin_popcountll(value & ~(0xffffffffffffffffULL >> n)));
     }
 
     inline bool operator== (const BitSet64& other) const { return value == other.value; }
diff --git a/libutils/include/utils/Debug.h b/libutils/include/utils/Debug.h
index 96bd70e..c3b9026 100644
--- a/libutils/include/utils/Debug.h
+++ b/libutils/include/utils/Debug.h
@@ -14,27 +14,9 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_UTILS_DEBUG_H
-#define ANDROID_UTILS_DEBUG_H
+#pragma once
 
-#include <stdint.h>
-#include <sys/types.h>
+// Note: new code should use static_assert directly.
 
-namespace android {
-// ---------------------------------------------------------------------------
-
-#ifdef __cplusplus
-template<bool> struct CompileTimeAssert;
-template<> struct CompileTimeAssert<true> {};
-#define COMPILE_TIME_ASSERT(_exp) \
-    template class CompileTimeAssert< (_exp) >;
-#endif
-
-// DO NOT USE: Please use static_assert instead
-#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \
-    CompileTimeAssert<( _exp )>();
-
-// ---------------------------------------------------------------------------
-}  // namespace android
-
-#endif // ANDROID_UTILS_DEBUG_H
+#define COMPILE_TIME_ASSERT static_assert
+#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE static_assert
diff --git a/libutils/include/utils/Flattenable.h b/libutils/include/utils/Flattenable.h
index 17c5e10..8aa381a 100644
--- a/libutils/include/utils/Flattenable.h
+++ b/libutils/include/utils/Flattenable.h
@@ -14,8 +14,7 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_UTILS_FLATTENABLE_H
-#define ANDROID_UTILS_FLATTENABLE_H
+#pragma once
 
 // DO NOT USE: please use parcelable instead
 // This code is deprecated and will not be supported via AIDL code gen. For data
@@ -25,7 +24,6 @@
 #include <string.h>
 #include <sys/types.h>
 #include <utils/Errors.h>
-#include <utils/Debug.h>
 
 #include <type_traits>
 
@@ -217,5 +215,3 @@
 };
 
 }  // namespace android
-
-#endif /* ANDROID_UTILS_FLATTENABLE_H */
diff --git a/libutils/include/utils/Looper.h b/libutils/include/utils/Looper.h
index c439c5c..466fbb7 100644
--- a/libutils/include/utils/Looper.h
+++ b/libutils/include/utils/Looper.h
@@ -26,6 +26,8 @@
 
 #include <android-base/unique_fd.h>
 
+#include <utility>
+
 namespace android {
 
 /*
@@ -438,9 +440,8 @@
     struct MessageEnvelope {
         MessageEnvelope() : uptime(0) { }
 
-        MessageEnvelope(nsecs_t u, const sp<MessageHandler> h,
-                const Message& m) : uptime(u), handler(h), message(m) {
-        }
+        MessageEnvelope(nsecs_t u, sp<MessageHandler> h, const Message& m)
+            : uptime(u), handler(std::move(h)), message(m) {}
 
         nsecs_t uptime;
         sp<MessageHandler> handler;
diff --git a/libutils/include/utils/PropertyMap.h b/libutils/include/utils/PropertyMap.h
deleted file mode 100644
index a9e674f..0000000
--- a/libutils/include/utils/PropertyMap.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef _UTILS_PROPERTY_MAP_H
-#define _UTILS_PROPERTY_MAP_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-#include <utils/Errors.h>
-#include <utils/Tokenizer.h>
-
-namespace android {
-
-/*
- * Provides a mechanism for passing around string-based property key / value pairs
- * and loading them from property files.
- *
- * The property files have the following simple structure:
- *
- * # Comment
- * key = value
- *
- * Keys and values are any sequence of printable ASCII characters.
- * The '=' separates the key from the value.
- * The key and value may not contain whitespace.
- *
- * The '\' character is reserved for escape sequences and is not currently supported.
- * The '"" character is reserved for quoting and is not currently supported.
- * Files that contain the '\' or '"' character will fail to parse.
- *
- * The file must not contain duplicate keys.
- *
- * TODO Support escape sequences and quoted values when needed.
- */
-class PropertyMap {
-public:
-    /* Creates an empty property map. */
-    PropertyMap();
-    ~PropertyMap();
-
-    /* Clears the property map. */
-    void clear();
-
-    /* Adds a property.
-     * Replaces the property with the same key if it is already present.
-     */
-    void addProperty(const String8& key, const String8& value);
-
-    /* Returns true if the property map contains the specified key. */
-    bool hasProperty(const String8& key) const;
-
-    /* Gets the value of a property and parses it.
-     * Returns true and sets outValue if the key was found and its value was parsed successfully.
-     * Otherwise returns false and does not modify outValue.  (Also logs a warning.)
-     */
-    bool tryGetProperty(const String8& key, String8& outValue) const;
-    bool tryGetProperty(const String8& key, bool& outValue) const;
-    bool tryGetProperty(const String8& key, int32_t& outValue) const;
-    bool tryGetProperty(const String8& key, float& outValue) const;
-
-    /* Adds all values from the specified property map. */
-    void addAll(const PropertyMap* map);
-
-    /* Gets the underlying property map. */
-    inline const KeyedVector<String8, String8>& getProperties() const { return mProperties; }
-
-    /* Loads a property map from a file. */
-    static status_t load(const String8& filename, PropertyMap** outMap);
-
-private:
-    class Parser {
-        PropertyMap* mMap;
-        Tokenizer* mTokenizer;
-
-    public:
-        Parser(PropertyMap* map, Tokenizer* tokenizer);
-        ~Parser();
-        status_t parse();
-
-    private:
-        status_t parseType();
-        status_t parseKey();
-        status_t parseKeyProperty();
-        status_t parseModifier(const String8& token, int32_t* outMetaState);
-        status_t parseCharacterLiteral(char16_t* outCharacter);
-    };
-
-    KeyedVector<String8, String8> mProperties;
-};
-
-} // namespace android
-
-#endif // _UTILS_PROPERTY_MAP_H
diff --git a/libutils/include/utils/RefBase.h b/libutils/include/utils/RefBase.h
index 89f048d..e7acd17 100644
--- a/libutils/include/utils/RefBase.h
+++ b/libutils/include/utils/RefBase.h
@@ -297,6 +297,11 @@
     }
 
 protected:
+    // When constructing these objects, prefer using sp::make<>. Using a RefBase
+    // object on the stack or with other refcount mechanisms (e.g.
+    // std::shared_ptr) is inherently wrong. RefBase types have an implicit
+    // ownership model and cannot be safely used with other ownership models.
+
                             RefBase();
     virtual                 ~RefBase();
     
diff --git a/libutils/include/utils/String16.h b/libutils/include/utils/String16.h
index c0e3f1e..1a4b47e 100644
--- a/libutils/include/utils/String16.h
+++ b/libutils/include/utils/String16.h
@@ -39,17 +39,7 @@
 class String16
 {
 public:
-    /*
-     * Use String16(StaticLinkage) if you're statically linking against
-     * libutils and declaring an empty static String16, e.g.:
-     *
-     *   static String16 sAStaticEmptyString(String16::kEmptyString);
-     *   static String16 sAnotherStaticEmptyString(sAStaticEmptyString);
-     */
-    enum StaticLinkage { kEmptyString };
-
                                 String16();
-    explicit                    String16(StaticLinkage);
                                 String16(const String16& o);
                                 String16(const String16& o,
                                          size_t len,
@@ -197,7 +187,7 @@
 ANDROID_TRIVIAL_MOVE_TRAIT(String16)
 
 static inline std::ostream& operator<<(std::ostream& os, const String16& str) {
-    os << String8(str).c_str();
+    os << String8(str);
     return os;
 }
 
diff --git a/libutils/include/utils/String8.h b/libutils/include/utils/String8.h
index 0ddcbb2..0bcb716 100644
--- a/libutils/include/utils/String8.h
+++ b/libutils/include/utils/String8.h
@@ -17,7 +17,8 @@
 #ifndef ANDROID_STRING8_H
 #define ANDROID_STRING8_H
 
-#include <string> // for std::string
+#include <iostream>
+#include <string>
 
 #include <utils/Errors.h>
 #include <utils/Unicode.h>
@@ -39,16 +40,7 @@
 class String8
 {
 public:
-    /* use String8(StaticLinkage) if you're statically linking against
-     * libutils and declaring an empty static String8, e.g.:
-     *
-     *   static String8 sAStaticEmptyString(String8::kEmptyString);
-     *   static String8 sAnotherStaticEmptyString(sAStaticEmptyString);
-     */
-    enum StaticLinkage { kEmptyString };
-
                                 String8();
-    explicit                    String8(StaticLinkage);
                                 String8(const String8& o);
     explicit                    String8(const char* o);
     explicit                    String8(const char* o, size_t numChars);
@@ -241,6 +233,11 @@
 // require any change to the underlying SharedBuffer contents or reference count.
 ANDROID_TRIVIAL_MOVE_TRAIT(String8)
 
+static inline std::ostream& operator<<(std::ostream& os, const String8& str) {
+    os << str.c_str();
+    return os;
+}
+
 // ---------------------------------------------------------------------------
 // No user servicable parts below.
 
diff --git a/libutils/include/utils/StrongPointer.h b/libutils/include/utils/StrongPointer.h
index 6f4fb47..11128f2 100644
--- a/libutils/include/utils/StrongPointer.h
+++ b/libutils/include/utils/StrongPointer.h
@@ -32,6 +32,12 @@
 public:
     inline sp() : m_ptr(nullptr) { }
 
+    // TODO: switch everyone to using this over new, and make RefBase operator
+    // new private to that class so that we can avoid RefBase being used with
+    // other memory management mechanisms.
+    template <typename... Args>
+    static inline sp<T> make(Args&&... args);
+
     sp(T* other);  // NOLINT(implicit)
     sp(const sp<T>& other);
     sp(sp<T>&& other) noexcept;
@@ -160,9 +166,6 @@
 // It does not appear safe to broaden this check to include adjacent pages; apparently this code
 // is used in environments where there may not be a guard page below (at higher addresses than)
 // the bottom of the stack.
-//
-// TODO: Consider adding make_sp<T>() to allocate an object and wrap the resulting pointer safely
-// without checking overhead.
 template <typename T>
 void sp<T>::check_not_on_stack(const void* ptr) {
     static constexpr int MIN_PAGE_SIZE = 0x1000;  // 4K. Safer than including sys/user.h.
@@ -174,6 +177,18 @@
     }
 }
 
+// TODO: Ideally we should find a way to increment the reference count before running the
+// constructor, so that generating an sp<> to this in the constructor is no longer dangerous.
+template <typename T>
+template <typename... Args>
+sp<T> sp<T>::make(Args&&... args) {
+    T* t = new T(std::forward<Args>(args)...);
+    sp<T> result;
+    result.m_ptr = t;
+    t->incStrong(t);  // bypass check_not_on_stack for heap allocation
+    return result;
+}
+
 template<typename T>
 sp<T>::sp(T* other)
         : m_ptr(other) {
diff --git a/libutils/include/utils/SystemClock.h b/libutils/include/utils/SystemClock.h
index f816fba..892104c 100644
--- a/libutils/include/utils/SystemClock.h
+++ b/libutils/include/utils/SystemClock.h
@@ -23,6 +23,7 @@
 namespace android {
 
 int64_t uptimeMillis();
+int64_t uptimeNanos();
 int64_t elapsedRealtime();
 int64_t elapsedRealtimeNano();
 
diff --git a/libutils/include/utils/Timers.h b/libutils/include/utils/Timers.h
index 54ec474..197fc26 100644
--- a/libutils/include/utils/Timers.h
+++ b/libutils/include/utils/Timers.h
@@ -14,11 +14,7 @@
  * limitations under the License.
  */
 
-//
-// Timer functions.
-//
-#ifndef _LIBS_UTILS_TIMERS_H
-#define _LIBS_UTILS_TIMERS_H
+#pragma once
 
 #include <stdint.h>
 #include <sys/types.h>
@@ -77,11 +73,11 @@
 static CONSTEXPR inline nsecs_t microseconds(nsecs_t v) { return us2ns(v); }
 
 enum {
-    SYSTEM_TIME_REALTIME = 0,  // system-wide realtime clock
-    SYSTEM_TIME_MONOTONIC = 1, // monotonic time since unspecified starting point
-    SYSTEM_TIME_PROCESS = 2,   // high-resolution per-process clock
-    SYSTEM_TIME_THREAD = 3,    // high-resolution per-thread clock
-    SYSTEM_TIME_BOOTTIME = 4   // same as SYSTEM_TIME_MONOTONIC, but including CPU suspend time
+    SYSTEM_TIME_REALTIME = 0,   // system-wide realtime clock
+    SYSTEM_TIME_MONOTONIC = 1,  // monotonic time since unspecified starting point
+    SYSTEM_TIME_PROCESS = 2,    // high-resolution per-process clock
+    SYSTEM_TIME_THREAD = 3,     // high-resolution per-thread clock
+    SYSTEM_TIME_BOOTTIME = 4,   // same as SYSTEM_TIME_MONOTONIC, but including CPU suspend time
 };
 
 // return the system-time according to the specified clock
@@ -104,5 +100,3 @@
 #ifdef __cplusplus
 } // extern "C"
 #endif
-
-#endif // _LIBS_UTILS_TIMERS_H
diff --git a/libutils/include/utils/Unicode.h b/libutils/include/utils/Unicode.h
index fc6712d..0087383 100644
--- a/libutils/include/utils/Unicode.h
+++ b/libutils/include/utils/Unicode.h
@@ -111,24 +111,6 @@
 void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst, size_t dst_len);
 
 /**
- * Returns the length of "src" when "src" is valid UTF-8 string.
- * Returns 0 if src is NULL or 0-length string. Returns -1 when the source
- * is an invalid string.
- *
- * This function should be used to determine whether "src" is valid UTF-8
- * characters with valid unicode codepoints. "src" must be nul-terminated.
- *
- * If you are going to use other utf8_to_... functions defined in this header
- * with string which may not be valid UTF-8 with valid codepoint (form 0 to
- * 0x10FFFF), you should use this function before calling others, since the
- * other functions do not check whether the string is valid UTF-8 or not.
- *
- * If you do not care whether "src" is valid UTF-8 or not, you should use
- * strlen() as usual, which should be much faster.
- */
-ssize_t utf8_length(const char *src);
-
-/**
  * Returns the UTF-16 length of UTF-8 string "src". Returns -1 in case
  * it's invalid utf8. No buffer over-read occurs because of bound checks. Using overreadIsFatal you
  * can ask to log a message and fail in case the invalid utf8 could have caused an override if no
diff --git a/libutils/include/utils/Vector.h b/libutils/include/utils/Vector.h
index ddf71de..be35ea2 100644
--- a/libutils/include/utils/Vector.h
+++ b/libutils/include/utils/Vector.h
@@ -23,15 +23,13 @@
 #include <log/log.h>
 #include <utils/TypeHelpers.h>
 #include <utils/VectorImpl.h>
-
-/*
- * Used to blacklist some functions from CFI.
- *
- */
 #ifndef __has_attribute
 #define __has_attribute(x) 0
 #endif
 
+/*
+ * Used to exclude some functions from CFI.
+ */
 #if __has_attribute(no_sanitize)
 #define UTILS_VECTOR_NO_CFI __attribute__((no_sanitize("cfi")))
 #else
diff --git a/libvndksupport/Android.bp b/libvndksupport/Android.bp
index b92c76c..a5cece4 100644
--- a/libvndksupport/Android.bp
+++ b/libvndksupport/Android.bp
@@ -1,6 +1,7 @@
 cc_library {
     name: "libvndksupport",
     native_bridge_supported: true,
+    llndk_stubs: "libvndksupport.llndk",
     srcs: ["linker.cpp"],
     cflags: [
         "-Wall",
@@ -20,7 +21,7 @@
 }
 
 llndk_library {
-    name: "libvndksupport",
+    name: "libvndksupport.llndk",
     native_bridge_supported: true,
     symbol_file: "libvndksupport.map.txt",
     export_include_dirs: ["include"],
diff --git a/libziparchive/.clang-format b/libziparchive/.clang-format
deleted file mode 120000
index fd0645f..0000000
--- a/libziparchive/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-2
\ No newline at end of file
diff --git a/libziparchive/Android.bp b/libziparchive/Android.bp
deleted file mode 100644
index 553136a..0000000
--- a/libziparchive/Android.bp
+++ /dev/null
@@ -1,218 +0,0 @@
-//
-// Copyright (C) 2013 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.
-
-cc_defaults {
-    name: "libziparchive_flags",
-    cflags: [
-        // ZLIB_CONST turns on const for input buffers, which is pretty standard.
-        "-DZLIB_CONST",
-        "-Werror",
-        "-Wall",
-        "-D_FILE_OFFSET_BITS=64",
-    ],
-    cppflags: [
-        // Incorrectly warns when C++11 empty brace {} initializer is used.
-        // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489
-        "-Wno-missing-field-initializers",
-        "-Wconversion",
-        "-Wno-sign-conversion",
-    ],
-
-    // Enable -Wold-style-cast only for non-Windows targets.  _islower_l,
-    // _isupper_l etc. in MinGW locale_win32.h (included from
-    // libcxx/include/__locale) has an old-style-cast.
-    target: {
-        not_windows: {
-            cppflags: [
-                "-Wold-style-cast",
-            ],
-        },
-    },
-    sanitize: {
-        misc_undefined: [
-            "signed-integer-overflow",
-            "unsigned-integer-overflow",
-            "shift",
-            "integer-divide-by-zero",
-            "implicit-signed-integer-truncation",
-            // TODO: Fix crash when we enable this option
-            // "implicit-unsigned-integer-truncation",
-            // TODO: not tested yet.
-            // "implicit-integer-sign-change",
-        ],
-    },
-}
-
-cc_defaults {
-    name: "libziparchive_defaults",
-    srcs: [
-        "zip_archive.cc",
-        "zip_archive_stream_entry.cc",
-        "zip_writer.cc",
-    ],
-
-    target: {
-        windows: {
-            cflags: ["-mno-ms-bitfields"],
-
-            enabled: true,
-        },
-    },
-
-    shared_libs: [
-        "libbase",
-        "liblog",
-    ],
-
-    // for FRIEND_TEST
-    static_libs: ["libgtest_prod"],
-    export_static_lib_headers: ["libgtest_prod"],
-
-    export_include_dirs: ["include"],
-}
-
-cc_library {
-    name: "libziparchive",
-    host_supported: true,
-    vendor_available: true,
-    recovery_available: true,
-    native_bridge_supported: true,
-    vndk: {
-        enabled: true,
-    },
-    double_loadable: true,
-    export_shared_lib_headers: ["libbase"],
-
-    defaults: [
-        "libziparchive_defaults",
-        "libziparchive_flags",
-    ],
-    shared_libs: [
-        "liblog",
-        "libbase",
-        "libz",
-    ],
-    target: {
-        linux_bionic: {
-            enabled: true,
-        },
-    },
-
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.art.debug",
-        "com.android.art.release",
-    ],
-}
-
-// Tests.
-cc_test {
-    name: "ziparchive-tests",
-    host_supported: true,
-    defaults: ["libziparchive_flags"],
-
-    data: [
-        "testdata/**/*",
-    ],
-
-    srcs: [
-        "entry_name_utils_test.cc",
-        "zip_archive_test.cc",
-        "zip_writer_test.cc",
-    ],
-    shared_libs: [
-        "libbase",
-        "liblog",
-    ],
-
-    static_libs: [
-        "libziparchive",
-        "libz",
-        "libutils",
-    ],
-
-    target: {
-        host: {
-            cppflags: ["-Wno-unnamed-type-template-args"],
-        },
-        windows: {
-            enabled: true,
-        },
-    },
-    test_suites: ["device-tests"],
-}
-
-// Performance benchmarks.
-cc_benchmark {
-    name: "ziparchive-benchmarks",
-    defaults: ["libziparchive_flags"],
-
-    srcs: [
-        "zip_archive_benchmark.cpp",
-    ],
-    shared_libs: [
-        "libbase",
-        "liblog",
-    ],
-
-    static_libs: [
-        "libziparchive",
-        "libz",
-        "libutils",
-    ],
-
-    target: {
-        host: {
-            cppflags: ["-Wno-unnamed-type-template-args"],
-        },
-    },
-}
-
-cc_binary {
-    name: "ziptool",
-    defaults: ["libziparchive_flags"],
-    srcs: ["ziptool.cpp"],
-    shared_libs: [
-        "libbase",
-        "libziparchive",
-    ],
-    recovery_available: true,
-    host_supported: true,
-    target: {
-        android: {
-            symlinks: ["unzip", "zipinfo"],
-        },
-    },
-}
-
-cc_fuzz {
-    name: "libziparchive_fuzzer",
-    srcs: ["libziparchive_fuzzer.cpp"],
-    static_libs: ["libziparchive", "libbase", "libz", "liblog"],
-    host_supported: true,
-    corpus: ["testdata/*"],
-}
-
-sh_test {
-    name: "ziptool-tests",
-    src: "run-ziptool-tests-on-android.sh",
-    filename: "run-ziptool-tests-on-android.sh",
-    test_suites: ["general-tests"],
-    host_supported: true,
-    device_supported: false,
-    test_config: "ziptool-tests.xml",
-    data: ["cli-tests/**/*"],
-    target_required: ["cli-test", "ziptool"],
-}
diff --git a/libziparchive/OWNERS b/libziparchive/OWNERS
deleted file mode 100644
index fcc567a..0000000
--- a/libziparchive/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-narayan@google.com
diff --git a/libziparchive/cli-tests/files/example.zip b/libziparchive/cli-tests/files/example.zip
deleted file mode 100644
index c3292e9..0000000
--- a/libziparchive/cli-tests/files/example.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/cli-tests/unzip.test b/libziparchive/cli-tests/unzip.test
deleted file mode 100755
index 6e5cbf2..0000000
--- a/libziparchive/cli-tests/unzip.test
+++ /dev/null
@@ -1,148 +0,0 @@
-# unzip tests.
-
-# Note: since "master key", Android uses libziparchive for all zip file
-# handling, and that scans the whole central directory immediately. Not only
-# lookups by name but also iteration is implemented using the resulting hash
-# table, meaning that any test that makes assumptions about iteration order
-# will fail on Android.
-
-name: unzip -l
-command: unzip -l $FILES/example.zip d1/d2/x.txt
-after: [ ! -f d1/d2/x.txt ]
-expected-stdout:
-	Archive:  $FILES/example.zip
-	  Length      Date    Time    Name
-	---------  ---------- -----   ----
-	     1024  2017-06-04 08:45   d1/d2/x.txt
-	---------                     -------
-	     1024                     1 file
----
-
-name: unzip -lq
-command: unzip -lq $FILES/example.zip d1/d2/x.txt
-after: [ ! -f d1/d2/x.txt ]
-expected-stdout:
-	  Length      Date    Time    Name
-	---------  ---------- -----   ----
-	     1024  2017-06-04 08:45   d1/d2/x.txt
-	---------                     -------
-	     1024                     1 file
----
-
-name: unzip -lv
-command: unzip -lv $FILES/example.zip d1/d2/x.txt
-after: [ ! -f d1/d2/file ]
-expected-stdout:
-	Archive:  $FILES/example.zip
-	 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
-	--------  ------  ------- ---- ---------- ----- --------  ----
-	    1024  Defl:N       11  99% 2017-06-04 08:45 48d7f063  d1/d2/x.txt
-	--------          -------  ---                            -------
-	    1024               11  99%                            1 file
----
-
-name: unzip -v
-command: unzip -v $FILES/example.zip d1/d2/x.txt
-after: [ ! -f d1/d2/file ]
-expected-stdout:
-	Archive:  $FILES/example.zip
-	 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
-	--------  ------  ------- ---- ---------- ----- --------  ----
-	    1024  Defl:N       11  99% 2017-06-04 08:45 48d7f063  d1/d2/x.txt
-	--------          -------  ---                            -------
-	    1024               11  99%                            1 file
----
-
-name: unzip one file
-command: unzip -q $FILES/example.zip d1/d2/a.txt && cat d1/d2/a.txt
-after: [ ! -f d1/d2/b.txt ]
-expected-stdout:
-	a
----
-
-name: unzip all files
-command: unzip -q $FILES/example.zip
-after: [ -f d1/d2/a.txt ]
-after: [ -f d1/d2/b.txt ]
-after: [ -f d1/d2/c.txt ]
-after: [ -f d1/d2/empty.txt ]
-after: [ -f d1/d2/x.txt ]
-after: [ -d d1/d2/dir ]
-expected-stdout:
----
-
-name: unzip -o
-before: mkdir -p d1/d2
-before: echo b > d1/d2/a.txt
-command: unzip -q -o $FILES/example.zip d1/d2/a.txt && cat d1/d2/a.txt
-expected-stdout:
-	a
----
-
-name: unzip -n
-before: mkdir -p d1/d2
-before: echo b > d1/d2/a.txt
-command: unzip -q -n $FILES/example.zip d1/d2/a.txt && cat d1/d2/a.txt
-expected-stdout:
-	b
----
-
-# The reference implementation will create *one* level of missing directories,
-# so this succeeds.
-name: unzip -d shallow non-existent
-command: unzip -q -d will-be-created $FILES/example.zip d1/d2/a.txt
-after: [ -d will-be-created ]
-after: [ -f will-be-created/d1/d2/a.txt ]
----
-
-# The reference implementation will *only* create one level of missing
-# directories, so this fails.
-name: unzip -d deep non-existent
-command: unzip -q -d oh-no/will-not-be-created $FILES/example.zip d1/d2/a.txt 2> stderr ; echo $? > status
-after: [ ! -d oh-no ]
-after: [ ! -d oh-no/will-not-be-created ]
-after: [ ! -f oh-no/will-not-be-created/d1/d2/a.txt ]
-after: grep -q "oh-no/will-not-be-created" stderr
-after: grep -q "No such file or directory" stderr
-# The reference implementation has *lots* of non-zero exit values, but we stick to 0 and 1.
-after: [ $(cat status) -gt 0 ]
----
-
-name: unzip -d exists
-before: mkdir dir
-command: unzip -q -d dir $FILES/example.zip d1/d2/a.txt && cat dir/d1/d2/a.txt
-after: [ ! -f d1/d2/a.txt ]
-expected-stdout:
-	a
----
-
-name: unzip -p
-command: unzip -p $FILES/example.zip d1/d2/a.txt
-after: [ ! -f d1/d2/a.txt ]
-expected-stdout:
-	a
----
-
-name: unzip -x FILE...
-# Note: the RI ignores -x DIR for some reason, but it's not obvious we should.
-command: unzip -q $FILES/example.zip -x d1/d2/a.txt d1/d2/b.txt d1/d2/empty.txt d1/d2/x.txt && cat d1/d2/c.txt
-after: [ ! -f d1/d2/a.txt ]
-after: [ ! -f d1/d2/b.txt ]
-after: [ ! -f d1/d2/empty.txt ]
-after: [ ! -f d1/d2/x.txt ]
-after: [ -d d1/d2/dir ]
-expected-stdout:
-	ccc
----
-
-name: unzip FILE -x FILE...
-command: unzip -q $FILES/example.zip d1/d2/a.txt d1/d2/b.txt -x d1/d2/a.txt && cat d1/d2/b.txt
-after: [ ! -f d1/d2/a.txt ]
-after: [ -f d1/d2/b.txt ]
-after: [ ! -f d1/d2/c.txt ]
-after: [ ! -f d1/d2/empty.txt ]
-after: [ ! -f d1/d2/x.txt ]
-after: [ ! -d d1/d2/dir ]
-expected-stdout:
-	bb
----
diff --git a/libziparchive/cli-tests/zipinfo.test b/libziparchive/cli-tests/zipinfo.test
deleted file mode 100755
index d5bce1c..0000000
--- a/libziparchive/cli-tests/zipinfo.test
+++ /dev/null
@@ -1,53 +0,0 @@
-# zipinfo tests.
-
-# Note: since "master key", Android uses libziparchive for all zip file
-# handling, and that scans the whole central directory immediately. Not only
-# lookups by name but also iteration is implemented using the resulting hash
-# table, meaning that any test that makes assumptions about iteration order
-# will fail on Android.
-
-name: zipinfo -1
-command: zipinfo -1 $FILES/example.zip | sort
-expected-stdout:
-	d1/
-	d1/d2/a.txt
-	d1/d2/b.txt
-	d1/d2/c.txt
-	d1/d2/dir/
-	d1/d2/empty.txt
-	d1/d2/x.txt
----
-
-name: zipinfo header
-command: zipinfo $FILES/example.zip | head -2
-expected-stdout:
-	Archive:  $FILES/example.zip
-	Zip file size: 1082 bytes, number of entries: 7
----
-
-name: zipinfo footer
-command: zipinfo $FILES/example.zip | tail -1
-expected-stdout:
-	7 files, 1033 bytes uncompressed, 20 bytes compressed:  98.1%
----
-
-name: zipinfo directory
-# The RI doesn't use ISO dates.
-command: zipinfo $FILES/example.zip d1/ | sed s/17-Jun-/2017-06-/
-expected-stdout:
-	drwxr-x---  3.0 unx        0 bx stor 2017-06-04 08:40 d1/
----
-
-name: zipinfo stored
-# The RI doesn't use ISO dates.
-command: zipinfo $FILES/example.zip d1/d2/empty.txt | sed s/17-Jun-/2017-06-/
-expected-stdout:
-	-rw-r-----  3.0 unx        0 bx stor 2017-06-04 08:43 d1/d2/empty.txt
----
-
-name: zipinfo deflated
-# The RI doesn't use ISO dates.
-command: zipinfo $FILES/example.zip d1/d2/x.txt | sed s/17-Jun-/2017-06-/
-expected-stdout:
-	-rw-r-----  3.0 unx     1024 tx defN 2017-06-04 08:45 d1/d2/x.txt
----
diff --git a/libziparchive/entry_name_utils-inl.h b/libziparchive/entry_name_utils-inl.h
deleted file mode 100644
index 10311b5..0000000
--- a/libziparchive/entry_name_utils-inl.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef LIBZIPARCHIVE_ENTRY_NAME_UTILS_INL_H_
-#define LIBZIPARCHIVE_ENTRY_NAME_UTILS_INL_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <limits>
-
-// Check if |length| bytes at |entry_name| constitute a valid entry name.
-// Entry names must be valid UTF-8 and must not contain '0'. They also must
-// fit into the central directory record.
-inline bool IsValidEntryName(const uint8_t* entry_name, const size_t length) {
-  if (length > std::numeric_limits<uint16_t>::max()) {
-    return false;
-  }
-  for (size_t i = 0; i < length; ++i) {
-    const uint8_t byte = entry_name[i];
-    if (byte == 0) {
-      return false;
-    } else if ((byte & 0x80) == 0) {
-      // Single byte sequence.
-      continue;
-    } else if ((byte & 0xc0) == 0x80 || (byte & 0xfe) == 0xfe) {
-      // Invalid sequence.
-      return false;
-    } else {
-      // 2-5 byte sequences.
-      for (uint8_t first = static_cast<uint8_t>((byte & 0x7f) << 1); first & 0x80;
-           first = static_cast<uint8_t>((first & 0x7f) << 1)) {
-        ++i;
-
-        // Missing continuation byte..
-        if (i == length) {
-          return false;
-        }
-
-        // Invalid continuation byte.
-        const uint8_t continuation_byte = entry_name[i];
-        if ((continuation_byte & 0xc0) != 0x80) {
-          return false;
-        }
-      }
-    }
-  }
-
-  return true;
-}
-
-#endif  // LIBZIPARCHIVE_ENTRY_NAME_UTILS_INL_H_
diff --git a/libziparchive/entry_name_utils_test.cc b/libziparchive/entry_name_utils_test.cc
deleted file mode 100644
index d83d854..0000000
--- a/libziparchive/entry_name_utils_test.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include "entry_name_utils-inl.h"
-
-#include <gtest/gtest.h>
-
-TEST(entry_name_utils, NullChars) {
-  // 'A', 'R', '\0', 'S', 'E'
-  const uint8_t zeroes[] = {0x41, 0x52, 0x00, 0x53, 0x45};
-  ASSERT_FALSE(IsValidEntryName(zeroes, sizeof(zeroes)));
-
-  const uint8_t zeroes_continuation_chars[] = {0xc2, 0xa1, 0xc2, 0x00};
-  ASSERT_FALSE(IsValidEntryName(zeroes_continuation_chars, sizeof(zeroes_continuation_chars)));
-}
-
-TEST(entry_name_utils, InvalidSequence) {
-  // 0xfe is an invalid start byte
-  const uint8_t invalid[] = {0x41, 0xfe};
-  ASSERT_FALSE(IsValidEntryName(invalid, sizeof(invalid)));
-
-  // 0x91 is an invalid start byte (it's a valid continuation byte).
-  const uint8_t invalid2[] = {0x41, 0x91};
-  ASSERT_FALSE(IsValidEntryName(invalid2, sizeof(invalid2)));
-}
-
-TEST(entry_name_utils, TruncatedContinuation) {
-  // Malayalam script with truncated bytes. There should be 2 bytes
-  // after 0xe0
-  const uint8_t truncated[] = {0xe0, 0xb4, 0x85, 0xe0, 0xb4};
-  ASSERT_FALSE(IsValidEntryName(truncated, sizeof(truncated)));
-
-  // 0xc2 is the start of a 2 byte sequence that we've subsequently
-  // dropped.
-  const uint8_t truncated2[] = {0xc2, 0xc2, 0xa1};
-  ASSERT_FALSE(IsValidEntryName(truncated2, sizeof(truncated2)));
-}
-
-TEST(entry_name_utils, BadContinuation) {
-  // 0x41 is an invalid continuation char, since it's MSBs
-  // aren't "10..." (are 01).
-  const uint8_t bad[] = {0xc2, 0xa1, 0xc2, 0x41};
-  ASSERT_FALSE(IsValidEntryName(bad, sizeof(bad)));
-
-  // 0x41 is an invalid continuation char, since it's MSBs
-  // aren't "10..." (are 11).
-  const uint8_t bad2[] = {0xc2, 0xa1, 0xc2, 0xfe};
-  ASSERT_FALSE(IsValidEntryName(bad2, sizeof(bad2)));
-}
diff --git a/libziparchive/include/ziparchive/zip_archive.h b/libziparchive/include/ziparchive/zip_archive.h
deleted file mode 100644
index fbc47db..0000000
--- a/libziparchive/include/ziparchive/zip_archive.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#pragma once
-
-/*
- * Read-only access to Zip archives, with minimal heap allocation.
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <string>
-#include <string_view>
-
-#include "android-base/off64_t.h"
-
-/* Zip compression methods we support */
-enum {
-  kCompressStored = 0,    // no compression
-  kCompressDeflated = 8,  // standard deflate
-};
-
-/*
- * Represents information about a zip entry in a zip file.
- */
-struct ZipEntry {
-  // Compression method. One of kCompressStored or kCompressDeflated.
-  // See also `gpbf` for deflate subtypes.
-  uint16_t method;
-
-  // Modification time. The zipfile format specifies
-  // that the first two little endian bytes contain the time
-  // and the last two little endian bytes contain the date.
-  // See `GetModificationTime`. Use signed integer to avoid the
-  // sub-overflow.
-  // TODO: should be overridden by extra time field, if present.
-  int32_t mod_time;
-
-  // Returns `mod_time` as a broken-down struct tm.
-  struct tm GetModificationTime() const;
-
-  // Suggested Unix mode for this entry, from the zip archive if created on
-  // Unix, or a default otherwise. See also `external_file_attributes`.
-  mode_t unix_mode;
-
-  // 1 if this entry contains a data descriptor segment, 0
-  // otherwise.
-  uint8_t has_data_descriptor;
-
-  // Crc32 value of this ZipEntry. This information might
-  // either be stored in the local file header or in a special
-  // Data descriptor footer at the end of the file entry.
-  uint32_t crc32;
-
-  // Compressed length of this ZipEntry. Might be present
-  // either in the local file header or in the data descriptor
-  // footer.
-  uint32_t compressed_length;
-
-  // Uncompressed length of this ZipEntry. Might be present
-  // either in the local file header or in the data descriptor
-  // footer.
-  uint32_t uncompressed_length;
-
-  // The offset to the start of data for this ZipEntry.
-  off64_t offset;
-
-  // The version of zip and the host file system this came from (for zipinfo).
-  uint16_t version_made_by;
-
-  // The raw attributes, whose interpretation depends on the host
-  // file system in `version_made_by` (for zipinfo). See also `unix_mode`.
-  uint32_t external_file_attributes;
-
-  // Specifics about the deflation (for zipinfo).
-  uint16_t gpbf;
-  // Whether this entry is believed to be text or binary (for zipinfo).
-  bool is_text;
-};
-
-struct ZipArchive;
-typedef ZipArchive* ZipArchiveHandle;
-
-/*
- * Open a Zip archive, and sets handle to the value of the opaque
- * handle for the file. This handle must be released by calling
- * CloseArchive with this handle.
- *
- * Returns 0 on success, and negative values on failure.
- */
-int32_t OpenArchive(const char* fileName, ZipArchiveHandle* handle);
-
-/*
- * Like OpenArchive, but takes a file descriptor open for reading
- * at the start of the file.  The descriptor must be mappable (this does
- * not allow access to a stream).
- *
- * Sets handle to the value of the opaque handle for this file descriptor.
- * This handle must be released by calling CloseArchive with this handle.
- *
- * If assume_ownership parameter is 'true' calling CloseArchive will close
- * the file.
- *
- * This function maps and scans the central directory and builds a table
- * of entries for future lookups.
- *
- * "debugFileName" will appear in error messages, but is not otherwise used.
- *
- * Returns 0 on success, and negative values on failure.
- */
-int32_t OpenArchiveFd(const int fd, const char* debugFileName, ZipArchiveHandle* handle,
-                      bool assume_ownership = true);
-
-int32_t OpenArchiveFdRange(const int fd, const char* debugFileName, ZipArchiveHandle* handle,
-                           off64_t length, off64_t offset, bool assume_ownership = true);
-
-int32_t OpenArchiveFromMemory(const void* address, size_t length, const char* debugFileName,
-                              ZipArchiveHandle* handle);
-/*
- * Close archive, releasing resources associated with it. This will
- * unmap the central directory of the zipfile and free all internal
- * data structures associated with the file. It is an error to use
- * this handle for any further operations without an intervening
- * call to one of the OpenArchive variants.
- */
-void CloseArchive(ZipArchiveHandle archive);
-
-/** See GetArchiveInfo(). */
-struct ZipArchiveInfo {
-  /** The size in bytes of the archive itself. Used by zipinfo. */
-  off64_t archive_size;
-  /** The number of entries in the archive. */
-  size_t entry_count;
-};
-
-/**
- * Returns information about the given archive.
- */
-ZipArchiveInfo GetArchiveInfo(ZipArchiveHandle archive);
-
-/*
- * Find an entry in the Zip archive, by name. |data| must be non-null.
- *
- * Returns 0 if an entry is found, and populates |data| with information
- * about this entry. Returns negative values otherwise.
- *
- * It's important to note that |data->crc32|, |data->compLen| and
- * |data->uncompLen| might be set to values from the central directory
- * if this file entry contains a data descriptor footer. To verify crc32s
- * and length, a call to VerifyCrcAndLengths must be made after entry data
- * has been processed.
- *
- * On non-Windows platforms this method does not modify internal state and
- * can be called concurrently.
- */
-int32_t FindEntry(const ZipArchiveHandle archive, const std::string_view entryName, ZipEntry* data);
-
-/*
- * Start iterating over all entries of a zip file. The order of iteration
- * is not guaranteed to be the same as the order of elements
- * in the central directory but is stable for a given zip file. |cookie| will
- * contain the value of an opaque cookie which can be used to make one or more
- * calls to Next. All calls to StartIteration must be matched by a call to
- * EndIteration to free any allocated memory.
- *
- * This method also accepts optional prefix and suffix to restrict iteration to
- * entry names that start with |optional_prefix| or end with |optional_suffix|.
- *
- * Returns 0 on success and negative values on failure.
- */
-int32_t StartIteration(ZipArchiveHandle archive, void** cookie_ptr,
-                       const std::string_view optional_prefix = "",
-                       const std::string_view optional_suffix = "");
-
-/*
- * Advance to the next element in the zipfile in iteration order.
- *
- * Returns 0 on success, -1 if there are no more elements in this
- * archive and lower negative values on failure.
- */
-int32_t Next(void* cookie, ZipEntry* data, std::string* name);
-int32_t Next(void* cookie, ZipEntry* data, std::string_view* name);
-
-/*
- * End iteration over all entries of a zip file and frees the memory allocated
- * in StartIteration.
- */
-void EndIteration(void* cookie);
-
-/*
- * Uncompress and write an entry to an open file identified by |fd|.
- * |entry->uncompressed_length| bytes will be written to the file at
- * its current offset, and the file will be truncated at the end of
- * the uncompressed data (no truncation if |fd| references a block
- * device).
- *
- * Returns 0 on success and negative values on failure.
- */
-int32_t ExtractEntryToFile(ZipArchiveHandle archive, ZipEntry* entry, int fd);
-
-/**
- * Uncompress a given zip entry to the memory region at |begin| and of
- * size |size|. This size is expected to be the same as the *declared*
- * uncompressed length of the zip entry. It is an error if the *actual*
- * number of uncompressed bytes differs from this number.
- *
- * Returns 0 on success and negative values on failure.
- */
-int32_t ExtractToMemory(ZipArchiveHandle archive, ZipEntry* entry, uint8_t* begin, uint32_t size);
-
-int GetFileDescriptor(const ZipArchiveHandle archive);
-
-/**
- * Returns the offset of the zip archive in the backing file descriptor, or 0 if the zip archive is
- * not backed by a file descriptor.
- */
-off64_t GetFileDescriptorOffset(const ZipArchiveHandle archive);
-
-const char* ErrorCodeString(int32_t error_code);
-
-#if !defined(_WIN32)
-typedef bool (*ProcessZipEntryFunction)(const uint8_t* buf, size_t buf_size, void* cookie);
-
-/*
- * Stream the uncompressed data through the supplied function,
- * passing cookie to it each time it gets called.
- */
-int32_t ProcessZipEntryContents(ZipArchiveHandle archive, ZipEntry* entry,
-                                ProcessZipEntryFunction func, void* cookie);
-#endif
-
-namespace zip_archive {
-
-class Writer {
- public:
-  virtual bool Append(uint8_t* buf, size_t buf_size) = 0;
-  virtual ~Writer();
-
- protected:
-  Writer() = default;
-
- private:
-  Writer(const Writer&) = delete;
-  void operator=(const Writer&) = delete;
-};
-
-class Reader {
- public:
-  virtual bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const = 0;
-  virtual ~Reader();
-
- protected:
-  Reader() = default;
-
- private:
-  Reader(const Reader&) = delete;
-  void operator=(const Reader&) = delete;
-};
-
-/*
- * Inflates the first |compressed_length| bytes of |reader| to a given |writer|.
- * |crc_out| is set to the CRC32 checksum of the uncompressed data.
- *
- * Returns 0 on success and negative values on failure, for example if |reader|
- * cannot supply the right amount of data, or if the number of bytes written to
- * data does not match |uncompressed_length|.
- *
- * If |crc_out| is not nullptr, it is set to the crc32 checksum of the
- * uncompressed data.
- */
-int32_t Inflate(const Reader& reader, const uint32_t compressed_length,
-                const uint32_t uncompressed_length, Writer* writer, uint64_t* crc_out);
-}  // namespace zip_archive
diff --git a/libziparchive/include/ziparchive/zip_archive_stream_entry.h b/libziparchive/include/ziparchive/zip_archive_stream_entry.h
deleted file mode 100644
index 8c6ca79..0000000
--- a/libziparchive/include/ziparchive/zip_archive_stream_entry.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-// Read-only stream access to Zip archives entries.
-#pragma once
-
-#include <ziparchive/zip_archive.h>
-
-#include <vector>
-
-#include "android-base/off64_t.h"
-
-class ZipArchiveStreamEntry {
- public:
-  virtual ~ZipArchiveStreamEntry() {}
-
-  virtual const std::vector<uint8_t>* Read() = 0;
-
-  virtual bool Verify() = 0;
-
-  static ZipArchiveStreamEntry* Create(ZipArchiveHandle handle, const ZipEntry& entry);
-  static ZipArchiveStreamEntry* CreateRaw(ZipArchiveHandle handle, const ZipEntry& entry);
-
- protected:
-  ZipArchiveStreamEntry(ZipArchiveHandle handle) : handle_(handle) {}
-
-  virtual bool Init(const ZipEntry& entry);
-
-  ZipArchiveHandle handle_;
-
-  off64_t offset_ = 0;
-  uint32_t crc32_ = 0u;
-};
diff --git a/libziparchive/include/ziparchive/zip_writer.h b/libziparchive/include/ziparchive/zip_writer.h
deleted file mode 100644
index d68683d..0000000
--- a/libziparchive/include/ziparchive/zip_writer.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#pragma once
-
-#include <cstdio>
-#include <ctime>
-
-#include <gtest/gtest_prod.h>
-#include <memory>
-#include <string>
-#include <string_view>
-#include <vector>
-
-#include "android-base/macros.h"
-#include "android-base/off64_t.h"
-
-struct z_stream_s;
-typedef struct z_stream_s z_stream;
-
-/**
- * Writes a Zip file via a stateful interface.
- *
- * Example:
- *
- *   FILE* file = fopen("path/to/zip.zip", "wb");
- *
- *   ZipWriter writer(file);
- *
- *   writer.StartEntry("test.txt", ZipWriter::kCompress | ZipWriter::kAlign);
- *   writer.WriteBytes(buffer, bufferLen);
- *   writer.WriteBytes(buffer2, bufferLen2);
- *   writer.FinishEntry();
- *
- *   writer.StartEntry("empty.txt", 0);
- *   writer.FinishEntry();
- *
- *   writer.Finish();
- *
- *   fclose(file);
- */
-class ZipWriter {
- public:
-  enum {
-    /**
-     * Flag to compress the zip entry using deflate.
-     */
-    kCompress = 0x01,
-
-    /**
-     * Flag to align the zip entry data on a 32bit boundary. Useful for
-     * mmapping the data at runtime.
-     */
-    kAlign32 = 0x02,
-  };
-
-  /**
-   * A struct representing a zip file entry.
-   */
-  struct FileEntry {
-    std::string path;
-    uint16_t compression_method;
-    uint32_t crc32;
-    uint32_t compressed_size;
-    uint32_t uncompressed_size;
-    uint16_t last_mod_time;
-    uint16_t last_mod_date;
-    uint16_t padding_length;
-    off64_t local_file_header_offset;
-  };
-
-  static const char* ErrorCodeString(int32_t error_code);
-
-  /**
-   * Create a ZipWriter that will write into a FILE stream. The file should be opened with
-   * open mode of "wb" or "w+b". ZipWriter does not take ownership of the file stream. The
-   * caller is responsible for closing the file.
-   */
-  explicit ZipWriter(FILE* f);
-
-  // Move constructor.
-  ZipWriter(ZipWriter&& zipWriter) noexcept;
-
-  // Move assignment.
-  ZipWriter& operator=(ZipWriter&& zipWriter) noexcept;
-
-  /**
-   * Starts a new zip entry with the given path and flags.
-   * Flags can be a bitwise OR of ZipWriter::kCompress and ZipWriter::kAlign.
-   * Subsequent calls to WriteBytes(const void*, size_t) will add data to this entry.
-   * Returns 0 on success, and an error value < 0 on failure.
-   */
-  int32_t StartEntry(std::string_view path, size_t flags);
-
-  /**
-   * Starts a new zip entry with the given path and flags, where the
-   * entry will be aligned to the given alignment.
-   * Flags can only be ZipWriter::kCompress. Using the flag ZipWriter::kAlign32
-   * will result in an error.
-   * Subsequent calls to WriteBytes(const void*, size_t) will add data to this entry.
-   * Returns 0 on success, and an error value < 0 on failure.
-   */
-  int32_t StartAlignedEntry(std::string_view path, size_t flags, uint32_t alignment);
-
-  /**
-   * Same as StartEntry(const char*, size_t), but sets a last modified time for the entry.
-   */
-  int32_t StartEntryWithTime(std::string_view path, size_t flags, time_t time);
-
-  /**
-   * Same as StartAlignedEntry(const char*, size_t), but sets a last modified time for the entry.
-   */
-  int32_t StartAlignedEntryWithTime(std::string_view path, size_t flags, time_t time, uint32_t alignment);
-
-  /**
-   * Writes bytes to the zip file for the previously started zip entry.
-   * Returns 0 on success, and an error value < 0 on failure.
-   */
-  int32_t WriteBytes(const void* data, size_t len);
-
-  /**
-   * Finish a zip entry started with StartEntry(const char*, size_t) or
-   * StartEntryWithTime(const char*, size_t, time_t). This must be called before
-   * any new zip entries are started, or before Finish() is called.
-   * Returns 0 on success, and an error value < 0 on failure.
-   */
-  int32_t FinishEntry();
-
-  /**
-   * Discards the last-written entry. Can only be called after an entry has been written using
-   * FinishEntry().
-   * Returns 0 on success, and an error value < 0 on failure.
-   */
-  int32_t DiscardLastEntry();
-
-  /**
-   * Sets `out_entry` to the last entry written after a call to FinishEntry().
-   * Returns 0 on success, and an error value < 0 if no entries have been written.
-   */
-  int32_t GetLastEntry(FileEntry* out_entry);
-
-  /**
-   * Writes the Central Directory Headers and flushes the zip file stream.
-   * Returns 0 on success, and an error value < 0 on failure.
-   */
-  int32_t Finish();
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ZipWriter);
-
-  int32_t HandleError(int32_t error_code);
-  int32_t PrepareDeflate();
-  int32_t StoreBytes(FileEntry* file, const void* data, uint32_t len);
-  int32_t CompressBytes(FileEntry* file, const void* data, uint32_t len);
-  int32_t FlushCompressedBytes(FileEntry* file);
-  bool ShouldUseDataDescriptor() const;
-
-  enum class State {
-    kWritingZip,
-    kWritingEntry,
-    kDone,
-    kError,
-  };
-
-  FILE* file_;
-  bool seekable_;
-  off64_t current_offset_;
-  State state_;
-  std::vector<FileEntry> files_;
-  FileEntry current_file_entry_;
-
-  std::unique_ptr<z_stream, void (*)(z_stream*)> z_stream_;
-  std::vector<uint8_t> buffer_;
-
-  FRIEND_TEST(zipwriter, WriteToUnseekableFile);
-};
diff --git a/libziparchive/libziparchive_fuzzer.cpp b/libziparchive/libziparchive_fuzzer.cpp
deleted file mode 100644
index 75e7939..0000000
--- a/libziparchive/libziparchive_fuzzer.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <ziparchive/zip_archive.h>
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-  ZipArchiveHandle handle = nullptr;
-  OpenArchiveFromMemory(data, size, "fuzz", &handle);
-  CloseArchive(handle);
-  return 0;
-}
diff --git a/libziparchive/run-ziptool-tests-on-android.sh b/libziparchive/run-ziptool-tests-on-android.sh
deleted file mode 100755
index 3c23d43..0000000
--- a/libziparchive/run-ziptool-tests-on-android.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# Copy the tests across.
-adb shell rm -rf /data/local/tmp/ziptool-tests/
-adb shell mkdir /data/local/tmp/ziptool-tests/
-adb push cli-tests/ /data/local/tmp/ziptool-tests/
-#adb push cli-test /data/local/tmp/ziptool-tests/
-
-if tty -s; then
-  dash_t="-t"
-else
-  dash_t=""
-fi
-
-exec adb shell $dash_t cli-test /data/local/tmp/ziptool-tests/cli-tests/*.test
diff --git a/libziparchive/testdata/bad_crc.zip b/libziparchive/testdata/bad_crc.zip
deleted file mode 100644
index e12ba07..0000000
--- a/libziparchive/testdata/bad_crc.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/bad_filename.zip b/libziparchive/testdata/bad_filename.zip
deleted file mode 100644
index 294eaf5..0000000
--- a/libziparchive/testdata/bad_filename.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/crash.apk b/libziparchive/testdata/crash.apk
deleted file mode 100644
index d6dd52d..0000000
--- a/libziparchive/testdata/crash.apk
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/declaredlength.zip b/libziparchive/testdata/declaredlength.zip
deleted file mode 100644
index 773380c..0000000
--- a/libziparchive/testdata/declaredlength.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/dummy-update.zip b/libziparchive/testdata/dummy-update.zip
deleted file mode 100644
index 6976bf1..0000000
--- a/libziparchive/testdata/dummy-update.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/empty.zip b/libziparchive/testdata/empty.zip
deleted file mode 100644
index 15cb0ec..0000000
--- a/libziparchive/testdata/empty.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/large.zip b/libziparchive/testdata/large.zip
deleted file mode 100644
index 49659c8..0000000
--- a/libziparchive/testdata/large.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/valid.zip b/libziparchive/testdata/valid.zip
deleted file mode 100644
index 9e7cb78..0000000
--- a/libziparchive/testdata/valid.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/testdata/zero-size-cd.zip b/libziparchive/testdata/zero-size-cd.zip
deleted file mode 100644
index b6c8cbe..0000000
--- a/libziparchive/testdata/zero-size-cd.zip
+++ /dev/null
Binary files differ
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
deleted file mode 100644
index 489fcb1..0000000
--- a/libziparchive/zip_archive.cc
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-/*
- * Read-only access to Zip archives, with minimal heap allocation.
- */
-
-#define LOG_TAG "ziparchive"
-
-#include "ziparchive/zip_archive.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#if defined(__APPLE__)
-#define lseek64 lseek
-#endif
-
-#if defined(__BIONIC__)
-#include <android/fdsan.h>
-#endif
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/macros.h>  // TEMP_FAILURE_RETRY may or may not be in unistd
-#include <android-base/mapped_file.h>
-#include <android-base/memory.h>
-#include <android-base/strings.h>
-#include <android-base/utf8.h>
-#include <log/log.h>
-#include "zlib.h"
-
-#include "entry_name_utils-inl.h"
-#include "zip_archive_common.h"
-#include "zip_archive_private.h"
-
-using android::base::get_unaligned;
-
-// Used to turn on crc checks - verify that the content CRC matches the values
-// specified in the local file header and the central directory.
-static constexpr bool kCrcChecksEnabled = false;
-
-// The maximum number of bytes to scan backwards for the EOCD start.
-static const uint32_t kMaxEOCDSearch = kMaxCommentLen + sizeof(EocdRecord);
-
-/*
- * A Read-only Zip archive.
- *
- * We want "open" and "find entry by name" to be fast operations, and
- * we want to use as little memory as possible.  We memory-map the zip
- * central directory, and load a hash table with pointers to the filenames
- * (which aren't null-terminated).  The other fields are at a fixed offset
- * from the filename, so we don't need to extract those (but we do need
- * to byte-read and endian-swap them every time we want them).
- *
- * It's possible that somebody has handed us a massive (~1GB) zip archive,
- * so we can't expect to mmap the entire file.
- *
- * To speed comparisons when doing a lookup by name, we could make the mapping
- * "private" (copy-on-write) and null-terminate the filenames after verifying
- * the record structure.  However, this requires a private mapping of
- * every page that the Central Directory touches.  Easier to tuck a copy
- * of the string length into the hash table entry.
- */
-
-/*
- * Round up to the next highest power of 2.
- *
- * Found on http://graphics.stanford.edu/~seander/bithacks.html.
- */
-static uint32_t RoundUpPower2(uint32_t val) {
-  val--;
-  val |= val >> 1;
-  val |= val >> 2;
-  val |= val >> 4;
-  val |= val >> 8;
-  val |= val >> 16;
-  val++;
-
-  return val;
-}
-
-static uint32_t ComputeHash(std::string_view name) {
-  return static_cast<uint32_t>(std::hash<std::string_view>{}(name));
-}
-
-/*
- * Convert a ZipEntry to a hash table index, verifying that it's in a
- * valid range.
- */
-static int64_t EntryToIndex(const ZipStringOffset* hash_table, const uint32_t hash_table_size,
-                            std::string_view name, const uint8_t* start) {
-  const uint32_t hash = ComputeHash(name);
-
-  // NOTE: (hash_table_size - 1) is guaranteed to be non-negative.
-  uint32_t ent = hash & (hash_table_size - 1);
-  while (hash_table[ent].name_offset != 0) {
-    if (hash_table[ent].ToStringView(start) == name) {
-      return ent;
-    }
-    ent = (ent + 1) & (hash_table_size - 1);
-  }
-
-  ALOGV("Zip: Unable to find entry %.*s", static_cast<int>(name.size()), name.data());
-  return kEntryNotFound;
-}
-
-/*
- * Add a new entry to the hash table.
- */
-static int32_t AddToHash(ZipStringOffset* hash_table, const uint32_t hash_table_size,
-                         std::string_view name, const uint8_t* start) {
-  const uint64_t hash = ComputeHash(name);
-  uint32_t ent = hash & (hash_table_size - 1);
-
-  /*
-   * We over-allocated the table, so we're guaranteed to find an empty slot.
-   * Further, we guarantee that the hashtable size is not 0.
-   */
-  while (hash_table[ent].name_offset != 0) {
-    if (hash_table[ent].ToStringView(start) == name) {
-      // We've found a duplicate entry. We don't accept duplicates.
-      ALOGW("Zip: Found duplicate entry %.*s", static_cast<int>(name.size()), name.data());
-      return kDuplicateEntry;
-    }
-    ent = (ent + 1) & (hash_table_size - 1);
-  }
-
-  // `name` has already been validated before entry.
-  const char* start_char = reinterpret_cast<const char*>(start);
-  hash_table[ent].name_offset = static_cast<uint32_t>(name.data() - start_char);
-  hash_table[ent].name_length = static_cast<uint16_t>(name.size());
-  return 0;
-}
-
-#if defined(__BIONIC__)
-uint64_t GetOwnerTag(const ZipArchive* archive) {
-  return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE,
-                                        reinterpret_cast<uint64_t>(archive));
-}
-#endif
-
-ZipArchive::ZipArchive(MappedZipFile&& map, bool assume_ownership)
-    : mapped_zip(map),
-      close_file(assume_ownership),
-      directory_offset(0),
-      central_directory(),
-      directory_map(),
-      num_entries(0),
-      hash_table_size(0),
-      hash_table(nullptr) {
-#if defined(__BIONIC__)
-  if (assume_ownership) {
-    CHECK(mapped_zip.HasFd());
-    android_fdsan_exchange_owner_tag(mapped_zip.GetFileDescriptor(), 0, GetOwnerTag(this));
-  }
-#endif
-}
-
-ZipArchive::ZipArchive(const void* address, size_t length)
-    : mapped_zip(address, length),
-      close_file(false),
-      directory_offset(0),
-      central_directory(),
-      directory_map(),
-      num_entries(0),
-      hash_table_size(0),
-      hash_table(nullptr) {}
-
-ZipArchive::~ZipArchive() {
-  if (close_file && mapped_zip.GetFileDescriptor() >= 0) {
-#if defined(__BIONIC__)
-    android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this));
-#else
-    close(mapped_zip.GetFileDescriptor());
-#endif
-  }
-
-  free(hash_table);
-}
-
-static int32_t MapCentralDirectory0(const char* debug_file_name, ZipArchive* archive,
-                                    off64_t file_length, uint32_t read_amount,
-                                    uint8_t* scan_buffer) {
-  const off64_t search_start = file_length - read_amount;
-
-  if (!archive->mapped_zip.ReadAtOffset(scan_buffer, read_amount, search_start)) {
-    ALOGE("Zip: read %" PRId64 " from offset %" PRId64 " failed", static_cast<int64_t>(read_amount),
-          static_cast<int64_t>(search_start));
-    return kIoError;
-  }
-
-  /*
-   * Scan backward for the EOCD magic.  In an archive without a trailing
-   * comment, we'll find it on the first try.  (We may want to consider
-   * doing an initial minimal read; if we don't find it, retry with a
-   * second read as above.)
-   */
-  CHECK_LE(read_amount, std::numeric_limits<int32_t>::max());
-  int32_t i = read_amount - sizeof(EocdRecord);
-  for (; i >= 0; i--) {
-    if (scan_buffer[i] == 0x50) {
-      uint32_t* sig_addr = reinterpret_cast<uint32_t*>(&scan_buffer[i]);
-      if (get_unaligned<uint32_t>(sig_addr) == EocdRecord::kSignature) {
-        ALOGV("+++ Found EOCD at buf+%d", i);
-        break;
-      }
-    }
-  }
-  if (i < 0) {
-    ALOGD("Zip: EOCD not found, %s is not zip", debug_file_name);
-    return kInvalidFile;
-  }
-
-  const off64_t eocd_offset = search_start + i;
-  const EocdRecord* eocd = reinterpret_cast<const EocdRecord*>(scan_buffer + i);
-  /*
-   * Verify that there's no trailing space at the end of the central directory
-   * and its comment.
-   */
-  const off64_t calculated_length = eocd_offset + sizeof(EocdRecord) + eocd->comment_length;
-  if (calculated_length != file_length) {
-    ALOGW("Zip: %" PRId64 " extraneous bytes at the end of the central directory",
-          static_cast<int64_t>(file_length - calculated_length));
-    return kInvalidFile;
-  }
-
-  /*
-   * Grab the CD offset and size, and the number of entries in the
-   * archive and verify that they look reasonable.
-   */
-  if (static_cast<off64_t>(eocd->cd_start_offset) + eocd->cd_size > eocd_offset) {
-    ALOGW("Zip: bad offsets (dir %" PRIu32 ", size %" PRIu32 ", eocd %" PRId64 ")",
-          eocd->cd_start_offset, eocd->cd_size, static_cast<int64_t>(eocd_offset));
-    return kInvalidOffset;
-  }
-  if (eocd->num_records == 0) {
-#if defined(__ANDROID__)
-    ALOGW("Zip: empty archive?");
-#endif
-    return kEmptyArchive;
-  }
-
-  ALOGV("+++ num_entries=%" PRIu32 " dir_size=%" PRIu32 " dir_offset=%" PRIu32, eocd->num_records,
-        eocd->cd_size, eocd->cd_start_offset);
-
-  // It all looks good.  Create a mapping for the CD, and set the fields
-  // in archive.
-  if (!archive->InitializeCentralDirectory(static_cast<off64_t>(eocd->cd_start_offset),
-                                           static_cast<size_t>(eocd->cd_size))) {
-    return kMmapFailed;
-  }
-
-  archive->num_entries = eocd->num_records;
-  archive->directory_offset = eocd->cd_start_offset;
-
-  return 0;
-}
-
-/*
- * Find the zip Central Directory and memory-map it.
- *
- * On success, returns 0 after populating fields from the EOCD area:
- *   directory_offset
- *   directory_ptr
- *   num_entries
- */
-static int32_t MapCentralDirectory(const char* debug_file_name, ZipArchive* archive) {
-  // Test file length. We use lseek64 to make sure the file
-  // is small enough to be a zip file (Its size must be less than
-  // 0xffffffff bytes).
-  off64_t file_length = archive->mapped_zip.GetFileLength();
-  if (file_length == -1) {
-    return kInvalidFile;
-  }
-
-  if (file_length > static_cast<off64_t>(0xffffffff)) {
-    ALOGV("Zip: zip file too long %" PRId64, static_cast<int64_t>(file_length));
-    return kInvalidFile;
-  }
-
-  if (file_length < static_cast<off64_t>(sizeof(EocdRecord))) {
-    ALOGV("Zip: length %" PRId64 " is too small to be zip", static_cast<int64_t>(file_length));
-    return kInvalidFile;
-  }
-
-  /*
-   * Perform the traditional EOCD snipe hunt.
-   *
-   * We're searching for the End of Central Directory magic number,
-   * which appears at the start of the EOCD block.  It's followed by
-   * 18 bytes of EOCD stuff and up to 64KB of archive comment.  We
-   * need to read the last part of the file into a buffer, dig through
-   * it to find the magic number, parse some values out, and use those
-   * to determine the extent of the CD.
-   *
-   * We start by pulling in the last part of the file.
-   */
-  uint32_t read_amount = kMaxEOCDSearch;
-  if (file_length < read_amount) {
-    read_amount = static_cast<uint32_t>(file_length);
-  }
-
-  std::vector<uint8_t> scan_buffer(read_amount);
-  int32_t result =
-      MapCentralDirectory0(debug_file_name, archive, file_length, read_amount, scan_buffer.data());
-  return result;
-}
-
-/*
- * Parses the Zip archive's Central Directory.  Allocates and populates the
- * hash table.
- *
- * Returns 0 on success.
- */
-static int32_t ParseZipArchive(ZipArchive* archive) {
-  const uint8_t* const cd_ptr = archive->central_directory.GetBasePtr();
-  const size_t cd_length = archive->central_directory.GetMapLength();
-  const uint16_t num_entries = archive->num_entries;
-
-  /*
-   * Create hash table.  We have a minimum 75% load factor, possibly as
-   * low as 50% after we round off to a power of 2.  There must be at
-   * least one unused entry to avoid an infinite loop during creation.
-   */
-  archive->hash_table_size = RoundUpPower2(1 + (num_entries * 4) / 3);
-  archive->hash_table =
-      reinterpret_cast<ZipStringOffset*>(calloc(archive->hash_table_size, sizeof(ZipStringOffset)));
-  if (archive->hash_table == nullptr) {
-    ALOGW("Zip: unable to allocate the %u-entry hash_table, entry size: %zu",
-          archive->hash_table_size, sizeof(ZipStringOffset));
-    return kAllocationFailed;
-  }
-
-  /*
-   * Walk through the central directory, adding entries to the hash
-   * table and verifying values.
-   */
-  const uint8_t* const cd_end = cd_ptr + cd_length;
-  const uint8_t* ptr = cd_ptr;
-  for (uint16_t i = 0; i < num_entries; i++) {
-    if (ptr > cd_end - sizeof(CentralDirectoryRecord)) {
-      ALOGW("Zip: ran off the end (item #%" PRIu16 ", %zu bytes of central directory)", i,
-            cd_length);
-#if defined(__ANDROID__)
-      android_errorWriteLog(0x534e4554, "36392138");
-#endif
-      return kInvalidFile;
-    }
-
-    const CentralDirectoryRecord* cdr = reinterpret_cast<const CentralDirectoryRecord*>(ptr);
-    if (cdr->record_signature != CentralDirectoryRecord::kSignature) {
-      ALOGW("Zip: missed a central dir sig (at %" PRIu16 ")", i);
-      return kInvalidFile;
-    }
-
-    const off64_t local_header_offset = cdr->local_file_header_offset;
-    if (local_header_offset >= archive->directory_offset) {
-      ALOGW("Zip: bad LFH offset %" PRId64 " at entry %" PRIu16,
-            static_cast<int64_t>(local_header_offset), i);
-      return kInvalidFile;
-    }
-
-    const uint16_t file_name_length = cdr->file_name_length;
-    const uint16_t extra_length = cdr->extra_field_length;
-    const uint16_t comment_length = cdr->comment_length;
-    const uint8_t* file_name = ptr + sizeof(CentralDirectoryRecord);
-
-    if (file_name + file_name_length > cd_end) {
-      ALOGW("Zip: file name for entry %" PRIu16
-            " exceeds the central directory range, file_name_length: %" PRIu16 ", cd_length: %zu",
-            i, file_name_length, cd_length);
-      return kInvalidEntryName;
-    }
-    // Check that file name is valid UTF-8 and doesn't contain NUL (U+0000) characters.
-    if (!IsValidEntryName(file_name, file_name_length)) {
-      ALOGW("Zip: invalid file name at entry %" PRIu16, i);
-      return kInvalidEntryName;
-    }
-
-    // Add the CDE filename to the hash table.
-    std::string_view entry_name{reinterpret_cast<const char*>(file_name), file_name_length};
-    const int add_result = AddToHash(archive->hash_table, archive->hash_table_size, entry_name,
-                                     archive->central_directory.GetBasePtr());
-    if (add_result != 0) {
-      ALOGW("Zip: Error adding entry to hash table %d", add_result);
-      return add_result;
-    }
-
-    ptr += sizeof(CentralDirectoryRecord) + file_name_length + extra_length + comment_length;
-    if ((ptr - cd_ptr) > static_cast<int64_t>(cd_length)) {
-      ALOGW("Zip: bad CD advance (%tu vs %zu) at entry %" PRIu16, ptr - cd_ptr, cd_length, i);
-      return kInvalidFile;
-    }
-  }
-
-  uint32_t lfh_start_bytes;
-  if (!archive->mapped_zip.ReadAtOffset(reinterpret_cast<uint8_t*>(&lfh_start_bytes),
-                                        sizeof(uint32_t), 0)) {
-    ALOGW("Zip: Unable to read header for entry at offset == 0.");
-    return kInvalidFile;
-  }
-
-  if (lfh_start_bytes != LocalFileHeader::kSignature) {
-    ALOGW("Zip: Entry at offset zero has invalid LFH signature %" PRIx32, lfh_start_bytes);
-#if defined(__ANDROID__)
-    android_errorWriteLog(0x534e4554, "64211847");
-#endif
-    return kInvalidFile;
-  }
-
-  ALOGV("+++ zip good scan %" PRIu16 " entries", num_entries);
-
-  return 0;
-}
-
-static int32_t OpenArchiveInternal(ZipArchive* archive, const char* debug_file_name) {
-  int32_t result = MapCentralDirectory(debug_file_name, archive);
-  return result != 0 ? result : ParseZipArchive(archive);
-}
-
-int32_t OpenArchiveFd(int fd, const char* debug_file_name, ZipArchiveHandle* handle,
-                      bool assume_ownership) {
-  ZipArchive* archive = new ZipArchive(MappedZipFile(fd), assume_ownership);
-  *handle = archive;
-  return OpenArchiveInternal(archive, debug_file_name);
-}
-
-int32_t OpenArchiveFdRange(int fd, const char* debug_file_name, ZipArchiveHandle* handle,
-                           off64_t length, off64_t offset, bool assume_ownership) {
-  ZipArchive* archive = new ZipArchive(MappedZipFile(fd, length, offset), assume_ownership);
-  *handle = archive;
-
-  if (length < 0) {
-    ALOGW("Invalid zip length %" PRId64, length);
-    return kIoError;
-  }
-
-  if (offset < 0) {
-    ALOGW("Invalid zip offset %" PRId64, offset);
-    return kIoError;
-  }
-
-  return OpenArchiveInternal(archive, debug_file_name);
-}
-
-int32_t OpenArchive(const char* fileName, ZipArchiveHandle* handle) {
-  const int fd = ::android::base::utf8::open(fileName, O_RDONLY | O_BINARY | O_CLOEXEC, 0);
-  ZipArchive* archive = new ZipArchive(MappedZipFile(fd), true);
-  *handle = archive;
-
-  if (fd < 0) {
-    ALOGW("Unable to open '%s': %s", fileName, strerror(errno));
-    return kIoError;
-  }
-
-  return OpenArchiveInternal(archive, fileName);
-}
-
-int32_t OpenArchiveFromMemory(const void* address, size_t length, const char* debug_file_name,
-                              ZipArchiveHandle* handle) {
-  ZipArchive* archive = new ZipArchive(address, length);
-  *handle = archive;
-  return OpenArchiveInternal(archive, debug_file_name);
-}
-
-ZipArchiveInfo GetArchiveInfo(ZipArchiveHandle archive) {
-  ZipArchiveInfo result;
-  result.archive_size = archive->mapped_zip.GetFileLength();
-  result.entry_count = archive->num_entries;
-  return result;
-}
-
-/*
- * Close a ZipArchive, closing the file and freeing the contents.
- */
-void CloseArchive(ZipArchiveHandle archive) {
-  ALOGV("Closing archive %p", archive);
-  delete archive;
-}
-
-static int32_t ValidateDataDescriptor(MappedZipFile& mapped_zip, ZipEntry* entry) {
-  uint8_t ddBuf[sizeof(DataDescriptor) + sizeof(DataDescriptor::kOptSignature)];
-  off64_t offset = entry->offset;
-  if (entry->method != kCompressStored) {
-    offset += entry->compressed_length;
-  } else {
-    offset += entry->uncompressed_length;
-  }
-
-  if (!mapped_zip.ReadAtOffset(ddBuf, sizeof(ddBuf), offset)) {
-    return kIoError;
-  }
-
-  const uint32_t ddSignature = *(reinterpret_cast<const uint32_t*>(ddBuf));
-  const uint16_t ddOffset = (ddSignature == DataDescriptor::kOptSignature) ? 4 : 0;
-  const DataDescriptor* descriptor = reinterpret_cast<const DataDescriptor*>(ddBuf + ddOffset);
-
-  // Validate that the values in the data descriptor match those in the central
-  // directory.
-  if (entry->compressed_length != descriptor->compressed_size ||
-      entry->uncompressed_length != descriptor->uncompressed_size ||
-      entry->crc32 != descriptor->crc32) {
-    ALOGW("Zip: size/crc32 mismatch. expected {%" PRIu32 ", %" PRIu32 ", %" PRIx32
-          "}, was {%" PRIu32 ", %" PRIu32 ", %" PRIx32 "}",
-          entry->compressed_length, entry->uncompressed_length, entry->crc32,
-          descriptor->compressed_size, descriptor->uncompressed_size, descriptor->crc32);
-    return kInconsistentInformation;
-  }
-
-  return 0;
-}
-
-static int32_t FindEntry(const ZipArchive* archive, const int32_t ent, ZipEntry* data) {
-  const uint16_t nameLen = archive->hash_table[ent].name_length;
-
-  // Recover the start of the central directory entry from the filename
-  // pointer.  The filename is the first entry past the fixed-size data,
-  // so we can just subtract back from that.
-  const uint8_t* base_ptr = archive->central_directory.GetBasePtr();
-  const uint8_t* ptr = base_ptr + archive->hash_table[ent].name_offset;
-  ptr -= sizeof(CentralDirectoryRecord);
-
-  // This is the base of our mmapped region, we have to sanity check that
-  // the name that's in the hash table is a pointer to a location within
-  // this mapped region.
-  if (ptr < base_ptr || ptr > base_ptr + archive->central_directory.GetMapLength()) {
-    ALOGW("Zip: Invalid entry pointer");
-    return kInvalidOffset;
-  }
-
-  const CentralDirectoryRecord* cdr = reinterpret_cast<const CentralDirectoryRecord*>(ptr);
-
-  // The offset of the start of the central directory in the zipfile.
-  // We keep this lying around so that we can sanity check all our lengths
-  // and our per-file structures.
-  const off64_t cd_offset = archive->directory_offset;
-
-  // Fill out the compression method, modification time, crc32
-  // and other interesting attributes from the central directory. These
-  // will later be compared against values from the local file header.
-  data->method = cdr->compression_method;
-  data->mod_time = cdr->last_mod_date << 16 | cdr->last_mod_time;
-  data->crc32 = cdr->crc32;
-  data->compressed_length = cdr->compressed_size;
-  data->uncompressed_length = cdr->uncompressed_size;
-
-  // Figure out the local header offset from the central directory. The
-  // actual file data will begin after the local header and the name /
-  // extra comments.
-  const off64_t local_header_offset = cdr->local_file_header_offset;
-  if (local_header_offset + static_cast<off64_t>(sizeof(LocalFileHeader)) >= cd_offset) {
-    ALOGW("Zip: bad local hdr offset in zip");
-    return kInvalidOffset;
-  }
-
-  uint8_t lfh_buf[sizeof(LocalFileHeader)];
-  if (!archive->mapped_zip.ReadAtOffset(lfh_buf, sizeof(lfh_buf), local_header_offset)) {
-    ALOGW("Zip: failed reading lfh name from offset %" PRId64,
-          static_cast<int64_t>(local_header_offset));
-    return kIoError;
-  }
-
-  const LocalFileHeader* lfh = reinterpret_cast<const LocalFileHeader*>(lfh_buf);
-
-  if (lfh->lfh_signature != LocalFileHeader::kSignature) {
-    ALOGW("Zip: didn't find signature at start of lfh, offset=%" PRId64,
-          static_cast<int64_t>(local_header_offset));
-    return kInvalidOffset;
-  }
-
-  // Paranoia: Match the values specified in the local file header
-  // to those specified in the central directory.
-
-  // Warn if central directory and local file header don't agree on the use
-  // of a trailing Data Descriptor. The reference implementation is inconsistent
-  // and appears to use the LFH value during extraction (unzip) but the CD value
-  // while displayng information about archives (zipinfo). The spec remains
-  // silent on this inconsistency as well.
-  //
-  // For now, always use the version from the LFH but make sure that the values
-  // specified in the central directory match those in the data descriptor.
-  //
-  // NOTE: It's also worth noting that unzip *does* warn about inconsistencies in
-  // bit 11 (EFS: The language encoding flag, marking that filename and comment are
-  // encoded using UTF-8). This implementation does not check for the presence of
-  // that flag and always enforces that entry names are valid UTF-8.
-  if ((lfh->gpb_flags & kGPBDDFlagMask) != (cdr->gpb_flags & kGPBDDFlagMask)) {
-    ALOGW("Zip: gpb flag mismatch at bit 3. expected {%04" PRIx16 "}, was {%04" PRIx16 "}",
-          cdr->gpb_flags, lfh->gpb_flags);
-  }
-
-  // If there is no trailing data descriptor, verify that the central directory and local file
-  // header agree on the crc, compressed, and uncompressed sizes of the entry.
-  if ((lfh->gpb_flags & kGPBDDFlagMask) == 0) {
-    data->has_data_descriptor = 0;
-    if (data->compressed_length != lfh->compressed_size ||
-        data->uncompressed_length != lfh->uncompressed_size || data->crc32 != lfh->crc32) {
-      ALOGW("Zip: size/crc32 mismatch. expected {%" PRIu32 ", %" PRIu32 ", %" PRIx32
-            "}, was {%" PRIu32 ", %" PRIu32 ", %" PRIx32 "}",
-            data->compressed_length, data->uncompressed_length, data->crc32, lfh->compressed_size,
-            lfh->uncompressed_size, lfh->crc32);
-      return kInconsistentInformation;
-    }
-  } else {
-    data->has_data_descriptor = 1;
-  }
-
-  // 4.4.2.1: the upper byte of `version_made_by` gives the source OS. Unix is 3.
-  data->version_made_by = cdr->version_made_by;
-  data->external_file_attributes = cdr->external_file_attributes;
-  if ((data->version_made_by >> 8) == 3) {
-    data->unix_mode = (cdr->external_file_attributes >> 16) & 0xffff;
-  } else {
-    data->unix_mode = 0777;
-  }
-
-  // 4.4.4: general purpose bit flags.
-  data->gpbf = lfh->gpb_flags;
-
-  // 4.4.14: the lowest bit of the internal file attributes field indicates text.
-  // Currently only needed to implement zipinfo.
-  data->is_text = (cdr->internal_file_attributes & 1);
-
-  // Check that the local file header name matches the declared
-  // name in the central directory.
-  if (lfh->file_name_length != nameLen) {
-    ALOGW("Zip: lfh name length did not match central directory");
-    return kInconsistentInformation;
-  }
-  const off64_t name_offset = local_header_offset + sizeof(LocalFileHeader);
-  if (name_offset + lfh->file_name_length > cd_offset) {
-    ALOGW("Zip: lfh name has invalid declared length");
-    return kInvalidOffset;
-  }
-  std::vector<uint8_t> name_buf(nameLen);
-  if (!archive->mapped_zip.ReadAtOffset(name_buf.data(), nameLen, name_offset)) {
-    ALOGW("Zip: failed reading lfh name from offset %" PRId64, static_cast<int64_t>(name_offset));
-    return kIoError;
-  }
-  const std::string_view entry_name =
-      archive->hash_table[ent].ToStringView(archive->central_directory.GetBasePtr());
-  if (memcmp(entry_name.data(), name_buf.data(), nameLen) != 0) {
-    ALOGW("Zip: lfh name did not match central directory");
-    return kInconsistentInformation;
-  }
-
-  const off64_t data_offset = local_header_offset + sizeof(LocalFileHeader) +
-                              lfh->file_name_length + lfh->extra_field_length;
-  if (data_offset > cd_offset) {
-    ALOGW("Zip: bad data offset %" PRId64 " in zip", static_cast<int64_t>(data_offset));
-    return kInvalidOffset;
-  }
-
-  if (static_cast<off64_t>(data_offset + data->compressed_length) > cd_offset) {
-    ALOGW("Zip: bad compressed length in zip (%" PRId64 " + %" PRIu32 " > %" PRId64 ")",
-          static_cast<int64_t>(data_offset), data->compressed_length,
-          static_cast<int64_t>(cd_offset));
-    return kInvalidOffset;
-  }
-
-  if (data->method == kCompressStored &&
-      static_cast<off64_t>(data_offset + data->uncompressed_length) > cd_offset) {
-    ALOGW("Zip: bad uncompressed length in zip (%" PRId64 " + %" PRIu32 " > %" PRId64 ")",
-          static_cast<int64_t>(data_offset), data->uncompressed_length,
-          static_cast<int64_t>(cd_offset));
-    return kInvalidOffset;
-  }
-
-  data->offset = data_offset;
-  return 0;
-}
-
-struct IterationHandle {
-  ZipArchive* archive;
-
-  std::string prefix;
-  std::string suffix;
-
-  uint32_t position = 0;
-
-  IterationHandle(ZipArchive* archive, std::string_view in_prefix, std::string_view in_suffix)
-      : archive(archive), prefix(in_prefix), suffix(in_suffix) {}
-};
-
-int32_t StartIteration(ZipArchiveHandle archive, void** cookie_ptr,
-                       const std::string_view optional_prefix,
-                       const std::string_view optional_suffix) {
-  if (archive == NULL || archive->hash_table == NULL) {
-    ALOGW("Zip: Invalid ZipArchiveHandle");
-    return kInvalidHandle;
-  }
-
-  if (optional_prefix.size() > static_cast<size_t>(UINT16_MAX) ||
-      optional_suffix.size() > static_cast<size_t>(UINT16_MAX)) {
-    ALOGW("Zip: prefix/suffix too long");
-    return kInvalidEntryName;
-  }
-
-  *cookie_ptr = new IterationHandle(archive, optional_prefix, optional_suffix);
-  return 0;
-}
-
-void EndIteration(void* cookie) {
-  delete reinterpret_cast<IterationHandle*>(cookie);
-}
-
-int32_t FindEntry(const ZipArchiveHandle archive, const std::string_view entryName,
-                  ZipEntry* data) {
-  if (entryName.empty() || entryName.size() > static_cast<size_t>(UINT16_MAX)) {
-    ALOGW("Zip: Invalid filename of length %zu", entryName.size());
-    return kInvalidEntryName;
-  }
-
-  const int64_t ent = EntryToIndex(archive->hash_table, archive->hash_table_size, entryName,
-                                   archive->central_directory.GetBasePtr());
-  if (ent < 0) {
-    ALOGV("Zip: Could not find entry %.*s", static_cast<int>(entryName.size()), entryName.data());
-    return static_cast<int32_t>(ent);  // kEntryNotFound is safe to truncate.
-  }
-  // We know there are at most hash_table_size entries, safe to truncate.
-  return FindEntry(archive, static_cast<uint32_t>(ent), data);
-}
-
-int32_t Next(void* cookie, ZipEntry* data, std::string* name) {
-  std::string_view sv;
-  int32_t result = Next(cookie, data, &sv);
-  if (result == 0 && name) {
-    *name = std::string(sv);
-  }
-  return result;
-}
-
-int32_t Next(void* cookie, ZipEntry* data, std::string_view* name) {
-  IterationHandle* handle = reinterpret_cast<IterationHandle*>(cookie);
-  if (handle == NULL) {
-    ALOGW("Zip: Null ZipArchiveHandle");
-    return kInvalidHandle;
-  }
-
-  ZipArchive* archive = handle->archive;
-  if (archive == NULL || archive->hash_table == NULL) {
-    ALOGW("Zip: Invalid ZipArchiveHandle");
-    return kInvalidHandle;
-  }
-
-  const uint32_t currentOffset = handle->position;
-  const uint32_t hash_table_length = archive->hash_table_size;
-  const ZipStringOffset* hash_table = archive->hash_table;
-  for (uint32_t i = currentOffset; i < hash_table_length; ++i) {
-    const std::string_view entry_name =
-        hash_table[i].ToStringView(archive->central_directory.GetBasePtr());
-    if (hash_table[i].name_offset != 0 && (android::base::StartsWith(entry_name, handle->prefix) &&
-                                           android::base::EndsWith(entry_name, handle->suffix))) {
-      handle->position = (i + 1);
-      const int error = FindEntry(archive, i, data);
-      if (!error && name) {
-        *name = entry_name;
-      }
-      return error;
-    }
-  }
-
-  handle->position = 0;
-  return kIterationEnd;
-}
-
-// A Writer that writes data to a fixed size memory region.
-// The size of the memory region must be equal to the total size of
-// the data appended to it.
-class MemoryWriter : public zip_archive::Writer {
- public:
-  MemoryWriter(uint8_t* buf, size_t size) : Writer(), buf_(buf), size_(size), bytes_written_(0) {}
-
-  virtual bool Append(uint8_t* buf, size_t buf_size) override {
-    if (bytes_written_ + buf_size > size_) {
-      ALOGW("Zip: Unexpected size %zu (declared) vs %zu (actual)", size_,
-            bytes_written_ + buf_size);
-      return false;
-    }
-
-    memcpy(buf_ + bytes_written_, buf, buf_size);
-    bytes_written_ += buf_size;
-    return true;
-  }
-
- private:
-  uint8_t* const buf_;
-  const size_t size_;
-  size_t bytes_written_;
-};
-
-// A Writer that appends data to a file |fd| at its current position.
-// The file will be truncated to the end of the written data.
-class FileWriter : public zip_archive::Writer {
- public:
-  // Creates a FileWriter for |fd| and prepare to write |entry| to it,
-  // guaranteeing that the file descriptor is valid and that there's enough
-  // space on the volume to write out the entry completely and that the file
-  // is truncated to the correct length (no truncation if |fd| references a
-  // block device).
-  //
-  // Returns a valid FileWriter on success, |nullptr| if an error occurred.
-  static FileWriter Create(int fd, const ZipEntry* entry) {
-    const uint32_t declared_length = entry->uncompressed_length;
-    const off64_t current_offset = lseek64(fd, 0, SEEK_CUR);
-    if (current_offset == -1) {
-      ALOGW("Zip: unable to seek to current location on fd %d: %s", fd, strerror(errno));
-      return FileWriter{};
-    }
-
-#if defined(__linux__)
-    if (declared_length > 0) {
-      // Make sure we have enough space on the volume to extract the compressed
-      // entry. Note that the call to ftruncate below will change the file size but
-      // will not allocate space on disk and this call to fallocate will not
-      // change the file size.
-      // Note: fallocate is only supported by the following filesystems -
-      // btrfs, ext4, ocfs2, and xfs. Therefore fallocate might fail with
-      // EOPNOTSUPP error when issued in other filesystems.
-      // Hence, check for the return error code before concluding that the
-      // disk does not have enough space.
-      long result = TEMP_FAILURE_RETRY(fallocate(fd, 0, current_offset, declared_length));
-      if (result == -1 && errno == ENOSPC) {
-        ALOGW("Zip: unable to allocate %" PRId64 " bytes at offset %" PRId64 ": %s",
-              static_cast<int64_t>(declared_length), static_cast<int64_t>(current_offset),
-              strerror(errno));
-        return FileWriter{};
-      }
-    }
-#endif  // __linux__
-
-    struct stat sb;
-    if (fstat(fd, &sb) == -1) {
-      ALOGW("Zip: unable to fstat file: %s", strerror(errno));
-      return FileWriter{};
-    }
-
-    // Block device doesn't support ftruncate(2).
-    if (!S_ISBLK(sb.st_mode)) {
-      long result = TEMP_FAILURE_RETRY(ftruncate(fd, declared_length + current_offset));
-      if (result == -1) {
-        ALOGW("Zip: unable to truncate file to %" PRId64 ": %s",
-              static_cast<int64_t>(declared_length + current_offset), strerror(errno));
-        return FileWriter{};
-      }
-    }
-
-    return FileWriter(fd, declared_length);
-  }
-
-  FileWriter(FileWriter&& other) noexcept
-      : fd_(other.fd_),
-        declared_length_(other.declared_length_),
-        total_bytes_written_(other.total_bytes_written_) {
-    other.fd_ = -1;
-  }
-
-  bool IsValid() const { return fd_ != -1; }
-
-  virtual bool Append(uint8_t* buf, size_t buf_size) override {
-    if (total_bytes_written_ + buf_size > declared_length_) {
-      ALOGW("Zip: Unexpected size %zu (declared) vs %zu (actual)", declared_length_,
-            total_bytes_written_ + buf_size);
-      return false;
-    }
-
-    const bool result = android::base::WriteFully(fd_, buf, buf_size);
-    if (result) {
-      total_bytes_written_ += buf_size;
-    } else {
-      ALOGW("Zip: unable to write %zu bytes to file; %s", buf_size, strerror(errno));
-    }
-
-    return result;
-  }
-
- private:
-  explicit FileWriter(const int fd = -1, const size_t declared_length = 0)
-      : Writer(), fd_(fd), declared_length_(declared_length), total_bytes_written_(0) {}
-
-  int fd_;
-  const size_t declared_length_;
-  size_t total_bytes_written_;
-};
-
-class EntryReader : public zip_archive::Reader {
- public:
-  EntryReader(const MappedZipFile& zip_file, const ZipEntry* entry)
-      : Reader(), zip_file_(zip_file), entry_(entry) {}
-
-  virtual bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
-    return zip_file_.ReadAtOffset(buf, len, entry_->offset + offset);
-  }
-
-  virtual ~EntryReader() {}
-
- private:
-  const MappedZipFile& zip_file_;
-  const ZipEntry* entry_;
-};
-
-// This method is using libz macros with old-style-casts
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-static inline int zlib_inflateInit2(z_stream* stream, int window_bits) {
-  return inflateInit2(stream, window_bits);
-}
-#pragma GCC diagnostic pop
-
-namespace zip_archive {
-
-// Moved out of line to avoid -Wweak-vtables.
-Reader::~Reader() {}
-Writer::~Writer() {}
-
-int32_t Inflate(const Reader& reader, const uint32_t compressed_length,
-                const uint32_t uncompressed_length, Writer* writer, uint64_t* crc_out) {
-  const size_t kBufSize = 32768;
-  std::vector<uint8_t> read_buf(kBufSize);
-  std::vector<uint8_t> write_buf(kBufSize);
-  z_stream zstream;
-  int zerr;
-
-  /*
-   * Initialize the zlib stream struct.
-   */
-  memset(&zstream, 0, sizeof(zstream));
-  zstream.zalloc = Z_NULL;
-  zstream.zfree = Z_NULL;
-  zstream.opaque = Z_NULL;
-  zstream.next_in = NULL;
-  zstream.avail_in = 0;
-  zstream.next_out = &write_buf[0];
-  zstream.avail_out = kBufSize;
-  zstream.data_type = Z_UNKNOWN;
-
-  /*
-   * Use the undocumented "negative window bits" feature to tell zlib
-   * that there's no zlib header waiting for it.
-   */
-  zerr = zlib_inflateInit2(&zstream, -MAX_WBITS);
-  if (zerr != Z_OK) {
-    if (zerr == Z_VERSION_ERROR) {
-      ALOGE("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION);
-    } else {
-      ALOGW("Call to inflateInit2 failed (zerr=%d)", zerr);
-    }
-
-    return kZlibError;
-  }
-
-  auto zstream_deleter = [](z_stream* stream) {
-    inflateEnd(stream); /* free up any allocated structures */
-  };
-
-  std::unique_ptr<z_stream, decltype(zstream_deleter)> zstream_guard(&zstream, zstream_deleter);
-
-  const bool compute_crc = (crc_out != nullptr);
-  uLong crc = 0;
-  uint32_t remaining_bytes = compressed_length;
-  do {
-    /* read as much as we can */
-    if (zstream.avail_in == 0) {
-      const uint32_t read_size = (remaining_bytes > kBufSize) ? kBufSize : remaining_bytes;
-      const uint32_t offset = (compressed_length - remaining_bytes);
-      // Make sure to read at offset to ensure concurrent access to the fd.
-      if (!reader.ReadAtOffset(read_buf.data(), read_size, offset)) {
-        ALOGW("Zip: inflate read failed, getSize = %u: %s", read_size, strerror(errno));
-        return kIoError;
-      }
-
-      remaining_bytes -= read_size;
-
-      zstream.next_in = &read_buf[0];
-      zstream.avail_in = read_size;
-    }
-
-    /* uncompress the data */
-    zerr = inflate(&zstream, Z_NO_FLUSH);
-    if (zerr != Z_OK && zerr != Z_STREAM_END) {
-      ALOGW("Zip: inflate zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)", zerr, zstream.next_in,
-            zstream.avail_in, zstream.next_out, zstream.avail_out);
-      return kZlibError;
-    }
-
-    /* write when we're full or when we're done */
-    if (zstream.avail_out == 0 || (zerr == Z_STREAM_END && zstream.avail_out != kBufSize)) {
-      const size_t write_size = zstream.next_out - &write_buf[0];
-      if (!writer->Append(&write_buf[0], write_size)) {
-        return kIoError;
-      } else if (compute_crc) {
-        DCHECK_LE(write_size, kBufSize);
-        crc = crc32(crc, &write_buf[0], static_cast<uint32_t>(write_size));
-      }
-
-      zstream.next_out = &write_buf[0];
-      zstream.avail_out = kBufSize;
-    }
-  } while (zerr == Z_OK);
-
-  CHECK_EQ(zerr, Z_STREAM_END); /* other errors should've been caught */
-
-  // NOTE: zstream.adler is always set to 0, because we're using the -MAX_WBITS
-  // "feature" of zlib to tell it there won't be a zlib file header. zlib
-  // doesn't bother calculating the checksum in that scenario. We just do
-  // it ourselves above because there are no additional gains to be made by
-  // having zlib calculate it for us, since they do it by calling crc32 in
-  // the same manner that we have above.
-  if (compute_crc) {
-    *crc_out = crc;
-  }
-
-  if (zstream.total_out != uncompressed_length || remaining_bytes != 0) {
-    ALOGW("Zip: size mismatch on inflated file (%lu vs %" PRIu32 ")", zstream.total_out,
-          uncompressed_length);
-    return kInconsistentInformation;
-  }
-
-  return 0;
-}
-}  // namespace zip_archive
-
-static int32_t InflateEntryToWriter(MappedZipFile& mapped_zip, const ZipEntry* entry,
-                                    zip_archive::Writer* writer, uint64_t* crc_out) {
-  const EntryReader reader(mapped_zip, entry);
-
-  return zip_archive::Inflate(reader, entry->compressed_length, entry->uncompressed_length, writer,
-                              crc_out);
-}
-
-static int32_t CopyEntryToWriter(MappedZipFile& mapped_zip, const ZipEntry* entry,
-                                 zip_archive::Writer* writer, uint64_t* crc_out) {
-  static const uint32_t kBufSize = 32768;
-  std::vector<uint8_t> buf(kBufSize);
-
-  const uint32_t length = entry->uncompressed_length;
-  uint32_t count = 0;
-  uLong crc = 0;
-  while (count < length) {
-    uint32_t remaining = length - count;
-    off64_t offset = entry->offset + count;
-
-    // Safe conversion because kBufSize is narrow enough for a 32 bit signed value.
-    const uint32_t block_size = (remaining > kBufSize) ? kBufSize : remaining;
-
-    // Make sure to read at offset to ensure concurrent access to the fd.
-    if (!mapped_zip.ReadAtOffset(buf.data(), block_size, offset)) {
-      ALOGW("CopyFileToFile: copy read failed, block_size = %u, offset = %" PRId64 ": %s",
-            block_size, static_cast<int64_t>(offset), strerror(errno));
-      return kIoError;
-    }
-
-    if (!writer->Append(&buf[0], block_size)) {
-      return kIoError;
-    }
-    if (crc_out) {
-      crc = crc32(crc, &buf[0], block_size);
-    }
-    count += block_size;
-  }
-
-  if (crc_out) {
-    *crc_out = crc;
-  }
-
-  return 0;
-}
-
-int32_t ExtractToWriter(ZipArchiveHandle archive, ZipEntry* entry, zip_archive::Writer* writer) {
-  const uint16_t method = entry->method;
-
-  // this should default to kUnknownCompressionMethod.
-  int32_t return_value = -1;
-  uint64_t crc = 0;
-  if (method == kCompressStored) {
-    return_value =
-        CopyEntryToWriter(archive->mapped_zip, entry, writer, kCrcChecksEnabled ? &crc : nullptr);
-  } else if (method == kCompressDeflated) {
-    return_value = InflateEntryToWriter(archive->mapped_zip, entry, writer,
-                                        kCrcChecksEnabled ? &crc : nullptr);
-  }
-
-  if (!return_value && entry->has_data_descriptor) {
-    return_value = ValidateDataDescriptor(archive->mapped_zip, entry);
-    if (return_value) {
-      return return_value;
-    }
-  }
-
-  // Validate that the CRC matches the calculated value.
-  if (kCrcChecksEnabled && (entry->crc32 != static_cast<uint32_t>(crc))) {
-    ALOGW("Zip: crc mismatch: expected %" PRIu32 ", was %" PRIu64, entry->crc32, crc);
-    return kInconsistentInformation;
-  }
-
-  return return_value;
-}
-
-int32_t ExtractToMemory(ZipArchiveHandle archive, ZipEntry* entry, uint8_t* begin, uint32_t size) {
-  MemoryWriter writer(begin, size);
-  return ExtractToWriter(archive, entry, &writer);
-}
-
-int32_t ExtractEntryToFile(ZipArchiveHandle archive, ZipEntry* entry, int fd) {
-  auto writer = FileWriter::Create(fd, entry);
-  if (!writer.IsValid()) {
-    return kIoError;
-  }
-
-  return ExtractToWriter(archive, entry, &writer);
-}
-
-const char* ErrorCodeString(int32_t error_code) {
-  // Make sure that the number of entries in kErrorMessages and ErrorCodes
-  // match.
-  static_assert((-kLastErrorCode + 1) == arraysize(kErrorMessages),
-                "(-kLastErrorCode + 1) != arraysize(kErrorMessages)");
-
-  const uint32_t idx = -error_code;
-  if (idx < arraysize(kErrorMessages)) {
-    return kErrorMessages[idx];
-  }
-
-  return "Unknown return code";
-}
-
-int GetFileDescriptor(const ZipArchiveHandle archive) {
-  return archive->mapped_zip.GetFileDescriptor();
-}
-
-off64_t GetFileDescriptorOffset(const ZipArchiveHandle archive) {
-  return archive->mapped_zip.GetFileOffset();
-}
-
-#if !defined(_WIN32)
-class ProcessWriter : public zip_archive::Writer {
- public:
-  ProcessWriter(ProcessZipEntryFunction func, void* cookie)
-      : Writer(), proc_function_(func), cookie_(cookie) {}
-
-  virtual bool Append(uint8_t* buf, size_t buf_size) override {
-    return proc_function_(buf, buf_size, cookie_);
-  }
-
- private:
-  ProcessZipEntryFunction proc_function_;
-  void* cookie_;
-};
-
-int32_t ProcessZipEntryContents(ZipArchiveHandle archive, ZipEntry* entry,
-                                ProcessZipEntryFunction func, void* cookie) {
-  ProcessWriter writer(func, cookie);
-  return ExtractToWriter(archive, entry, &writer);
-}
-
-#endif  //! defined(_WIN32)
-
-int MappedZipFile::GetFileDescriptor() const {
-  if (!has_fd_) {
-    ALOGW("Zip: MappedZipFile doesn't have a file descriptor.");
-    return -1;
-  }
-  return fd_;
-}
-
-const void* MappedZipFile::GetBasePtr() const {
-  if (has_fd_) {
-    ALOGW("Zip: MappedZipFile doesn't have a base pointer.");
-    return nullptr;
-  }
-  return base_ptr_;
-}
-
-off64_t MappedZipFile::GetFileOffset() const {
-  return fd_offset_;
-}
-
-off64_t MappedZipFile::GetFileLength() const {
-  if (has_fd_) {
-    if (data_length_ != -1) {
-      return data_length_;
-    }
-    data_length_ = lseek64(fd_, 0, SEEK_END);
-    if (data_length_ == -1) {
-      ALOGE("Zip: lseek on fd %d failed: %s", fd_, strerror(errno));
-    }
-    return data_length_;
-  } else {
-    if (base_ptr_ == nullptr) {
-      ALOGE("Zip: invalid file map");
-      return -1;
-    }
-    return data_length_;
-  }
-}
-
-// Attempts to read |len| bytes into |buf| at offset |off|.
-bool MappedZipFile::ReadAtOffset(uint8_t* buf, size_t len, off64_t off) const {
-  if (has_fd_) {
-    if (off < 0) {
-      ALOGE("Zip: invalid offset %" PRId64, off);
-      return false;
-    }
-
-    off64_t read_offset;
-    if (__builtin_add_overflow(fd_offset_, off, &read_offset)) {
-      ALOGE("Zip: invalid read offset %" PRId64 " overflows, fd offset %" PRId64, off, fd_offset_);
-      return false;
-    }
-
-    if (data_length_ != -1) {
-      off64_t read_end;
-      if (len > std::numeric_limits<off64_t>::max() ||
-          __builtin_add_overflow(off, static_cast<off64_t>(len), &read_end)) {
-        ALOGE("Zip: invalid read length %" PRId64 " overflows, offset %" PRId64,
-              static_cast<off64_t>(len), off);
-        return false;
-      }
-
-      if (read_end > data_length_) {
-        ALOGE("Zip: invalid read length %" PRId64 " exceeds data length %" PRId64 ", offset %"
-              PRId64, static_cast<off64_t>(len), data_length_, off);
-        return false;
-      }
-    }
-
-    if (!android::base::ReadFullyAtOffset(fd_, buf, len, read_offset)) {
-      ALOGE("Zip: failed to read at offset %" PRId64, off);
-      return false;
-    }
-  } else {
-    if (off < 0 || off > data_length_) {
-      ALOGE("Zip: invalid offset: %" PRId64 ", data length: %" PRId64, off, data_length_);
-      return false;
-    }
-    memcpy(buf, static_cast<const uint8_t*>(base_ptr_) + off, len);
-  }
-  return true;
-}
-
-void CentralDirectory::Initialize(const void* map_base_ptr, off64_t cd_start_offset,
-                                  size_t cd_size) {
-  base_ptr_ = static_cast<const uint8_t*>(map_base_ptr) + cd_start_offset;
-  length_ = cd_size;
-}
-
-bool ZipArchive::InitializeCentralDirectory(off64_t cd_start_offset, size_t cd_size) {
-  if (mapped_zip.HasFd()) {
-    directory_map = android::base::MappedFile::FromFd(mapped_zip.GetFileDescriptor(),
-                                                      mapped_zip.GetFileOffset() + cd_start_offset,
-                                                      cd_size, PROT_READ);
-    if (!directory_map) {
-      ALOGE("Zip: failed to map central directory (offset %" PRId64 ", size %zu): %s",
-            cd_start_offset, cd_size, strerror(errno));
-      return false;
-    }
-
-    CHECK_EQ(directory_map->size(), cd_size);
-    central_directory.Initialize(directory_map->data(), 0 /*offset*/, cd_size);
-  } else {
-    if (mapped_zip.GetBasePtr() == nullptr) {
-      ALOGE("Zip: Failed to map central directory, bad mapped_zip base pointer");
-      return false;
-    }
-    if (static_cast<off64_t>(cd_start_offset) + static_cast<off64_t>(cd_size) >
-        mapped_zip.GetFileLength()) {
-      ALOGE(
-          "Zip: Failed to map central directory, offset exceeds mapped memory region ("
-          "start_offset %" PRId64 ", cd_size %zu, mapped_region_size %" PRId64 ")",
-          static_cast<int64_t>(cd_start_offset), cd_size, mapped_zip.GetFileLength());
-      return false;
-    }
-
-    central_directory.Initialize(mapped_zip.GetBasePtr(), cd_start_offset, cd_size);
-  }
-  return true;
-}
-
-// This function returns the embedded timestamp as is; and doesn't perform validations.
-tm ZipEntry::GetModificationTime() const {
-  tm t = {};
-
-  t.tm_hour = (mod_time >> 11) & 0x1f;
-  t.tm_min = (mod_time >> 5) & 0x3f;
-  t.tm_sec = (mod_time & 0x1f) << 1;
-
-  t.tm_year = ((mod_time >> 25) & 0x7f) + 80;
-  t.tm_mon = ((mod_time >> 21) & 0xf) - 1;
-  t.tm_mday = (mod_time >> 16) & 0x1f;
-
-  return t;
-}
diff --git a/libziparchive/zip_archive_benchmark.cpp b/libziparchive/zip_archive_benchmark.cpp
deleted file mode 100644
index cfa5912..0000000
--- a/libziparchive/zip_archive_benchmark.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <string>
-#include <tuple>
-#include <vector>
-
-#include <android-base/test_utils.h>
-#include <benchmark/benchmark.h>
-#include <ziparchive/zip_archive.h>
-#include <ziparchive/zip_archive_stream_entry.h>
-#include <ziparchive/zip_writer.h>
-
-static std::unique_ptr<TemporaryFile> CreateZip(int size = 4, int count = 1000) {
-  auto result = std::make_unique<TemporaryFile>();
-  FILE* fp = fdopen(result->fd, "w");
-
-  ZipWriter writer(fp);
-  std::string lastName = "file";
-  for (size_t i = 0; i < count; i++) {
-    // Make file names longer and longer.
-    lastName = lastName + std::to_string(i);
-    writer.StartEntry(lastName.c_str(), ZipWriter::kCompress);
-    while (size > 0) {
-      writer.WriteBytes("helo", 4);
-      size -= 4;
-    }
-    writer.FinishEntry();
-  }
-  writer.Finish();
-  fclose(fp);
-
-  return result;
-}
-
-static void FindEntry_no_match(benchmark::State& state) {
-  // Create a temporary zip archive.
-  std::unique_ptr<TemporaryFile> temp_file(CreateZip());
-  ZipArchiveHandle handle;
-  ZipEntry data;
-
-  // In order to walk through all file names in the archive, look for a name
-  // that does not exist in the archive.
-  std::string_view name("thisFileNameDoesNotExist");
-
-  // Start the benchmark.
-  for (auto _ : state) {
-    OpenArchive(temp_file->path, &handle);
-    FindEntry(handle, name, &data);
-    CloseArchive(handle);
-  }
-}
-BENCHMARK(FindEntry_no_match);
-
-static void Iterate_all_files(benchmark::State& state) {
-  std::unique_ptr<TemporaryFile> temp_file(CreateZip());
-  ZipArchiveHandle handle;
-  void* iteration_cookie;
-  ZipEntry data;
-  std::string name;
-
-  for (auto _ : state) {
-    OpenArchive(temp_file->path, &handle);
-    StartIteration(handle, &iteration_cookie);
-    while (Next(iteration_cookie, &data, &name) == 0) {
-    }
-    EndIteration(iteration_cookie);
-    CloseArchive(handle);
-  }
-}
-BENCHMARK(Iterate_all_files);
-
-static void StartAlignedEntry(benchmark::State& state) {
-  TemporaryFile file;
-  FILE* fp = fdopen(file.fd, "w");
-
-  ZipWriter writer(fp);
-
-  auto alignment = uint32_t(state.range(0));
-  std::string name = "name";
-  int counter = 0;
-  for (auto _ : state) {
-    writer.StartAlignedEntry(name + std::to_string(counter++), 0, alignment);
-    state.PauseTiming();
-    writer.WriteBytes("hola", 4);
-    writer.FinishEntry();
-    state.ResumeTiming();
-  }
-
-  writer.Finish();
-  fclose(fp);
-}
-BENCHMARK(StartAlignedEntry)->Arg(2)->Arg(16)->Arg(1024)->Arg(4096);
-
-static void ExtractEntry(benchmark::State& state) {
-  std::unique_ptr<TemporaryFile> temp_file(CreateZip(1024 * 1024, 1));
-
-  ZipArchiveHandle handle;
-  ZipEntry data;
-  if (OpenArchive(temp_file->path, &handle)) {
-    state.SkipWithError("Failed to open archive");
-  }
-  if (FindEntry(handle, "file0", &data)) {
-    state.SkipWithError("Failed to find archive entry");
-  }
-
-  std::vector<uint8_t> buffer(1024 * 1024);
-  for (auto _ : state) {
-    if (ExtractToMemory(handle, &data, buffer.data(), uint32_t(buffer.size()))) {
-      state.SkipWithError("Failed to extract archive entry");
-      break;
-    }
-  }
-  CloseArchive(handle);
-}
-
-BENCHMARK(ExtractEntry)->Arg(2)->Arg(16)->Arg(1024);
-
-BENCHMARK_MAIN();
diff --git a/libziparchive/zip_archive_common.h b/libziparchive/zip_archive_common.h
deleted file mode 100644
index 8b99bde..0000000
--- a/libziparchive/zip_archive_common.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef LIBZIPARCHIVE_ZIPARCHIVECOMMON_H_
-#define LIBZIPARCHIVE_ZIPARCHIVECOMMON_H_
-
-#include "android-base/macros.h"
-
-#include <inttypes.h>
-
-// The "end of central directory" (EOCD) record. Each archive
-// contains exactly once such record which appears at the end of
-// the archive. It contains archive wide information like the
-// number of entries in the archive and the offset to the central
-// directory of the offset.
-struct EocdRecord {
-  static const uint32_t kSignature = 0x06054b50;
-
-  // End of central directory signature, should always be
-  // |kSignature|.
-  uint32_t eocd_signature;
-  // The number of the current "disk", i.e, the "disk" that this
-  // central directory is on.
-  //
-  // This implementation assumes that each archive spans a single
-  // disk only. i.e, that disk_num == 1.
-  uint16_t disk_num;
-  // The disk where the central directory starts.
-  //
-  // This implementation assumes that each archive spans a single
-  // disk only. i.e, that cd_start_disk == 1.
-  uint16_t cd_start_disk;
-  // The number of central directory records on this disk.
-  //
-  // This implementation assumes that each archive spans a single
-  // disk only. i.e, that num_records_on_disk == num_records.
-  uint16_t num_records_on_disk;
-  // The total number of central directory records.
-  uint16_t num_records;
-  // The size of the central directory (in bytes).
-  uint32_t cd_size;
-  // The offset of the start of the central directory, relative
-  // to the start of the file.
-  uint32_t cd_start_offset;
-  // Length of the central directory comment.
-  uint16_t comment_length;
-
- private:
-  EocdRecord() = default;
-  DISALLOW_COPY_AND_ASSIGN(EocdRecord);
-} __attribute__((packed));
-
-// A structure representing the fixed length fields for a single
-// record in the central directory of the archive. In addition to
-// the fixed length fields listed here, each central directory
-// record contains a variable length "file_name" and "extra_field"
-// whose lengths are given by |file_name_length| and |extra_field_length|
-// respectively.
-struct CentralDirectoryRecord {
-  static const uint32_t kSignature = 0x02014b50;
-
-  // The start of record signature. Must be |kSignature|.
-  uint32_t record_signature;
-  // Source tool version. Top byte gives source OS.
-  uint16_t version_made_by;
-  // Tool version. Ignored by this implementation.
-  uint16_t version_needed;
-  // The "general purpose bit flags" for this entry. The only
-  // flag value that we currently check for is the "data descriptor"
-  // flag.
-  uint16_t gpb_flags;
-  // The compression method for this entry, one of |kCompressStored|
-  // and |kCompressDeflated|.
-  uint16_t compression_method;
-  // The file modification time and date for this entry.
-  uint16_t last_mod_time;
-  uint16_t last_mod_date;
-  // The CRC-32 checksum for this entry.
-  uint32_t crc32;
-  // The compressed size (in bytes) of this entry.
-  uint32_t compressed_size;
-  // The uncompressed size (in bytes) of this entry.
-  uint32_t uncompressed_size;
-  // The length of the entry file name in bytes. The file name
-  // will appear immediately after this record.
-  uint16_t file_name_length;
-  // The length of the extra field info (in bytes). This data
-  // will appear immediately after the entry file name.
-  uint16_t extra_field_length;
-  // The length of the entry comment (in bytes). This data will
-  // appear immediately after the extra field.
-  uint16_t comment_length;
-  // The start disk for this entry. Ignored by this implementation).
-  uint16_t file_start_disk;
-  // File attributes. Ignored by this implementation.
-  uint16_t internal_file_attributes;
-  // File attributes. For archives created on Unix, the top bits are the mode.
-  uint32_t external_file_attributes;
-  // The offset to the local file header for this entry, from the
-  // beginning of this archive.
-  uint32_t local_file_header_offset;
-
- private:
-  CentralDirectoryRecord() = default;
-  DISALLOW_COPY_AND_ASSIGN(CentralDirectoryRecord);
-} __attribute__((packed));
-
-// The local file header for a given entry. This duplicates information
-// present in the central directory of the archive. It is an error for
-// the information here to be different from the central directory
-// information for a given entry.
-struct LocalFileHeader {
-  static const uint32_t kSignature = 0x04034b50;
-
-  // The local file header signature, must be |kSignature|.
-  uint32_t lfh_signature;
-  // Tool version. Ignored by this implementation.
-  uint16_t version_needed;
-  // The "general purpose bit flags" for this entry. The only
-  // flag value that we currently check for is the "data descriptor"
-  // flag.
-  uint16_t gpb_flags;
-  // The compression method for this entry, one of |kCompressStored|
-  // and |kCompressDeflated|.
-  uint16_t compression_method;
-  // The file modification time and date for this entry.
-  uint16_t last_mod_time;
-  uint16_t last_mod_date;
-  // The CRC-32 checksum for this entry.
-  uint32_t crc32;
-  // The compressed size (in bytes) of this entry.
-  uint32_t compressed_size;
-  // The uncompressed size (in bytes) of this entry.
-  uint32_t uncompressed_size;
-  // The length of the entry file name in bytes. The file name
-  // will appear immediately after this record.
-  uint16_t file_name_length;
-  // The length of the extra field info (in bytes). This data
-  // will appear immediately after the entry file name.
-  uint16_t extra_field_length;
-
- private:
-  LocalFileHeader() = default;
-  DISALLOW_COPY_AND_ASSIGN(LocalFileHeader);
-} __attribute__((packed));
-
-struct DataDescriptor {
-  // The *optional* data descriptor start signature.
-  static const uint32_t kOptSignature = 0x08074b50;
-
-  // CRC-32 checksum of the entry.
-  uint32_t crc32;
-  // Compressed size of the entry.
-  uint32_t compressed_size;
-  // Uncompressed size of the entry.
-  uint32_t uncompressed_size;
-
- private:
-  DataDescriptor() = default;
-  DISALLOW_COPY_AND_ASSIGN(DataDescriptor);
-} __attribute__((packed));
-
-// mask value that signifies that the entry has a DD
-static const uint32_t kGPBDDFlagMask = 0x0008;
-
-// The maximum size of a central directory or a file
-// comment in bytes.
-static const uint32_t kMaxCommentLen = 65535;
-
-#endif /* LIBZIPARCHIVE_ZIPARCHIVECOMMON_H_ */
diff --git a/libziparchive/zip_archive_private.h b/libziparchive/zip_archive_private.h
deleted file mode 100644
index 3625038..0000000
--- a/libziparchive/zip_archive_private.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#pragma once
-
-#include <ziparchive/zip_archive.h>
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#include "android-base/macros.h"
-#include "android-base/mapped_file.h"
-
-static const char* kErrorMessages[] = {
-    "Success",
-    "Iteration ended",
-    "Zlib error",
-    "Invalid file",
-    "Invalid handle",
-    "Duplicate entries in archive",
-    "Empty archive",
-    "Entry not found",
-    "Invalid offset",
-    "Inconsistent information",
-    "Invalid entry name",
-    "I/O error",
-    "File mapping failed",
-    "Allocation failed",
-};
-
-enum ErrorCodes : int32_t {
-  kIterationEnd = -1,
-
-  // We encountered a Zlib error when inflating a stream from this file.
-  // Usually indicates file corruption.
-  kZlibError = -2,
-
-  // The input file cannot be processed as a zip archive. Usually because
-  // it's too small, too large or does not have a valid signature.
-  kInvalidFile = -3,
-
-  // An invalid iteration / ziparchive handle was passed in as an input
-  // argument.
-  kInvalidHandle = -4,
-
-  // The zip archive contained two (or possibly more) entries with the same
-  // name.
-  kDuplicateEntry = -5,
-
-  // The zip archive contains no entries.
-  kEmptyArchive = -6,
-
-  // The specified entry was not found in the archive.
-  kEntryNotFound = -7,
-
-  // The zip archive contained an invalid local file header pointer.
-  kInvalidOffset = -8,
-
-  // The zip archive contained inconsistent entry information. This could
-  // be because the central directory & local file header did not agree, or
-  // if the actual uncompressed length or crc32 do not match their declared
-  // values.
-  kInconsistentInformation = -9,
-
-  // An invalid entry name was encountered.
-  kInvalidEntryName = -10,
-
-  // An I/O related system call (read, lseek, ftruncate, map) failed.
-  kIoError = -11,
-
-  // We were not able to mmap the central directory or entry contents.
-  kMmapFailed = -12,
-
-  // An allocation failed.
-  kAllocationFailed = -13,
-
-  kLastErrorCode = kAllocationFailed,
-};
-
-class MappedZipFile {
- public:
-  explicit MappedZipFile(const int fd)
-      : has_fd_(true), fd_(fd), fd_offset_(0), base_ptr_(nullptr), data_length_(-1) {}
-
-  explicit MappedZipFile(const int fd, off64_t length, off64_t offset)
-      : has_fd_(true), fd_(fd), fd_offset_(offset), base_ptr_(nullptr), data_length_(length) {}
-
-  explicit MappedZipFile(const void* address, size_t length)
-      : has_fd_(false), fd_(-1), fd_offset_(0), base_ptr_(address),
-        data_length_(static_cast<off64_t>(length)) {}
-
-  bool HasFd() const { return has_fd_; }
-
-  int GetFileDescriptor() const;
-
-  const void* GetBasePtr() const;
-
-  off64_t GetFileOffset() const;
-
-  off64_t GetFileLength() const;
-
-  bool ReadAtOffset(uint8_t* buf, size_t len, off64_t off) const;
-
- private:
-  // If has_fd_ is true, fd is valid and we'll read contents of a zip archive
-  // from the file. Otherwise, we're opening the archive from a memory mapped
-  // file. In that case, base_ptr_ points to the start of the memory region and
-  // data_length_ defines the file length.
-  const bool has_fd_;
-
-  const int fd_;
-  const off64_t fd_offset_;
-
-  const void* const base_ptr_;
-  mutable off64_t data_length_;
-};
-
-class CentralDirectory {
- public:
-  CentralDirectory(void) : base_ptr_(nullptr), length_(0) {}
-
-  const uint8_t* GetBasePtr() const { return base_ptr_; }
-
-  size_t GetMapLength() const { return length_; }
-
-  void Initialize(const void* map_base_ptr, off64_t cd_start_offset, size_t cd_size);
-
- private:
-  const uint8_t* base_ptr_;
-  size_t length_;
-};
-
-/**
- * More space efficient string representation of strings in an mmaped zipped
- * file than std::string_view. Using std::string_view as an entry in the
- * ZipArchive hash table wastes space. std::string_view stores a pointer to a
- * string (on 64 bit, 8 bytes) and the length to read from that pointer,
- * 2 bytes. Because of alignment, the structure consumes 16 bytes, wasting
- * 6 bytes.
- *
- * ZipStringOffset stores a 4 byte offset from a fixed location in the memory
- * mapped file instead of the entire address, consuming 8 bytes with alignment.
- */
-struct ZipStringOffset {
-  uint32_t name_offset;
-  uint16_t name_length;
-
-  const std::string_view ToStringView(const uint8_t* start) const {
-    return std::string_view{reinterpret_cast<const char*>(start + name_offset), name_length};
-  }
-};
-
-struct ZipArchive {
-  // open Zip archive
-  mutable MappedZipFile mapped_zip;
-  const bool close_file;
-
-  // mapped central directory area
-  off64_t directory_offset;
-  CentralDirectory central_directory;
-  std::unique_ptr<android::base::MappedFile> directory_map;
-
-  // number of entries in the Zip archive
-  uint16_t num_entries;
-
-  // We know how many entries are in the Zip archive, so we can have a
-  // fixed-size hash table. We define a load factor of 0.75 and over
-  // allocate so the maximum number entries can never be higher than
-  // ((4 * UINT16_MAX) / 3 + 1) which can safely fit into a uint32_t.
-  uint32_t hash_table_size;
-  ZipStringOffset* hash_table;
-
-  ZipArchive(MappedZipFile&& map, bool assume_ownership);
-  ZipArchive(const void* address, size_t length);
-  ~ZipArchive();
-
-  bool InitializeCentralDirectory(off64_t cd_start_offset, size_t cd_size);
-};
diff --git a/libziparchive/zip_archive_stream_entry.cc b/libziparchive/zip_archive_stream_entry.cc
deleted file mode 100644
index 1ec95b6..0000000
--- a/libziparchive/zip_archive_stream_entry.cc
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#define LOG_TAG "ZIPARCHIVE"
-
-// Read-only stream access to Zip Archive entries.
-#include <errno.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <log/log.h>
-
-#include <ziparchive/zip_archive.h>
-#include <ziparchive/zip_archive_stream_entry.h>
-#include <zlib.h>
-
-#include "zip_archive_private.h"
-
-static constexpr size_t kBufSize = 65535;
-
-bool ZipArchiveStreamEntry::Init(const ZipEntry& entry) {
-  crc32_ = entry.crc32;
-  offset_ = entry.offset;
-  return true;
-}
-
-class ZipArchiveStreamEntryUncompressed : public ZipArchiveStreamEntry {
- public:
-  explicit ZipArchiveStreamEntryUncompressed(ZipArchiveHandle handle)
-      : ZipArchiveStreamEntry(handle) {}
-  virtual ~ZipArchiveStreamEntryUncompressed() {}
-
-  const std::vector<uint8_t>* Read() override;
-
-  bool Verify() override;
-
- protected:
-  bool Init(const ZipEntry& entry) override;
-
-  uint32_t length_ = 0u;
-
- private:
-  std::vector<uint8_t> data_;
-  uint32_t computed_crc32_ = 0u;
-};
-
-bool ZipArchiveStreamEntryUncompressed::Init(const ZipEntry& entry) {
-  if (!ZipArchiveStreamEntry::Init(entry)) {
-    return false;
-  }
-
-  length_ = entry.uncompressed_length;
-
-  data_.resize(kBufSize);
-  computed_crc32_ = 0;
-
-  return true;
-}
-
-const std::vector<uint8_t>* ZipArchiveStreamEntryUncompressed::Read() {
-  // Simple sanity check. The vector should *only* be handled by this code. A caller
-  // should not const-cast and modify the capacity. This may invalidate next_out.
-  //
-  // Note: it would be better to store the results of data() across Read calls.
-  CHECK_EQ(data_.capacity(), kBufSize);
-
-  if (length_ == 0) {
-    return nullptr;
-  }
-
-  size_t bytes = (length_ > data_.size()) ? data_.size() : length_;
-  ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle_);
-  errno = 0;
-  if (!archive->mapped_zip.ReadAtOffset(data_.data(), bytes, offset_)) {
-    if (errno != 0) {
-      ALOGE("Error reading from archive fd: %s", strerror(errno));
-    } else {
-      ALOGE("Short read of zip file, possibly corrupted zip?");
-    }
-    length_ = 0;
-    return nullptr;
-  }
-
-  if (bytes < data_.size()) {
-    data_.resize(bytes);
-  }
-  computed_crc32_ = static_cast<uint32_t>(
-      crc32(computed_crc32_, data_.data(), static_cast<uint32_t>(data_.size())));
-  length_ -= bytes;
-  offset_ += bytes;
-  return &data_;
-}
-
-bool ZipArchiveStreamEntryUncompressed::Verify() {
-  return length_ == 0 && crc32_ == computed_crc32_;
-}
-
-class ZipArchiveStreamEntryCompressed : public ZipArchiveStreamEntry {
- public:
-  explicit ZipArchiveStreamEntryCompressed(ZipArchiveHandle handle)
-      : ZipArchiveStreamEntry(handle) {}
-  virtual ~ZipArchiveStreamEntryCompressed();
-
-  const std::vector<uint8_t>* Read() override;
-
-  bool Verify() override;
-
- protected:
-  bool Init(const ZipEntry& entry) override;
-
- private:
-  bool z_stream_init_ = false;
-  z_stream z_stream_;
-  std::vector<uint8_t> in_;
-  std::vector<uint8_t> out_;
-  uint32_t uncompressed_length_ = 0u;
-  uint32_t compressed_length_ = 0u;
-  uint32_t computed_crc32_ = 0u;
-};
-
-// This method is using libz macros with old-style-casts
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-static inline int zlib_inflateInit2(z_stream* stream, int window_bits) {
-  return inflateInit2(stream, window_bits);
-}
-#pragma GCC diagnostic pop
-
-bool ZipArchiveStreamEntryCompressed::Init(const ZipEntry& entry) {
-  if (!ZipArchiveStreamEntry::Init(entry)) {
-    return false;
-  }
-
-  // Initialize the zlib stream struct.
-  memset(&z_stream_, 0, sizeof(z_stream_));
-  z_stream_.zalloc = Z_NULL;
-  z_stream_.zfree = Z_NULL;
-  z_stream_.opaque = Z_NULL;
-  z_stream_.next_in = nullptr;
-  z_stream_.avail_in = 0;
-  z_stream_.avail_out = 0;
-  z_stream_.data_type = Z_UNKNOWN;
-
-  // Use the undocumented "negative window bits" feature to tell zlib
-  // that there's no zlib header waiting for it.
-  int zerr = zlib_inflateInit2(&z_stream_, -MAX_WBITS);
-  if (zerr != Z_OK) {
-    if (zerr == Z_VERSION_ERROR) {
-      ALOGE("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION);
-    } else {
-      ALOGE("Call to inflateInit2 failed (zerr=%d)", zerr);
-    }
-
-    return false;
-  }
-
-  z_stream_init_ = true;
-
-  uncompressed_length_ = entry.uncompressed_length;
-  compressed_length_ = entry.compressed_length;
-
-  out_.resize(kBufSize);
-  in_.resize(kBufSize);
-
-  computed_crc32_ = 0;
-
-  return true;
-}
-
-ZipArchiveStreamEntryCompressed::~ZipArchiveStreamEntryCompressed() {
-  if (z_stream_init_) {
-    inflateEnd(&z_stream_);
-    z_stream_init_ = false;
-  }
-}
-
-bool ZipArchiveStreamEntryCompressed::Verify() {
-  return z_stream_init_ && uncompressed_length_ == 0 && compressed_length_ == 0 &&
-         crc32_ == computed_crc32_;
-}
-
-const std::vector<uint8_t>* ZipArchiveStreamEntryCompressed::Read() {
-  // Simple sanity check. The vector should *only* be handled by this code. A caller
-  // should not const-cast and modify the capacity. This may invalidate next_out.
-  //
-  // Note: it would be better to store the results of data() across Read calls.
-  CHECK_EQ(out_.capacity(), kBufSize);
-
-  if (z_stream_.avail_out == 0) {
-    z_stream_.next_out = out_.data();
-    z_stream_.avail_out = static_cast<uint32_t>(out_.size());
-    ;
-  }
-
-  while (true) {
-    if (z_stream_.avail_in == 0) {
-      if (compressed_length_ == 0) {
-        return nullptr;
-      }
-      DCHECK_LE(in_.size(), std::numeric_limits<uint32_t>::max());  // Should be buf size = 64k.
-      uint32_t bytes = (compressed_length_ > in_.size()) ? static_cast<uint32_t>(in_.size())
-                                                         : compressed_length_;
-      ZipArchive* archive = reinterpret_cast<ZipArchive*>(handle_);
-      errno = 0;
-      if (!archive->mapped_zip.ReadAtOffset(in_.data(), bytes, offset_)) {
-        if (errno != 0) {
-          ALOGE("Error reading from archive fd: %s", strerror(errno));
-        } else {
-          ALOGE("Short read of zip file, possibly corrupted zip?");
-        }
-        return nullptr;
-      }
-
-      compressed_length_ -= bytes;
-      offset_ += bytes;
-      z_stream_.next_in = in_.data();
-      z_stream_.avail_in = bytes;
-    }
-
-    int zerr = inflate(&z_stream_, Z_NO_FLUSH);
-    if (zerr != Z_OK && zerr != Z_STREAM_END) {
-      ALOGE("inflate zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)", zerr, z_stream_.next_in,
-            z_stream_.avail_in, z_stream_.next_out, z_stream_.avail_out);
-      return nullptr;
-    }
-
-    if (z_stream_.avail_out == 0) {
-      uncompressed_length_ -= out_.size();
-      computed_crc32_ = static_cast<uint32_t>(
-          crc32(computed_crc32_, out_.data(), static_cast<uint32_t>(out_.size())));
-      return &out_;
-    }
-    if (zerr == Z_STREAM_END) {
-      if (z_stream_.avail_out != 0) {
-        // Resize the vector down to the actual size of the data.
-        out_.resize(out_.size() - z_stream_.avail_out);
-        computed_crc32_ = static_cast<uint32_t>(
-            crc32(computed_crc32_, out_.data(), static_cast<uint32_t>(out_.size())));
-        uncompressed_length_ -= out_.size();
-        return &out_;
-      }
-      return nullptr;
-    }
-  }
-  return nullptr;
-}
-
-class ZipArchiveStreamEntryRawCompressed : public ZipArchiveStreamEntryUncompressed {
- public:
-  explicit ZipArchiveStreamEntryRawCompressed(ZipArchiveHandle handle)
-      : ZipArchiveStreamEntryUncompressed(handle) {}
-  virtual ~ZipArchiveStreamEntryRawCompressed() {}
-
-  bool Verify() override;
-
- protected:
-  bool Init(const ZipEntry& entry) override;
-};
-
-bool ZipArchiveStreamEntryRawCompressed::Init(const ZipEntry& entry) {
-  if (!ZipArchiveStreamEntryUncompressed::Init(entry)) {
-    return false;
-  }
-  length_ = entry.compressed_length;
-
-  return true;
-}
-
-bool ZipArchiveStreamEntryRawCompressed::Verify() {
-  return length_ == 0;
-}
-
-ZipArchiveStreamEntry* ZipArchiveStreamEntry::Create(ZipArchiveHandle handle,
-                                                     const ZipEntry& entry) {
-  ZipArchiveStreamEntry* stream = nullptr;
-  if (entry.method != kCompressStored) {
-    stream = new ZipArchiveStreamEntryCompressed(handle);
-  } else {
-    stream = new ZipArchiveStreamEntryUncompressed(handle);
-  }
-  if (stream && !stream->Init(entry)) {
-    delete stream;
-    stream = nullptr;
-  }
-
-  return stream;
-}
-
-ZipArchiveStreamEntry* ZipArchiveStreamEntry::CreateRaw(ZipArchiveHandle handle,
-                                                        const ZipEntry& entry) {
-  ZipArchiveStreamEntry* stream = nullptr;
-  if (entry.method == kCompressStored) {
-    // Not compressed, don't need to do anything special.
-    stream = new ZipArchiveStreamEntryUncompressed(handle);
-  } else {
-    stream = new ZipArchiveStreamEntryRawCompressed(handle);
-  }
-  if (stream && !stream->Init(entry)) {
-    delete stream;
-    stream = nullptr;
-  }
-  return stream;
-}
diff --git a/libziparchive/zip_archive_test.cc b/libziparchive/zip_archive_test.cc
deleted file mode 100644
index 35fb3fe..0000000
--- a/libziparchive/zip_archive_test.cc
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include "zip_archive_private.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <memory>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/mapped_file.h>
-#include <android-base/unique_fd.h>
-#include <gtest/gtest.h>
-#include <ziparchive/zip_archive.h>
-#include <ziparchive/zip_archive_stream_entry.h>
-
-static std::string test_data_dir = android::base::GetExecutableDirectory() + "/testdata";
-
-static const std::string kValidZip = "valid.zip";
-static const std::string kLargeZip = "large.zip";
-static const std::string kBadCrcZip = "bad_crc.zip";
-
-static const std::vector<uint8_t> kATxtContents{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'a',
-                                                'b', 'c', 'd', 'e', 'f', 'g', 'h', '\n'};
-
-static const std::vector<uint8_t> kATxtContentsCompressed{'K', 'L', 'J', 'N', 'I',  'M', 'K',
-                                                          207, 'H', 132, 210, '\\', '\0'};
-
-static const std::vector<uint8_t> kBTxtContents{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', '\n'};
-
-static int32_t OpenArchiveWrapper(const std::string& name, ZipArchiveHandle* handle) {
-  const std::string abs_path = test_data_dir + "/" + name;
-  return OpenArchive(abs_path.c_str(), handle);
-}
-
-TEST(ziparchive, Open) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-  CloseArchive(handle);
-
-  ASSERT_EQ(kInvalidEntryName, OpenArchiveWrapper("bad_filename.zip", &handle));
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, OutOfBound) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(kInvalidOffset, OpenArchiveWrapper("crash.apk", &handle));
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, EmptyArchive) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(kEmptyArchive, OpenArchiveWrapper("empty.zip", &handle));
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, ZeroSizeCentralDirectory) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(kInvalidFile, OpenArchiveWrapper("zero-size-cd.zip", &handle));
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, OpenMissing) {
-  ZipArchiveHandle handle;
-  ASSERT_NE(0, OpenArchiveWrapper("missing.zip", &handle));
-
-  // Confirm the file descriptor is not going to be mistaken for a valid one.
-  ASSERT_EQ(-1, GetFileDescriptor(handle));
-}
-
-TEST(ziparchive, OpenAssumeFdOwnership) {
-  int fd = open((test_data_dir + "/" + kValidZip).c_str(), O_RDONLY | O_BINARY);
-  ASSERT_NE(-1, fd);
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd, "OpenWithAssumeFdOwnership", &handle));
-  CloseArchive(handle);
-  ASSERT_EQ(-1, lseek(fd, 0, SEEK_SET));
-  ASSERT_EQ(EBADF, errno);
-}
-
-TEST(ziparchive, OpenDoNotAssumeFdOwnership) {
-  int fd = open((test_data_dir + "/" + kValidZip).c_str(), O_RDONLY | O_BINARY);
-  ASSERT_NE(-1, fd);
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd, "OpenWithAssumeFdOwnership", &handle, false));
-  CloseArchive(handle);
-  ASSERT_EQ(0, lseek(fd, 0, SEEK_SET));
-  close(fd);
-}
-
-TEST(ziparchive, OpenAssumeFdRangeOwnership) {
-  int fd = open((test_data_dir + "/" + kValidZip).c_str(), O_RDONLY | O_BINARY);
-  ASSERT_NE(-1, fd);
-  const off64_t length = lseek64(fd, 0, SEEK_END);
-  ASSERT_NE(-1, length);
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFdRange(fd, "OpenWithAssumeFdOwnership", &handle,
-                                  static_cast<size_t>(length), 0));
-  CloseArchive(handle);
-  ASSERT_EQ(-1, lseek(fd, 0, SEEK_SET));
-  ASSERT_EQ(EBADF, errno);
-}
-
-TEST(ziparchive, OpenDoNotAssumeFdRangeOwnership) {
-  int fd = open((test_data_dir + "/" + kValidZip).c_str(), O_RDONLY | O_BINARY);
-  ASSERT_NE(-1, fd);
-  const off64_t length = lseek(fd, 0, SEEK_END);
-  ASSERT_NE(-1, length);
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFdRange(fd, "OpenWithAssumeFdOwnership", &handle,
-                                  static_cast<size_t>(length), 0, false));
-  CloseArchive(handle);
-  ASSERT_EQ(0, lseek(fd, 0, SEEK_SET));
-  close(fd);
-}
-
-TEST(ziparchive, Iteration_std_string_view) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  void* iteration_cookie;
-  ASSERT_EQ(0, StartIteration(handle, &iteration_cookie));
-
-  ZipEntry data;
-  std::vector<std::string_view> names;
-  std::string_view name;
-  while (Next(iteration_cookie, &data, &name) == 0) names.push_back(name);
-
-  // Assert that the names are as expected.
-  std::vector<std::string_view> expected_names{"a.txt", "b.txt", "b/", "b/c.txt", "b/d.txt"};
-  std::sort(names.begin(), names.end());
-  ASSERT_EQ(expected_names, names);
-
-  CloseArchive(handle);
-}
-
-static void AssertIterationOrder(const std::string_view prefix, const std::string_view suffix,
-                                 const std::vector<std::string>& expected_names_sorted) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  void* iteration_cookie;
-  ASSERT_EQ(0, StartIteration(handle, &iteration_cookie, prefix, suffix));
-
-  ZipEntry data;
-  std::vector<std::string> names;
-
-  std::string name;
-  for (size_t i = 0; i < expected_names_sorted.size(); ++i) {
-    ASSERT_EQ(0, Next(iteration_cookie, &data, &name));
-    names.push_back(name);
-  }
-
-  // End of iteration.
-  ASSERT_EQ(-1, Next(iteration_cookie, &data, &name));
-  CloseArchive(handle);
-
-  // Assert that the names are as expected.
-  std::sort(names.begin(), names.end());
-  ASSERT_EQ(expected_names_sorted, names);
-}
-
-TEST(ziparchive, Iteration) {
-  static const std::vector<std::string> kExpectedMatchesSorted = {"a.txt", "b.txt", "b/", "b/c.txt",
-                                                                  "b/d.txt"};
-
-  AssertIterationOrder("", "", kExpectedMatchesSorted);
-}
-
-TEST(ziparchive, IterationWithPrefix) {
-  static const std::vector<std::string> kExpectedMatchesSorted = {"b/", "b/c.txt", "b/d.txt"};
-
-  AssertIterationOrder("b/", "", kExpectedMatchesSorted);
-}
-
-TEST(ziparchive, IterationWithSuffix) {
-  static const std::vector<std::string> kExpectedMatchesSorted = {"a.txt", "b.txt", "b/c.txt",
-                                                                  "b/d.txt"};
-
-  AssertIterationOrder("", ".txt", kExpectedMatchesSorted);
-}
-
-TEST(ziparchive, IterationWithPrefixAndSuffix) {
-  static const std::vector<std::string> kExpectedMatchesSorted = {"b.txt", "b/c.txt", "b/d.txt"};
-
-  AssertIterationOrder("b", ".txt", kExpectedMatchesSorted);
-}
-
-TEST(ziparchive, IterationWithBadPrefixAndSuffix) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  void* iteration_cookie;
-  ASSERT_EQ(0, StartIteration(handle, &iteration_cookie, "x", "y"));
-
-  ZipEntry data;
-  std::string name;
-
-  // End of iteration.
-  ASSERT_EQ(-1, Next(iteration_cookie, &data, &name));
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, FindEntry) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "a.txt", &data));
-
-  // Known facts about a.txt, from zipinfo -v.
-  ASSERT_EQ(63, data.offset);
-  ASSERT_EQ(kCompressDeflated, data.method);
-  ASSERT_EQ(static_cast<uint32_t>(17), data.uncompressed_length);
-  ASSERT_EQ(static_cast<uint32_t>(13), data.compressed_length);
-  ASSERT_EQ(0x950821c5, data.crc32);
-  ASSERT_EQ(static_cast<uint32_t>(0x438a8005), data.mod_time);
-
-  // An entry that doesn't exist. Should be a negative return code.
-  ASSERT_LT(FindEntry(handle, "this file does not exist", &data), 0);
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, FindEntry_empty) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  ZipEntry data;
-  ASSERT_EQ(kInvalidEntryName, FindEntry(handle, "", &data));
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, FindEntry_too_long) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  std::string very_long_name(65536, 'x');
-  ZipEntry data;
-  ASSERT_EQ(kInvalidEntryName, FindEntry(handle, very_long_name, &data));
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, TestInvalidDeclaredLength) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper("declaredlength.zip", &handle));
-
-  void* iteration_cookie;
-  ASSERT_EQ(0, StartIteration(handle, &iteration_cookie));
-
-  std::string name;
-  ZipEntry data;
-
-  ASSERT_EQ(Next(iteration_cookie, &data, &name), 0);
-  ASSERT_EQ(Next(iteration_cookie, &data, &name), 0);
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, OpenArchiveFdRange) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-
-  const std::string leading_garbage(21, 'x');
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, leading_garbage.c_str(),
-                                        leading_garbage.size()));
-
-  std::string valid_content;
-  ASSERT_TRUE(android::base::ReadFileToString(test_data_dir + "/" + kValidZip, &valid_content));
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, valid_content.c_str(), valid_content.size()));
-
-  const std::string ending_garbage(42, 'x');
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, ending_garbage.c_str(),
-                                        ending_garbage.size()));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, lseek(tmp_file.fd, 0, SEEK_SET));
-  ASSERT_EQ(0, OpenArchiveFdRange(tmp_file.fd, "OpenArchiveFdRange", &handle,
-                                  valid_content.size(),
-                                  static_cast<off64_t>(leading_garbage.size())));
-
-  // An entry that's deflated.
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "a.txt", &data));
-  const uint32_t a_size = data.uncompressed_length;
-  ASSERT_EQ(a_size, kATxtContents.size());
-  auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[a_size]);
-  ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer.get(), a_size));
-  ASSERT_EQ(0, memcmp(buffer.get(), kATxtContents.data(), a_size));
-
-  // An entry that's stored.
-  ASSERT_EQ(0, FindEntry(handle, "b.txt", &data));
-  const uint32_t b_size = data.uncompressed_length;
-  ASSERT_EQ(b_size, kBTxtContents.size());
-  buffer = std::unique_ptr<uint8_t[]>(new uint8_t[b_size]);
-  ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer.get(), b_size));
-  ASSERT_EQ(0, memcmp(buffer.get(), kBTxtContents.data(), b_size));
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, ExtractToMemory) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  // An entry that's deflated.
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "a.txt", &data));
-  const uint32_t a_size = data.uncompressed_length;
-  ASSERT_EQ(a_size, kATxtContents.size());
-  uint8_t* buffer = new uint8_t[a_size];
-  ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer, a_size));
-  ASSERT_EQ(0, memcmp(buffer, kATxtContents.data(), a_size));
-  delete[] buffer;
-
-  // An entry that's stored.
-  ASSERT_EQ(0, FindEntry(handle, "b.txt", &data));
-  const uint32_t b_size = data.uncompressed_length;
-  ASSERT_EQ(b_size, kBTxtContents.size());
-  buffer = new uint8_t[b_size];
-  ASSERT_EQ(0, ExtractToMemory(handle, &data, buffer, b_size));
-  ASSERT_EQ(0, memcmp(buffer, kBTxtContents.data(), b_size));
-  delete[] buffer;
-
-  CloseArchive(handle);
-}
-
-static const uint32_t kEmptyEntriesZip[] = {
-    0x04034b50, 0x0000000a, 0x63600000, 0x00004438, 0x00000000, 0x00000000, 0x00090000,
-    0x6d65001c, 0x2e797470, 0x55747874, 0x03000954, 0x52e25c13, 0x52e25c24, 0x000b7875,
-    0x42890401, 0x88040000, 0x50000013, 0x1e02014b, 0x00000a03, 0x60000000, 0x00443863,
-    0x00000000, 0x00000000, 0x09000000, 0x00001800, 0x00000000, 0xa0000000, 0x00000081,
-    0x706d6500, 0x742e7974, 0x54557478, 0x13030005, 0x7552e25c, 0x01000b78, 0x00428904,
-    0x13880400, 0x4b500000, 0x00000605, 0x00010000, 0x004f0001, 0x00430000, 0x00000000};
-
-// This is a zip file containing a single entry (ab.txt) that contains
-// 90072 repetitions of the string "ab\n" and has an uncompressed length
-// of 270216 bytes.
-static const uint16_t kAbZip[] = {
-    0x4b50, 0x0403, 0x0014, 0x0000, 0x0008, 0x51d2, 0x4698, 0xc4b0, 0x2cda, 0x011b, 0x0000, 0x1f88,
-    0x0004, 0x0006, 0x001c, 0x6261, 0x742e, 0x7478, 0x5455, 0x0009, 0x7c03, 0x3a09, 0x7c55, 0x3a09,
-    0x7555, 0x0b78, 0x0100, 0x8904, 0x0042, 0x0400, 0x1388, 0x0000, 0xc2ed, 0x0d31, 0x0000, 0x030c,
-    0x7fa0, 0x3b2e, 0x22ff, 0xa2aa, 0x841f, 0x45fc, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555,
-    0x5555, 0x5555, 0x5555, 0x5555, 0xdd55, 0x502c, 0x014b, 0x1e02, 0x1403, 0x0000, 0x0800, 0xd200,
-    0x9851, 0xb046, 0xdac4, 0x1b2c, 0x0001, 0x8800, 0x041f, 0x0600, 0x1800, 0x0000, 0x0000, 0x0100,
-    0x0000, 0xa000, 0x0081, 0x0000, 0x6100, 0x2e62, 0x7874, 0x5574, 0x0554, 0x0300, 0x097c, 0x553a,
-    0x7875, 0x000b, 0x0401, 0x4289, 0x0000, 0x8804, 0x0013, 0x5000, 0x054b, 0x0006, 0x0000, 0x0100,
-    0x0100, 0x4c00, 0x0000, 0x5b00, 0x0001, 0x0000, 0x0000};
-
-static const std::string kAbTxtName("ab.txt");
-static const size_t kAbUncompressedSize = 270216;
-
-TEST(ziparchive, EmptyEntries) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, kEmptyEntriesZip, sizeof(kEmptyEntriesZip)));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle, false));
-
-  ZipEntry entry;
-  ASSERT_EQ(0, FindEntry(handle, "empty.txt", &entry));
-  ASSERT_EQ(static_cast<uint32_t>(0), entry.uncompressed_length);
-  uint8_t buffer[1];
-  ASSERT_EQ(0, ExtractToMemory(handle, &entry, buffer, 1));
-
-  TemporaryFile tmp_output_file;
-  ASSERT_NE(-1, tmp_output_file.fd);
-  ASSERT_EQ(0, ExtractEntryToFile(handle, &entry, tmp_output_file.fd));
-
-  struct stat stat_buf;
-  ASSERT_EQ(0, fstat(tmp_output_file.fd, &stat_buf));
-  ASSERT_EQ(0, stat_buf.st_size);
-}
-
-TEST(ziparchive, EntryLargerThan32K) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, reinterpret_cast<const uint8_t*>(kAbZip),
-                                        sizeof(kAbZip) - 1));
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EntryLargerThan32KTest", &handle, false));
-
-  ZipEntry entry;
-  ASSERT_EQ(0, FindEntry(handle, kAbTxtName, &entry));
-  ASSERT_EQ(kAbUncompressedSize, entry.uncompressed_length);
-
-  // Extract the entry to memory.
-  std::vector<uint8_t> buffer(kAbUncompressedSize);
-  ASSERT_EQ(0, ExtractToMemory(handle, &entry, &buffer[0], static_cast<uint32_t>(buffer.size())));
-
-  // Extract the entry to a file.
-  TemporaryFile tmp_output_file;
-  ASSERT_NE(-1, tmp_output_file.fd);
-  ASSERT_EQ(0, ExtractEntryToFile(handle, &entry, tmp_output_file.fd));
-
-  // Make sure the extracted file size is as expected.
-  struct stat stat_buf;
-  ASSERT_EQ(0, fstat(tmp_output_file.fd, &stat_buf));
-  ASSERT_EQ(kAbUncompressedSize, static_cast<size_t>(stat_buf.st_size));
-
-  // Read the file back to a buffer and make sure the contents are
-  // the same as the memory buffer we extracted directly to.
-  std::vector<uint8_t> file_contents(kAbUncompressedSize);
-  ASSERT_EQ(0, lseek(tmp_output_file.fd, 0, SEEK_SET));
-  ASSERT_TRUE(android::base::ReadFully(tmp_output_file.fd, &file_contents[0], file_contents.size()));
-  ASSERT_EQ(file_contents, buffer);
-
-  for (int i = 0; i < 90072; ++i) {
-    const uint8_t* line = &file_contents[0] + (3 * i);
-    ASSERT_EQ('a', line[0]);
-    ASSERT_EQ('b', line[1]);
-    ASSERT_EQ('\n', line[2]);
-  }
-}
-
-TEST(ziparchive, TrailerAfterEOCD) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-
-  // Create a file with 8 bytes of random garbage.
-  static const uint8_t trailer[] = {'A', 'n', 'd', 'r', 'o', 'i', 'd', 'z'};
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, kEmptyEntriesZip, sizeof(kEmptyEntriesZip)));
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, trailer, sizeof(trailer)));
-
-  ZipArchiveHandle handle;
-  ASSERT_GT(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle, false));
-}
-
-TEST(ziparchive, ExtractToFile) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-  const uint8_t data[8] = {'1', '2', '3', '4', '5', '6', '7', '8'};
-  const size_t data_size = sizeof(data);
-
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, data, data_size));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kValidZip, &handle));
-
-  ZipEntry entry;
-  ASSERT_EQ(0, FindEntry(handle, "a.txt", &entry));
-  ASSERT_EQ(0, ExtractEntryToFile(handle, &entry, tmp_file.fd));
-
-  // Assert that the first 8 bytes of the file haven't been clobbered.
-  uint8_t read_buffer[data_size];
-  ASSERT_EQ(0, lseek(tmp_file.fd, 0, SEEK_SET));
-  ASSERT_TRUE(android::base::ReadFully(tmp_file.fd, read_buffer, data_size));
-  ASSERT_EQ(0, memcmp(read_buffer, data, data_size));
-
-  // Assert that the remainder of the file contains the incompressed data.
-  std::vector<uint8_t> uncompressed_data(entry.uncompressed_length);
-  ASSERT_TRUE(
-      android::base::ReadFully(tmp_file.fd, uncompressed_data.data(), entry.uncompressed_length));
-  ASSERT_EQ(0, memcmp(&uncompressed_data[0], kATxtContents.data(), kATxtContents.size()));
-
-  // Assert that the total length of the file is sane
-  ASSERT_EQ(static_cast<ssize_t>(data_size + kATxtContents.size()),
-            lseek(tmp_file.fd, 0, SEEK_END));
-}
-
-#if !defined(_WIN32)
-TEST(ziparchive, OpenFromMemory) {
-  const std::string zip_path = test_data_dir + "/dummy-update.zip";
-  android::base::unique_fd fd(open(zip_path.c_str(), O_RDONLY | O_BINARY));
-  ASSERT_NE(-1, fd);
-  struct stat sb;
-  ASSERT_EQ(0, fstat(fd, &sb));
-
-  // Memory map the file first and open the archive from the memory region.
-  auto file_map{
-      android::base::MappedFile::FromFd(fd, 0, static_cast<size_t>(sb.st_size), PROT_READ)};
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0,
-            OpenArchiveFromMemory(file_map->data(), file_map->size(), zip_path.c_str(), &handle));
-
-  // Assert one entry can be found and extracted correctly.
-  ZipEntry binary_entry;
-  ASSERT_EQ(0, FindEntry(handle, "META-INF/com/google/android/update-binary", &binary_entry));
-  TemporaryFile tmp_binary;
-  ASSERT_NE(-1, tmp_binary.fd);
-  ASSERT_EQ(0, ExtractEntryToFile(handle, &binary_entry, tmp_binary.fd));
-}
-#endif
-
-static void ZipArchiveStreamTest(ZipArchiveHandle& handle, const std::string& entry_name, bool raw,
-                                 bool verified, ZipEntry* entry, std::vector<uint8_t>* read_data) {
-  ASSERT_EQ(0, FindEntry(handle, entry_name, entry));
-  std::unique_ptr<ZipArchiveStreamEntry> stream;
-  if (raw) {
-    stream.reset(ZipArchiveStreamEntry::CreateRaw(handle, *entry));
-    if (entry->method == kCompressStored) {
-      read_data->resize(entry->uncompressed_length);
-    } else {
-      read_data->resize(entry->compressed_length);
-    }
-  } else {
-    stream.reset(ZipArchiveStreamEntry::Create(handle, *entry));
-    read_data->resize(entry->uncompressed_length);
-  }
-  uint8_t* read_data_ptr = read_data->data();
-  ASSERT_TRUE(stream.get() != nullptr);
-  const std::vector<uint8_t>* data;
-  uint64_t total_size = 0;
-  while ((data = stream->Read()) != nullptr) {
-    total_size += data->size();
-    memcpy(read_data_ptr, data->data(), data->size());
-    read_data_ptr += data->size();
-  }
-  ASSERT_EQ(verified, stream->Verify());
-  ASSERT_EQ(total_size, read_data->size());
-}
-
-static void ZipArchiveStreamTestUsingContents(const std::string& zip_file,
-                                              const std::string& entry_name,
-                                              const std::vector<uint8_t>& contents, bool raw) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(zip_file, &handle));
-
-  ZipEntry entry;
-  std::vector<uint8_t> read_data;
-  ZipArchiveStreamTest(handle, entry_name, raw, true, &entry, &read_data);
-
-  ASSERT_EQ(contents.size(), read_data.size());
-  ASSERT_TRUE(memcmp(read_data.data(), contents.data(), read_data.size()) == 0);
-
-  CloseArchive(handle);
-}
-
-static void ZipArchiveStreamTestUsingMemory(const std::string& zip_file,
-                                            const std::string& entry_name) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(zip_file, &handle));
-
-  ZipEntry entry;
-  std::vector<uint8_t> read_data;
-  ZipArchiveStreamTest(handle, entry_name, false, true, &entry, &read_data);
-
-  std::vector<uint8_t> cmp_data(entry.uncompressed_length);
-  ASSERT_EQ(entry.uncompressed_length, read_data.size());
-  ASSERT_EQ(
-      0, ExtractToMemory(handle, &entry, cmp_data.data(), static_cast<uint32_t>(cmp_data.size())));
-  ASSERT_TRUE(memcmp(read_data.data(), cmp_data.data(), read_data.size()) == 0);
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, StreamCompressed) {
-  ZipArchiveStreamTestUsingContents(kValidZip, "a.txt", kATxtContents, false);
-}
-
-TEST(ziparchive, StreamUncompressed) {
-  ZipArchiveStreamTestUsingContents(kValidZip, "b.txt", kBTxtContents, false);
-}
-
-TEST(ziparchive, StreamRawCompressed) {
-  ZipArchiveStreamTestUsingContents(kValidZip, "a.txt", kATxtContentsCompressed, true);
-}
-
-TEST(ziparchive, StreamRawUncompressed) {
-  ZipArchiveStreamTestUsingContents(kValidZip, "b.txt", kBTxtContents, true);
-}
-
-TEST(ziparchive, StreamLargeCompressed) {
-  ZipArchiveStreamTestUsingMemory(kLargeZip, "compress.txt");
-}
-
-TEST(ziparchive, StreamLargeUncompressed) {
-  ZipArchiveStreamTestUsingMemory(kLargeZip, "uncompress.txt");
-}
-
-TEST(ziparchive, StreamCompressedBadCrc) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kBadCrcZip, &handle));
-
-  ZipEntry entry;
-  std::vector<uint8_t> read_data;
-  ZipArchiveStreamTest(handle, "a.txt", false, false, &entry, &read_data);
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, StreamUncompressedBadCrc) {
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveWrapper(kBadCrcZip, &handle));
-
-  ZipEntry entry;
-  std::vector<uint8_t> read_data;
-  ZipArchiveStreamTest(handle, "b.txt", false, false, &entry, &read_data);
-
-  CloseArchive(handle);
-}
-
-// Generated using the following Java program:
-//     public static void main(String[] foo) throws Exception {
-//       FileOutputStream fos = new
-//       FileOutputStream("/tmp/data_descriptor.zip");
-//       ZipOutputStream zos = new ZipOutputStream(fos);
-//       ZipEntry ze = new ZipEntry("name");
-//       ze.setMethod(ZipEntry.DEFLATED);
-//       zos.putNextEntry(ze);
-//       zos.write("abdcdefghijk".getBytes());
-//       zos.closeEntry();
-//       zos.close();
-//     }
-//
-// cat /tmp/data_descriptor.zip | xxd -i
-//
-static const std::vector<uint8_t> kDataDescriptorZipFile{
-    0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x08, 0x08, 0x08, 0x00, 0x30, 0x59, 0xce, 0x4a, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6e, 0x61,
-    0x6d, 0x65, 0x4b, 0x4c, 0x4a, 0x49, 0x4e, 0x49, 0x4d, 0x4b, 0xcf, 0xc8, 0xcc, 0xca, 0x06, 0x00,
-    //[sig---------------], [crc32---------------], [csize---------------], [size----------------]
-    0x50, 0x4b, 0x07, 0x08, 0x3d, 0x4e, 0x0e, 0xf9, 0x0e, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
-    0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00, 0x08, 0x08, 0x08, 0x00, 0x30, 0x59, 0xce, 0x4a,
-    0x3d, 0x4e, 0x0e, 0xf9, 0x0e, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x61,
-    0x6d, 0x65, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x32, 0x00,
-    0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-// The offsets of the data descriptor in this file, so we can mess with
-// them later in the test.
-static constexpr uint32_t kDataDescriptorOffset = 48;
-static constexpr uint32_t kCSizeOffset = kDataDescriptorOffset + 8;
-static constexpr uint32_t kSizeOffset = kCSizeOffset + 4;
-
-static void ExtractEntryToMemory(const std::vector<uint8_t>& zip_data,
-                                 std::vector<uint8_t>* entry_out, int32_t* error_code_out) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &zip_data[0], zip_data.size()));
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "ExtractEntryToMemory", &handle, false));
-
-  // This function expects a variant of kDataDescriptorZipFile, for look for
-  // an entry whose name is "name" and whose size is 12 (contents =
-  // "abdcdefghijk").
-  ZipEntry entry;
-  ASSERT_EQ(0, FindEntry(handle, "name", &entry));
-  ASSERT_EQ(static_cast<uint32_t>(12), entry.uncompressed_length);
-
-  entry_out->resize(12);
-  (*error_code_out) = ExtractToMemory(handle, &entry, &((*entry_out)[0]), 12);
-
-  CloseArchive(handle);
-}
-
-TEST(ziparchive, ValidDataDescriptors) {
-  std::vector<uint8_t> entry;
-  int32_t error_code = 0;
-  ExtractEntryToMemory(kDataDescriptorZipFile, &entry, &error_code);
-
-  ASSERT_EQ(0, error_code);
-  ASSERT_EQ(12u, entry.size());
-  ASSERT_EQ('a', entry[0]);
-  ASSERT_EQ('k', entry[11]);
-}
-
-TEST(ziparchive, InvalidDataDescriptors_csize) {
-  std::vector<uint8_t> invalid_csize = kDataDescriptorZipFile;
-  invalid_csize[kCSizeOffset] = 0xfe;
-
-  std::vector<uint8_t> entry;
-  int32_t error_code = 0;
-  ExtractEntryToMemory(invalid_csize, &entry, &error_code);
-
-  ASSERT_EQ(kInconsistentInformation, error_code);
-}
-
-TEST(ziparchive, InvalidDataDescriptors_size) {
-  std::vector<uint8_t> invalid_size = kDataDescriptorZipFile;
-  invalid_size[kSizeOffset] = 0xfe;
-
-  std::vector<uint8_t> entry;
-  int32_t error_code = 0;
-  ExtractEntryToMemory(invalid_size, &entry, &error_code);
-
-  ASSERT_EQ(kInconsistentInformation, error_code);
-}
-
-TEST(ziparchive, ErrorCodeString) {
-  ASSERT_STREQ("Success", ErrorCodeString(0));
-
-  // Out of bounds.
-  ASSERT_STREQ("Unknown return code", ErrorCodeString(1));
-  ASSERT_STRNE("Unknown return code", ErrorCodeString(kLastErrorCode));
-  ASSERT_STREQ("Unknown return code", ErrorCodeString(kLastErrorCode - 1));
-
-  ASSERT_STREQ("I/O error", ErrorCodeString(kIoError));
-}
-
-// A zip file whose local file header at offset zero is corrupted.
-//
-// ---------------
-// cat foo > a.txt
-// zip a.zip a.txt
-// cat a.zip | xxd -i
-//
-// Manual changes :
-// [2] = 0xff  // Corrupt the LFH signature of entry 0.
-// [3] = 0xff  // Corrupt the LFH signature of entry 0.
-static const std::vector<uint8_t> kZipFileWithBrokenLfhSignature{
-    //[lfh-sig-----------], [lfh contents---------------------------------
-    0x50, 0x4b, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x80,
-    //--------------------------------------------------------------------
-    0x09, 0x4b, 0xa8, 0x65, 0x32, 0x7e, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00,
-    //-------------------------------]  [file-name-----------------], [---
-    0x00, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x61, 0x2e, 0x74, 0x78, 0x74, 0x55,
-    // entry-contents------------------------------------------------------
-    0x54, 0x09, 0x00, 0x03, 0x51, 0x24, 0x8b, 0x59, 0x51, 0x24, 0x8b, 0x59,
-    //--------------------------------------------------------------------
-    0x75, 0x78, 0x0b, 0x00, 0x01, 0x04, 0x89, 0x42, 0x00, 0x00, 0x04, 0x88,
-    //-------------------------------------], [cd-record-sig-------], [---
-    0x13, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x0a, 0x50, 0x4b, 0x01, 0x02, 0x1e,
-    // cd-record-----------------------------------------------------------
-    0x03, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x80, 0x09, 0x4b, 0xa8,
-    //--------------------------------------------------------------------
-    0x65, 0x32, 0x7e, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05,
-    //--------------------------------------------------------------------
-    0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa0,
-    //-]  [lfh-file-header-off-], [file-name-----------------], [extra----
-    0x81, 0x00, 0x00, 0x00, 0x00, 0x61, 0x2e, 0x74, 0x78, 0x74, 0x55, 0x54,
-    //--------------------------------------------------------------------
-    0x05, 0x00, 0x03, 0x51, 0x24, 0x8b, 0x59, 0x75, 0x78, 0x0b, 0x00, 0x01,
-    //-------------------------------------------------------], [eocd-sig-
-    0x04, 0x89, 0x42, 0x00, 0x00, 0x04, 0x88, 0x13, 0x00, 0x00, 0x50, 0x4b,
-    //-------], [---------------------------------------------------------
-    0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x4b, 0x00,
-    //-------------------------------------------]
-    0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-TEST(ziparchive, BrokenLfhSignature) {
-  TemporaryFile tmp_file;
-  ASSERT_NE(-1, tmp_file.fd);
-  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &kZipFileWithBrokenLfhSignature[0],
-                                        kZipFileWithBrokenLfhSignature.size()));
-  ZipArchiveHandle handle;
-  ASSERT_EQ(kInvalidFile, OpenArchiveFd(tmp_file.fd, "LeadingNonZipBytes", &handle, false));
-}
-
-class VectorReader : public zip_archive::Reader {
- public:
-  VectorReader(const std::vector<uint8_t>& input) : Reader(), input_(input) {}
-
-  bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
-    if ((offset + len) < input_.size()) {
-      return false;
-    }
-
-    memcpy(buf, &input_[offset], len);
-    return true;
-  }
-
- private:
-  const std::vector<uint8_t>& input_;
-};
-
-class VectorWriter : public zip_archive::Writer {
- public:
-  VectorWriter() : Writer() {}
-
-  bool Append(uint8_t* buf, size_t size) {
-    output_.insert(output_.end(), buf, buf + size);
-    return true;
-  }
-
-  std::vector<uint8_t>& GetOutput() { return output_; }
-
- private:
-  std::vector<uint8_t> output_;
-};
-
-class BadReader : public zip_archive::Reader {
- public:
-  BadReader() : Reader() {}
-
-  bool ReadAtOffset(uint8_t*, size_t, uint32_t) const { return false; }
-};
-
-class BadWriter : public zip_archive::Writer {
- public:
-  BadWriter() : Writer() {}
-
-  bool Append(uint8_t*, size_t) { return false; }
-};
-
-TEST(ziparchive, Inflate) {
-  const uint32_t compressed_length = static_cast<uint32_t>(kATxtContentsCompressed.size());
-  const uint32_t uncompressed_length = static_cast<uint32_t>(kATxtContents.size());
-
-  const VectorReader reader(kATxtContentsCompressed);
-  {
-    VectorWriter writer;
-    uint64_t crc_out = 0;
-
-    int32_t ret =
-        zip_archive::Inflate(reader, compressed_length, uncompressed_length, &writer, &crc_out);
-    ASSERT_EQ(0, ret);
-    ASSERT_EQ(kATxtContents, writer.GetOutput());
-    ASSERT_EQ(0x950821C5u, crc_out);
-  }
-
-  {
-    VectorWriter writer;
-    int32_t ret =
-        zip_archive::Inflate(reader, compressed_length, uncompressed_length, &writer, nullptr);
-    ASSERT_EQ(0, ret);
-    ASSERT_EQ(kATxtContents, writer.GetOutput());
-  }
-
-  {
-    BadWriter writer;
-    int32_t ret =
-        zip_archive::Inflate(reader, compressed_length, uncompressed_length, &writer, nullptr);
-    ASSERT_EQ(kIoError, ret);
-  }
-
-  {
-    BadReader reader;
-    VectorWriter writer;
-    int32_t ret =
-        zip_archive::Inflate(reader, compressed_length, uncompressed_length, &writer, nullptr);
-    ASSERT_EQ(kIoError, ret);
-    ASSERT_EQ(0u, writer.GetOutput().size());
-  }
-}
diff --git a/libziparchive/zip_writer.cc b/libziparchive/zip_writer.cc
deleted file mode 100644
index 67279a6..0000000
--- a/libziparchive/zip_writer.cc
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "ziparchive/zip_writer.h"
-
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <zlib.h>
-#include <cstdio>
-#define DEF_MEM_LEVEL 8  // normally in zutil.h?
-
-#include <memory>
-#include <vector>
-
-#include "android-base/logging.h"
-
-#include "entry_name_utils-inl.h"
-#include "zip_archive_common.h"
-
-#undef powerof2
-#define powerof2(x)                                               \
-  ({                                                              \
-    __typeof__(x) _x = (x);                                       \
-    __typeof__(x) _x2;                                            \
-    __builtin_add_overflow(_x, -1, &_x2) ? 1 : ((_x2 & _x) == 0); \
-  })
-
-/* Zip compression methods we support */
-enum {
-  kCompressStored = 0,    // no compression
-  kCompressDeflated = 8,  // standard deflate
-};
-
-// Size of the output buffer used for compression.
-static const size_t kBufSize = 32768u;
-
-// No error, operation completed successfully.
-static const int32_t kNoError = 0;
-
-// The ZipWriter is in a bad state.
-static const int32_t kInvalidState = -1;
-
-// There was an IO error while writing to disk.
-static const int32_t kIoError = -2;
-
-// The zip entry name was invalid.
-static const int32_t kInvalidEntryName = -3;
-
-// An error occurred in zlib.
-static const int32_t kZlibError = -4;
-
-// The start aligned function was called with the aligned flag.
-static const int32_t kInvalidAlign32Flag = -5;
-
-// The alignment parameter is not a power of 2.
-static const int32_t kInvalidAlignment = -6;
-
-static const char* sErrorCodes[] = {
-    "Invalid state", "IO error", "Invalid entry name", "Zlib error",
-};
-
-const char* ZipWriter::ErrorCodeString(int32_t error_code) {
-  if (error_code < 0 && (-error_code) < static_cast<int32_t>(arraysize(sErrorCodes))) {
-    return sErrorCodes[-error_code];
-  }
-  return nullptr;
-}
-
-static void DeleteZStream(z_stream* stream) {
-  deflateEnd(stream);
-  delete stream;
-}
-
-ZipWriter::ZipWriter(FILE* f)
-    : file_(f),
-      seekable_(false),
-      current_offset_(0),
-      state_(State::kWritingZip),
-      z_stream_(nullptr, DeleteZStream),
-      buffer_(kBufSize) {
-  // Check if the file is seekable (regular file). If fstat fails, that's fine, subsequent calls
-  // will fail as well.
-  struct stat file_stats;
-  if (fstat(fileno(f), &file_stats) == 0) {
-    seekable_ = S_ISREG(file_stats.st_mode);
-  }
-}
-
-ZipWriter::ZipWriter(ZipWriter&& writer) noexcept
-    : file_(writer.file_),
-      seekable_(writer.seekable_),
-      current_offset_(writer.current_offset_),
-      state_(writer.state_),
-      files_(std::move(writer.files_)),
-      z_stream_(std::move(writer.z_stream_)),
-      buffer_(std::move(writer.buffer_)) {
-  writer.file_ = nullptr;
-  writer.state_ = State::kError;
-}
-
-ZipWriter& ZipWriter::operator=(ZipWriter&& writer) noexcept {
-  file_ = writer.file_;
-  seekable_ = writer.seekable_;
-  current_offset_ = writer.current_offset_;
-  state_ = writer.state_;
-  files_ = std::move(writer.files_);
-  z_stream_ = std::move(writer.z_stream_);
-  buffer_ = std::move(writer.buffer_);
-  writer.file_ = nullptr;
-  writer.state_ = State::kError;
-  return *this;
-}
-
-int32_t ZipWriter::HandleError(int32_t error_code) {
-  state_ = State::kError;
-  z_stream_.reset();
-  return error_code;
-}
-
-int32_t ZipWriter::StartEntry(std::string_view path, size_t flags) {
-  uint32_t alignment = 0;
-  if (flags & kAlign32) {
-    flags &= ~kAlign32;
-    alignment = 4;
-  }
-  return StartAlignedEntryWithTime(path, flags, time_t(), alignment);
-}
-
-int32_t ZipWriter::StartAlignedEntry(std::string_view path, size_t flags, uint32_t alignment) {
-  return StartAlignedEntryWithTime(path, flags, time_t(), alignment);
-}
-
-int32_t ZipWriter::StartEntryWithTime(std::string_view path, size_t flags, time_t time) {
-  uint32_t alignment = 0;
-  if (flags & kAlign32) {
-    flags &= ~kAlign32;
-    alignment = 4;
-  }
-  return StartAlignedEntryWithTime(path, flags, time, alignment);
-}
-
-static void ExtractTimeAndDate(time_t when, uint16_t* out_time, uint16_t* out_date) {
-  /* round up to an even number of seconds */
-  when = static_cast<time_t>((static_cast<unsigned long>(when) + 1) & (~1));
-
-  struct tm* ptm;
-#if !defined(_WIN32)
-  struct tm tm_result;
-  ptm = localtime_r(&when, &tm_result);
-#else
-  ptm = localtime(&when);
-#endif
-
-  int year = ptm->tm_year;
-  if (year < 80) {
-    year = 80;
-  }
-
-  *out_date = static_cast<uint16_t>((year - 80) << 9 | (ptm->tm_mon + 1) << 5 | ptm->tm_mday);
-  *out_time = static_cast<uint16_t>(ptm->tm_hour << 11 | ptm->tm_min << 5 | ptm->tm_sec >> 1);
-}
-
-static void CopyFromFileEntry(const ZipWriter::FileEntry& src, bool use_data_descriptor,
-                              LocalFileHeader* dst) {
-  dst->lfh_signature = LocalFileHeader::kSignature;
-  if (use_data_descriptor) {
-    // Set this flag to denote that a DataDescriptor struct will appear after the data,
-    // containing the crc and size fields.
-    dst->gpb_flags |= kGPBDDFlagMask;
-
-    // The size and crc fields must be 0.
-    dst->compressed_size = 0u;
-    dst->uncompressed_size = 0u;
-    dst->crc32 = 0u;
-  } else {
-    dst->compressed_size = src.compressed_size;
-    dst->uncompressed_size = src.uncompressed_size;
-    dst->crc32 = src.crc32;
-  }
-  dst->compression_method = src.compression_method;
-  dst->last_mod_time = src.last_mod_time;
-  dst->last_mod_date = src.last_mod_date;
-  DCHECK_LE(src.path.size(), std::numeric_limits<uint16_t>::max());
-  dst->file_name_length = static_cast<uint16_t>(src.path.size());
-  dst->extra_field_length = src.padding_length;
-}
-
-int32_t ZipWriter::StartAlignedEntryWithTime(std::string_view path, size_t flags, time_t time,
-                                             uint32_t alignment) {
-  if (state_ != State::kWritingZip) {
-    return kInvalidState;
-  }
-
-  // Can only have 16535 entries because of zip records.
-  if (files_.size() == std::numeric_limits<uint16_t>::max()) {
-    return HandleError(kIoError);
-  }
-
-  if (flags & kAlign32) {
-    return kInvalidAlign32Flag;
-  }
-
-  if (powerof2(alignment) == 0) {
-    return kInvalidAlignment;
-  }
-  if (alignment > std::numeric_limits<uint16_t>::max()) {
-    return kInvalidAlignment;
-  }
-
-  FileEntry file_entry = {};
-  file_entry.local_file_header_offset = current_offset_;
-  file_entry.path = path;
-  // No support for larger than 4GB files.
-  if (file_entry.local_file_header_offset > std::numeric_limits<uint32_t>::max()) {
-    return HandleError(kIoError);
-  }
-
-  if (!IsValidEntryName(reinterpret_cast<const uint8_t*>(file_entry.path.data()),
-                        file_entry.path.size())) {
-    return kInvalidEntryName;
-  }
-
-  if (flags & ZipWriter::kCompress) {
-    file_entry.compression_method = kCompressDeflated;
-
-    int32_t result = PrepareDeflate();
-    if (result != kNoError) {
-      return result;
-    }
-  } else {
-    file_entry.compression_method = kCompressStored;
-  }
-
-  ExtractTimeAndDate(time, &file_entry.last_mod_time, &file_entry.last_mod_date);
-
-  off_t offset = current_offset_ + sizeof(LocalFileHeader) + file_entry.path.size();
-  // prepare a pre-zeroed memory page in case when we need to pad some aligned data.
-  static constexpr auto kPageSize = 4096;
-  static constexpr char kSmallZeroPadding[kPageSize] = {};
-  // use this buffer if our preallocated one is too small
-  std::vector<char> zero_padding_big;
-  const char* zero_padding = nullptr;
-
-  if (alignment != 0 && (offset & (alignment - 1))) {
-    // Pad the extra field so the data will be aligned.
-    uint16_t padding = static_cast<uint16_t>(alignment - (offset % alignment));
-    file_entry.padding_length = padding;
-    offset += padding;
-    if (padding <= std::size(kSmallZeroPadding)) {
-        zero_padding = kSmallZeroPadding;
-    } else {
-        zero_padding_big.resize(padding, 0);
-        zero_padding = zero_padding_big.data();
-    }
-  }
-
-  LocalFileHeader header = {};
-  // Always start expecting a data descriptor. When the data has finished being written,
-  // if it is possible to seek back, the GPB flag will reset and the sizes written.
-  CopyFromFileEntry(file_entry, true /*use_data_descriptor*/, &header);
-
-  if (fwrite(&header, sizeof(header), 1, file_) != 1) {
-    return HandleError(kIoError);
-  }
-
-  if (fwrite(path.data(), 1, path.size(), file_) != path.size()) {
-    return HandleError(kIoError);
-  }
-
-  if (file_entry.padding_length != 0 && fwrite(zero_padding, 1, file_entry.padding_length,
-                                               file_) != file_entry.padding_length) {
-    return HandleError(kIoError);
-  }
-
-  current_file_entry_ = std::move(file_entry);
-  current_offset_ = offset;
-  state_ = State::kWritingEntry;
-  return kNoError;
-}
-
-int32_t ZipWriter::DiscardLastEntry() {
-  if (state_ != State::kWritingZip || files_.empty()) {
-    return kInvalidState;
-  }
-
-  FileEntry& last_entry = files_.back();
-  current_offset_ = last_entry.local_file_header_offset;
-  if (fseeko(file_, current_offset_, SEEK_SET) != 0) {
-    return HandleError(kIoError);
-  }
-  files_.pop_back();
-  return kNoError;
-}
-
-int32_t ZipWriter::GetLastEntry(FileEntry* out_entry) {
-  CHECK(out_entry != nullptr);
-
-  if (files_.empty()) {
-    return kInvalidState;
-  }
-  *out_entry = files_.back();
-  return kNoError;
-}
-
-int32_t ZipWriter::PrepareDeflate() {
-  CHECK(state_ == State::kWritingZip);
-
-  // Initialize the z_stream for compression.
-  z_stream_ = std::unique_ptr<z_stream, void (*)(z_stream*)>(new z_stream(), DeleteZStream);
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-  int zerr = deflateInit2(z_stream_.get(), Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS,
-                          DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
-#pragma GCC diagnostic pop
-
-  if (zerr != Z_OK) {
-    if (zerr == Z_VERSION_ERROR) {
-      LOG(ERROR) << "Installed zlib is not compatible with linked version (" << ZLIB_VERSION << ")";
-      return HandleError(kZlibError);
-    } else {
-      LOG(ERROR) << "deflateInit2 failed (zerr=" << zerr << ")";
-      return HandleError(kZlibError);
-    }
-  }
-
-  z_stream_->next_out = buffer_.data();
-  DCHECK_EQ(buffer_.size(), kBufSize);
-  z_stream_->avail_out = static_cast<uint32_t>(buffer_.size());
-  return kNoError;
-}
-
-int32_t ZipWriter::WriteBytes(const void* data, size_t len) {
-  if (state_ != State::kWritingEntry) {
-    return HandleError(kInvalidState);
-  }
-  // Need to be able to mark down data correctly.
-  if (len + static_cast<uint64_t>(current_file_entry_.uncompressed_size) >
-      std::numeric_limits<uint32_t>::max()) {
-    return HandleError(kIoError);
-  }
-  uint32_t len32 = static_cast<uint32_t>(len);
-
-  int32_t result = kNoError;
-  if (current_file_entry_.compression_method & kCompressDeflated) {
-    result = CompressBytes(&current_file_entry_, data, len32);
-  } else {
-    result = StoreBytes(&current_file_entry_, data, len32);
-  }
-
-  if (result != kNoError) {
-    return result;
-  }
-
-  current_file_entry_.crc32 = static_cast<uint32_t>(
-      crc32(current_file_entry_.crc32, reinterpret_cast<const Bytef*>(data), len32));
-  current_file_entry_.uncompressed_size += len32;
-  return kNoError;
-}
-
-int32_t ZipWriter::StoreBytes(FileEntry* file, const void* data, uint32_t len) {
-  CHECK(state_ == State::kWritingEntry);
-
-  if (fwrite(data, 1, len, file_) != len) {
-    return HandleError(kIoError);
-  }
-  file->compressed_size += len;
-  current_offset_ += len;
-  return kNoError;
-}
-
-int32_t ZipWriter::CompressBytes(FileEntry* file, const void* data, uint32_t len) {
-  CHECK(state_ == State::kWritingEntry);
-  CHECK(z_stream_);
-  CHECK(z_stream_->next_out != nullptr);
-  CHECK(z_stream_->avail_out != 0);
-
-  // Prepare the input.
-  z_stream_->next_in = reinterpret_cast<const uint8_t*>(data);
-  z_stream_->avail_in = len;
-
-  while (z_stream_->avail_in > 0) {
-    // We have more data to compress.
-    int zerr = deflate(z_stream_.get(), Z_NO_FLUSH);
-    if (zerr != Z_OK) {
-      return HandleError(kZlibError);
-    }
-
-    if (z_stream_->avail_out == 0) {
-      // The output is full, let's write it to disk.
-      size_t write_bytes = z_stream_->next_out - buffer_.data();
-      if (fwrite(buffer_.data(), 1, write_bytes, file_) != write_bytes) {
-        return HandleError(kIoError);
-      }
-      file->compressed_size += write_bytes;
-      current_offset_ += write_bytes;
-
-      // Reset the output buffer for the next input.
-      z_stream_->next_out = buffer_.data();
-      DCHECK_EQ(buffer_.size(), kBufSize);
-      z_stream_->avail_out = static_cast<uint32_t>(buffer_.size());
-    }
-  }
-  return kNoError;
-}
-
-int32_t ZipWriter::FlushCompressedBytes(FileEntry* file) {
-  CHECK(state_ == State::kWritingEntry);
-  CHECK(z_stream_);
-  CHECK(z_stream_->next_out != nullptr);
-  CHECK(z_stream_->avail_out != 0);
-
-  // Keep deflating while there isn't enough space in the buffer to
-  // to complete the compress.
-  int zerr;
-  while ((zerr = deflate(z_stream_.get(), Z_FINISH)) == Z_OK) {
-    CHECK(z_stream_->avail_out == 0);
-    size_t write_bytes = z_stream_->next_out - buffer_.data();
-    if (fwrite(buffer_.data(), 1, write_bytes, file_) != write_bytes) {
-      return HandleError(kIoError);
-    }
-    file->compressed_size += write_bytes;
-    current_offset_ += write_bytes;
-
-    z_stream_->next_out = buffer_.data();
-    DCHECK_EQ(buffer_.size(), kBufSize);
-    z_stream_->avail_out = static_cast<uint32_t>(buffer_.size());
-  }
-  if (zerr != Z_STREAM_END) {
-    return HandleError(kZlibError);
-  }
-
-  size_t write_bytes = z_stream_->next_out - buffer_.data();
-  if (write_bytes != 0) {
-    if (fwrite(buffer_.data(), 1, write_bytes, file_) != write_bytes) {
-      return HandleError(kIoError);
-    }
-    file->compressed_size += write_bytes;
-    current_offset_ += write_bytes;
-  }
-  z_stream_.reset();
-  return kNoError;
-}
-
-bool ZipWriter::ShouldUseDataDescriptor() const {
-  // Only use a trailing "data descriptor" if the output isn't seekable.
-  return !seekable_;
-}
-
-int32_t ZipWriter::FinishEntry() {
-  if (state_ != State::kWritingEntry) {
-    return kInvalidState;
-  }
-
-  if (current_file_entry_.compression_method & kCompressDeflated) {
-    int32_t result = FlushCompressedBytes(&current_file_entry_);
-    if (result != kNoError) {
-      return result;
-    }
-  }
-
-  if (ShouldUseDataDescriptor()) {
-    // Some versions of ZIP don't allow STORED data to have a trailing DataDescriptor.
-    // If this file is not seekable, or if the data is compressed, write a DataDescriptor.
-    const uint32_t sig = DataDescriptor::kOptSignature;
-    if (fwrite(&sig, sizeof(sig), 1, file_) != 1) {
-      return HandleError(kIoError);
-    }
-
-    DataDescriptor dd = {};
-    dd.crc32 = current_file_entry_.crc32;
-    dd.compressed_size = current_file_entry_.compressed_size;
-    dd.uncompressed_size = current_file_entry_.uncompressed_size;
-    if (fwrite(&dd, sizeof(dd), 1, file_) != 1) {
-      return HandleError(kIoError);
-    }
-    current_offset_ += sizeof(DataDescriptor::kOptSignature) + sizeof(dd);
-  } else {
-    // Seek back to the header and rewrite to include the size.
-    if (fseeko(file_, current_file_entry_.local_file_header_offset, SEEK_SET) != 0) {
-      return HandleError(kIoError);
-    }
-
-    LocalFileHeader header = {};
-    CopyFromFileEntry(current_file_entry_, false /*use_data_descriptor*/, &header);
-
-    if (fwrite(&header, sizeof(header), 1, file_) != 1) {
-      return HandleError(kIoError);
-    }
-
-    if (fseeko(file_, current_offset_, SEEK_SET) != 0) {
-      return HandleError(kIoError);
-    }
-  }
-
-  files_.emplace_back(std::move(current_file_entry_));
-  state_ = State::kWritingZip;
-  return kNoError;
-}
-
-int32_t ZipWriter::Finish() {
-  if (state_ != State::kWritingZip) {
-    return kInvalidState;
-  }
-
-  off_t startOfCdr = current_offset_;
-  for (FileEntry& file : files_) {
-    CentralDirectoryRecord cdr = {};
-    cdr.record_signature = CentralDirectoryRecord::kSignature;
-    if (ShouldUseDataDescriptor()) {
-      cdr.gpb_flags |= kGPBDDFlagMask;
-    }
-    cdr.compression_method = file.compression_method;
-    cdr.last_mod_time = file.last_mod_time;
-    cdr.last_mod_date = file.last_mod_date;
-    cdr.crc32 = file.crc32;
-    cdr.compressed_size = file.compressed_size;
-    cdr.uncompressed_size = file.uncompressed_size;
-    // Checked in IsValidEntryName.
-    DCHECK_LE(file.path.size(), std::numeric_limits<uint16_t>::max());
-    cdr.file_name_length = static_cast<uint16_t>(file.path.size());
-    // Checked in StartAlignedEntryWithTime.
-    DCHECK_LE(file.local_file_header_offset, std::numeric_limits<uint32_t>::max());
-    cdr.local_file_header_offset = static_cast<uint32_t>(file.local_file_header_offset);
-    if (fwrite(&cdr, sizeof(cdr), 1, file_) != 1) {
-      return HandleError(kIoError);
-    }
-
-    if (fwrite(file.path.data(), 1, file.path.size(), file_) != file.path.size()) {
-      return HandleError(kIoError);
-    }
-
-    current_offset_ += sizeof(cdr) + file.path.size();
-  }
-
-  EocdRecord er = {};
-  er.eocd_signature = EocdRecord::kSignature;
-  er.disk_num = 0;
-  er.cd_start_disk = 0;
-  // Checked when adding entries.
-  DCHECK_LE(files_.size(), std::numeric_limits<uint16_t>::max());
-  er.num_records_on_disk = static_cast<uint16_t>(files_.size());
-  er.num_records = static_cast<uint16_t>(files_.size());
-  if (current_offset_ > std::numeric_limits<uint32_t>::max()) {
-    return HandleError(kIoError);
-  }
-  er.cd_size = static_cast<uint32_t>(current_offset_ - startOfCdr);
-  er.cd_start_offset = static_cast<uint32_t>(startOfCdr);
-
-  if (fwrite(&er, sizeof(er), 1, file_) != 1) {
-    return HandleError(kIoError);
-  }
-
-  current_offset_ += sizeof(er);
-
-  // Since we can BackUp() and potentially finish writing at an offset less than one we had
-  // already written at, we must truncate the file.
-
-  if (ftruncate(fileno(file_), current_offset_) != 0) {
-    return HandleError(kIoError);
-  }
-
-  if (fflush(file_) != 0) {
-    return HandleError(kIoError);
-  }
-
-  state_ = State::kDone;
-  return kNoError;
-}
diff --git a/libziparchive/zip_writer_test.cc b/libziparchive/zip_writer_test.cc
deleted file mode 100644
index d324d4b..0000000
--- a/libziparchive/zip_writer_test.cc
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include "ziparchive/zip_writer.h"
-#include "ziparchive/zip_archive.h"
-
-#include <android-base/test_utils.h>
-#include <gtest/gtest.h>
-#include <time.h>
-#include <memory>
-#include <vector>
-
-static ::testing::AssertionResult AssertFileEntryContentsEq(const std::string& expected,
-                                                            ZipArchiveHandle handle,
-                                                            ZipEntry* zip_entry);
-
-struct zipwriter : public ::testing::Test {
-  TemporaryFile* temp_file_;
-  int fd_;
-  FILE* file_;
-
-  void SetUp() override {
-    temp_file_ = new TemporaryFile();
-    fd_ = temp_file_->fd;
-    file_ = fdopen(fd_, "w");
-    ASSERT_NE(file_, nullptr);
-  }
-
-  void TearDown() override {
-    fclose(file_);
-    delete temp_file_;
-  }
-};
-
-TEST_F(zipwriter, WriteUncompressedZipWithOneFile) {
-  ZipWriter writer(file_);
-
-  const char* expected = "hello";
-
-  ASSERT_EQ(0, writer.StartEntry("file.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes("he", 2));
-  ASSERT_EQ(0, writer.WriteBytes("llo", 3));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "file.txt", &data));
-  EXPECT_EQ(kCompressStored, data.method);
-  EXPECT_EQ(0u, data.has_data_descriptor);
-  EXPECT_EQ(strlen(expected), data.compressed_length);
-  ASSERT_EQ(strlen(expected), data.uncompressed_length);
-  ASSERT_TRUE(AssertFileEntryContentsEq(expected, handle, &data));
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteUncompressedZipWithMultipleFiles) {
-  ZipWriter writer(file_);
-
-  ASSERT_EQ(0, writer.StartEntry("file.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes("he", 2));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.StartEntry("file/file.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes("llo", 3));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.StartEntry("file/file2.txt", 0));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-
-  ASSERT_EQ(0, FindEntry(handle, "file.txt", &data));
-  EXPECT_EQ(kCompressStored, data.method);
-  EXPECT_EQ(2u, data.compressed_length);
-  ASSERT_EQ(2u, data.uncompressed_length);
-  ASSERT_TRUE(AssertFileEntryContentsEq("he", handle, &data));
-
-  ASSERT_EQ(0, FindEntry(handle, "file/file.txt", &data));
-  EXPECT_EQ(kCompressStored, data.method);
-  EXPECT_EQ(3u, data.compressed_length);
-  ASSERT_EQ(3u, data.uncompressed_length);
-  ASSERT_TRUE(AssertFileEntryContentsEq("llo", handle, &data));
-
-  ASSERT_EQ(0, FindEntry(handle, "file/file2.txt", &data));
-  EXPECT_EQ(kCompressStored, data.method);
-  EXPECT_EQ(0u, data.compressed_length);
-  EXPECT_EQ(0u, data.uncompressed_length);
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteUncompressedZipFileWithAlignedFlag) {
-  ZipWriter writer(file_);
-
-  ASSERT_EQ(0, writer.StartEntry("align.txt", ZipWriter::kAlign32));
-  ASSERT_EQ(0, writer.WriteBytes("he", 2));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "align.txt", &data));
-  EXPECT_EQ(0, data.offset & 0x03);
-
-  CloseArchive(handle);
-}
-
-static struct tm MakeTm() {
-  struct tm tm;
-  memset(&tm, 0, sizeof(struct tm));
-  tm.tm_year = 2001 - 1900;
-  tm.tm_mon = 1;
-  tm.tm_mday = 12;
-  tm.tm_hour = 18;
-  tm.tm_min = 30;
-  tm.tm_sec = 20;
-  return tm;
-}
-
-TEST_F(zipwriter, WriteUncompressedZipFileWithAlignedFlagAndTime) {
-  ZipWriter writer(file_);
-
-  struct tm tm = MakeTm();
-  time_t time = mktime(&tm);
-  ASSERT_EQ(0, writer.StartEntryWithTime("align.txt", ZipWriter::kAlign32, time));
-  ASSERT_EQ(0, writer.WriteBytes("he", 2));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "align.txt", &data));
-  EXPECT_EQ(0, data.offset & 0x03);
-
-  struct tm mod = data.GetModificationTime();
-  EXPECT_EQ(tm.tm_sec, mod.tm_sec);
-  EXPECT_EQ(tm.tm_min, mod.tm_min);
-  EXPECT_EQ(tm.tm_hour, mod.tm_hour);
-  EXPECT_EQ(tm.tm_mday, mod.tm_mday);
-  EXPECT_EQ(tm.tm_mon, mod.tm_mon);
-  EXPECT_EQ(tm.tm_year, mod.tm_year);
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteUncompressedZipFileWithAlignedValue) {
-  ZipWriter writer(file_);
-
-  ASSERT_EQ(0, writer.StartAlignedEntry("align.txt", 0, 4096));
-  ASSERT_EQ(0, writer.WriteBytes("he", 2));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "align.txt", &data));
-  EXPECT_EQ(0, data.offset & 0xfff);
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteUncompressedZipFileWithAlignedValueAndTime) {
-  ZipWriter writer(file_);
-
-  struct tm tm = MakeTm();
-  time_t time = mktime(&tm);
-  ASSERT_EQ(0, writer.StartAlignedEntryWithTime("align.txt", 0, time, 4096));
-  ASSERT_EQ(0, writer.WriteBytes("he", 2));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "align.txt", &data));
-  EXPECT_EQ(0, data.offset & 0xfff);
-
-  struct tm mod = data.GetModificationTime();
-  EXPECT_EQ(tm.tm_sec, mod.tm_sec);
-  EXPECT_EQ(tm.tm_min, mod.tm_min);
-  EXPECT_EQ(tm.tm_hour, mod.tm_hour);
-  EXPECT_EQ(tm.tm_mday, mod.tm_mday);
-  EXPECT_EQ(tm.tm_mon, mod.tm_mon);
-  EXPECT_EQ(tm.tm_year, mod.tm_year);
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteCompressedZipWithOneFile) {
-  ZipWriter writer(file_);
-
-  ASSERT_EQ(0, writer.StartEntry("file.txt", ZipWriter::kCompress));
-  ASSERT_EQ(0, writer.WriteBytes("helo", 4));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "file.txt", &data));
-  EXPECT_EQ(kCompressDeflated, data.method);
-  EXPECT_EQ(0u, data.has_data_descriptor);
-  ASSERT_EQ(4u, data.uncompressed_length);
-  ASSERT_TRUE(AssertFileEntryContentsEq("helo", handle, &data));
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteCompressedZipFlushFull) {
-  // This exact data will cause the Finish() to require multiple calls
-  // to deflate() because the ZipWriter buffer isn't big enough to hold
-  // the entire compressed data buffer.
-  constexpr size_t kBufSize = 10000000;
-  std::vector<uint8_t> buffer(kBufSize);
-  size_t prev = 1;
-  for (size_t i = 0; i < kBufSize; i++) {
-    buffer[i] = static_cast<uint8_t>(i + prev);
-    prev = i;
-  }
-
-  ZipWriter writer(file_);
-  ASSERT_EQ(0, writer.StartEntry("file.txt", ZipWriter::kCompress));
-  ASSERT_EQ(0, writer.WriteBytes(buffer.data(), buffer.size()));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "file.txt", &data));
-  EXPECT_EQ(kCompressDeflated, data.method);
-  EXPECT_EQ(kBufSize, data.uncompressed_length);
-
-  std::vector<uint8_t> decompress(kBufSize);
-  memset(decompress.data(), 0, kBufSize);
-  ASSERT_EQ(0, ExtractToMemory(handle, &data, decompress.data(),
-                               static_cast<uint32_t>(decompress.size())));
-  EXPECT_EQ(0, memcmp(decompress.data(), buffer.data(), kBufSize))
-      << "Input buffer and output buffer are different.";
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, CheckStartEntryErrors) {
-  ZipWriter writer(file_);
-
-  ASSERT_EQ(-5, writer.StartAlignedEntry("align.txt", ZipWriter::kAlign32, 4096));
-  ASSERT_EQ(-6, writer.StartAlignedEntry("align.txt", 0, 3));
-}
-
-TEST_F(zipwriter, BackupRemovesTheLastFile) {
-  ZipWriter writer(file_);
-
-  const char* kKeepThis = "keep this";
-  const char* kDropThis = "drop this";
-  const char* kReplaceWithThis = "replace with this";
-
-  ZipWriter::FileEntry entry;
-  EXPECT_LT(writer.GetLastEntry(&entry), 0);
-
-  ASSERT_EQ(0, writer.StartEntry("keep.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes(kKeepThis, strlen(kKeepThis)));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.GetLastEntry(&entry));
-  EXPECT_EQ("keep.txt", entry.path);
-
-  ASSERT_EQ(0, writer.StartEntry("drop.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes(kDropThis, strlen(kDropThis)));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.GetLastEntry(&entry));
-  EXPECT_EQ("drop.txt", entry.path);
-
-  ASSERT_EQ(0, writer.DiscardLastEntry());
-
-  ASSERT_EQ(0, writer.GetLastEntry(&entry));
-  EXPECT_EQ("keep.txt", entry.path);
-
-  ASSERT_EQ(0, writer.StartEntry("replace.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes(kReplaceWithThis, strlen(kReplaceWithThis)));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.GetLastEntry(&entry));
-  EXPECT_EQ("replace.txt", entry.path);
-
-  ASSERT_EQ(0, writer.Finish());
-
-  // Verify that "drop.txt" does not exist.
-
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "keep.txt", &data));
-  ASSERT_TRUE(AssertFileEntryContentsEq(kKeepThis, handle, &data));
-
-  ASSERT_NE(0, FindEntry(handle, "drop.txt", &data));
-
-  ASSERT_EQ(0, FindEntry(handle, "replace.txt", &data));
-  ASSERT_TRUE(AssertFileEntryContentsEq(kReplaceWithThis, handle, &data));
-
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, WriteToUnseekableFile) {
-  const char* expected = "hello";
-  ZipWriter writer(file_);
-  writer.seekable_ = false;
-
-  ASSERT_EQ(0, writer.StartEntry("file.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes(expected, strlen(expected)));
-  ASSERT_EQ(0, writer.FinishEntry());
-  ASSERT_EQ(0, writer.Finish());
-  ASSERT_GE(0, lseek(fd_, 0, SEEK_SET));
-
-  ZipArchiveHandle handle;
-  ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false));
-  ZipEntry data;
-  ASSERT_EQ(0, FindEntry(handle, "file.txt", &data));
-  EXPECT_EQ(kCompressStored, data.method);
-  EXPECT_EQ(1u, data.has_data_descriptor);
-  EXPECT_EQ(strlen(expected), data.compressed_length);
-  ASSERT_EQ(strlen(expected), data.uncompressed_length);
-  ASSERT_TRUE(AssertFileEntryContentsEq(expected, handle, &data));
-  CloseArchive(handle);
-}
-
-TEST_F(zipwriter, TruncateFileAfterBackup) {
-  ZipWriter writer(file_);
-
-  const char* kSmall = "small";
-
-  ASSERT_EQ(0, writer.StartEntry("small.txt", 0));
-  ASSERT_EQ(0, writer.WriteBytes(kSmall, strlen(kSmall)));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  ASSERT_EQ(0, writer.StartEntry("large.txt", 0));
-  std::vector<uint8_t> data;
-  data.resize(1024 * 1024, 0xef);
-  ASSERT_EQ(0, writer.WriteBytes(data.data(), data.size()));
-  ASSERT_EQ(0, writer.FinishEntry());
-
-  off_t before_len = ftello(file_);
-
-  ZipWriter::FileEntry entry;
-  ASSERT_EQ(0, writer.GetLastEntry(&entry));
-  ASSERT_EQ(0, writer.DiscardLastEntry());
-
-  ASSERT_EQ(0, writer.Finish());
-
-  off_t after_len = ftello(file_);
-
-  ASSERT_GT(before_len, after_len);
-}
-
-static ::testing::AssertionResult AssertFileEntryContentsEq(const std::string& expected,
-                                                            ZipArchiveHandle handle,
-                                                            ZipEntry* zip_entry) {
-  if (expected.size() != zip_entry->uncompressed_length) {
-    return ::testing::AssertionFailure()
-           << "uncompressed entry size " << zip_entry->uncompressed_length
-           << " does not match expected size " << expected.size();
-  }
-
-  std::string actual;
-  actual.resize(expected.size());
-
-  uint8_t* buffer = reinterpret_cast<uint8_t*>(&*actual.begin());
-  if (ExtractToMemory(handle, zip_entry, buffer, static_cast<uint32_t>(actual.size())) != 0) {
-    return ::testing::AssertionFailure() << "failed to extract entry";
-  }
-
-  if (expected != actual) {
-    return ::testing::AssertionFailure() << "actual zip_entry data '" << actual
-                                         << "' does not match expected '" << expected << "'";
-  }
-  return ::testing::AssertionSuccess();
-}
diff --git a/libziparchive/ziptool-tests.xml b/libziparchive/ziptool-tests.xml
deleted file mode 100644
index 211119f..0000000
--- a/libziparchive/ziptool-tests.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<configuration description="Config for running ziptool-tests through Atest or in Infra">
-    <option name="test-suite-tag" value="ziptool-tests" />
-    <!-- This test requires a device, so it's not annotated with a null-device. -->
-    <test class="com.android.tradefed.testtype.binary.ExecutableHostTest" >
-        <option name="binary" value="run-ziptool-tests-on-android.sh" />
-        <!-- Test script assumes a relative path with the cli-tests/ folders. -->
-        <option name="relative-path-execution" value="true" />
-        <!-- Tests shouldn't be that long but set 15m to be safe. -->
-        <option name="per-binary-timeout" value="15m" />
-    </test>
-</configuration>
diff --git a/libziparchive/ziptool.cpp b/libziparchive/ziptool.cpp
deleted file mode 100644
index dd42e90..0000000
--- a/libziparchive/ziptool.cpp
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <getopt.h>
-#include <inttypes.h>
-#include <libgen.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <set>
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/strings.h>
-#include <ziparchive/zip_archive.h>
-
-using android::base::EndsWith;
-using android::base::StartsWith;
-
-enum OverwriteMode {
-  kAlways,
-  kNever,
-  kPrompt,
-};
-
-enum Role {
-  kUnzip,
-  kZipinfo,
-};
-
-static Role role;
-static OverwriteMode overwrite_mode = kPrompt;
-static bool flag_1 = false;
-static std::string flag_d;
-static bool flag_l = false;
-static bool flag_p = false;
-static bool flag_q = false;
-static bool flag_v = false;
-static bool flag_x = false;
-static const char* archive_name = nullptr;
-static std::set<std::string> includes;
-static std::set<std::string> excludes;
-static uint64_t total_uncompressed_length = 0;
-static uint64_t total_compressed_length = 0;
-static size_t file_count = 0;
-
-static const char* g_progname;
-
-static void die(int error, const char* fmt, ...) {
-  va_list ap;
-
-  va_start(ap, fmt);
-  fprintf(stderr, "%s: ", g_progname);
-  vfprintf(stderr, fmt, ap);
-  if (error != 0) fprintf(stderr, ": %s", strerror(error));
-  fprintf(stderr, "\n");
-  va_end(ap);
-  exit(1);
-}
-
-static bool ShouldInclude(const std::string& name) {
-  // Explicitly excluded?
-  if (!excludes.empty()) {
-    for (const auto& exclude : excludes) {
-      if (!fnmatch(exclude.c_str(), name.c_str(), 0)) return false;
-    }
-  }
-
-  // Implicitly included?
-  if (includes.empty()) return true;
-
-  // Explicitly included?
-  for (const auto& include : includes) {
-    if (!fnmatch(include.c_str(), name.c_str(), 0)) return true;
-  }
-  return false;
-}
-
-static bool MakeDirectoryHierarchy(const std::string& path) {
-  // stat rather than lstat because a symbolic link to a directory is fine too.
-  struct stat sb;
-  if (stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode)) return true;
-
-  // Ensure the parent directories exist first.
-  if (!MakeDirectoryHierarchy(android::base::Dirname(path))) return false;
-
-  // Then try to create this directory.
-  return (mkdir(path.c_str(), 0777) != -1);
-}
-
-static float CompressionRatio(int64_t uncompressed, int64_t compressed) {
-  if (uncompressed == 0) return 0;
-  return static_cast<float>(100LL * (uncompressed - compressed)) /
-         static_cast<float>(uncompressed);
-}
-
-static void MaybeShowHeader(ZipArchiveHandle zah) {
-  if (role == kUnzip) {
-    // unzip has three formats.
-    if (!flag_q) printf("Archive:  %s\n", archive_name);
-    if (flag_v) {
-      printf(
-          " Length   Method    Size  Cmpr    Date    Time   CRC-32   Name\n"
-          "--------  ------  ------- ---- ---------- ----- --------  ----\n");
-    } else if (flag_l) {
-      printf(
-          "  Length      Date    Time    Name\n"
-          "---------  ---------- -----   ----\n");
-    }
-  } else {
-    // zipinfo.
-    if (!flag_1 && includes.empty() && excludes.empty()) {
-      ZipArchiveInfo info{GetArchiveInfo(zah)};
-      printf("Archive:  %s\n", archive_name);
-      printf("Zip file size: %" PRId64 " bytes, number of entries: %zu\n", info.archive_size,
-             info.entry_count);
-    }
-  }
-}
-
-static void MaybeShowFooter() {
-  if (role == kUnzip) {
-    if (flag_v) {
-      printf(
-          "--------          -------  ---                            -------\n"
-          "%8" PRId64 "         %8" PRId64 " %3.0f%%                            %zu file%s\n",
-          total_uncompressed_length, total_compressed_length,
-          CompressionRatio(total_uncompressed_length, total_compressed_length), file_count,
-          (file_count == 1) ? "" : "s");
-    } else if (flag_l) {
-      printf(
-          "---------                     -------\n"
-          "%9" PRId64 "                     %zu file%s\n",
-          total_uncompressed_length, file_count, (file_count == 1) ? "" : "s");
-    }
-  } else {
-    if (!flag_1 && includes.empty() && excludes.empty()) {
-      printf("%zu files, %" PRId64 " bytes uncompressed, %" PRId64 " bytes compressed:  %.1f%%\n",
-             file_count, total_uncompressed_length, total_compressed_length,
-             CompressionRatio(total_uncompressed_length, total_compressed_length));
-    }
-  }
-}
-
-static bool PromptOverwrite(const std::string& dst) {
-  // TODO: [r]ename not implemented because it doesn't seem useful.
-  printf("replace %s? [y]es, [n]o, [A]ll, [N]one: ", dst.c_str());
-  fflush(stdout);
-  while (true) {
-    char* line = nullptr;
-    size_t n;
-    if (getline(&line, &n, stdin) == -1) {
-      die(0, "(EOF/read error; assuming [N]one...)");
-      overwrite_mode = kNever;
-      return false;
-    }
-    if (n == 0) continue;
-    char cmd = line[0];
-    free(line);
-    switch (cmd) {
-      case 'y':
-        return true;
-      case 'n':
-        return false;
-      case 'A':
-        overwrite_mode = kAlways;
-        return true;
-      case 'N':
-        overwrite_mode = kNever;
-        return false;
-    }
-  }
-}
-
-static void ExtractToPipe(ZipArchiveHandle zah, ZipEntry& entry, const std::string& name) {
-  // We need to extract to memory because ExtractEntryToFile insists on
-  // being able to seek and truncate, and you can't do that with stdout.
-  uint8_t* buffer = new uint8_t[entry.uncompressed_length];
-  int err = ExtractToMemory(zah, &entry, buffer, entry.uncompressed_length);
-  if (err < 0) {
-    die(0, "failed to extract %s: %s", name.c_str(), ErrorCodeString(err));
-  }
-  if (!android::base::WriteFully(1, buffer, entry.uncompressed_length)) {
-    die(errno, "failed to write %s to stdout", name.c_str());
-  }
-  delete[] buffer;
-}
-
-static void ExtractOne(ZipArchiveHandle zah, ZipEntry& entry, const std::string& name) {
-  // Bad filename?
-  if (StartsWith(name, "/") || StartsWith(name, "../") || name.find("/../") != std::string::npos) {
-    die(0, "bad filename %s", name.c_str());
-  }
-
-  // Where are we actually extracting to (for human-readable output)?
-  // flag_d is the empty string if -d wasn't used, or has a trailing '/'
-  // otherwise.
-  std::string dst = flag_d + name;
-
-  // Ensure the directory hierarchy exists.
-  if (!MakeDirectoryHierarchy(android::base::Dirname(name))) {
-    die(errno, "couldn't create directory hierarchy for %s", dst.c_str());
-  }
-
-  // An entry in a zip file can just be a directory itself.
-  if (EndsWith(name, "/")) {
-    if (mkdir(name.c_str(), entry.unix_mode) == -1) {
-      // If the directory already exists, that's fine.
-      if (errno == EEXIST) {
-        struct stat sb;
-        if (stat(name.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode)) return;
-      }
-      die(errno, "couldn't extract directory %s", dst.c_str());
-    }
-    return;
-  }
-
-  // Create the file.
-  int fd = open(name.c_str(), O_CREAT | O_WRONLY | O_CLOEXEC | O_EXCL, entry.unix_mode);
-  if (fd == -1 && errno == EEXIST) {
-    if (overwrite_mode == kNever) return;
-    if (overwrite_mode == kPrompt && !PromptOverwrite(dst)) return;
-    // Either overwrite_mode is kAlways or the user consented to this specific case.
-    fd = open(name.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, entry.unix_mode);
-  }
-  if (fd == -1) die(errno, "couldn't create file %s", dst.c_str());
-
-  // Actually extract into the file.
-  if (!flag_q) printf("  inflating: %s\n", dst.c_str());
-  int err = ExtractEntryToFile(zah, &entry, fd);
-  if (err < 0) die(0, "failed to extract %s: %s", dst.c_str(), ErrorCodeString(err));
-  close(fd);
-}
-
-static void ListOne(const ZipEntry& entry, const std::string& name) {
-  tm t = entry.GetModificationTime();
-  char time[32];
-  snprintf(time, sizeof(time), "%04d-%02d-%02d %02d:%02d", t.tm_year + 1900, t.tm_mon + 1,
-           t.tm_mday, t.tm_hour, t.tm_min);
-  if (flag_v) {
-    printf("%8d  %s  %7d %3.0f%% %s %08x  %s\n", entry.uncompressed_length,
-           (entry.method == kCompressStored) ? "Stored" : "Defl:N", entry.compressed_length,
-           CompressionRatio(entry.uncompressed_length, entry.compressed_length), time, entry.crc32,
-           name.c_str());
-  } else {
-    printf("%9d  %s   %s\n", entry.uncompressed_length, time, name.c_str());
-  }
-}
-
-static void InfoOne(const ZipEntry& entry, const std::string& name) {
-  if (flag_1) {
-    // "android-ndk-r19b/sources/android/NOTICE"
-    printf("%s\n", name.c_str());
-    return;
-  }
-
-  int version = entry.version_made_by & 0xff;
-  int os = (entry.version_made_by >> 8) & 0xff;
-
-  // TODO: Support suid/sgid? Non-Unix/non-FAT host file system attributes?
-  const char* src_fs = "???";
-  char mode[] = "???       ";
-  if (os == 0) {
-    src_fs = "fat";
-    // https://docs.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
-    int attrs = entry.external_file_attributes & 0xff;
-    mode[0] = (attrs & 0x10) ? 'd' : '-';
-    mode[1] = 'r';
-    mode[2] = (attrs & 0x01) ? '-' : 'w';
-    // The man page also mentions ".btm", but that seems to be obsolete?
-    mode[3] = EndsWith(name, ".exe") || EndsWith(name, ".com") || EndsWith(name, ".bat") ||
-                      EndsWith(name, ".cmd")
-                  ? 'x'
-                  : '-';
-    mode[4] = (attrs & 0x20) ? 'a' : '-';
-    mode[5] = (attrs & 0x02) ? 'h' : '-';
-    mode[6] = (attrs & 0x04) ? 's' : '-';
-  } else if (os == 3) {
-    src_fs = "unx";
-    mode[0] = S_ISDIR(entry.unix_mode) ? 'd' : (S_ISREG(entry.unix_mode) ? '-' : '?');
-    mode[1] = entry.unix_mode & S_IRUSR ? 'r' : '-';
-    mode[2] = entry.unix_mode & S_IWUSR ? 'w' : '-';
-    mode[3] = entry.unix_mode & S_IXUSR ? 'x' : '-';
-    mode[4] = entry.unix_mode & S_IRGRP ? 'r' : '-';
-    mode[5] = entry.unix_mode & S_IWGRP ? 'w' : '-';
-    mode[6] = entry.unix_mode & S_IXGRP ? 'x' : '-';
-    mode[7] = entry.unix_mode & S_IROTH ? 'r' : '-';
-    mode[8] = entry.unix_mode & S_IWOTH ? 'w' : '-';
-    mode[9] = entry.unix_mode & S_IXOTH ? 'x' : '-';
-  }
-
-  char method[5] = "stor";
-  if (entry.method == kCompressDeflated) {
-    snprintf(method, sizeof(method), "def%c", "NXFS"[(entry.gpbf >> 1) & 0x3]);
-  }
-
-  // TODO: zipinfo (unlike unzip) sometimes uses time zone?
-  // TODO: this uses 4-digit years because we're not barbarians unless interoperability forces it.
-  tm t = entry.GetModificationTime();
-  char time[32];
-  snprintf(time, sizeof(time), "%04d-%02d-%02d %02d:%02d", t.tm_year + 1900, t.tm_mon + 1,
-           t.tm_mday, t.tm_hour, t.tm_min);
-
-  // "-rw-r--r--  3.0 unx      577 t- defX 19-Feb-12 16:09 android-ndk-r19b/sources/android/NOTICE"
-  printf("%s %2d.%d %s %8d %c%c %s %s %s\n", mode, version / 10, version % 10, src_fs,
-         entry.uncompressed_length, entry.is_text ? 't' : 'b',
-         entry.has_data_descriptor ? 'X' : 'x', method, time, name.c_str());
-}
-
-static void ProcessOne(ZipArchiveHandle zah, ZipEntry& entry, const std::string& name) {
-  if (role == kUnzip) {
-    if (flag_l || flag_v) {
-      // -l or -lv or -lq or -v.
-      ListOne(entry, name);
-    } else {
-      // Actually extract.
-      if (flag_p) {
-        ExtractToPipe(zah, entry, name);
-      } else {
-        ExtractOne(zah, entry, name);
-      }
-    }
-  } else {
-    // zipinfo or zipinfo -1.
-    InfoOne(entry, name);
-  }
-  total_uncompressed_length += entry.uncompressed_length;
-  total_compressed_length += entry.compressed_length;
-  ++file_count;
-}
-
-static void ProcessAll(ZipArchiveHandle zah) {
-  MaybeShowHeader(zah);
-
-  // libziparchive iteration order doesn't match the central directory.
-  // We could sort, but that would cost extra and wouldn't match either.
-  void* cookie;
-  int err = StartIteration(zah, &cookie);
-  if (err != 0) {
-    die(0, "couldn't iterate %s: %s", archive_name, ErrorCodeString(err));
-  }
-
-  ZipEntry entry;
-  std::string name;
-  while ((err = Next(cookie, &entry, &name)) >= 0) {
-    if (ShouldInclude(name)) ProcessOne(zah, entry, name);
-  }
-
-  if (err < -1) die(0, "failed iterating %s: %s", archive_name, ErrorCodeString(err));
-  EndIteration(cookie);
-
-  MaybeShowFooter();
-}
-
-static void ShowHelp(bool full) {
-  if (role == kUnzip) {
-    fprintf(full ? stdout : stderr, "usage: unzip [-d DIR] [-lnopqv] ZIP [FILE...] [-x FILE...]\n");
-    if (!full) exit(EXIT_FAILURE);
-
-    printf(
-        "\n"
-        "Extract FILEs from ZIP archive. Default is all files. Both the include and\n"
-        "exclude (-x) lists use shell glob patterns.\n"
-        "\n"
-        "-d DIR	Extract into DIR\n"
-        "-l	List contents (-lq excludes archive name, -lv is verbose)\n"
-        "-n	Never overwrite files (default: prompt)\n"
-        "-o	Always overwrite files\n"
-        "-p	Pipe to stdout\n"
-        "-q	Quiet\n"
-        "-v	List contents verbosely\n"
-        "-x FILE	Exclude files\n");
-  } else {
-    fprintf(full ? stdout : stderr, "usage: zipinfo [-1] ZIP [FILE...] [-x FILE...]\n");
-    if (!full) exit(EXIT_FAILURE);
-
-    printf(
-        "\n"
-        "Show information about FILEs from ZIP archive. Default is all files.\n"
-        "Both the include and exclude (-x) lists use shell glob patterns.\n"
-        "\n"
-        "-1	Show filenames only, one per line\n"
-        "-x FILE	Exclude files\n");
-  }
-  exit(EXIT_SUCCESS);
-}
-
-static void HandleCommonOption(int opt) {
-  switch (opt) {
-    case 'h':
-      ShowHelp(true);
-      break;
-    case 'x':
-      flag_x = true;
-      break;
-    case 1:
-      // -x swallows all following arguments, so we use '-' in the getopt
-      // string and collect files here.
-      if (!archive_name) {
-        archive_name = optarg;
-      } else if (flag_x) {
-        excludes.insert(optarg);
-      } else {
-        includes.insert(optarg);
-      }
-      break;
-    default:
-      ShowHelp(false);
-      break;
-  }
-}
-
-int main(int argc, char* argv[]) {
-  // Who am I, and what am I doing?
-  g_progname = basename(argv[0]);
-  if (!strcmp(g_progname, "ziptool") && argc > 1) return main(argc - 1, argv + 1);
-  if (!strcmp(g_progname, "unzip")) {
-    role = kUnzip;
-  } else if (!strcmp(g_progname, "zipinfo")) {
-    role = kZipinfo;
-  } else {
-    die(0, "run as ziptool with unzip or zipinfo as the first argument, or symlink");
-  }
-
-  static const struct option opts[] = {
-      {"help", no_argument, 0, 'h'},
-      {},
-  };
-
-  if (role == kUnzip) {
-    // `unzip -Z` is "zipinfo mode", so in that case just restart...
-    if (argc > 1 && !strcmp(argv[1], "-Z")) {
-      argv[1] = const_cast<char*>("zipinfo");
-      return main(argc - 1, argv + 1);
-    }
-
-    int opt;
-    while ((opt = getopt_long(argc, argv, "-d:hlnopqvx", opts, nullptr)) != -1) {
-      switch (opt) {
-        case 'd':
-          flag_d = optarg;
-          if (!EndsWith(flag_d, "/")) flag_d += '/';
-          break;
-        case 'l':
-          flag_l = true;
-          break;
-        case 'n':
-          overwrite_mode = kNever;
-          break;
-        case 'o':
-          overwrite_mode = kAlways;
-          break;
-        case 'p':
-          flag_p = flag_q = true;
-          break;
-        case 'q':
-          flag_q = true;
-          break;
-        case 'v':
-          flag_v = true;
-          break;
-        default:
-          HandleCommonOption(opt);
-          break;
-      }
-    }
-  } else {
-    int opt;
-    while ((opt = getopt_long(argc, argv, "-1hx", opts, nullptr)) != -1) {
-      switch (opt) {
-        case '1':
-          flag_1 = true;
-          break;
-        default:
-          HandleCommonOption(opt);
-          break;
-      }
-    }
-  }
-
-  if (!archive_name) die(0, "missing archive filename");
-
-  // We can't support "-" to unzip from stdin because libziparchive relies on mmap.
-  ZipArchiveHandle zah;
-  int32_t err;
-  if ((err = OpenArchive(archive_name, &zah)) != 0) {
-    die(0, "couldn't open %s: %s", archive_name, ErrorCodeString(err));
-  }
-
-  // Implement -d by changing into that directory.
-  // We'll create implicit directories based on paths in the zip file, and we'll create
-  // the -d directory itself, but we require that *parents* of the -d directory already exists.
-  // This is pretty arbitrary, but it's the behavior of the original unzip.
-  if (!flag_d.empty()) {
-    if (mkdir(flag_d.c_str(), 0777) == -1 && errno != EEXIST) {
-      die(errno, "couldn't created %s", flag_d.c_str());
-    }
-    if (chdir(flag_d.c_str()) == -1) {
-      die(errno, "couldn't chdir to %s", flag_d.c_str());
-    }
-  }
-
-  ProcessAll(zah);
-
-  CloseArchive(zah);
-  return 0;
-}
diff --git a/llkd/libllkd.cpp b/llkd/libllkd.cpp
index a24d900..9f3e218 100644
--- a/llkd/libllkd.cpp
+++ b/llkd/libllkd.cpp
@@ -962,7 +962,7 @@
     //
     // This alarm is effectively the live lock detection of llkd, as
     // we understandably can not monitor ourselves otherwise.
-    ::alarm(duration_cast<seconds>(llkTimeoutMs * 2).count());
+    ::alarm(duration_cast<seconds>(llkTimeoutMs * 2 * android::base::TimeoutMultiplier()).count());
 
     // kernel jiffy precision fastest acquisition
     static timespec last;
diff --git a/logcat/Android.bp b/logcat/Android.bp
deleted file mode 100644
index 61fba59..0000000
--- a/logcat/Android.bp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Copyright (C) 2006 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.
-//
-
-cc_defaults {
-    name: "logcat_defaults",
-
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
-    ],
-    shared_libs: [
-        "libbase",
-        "libprocessgroup",
-    ],
-    static_libs: ["liblog"],
-    logtags: ["event.logtags"],
-}
-
-cc_binary {
-    name: "logcat",
-
-    defaults: ["logcat_defaults"],
-    srcs: [
-        "logcat.cpp",
-    ],
-}
-
-sh_binary {
-    name: "logcatd",
-    src: "logcatd",
-}
-
-sh_binary {
-    name: "logpersist.start",
-    src: "logpersist",
-    init_rc: ["logcatd.rc"],
-    required: ["logcatd"],
-    symlinks: [
-        "logpersist.stop",
-        "logpersist.cat",
-    ],
-}
diff --git a/logcat/MODULE_LICENSE_APACHE2 b/logcat/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/logcat/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/logcat/NOTICE b/logcat/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/logcat/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
-   Copyright (c) 2005-2008, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
diff --git a/logcat/OWNERS b/logcat/OWNERS
deleted file mode 100644
index babbe4d..0000000
--- a/logcat/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-tomcherry@google.com
diff --git a/logcat/event.logtags b/logcat/event.logtags
deleted file mode 100644
index 56a670a..0000000
--- a/logcat/event.logtags
+++ /dev/null
@@ -1,156 +0,0 @@
-# The entries in this file map a sparse set of log tag numbers to tag names.
-# This is installed on the device, in /system/etc, and parsed by logcat.
-#
-# Tag numbers are decimal integers, from 0 to 2^31.  (Let's leave the
-# negative values alone for now.)
-#
-# Tag names are one or more ASCII letters and numbers or underscores, i.e.
-# "[A-Z][a-z][0-9]_".  Do not include spaces or punctuation (the former
-# impacts log readability, the latter makes regex searches more annoying).
-#
-# Tag numbers and names are separated by whitespace.  Blank lines and lines
-# starting with '#' are ignored.
-#
-# Optionally, after the tag names can be put a description for the value(s)
-# of the tag. Description are in the format
-#    (<name>|data type[|data unit])
-# Multiple values are separated by commas.
-#
-# The data type is a number from the following values:
-# 1: int
-# 2: long
-# 3: string
-# 4: list
-# 5: float
-#
-# The data unit is a number taken from the following list:
-# 1: Number of objects
-# 2: Number of bytes
-# 3: Number of milliseconds
-# 4: Number of allocations
-# 5: Id
-# 6: Percent
-# s: Number of seconds (monotonic time)
-# Default value for data of type int/long is 2 (bytes).
-#
-# TODO: generate ".java" and ".h" files with integer constants from this file.
-
-# These are used for testing, do not modify without updating
-# tests/framework-tests/src/android/util/EventLogFunctionalTest.java.
-# system/core/liblog/tests/liblog_benchmark.cpp
-# system/core/liblog/tests/liblog_test.cpp
-42    answer (to life the universe etc|3)
-314   pi
-2718  e
-
-# "account" is the java hash of the account name
-2720 sync (id|3),(event|1|5),(source|1|5),(account|1|5)
-
-# This event is logged when the location service uploads location data.
-2740 location_controller
-# This event is logged when someone is deciding to force a garbage collection
-2741 force_gc (reason|3)
-# This event is logged on each tickle
-2742 tickle (authority|3)
-
-# contacts aggregation: time and number of contacts.
-# count is negative for query phase, positive for merge phase
-2747 contacts_aggregation (aggregation time|2|3), (count|1|1)
-
-# Device boot timings.  We include monotonic clock values because the
-# intrinsic event log times are wall-clock.
-#
-# Runtime starts:
-3000 boot_progress_start (time|2|3)
-# ZygoteInit class preloading starts:
-3020 boot_progress_preload_start (time|2|3)
-# ZygoteInit class preloading ends:
-3030 boot_progress_preload_end (time|2|3)
-
-# Dalvik VM / ART
-20003 dvm_lock_sample (process|3),(main|1|5),(thread|3),(time|1|3),(file|3),(line|1|5),(ownerfile|3),(ownerline|1|5),(sample_percent|1|6)
-20004 art_hidden_api_access (access_method|1),(flags|1),(class|3),(member|3),(type_signature|3)
-
-75000 sqlite_mem_alarm_current (current|1|2)
-75001 sqlite_mem_alarm_max (max|1|2)
-75002 sqlite_mem_alarm_alloc_attempt (attempts|1|4)
-75003 sqlite_mem_released (Memory released|1|2)
-75004 sqlite_db_corrupt (Database file corrupt|3)
-
-50000 menu_item_selected (Menu type where 0 is options and 1 is context|1|5),(Menu item title|3)
-50001 menu_opened (Menu type where 0 is options and 1 is context|1|5)
-
-# HSM wifi state change
-# Hierarchical state class name (as defined in WifiStateTracker.java)
-# Logged on every state change in the hierarchical state machine
-50021 wifi_state_changed (wifi_state|3)
-# HSM wifi event
-# [31-16] Reserved for future use
-# [15 - 0] HSM event (as defined in WifiStateTracker.java)
-# Logged when an event is handled in a hierarchical state
-50022 wifi_event_handled (wifi_event|1|5)
-# Supplicant state change
-# [31-13] Reserved for future use
-# [8 - 0] Supplicant state (as defined in SupplicantState.java)
-# Logged when the supplicant switches to a new state
-50023 wifi_supplicant_state_changed (supplicant_state|1|5)
-
-# Database operation samples.
-# db: the filename of the database
-# sql: the executed query (without query args)
-# time: cpu time millis (not wall time), including lock acquisition
-# blocking_package: if this is on a main thread, the package name, otherwise ""
-# sample_percent: the percent likelihood this query was logged
-52000 db_sample (db|3),(sql|3),(time|1|3),(blocking_package|3),(sample_percent|1|6)
-
-# http request/response stats
-52001 http_stats (useragent|3),(response|2|3),(processing|2|3),(tx|1|2),(rx|1|2)
-60000 viewroot_draw (Draw time|1|3)
-60001 viewroot_layout (Layout time|1|3)
-60002 view_build_drawing_cache (View created drawing cache|1|5)
-60003 view_use_drawing_cache (View drawn using bitmap cache|1|5)
-
-# graphics timestamp
-# 60100 - 60199 reserved for surfaceflinger
-
-# audio
-# 61000 - 61199 reserved for audioserver
-
-# com.android.server.policy
-# 70000 - 70199 reserved for PhoneWindowManager and other policies
-
-# aggregation service
-70200 aggregation (aggregation time|2|3)
-70201 aggregation_test (field1|1|2),(field2|1|2),(field3|1|2),(field4|1|2),(field5|1|2)
-
-# gms refuses to register this log tag, b/30156345
-70220 gms_unknown
-
-# libc failure logging
-80100 bionic_event_memcpy_buffer_overflow (uid|1)
-80105 bionic_event_strcat_buffer_overflow (uid|1)
-80110 bionic_event_memmov_buffer_overflow (uid|1)
-80115 bionic_event_strncat_buffer_overflow (uid|1)
-80120 bionic_event_strncpy_buffer_overflow (uid|1)
-80125 bionic_event_memset_buffer_overflow (uid|1)
-80130 bionic_event_strcpy_buffer_overflow (uid|1)
-
-80200 bionic_event_strcat_integer_overflow (uid|1)
-80205 bionic_event_strncat_integer_overflow (uid|1)
-
-80300 bionic_event_resolver_old_response (uid|1)
-80305 bionic_event_resolver_wrong_server (uid|1)
-80310 bionic_event_resolver_wrong_query (uid|1)
-
-# libcore failure logging
-90100 exp_det_cert_pin_failure (certs|4)
-
-# 150000 - 160000 reserved for Android Automotive builds
-
-1397638484 snet_event_log (subtag|3) (uid|1) (message|3)
-
-# for events that go to stats log buffer
-1937006964 stats_log (atom_id|1|5),(data|4)
-
-# NOTE - the range 1000000-2000000 is reserved for partners and others who
-# want to define their own log tags without conflicting with the core platform.
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
deleted file mode 100644
index b8c143d..0000000
--- a/logcat/logcat.cpp
+++ /dev/null
@@ -1,1183 +0,0 @@
-/*
- * Copyright (C) 2006-2017 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.
- */
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <error.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <math.h>
-#include <sched.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/cdefs.h>
-#include <sys/ioctl.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <memory>
-#include <regex>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/parseint.h>
-#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <android-base/unique_fd.h>
-#include <android/log.h>
-#include <log/event_tag_map.h>
-#include <log/log_id.h>
-#include <log/logprint.h>
-#include <private/android_logger.h>
-#include <processgroup/sched_policy.h>
-#include <system/thread_defs.h>
-
-#define DEFAULT_MAX_ROTATED_LOGS 4
-
-using android::base::Join;
-using android::base::ParseByteCount;
-using android::base::ParseUint;
-using android::base::Split;
-using android::base::StringPrintf;
-
-class Logcat {
-  public:
-    int Run(int argc, char** argv);
-
-  private:
-    void RotateLogs();
-    void ProcessBuffer(struct log_msg* buf);
-    void PrintDividers(log_id_t log_id, bool print_dividers);
-    void SetupOutputAndSchedulingPolicy(bool blocking);
-    int SetLogFormat(const char* format_string);
-
-    // Used for all options
-    android::base::unique_fd output_fd_{dup(STDOUT_FILENO)};
-    std::unique_ptr<AndroidLogFormat, decltype(&android_log_format_free)> logformat_{
-            android_log_format_new(), &android_log_format_free};
-
-    // For logging to a file and log rotation
-    const char* output_file_name_ = nullptr;
-    size_t log_rotate_size_kb_ = 0;                       // 0 means "no log rotation"
-    size_t max_rotated_logs_ = DEFAULT_MAX_ROTATED_LOGS;  // 0 means "unbounded"
-    size_t out_byte_count_ = 0;
-
-    // For binary log buffers
-    int print_binary_ = 0;
-    std::unique_ptr<EventTagMap, decltype(&android_closeEventTagMap)> event_tag_map_{
-            nullptr, &android_closeEventTagMap};
-    bool has_opened_event_tag_map_ = false;
-
-    // For the related --regex, --max-count, --print
-    std::unique_ptr<std::regex> regex_;
-    size_t max_count_ = 0;  // 0 means "infinite"
-    size_t print_count_ = 0;
-    bool print_it_anyways_ = false;
-
-    // For PrintDividers()
-    log_id_t last_printed_id_ = LOG_ID_MAX;
-    bool printed_start_[LOG_ID_MAX] = {};
-
-    bool debug_ = false;
-};
-
-#ifndef F2FS_IOC_SET_PIN_FILE
-#define F2FS_IOCTL_MAGIC       0xf5
-#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32)
-#endif
-
-static int openLogFile(const char* pathname, size_t sizeKB) {
-    int fd = open(pathname, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR | S_IRGRP);
-    if (fd < 0) {
-        return fd;
-    }
-
-    // no need to check errors
-    __u32 set = 1;
-    ioctl(fd, F2FS_IOC_SET_PIN_FILE, &set);
-    fallocate(fd, FALLOC_FL_KEEP_SIZE, 0, (sizeKB << 10));
-    return fd;
-}
-
-static void closeLogFile(const char* pathname) {
-    int fd = open(pathname, O_WRONLY | O_CLOEXEC);
-    if (fd == -1) {
-        return;
-    }
-
-    // no need to check errors
-    __u32 set = 0;
-    ioctl(fd, F2FS_IOC_SET_PIN_FILE, &set);
-    close(fd);
-}
-
-void Logcat::RotateLogs() {
-    // Can't rotate logs if we're not outputting to a file
-    if (!output_file_name_) return;
-
-    output_fd_.reset();
-
-    // Compute the maximum number of digits needed to count up to
-    // maxRotatedLogs in decimal.  eg:
-    // maxRotatedLogs == 30
-    //   -> log10(30) == 1.477
-    //   -> maxRotationCountDigits == 2
-    int max_rotation_count_digits =
-            max_rotated_logs_ > 0 ? (int)(floor(log10(max_rotated_logs_) + 1)) : 0;
-
-    for (int i = max_rotated_logs_; i > 0; i--) {
-        std::string file1 =
-                StringPrintf("%s.%.*d", output_file_name_, max_rotation_count_digits, i);
-
-        std::string file0;
-        if (!(i - 1)) {
-            file0 = output_file_name_;
-        } else {
-            file0 = StringPrintf("%s.%.*d", output_file_name_, max_rotation_count_digits, i - 1);
-        }
-
-        if (!file0.length() || !file1.length()) {
-            perror("while rotating log files");
-            break;
-        }
-
-        closeLogFile(file0.c_str());
-
-        int err = rename(file0.c_str(), file1.c_str());
-
-        if (err < 0 && errno != ENOENT) {
-            perror("while rotating log files");
-        }
-    }
-
-    output_fd_.reset(openLogFile(output_file_name_, log_rotate_size_kb_));
-
-    if (!output_fd_.ok()) {
-        error(EXIT_FAILURE, errno, "Couldn't open output file");
-    }
-
-    out_byte_count_ = 0;
-}
-
-void Logcat::ProcessBuffer(struct log_msg* buf) {
-    int bytesWritten = 0;
-    int err;
-    AndroidLogEntry entry;
-    char binaryMsgBuf[1024];
-
-    bool is_binary =
-            buf->id() == LOG_ID_EVENTS || buf->id() == LOG_ID_STATS || buf->id() == LOG_ID_SECURITY;
-
-    if (is_binary) {
-        if (!event_tag_map_ && !has_opened_event_tag_map_) {
-            event_tag_map_.reset(android_openEventTagMap(nullptr));
-            has_opened_event_tag_map_ = true;
-        }
-        err = android_log_processBinaryLogBuffer(&buf->entry, &entry, event_tag_map_.get(),
-                                                 binaryMsgBuf, sizeof(binaryMsgBuf));
-        // printf(">>> pri=%d len=%d msg='%s'\n",
-        //    entry.priority, entry.messageLen, entry.message);
-    } else {
-        err = android_log_processLogBuffer(&buf->entry, &entry);
-    }
-    if (err < 0 && !debug_) return;
-
-    if (android_log_shouldPrintLine(logformat_.get(), std::string(entry.tag, entry.tagLen).c_str(),
-                                    entry.priority)) {
-        bool match = !regex_ ||
-                     std::regex_search(entry.message, entry.message + entry.messageLen, *regex_);
-
-        print_count_ += match;
-        if (match || print_it_anyways_) {
-            bytesWritten = android_log_printLogLine(logformat_.get(), output_fd_.get(), &entry);
-
-            if (bytesWritten < 0) {
-                error(EXIT_FAILURE, 0, "Output error.");
-            }
-        }
-    }
-
-    out_byte_count_ += bytesWritten;
-
-    if (log_rotate_size_kb_ > 0 && (out_byte_count_ / 1024) >= log_rotate_size_kb_) {
-        RotateLogs();
-    }
-}
-
-void Logcat::PrintDividers(log_id_t log_id, bool print_dividers) {
-    if (log_id == last_printed_id_ || print_binary_) {
-        return;
-    }
-    if (!printed_start_[log_id] || print_dividers) {
-        if (dprintf(output_fd_.get(), "--------- %s %s\n",
-                    printed_start_[log_id] ? "switch to" : "beginning of",
-                    android_log_id_to_name(log_id)) < 0) {
-            error(EXIT_FAILURE, errno, "Output error");
-        }
-    }
-    last_printed_id_ = log_id;
-    printed_start_[log_id] = true;
-}
-
-void Logcat::SetupOutputAndSchedulingPolicy(bool blocking) {
-    if (!output_file_name_) return;
-
-    if (blocking) {
-        // Lower priority and set to batch scheduling if we are saving
-        // the logs into files and taking continuous content.
-        if (set_sched_policy(0, SP_BACKGROUND) < 0) {
-            fprintf(stderr, "failed to set background scheduling policy\n");
-        }
-
-        struct sched_param param = {};
-        if (sched_setscheduler((pid_t)0, SCHED_BATCH, &param) < 0) {
-            fprintf(stderr, "failed to set to batch scheduler\n");
-        }
-
-        if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
-            fprintf(stderr, "failed set to priority\n");
-        }
-    }
-
-    output_fd_.reset(openLogFile(output_file_name_, log_rotate_size_kb_));
-
-    if (!output_fd_.ok()) {
-        error(EXIT_FAILURE, errno, "Couldn't open output file");
-    }
-
-    struct stat statbuf;
-    if (fstat(output_fd_.get(), &statbuf) == -1) {
-        error(EXIT_FAILURE, errno, "Couldn't get output file stat");
-    }
-
-    if ((size_t)statbuf.st_size > SIZE_MAX || statbuf.st_size < 0) {
-        error(EXIT_FAILURE, 0, "Invalid output file stat.");
-    }
-
-    out_byte_count_ = statbuf.st_size;
-}
-
-// clang-format off
-static void show_help() {
-    const char* cmd = getprogname();
-
-    fprintf(stderr, "Usage: %s [options] [filterspecs]\n", cmd);
-
-    fprintf(stderr, R"init(
-General options:
-  -b, --buffer=<buffer>       Request alternate ring buffer(s):
-                                main system radio events crash default all
-                              Additionally, 'kernel' for userdebug and eng builds, and
-                              'security' for Device Owner installations.
-                              Multiple -b parameters or comma separated list of buffers are
-                              allowed. Buffers are interleaved.
-                              Default -b main,system,crash,kernel.
-  -L, --last                  Dump logs from prior to last reboot from pstore.
-  -c, --clear                 Clear (flush) the entire log and exit.
-                              if -f is specified, clear the specified file and its related rotated
-                              log files instead.
-                              if -L is specified, clear pstore log instead.
-  -d                          Dump the log and then exit (don't block).
-  --pid=<pid>                 Only print logs from the given pid.
-  --wrap                      Sleep for 2 hours or when buffer about to wrap whichever
-                              comes first. Improves efficiency of polling by providing
-                              an about-to-wrap wakeup.
-
-Formatting:
-  -v, --format=<format>       Sets log print format verb and adverbs, where <format> is one of:
-                                brief help long process raw tag thread threadtime time
-                              Modifying adverbs can be added:
-                                color descriptive epoch monotonic printable uid usec UTC year zone
-                              Multiple -v parameters or comma separated list of format and format
-                              modifiers are allowed.
-  -D, --dividers              Print dividers between each log buffer.
-  -B, --binary                Output the log in binary.
-
-Outfile files:
-  -f, --file=<file>           Log to file instead of stdout.
-  -r, --rotate-kbytes=<n>     Rotate log every <n> kbytes. Requires -f option.
-  -n, --rotate-count=<count>  Sets max number of rotated logs to <count>, default 4.
-  --id=<id>                   If the signature <id> for logging to file changes, then clear the
-                              associated files and continue.
-
-Logd control:
- These options send a control message to the logd daemon on device, print its return message if
- applicable, then exit. They are incompatible with -L, as these attributes do not apply to pstore.
-  -g, --buffer-size           Get the size of the ring buffers within logd.
-  -G, --buffer-size=<size>    Set size of a ring buffer in logd. May suffix with K or M.
-                              This can individually control each buffer's size with -b.
-  -S, --statistics            Output statistics.
-                              --pid can be used to provide pid specific stats.
-  -p, --prune                 Print prune white and ~black list. Service is specified as UID,
-                              UID/PID or /PID. Weighed for quicker pruning if prefix with ~,
-                              otherwise weighed for longevity if unadorned. All other pruning
-                              activity is oldest first. Special case ~! represents an automatic
-                              quicker pruning for the noisiest UID as determined by the current
-                              statistics.
-  -P, --prune='<list> ...'    Set prune white and ~black list, using same format as listed above.
-                              Must be quoted.
-
-Filtering:
-  -s                          Set default filter to silent. Equivalent to filterspec '*:S'
-  -e, --regex=<expr>          Only print lines where the log message matches <expr> where <expr> is
-                              an ECMAScript regular expression.
-  -m, --max-count=<count>     Quit after printing <count> lines. This is meant to be paired with
-                              --regex, but will work on its own.
-  --print                     This option is only applicable when --regex is set and only useful if
-                              --max-count is also provided.
-                              With --print, logcat will print all messages even if they do not
-                              match the regex. Logcat will quit after printing the max-count number
-                              of lines that match the regex.
-  -t <count>                  Print only the most recent <count> lines (implies -d).
-  -t '<time>'                 Print the lines since specified time (implies -d).
-  -T <count>                  Print only the most recent <count> lines (does not imply -d).
-  -T '<time>'                 Print the lines since specified time (not imply -d).
-                              count is pure numerical, time is 'MM-DD hh:mm:ss.mmm...'
-                              'YYYY-MM-DD hh:mm:ss.mmm...' or 'sssss.mmm...' format.
-)init");
-
-    fprintf(stderr, "\nfilterspecs are a series of \n"
-                   "  <tag>[:priority]\n\n"
-                   "where <tag> is a log component tag (or * for all) and priority is:\n"
-                   "  V    Verbose (default for <tag>)\n"
-                   "  D    Debug (default for '*')\n"
-                   "  I    Info\n"
-                   "  W    Warn\n"
-                   "  E    Error\n"
-                   "  F    Fatal\n"
-                   "  S    Silent (suppress all output)\n"
-                   "\n'*' by itself means '*:D' and <tag> by itself means <tag>:V.\n"
-                   "If no '*' filterspec or -s on command line, all filter defaults to '*:V'.\n"
-                   "eg: '*:S <tag>' prints only <tag>, '<tag>:S' suppresses all <tag> log messages.\n"
-                   "\nIf not specified on the command line, filterspec is set from ANDROID_LOG_TAGS.\n"
-                   "\nIf not specified with -v on command line, format is set from ANDROID_PRINTF_LOG\n"
-                   "or defaults to \"threadtime\"\n\n");
-}
-
-static void show_format_help() {
-    fprintf(stderr,
-        "-v <format>, --format=<format> options:\n"
-        "  Sets log print format verb and adverbs, where <format> is:\n"
-        "    brief long process raw tag thread threadtime time\n"
-        "  and individually flagged modifying adverbs can be added:\n"
-        "    color descriptive epoch monotonic printable uid usec UTC year zone\n"
-        "\nSingle format verbs:\n"
-        "  brief      — Display priority/tag and PID of the process issuing the message.\n"
-        "  long       — Display all metadata fields, separate messages with blank lines.\n"
-        "  process    — Display PID only.\n"
-        "  raw        — Display the raw log message, with no other metadata fields.\n"
-        "  tag        — Display the priority/tag only.\n"
-        "  thread     — Display priority, PID and TID of process issuing the message.\n"
-        "  threadtime — Display the date, invocation time, priority, tag, and the PID\n"
-        "               and TID of the thread issuing the message. (the default format).\n"
-        "  time       — Display the date, invocation time, priority/tag, and PID of the\n"
-        "             process issuing the message.\n"
-        "\nAdverb modifiers can be used in combination:\n"
-        "  color       — Display in highlighted color to match priority. i.e. \x1B[38;5;231mVERBOSE\n"
-        "                \x1B[38;5;75mDEBUG \x1B[38;5;40mINFO \x1B[38;5;166mWARNING \x1B[38;5;196mERROR FATAL\x1B[0m\n"
-        "  descriptive — events logs only, descriptions from event-log-tags database.\n"
-        "  epoch       — Display time as seconds since Jan 1 1970.\n"
-        "  monotonic   — Display time as cpu seconds since last boot.\n"
-        "  printable   — Ensure that any binary logging content is escaped.\n"
-        "  uid         — If permitted, display the UID or Android ID of logged process.\n"
-        "  usec        — Display time down the microsecond precision.\n"
-        "  UTC         — Display time as UTC.\n"
-        "  year        — Add the year to the displayed time.\n"
-        "  zone        — Add the local timezone to the displayed time.\n"
-        "  \"<zone>\"    — Print using this public named timezone (experimental).\n\n"
-    );
-}
-// clang-format on
-
-int Logcat::SetLogFormat(const char* format_string) {
-    AndroidLogPrintFormat format = android_log_formatFromString(format_string);
-
-    // invalid string?
-    if (format == FORMAT_OFF) return -1;
-
-    return android_log_setPrintFormat(logformat_.get(), format);
-}
-
-static std::pair<unsigned long, const char*> format_of_size(unsigned long value) {
-    static const char multipliers[][3] = {{""}, {"Ki"}, {"Mi"}, {"Gi"}};
-    size_t i;
-    for (i = 0;
-         (i < sizeof(multipliers) / sizeof(multipliers[0])) && (value >= 1024);
-         value /= 1024, ++i)
-        ;
-    return std::make_pair(value, multipliers[i]);
-}
-
-static char* parseTime(log_time& t, const char* cp) {
-    char* ep = t.strptime(cp, "%m-%d %H:%M:%S.%q");
-    if (ep) return ep;
-    ep = t.strptime(cp, "%Y-%m-%d %H:%M:%S.%q");
-    if (ep) return ep;
-    return t.strptime(cp, "%s.%q");
-}
-
-// Find last logged line in <outputFileName>, or <outputFileName>.1
-static log_time lastLogTime(const char* outputFileName) {
-    log_time retval(log_time::EPOCH);
-    if (!outputFileName) return retval;
-
-    std::string directory;
-    const char* file = strrchr(outputFileName, '/');
-    if (!file) {
-        directory = ".";
-        file = outputFileName;
-    } else {
-        directory = std::string(outputFileName, file - outputFileName);
-        ++file;
-    }
-
-    std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir(directory.c_str()),
-                                            closedir);
-    if (!dir.get()) return retval;
-
-    log_time now(android_log_clockid());
-
-    size_t len = strlen(file);
-    log_time modulo(0, NS_PER_SEC);
-    struct dirent* dp;
-
-    while (!!(dp = readdir(dir.get()))) {
-        if ((dp->d_type != DT_REG) || !!strncmp(dp->d_name, file, len) ||
-            (dp->d_name[len] && ((dp->d_name[len] != '.') ||
-                                 (strtoll(dp->d_name + 1, nullptr, 10) != 1)))) {
-            continue;
-        }
-
-        std::string file_name = directory;
-        file_name += "/";
-        file_name += dp->d_name;
-        std::string file;
-        if (!android::base::ReadFileToString(file_name, &file)) continue;
-
-        bool found = false;
-        for (const auto& line : android::base::Split(file, "\n")) {
-            log_time t(log_time::EPOCH);
-            char* ep = parseTime(t, line.c_str());
-            if (!ep || (*ep != ' ')) continue;
-            // determine the time precision of the logs (eg: msec or usec)
-            for (unsigned long mod = 1UL; mod < modulo.tv_nsec; mod *= 10) {
-                if (t.tv_nsec % (mod * 10)) {
-                    modulo.tv_nsec = mod;
-                    break;
-                }
-            }
-            // We filter any times later than current as we may not have the
-            // year stored with each log entry. Also, since it is possible for
-            // entries to be recorded out of order (very rare) we select the
-            // maximum we find just in case.
-            if ((t < now) && (t > retval)) {
-                retval = t;
-                found = true;
-            }
-        }
-        // We count on the basename file to be the definitive end, so stop here.
-        if (!dp->d_name[len] && found) break;
-    }
-    if (retval == log_time::EPOCH) return retval;
-    // tail_time prints matching or higher, round up by the modulo to prevent
-    // a replay of the last entry we have just checked.
-    retval += modulo;
-    return retval;
-}
-
-void ReportErrorName(const std::string& name, bool allow_security,
-                     std::vector<std::string>* errors) {
-    if (allow_security || name != "security") {
-        errors->emplace_back(name);
-    }
-}
-
-int Logcat::Run(int argc, char** argv) {
-    bool hasSetLogFormat = false;
-    bool clearLog = false;
-    bool security_buffer_selected =
-            false;  // Do not report errors on the security buffer unless it is explicitly named.
-    bool getLogSize = false;
-    bool getPruneList = false;
-    bool printStatistics = false;
-    bool printDividers = false;
-    unsigned long setLogSize = 0;
-    const char* setPruneList = nullptr;
-    const char* setId = nullptr;
-    int mode = ANDROID_LOG_RDONLY;
-    std::string forceFilters;
-    size_t tail_lines = 0;
-    log_time tail_time(log_time::EPOCH);
-    size_t pid = 0;
-    bool got_t = false;
-    unsigned id_mask = 0;
-
-    if (argc == 2 && !strcmp(argv[1], "--help")) {
-        show_help();
-        return EXIT_SUCCESS;
-    }
-
-    // meant to catch comma-delimited values, but cast a wider
-    // net for stability dealing with possible mistaken inputs.
-    static const char delimiters[] = ",:; \t\n\r\f";
-
-    optind = 0;
-    while (true) {
-        int option_index = 0;
-        // list of long-argument only strings for later comparison
-        static const char pid_str[] = "pid";
-        static const char debug_str[] = "debug";
-        static const char id_str[] = "id";
-        static const char wrap_str[] = "wrap";
-        static const char print_str[] = "print";
-        // clang-format off
-        static const struct option long_options[] = {
-          { "binary",        no_argument,       nullptr, 'B' },
-          { "buffer",        required_argument, nullptr, 'b' },
-          { "buffer-size",   optional_argument, nullptr, 'g' },
-          { "clear",         no_argument,       nullptr, 'c' },
-          { debug_str,       no_argument,       nullptr, 0 },
-          { "dividers",      no_argument,       nullptr, 'D' },
-          { "file",          required_argument, nullptr, 'f' },
-          { "format",        required_argument, nullptr, 'v' },
-          // hidden and undocumented reserved alias for --regex
-          { "grep",          required_argument, nullptr, 'e' },
-          // hidden and undocumented reserved alias for --max-count
-          { "head",          required_argument, nullptr, 'm' },
-          { "help",          no_argument,       nullptr, 'h' },
-          { id_str,          required_argument, nullptr, 0 },
-          { "last",          no_argument,       nullptr, 'L' },
-          { "max-count",     required_argument, nullptr, 'm' },
-          { pid_str,         required_argument, nullptr, 0 },
-          { print_str,       no_argument,       nullptr, 0 },
-          { "prune",         optional_argument, nullptr, 'p' },
-          { "regex",         required_argument, nullptr, 'e' },
-          { "rotate-count",  required_argument, nullptr, 'n' },
-          { "rotate-kbytes", required_argument, nullptr, 'r' },
-          { "statistics",    no_argument,       nullptr, 'S' },
-          // hidden and undocumented reserved alias for -t
-          { "tail",          required_argument, nullptr, 't' },
-          // support, but ignore and do not document, the optional argument
-          { wrap_str,        optional_argument, nullptr, 0 },
-          { nullptr,         0,                 nullptr, 0 }
-        };
-        // clang-format on
-
-        int c = getopt_long(argc, argv, ":cdDhLt:T:gG:sQf:r:n:v:b:BSpP:m:e:", long_options,
-                            &option_index);
-        if (c == -1) break;
-
-        switch (c) {
-            case 0:
-                // only long options
-                if (long_options[option_index].name == pid_str) {
-                    if (pid != 0) {
-                        error(EXIT_FAILURE, 0, "Only one --pid argument can be provided.");
-                    }
-
-                    if (!ParseUint(optarg, &pid) || pid < 1) {
-                        error(EXIT_FAILURE, 0, "%s %s out of range.",
-                              long_options[option_index].name, optarg);
-                    }
-                    break;
-                }
-                if (long_options[option_index].name == wrap_str) {
-                    mode |= ANDROID_LOG_WRAP | ANDROID_LOG_RDONLY |
-                            ANDROID_LOG_NONBLOCK;
-                    // ToDo: implement API that supports setting a wrap timeout
-                    size_t dummy = ANDROID_LOG_WRAP_DEFAULT_TIMEOUT;
-                    if (optarg && (!ParseUint(optarg, &dummy) || dummy < 1)) {
-                        error(EXIT_FAILURE, 0, "%s %s out of range.",
-                              long_options[option_index].name, optarg);
-                    }
-                    if (dummy != ANDROID_LOG_WRAP_DEFAULT_TIMEOUT) {
-                        fprintf(stderr, "WARNING: %s %u seconds, ignoring %zu\n",
-                                long_options[option_index].name, ANDROID_LOG_WRAP_DEFAULT_TIMEOUT,
-                                dummy);
-                    }
-                    break;
-                }
-                if (long_options[option_index].name == print_str) {
-                    print_it_anyways_ = true;
-                    break;
-                }
-                if (long_options[option_index].name == debug_str) {
-                    debug_ = true;
-                    break;
-                }
-                if (long_options[option_index].name == id_str) {
-                    setId = (optarg && optarg[0]) ? optarg : nullptr;
-                }
-                break;
-
-            case 's':
-                // default to all silent
-                android_log_addFilterRule(logformat_.get(), "*:s");
-                break;
-
-            case 'c':
-                clearLog = true;
-                mode |= ANDROID_LOG_WRONLY;
-                break;
-
-            case 'L':
-                mode |= ANDROID_LOG_RDONLY | ANDROID_LOG_PSTORE |
-                        ANDROID_LOG_NONBLOCK;
-                break;
-
-            case 'd':
-                mode |= ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK;
-                break;
-
-            case 't':
-                got_t = true;
-                mode |= ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK;
-                FALLTHROUGH_INTENDED;
-            case 'T':
-                if (strspn(optarg, "0123456789") != strlen(optarg)) {
-                    char* cp = parseTime(tail_time, optarg);
-                    if (!cp) {
-                        error(EXIT_FAILURE, 0, "-%c '%s' not in time format.", c, optarg);
-                    }
-                    if (*cp) {
-                        char ch = *cp;
-                        *cp = '\0';
-                        fprintf(stderr, "WARNING: -%c '%s' '%c%s' time truncated\n", c, optarg, ch,
-                                cp + 1);
-                        *cp = ch;
-                    }
-                } else {
-                    if (!ParseUint(optarg, &tail_lines) || tail_lines < 1) {
-                        fprintf(stderr, "WARNING: -%c %s invalid, setting to 1\n", c, optarg);
-                        tail_lines = 1;
-                    }
-                }
-                break;
-
-            case 'D':
-                printDividers = true;
-                break;
-
-            case 'e':
-                regex_.reset(new std::regex(optarg));
-                break;
-
-            case 'm': {
-                if (!ParseUint(optarg, &max_count_) || max_count_ < 1) {
-                    error(EXIT_FAILURE, 0, "-%c '%s' isn't an integer greater than zero.", c,
-                          optarg);
-                }
-            } break;
-
-            case 'g':
-                if (!optarg) {
-                    getLogSize = true;
-                    break;
-                }
-                FALLTHROUGH_INTENDED;
-
-            case 'G': {
-                if (!ParseByteCount(optarg, &setLogSize) || setLogSize < 1) {
-                    error(EXIT_FAILURE, 0, "-G must be specified as <num><multiplier>.");
-                }
-            } break;
-
-            case 'p':
-                if (!optarg) {
-                    getPruneList = true;
-                    break;
-                }
-                FALLTHROUGH_INTENDED;
-
-            case 'P':
-                setPruneList = optarg;
-                break;
-
-            case 'b':
-                for (const auto& buffer : Split(optarg, delimiters)) {
-                    if (buffer == "default") {
-                        id_mask |= (1 << LOG_ID_MAIN) | (1 << LOG_ID_SYSTEM) | (1 << LOG_ID_CRASH);
-                    } else if (buffer == "all") {
-                        id_mask = -1;
-                    } else {
-                        log_id_t log_id = android_name_to_log_id(buffer.c_str());
-                        if (log_id >= LOG_ID_MAX) {
-                            error(EXIT_FAILURE, 0, "Unknown buffer '%s' listed for -b.",
-                                  buffer.c_str());
-                        }
-                        if (log_id == LOG_ID_SECURITY) {
-                            security_buffer_selected = true;
-                        }
-                        id_mask |= (1 << log_id);
-                    }
-                }
-                break;
-
-            case 'B':
-                print_binary_ = 1;
-                break;
-
-            case 'f':
-                if ((tail_time == log_time::EPOCH) && !tail_lines) {
-                    tail_time = lastLogTime(optarg);
-                }
-                // redirect output to a file
-                output_file_name_ = optarg;
-                break;
-
-            case 'r':
-                if (!ParseUint(optarg, &log_rotate_size_kb_) || log_rotate_size_kb_ < 1) {
-                    error(EXIT_FAILURE, 0, "Invalid parameter '%s' to -r.", optarg);
-                }
-                break;
-
-            case 'n':
-                if (!ParseUint(optarg, &max_rotated_logs_) || max_rotated_logs_ < 1) {
-                    error(EXIT_FAILURE, 0, "Invalid parameter '%s' to -n.", optarg);
-                }
-                break;
-
-            case 'v':
-                if (!strcmp(optarg, "help") || !strcmp(optarg, "--help")) {
-                    show_format_help();
-                    return EXIT_SUCCESS;
-                }
-                for (const auto& arg : Split(optarg, delimiters)) {
-                    int err = SetLogFormat(arg.c_str());
-                    if (err < 0) {
-                        error(EXIT_FAILURE, 0, "Invalid parameter '%s' to -v.", arg.c_str());
-                    }
-                    if (err) hasSetLogFormat = true;
-                }
-                break;
-
-            case 'Q':
-#define LOGCAT_FILTER "androidboot.logcat="
-#define CONSOLE_PIPE_OPTION "androidboot.consolepipe="
-#define CONSOLE_OPTION "androidboot.console="
-#define QEMU_PROPERTY "ro.kernel.qemu"
-#define QEMU_CMDLINE "qemu.cmdline"
-                // This is a *hidden* option used to start a version of logcat
-                // in an emulated device only.  It basically looks for
-                // androidboot.logcat= on the kernel command line.  If
-                // something is found, it extracts a log filter and uses it to
-                // run the program. The logcat output will go to consolepipe if
-                // androiboot.consolepipe (e.g. qemu_pipe) is given, otherwise,
-                // it goes to androidboot.console (e.g. tty)
-                {
-                    // if not in emulator, exit quietly
-                    if (false == android::base::GetBoolProperty(QEMU_PROPERTY, false)) {
-                        return EXIT_SUCCESS;
-                    }
-
-                    std::string cmdline = android::base::GetProperty(QEMU_CMDLINE, "");
-                    if (cmdline.empty()) {
-                        android::base::ReadFileToString("/proc/cmdline", &cmdline);
-                    }
-
-                    const char* logcatFilter = strstr(cmdline.c_str(), LOGCAT_FILTER);
-                    // if nothing found or invalid filters, exit quietly
-                    if (!logcatFilter) {
-                        return EXIT_SUCCESS;
-                    }
-
-                    const char* p = logcatFilter + strlen(LOGCAT_FILTER);
-                    const char* q = strpbrk(p, " \t\n\r");
-                    if (!q) q = p + strlen(p);
-                    forceFilters = std::string(p, q);
-
-                    // redirect our output to the emulator console pipe or console
-                    const char* consolePipe =
-                        strstr(cmdline.c_str(), CONSOLE_PIPE_OPTION);
-                    const char* console =
-                        strstr(cmdline.c_str(), CONSOLE_OPTION);
-
-                    if (consolePipe) {
-                        p = consolePipe + strlen(CONSOLE_PIPE_OPTION);
-                    } else if (console) {
-                        p = console + strlen(CONSOLE_OPTION);
-                    } else {
-                        return EXIT_FAILURE;
-                    }
-
-                    q = strpbrk(p, " \t\n\r");
-                    int len = q ? q - p : strlen(p);
-                    std::string devname = "/dev/" + std::string(p, len);
-                    std::string pipePurpose("pipe:logcat");
-                    if (consolePipe) {
-                        // example: "qemu_pipe,pipe:logcat"
-                        // upon opening of /dev/qemu_pipe, the "pipe:logcat"
-                        // string with trailing '\0' should be written to the fd
-                        size_t pos = devname.find(',');
-                        if (pos != std::string::npos) {
-                            pipePurpose = devname.substr(pos + 1);
-                            devname = devname.substr(0, pos);
-                        }
-                    }
-
-                    fprintf(stderr, "logcat using %s\n", devname.c_str());
-
-                    int fd = open(devname.c_str(), O_WRONLY | O_CLOEXEC);
-                    if (fd < 0) {
-                        break;
-                    }
-
-                    if (consolePipe) {
-                        // need the trailing '\0'
-                        if (!android::base::WriteFully(fd, pipePurpose.c_str(),
-                                                       pipePurpose.size() + 1)) {
-                            close(fd);
-                            return EXIT_FAILURE;
-                        }
-                    }
-                    // close output and error channels, replace with console
-                    dup2(fd, output_fd_.get());
-                    dup2(fd, STDERR_FILENO);
-                    close(fd);
-                }
-                break;
-
-            case 'S':
-                printStatistics = true;
-                break;
-
-            case ':':
-                error(EXIT_FAILURE, 0, "Option '%s' needs an argument.", argv[optind - 1]);
-                break;
-
-            case 'h':
-                show_help();
-                show_format_help();
-                return EXIT_SUCCESS;
-
-            case '?':
-                error(EXIT_FAILURE, 0, "Unknown option '%s'.", argv[optind - 1]);
-                break;
-
-            default:
-                error(EXIT_FAILURE, 0, "Unknown getopt_long() result '%c'.", c);
-        }
-    }
-
-    if (max_count_ && got_t) {
-        error(EXIT_FAILURE, 0, "Cannot use -m (--max-count) and -t together.");
-    }
-    if (print_it_anyways_ && (!regex_ || !max_count_)) {
-        // One day it would be nice if --print -v color and --regex <expr>
-        // could play with each other and show regex highlighted content.
-        fprintf(stderr,
-                "WARNING: "
-                "--print ignored, to be used in combination with\n"
-                "         "
-                "--regex <expr> and --max-count <N>\n");
-        print_it_anyways_ = false;
-    }
-
-    // If no buffers are specified, default to using these buffers.
-    if (id_mask == 0) {
-        id_mask = (1 << LOG_ID_MAIN) | (1 << LOG_ID_SYSTEM) | (1 << LOG_ID_CRASH) |
-                  (1 << LOG_ID_KERNEL);
-    }
-
-    if (log_rotate_size_kb_ != 0 && !output_file_name_) {
-        error(EXIT_FAILURE, 0, "-r requires -f as well.");
-    }
-
-    if (setId != 0) {
-        if (!output_file_name_) {
-            error(EXIT_FAILURE, 0, "--id='%s' requires -f as well.", setId);
-        }
-
-        std::string file_name = StringPrintf("%s.id", output_file_name_);
-        std::string file;
-        bool file_ok = android::base::ReadFileToString(file_name, &file);
-        android::base::WriteStringToFile(setId, file_name, S_IRUSR | S_IWUSR,
-                                         getuid(), getgid());
-        if (!file_ok || !file.compare(setId)) setId = nullptr;
-    }
-
-    if (!hasSetLogFormat) {
-        const char* logFormat = getenv("ANDROID_PRINTF_LOG");
-
-        if (!!logFormat) {
-            for (const auto& arg : Split(logFormat, delimiters)) {
-                int err = SetLogFormat(arg.c_str());
-                // environment should not cause crash of logcat
-                if (err < 0) {
-                    fprintf(stderr, "invalid format in ANDROID_PRINTF_LOG '%s'\n", arg.c_str());
-                }
-                if (err > 0) hasSetLogFormat = true;
-            }
-        }
-        if (!hasSetLogFormat) {
-            SetLogFormat("threadtime");
-        }
-    }
-
-    if (forceFilters.size()) {
-        int err = android_log_addFilterString(logformat_.get(), forceFilters.c_str());
-        if (err < 0) {
-            error(EXIT_FAILURE, 0, "Invalid filter expression in logcat args.");
-        }
-    } else if (argc == optind) {
-        // Add from environment variable
-        const char* env_tags_orig = getenv("ANDROID_LOG_TAGS");
-
-        if (!!env_tags_orig) {
-            int err = android_log_addFilterString(logformat_.get(), env_tags_orig);
-
-            if (err < 0) {
-                error(EXIT_FAILURE, 0, "Invalid filter expression in ANDROID_LOG_TAGS.");
-            }
-        }
-    } else {
-        // Add from commandline
-        for (int i = optind ; i < argc ; i++) {
-            int err = android_log_addFilterString(logformat_.get(), argv[i]);
-            if (err < 0) {
-                error(EXIT_FAILURE, 0, "Invalid filter expression '%s'.", argv[i]);
-            }
-        }
-    }
-
-    if (mode & ANDROID_LOG_PSTORE) {
-        if (output_file_name_) {
-            error(EXIT_FAILURE, 0, "-c is ambiguous with both -f and -L specified.");
-        }
-        if (setLogSize || getLogSize || printStatistics || getPruneList || setPruneList) {
-            error(EXIT_FAILURE, 0, "-L is incompatible with -g/-G, -S, and -p/-P.");
-        }
-        if (clearLog) {
-            unlink("/sys/fs/pstore/pmsg-ramoops-0");
-            return EXIT_SUCCESS;
-        }
-    }
-
-    if (output_file_name_) {
-        if (setLogSize || getLogSize || printStatistics || getPruneList || setPruneList) {
-            error(EXIT_FAILURE, 0, "-f is incompatible with -g/-G, -S, and -p/-P.");
-        }
-
-        if (clearLog || setId) {
-            int max_rotation_count_digits =
-                    max_rotated_logs_ > 0 ? (int)(floor(log10(max_rotated_logs_) + 1)) : 0;
-
-            for (int i = max_rotated_logs_; i >= 0; --i) {
-                std::string file;
-
-                if (!i) {
-                    file = output_file_name_;
-                } else {
-                    file = StringPrintf("%s.%.*d", output_file_name_, max_rotation_count_digits, i);
-                }
-
-                int err = unlink(file.c_str());
-
-                if (err < 0 && errno != ENOENT) {
-                    fprintf(stderr, "failed to delete log file '%s': %s\n", file.c_str(),
-                            strerror(errno));
-                }
-            }
-        }
-
-        if (clearLog) {
-            return EXIT_SUCCESS;
-        }
-    }
-
-    std::unique_ptr<logger_list, decltype(&android_logger_list_free)> logger_list{
-            nullptr, &android_logger_list_free};
-    if (tail_time != log_time::EPOCH) {
-        logger_list.reset(android_logger_list_alloc_time(mode, tail_time, pid));
-    } else {
-        logger_list.reset(android_logger_list_alloc(mode, tail_lines, pid));
-    }
-    // We have three orthogonal actions below to clear, set log size and
-    // get log size. All sharing the same iteration loop.
-    std::vector<std::string> open_device_failures;
-    std::vector<std::string> clear_failures;
-    std::vector<std::string> set_size_failures;
-    std::vector<std::string> get_size_failures;
-
-    for (int i = LOG_ID_MIN; i < LOG_ID_MAX; ++i) {
-        if (!(id_mask & (1 << i))) continue;
-        const char* buffer_name = android_log_id_to_name(static_cast<log_id_t>(i));
-
-        auto logger = android_logger_open(logger_list.get(), static_cast<log_id_t>(i));
-        if (logger == nullptr) {
-            ReportErrorName(buffer_name, security_buffer_selected, &open_device_failures);
-            continue;
-        }
-
-        if (clearLog) {
-            if (android_logger_clear(logger)) {
-                ReportErrorName(buffer_name, security_buffer_selected, &clear_failures);
-            }
-        }
-
-        if (setLogSize) {
-            if (android_logger_set_log_size(logger, setLogSize)) {
-                ReportErrorName(buffer_name, security_buffer_selected, &set_size_failures);
-            }
-        }
-
-        if (getLogSize) {
-            long size = android_logger_get_log_size(logger);
-            long readable = android_logger_get_log_readable_size(logger);
-
-            if (size < 0 || readable < 0) {
-                ReportErrorName(buffer_name, security_buffer_selected, &get_size_failures);
-            } else {
-                auto size_format = format_of_size(size);
-                auto readable_format = format_of_size(readable);
-                std::string str = android::base::StringPrintf(
-                        "%s: ring buffer is %lu %sB (%lu %sB consumed),"
-                        " max entry is %d B, max payload is %d B\n",
-                        buffer_name, size_format.first, size_format.second, readable_format.first,
-                        readable_format.second, (int)LOGGER_ENTRY_MAX_LEN,
-                        (int)LOGGER_ENTRY_MAX_PAYLOAD);
-                TEMP_FAILURE_RETRY(write(output_fd_.get(), str.data(), str.length()));
-            }
-        }
-    }
-
-    // report any errors in the above loop and exit
-    if (!open_device_failures.empty()) {
-        error(EXIT_FAILURE, 0, "Unable to open log device%s '%s'.",
-              open_device_failures.size() > 1 ? "s" : "", Join(open_device_failures, ",").c_str());
-    }
-    if (!clear_failures.empty()) {
-        error(EXIT_FAILURE, 0, "failed to clear the '%s' log%s.", Join(clear_failures, ",").c_str(),
-              clear_failures.size() > 1 ? "s" : "");
-    }
-    if (!set_size_failures.empty()) {
-        error(EXIT_FAILURE, 0, "failed to set the '%s' log size%s.",
-              Join(set_size_failures, ",").c_str(), set_size_failures.size() > 1 ? "s" : "");
-    }
-    if (!get_size_failures.empty()) {
-        error(EXIT_FAILURE, 0, "failed to get the readable '%s' log size%s.",
-              Join(get_size_failures, ",").c_str(), get_size_failures.size() > 1 ? "s" : "");
-    }
-
-    if (setPruneList) {
-        size_t len = strlen(setPruneList);
-        if (android_logger_set_prune_list(logger_list.get(), setPruneList, len)) {
-            error(EXIT_FAILURE, 0, "Failed to set the prune list.");
-        }
-        return EXIT_SUCCESS;
-    }
-
-    if (printStatistics || getPruneList) {
-        std::string buf(8192, '\0');
-        size_t ret_length = 0;
-        int retry = 32;
-
-        for (; retry >= 0; --retry) {
-            if (getPruneList) {
-                android_logger_get_prune_list(logger_list.get(), buf.data(), buf.size());
-            } else {
-                android_logger_get_statistics(logger_list.get(), buf.data(), buf.size());
-            }
-
-            ret_length = atol(buf.c_str());
-            if (ret_length < 3) {
-                error(EXIT_FAILURE, 0, "Failed to read data.");
-            }
-
-            if (ret_length < buf.size()) {
-                break;
-            }
-
-            buf.resize(ret_length + 1);
-        }
-
-        if (retry < 0) {
-            error(EXIT_FAILURE, 0, "Failed to read data.");
-        }
-
-        buf.resize(ret_length);
-        if (buf.back() == '\f') {
-            buf.pop_back();
-        }
-
-        // Remove the byte count prefix
-        const char* cp = buf.c_str();
-        while (isdigit(*cp)) ++cp;
-        if (*cp == '\n') ++cp;
-
-        size_t len = strlen(cp);
-        TEMP_FAILURE_RETRY(write(output_fd_.get(), cp, len));
-        return EXIT_SUCCESS;
-    }
-
-    if (getLogSize || setLogSize || clearLog) return EXIT_SUCCESS;
-
-    SetupOutputAndSchedulingPolicy(!(mode & ANDROID_LOG_NONBLOCK));
-
-    while (!max_count_ || print_count_ < max_count_) {
-        struct log_msg log_msg;
-        int ret = android_logger_list_read(logger_list.get(), &log_msg);
-        if (!ret) {
-            error(EXIT_FAILURE, 0, R"init(Unexpected EOF!
-
-This means that either the device shut down, logd crashed, or this instance of logcat was unable to read log
-messages as quickly as they were being produced.
-
-If you have enabled significant logging, look into using the -G option to increase log buffer sizes.)init");
-        }
-
-        if (ret < 0) {
-            if (ret == -EAGAIN) break;
-
-            if (ret == -EIO) {
-                error(EXIT_FAILURE, 0, "Unexpected EOF!");
-            }
-            if (ret == -EINVAL) {
-                error(EXIT_FAILURE, 0, "Unexpected length.");
-            }
-            error(EXIT_FAILURE, errno, "Logcat read failure");
-        }
-
-        if (log_msg.id() > LOG_ID_MAX) {
-            error(EXIT_FAILURE, 0, "Unexpected log id (%d) over LOG_ID_MAX (%d).", log_msg.id(),
-                  LOG_ID_MAX);
-        }
-
-        PrintDividers(log_msg.id(), printDividers);
-
-        if (print_binary_) {
-            TEMP_FAILURE_RETRY(write(output_fd_.get(), &log_msg, log_msg.len()));
-        } else {
-            ProcessBuffer(&log_msg);
-        }
-    }
-    return EXIT_SUCCESS;
-}
-
-int main(int argc, char** argv) {
-    Logcat logcat;
-    return logcat.Run(argc, argv);
-}
diff --git a/logcat/logcatd b/logcat/logcatd
deleted file mode 100755
index 5a1415d..0000000
--- a/logcat/logcatd
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /system/bin/sh
-
-# This is primarily meant to be used by logpersist.  This script is run as an init service, which
-# first reads the 'last' logcat to persistent storage with `-L` then run logcat again without
-# `-L` to read the current logcat buffers to persistent storage.
-
-# init sets the umask to 077 for forked processes. logpersist needs to create files that are group
-# readable. So relax the umask to only disallow group wx and world rwx.
-umask 037
-
-has_last="false"
-for arg in "$@"; do
-  if [ "$arg" == "-L" -o "$arg" == "--last" ]; then
-    has_last="true"
-  fi
-done
-
-if [ "$has_last" == "true" ]; then
-  logcat "$@"
-fi
-
-args_without_last=()
-for arg in "$@"; do
-  if [ "$arg" != "-L" -a "$arg" != "--last" ]; then
-    ARGS+=("$arg")
-  fi
-done
-
-exec logcat "${ARGS[@]}"
diff --git a/logcat/logcatd.rc b/logcat/logcatd.rc
deleted file mode 100644
index 64d5500..0000000
--- a/logcat/logcatd.rc
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# init scriptures for logcatd persistent logging.
-#
-# Make sure any property changes are only performed with /data mounted, after
-# post-fs-data state because otherwise behavior is undefined. The exceptions
-# are device adjustments for logcatd service properties (persist.* overrides
-# notwithstanding) for logd.logpersistd.size logd.logpersistd.rotate_kbytes and
-# logd.logpersistd.buffer.
-
-# persist to non-persistent trampolines to permit device properties can be
-# overridden when /data mounts, or during runtime.
-on property:persist.logd.logpersistd.count=*
-    # expect /init to report failure if property empty (default)
-    setprop persist.logd.logpersistd.size ${persist.logd.logpersistd.count}
-
-on property:persist.logd.logpersistd.size=*
-    setprop logd.logpersistd.size ${persist.logd.logpersistd.size}
-
-on property:persist.logd.logpersistd.rotate_kbytes=*
-    setprop logd.logpersistd.rotate_kbytes ${persist.logd.logpersistd.rotate_kbytes}
-
-on property:persist.logd.logpersistd.buffer=*
-    setprop logd.logpersistd.buffer ${persist.logd.logpersistd.buffer}
-
-on property:persist.logd.logpersistd=logcatd
-    setprop logd.logpersistd logcatd
-
-# enable, prep and start logcatd service
-on load_persist_props_action
-    setprop logd.logpersistd.enable true
-
-on property:logd.logpersistd.enable=true && property:logd.logpersistd=logcatd
-    # log group should be able to read persisted logs
-    mkdir /data/misc/logd 0750 logd log
-    start logcatd
-
-# stop logcatd service and clear data
-on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear
-    setprop persist.logd.logpersistd ""
-    stop logcatd
-    # logd for clear of only our files in /data/misc/logd
-    exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256}
-    setprop logd.logpersistd ""
-
-# stop logcatd service
-on property:logd.logpersistd=stop
-    setprop persist.logd.logpersistd ""
-    stop logcatd
-    setprop logd.logpersistd ""
-
-on property:logd.logpersistd.enable=false
-    stop logcatd
-
-# logcatd service
-service logcatd /system/bin/logcatd -L -b ${logd.logpersistd.buffer:-all} -v threadtime -v usec -v printable -D -f /data/misc/logd/logcat -r ${logd.logpersistd.rotate_kbytes:-2048} -n ${logd.logpersistd.size:-256} --id=${ro.build.id}
-    class late_start
-    disabled
-    # logd for write to /data/misc/logd, log group for read from log daemon
-    user logd
-    group log
-    writepid /dev/cpuset/system-background/tasks
-    oom_score_adjust -600
diff --git a/logcat/logpersist b/logcat/logpersist
deleted file mode 100755
index 05b46f0..0000000
--- a/logcat/logpersist
+++ /dev/null
@@ -1,178 +0,0 @@
-#! /system/bin/sh
-# logpersist cat, start and stop handlers
-progname="${0##*/}"
-case `getprop ro.debuggable` in
-1) ;;
-*) echo "${progname} - Permission denied"
-   exit 1
-   ;;
-esac
-
-property=persist.logd.logpersistd
-
-case `getprop ${property#persist.}.enable` in
-true) ;;
-*) echo "${progname} - Disabled"
-   exit 1
-   ;;
-esac
-
-log_uid=logd
-log_tag_property=persist.log.tag
-data=/data/misc/logd/logcat
-service=logcatd
-size_default=256
-buffer_default=all
-args="${@}"
-
-size=${size_default}
-buffer=${buffer_default}
-clear=false
-while [ ${#} -gt 0 ]; do
-  case ${1} in
-    -c|--clear) clear=true ;;
-    --size=*) size="${1#--size=}" ;;
-    --rotate-count=*) size="${1#--rotate-count=}" ;;
-    -n|--size|--rotate-count) size="${2}" ; shift ;;
-    --buffer=*) buffer="${1#--buffer=}" ;;
-    -b|--buffer) buffer="${2}" ; shift ;;
-    -h|--help|*)
-      LEAD_SPACE_="`echo ${progname%.*} | tr '[ -~]' ' '`"
-      echo "${progname%.*}.cat             - dump current ${service} logs"
-      echo "${progname%.*}.start [--size=<size_in_kb>] [--buffer=<buffers>] [--clear]"
-      echo "${LEAD_SPACE_}                 - start ${service} service"
-      echo "${progname%.*}.stop [--clear]  - stop ${service} service"
-      case ${1} in
-        -h|--help) exit 0 ;;
-        *) echo ERROR: bad argument ${@} >&2 ; exit 1 ;;
-      esac
-      ;;
-  esac
-  shift
-done
-
-if [ -z "${size}" -o "${size_default}" = "${size}" ]; then
-  unset size
-fi
-if [ -n "${size}" ] &&
-  ! ( [ 0 -lt "${size}" ] && [ 2048 -ge "${size}" ] ) >/dev/null 2>&1; then
-  echo ERROR: Invalid --size ${size} >&2
-  exit 1
-fi
-if [ -z "${buffer}" -o "${buffer_default}" = "${buffer}" ]; then
-  unset buffer
-fi
-if [ -n "${buffer}" ] && ! logcat -b ${buffer} -g >/dev/null 2>&1; then
-  echo ERROR: Invalid --buffer ${buffer} >&2
-  exit 1
-fi
-
-log_tag="`getprop ${log_tag_property}`"
-logd_logpersistd="`getprop ${property}`"
-
-case ${progname} in
-*.cat)
-  if [ -n "${size}${buffer}" -o "true" = "${clear}" ]; then
-    echo WARNING: Can not use --clear, --size or --buffer with ${progname%.*}.cat >&2
-  fi
-  su ${log_uid} ls "${data%/*}" |
-  tr -d '\r' |
-  sort -ru |
-  sed "s#^#${data%/*}/#" |
-  grep "${data}[.]*[0-9]*\$" |
-  su ${log_uid} xargs cat
-  ;;
-*.start)
-  current_buffer="`getprop ${property#persist.}.buffer`"
-  current_size="`getprop ${property#persist.}.size`"
-  if [ "${service}" = "`getprop ${property#persist.}`" ]; then
-    if [ "true" = "${clear}" ]; then
-      setprop ${property#persist.} "clear"
-    elif [ "${buffer}|${size}" != "${current_buffer}|${current_size}" ]; then
-      echo   "ERROR: Changing existing collection parameters from" >&2
-      if [ "${buffer}" != "${current_buffer}" ]; then
-        a=${current_buffer}
-        b=${buffer}
-        if [ -z "${a}" ]; then a="${default_buffer}"; fi
-        if [ -z "${b}" ]; then b="${default_buffer}"; fi
-        echo "           --buffer ${a} to ${b}" >&2
-      fi
-      if [ "${size}" != "${current_size}" ]; then
-        a=${current_size}
-        b=${size}
-        if [ -z "${a}" ]; then a="${default_size}"; fi
-        if [ -z "${b}" ]; then b="${default_size}"; fi
-        echo "           --size ${a} to ${b}" >&2
-      fi
-      echo   "       Are you sure you want to do this?" >&2
-      echo   "       Suggest add --clear to erase data and restart with new settings." >&2
-      echo   "       To blindly override and retain data, ${progname%.*}.stop first." >&2
-      exit 1
-    fi
-  elif [ "true" = "${clear}" ]; then
-    setprop ${property#persist.} "clear"
-  fi
-  if [ -n "${buffer}${current_buffer}" ]; then
-    setprop ${property}.buffer "${buffer}"
-    if [ -z "${buffer}" ]; then
-      # deal with trampoline for empty properties
-      setprop ${property#persist.}.buffer ""
-    fi
-  fi
-  if [ -n "${size}${current_size}" ]; then
-    setprop ${property}.size "${size}"
-    if [ -z "${size}" ]; then
-      # deal with trampoline for empty properties
-      setprop ${property#persist.}.size ""
-    fi
-  fi
-  while [ "clear" = "`getprop ${property#persist.}`" ]; do
-    continue
-  done
-  # Tell Settings that we are back on again if we turned logging off
-  tag="${log_tag#Settings}"
-  if [ X"${log_tag}" != X"${tag}" ]; then
-    echo "WARNING: enabling logd service" >&2
-    setprop ${log_tag_property} "${tag#,}"
-  fi
-  # ${service}.rc does the heavy lifting with the following trigger
-  setprop ${property} ${service}
-  # 20ms done, to permit process feedback check
-  sleep 1
-  getprop ${property#persist.}
-  # also generate an error return code if not found running
-  pgrep -u ${log_uid} ${service%d}
-  ;;
-*.stop)
-  if [ -n "${size}${buffer}" ]; then
-    echo "WARNING: Can not use --size or --buffer with ${progname%.*}.stop" >&2
-  fi
-  if [ "true" = "${clear}" ]; then
-    setprop ${property#persist.} "clear"
-  else
-    setprop ${property#persist.} "stop"
-  fi
-  if [ -n "`getprop ${property#persist.}.buffer`" ]; then
-    setprop ${property}.buffer ""
-    # deal with trampoline for empty properties
-    setprop ${property#persist.}.buffer ""
-  fi
-  if [ -n "`getprop ${property#persist.}.size`" ]; then
-    setprop ${property}.size ""
-    # deal with trampoline for empty properties
-    setprop ${property#persist.}.size ""
-  fi
-  while [ "clear" = "`getprop ${property#persist.}`" ]; do
-    continue
-  done
-  ;;
-*)
-  echo "ERROR: Unexpected command ${0##*/} ${args}" >&2
-  exit 1
-esac
-
-if [ X"${log_tag}" != X"`getprop ${log_tag_property}`" ] ||
-   [ X"${logd_logpersistd}" != X"`getprop ${property}`" ]; then
-  echo "WARNING: killing Settings application to pull in new values" >&2
-  am force-stop com.android.settings
-fi
diff --git a/logcat/tests/Android.bp b/logcat/tests/Android.bp
deleted file mode 100644
index ab84150..0000000
--- a/logcat/tests/Android.bp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Copyright (C) 2013-2014 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.
-//
-
-cc_defaults {
-    name: "logcat-tests-defaults",
-    cflags: [
-        "-fstack-protector-all",
-        "-g",
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-fno-builtin",
-    ],
-}
-
-// -----------------------------------------------------------------------------
-// Benchmarks
-// ----------------------------------------------------------------------------
-
-// Build benchmarks for the device. Run with:
-//   adb shell /data/nativetest/logcat-benchmarks/logcat-benchmarks
-cc_benchmark {
-    name: "logcat-benchmarks",
-    defaults: ["logcat-tests-defaults"],
-    srcs: ["logcat_benchmark.cpp"],
-    shared_libs: ["libbase"],
-}
-
-// -----------------------------------------------------------------------------
-// Unit tests.
-// -----------------------------------------------------------------------------
-
-// Build tests for the device (with .so). Run with:
-//   adb shell /data/nativetest/logcat-unit-tests/logcat-unit-tests
-cc_test {
-    name: "logcat-unit-tests",
-    defaults: ["logcat-tests-defaults"],
-    shared_libs: ["libbase"],
-    static_libs: ["liblog"],
-    srcs: [
-        "logcat_test.cpp",
-        "logcatd_test.cpp",
-    ],
-}
diff --git a/logcat/tests/logcat_benchmark.cpp b/logcat/tests/logcat_benchmark.cpp
deleted file mode 100644
index 8d88628..0000000
--- a/logcat/tests/logcat_benchmark.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2013-2014 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <benchmark/benchmark.h>
-
-static const char begin[] = "--------- beginning of ";
-
-static void BM_logcat_sorted_order(benchmark::State& state) {
-    FILE* fp;
-
-    if (!state.KeepRunning()) return;
-
-    fp = popen(
-        "logcat -v time -b radio -b events -b system -b main -d 2>/dev/null",
-        "r");
-    if (!fp) return;
-
-    class timestamp {
-       private:
-        int month;
-        int day;
-        int hour;
-        int minute;
-        int second;
-        int millisecond;
-        bool ok;
-
-       public:
-        void init(const char* buffer) {
-            ok = false;
-            if (buffer != NULL) {
-                ok = sscanf(buffer, "%d-%d %d:%d:%d.%d ", &month, &day, &hour,
-                            &minute, &second, &millisecond) == 6;
-            }
-        }
-
-        explicit timestamp(const char* buffer) {
-            init(buffer);
-        }
-
-        bool operator<(timestamp& T) {
-            return !ok || !T.ok || (month < T.month) ||
-                   ((month == T.month) &&
-                    ((day < T.day) ||
-                     ((day == T.day) &&
-                      ((hour < T.hour) ||
-                       ((hour == T.hour) &&
-                        ((minute < T.minute) ||
-                         ((minute == T.minute) &&
-                          ((second < T.second) ||
-                           ((second == T.second) &&
-                            (millisecond < T.millisecond))))))))));
-        }
-
-        bool valid(void) {
-            return ok;
-        }
-    } last(NULL);
-
-    char* last_buffer = NULL;
-    char buffer[5120];
-
-    int count = 0;
-    int next_lt_last = 0;
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(begin, buffer, sizeof(begin) - 1)) {
-            continue;
-        }
-        if (!last.valid()) {
-            free(last_buffer);
-            last_buffer = strdup(buffer);
-            last.init(buffer);
-        }
-        timestamp next(buffer);
-        if (next < last) {
-            if (last_buffer) {
-                fprintf(stderr, "<%s", last_buffer);
-            }
-            fprintf(stderr, ">%s", buffer);
-            ++next_lt_last;
-        }
-        if (next.valid()) {
-            free(last_buffer);
-            last_buffer = strdup(buffer);
-            last.init(buffer);
-        }
-        ++count;
-    }
-    free(last_buffer);
-
-    pclose(fp);
-
-    static const int max_ok = 2;
-
-    // Allow few fails, happens with readers active
-    fprintf(stderr, "%s: %d/%d out of order entries\n",
-            (next_lt_last) ? ((next_lt_last <= max_ok) ? "WARNING" : "ERROR")
-                           : "INFO",
-            next_lt_last, count);
-
-    if (next_lt_last > max_ok) {
-        fprintf(stderr, "EXPECT_GE(max_ok=%d, next_lt_last=%d)\n", max_ok,
-                next_lt_last);
-    }
-
-    // sample statistically too small
-    if (count < 100) {
-        fprintf(stderr, "EXPECT_LT(100, count=%d)\n", count);
-    }
-
-    state.KeepRunning();
-}
-BENCHMARK(BM_logcat_sorted_order);
-
-BENCHMARK_MAIN();
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
deleted file mode 100644
index b32b437..0000000
--- a/logcat/tests/logcat_test.cpp
+++ /dev/null
@@ -1,1760 +0,0 @@
-/*
- * Copyright (C) 2013-2014 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.
- */
-
-#include <ctype.h>
-#include <dirent.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/cdefs.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <memory>
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <gtest/gtest.h>
-#include <log/event_tag_map.h>
-#include <log/log.h>
-#include <log/log_event_list.h>
-
-#ifndef logcat_executable
-#define USING_LOGCAT_EXECUTABLE_DEFAULT
-#define logcat_executable "logcat"
-#endif
-
-#define BIG_BUFFER (5 * 1024)
-
-// rest(), let the logs settle.
-//
-// logd is in a background cgroup and under extreme load can take up to
-// 3 seconds to land a log entry. Under moderate load we can do with 200ms.
-static void rest() {
-    static const useconds_t restPeriod = 200000;
-
-    usleep(restPeriod);
-}
-
-// enhanced version of LOG_FAILURE_RETRY to add support for EAGAIN and
-// non-syscall libs. Since we are only using this in the emergency of
-// a signal to stuff a terminating code into the logs, we will spin rather
-// than try a usleep.
-#define LOG_FAILURE_RETRY(exp)                                               \
-    ({                                                                       \
-        typeof(exp) _rc;                                                     \
-        do {                                                                 \
-            _rc = (exp);                                                     \
-        } while (((_rc == -1) && ((errno == EINTR) || (errno == EAGAIN))) || \
-                 (_rc == -EINTR) || (_rc == -EAGAIN));                       \
-        _rc;                                                                 \
-    })
-
-static const char begin[] = "--------- beginning of ";
-
-TEST(logcat, buckets) {
-    FILE* fp;
-
-#undef LOG_TAG
-#define LOG_TAG "inject.buckets"
-    // inject messages into radio, system, main and events buffers to
-    // ensure that we see all the begin[] bucket messages.
-    RLOGE(logcat_executable);
-    SLOGE(logcat_executable);
-    ALOGE(logcat_executable);
-    __android_log_bswrite(0, logcat_executable ".inject.buckets");
-    rest();
-
-    ASSERT_TRUE(NULL != (fp = popen(logcat_executable
-                                    " -b radio -b events -b system -b main -d 2>/dev/null",
-                                    "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int ids = 0;
-    int count = 0;
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(begin, buffer, sizeof(begin) - 1)) {
-            while (char* cp = strrchr(buffer, '\n')) {
-                *cp = '\0';
-            }
-            log_id_t id = android_name_to_log_id(buffer + sizeof(begin) - 1);
-            ids |= 1 << id;
-            ++count;
-        }
-    }
-
-    pclose(fp);
-
-    EXPECT_EQ(ids, 15);
-
-    EXPECT_EQ(count, 4);
-}
-
-TEST(logcat, event_tag_filter) {
-    FILE* fp;
-
-#undef LOG_TAG
-#define LOG_TAG "inject.filter"
-    // inject messages into radio, system and main buffers
-    // with our unique log tag to test logcat filter.
-    RLOGE(logcat_executable);
-    SLOGE(logcat_executable);
-    ALOGE(logcat_executable);
-    rest();
-
-    std::string command = android::base::StringPrintf(
-        logcat_executable
-        " -b radio -b system -b main --pid=%d -d -s inject.filter 2>/dev/null",
-        getpid());
-    ASSERT_TRUE(NULL != (fp = popen(command.c_str(), "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (strncmp(begin, buffer, sizeof(begin) - 1)) ++count;
-    }
-
-    pclose(fp);
-
-    // logcat, liblogcat and logcatd test instances result in the progression
-    // of 3, 6 and 9 for our counts as each round is performed.
-    EXPECT_GE(count, 3);
-    EXPECT_LE(count, 9);
-    EXPECT_EQ(count % 3, 0);
-}
-
-// If there is not enough background noise in the logs, then spam the logs to
-// permit tail checking so that the tests can progress.
-static size_t inject(ssize_t count) {
-    if (count <= 0) return 0;
-
-    static const size_t retry = 4;
-    size_t errors = retry;
-    size_t num = 0;
-    for (;;) {
-        log_time ts(CLOCK_MONOTONIC);
-        if (__android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)) >= 0) {
-            if (++num >= (size_t)count) {
-                // let data settle end-to-end
-                sleep(3);
-                return num;
-            }
-            errors = retry;
-            usleep(100);  // ~32 per timer tick, we are a spammer regardless
-        } else if (--errors <= 0) {
-            return num;
-        }
-    }
-    // NOTREACH
-    return num;
-}
-
-TEST(logcat, year) {
-    if (android_log_clockid() == CLOCK_MONOTONIC) {
-        fprintf(stderr, "Skipping test, logd is monotonic time\n");
-        return;
-    }
-
-    int count;
-    int tries = 3;  // in case run too soon after system start or buffer clear
-
-    do {
-        FILE* fp;
-
-        char needle[32];
-        time_t now;
-        time(&now);
-        struct tm* ptm;
-#if !defined(_WIN32)
-        struct tm tmBuf;
-        ptm = localtime_r(&now, &tmBuf);
-#else
-        ptm = localtime(&&now);
-#endif
-        strftime(needle, sizeof(needle), "[ %Y-", ptm);
-
-        ASSERT_TRUE(NULL !=
-                    (fp = popen(logcat_executable " -v long -v year -b all -t 3 2>/dev/null", "r")));
-
-        char buffer[BIG_BUFFER];
-
-        count = 0;
-
-        while (fgets(buffer, sizeof(buffer), fp)) {
-            if (!strncmp(buffer, needle, strlen(needle))) {
-                ++count;
-            }
-        }
-        pclose(fp);
-
-    } while ((count < 3) && --tries && inject(3 - count));
-
-    ASSERT_EQ(3, count);
-}
-
-// Return a pointer to each null terminated -v long time field.
-static char* fgetLongTime(char* buffer, size_t buflen, FILE* fp) {
-    while (fgets(buffer, buflen, fp)) {
-        char* cp = buffer;
-        if (*cp != '[') {
-            continue;
-        }
-        while (*++cp == ' ') {
-            ;
-        }
-        char* ep = cp;
-        while (isdigit(*ep)) {
-            ++ep;
-        }
-        if ((*ep != '-') && (*ep != '.')) {
-            continue;
-        }
-        // Find PID field.  Look for ': ' or ':[0-9][0-9][0-9]'
-        while (((ep = strchr(ep, ':'))) && (*++ep != ' ')) {
-            if (isdigit(ep[0]) && isdigit(ep[1]) && isdigit(ep[2])) break;
-        }
-        if (!ep) {
-            continue;
-        }
-        static const size_t pid_field_width = 7;
-        ep -= pid_field_width;
-        *ep = '\0';
-        return cp;
-    }
-    return NULL;
-}
-
-TEST(logcat, tz) {
-    if (android_log_clockid() == CLOCK_MONOTONIC) {
-        fprintf(stderr, "Skipping test, logd is monotonic time\n");
-        return;
-    }
-
-    int tries = 4;  // in case run too soon after system start or buffer clear
-    int count;
-
-    do {
-        FILE* fp;
-
-        ASSERT_TRUE(NULL != (fp = popen(logcat_executable
-                                        " -v long -v America/Los_Angeles -b all -t 3 2>/dev/null",
-                                        "r")));
-
-        char buffer[BIG_BUFFER];
-
-        count = 0;
-
-        while (fgetLongTime(buffer, sizeof(buffer), fp)) {
-            if (strstr(buffer, " -0700") || strstr(buffer, " -0800")) {
-                ++count;
-            } else {
-                fprintf(stderr, "ts=\"%s\"\n", buffer + 2);
-            }
-        }
-
-        pclose(fp);
-
-    } while ((count < 3) && --tries && inject(3 - count));
-
-    ASSERT_EQ(3, count);
-}
-
-TEST(logcat, ntz) {
-    FILE* fp;
-
-    ASSERT_TRUE(NULL !=
-                (fp = popen(logcat_executable
-                            " -v long -v America/Los_Angeles -v zone -b all -t 3 2>/dev/null",
-                            "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-
-    while (fgetLongTime(buffer, sizeof(buffer), fp)) {
-        if (strstr(buffer, " -0700") || strstr(buffer, " -0800")) {
-            ++count;
-        }
-    }
-
-    pclose(fp);
-
-    ASSERT_EQ(0, count);
-}
-
-static void do_tail(int num) {
-    int tries = 4;  // in case run too soon after system start or buffer clear
-    int count;
-
-    if (num > 10) ++tries;
-    if (num > 100) ++tries;
-    do {
-        char buffer[BIG_BUFFER];
-
-        snprintf(buffer, sizeof(buffer),
-                 "ANDROID_PRINTF_LOG=long logcat -b all -t %d 2>/dev/null", num);
-
-        FILE* fp;
-        ASSERT_TRUE(NULL != (fp = popen(buffer, "r")));
-
-        count = 0;
-
-        while (fgetLongTime(buffer, sizeof(buffer), fp)) {
-            ++count;
-        }
-
-        pclose(fp);
-
-    } while ((count < num) && --tries && inject(num - count));
-
-    ASSERT_EQ(num, count);
-}
-
-TEST(logcat, tail_3) {
-    do_tail(3);
-}
-
-TEST(logcat, tail_10) {
-    do_tail(10);
-}
-
-TEST(logcat, tail_100) {
-    do_tail(100);
-}
-
-TEST(logcat, tail_1000) {
-    do_tail(1000);
-}
-
-static void do_tail_time(const char* cmd) {
-    FILE* fp;
-    int count;
-    char buffer[BIG_BUFFER];
-    char* last_timestamp = NULL;
-    // Hard to predict 100% if first (overlap) or second line will match.
-    // -v nsec will in a substantial majority be the second line.
-    char* first_timestamp = NULL;
-    char* second_timestamp = NULL;
-    char* input;
-
-    int tries = 4;  // in case run too soon after system start or buffer clear
-
-    do {
-        snprintf(buffer, sizeof(buffer), "%s -t 10 2>&1", cmd);
-        ASSERT_TRUE(NULL != (fp = popen(buffer, "r")));
-        count = 0;
-
-        while ((input = fgetLongTime(buffer, sizeof(buffer), fp))) {
-            ++count;
-            if (!first_timestamp) {
-                first_timestamp = strdup(input);
-            } else if (!second_timestamp) {
-                second_timestamp = strdup(input);
-            }
-            free(last_timestamp);
-            last_timestamp = strdup(input);
-        }
-        pclose(fp);
-
-    } while ((count < 10) && --tries && inject(10 - count));
-
-    EXPECT_EQ(count, 10);  // We want _some_ history, too small, falses below
-    EXPECT_TRUE(last_timestamp != NULL);
-    EXPECT_TRUE(first_timestamp != NULL);
-    EXPECT_TRUE(second_timestamp != NULL);
-
-    snprintf(buffer, sizeof(buffer), "%s -t '%s' 2>&1", cmd, first_timestamp);
-    ASSERT_TRUE(NULL != (fp = popen(buffer, "r")));
-
-    int second_count = 0;
-    int last_timestamp_count = -1;
-
-    --count;  // One less unless we match the first_timestamp
-    bool found = false;
-    while ((input = fgetLongTime(buffer, sizeof(buffer), fp))) {
-        ++second_count;
-        // We want to highlight if we skip to the next entry.
-        // WAI, if the time in logd is *exactly*
-        // XX-XX XX:XX:XX.XXXXXX000 (usec) or XX-XX XX:XX:XX.XXX000000
-        // this can happen, but it should not happen with nsec.
-        // We can make this WAI behavior happen 1000 times less
-        // frequently if the caller does not use the -v usec flag,
-        // but always the second (always skip) if they use the
-        // (undocumented) -v nsec flag.
-        if (first_timestamp) {
-            found = !strcmp(input, first_timestamp);
-            if (found) {
-                ++count;
-                GTEST_LOG_(INFO)
-                    << "input = first(" << first_timestamp << ")\n";
-            }
-            free(first_timestamp);
-            first_timestamp = NULL;
-        }
-        if (second_timestamp) {
-            found = found || !strcmp(input, second_timestamp);
-            if (!found) {
-                GTEST_LOG_(INFO) << "input(" << input << ") != second("
-                                 << second_timestamp << ")\n";
-            }
-            free(second_timestamp);
-            second_timestamp = NULL;
-        }
-        if (!strcmp(input, last_timestamp)) {
-            last_timestamp_count = second_count;
-        }
-    }
-    pclose(fp);
-
-    EXPECT_TRUE(found);
-    if (!found) {
-        if (first_timestamp) {
-            GTEST_LOG_(INFO) << "first = " << first_timestamp << "\n";
-        }
-        if (second_timestamp) {
-            GTEST_LOG_(INFO) << "second = " << second_timestamp << "\n";
-        }
-        if (last_timestamp) {
-            GTEST_LOG_(INFO) << "last = " << last_timestamp << "\n";
-        }
-    }
-    free(last_timestamp);
-    last_timestamp = NULL;
-    free(first_timestamp);
-    free(second_timestamp);
-
-    EXPECT_TRUE(first_timestamp == NULL);
-    EXPECT_TRUE(second_timestamp == NULL);
-    EXPECT_LE(count, second_count);
-    EXPECT_LE(count, last_timestamp_count);
-}
-
-TEST(logcat, tail_time) {
-    do_tail_time(logcat_executable " -v long -v nsec -b all");
-}
-
-TEST(logcat, tail_time_epoch) {
-    do_tail_time(logcat_executable " -v long -v nsec -v epoch -b all");
-}
-
-TEST(logcat, End_to_End) {
-    pid_t pid = getpid();
-
-    log_time ts(CLOCK_MONOTONIC);
-
-    ASSERT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-
-    FILE* fp;
-    ASSERT_TRUE(NULL !=
-                (fp = popen(logcat_executable " -v brief -b events -t 100 2>/dev/null", "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        int p;
-        unsigned long long t;
-
-        if ((2 != sscanf(buffer, "I/[0]     ( %d): %llu", &p, &t)) ||
-            (p != pid)) {
-            continue;
-        }
-
-        log_time tx((const char*)&t);
-        if (ts == tx) {
-            ++count;
-        }
-    }
-
-    pclose(fp);
-
-    ASSERT_EQ(1, count);
-}
-
-TEST(logcat, End_to_End_multitude) {
-    pid_t pid = getpid();
-
-    log_time ts(CLOCK_MONOTONIC);
-
-    ASSERT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-
-    FILE* fp[256];  // does this count as a multitude!
-    memset(fp, 0, sizeof(fp));
-    size_t num = 0;
-    do {
-        EXPECT_TRUE(NULL != (fp[num] = popen(logcat_executable " -v brief -b events -t 100", "r")));
-        if (!fp[num]) {
-            fprintf(stderr,
-                    "WARNING: limiting to %zu simultaneous logcat operations\n",
-                    num);
-            break;
-        }
-    } while (++num < sizeof(fp) / sizeof(fp[0]));
-
-    char buffer[BIG_BUFFER];
-
-    size_t count = 0;
-
-    for (size_t idx = 0; idx < sizeof(fp) / sizeof(fp[0]); ++idx) {
-        if (!fp[idx]) break;
-        while (fgets(buffer, sizeof(buffer), fp[idx])) {
-            int p;
-            unsigned long long t;
-
-            if ((2 != sscanf(buffer, "I/[0]     ( %d): %llu", &p, &t)) ||
-                (p != pid)) {
-                continue;
-            }
-
-            log_time tx((const char*)&t);
-            if (ts == tx) {
-                ++count;
-            }
-        }
-
-        pclose(fp[idx]);
-    }
-
-    ASSERT_EQ(num, count);
-}
-
-static int get_groups(const char* cmd) {
-    FILE* fp;
-
-    // NB: crash log only available in user space
-    EXPECT_TRUE(NULL != (fp = popen(cmd, "r")));
-
-    if (fp == NULL) {
-        return 0;
-    }
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        int size, consumed, max, payload;
-        char size_mult[4], consumed_mult[4];
-        long full_size, full_consumed;
-
-        size = consumed = max = payload = 0;
-        // NB: crash log can be very small, not hit a Kb of consumed space
-        //     doubly lucky we are not including it.
-        EXPECT_EQ(6, sscanf(buffer,
-                            "%*s ring buffer is %d %3s (%d %3s consumed),"
-                            " max entry is %d B, max payload is %d B",
-                            &size, size_mult, &consumed, consumed_mult, &max, &payload))
-                << "Parse error on: " << buffer;
-        full_size = size;
-        switch (size_mult[0]) {
-            case 'G':
-                full_size *= 1024;
-                FALLTHROUGH_INTENDED;
-            case 'M':
-                full_size *= 1024;
-                FALLTHROUGH_INTENDED;
-            case 'K':
-                full_size *= 1024;
-                FALLTHROUGH_INTENDED;
-            case 'B':
-                break;
-            default:
-                ADD_FAILURE() << "Parse error on multiplier: " << size_mult;
-        }
-        full_consumed = consumed;
-        switch (consumed_mult[0]) {
-            case 'G':
-                full_consumed *= 1024;
-                FALLTHROUGH_INTENDED;
-            case 'M':
-                full_consumed *= 1024;
-                FALLTHROUGH_INTENDED;
-            case 'K':
-                full_consumed *= 1024;
-                FALLTHROUGH_INTENDED;
-            case 'B':
-                break;
-            default:
-                ADD_FAILURE() << "Parse error on multiplier: " << consumed_mult;
-        }
-        EXPECT_GT((full_size * 9) / 4, full_consumed);
-        EXPECT_GT(full_size, max);
-        EXPECT_GT(max, payload);
-
-        if ((((full_size * 9) / 4) >= full_consumed) && (full_size > max) &&
-            (max > payload)) {
-            ++count;
-        }
-    }
-
-    pclose(fp);
-
-    return count;
-}
-
-TEST(logcat, get_size) {
-    ASSERT_EQ(4, get_groups(logcat_executable
-                            " -v brief -b radio -b events -b system -b "
-                            "main -g 2>/dev/null"));
-}
-
-// duplicate test for get_size, but use comma-separated list of buffers
-TEST(logcat, multiple_buffer) {
-    ASSERT_EQ(
-        4, get_groups(logcat_executable
-                      " -v brief -b radio,events,system,main -g 2>/dev/null"));
-}
-
-TEST(logcat, bad_buffer) {
-    ASSERT_EQ(0,
-              get_groups(
-                  logcat_executable
-                  " -v brief -b radio,events,bogo,system,main -g 2>/dev/null"));
-}
-
-#ifndef logcat
-static void caught_blocking(int signum) {
-    unsigned long long v = 0xDEADBEEFA55A0000ULL;
-
-    v += getpid() & 0xFFFF;
-    if (signum == 0) ++v;
-
-    LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-}
-
-TEST(logcat, blocking) {
-    FILE* fp;
-    unsigned long long v = 0xDEADBEEFA55F0000ULL;
-
-    pid_t pid = getpid();
-
-    v += pid & 0xFFFF;
-
-    LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-
-    v &= 0xFFFFFFFFFFFAFFFFULL;
-
-    ASSERT_TRUE(
-        NULL !=
-        (fp = popen("( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&"
-                    " logcat -v brief -b events 2>&1",
-                    "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-
-    int signals = 0;
-
-    signal(SIGALRM, caught_blocking);
-    alarm(2);
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(buffer, "DONE", 4)) {
-            break;
-        }
-
-        ++count;
-
-        int p;
-        unsigned long long l;
-
-        if ((2 != sscanf(buffer, "I/[0] ( %u): %lld", &p, &l)) || (p != pid)) {
-            continue;
-        }
-
-        if (l == v) {
-            ++signals;
-            break;
-        }
-    }
-    alarm(0);
-    signal(SIGALRM, SIG_DFL);
-
-    // Generate SIGPIPE
-    fclose(fp);
-    caught_blocking(0);
-
-    pclose(fp);
-
-    EXPECT_GE(count, 2);
-
-    EXPECT_EQ(signals, 1);
-}
-
-static void caught_blocking_tail(int signum) {
-    unsigned long long v = 0xA55ADEADBEEF0000ULL;
-
-    v += getpid() & 0xFFFF;
-    if (signum == 0) ++v;
-
-    LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-}
-
-TEST(logcat, blocking_tail) {
-    FILE* fp;
-    unsigned long long v = 0xA55FDEADBEEF0000ULL;
-
-    pid_t pid = getpid();
-
-    v += pid & 0xFFFF;
-
-    LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-
-    v &= 0xFFFAFFFFFFFFFFFFULL;
-
-    ASSERT_TRUE(
-        NULL !=
-        (fp = popen("( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&"
-                    " logcat -v brief -b events -T 5 2>&1",
-                    "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-
-    int signals = 0;
-
-    signal(SIGALRM, caught_blocking_tail);
-    alarm(2);
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(buffer, "DONE", 4)) {
-            break;
-        }
-
-        ++count;
-
-        int p;
-        unsigned long long l;
-
-        if ((2 != sscanf(buffer, "I/[0] ( %u): %lld", &p, &l)) || (p != pid)) {
-            continue;
-        }
-
-        if (l == v) {
-            if (count >= 5) {
-                ++signals;
-            }
-            break;
-        }
-    }
-    alarm(0);
-    signal(SIGALRM, SIG_DFL);
-
-    // Generate SIGPIPE
-    fclose(fp);
-    caught_blocking_tail(0);
-
-    pclose(fp);
-
-    EXPECT_GE(count, 2);
-
-    EXPECT_EQ(signals, 1);
-}
-#endif
-
-// meant to be handed to ASSERT_FALSE / EXPECT_FALSE to expand the message
-static testing::AssertionResult IsFalse(int ret, const char* command) {
-    return ret ? (testing::AssertionSuccess()
-                  << "ret=" << ret << " command=\"" << command << "\"")
-               : testing::AssertionFailure();
-}
-
-TEST(logcat, logrotate) {
-    static const char form[] = "/data/local/tmp/logcat.logrotate.XXXXXX";
-    char buf[sizeof(form)];
-    ASSERT_TRUE(NULL != mkdtemp(strcpy(buf, form)));
-
-    static const char comm[] = logcat_executable
-        " -b radio -b events -b system -b main"
-        " -d -f %s/log.txt -n 7 -r 1";
-    char command[sizeof(buf) + sizeof(comm)];
-    snprintf(command, sizeof(command), comm, buf);
-
-    int ret;
-    EXPECT_FALSE(IsFalse(ret = system(command), command));
-    if (!ret) {
-        snprintf(command, sizeof(command), "ls -s %s 2>/dev/null", buf);
-
-        FILE* fp;
-        EXPECT_TRUE(NULL != (fp = popen(command, "r")));
-        if (fp) {
-            char buffer[BIG_BUFFER];
-            int count = 0;
-
-            while (fgets(buffer, sizeof(buffer), fp)) {
-                static const char total[] = "total ";
-                int num;
-                char c;
-
-                if ((2 == sscanf(buffer, "%d log.tx%c", &num, &c)) &&
-                    (num <= 40)) {
-                    ++count;
-                } else if (strncmp(buffer, total, sizeof(total) - 1)) {
-                    fprintf(stderr, "WARNING: Parse error: %s", buffer);
-                }
-            }
-            pclose(fp);
-            if ((count != 7) && (count != 8)) {
-                fprintf(stderr, "count=%d\n", count);
-            }
-            EXPECT_TRUE(count == 7 || count == 8);
-        }
-    }
-    snprintf(command, sizeof(command), "rm -rf %s", buf);
-    EXPECT_FALSE(IsFalse(system(command), command));
-}
-
-TEST(logcat, logrotate_suffix) {
-    static const char tmp_out_dir_form[] =
-        "/data/local/tmp/logcat.logrotate.XXXXXX";
-    char tmp_out_dir[sizeof(tmp_out_dir_form)];
-    ASSERT_TRUE(NULL != mkdtemp(strcpy(tmp_out_dir, tmp_out_dir_form)));
-
-    static const char logcat_cmd[] = logcat_executable
-        " -b radio -b events -b system -b main"
-        " -d -f %s/log.txt -n 10 -r 1";
-    char command[sizeof(tmp_out_dir) + sizeof(logcat_cmd)];
-    snprintf(command, sizeof(command), logcat_cmd, tmp_out_dir);
-
-    int ret;
-    EXPECT_FALSE(IsFalse(ret = system(command), command));
-    if (!ret) {
-        snprintf(command, sizeof(command), "ls %s 2>/dev/null", tmp_out_dir);
-
-        FILE* fp;
-        EXPECT_TRUE(NULL != (fp = popen(command, "r")));
-        char buffer[BIG_BUFFER];
-        int log_file_count = 0;
-
-        while (fgets(buffer, sizeof(buffer), fp)) {
-            static const char rotated_log_filename_prefix[] = "log.txt.";
-            static const size_t rotated_log_filename_prefix_len =
-                strlen(rotated_log_filename_prefix);
-            static const char log_filename[] = "log.txt";
-
-            if (!strncmp(buffer, rotated_log_filename_prefix,
-                         rotated_log_filename_prefix_len)) {
-                // Rotated file should have form log.txt.##
-                char* rotated_log_filename_suffix =
-                    buffer + rotated_log_filename_prefix_len;
-                char* endptr;
-                const long int suffix_value =
-                    strtol(rotated_log_filename_suffix, &endptr, 10);
-                EXPECT_EQ(rotated_log_filename_suffix + 2, endptr);
-                EXPECT_LE(suffix_value, 10);
-                EXPECT_GT(suffix_value, 0);
-                ++log_file_count;
-                continue;
-            }
-
-            if (!strncmp(buffer, log_filename, strlen(log_filename))) {
-                ++log_file_count;
-                continue;
-            }
-
-            fprintf(stderr, "ERROR: Unexpected file: %s", buffer);
-            ADD_FAILURE();
-        }
-        pclose(fp);
-        EXPECT_EQ(log_file_count, 11);
-    }
-    snprintf(command, sizeof(command), "rm -rf %s", tmp_out_dir);
-    EXPECT_FALSE(IsFalse(system(command), command));
-}
-
-TEST(logcat, logrotate_continue) {
-    static const char tmp_out_dir_form[] =
-        "/data/local/tmp/logcat.logrotate.XXXXXX";
-    char tmp_out_dir[sizeof(tmp_out_dir_form)];
-    ASSERT_TRUE(NULL != mkdtemp(strcpy(tmp_out_dir, tmp_out_dir_form)));
-
-    static const char log_filename[] = "log.txt";
-    static const char logcat_cmd[] =
-        logcat_executable " -b all -v nsec -d -f %s/%s -n 256 -r 1024";
-    static const char cleanup_cmd[] = "rm -rf %s";
-    char command[sizeof(tmp_out_dir) + sizeof(logcat_cmd) + sizeof(log_filename)];
-    snprintf(command, sizeof(command), logcat_cmd, tmp_out_dir, log_filename);
-
-    int ret;
-    EXPECT_FALSE(IsFalse(ret = system(command), command));
-    if (ret) {
-        snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-        EXPECT_FALSE(IsFalse(system(command), command));
-        return;
-    }
-    FILE* fp;
-    snprintf(command, sizeof(command), "%s/%s", tmp_out_dir, log_filename);
-    EXPECT_TRUE(NULL != ((fp = fopen(command, "r"))));
-    if (!fp) {
-        snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-        EXPECT_FALSE(IsFalse(system(command), command));
-        return;
-    }
-    char* line = NULL;
-    char* last_line =
-        NULL;  // this line is allowed to stutter, one-line overlap
-    char* second_last_line = NULL;  // should never stutter
-    char* first_line = NULL;        // help diagnose failure?
-    size_t len = 0;
-    while (getline(&line, &len, fp) != -1) {
-        if (!first_line) {
-            first_line = line;
-            line = NULL;
-            continue;
-        }
-        free(second_last_line);
-        second_last_line = last_line;
-        last_line = line;
-        line = NULL;
-    }
-    fclose(fp);
-    free(line);
-    if (second_last_line == NULL) {
-        fprintf(stderr, "No second to last line, using last, test may fail\n");
-        second_last_line = last_line;
-        last_line = NULL;
-    }
-    free(last_line);
-    EXPECT_TRUE(NULL != second_last_line);
-    if (!second_last_line) {
-        snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-        EXPECT_FALSE(IsFalse(system(command), command));
-        free(first_line);
-        return;
-    }
-    // re-run the command, it should only add a few lines more content if it
-    // continues where it left off.
-    snprintf(command, sizeof(command), logcat_cmd, tmp_out_dir, log_filename);
-    EXPECT_FALSE(IsFalse(ret = system(command), command));
-    if (ret) {
-        snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-        EXPECT_FALSE(IsFalse(system(command), command));
-        free(second_last_line);
-        free(first_line);
-        return;
-    }
-    std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(tmp_out_dir),
-                                                  closedir);
-    EXPECT_NE(nullptr, dir);
-    if (!dir) {
-        snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-        EXPECT_FALSE(IsFalse(system(command), command));
-        free(second_last_line);
-        free(first_line);
-        return;
-    }
-    struct dirent* entry;
-    unsigned count = 0;
-    while ((entry = readdir(dir.get()))) {
-        if (strncmp(entry->d_name, log_filename, sizeof(log_filename) - 1)) {
-            continue;
-        }
-        snprintf(command, sizeof(command), "%s/%s", tmp_out_dir, entry->d_name);
-        EXPECT_TRUE(NULL != ((fp = fopen(command, "r"))));
-        if (!fp) {
-            fprintf(stderr, "%s ?\n", command);
-            continue;
-        }
-        line = NULL;
-        size_t number = 0;
-        while (getline(&line, &len, fp) != -1) {
-            ++number;
-            if (!strcmp(line, second_last_line)) {
-                EXPECT_TRUE(++count <= 1);
-                fprintf(stderr, "%s(%zu):\n", entry->d_name, number);
-            }
-        }
-        fclose(fp);
-        free(line);
-        unlink(command);
-    }
-    if (count > 1) {
-        char* brk = strpbrk(second_last_line, "\r\n");
-        if (!brk) brk = second_last_line + strlen(second_last_line);
-        fprintf(stderr, "\"%.*s\" occurred %u times\n",
-                (int)(brk - second_last_line), second_last_line, count);
-        if (first_line) {
-            brk = strpbrk(first_line, "\r\n");
-            if (!brk) brk = first_line + strlen(first_line);
-            fprintf(stderr, "\"%.*s\" was first line, fault?\n",
-                    (int)(brk - first_line), first_line);
-        }
-    }
-    free(second_last_line);
-    free(first_line);
-
-    snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-    EXPECT_FALSE(IsFalse(system(command), command));
-}
-
-TEST(logcat, logrotate_clear) {
-    static const char tmp_out_dir_form[] =
-        "/data/local/tmp/logcat.logrotate.XXXXXX";
-    char tmp_out_dir[sizeof(tmp_out_dir_form)];
-    ASSERT_TRUE(NULL != mkdtemp(strcpy(tmp_out_dir, tmp_out_dir_form)));
-
-    static const char log_filename[] = "log.txt";
-    static const unsigned num_val = 32;
-    static const char logcat_cmd[] =
-        logcat_executable " -b all -d -f %s/%s -n %d -r 1";
-    static const char clear_cmd[] = " -c";
-    static const char cleanup_cmd[] = "rm -rf %s";
-    char command[sizeof(tmp_out_dir) + sizeof(logcat_cmd) +
-                 sizeof(log_filename) + sizeof(clear_cmd) + 32];
-
-    // Run command with all data
-    {
-        snprintf(command, sizeof(command) - sizeof(clear_cmd), logcat_cmd,
-                 tmp_out_dir, log_filename, num_val);
-
-        int ret;
-        EXPECT_FALSE(IsFalse(ret = system(command), command));
-        if (ret) {
-            snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-            EXPECT_FALSE(IsFalse(system(command), command));
-            return;
-        }
-        std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(tmp_out_dir),
-                                                      closedir);
-        EXPECT_NE(nullptr, dir);
-        if (!dir) {
-            snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-            EXPECT_FALSE(IsFalse(system(command), command));
-            return;
-        }
-        struct dirent* entry;
-        unsigned count = 0;
-        while ((entry = readdir(dir.get()))) {
-            if (strncmp(entry->d_name, log_filename, sizeof(log_filename) - 1)) {
-                continue;
-            }
-            ++count;
-        }
-        EXPECT_EQ(count, num_val + 1);
-    }
-
-    {
-        // Now with -c option tacked onto the end
-        strcat(command, clear_cmd);
-
-        int ret;
-        EXPECT_FALSE(IsFalse(ret = system(command), command));
-        if (ret) {
-            snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-            EXPECT_FALSE(system(command));
-            EXPECT_FALSE(IsFalse(system(command), command));
-            return;
-        }
-        std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(tmp_out_dir),
-                                                      closedir);
-        EXPECT_NE(nullptr, dir);
-        if (!dir) {
-            snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-            EXPECT_FALSE(IsFalse(system(command), command));
-            return;
-        }
-        struct dirent* entry;
-        unsigned count = 0;
-        while ((entry = readdir(dir.get()))) {
-            if (strncmp(entry->d_name, log_filename, sizeof(log_filename) - 1)) {
-                continue;
-            }
-            fprintf(stderr, "Found %s/%s!!!\n", tmp_out_dir, entry->d_name);
-            ++count;
-        }
-        EXPECT_EQ(count, 0U);
-    }
-
-    snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-    EXPECT_FALSE(IsFalse(system(command), command));
-}
-
-static int logrotate_count_id(const char* logcat_cmd, const char* tmp_out_dir) {
-    static const char log_filename[] = "log.txt";
-    char command[strlen(tmp_out_dir) + strlen(logcat_cmd) +
-                 strlen(log_filename) + 32];
-
-    snprintf(command, sizeof(command), logcat_cmd, tmp_out_dir, log_filename);
-
-    int ret = system(command);
-    if (ret) {
-        fprintf(stderr, "system(\"%s\")=%d", command, ret);
-        return -1;
-    }
-    std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(tmp_out_dir),
-                                                  closedir);
-    if (!dir) {
-        fprintf(stderr, "opendir(\"%s\") failed", tmp_out_dir);
-        return -1;
-    }
-    struct dirent* entry;
-    int count = 0;
-    while ((entry = readdir(dir.get()))) {
-        if (strncmp(entry->d_name, log_filename, sizeof(log_filename) - 1)) {
-            continue;
-        }
-        ++count;
-    }
-    return count;
-}
-
-TEST(logcat, logrotate_id) {
-    static const char logcat_cmd[] =
-        logcat_executable " -b all -d -f %s/%s -n 32 -r 1 --id=test";
-    static const char logcat_short_cmd[] =
-        logcat_executable " -b all -t 10 -f %s/%s -n 32 -r 1 --id=test";
-    static const char tmp_out_dir_form[] =
-        "/data/local/tmp/logcat.logrotate.XXXXXX";
-    static const char log_filename[] = "log.txt";
-    char tmp_out_dir[strlen(tmp_out_dir_form) + 1];
-    ASSERT_TRUE(NULL != mkdtemp(strcpy(tmp_out_dir, tmp_out_dir_form)));
-
-    EXPECT_EQ(logrotate_count_id(logcat_cmd, tmp_out_dir), 34);
-    EXPECT_EQ(logrotate_count_id(logcat_short_cmd, tmp_out_dir), 34);
-
-    char id_file[strlen(tmp_out_dir_form) + strlen(log_filename) + 5];
-    snprintf(id_file, sizeof(id_file), "%s/%s.id", tmp_out_dir, log_filename);
-    if (getuid() != 0) {
-        chmod(id_file, 0);
-        EXPECT_EQ(logrotate_count_id(logcat_short_cmd, tmp_out_dir), 34);
-    }
-    unlink(id_file);
-    EXPECT_EQ(logrotate_count_id(logcat_short_cmd, tmp_out_dir), 34);
-
-    FILE* fp = fopen(id_file, "w");
-    if (fp) {
-        fprintf(fp, "not_a_test");
-        fclose(fp);
-    }
-    if (getuid() != 0) {
-        chmod(id_file,
-              0);  // API to preserve content even with signature change
-        ASSERT_EQ(34, logrotate_count_id(logcat_short_cmd, tmp_out_dir));
-        chmod(id_file, 0600);
-    }
-
-    int new_signature;
-    EXPECT_GE(
-        (new_signature = logrotate_count_id(logcat_short_cmd, tmp_out_dir)), 2);
-    EXPECT_LT(new_signature, 34);
-
-    static const char cleanup_cmd[] = "rm -rf %s";
-    char command[strlen(cleanup_cmd) + strlen(tmp_out_dir_form)];
-    snprintf(command, sizeof(command), cleanup_cmd, tmp_out_dir);
-    EXPECT_FALSE(IsFalse(system(command), command));
-}
-
-TEST(logcat, logrotate_nodir) {
-    // expect logcat to error out on writing content and not exit(0) for nodir
-    static const char command[] = logcat_executable
-        " -b all -d"
-        " -f /das/nein/gerfingerpoken/logcat/log.txt"
-        " -n 256 -r 1024";
-    EXPECT_FALSE(IsFalse(0 == system(command), command));
-}
-
-#ifndef logcat
-static void caught_blocking_clear(int signum) {
-    unsigned long long v = 0xDEADBEEFA55C0000ULL;
-
-    v += getpid() & 0xFFFF;
-    if (signum == 0) ++v;
-
-    LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));
-}
-
-TEST(logcat, blocking_clear) {
-    FILE* fp;
-    unsigned long long v = 0xDEADBEEFA55C0000ULL;
-
-    pid_t pid = getpid();
-
-    v += pid & 0xFFFF;
-
-    // This test is racey; an event occurs between clear and dump.
-    // We accept that we will get a false positive, but never a false negative.
-    ASSERT_TRUE(
-        NULL !=
-        (fp = popen("( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&"
-                    " logcat -b events -c 2>&1 ;"
-                    " logcat -b events -g 2>&1 ;"
-                    " logcat -v brief -b events 2>&1",
-                    "r")));
-
-    char buffer[BIG_BUFFER];
-
-    int count = 0;
-    int minus_g = 0;
-
-    int signals = 0;
-
-    signal(SIGALRM, caught_blocking_clear);
-    alarm(2);
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(buffer, "clearLog: ", strlen("clearLog: "))) {
-            fprintf(stderr, "WARNING: Test lacks permission to run :-(\n");
-            count = signals = 1;
-            break;
-        }
-        if (!strncmp(buffer, "failed to clear", strlen("failed to clear"))) {
-            fprintf(stderr, "WARNING: Test lacks permission to run :-(\n");
-            count = signals = 1;
-            break;
-        }
-
-        if (!strncmp(buffer, "DONE", 4)) {
-            break;
-        }
-
-        int size, consumed, max, payload;
-        char size_mult[4], consumed_mult[4];
-        size = consumed = max = payload = 0;
-        if (6 == sscanf(buffer,
-                        "events: ring buffer is %d %3s (%d %3s consumed),"
-                        " max entry is %d B, max payload is %d B",
-                        &size, size_mult, &consumed, consumed_mult, &max, &payload)) {
-            long full_size = size, full_consumed = consumed;
-
-            switch (size_mult[0]) {
-                case 'G':
-                    full_size *= 1024;
-                    FALLTHROUGH_INTENDED;
-                case 'M':
-                    full_size *= 1024;
-                    FALLTHROUGH_INTENDED;
-                case 'K':
-                    full_size *= 1024;
-                    FALLTHROUGH_INTENDED;
-                case 'B':
-                    break;
-            }
-            switch (consumed_mult[0]) {
-                case 'G':
-                    full_consumed *= 1024;
-                    FALLTHROUGH_INTENDED;
-                case 'M':
-                    full_consumed *= 1024;
-                    FALLTHROUGH_INTENDED;
-                case 'K':
-                    full_consumed *= 1024;
-                    FALLTHROUGH_INTENDED;
-                case 'B':
-                    break;
-            }
-            EXPECT_GT(full_size, full_consumed);
-            EXPECT_GT(full_size, max);
-            EXPECT_GT(max, payload);
-            EXPECT_GT(max, full_consumed);
-
-            ++minus_g;
-            continue;
-        }
-
-        ++count;
-
-        int p;
-        unsigned long long l;
-
-        if ((2 != sscanf(buffer, "I/[0] ( %u): %lld", &p, &l)) || (p != pid)) {
-            continue;
-        }
-
-        if (l == v) {
-            if (count > 1) {
-                fprintf(stderr, "WARNING: Possible false positive\n");
-            }
-            ++signals;
-            break;
-        }
-    }
-    alarm(0);
-    signal(SIGALRM, SIG_DFL);
-
-    // Generate SIGPIPE
-    fclose(fp);
-    caught_blocking_clear(0);
-
-    pclose(fp);
-
-    EXPECT_GE(count, 1);
-    EXPECT_EQ(minus_g, 1);
-
-    EXPECT_EQ(signals, 1);
-}
-#endif
-
-static bool get_white_black(char** list) {
-    FILE* fp = popen(logcat_executable " -p 2>/dev/null", "r");
-    if (fp == NULL) {
-        fprintf(stderr, "ERROR: logcat -p 2>/dev/null\n");
-        return false;
-    }
-
-    char buffer[BIG_BUFFER];
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        char* hold = *list;
-        char* buf = buffer;
-        while (isspace(*buf)) {
-            ++buf;
-        }
-        char* end = buf + strlen(buf);
-        while (isspace(*--end) && (end >= buf)) {
-            *end = '\0';
-        }
-        if (end < buf) {
-            continue;
-        }
-        if (hold) {
-            asprintf(list, "%s %s", hold, buf);
-            free(hold);
-        } else {
-            asprintf(list, "%s", buf);
-        }
-    }
-    pclose(fp);
-    return *list != NULL;
-}
-
-static bool set_white_black(const char* list) {
-    char buffer[BIG_BUFFER];
-    snprintf(buffer, sizeof(buffer), logcat_executable " -P '%s' 2>&1",
-             list ? list : "");
-    FILE* fp = popen(buffer, "r");
-    if (fp == NULL) {
-        fprintf(stderr, "ERROR: %s\n", buffer);
-        return false;
-    }
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        char* buf = buffer;
-        while (isspace(*buf)) {
-            ++buf;
-        }
-        char* end = buf + strlen(buf);
-        while ((end > buf) && isspace(*--end)) {
-            *end = '\0';
-        }
-        if (end <= buf) {
-            continue;
-        }
-        fprintf(stderr, "%s\n", buf);
-        pclose(fp);
-        return false;
-    }
-    return pclose(fp) == 0;
-}
-
-TEST(logcat, white_black_adjust) {
-    char* list = NULL;
-    char* adjust = NULL;
-
-    get_white_black(&list);
-
-    static const char adjustment[] = "~! 300/20 300/25 2000 ~1000/5 ~1000/30";
-    ASSERT_EQ(true, set_white_black(adjustment));
-    ASSERT_EQ(true, get_white_black(&adjust));
-    EXPECT_STREQ(adjustment, adjust);
-    free(adjust);
-    adjust = NULL;
-
-    static const char adjustment2[] = "300/20 300/21 2000 ~1000";
-    ASSERT_EQ(true, set_white_black(adjustment2));
-    ASSERT_EQ(true, get_white_black(&adjust));
-    EXPECT_STREQ(adjustment2, adjust);
-    free(adjust);
-    adjust = NULL;
-
-    ASSERT_EQ(true, set_white_black(list));
-    get_white_black(&adjust);
-    EXPECT_STREQ(list ? list : "", adjust ? adjust : "");
-    free(adjust);
-    adjust = NULL;
-
-    free(list);
-    list = NULL;
-}
-
-TEST(logcat, regex) {
-    FILE* fp;
-    int count = 0;
-
-    char buffer[BIG_BUFFER];
-#define logcat_regex_prefix logcat_executable "_test"
-
-    snprintf(buffer, sizeof(buffer),
-             logcat_executable " --pid %d -d -e " logcat_regex_prefix "_a+b",
-             getpid());
-
-    LOG_FAILURE_RETRY(__android_log_print(ANDROID_LOG_WARN, logcat_regex_prefix,
-                                          logcat_regex_prefix "_ab"));
-    LOG_FAILURE_RETRY(__android_log_print(ANDROID_LOG_WARN, logcat_regex_prefix,
-                                          logcat_regex_prefix "_b"));
-    LOG_FAILURE_RETRY(__android_log_print(ANDROID_LOG_WARN, logcat_regex_prefix,
-                                          logcat_regex_prefix "_aaaab"));
-    LOG_FAILURE_RETRY(__android_log_print(ANDROID_LOG_WARN, logcat_regex_prefix,
-                                          logcat_regex_prefix "_aaaa"));
-    // Let the logs settle
-    rest();
-
-    ASSERT_TRUE(NULL != (fp = popen(buffer, "r")));
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(begin, buffer, sizeof(begin) - 1)) {
-            continue;
-        }
-
-        EXPECT_TRUE(strstr(buffer, logcat_regex_prefix "_") != NULL);
-
-        count++;
-    }
-
-    pclose(fp);
-
-    ASSERT_EQ(2, count);
-}
-
-TEST(logcat, maxcount) {
-    FILE* fp;
-    int count = 0;
-
-    char buffer[BIG_BUFFER];
-
-    snprintf(buffer, sizeof(buffer),
-             logcat_executable " --pid %d -d --max-count 3", getpid());
-
-    LOG_FAILURE_RETRY(
-        __android_log_print(ANDROID_LOG_WARN, "logcat_test", "logcat_test"));
-    LOG_FAILURE_RETRY(
-        __android_log_print(ANDROID_LOG_WARN, "logcat_test", "logcat_test"));
-    LOG_FAILURE_RETRY(
-        __android_log_print(ANDROID_LOG_WARN, "logcat_test", "logcat_test"));
-    LOG_FAILURE_RETRY(
-        __android_log_print(ANDROID_LOG_WARN, "logcat_test", "logcat_test"));
-
-    rest();
-
-    ASSERT_TRUE(NULL != (fp = popen(buffer, "r")));
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        if (!strncmp(begin, buffer, sizeof(begin) - 1)) {
-            continue;
-        }
-
-        count++;
-    }
-
-    pclose(fp);
-
-    ASSERT_EQ(3, count);
-}
-
-static bool End_to_End(const char* tag, const char* fmt, ...)
-#if defined(__GNUC__)
-    __attribute__((__format__(printf, 2, 3)))
-#endif
-    ;
-
-static bool End_to_End(const char* tag, const char* fmt, ...) {
-    FILE* fp = popen(logcat_executable " -v brief -b events -v descriptive -t 100 2>/dev/null", "r");
-    if (!fp) {
-        fprintf(stderr, "End_to_End: popen failed");
-        return false;
-    }
-
-    char buffer[BIG_BUFFER];
-    va_list ap;
-
-    va_start(ap, fmt);
-    vsnprintf(buffer, sizeof(buffer), fmt, ap);
-    va_end(ap);
-
-    char* str = NULL;
-    asprintf(&str, "I/%s ( %%d):%%c%s%%c", tag, buffer);
-    std::string expect(str);
-    free(str);
-
-    int count = 0;
-    pid_t pid = getpid();
-    std::string lastMatch;
-    int maxMatch = 1;
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        char space;
-        char newline;
-        int p;
-        int ret = sscanf(buffer, expect.c_str(), &p, &space, &newline);
-        if ((ret == 3) && (p == pid) && (space == ' ') && (newline == '\n')) {
-            ++count;
-        } else if ((ret >= maxMatch) && (p == pid) && (count == 0)) {
-            lastMatch = buffer;
-            maxMatch = ret;
-        }
-    }
-
-    pclose(fp);
-
-    if ((count == 0) && (lastMatch.length() > 0)) {
-        // Help us pinpoint where things went wrong ...
-        fprintf(stderr, "Closest match for\n    %s\n  is\n    %s",
-                expect.c_str(), lastMatch.c_str());
-    } else if (count > 3) {
-        fprintf(stderr, "Too many matches (%d) for %s\n", count, expect.c_str());
-    }
-
-    // Three different known tests, we can see pollution from the others
-    return count && (count <= 3);
-}
-
-TEST(logcat, descriptive) {
-    struct tag {
-        uint32_t tagNo;
-        const char* tagStr;
-    };
-    int ret;
-
-    {
-        static const struct tag hhgtg = { 42, "answer" };
-        android_log_event_list ctx(hhgtg.tagNo);
-        static const char theAnswer[] = "what is five by seven";
-        ctx << theAnswer;
-        // crafted to rest at least once after, and rest between retries.
-        for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-        EXPECT_GE(ret, 0);
-        EXPECT_TRUE(
-            End_to_End(hhgtg.tagStr, "to life the universe etc=%s", theAnswer));
-    }
-
-    {
-        static const struct tag sync = { 2720, "sync" };
-        static const char id[] = logcat_executable ".descriptive-sync";
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << id << (int32_t)42 << (int32_t)-1 << (int32_t)0;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr,
-                                   "[id=%s,event=42,source=-1,account=0]", id));
-        }
-
-        // Partial match to description
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << id << (int32_t)43 << (int64_t)-1 << (int32_t)0;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "[id=%s,event=43,-1,0]", id));
-        }
-
-        // Negative Test of End_to_End, ensure it is working
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << id << (int32_t)44 << (int32_t)-1 << (int64_t)0;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            fprintf(stderr, "Expect a \"Closest match\" message\n");
-            EXPECT_FALSE(End_to_End(
-                sync.tagStr, "[id=%s,event=44,source=-1,account=0]", id));
-        }
-    }
-
-    {
-        static const struct tag sync = { 2747, "contacts_aggregation" };
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint64_t)30 << (int32_t)2;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(
-                End_to_End(sync.tagStr, "[aggregation time=30ms,count=2]"));
-        }
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint64_t)31570 << (int32_t)911;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(
-                End_to_End(sync.tagStr, "[aggregation time=31.57s,count=911]"));
-        }
-    }
-
-    {
-        static const struct tag sync = { 75000, "sqlite_mem_alarm_current" };
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)512;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "current=512B"));
-        }
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)3072;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "current=3KB"));
-        }
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)2097152;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "current=2MB"));
-        }
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)2097153;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "current=2097153B"));
-        }
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)1073741824;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "current=1GB"));
-        }
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)3221225472;  // 3MB, but on purpose overflowed
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "current=-1GB"));
-        }
-    }
-
-    {
-        static const struct tag sync = { 27501, "notification_panel_hidden" };
-        android_log_event_list ctx(sync.tagNo);
-        for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-        EXPECT_GE(ret, 0);
-        EXPECT_TRUE(End_to_End(sync.tagStr, ""));
-    }
-
-    {
-        // Invent new entries because existing can not serve
-        EventTagMap* map = android_openEventTagMap(nullptr);
-        ASSERT_TRUE(nullptr != map);
-        static const char name[] = logcat_executable ".descriptive-monotonic";
-        int myTag = android_lookupEventTagNum(map, name, "(new|1|s)",
-                                              ANDROID_LOG_UNKNOWN);
-        android_closeEventTagMap(map);
-        ASSERT_NE(-1, myTag);
-
-        const struct tag sync = { (uint32_t)myTag, name };
-
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)7;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "new=7s"));
-        }
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)62;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "new=1:02"));
-        }
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)3673;
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "new=1:01:13"));
-        }
-        {
-            android_log_event_list ctx(sync.tagNo);
-            ctx << (uint32_t)(86400 + 7200 + 180 + 58);
-            for (ret = -EBUSY; ret == -EBUSY; rest()) ret = ctx.write();
-            EXPECT_GE(ret, 0);
-            EXPECT_TRUE(End_to_End(sync.tagStr, "new=1d 2:03:58"));
-        }
-    }
-}
-
-static bool reportedSecurity(const char* command) {
-    FILE* fp = popen(command, "r");
-    if (!fp) return true;
-
-    std::string ret;
-    bool val = android::base::ReadFdToString(fileno(fp), &ret);
-    pclose(fp);
-
-    if (!val) return true;
-    return std::string::npos != ret.find("'security'");
-}
-
-TEST(logcat, security) {
-    EXPECT_FALSE(reportedSecurity(logcat_executable " -b all -g 2>&1"));
-    EXPECT_TRUE(reportedSecurity(logcat_executable " -b security -g 2>&1"));
-    EXPECT_TRUE(reportedSecurity(logcat_executable " -b security -c 2>&1"));
-    EXPECT_TRUE(
-        reportedSecurity(logcat_executable " -b security -G 256K 2>&1"));
-}
-
-static size_t commandOutputSize(const char* command) {
-    FILE* fp = popen(command, "r");
-    if (!fp) return 0;
-
-    std::string ret;
-    if (!android::base::ReadFdToString(fileno(fp), &ret)) return 0;
-    if (pclose(fp) != 0) return 0;
-
-    return ret.size();
-}
-
-TEST(logcat, help) {
-    size_t logcatHelpTextSize = commandOutputSize(logcat_executable " -h 2>&1");
-    EXPECT_GT(logcatHelpTextSize, 4096UL);
-    size_t logcatLastHelpTextSize =
-        commandOutputSize(logcat_executable " -L -h 2>&1");
-#ifdef USING_LOGCAT_EXECUTABLE_DEFAULT  // logcat and liblogcat
-    EXPECT_EQ(logcatHelpTextSize, logcatLastHelpTextSize);
-#else
-    // logcatd -L -h prints the help twice, as designed.
-    EXPECT_EQ(logcatHelpTextSize * 2, logcatLastHelpTextSize);
-#endif
-}
-
-TEST(logcat, invalid_buffer) {
-  FILE* fp = popen("logcat -b foo 2>&1", "r");
-  ASSERT_NE(nullptr, fp);
-  std::string output;
-  ASSERT_TRUE(android::base::ReadFdToString(fileno(fp), &output));
-  pclose(fp);
-
-  ASSERT_TRUE(android::base::StartsWith(output, "unknown buffer foo\n"));
-}
diff --git a/logcat/tests/logcatd_test.cpp b/logcat/tests/logcatd_test.cpp
deleted file mode 100644
index bb7534e..0000000
--- a/logcat/tests/logcatd_test.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#define logcat logcatd
-#define logcat_executable "logcatd"
-
-#include "logcat_test.cpp"
diff --git a/logd/.clang-format b/logd/.clang-format
deleted file mode 120000
index 1af4f51..0000000
--- a/logd/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-../.clang-format-4
\ No newline at end of file
diff --git a/logd/Android.bp b/logd/Android.bp
deleted file mode 100644
index b337b7c..0000000
--- a/logd/Android.bp
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (C) 2017 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.
-
-// This is what we want to do:
-//  event_logtags = $(shell
-//    sed -n
-//        "s/^\([0-9]*\)[ \t]*$1[ \t].*/-D`echo $1 | tr a-z A-Z`_LOG_TAG=\1/p"
-//        $(LOCAL_PATH)/$2/event.logtags)
-//  event_flag := $(call event_logtags,auditd)
-//  event_flag += $(call event_logtags,logd)
-//  event_flag += $(call event_logtags,tag_def)
-// so make sure we do not regret hard-coding it as follows:
-event_flag = [
-    "-DAUDITD_LOG_TAG=1003",
-    "-DCHATTY_LOG_TAG=1004",
-    "-DTAG_DEF_LOG_TAG=1005",
-    "-DLIBLOG_LOG_TAG=1006",
-]
-
-cc_library_static {
-    name: "liblogd",
-
-    srcs: [
-        "LogCommand.cpp",
-        "CommandListener.cpp",
-        "LogListener.cpp",
-        "LogReader.cpp",
-        "FlushCommand.cpp",
-        "LogBuffer.cpp",
-        "LogBufferElement.cpp",
-        "LogTimes.cpp",
-        "LogStatistics.cpp",
-        "LogWhiteBlackList.cpp",
-        "libaudit.c",
-        "LogAudit.cpp",
-        "LogKlog.cpp",
-        "LogTags.cpp",
-    ],
-    logtags: ["event.logtags"],
-
-    shared_libs: ["libbase"],
-
-    export_include_dirs: ["."],
-
-    cflags: ["-Werror"] + event_flag,
-}
-
-cc_binary {
-    name: "logd",
-    init_rc: ["logd.rc"],
-
-    srcs: ["main.cpp"],
-
-    static_libs: [
-        "liblog",
-        "liblogd",
-    ],
-
-    shared_libs: [
-        "libsysutils",
-        "libcutils",
-        "libbase",
-        "libpackagelistparser",
-        "libprocessgroup",
-        "libcap",
-    ],
-
-    cflags: ["-Werror"],
-}
-
-cc_binary {
-    name: "auditctl",
-
-    srcs: ["auditctl.cpp"],
-
-    static_libs: [
-        "liblogd",
-    ],
-
-    shared_libs: ["libbase"],
-
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-Wconversion"
-    ],
-}
-
-prebuilt_etc {
-    name: "logtagd.rc",
-    src: "logtagd.rc",
-    sub_dir: "init",
-}
diff --git a/logd/CommandListener.cpp b/logd/CommandListener.cpp
deleted file mode 100644
index 694b5fa..0000000
--- a/logd/CommandListener.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#include <arpa/inet.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <math.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/prctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include <string>
-
-#include <android-base/stringprintf.h>
-#include <cutils/sockets.h>
-#include <private/android_filesystem_config.h>
-#include <sysutils/SocketClient.h>
-
-#include "CommandListener.h"
-#include "LogCommand.h"
-#include "LogUtils.h"
-
-CommandListener::CommandListener(LogBuffer* buf, LogReader* /*reader*/,
-                                 LogListener* /*swl*/)
-    : FrameworkListener(getLogSocket()) {
-    // registerCmd(new ShutdownCmd(buf, writer, swl));
-    registerCmd(new ClearCmd(buf));
-    registerCmd(new GetBufSizeCmd(buf));
-    registerCmd(new SetBufSizeCmd(buf));
-    registerCmd(new GetBufSizeUsedCmd(buf));
-    registerCmd(new GetStatisticsCmd(buf));
-    registerCmd(new SetPruneListCmd(buf));
-    registerCmd(new GetPruneListCmd(buf));
-    registerCmd(new GetEventTagCmd(buf));
-    registerCmd(new ReinitCmd());
-    registerCmd(new ExitCmd(this));
-}
-
-CommandListener::ShutdownCmd::ShutdownCmd(LogReader* reader, LogListener* swl)
-    : LogCommand("shutdown"), mReader(*reader), mSwl(*swl) {
-}
-
-int CommandListener::ShutdownCmd::runCommand(SocketClient* /*cli*/,
-                                             int /*argc*/, char** /*argv*/) {
-    mSwl.stopListener();
-    mReader.stopListener();
-    exit(0);
-}
-
-CommandListener::ClearCmd::ClearCmd(LogBuffer* buf)
-    : LogCommand("clear"), mBuf(*buf) {
-}
-
-static void setname() {
-    static bool name_set;
-    if (!name_set) {
-        prctl(PR_SET_NAME, "logd.control");
-        name_set = true;
-    }
-}
-
-int CommandListener::ClearCmd::runCommand(SocketClient* cli, int argc,
-                                          char** argv) {
-    setname();
-    uid_t uid = cli->getUid();
-    if (clientHasLogCredentials(cli)) {
-        uid = AID_ROOT;
-    }
-
-    if (argc < 2) {
-        cli->sendMsg("Missing Argument");
-        return 0;
-    }
-
-    int id = atoi(argv[1]);
-    if ((id < LOG_ID_MIN) || (LOG_ID_MAX <= id)) {
-        cli->sendMsg("Range Error");
-        return 0;
-    }
-
-    cli->sendMsg(mBuf.clear((log_id_t)id, uid) ? "busy" : "success");
-    return 0;
-}
-
-CommandListener::GetBufSizeCmd::GetBufSizeCmd(LogBuffer* buf)
-    : LogCommand("getLogSize"), mBuf(*buf) {
-}
-
-int CommandListener::GetBufSizeCmd::runCommand(SocketClient* cli, int argc,
-                                               char** argv) {
-    setname();
-    if (argc < 2) {
-        cli->sendMsg("Missing Argument");
-        return 0;
-    }
-
-    int id = atoi(argv[1]);
-    if ((id < LOG_ID_MIN) || (LOG_ID_MAX <= id)) {
-        cli->sendMsg("Range Error");
-        return 0;
-    }
-
-    unsigned long size = mBuf.getSize((log_id_t)id);
-    char buf[512];
-    snprintf(buf, sizeof(buf), "%lu", size);
-    cli->sendMsg(buf);
-    return 0;
-}
-
-CommandListener::SetBufSizeCmd::SetBufSizeCmd(LogBuffer* buf)
-    : LogCommand("setLogSize"), mBuf(*buf) {
-}
-
-int CommandListener::SetBufSizeCmd::runCommand(SocketClient* cli, int argc,
-                                               char** argv) {
-    setname();
-    if (!clientHasLogCredentials(cli)) {
-        cli->sendMsg("Permission Denied");
-        return 0;
-    }
-
-    if (argc < 3) {
-        cli->sendMsg("Missing Argument");
-        return 0;
-    }
-
-    int id = atoi(argv[1]);
-    if ((id < LOG_ID_MIN) || (LOG_ID_MAX <= id)) {
-        cli->sendMsg("Range Error");
-        return 0;
-    }
-
-    unsigned long size = atol(argv[2]);
-    if (mBuf.setSize((log_id_t)id, size)) {
-        cli->sendMsg("Range Error");
-        return 0;
-    }
-
-    cli->sendMsg("success");
-    return 0;
-}
-
-CommandListener::GetBufSizeUsedCmd::GetBufSizeUsedCmd(LogBuffer* buf)
-    : LogCommand("getLogSizeUsed"), mBuf(*buf) {
-}
-
-int CommandListener::GetBufSizeUsedCmd::runCommand(SocketClient* cli, int argc,
-                                                   char** argv) {
-    setname();
-    if (argc < 2) {
-        cli->sendMsg("Missing Argument");
-        return 0;
-    }
-
-    int id = atoi(argv[1]);
-    if ((id < LOG_ID_MIN) || (LOG_ID_MAX <= id)) {
-        cli->sendMsg("Range Error");
-        return 0;
-    }
-
-    unsigned long size = mBuf.getSizeUsed((log_id_t)id);
-    char buf[512];
-    snprintf(buf, sizeof(buf), "%lu", size);
-    cli->sendMsg(buf);
-    return 0;
-}
-
-CommandListener::GetStatisticsCmd::GetStatisticsCmd(LogBuffer* buf)
-    : LogCommand("getStatistics"), mBuf(*buf) {
-}
-
-// This returns a string with a length prefix with the format <length>\n<data>\n\f.  The length
-// prefix includes the length of the prefix itself.
-static std::string PackageString(const std::string& str) {
-    size_t overhead_length = 3;  // \n \n \f.
-
-    // Number of digits needed to represent length(str + overhead_length).
-    size_t str_size_digits = 1 + static_cast<size_t>(log10(str.size() + overhead_length));
-    // Number of digits needed to represent the total size.
-    size_t total_size_digits =
-            1 + static_cast<size_t>(log10(str.size() + overhead_length + str_size_digits));
-
-    // If adding the size prefix causes a new digit to be required to represent the new total
-    // size, add it to the 'overhead_length'.  This can only happen once, since each new digit
-    // allows for 10x the previous size to be recorded.
-    if (total_size_digits != str_size_digits) {
-        overhead_length++;
-    }
-
-    size_t total_size = str.size() + overhead_length + str_size_digits;
-    return android::base::StringPrintf("%zu\n%s\n\f", total_size, str.c_str());
-}
-
-int CommandListener::GetStatisticsCmd::runCommand(SocketClient* cli, int argc,
-                                                  char** argv) {
-    setname();
-    uid_t uid = cli->getUid();
-    if (clientHasLogCredentials(cli)) {
-        uid = AID_ROOT;
-    }
-
-    unsigned int logMask = -1;
-    pid_t pid = 0;
-    if (argc > 1) {
-        logMask = 0;
-        for (int i = 1; i < argc; ++i) {
-            static const char _pid[] = "pid=";
-            if (!strncmp(argv[i], _pid, sizeof(_pid) - 1)) {
-                pid = atol(argv[i] + sizeof(_pid) - 1);
-                if (pid == 0) {
-                    cli->sendMsg("PID Error");
-                    return 0;
-                }
-                continue;
-            }
-
-            int id = atoi(argv[i]);
-            if ((id < LOG_ID_MIN) || (LOG_ID_MAX <= id)) {
-                cli->sendMsg("Range Error");
-                return 0;
-            }
-            logMask |= 1 << id;
-        }
-    }
-
-    cli->sendMsg(PackageString(mBuf.formatStatistics(uid, pid, logMask)).c_str());
-    return 0;
-}
-
-CommandListener::GetPruneListCmd::GetPruneListCmd(LogBuffer* buf)
-    : LogCommand("getPruneList"), mBuf(*buf) {
-}
-
-int CommandListener::GetPruneListCmd::runCommand(SocketClient* cli,
-                                                 int /*argc*/, char** /*argv*/) {
-    setname();
-    cli->sendMsg(PackageString(mBuf.formatPrune()).c_str());
-    return 0;
-}
-
-CommandListener::SetPruneListCmd::SetPruneListCmd(LogBuffer* buf)
-    : LogCommand("setPruneList"), mBuf(*buf) {
-}
-
-int CommandListener::SetPruneListCmd::runCommand(SocketClient* cli, int argc,
-                                                 char** argv) {
-    setname();
-    if (!clientHasLogCredentials(cli)) {
-        cli->sendMsg("Permission Denied");
-        return 0;
-    }
-
-    std::string str;
-    for (int i = 1; i < argc; ++i) {
-        if (str.length()) {
-            str += " ";
-        }
-        str += argv[i];
-    }
-
-    int ret = mBuf.initPrune(str.c_str());
-
-    if (ret) {
-        cli->sendMsg("Invalid");
-        return 0;
-    }
-
-    cli->sendMsg("success");
-
-    return 0;
-}
-
-CommandListener::GetEventTagCmd::GetEventTagCmd(LogBuffer* buf)
-    : LogCommand("getEventTag"), mBuf(*buf) {
-}
-
-int CommandListener::GetEventTagCmd::runCommand(SocketClient* cli, int argc,
-                                                char** argv) {
-    setname();
-    uid_t uid = cli->getUid();
-    if (clientHasLogCredentials(cli)) {
-        uid = AID_ROOT;
-    }
-
-    const char* name = nullptr;
-    const char* format = nullptr;
-    const char* id = nullptr;
-    for (int i = 1; i < argc; ++i) {
-        static const char _name[] = "name=";
-        if (!strncmp(argv[i], _name, strlen(_name))) {
-            name = argv[i] + strlen(_name);
-            continue;
-        }
-
-        static const char _format[] = "format=";
-        if (!strncmp(argv[i], _format, strlen(_format))) {
-            format = argv[i] + strlen(_format);
-            continue;
-        }
-
-        static const char _id[] = "id=";
-        if (!strncmp(argv[i], _id, strlen(_id))) {
-            id = argv[i] + strlen(_id);
-            continue;
-        }
-    }
-
-    if (id) {
-        if (format || name) {
-            cli->sendMsg("can not mix id= with either format= or name=");
-            return 0;
-        }
-        cli->sendMsg(PackageString(mBuf.formatEntry(atoi(id), uid)).c_str());
-        return 0;
-    }
-
-    cli->sendMsg(PackageString(mBuf.formatGetEventTag(uid, name, format)).c_str());
-
-    return 0;
-}
-
-CommandListener::ReinitCmd::ReinitCmd() : LogCommand("reinit") {
-}
-
-int CommandListener::ReinitCmd::runCommand(SocketClient* cli, int /*argc*/,
-                                           char** /*argv*/) {
-    setname();
-
-    reinit_signal_handler(SIGHUP);
-
-    cli->sendMsg("success");
-
-    return 0;
-}
-
-CommandListener::ExitCmd::ExitCmd(CommandListener* parent)
-    : LogCommand("EXIT"), mParent(*parent) {
-}
-
-int CommandListener::ExitCmd::runCommand(SocketClient* cli, int /*argc*/,
-                                         char** /*argv*/) {
-    setname();
-
-    cli->sendMsg("success");
-    release(cli);
-
-    return 0;
-}
-
-int CommandListener::getLogSocket() {
-    static const char socketName[] = "logd";
-    int sock = android_get_control_socket(socketName);
-
-    if (sock < 0) {
-        sock = socket_local_server(
-            socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM);
-    }
-
-    return sock;
-}
diff --git a/logd/CommandListener.h b/logd/CommandListener.h
deleted file mode 100644
index ed99419..0000000
--- a/logd/CommandListener.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#ifndef _COMMANDLISTENER_H__
-#define _COMMANDLISTENER_H__
-
-#include <sysutils/FrameworkListener.h>
-#include "LogBuffer.h"
-#include "LogCommand.h"
-#include "LogListener.h"
-#include "LogReader.h"
-
-// See main.cpp for implementation
-void reinit_signal_handler(int /*signal*/);
-
-class CommandListener : public FrameworkListener {
-   public:
-    CommandListener(LogBuffer* buf, LogReader* reader, LogListener* swl);
-    virtual ~CommandListener() {
-    }
-
-   private:
-    static int getLogSocket();
-
-    class ShutdownCmd : public LogCommand {
-        LogReader& mReader;
-        LogListener& mSwl;
-
-       public:
-        ShutdownCmd(LogReader* reader, LogListener* swl);
-        virtual ~ShutdownCmd() {
-        }
-        int runCommand(SocketClient* c, int argc, char** argv);
-    };
-
-#define LogBufferCmd(name)                                      \
-    class name##Cmd : public LogCommand {                       \
-        LogBuffer& mBuf;                                        \
-                                                                \
-       public:                                                  \
-        explicit name##Cmd(LogBuffer* buf);                     \
-        virtual ~name##Cmd() {                                  \
-        }                                                       \
-        int runCommand(SocketClient* c, int argc, char** argv); \
-    }
-
-    LogBufferCmd(Clear);
-    LogBufferCmd(GetBufSize);
-    LogBufferCmd(SetBufSize);
-    LogBufferCmd(GetBufSizeUsed);
-    LogBufferCmd(GetStatistics);
-    LogBufferCmd(GetPruneList);
-    LogBufferCmd(SetPruneList);
-    LogBufferCmd(GetEventTag);
-
-#define LogCmd(name)                                            \
-    class name##Cmd : public LogCommand {                       \
-       public:                                                  \
-        name##Cmd();                                            \
-        virtual ~name##Cmd() {                                  \
-        }                                                       \
-        int runCommand(SocketClient* c, int argc, char** argv); \
-    }
-
-    LogCmd(Reinit);
-
-#define LogParentCmd(name)                                      \
-    class name##Cmd : public LogCommand {                       \
-        CommandListener& mParent;                               \
-                                                                \
-       public:                                                  \
-        name##Cmd();                                            \
-        explicit name##Cmd(CommandListener* parent);            \
-        virtual ~name##Cmd() {                                  \
-        }                                                       \
-        int runCommand(SocketClient* c, int argc, char** argv); \
-        void release(SocketClient* c) {                         \
-            mParent.release(c);                                 \
-        }                                                       \
-    }
-
-    LogParentCmd(Exit);
-};
-
-#endif
diff --git a/logd/FlushCommand.cpp b/logd/FlushCommand.cpp
deleted file mode 100644
index bd17555..0000000
--- a/logd/FlushCommand.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#include <stdlib.h>
-
-#include <private/android_filesystem_config.h>
-
-#include "FlushCommand.h"
-#include "LogBuffer.h"
-#include "LogBufferElement.h"
-#include "LogCommand.h"
-#include "LogReader.h"
-#include "LogTimes.h"
-#include "LogUtils.h"
-
-// runSocketCommand is called once for every open client on the
-// log reader socket. Here we manage and associated the reader
-// client tracking and log region locks LastLogTimes list of
-// LogTimeEntrys, and spawn a transitory per-client thread to
-// work at filing data to the  socket.
-//
-// global LogTimeEntry::wrlock() is used to protect access,
-// reference counts are used to ensure that individual
-// LogTimeEntry lifetime is managed when not protected.
-void FlushCommand::runSocketCommand(SocketClient* client) {
-    LogTimeEntry* entry = nullptr;
-    LastLogTimes& times = mReader.logbuf().mTimes;
-
-    LogTimeEntry::wrlock();
-    LastLogTimes::iterator it = times.begin();
-    while (it != times.end()) {
-        entry = it->get();
-        if (entry->mClient == client) {
-            if (!entry->isWatchingMultiple(mLogMask)) {
-                LogTimeEntry::unlock();
-                return;
-            }
-            if (entry->mTimeout.tv_sec || entry->mTimeout.tv_nsec) {
-                if (mReader.logbuf().isMonotonic()) {
-                    LogTimeEntry::unlock();
-                    return;
-                }
-                // If the user changes the time in a gross manner that
-                // invalidates the timeout, fall through and trigger.
-                log_time now(CLOCK_REALTIME);
-                if (((entry->mEnd + entry->mTimeout) > now) &&
-                    (now > entry->mEnd)) {
-                    LogTimeEntry::unlock();
-                    return;
-                }
-            }
-            entry->triggerReader_Locked();
-            LogTimeEntry::unlock();
-            return;
-        }
-        it++;
-    }
-
-    LogTimeEntry::unlock();
-}
-
-bool FlushCommand::hasReadLogs(SocketClient* client) {
-    return clientHasLogCredentials(client);
-}
-
-static bool clientHasSecurityCredentials(SocketClient* client) {
-    return (client->getUid() == AID_SYSTEM) || (client->getGid() == AID_SYSTEM);
-}
-
-bool FlushCommand::hasSecurityLogs(SocketClient* client) {
-    return clientHasSecurityCredentials(client);
-}
diff --git a/logd/FlushCommand.h b/logd/FlushCommand.h
deleted file mode 100644
index ceaf393..0000000
--- a/logd/FlushCommand.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2012-2013 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.
- */
-#ifndef _FLUSH_COMMAND_H
-#define _FLUSH_COMMAND_H
-
-#include <private/android_logger.h>
-#include <sysutils/SocketClientCommand.h>
-
-class LogBufferElement;
-
-#include "LogTimes.h"
-
-class LogReader;
-
-class FlushCommand : public SocketClientCommand {
-    LogReader& mReader;
-    log_mask_t mLogMask;
-
-   public:
-    explicit FlushCommand(LogReader& reader, log_mask_t logMask)
-        : mReader(reader), mLogMask(logMask) {
-    }
-
-    virtual void runSocketCommand(SocketClient* client);
-
-    static bool hasReadLogs(SocketClient* client);
-    static bool hasSecurityLogs(SocketClient* client);
-};
-
-#endif
diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp
deleted file mode 100644
index d9cc0db..0000000
--- a/logd/LogAudit.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <ctype.h>
-#include <endian.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/prctl.h>
-#include <sys/uio.h>
-#include <syslog.h>
-
-#include <fstream>
-#include <sstream>
-
-#include <android-base/macros.h>
-#include <log/log_properties.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-
-#include "LogAudit.h"
-#include "LogBuffer.h"
-#include "LogKlog.h"
-#include "LogReader.h"
-#include "LogUtils.h"
-#include "libaudit.h"
-
-#define KMSG_PRIORITY(PRI)                               \
-    '<', '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) / 10, \
-        '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) % 10, '>'
-
-LogAudit::LogAudit(LogBuffer* buf, LogReader* reader, int fdDmesg)
-    : SocketListener(getLogSocket(), false),
-      logbuf(buf),
-      reader(reader),
-      fdDmesg(fdDmesg),
-      main(__android_logger_property_get_bool("ro.logd.auditd.main",
-                                              BOOL_DEFAULT_TRUE)),
-      events(__android_logger_property_get_bool("ro.logd.auditd.events",
-                                                BOOL_DEFAULT_TRUE)),
-      initialized(false) {
-    static const char auditd_message[] = { KMSG_PRIORITY(LOG_INFO),
-                                           'l',
-                                           'o',
-                                           'g',
-                                           'd',
-                                           '.',
-                                           'a',
-                                           'u',
-                                           'd',
-                                           'i',
-                                           't',
-                                           'd',
-                                           ':',
-                                           ' ',
-                                           's',
-                                           't',
-                                           'a',
-                                           'r',
-                                           't',
-                                           '\n' };
-    write(fdDmesg, auditd_message, sizeof(auditd_message));
-}
-
-bool LogAudit::onDataAvailable(SocketClient* cli) {
-    if (!initialized) {
-        prctl(PR_SET_NAME, "logd.auditd");
-        initialized = true;
-    }
-
-    struct audit_message rep;
-
-    rep.nlh.nlmsg_type = 0;
-    rep.nlh.nlmsg_len = 0;
-    rep.data[0] = '\0';
-
-    if (audit_get_reply(cli->getSocket(), &rep, GET_REPLY_BLOCKING, 0) < 0) {
-        SLOGE("Failed on audit_get_reply with error: %s", strerror(errno));
-        return false;
-    }
-
-    logPrint("type=%d %.*s", rep.nlh.nlmsg_type, rep.nlh.nlmsg_len, rep.data);
-
-    return true;
-}
-
-static inline bool hasMetadata(char* str, int str_len) {
-    // need to check and see if str already contains bug metadata from
-    // possibility of stuttering if log audit crashes and then reloads kernel
-    // messages. Kernel denials that contain metadata will either end in
-    // "b/[0-9]+$" or "b/[0-9]+  duplicate messages suppressed$" which will put
-    // a '/' character at either 9 or 39 indices away from the end of the str.
-    return str_len >= 39 &&
-           (str[str_len - 9] == '/' || str[str_len - 39] == '/');
-}
-
-std::map<std::string, std::string> LogAudit::populateDenialMap() {
-    std::ifstream bug_file("/vendor/etc/selinux/selinux_denial_metadata");
-    std::string line;
-    // allocate a map for the static map pointer in auditParse to keep track of,
-    // this function only runs once
-    std::map<std::string, std::string> denial_to_bug;
-    if (bug_file.good()) {
-        std::string scontext;
-        std::string tcontext;
-        std::string tclass;
-        std::string bug_num;
-        while (std::getline(bug_file, line)) {
-            std::stringstream split_line(line);
-            split_line >> scontext >> tcontext >> tclass >> bug_num;
-            denial_to_bug.emplace(scontext + tcontext + tclass, bug_num);
-        }
-    }
-    return denial_to_bug;
-}
-
-std::string LogAudit::denialParse(const std::string& denial, char terminator,
-                                  const std::string& search_term) {
-    size_t start_index = denial.find(search_term);
-    if (start_index != std::string::npos) {
-        start_index += search_term.length();
-        return denial.substr(
-            start_index, denial.find(terminator, start_index) - start_index);
-    }
-    return "";
-}
-
-void LogAudit::auditParse(const std::string& string, uid_t uid,
-                          std::string* bug_num) {
-    static std::map<std::string, std::string> denial_to_bug =
-        populateDenialMap();
-    std::string scontext = denialParse(string, ':', "scontext=u:object_r:");
-    std::string tcontext = denialParse(string, ':', "tcontext=u:object_r:");
-    std::string tclass = denialParse(string, ' ', "tclass=");
-    if (scontext.empty()) {
-        scontext = denialParse(string, ':', "scontext=u:r:");
-    }
-    if (tcontext.empty()) {
-        tcontext = denialParse(string, ':', "tcontext=u:r:");
-    }
-    auto search = denial_to_bug.find(scontext + tcontext + tclass);
-    if (search != denial_to_bug.end()) {
-        bug_num->assign(" " + search->second);
-    } else {
-        bug_num->assign("");
-    }
-
-    // Ensure the uid name is not null before passing it to the bug string.
-    if (uid >= AID_APP_START && uid <= AID_APP_END) {
-        char* uidname = android::uidToName(uid);
-        if (uidname) {
-            bug_num->append(" app=");
-            bug_num->append(uidname);
-            free(uidname);
-        }
-    }
-}
-
-int LogAudit::logPrint(const char* fmt, ...) {
-    if (fmt == nullptr) {
-        return -EINVAL;
-    }
-
-    va_list args;
-
-    char* str = nullptr;
-    va_start(args, fmt);
-    int rc = vasprintf(&str, fmt, args);
-    va_end(args);
-
-    if (rc < 0) {
-        return rc;
-    }
-    char* cp;
-    // Work around kernels missing
-    // https://github.com/torvalds/linux/commit/b8f89caafeb55fba75b74bea25adc4e4cd91be67
-    // Such kernels improperly add newlines inside audit messages.
-    while ((cp = strchr(str, '\n'))) {
-        *cp = ' ';
-    }
-
-    while ((cp = strstr(str, "  "))) {
-        memmove(cp, cp + 1, strlen(cp + 1) + 1);
-    }
-    pid_t pid = getpid();
-    pid_t tid = gettid();
-    uid_t uid = AID_LOGD;
-    static const char pid_str[] = " pid=";
-    char* pidptr = strstr(str, pid_str);
-    if (pidptr && isdigit(pidptr[sizeof(pid_str) - 1])) {
-        cp = pidptr + sizeof(pid_str) - 1;
-        pid = 0;
-        while (isdigit(*cp)) {
-            pid = (pid * 10) + (*cp - '0');
-            ++cp;
-        }
-        tid = pid;
-        logbuf->wrlock();
-        uid = logbuf->pidToUid(pid);
-        logbuf->unlock();
-        memmove(pidptr, cp, strlen(cp) + 1);
-    }
-
-    bool info = strstr(str, " permissive=1") || strstr(str, " policy loaded ");
-    static std::string denial_metadata;
-    if ((fdDmesg >= 0) && initialized) {
-        struct iovec iov[4];
-        static const char log_info[] = { KMSG_PRIORITY(LOG_INFO) };
-        static const char log_warning[] = { KMSG_PRIORITY(LOG_WARNING) };
-        static const char newline[] = "\n";
-
-        auditParse(str, uid, &denial_metadata);
-        iov[0].iov_base = info ? const_cast<char*>(log_info) : const_cast<char*>(log_warning);
-        iov[0].iov_len = info ? sizeof(log_info) : sizeof(log_warning);
-        iov[1].iov_base = str;
-        iov[1].iov_len = strlen(str);
-        iov[2].iov_base = const_cast<char*>(denial_metadata.c_str());
-        iov[2].iov_len = denial_metadata.length();
-        iov[3].iov_base = const_cast<char*>(newline);
-        iov[3].iov_len = strlen(newline);
-
-        writev(fdDmesg, iov, arraysize(iov));
-    }
-
-    if (!main && !events) {
-        free(str);
-        return 0;
-    }
-
-    log_time now(log_time::EPOCH);
-
-    static const char audit_str[] = " audit(";
-    char* timeptr = strstr(str, audit_str);
-    if (timeptr &&
-        ((cp = now.strptime(timeptr + sizeof(audit_str) - 1, "%s.%q"))) &&
-        (*cp == ':')) {
-        memcpy(timeptr + sizeof(audit_str) - 1, "0.0", 3);
-        memmove(timeptr + sizeof(audit_str) - 1 + 3, cp, strlen(cp) + 1);
-        if (!isMonotonic()) {
-            if (android::isMonotonic(now)) {
-                LogKlog::convertMonotonicToReal(now);
-            }
-        } else {
-            if (!android::isMonotonic(now)) {
-                LogKlog::convertRealToMonotonic(now);
-            }
-        }
-    } else if (isMonotonic()) {
-        now = log_time(CLOCK_MONOTONIC);
-    } else {
-        now = log_time(CLOCK_REALTIME);
-    }
-
-    // log to events
-
-    size_t str_len = strnlen(str, LOGGER_ENTRY_MAX_PAYLOAD);
-    if (((fdDmesg < 0) || !initialized) && !hasMetadata(str, str_len))
-        auditParse(str, uid, &denial_metadata);
-    str_len = (str_len + denial_metadata.length() <= LOGGER_ENTRY_MAX_PAYLOAD)
-                  ? str_len + denial_metadata.length()
-                  : LOGGER_ENTRY_MAX_PAYLOAD;
-    size_t message_len = str_len + sizeof(android_log_event_string_t);
-
-    log_mask_t notify = 0;
-
-    if (events) {  // begin scope for event buffer
-        uint32_t buffer[(message_len + sizeof(uint32_t) - 1) / sizeof(uint32_t)];
-
-        android_log_event_string_t* event =
-            reinterpret_cast<android_log_event_string_t*>(buffer);
-        event->header.tag = htole32(AUDITD_LOG_TAG);
-        event->type = EVENT_TYPE_STRING;
-        event->length = htole32(str_len);
-        memcpy(event->data, str, str_len - denial_metadata.length());
-        memcpy(event->data + str_len - denial_metadata.length(),
-               denial_metadata.c_str(), denial_metadata.length());
-
-        rc = logbuf->log(
-            LOG_ID_EVENTS, now, uid, pid, tid, reinterpret_cast<char*>(event),
-            (message_len <= UINT16_MAX) ? (uint16_t)message_len : UINT16_MAX);
-        if (rc >= 0) {
-            notify |= 1 << LOG_ID_EVENTS;
-        }
-        // end scope for event buffer
-    }
-
-    // log to main
-
-    static const char comm_str[] = " comm=\"";
-    const char* comm = strstr(str, comm_str);
-    const char* estr = str + strlen(str);
-    const char* commfree = nullptr;
-    if (comm) {
-        estr = comm;
-        comm += sizeof(comm_str) - 1;
-    } else if (pid == getpid()) {
-        pid = tid;
-        comm = "auditd";
-    } else {
-        logbuf->wrlock();
-        comm = commfree = logbuf->pidToName(pid);
-        logbuf->unlock();
-        if (!comm) {
-            comm = "unknown";
-        }
-    }
-
-    const char* ecomm = strchr(comm, '"');
-    if (ecomm) {
-        ++ecomm;
-        str_len = ecomm - comm;
-    } else {
-        str_len = strlen(comm) + 1;
-        ecomm = "";
-    }
-    size_t prefix_len = estr - str;
-    if (prefix_len > LOGGER_ENTRY_MAX_PAYLOAD) {
-        prefix_len = LOGGER_ENTRY_MAX_PAYLOAD;
-    }
-    size_t suffix_len = strnlen(ecomm, LOGGER_ENTRY_MAX_PAYLOAD - prefix_len);
-    message_len =
-        str_len + prefix_len + suffix_len + denial_metadata.length() + 2;
-
-    if (main) {  // begin scope for main buffer
-        char newstr[message_len];
-
-        *newstr = info ? ANDROID_LOG_INFO : ANDROID_LOG_WARN;
-        strlcpy(newstr + 1, comm, str_len);
-        strncpy(newstr + 1 + str_len, str, prefix_len);
-        strncpy(newstr + 1 + str_len + prefix_len, ecomm, suffix_len);
-        strncpy(newstr + 1 + str_len + prefix_len + suffix_len,
-                denial_metadata.c_str(), denial_metadata.length());
-
-        rc = logbuf->log(
-            LOG_ID_MAIN, now, uid, pid, tid, newstr,
-            (message_len <= UINT16_MAX) ? (uint16_t)message_len : UINT16_MAX);
-
-        if (rc >= 0) {
-            notify |= 1 << LOG_ID_MAIN;
-        }
-        // end scope for main buffer
-    }
-
-    free(const_cast<char*>(commfree));
-    free(str);
-
-    if (notify) {
-        reader->notifyNewLog(notify);
-        if (rc < 0) {
-            rc = message_len;
-        }
-    }
-
-    return rc;
-}
-
-int LogAudit::log(char* buf, size_t len) {
-    char* audit = strstr(buf, " audit(");
-    if (!audit || (audit >= &buf[len])) {
-        return 0;
-    }
-
-    *audit = '\0';
-
-    int rc;
-    char* type = strstr(buf, "type=");
-    if (type && (type < &buf[len])) {
-        rc = logPrint("%s %s", type, audit + 1);
-    } else {
-        rc = logPrint("%s", audit + 1);
-    }
-    *audit = ' ';
-    return rc;
-}
-
-int LogAudit::getLogSocket() {
-    int fd = audit_open();
-    if (fd < 0) {
-        return fd;
-    }
-    if (audit_setup(fd, getpid()) < 0) {
-        audit_close(fd);
-        fd = -1;
-    }
-    return fd;
-}
diff --git a/logd/LogAudit.h b/logd/LogAudit.h
deleted file mode 100644
index c3d7a3e..0000000
--- a/logd/LogAudit.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LOGD_LOG_AUDIT_H__
-#define _LOGD_LOG_AUDIT_H__
-
-#include <map>
-
-#include <sysutils/SocketListener.h>
-
-#include "LogBuffer.h"
-
-class LogReader;
-
-class LogAudit : public SocketListener {
-    LogBuffer* logbuf;
-    LogReader* reader;
-    int fdDmesg;  // fdDmesg >= 0 is functionally bool dmesg
-    bool main;
-    bool events;
-    bool initialized;
-
-   public:
-    LogAudit(LogBuffer* buf, LogReader* reader, int fdDmesg);
-    int log(char* buf, size_t len);
-    bool isMonotonic() {
-        return logbuf->isMonotonic();
-    }
-
-   protected:
-    virtual bool onDataAvailable(SocketClient* cli);
-
-   private:
-    static int getLogSocket();
-    std::map<std::string, std::string> populateDenialMap();
-    std::string denialParse(const std::string& denial, char terminator,
-                            const std::string& search_term);
-    void auditParse(const std::string& string, uid_t uid, std::string* bug_num);
-    int logPrint(const char* fmt, ...)
-        __attribute__((__format__(__printf__, 2, 3)));
-};
-
-#endif
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
deleted file mode 100644
index 1cf2061..0000000
--- a/logd/LogBuffer.cpp
+++ /dev/null
@@ -1,1225 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-// for manual checking of stale entries during LogBuffer::erase()
-//#define DEBUG_CHECK_FOR_STALE_ENTRIES
-
-#include <ctype.h>
-#include <endian.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/cdefs.h>
-#include <sys/user.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <unordered_map>
-
-#include <cutils/properties.h>
-#include <private/android_logger.h>
-
-#include "LogBuffer.h"
-#include "LogKlog.h"
-#include "LogReader.h"
-#include "LogUtils.h"
-
-#ifndef __predict_false
-#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
-#endif
-
-// Default
-#define log_buffer_size(id) mMaxSize[id]
-
-const log_time LogBuffer::pruneMargin(3, 0);
-
-void LogBuffer::init() {
-    log_id_for_each(i) {
-        mLastSet[i] = false;
-        mLast[i] = mLogElements.begin();
-
-        if (setSize(i, __android_logger_get_buffer_size(i))) {
-            setSize(i, LOG_BUFFER_MIN_SIZE);
-        }
-    }
-    bool lastMonotonic = monotonic;
-    monotonic = android_log_clockid() == CLOCK_MONOTONIC;
-    if (lastMonotonic != monotonic) {
-        //
-        // Fixup all timestamps, may not be 100% accurate, but better than
-        // throwing what we have away when we get 'surprised' by a change.
-        // In-place element fixup so no need to check reader-lock. Entries
-        // should already be in timestamp order, but we could end up with a
-        // few out-of-order entries if new monotonics come in before we
-        // are notified of the reinit change in status. A Typical example would
-        // be:
-        //  --------- beginning of system
-        //      10.494082   184   201 D Cryptfs : Just triggered post_fs_data
-        //  --------- beginning of kernel
-        //       0.000000     0     0 I         : Initializing cgroup subsys
-        // as the act of mounting /data would trigger persist.logd.timestamp to
-        // be corrected. 1/30 corner case YMMV.
-        //
-        rdlock();
-        LogBufferElementCollection::iterator it = mLogElements.begin();
-        while ((it != mLogElements.end())) {
-            LogBufferElement* e = *it;
-            if (monotonic) {
-                if (!android::isMonotonic(e->mRealTime)) {
-                    LogKlog::convertRealToMonotonic(e->mRealTime);
-                    if ((e->mRealTime.tv_nsec % 1000) == 0) {
-                        e->mRealTime.tv_nsec++;
-                    }
-                }
-            } else {
-                if (android::isMonotonic(e->mRealTime)) {
-                    LogKlog::convertMonotonicToReal(e->mRealTime);
-                    if ((e->mRealTime.tv_nsec % 1000) == 0) {
-                        e->mRealTime.tv_nsec++;
-                    }
-                }
-            }
-            ++it;
-        }
-        unlock();
-    }
-
-    // We may have been triggered by a SIGHUP. Release any sleeping reader
-    // threads to dump their current content.
-    //
-    // NB: this is _not_ performed in the context of a SIGHUP, it is
-    // performed during startup, and in context of reinit administrative thread
-    LogTimeEntry::wrlock();
-
-    LastLogTimes::iterator times = mTimes.begin();
-    while (times != mTimes.end()) {
-        LogTimeEntry* entry = times->get();
-        entry->triggerReader_Locked();
-        times++;
-    }
-
-    LogTimeEntry::unlock();
-}
-
-LogBuffer::LogBuffer(LastLogTimes* times)
-    : monotonic(android_log_clockid() == CLOCK_MONOTONIC), mTimes(*times) {
-    pthread_rwlock_init(&mLogElementsLock, nullptr);
-
-    log_id_for_each(i) {
-        lastLoggedElements[i] = nullptr;
-        droppedElements[i] = nullptr;
-    }
-
-    init();
-}
-
-LogBuffer::~LogBuffer() {
-    log_id_for_each(i) {
-        delete lastLoggedElements[i];
-        delete droppedElements[i];
-    }
-}
-
-enum match_type { DIFFERENT, SAME, SAME_LIBLOG };
-
-static enum match_type identical(LogBufferElement* elem,
-                                 LogBufferElement* last) {
-    // is it mostly identical?
-    //  if (!elem) return DIFFERENT;
-    ssize_t lenl = elem->getMsgLen();
-    if (lenl <= 0) return DIFFERENT;  // value if this represents a chatty elem
-    //  if (!last) return DIFFERENT;
-    ssize_t lenr = last->getMsgLen();
-    if (lenr <= 0) return DIFFERENT;  // value if this represents a chatty elem
-    //  if (elem->getLogId() != last->getLogId()) return DIFFERENT;
-    if (elem->getUid() != last->getUid()) return DIFFERENT;
-    if (elem->getPid() != last->getPid()) return DIFFERENT;
-    if (elem->getTid() != last->getTid()) return DIFFERENT;
-
-    // last is more than a minute old, stop squashing identical messages
-    if (elem->getRealTime().nsec() >
-        (last->getRealTime().nsec() + 60 * NS_PER_SEC))
-        return DIFFERENT;
-
-    // Identical message
-    const char* msgl = elem->getMsg();
-    const char* msgr = last->getMsg();
-    if (lenl == lenr) {
-        if (!fastcmp<memcmp>(msgl, msgr, lenl)) return SAME;
-        // liblog tagged messages (content gets summed)
-        if ((elem->getLogId() == LOG_ID_EVENTS) &&
-            (lenl == sizeof(android_log_event_int_t)) &&
-            !fastcmp<memcmp>(msgl, msgr, sizeof(android_log_event_int_t) -
-                                             sizeof(int32_t)) &&
-            (elem->getTag() == LIBLOG_LOG_TAG)) {
-            return SAME_LIBLOG;
-        }
-    }
-
-    // audit message (except sequence number) identical?
-    if (last->isBinary() &&
-        (lenl > static_cast<ssize_t>(sizeof(android_log_event_string_t))) &&
-        (lenr > static_cast<ssize_t>(sizeof(android_log_event_string_t)))) {
-        if (fastcmp<memcmp>(msgl, msgr, sizeof(android_log_event_string_t) -
-                                            sizeof(int32_t))) {
-            return DIFFERENT;
-        }
-        msgl += sizeof(android_log_event_string_t);
-        lenl -= sizeof(android_log_event_string_t);
-        msgr += sizeof(android_log_event_string_t);
-        lenr -= sizeof(android_log_event_string_t);
-    }
-    static const char avc[] = "): avc: ";
-    const char* avcl = android::strnstr(msgl, lenl, avc);
-    if (!avcl) return DIFFERENT;
-    lenl -= avcl - msgl;
-    const char* avcr = android::strnstr(msgr, lenr, avc);
-    if (!avcr) return DIFFERENT;
-    lenr -= avcr - msgr;
-    if (lenl != lenr) return DIFFERENT;
-    if (fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc),
-                        lenl - strlen(avc))) {
-        return DIFFERENT;
-    }
-    return SAME;
-}
-
-int LogBuffer::log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid,
-                   pid_t tid, const char* msg, uint16_t len) {
-    if (log_id >= LOG_ID_MAX) {
-        return -EINVAL;
-    }
-
-    // Slip the time by 1 nsec if the incoming lands on xxxxxx000 ns.
-    // This prevents any chance that an outside source can request an
-    // exact entry with time specified in ms or us precision.
-    if ((realtime.tv_nsec % 1000) == 0) ++realtime.tv_nsec;
-
-    LogBufferElement* elem = new LogBufferElement(log_id, realtime, uid, pid, tid, msg, len);
-
-    // b/137093665: don't coalesce security messages.
-    if (log_id == LOG_ID_SECURITY) {
-        wrlock();
-        log(elem);
-        unlock();
-
-        return len;
-    }
-
-    int prio = ANDROID_LOG_INFO;
-    const char* tag = nullptr;
-    size_t tag_len = 0;
-    if (log_id == LOG_ID_EVENTS || log_id == LOG_ID_STATS) {
-        tag = tagToName(elem->getTag());
-        if (tag) {
-            tag_len = strlen(tag);
-        }
-    } else {
-        prio = *msg;
-        tag = msg + 1;
-        tag_len = strnlen(tag, len - 1);
-    }
-    if (!__android_log_is_loggable_len(prio, tag, tag_len, ANDROID_LOG_VERBOSE)) {
-        // Log traffic received to total
-        wrlock();
-        stats.addTotal(elem);
-        unlock();
-        delete elem;
-        return -EACCES;
-    }
-
-    wrlock();
-    LogBufferElement* currentLast = lastLoggedElements[log_id];
-    if (currentLast) {
-        LogBufferElement* dropped = droppedElements[log_id];
-        uint16_t count = dropped ? dropped->getDropped() : 0;
-        //
-        // State Init
-        //     incoming:
-        //         dropped = nullptr
-        //         currentLast = nullptr;
-        //         elem = incoming message
-        //     outgoing:
-        //         dropped = nullptr -> State 0
-        //         currentLast = copy of elem
-        //         log elem
-        // State 0
-        //     incoming:
-        //         count = 0
-        //         dropped = nullptr
-        //         currentLast = copy of last message
-        //         elem = incoming message
-        //     outgoing: if match != DIFFERENT
-        //         dropped = copy of first identical message -> State 1
-        //         currentLast = reference to elem
-        //     break: if match == DIFFERENT
-        //         dropped = nullptr -> State 0
-        //         delete copy of last message (incoming currentLast)
-        //         currentLast = copy of elem
-        //         log elem
-        // State 1
-        //     incoming:
-        //         count = 0
-        //         dropped = copy of first identical message
-        //         currentLast = reference to last held-back incoming
-        //                       message
-        //         elem = incoming message
-        //     outgoing: if match == SAME
-        //         delete copy of first identical message (dropped)
-        //         dropped = reference to last held-back incoming
-        //                   message set to chatty count of 1 -> State 2
-        //         currentLast = reference to elem
-        //     outgoing: if match == SAME_LIBLOG
-        //         dropped = copy of first identical message -> State 1
-        //         take sum of currentLast and elem
-        //         if sum overflows:
-        //             log currentLast
-        //             currentLast = reference to elem
-        //         else
-        //             delete currentLast
-        //             currentLast = reference to elem, sum liblog.
-        //     break: if match == DIFFERENT
-        //         delete dropped
-        //         dropped = nullptr -> State 0
-        //         log reference to last held-back (currentLast)
-        //         currentLast = copy of elem
-        //         log elem
-        // State 2
-        //     incoming:
-        //         count = chatty count
-        //         dropped = chatty message holding count
-        //         currentLast = reference to last held-back incoming
-        //                       message.
-        //         dropped = chatty message holding count
-        //         elem = incoming message
-        //     outgoing: if match != DIFFERENT
-        //         delete chatty message holding count
-        //         dropped = reference to last held-back incoming
-        //                   message, set to chatty count + 1
-        //         currentLast = reference to elem
-        //     break: if match == DIFFERENT
-        //         log dropped (chatty message)
-        //         dropped = nullptr -> State 0
-        //         log reference to last held-back (currentLast)
-        //         currentLast = copy of elem
-        //         log elem
-        //
-        enum match_type match = identical(elem, currentLast);
-        if (match != DIFFERENT) {
-            if (dropped) {
-                // Sum up liblog tag messages?
-                if ((count == 0) /* at Pass 1 */ && (match == SAME_LIBLOG)) {
-                    android_log_event_int_t* event =
-                        reinterpret_cast<android_log_event_int_t*>(
-                            const_cast<char*>(currentLast->getMsg()));
-                    //
-                    // To unit test, differentiate with something like:
-                    //    event->header.tag = htole32(CHATTY_LOG_TAG);
-                    // here, then instead of delete currentLast below,
-                    // log(currentLast) to see the incremental sums form.
-                    //
-                    uint32_t swab = event->payload.data;
-                    unsigned long long total = htole32(swab);
-                    event = reinterpret_cast<android_log_event_int_t*>(
-                        const_cast<char*>(elem->getMsg()));
-                    swab = event->payload.data;
-
-                    lastLoggedElements[LOG_ID_EVENTS] = elem;
-                    total += htole32(swab);
-                    // check for overflow
-                    if (total >= UINT32_MAX) {
-                        log(currentLast);
-                        unlock();
-                        return len;
-                    }
-                    stats.addTotal(currentLast);
-                    delete currentLast;
-                    swab = total;
-                    event->payload.data = htole32(swab);
-                    unlock();
-                    return len;
-                }
-                if (count == USHRT_MAX) {
-                    log(dropped);
-                    count = 1;
-                } else {
-                    delete dropped;
-                    ++count;
-                }
-            }
-            if (count) {
-                stats.addTotal(currentLast);
-                currentLast->setDropped(count);
-            }
-            droppedElements[log_id] = currentLast;
-            lastLoggedElements[log_id] = elem;
-            unlock();
-            return len;
-        }
-        if (dropped) {         // State 1 or 2
-            if (count) {       // State 2
-                log(dropped);  // report chatty
-            } else {           // State 1
-                delete dropped;
-            }
-            droppedElements[log_id] = nullptr;
-            log(currentLast);  // report last message in the series
-        } else {               // State 0
-            delete currentLast;
-        }
-    }
-    lastLoggedElements[log_id] = new LogBufferElement(*elem);
-
-    log(elem);
-    unlock();
-
-    return len;
-}
-
-// assumes LogBuffer::wrlock() held, owns elem, look after garbage collection
-void LogBuffer::log(LogBufferElement* elem) {
-    // cap on how far back we will sort in-place, otherwise append
-    static uint32_t too_far_back = 5;  // five seconds
-    // Insert elements in time sorted order if possible
-    //  NB: if end is region locked, place element at end of list
-    LogBufferElementCollection::iterator it = mLogElements.end();
-    LogBufferElementCollection::iterator last = it;
-    if (__predict_true(it != mLogElements.begin())) --it;
-    if (__predict_false(it == mLogElements.begin()) ||
-        __predict_true((*it)->getRealTime() <= elem->getRealTime()) ||
-        __predict_false((((*it)->getRealTime().tv_sec - too_far_back) >
-                         elem->getRealTime().tv_sec) &&
-                        (elem->getLogId() != LOG_ID_KERNEL) &&
-                        ((*it)->getLogId() != LOG_ID_KERNEL))) {
-        mLogElements.push_back(elem);
-    } else {
-        log_time end(log_time::EPOCH);
-        bool end_set = false;
-        bool end_always = false;
-
-        LogTimeEntry::rdlock();
-
-        LastLogTimes::iterator times = mTimes.begin();
-        while (times != mTimes.end()) {
-            LogTimeEntry* entry = times->get();
-            if (!entry->mNonBlock) {
-                end_always = true;
-                break;
-            }
-            // it passing mEnd is blocked by the following checks.
-            if (!end_set || (end <= entry->mEnd)) {
-                end = entry->mEnd;
-                end_set = true;
-            }
-            times++;
-        }
-
-        if (end_always || (end_set && (end > (*it)->getRealTime()))) {
-            mLogElements.push_back(elem);
-        } else {
-            // should be short as timestamps are localized near end()
-            do {
-                last = it;
-                if (__predict_false(it == mLogElements.begin())) {
-                    break;
-                }
-                --it;
-            } while (((*it)->getRealTime() > elem->getRealTime()) &&
-                     (!end_set || (end <= (*it)->getRealTime())));
-            mLogElements.insert(last, elem);
-        }
-        LogTimeEntry::unlock();
-    }
-
-    stats.add(elem);
-    maybePrune(elem->getLogId());
-}
-
-// Prune at most 10% of the log entries or maxPrune, whichever is less.
-//
-// LogBuffer::wrlock() must be held when this function is called.
-void LogBuffer::maybePrune(log_id_t id) {
-    size_t sizes = stats.sizes(id);
-    unsigned long maxSize = log_buffer_size(id);
-    if (sizes > maxSize) {
-        size_t sizeOver = sizes - ((maxSize * 9) / 10);
-        size_t elements = stats.realElements(id);
-        size_t minElements = elements / 100;
-        if (minElements < minPrune) {
-            minElements = minPrune;
-        }
-        unsigned long pruneRows = elements * sizeOver / sizes;
-        if (pruneRows < minElements) {
-            pruneRows = minElements;
-        }
-        if (pruneRows > maxPrune) {
-            pruneRows = maxPrune;
-        }
-        prune(id, pruneRows);
-    }
-}
-
-LogBufferElementCollection::iterator LogBuffer::erase(
-    LogBufferElementCollection::iterator it, bool coalesce) {
-    LogBufferElement* element = *it;
-    log_id_t id = element->getLogId();
-
-    // Remove iterator references in the various lists that will become stale
-    // after the element is erased from the main logging list.
-
-    {  // start of scope for found iterator
-        int key = ((id == LOG_ID_EVENTS) || (id == LOG_ID_SECURITY))
-                      ? element->getTag()
-                      : element->getUid();
-        LogBufferIteratorMap::iterator found = mLastWorst[id].find(key);
-        if ((found != mLastWorst[id].end()) && (it == found->second)) {
-            mLastWorst[id].erase(found);
-        }
-    }
-
-    {  // start of scope for pid found iterator
-        // element->getUid() may not be AID_SYSTEM for next-best-watermark.
-        // will not assume id != LOG_ID_EVENTS or LOG_ID_SECURITY for KISS and
-        // long term code stability, find() check should be fast for those ids.
-        LogBufferPidIteratorMap::iterator found =
-            mLastWorstPidOfSystem[id].find(element->getPid());
-        if ((found != mLastWorstPidOfSystem[id].end()) &&
-            (it == found->second)) {
-            mLastWorstPidOfSystem[id].erase(found);
-        }
-    }
-
-    bool setLast[LOG_ID_MAX];
-    bool doSetLast = false;
-    log_id_for_each(i) {
-        doSetLast |= setLast[i] = mLastSet[i] && (it == mLast[i]);
-    }
-#ifdef DEBUG_CHECK_FOR_STALE_ENTRIES
-    LogBufferElementCollection::iterator bad = it;
-    int key = ((id == LOG_ID_EVENTS) || (id == LOG_ID_SECURITY))
-                  ? element->getTag()
-                  : element->getUid();
-#endif
-    it = mLogElements.erase(it);
-    if (doSetLast) {
-        log_id_for_each(i) {
-            if (setLast[i]) {
-                if (__predict_false(it == mLogElements.end())) {  // impossible
-                    mLastSet[i] = false;
-                    mLast[i] = mLogElements.begin();
-                } else {
-                    mLast[i] = it;  // push down the road as next-best-watermark
-                }
-            }
-        }
-    }
-#ifdef DEBUG_CHECK_FOR_STALE_ENTRIES
-    log_id_for_each(i) {
-        for (auto b : mLastWorst[i]) {
-            if (bad == b.second) {
-                android::prdebug("stale mLastWorst[%d] key=%d mykey=%d\n", i,
-                                 b.first, key);
-            }
-        }
-        for (auto b : mLastWorstPidOfSystem[i]) {
-            if (bad == b.second) {
-                android::prdebug("stale mLastWorstPidOfSystem[%d] pid=%d\n", i,
-                                 b.first);
-            }
-        }
-        if (mLastSet[i] && (bad == mLast[i])) {
-            android::prdebug("stale mLast[%d]\n", i);
-            mLastSet[i] = false;
-            mLast[i] = mLogElements.begin();
-        }
-    }
-#endif
-    if (coalesce) {
-        stats.erase(element);
-    } else {
-        stats.subtract(element);
-    }
-    delete element;
-
-    return it;
-}
-
-// Define a temporary mechanism to report the last LogBufferElement pointer
-// for the specified uid, pid and tid. Used below to help merge-sort when
-// pruning for worst UID.
-class LogBufferElementKey {
-    const union {
-        struct {
-            uint32_t uid;
-            uint16_t pid;
-            uint16_t tid;
-        } __packed;
-        uint64_t value;
-    } __packed;
-
-   public:
-    LogBufferElementKey(uid_t uid, pid_t pid, pid_t tid)
-        : uid(uid), pid(pid), tid(tid) {
-    }
-    explicit LogBufferElementKey(uint64_t key) : value(key) {
-    }
-
-    uint64_t getKey() {
-        return value;
-    }
-};
-
-class LogBufferElementLast {
-    typedef std::unordered_map<uint64_t, LogBufferElement*> LogBufferElementMap;
-    LogBufferElementMap map;
-
-   public:
-    bool coalesce(LogBufferElement* element, uint16_t dropped) {
-        LogBufferElementKey key(element->getUid(), element->getPid(),
-                                element->getTid());
-        LogBufferElementMap::iterator it = map.find(key.getKey());
-        if (it != map.end()) {
-            LogBufferElement* found = it->second;
-            uint16_t moreDropped = found->getDropped();
-            if ((dropped + moreDropped) > USHRT_MAX) {
-                map.erase(it);
-            } else {
-                found->setDropped(dropped + moreDropped);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    void add(LogBufferElement* element) {
-        LogBufferElementKey key(element->getUid(), element->getPid(),
-                                element->getTid());
-        map[key.getKey()] = element;
-    }
-
-    inline void clear() {
-        map.clear();
-    }
-
-    void clear(LogBufferElement* element) {
-        log_time current =
-            element->getRealTime() - log_time(EXPIRE_RATELIMIT, 0);
-        for (LogBufferElementMap::iterator it = map.begin(); it != map.end();) {
-            LogBufferElement* mapElement = it->second;
-            if ((mapElement->getDropped() >= EXPIRE_THRESHOLD) &&
-                (current > mapElement->getRealTime())) {
-                it = map.erase(it);
-            } else {
-                ++it;
-            }
-        }
-    }
-};
-
-// Determine if watermark is within pruneMargin + 1s from the end of the list,
-// the caller will use this result to set an internal busy flag indicating
-// the prune operation could not be completed because a reader is blocking
-// the request.
-bool LogBuffer::isBusy(log_time watermark) {
-    LogBufferElementCollection::iterator ei = mLogElements.end();
-    --ei;
-    return watermark < ((*ei)->getRealTime() - pruneMargin - log_time(1, 0));
-}
-
-// If the selected reader is blocking our pruning progress, decide on
-// what kind of mitigation is necessary to unblock the situation.
-void LogBuffer::kickMe(LogTimeEntry* me, log_id_t id, unsigned long pruneRows) {
-    if (stats.sizes(id) > (2 * log_buffer_size(id))) {  // +100%
-        // A misbehaving or slow reader has its connection
-        // dropped if we hit too much memory pressure.
-        android::prdebug("Kicking blocked reader, pid %d, from LogBuffer::kickMe()\n",
-                         me->mClient->getPid());
-        me->release_Locked();
-    } else if (me->mTimeout.tv_sec || me->mTimeout.tv_nsec) {
-        // Allow a blocked WRAP timeout reader to
-        // trigger and start reporting the log data.
-        me->triggerReader_Locked();
-    } else {
-        // tell slow reader to skip entries to catch up
-        android::prdebug(
-                "Skipping %lu entries from slow reader, pid %d, from LogBuffer::kickMe()\n",
-                pruneRows, me->mClient->getPid());
-        me->triggerSkip_Locked(id, pruneRows);
-    }
-}
-
-// prune "pruneRows" of type "id" from the buffer.
-//
-// This garbage collection task is used to expire log entries. It is called to
-// remove all logs (clear), all UID logs (unprivileged clear), or every
-// 256 or 10% of the total logs (whichever is less) to prune the logs.
-//
-// First there is a prep phase where we discover the reader region lock that
-// acts as a backstop to any pruning activity to stop there and go no further.
-//
-// There are three major pruning loops that follow. All expire from the oldest
-// entries. Since there are multiple log buffers, the Android logging facility
-// will appear to drop entries 'in the middle' when looking at multiple log
-// sources and buffers. This effect is slightly more prominent when we prune
-// the worst offender by logging source. Thus the logs slowly loose content
-// and value as you move back in time. This is preferred since chatty sources
-// invariably move the logs value down faster as less chatty sources would be
-// expired in the noise.
-//
-// The first loop performs blacklisting and worst offender pruning. Falling
-// through when there are no notable worst offenders and have not hit the
-// region lock preventing further worst offender pruning. This loop also looks
-// after managing the chatty log entries and merging to help provide
-// statistical basis for blame. The chatty entries are not a notification of
-// how much logs you may have, but instead represent how much logs you would
-// have had in a virtual log buffer that is extended to cover all the in-memory
-// logs without loss. They last much longer than the represented pruned logs
-// since they get multiplied by the gains in the non-chatty log sources.
-//
-// The second loop get complicated because an algorithm of watermarks and
-// history is maintained to reduce the order and keep processing time
-// down to a minimum at scale. These algorithms can be costly in the face
-// of larger log buffers, or severly limited processing time granted to a
-// background task at lowest priority.
-//
-// This second loop does straight-up expiration from the end of the logs
-// (again, remember for the specified log buffer id) but does some whitelist
-// preservation. Thus whitelist is a Hail Mary low priority, blacklists and
-// spam filtration all take priority. This second loop also checks if a region
-// lock is causing us to buffer too much in the logs to help the reader(s),
-// and will tell the slowest reader thread to skip log entries, and if
-// persistent and hits a further threshold, kill the reader thread.
-//
-// The third thread is optional, and only gets hit if there was a whitelist
-// and more needs to be pruned against the backstop of the region lock.
-//
-// LogBuffer::wrlock() must be held when this function is called.
-//
-bool LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
-    LogTimeEntry* oldest = nullptr;
-    bool busy = false;
-    bool clearAll = pruneRows == ULONG_MAX;
-
-    LogTimeEntry::rdlock();
-
-    // Region locked?
-    LastLogTimes::iterator times = mTimes.begin();
-    while (times != mTimes.end()) {
-        LogTimeEntry* entry = times->get();
-        if (entry->isWatching(id) &&
-            (!oldest || (oldest->mStart > entry->mStart) ||
-             ((oldest->mStart == entry->mStart) &&
-              (entry->mTimeout.tv_sec || entry->mTimeout.tv_nsec)))) {
-            oldest = entry;
-        }
-        times++;
-    }
-    log_time watermark(log_time::tv_sec_max, log_time::tv_nsec_max);
-    if (oldest) watermark = oldest->mStart - pruneMargin;
-
-    LogBufferElementCollection::iterator it;
-
-    if (__predict_false(caller_uid != AID_ROOT)) {  // unlikely
-        // Only here if clear all request from non system source, so chatty
-        // filter logistics is not required.
-        it = mLastSet[id] ? mLast[id] : mLogElements.begin();
-        while (it != mLogElements.end()) {
-            LogBufferElement* element = *it;
-
-            if ((element->getLogId() != id) ||
-                (element->getUid() != caller_uid)) {
-                ++it;
-                continue;
-            }
-
-            if (!mLastSet[id] || ((*mLast[id])->getLogId() != id)) {
-                mLast[id] = it;
-                mLastSet[id] = true;
-            }
-
-            if (oldest && (watermark <= element->getRealTime())) {
-                busy = isBusy(watermark);
-                if (busy) kickMe(oldest, id, pruneRows);
-                break;
-            }
-
-            it = erase(it);
-            if (--pruneRows == 0) {
-                break;
-            }
-        }
-        LogTimeEntry::unlock();
-        return busy;
-    }
-
-    // prune by worst offenders; by blacklist, UID, and by PID of system UID
-    bool hasBlacklist = (id != LOG_ID_SECURITY) && mPrune.naughty();
-    while (!clearAll && (pruneRows > 0)) {
-        // recalculate the worst offender on every batched pass
-        int worst = -1;  // not valid for getUid() or getKey()
-        size_t worst_sizes = 0;
-        size_t second_worst_sizes = 0;
-        pid_t worstPid = 0;  // POSIX guarantees PID != 0
-
-        if (worstUidEnabledForLogid(id) && mPrune.worstUidEnabled()) {
-            // Calculate threshold as 12.5% of available storage
-            size_t threshold = log_buffer_size(id) / 8;
-
-            if ((id == LOG_ID_EVENTS) || (id == LOG_ID_SECURITY)) {
-                stats.sortTags(AID_ROOT, (pid_t)0, 2, id)
-                    .findWorst(worst, worst_sizes, second_worst_sizes,
-                               threshold);
-                // per-pid filter for AID_SYSTEM sources is too complex
-            } else {
-                stats.sort(AID_ROOT, (pid_t)0, 2, id)
-                    .findWorst(worst, worst_sizes, second_worst_sizes,
-                               threshold);
-
-                if ((worst == AID_SYSTEM) && mPrune.worstPidOfSystemEnabled()) {
-                    stats.sortPids(worst, (pid_t)0, 2, id)
-                        .findWorst(worstPid, worst_sizes, second_worst_sizes);
-                }
-            }
-        }
-
-        // skip if we have neither worst nor naughty filters
-        if ((worst == -1) && !hasBlacklist) {
-            break;
-        }
-
-        bool kick = false;
-        bool leading = true;
-        it = mLastSet[id] ? mLast[id] : mLogElements.begin();
-        // Perform at least one mandatory garbage collection cycle in following
-        // - clear leading chatty tags
-        // - coalesce chatty tags
-        // - check age-out of preserved logs
-        bool gc = pruneRows <= 1;
-        if (!gc && (worst != -1)) {
-            {  // begin scope for worst found iterator
-                LogBufferIteratorMap::iterator found =
-                    mLastWorst[id].find(worst);
-                if ((found != mLastWorst[id].end()) &&
-                    (found->second != mLogElements.end())) {
-                    leading = false;
-                    it = found->second;
-                }
-            }
-            if (worstPid) {  // begin scope for pid worst found iterator
-                // FYI: worstPid only set if !LOG_ID_EVENTS and
-                //      !LOG_ID_SECURITY, not going to make that assumption ...
-                LogBufferPidIteratorMap::iterator found =
-                    mLastWorstPidOfSystem[id].find(worstPid);
-                if ((found != mLastWorstPidOfSystem[id].end()) &&
-                    (found->second != mLogElements.end())) {
-                    leading = false;
-                    it = found->second;
-                }
-            }
-        }
-        static const timespec too_old = { EXPIRE_HOUR_THRESHOLD * 60 * 60, 0 };
-        LogBufferElementCollection::iterator lastt;
-        lastt = mLogElements.end();
-        --lastt;
-        LogBufferElementLast last;
-        while (it != mLogElements.end()) {
-            LogBufferElement* element = *it;
-
-            if (oldest && (watermark <= element->getRealTime())) {
-                busy = isBusy(watermark);
-                // Do not let chatty eliding trigger any reader mitigation
-                break;
-            }
-
-            if (element->getLogId() != id) {
-                ++it;
-                continue;
-            }
-            // below this point element->getLogId() == id
-
-            if (leading && (!mLastSet[id] || ((*mLast[id])->getLogId() != id))) {
-                mLast[id] = it;
-                mLastSet[id] = true;
-            }
-
-            uint16_t dropped = element->getDropped();
-
-            // remove any leading drops
-            if (leading && dropped) {
-                it = erase(it);
-                continue;
-            }
-
-            if (dropped && last.coalesce(element, dropped)) {
-                it = erase(it, true);
-                continue;
-            }
-
-            int key = ((id == LOG_ID_EVENTS) || (id == LOG_ID_SECURITY))
-                          ? element->getTag()
-                          : element->getUid();
-
-            if (hasBlacklist && mPrune.naughty(element)) {
-                last.clear(element);
-                it = erase(it);
-                if (dropped) {
-                    continue;
-                }
-
-                pruneRows--;
-                if (pruneRows == 0) {
-                    break;
-                }
-
-                if (key == worst) {
-                    kick = true;
-                    if (worst_sizes < second_worst_sizes) {
-                        break;
-                    }
-                    worst_sizes -= element->getMsgLen();
-                }
-                continue;
-            }
-
-            if ((element->getRealTime() < ((*lastt)->getRealTime() - too_old)) ||
-                (element->getRealTime() > (*lastt)->getRealTime())) {
-                break;
-            }
-
-            if (dropped) {
-                last.add(element);
-                if (worstPid &&
-                    ((!gc && (element->getPid() == worstPid)) ||
-                     (mLastWorstPidOfSystem[id].find(element->getPid()) ==
-                      mLastWorstPidOfSystem[id].end()))) {
-                    // element->getUid() may not be AID_SYSTEM, next best
-                    // watermark if current one empty. id is not LOG_ID_EVENTS
-                    // or LOG_ID_SECURITY because of worstPid check.
-                    mLastWorstPidOfSystem[id][element->getPid()] = it;
-                }
-                if ((!gc && !worstPid && (key == worst)) ||
-                    (mLastWorst[id].find(key) == mLastWorst[id].end())) {
-                    mLastWorst[id][key] = it;
-                }
-                ++it;
-                continue;
-            }
-
-            if ((key != worst) ||
-                (worstPid && (element->getPid() != worstPid))) {
-                leading = false;
-                last.clear(element);
-                ++it;
-                continue;
-            }
-            // key == worst below here
-            // If worstPid set, then element->getPid() == worstPid below here
-
-            pruneRows--;
-            if (pruneRows == 0) {
-                break;
-            }
-
-            kick = true;
-
-            uint16_t len = element->getMsgLen();
-
-            // do not create any leading drops
-            if (leading) {
-                it = erase(it);
-            } else {
-                stats.drop(element);
-                element->setDropped(1);
-                if (last.coalesce(element, 1)) {
-                    it = erase(it, true);
-                } else {
-                    last.add(element);
-                    if (worstPid &&
-                        (!gc || (mLastWorstPidOfSystem[id].find(worstPid) ==
-                                 mLastWorstPidOfSystem[id].end()))) {
-                        // element->getUid() may not be AID_SYSTEM, next best
-                        // watermark if current one empty. id is not
-                        // LOG_ID_EVENTS or LOG_ID_SECURITY because of worstPid.
-                        mLastWorstPidOfSystem[id][worstPid] = it;
-                    }
-                    if ((!gc && !worstPid) ||
-                        (mLastWorst[id].find(worst) == mLastWorst[id].end())) {
-                        mLastWorst[id][worst] = it;
-                    }
-                    ++it;
-                }
-            }
-            if (worst_sizes < second_worst_sizes) {
-                break;
-            }
-            worst_sizes -= len;
-        }
-        last.clear();
-
-        if (!kick || !mPrune.worstUidEnabled()) {
-            break;  // the following loop will ask bad clients to skip/drop
-        }
-    }
-
-    bool whitelist = false;
-    bool hasWhitelist = (id != LOG_ID_SECURITY) && mPrune.nice() && !clearAll;
-    it = mLastSet[id] ? mLast[id] : mLogElements.begin();
-    while ((pruneRows > 0) && (it != mLogElements.end())) {
-        LogBufferElement* element = *it;
-
-        if (element->getLogId() != id) {
-            it++;
-            continue;
-        }
-
-        if (!mLastSet[id] || ((*mLast[id])->getLogId() != id)) {
-            mLast[id] = it;
-            mLastSet[id] = true;
-        }
-
-        if (oldest && (watermark <= element->getRealTime())) {
-            busy = isBusy(watermark);
-            if (!whitelist && busy) kickMe(oldest, id, pruneRows);
-            break;
-        }
-
-        if (hasWhitelist && !element->getDropped() && mPrune.nice(element)) {
-            // WhiteListed
-            whitelist = true;
-            it++;
-            continue;
-        }
-
-        it = erase(it);
-        pruneRows--;
-    }
-
-    // Do not save the whitelist if we are reader range limited
-    if (whitelist && (pruneRows > 0)) {
-        it = mLastSet[id] ? mLast[id] : mLogElements.begin();
-        while ((it != mLogElements.end()) && (pruneRows > 0)) {
-            LogBufferElement* element = *it;
-
-            if (element->getLogId() != id) {
-                ++it;
-                continue;
-            }
-
-            if (!mLastSet[id] || ((*mLast[id])->getLogId() != id)) {
-                mLast[id] = it;
-                mLastSet[id] = true;
-            }
-
-            if (oldest && (watermark <= element->getRealTime())) {
-                busy = isBusy(watermark);
-                if (busy) kickMe(oldest, id, pruneRows);
-                break;
-            }
-
-            it = erase(it);
-            pruneRows--;
-        }
-    }
-
-    LogTimeEntry::unlock();
-
-    return (pruneRows > 0) && busy;
-}
-
-// clear all rows of type "id" from the buffer.
-bool LogBuffer::clear(log_id_t id, uid_t uid) {
-    bool busy = true;
-    // If it takes more than 4 tries (seconds) to clear, then kill reader(s)
-    for (int retry = 4;;) {
-        if (retry == 1) {  // last pass
-            // Check if it is still busy after the sleep, we say prune
-            // one entry, not another clear run, so we are looking for
-            // the quick side effect of the return value to tell us if
-            // we have a _blocked_ reader.
-            wrlock();
-            busy = prune(id, 1, uid);
-            unlock();
-            // It is still busy, blocked reader(s), lets kill them all!
-            // otherwise, lets be a good citizen and preserve the slow
-            // readers and let the clear run (below) deal with determining
-            // if we are still blocked and return an error code to caller.
-            if (busy) {
-                LogTimeEntry::wrlock();
-                LastLogTimes::iterator times = mTimes.begin();
-                while (times != mTimes.end()) {
-                    LogTimeEntry* entry = times->get();
-                    // Killer punch
-                    if (entry->isWatching(id)) {
-                        android::prdebug(
-                                "Kicking blocked reader, pid %d, from LogBuffer::clear()\n",
-                                entry->mClient->getPid());
-                        entry->release_Locked();
-                    }
-                    times++;
-                }
-                LogTimeEntry::unlock();
-            }
-        }
-        wrlock();
-        busy = prune(id, ULONG_MAX, uid);
-        unlock();
-        if (!busy || !--retry) {
-            break;
-        }
-        sleep(1);  // Let reader(s) catch up after notification
-    }
-    return busy;
-}
-
-// get the used space associated with "id".
-unsigned long LogBuffer::getSizeUsed(log_id_t id) {
-    rdlock();
-    size_t retval = stats.sizes(id);
-    unlock();
-    return retval;
-}
-
-// set the total space allocated to "id"
-int LogBuffer::setSize(log_id_t id, unsigned long size) {
-    // Reasonable limits ...
-    if (!__android_logger_valid_buffer_size(size)) {
-        return -1;
-    }
-    wrlock();
-    log_buffer_size(id) = size;
-    unlock();
-    return 0;
-}
-
-// get the total space allocated to "id"
-unsigned long LogBuffer::getSize(log_id_t id) {
-    rdlock();
-    size_t retval = log_buffer_size(id);
-    unlock();
-    return retval;
-}
-
-log_time LogBuffer::flushTo(SocketClient* reader, const log_time& start,
-                            pid_t* lastTid, bool privileged, bool security,
-                            int (*filter)(const LogBufferElement* element,
-                                          void* arg),
-                            void* arg) {
-    LogBufferElementCollection::iterator it;
-    uid_t uid = reader->getUid();
-
-    rdlock();
-
-    if (start == log_time::EPOCH) {
-        // client wants to start from the beginning
-        it = mLogElements.begin();
-    } else {
-        // Cap to 300 iterations we look back for out-of-order entries.
-        size_t count = 300;
-
-        // Client wants to start from some specified time. Chances are
-        // we are better off starting from the end of the time sorted list.
-        LogBufferElementCollection::iterator last;
-        for (last = it = mLogElements.end(); it != mLogElements.begin();
-             /* do nothing */) {
-            --it;
-            LogBufferElement* element = *it;
-            if (element->getRealTime() > start) {
-                last = it;
-            } else if (element->getRealTime() == start) {
-                last = ++it;
-                break;
-            } else if (!--count) {
-                break;
-            }
-        }
-        it = last;
-    }
-
-    log_time curr = start;
-
-    LogBufferElement* lastElement = nullptr;  // iterator corruption paranoia
-    static const size_t maxSkip = 4194304;    // maximum entries to skip
-    size_t skip = maxSkip;
-    for (; it != mLogElements.end(); ++it) {
-        LogBufferElement* element = *it;
-
-        if (!--skip) {
-            android::prdebug("reader.per: too many elements skipped");
-            break;
-        }
-        if (element == lastElement) {
-            android::prdebug("reader.per: identical elements");
-            break;
-        }
-        lastElement = element;
-
-        if (!privileged && (element->getUid() != uid)) {
-            continue;
-        }
-
-        if (!security && (element->getLogId() == LOG_ID_SECURITY)) {
-            continue;
-        }
-
-        // NB: calling out to another object with wrlock() held (safe)
-        if (filter) {
-            int ret = (*filter)(element, arg);
-            if (ret == false) {
-                continue;
-            }
-            if (ret != true) {
-                break;
-            }
-        }
-
-        bool sameTid = false;
-        if (lastTid) {
-            sameTid = lastTid[element->getLogId()] == element->getTid();
-            // Dropped (chatty) immediately following a valid log from the
-            // same source in the same log buffer indicates we have a
-            // multiple identical squash.  chatty that differs source
-            // is due to spam filter.  chatty to chatty of different
-            // source is also due to spam filter.
-            lastTid[element->getLogId()] =
-                (element->getDropped() && !sameTid) ? 0 : element->getTid();
-        }
-
-        unlock();
-
-        // range locking in LastLogTimes looks after us
-        curr = element->flushTo(reader, this, sameTid);
-
-        if (curr == element->FLUSH_ERROR) {
-            return curr;
-        }
-
-        skip = maxSkip;
-        rdlock();
-    }
-    unlock();
-
-    return curr;
-}
-
-std::string LogBuffer::formatStatistics(uid_t uid, pid_t pid,
-                                        unsigned int logMask) {
-    wrlock();
-
-    std::string ret = stats.format(uid, pid, logMask);
-
-    unlock();
-
-    return ret;
-}
diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h
deleted file mode 100644
index c2d5b97..0000000
--- a/logd/LogBuffer.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#ifndef _LOGD_LOG_BUFFER_H__
-#define _LOGD_LOG_BUFFER_H__
-
-#include <sys/types.h>
-
-#include <list>
-#include <string>
-
-#include <android/log.h>
-#include <private/android_filesystem_config.h>
-#include <sysutils/SocketClient.h>
-
-#include "LogBufferElement.h"
-#include "LogStatistics.h"
-#include "LogTags.h"
-#include "LogTimes.h"
-#include "LogWhiteBlackList.h"
-
-//
-// We are either in 1970ish (MONOTONIC) or 2016+ish (REALTIME) so to
-// differentiate without prejudice, we use 1972 to delineate, earlier
-// is likely monotonic, later is real. Otherwise we start using a
-// dividing line between monotonic and realtime if more than a minute
-// difference between them.
-//
-namespace android {
-
-static bool isMonotonic(const log_time& mono) {
-    static const uint32_t EPOCH_PLUS_2_YEARS = 2 * 24 * 60 * 60 * 1461 / 4;
-    static const uint32_t EPOCH_PLUS_MINUTE = 60;
-
-    if (mono.tv_sec >= EPOCH_PLUS_2_YEARS) {
-        return false;
-    }
-
-    log_time now(CLOCK_REALTIME);
-
-    /* Timezone and ntp time setup? */
-    if (now.tv_sec >= EPOCH_PLUS_2_YEARS) {
-        return true;
-    }
-
-    /* no way to differentiate realtime from monotonic time */
-    if (now.tv_sec < EPOCH_PLUS_MINUTE) {
-        return false;
-    }
-
-    log_time cpu(CLOCK_MONOTONIC);
-    /* too close to call to differentiate monotonic times from realtime */
-    if ((cpu.tv_sec + EPOCH_PLUS_MINUTE) >= now.tv_sec) {
-        return false;
-    }
-
-    /* dividing line half way between monotonic and realtime */
-    return mono.tv_sec < ((cpu.tv_sec + now.tv_sec) / 2);
-}
-}
-
-typedef std::list<LogBufferElement*> LogBufferElementCollection;
-
-class LogBuffer {
-    LogBufferElementCollection mLogElements;
-    pthread_rwlock_t mLogElementsLock;
-
-    LogStatistics stats;
-
-    PruneList mPrune;
-    // watermark for last per log id
-    LogBufferElementCollection::iterator mLast[LOG_ID_MAX];
-    bool mLastSet[LOG_ID_MAX];
-    // watermark of any worst/chatty uid processing
-    typedef std::unordered_map<uid_t, LogBufferElementCollection::iterator>
-        LogBufferIteratorMap;
-    LogBufferIteratorMap mLastWorst[LOG_ID_MAX];
-    // watermark of any worst/chatty pid of system processing
-    typedef std::unordered_map<pid_t, LogBufferElementCollection::iterator>
-        LogBufferPidIteratorMap;
-    LogBufferPidIteratorMap mLastWorstPidOfSystem[LOG_ID_MAX];
-
-    unsigned long mMaxSize[LOG_ID_MAX];
-
-    bool monotonic;
-
-    LogTags tags;
-
-    LogBufferElement* lastLoggedElements[LOG_ID_MAX];
-    LogBufferElement* droppedElements[LOG_ID_MAX];
-    void log(LogBufferElement* elem);
-
-   public:
-    LastLogTimes& mTimes;
-
-    explicit LogBuffer(LastLogTimes* times);
-    ~LogBuffer();
-    void init();
-    bool isMonotonic() {
-        return monotonic;
-    }
-
-    int log(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid, pid_t tid, const char* msg,
-            uint16_t len);
-    // lastTid is an optional context to help detect if the last previous
-    // valid message was from the same source so we can differentiate chatty
-    // filter types (identical or expired)
-    log_time flushTo(SocketClient* writer, const log_time& start,
-                     pid_t* lastTid,  // &lastTid[LOG_ID_MAX] or nullptr
-                     bool privileged, bool security,
-                     int (*filter)(const LogBufferElement* element,
-                                   void* arg) = nullptr,
-                     void* arg = nullptr);
-
-    bool clear(log_id_t id, uid_t uid = AID_ROOT);
-    unsigned long getSize(log_id_t id);
-    int setSize(log_id_t id, unsigned long size);
-    unsigned long getSizeUsed(log_id_t id);
-
-    std::string formatStatistics(uid_t uid, pid_t pid, unsigned int logMask);
-
-    void enableStatistics() {
-        stats.enableStatistics();
-    }
-
-    int initPrune(const char* cp) {
-        return mPrune.init(cp);
-    }
-    std::string formatPrune() {
-        return mPrune.format();
-    }
-
-    std::string formatGetEventTag(uid_t uid, const char* name,
-                                  const char* format) {
-        return tags.formatGetEventTag(uid, name, format);
-    }
-    std::string formatEntry(uint32_t tag, uid_t uid) {
-        return tags.formatEntry(tag, uid);
-    }
-    const char* tagToName(uint32_t tag) {
-        return tags.tagToName(tag);
-    }
-
-    // helper must be protected directly or implicitly by wrlock()/unlock()
-    const char* pidToName(pid_t pid) {
-        return stats.pidToName(pid);
-    }
-    uid_t pidToUid(pid_t pid) { return stats.pidToUid(pid); }
-    const char* uidToName(uid_t uid) {
-        return stats.uidToName(uid);
-    }
-    void wrlock() {
-        pthread_rwlock_wrlock(&mLogElementsLock);
-    }
-    void rdlock() {
-        pthread_rwlock_rdlock(&mLogElementsLock);
-    }
-    void unlock() {
-        pthread_rwlock_unlock(&mLogElementsLock);
-    }
-
-   private:
-    static constexpr size_t minPrune = 4;
-    static constexpr size_t maxPrune = 256;
-    static const log_time pruneMargin;
-
-    void maybePrune(log_id_t id);
-    bool isBusy(log_time watermark);
-    void kickMe(LogTimeEntry* me, log_id_t id, unsigned long pruneRows);
-
-    bool prune(log_id_t id, unsigned long pruneRows, uid_t uid = AID_ROOT);
-    LogBufferElementCollection::iterator erase(
-        LogBufferElementCollection::iterator it, bool coalesce = false);
-};
-
-#endif  // _LOGD_LOG_BUFFER_H__
diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp
deleted file mode 100644
index ec81933..0000000
--- a/logd/LogBufferElement.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#include <ctype.h>
-#include <endian.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <private/android_logger.h>
-
-#include "LogBuffer.h"
-#include "LogBufferElement.h"
-#include "LogCommand.h"
-#include "LogReader.h"
-#include "LogUtils.h"
-
-const log_time LogBufferElement::FLUSH_ERROR((uint32_t)-1, (uint32_t)-1);
-atomic_int_fast64_t LogBufferElement::sequence(1);
-
-LogBufferElement::LogBufferElement(log_id_t log_id, log_time realtime,
-                                   uid_t uid, pid_t pid, pid_t tid,
-                                   const char* msg, uint16_t len)
-    : mUid(uid),
-      mPid(pid),
-      mTid(tid),
-      mRealTime(realtime),
-      mMsgLen(len),
-      mLogId(log_id),
-      mDropped(false) {
-    mMsg = new char[len];
-    memcpy(mMsg, msg, len);
-}
-
-LogBufferElement::LogBufferElement(const LogBufferElement& elem)
-    : mUid(elem.mUid),
-      mPid(elem.mPid),
-      mTid(elem.mTid),
-      mRealTime(elem.mRealTime),
-      mMsgLen(elem.mMsgLen),
-      mLogId(elem.mLogId),
-      mDropped(elem.mDropped) {
-    if (mDropped) {
-        mTag = elem.getTag();
-    } else {
-        mMsg = new char[mMsgLen];
-        memcpy(mMsg, elem.mMsg, mMsgLen);
-    }
-}
-
-LogBufferElement::~LogBufferElement() {
-    if (!mDropped) {
-        delete[] mMsg;
-    }
-}
-
-uint32_t LogBufferElement::getTag() const {
-    // Binary buffers have no tag.
-    if (!isBinary()) {
-        return 0;
-    }
-
-    // Dropped messages store the tag in place of mMsg.
-    if (mDropped) {
-        return mTag;
-    }
-
-    // For non-dropped messages, we get the tag from the message header itself.
-    if (mMsgLen < sizeof(android_event_header_t)) {
-        return 0;
-    }
-
-    return reinterpret_cast<const android_event_header_t*>(mMsg)->tag;
-}
-
-uint16_t LogBufferElement::setDropped(uint16_t value) {
-    if (mDropped) {
-        return mDroppedCount = value;
-    }
-
-    // The tag information is saved in mMsg data, which is in a union with mTag, used after mDropped
-    // is set to true. Therefore we save the tag value aside, delete mMsg, then set mTag to the tag
-    // value in its place.
-    auto old_tag = getTag();
-    delete[] mMsg;
-    mMsg = nullptr;
-
-    mTag = old_tag;
-    mDropped = true;
-    return mDroppedCount = value;
-}
-
-// caller must own and free character string
-char* android::tidToName(pid_t tid) {
-    char* retval = nullptr;
-    char buffer[256];
-    snprintf(buffer, sizeof(buffer), "/proc/%u/comm", tid);
-    int fd = open(buffer, O_RDONLY);
-    if (fd >= 0) {
-        ssize_t ret = read(fd, buffer, sizeof(buffer));
-        if (ret >= (ssize_t)sizeof(buffer)) {
-            ret = sizeof(buffer) - 1;
-        }
-        while ((ret > 0) && isspace(buffer[ret - 1])) {
-            --ret;
-        }
-        if (ret > 0) {
-            buffer[ret] = '\0';
-            retval = strdup(buffer);
-        }
-        close(fd);
-    }
-
-    // if nothing for comm, check out cmdline
-    char* name = android::pidToName(tid);
-    if (!retval) {
-        retval = name;
-        name = nullptr;
-    }
-
-    // check if comm is truncated, see if cmdline has full representation
-    if (name) {
-        // impossible for retval to be NULL if name not NULL
-        size_t retval_len = strlen(retval);
-        size_t name_len = strlen(name);
-        // KISS: ToDo: Only checks prefix truncated, not suffix, or both
-        if ((retval_len < name_len) &&
-            !fastcmp<strcmp>(retval, name + name_len - retval_len)) {
-            free(retval);
-            retval = name;
-        } else {
-            free(name);
-        }
-    }
-    return retval;
-}
-
-// assumption: mMsg == NULL
-size_t LogBufferElement::populateDroppedMessage(char*& buffer, LogBuffer* parent,
-                                                bool lastSame) {
-    static const char tag[] = "chatty";
-
-    if (!__android_log_is_loggable_len(ANDROID_LOG_INFO, tag, strlen(tag),
-                                       ANDROID_LOG_VERBOSE)) {
-        return 0;
-    }
-
-    static const char format_uid[] = "uid=%u%s%s %s %u line%s";
-    parent->wrlock();
-    const char* name = parent->uidToName(mUid);
-    parent->unlock();
-    const char* commName = android::tidToName(mTid);
-    if (!commName && (mTid != mPid)) {
-        commName = android::tidToName(mPid);
-    }
-    if (!commName) {
-        parent->wrlock();
-        commName = parent->pidToName(mPid);
-        parent->unlock();
-    }
-    if (name && name[0] && commName && (name[0] == commName[0])) {
-        size_t len = strlen(name + 1);
-        if (!strncmp(name + 1, commName + 1, len)) {
-            if (commName[len + 1] == '\0') {
-                free(const_cast<char*>(commName));
-                commName = nullptr;
-            } else {
-                free(const_cast<char*>(name));
-                name = nullptr;
-            }
-        }
-    }
-    if (name) {
-        char* buf = nullptr;
-        asprintf(&buf, "(%s)", name);
-        if (buf) {
-            free(const_cast<char*>(name));
-            name = buf;
-        }
-    }
-    if (commName) {
-        char* buf = nullptr;
-        asprintf(&buf, " %s", commName);
-        if (buf) {
-            free(const_cast<char*>(commName));
-            commName = buf;
-        }
-    }
-    // identical to below to calculate the buffer size required
-    const char* type = lastSame ? "identical" : "expire";
-    size_t len = snprintf(nullptr, 0, format_uid, mUid, name ? name : "",
-                          commName ? commName : "", type, getDropped(),
-                          (getDropped() > 1) ? "s" : "");
-
-    size_t hdrLen;
-    if (isBinary()) {
-        hdrLen = sizeof(android_log_event_string_t);
-    } else {
-        hdrLen = 1 + sizeof(tag);
-    }
-
-    buffer = static_cast<char*>(calloc(1, hdrLen + len + 1));
-    if (!buffer) {
-        free(const_cast<char*>(name));
-        free(const_cast<char*>(commName));
-        return 0;
-    }
-
-    size_t retval = hdrLen + len;
-    if (isBinary()) {
-        android_log_event_string_t* event =
-            reinterpret_cast<android_log_event_string_t*>(buffer);
-
-        event->header.tag = htole32(CHATTY_LOG_TAG);
-        event->type = EVENT_TYPE_STRING;
-        event->length = htole32(len);
-    } else {
-        ++retval;
-        buffer[0] = ANDROID_LOG_INFO;
-        strcpy(buffer + 1, tag);
-    }
-
-    snprintf(buffer + hdrLen, len + 1, format_uid, mUid, name ? name : "",
-             commName ? commName : "", type, getDropped(),
-             (getDropped() > 1) ? "s" : "");
-    free(const_cast<char*>(name));
-    free(const_cast<char*>(commName));
-
-    return retval;
-}
-
-log_time LogBufferElement::flushTo(SocketClient* reader, LogBuffer* parent, bool lastSame) {
-    struct logger_entry entry = {};
-
-    entry.hdr_size = sizeof(struct logger_entry);
-    entry.lid = mLogId;
-    entry.pid = mPid;
-    entry.tid = mTid;
-    entry.uid = mUid;
-    entry.sec = mRealTime.tv_sec;
-    entry.nsec = mRealTime.tv_nsec;
-
-    struct iovec iovec[2];
-    iovec[0].iov_base = &entry;
-    iovec[0].iov_len = entry.hdr_size;
-
-    char* buffer = nullptr;
-
-    if (mDropped) {
-        entry.len = populateDroppedMessage(buffer, parent, lastSame);
-        if (!entry.len) return mRealTime;
-        iovec[1].iov_base = buffer;
-    } else {
-        entry.len = mMsgLen;
-        iovec[1].iov_base = mMsg;
-    }
-    iovec[1].iov_len = entry.len;
-
-    log_time retval = reader->sendDatav(iovec, 1 + (entry.len != 0))
-                          ? FLUSH_ERROR
-                          : mRealTime;
-
-    if (buffer) free(buffer);
-
-    return retval;
-}
diff --git a/logd/LogBufferElement.h b/logd/LogBufferElement.h
deleted file mode 100644
index fd790e4..0000000
--- a/logd/LogBufferElement.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#pragma once
-
-#include <stdatomic.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-#include <log/log.h>
-#include <sysutils/SocketClient.h>
-
-class LogBuffer;
-
-#define EXPIRE_HOUR_THRESHOLD 24  // Only expire chatty UID logs to preserve
-                                  // non-chatty UIDs less than this age in hours
-#define EXPIRE_THRESHOLD 10       // A smaller expire count is considered too
-                                  // chatty for the temporal expire messages
-#define EXPIRE_RATELIMIT 10  // maximum rate in seconds to report expiration
-
-class __attribute__((packed)) LogBufferElement {
-    friend LogBuffer;
-
-    // sized to match reality of incoming log packets
-    const uint32_t mUid;
-    const uint32_t mPid;
-    const uint32_t mTid;
-    log_time mRealTime;
-    union {
-        char* mMsg;    // mDropped == false
-        int32_t mTag;  // mDropped == true
-    };
-    union {
-        const uint16_t mMsgLen;  // mDropped == false
-        uint16_t mDroppedCount;  // mDropped == true
-    };
-    const uint8_t mLogId;
-    bool mDropped;
-
-    static atomic_int_fast64_t sequence;
-
-    // assumption: mDropped == true
-    size_t populateDroppedMessage(char*& buffer, LogBuffer* parent,
-                                  bool lastSame);
-
-   public:
-    LogBufferElement(log_id_t log_id, log_time realtime, uid_t uid, pid_t pid,
-                     pid_t tid, const char* msg, uint16_t len);
-    LogBufferElement(const LogBufferElement& elem);
-    ~LogBufferElement();
-
-    bool isBinary(void) const {
-        return (mLogId == LOG_ID_EVENTS) || (mLogId == LOG_ID_SECURITY);
-    }
-
-    log_id_t getLogId() const {
-        return static_cast<log_id_t>(mLogId);
-    }
-    uid_t getUid(void) const {
-        return mUid;
-    }
-    pid_t getPid(void) const {
-        return mPid;
-    }
-    pid_t getTid(void) const {
-        return mTid;
-    }
-    uint32_t getTag() const;
-    uint16_t getDropped(void) const {
-        return mDropped ? mDroppedCount : 0;
-    }
-    uint16_t setDropped(uint16_t value);
-    uint16_t getMsgLen() const {
-        return mDropped ? 0 : mMsgLen;
-    }
-    const char* getMsg() const {
-        return mDropped ? nullptr : mMsg;
-    }
-    log_time getRealTime(void) const {
-        return mRealTime;
-    }
-
-    static const log_time FLUSH_ERROR;
-    log_time flushTo(SocketClient* writer, LogBuffer* parent, bool lastSame);
-};
diff --git a/logd/LogCommand.cpp b/logd/LogCommand.cpp
deleted file mode 100644
index 8bff9da..0000000
--- a/logd/LogCommand.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <private/android_filesystem_config.h>
-
-#include "LogCommand.h"
-#include "LogUtils.h"
-
-LogCommand::LogCommand(const char* cmd) : FrameworkCommand(cmd) {
-}
-
-// gets a list of supplementary group IDs associated with
-// the socket peer.  This is implemented by opening
-// /proc/PID/status and look for the "Group:" line.
-//
-// This function introduces races especially since status
-// can change 'shape' while reading, the net result is err
-// on lack of permission.
-//
-// Race-free alternative is to introduce pairs of sockets
-// and threads for each command and reading, one each that
-// has open permissions, and one that has restricted
-// permissions.
-
-static bool groupIsLog(char* buf) {
-    char* ptr;
-    static const char ws[] = " \n";
-
-    for (buf = strtok_r(buf, ws, &ptr); buf; buf = strtok_r(nullptr, ws, &ptr)) {
-        errno = 0;
-        gid_t Gid = strtol(buf, nullptr, 10);
-        if (errno != 0) {
-            return false;
-        }
-        if (Gid == AID_LOG) {
-            return true;
-        }
-    }
-    return false;
-}
-
-bool clientHasLogCredentials(uid_t uid, gid_t gid, pid_t pid) {
-    if ((uid == AID_ROOT) || (uid == AID_SYSTEM) || (uid == AID_LOG)) {
-        return true;
-    }
-
-    if ((gid == AID_ROOT) || (gid == AID_SYSTEM) || (gid == AID_LOG)) {
-        return true;
-    }
-
-    // FYI We will typically be here for 'adb logcat'
-    char filename[256];
-    snprintf(filename, sizeof(filename), "/proc/%u/status", pid);
-
-    bool ret;
-    bool foundLog = false;
-    bool foundGid = false;
-    bool foundUid = false;
-
-    //
-    // Reading /proc/<pid>/status is rife with race conditions. All of /proc
-    // suffers from this and its use should be minimized. However, we have no
-    // choice.
-    //
-    // Notably the content from one 4KB page to the next 4KB page can be from a
-    // change in shape even if we are gracious enough to attempt to read
-    // atomically. getline can not even guarantee a page read is not split up
-    // and in effect can read from different vintages of the content.
-    //
-    // We are finding out in the field that a 'logcat -c' via adb occasionally
-    // is returned with permission denied when we did only one pass and thus
-    // breaking scripts. For security we still err on denying access if in
-    // doubt, but we expect the falses  should be reduced significantly as
-    // three times is a charm.
-    //
-    for (int retry = 3; !(ret = foundGid && foundUid && foundLog) && retry;
-         --retry) {
-        FILE* file = fopen(filename, "r");
-        if (!file) {
-            continue;
-        }
-
-        char* line = nullptr;
-        size_t len = 0;
-        while (getline(&line, &len, file) > 0) {
-            static const char groups_string[] = "Groups:\t";
-            static const char uid_string[] = "Uid:\t";
-            static const char gid_string[] = "Gid:\t";
-
-            if (strncmp(groups_string, line, sizeof(groups_string) - 1) == 0) {
-                if (groupIsLog(line + sizeof(groups_string) - 1)) {
-                    foundLog = true;
-                }
-            } else if (strncmp(uid_string, line, sizeof(uid_string) - 1) == 0) {
-                uid_t u[4] = { (uid_t)-1, (uid_t)-1, (uid_t)-1, (uid_t)-1 };
-
-                sscanf(line + sizeof(uid_string) - 1, "%u\t%u\t%u\t%u", &u[0],
-                       &u[1], &u[2], &u[3]);
-
-                // Protect against PID reuse by checking that UID is the same
-                if ((uid == u[0]) && (uid == u[1]) && (uid == u[2]) &&
-                    (uid == u[3])) {
-                    foundUid = true;
-                }
-            } else if (strncmp(gid_string, line, sizeof(gid_string) - 1) == 0) {
-                gid_t g[4] = { (gid_t)-1, (gid_t)-1, (gid_t)-1, (gid_t)-1 };
-
-                sscanf(line + sizeof(gid_string) - 1, "%u\t%u\t%u\t%u", &g[0],
-                       &g[1], &g[2], &g[3]);
-
-                // Protect against PID reuse by checking that GID is the same
-                if ((gid == g[0]) && (gid == g[1]) && (gid == g[2]) &&
-                    (gid == g[3])) {
-                    foundGid = true;
-                }
-            }
-        }
-        free(line);
-        fclose(file);
-    }
-
-    return ret;
-}
-
-bool clientHasLogCredentials(SocketClient* cli) {
-    return clientHasLogCredentials(cli->getUid(), cli->getGid(), cli->getPid());
-}
diff --git a/logd/LogCommand.h b/logd/LogCommand.h
deleted file mode 100644
index e10ffa0..0000000
--- a/logd/LogCommand.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#ifndef _LOGD_COMMAND_H
-#define _LOGD_COMMAND_H
-
-#include <sysutils/FrameworkCommand.h>
-#include <sysutils/SocketClient.h>
-
-class LogCommand : public FrameworkCommand {
-   public:
-    explicit LogCommand(const char* cmd);
-    virtual ~LogCommand() {
-    }
-};
-
-#endif
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
deleted file mode 100644
index edd326a..0000000
--- a/logd/LogKlog.cpp
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/prctl.h>
-#include <sys/uio.h>
-#include <syslog.h>
-
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-
-#include "LogBuffer.h"
-#include "LogKlog.h"
-#include "LogReader.h"
-
-#define KMSG_PRIORITY(PRI) \
-    '<', '0' + (LOG_SYSLOG | (PRI)) / 10, '0' + (LOG_SYSLOG | (PRI)) % 10, '>'
-
-static const char priority_message[] = { KMSG_PRIORITY(LOG_INFO), '\0' };
-
-// List of the _only_ needles we supply here to android::strnstr
-static const char suspendStr[] = "PM: suspend entry ";
-static const char resumeStr[] = "PM: suspend exit ";
-static const char suspendedStr[] = "Suspended for ";
-static const char healthdStr[] = "healthd";
-static const char batteryStr[] = ": battery ";
-static const char auditStr[] = " audit(";
-static const char klogdStr[] = "logd.klogd: ";
-
-// Parsing is hard
-
-// called if we see a '<', s is the next character, returns pointer after '>'
-static char* is_prio(char* s, ssize_t len) {
-    if ((len <= 0) || !isdigit(*s++)) return nullptr;
-    --len;
-    static const size_t max_prio_len = (len < 4) ? len : 4;
-    size_t priolen = 0;
-    char c;
-    while (((c = *s++)) && (++priolen <= max_prio_len)) {
-        if (!isdigit(c)) return ((c == '>') && (*s == '[')) ? s : nullptr;
-    }
-    return nullptr;
-}
-
-// called if we see a '[', s is the next character, returns pointer after ']'
-static char* is_timestamp(char* s, ssize_t len) {
-    while ((len > 0) && (*s == ' ')) {
-        ++s;
-        --len;
-    }
-    if ((len <= 0) || !isdigit(*s++)) return nullptr;
-    --len;
-    bool first_period = true;
-    char c;
-    while ((len > 0) && ((c = *s++))) {
-        --len;
-        if ((c == '.') && first_period) {
-            first_period = false;
-        } else if (!isdigit(c)) {
-            return ((c == ']') && !first_period && (*s == ' ')) ? s : nullptr;
-        }
-    }
-    return nullptr;
-}
-
-// Like strtok_r with "\r\n" except that we look for log signatures (regex)
-//  \(\(<[0-9]\{1,4\}>\)\([[] *[0-9]+[.][0-9]+[]] \)\{0,1\}\|[[]
-//  *[0-9]+[.][0-9]+[]] \)
-// and split if we see a second one without a newline.
-// We allow nuls in content, monitoring the overall length and sub-length of
-// the discovered tokens.
-
-#define SIGNATURE_MASK 0xF0
-// <digit> following ('0' to '9' masked with ~SIGNATURE_MASK) added to signature
-#define LESS_THAN_SIG SIGNATURE_MASK
-#define OPEN_BRACKET_SIG ((SIGNATURE_MASK << 1) & SIGNATURE_MASK)
-// space is one more than <digit> of 9
-#define OPEN_BRACKET_SPACE ((char)(OPEN_BRACKET_SIG | 10))
-
-char* android::log_strntok_r(char* s, ssize_t& len, char*& last,
-                             ssize_t& sublen) {
-    sublen = 0;
-    if (len <= 0) return nullptr;
-    if (!s) {
-        if (!(s = last)) return nullptr;
-        // fixup for log signature split <,
-        // LESS_THAN_SIG + <digit>
-        if ((*s & SIGNATURE_MASK) == LESS_THAN_SIG) {
-            *s = (*s & ~SIGNATURE_MASK) + '0';
-            *--s = '<';
-            ++len;
-        }
-        // fixup for log signature split [,
-        // OPEN_BRACKET_SPACE is space, OPEN_BRACKET_SIG + <digit>
-        if ((*s & SIGNATURE_MASK) == OPEN_BRACKET_SIG) {
-            *s = (*s == OPEN_BRACKET_SPACE) ? ' ' : (*s & ~SIGNATURE_MASK) + '0';
-            *--s = '[';
-            ++len;
-        }
-    }
-
-    while ((len > 0) && ((*s == '\r') || (*s == '\n'))) {
-        ++s;
-        --len;
-    }
-
-    if (len <= 0) return last = nullptr;
-    char *peek, *tok = s;
-
-    for (;;) {
-        if (len <= 0) {
-            last = nullptr;
-            return tok;
-        }
-        char c = *s++;
-        --len;
-        ssize_t adjust;
-        switch (c) {
-            case '\r':
-            case '\n':
-                s[-1] = '\0';
-                last = s;
-                return tok;
-
-            case '<':
-                peek = is_prio(s, len);
-                if (!peek) break;
-                if (s != (tok + 1)) {  // not first?
-                    s[-1] = '\0';
-                    *s &= ~SIGNATURE_MASK;
-                    *s |= LESS_THAN_SIG;  // signature for '<'
-                    last = s;
-                    return tok;
-                }
-                adjust = peek - s;
-                if (adjust > len) {
-                    adjust = len;
-                }
-                sublen += adjust;
-                len -= adjust;
-                s = peek;
-                if ((*s == '[') && ((peek = is_timestamp(s + 1, len - 1)))) {
-                    adjust = peek - s;
-                    if (adjust > len) {
-                        adjust = len;
-                    }
-                    sublen += adjust;
-                    len -= adjust;
-                    s = peek;
-                }
-                break;
-
-            case '[':
-                peek = is_timestamp(s, len);
-                if (!peek) break;
-                if (s != (tok + 1)) {  // not first?
-                    s[-1] = '\0';
-                    if (*s == ' ') {
-                        *s = OPEN_BRACKET_SPACE;
-                    } else {
-                        *s &= ~SIGNATURE_MASK;
-                        *s |= OPEN_BRACKET_SIG;  // signature for '['
-                    }
-                    last = s;
-                    return tok;
-                }
-                adjust = peek - s;
-                if (adjust > len) {
-                    adjust = len;
-                }
-                sublen += adjust;
-                len -= adjust;
-                s = peek;
-                break;
-        }
-        ++sublen;
-    }
-    // NOTREACHED
-}
-
-log_time LogKlog::correction = (log_time(CLOCK_REALTIME) < log_time(CLOCK_MONOTONIC))
-                                       ? log_time(log_time::EPOCH)
-                                       : (log_time(CLOCK_REALTIME) - log_time(CLOCK_MONOTONIC));
-
-LogKlog::LogKlog(LogBuffer* buf, LogReader* reader, int fdWrite, int fdRead,
-                 bool auditd)
-    : SocketListener(fdRead, false),
-      logbuf(buf),
-      reader(reader),
-      signature(CLOCK_MONOTONIC),
-      initialized(false),
-      enableLogging(true),
-      auditd(auditd) {
-    static const char klogd_message[] = "%s%s%" PRIu64 "\n";
-    char buffer[strlen(priority_message) + strlen(klogdStr) +
-                strlen(klogd_message) + 20];
-    snprintf(buffer, sizeof(buffer), klogd_message, priority_message, klogdStr,
-             signature.nsec());
-    write(fdWrite, buffer, strlen(buffer));
-}
-
-bool LogKlog::onDataAvailable(SocketClient* cli) {
-    if (!initialized) {
-        prctl(PR_SET_NAME, "logd.klogd");
-        initialized = true;
-        enableLogging = false;
-    }
-
-    char buffer[LOGGER_ENTRY_MAX_PAYLOAD];
-    ssize_t len = 0;
-
-    for (;;) {
-        ssize_t retval = 0;
-        if (len < (ssize_t)(sizeof(buffer) - 1)) {
-            retval =
-                read(cli->getSocket(), buffer + len, sizeof(buffer) - 1 - len);
-        }
-        if ((retval == 0) && (len <= 0)) {
-            break;
-        }
-        if (retval < 0) {
-            return false;
-        }
-        len += retval;
-        bool full = len == (sizeof(buffer) - 1);
-        char* ep = buffer + len;
-        *ep = '\0';
-        ssize_t sublen;
-        for (char *ptr = nullptr, *tok = buffer;
-             !!(tok = android::log_strntok_r(tok, len, ptr, sublen));
-             tok = nullptr) {
-            if (((tok + sublen) >= ep) && (retval != 0) && full) {
-                if (sublen > 0) memmove(buffer, tok, sublen);
-                len = sublen;
-                break;
-            }
-            if ((sublen > 0) && *tok) {
-                log(tok, sublen);
-            }
-        }
-    }
-
-    return true;
-}
-
-void LogKlog::calculateCorrection(const log_time& monotonic,
-                                  const char* real_string, ssize_t len) {
-    static const char real_format[] = "%Y-%m-%d %H:%M:%S.%09q UTC";
-    if (len < (ssize_t)(strlen(real_format) + 5)) return;
-
-    log_time real(log_time::EPOCH);
-    const char* ep = real.strptime(real_string, real_format);
-    if (!ep || (ep > &real_string[len]) || (real > log_time(CLOCK_REALTIME))) {
-        return;
-    }
-    // kernel report UTC, log_time::strptime is localtime from calendar.
-    // Bionic and liblog strptime does not support %z or %Z to pick up
-    // timezone so we are calculating our own correction.
-    time_t now = real.tv_sec;
-    struct tm tm;
-    memset(&tm, 0, sizeof(tm));
-    tm.tm_isdst = -1;
-    localtime_r(&now, &tm);
-    if ((tm.tm_gmtoff < 0) && ((-tm.tm_gmtoff) > (long)real.tv_sec)) {
-        real = log_time(log_time::EPOCH);
-    } else {
-        real.tv_sec += tm.tm_gmtoff;
-    }
-    if (monotonic > real) {
-        correction = log_time(log_time::EPOCH);
-    } else {
-        correction = real - monotonic;
-    }
-}
-
-log_time LogKlog::sniffTime(const char*& buf, ssize_t len, bool reverse) {
-    log_time now(log_time::EPOCH);
-    if (len <= 0) return now;
-
-    const char* cp = nullptr;
-    if ((len > 10) && (*buf == '[')) {
-        cp = now.strptime(buf, "[ %s.%q]");  // can index beyond buffer bounds
-        if (cp && (cp > &buf[len - 1])) cp = nullptr;
-    }
-    if (cp) {
-        len -= cp - buf;
-        if ((len > 0) && isspace(*cp)) {
-            ++cp;
-            --len;
-        }
-        buf = cp;
-
-        if (isMonotonic()) return now;
-
-        const char* b;
-        if (((b = android::strnstr(cp, len, suspendStr))) &&
-            (((b += strlen(suspendStr)) - cp) < len)) {
-            len -= b - cp;
-            calculateCorrection(now, b, len);
-        } else if (((b = android::strnstr(cp, len, resumeStr))) &&
-                   (((b += strlen(resumeStr)) - cp) < len)) {
-            len -= b - cp;
-            calculateCorrection(now, b, len);
-        } else if (((b = android::strnstr(cp, len, healthdStr))) &&
-                   (((b += strlen(healthdStr)) - cp) < len) &&
-                   ((b = android::strnstr(b, len -= b - cp, batteryStr))) &&
-                   (((b += strlen(batteryStr)) - cp) < len)) {
-            // NB: healthd is roughly 150us late, so we use it instead to
-            //     trigger a check for ntp-induced or hardware clock drift.
-            log_time real(CLOCK_REALTIME);
-            log_time mono(CLOCK_MONOTONIC);
-            correction = (real < mono) ? log_time(log_time::EPOCH) : (real - mono);
-        } else if (((b = android::strnstr(cp, len, suspendedStr))) &&
-                   (((b += strlen(suspendStr)) - cp) < len)) {
-            len -= b - cp;
-            log_time real(log_time::EPOCH);
-            char* endp;
-            real.tv_sec = strtol(b, &endp, 10);
-            if ((*endp == '.') && ((endp - b) < len)) {
-                unsigned long multiplier = NS_PER_SEC;
-                real.tv_nsec = 0;
-                len -= endp - b;
-                while (--len && isdigit(*++endp) && (multiplier /= 10)) {
-                    real.tv_nsec += (*endp - '0') * multiplier;
-                }
-                if (reverse) {
-                    if (real > correction) {
-                        correction = log_time(log_time::EPOCH);
-                    } else {
-                        correction -= real;
-                    }
-                } else {
-                    correction += real;
-                }
-            }
-        }
-
-        convertMonotonicToReal(now);
-    } else {
-        if (isMonotonic()) {
-            now = log_time(CLOCK_MONOTONIC);
-        } else {
-            now = log_time(CLOCK_REALTIME);
-        }
-    }
-    return now;
-}
-
-pid_t LogKlog::sniffPid(const char*& buf, ssize_t len) {
-    if (len <= 0) return 0;
-
-    const char* cp = buf;
-    // sscanf does a strlen, let's check if the string is not nul terminated.
-    // pseudo out-of-bounds access since we always have an extra char on buffer.
-    if (((ssize_t)strnlen(cp, len) == len) && cp[len]) {
-        return 0;
-    }
-    // HTC kernels with modified printk "c0   1648 "
-    if ((len > 9) && (cp[0] == 'c') && isdigit(cp[1]) &&
-        (isdigit(cp[2]) || (cp[2] == ' ')) && (cp[3] == ' ')) {
-        bool gotDigit = false;
-        int i;
-        for (i = 4; i < 9; ++i) {
-            if (isdigit(cp[i])) {
-                gotDigit = true;
-            } else if (gotDigit || (cp[i] != ' ')) {
-                break;
-            }
-        }
-        if ((i == 9) && (cp[i] == ' ')) {
-            int pid = 0;
-            char dummy;
-            if (sscanf(cp + 4, "%d%c", &pid, &dummy) == 2) {
-                buf = cp + 10;  // skip-it-all
-                return pid;
-            }
-        }
-    }
-    while (len) {
-        // Mediatek kernels with modified printk
-        if (*cp == '[') {
-            int pid = 0;
-            char dummy;
-            if (sscanf(cp, "[%d:%*[a-z_./0-9:A-Z]]%c", &pid, &dummy) == 2) {
-                return pid;
-            }
-            break;  // Only the first one
-        }
-        ++cp;
-        --len;
-    }
-    return 0;
-}
-
-// kernel log prefix, convert to a kernel log priority number
-static int parseKernelPrio(const char*& buf, ssize_t len) {
-    int pri = LOG_USER | LOG_INFO;
-    const char* cp = buf;
-    if ((len > 0) && (*cp == '<')) {
-        pri = 0;
-        while (--len && isdigit(*++cp)) {
-            pri = (pri * 10) + *cp - '0';
-        }
-        if ((len > 0) && (*cp == '>')) {
-            ++cp;
-        } else {
-            cp = buf;
-            pri = LOG_USER | LOG_INFO;
-        }
-        buf = cp;
-    }
-    return pri;
-}
-
-// Passed the entire SYSLOG_ACTION_READ_ALL buffer and interpret a
-// compensated start time.
-void LogKlog::synchronize(const char* buf, ssize_t len) {
-    const char* cp = android::strnstr(buf, len, suspendStr);
-    if (!cp) {
-        cp = android::strnstr(buf, len, resumeStr);
-        if (!cp) return;
-    } else {
-        const char* rp = android::strnstr(buf, len, resumeStr);
-        if (rp && (rp < cp)) cp = rp;
-    }
-
-    do {
-        --cp;
-    } while ((cp > buf) && (*cp != '\n'));
-    if (*cp == '\n') {
-        ++cp;
-    }
-    parseKernelPrio(cp, len - (cp - buf));
-
-    log_time now = sniffTime(cp, len - (cp - buf), true);
-
-    const char* suspended = android::strnstr(buf, len, suspendedStr);
-    if (!suspended || (suspended > cp)) {
-        return;
-    }
-    cp = suspended;
-
-    do {
-        --cp;
-    } while ((cp > buf) && (*cp != '\n'));
-    if (*cp == '\n') {
-        ++cp;
-    }
-    parseKernelPrio(cp, len - (cp - buf));
-
-    sniffTime(cp, len - (cp - buf), true);
-}
-
-// Convert kernel log priority number into an Android Logger priority number
-static int convertKernelPrioToAndroidPrio(int pri) {
-    switch (pri & LOG_PRIMASK) {
-        case LOG_EMERG:
-        case LOG_ALERT:
-        case LOG_CRIT:
-            return ANDROID_LOG_FATAL;
-
-        case LOG_ERR:
-            return ANDROID_LOG_ERROR;
-
-        case LOG_WARNING:
-            return ANDROID_LOG_WARN;
-
-        default:
-        case LOG_NOTICE:
-        case LOG_INFO:
-            break;
-
-        case LOG_DEBUG:
-            return ANDROID_LOG_DEBUG;
-    }
-
-    return ANDROID_LOG_INFO;
-}
-
-static const char* strnrchr(const char* s, ssize_t len, char c) {
-    const char* save = nullptr;
-    for (; len > 0; ++s, len--) {
-        if (*s == c) {
-            save = s;
-        }
-    }
-    return save;
-}
-
-//
-// log a message into the kernel log buffer
-//
-// Filter rules to parse <PRI> <TIME> <tag> and <message> in order for
-// them to appear correct in the logcat output:
-//
-// LOG_KERN (0):
-// <PRI>[<TIME>] <tag> ":" <message>
-// <PRI>[<TIME>] <tag> <tag> ":" <message>
-// <PRI>[<TIME>] <tag> <tag>_work ":" <message>
-// <PRI>[<TIME>] <tag> '<tag>.<num>' ":" <message>
-// <PRI>[<TIME>] <tag> '<tag><num>' ":" <message>
-// <PRI>[<TIME>] <tag>_host '<tag>.<num>' ":" <message>
-// (unimplemented) <PRI>[<TIME>] <tag> '<num>.<tag>' ":" <message>
-// <PRI>[<TIME>] "[INFO]"<tag> : <message>
-// <PRI>[<TIME>] "------------[ cut here ]------------"   (?)
-// <PRI>[<TIME>] "---[ end trace 3225a3070ca3e4ac ]---"   (?)
-// LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG, LOG_LPR, LOG_NEWS
-// LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP:
-// <PRI+TAG>[<TIME>] (see sys/syslog.h)
-// Observe:
-//  Minimum tag length = 3   NB: drops things like r5:c00bbadf, but allow PM:
-//  Maximum tag words = 2
-//  Maximum tag length = 16  NB: we are thinking of how ugly logcat can get.
-//  Not a Tag if there is no message content.
-//  leading additional spaces means no tag, inherit last tag.
-//  Not a Tag if <tag>: is "ERROR:", "WARNING:", "INFO:" or "CPU:"
-// Drop:
-//  empty messages
-//  messages with ' audit(' in them if auditd is running
-//  logd.klogd:
-// return -1 if message logd.klogd: <signature>
-//
-int LogKlog::log(const char* buf, ssize_t len) {
-    if (auditd && android::strnstr(buf, len, auditStr)) {
-        return 0;
-    }
-
-    const char* p = buf;
-    int pri = parseKernelPrio(p, len);
-
-    log_time now = sniffTime(p, len - (p - buf), false);
-
-    // sniff for start marker
-    const char* start = android::strnstr(p, len - (p - buf), klogdStr);
-    if (start) {
-        uint64_t sig = strtoll(start + strlen(klogdStr), nullptr, 10);
-        if (sig == signature.nsec()) {
-            if (initialized) {
-                enableLogging = true;
-            } else {
-                enableLogging = false;
-            }
-            return -1;
-        }
-        return 0;
-    }
-
-    if (!enableLogging) {
-        return 0;
-    }
-
-    // Parse pid, tid and uid
-    const pid_t pid = sniffPid(p, len - (p - buf));
-    const pid_t tid = pid;
-    uid_t uid = AID_ROOT;
-    if (pid) {
-        logbuf->wrlock();
-        uid = logbuf->pidToUid(pid);
-        logbuf->unlock();
-    }
-
-    // Parse (rules at top) to pull out a tag from the incoming kernel message.
-    // Some may view the following as an ugly heuristic, the desire is to
-    // beautify the kernel logs into an Android Logging format; the goal is
-    // admirable but costly.
-    while ((p < &buf[len]) && (isspace(*p) || !*p)) {
-        ++p;
-    }
-    if (p >= &buf[len]) {  // timestamp, no content
-        return 0;
-    }
-    start = p;
-    const char* tag = "";
-    const char* etag = tag;
-    ssize_t taglen = len - (p - buf);
-    const char* bt = p;
-
-    static const char infoBrace[] = "[INFO]";
-    static const ssize_t infoBraceLen = strlen(infoBrace);
-    if ((taglen >= infoBraceLen) &&
-        !fastcmp<strncmp>(p, infoBrace, infoBraceLen)) {
-        // <PRI>[<TIME>] "[INFO]"<tag> ":" message
-        bt = p + infoBraceLen;
-        taglen -= infoBraceLen;
-    }
-
-    const char* et;
-    for (et = bt; (taglen > 0) && *et && (*et != ':') && !isspace(*et);
-         ++et, --taglen) {
-        // skip ':' within [ ... ]
-        if (*et == '[') {
-            while ((taglen > 0) && *et && *et != ']') {
-                ++et;
-                --taglen;
-            }
-            if (taglen <= 0) {
-                break;
-            }
-        }
-    }
-    const char* cp;
-    for (cp = et; (taglen > 0) && isspace(*cp); ++cp, --taglen) {
-    }
-
-    // Validate tag
-    ssize_t size = et - bt;
-    if ((taglen > 0) && (size > 0)) {
-        if (*cp == ':') {
-            // ToDo: handle case insensitive colon separated logging stutter:
-            //       <tag> : <tag>: ...
-
-            // One Word
-            tag = bt;
-            etag = et;
-            p = cp + 1;
-        } else if ((taglen > size) && (tolower(*bt) == tolower(*cp))) {
-            // clean up any tag stutter
-            if (!fastcmp<strncasecmp>(bt + 1, cp + 1, size - 1)) {  // no match
-                // <PRI>[<TIME>] <tag> <tag> : message
-                // <PRI>[<TIME>] <tag> <tag>: message
-                // <PRI>[<TIME>] <tag> '<tag>.<num>' : message
-                // <PRI>[<TIME>] <tag> '<tag><num>' : message
-                // <PRI>[<TIME>] <tag> '<tag><stuff>' : message
-                const char* b = cp;
-                cp += size;
-                taglen -= size;
-                while ((--taglen > 0) && !isspace(*++cp) && (*cp != ':')) {
-                }
-                const char* e;
-                for (e = cp; (taglen > 0) && isspace(*cp); ++cp, --taglen) {
-                }
-                if ((taglen > 0) && (*cp == ':')) {
-                    tag = b;
-                    etag = e;
-                    p = cp + 1;
-                }
-            } else {
-                // what about <PRI>[<TIME>] <tag>_host '<tag><stuff>' : message
-                static const char host[] = "_host";
-                static const ssize_t hostlen = strlen(host);
-                if ((size > hostlen) &&
-                    !fastcmp<strncmp>(bt + size - hostlen, host, hostlen) &&
-                    !fastcmp<strncmp>(bt + 1, cp + 1, size - hostlen - 1)) {
-                    const char* b = cp;
-                    cp += size - hostlen;
-                    taglen -= size - hostlen;
-                    if (*cp == '.') {
-                        while ((--taglen > 0) && !isspace(*++cp) &&
-                               (*cp != ':')) {
-                        }
-                        const char* e;
-                        for (e = cp; (taglen > 0) && isspace(*cp);
-                             ++cp, --taglen) {
-                        }
-                        if ((taglen > 0) && (*cp == ':')) {
-                            tag = b;
-                            etag = e;
-                            p = cp + 1;
-                        }
-                    }
-                } else {
-                    goto twoWord;
-                }
-            }
-        } else {
-        // <PRI>[<TIME>] <tag> <stuff>' : message
-        twoWord:
-            while ((--taglen > 0) && !isspace(*++cp) && (*cp != ':')) {
-            }
-            const char* e;
-            for (e = cp; (taglen > 0) && isspace(*cp); ++cp, --taglen) {
-            }
-            // Two words
-            if ((taglen > 0) && (*cp == ':')) {
-                tag = bt;
-                etag = e;
-                p = cp + 1;
-            }
-        }
-    }  // else no tag
-
-    static const char cpu[] = "CPU";
-    static const ssize_t cpuLen = strlen(cpu);
-    static const char warning[] = "WARNING";
-    static const ssize_t warningLen = strlen(warning);
-    static const char error[] = "ERROR";
-    static const ssize_t errorLen = strlen(error);
-    static const char info[] = "INFO";
-    static const ssize_t infoLen = strlen(info);
-
-    size = etag - tag;
-    if ((size <= 1) ||
-        // register names like x9
-        ((size == 2) && (isdigit(tag[0]) || isdigit(tag[1]))) ||
-        // register names like x18 but not driver names like en0
-        ((size == 3) && (isdigit(tag[1]) && isdigit(tag[2]))) ||
-        // blacklist
-        ((size == cpuLen) && !fastcmp<strncmp>(tag, cpu, cpuLen)) ||
-        ((size == warningLen) &&
-         !fastcmp<strncasecmp>(tag, warning, warningLen)) ||
-        ((size == errorLen) && !fastcmp<strncasecmp>(tag, error, errorLen)) ||
-        ((size == infoLen) && !fastcmp<strncasecmp>(tag, info, infoLen))) {
-        p = start;
-        etag = tag = "";
-    }
-
-    // Suppress additional stutter in tag:
-    //   eg: [143:healthd]healthd -> [143:healthd]
-    taglen = etag - tag;
-    // Mediatek-special printk induced stutter
-    const char* mp = strnrchr(tag, taglen, ']');
-    if (mp && (++mp < etag)) {
-        ssize_t s = etag - mp;
-        if (((s + s) < taglen) && !fastcmp<memcmp>(mp, mp - 1 - s, s)) {
-            taglen = mp - tag;
-        }
-    }
-    // Deal with sloppy and simplistic harmless p = cp + 1 etc above.
-    if (len < (p - buf)) {
-        p = &buf[len];
-    }
-    // skip leading space
-    while ((p < &buf[len]) && (isspace(*p) || !*p)) {
-        ++p;
-    }
-    // truncate trailing space or nuls
-    ssize_t b = len - (p - buf);
-    while ((b > 0) && (isspace(p[b - 1]) || !p[b - 1])) {
-        --b;
-    }
-    // trick ... allow tag with empty content to be logged. log() drops empty
-    if ((b <= 0) && (taglen > 0)) {
-        p = " ";
-        b = 1;
-    }
-    // paranoid sanity check, can not happen ...
-    if (b > LOGGER_ENTRY_MAX_PAYLOAD) {
-        b = LOGGER_ENTRY_MAX_PAYLOAD;
-    }
-    if (taglen > LOGGER_ENTRY_MAX_PAYLOAD) {
-        taglen = LOGGER_ENTRY_MAX_PAYLOAD;
-    }
-    // calculate buffer copy requirements
-    ssize_t n = 1 + taglen + 1 + b + 1;
-    // paranoid sanity check, first two just can not happen ...
-    if ((taglen > n) || (b > n) || (n > (ssize_t)USHRT_MAX) || (n <= 0)) {
-        return -EINVAL;
-    }
-
-    // Careful.
-    // We are using the stack to house the log buffer for speed reasons.
-    // If we malloc'd this buffer, we could get away without n's USHRT_MAX
-    // test above, but we would then required a max(n, USHRT_MAX) as
-    // truncating length argument to logbuf->log() below. Gain is protection
-    // of stack sanity and speedup, loss is truncated long-line content.
-    char newstr[n];
-    char* np = newstr;
-
-    // Convert priority into single-byte Android logger priority
-    *np = convertKernelPrioToAndroidPrio(pri);
-    ++np;
-
-    // Copy parsed tag following priority
-    memcpy(np, tag, taglen);
-    np += taglen;
-    *np = '\0';
-    ++np;
-
-    // Copy main message to the remainder
-    memcpy(np, p, b);
-    np[b] = '\0';
-
-    if (!isMonotonic()) {
-        // Watch out for singular race conditions with timezone causing near
-        // integer quarter-hour jumps in the time and compensate accordingly.
-        // Entries will be temporal within near_seconds * 2. b/21868540
-        static uint32_t vote_time[3];
-        vote_time[2] = vote_time[1];
-        vote_time[1] = vote_time[0];
-        vote_time[0] = now.tv_sec;
-
-        if (vote_time[1] && vote_time[2]) {
-            static const unsigned near_seconds = 10;
-            static const unsigned timezones_seconds = 900;
-            int diff0 = (vote_time[0] - vote_time[1]) / near_seconds;
-            unsigned abs0 = (diff0 < 0) ? -diff0 : diff0;
-            int diff1 = (vote_time[1] - vote_time[2]) / near_seconds;
-            unsigned abs1 = (diff1 < 0) ? -diff1 : diff1;
-            if ((abs1 <= 1) &&  // last two were in agreement on timezone
-                ((abs0 + 1) % (timezones_seconds / near_seconds)) <= 2) {
-                abs0 = (abs0 + 1) / (timezones_seconds / near_seconds) *
-                       timezones_seconds;
-                now.tv_sec -= (diff0 < 0) ? -abs0 : abs0;
-            }
-        }
-    }
-
-    // Log message
-    int rc = logbuf->log(LOG_ID_KERNEL, now, uid, pid, tid, newstr, (uint16_t)n);
-
-    // notify readers
-    if (rc > 0) {
-        reader->notifyNewLog(static_cast<log_mask_t>(1 << LOG_ID_KERNEL));
-    }
-
-    return rc;
-}
diff --git a/logd/LogKlog.h b/logd/LogKlog.h
deleted file mode 100644
index 6bfd6a8..0000000
--- a/logd/LogKlog.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LOGD_LOG_KLOG_H__
-#define _LOGD_LOG_KLOG_H__
-
-#include <private/android_logger.h>
-#include <sysutils/SocketListener.h>
-
-class LogBuffer;
-class LogReader;
-
-class LogKlog : public SocketListener {
-    LogBuffer* logbuf;
-    LogReader* reader;
-    const log_time signature;
-    // Set once thread is started, separates KLOG_ACTION_READ_ALL
-    // and KLOG_ACTION_READ phases.
-    bool initialized;
-    // Used during each of the above phases to control logging.
-    bool enableLogging;
-    // set if we are also running auditd, to filter out audit reports from
-    // our copy of the kernel log
-    bool auditd;
-
-    static log_time correction;
-
-   public:
-    LogKlog(LogBuffer* buf, LogReader* reader, int fdWrite, int fdRead,
-            bool auditd);
-    int log(const char* buf, ssize_t len);
-    void synchronize(const char* buf, ssize_t len);
-
-    bool isMonotonic() {
-        return logbuf->isMonotonic();
-    }
-    static void convertMonotonicToReal(log_time& real) {
-        real += correction;
-    }
-    static void convertRealToMonotonic(log_time& real) {
-        real -= correction;
-    }
-
-   protected:
-     log_time sniffTime(const char*& buf, ssize_t len, bool reverse);
-     pid_t sniffPid(const char*& buf, ssize_t len);
-     void calculateCorrection(const log_time& monotonic, const char* real_string, ssize_t len);
-     virtual bool onDataAvailable(SocketClient* cli);
-};
-
-#endif
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
deleted file mode 100644
index ba61042..0000000
--- a/logd/LogListener.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#include <limits.h>
-#include <sys/cdefs.h>
-#include <sys/prctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-#include <cutils/sockets.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-
-#include "LogBuffer.h"
-#include "LogListener.h"
-#include "LogUtils.h"
-
-LogListener::LogListener(LogBuffer* buf, LogReader* reader)
-    : SocketListener(getLogSocket(), false), logbuf(buf), reader(reader) {}
-
-bool LogListener::onDataAvailable(SocketClient* cli) {
-    static bool name_set;
-    if (!name_set) {
-        prctl(PR_SET_NAME, "logd.writer");
-        name_set = true;
-    }
-
-    // + 1 to ensure null terminator if MAX_PAYLOAD buffer is received
-    char buffer[sizeof(android_log_header_t) + LOGGER_ENTRY_MAX_PAYLOAD + 1];
-    struct iovec iov = { buffer, sizeof(buffer) - 1 };
-
-    alignas(4) char control[CMSG_SPACE(sizeof(struct ucred))];
-    struct msghdr hdr = {
-        nullptr, 0, &iov, 1, control, sizeof(control), 0,
-    };
-
-    int socket = cli->getSocket();
-
-    // To clear the entire buffer is secure/safe, but this contributes to 1.68%
-    // overhead under logging load. We are safe because we check counts, but
-    // still need to clear null terminator
-    // memset(buffer, 0, sizeof(buffer));
-    ssize_t n = recvmsg(socket, &hdr, 0);
-    if (n <= (ssize_t)(sizeof(android_log_header_t))) {
-        return false;
-    }
-
-    buffer[n] = 0;
-
-    struct ucred* cred = nullptr;
-
-    struct cmsghdr* cmsg = CMSG_FIRSTHDR(&hdr);
-    while (cmsg != nullptr) {
-        if (cmsg->cmsg_level == SOL_SOCKET &&
-            cmsg->cmsg_type == SCM_CREDENTIALS) {
-            cred = (struct ucred*)CMSG_DATA(cmsg);
-            break;
-        }
-        cmsg = CMSG_NXTHDR(&hdr, cmsg);
-    }
-
-    if (cred == nullptr) {
-        return false;
-    }
-
-    if (cred->uid == AID_LOGD) {
-        // ignore log messages we send to ourself.
-        // Such log messages are often generated by libraries we depend on
-        // which use standard Android logging.
-        return false;
-    }
-
-    android_log_header_t* header =
-        reinterpret_cast<android_log_header_t*>(buffer);
-    log_id_t logId = static_cast<log_id_t>(header->id);
-    if (/* logId < LOG_ID_MIN || */ logId >= LOG_ID_MAX ||
-        logId == LOG_ID_KERNEL) {
-        return false;
-    }
-
-    if ((logId == LOG_ID_SECURITY) &&
-        (!__android_log_security() ||
-         !clientHasLogCredentials(cred->uid, cred->gid, cred->pid))) {
-        return false;
-    }
-
-    char* msg = ((char*)buffer) + sizeof(android_log_header_t);
-    n -= sizeof(android_log_header_t);
-
-    // NB: hdr.msg_flags & MSG_TRUNC is not tested, silently passing a
-    // truncated message to the logs.
-
-    int res = logbuf->log(logId, header->realtime, cred->uid, cred->pid, header->tid, msg,
-                          ((size_t)n <= UINT16_MAX) ? (uint16_t)n : UINT16_MAX);
-    if (res > 0) {
-        reader->notifyNewLog(static_cast<log_mask_t>(1 << logId));
-    }
-
-    return true;
-}
-
-int LogListener::getLogSocket() {
-    static const char socketName[] = "logdw";
-    int sock = android_get_control_socket(socketName);
-
-    if (sock < 0) {  // logd started up in init.sh
-        sock = socket_local_server(
-            socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_DGRAM);
-
-        int on = 1;
-        if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) {
-            return -1;
-        }
-    }
-    return sock;
-}
diff --git a/logd/LogListener.h b/logd/LogListener.h
deleted file mode 100644
index 8fe3da4..0000000
--- a/logd/LogListener.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012-2013 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.
- */
-
-#ifndef _LOGD_LOG_LISTENER_H__
-#define _LOGD_LOG_LISTENER_H__
-
-#include <sysutils/SocketListener.h>
-#include "LogReader.h"
-
-class LogListener : public SocketListener {
-    LogBuffer* logbuf;
-    LogReader* reader;
-
-   public:
-     LogListener(LogBuffer* buf, LogReader* reader);
-
-   protected:
-    virtual bool onDataAvailable(SocketClient* cli);
-
-   private:
-    static int getLogSocket();
-};
-
-#endif
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
deleted file mode 100644
index 9db8c00..0000000
--- a/logd/LogReader.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (C) 2012-2013 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.
- */
-
-#include <ctype.h>
-#include <inttypes.h>
-#include <poll.h>
-#include <sys/prctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include <cutils/sockets.h>
-#include <private/android_logger.h>
-
-#include "FlushCommand.h"
-#include "LogBuffer.h"
-#include "LogBufferElement.h"
-#include "LogReader.h"
-#include "LogUtils.h"
-
-LogReader::LogReader(LogBuffer* logbuf)
-    : SocketListener(getLogSocket(), true), mLogbuf(*logbuf) {
-}
-
-// When we are notified a new log entry is available, inform
-// listening sockets who are watching this entry's log id.
-void LogReader::notifyNewLog(log_mask_t logMask) {
-    FlushCommand command(*this, logMask);
-    runOnEachSocket(&command);
-}
-
-// Note returning false will release the SocketClient instance.
-bool LogReader::onDataAvailable(SocketClient* cli) {
-    static bool name_set;
-    if (!name_set) {
-        prctl(PR_SET_NAME, "logd.reader");
-        name_set = true;
-    }
-
-    char buffer[255];
-
-    int len = read(cli->getSocket(), buffer, sizeof(buffer) - 1);
-    if (len <= 0) {
-        doSocketDelete(cli);
-        return false;
-    }
-    buffer[len] = '\0';
-
-    // Clients are only allowed to send one command, disconnect them if they
-    // send another.
-    LogTimeEntry::wrlock();
-    for (const auto& entry : mLogbuf.mTimes) {
-        if (entry->mClient == cli) {
-            entry->release_Locked();
-            LogTimeEntry::unlock();
-            return false;
-        }
-    }
-    LogTimeEntry::unlock();
-
-    unsigned long tail = 0;
-    static const char _tail[] = " tail=";
-    char* cp = strstr(buffer, _tail);
-    if (cp) {
-        tail = atol(cp + sizeof(_tail) - 1);
-    }
-
-    log_time start(log_time::EPOCH);
-    static const char _start[] = " start=";
-    cp = strstr(buffer, _start);
-    if (cp) {
-        // Parse errors will result in current time
-        start.strptime(cp + sizeof(_start) - 1, "%s.%q");
-    }
-
-    uint64_t timeout = 0;
-    static const char _timeout[] = " timeout=";
-    cp = strstr(buffer, _timeout);
-    if (cp) {
-        timeout = atol(cp + sizeof(_timeout) - 1) * NS_PER_SEC +
-                  log_time(CLOCK_REALTIME).nsec();
-    }
-
-    unsigned int logMask = -1;
-    static const char _logIds[] = " lids=";
-    cp = strstr(buffer, _logIds);
-    if (cp) {
-        logMask = 0;
-        cp += sizeof(_logIds) - 1;
-        while (*cp && *cp != '\0') {
-            int val = 0;
-            while (isdigit(*cp)) {
-                val = val * 10 + *cp - '0';
-                ++cp;
-            }
-            logMask |= 1 << val;
-            if (*cp != ',') {
-                break;
-            }
-            ++cp;
-        }
-    }
-
-    pid_t pid = 0;
-    static const char _pid[] = " pid=";
-    cp = strstr(buffer, _pid);
-    if (cp) {
-        pid = atol(cp + sizeof(_pid) - 1);
-    }
-
-    bool nonBlock = false;
-    if (!fastcmp<strncmp>(buffer, "dumpAndClose", 12)) {
-        // Allow writer to get some cycles, and wait for pending notifications
-        sched_yield();
-        LogTimeEntry::wrlock();
-        LogTimeEntry::unlock();
-        sched_yield();
-        nonBlock = true;
-    }
-
-    log_time sequence = start;
-    //
-    // This somewhat expensive data validation operation is required
-    // for non-blocking, with timeout.  The incoming timestamp must be
-    // in range of the list, if not, return immediately.  This is
-    // used to prevent us from from getting stuck in timeout processing
-    // with an invalid time.
-    //
-    // Find if time is really present in the logs, monotonic or real, implicit
-    // conversion from monotonic or real as necessary to perform the check.
-    // Exit in the check loop ASAP as you find a transition from older to
-    // newer, but use the last entry found to ensure overlap.
-    //
-    if (nonBlock && (sequence != log_time::EPOCH) && timeout) {
-        class LogFindStart {  // A lambda by another name
-           private:
-            const pid_t mPid;
-            const unsigned mLogMask;
-            bool mStartTimeSet;
-            log_time mStart;
-            log_time& mSequence;
-            log_time mLast;
-            bool mIsMonotonic;
-
-           public:
-            LogFindStart(pid_t pid, unsigned logMask, log_time& sequence,
-                         bool isMonotonic)
-                : mPid(pid),
-                  mLogMask(logMask),
-                  mStartTimeSet(false),
-                  mStart(sequence),
-                  mSequence(sequence),
-                  mLast(sequence),
-                  mIsMonotonic(isMonotonic) {
-            }
-
-            static int callback(const LogBufferElement* element, void* obj) {
-                LogFindStart* me = reinterpret_cast<LogFindStart*>(obj);
-                if ((!me->mPid || (me->mPid == element->getPid())) &&
-                    (me->mLogMask & (1 << element->getLogId()))) {
-                    log_time real = element->getRealTime();
-                    if (me->mStart == real) {
-                        me->mSequence = real;
-                        me->mStartTimeSet = true;
-                        return -1;
-                    } else if (!me->mIsMonotonic || android::isMonotonic(real)) {
-                        if (me->mStart < real) {
-                            me->mSequence = me->mLast;
-                            me->mStartTimeSet = true;
-                            return -1;
-                        }
-                        me->mLast = real;
-                    } else {
-                        me->mLast = real;
-                    }
-                }
-                return false;
-            }
-
-            bool found() {
-                return mStartTimeSet;
-            }
-
-        } logFindStart(pid, logMask, sequence,
-                       logbuf().isMonotonic() && android::isMonotonic(start));
-
-        logbuf().flushTo(cli, sequence, nullptr, FlushCommand::hasReadLogs(cli),
-                         FlushCommand::hasSecurityLogs(cli),
-                         logFindStart.callback, &logFindStart);
-
-        if (!logFindStart.found()) {
-            doSocketDelete(cli);
-            return false;
-        }
-    }
-
-    android::prdebug(
-        "logdr: UID=%d GID=%d PID=%d %c tail=%lu logMask=%x pid=%d "
-        "start=%" PRIu64 "ns timeout=%" PRIu64 "ns\n",
-        cli->getUid(), cli->getGid(), cli->getPid(), nonBlock ? 'n' : 'b', tail,
-        logMask, (int)pid, sequence.nsec(), timeout);
-
-    if (sequence == log_time::EPOCH) {
-        timeout = 0;
-    }
-
-    LogTimeEntry::wrlock();
-    auto entry = std::make_unique<LogTimeEntry>(
-        *this, cli, nonBlock, tail, logMask, pid, sequence, timeout);
-    if (!entry->startReader_Locked()) {
-        LogTimeEntry::unlock();
-        return false;
-    }
-
-    // release client and entry reference counts once done
-    cli->incRef();
-    mLogbuf.mTimes.emplace_front(std::move(entry));
-
-    // Set acceptable upper limit to wait for slow reader processing b/27242723
-    struct timeval t = { LOGD_SNDTIMEO, 0 };
-    setsockopt(cli->getSocket(), SOL_SOCKET, SO_SNDTIMEO, (const char*)&t,
-               sizeof(t));
-
-    LogTimeEntry::unlock();
-
-    return true;
-}
-
-void LogReader::doSocketDelete(SocketClient* cli) {
-    LastLogTimes& times = mLogbuf.mTimes;
-    LogTimeEntry::wrlock();
-    LastLogTimes::iterator it = times.begin();
-    while (it != times.end()) {
-        LogTimeEntry* entry = it->get();
-        if (entry->mClient == cli) {
-            entry->release_Locked();
-            break;
-        }
-        it++;
-    }
-    LogTimeEntry::unlock();
-}
-
-int LogReader::getLogSocket() {
-    static const char socketName[] = "logdr";
-    int sock = android_get_control_socket(socketName);
-
-    if (sock < 0) {
-        sock = socket_local_server(
-            socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_SEQPACKET);
-    }
-
-    return sock;
-}
diff --git a/logd/LogReader.h b/logd/LogReader.h
deleted file mode 100644
index b5312b6..0000000
--- a/logd/LogReader.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2012-2013 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.
- */
-
-#ifndef _LOGD_LOG_WRITER_H__
-#define _LOGD_LOG_WRITER_H__
-
-#include <sysutils/SocketListener.h>
-
-#include "LogTimes.h"
-
-#define LOGD_SNDTIMEO 32
-
-class LogBuffer;
-
-class LogReader : public SocketListener {
-    LogBuffer& mLogbuf;
-
-   public:
-    explicit LogReader(LogBuffer* logbuf);
-    void notifyNewLog(log_mask_t logMask);
-
-    LogBuffer& logbuf(void) const {
-        return mLogbuf;
-    }
-
-   protected:
-    virtual bool onDataAvailable(SocketClient* cli);
-
-   private:
-    static int getLogSocket();
-
-    void doSocketDelete(SocketClient* cli);
-};
-
-#endif
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
deleted file mode 100644
index 431b778..0000000
--- a/logd/LogStatistics.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <ctype.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <list>
-
-#include <private/android_logger.h>
-
-#include "LogStatistics.h"
-
-static const uint64_t hourSec = 60 * 60;
-static const uint64_t monthSec = 31 * 24 * hourSec;
-
-size_t LogStatistics::SizesTotal;
-
-LogStatistics::LogStatistics() : enable(false) {
-    log_time now(CLOCK_REALTIME);
-    log_id_for_each(id) {
-        mSizes[id] = 0;
-        mElements[id] = 0;
-        mDroppedElements[id] = 0;
-        mSizesTotal[id] = 0;
-        mElementsTotal[id] = 0;
-        mOldest[id] = now;
-        mNewest[id] = now;
-        mNewestDropped[id] = now;
-    }
-}
-
-namespace android {
-
-size_t sizesTotal() {
-    return LogStatistics::sizesTotal();
-}
-
-// caller must own and free character string
-char* pidToName(pid_t pid) {
-    char* retval = nullptr;
-    if (pid == 0) {  // special case from auditd/klogd for kernel
-        retval = strdup("logd");
-    } else {
-        char buffer[512];
-        snprintf(buffer, sizeof(buffer), "/proc/%u/cmdline", pid);
-        int fd = open(buffer, O_RDONLY);
-        if (fd >= 0) {
-            ssize_t ret = read(fd, buffer, sizeof(buffer));
-            if (ret > 0) {
-                buffer[sizeof(buffer) - 1] = '\0';
-                // frameworks intermediate state
-                if (fastcmp<strcmp>(buffer, "<pre-initialized>")) {
-                    retval = strdup(buffer);
-                }
-            }
-            close(fd);
-        }
-    }
-    return retval;
-}
-}
-
-void LogStatistics::addTotal(LogBufferElement* element) {
-    if (element->getDropped()) return;
-
-    log_id_t log_id = element->getLogId();
-    uint16_t size = element->getMsgLen();
-    mSizesTotal[log_id] += size;
-    SizesTotal += size;
-    ++mElementsTotal[log_id];
-}
-
-void LogStatistics::add(LogBufferElement* element) {
-    log_id_t log_id = element->getLogId();
-    uint16_t size = element->getMsgLen();
-    mSizes[log_id] += size;
-    ++mElements[log_id];
-
-    // When caller adding a chatty entry, they will have already
-    // called add() and subtract() for each entry as they are
-    // evaluated and trimmed, thus recording size and number of
-    // elements, but we must recognize the manufactured dropped
-    // entry as not contributing to the lifetime totals.
-    if (element->getDropped()) {
-        ++mDroppedElements[log_id];
-    } else {
-        mSizesTotal[log_id] += size;
-        SizesTotal += size;
-        ++mElementsTotal[log_id];
-    }
-
-    log_time stamp(element->getRealTime());
-    if (mNewest[log_id] < stamp) {
-        // A major time update invalidates the statistics :-(
-        log_time diff = stamp - mNewest[log_id];
-        mNewest[log_id] = stamp;
-
-        if (diff.tv_sec > hourSec) {
-            // approximate Do-Your-Best fixup
-            diff += mOldest[log_id];
-            if ((diff > stamp) && ((diff - stamp).tv_sec < hourSec)) {
-                diff = stamp;
-            }
-            if (diff <= stamp) {
-                mOldest[log_id] = diff;
-                if (mNewestDropped[log_id] < diff) {
-                    mNewestDropped[log_id] = diff;
-                }
-            }
-        }
-    }
-
-    if (log_id == LOG_ID_KERNEL) {
-        return;
-    }
-
-    uidTable[log_id].add(element->getUid(), element);
-    if (element->getUid() == AID_SYSTEM) {
-        pidSystemTable[log_id].add(element->getPid(), element);
-    }
-
-    if (!enable) {
-        return;
-    }
-
-    pidTable.add(element->getPid(), element);
-    tidTable.add(element->getTid(), element);
-
-    uint32_t tag = element->getTag();
-    if (tag) {
-        if (log_id == LOG_ID_SECURITY) {
-            securityTagTable.add(tag, element);
-        } else {
-            tagTable.add(tag, element);
-        }
-    }
-
-    if (!element->getDropped()) {
-        tagNameTable.add(TagNameKey(element), element);
-    }
-}
-
-void LogStatistics::subtract(LogBufferElement* element) {
-    log_id_t log_id = element->getLogId();
-    uint16_t size = element->getMsgLen();
-    mSizes[log_id] -= size;
-    --mElements[log_id];
-    if (element->getDropped()) {
-        --mDroppedElements[log_id];
-    }
-
-    if (mOldest[log_id] < element->getRealTime()) {
-        mOldest[log_id] = element->getRealTime();
-    }
-
-    if (log_id == LOG_ID_KERNEL) {
-        return;
-    }
-
-    uidTable[log_id].subtract(element->getUid(), element);
-    if (element->getUid() == AID_SYSTEM) {
-        pidSystemTable[log_id].subtract(element->getPid(), element);
-    }
-
-    if (!enable) {
-        return;
-    }
-
-    pidTable.subtract(element->getPid(), element);
-    tidTable.subtract(element->getTid(), element);
-
-    uint32_t tag = element->getTag();
-    if (tag) {
-        if (log_id == LOG_ID_SECURITY) {
-            securityTagTable.subtract(tag, element);
-        } else {
-            tagTable.subtract(tag, element);
-        }
-    }
-
-    if (!element->getDropped()) {
-        tagNameTable.subtract(TagNameKey(element), element);
-    }
-}
-
-// Atomically set an entry to drop
-// entry->setDropped(1) must follow this call, caller should do this explicitly.
-void LogStatistics::drop(LogBufferElement* element) {
-    log_id_t log_id = element->getLogId();
-    uint16_t size = element->getMsgLen();
-    mSizes[log_id] -= size;
-    ++mDroppedElements[log_id];
-
-    if (mNewestDropped[log_id] < element->getRealTime()) {
-        mNewestDropped[log_id] = element->getRealTime();
-    }
-
-    uidTable[log_id].drop(element->getUid(), element);
-    if (element->getUid() == AID_SYSTEM) {
-        pidSystemTable[log_id].drop(element->getPid(), element);
-    }
-
-    if (!enable) {
-        return;
-    }
-
-    pidTable.drop(element->getPid(), element);
-    tidTable.drop(element->getTid(), element);
-
-    uint32_t tag = element->getTag();
-    if (tag) {
-        if (log_id == LOG_ID_SECURITY) {
-            securityTagTable.drop(tag, element);
-        } else {
-            tagTable.drop(tag, element);
-        }
-    }
-
-    tagNameTable.subtract(TagNameKey(element), element);
-}
-
-// caller must own and free character string
-// Requires parent LogBuffer::wrlock() to be held
-const char* LogStatistics::uidToName(uid_t uid) const {
-    // Local hard coded favourites
-    if (uid == AID_LOGD) {
-        return strdup("auditd");
-    }
-
-    // Android system
-    if (uid < AID_APP) {
-        // in bionic, thread safe as long as we copy the results
-        struct passwd* pwd = getpwuid(uid);
-        if (pwd) {
-            return strdup(pwd->pw_name);
-        }
-    }
-
-    // Parse /data/system/packages.list
-    uid_t userId = uid % AID_USER_OFFSET;
-    const char* name = android::uidToName(userId);
-    if (!name && (userId > (AID_SHARED_GID_START - AID_APP))) {
-        name = android::uidToName(userId - (AID_SHARED_GID_START - AID_APP));
-    }
-    if (name) {
-        return name;
-    }
-
-    // Android application
-    if (uid >= AID_APP) {
-        struct passwd* pwd = getpwuid(uid);
-        if (pwd) {
-            return strdup(pwd->pw_name);
-        }
-    }
-
-    // report uid -> pid(s) -> pidToName if unique
-    for (pidTable_t::const_iterator it = pidTable.begin(); it != pidTable.end();
-         ++it) {
-        const PidEntry& entry = it->second;
-
-        if (entry.getUid() == uid) {
-            const char* nameTmp = entry.getName();
-
-            if (nameTmp) {
-                if (!name) {
-                    name = strdup(nameTmp);
-                } else if (fastcmp<strcmp>(name, nameTmp)) {
-                    free(const_cast<char*>(name));
-                    name = nullptr;
-                    break;
-                }
-            }
-        }
-    }
-
-    // No one
-    return name;
-}
-
-std::string UidEntry::formatHeader(const std::string& name, log_id_t id) const {
-    bool isprune = worstUidEnabledForLogid(id);
-    return formatLine(android::base::StringPrintf(name.c_str(),
-                                                  android_log_id_to_name(id)),
-                      std::string("Size"),
-                      std::string(isprune ? "+/-  Pruned" : "")) +
-           formatLine(std::string("UID   PACKAGE"), std::string("BYTES"),
-                      std::string(isprune ? "NUM" : ""));
-}
-
-// Helper to truncate name, if too long, and add name dressings
-static void formatTmp(const LogStatistics& stat, const char* nameTmp, uid_t uid,
-                      std::string& name, std::string& size, size_t nameLen) {
-    const char* allocNameTmp = nullptr;
-    if (!nameTmp) nameTmp = allocNameTmp = stat.uidToName(uid);
-    if (nameTmp) {
-        size_t lenSpace = std::max(nameLen - name.length(), (size_t)1);
-        size_t len = EntryBaseConstants::total_len -
-                     EntryBaseConstants::pruned_len - size.length() -
-                     name.length() - lenSpace - 2;
-        size_t lenNameTmp = strlen(nameTmp);
-        while ((len < lenNameTmp) && (lenSpace > 1)) {
-            ++len;
-            --lenSpace;
-        }
-        name += android::base::StringPrintf("%*s", (int)lenSpace, "");
-        if (len < lenNameTmp) {
-            name += "...";
-            nameTmp += lenNameTmp - std::max(len - 3, (size_t)1);
-        }
-        name += nameTmp;
-        free(const_cast<char*>(allocNameTmp));
-    }
-}
-
-std::string UidEntry::format(const LogStatistics& stat, log_id_t id) const {
-    uid_t uid = getUid();
-    std::string name = android::base::StringPrintf("%u", uid);
-    std::string size = android::base::StringPrintf("%zu", getSizes());
-
-    formatTmp(stat, nullptr, uid, name, size, 6);
-
-    std::string pruned = "";
-    if (worstUidEnabledForLogid(id)) {
-        size_t totalDropped = 0;
-        for (LogStatistics::uidTable_t::const_iterator it =
-                 stat.uidTable[id].begin();
-             it != stat.uidTable[id].end(); ++it) {
-            totalDropped += it->second.getDropped();
-        }
-        size_t sizes = stat.sizes(id);
-        size_t totalSize = stat.sizesTotal(id);
-        size_t totalElements = stat.elementsTotal(id);
-        float totalVirtualSize =
-            (float)sizes + (float)totalDropped * totalSize / totalElements;
-        size_t entrySize = getSizes();
-        float virtualEntrySize = entrySize;
-        int realPermille = virtualEntrySize * 1000.0 / sizes;
-        size_t dropped = getDropped();
-        if (dropped) {
-            pruned = android::base::StringPrintf("%zu", dropped);
-            virtualEntrySize += (float)dropped * totalSize / totalElements;
-        }
-        int virtualPermille = virtualEntrySize * 1000.0 / totalVirtualSize;
-        int permille =
-            (realPermille - virtualPermille) * 1000L / (virtualPermille ?: 1);
-        if ((permille < -1) || (1 < permille)) {
-            std::string change;
-            const char* units = "%";
-            const char* prefix = (permille > 0) ? "+" : "";
-
-            if (permille > 999) {
-                permille = (permille + 1000) / 100;  // Now tenths fold
-                units = "X";
-                prefix = "";
-            }
-            if ((-99 < permille) && (permille < 99)) {
-                change = android::base::StringPrintf(
-                    "%s%d.%u%s", prefix, permille / 10,
-                    ((permille < 0) ? (-permille % 10) : (permille % 10)),
-                    units);
-            } else {
-                change = android::base::StringPrintf(
-                    "%s%d%s", prefix, (permille + 5) / 10, units);
-            }
-            ssize_t spaces = EntryBaseConstants::pruned_len - 2 -
-                             pruned.length() - change.length();
-            if ((spaces <= 0) && pruned.length()) {
-                spaces = 1;
-            }
-            if (spaces > 0) {
-                change += android::base::StringPrintf("%*s", (int)spaces, "");
-            }
-            pruned = change + pruned;
-        }
-    }
-
-    std::string output = formatLine(name, size, pruned);
-
-    if (uid != AID_SYSTEM) {
-        return output;
-    }
-
-    static const size_t maximum_sorted_entries = 32;
-    std::unique_ptr<const PidEntry* []> sorted =
-        stat.pidSystemTable[id].sort(uid, (pid_t)0, maximum_sorted_entries);
-
-    if (!sorted.get()) {
-        return output;
-    }
-    std::string byPid;
-    size_t index;
-    bool hasDropped = false;
-    for (index = 0; index < maximum_sorted_entries; ++index) {
-        const PidEntry* entry = sorted[index];
-        if (!entry) {
-            break;
-        }
-        if (entry->getSizes() <= (getSizes() / 100)) {
-            break;
-        }
-        if (entry->getDropped()) {
-            hasDropped = true;
-        }
-        byPid += entry->format(stat, id);
-    }
-    if (index > 1) {  // print this only if interesting
-        std::string ditto("\" ");
-        output += formatLine(std::string("  PID/UID   COMMAND LINE"), ditto,
-                             hasDropped ? ditto : std::string(""));
-        output += byPid;
-    }
-
-    return output;
-}
-
-std::string PidEntry::formatHeader(const std::string& name,
-                                   log_id_t /* id */) const {
-    return formatLine(name, std::string("Size"), std::string("Pruned")) +
-           formatLine(std::string("  PID/UID   COMMAND LINE"),
-                      std::string("BYTES"), std::string("NUM"));
-}
-
-std::string PidEntry::format(const LogStatistics& stat,
-                             log_id_t /* id */) const {
-    uid_t uid = getUid();
-    pid_t pid = getPid();
-    std::string name = android::base::StringPrintf("%5u/%u", pid, uid);
-    std::string size = android::base::StringPrintf("%zu", getSizes());
-
-    formatTmp(stat, getName(), uid, name, size, 12);
-
-    std::string pruned = "";
-    size_t dropped = getDropped();
-    if (dropped) {
-        pruned = android::base::StringPrintf("%zu", dropped);
-    }
-
-    return formatLine(name, size, pruned);
-}
-
-std::string TidEntry::formatHeader(const std::string& name,
-                                   log_id_t /* id */) const {
-    return formatLine(name, std::string("Size"), std::string("Pruned")) +
-           formatLine(std::string("  TID/UID   COMM"), std::string("BYTES"),
-                      std::string("NUM"));
-}
-
-std::string TidEntry::format(const LogStatistics& stat,
-                             log_id_t /* id */) const {
-    uid_t uid = getUid();
-    std::string name = android::base::StringPrintf("%5u/%u", getTid(), uid);
-    std::string size = android::base::StringPrintf("%zu", getSizes());
-
-    formatTmp(stat, getName(), uid, name, size, 12);
-
-    std::string pruned = "";
-    size_t dropped = getDropped();
-    if (dropped) {
-        pruned = android::base::StringPrintf("%zu", dropped);
-    }
-
-    return formatLine(name, size, pruned);
-}
-
-std::string TagEntry::formatHeader(const std::string& name, log_id_t id) const {
-    bool isprune = worstUidEnabledForLogid(id);
-    return formatLine(name, std::string("Size"),
-                      std::string(isprune ? "Prune" : "")) +
-           formatLine(std::string("    TAG/UID   TAGNAME"),
-                      std::string("BYTES"), std::string(isprune ? "NUM" : ""));
-}
-
-std::string TagEntry::format(const LogStatistics& /* stat */,
-                             log_id_t /* id */) const {
-    std::string name;
-    uid_t uid = getUid();
-    if (uid == (uid_t)-1) {
-        name = android::base::StringPrintf("%7u", getKey());
-    } else {
-        name = android::base::StringPrintf("%7u/%u", getKey(), uid);
-    }
-    const char* nameTmp = getName();
-    if (nameTmp) {
-        name += android::base::StringPrintf(
-            "%*s%s", (int)std::max(14 - name.length(), (size_t)1), "", nameTmp);
-    }
-
-    std::string size = android::base::StringPrintf("%zu", getSizes());
-
-    std::string pruned = "";
-    size_t dropped = getDropped();
-    if (dropped) {
-        pruned = android::base::StringPrintf("%zu", dropped);
-    }
-
-    return formatLine(name, size, pruned);
-}
-
-std::string TagNameEntry::formatHeader(const std::string& name,
-                                       log_id_t /* id */) const {
-    return formatLine(name, std::string("Size"), std::string("")) +
-           formatLine(std::string("  TID/PID/UID   LOG_TAG NAME"),
-                      std::string("BYTES"), std::string(""));
-}
-
-std::string TagNameEntry::format(const LogStatistics& /* stat */,
-                                 log_id_t /* id */) const {
-    std::string name;
-    pid_t tid = getTid();
-    pid_t pid = getPid();
-    std::string pidstr;
-    if (pid != (pid_t)-1) {
-        pidstr = android::base::StringPrintf("%u", pid);
-        if ((tid != (pid_t)-1) && (tid != pid)) pidstr = "/" + pidstr;
-    }
-    int len = 9 - pidstr.length();
-    if (len < 0) len = 0;
-    if ((tid == (pid_t)-1) || (tid == pid)) {
-        name = android::base::StringPrintf("%*s", len, "");
-    } else {
-        name = android::base::StringPrintf("%*u", len, tid);
-    }
-    name += pidstr;
-    uid_t uid = getUid();
-    if (uid != (uid_t)-1) {
-        name += android::base::StringPrintf("/%u", uid);
-    }
-
-    std::string size = android::base::StringPrintf("%zu", getSizes());
-
-    const char* nameTmp = getName();
-    if (nameTmp) {
-        size_t lenSpace = std::max(16 - name.length(), (size_t)1);
-        size_t len = EntryBaseConstants::total_len -
-                     EntryBaseConstants::pruned_len - size.length() -
-                     name.length() - lenSpace - 2;
-        size_t lenNameTmp = strlen(nameTmp);
-        while ((len < lenNameTmp) && (lenSpace > 1)) {
-            ++len;
-            --lenSpace;
-        }
-        name += android::base::StringPrintf("%*s", (int)lenSpace, "");
-        if (len < lenNameTmp) {
-            name += "...";
-            nameTmp += lenNameTmp - std::max(len - 3, (size_t)1);
-        }
-        name += nameTmp;
-    }
-
-    std::string pruned = "";
-
-    return formatLine(name, size, pruned);
-}
-
-static std::string formatMsec(uint64_t val) {
-    static const unsigned subsecDigits = 3;
-    static const uint64_t sec = MS_PER_SEC;
-
-    static const uint64_t minute = 60 * sec;
-    static const uint64_t hour = 60 * minute;
-    static const uint64_t day = 24 * hour;
-
-    std::string output;
-    if (val < sec) return output;
-
-    if (val >= day) {
-        output = android::base::StringPrintf("%" PRIu64 "d ", val / day);
-        val = (val % day) + day;
-    }
-    if (val >= minute) {
-        if (val >= hour) {
-            output += android::base::StringPrintf("%" PRIu64 ":",
-                                                  (val / hour) % (day / hour));
-        }
-        output += android::base::StringPrintf(
-            (val >= hour) ? "%02" PRIu64 ":" : "%" PRIu64 ":",
-            (val / minute) % (hour / minute));
-    }
-    output +=
-        android::base::StringPrintf((val >= minute) ? "%02" PRIu64 : "%" PRIu64,
-                                    (val / sec) % (minute / sec));
-    val %= sec;
-    unsigned digits = subsecDigits;
-    while (digits && ((val % 10) == 0)) {
-        val /= 10;
-        --digits;
-    }
-    if (digits) {
-        output += android::base::StringPrintf(".%0*" PRIu64, digits, val);
-    }
-    return output;
-}
-
-std::string LogStatistics::format(uid_t uid, pid_t pid,
-                                  unsigned int logMask) const {
-    static const uint16_t spaces_total = 19;
-
-    // Report on total logging, current and for all time
-
-    std::string output = "size/num";
-    size_t oldLength;
-    int16_t spaces = 1;
-
-    log_id_for_each(id) {
-        if (!(logMask & (1 << id))) continue;
-        oldLength = output.length();
-        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, "");
-
-    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;
-        oldLength = output.length();
-        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);
-
-    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;
-
-        size_t els = elements(id);
-        if (els) {
-            oldLength = output.length();
-            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 SpanStr[] = "\nLogspan";
-    spaces = 10 - strlen(SpanStr);
-    output += SpanStr;
-
-    // Total reports the greater of the individual maximum time span, or the
-    // validated minimum start and maximum end time span if it makes sense.
-    uint64_t minTime = UINT64_MAX;
-    uint64_t maxTime = 0;
-    uint64_t maxSpan = 0;
-    totalSize = 0;
-
-    log_id_for_each(id) {
-        if (!(logMask & (1 << id))) continue;
-
-        // validity checking
-        uint64_t oldest = mOldest[id].msec();
-        uint64_t newest = mNewest[id].msec();
-        if (newest <= oldest) {
-            spaces += spaces_total;
-            continue;
-        }
-
-        uint64_t span = newest - oldest;
-        if (span > (monthSec * MS_PER_SEC)) {
-            spaces += spaces_total;
-            continue;
-        }
-
-        // total span
-        if (minTime > oldest) minTime = oldest;
-        if (maxTime < newest) maxTime = newest;
-        if (span > maxSpan) maxSpan = span;
-        totalSize += span;
-
-        uint64_t dropped = mNewestDropped[id].msec();
-        if (dropped < oldest) dropped = oldest;
-        if (dropped > newest) dropped = newest;
-
-        oldLength = output.length();
-        output += android::base::StringPrintf("%*s%s", spaces, "",
-                                              formatMsec(span).c_str());
-        unsigned permille = ((newest - dropped) * 1000 + (span / 2)) / span;
-        if ((permille > 1) && (permille < 999)) {
-            output += android::base::StringPrintf("(%u", permille / 10);
-            permille %= 10;
-            if (permille) {
-                output += android::base::StringPrintf(".%u", permille);
-            }
-            output += android::base::StringPrintf("%%)");
-        }
-        spaces -= output.length() - oldLength;
-        spaces += spaces_total;
-    }
-    if ((maxTime > minTime) && ((maxTime -= minTime) < totalSize) &&
-        (maxTime > maxSpan)) {
-        maxSpan = maxTime;
-    }
-    if (spaces < 0) spaces = 0;
-    output += android::base::StringPrintf("%*s%s", spaces, "",
-                                          formatMsec(maxSpan).c_str());
-
-    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;
-    }
-    totalSize += sizeOf();
-    if (spaces < 0) spaces = 0;
-    output += android::base::StringPrintf("%*s%zu", spaces, "", totalSize);
-
-    // Report on Chattiest
-
-    std::string name;
-
-    // Chattiest by application (UID)
-    log_id_for_each(id) {
-        if (!(logMask & (1 << id))) continue;
-
-        name = (uid == AID_ROOT) ? "Chattiest UIDs in %s log buffer:"
-                                 : "Logging for your UID in %s log buffer:";
-        output += uidTable[id].format(*this, uid, pid, name, id);
-    }
-
-    if (enable) {
-        name = ((uid == AID_ROOT) && !pid) ? "Chattiest PIDs:"
-                                           : "Logging for this PID:";
-        output += pidTable.format(*this, uid, pid, name);
-        name = "Chattiest TIDs";
-        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);
-        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);
-        name += ":";
-        output +=
-            securityTagTable.format(*this, uid, pid, name, LOG_ID_SECURITY);
-    }
-
-    if (enable) {
-        name = "Chattiest TAGs";
-        if (pid) name += android::base::StringPrintf(" for PID %d", pid);
-        name += ":";
-        output += tagNameTable.format(*this, uid, pid, name);
-    }
-
-    return output;
-}
-
-namespace android {
-
-uid_t pidToUid(pid_t pid) {
-    char buffer[512];
-    snprintf(buffer, sizeof(buffer), "/proc/%u/status", pid);
-    FILE* fp = fopen(buffer, "r");
-    if (fp) {
-        while (fgets(buffer, sizeof(buffer), fp)) {
-            int uid = AID_LOGD;
-            char space = 0;
-            if ((sscanf(buffer, "Uid: %d%c", &uid, &space) == 2) &&
-                isspace(space)) {
-                fclose(fp);
-                return uid;
-            }
-        }
-        fclose(fp);
-    }
-    return AID_LOGD;  // associate this with the logger
-}
-}
-
-uid_t LogStatistics::pidToUid(pid_t pid) {
-    return pidTable.add(pid)->second.getUid();
-}
-
-// caller must free character string
-const char* LogStatistics::pidToName(pid_t pid) const {
-    // An inconvenient truth ... getName() can alter the object
-    pidTable_t& writablePidTable = const_cast<pidTable_t&>(pidTable);
-    const char* name = writablePidTable.add(pid)->second.getName();
-    if (!name) {
-        return nullptr;
-    }
-    return strdup(name);
-}
diff --git a/logd/LogStatistics.h b/logd/LogStatistics.h
deleted file mode 100644
index 0782de3..0000000
--- a/logd/LogStatistics.h
+++ /dev/null
@@ -1,790 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LOGD_LOG_STATISTICS_H__
-#define _LOGD_LOG_STATISTICS_H__
-
-#include <ctype.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include <algorithm>  // std::max
-#include <memory>
-#include <string>
-#include <string_view>
-#include <unordered_map>
-
-#include <android-base/stringprintf.h>
-#include <android/log.h>
-#include <log/log_time.h>
-#include <private/android_filesystem_config.h>
-#include <utils/FastStrcmp.h>
-
-#include "LogBufferElement.h"
-#include "LogUtils.h"
-
-#define log_id_for_each(i) \
-    for (log_id_t i = LOG_ID_MIN; (i) < LOG_ID_MAX; (i) = (log_id_t)((i) + 1))
-
-class LogStatistics;
-
-template <typename TKey, typename TEntry>
-class LogHashtable {
-    std::unordered_map<TKey, TEntry> map;
-
-    size_t bucket_size() const {
-        size_t count = 0;
-        for (size_t idx = 0; idx < map.bucket_count(); ++idx) {
-            size_t bucket_size = map.bucket_size(idx);
-            if (bucket_size == 0) bucket_size = 1;
-            count += bucket_size;
-        }
-        float load_factor = map.max_load_factor();
-        if (load_factor < 1.0) return count;
-        return count * load_factor;
-    }
-
-    static const size_t unordered_map_per_entry_overhead = sizeof(void*);
-    static const size_t unordered_map_bucket_overhead = sizeof(void*);
-
-   public:
-    size_t size() const {
-        return map.size();
-    }
-
-    // Estimate unordered_map memory usage.
-    size_t sizeOf() const {
-        return sizeof(*this) +
-               (size() * (sizeof(TEntry) + unordered_map_per_entry_overhead)) +
-               (bucket_size() * sizeof(size_t) + unordered_map_bucket_overhead);
-    }
-
-    typedef typename std::unordered_map<TKey, TEntry>::iterator iterator;
-    typedef
-        typename std::unordered_map<TKey, TEntry>::const_iterator const_iterator;
-
-    std::unique_ptr<const TEntry* []> sort(uid_t uid, pid_t pid,
-                                           size_t len) const {
-        if (!len) {
-            std::unique_ptr<const TEntry* []> sorted(nullptr);
-            return sorted;
-        }
-
-        const TEntry** retval = new const TEntry*[len];
-        memset(retval, 0, sizeof(*retval) * len);
-
-        for (const_iterator it = map.begin(); it != map.end(); ++it) {
-            const TEntry& entry = it->second;
-
-            if ((uid != AID_ROOT) && (uid != entry.getUid())) {
-                continue;
-            }
-            if (pid && entry.getPid() && (pid != entry.getPid())) {
-                continue;
-            }
-
-            size_t sizes = entry.getSizes();
-            ssize_t index = len - 1;
-            while ((!retval[index] || (sizes > retval[index]->getSizes())) &&
-                   (--index >= 0))
-                ;
-            if (++index < (ssize_t)len) {
-                size_t num = len - index - 1;
-                if (num) {
-                    memmove(&retval[index + 1], &retval[index],
-                            num * sizeof(retval[0]));
-                }
-                retval[index] = &entry;
-            }
-        }
-        std::unique_ptr<const TEntry* []> sorted(retval);
-        return sorted;
-    }
-
-    inline iterator add(const TKey& key, const LogBufferElement* element) {
-        iterator it = map.find(key);
-        if (it == map.end()) {
-            it = map.insert(std::make_pair(key, TEntry(element))).first;
-        } else {
-            it->second.add(element);
-        }
-        return it;
-    }
-
-    inline iterator add(TKey key) {
-        iterator it = map.find(key);
-        if (it == map.end()) {
-            it = map.insert(std::make_pair(key, TEntry(key))).first;
-        } else {
-            it->second.add(key);
-        }
-        return it;
-    }
-
-    void subtract(TKey&& key, const LogBufferElement* element) {
-        iterator it = map.find(std::move(key));
-        if ((it != map.end()) && it->second.subtract(element)) {
-            map.erase(it);
-        }
-    }
-
-    void subtract(const TKey& key, const LogBufferElement* element) {
-        iterator it = map.find(key);
-        if ((it != map.end()) && it->second.subtract(element)) {
-            map.erase(it);
-        }
-    }
-
-    inline void drop(TKey key, const LogBufferElement* element) {
-        iterator it = map.find(key);
-        if (it != map.end()) {
-            it->second.drop(element);
-        }
-    }
-
-    inline iterator begin() {
-        return map.begin();
-    }
-    inline const_iterator begin() const {
-        return map.begin();
-    }
-    inline iterator end() {
-        return map.end();
-    }
-    inline const_iterator end() const {
-        return map.end();
-    }
-
-    std::string format(const LogStatistics& stat, uid_t uid, pid_t pid,
-                       const std::string& name = std::string(""),
-                       log_id_t id = LOG_ID_MAX) const {
-        static const size_t maximum_sorted_entries = 32;
-        std::string output;
-        std::unique_ptr<const TEntry* []> sorted =
-            sort(uid, pid, maximum_sorted_entries);
-        if (!sorted.get()) {
-            return output;
-        }
-        bool headerPrinted = false;
-        for (size_t index = 0; index < maximum_sorted_entries; ++index) {
-            const TEntry* entry = sorted[index];
-            if (!entry) {
-                break;
-            }
-            if (entry->getSizes() <= (sorted[0]->getSizes() / 100)) {
-                break;
-            }
-            if (!headerPrinted) {
-                output += "\n\n";
-                output += entry->formatHeader(name, id);
-                headerPrinted = true;
-            }
-            output += entry->format(stat, id);
-        }
-        return output;
-    }
-};
-
-namespace EntryBaseConstants {
-static constexpr size_t pruned_len = 14;
-static constexpr size_t total_len = 80;
-}
-
-struct EntryBase {
-    size_t size;
-
-    EntryBase() : size(0) {
-    }
-    explicit EntryBase(const LogBufferElement* element)
-        : size(element->getMsgLen()) {
-    }
-
-    size_t getSizes() const {
-        return size;
-    }
-
-    inline void add(const LogBufferElement* element) {
-        size += element->getMsgLen();
-    }
-    inline bool subtract(const LogBufferElement* element) {
-        size -= element->getMsgLen();
-        return !size;
-    }
-
-    static std::string formatLine(const std::string& name,
-                                  const std::string& size,
-                                  const std::string& pruned) {
-        ssize_t drop_len =
-            std::max(pruned.length() + 1, EntryBaseConstants::pruned_len);
-        ssize_t size_len =
-            std::max(size.length() + 1, EntryBaseConstants::total_len -
-                                            name.length() - drop_len - 1);
-
-        std::string ret = android::base::StringPrintf(
-            "%s%*s%*s", name.c_str(), (int)size_len, size.c_str(),
-            (int)drop_len, pruned.c_str());
-        // remove any trailing spaces
-        size_t pos = ret.size();
-        size_t len = 0;
-        while (pos && isspace(ret[--pos])) ++len;
-        if (len) ret.erase(pos + 1, len);
-        return ret + "\n";
-    }
-};
-
-struct EntryBaseDropped : public EntryBase {
-    size_t dropped;
-
-    EntryBaseDropped() : dropped(0) {
-    }
-    explicit EntryBaseDropped(const LogBufferElement* element)
-        : EntryBase(element), dropped(element->getDropped()) {
-    }
-
-    size_t getDropped() const {
-        return dropped;
-    }
-
-    inline void add(const LogBufferElement* element) {
-        dropped += element->getDropped();
-        EntryBase::add(element);
-    }
-    inline bool subtract(const LogBufferElement* element) {
-        dropped -= element->getDropped();
-        return EntryBase::subtract(element) && !dropped;
-    }
-    inline void drop(const LogBufferElement* element) {
-        dropped += 1;
-        EntryBase::subtract(element);
-    }
-};
-
-struct UidEntry : public EntryBaseDropped {
-    const uid_t uid;
-    pid_t pid;
-
-    explicit UidEntry(const LogBufferElement* element)
-        : EntryBaseDropped(element),
-          uid(element->getUid()),
-          pid(element->getPid()) {
-    }
-
-    inline const uid_t& getKey() const {
-        return uid;
-    }
-    inline const uid_t& getUid() const {
-        return getKey();
-    }
-    inline const pid_t& getPid() const {
-        return pid;
-    }
-
-    inline void add(const LogBufferElement* element) {
-        if (pid != element->getPid()) {
-            pid = -1;
-        }
-        EntryBaseDropped::add(element);
-    }
-
-    std::string formatHeader(const std::string& name, log_id_t id) const;
-    std::string format(const LogStatistics& stat, log_id_t id) const;
-};
-
-namespace android {
-uid_t pidToUid(pid_t pid);
-}
-
-struct PidEntry : public EntryBaseDropped {
-    const pid_t pid;
-    uid_t uid;
-    char* name;
-
-    explicit PidEntry(pid_t pid)
-        : EntryBaseDropped(),
-          pid(pid),
-          uid(android::pidToUid(pid)),
-          name(android::pidToName(pid)) {
-    }
-    explicit PidEntry(const LogBufferElement* element)
-        : EntryBaseDropped(element),
-          pid(element->getPid()),
-          uid(element->getUid()),
-          name(android::pidToName(pid)) {
-    }
-    PidEntry(const PidEntry& element)
-        : EntryBaseDropped(element),
-          pid(element.pid),
-          uid(element.uid),
-          name(element.name ? strdup(element.name) : nullptr) {
-    }
-    ~PidEntry() {
-        free(name);
-    }
-
-    const pid_t& getKey() const {
-        return pid;
-    }
-    const pid_t& getPid() const {
-        return getKey();
-    }
-    const uid_t& getUid() const {
-        return uid;
-    }
-    const char* getName() const {
-        return name;
-    }
-
-    inline void add(pid_t newPid) {
-        if (name && !fastcmp<strncmp>(name, "zygote", 6)) {
-            free(name);
-            name = nullptr;
-        }
-        if (!name) {
-            name = android::pidToName(newPid);
-        }
-    }
-
-    inline void add(const LogBufferElement* element) {
-        uid_t incomingUid = element->getUid();
-        if (getUid() != incomingUid) {
-            uid = incomingUid;
-            free(name);
-            name = android::pidToName(element->getPid());
-        } else {
-            add(element->getPid());
-        }
-        EntryBaseDropped::add(element);
-    }
-
-    std::string formatHeader(const std::string& name, log_id_t id) const;
-    std::string format(const LogStatistics& stat, log_id_t id) const;
-};
-
-struct TidEntry : public EntryBaseDropped {
-    const pid_t tid;
-    pid_t pid;
-    uid_t uid;
-    char* name;
-
-    TidEntry(pid_t tid, pid_t pid)
-        : EntryBaseDropped(),
-          tid(tid),
-          pid(pid),
-          uid(android::pidToUid(tid)),
-          name(android::tidToName(tid)) {
-    }
-    explicit TidEntry(const LogBufferElement* element)
-        : EntryBaseDropped(element),
-          tid(element->getTid()),
-          pid(element->getPid()),
-          uid(element->getUid()),
-          name(android::tidToName(tid)) {
-    }
-    TidEntry(const TidEntry& element)
-        : EntryBaseDropped(element),
-          tid(element.tid),
-          pid(element.pid),
-          uid(element.uid),
-          name(element.name ? strdup(element.name) : nullptr) {
-    }
-    ~TidEntry() {
-        free(name);
-    }
-
-    const pid_t& getKey() const {
-        return tid;
-    }
-    const pid_t& getTid() const {
-        return getKey();
-    }
-    const pid_t& getPid() const {
-        return pid;
-    }
-    const uid_t& getUid() const {
-        return uid;
-    }
-    const char* getName() const {
-        return name;
-    }
-
-    inline void add(pid_t incomingTid) {
-        if (name && !fastcmp<strncmp>(name, "zygote", 6)) {
-            free(name);
-            name = nullptr;
-        }
-        if (!name) {
-            name = android::tidToName(incomingTid);
-        }
-    }
-
-    inline void add(const LogBufferElement* element) {
-        uid_t incomingUid = element->getUid();
-        pid_t incomingPid = element->getPid();
-        if ((getUid() != incomingUid) || (getPid() != incomingPid)) {
-            uid = incomingUid;
-            pid = incomingPid;
-            free(name);
-            name = android::tidToName(element->getTid());
-        } else {
-            add(element->getTid());
-        }
-        EntryBaseDropped::add(element);
-    }
-
-    std::string formatHeader(const std::string& name, log_id_t id) const;
-    std::string format(const LogStatistics& stat, log_id_t id) const;
-};
-
-struct TagEntry : public EntryBaseDropped {
-    const uint32_t tag;
-    pid_t pid;
-    uid_t uid;
-
-    explicit TagEntry(const LogBufferElement* element)
-        : EntryBaseDropped(element),
-          tag(element->getTag()),
-          pid(element->getPid()),
-          uid(element->getUid()) {
-    }
-
-    const uint32_t& getKey() const {
-        return tag;
-    }
-    const pid_t& getPid() const {
-        return pid;
-    }
-    const uid_t& getUid() const {
-        return uid;
-    }
-    const char* getName() const {
-        return android::tagToName(tag);
-    }
-
-    inline void add(const LogBufferElement* element) {
-        if (uid != element->getUid()) {
-            uid = -1;
-        }
-        if (pid != element->getPid()) {
-            pid = -1;
-        }
-        EntryBaseDropped::add(element);
-    }
-
-    std::string formatHeader(const std::string& name, log_id_t id) const;
-    std::string format(const LogStatistics& stat, log_id_t id) const;
-};
-
-struct TagNameKey {
-    std::string* alloc;
-    std::string_view name;  // Saves space if const char*
-
-    explicit TagNameKey(const LogBufferElement* element)
-        : alloc(nullptr), name("", strlen("")) {
-        if (element->isBinary()) {
-            uint32_t tag = element->getTag();
-            if (tag) {
-                const char* cp = android::tagToName(tag);
-                if (cp) {
-                    name = std::string_view(cp, strlen(cp));
-                    return;
-                }
-            }
-            alloc = new std::string(
-                android::base::StringPrintf("[%" PRIu32 "]", tag));
-            if (!alloc) return;
-            name = std::string_view(alloc->c_str(), alloc->size());
-            return;
-        }
-        const char* msg = element->getMsg();
-        if (!msg) {
-            name = std::string_view("chatty", strlen("chatty"));
-            return;
-        }
-        ++msg;
-        uint16_t len = element->getMsgLen();
-        len = (len <= 1) ? 0 : strnlen(msg, len - 1);
-        if (!len) {
-            name = std::string_view("<NULL>", strlen("<NULL>"));
-            return;
-        }
-        alloc = new std::string(msg, len);
-        if (!alloc) return;
-        name = std::string_view(alloc->c_str(), alloc->size());
-    }
-
-    explicit TagNameKey(TagNameKey&& rval) noexcept
-        : alloc(rval.alloc), name(rval.name.data(), rval.name.length()) {
-        rval.alloc = nullptr;
-    }
-
-    explicit TagNameKey(const TagNameKey& rval)
-        : alloc(rval.alloc ? new std::string(*rval.alloc) : nullptr),
-          name(alloc ? alloc->data() : rval.name.data(), rval.name.length()) {
-    }
-
-    ~TagNameKey() {
-        if (alloc) delete alloc;
-    }
-
-    operator const std::string_view() const {
-        return name;
-    }
-
-    const char* data() const {
-        return name.data();
-    }
-    size_t length() const {
-        return name.length();
-    }
-
-    bool operator==(const TagNameKey& rval) const {
-        if (length() != rval.length()) return false;
-        if (length() == 0) return true;
-        return fastcmp<strncmp>(data(), rval.data(), length()) == 0;
-    }
-    bool operator!=(const TagNameKey& rval) const {
-        return !(*this == rval);
-    }
-
-    size_t getAllocLength() const {
-        return alloc ? alloc->length() + 1 + sizeof(std::string) : 0;
-    }
-};
-
-// Hash for TagNameKey
-template <>
-struct std::hash<TagNameKey>
-    : public std::unary_function<const TagNameKey&, size_t> {
-    size_t operator()(const TagNameKey& __t) const noexcept {
-        if (!__t.length()) return 0;
-        return std::hash<std::string_view>()(std::string_view(__t));
-    }
-};
-
-struct TagNameEntry : public EntryBase {
-    pid_t tid;
-    pid_t pid;
-    uid_t uid;
-    TagNameKey name;
-
-    explicit TagNameEntry(const LogBufferElement* element)
-        : EntryBase(element),
-          tid(element->getTid()),
-          pid(element->getPid()),
-          uid(element->getUid()),
-          name(element) {
-    }
-
-    const TagNameKey& getKey() const {
-        return name;
-    }
-    const pid_t& getTid() const {
-        return tid;
-    }
-    const pid_t& getPid() const {
-        return pid;
-    }
-    const uid_t& getUid() const {
-        return uid;
-    }
-    const char* getName() const {
-        return name.data();
-    }
-    size_t getNameAllocLength() const {
-        return name.getAllocLength();
-    }
-
-    inline void add(const LogBufferElement* element) {
-        if (uid != element->getUid()) {
-            uid = -1;
-        }
-        if (pid != element->getPid()) {
-            pid = -1;
-        }
-        if (tid != element->getTid()) {
-            tid = -1;
-        }
-        EntryBase::add(element);
-    }
-
-    std::string formatHeader(const std::string& name, log_id_t id) const;
-    std::string format(const LogStatistics& stat, log_id_t id) const;
-};
-
-template <typename TEntry>
-class LogFindWorst {
-    std::unique_ptr<const TEntry* []> sorted;
-
-   public:
-    explicit LogFindWorst(std::unique_ptr<const TEntry* []>&& sorted)
-        : sorted(std::move(sorted)) {
-    }
-
-    void findWorst(int& worst, size_t& worst_sizes, size_t& second_worst_sizes,
-                   size_t threshold) {
-        if (sorted.get() && sorted[0] && sorted[1]) {
-            worst_sizes = sorted[0]->getSizes();
-            if ((worst_sizes > threshold)
-                // Allow time horizon to extend roughly tenfold, assume
-                // average entry length is 100 characters.
-                && (worst_sizes > (10 * sorted[0]->getDropped()))) {
-                worst = sorted[0]->getKey();
-                second_worst_sizes = sorted[1]->getSizes();
-                if (second_worst_sizes < threshold) {
-                    second_worst_sizes = threshold;
-                }
-            }
-        }
-    }
-
-    void findWorst(int& worst, size_t worst_sizes, size_t& second_worst_sizes) {
-        if (sorted.get() && sorted[0] && sorted[1]) {
-            worst = sorted[0]->getKey();
-            second_worst_sizes =
-                worst_sizes - sorted[0]->getSizes() + sorted[1]->getSizes();
-        }
-    }
-};
-
-// Log Statistics
-class LogStatistics {
-    friend UidEntry;
-
-    size_t mSizes[LOG_ID_MAX];
-    size_t mElements[LOG_ID_MAX];
-    size_t mDroppedElements[LOG_ID_MAX];
-    size_t mSizesTotal[LOG_ID_MAX];
-    size_t mElementsTotal[LOG_ID_MAX];
-    log_time mOldest[LOG_ID_MAX];
-    log_time mNewest[LOG_ID_MAX];
-    log_time mNewestDropped[LOG_ID_MAX];
-    static size_t SizesTotal;
-    bool enable;
-
-    // uid to size list
-    typedef LogHashtable<uid_t, UidEntry> uidTable_t;
-    uidTable_t uidTable[LOG_ID_MAX];
-
-    // pid of system to size list
-    typedef LogHashtable<pid_t, PidEntry> pidSystemTable_t;
-    pidSystemTable_t pidSystemTable[LOG_ID_MAX];
-
-    // pid to uid list
-    typedef LogHashtable<pid_t, PidEntry> pidTable_t;
-    pidTable_t pidTable;
-
-    // tid to uid list
-    typedef LogHashtable<pid_t, TidEntry> tidTable_t;
-    tidTable_t tidTable;
-
-    // tag list
-    typedef LogHashtable<uint32_t, TagEntry> tagTable_t;
-    tagTable_t tagTable;
-
-    // security tag list
-    tagTable_t securityTagTable;
-
-    // global tag list
-    typedef LogHashtable<TagNameKey, TagNameEntry> tagNameTable_t;
-    tagNameTable_t tagNameTable;
-
-    size_t sizeOf() const {
-        size_t size = sizeof(*this) + pidTable.sizeOf() + tidTable.sizeOf() +
-                      tagTable.sizeOf() + securityTagTable.sizeOf() +
-                      tagNameTable.sizeOf() +
-                      (pidTable.size() * sizeof(pidTable_t::iterator)) +
-                      (tagTable.size() * sizeof(tagTable_t::iterator));
-        for (auto it : pidTable) {
-            const char* name = it.second.getName();
-            if (name) size += strlen(name) + 1;
-        }
-        for (auto it : tidTable) {
-            const char* name = it.second.getName();
-            if (name) size += strlen(name) + 1;
-        }
-        for (auto it : tagNameTable) size += it.second.getNameAllocLength();
-        log_id_for_each(id) {
-            size += uidTable[id].sizeOf();
-            size += uidTable[id].size() * sizeof(uidTable_t::iterator);
-            size += pidSystemTable[id].sizeOf();
-            size +=
-                pidSystemTable[id].size() * sizeof(pidSystemTable_t::iterator);
-        }
-        return size;
-    }
-
-   public:
-    LogStatistics();
-
-    void enableStatistics() {
-        enable = true;
-    }
-
-    void addTotal(LogBufferElement* entry);
-    void add(LogBufferElement* entry);
-    void subtract(LogBufferElement* entry);
-    // entry->setDropped(1) must follow this call
-    void drop(LogBufferElement* entry);
-    // Correct for coalescing two entries referencing dropped content
-    void erase(LogBufferElement* element) {
-        log_id_t log_id = element->getLogId();
-        --mElements[log_id];
-        --mDroppedElements[log_id];
-    }
-
-    LogFindWorst<UidEntry> sort(uid_t uid, pid_t pid, size_t len, log_id id) {
-        return LogFindWorst<UidEntry>(uidTable[id].sort(uid, pid, len));
-    }
-    LogFindWorst<PidEntry> sortPids(uid_t uid, pid_t pid, size_t len,
-                                    log_id id) {
-        return LogFindWorst<PidEntry>(pidSystemTable[id].sort(uid, pid, len));
-    }
-    LogFindWorst<TagEntry> sortTags(uid_t uid, pid_t pid, size_t len, log_id) {
-        return LogFindWorst<TagEntry>(tagTable.sort(uid, pid, len));
-    }
-
-    // fast track current value by id only
-    size_t sizes(log_id_t id) const {
-        return mSizes[id];
-    }
-    size_t elements(log_id_t id) const {
-        return mElements[id];
-    }
-    size_t realElements(log_id_t id) const {
-        return mElements[id] - mDroppedElements[id];
-    }
-    size_t sizesTotal(log_id_t id) const {
-        return mSizesTotal[id];
-    }
-    size_t elementsTotal(log_id_t id) const {
-        return mElementsTotal[id];
-    }
-    static size_t sizesTotal() {
-        return SizesTotal;
-    }
-
-    std::string format(uid_t uid, pid_t pid, unsigned int logMask) const;
-
-    // helper (must be locked directly or implicitly by mLogElementsLock)
-    const char* pidToName(pid_t pid) const;
-    uid_t pidToUid(pid_t pid);
-    const char* uidToName(uid_t uid) const;
-};
-
-#endif  // _LOGD_LOG_STATISTICS_H__
diff --git a/logd/LogTags.cpp b/logd/LogTags.cpp
deleted file mode 100644
index 0cc7886..0000000
--- a/logd/LogTags.cpp
+++ /dev/null
@@ -1,903 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/scopeguard.h>
-#include <android-base/stringprintf.h>
-#include <log/log_event_list.h>
-#include <log/log_properties.h>
-#include <private/android_filesystem_config.h>
-
-#include "LogTags.h"
-#include "LogUtils.h"
-
-using android::base::make_scope_guard;
-
-static LogTags* logtags;
-
-const char LogTags::system_event_log_tags[] = "/system/etc/event-log-tags";
-const char LogTags::dynamic_event_log_tags[] = "/dev/event-log-tags";
-// Only for debug
-const char LogTags::debug_event_log_tags[] = "/data/misc/logd/event-log-tags";
-
-// Sniff for first uid=%d in utf8z comment string
-static uid_t sniffUid(const char* comment, const char* endp) {
-    if (!comment) return AID_ROOT;
-
-    if (*comment == '#') ++comment;
-    while ((comment < endp) && (*comment != '\n') && isspace(*comment))
-        ++comment;
-    static const char uid_str[] = "uid=";
-    if (((comment + strlen(uid_str)) >= endp) ||
-        fastcmp<strncmp>(comment, uid_str, strlen(uid_str)) ||
-        !isdigit(comment[strlen(uid_str)]))
-        return AID_ROOT;
-    char* cp;
-    unsigned long Uid = strtoul(comment + 4, &cp, 10);
-    if ((cp > endp) || (Uid >= INT_MAX)) return AID_ROOT;
-
-    return Uid;
-}
-
-// Checks for file corruption, and report false if there was no need
-// to rebuild the referenced file.  Failure to rebuild is only logged,
-// does not cause a return value of false.
-bool LogTags::RebuildFileEventLogTags(const char* filename, bool warn) {
-    int fd;
-
-    {
-        android::RWLock::AutoRLock readLock(rwlock);
-
-        if (tag2total.begin() == tag2total.end()) {
-            return false;
-        }
-
-        file2watermark_const_iterator iwater = file2watermark.find(filename);
-        if (iwater == file2watermark.end()) {
-            return false;
-        }
-
-        struct stat sb;
-        if (!stat(filename, &sb) && ((size_t)sb.st_size >= iwater->second)) {
-            return false;
-        }
-
-        // dump what we already know back into the file?
-        fd = TEMP_FAILURE_RETRY(open(
-            filename, O_WRONLY | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY));
-        if (fd >= 0) {
-            time_t now = time(nullptr);
-            struct tm tm;
-            localtime_r(&now, &tm);
-            char timebuf[20];
-            size_t len =
-                strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", &tm);
-            android::base::WriteStringToFd(
-                android::base::StringPrintf(
-                    "# Rebuilt %.20s, content owned by logd\n", timebuf),
-                fd);
-            for (const auto& it : tag2total) {
-                android::base::WriteStringToFd(
-                    formatEntry_locked(it.first, AID_ROOT), fd);
-            }
-            close(fd);
-        }
-    }
-
-    if (warn) {
-        android::prdebug(
-            ((fd < 0) ? "%s failed to rebuild"
-                      : "%s missing, damaged or truncated; rebuilt"),
-            filename);
-    }
-
-    if (fd >= 0) {
-        android::RWLock::AutoWLock writeLock(rwlock);
-
-        struct stat sb;
-        if (!stat(filename, &sb)) file2watermark[filename] = sb.st_size;
-    }
-
-    return true;
-}
-
-void LogTags::AddEventLogTags(uint32_t tag, uid_t uid, const std::string& Name,
-                              const std::string& Format, const char* source,
-                              bool warn) {
-    std::string Key = Name;
-    if (Format.length()) Key += "+" + Format;
-
-    bool update = !source || !!strcmp(source, system_event_log_tags);
-    bool newOne;
-
-    {
-        android::RWLock::AutoWLock writeLock(rwlock);
-
-        tag2total_const_iterator itot = tag2total.find(tag);
-
-        // unlikely except for dupes, or updates to uid list (more later)
-        if (itot != tag2total.end()) update = false;
-
-        newOne = tag2name.find(tag) == tag2name.end();
-        key2tag[Key] = tag;
-
-        if (Format.length()) {
-            if (key2tag.find(Name) == key2tag.end()) {
-                key2tag[Name] = tag;
-            }
-            tag2format[tag] = Format;
-        }
-        tag2name[tag] = Name;
-
-        tag2uid_const_iterator ut = tag2uid.find(tag);
-        if (ut != tag2uid.end()) {
-            if (uid == AID_ROOT) {
-                tag2uid.erase(ut);
-                update = true;
-            } else if (ut->second.find(uid) == ut->second.end()) {
-                const_cast<uid_list&>(ut->second).emplace(uid);
-                update = true;
-            }
-        } else if (newOne && (uid != AID_ROOT)) {
-            tag2uid[tag].emplace(uid);
-            update = true;
-        }
-
-        // updatePersist -> trigger output on modified
-        // content, reset tag2total if available
-        if (update && (itot != tag2total.end())) tag2total[tag] = 0;
-    }
-
-    if (update) {
-        WritePersistEventLogTags(tag, uid, source);
-    } else if (warn && !newOne && source) {
-        // For the files, we want to report dupes.
-        android::prdebug("Multiple tag %" PRIu32 " %s %s %s", tag, Name.c_str(),
-                         Format.c_str(), source);
-    }
-}
-
-// Read the event log tags file, and build up our internal database
-void LogTags::ReadFileEventLogTags(const char* filename, bool warn) {
-    bool etc = !strcmp(filename, system_event_log_tags);
-    bool debug = !etc && !strcmp(filename, debug_event_log_tags);
-
-    if (!etc) {
-        RebuildFileEventLogTags(filename, warn);
-    }
-    std::string content;
-    if (android::base::ReadFileToString(filename, &content)) {
-        char* cp = (char*)content.c_str();
-        char* endp = cp + content.length();
-
-        {
-            android::RWLock::AutoRLock writeLock(rwlock);
-
-            file2watermark[filename] = content.length();
-        }
-
-        char* lineStart = cp;
-        while (cp < endp) {
-            if (*cp == '\n') {
-                lineStart = cp;
-            } else if (lineStart) {
-                if (*cp == '#') {
-                    /* comment; just scan to end */
-                    lineStart = nullptr;
-                } else if (isdigit(*cp)) {
-                    unsigned long Tag = strtoul(cp, &cp, 10);
-                    if (warn && (Tag > emptyTag)) {
-                        android::prdebug("tag too large %lu", Tag);
-                    }
-                    while ((cp < endp) && (*cp != '\n') && isspace(*cp)) ++cp;
-                    if (cp >= endp) break;
-                    if (*cp == '\n') continue;
-                    const char* name = cp;
-                    /* Determine whether it is a valid tag name [a-zA-Z0-9_] */
-                    bool hasAlpha = false;
-                    while ((cp < endp) && (isalnum(*cp) || (*cp == '_'))) {
-                        if (!isdigit(*cp)) hasAlpha = true;
-                        ++cp;
-                    }
-                    std::string Name(name, cp - name);
-#ifdef ALLOW_NOISY_LOGGING_OF_PROBLEM_WITH_LOTS_OF_TECHNICAL_DEBT
-                    static const size_t maximum_official_tag_name_size = 24;
-                    if (warn &&
-                        (Name.length() > maximum_official_tag_name_size)) {
-                        android::prdebug("tag name too long %s", Name.c_str());
-                    }
-#endif
-                    if (hasAlpha &&
-                        ((cp >= endp) || (*cp == '#') || isspace(*cp))) {
-                        if (Tag > emptyTag) {
-                            if (*cp != '\n') lineStart = nullptr;
-                            continue;
-                        }
-                        while ((cp < endp) && (*cp != '\n') && isspace(*cp))
-                            ++cp;
-                        const char* format = cp;
-                        uid_t uid = AID_ROOT;
-                        while ((cp < endp) && (*cp != '\n')) {
-                            if (*cp == '#') {
-                                uid = sniffUid(cp, endp);
-                                lineStart = nullptr;
-                                break;
-                            }
-                            ++cp;
-                        }
-                        while ((cp > format) && isspace(cp[-1])) {
-                            --cp;
-                            lineStart = nullptr;
-                        }
-                        std::string Format(format, cp - format);
-
-                        AddEventLogTags((uint32_t)Tag, uid, Name, Format,
-                                        filename, warn);
-                    } else {
-                        if (warn) {
-                            android::prdebug("tag name invalid %.*s",
-                                             (int)(cp - name + 1), name);
-                        }
-                        lineStart = nullptr;
-                    }
-                } else if (!isspace(*cp)) {
-                    break;
-                }
-            }
-            cp++;
-        }
-    } else if (warn) {
-        android::prdebug("Cannot read %s", filename);
-    }
-}
-
-// Extract a 4-byte value from a byte stream.
-static inline uint32_t get4LE(const char* msg) {
-    const uint8_t* src = reinterpret_cast<const uint8_t*>(msg);
-    return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
-}
-
-// Additional persistent sources for invented log tags.  Read the
-// special pmsg event for log tags, and build up our internal
-// database with any found.
-void LogTags::ReadPersistEventLogTags() {
-    struct logger_list* logger_list = android_logger_list_alloc(
-        ANDROID_LOG_RDONLY | ANDROID_LOG_PSTORE | ANDROID_LOG_NONBLOCK, 0,
-        (pid_t)0);
-    if (!logger_list) return;
-
-    struct logger* e = android_logger_open(logger_list, LOG_ID_EVENTS);
-    struct logger* s = android_logger_open(logger_list, LOG_ID_SECURITY);
-    if (!e && !s) {
-        android_logger_list_free(logger_list);
-        return;
-    }
-
-    for (;;) {
-        struct log_msg log_msg;
-        int ret = android_logger_list_read(logger_list, &log_msg);
-        if (ret <= 0) break;
-
-        const char* msg = log_msg.msg();
-        if (!msg) continue;
-        if (log_msg.entry.len <= sizeof(uint32_t)) continue;
-        uint32_t Tag = get4LE(msg);
-        if (Tag != TAG_DEF_LOG_TAG) continue;
-        uid_t uid = log_msg.entry.uid;
-
-        std::string Name;
-        std::string Format;
-        android_log_list_element elem;
-        {
-            auto ctx = create_android_log_parser(log_msg.msg() + sizeof(uint32_t),
-                                                 log_msg.entry.len - sizeof(uint32_t));
-            auto guard = make_scope_guard([&ctx]() { android_log_destroy(&ctx); });
-            elem = android_log_read_next(ctx);
-            if (elem.type != EVENT_TYPE_LIST) {
-                continue;
-            }
-            elem = android_log_read_next(ctx);
-            if (elem.type != EVENT_TYPE_INT) {
-                continue;
-            }
-            Tag = elem.data.int32;
-            elem = android_log_read_next(ctx);
-            if (elem.type != EVENT_TYPE_STRING) {
-                continue;
-            }
-            Name = std::string(elem.data.string, elem.len);
-            elem = android_log_read_next(ctx);
-            if (elem.type != EVENT_TYPE_STRING) {
-                continue;
-            }
-            Format = std::string(elem.data.string, elem.len);
-            elem = android_log_read_next(ctx);
-        }
-        if ((elem.type != EVENT_TYPE_LIST_STOP) || !elem.complete) continue;
-
-        AddEventLogTags(Tag, uid, Name, Format);
-    }
-    android_logger_list_free(logger_list);
-}
-
-LogTags::LogTags() {
-    ReadFileEventLogTags(system_event_log_tags);
-    // Following will likely fail on boot, but is required if logd restarts
-    ReadFileEventLogTags(dynamic_event_log_tags, false);
-    if (__android_log_is_debuggable()) {
-        ReadFileEventLogTags(debug_event_log_tags, false);
-    }
-    ReadPersistEventLogTags();
-
-    logtags = this;
-}
-
-// Converts an event tag into a name
-const char* LogTags::tagToName(uint32_t tag) const {
-    tag2name_const_iterator it;
-
-    android::RWLock::AutoRLock readLock(const_cast<android::RWLock&>(rwlock));
-
-    it = tag2name.find(tag);
-    if ((it == tag2name.end()) || (it->second.length() == 0)) return nullptr;
-
-    return it->second.c_str();
-}
-
-// Prototype in LogUtils.h allowing external access to our database.
-//
-// This must be a pure reader to our database, as everything else is
-// guaranteed single-threaded except this access point which is
-// asynchonous and can be multithreaded and thus rentrant.  The
-// object's rwlock is only used to guarantee atomic access to the
-// unordered_map to prevent corruption, with a requirement to be a
-// low chance of contention for this call.  If we end up changing
-// this algorithm resulting in write, then we should use a different
-// lock than the object's rwlock to protect groups of associated
-// actions.
-const char* android::tagToName(uint32_t tag) {
-    LogTags* me = logtags;
-
-    if (!me) return nullptr;
-    me->WritePmsgEventLogTags(tag);
-    return me->tagToName(tag);
-}
-
-// Prototype in LogUtils.h allowing external access to our database.
-//
-// This only works on userdebug and eng devices to re-read the
-// /data/misc/logd/event-log-tags file right after /data is mounted.
-// The operation is near to boot and should only happen once.  There
-// are races associated with its use since it can trigger a Rebuild
-// of the file, but that is a can-not-happen since the file was not
-// read yet.  More dangerous if called later, but if all is well it
-// should just skip over everything and not write any new entries.
-void android::ReReadEventLogTags() {
-    LogTags* me = logtags;
-
-    if (me && __android_log_is_debuggable()) {
-        me->ReadFileEventLogTags(me->debug_event_log_tags);
-    }
-}
-
-// converts an event tag into a format
-const char* LogTags::tagToFormat(uint32_t tag) const {
-    tag2format_const_iterator iform;
-
-    android::RWLock::AutoRLock readLock(const_cast<android::RWLock&>(rwlock));
-
-    iform = tag2format.find(tag);
-    if (iform == tag2format.end()) return nullptr;
-
-    return iform->second.c_str();
-}
-
-// converts a name into an event tag
-uint32_t LogTags::nameToTag(const char* name) const {
-    uint32_t ret = emptyTag;
-
-    // Bug: Only works for a single entry, we can have multiple entries,
-    // one for each format, so we find first entry recorded, or entry with
-    // no format associated with it.
-
-    android::RWLock::AutoRLock readLock(const_cast<android::RWLock&>(rwlock));
-
-    key2tag_const_iterator ik = key2tag.find(std::string(name));
-    if (ik != key2tag.end()) ret = ik->second;
-
-    return ret;
-}
-
-// Caller must perform locks, can be under reader (for pre-check) or
-// writer lock.  We use this call to invent a new deterministically
-// random tag, unique is cleared if no conflicts.  If format is NULL,
-// we are in readonly mode.
-uint32_t LogTags::nameToTag_locked(const std::string& name, const char* format,
-                                   bool& unique) {
-    key2tag_const_iterator ik;
-
-    bool write = format != nullptr;
-    unique = write;
-
-    if (!write) {
-        // Bug: Only works for a single entry, we can have multiple entries,
-        // one for each format, so we find first entry recorded, or entry with
-        // no format associated with it.
-        ik = key2tag.find(name);
-        if (ik == key2tag.end()) return emptyTag;
-        return ik->second;
-    }
-
-    std::string Key(name);
-    if (*format) Key += std::string("+") + format;
-
-    ik = key2tag.find(Key);
-    if (ik != key2tag.end()) {
-        unique = false;
-        return ik->second;
-    }
-
-    size_t Hash = key2tag.hash_function()(Key);
-    uint32_t Tag = Hash;
-    // This sets an upper limit on the conflics we are allowed to deal with.
-    for (unsigned i = 0; i < 256;) {
-        tag2name_const_iterator it = tag2name.find(Tag);
-        if (it == tag2name.end()) return Tag;
-        std::string localKey(it->second);
-        tag2format_const_iterator iform = tag2format.find(Tag);
-        if ((iform == tag2format.end()) && iform->second.length()) {
-            localKey += "+" + iform->second;
-        }
-        unique = !!it->second.compare(localKey);
-        if (!unique) return Tag;  // unlikely except in a race
-
-        ++i;
-        // Algorithm to convert hash to next tag
-        if (i < 32) {
-            Tag = (Hash >> i);
-            // size_t is 32 bits, or upper word zero, rotate
-            if ((sizeof(Hash) <= 4) || ((Hash & (uint64_t(-1LL) << 32)) == 0)) {
-                Tag |= Hash << (32 - i);
-            }
-        } else {
-            Tag = Hash + i - 31;
-        }
-    }
-    return emptyTag;
-}
-
-static int openFile(const char* name, int mode, bool warning) {
-    int fd = TEMP_FAILURE_RETRY(open(name, mode));
-    if ((fd < 0) && warning) {
-        android::prdebug("Failed open %s (%d)", name, errno);
-    }
-    return fd;
-}
-
-void LogTags::WritePmsgEventLogTags(uint32_t tag, uid_t uid) {
-    android::RWLock::AutoRLock readLock(rwlock);
-
-    tag2total_const_iterator itot = tag2total.find(tag);
-    if (itot == tag2total.end()) return;  // source is a static entry
-
-    size_t lastTotal = itot->second;
-
-    // Every 16K (half the smallest configurable pmsg buffer size) record
-    static const size_t rate_to_pmsg = 16 * 1024;
-    if (lastTotal && ((android::sizesTotal() - lastTotal) < rate_to_pmsg)) {
-        return;
-    }
-
-    static int pmsg_fd = -1;
-    if (pmsg_fd < 0) {
-        pmsg_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
-        // unlikely, but deal with partners with borken pmsg
-        if (pmsg_fd < 0) return;
-    }
-
-    std::string Name = tag2name[tag];
-    tag2format_const_iterator iform = tag2format.find(tag);
-    std::string Format = (iform != tag2format.end()) ? iform->second : "";
-
-    auto ctx = create_android_logger(TAG_DEF_LOG_TAG);
-    auto guard = make_scope_guard([&ctx]() { android_log_destroy(&ctx); });
-    if (android_log_write_int32(ctx, static_cast<int32_t>(tag) < 0) ||
-        android_log_write_string8_len(ctx, Name.c_str(), Name.size()) < 0 ||
-        android_log_write_string8_len(ctx, Format.c_str(), Format.size()) < 0) {
-        return;
-    }
-
-    const char* cp = nullptr;
-    ssize_t len = android_log_write_list_buffer(ctx, &cp);
-
-    if (len <= 0 || cp == nullptr) {
-        return;
-    }
-
-    std::string buffer(cp, len);
-
-    /*
-     *  struct {
-     *      // what we provide to pstore
-     *      android_pmsg_log_header_t pmsgHeader;
-     *      // what we provide to file
-     *      android_log_header_t header;
-     *      // caller provides
-     *      union {
-     *          struct {
-     *              char     prio;
-     *              char     payload[];
-     *          } string;
-     *          struct {
-     *              uint32_t tag
-     *              char     payload[];
-     *          } binary;
-     *      };
-     *  };
-     */
-
-    struct timespec ts;
-    clock_gettime(android_log_clockid(), &ts);
-
-    android_log_header_t header = {
-        .id = LOG_ID_EVENTS,
-        .tid = (uint16_t)gettid(),
-        .realtime.tv_sec = (uint32_t)ts.tv_sec,
-        .realtime.tv_nsec = (uint32_t)ts.tv_nsec,
-    };
-
-    uint32_t outTag = TAG_DEF_LOG_TAG;
-    outTag = get4LE((const char*)&outTag);
-
-    android_pmsg_log_header_t pmsgHeader = {
-        .magic = LOGGER_MAGIC,
-        .len = (uint16_t)(sizeof(pmsgHeader) + sizeof(header) + sizeof(outTag) +
-                          buffer.length()),
-        .uid = (uint16_t)AID_ROOT,
-        .pid = (uint16_t)getpid(),
-    };
-
-    struct iovec Vec[] = { { (unsigned char*)&pmsgHeader, sizeof(pmsgHeader) },
-                           { (unsigned char*)&header, sizeof(header) },
-                           { (unsigned char*)&outTag, sizeof(outTag) },
-                           { (unsigned char*)const_cast<char*>(buffer.data()),
-                             buffer.length() } };
-
-    tag2uid_const_iterator ut = tag2uid.find(tag);
-    if (ut == tag2uid.end()) {
-        TEMP_FAILURE_RETRY(writev(pmsg_fd, Vec, arraysize(Vec)));
-    } else if (uid != AID_ROOT) {
-        pmsgHeader.uid = (uint16_t)uid;
-        TEMP_FAILURE_RETRY(writev(pmsg_fd, Vec, arraysize(Vec)));
-    } else {
-        for (auto& it : ut->second) {
-            pmsgHeader.uid = (uint16_t)it;
-            TEMP_FAILURE_RETRY(writev(pmsg_fd, Vec, arraysize(Vec)));
-        }
-    }
-}
-
-void LogTags::WriteDynamicEventLogTags(uint32_t tag, uid_t uid) {
-    static const int mode =
-        O_WRONLY | O_APPEND | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
-
-    int fd = openFile(dynamic_event_log_tags, mode, true);
-    if (fd < 0) return;
-
-    android::RWLock::AutoWLock writeLock(rwlock);
-
-    std::string ret = formatEntry_locked(tag, uid, false);
-    android::base::WriteStringToFd(ret, fd);
-    close(fd);
-
-    size_t size = 0;
-    file2watermark_const_iterator iwater;
-
-    iwater = file2watermark.find(dynamic_event_log_tags);
-    if (iwater != file2watermark.end()) size = iwater->second;
-
-    file2watermark[dynamic_event_log_tags] = size + ret.length();
-}
-
-void LogTags::WriteDebugEventLogTags(uint32_t tag, uid_t uid) {
-    static const int mode =
-        O_WRONLY | O_APPEND | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
-
-    static bool one = true;
-    int fd = openFile(debug_event_log_tags, mode, one);
-    one = fd >= 0;
-    if (!one) return;
-
-    android::RWLock::AutoWLock writeLock(rwlock);
-
-    std::string ret = formatEntry_locked(tag, uid, false);
-    android::base::WriteStringToFd(ret, fd);
-    close(fd);
-
-    size_t size = 0;
-    file2watermark_const_iterator iwater;
-
-    iwater = file2watermark.find(debug_event_log_tags);
-    if (iwater != file2watermark.end()) size = iwater->second;
-
-    file2watermark[debug_event_log_tags] = size + ret.length();
-}
-
-// How we maintain some runtime or reboot stickiness
-void LogTags::WritePersistEventLogTags(uint32_t tag, uid_t uid,
-                                       const char* source) {
-    // very unlikely
-    bool etc = source && !strcmp(source, system_event_log_tags);
-    if (etc) return;
-
-    bool dynamic = source && !strcmp(source, dynamic_event_log_tags);
-    bool debug = (!dynamic && source && !strcmp(source, debug_event_log_tags)) ||
-                 !__android_log_is_debuggable();
-
-    WritePmsgEventLogTags(tag, uid);
-
-    size_t lastTotal = 0;
-    {
-        android::RWLock::AutoRLock readLock(rwlock);
-
-        tag2total_const_iterator itot = tag2total.find(tag);
-        if (itot != tag2total.end()) lastTotal = itot->second;
-    }
-
-    if (lastTotal == 0) {  // denotes first time for this one
-        if (!dynamic || !RebuildFileEventLogTags(dynamic_event_log_tags)) {
-            WriteDynamicEventLogTags(tag, uid);
-        }
-
-        if (!debug && !RebuildFileEventLogTags(debug_event_log_tags)) {
-            WriteDebugEventLogTags(tag, uid);
-        }
-    }
-
-    lastTotal = android::sizesTotal();
-    if (!lastTotal) ++lastTotal;
-
-    // record totals for next watermark.
-    android::RWLock::AutoWLock writeLock(rwlock);
-    tag2total[tag] = lastTotal;
-}
-
-// nameToTag converts a name into an event tag. If format is NULL, then we
-// are in readonly mode.
-uint32_t LogTags::nameToTag(uid_t uid, const char* name, const char* format) {
-    std::string Name = std::string(name);
-    bool write = format != nullptr;
-    bool updateUid = uid != AID_ROOT;
-    bool updateFormat = format && *format;
-    bool unique;
-    uint32_t Tag;
-
-    {
-        android::RWLock::AutoRLock readLock(rwlock);
-
-        Tag = nameToTag_locked(Name, format, unique);
-        if (updateUid && (Tag != emptyTag) && !unique) {
-            tag2uid_const_iterator ut = tag2uid.find(Tag);
-            if (updateUid) {
-                if ((ut != tag2uid.end()) &&
-                    (ut->second.find(uid) == ut->second.end())) {
-                    unique = write;  // write passthrough to update uid counts
-                    if (!write) Tag = emptyTag;  // deny read access
-                }
-            } else {
-                unique = write && (ut != tag2uid.end());
-            }
-        }
-    }
-
-    if (Tag == emptyTag) return Tag;
-    WritePmsgEventLogTags(Tag, uid);  // record references periodically
-    if (!unique) return Tag;
-
-    bool updateWrite = false;
-    bool updateTag;
-
-    // Special case of AddEventLogTags, checks per-uid counter which makes
-    // no sense there, and is also optimized somewhat to reduce write times.
-    {
-        android::RWLock::AutoWLock writeLock(rwlock);
-
-        // double check after switch from read lock to write lock for Tag
-        updateTag = tag2name.find(Tag) == tag2name.end();
-        // unlikely, either update, race inviting conflict or multiple uids
-        if (!updateTag) {
-            Tag = nameToTag_locked(Name, format, unique);
-            if (Tag == emptyTag) return Tag;
-            // is it multiple uid's setting this value
-            if (!unique) {
-                tag2uid_const_iterator ut = tag2uid.find(Tag);
-                if (updateUid) {
-                    // Add it to the uid list
-                    if ((ut == tag2uid.end()) ||
-                        (ut->second.find(uid) != ut->second.end())) {
-                        return Tag;
-                    }
-                    const_cast<uid_list&>(ut->second).emplace(uid);
-                    updateWrite = true;
-                } else {
-                    if (ut == tag2uid.end()) return Tag;
-                    // (system) adding a global one, erase the uid list
-                    tag2uid.erase(ut);
-                    updateWrite = true;
-                }
-            }
-        }
-
-        // Update section
-        size_t count;
-        if (updateUid) {
-            count = 0;
-            uid2count_const_iterator ci = uid2count.find(uid);
-            if (ci != uid2count.end()) {
-                count = ci->second;
-                if (count >= max_per_uid) {
-                    if (!updateWrite) return emptyTag;
-                    // If we are added to the per-Uid perms, leak the Tag
-                    // if it already exists.
-                    updateUid = false;
-                    updateTag = false;
-                    updateFormat = false;
-                }
-            }
-        }
-
-        // updateWrite -> trigger output on modified content, reset tag2total
-        //    also sets static to dynamic entries if they are alterred,
-        //    only occurs if they have a uid, and runtime adds another uid.
-        if (updateWrite) tag2total[Tag] = 0;
-
-        if (updateTag) {
-            // mark as a dynamic entry, but do not upset current total counter
-            tag2total_const_iterator itot = tag2total.find(Tag);
-            if (itot == tag2total.end()) tag2total[Tag] = 0;
-
-            if (*format) {
-                key2tag[Name + "+" + format] = Tag;
-                if (key2tag.find(Name) == key2tag.end()) key2tag[Name] = Tag;
-            } else {
-                key2tag[Name] = Tag;
-            }
-            tag2name[Tag] = Name;
-        }
-        if (updateFormat) tag2format[Tag] = format;
-
-        if (updateUid) {
-            tag2uid[Tag].emplace(uid);
-            uid2count[uid] = count + 1;
-        }
-    }
-
-    if (updateTag || updateFormat || updateWrite) {
-        WritePersistEventLogTags(Tag, uid);
-    }
-
-    return Tag;
-}
-
-std::string LogTags::formatEntry(uint32_t tag, uid_t uid, const char* name,
-                                 const char* format) {
-    if (!format || !format[0]) {
-        return android::base::StringPrintf("%" PRIu32 "\t%s\n", tag, name);
-    }
-    size_t len = (strlen(name) + 7) / 8;
-    static const char tabs[] = "\t\t\t";
-    if (len > strlen(tabs)) len = strlen(tabs);
-    std::string Uid;
-    if (uid != AID_ROOT) Uid = android::base::StringPrintf(" # uid=%u", uid);
-    return android::base::StringPrintf("%" PRIu32 "\t%s%s\t%s%s\n", tag, name,
-                                       &tabs[len], format, Uid.c_str());
-}
-
-std::string LogTags::formatEntry_locked(uint32_t tag, uid_t uid,
-                                        bool authenticate) {
-    const char* name = tag2name[tag].c_str();
-
-    const char* format = "";
-    tag2format_const_iterator iform = tag2format.find(tag);
-    if (iform != tag2format.end()) format = iform->second.c_str();
-
-    // Access permission test, do not report dynamic entries
-    // that do not belong to us.
-    tag2uid_const_iterator ut = tag2uid.find(tag);
-    if (ut == tag2uid.end()) {
-        return formatEntry(tag, AID_ROOT, name, format);
-    }
-    if (uid != AID_ROOT) {
-        if (authenticate && (ut->second.find(uid) == ut->second.end())) {
-            return std::string("");
-        }
-        return formatEntry(tag, uid, name, format);
-    }
-
-    // Show all, one for each registered uid (we are group root)
-    std::string ret;
-    for (auto& it : ut->second) {
-        ret += formatEntry(tag, it, name, format);
-    }
-    return ret;
-}
-
-std::string LogTags::formatEntry(uint32_t tag, uid_t uid) {
-    android::RWLock::AutoRLock readLock(rwlock);
-    return formatEntry_locked(tag, uid);
-}
-
-std::string LogTags::formatGetEventTag(uid_t uid, const char* name,
-                                       const char* format) {
-    bool all = name && (name[0] == '*') && !name[1];
-    bool list = !name || all;
-    std::string ret;
-
-    if (!list) {
-        // switch to read entry only if format == "*"
-        if (format && (format[0] == '*') && !format[1]) format = nullptr;
-
-        // WAI: for null format, only works for a single entry, we can have
-        // multiple entries, one for each format, so we find first entry
-        // recorded, or entry with no format associated with it.
-        // We may desire to print all that match the name, but we did not
-        // add a mapping table for that and the cost is too high.
-        uint32_t tag = nameToTag(uid, name, format);
-        if (tag == emptyTag) return std::string("-1 ESRCH");
-        if (uid == AID_ROOT) {
-            android::RWLock::AutoRLock readLock(rwlock);
-
-            // first uid in list so as to manufacture an accurate reference
-            tag2uid_const_iterator ut = tag2uid.find(tag);
-            if ((ut != tag2uid.end()) &&
-                (ut->second.begin() != ut->second.end())) {
-                uid = *(ut->second.begin());
-            }
-        }
-        ret = formatEntry(tag, uid, name, format ?: tagToFormat(tag));
-        if (!ret.length()) return std::string("-1 ESRCH");
-        return ret;
-    }
-
-    android::RWLock::AutoRLock readLock(rwlock);
-    if (all) {
-        // everything under the sun
-        for (const auto& it : tag2name) {
-            ret += formatEntry_locked(it.first, uid);
-        }
-    } else {
-        // set entries are dynamic
-        for (const auto& it : tag2total) {
-            ret += formatEntry_locked(it.first, uid);
-        }
-    }
-    return ret;
-}
diff --git a/logd/LogTags.h b/logd/LogTags.h
deleted file mode 100644
index e4d165a..0000000
--- a/logd/LogTags.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#ifndef _LOGD_LOG_TAGS_H__
-#define _LOGD_LOG_TAGS_H__
-
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-
-#include <utils/RWLock.h>
-
-class LogTags {
-    // This lock protects all the unordered_map accesses below.  It
-    // is a reader/writer lock so that contentions are kept to a
-    // minimum since writes are rare, even administratably when
-    // reads are extended.  Resist the temptation to use the writer
-    // lock to protect anything outside the following unordered_maps
-    // as that would increase the reader contentions.  Use a separate
-    // mutex to protect the other entities.
-    android::RWLock rwlock;
-
-    // key is Name + "+" + Format
-    std::unordered_map<std::string, uint32_t> key2tag;
-    typedef std::unordered_map<std::string, uint32_t>::const_iterator
-        key2tag_const_iterator;
-
-    // Allows us to manage access permissions based on uid registrants
-    // Global entries are specifically erased.
-    typedef std::unordered_set<uid_t> uid_list;
-    std::unordered_map<uint32_t, uid_list> tag2uid;
-    typedef std::unordered_map<uint32_t, uid_list>::const_iterator
-        tag2uid_const_iterator;
-
-    std::unordered_map<uint32_t, std::string> tag2name;
-    typedef std::unordered_map<uint32_t, std::string>::const_iterator
-        tag2name_const_iterator;
-
-    std::unordered_map<uint32_t, std::string> tag2format;
-    typedef std::unordered_map<uint32_t, std::string>::const_iterator
-        tag2format_const_iterator;
-
-    static const size_t max_per_uid = 256;  // Put a cap on the tags per uid
-    std::unordered_map<uid_t, size_t> uid2count;
-    typedef std::unordered_map<uid_t, size_t>::const_iterator
-        uid2count_const_iterator;
-
-    // Dynamic entries are assigned
-    std::unordered_map<uint32_t, size_t> tag2total;
-    typedef std::unordered_map<uint32_t, size_t>::const_iterator
-        tag2total_const_iterator;
-
-    // emplace unique tag
-    uint32_t nameToTag(uid_t uid, const char* name, const char* format);
-    // find unique or associated tag
-    uint32_t nameToTag_locked(const std::string& name, const char* format,
-                              bool& unique);
-
-    // Record expected file watermarks to detect corruption.
-    std::unordered_map<std::string, size_t> file2watermark;
-    typedef std::unordered_map<std::string, size_t>::const_iterator
-        file2watermark_const_iterator;
-
-    void ReadPersistEventLogTags();
-
-    // format helpers
-    // format a single entry, does not need object data
-    static std::string formatEntry(uint32_t tag, uid_t uid, const char* name,
-                                   const char* format);
-    // caller locks, database lookup, authenticate against uid
-    std::string formatEntry_locked(uint32_t tag, uid_t uid,
-                                   bool authenticate = true);
-
-    bool RebuildFileEventLogTags(const char* filename, bool warn = true);
-
-    void AddEventLogTags(uint32_t tag, uid_t uid, const std::string& Name,
-                         const std::string& Format, const char* source = nullptr,
-                         bool warn = false);
-
-    void WriteDynamicEventLogTags(uint32_t tag, uid_t uid);
-    void WriteDebugEventLogTags(uint32_t tag, uid_t uid);
-    // push tag details to persistent storage
-    void WritePersistEventLogTags(uint32_t tag, uid_t uid = AID_ROOT,
-                                  const char* source = nullptr);
-
-    static const uint32_t emptyTag = uint32_t(-1);
-
-   public:
-    static const char system_event_log_tags[];
-    static const char dynamic_event_log_tags[];
-    // Only for userdebug and eng
-    static const char debug_event_log_tags[];
-
-    LogTags();
-
-    void WritePmsgEventLogTags(uint32_t tag, uid_t uid = AID_ROOT);
-    void ReadFileEventLogTags(const char* filename, bool warn = true);
-
-    // reverse lookup from tag
-    const char* tagToName(uint32_t tag) const;
-    const char* tagToFormat(uint32_t tag) const;
-    std::string formatEntry(uint32_t tag, uid_t uid);
-    // find associated tag
-    uint32_t nameToTag(const char* name) const;
-
-    // emplace tag if necessary, provide event-log-tag formated output in string
-    std::string formatGetEventTag(uid_t uid, const char* name,
-                                  const char* format);
-};
-
-#endif  // _LOGD_LOG_TAGS_H__
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
deleted file mode 100644
index 208d67f..0000000
--- a/logd/LogTimes.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <errno.h>
-#include <string.h>
-#include <sys/prctl.h>
-
-#include <private/android_logger.h>
-
-#include "FlushCommand.h"
-#include "LogBuffer.h"
-#include "LogReader.h"
-#include "LogTimes.h"
-
-pthread_mutex_t LogTimeEntry::timesLock = PTHREAD_MUTEX_INITIALIZER;
-
-LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client,
-                           bool nonBlock, unsigned long tail, log_mask_t logMask,
-                           pid_t pid, log_time start, uint64_t timeout)
-    : leadingDropped(false),
-      mReader(reader),
-      mLogMask(logMask),
-      mPid(pid),
-      mCount(0),
-      mTail(tail),
-      mIndex(0),
-      mClient(client),
-      mStart(start),
-      mNonBlock(nonBlock),
-      mEnd(log_time(android_log_clockid())) {
-    mTimeout.tv_sec = timeout / NS_PER_SEC;
-    mTimeout.tv_nsec = timeout % NS_PER_SEC;
-    memset(mLastTid, 0, sizeof(mLastTid));
-    pthread_cond_init(&threadTriggeredCondition, nullptr);
-    cleanSkip_Locked();
-}
-
-bool LogTimeEntry::startReader_Locked() {
-    pthread_attr_t attr;
-
-    if (!pthread_attr_init(&attr)) {
-        if (!pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
-            if (!pthread_create(&mThread, &attr, LogTimeEntry::threadStart,
-                                this)) {
-                pthread_attr_destroy(&attr);
-                return true;
-            }
-        }
-        pthread_attr_destroy(&attr);
-    }
-
-    return false;
-}
-
-void* LogTimeEntry::threadStart(void* obj) {
-    prctl(PR_SET_NAME, "logd.reader.per");
-
-    LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
-
-    SocketClient* client = me->mClient;
-
-    LogBuffer& logbuf = me->mReader.logbuf();
-
-    bool privileged = FlushCommand::hasReadLogs(client);
-    bool security = FlushCommand::hasSecurityLogs(client);
-
-    me->leadingDropped = true;
-
-    wrlock();
-
-    log_time start = me->mStart;
-
-    while (!me->mRelease) {
-        if (me->mTimeout.tv_sec || me->mTimeout.tv_nsec) {
-            if (pthread_cond_timedwait(&me->threadTriggeredCondition,
-                                       &timesLock, &me->mTimeout) == ETIMEDOUT) {
-                me->mTimeout.tv_sec = 0;
-                me->mTimeout.tv_nsec = 0;
-            }
-            if (me->mRelease) {
-                break;
-            }
-        }
-
-        unlock();
-
-        if (me->mTail) {
-            logbuf.flushTo(client, start, nullptr, privileged, security,
-                           FilterFirstPass, me);
-            me->leadingDropped = true;
-        }
-        start = logbuf.flushTo(client, start, me->mLastTid, privileged,
-                               security, FilterSecondPass, me);
-
-        wrlock();
-
-        if (start == LogBufferElement::FLUSH_ERROR) {
-            break;
-        }
-
-        me->mStart = start + log_time(0, 1);
-
-        if (me->mNonBlock || me->mRelease) {
-            break;
-        }
-
-        me->cleanSkip_Locked();
-
-        if (!me->mTimeout.tv_sec && !me->mTimeout.tv_nsec) {
-            pthread_cond_wait(&me->threadTriggeredCondition, &timesLock);
-        }
-    }
-
-    LogReader& reader = me->mReader;
-    reader.release(client);
-
-    client->decRef();
-
-    LastLogTimes& times = reader.logbuf().mTimes;
-    auto it =
-        std::find_if(times.begin(), times.end(),
-                     [&me](const auto& other) { return other.get() == me; });
-
-    if (it != times.end()) {
-        times.erase(it);
-    }
-
-    unlock();
-
-    return nullptr;
-}
-
-// A first pass to count the number of elements
-int LogTimeEntry::FilterFirstPass(const LogBufferElement* element, void* obj) {
-    LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
-
-    LogTimeEntry::wrlock();
-
-    if (me->leadingDropped) {
-        if (element->getDropped()) {
-            LogTimeEntry::unlock();
-            return false;
-        }
-        me->leadingDropped = false;
-    }
-
-    if (me->mCount == 0) {
-        me->mStart = element->getRealTime();
-    }
-
-    if ((!me->mPid || (me->mPid == element->getPid())) &&
-        (me->isWatching(element->getLogId()))) {
-        ++me->mCount;
-    }
-
-    LogTimeEntry::unlock();
-
-    return false;
-}
-
-// A second pass to send the selected elements
-int LogTimeEntry::FilterSecondPass(const LogBufferElement* element, void* obj) {
-    LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
-
-    LogTimeEntry::wrlock();
-
-    me->mStart = element->getRealTime();
-
-    if (me->skipAhead[element->getLogId()]) {
-        me->skipAhead[element->getLogId()]--;
-        goto skip;
-    }
-
-    if (me->leadingDropped) {
-        if (element->getDropped()) {
-            goto skip;
-        }
-        me->leadingDropped = false;
-    }
-
-    // Truncate to close race between first and second pass
-    if (me->mNonBlock && me->mTail && (me->mIndex >= me->mCount)) {
-        goto stop;
-    }
-
-    if (!me->isWatching(element->getLogId())) {
-        goto skip;
-    }
-
-    if (me->mPid && (me->mPid != element->getPid())) {
-        goto skip;
-    }
-
-    if (me->mRelease) {
-        goto stop;
-    }
-
-    if (!me->mTail) {
-        goto ok;
-    }
-
-    ++me->mIndex;
-
-    if ((me->mCount > me->mTail) && (me->mIndex <= (me->mCount - me->mTail))) {
-        goto skip;
-    }
-
-    if (!me->mNonBlock) {
-        me->mTail = 0;
-    }
-
-ok:
-    if (!me->skipAhead[element->getLogId()]) {
-        LogTimeEntry::unlock();
-        return true;
-    }
-// FALLTHRU
-
-skip:
-    LogTimeEntry::unlock();
-    return false;
-
-stop:
-    LogTimeEntry::unlock();
-    return -1;
-}
-
-void LogTimeEntry::cleanSkip_Locked(void) {
-    memset(skipAhead, 0, sizeof(skipAhead));
-}
diff --git a/logd/LogTimes.h b/logd/LogTimes.h
deleted file mode 100644
index 9f6f203..0000000
--- a/logd/LogTimes.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2012-2013 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.
- */
-
-#ifndef _LOGD_LOG_TIMES_H__
-#define _LOGD_LOG_TIMES_H__
-
-#include <pthread.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <time.h>
-
-#include <list>
-#include <memory>
-
-#include <log/log.h>
-#include <sysutils/SocketClient.h>
-
-typedef unsigned int log_mask_t;
-
-class LogReader;
-class LogBufferElement;
-
-class LogTimeEntry {
-    static pthread_mutex_t timesLock;
-    bool mRelease = false;
-    bool leadingDropped;
-    pthread_cond_t threadTriggeredCondition;
-    pthread_t mThread;
-    LogReader& mReader;
-    static void* threadStart(void* me);
-    const log_mask_t mLogMask;
-    const pid_t mPid;
-    unsigned int skipAhead[LOG_ID_MAX];
-    pid_t mLastTid[LOG_ID_MAX];
-    unsigned long mCount;
-    unsigned long mTail;
-    unsigned long mIndex;
-
-   public:
-    LogTimeEntry(LogReader& reader, SocketClient* client, bool nonBlock,
-                 unsigned long tail, log_mask_t logMask, pid_t pid,
-                 log_time start, uint64_t timeout);
-
-    SocketClient* mClient;
-    log_time mStart;
-    struct timespec mTimeout;
-    const bool mNonBlock;
-    const log_time mEnd;  // only relevant if mNonBlock
-
-    // Protect List manipulations
-    static void wrlock(void) {
-        pthread_mutex_lock(&timesLock);
-    }
-    static void rdlock(void) {
-        pthread_mutex_lock(&timesLock);
-    }
-    static void unlock(void) {
-        pthread_mutex_unlock(&timesLock);
-    }
-
-    bool startReader_Locked();
-
-    void triggerReader_Locked(void) {
-        pthread_cond_signal(&threadTriggeredCondition);
-    }
-
-    void triggerSkip_Locked(log_id_t id, unsigned int skip) {
-        skipAhead[id] = skip;
-    }
-    void cleanSkip_Locked(void);
-
-    void release_Locked(void) {
-        // gracefully shut down the socket.
-        shutdown(mClient->getSocket(), SHUT_RDWR);
-        mRelease = true;
-        pthread_cond_signal(&threadTriggeredCondition);
-    }
-
-    bool isWatching(log_id_t id) const {
-        return mLogMask & (1 << id);
-    }
-    bool isWatchingMultiple(log_mask_t logMask) const {
-        return mLogMask & logMask;
-    }
-    // flushTo filter callbacks
-    static int FilterFirstPass(const LogBufferElement* element, void* me);
-    static int FilterSecondPass(const LogBufferElement* element, void* me);
-};
-
-typedef std::list<std::unique_ptr<LogTimeEntry>> LastLogTimes;
-
-#endif  // _LOGD_LOG_TIMES_H__
diff --git a/logd/LogUtils.h b/logd/LogUtils.h
deleted file mode 100644
index fa9f398..0000000
--- a/logd/LogUtils.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2012-2015 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.
- */
-
-#ifndef _LOGD_LOG_UTILS_H__
-#define _LOGD_LOG_UTILS_H__
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <private/android_logger.h>
-#include <sysutils/SocketClient.h>
-#include <utils/FastStrcmp.h>
-
-// Hijack this header as a common include file used by most all sources
-// to report some utilities defined here and there.
-
-namespace android {
-
-// Furnished in main.cpp. Caller must own and free returned value
-char* uidToName(uid_t uid);
-void prdebug(const char* fmt, ...) __printflike(1, 2);
-
-// Furnished in LogStatistics.cpp.
-size_t sizesTotal();
-// Caller must own and free returned value
-char* pidToName(pid_t pid);
-char* tidToName(pid_t tid);
-
-// Furnished in LogTags.cpp. Thread safe.
-const char* tagToName(uint32_t tag);
-void ReReadEventLogTags();
-
-// Furnished by LogKlog.cpp
-char* log_strntok_r(char* s, ssize_t& len, char*& saveptr, ssize_t& sublen);
-
-// needle should reference a string longer than 1 character
-static inline const char* strnstr(const char* s, ssize_t len,
-                                  const char* needle) {
-    if (len <= 0) return nullptr;
-
-    const char c = *needle++;
-    const size_t needleLen = strlen(needle);
-    do {
-        do {
-            if (len <= (ssize_t)needleLen) return nullptr;
-            --len;
-        } while (*s++ != c);
-    } while (fastcmp<memcmp>(s, needle, needleLen));
-    s--;
-    return s;
-}
-}
-
-// Furnished in LogCommand.cpp
-bool clientHasLogCredentials(uid_t uid, gid_t gid, pid_t pid);
-bool clientHasLogCredentials(SocketClient* cli);
-
-static inline bool worstUidEnabledForLogid(log_id_t id) {
-    return (id == LOG_ID_MAIN) || (id == LOG_ID_SYSTEM) ||
-           (id == LOG_ID_RADIO) || (id == LOG_ID_EVENTS);
-}
-
-#endif  // _LOGD_LOG_UTILS_H__
diff --git a/logd/LogWhiteBlackList.cpp b/logd/LogWhiteBlackList.cpp
deleted file mode 100644
index 9d762dc..0000000
--- a/logd/LogWhiteBlackList.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <ctype.h>
-
-#include <android-base/stringprintf.h>
-#include <cutils/properties.h>
-
-#include "LogWhiteBlackList.h"
-
-// White and Black list
-
-Prune::Prune(uid_t uid, pid_t pid) : mUid(uid), mPid(pid) {
-}
-
-int Prune::cmp(uid_t uid, pid_t pid) const {
-    if ((mUid == uid_all) || (mUid == uid)) {
-        if (mPid == pid_all) {
-            return 0;
-        }
-        return pid - mPid;
-    }
-    return uid - mUid;
-}
-
-std::string Prune::format() {
-    if (mUid != uid_all) {
-        if (mPid != pid_all) {
-            return android::base::StringPrintf("%u/%u", mUid, mPid);
-        }
-        return android::base::StringPrintf("%u", mUid);
-    }
-    if (mPid != pid_all) {
-        return android::base::StringPrintf("/%u", mPid);
-    }
-    // NB: mPid == pid_all can not happen if mUid == uid_all
-    return std::string("/");
-}
-
-PruneList::PruneList() {
-    init(nullptr);
-}
-
-PruneList::~PruneList() {
-    PruneCollection::iterator it;
-    for (it = mNice.begin(); it != mNice.end();) {
-        it = mNice.erase(it);
-    }
-    for (it = mNaughty.begin(); it != mNaughty.end();) {
-        it = mNaughty.erase(it);
-    }
-}
-
-int PruneList::init(const char* str) {
-    mWorstUidEnabled = true;
-    mWorstPidOfSystemEnabled = true;
-    PruneCollection::iterator it;
-    for (it = mNice.begin(); it != mNice.end();) {
-        it = mNice.erase(it);
-    }
-    for (it = mNaughty.begin(); it != mNaughty.end();) {
-        it = mNaughty.erase(it);
-    }
-
-    static const char _default[] = "default";
-    // default here means take ro.logd.filter, persist.logd.filter then
-    // internal default in that order.
-    if (str && !strcmp(str, _default)) {
-        str = nullptr;
-    }
-    static const char _disable[] = "disable";
-    if (str && !strcmp(str, _disable)) {
-        str = "";
-    }
-
-    std::string filter;
-
-    if (str) {
-        filter = str;
-    } else {
-        char property[PROPERTY_VALUE_MAX];
-        property_get("ro.logd.filter", property, _default);
-        filter = property;
-        property_get("persist.logd.filter", property, filter.c_str());
-        // default here means take ro.logd.filter
-        if (strcmp(property, _default)) {
-            filter = property;
-        }
-    }
-
-    // default here means take internal default.
-    if (filter == _default) {
-        // See README.property for description of filter format
-        filter = "~! ~1000/!";
-    }
-    if (filter == _disable) {
-        filter = "";
-    }
-
-    mWorstUidEnabled = false;
-    mWorstPidOfSystemEnabled = false;
-
-    for (str = filter.c_str(); *str; ++str) {
-        if (isspace(*str)) {
-            continue;
-        }
-
-        PruneCollection* list;
-        if ((*str == '~') || (*str == '!')) {  // ~ supported, ! undocumented
-            ++str;
-            // special case, translates to worst UID at priority in blacklist
-            if (*str == '!') {
-                mWorstUidEnabled = true;
-                ++str;
-                if (!*str) {
-                    break;
-                }
-                if (!isspace(*str)) {
-                    return 1;
-                }
-                continue;
-            }
-            // special case, translated to worst PID of System at priority
-            static const char worstPid[] = "1000/!";
-            if (!strncmp(str, worstPid, sizeof(worstPid) - 1)) {
-                mWorstPidOfSystemEnabled = true;
-                str += sizeof(worstPid) - 1;
-                if (!*str) {
-                    break;
-                }
-                if (!isspace(*str)) {
-                    return 1;
-                }
-                continue;
-            }
-            if (!*str) {
-                return 1;
-            }
-            list = &mNaughty;
-        } else {
-            list = &mNice;
-        }
-
-        uid_t uid = Prune::uid_all;
-        if (isdigit(*str)) {
-            uid = 0;
-            do {
-                uid = uid * 10 + *str++ - '0';
-            } while (isdigit(*str));
-        }
-
-        pid_t pid = Prune::pid_all;
-        if (*str == '/') {
-            ++str;
-            if (isdigit(*str)) {
-                pid = 0;
-                do {
-                    pid = pid * 10 + *str++ - '0';
-                } while (isdigit(*str));
-            }
-        }
-
-        if ((uid == Prune::uid_all) && (pid == Prune::pid_all)) {
-            return 1;
-        }
-
-        if (*str && !isspace(*str)) {
-            return 1;
-        }
-
-        // insert sequentially into list
-        PruneCollection::iterator it = list->begin();
-        while (it != list->end()) {
-            Prune& p = *it;
-            int m = uid - p.mUid;
-            if (m == 0) {
-                if (p.mPid == p.pid_all) {
-                    break;
-                }
-                if ((pid == p.pid_all) && (p.mPid != p.pid_all)) {
-                    it = list->erase(it);
-                    continue;
-                }
-                m = pid - p.mPid;
-            }
-            if (m <= 0) {
-                if (m < 0) {
-                    list->insert(it, Prune(uid, pid));
-                }
-                break;
-            }
-            ++it;
-        }
-        if (it == list->end()) {
-            list->push_back(Prune(uid, pid));
-        }
-        if (!*str) {
-            break;
-        }
-    }
-
-    return 0;
-}
-
-std::string PruneList::format() {
-    static const char nice_format[] = " %s";
-    const char* fmt = nice_format + 1;
-
-    std::string string;
-
-    if (mWorstUidEnabled) {
-        string = "~!";
-        fmt = nice_format;
-        if (mWorstPidOfSystemEnabled) {
-            string += " ~1000/!";
-        }
-    }
-
-    PruneCollection::iterator it;
-
-    for (it = mNice.begin(); it != mNice.end(); ++it) {
-        string += android::base::StringPrintf(fmt, (*it).format().c_str());
-        fmt = nice_format;
-    }
-
-    static const char naughty_format[] = " ~%s";
-    fmt = naughty_format + (*fmt != ' ');
-    for (it = mNaughty.begin(); it != mNaughty.end(); ++it) {
-        string += android::base::StringPrintf(fmt, (*it).format().c_str());
-        fmt = naughty_format;
-    }
-
-    return string;
-}
-
-// ToDo: Lists are in sorted order, Prune->cmp() returns + or -
-// If there is scaling issues, resort to a better algorithm than linear
-// based on these assumptions.
-
-bool PruneList::naughty(LogBufferElement* element) {
-    PruneCollection::iterator it;
-    for (it = mNaughty.begin(); it != mNaughty.end(); ++it) {
-        if (!(*it).cmp(element)) {
-            return true;
-        }
-    }
-    return false;
-}
-
-bool PruneList::nice(LogBufferElement* element) {
-    PruneCollection::iterator it;
-    for (it = mNice.begin(); it != mNice.end(); ++it) {
-        if (!(*it).cmp(element)) {
-            return true;
-        }
-    }
-    return false;
-}
diff --git a/logd/LogWhiteBlackList.h b/logd/LogWhiteBlackList.h
deleted file mode 100644
index 6e9893b..0000000
--- a/logd/LogWhiteBlackList.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef _LOGD_LOG_WHITE_BLACK_LIST_H__
-#define _LOGD_LOG_WHITE_BLACK_LIST_H__
-
-#include <sys/types.h>
-
-#include <string.h>
-#include <list>
-
-#include "LogBufferElement.h"
-
-// White and Blacklist
-
-class Prune {
-    friend class PruneList;
-
-    const uid_t mUid;
-    const pid_t mPid;
-    int cmp(uid_t uid, pid_t pid) const;
-
-   public:
-    static const uid_t uid_all = (uid_t)-1;
-    static const pid_t pid_all = (pid_t)-1;
-
-    Prune(uid_t uid, pid_t pid);
-
-    uid_t getUid() const {
-        return mUid;
-    }
-    pid_t getPid() const {
-        return mPid;
-    }
-
-    int cmp(LogBufferElement* e) const {
-        return cmp(e->getUid(), e->getPid());
-    }
-
-    std::string format();
-};
-
-typedef std::list<Prune> PruneCollection;
-
-class PruneList {
-    PruneCollection mNaughty;
-    PruneCollection mNice;
-    bool mWorstUidEnabled;
-    bool mWorstPidOfSystemEnabled;
-
-   public:
-    PruneList();
-    ~PruneList();
-
-    int init(const char* str);
-
-    bool naughty(LogBufferElement* element);
-    bool naughty(void) {
-        return !mNaughty.empty();
-    }
-    bool nice(LogBufferElement* element);
-    bool nice(void) {
-        return !mNice.empty();
-    }
-    bool worstUidEnabled() const {
-        return mWorstUidEnabled;
-    }
-    bool worstPidOfSystemEnabled() const {
-        return mWorstPidOfSystemEnabled;
-    }
-
-    std::string format();
-};
-
-#endif  // _LOGD_LOG_WHITE_BLACK_LIST_H__
diff --git a/logd/OWNERS b/logd/OWNERS
deleted file mode 100644
index 2394e32..0000000
--- a/logd/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-cferris@google.com
-tomcherry@google.com
diff --git a/logd/README.auditd b/logd/README.auditd
deleted file mode 100644
index 3f614a3..0000000
--- a/logd/README.auditd
+++ /dev/null
@@ -1,17 +0,0 @@
-Auditd Daemon
-
-The audit daemon is a simplified version of its desktop
-counterpart designed to gather the audit logs from the
-audit kernel subsystem. The audit subsystem of the kernel
-includes Linux Security Modules (LSM) messages as well.
-
-To enable the audit subsystem, you must add this to your
-kernel config:
-CONFIG_AUDIT=y
-
-To enable a LSM, you must consult that LSM's documentation, the
-example below is for SELinux:
-CONFIG_SECURITY_SELINUX=y
-
-This does not include possible dependencies that may need to be
-satisfied for that particular LSM.
diff --git a/logd/README.property b/logd/README.property
deleted file mode 100644
index 1b7e165..0000000
--- a/logd/README.property
+++ /dev/null
@@ -1,76 +0,0 @@
-The properties that logd and friends react to are:
-
-name                       type default  description
-ro.logd.auditd             bool   true   Enable selinux audit daemon
-ro.logd.auditd.dmesg       bool   true   selinux audit messages sent to dmesg.
-ro.logd.auditd.main        bool   true   selinux audit messages sent to main.
-ro.logd.auditd.events      bool   true   selinux audit messages sent to events.
-persist.logd.security      bool   false  Enable security buffer.
-ro.organization_owned      bool   false  Override persist.logd.security to false
-ro.logd.kernel             bool+ svelte+ Enable klogd daemon
-ro.logd.statistics         bool+ svelte+ Enable logcat -S statistics.
-ro.debuggable              number        if not "1", logd.statistics &
-                                         ro.logd.kernel default false.
-logd.logpersistd.enable    bool   auto   Safe to start logpersist daemon service
-logd.logpersistd          string persist Enable logpersist daemon, "logcatd"
-                                         turns on logcat -f in logd context.
-					 Responds to logcatd, clear and stop.
-logd.logpersistd.buffer          persist logpersistd buffers to collect
-logd.logpersistd.size            persist logpersistd size in MB
-logd.logpersistd.rotate_kbytes   	 persist logpersistd outout file size in KB.
-persist.logd.logpersistd   string        Enable logpersist daemon, "logcatd"
-                                         turns on logcat -f in logd context.
-persist.logd.logpersistd.buffer    all   logpersistd buffers to collect
-persist.logd.logpersistd.size      256   logpersistd size in MB
-persist.logd.logpersistd.count     256   sets max number of rotated logs to <count>.
-persist.logd.logpersistd.rotate_kbytes   1024  logpersistd output file size in KB
-persist.logd.size          number  ro    Global default size of the buffer for
-                                         all log ids at initial startup, at
-                                         runtime use: logcat -b all -G <value>
-ro.logd.size               number svelte default for persist.logd.size. Larger
-                                         platform default sizes than 256KB are
-                                         known to not scale well under log spam
-                                         pressure. Address the spam first,
-                                         resist increasing the log buffer.
-persist.logd.size.<buffer> number  ro    Size of the buffer for <buffer> log
-ro.logd.size.<buffer>      number svelte default for persist.logd.size.<buffer>
-ro.config.low_ram          bool   false  if true, logd.statistics,
-                                         ro.logd.kernel default false,
-                                         logd.size 64K instead of 256K.
-persist.logd.filter        string        Pruning filter to optimize content.
-                                         At runtime use: logcat -P "<string>"
-ro.logd.filter       string "~! ~1000/!" default for persist.logd.filter.
-                                         This default means to prune the
-                                         oldest entries of chattiest UID, and
-                                         the chattiest PID of system
-                                         (1000, or AID_SYSTEM).
-persist.logd.timestamp     string  ro    The recording timestamp source.
-                                         "m[onotonic]" is the only supported
-                                         key character, otherwise realtime.
-ro.logd.timestamp        string realtime default for persist.logd.timestamp
-log.tag                   string persist The global logging level, VERBOSE,
-                                         DEBUG, INFO, WARN, ERROR, ASSERT or
-                                         SILENT. Only the first character is
-                                         the key character.
-persist.log.tag            string build  default for log.tag
-log.tag.<tag>             string persist The <tag> specific logging level.
-persist.log.tag.<tag>      string build  default for log.tag.<tag>
-
-NB:
-- auto - managed by /init
-- bool+ - "true", "false" and comma separated list of "eng" (forced false if
-  ro.debuggable is not "1") or "svelte" (forced false if ro.config.low_ram is
-  true).
-- svelte - see ro.config.low_ram for details.
-- svelte+ - see ro.config.low_ram and ro.debuggable for details.
-- ro - <base property> temporary override, ro.<base property> platform default.
-- persist - <base property> override, persist.<base property> platform default.
-- build - VERBOSE for native, DEBUG for jvm isLoggable, or developer option.
-- number - support multipliers (K or M) for convenience. Range is limited
-  to between 64K and 256M for log buffer sizes. Individual log buffer ids
-  such as main, system, ... override global default.
-- Pruning filter is of form of a space-separated list of [~][UID][/PID]
-  references, where '~' prefix means to blacklist otherwise whitelist. For
-  blacklisting, UID or PID may be a '!' to instead reference the chattiest
-  client, with the restriction that the PID must be in the UID group 1000
-  (system or AID_SYSTEM).
diff --git a/logd/auditctl.cpp b/logd/auditctl.cpp
deleted file mode 100644
index 98bb02d..0000000
--- a/logd/auditctl.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#include <android-base/parseint.h>
-#include <error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "libaudit.h"
-
-static void usage(const char* cmdline) {
-    fprintf(stderr, "Usage: %s [-r rate]\n", cmdline);
-}
-
-static void do_update_rate(uint32_t rate) {
-    int fd = audit_open();
-    if (fd == -1) {
-        error(EXIT_FAILURE, errno, "Unable to open audit socket");
-    }
-    int result = audit_rate_limit(fd, rate);
-    close(fd);
-    if (result < 0) {
-        fprintf(stderr, "Can't update audit rate limit: %d\n", result);
-        exit(EXIT_FAILURE);
-    }
-}
-
-int main(int argc, char* argv[]) {
-    uint32_t rate = 0;
-    bool update_rate = false;
-    int opt;
-
-    while ((opt = getopt(argc, argv, "r:")) != -1) {
-        switch (opt) {
-            case 'r':
-                if (!android::base::ParseUint<uint32_t>(optarg, &rate)) {
-                    error(EXIT_FAILURE, errno, "Invalid Rate");
-                }
-                update_rate = true;
-                break;
-            default: /* '?' */
-                usage(argv[0]);
-                exit(EXIT_FAILURE);
-        }
-    }
-
-    // In the future, we may add other options to auditctl
-    // so this if statement will expand.
-    // if (!update_rate && !update_backlog && !update_whatever) ...
-    if (!update_rate) {
-        fprintf(stderr, "Nothing to do\n");
-        usage(argv[0]);
-        exit(EXIT_FAILURE);
-    }
-
-    if (update_rate) {
-        do_update_rate(rate);
-    }
-
-    return 0;
-}
diff --git a/logd/event.logtags b/logd/event.logtags
deleted file mode 100644
index fa13a62..0000000
--- a/logd/event.logtags
+++ /dev/null
@@ -1,39 +0,0 @@
-# The entries in this file map a sparse set of log tag numbers to tag names.
-# This is installed on the device, in /system/etc, and parsed by logcat.
-#
-# Tag numbers are decimal integers, from 0 to 2^31.  (Let's leave the
-# negative values alone for now.)
-#
-# Tag names are one or more ASCII letters and numbers or underscores, i.e.
-# "[A-Z][a-z][0-9]_".  Do not include spaces or punctuation (the former
-# impacts log readability, the latter makes regex searches more annoying).
-#
-# Tag numbers and names are separated by whitespace.  Blank lines and lines
-# starting with '#' are ignored.
-#
-# Optionally, after the tag names can be put a description for the value(s)
-# of the tag. Description are in the format
-#    (<name>|data type[|data unit])
-# Multiple values are separated by commas.
-#
-# The data type is a number from the following values:
-# 1: int
-# 2: long
-# 3: string
-# 4: list
-#
-# The data unit is a number taken from the following list:
-# 1: Number of objects
-# 2: Number of bytes
-# 3: Number of milliseconds
-# 4: Number of allocations
-# 5: Id
-# 6: Percent
-# s: Number of seconds (monotonic time)
-# Default value for data of type int/long is 2 (bytes).
-#
-# TODO: generate ".java" and ".h" files with integer constants from this file.
-
-1003  auditd (avc|3)
-1004  chatty (dropped|3)
-1005  tag_def (tag|1),(name|3),(format|3)
diff --git a/logd/fuzz/Android.bp b/logd/fuzz/Android.bp
deleted file mode 100644
index 299242d..0000000
--- a/logd/fuzz/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-cc_fuzz {
-    name: "log_buffer_log_fuzzer",
-    srcs: [
-        "log_buffer_log_fuzzer.cpp",
-    ],
-    static_libs: [
-        "libbase",
-        "libcutils",
-        "libselinux",
-        "liblog",
-        "liblogd",
-        "libcutils",
-    ],
-    cflags: ["-Werror"],
-}
diff --git a/logd/fuzz/log_buffer_log_fuzzer.cpp b/logd/fuzz/log_buffer_log_fuzzer.cpp
deleted file mode 100644
index 4d1589b..0000000
--- a/logd/fuzz/log_buffer_log_fuzzer.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-#include <string>
-
-#include "../LogBuffer.h"
-#include "../LogTimes.h"
-
-// We don't want to waste a lot of entropy on messages
-#define MAX_MSG_LENGTH 5
-
-// Tag IDs usually start at 1000, we only want to try 1000 through 1009
-#define MIN_TAG_ID 1000
-#define TAG_MOD 10
-
-namespace android {
-struct LogInput {
-  public:
-    log_id_t log_id;
-    log_time realtime;
-    uid_t uid;
-    pid_t pid;
-    pid_t tid;
-    unsigned int log_mask;
-};
-
-int write_log_messages(const uint8_t** pdata, size_t* data_left, LogBuffer* log_buffer) {
-    const uint8_t* data = *pdata;
-    const LogInput* logInput = reinterpret_cast<const LogInput*>(data);
-    data += sizeof(LogInput);
-    *data_left -= sizeof(LogInput);
-
-    uint32_t tag = MIN_TAG_ID + data[0] % TAG_MOD;
-    uint8_t msg_length = data[1] % MAX_MSG_LENGTH;
-    if (msg_length < 2) {
-        // Not enough data for message
-        return 0;
-    }
-
-    data += 2 * sizeof(uint8_t);
-    *data_left -= 2 * sizeof(uint8_t);
-
-    if (*data_left < msg_length) {
-        // Not enough data for tag and message
-        *pdata = data;
-        return 0;
-    }
-
-    // We need nullterm'd strings
-    char msg[sizeof(uint32_t) + MAX_MSG_LENGTH + sizeof(char)];
-    char* msg_only = msg + sizeof(uint32_t);
-    memcpy(msg, &tag, sizeof(uint32_t));
-    memcpy(msg_only, data, msg_length);
-    msg_only[msg_length] = '\0';
-    data += msg_length;
-    *data_left -= msg_length;
-
-    // Other elements not in enum.
-    log_id_t log_id = static_cast<log_id_t>(unsigned(logInput->log_id) % (LOG_ID_MAX + 1));
-    log_buffer->log(log_id, logInput->realtime, logInput->uid, logInput->pid, logInput->tid, msg,
-                    sizeof(uint32_t) + msg_length + 1);
-    log_buffer->formatStatistics(logInput->uid, logInput->pid, logInput->log_mask);
-    *pdata = data;
-    return 1;
-}
-
-// Because system/core/logd/main.cpp redefines these.
-void prdebug(char const* fmt, ...) {
-    va_list ap;
-    va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-}
-char* uidToName(uid_t) {
-    return strdup("fake");
-}
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
-    // We want a random tag length and a random remaining message length
-    if (data == nullptr || size < sizeof(LogInput) + 2 * sizeof(uint8_t)) {
-        return 0;
-    }
-
-    LastLogTimes times;
-    LogBuffer log_buffer(&times);
-    size_t data_left = size;
-    const uint8_t** pdata = &data;
-
-    log_buffer.enableStatistics();
-    log_buffer.initPrune(nullptr);
-    // We want to get pruning code to get called.
-    log_id_for_each(i) { log_buffer.setSize(i, 10000); }
-
-    while (data_left >= sizeof(LogInput) + 2 * sizeof(uint8_t)) {
-        if (!write_log_messages(pdata, &data_left, &log_buffer)) {
-            return 0;
-        }
-    }
-
-    log_id_for_each(i) { log_buffer.clear(i); }
-    return 0;
-}
-}  // namespace android
diff --git a/logd/libaudit.c b/logd/libaudit.c
deleted file mode 100644
index f452c71..0000000
--- a/logd/libaudit.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright 2012, Samsung Telecommunications of America
- * Copyright (C) 2014 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.
- *
- * Written by William Roberts <w.roberts@sta.samsung.com>
- *
- */
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libaudit.h"
-
-/**
- * Waits for an ack from the kernel
- * @param fd
- *  The netlink socket fd
- * @return
- *  This function returns 0 on success, else -errno.
- */
-static int get_ack(int fd) {
-    int rc;
-    struct audit_message rep;
-
-    /* Sanity check, this is an internal interface this shouldn't happen */
-    if (fd < 0) {
-        return -EINVAL;
-    }
-
-    rc = audit_get_reply(fd, &rep, GET_REPLY_BLOCKING, MSG_PEEK);
-    if (rc < 0) {
-        return rc;
-    }
-
-    if (rep.nlh.nlmsg_type == NLMSG_ERROR) {
-        audit_get_reply(fd, &rep, GET_REPLY_BLOCKING, 0);
-        rc = ((struct nlmsgerr*)rep.data)->error;
-        if (rc) {
-            return -rc;
-        }
-    }
-
-    return 0;
-}
-
-/**
- *
- * @param fd
- *  The netlink socket fd
- * @param type
- *  The type of netlink message
- * @param data
- *  The data to send
- * @param size
- *  The length of the data in bytes
- * @return
- *  This function returns a positive sequence number on success, else -errno.
- */
-static int audit_send(int fd, int type, const void* data, size_t size) {
-    int rc;
-    static int16_t sequence = 0;
-    struct audit_message req;
-    struct sockaddr_nl addr;
-
-    memset(&req, 0, sizeof(req));
-    memset(&addr, 0, sizeof(addr));
-
-    /* We always send netlink messaged */
-    addr.nl_family = AF_NETLINK;
-
-    /* Set up the netlink headers */
-    req.nlh.nlmsg_type = type;
-    req.nlh.nlmsg_len = NLMSG_SPACE(size);
-    req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-
-    /*
-     * Check for a valid fd, even though sendto would catch this, its easier
-     * to always blindly increment the sequence number
-     */
-    if (fd < 0) {
-        return -EBADF;
-    }
-
-    /* Ensure the message is not too big */
-    if (NLMSG_SPACE(size) > MAX_AUDIT_MESSAGE_LENGTH) {
-        return -EINVAL;
-    }
-
-    /* Only memcpy in the data if it was specified */
-    if (size && data) {
-        memcpy(NLMSG_DATA(&req.nlh), data, size);
-    }
-
-    /*
-     * Only increment the sequence number on a guarantee
-     * you will send it to the kernel.
-     *
-     * Also, the sequence is defined as a u32 in the kernel
-     * struct. Using an int here might not work on 32/64 bit splits. A
-     * signed 64 bit value can overflow a u32..but a u32
-     * might not fit in the response, so we need to use s32.
-     * Which is still kind of hackish since int could be 16 bits
-     * in size. The only safe type to use here is a signed 16
-     * bit value.
-     */
-    req.nlh.nlmsg_seq = ++sequence;
-
-    /* While failing and its due to interrupts */
-
-    rc = TEMP_FAILURE_RETRY(sendto(fd, &req, req.nlh.nlmsg_len, 0,
-                                   (struct sockaddr*)&addr, sizeof(addr)));
-
-    /* Not all the bytes were sent */
-    if (rc < 0) {
-        rc = -errno;
-        goto out;
-    } else if ((uint32_t)rc != req.nlh.nlmsg_len) {
-        rc = -EPROTO;
-        goto out;
-    }
-
-    /* We sent all the bytes, get the ack */
-    rc = get_ack(fd);
-
-    /* If the ack failed, return the error, else return the sequence number */
-    rc = (rc == 0) ? (int)sequence : rc;
-
-out:
-    /* Don't let sequence roll to negative */
-    if (sequence < 0) {
-        sequence = 0;
-    }
-
-    return rc;
-}
-
-int audit_setup(int fd, pid_t pid) {
-    int rc;
-    struct audit_message rep;
-    struct audit_status status;
-
-    memset(&status, 0, sizeof(status));
-
-    /*
-     * In order to set the auditd PID we send an audit message over the netlink
-     * socket with the pid field of the status struct set to our current pid,
-     * and the the mask set to AUDIT_STATUS_PID
-     */
-    status.pid = pid;
-    status.mask = AUDIT_STATUS_PID;
-
-    /* Let the kernel know this pid will be registering for audit events */
-    rc = audit_send(fd, AUDIT_SET, &status, sizeof(status));
-    if (rc < 0) {
-        return rc;
-    }
-
-    /*
-     * In a request where we need to wait for a response, wait for the message
-     * and discard it. This message confirms and sync's us with the kernel.
-     * This daemon is now registered as the audit logger.
-     *
-     * TODO
-     * If the daemon dies and restarts the message didn't come back,
-     * so I went to non-blocking and it seemed to fix the bug.
-     * Need to investigate further.
-     */
-    audit_get_reply(fd, &rep, GET_REPLY_NONBLOCKING, 0);
-
-    return 0;
-}
-
-int audit_open() {
-    return socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_AUDIT);
-}
-
-int audit_rate_limit(int fd, uint32_t limit) {
-    struct audit_status status;
-    memset(&status, 0, sizeof(status));
-    status.mask = AUDIT_STATUS_RATE_LIMIT;
-    status.rate_limit = limit; /* audit entries per second */
-    return audit_send(fd, AUDIT_SET, &status, sizeof(status));
-}
-
-int audit_get_reply(int fd, struct audit_message* rep, reply_t block, int peek) {
-    ssize_t len;
-    int flags;
-    int rc = 0;
-
-    struct sockaddr_nl nladdr;
-    socklen_t nladdrlen = sizeof(nladdr);
-
-    if (fd < 0) {
-        return -EBADF;
-    }
-
-    /* Set up the flags for recv from */
-    flags = (block == GET_REPLY_NONBLOCKING) ? MSG_DONTWAIT : 0;
-    flags |= peek;
-
-    /*
-     * Get the data from the netlink socket but on error we need to be carefull,
-     * the interface shows that EINTR can never be returned, other errors,
-     * however, can be returned.
-     */
-    len = TEMP_FAILURE_RETRY(recvfrom(fd, rep, sizeof(*rep), flags,
-                                      (struct sockaddr*)&nladdr, &nladdrlen));
-
-    /*
-     * EAGAIN should be re-tried until success or another error manifests.
-     */
-    if (len < 0) {
-        rc = -errno;
-        if (block == GET_REPLY_NONBLOCKING && rc == -EAGAIN) {
-            /* If request is non blocking and errno is EAGAIN, just return 0 */
-            return 0;
-        }
-        return rc;
-    }
-
-    if (nladdrlen != sizeof(nladdr)) {
-        return -EPROTO;
-    }
-
-    /* Make sure the netlink message was not spoof'd */
-    if (nladdr.nl_pid) {
-        return -EINVAL;
-    }
-
-    /* Check if the reply from the kernel was ok */
-    if (!NLMSG_OK(&rep->nlh, (size_t)len)) {
-        rc = (len == sizeof(*rep)) ? -EFBIG : -EBADE;
-    }
-
-    return rc;
-}
-
-void audit_close(int fd) {
-    close(fd);
-}
diff --git a/logd/libaudit.h b/logd/libaudit.h
deleted file mode 100644
index b4a92a8..0000000
--- a/logd/libaudit.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2012, Samsung Telecommunications of America
- * Copyright (C) 2014 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.
- *
- * Written by William Roberts <w.roberts@sta.samsung.com>
- */
-
-#ifndef _LIBAUDIT_H_
-#define _LIBAUDIT_H_
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include <linux/audit.h>
-#include <linux/netlink.h>
-
-__BEGIN_DECLS
-
-#define MAX_AUDIT_MESSAGE_LENGTH 8970
-
-typedef enum { GET_REPLY_BLOCKING = 0, GET_REPLY_NONBLOCKING } reply_t;
-
-/* type == AUDIT_SIGNAL_INFO */
-struct audit_sig_info {
-    uid_t uid;
-    pid_t pid;
-    char ctx[0];
-};
-
-struct audit_message {
-    struct nlmsghdr nlh;
-    char data[MAX_AUDIT_MESSAGE_LENGTH];
-};
-
-/**
- * Opens a connection to the Audit netlink socket
- * @return
- *  A valid fd on success or < 0 on error with errno set.
- *  Returns the same errors as man 2 socket.
- */
-extern int audit_open(void);
-
-/**
- * Closes the fd returned from audit_open()
- * @param fd
- *  The fd to close
- */
-extern void audit_close(int fd);
-
-/**
- *
- * @param fd
- *  The fd returned by a call to audit_open()
- * @param rep
- *  The response struct to store the response in.
- * @param block
- *  Whether or not to block on IO
- * @param peek
- *  Whether or not we are to remove the message from
- *  the queue when we do a read on the netlink socket.
- * @return
- *  This function returns 0 on success, else -errno.
- */
-extern int audit_get_reply(int fd, struct audit_message* rep, reply_t block,
-                           int peek);
-
-/**
- * Sets a pid to receive audit netlink events from the kernel
- * @param fd
- *  The fd returned by a call to audit_open()
- * @param pid
- *  The pid whom to set as the receiver of audit messages
- * @return
- *  This function returns 0 on success, -errno on error.
- */
-extern int audit_setup(int fd, pid_t pid);
-
-/**
- * Throttle kernel messages at the provided rate
- * @param fd
- *  The fd returned by a call to audit_open()
- * @param rate
- *  The rate, in messages per second, above which the kernel
- *  should drop audit messages.
- * @return
- *  This function returns 0 on success, -errno on error.
- */
-extern int audit_rate_limit(int fd, uint32_t limit);
-
-__END_DECLS
-
-#endif
diff --git a/logd/logd.rc b/logd/logd.rc
deleted file mode 100644
index 530f342..0000000
--- a/logd/logd.rc
+++ /dev/null
@@ -1,35 +0,0 @@
-service logd /system/bin/logd
-    socket logd stream 0666 logd logd
-    socket logdr seqpacket 0666 logd logd
-    socket logdw dgram+passcred 0222 logd logd
-    file /proc/kmsg r
-    file /dev/kmsg w
-    user logd
-    group logd system package_info readproc
-    capabilities SYSLOG AUDIT_CONTROL
-    priority 10
-    writepid /dev/cpuset/system-background/tasks
-
-service logd-reinit /system/bin/logd --reinit
-    oneshot
-    disabled
-    user logd
-    group logd
-    writepid /dev/cpuset/system-background/tasks
-
-# Limit SELinux denial generation to 5/second
-service logd-auditctl /system/bin/auditctl -r 5
-    oneshot
-    disabled
-    user logd
-    group logd
-    capabilities AUDIT_CONTROL
-
-on fs
-    write /dev/event-log-tags "# content owned by logd
-"
-    chown logd logd /dev/event-log-tags
-    chmod 0644 /dev/event-log-tags
-
-on property:sys.boot_completed=1
-    start logd-auditctl
diff --git a/logd/logtagd.rc b/logd/logtagd.rc
deleted file mode 100644
index 248a78c..0000000
--- a/logd/logtagd.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# logtagd event log tag service (debug only)
-#
-on post-fs-data
-    mkdir /data/misc/logd 0750 logd log
-    write /data/misc/logd/event-log-tags ""
-    chown logd log /data/misc/logd/event-log-tags
-    chmod 0600 /data/misc/logd/event-log-tags
-    restorecon /data/misc/logd/event-log-tags
diff --git a/logd/main.cpp b/logd/main.cpp
deleted file mode 100644
index acf9a07..0000000
--- a/logd/main.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Copyright (C) 2012-2013 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.
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/capability.h>
-#include <poll.h>
-#include <sched.h>
-#include <semaphore.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/capability.h>
-#include <sys/klog.h>
-#include <sys/prctl.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <syslog.h>
-#include <unistd.h>
-
-#include <memory>
-
-#include <android-base/macros.h>
-#include <cutils/android_get_control_file.h>
-#include <cutils/properties.h>
-#include <cutils/sockets.h>
-#include <log/event_tag_map.h>
-#include <packagelistparser/packagelistparser.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-#include <processgroup/sched_policy.h>
-#include <utils/threads.h>
-
-#include "CommandListener.h"
-#include "LogAudit.h"
-#include "LogBuffer.h"
-#include "LogKlog.h"
-#include "LogListener.h"
-#include "LogUtils.h"
-
-#define KMSG_PRIORITY(PRI)                                 \
-    '<', '0' + LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(PRI)) / 10, \
-        '0' + LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(PRI)) % 10, '>'
-
-// The service is designed to be run by init, it does not respond well to starting up manually. Init
-// has a 'sigstop' feature that sends SIGSTOP to a service immediately before calling exec().  This
-// allows debuggers, etc to be attached to logd at the very beginning, while still having init
-// handle the user, groups, capabilities, files, etc setup.
-static int DropPrivs(bool klogd, bool auditd) {
-    if (set_sched_policy(0, SP_BACKGROUND) < 0) {
-        android::prdebug("failed to set background scheduling policy");
-        return -1;
-    }
-
-    sched_param param = {};
-    if (sched_setscheduler((pid_t)0, SCHED_BATCH, &param) < 0) {
-        android::prdebug("failed to set batch scheduler");
-        return -1;
-    }
-
-    if (!__android_logger_property_get_bool("ro.debuggable",
-                                            BOOL_DEFAULT_FALSE) &&
-        prctl(PR_SET_DUMPABLE, 0) == -1) {
-        android::prdebug("failed to clear PR_SET_DUMPABLE");
-        return -1;
-    }
-
-    std::unique_ptr<struct _cap_struct, int (*)(void*)> caps(cap_init(), cap_free);
-    if (cap_clear(caps.get()) < 0) {
-        android::prdebug("cap_clear() failed");
-        return -1;
-    }
-    if (klogd) {
-        cap_value_t cap_syslog = CAP_SYSLOG;
-        if (cap_set_flag(caps.get(), CAP_PERMITTED, 1, &cap_syslog, CAP_SET) < 0 ||
-            cap_set_flag(caps.get(), CAP_EFFECTIVE, 1, &cap_syslog, CAP_SET) < 0) {
-            android::prdebug("Failed to set CAP_SYSLOG");
-            return -1;
-        }
-    }
-    if (auditd) {
-        cap_value_t cap_audit_control = CAP_AUDIT_CONTROL;
-        if (cap_set_flag(caps.get(), CAP_PERMITTED, 1, &cap_audit_control, CAP_SET) < 0 ||
-            cap_set_flag(caps.get(), CAP_EFFECTIVE, 1, &cap_audit_control, CAP_SET) < 0) {
-            android::prdebug("Failed to set CAP_AUDIT_CONTROL");
-            return -1;
-        }
-    }
-    if (cap_set_proc(caps.get()) < 0) {
-        android::prdebug("failed to set CAP_SYSLOG or CAP_AUDIT_CONTROL (%d)", errno);
-        return -1;
-    }
-
-    return 0;
-}
-
-// Property helper
-static bool check_flag(const char* prop, const char* flag) {
-    const char* cp = strcasestr(prop, flag);
-    if (!cp) {
-        return false;
-    }
-    // We only will document comma (,)
-    static const char sep[] = ",:;|+ \t\f";
-    if ((cp != prop) && !strchr(sep, cp[-1])) {
-        return false;
-    }
-    cp += strlen(flag);
-    return !*cp || !!strchr(sep, *cp);
-}
-
-static int fdDmesg = -1;
-void android::prdebug(const char* fmt, ...) {
-    if (fdDmesg < 0) {
-        return;
-    }
-
-    static const char message[] = {
-        KMSG_PRIORITY(LOG_DEBUG), 'l', 'o', 'g', 'd', ':', ' '
-    };
-    char buffer[256];
-    memcpy(buffer, message, sizeof(message));
-
-    va_list ap;
-    va_start(ap, fmt);
-    int n = vsnprintf(buffer + sizeof(message),
-                      sizeof(buffer) - sizeof(message), fmt, ap);
-    va_end(ap);
-    if (n > 0) {
-        buffer[sizeof(buffer) - 1] = '\0';
-        if (!strchr(buffer, '\n')) {
-            buffer[sizeof(buffer) - 2] = '\0';
-            strlcat(buffer, "\n", sizeof(buffer));
-        }
-        write(fdDmesg, buffer, strlen(buffer));
-    }
-}
-
-static sem_t reinit;
-static bool reinit_running = false;
-static LogBuffer* logBuf = nullptr;
-
-static void* reinit_thread_start(void* /*obj*/) {
-    prctl(PR_SET_NAME, "logd.daemon");
-
-    while (reinit_running && !sem_wait(&reinit) && reinit_running) {
-        if (fdDmesg >= 0) {
-            static const char reinit_message[] = { KMSG_PRIORITY(LOG_INFO),
-                                                   'l',
-                                                   'o',
-                                                   'g',
-                                                   'd',
-                                                   '.',
-                                                   'd',
-                                                   'a',
-                                                   'e',
-                                                   'm',
-                                                   'o',
-                                                   'n',
-                                                   ':',
-                                                   ' ',
-                                                   'r',
-                                                   'e',
-                                                   'i',
-                                                   'n',
-                                                   'i',
-                                                   't',
-                                                   '\n' };
-            write(fdDmesg, reinit_message, sizeof(reinit_message));
-        }
-
-        // Anything that reads persist.<property>
-        if (logBuf) {
-            logBuf->init();
-            logBuf->initPrune(nullptr);
-        }
-        android::ReReadEventLogTags();
-    }
-
-    return nullptr;
-}
-
-char* android::uidToName(uid_t u) {
-    struct Userdata {
-        uid_t uid;
-        char* name;
-    } userdata = {
-            .uid = u,
-            .name = nullptr,
-    };
-
-    packagelist_parse(
-            [](pkg_info* info, void* callback_parameter) {
-                auto userdata = reinterpret_cast<Userdata*>(callback_parameter);
-                bool result = true;
-                if (info->uid == userdata->uid) {
-                    userdata->name = strdup(info->name);
-                    // false to stop processing
-                    result = false;
-                }
-                packagelist_free(info);
-                return result;
-            },
-            &userdata);
-
-    return userdata.name;
-}
-
-// Serves as a global method to trigger reinitialization
-// and as a function that can be provided to signal().
-void reinit_signal_handler(int /*signal*/) {
-    sem_post(&reinit);
-}
-
-static void readDmesg(LogAudit* al, LogKlog* kl) {
-    if (!al && !kl) {
-        return;
-    }
-
-    int rc = klogctl(KLOG_SIZE_BUFFER, nullptr, 0);
-    if (rc <= 0) {
-        return;
-    }
-
-    // Margin for additional input race or trailing nul
-    ssize_t len = rc + 1024;
-    std::unique_ptr<char[]> buf(new char[len]);
-
-    rc = klogctl(KLOG_READ_ALL, buf.get(), len);
-    if (rc <= 0) {
-        return;
-    }
-
-    if (rc < len) {
-        len = rc + 1;
-    }
-    buf[--len] = '\0';
-
-    if (kl && kl->isMonotonic()) {
-        kl->synchronize(buf.get(), len);
-    }
-
-    ssize_t sublen;
-    for (char *ptr = nullptr, *tok = buf.get();
-         (rc >= 0) && !!(tok = android::log_strntok_r(tok, len, ptr, sublen));
-         tok = nullptr) {
-        if ((sublen <= 0) || !*tok) continue;
-        if (al) {
-            rc = al->log(tok, sublen);
-        }
-        if (kl) {
-            rc = kl->log(tok, sublen);
-        }
-    }
-}
-
-static int issueReinit() {
-    int sock = TEMP_FAILURE_RETRY(socket_local_client(
-        "logd", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM));
-    if (sock < 0) return -errno;
-
-    static const char reinitStr[] = "reinit";
-    ssize_t ret = TEMP_FAILURE_RETRY(write(sock, reinitStr, sizeof(reinitStr)));
-    if (ret < 0) return -errno;
-
-    struct pollfd p;
-    memset(&p, 0, sizeof(p));
-    p.fd = sock;
-    p.events = POLLIN;
-    ret = TEMP_FAILURE_RETRY(poll(&p, 1, 1000));
-    if (ret < 0) return -errno;
-    if ((ret == 0) || !(p.revents & POLLIN)) return -ETIME;
-
-    static const char success[] = "success";
-    char buffer[sizeof(success) - 1];
-    memset(buffer, 0, sizeof(buffer));
-    ret = TEMP_FAILURE_RETRY(read(sock, buffer, sizeof(buffer)));
-    if (ret < 0) return -errno;
-
-    return strncmp(buffer, success, sizeof(success) - 1) != 0;
-}
-
-// Foreground waits for exit of the main persistent threads
-// that are started here. The threads are created to manage
-// UNIX domain client sockets for writing, reading and
-// controlling the user space logger, and for any additional
-// logging plugins like auditd and restart control. Additional
-// transitory per-client threads are created for each reader.
-int main(int argc, char* argv[]) {
-    // logd is written under the assumption that the timezone is UTC.
-    // If TZ is not set, persist.sys.timezone is looked up in some time utility
-    // libc functions, including mktime. It confuses the logd time handling,
-    // so here explicitly set TZ to UTC, which overrides the property.
-    setenv("TZ", "UTC", 1);
-    // issue reinit command. KISS argument parsing.
-    if ((argc > 1) && argv[1] && !strcmp(argv[1], "--reinit")) {
-        return issueReinit();
-    }
-
-    static const char dev_kmsg[] = "/dev/kmsg";
-    fdDmesg = android_get_control_file(dev_kmsg);
-    if (fdDmesg < 0) {
-        fdDmesg = TEMP_FAILURE_RETRY(open(dev_kmsg, O_WRONLY | O_CLOEXEC));
-    }
-
-    int fdPmesg = -1;
-    bool klogd = __android_logger_property_get_bool(
-        "ro.logd.kernel",
-        BOOL_DEFAULT_TRUE | BOOL_DEFAULT_FLAG_ENG | BOOL_DEFAULT_FLAG_SVELTE);
-    if (klogd) {
-        static const char proc_kmsg[] = "/proc/kmsg";
-        fdPmesg = android_get_control_file(proc_kmsg);
-        if (fdPmesg < 0) {
-            fdPmesg = TEMP_FAILURE_RETRY(
-                open(proc_kmsg, O_RDONLY | O_NDELAY | O_CLOEXEC));
-        }
-        if (fdPmesg < 0) android::prdebug("Failed to open %s\n", proc_kmsg);
-    }
-
-    bool auditd = __android_logger_property_get_bool("ro.logd.auditd", BOOL_DEFAULT_TRUE);
-    if (DropPrivs(klogd, auditd) != 0) {
-        return EXIT_FAILURE;
-    }
-
-    // Reinit Thread
-    sem_init(&reinit, 0, 0);
-    pthread_attr_t attr;
-    if (!pthread_attr_init(&attr)) {
-        struct sched_param param;
-
-        memset(&param, 0, sizeof(param));
-        pthread_attr_setschedparam(&attr, &param);
-        pthread_attr_setschedpolicy(&attr, SCHED_BATCH);
-        if (!pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
-            pthread_t thread;
-            reinit_running = true;
-            if (pthread_create(&thread, &attr, reinit_thread_start, nullptr)) {
-                reinit_running = false;
-            }
-        }
-        pthread_attr_destroy(&attr);
-    }
-
-    // Serves the purpose of managing the last logs times read on a
-    // socket connection, and as a reader lock on a range of log
-    // entries.
-
-    LastLogTimes* times = new LastLogTimes();
-
-    // LogBuffer is the object which is responsible for holding all
-    // log entries.
-
-    logBuf = new LogBuffer(times);
-
-    signal(SIGHUP, reinit_signal_handler);
-
-    if (__android_logger_property_get_bool(
-            "logd.statistics", BOOL_DEFAULT_TRUE | BOOL_DEFAULT_FLAG_PERSIST |
-                                   BOOL_DEFAULT_FLAG_ENG |
-                                   BOOL_DEFAULT_FLAG_SVELTE)) {
-        logBuf->enableStatistics();
-    }
-
-    // LogReader listens on /dev/socket/logdr. When a client
-    // connects, log entries in the LogBuffer are written to the client.
-
-    LogReader* reader = new LogReader(logBuf);
-    if (reader->startListener()) {
-        return EXIT_FAILURE;
-    }
-
-    // LogListener listens on /dev/socket/logdw for client
-    // initiated log messages. New log entries are added to LogBuffer
-    // and LogReader is notified to send updates to connected clients.
-
-    LogListener* swl = new LogListener(logBuf, reader);
-    // Backlog and /proc/sys/net/unix/max_dgram_qlen set to large value
-    if (swl->startListener(600)) {
-        return EXIT_FAILURE;
-    }
-
-    // Command listener listens on /dev/socket/logd for incoming logd
-    // administrative commands.
-
-    CommandListener* cl = new CommandListener(logBuf, reader, swl);
-    if (cl->startListener()) {
-        return EXIT_FAILURE;
-    }
-
-    // LogAudit listens on NETLINK_AUDIT socket for selinux
-    // initiated log messages. New log entries are added to LogBuffer
-    // and LogReader is notified to send updates to connected clients.
-
-    LogAudit* al = nullptr;
-    if (auditd) {
-        al = new LogAudit(logBuf, reader,
-                          __android_logger_property_get_bool(
-                              "ro.logd.auditd.dmesg", BOOL_DEFAULT_TRUE)
-                              ? fdDmesg
-                              : -1);
-    }
-
-    LogKlog* kl = nullptr;
-    if (klogd) {
-        kl = new LogKlog(logBuf, reader, fdDmesg, fdPmesg, al != nullptr);
-    }
-
-    readDmesg(al, kl);
-
-    // failure is an option ... messages are in dmesg (required by standard)
-
-    if (kl && kl->startListener()) {
-        delete kl;
-    }
-
-    if (al && al->startListener()) {
-        delete al;
-    }
-
-    TEMP_FAILURE_RETRY(pause());
-
-    return EXIT_SUCCESS;
-}
diff --git a/logd/tests/Android.bp b/logd/tests/Android.bp
deleted file mode 100644
index 9a5defa..0000000
--- a/logd/tests/Android.bp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// Copyright (C) 2014 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.
-//
-
-// -----------------------------------------------------------------------------
-// Unit tests.
-// -----------------------------------------------------------------------------
-
-cc_defaults {
-    name: "logd-unit-test-defaults",
-
-    cflags: [
-        "-fstack-protector-all",
-        "-g",
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-fno-builtin",
-
-        "-DAUDITD_LOG_TAG=1003",
-        "-DCHATTY_LOG_TAG=1004",
-    ],
-
-    srcs: ["logd_test.cpp"],
-
-    static_libs: [
-        "libbase",
-        "libcutils",
-        "libselinux",
-        "liblog",
-    ],
-}
-
-// Build tests for the logger. Run with:
-//   adb shell /data/nativetest/logd-unit-tests/logd-unit-tests
-cc_test {
-    name: "logd-unit-tests",
-    defaults: ["logd-unit-test-defaults"],
-}
-
-cc_test {
-    name: "CtsLogdTestCases",
-    defaults: ["logd-unit-test-defaults"],
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-    test_suites: [
-        "cts",
-        "vts10",
-    ],
-}
diff --git a/logd/tests/AndroidTest.xml b/logd/tests/AndroidTest.xml
deleted file mode 100644
index a25dc44..0000000
--- a/logd/tests/AndroidTest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<configuration description="Config for CTS Logging Daemon test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-        <option name="cleanup" value="true" />
-        <option name="push" value="CtsLogdTestCases->/data/local/tmp/CtsLogdTestCases" />
-        <option name="append-bitness" value="true" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="CtsLogdTestCases" />
-        <option name="runtime-hint" value="65s" />
-    </test>
-</configuration>
diff --git a/logd/tests/logd_test.cpp b/logd/tests/logd_test.cpp
deleted file mode 100644
index 10bac62..0000000
--- a/logd/tests/logd_test.cpp
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include <ctype.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-
-#include <android-base/file.h>
-#include <android-base/macros.h>
-#include <android-base/stringprintf.h>
-#include <cutils/sockets.h>
-#include <gtest/gtest.h>
-#include <private/android_filesystem_config.h>
-#include <private/android_logger.h>
-#ifdef __ANDROID__
-#include <selinux/selinux.h>
-#endif
-
-#include "../LogReader.h"  // pickup LOGD_SNDTIMEO
-
-#ifdef __ANDROID__
-static void send_to_control(char* buf, size_t len) {
-    int sock = socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                   SOCK_STREAM);
-    if (sock >= 0) {
-        if (write(sock, buf, strlen(buf) + 1) > 0) {
-            ssize_t ret;
-            while ((ret = read(sock, buf, len)) > 0) {
-                if (((size_t)ret == len) || (len < PAGE_SIZE)) {
-                    break;
-                }
-                len -= ret;
-                buf += ret;
-
-                struct pollfd p = {.fd = sock, .events = POLLIN, .revents = 0 };
-
-                ret = poll(&p, 1, 20);
-                if ((ret <= 0) || !(p.revents & POLLIN)) {
-                    break;
-                }
-            }
-        }
-        close(sock);
-    }
-}
-
-/*
- * returns statistics
- */
-static void my_android_logger_get_statistics(char* buf, size_t len) {
-    snprintf(buf, len, "getStatistics 0 1 2 3 4");
-    send_to_control(buf, len);
-}
-
-static void alloc_statistics(char** buffer, size_t* length) {
-    size_t len = 8192;
-    char* buf;
-
-    for (int retry = 32; (retry >= 0); delete[] buf, --retry) {
-        buf = new char[len];
-        my_android_logger_get_statistics(buf, len);
-
-        buf[len - 1] = '\0';
-        size_t ret = atol(buf) + 1;
-        if (ret < 4) {
-            delete[] buf;
-            buf = nullptr;
-            break;
-        }
-        bool check = ret <= len;
-        len = ret;
-        if (check) {
-            break;
-        }
-        len += len / 8;  // allow for some slop
-    }
-    *buffer = buf;
-    *length = len;
-}
-
-static char* find_benchmark_spam(char* cp) {
-    // liblog_benchmarks has been run designed to SPAM.  The signature of
-    // a noisiest UID statistics is:
-    //
-    // Chattiest UIDs in main log buffer:                           Size Pruned
-    // UID   PACKAGE                                                BYTES LINES
-    // 0     root                                                  54164 147569
-    //
-    char* benchmark = nullptr;
-    do {
-        static const char signature[] = "\n0     root ";
-
-        benchmark = strstr(cp, signature);
-        if (!benchmark) {
-            break;
-        }
-        cp = benchmark + sizeof(signature);
-        while (isspace(*cp)) {
-            ++cp;
-        }
-        benchmark = cp;
-#ifdef DEBUG
-        char* end = strstr(benchmark, "\n");
-        if (end == nullptr) {
-            end = benchmark + strlen(benchmark);
-        }
-        fprintf(stderr, "parse for spam counter in \"%.*s\"\n",
-                (int)(end - benchmark), benchmark);
-#endif
-        // content
-        while (isdigit(*cp)) {
-            ++cp;
-        }
-        while (isspace(*cp)) {
-            ++cp;
-        }
-        // optional +/- field?
-        if ((*cp == '-') || (*cp == '+')) {
-            while (isdigit(*++cp) || (*cp == '.') || (*cp == '%') ||
-                   (*cp == 'X')) {
-                ;
-            }
-            while (isspace(*cp)) {
-                ++cp;
-            }
-        }
-        // number of entries pruned
-        unsigned long value = 0;
-        while (isdigit(*cp)) {
-            value = value * 10ULL + *cp - '0';
-            ++cp;
-        }
-        if (value > 10UL) {
-            break;
-        }
-        benchmark = nullptr;
-    } while (*cp);
-    return benchmark;
-}
-#endif
-
-TEST(logd, statistics) {
-#ifdef __ANDROID__
-    size_t len;
-    char* buf;
-
-    // Drop cache so that any access problems can be discovered.
-    if (!android::base::WriteStringToFile("3\n", "/proc/sys/vm/drop_caches")) {
-        GTEST_LOG_(INFO) << "Could not open trigger dropping inode cache";
-    }
-
-    alloc_statistics(&buf, &len);
-
-    ASSERT_TRUE(nullptr != buf);
-
-    // remove trailing FF
-    char* cp = buf + len - 1;
-    *cp = '\0';
-    bool truncated = *--cp != '\f';
-    if (!truncated) {
-        *cp = '\0';
-    }
-
-    // squash out the byte count
-    cp = buf;
-    if (!truncated) {
-        while (isdigit(*cp) || (*cp == '\n')) {
-            ++cp;
-        }
-    }
-
-    fprintf(stderr, "%s", cp);
-
-    EXPECT_LT((size_t)64, strlen(cp));
-
-    EXPECT_EQ(0, truncated);
-
-    char* main_logs = strstr(cp, "\nChattiest UIDs in main ");
-    EXPECT_TRUE(nullptr != main_logs);
-
-    char* radio_logs = strstr(cp, "\nChattiest UIDs in radio ");
-    if (!radio_logs)
-        GTEST_LOG_(INFO) << "Value of: nullptr != radio_logs\n"
-                            "Actual: false\n"
-                            "Expected: false\n";
-
-    char* system_logs = strstr(cp, "\nChattiest UIDs in system ");
-    EXPECT_TRUE(nullptr != system_logs);
-
-    char* events_logs = strstr(cp, "\nChattiest UIDs in events ");
-    EXPECT_TRUE(nullptr != events_logs);
-
-    // Check if there is any " u0_a#### " as this means packagelistparser broken
-    char* used_getpwuid = nullptr;
-    int used_getpwuid_len;
-    char* uid_name = cp;
-    static const char getpwuid_prefix[] = " u0_a";
-    while ((uid_name = strstr(uid_name, getpwuid_prefix)) != nullptr) {
-        used_getpwuid = uid_name + 1;
-        uid_name += strlen(getpwuid_prefix);
-        while (isdigit(*uid_name)) ++uid_name;
-        used_getpwuid_len = uid_name - used_getpwuid;
-        if (isspace(*uid_name)) break;
-        used_getpwuid = nullptr;
-    }
-    EXPECT_TRUE(nullptr == used_getpwuid);
-    if (used_getpwuid) {
-        fprintf(stderr, "libpackagelistparser failed to pick up %.*s\n",
-                used_getpwuid_len, used_getpwuid);
-    }
-
-    delete[] buf;
-#else
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-#ifdef __ANDROID__
-static void caught_signal(int /* signum */) {
-}
-
-static void dump_log_msg(const char* prefix, log_msg* msg, int lid) {
-    std::cout << std::flush;
-    std::cerr << std::flush;
-    fflush(stdout);
-    fflush(stderr);
-    EXPECT_GE(msg->entry.hdr_size, sizeof(logger_entry));
-
-    fprintf(stderr, "%s: [%u] ", prefix, msg->len());
-    fprintf(stderr, "hdr_size=%u ", msg->entry.hdr_size);
-    fprintf(stderr, "pid=%u tid=%u %u.%09u ", msg->entry.pid, msg->entry.tid, msg->entry.sec,
-            msg->entry.nsec);
-    lid = msg->entry.lid;
-
-    switch (lid) {
-        case 0:
-            fprintf(stderr, "lid=main ");
-            break;
-        case 1:
-            fprintf(stderr, "lid=radio ");
-            break;
-        case 2:
-            fprintf(stderr, "lid=events ");
-            break;
-        case 3:
-            fprintf(stderr, "lid=system ");
-            break;
-        case 4:
-            fprintf(stderr, "lid=crash ");
-            break;
-        case 5:
-            fprintf(stderr, "lid=security ");
-            break;
-        case 6:
-            fprintf(stderr, "lid=kernel ");
-            break;
-        default:
-            if (lid >= 0) {
-                fprintf(stderr, "lid=%d ", lid);
-            }
-    }
-
-    unsigned int len = msg->entry.len;
-    fprintf(stderr, "msg[%u]={", len);
-    unsigned char* cp = reinterpret_cast<unsigned char*>(msg->msg());
-    if (!cp) {
-        static const unsigned char garbage[] = "<INVALID>";
-        cp = const_cast<unsigned char*>(garbage);
-        len = strlen(reinterpret_cast<const char*>(garbage));
-    }
-    while (len) {
-        unsigned char* p = cp;
-        while (*p && (((' ' <= *p) && (*p < 0x7F)) || (*p == '\n'))) {
-            ++p;
-        }
-        if (((p - cp) > 3) && !*p && ((unsigned int)(p - cp) < len)) {
-            fprintf(stderr, "\"");
-            while (*cp) {
-                if (*cp != '\n') {
-                    fprintf(stderr, "%c", *cp);
-                } else {
-                    fprintf(stderr, "\\n");
-                }
-                ++cp;
-                --len;
-            }
-            fprintf(stderr, "\"");
-        } else {
-            fprintf(stderr, "%02x", *cp);
-        }
-        ++cp;
-        if (--len) {
-            fprintf(stderr, ", ");
-        }
-    }
-    fprintf(stderr, "}\n");
-    fflush(stderr);
-}
-#endif
-
-#ifdef __ANDROID__
-// BAD ROBOT
-//   Benchmark threshold are generally considered bad form unless there is
-//   is some human love applied to the continued maintenance and whether the
-//   thresholds are tuned on a per-target basis. Here we check if the values
-//   are more than double what is expected. Doubling will not prevent failure
-//   on busy or low-end systems that could have a tendency to stretch values.
-//
-//   The primary goal of this test is to simulate a spammy app (benchmark
-//   being the worst) and check to make sure the logger can deal with it
-//   appropriately by checking all the statistics are in an expected range.
-//
-TEST(logd, benchmark) {
-    size_t len;
-    char* buf;
-
-    alloc_statistics(&buf, &len);
-    bool benchmark_already_run = buf && find_benchmark_spam(buf);
-    delete[] buf;
-
-    if (benchmark_already_run) {
-        fprintf(stderr,
-                "WARNING: spam already present and too much history\n"
-                "         false OK for prune by worst UID check\n");
-    }
-
-    FILE* fp;
-
-    // Introduce some extreme spam for the worst UID filter
-    ASSERT_TRUE(
-        nullptr !=
-        (fp = popen("/data/nativetest/liblog-benchmarks/liblog-benchmarks"
-                    " BM_log_maximum_retry"
-                    " BM_log_maximum"
-                    " BM_clock_overhead"
-                    " BM_log_print_overhead"
-                    " BM_log_latency"
-                    " BM_log_delay",
-                    "r")));
-
-    char buffer[5120];
-
-    static const char* benchmarks[] = {
-        "BM_log_maximum_retry ",  "BM_log_maximum ", "BM_clock_overhead ",
-        "BM_log_print_overhead ", "BM_log_latency ", "BM_log_delay "
-    };
-    static const unsigned int log_maximum_retry = 0;
-    static const unsigned int log_maximum = 1;
-    static const unsigned int clock_overhead = 2;
-    static const unsigned int log_print_overhead = 3;
-    static const unsigned int log_latency = 4;
-    static const unsigned int log_delay = 5;
-
-    unsigned long ns[arraysize(benchmarks)];
-
-    memset(ns, 0, sizeof(ns));
-
-    while (fgets(buffer, sizeof(buffer), fp)) {
-        for (unsigned i = 0; i < arraysize(ns); ++i) {
-            char* cp = strstr(buffer, benchmarks[i]);
-            if (!cp) {
-                continue;
-            }
-            sscanf(cp, "%*s %lu %lu", &ns[i], &ns[i]);
-            fprintf(stderr, "%-22s%8lu\n", benchmarks[i], ns[i]);
-        }
-    }
-    int ret = pclose(fp);
-
-    if (!WIFEXITED(ret) || (WEXITSTATUS(ret) == 127)) {
-        fprintf(stderr,
-                "WARNING: "
-                "/data/nativetest/liblog-benchmarks/liblog-benchmarks missing\n"
-                "         can not perform test\n");
-        return;
-    }
-
-    EXPECT_GE(200000UL, ns[log_maximum_retry]);  // 104734 user
-    EXPECT_NE(0UL, ns[log_maximum_retry]);       // failure to parse
-
-    EXPECT_GE(90000UL, ns[log_maximum]);  // 46913 user
-    EXPECT_NE(0UL, ns[log_maximum]);      // failure to parse
-
-    EXPECT_GE(4096UL, ns[clock_overhead]);  // 4095
-    EXPECT_NE(0UL, ns[clock_overhead]);     // failure to parse
-
-    EXPECT_GE(250000UL, ns[log_print_overhead]);  // 126886 user
-    EXPECT_NE(0UL, ns[log_print_overhead]);       // failure to parse
-
-    EXPECT_GE(10000000UL,
-              ns[log_latency]);  // 1453559 user space (background cgroup)
-    EXPECT_NE(0UL, ns[log_latency]);  // failure to parse
-
-    EXPECT_GE(20000000UL, ns[log_delay]);  // 10500289 user
-    EXPECT_NE(0UL, ns[log_delay]);         // failure to parse
-
-    alloc_statistics(&buf, &len);
-
-    bool collected_statistics = !!buf;
-    EXPECT_EQ(true, collected_statistics);
-
-    ASSERT_TRUE(nullptr != buf);
-
-    char* benchmark_statistics_found = find_benchmark_spam(buf);
-    ASSERT_TRUE(benchmark_statistics_found != nullptr);
-
-    // Check how effective the SPAM filter is, parse out Now size.
-    // 0     root                      54164 147569
-    //                                 ^-- benchmark_statistics_found
-
-    unsigned long nowSpamSize = atol(benchmark_statistics_found);
-
-    delete[] buf;
-
-    ASSERT_NE(0UL, nowSpamSize);
-
-    // Determine if we have the spam filter enabled
-    int sock = socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                   SOCK_STREAM);
-
-    ASSERT_TRUE(sock >= 0);
-
-    static const char getPruneList[] = "getPruneList";
-    if (write(sock, getPruneList, sizeof(getPruneList)) > 0) {
-        char buffer[80];
-        memset(buffer, 0, sizeof(buffer));
-        read(sock, buffer, sizeof(buffer));
-        char* cp = strchr(buffer, '\n');
-        if (!cp || (cp[1] != '~') || (cp[2] != '!')) {
-            close(sock);
-            fprintf(stderr,
-                    "WARNING: "
-                    "Logger has SPAM filtration turned off \"%s\"\n",
-                    buffer);
-            return;
-        }
-    } else {
-        int save_errno = errno;
-        close(sock);
-        FAIL() << "Can not send " << getPruneList << " to logger -- "
-               << strerror(save_errno);
-    }
-
-    static const unsigned long expected_absolute_minimum_log_size = 65536UL;
-    unsigned long totalSize = expected_absolute_minimum_log_size;
-    static const char getSize[] = { 'g', 'e', 't', 'L', 'o', 'g',
-                                    'S', 'i', 'z', 'e', ' ', LOG_ID_MAIN + '0',
-                                    '\0' };
-    if (write(sock, getSize, sizeof(getSize)) > 0) {
-        char buffer[80];
-        memset(buffer, 0, sizeof(buffer));
-        read(sock, buffer, sizeof(buffer));
-        totalSize = atol(buffer);
-        if (totalSize < expected_absolute_minimum_log_size) {
-            fprintf(stderr,
-                    "WARNING: "
-                    "Logger had unexpected referenced size \"%s\"\n",
-                    buffer);
-            totalSize = expected_absolute_minimum_log_size;
-        }
-    }
-    close(sock);
-
-    // logd allows excursions to 110% of total size
-    totalSize = (totalSize * 11) / 10;
-
-    // 50% threshold for SPAM filter (<20% typical, lots of engineering margin)
-    ASSERT_GT(totalSize, nowSpamSize * 2);
-}
-#endif
-
-// b/26447386 confirm fixed
-void timeout_negative(const char* command) {
-#ifdef __ANDROID__
-    log_msg msg_wrap, msg_timeout;
-    bool content_wrap = false, content_timeout = false, written = false;
-    unsigned int alarm_wrap = 0, alarm_timeout = 0;
-    // A few tries to get it right just in case wrap kicks in due to
-    // content providers being active during the test.
-    int i = 3;
-
-    while (--i) {
-        int fd = socket_local_client("logdr", ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                     SOCK_SEQPACKET);
-        ASSERT_LT(0, fd);
-
-        std::string ask(command);
-
-        struct sigaction ignore, old_sigaction;
-        memset(&ignore, 0, sizeof(ignore));
-        ignore.sa_handler = caught_signal;
-        sigemptyset(&ignore.sa_mask);
-        sigaction(SIGALRM, &ignore, &old_sigaction);
-        unsigned int old_alarm = alarm(3);
-
-        size_t len = ask.length() + 1;
-        written = write(fd, ask.c_str(), len) == (ssize_t)len;
-        if (!written) {
-            alarm(old_alarm);
-            sigaction(SIGALRM, &old_sigaction, nullptr);
-            close(fd);
-            continue;
-        }
-
-        // alarm triggers at 50% of the --wrap time out
-        content_wrap = recv(fd, msg_wrap.buf, sizeof(msg_wrap), 0) > 0;
-
-        alarm_wrap = alarm(5);
-
-        // alarm triggers at 133% of the --wrap time out
-        content_timeout = recv(fd, msg_timeout.buf, sizeof(msg_timeout), 0) > 0;
-        if (!content_timeout) {  // make sure we hit dumpAndClose
-            content_timeout =
-                recv(fd, msg_timeout.buf, sizeof(msg_timeout), 0) > 0;
-        }
-
-        if (old_alarm > 0) {
-            unsigned int time_spent = 3 - alarm_wrap;
-            if (old_alarm > time_spent + 1) {
-                old_alarm -= time_spent;
-            } else {
-                old_alarm = 2;
-            }
-        }
-        alarm_timeout = alarm(old_alarm);
-        sigaction(SIGALRM, &old_sigaction, nullptr);
-
-        close(fd);
-
-        if (content_wrap && alarm_wrap && content_timeout && alarm_timeout) {
-            break;
-        }
-    }
-
-    if (content_wrap) {
-        dump_log_msg("wrap", &msg_wrap, -1);
-    }
-
-    if (content_timeout) {
-        dump_log_msg("timeout", &msg_timeout, -1);
-    }
-
-    EXPECT_TRUE(written);
-    EXPECT_TRUE(content_wrap);
-    EXPECT_NE(0U, alarm_wrap);
-    EXPECT_TRUE(content_timeout);
-    EXPECT_NE(0U, alarm_timeout);
-#else
-    command = nullptr;
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(logd, timeout_no_start) {
-    timeout_negative("dumpAndClose lids=0,1,2,3,4,5 timeout=6");
-}
-
-TEST(logd, timeout_start_epoch) {
-    timeout_negative(
-        "dumpAndClose lids=0,1,2,3,4,5 timeout=6 start=0.000000000");
-}
-
-#ifdef ENABLE_FLAKY_TESTS
-// b/26447386 refined behavior
-TEST(logd, timeout) {
-#ifdef __ANDROID__
-    // b/33962045 This test interferes with other log reader tests that
-    // follow because of file descriptor socket persistence in the same
-    // process.  So let's fork it to isolate it from giving us pain.
-
-    pid_t pid = fork();
-
-    if (pid) {
-        siginfo_t info = {};
-        ASSERT_EQ(0, TEMP_FAILURE_RETRY(waitid(P_PID, pid, &info, WEXITED)));
-        ASSERT_EQ(0, info.si_status);
-        return;
-    }
-
-    log_msg msg_wrap, msg_timeout;
-    bool content_wrap = false, content_timeout = false, written = false;
-    unsigned int alarm_wrap = 0, alarm_timeout = 0;
-    // A few tries to get it right just in case wrap kicks in due to
-    // content providers being active during the test.
-    int i = 5;
-    log_time start(android_log_clockid());
-    start.tv_sec -= 30;  // reach back a moderate period of time
-
-    while (--i) {
-        int fd = socket_local_client("logdr", ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                     SOCK_SEQPACKET);
-        int save_errno = errno;
-        if (fd < 0) {
-            fprintf(stderr, "failed to open /dev/socket/logdr %s\n",
-                    strerror(save_errno));
-            _exit(fd);
-        }
-
-        std::string ask = android::base::StringPrintf(
-            "dumpAndClose lids=0,1,2,3,4,5 timeout=6 start=%" PRIu32
-            ".%09" PRIu32,
-            start.tv_sec, start.tv_nsec);
-
-        struct sigaction ignore, old_sigaction;
-        memset(&ignore, 0, sizeof(ignore));
-        ignore.sa_handler = caught_signal;
-        sigemptyset(&ignore.sa_mask);
-        sigaction(SIGALRM, &ignore, &old_sigaction);
-        unsigned int old_alarm = alarm(3);
-
-        size_t len = ask.length() + 1;
-        written = write(fd, ask.c_str(), len) == (ssize_t)len;
-        if (!written) {
-            alarm(old_alarm);
-            sigaction(SIGALRM, &old_sigaction, nullptr);
-            close(fd);
-            continue;
-        }
-
-        // alarm triggers at 50% of the --wrap time out
-        content_wrap = recv(fd, msg_wrap.buf, sizeof(msg_wrap), 0) > 0;
-
-        alarm_wrap = alarm(5);
-
-        // alarm triggers at 133% of the --wrap time out
-        content_timeout = recv(fd, msg_timeout.buf, sizeof(msg_timeout), 0) > 0;
-        if (!content_timeout) {  // make sure we hit dumpAndClose
-            content_timeout =
-                recv(fd, msg_timeout.buf, sizeof(msg_timeout), 0) > 0;
-        }
-
-        if (old_alarm > 0) {
-            unsigned int time_spent = 3 - alarm_wrap;
-            if (old_alarm > time_spent + 1) {
-                old_alarm -= time_spent;
-            } else {
-                old_alarm = 2;
-            }
-        }
-        alarm_timeout = alarm(old_alarm);
-        sigaction(SIGALRM, &old_sigaction, nullptr);
-
-        close(fd);
-
-        if (!content_wrap && !alarm_wrap && content_timeout && alarm_timeout) {
-            break;
-        }
-
-        // modify start time in case content providers are relatively
-        // active _or_ inactive during the test.
-        if (content_timeout) {
-            log_time msg(msg_timeout.entry.sec, msg_timeout.entry.nsec);
-            if (msg < start) {
-                fprintf(stderr, "%u.%09u < %u.%09u\n", msg_timeout.entry.sec,
-                        msg_timeout.entry.nsec, (unsigned)start.tv_sec,
-                        (unsigned)start.tv_nsec);
-                _exit(-1);
-            }
-            if (msg > start) {
-                start = msg;
-                start.tv_sec += 30;
-                log_time now = log_time(android_log_clockid());
-                if (start > now) {
-                    start = now;
-                    --start.tv_sec;
-                }
-            }
-        } else {
-            start.tv_sec -= 120;  // inactive, reach further back!
-        }
-    }
-
-    if (content_wrap) {
-        dump_log_msg("wrap", &msg_wrap, -1);
-    }
-
-    if (content_timeout) {
-        dump_log_msg("timeout", &msg_timeout, -1);
-    }
-
-    if (content_wrap || !content_timeout) {
-        fprintf(stderr, "start=%" PRIu32 ".%09" PRIu32 "\n", start.tv_sec,
-                start.tv_nsec);
-    }
-
-    EXPECT_TRUE(written);
-    EXPECT_FALSE(content_wrap);
-    EXPECT_EQ(0U, alarm_wrap);
-    EXPECT_TRUE(content_timeout);
-    EXPECT_NE(0U, alarm_timeout);
-
-    _exit(!written + content_wrap + alarm_wrap + !content_timeout +
-          !alarm_timeout);
-#else
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-#endif
-
-// b/27242723 confirmed fixed
-TEST(logd, SNDTIMEO) {
-#ifdef __ANDROID__
-    static const unsigned sndtimeo =
-        LOGD_SNDTIMEO;  // <sigh> it has to be done!
-    static const unsigned sleep_time = sndtimeo + 3;
-    static const unsigned alarm_time = sleep_time + 5;
-
-    int fd;
-
-    ASSERT_TRUE(
-        (fd = socket_local_client("logdr", ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                  SOCK_SEQPACKET)) > 0);
-
-    struct sigaction ignore, old_sigaction;
-    memset(&ignore, 0, sizeof(ignore));
-    ignore.sa_handler = caught_signal;
-    sigemptyset(&ignore.sa_mask);
-    sigaction(SIGALRM, &ignore, &old_sigaction);
-    unsigned int old_alarm = alarm(alarm_time);
-
-    static const char ask[] = "stream lids=0,1,2,3,4,5,6";  // all sources
-    bool reader_requested = write(fd, ask, sizeof(ask)) == sizeof(ask);
-    EXPECT_TRUE(reader_requested);
-
-    log_msg msg;
-    bool read_one = recv(fd, msg.buf, sizeof(msg), 0) > 0;
-
-    EXPECT_TRUE(read_one);
-    if (read_one) {
-        dump_log_msg("user", &msg, -1);
-    }
-
-    fprintf(stderr, "Sleep for >%d seconds logd SO_SNDTIMEO ...\n", sndtimeo);
-    sleep(sleep_time);
-
-    // flush will block if we did not trigger. if it did, last entry returns 0
-    int recv_ret;
-    do {
-        recv_ret = recv(fd, msg.buf, sizeof(msg), 0);
-    } while (recv_ret > 0);
-    int save_errno = (recv_ret < 0) ? errno : 0;
-
-    EXPECT_NE(0U, alarm(old_alarm));
-    sigaction(SIGALRM, &old_sigaction, nullptr);
-
-    EXPECT_EQ(0, recv_ret);
-    if (recv_ret > 0) {
-        dump_log_msg("user", &msg, -1);
-    }
-    EXPECT_EQ(0, save_errno);
-
-    close(fd);
-#else
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(logd, getEventTag_list) {
-#ifdef __ANDROID__
-    char buffer[256];
-    memset(buffer, 0, sizeof(buffer));
-    snprintf(buffer, sizeof(buffer), "getEventTag name=*");
-    send_to_control(buffer, sizeof(buffer));
-    buffer[sizeof(buffer) - 1] = '\0';
-    char* cp;
-    long ret = strtol(buffer, &cp, 10);
-    EXPECT_GT(ret, 4096);
-#else
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(logd, getEventTag_42) {
-#ifdef __ANDROID__
-    char buffer[256];
-    memset(buffer, 0, sizeof(buffer));
-    snprintf(buffer, sizeof(buffer), "getEventTag id=42");
-    send_to_control(buffer, sizeof(buffer));
-    buffer[sizeof(buffer) - 1] = '\0';
-    char* cp;
-    long ret = strtol(buffer, &cp, 10);
-    EXPECT_GT(ret, 16);
-    EXPECT_TRUE(strstr(buffer, "\t(to life the universe etc|3)") != nullptr);
-    EXPECT_TRUE(strstr(buffer, "answer") != nullptr);
-#else
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(logd, getEventTag_newentry) {
-#ifdef __ANDROID__
-    char buffer[256];
-    memset(buffer, 0, sizeof(buffer));
-    log_time now(CLOCK_MONOTONIC);
-    char name[64];
-    snprintf(name, sizeof(name), "a%" PRIu64, now.nsec());
-    snprintf(buffer, sizeof(buffer), "getEventTag name=%s format=\"(new|1)\"",
-             name);
-    send_to_control(buffer, sizeof(buffer));
-    buffer[sizeof(buffer) - 1] = '\0';
-    char* cp;
-    long ret = strtol(buffer, &cp, 10);
-    EXPECT_GT(ret, 16);
-    EXPECT_TRUE(strstr(buffer, "\t(new|1)") != nullptr);
-    EXPECT_TRUE(strstr(buffer, name) != nullptr);
-// ToDo: also look for this in /data/misc/logd/event-log-tags and
-// /dev/event-log-tags.
-#else
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-#ifdef __ANDROID__
-static inline uint32_t get4LE(const uint8_t* src) {
-  return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
-}
-
-static inline uint32_t get4LE(const char* src) {
-  return get4LE(reinterpret_cast<const uint8_t*>(src));
-}
-#endif
-
-void __android_log_btwrite_multiple__helper(int count) {
-#ifdef __ANDROID__
-    log_time ts(CLOCK_MONOTONIC);
-    usleep(100);
-    log_time ts1(CLOCK_MONOTONIC);
-
-    // We fork to create a unique pid for the submitted log messages
-    // so that we do not collide with the other _multiple_ tests.
-
-    pid_t pid = fork();
-
-    if (pid == 0) {
-        // child
-        for (int i = count; i; --i) {
-            ASSERT_LT(
-                0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
-            usleep(100);
-        }
-        ASSERT_LT(0,
-                  __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1)));
-        usleep(1000000);
-
-        _exit(0);
-    }
-
-    siginfo_t info = {};
-    ASSERT_EQ(0, TEMP_FAILURE_RETRY(waitid(P_PID, pid, &info, WEXITED)));
-    ASSERT_EQ(0, info.si_status);
-
-    struct logger_list* logger_list;
-    ASSERT_TRUE(nullptr !=
-                (logger_list = android_logger_list_open(
-                     LOG_ID_EVENTS, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK,
-                     0, pid)));
-
-    int expected_count = (count < 2) ? count : 2;
-    int expected_chatty_count = (count <= 2) ? 0 : 1;
-    int expected_identical_count = (count < 2) ? 0 : (count - 2);
-    static const int expected_expire_count = 0;
-
-    count = 0;
-    int second_count = 0;
-    int chatty_count = 0;
-    int identical_count = 0;
-    int expire_count = 0;
-
-    for (;;) {
-        log_msg log_msg;
-        if (android_logger_list_read(logger_list, &log_msg) <= 0) break;
-
-        if ((log_msg.entry.pid != pid) || (log_msg.entry.len < (4 + 1 + 8)) ||
-            (log_msg.id() != LOG_ID_EVENTS))
-            continue;
-
-        char* eventData = log_msg.msg();
-        if (!eventData) continue;
-
-        uint32_t tag = get4LE(eventData);
-
-        if ((eventData[4] == EVENT_TYPE_LONG) &&
-            (log_msg.entry.len == (4 + 1 + 8))) {
-            if (tag != 0) continue;
-
-            log_time tx(eventData + 4 + 1);
-            if (ts == tx) {
-                ++count;
-            } else if (ts1 == tx) {
-                ++second_count;
-            }
-        } else if (eventData[4] == EVENT_TYPE_STRING) {
-            if (tag != CHATTY_LOG_TAG) continue;
-            ++chatty_count;
-            // int len = get4LE(eventData + 4 + 1);
-            log_msg.buf[LOGGER_ENTRY_MAX_LEN] = '\0';
-            const char* cp;
-            if ((cp = strstr(eventData + 4 + 1 + 4, " identical "))) {
-                unsigned val = 0;
-                sscanf(cp, " identical %u lines", &val);
-                identical_count += val;
-            } else if ((cp = strstr(eventData + 4 + 1 + 4, " expire "))) {
-                unsigned val = 0;
-                sscanf(cp, " expire %u lines", &val);
-                expire_count += val;
-            }
-        }
-    }
-
-    android_logger_list_close(logger_list);
-
-    EXPECT_EQ(expected_count, count);
-    EXPECT_EQ(1, second_count);
-    EXPECT_EQ(expected_chatty_count, chatty_count);
-    EXPECT_EQ(expected_identical_count, identical_count);
-    EXPECT_EQ(expected_expire_count, expire_count);
-#else
-    count = 0;
-    GTEST_LOG_(INFO) << "This test does nothing.\n";
-#endif
-}
-
-TEST(logd, multiple_test_1) {
-    __android_log_btwrite_multiple__helper(1);
-}
-
-TEST(logd, multiple_test_2) {
-    __android_log_btwrite_multiple__helper(2);
-}
-
-TEST(logd, multiple_test_3) {
-    __android_log_btwrite_multiple__helper(3);
-}
-
-TEST(logd, multiple_test_10) {
-    __android_log_btwrite_multiple__helper(10);
-}
diff --git a/logwrapper/Android.bp b/logwrapper/Android.bp
deleted file mode 100644
index 8851a47..0000000
--- a/logwrapper/Android.bp
+++ /dev/null
@@ -1,70 +0,0 @@
-cc_defaults {
-    name: "logwrapper_defaults",
-    cflags: [
-        "-Werror",
-    ],
-}
-
-// ========================================================
-// Static and shared library
-// ========================================================
-
-cc_library {
-    name: "liblogwrap",
-    defaults: ["logwrapper_defaults"],
-    recovery_available: true,
-    srcs: ["logwrap.cpp"],
-    shared_libs: [
-        "libcutils",
-        "liblog",
-    ],
-    header_libs: ["libbase_headers"],
-    export_include_dirs: ["include"],
-    local_include_dirs: ["include"],
-}
-
-// ========================================================
-// Executable
-// ========================================================
-
-cc_defaults {
-    name: "logwrapper_common",
-    defaults: ["logwrapper_defaults"],
-    local_include_dirs: ["include"],
-    srcs: [
-        "logwrap.cpp",
-        "logwrapper.cpp",
-    ],
-    header_libs: ["libbase_headers"],
-    shared_libs: ["libcutils", "liblog"],
-}
-
-cc_binary {
-    name: "logwrapper",
-    defaults: ["logwrapper_common"],
-}
-
-cc_binary {
-    name: "logwrapper_vendor",
-    defaults: ["logwrapper_common"],
-    stem: "logwrapper",
-    vendor: true,
-}
-
-// ========================================================
-// Benchmark
-// ========================================================
-
-cc_benchmark {
-    name: "logwrap_fork_execvp_benchmark",
-    defaults: ["logwrapper_defaults"],
-    srcs: [
-        "logwrap_fork_execvp_benchmark.cpp",
-    ],
-    shared_libs: [
-        "libbase",
-        "libcutils",
-        "liblog",
-        "liblogwrap",
-    ],
-}
diff --git a/logwrapper/NOTICE b/logwrapper/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/logwrapper/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
-   Copyright (c) 2005-2008, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
diff --git a/logwrapper/OWNERS b/logwrapper/OWNERS
deleted file mode 100644
index babbe4d..0000000
--- a/logwrapper/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-tomcherry@google.com
diff --git a/logwrapper/include/logwrap/logwrap.h b/logwrapper/include/logwrap/logwrap.h
deleted file mode 100644
index cb40ee2..0000000
--- a/logwrapper/include/logwrap/logwrap.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* system/core/include/logwrap/logwrap.h
- *
- * Copyright 2013, 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.
- */
-
-#pragma once
-
-/*
- * Run a command while logging its stdout and stderr
- *
- * Arguments:
- *   argc:   the number of elements in argv
- *   argv:   an array of strings containing the command to be executed and its
- *           arguments as separate strings. argv does not need to be
- *           NULL-terminated
- *   status: the equivalent child status as populated by wait(status). This
- *           value is only valid when logwrap successfully completes. If NULL
- *           the return value of the child will be the function's return value.
- *   forward_signals: set to true if you want to forward SIGINT, SIGQUIT, and
- *           SIGHUP to the child process, while it is running.  You likely do
- *           not need to use this; it is primarily for the logwrapper
- *           executable itself.
- *   log_target: Specify where to log the output of the child, either LOG_NONE,
- *           LOG_ALOG (for the Android system log), LOG_KLOG (for the kernel
- *           log), or LOG_FILE (and you need to specify a pathname in the
- *           file_path argument, otherwise pass NULL).  These are bit fields,
- *           and can be OR'ed together to log to multiple places.
- *   abbreviated: If true, capture up to the first 100 lines and last 4K of
- *           output from the child.  The abbreviated output is not dumped to
- *           the specified log until the child has exited.
- *   file_path: if log_target has the LOG_FILE bit set, then this parameter
- *           must be set to the pathname of the file to log to.
- *
- * Return value:
- *   0 when logwrap successfully run the child process and captured its status
- *   -1 when an internal error occurred
- *   -ECHILD if status is NULL and the child didn't exit properly
- *   the return value of the child if it exited properly and status is NULL
- *
- */
-
-/* Values for the log_target parameter logwrap_fork_execvp() */
-#define LOG_NONE        0
-#define LOG_ALOG        1
-#define LOG_KLOG        2
-#define LOG_FILE        4
-
-int logwrap_fork_execvp(int argc, const char* const* argv, int* status, bool forward_signals,
-                        int log_target, bool abbreviated, const char* file_path);
diff --git a/logwrapper/logwrap.cpp b/logwrapper/logwrap.cpp
deleted file mode 100644
index 5a518bc..0000000
--- a/logwrapper/logwrap.cpp
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <libgen.h>
-#include <poll.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <algorithm>
-
-#include <android-base/macros.h>
-#include <cutils/klog.h>
-#include <log/log.h>
-#include <logwrap/logwrap.h>
-
-static pthread_mutex_t fd_mutex = PTHREAD_MUTEX_INITIALIZER;
-// Protected by fd_mutex.  These signals must be blocked while modifying as well.
-static pid_t child_pid;
-static struct sigaction old_int;
-static struct sigaction old_quit;
-static struct sigaction old_hup;
-
-#define ERROR(fmt, args...)                         \
-    do {                                            \
-        fprintf(stderr, fmt, ##args);               \
-        ALOG(LOG_ERROR, "logwrapper", fmt, ##args); \
-    } while (0)
-
-#define FATAL_CHILD(fmt, args...) \
-    do {                          \
-        ERROR(fmt, ##args);       \
-        _exit(-1);                \
-    } while (0)
-
-#define MAX_KLOG_TAG 16
-
-/* This is a simple buffer that holds up to the first beginning_buf->buf_size
- * bytes of output from a command.
- */
-#define BEGINNING_BUF_SIZE 0x1000
-struct beginning_buf {
-    char* buf;
-    size_t alloc_len;
-    /* buf_size is the usable space, which is one less than the allocated size */
-    size_t buf_size;
-    size_t used_len;
-};
-
-/* This is a circular buf that holds up to the last ending_buf->buf_size bytes
- * of output from a command after the first beginning_buf->buf_size bytes
- * (which are held in beginning_buf above).
- */
-#define ENDING_BUF_SIZE 0x1000
-struct ending_buf {
-    char* buf;
-    ssize_t alloc_len;
-    /* buf_size is the usable space, which is one less than the allocated size */
-    ssize_t buf_size;
-    ssize_t used_len;
-    /* read and write offsets into the circular buffer */
-    int read;
-    int write;
-};
-
-/* A structure to hold all the abbreviated buf data */
-struct abbr_buf {
-    struct beginning_buf b_buf;
-    struct ending_buf e_buf;
-    int beginning_buf_full;
-};
-
-/* Collect all the various bits of info needed for logging in one place. */
-struct log_info {
-    int log_target;
-    char klog_fmt[MAX_KLOG_TAG * 2];
-    const char* btag;
-    bool abbreviated;
-    FILE* fp;
-    struct abbr_buf a_buf;
-};
-
-/* Forware declaration */
-static void add_line_to_abbr_buf(struct abbr_buf* a_buf, char* linebuf, int linelen);
-
-/* Return 0 on success, and 1 when full */
-static int add_line_to_linear_buf(struct beginning_buf* b_buf, char* line, ssize_t line_len) {
-    int full = 0;
-
-    if ((line_len + b_buf->used_len) > b_buf->buf_size) {
-        full = 1;
-    } else {
-        /* Add to the end of the buf */
-        memcpy(b_buf->buf + b_buf->used_len, line, line_len);
-        b_buf->used_len += line_len;
-    }
-
-    return full;
-}
-
-static void add_line_to_circular_buf(struct ending_buf* e_buf, char* line, ssize_t line_len) {
-    ssize_t free_len;
-    ssize_t needed_space;
-    int cnt;
-
-    if (e_buf->buf == nullptr) {
-        return;
-    }
-
-    if (line_len > e_buf->buf_size) {
-        return;
-    }
-
-    free_len = e_buf->buf_size - e_buf->used_len;
-
-    if (line_len > free_len) {
-        /* remove oldest entries at read, and move read to make
-         * room for the new string */
-        needed_space = line_len - free_len;
-        e_buf->read = (e_buf->read + needed_space) % e_buf->buf_size;
-        e_buf->used_len -= needed_space;
-    }
-
-    /* Copy the line into the circular buffer, dealing with possible
-     * wraparound.
-     */
-    cnt = std::min(line_len, e_buf->buf_size - e_buf->write);
-    memcpy(e_buf->buf + e_buf->write, line, cnt);
-    if (cnt < line_len) {
-        memcpy(e_buf->buf, line + cnt, line_len - cnt);
-    }
-    e_buf->used_len += line_len;
-    e_buf->write = (e_buf->write + line_len) % e_buf->buf_size;
-}
-
-/* Log directly to the specified log */
-static void do_log_line(struct log_info* log_info, const char* line) {
-    if (log_info->log_target & LOG_KLOG) {
-        klog_write(6, log_info->klog_fmt, line);
-    }
-    if (log_info->log_target & LOG_ALOG) {
-        ALOG(LOG_INFO, log_info->btag, "%s", line);
-    }
-    if (log_info->log_target & LOG_FILE) {
-        fprintf(log_info->fp, "%s\n", line);
-    }
-}
-
-/* Log to either the abbreviated buf, or directly to the specified log
- * via do_log_line() above.
- */
-static void log_line(struct log_info* log_info, char* line, int len) {
-    if (log_info->abbreviated) {
-        add_line_to_abbr_buf(&log_info->a_buf, line, len);
-    } else {
-        do_log_line(log_info, line);
-    }
-}
-
-/*
- * The kernel will take a maximum of 1024 bytes in any single write to
- * the kernel logging device file, so find and print each line one at
- * a time.  The allocated size for buf should be at least 1 byte larger
- * than buf_size (the usable size of the buffer) to make sure there is
- * room to temporarily stuff a null byte to terminate a line for logging.
- */
-static void print_buf_lines(struct log_info* log_info, char* buf, int buf_size) {
-    char* line_start;
-    char c;
-    int i;
-
-    line_start = buf;
-    for (i = 0; i < buf_size; i++) {
-        if (*(buf + i) == '\n') {
-            /* Found a line ending, print the line and compute new line_start */
-            /* Save the next char and replace with \0 */
-            c = *(buf + i + 1);
-            *(buf + i + 1) = '\0';
-            do_log_line(log_info, line_start);
-            /* Restore the saved char */
-            *(buf + i + 1) = c;
-            line_start = buf + i + 1;
-        } else if (*(buf + i) == '\0') {
-            /* The end of the buffer, print the last bit */
-            do_log_line(log_info, line_start);
-            break;
-        }
-    }
-    /* If the buffer was completely full, and didn't end with a newline, just
-     * ignore the partial last line.
-     */
-}
-
-static void init_abbr_buf(struct abbr_buf* a_buf) {
-    char* new_buf;
-
-    memset(a_buf, 0, sizeof(struct abbr_buf));
-    new_buf = static_cast<char*>(malloc(BEGINNING_BUF_SIZE));
-    if (new_buf) {
-        a_buf->b_buf.buf = new_buf;
-        a_buf->b_buf.alloc_len = BEGINNING_BUF_SIZE;
-        a_buf->b_buf.buf_size = BEGINNING_BUF_SIZE - 1;
-    }
-    new_buf = static_cast<char*>(malloc(ENDING_BUF_SIZE));
-    if (new_buf) {
-        a_buf->e_buf.buf = new_buf;
-        a_buf->e_buf.alloc_len = ENDING_BUF_SIZE;
-        a_buf->e_buf.buf_size = ENDING_BUF_SIZE - 1;
-    }
-}
-
-static void free_abbr_buf(struct abbr_buf* a_buf) {
-    free(a_buf->b_buf.buf);
-    free(a_buf->e_buf.buf);
-}
-
-static void add_line_to_abbr_buf(struct abbr_buf* a_buf, char* linebuf, int linelen) {
-    if (!a_buf->beginning_buf_full) {
-        a_buf->beginning_buf_full = add_line_to_linear_buf(&a_buf->b_buf, linebuf, linelen);
-    }
-    if (a_buf->beginning_buf_full) {
-        add_line_to_circular_buf(&a_buf->e_buf, linebuf, linelen);
-    }
-}
-
-static void print_abbr_buf(struct log_info* log_info) {
-    struct abbr_buf* a_buf = &log_info->a_buf;
-
-    /* Add the abbreviated output to the kernel log */
-    if (a_buf->b_buf.alloc_len) {
-        print_buf_lines(log_info, a_buf->b_buf.buf, a_buf->b_buf.used_len);
-    }
-
-    /* Print an ellipsis to indicate that the buffer has wrapped or
-     * is full, and some data was not logged.
-     */
-    if (a_buf->e_buf.used_len == a_buf->e_buf.buf_size) {
-        do_log_line(log_info, "...\n");
-    }
-
-    if (a_buf->e_buf.used_len == 0) {
-        return;
-    }
-
-    /* Simplest way to print the circular buffer is allocate a second buf
-     * of the same size, and memcpy it so it's a simple linear buffer,
-     * and then cal print_buf_lines on it */
-    if (a_buf->e_buf.read < a_buf->e_buf.write) {
-        /* no wrap around, just print it */
-        print_buf_lines(log_info, a_buf->e_buf.buf + a_buf->e_buf.read, a_buf->e_buf.used_len);
-    } else {
-        /* The circular buffer will always have at least 1 byte unused,
-         * so by allocating alloc_len here we will have at least
-         * 1 byte of space available as required by print_buf_lines().
-         */
-        char* nbuf = static_cast<char*>(malloc(a_buf->e_buf.alloc_len));
-        if (!nbuf) {
-            return;
-        }
-        int first_chunk_len = a_buf->e_buf.buf_size - a_buf->e_buf.read;
-        memcpy(nbuf, a_buf->e_buf.buf + a_buf->e_buf.read, first_chunk_len);
-        /* copy second chunk */
-        memcpy(nbuf + first_chunk_len, a_buf->e_buf.buf, a_buf->e_buf.write);
-        print_buf_lines(log_info, nbuf, first_chunk_len + a_buf->e_buf.write);
-        free(nbuf);
-    }
-}
-
-static void signal_handler(int signal_num);
-
-static void block_signals(sigset_t* oldset) {
-    sigset_t blockset;
-
-    sigemptyset(&blockset);
-    sigaddset(&blockset, SIGINT);
-    sigaddset(&blockset, SIGQUIT);
-    sigaddset(&blockset, SIGHUP);
-    pthread_sigmask(SIG_BLOCK, &blockset, oldset);
-}
-
-static void unblock_signals(sigset_t* oldset) {
-    pthread_sigmask(SIG_SETMASK, oldset, nullptr);
-}
-
-static void setup_signal_handlers(pid_t pid) {
-    struct sigaction handler = {.sa_handler = signal_handler};
-
-    child_pid = pid;
-    sigaction(SIGINT, &handler, &old_int);
-    sigaction(SIGQUIT, &handler, &old_quit);
-    sigaction(SIGHUP, &handler, &old_hup);
-}
-
-static void restore_signal_handlers() {
-    sigaction(SIGINT, &old_int, nullptr);
-    sigaction(SIGQUIT, &old_quit, nullptr);
-    sigaction(SIGHUP, &old_hup, nullptr);
-    child_pid = 0;
-}
-
-static void signal_handler(int signal_num) {
-    if (child_pid == 0 || kill(child_pid, signal_num) != 0) {
-        restore_signal_handlers();
-        raise(signal_num);
-    }
-}
-
-static int parent(const char* tag, int parent_read, pid_t pid, int* chld_sts, int log_target,
-                  bool abbreviated, const char* file_path, bool forward_signals) {
-    int status = 0;
-    char buffer[4096];
-    struct pollfd poll_fds[] = {
-            {
-                    .fd = parent_read,
-                    .events = POLLIN,
-            },
-    };
-    int rc = 0;
-    int fd;
-
-    struct log_info log_info;
-
-    int a = 0;  // start index of unprocessed data
-    int b = 0;  // end index of unprocessed data
-    int sz;
-    bool found_child = false;
-    // There is a very small chance that opening child_ptty in the child will fail, but in this case
-    // POLLHUP will not be generated below.  Therefore, we use a 1 second timeout for poll() until
-    // we receive a message from child_ptty.  If this times out, we call waitpid() with WNOHANG to
-    // check the status of the child process and exit appropriately if it has terminated.
-    bool received_messages = false;
-    char tmpbuf[256];
-
-    log_info.btag = basename(tag);
-    if (!log_info.btag) {
-        log_info.btag = tag;
-    }
-
-    if (abbreviated && (log_target == LOG_NONE)) {
-        abbreviated = 0;
-    }
-    if (abbreviated) {
-        init_abbr_buf(&log_info.a_buf);
-    }
-
-    if (log_target & LOG_KLOG) {
-        snprintf(log_info.klog_fmt, sizeof(log_info.klog_fmt), "<6>%.*s: %%s\n", MAX_KLOG_TAG,
-                 log_info.btag);
-    }
-
-    if ((log_target & LOG_FILE) && !file_path) {
-        /* No file_path specified, clear the LOG_FILE bit */
-        log_target &= ~LOG_FILE;
-    }
-
-    if (log_target & LOG_FILE) {
-        fd = open(file_path, O_WRONLY | O_CREAT | O_CLOEXEC, 0664);
-        if (fd < 0) {
-            ERROR("Cannot log to file %s\n", file_path);
-            log_target &= ~LOG_FILE;
-        } else {
-            lseek(fd, 0, SEEK_END);
-            log_info.fp = fdopen(fd, "a");
-        }
-    }
-
-    log_info.log_target = log_target;
-    log_info.abbreviated = abbreviated;
-
-    while (!found_child) {
-        int timeout = received_messages ? -1 : 1000;
-        if (TEMP_FAILURE_RETRY(poll(poll_fds, arraysize(poll_fds), timeout)) < 0) {
-            ERROR("poll failed\n");
-            rc = -1;
-            goto err_poll;
-        }
-
-        if (poll_fds[0].revents & POLLIN) {
-            received_messages = true;
-            sz = TEMP_FAILURE_RETRY(read(parent_read, &buffer[b], sizeof(buffer) - 1 - b));
-
-            sz += b;
-            // Log one line at a time
-            for (b = 0; b < sz; b++) {
-                if (buffer[b] == '\r') {
-                    if (abbreviated) {
-                        /* The abbreviated logging code uses newline as
-                         * the line separator.  Lucikly, the pty layer
-                         * helpfully cooks the output of the command
-                         * being run and inserts a CR before NL.  So
-                         * I just change it to NL here when doing
-                         * abbreviated logging.
-                         */
-                        buffer[b] = '\n';
-                    } else {
-                        buffer[b] = '\0';
-                    }
-                } else if (buffer[b] == '\n') {
-                    buffer[b] = '\0';
-                    log_line(&log_info, &buffer[a], b - a);
-                    a = b + 1;
-                }
-            }
-
-            if (a == 0 && b == sizeof(buffer) - 1) {
-                // buffer is full, flush
-                buffer[b] = '\0';
-                log_line(&log_info, &buffer[a], b - a);
-                b = 0;
-            } else if (a != b) {
-                // Keep left-overs
-                b -= a;
-                memmove(buffer, &buffer[a], b);
-                a = 0;
-            } else {
-                a = 0;
-                b = 0;
-            }
-        }
-
-        if (!received_messages || (poll_fds[0].revents & POLLHUP)) {
-            int ret;
-            sigset_t oldset;
-
-            if (forward_signals) {
-                // Our signal handlers forward these signals to 'child_pid', but waitpid() may reap
-                // the child, so we must block these signals until we either 1) conclude that the
-                // child is still running or 2) determine the child has been reaped and we have
-                // reset the signals to their original disposition.
-                block_signals(&oldset);
-            }
-
-            int flags = (poll_fds[0].revents & POLLHUP) ? 0 : WNOHANG;
-            ret = TEMP_FAILURE_RETRY(waitpid(pid, &status, flags));
-            if (ret < 0) {
-                rc = errno;
-                ALOG(LOG_ERROR, "logwrap", "waitpid failed with %s\n", strerror(errno));
-                goto err_waitpid;
-            }
-            if (ret > 0) {
-                found_child = true;
-            }
-
-            if (forward_signals) {
-                if (found_child) {
-                    restore_signal_handlers();
-                }
-                unblock_signals(&oldset);
-            }
-        }
-    }
-
-    if (chld_sts != nullptr) {
-        *chld_sts = status;
-    } else {
-        if (WIFEXITED(status))
-            rc = WEXITSTATUS(status);
-        else
-            rc = -ECHILD;
-    }
-
-    // Flush remaining data
-    if (a != b) {
-        buffer[b] = '\0';
-        log_line(&log_info, &buffer[a], b - a);
-    }
-
-    /* All the output has been processed, time to dump the abbreviated output */
-    if (abbreviated) {
-        print_abbr_buf(&log_info);
-    }
-
-    if (WIFEXITED(status)) {
-        if (WEXITSTATUS(status)) {
-            snprintf(tmpbuf, sizeof(tmpbuf), "%s terminated by exit(%d)\n", log_info.btag,
-                     WEXITSTATUS(status));
-            do_log_line(&log_info, tmpbuf);
-        }
-    } else {
-        if (WIFSIGNALED(status)) {
-            snprintf(tmpbuf, sizeof(tmpbuf), "%s terminated by signal %d\n", log_info.btag,
-                     WTERMSIG(status));
-            do_log_line(&log_info, tmpbuf);
-        } else if (WIFSTOPPED(status)) {
-            snprintf(tmpbuf, sizeof(tmpbuf), "%s stopped by signal %d\n", log_info.btag,
-                     WSTOPSIG(status));
-            do_log_line(&log_info, tmpbuf);
-        }
-    }
-
-err_waitpid:
-err_poll:
-    if (log_target & LOG_FILE) {
-        fclose(log_info.fp); /* Also closes underlying fd */
-    }
-    if (abbreviated) {
-        free_abbr_buf(&log_info.a_buf);
-    }
-    return rc;
-}
-
-static void child(int argc, const char* const* argv) {
-    // create null terminated argv_child array
-    char* argv_child[argc + 1];
-    memcpy(argv_child, argv, argc * sizeof(char*));
-    argv_child[argc] = nullptr;
-
-    if (execvp(argv_child[0], argv_child)) {
-        FATAL_CHILD("executing %s failed: %s\n", argv_child[0], strerror(errno));
-    }
-}
-
-int logwrap_fork_execvp(int argc, const char* const* argv, int* status, bool forward_signals,
-                        int log_target, bool abbreviated, const char* file_path) {
-    pid_t pid;
-    int parent_ptty;
-    sigset_t oldset;
-    int rc = 0;
-
-    rc = pthread_mutex_lock(&fd_mutex);
-    if (rc) {
-        ERROR("failed to lock signal_fd mutex\n");
-        goto err_lock;
-    }
-
-    /* Use ptty instead of socketpair so that STDOUT is not buffered */
-    parent_ptty = TEMP_FAILURE_RETRY(posix_openpt(O_RDWR | O_CLOEXEC));
-    if (parent_ptty < 0) {
-        ERROR("Cannot create parent ptty\n");
-        rc = -1;
-        goto err_open;
-    }
-
-    char child_devname[64];
-    if (grantpt(parent_ptty) || unlockpt(parent_ptty) ||
-        ptsname_r(parent_ptty, child_devname, sizeof(child_devname)) != 0) {
-        ERROR("Problem with /dev/ptmx\n");
-        rc = -1;
-        goto err_ptty;
-    }
-
-    if (forward_signals) {
-        // Block these signals until we have the child pid and our signal handlers set up.
-        block_signals(&oldset);
-    }
-
-    pid = fork();
-    if (pid < 0) {
-        ERROR("Failed to fork\n");
-        rc = -1;
-        goto err_fork;
-    } else if (pid == 0) {
-        pthread_mutex_unlock(&fd_mutex);
-        if (forward_signals) {
-            unblock_signals(&oldset);
-        }
-
-        setsid();
-
-        int child_ptty = TEMP_FAILURE_RETRY(open(child_devname, O_RDWR | O_CLOEXEC));
-        if (child_ptty < 0) {
-            FATAL_CHILD("Cannot open child_ptty: %s\n", strerror(errno));
-        }
-        close(parent_ptty);
-
-        dup2(child_ptty, 1);
-        dup2(child_ptty, 2);
-        close(child_ptty);
-
-        child(argc, argv);
-    } else {
-        if (forward_signals) {
-            setup_signal_handlers(pid);
-            unblock_signals(&oldset);
-        }
-
-        rc = parent(argv[0], parent_ptty, pid, status, log_target, abbreviated, file_path,
-                    forward_signals);
-
-        if (forward_signals) {
-            restore_signal_handlers();
-        }
-    }
-
-err_fork:
-    if (forward_signals) {
-        unblock_signals(&oldset);
-    }
-err_ptty:
-    close(parent_ptty);
-err_open:
-    pthread_mutex_unlock(&fd_mutex);
-err_lock:
-    return rc;
-}
diff --git a/logwrapper/logwrap_fork_execvp_benchmark.cpp b/logwrapper/logwrap_fork_execvp_benchmark.cpp
deleted file mode 100644
index b2d0c71..0000000
--- a/logwrapper/logwrap_fork_execvp_benchmark.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-#include "logwrap/logwrap.h"
-
-#include <android-base/logging.h>
-#include <benchmark/benchmark.h>
-
-static void BM_android_fork_execvp_ext(benchmark::State& state) {
-    const char* argv[] = {"/system/bin/echo", "hello", "world"};
-    const int argc = 3;
-    while (state.KeepRunning()) {
-        int rc = logwrap_fork_execvp(argc, argv, nullptr, false, LOG_NONE, false, nullptr);
-        CHECK_EQ(0, rc);
-    }
-}
-BENCHMARK(BM_android_fork_execvp_ext);
-
-BENCHMARK_MAIN();
diff --git a/logwrapper/logwrapper.cpp b/logwrapper/logwrapper.cpp
deleted file mode 100644
index 7118d12..0000000
--- a/logwrapper/logwrapper.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <cutils/klog.h>
-#include <log/log.h>
-#include <logwrap/logwrap.h>
-
-void fatal(const char* msg) {
-    fprintf(stderr, "%s", msg);
-    ALOG(LOG_ERROR, "logwrapper", "%s", msg);
-    exit(-1);
-}
-
-void usage() {
-    fatal("Usage: logwrapper [-a] [-d] [-k] BINARY [ARGS ...]\n"
-          "\n"
-          "Forks and executes BINARY ARGS, redirecting stdout and stderr to\n"
-          "the Android logging system. Tag is set to BINARY, priority is\n"
-          "always LOG_INFO.\n"
-          "\n"
-          "-a: Causes logwrapper to do abbreviated logging.\n"
-          "    This logs up to the first 4K and last 4K of the command\n"
-          "    being run, and logs the output when the command exits\n"
-          "-d: Causes logwrapper to SIGSEGV when BINARY terminates\n"
-          "    fault address is set to the status of wait()\n"
-          "-k: Causes logwrapper to log to the kernel log instead of\n"
-          "    the Android system log\n");
-}
-
-int main(int argc, char* argv[]) {
-    int seg_fault_on_exit = 0;
-    int log_target = LOG_ALOG;
-    bool abbreviated = false;
-    int ch;
-    int status = 0xAAAA;
-    int rc;
-
-    while ((ch = getopt(argc, argv, "adk")) != -1) {
-        switch (ch) {
-            case 'a':
-                abbreviated = true;
-                break;
-            case 'd':
-                seg_fault_on_exit = 1;
-                break;
-            case 'k':
-                log_target = LOG_KLOG;
-                klog_set_level(6);
-                break;
-            case '?':
-            default:
-                usage();
-        }
-    }
-    argc -= optind;
-    argv += optind;
-
-    if (argc < 1) {
-        usage();
-    }
-
-    rc = logwrap_fork_execvp(argc, &argv[0], &status, true, log_target, abbreviated, nullptr);
-    if (!rc) {
-        if (WIFEXITED(status))
-            rc = WEXITSTATUS(status);
-        else
-            rc = -ECHILD;
-    }
-
-    if (seg_fault_on_exit) {
-        uintptr_t fault_address = (uintptr_t)status;
-        *(int*)fault_address = 0;  // causes SIGSEGV with fault_address = status
-    }
-
-    return rc;
-}
diff --git a/property_service/OWNERS b/property_service/OWNERS
index babbe4d..7529cb9 100644
--- a/property_service/OWNERS
+++ b/property_service/OWNERS
@@ -1 +1 @@
-tomcherry@google.com
+include platform/system/core:/janitors/OWNERS
diff --git a/property_service/libpropertyinfoparser/Android.bp b/property_service/libpropertyinfoparser/Android.bp
index 108d15a..2d7e9cb 100644
--- a/property_service/libpropertyinfoparser/Android.bp
+++ b/property_service/libpropertyinfoparser/Android.bp
@@ -3,6 +3,7 @@
     host_supported: true,
     vendor_available: true,
     ramdisk_available: true,
+    vendor_ramdisk_available: true,
     recovery_available: true,
     native_bridge_supported: true,
     srcs: ["property_info_parser.cpp"],
diff --git a/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp b/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp
index a643062..3907413 100644
--- a/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp
+++ b/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp
@@ -139,7 +139,7 @@
 
   auto property_info_area = reinterpret_cast<const PropertyInfoArea*>(serialized_trie.data());
 
-  // Sanity check
+  // Smoke test
   auto root_node = property_info_area->root_node();
   EXPECT_STREQ("root", root_node.name());
   EXPECT_STREQ("default", property_info_area->context(root_node.context_index()));
diff --git a/qemu_pipe/OWNERS b/qemu_pipe/OWNERS
index dbc1bf6..d67a329 100644
--- a/qemu_pipe/OWNERS
+++ b/qemu_pipe/OWNERS
@@ -1 +1,3 @@
 bohu@google.com
+lfy@google.com
+rkir@google.com
diff --git a/qemu_pipe/qemu_pipe.cpp b/qemu_pipe/qemu_pipe.cpp
index beeccb0..03afb21 100644
--- a/qemu_pipe/qemu_pipe.cpp
+++ b/qemu_pipe/qemu_pipe.cpp
@@ -35,7 +35,6 @@
 #endif
 
 int qemu_pipe_open(const char* pipeName) {
-    // Sanity check.
     if (!pipeName) {
         errno = EINVAL;
         return -1;
diff --git a/rootdir/Android.bp b/rootdir/Android.bp
index 96b5e0d..d63868a 100644
--- a/rootdir/Android.bp
+++ b/rootdir/Android.bp
@@ -24,3 +24,10 @@
     src: "ueventd.rc",
     recovery_available: true,
 }
+
+// TODO(b/147210213) Generate list of libraries during build and fill in at build time
+linker_config {
+    name: "system_linker_config",
+    src: "etc/linker.config.json",
+    installable: false,
+}
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index a9d0ed0..73d1101 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -69,7 +69,7 @@
 
 EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS :=
 ifeq ($(CLANG_COVERAGE),true)
-  EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/misc/trace/clang-%p-%m.profraw
+  EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/misc/trace/clang-%20m.profraw
 endif
 
 # Put it here instead of in init.rc module definition,
@@ -78,7 +78,7 @@
 # create some directories (some are mount points) and symlinks
 LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \
     dev proc sys system data data_mirror odm oem acct config storage mnt apex debug_ramdisk \
-    linkerconfig $(BOARD_ROOT_EXTRA_FOLDERS)); \
+    linkerconfig second_stage_resources postinstall $(BOARD_ROOT_EXTRA_FOLDERS)); \
     ln -sf /system/bin $(TARGET_ROOT_OUT)/bin; \
     ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \
     ln -sf /data/user_de/0/com.android.shell/files/bugreports $(TARGET_ROOT_OUT)/bugreports; \
@@ -120,6 +120,27 @@
 LOCAL_POST_INSTALL_CMD += ; ln -sf /vendor/odm/priv-app $(TARGET_ROOT_OUT)/odm/priv-app
 LOCAL_POST_INSTALL_CMD += ; ln -sf /vendor/odm/usr $(TARGET_ROOT_OUT)/odm/usr
 
+
+# For /vendor_dlkm partition.
+LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/vendor_dlkm
+# For Treble Generic System Image (GSI), system-as-root GSI needs to work on
+# both devices with and without /vendor_dlkm partition. Those symlinks are for
+# devices without /vendor_dlkm partition. For devices with /vendor_dlkm
+# partition, mount vendor_dlkm.img under /vendor_dlkm will hide those symlinks.
+# Note that /vendor_dlkm/lib is omitted because vendor DLKMs should be accessed
+# via /vendor/lib/modules directly.
+LOCAL_POST_INSTALL_CMD += ; ln -sf /vendor/vendor_dlkm/etc $(TARGET_ROOT_OUT)/vendor_dlkm/etc
+
+# For /odm_dlkm partition.
+LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/odm_dlkm
+# For Treble Generic System Image (GSI), system-as-root GSI needs to work on
+# both devices with and without /odm_dlkm partition. Those symlinks are for
+# devices without /odm_dlkm partition. For devices with /odm_dlkm
+# partition, mount odm_dlkm.img under /odm_dlkm will hide those symlinks.
+# Note that /odm_dlkm/lib is omitted because odm DLKMs should be accessed
+# via /odm/lib/modules directly.
+LOCAL_POST_INSTALL_CMD += ; ln -sf /odm/odm_dlkm/etc $(TARGET_ROOT_OUT)/odm_dlkm/etc
+
 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
   LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/cache
 else
@@ -132,11 +153,6 @@
     ; mkdir -p $(dir $(TARGET_ROOT_OUT)/$(word 2,$(p))) \
     ; ln -sf $(word 1,$(p)) $(TARGET_ROOT_OUT)/$(word 2,$(p)))
 endif
-# The A/B updater uses a top-level /postinstall directory to mount the new
-# system before reboot.
-ifeq ($(AB_OTA_UPDATER),true)
-  LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/postinstall
-endif
 
 # The init symlink must be a post install command of a file that is to TARGET_ROOT_OUT.
 # Since init.environ.rc is required for init and satisfies that requirement, we hijack it to create the symlink.
diff --git a/rootdir/OWNERS b/rootdir/OWNERS
index ca22eb8..5d0d673 100644
--- a/rootdir/OWNERS
+++ b/rootdir/OWNERS
@@ -1,5 +1,7 @@
+bowgotsai@google.com
 ccross@google.com
+dvander@google.com
+elsk@google.com
 jeffv@google.com
 jiyong@google.com
 smoreland@google.com
-tomcherry@google.com
diff --git a/rootdir/avb/Android.bp b/rootdir/avb/Android.bp
index 85d2786..8c7caf3 100644
--- a/rootdir/avb/Android.bp
+++ b/rootdir/avb/Android.bp
@@ -18,3 +18,10 @@
         "s-gsi.avbpubkey",
     ],
 }
+
+filegroup {
+    name: "qcar-gsi_avbpubkey",
+    srcs: [
+        "qcar-gsi.avbpubkey",
+    ],
+}
diff --git a/rootdir/avb/Android.mk b/rootdir/avb/Android.mk
index f96ffdd..f71f205 100644
--- a/rootdir/avb/Android.mk
+++ b/rootdir/avb/Android.mk
@@ -1,5 +1,19 @@
 LOCAL_PATH:= $(call my-dir)
 
+ifeq ($(BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT),true) # AVB keys are installed to vendor ramdisk
+  ifeq ($(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT),true) # no dedicated recovery partition
+    my_gsi_avb_keys_path := $(TARGET_VENDOR_RAMDISK_OUT)/first_stage_ramdisk/avb
+  else # device has a dedicated recovery partition
+    my_gsi_avb_keys_path := $(TARGET_VENDOR_RAMDISK_OUT)/avb
+  endif
+else
+  ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) # no dedicated recovery partition
+    my_gsi_avb_keys_path := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
+  else # device has a dedicated recovery partition
+    my_gsi_avb_keys_path := $(TARGET_RAMDISK_OUT)/avb
+  endif
+endif
+
 #######################################
 # q-gsi.avbpubkey
 include $(CLEAR_VARS)
@@ -7,11 +21,7 @@
 LOCAL_MODULE := q-gsi.avbpubkey
 LOCAL_MODULE_CLASS := ETC
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
-else
-LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)/avb
-endif
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
 
 include $(BUILD_PREBUILT)
 
@@ -22,11 +32,7 @@
 LOCAL_MODULE := q-developer-gsi.avbpubkey
 LOCAL_MODULE_CLASS := ETC
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
-else
-LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)/avb
-endif
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
 
 include $(BUILD_PREBUILT)
 
@@ -37,11 +43,7 @@
 LOCAL_MODULE := r-gsi.avbpubkey
 LOCAL_MODULE_CLASS := ETC
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
-else
-LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)/avb
-endif
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
 
 include $(BUILD_PREBUILT)
 
@@ -52,11 +54,7 @@
 LOCAL_MODULE := r-developer-gsi.avbpubkey
 LOCAL_MODULE_CLASS := ETC
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
-else
-LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)/avb
-endif
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
 
 include $(BUILD_PREBUILT)
 
@@ -67,11 +65,7 @@
 LOCAL_MODULE := s-gsi.avbpubkey
 LOCAL_MODULE_CLASS := ETC
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
-else
-LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)/avb
-endif
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
 
 include $(BUILD_PREBUILT)
 
@@ -82,10 +76,19 @@
 LOCAL_MODULE := s-developer-gsi.avbpubkey
 LOCAL_MODULE_CLASS := ETC
 LOCAL_SRC_FILES := $(LOCAL_MODULE)
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
-LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/avb
-else
-LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)/avb
-endif
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
 
 include $(BUILD_PREBUILT)
+
+#######################################
+# qcar-gsi.avbpubkey
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := qcar-gsi.avbpubkey
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(my_gsi_avb_keys_path)
+
+include $(BUILD_PREBUILT)
+
+my_gsi_avb_keys_path :=
diff --git a/rootdir/avb/qcar-gsi.avbpubkey b/rootdir/avb/qcar-gsi.avbpubkey
new file mode 100644
index 0000000..ce56646
--- /dev/null
+++ b/rootdir/avb/qcar-gsi.avbpubkey
Binary files differ
diff --git a/rootdir/etc/linker.config.json b/rootdir/etc/linker.config.json
new file mode 100644
index 0000000..2faf608
--- /dev/null
+++ b/rootdir/etc/linker.config.json
@@ -0,0 +1,29 @@
+{
+  "requireLibs": [
+    // Keep in sync with the "platform" namespace in art/build/apex/ld.config.txt.
+    "libdexfile_external.so",
+    "libdexfiled_external.so",
+    "libnativebridge.so",
+    "libnativehelper.so",
+    "libnativeloader.so",
+    "libandroidicu.so",
+    "libicu.so",
+    // TODO(b/122876336): Remove libpac.so once it's migrated to Webview
+    "libpac.so",
+    // TODO(b/120786417 or b/134659294): libicuuc.so
+    // and libicui18n.so are kept for app compat.
+    "libicui18n.so",
+    "libicuuc.so",
+    // resolv
+    "libnetd_resolv.so",
+    // nn
+    "libneuralnetworks.so",
+    // statsd
+    "libstatspull.so",
+    "libstatssocket.so",
+    // adbd
+    "libadb_pairing_auth.so",
+    "libadb_pairing_connection.so",
+    "libadb_pairing_server.so"
+  ]
+}
\ No newline at end of file
diff --git a/rootdir/etc/public.libraries.android.txt b/rootdir/etc/public.libraries.android.txt
index 405f5a9..967205f 100644
--- a/rootdir/etc/public.libraries.android.txt
+++ b/rootdir/etc/public.libraries.android.txt
@@ -10,12 +10,14 @@
 libGLESv1_CM.so
 libGLESv2.so
 libGLESv3.so
+libicu.so
 libicui18n.so
 libicuuc.so
 libjnigraphics.so
 liblog.so
 libmediandk.so
 libm.so
+libnativehelper.so
 libnativewindow.so
 libneuralnetworks.so nopreload
 libOpenMAXAL.so
diff --git a/rootdir/etc/public.libraries.iot.txt b/rootdir/etc/public.libraries.iot.txt
index b565340..77f8bb8 100644
--- a/rootdir/etc/public.libraries.iot.txt
+++ b/rootdir/etc/public.libraries.iot.txt
@@ -17,6 +17,7 @@
 liblog.so
 libmediandk.so
 libm.so
+libnativehelper.so
 libnativewindow.so
 libneuralnetworks.so
 libOpenMAXAL.so
diff --git a/rootdir/etc/public.libraries.wear.txt b/rootdir/etc/public.libraries.wear.txt
index 7cbda08..82196e4 100644
--- a/rootdir/etc/public.libraries.wear.txt
+++ b/rootdir/etc/public.libraries.wear.txt
@@ -16,6 +16,7 @@
 liblog.so
 libmediandk.so
 libm.so
+libnativehelper.so
 libnativewindow.so
 libneuralnetworks.so
 libOpenMAXAL.so
diff --git a/rootdir/init.rc b/rootdir/init.rc
index a9af0b0..03af4f3 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -56,7 +56,7 @@
     write /sys/module/dm_verity/parameters/prefetch_cluster 0
 
     # Generate ld.config.txt for early executed processes
-    exec -- /system/bin/linkerconfig --target /linkerconfig/bootstrap
+    exec -- /system/bin/bootstrap/linkerconfig --target /linkerconfig/bootstrap
     chmod 644 /linkerconfig/bootstrap/ld.config.txt
     copy /linkerconfig/bootstrap/ld.config.txt /linkerconfig/default/ld.config.txt
     chmod 644 /linkerconfig/default/ld.config.txt
@@ -81,6 +81,11 @@
     # Mount tracefs
     mount tracefs tracefs /sys/kernel/tracing
 
+    # create sys dirctory
+    mkdir /dev/sys 0755 system system
+    mkdir /dev/sys/fs 0755 system system
+    mkdir /dev/sys/block 0755 system system
+
 # Run boringssl self test for each ABI so that later processes can skip it. http://b/139348610
 on early-init && property:ro.product.cpu.abilist32=*
     exec_start boringssl_self_test32
@@ -143,6 +148,82 @@
     chmod 0664 /dev/stune/top-app/tasks
     chmod 0664 /dev/stune/rt/tasks
 
+    # cpuctl hierarchy for devices using utilclamp
+    mkdir /dev/cpuctl/foreground
+    mkdir /dev/cpuctl/background
+    mkdir /dev/cpuctl/top-app
+    mkdir /dev/cpuctl/rt
+    mkdir /dev/cpuctl/system
+    mkdir /dev/cpuctl/system-background
+    chown system system /dev/cpuctl
+    chown system system /dev/cpuctl/foreground
+    chown system system /dev/cpuctl/background
+    chown system system /dev/cpuctl/top-app
+    chown system system /dev/cpuctl/rt
+    chown system system /dev/cpuctl/system
+    chown system system /dev/cpuctl/system-background
+    chown system system /dev/cpuctl/tasks
+    chown system system /dev/cpuctl/foreground/tasks
+    chown system system /dev/cpuctl/background/tasks
+    chown system system /dev/cpuctl/top-app/tasks
+    chown system system /dev/cpuctl/rt/tasks
+    chown system system /dev/cpuctl/system/tasks
+    chown system system /dev/cpuctl/system-background/tasks
+    chmod 0664 /dev/cpuctl/tasks
+    chmod 0664 /dev/cpuctl/foreground/tasks
+    chmod 0664 /dev/cpuctl/background/tasks
+    chmod 0664 /dev/cpuctl/top-app/tasks
+    chmod 0664 /dev/cpuctl/rt/tasks
+    chmod 0664 /dev/cpuctl/system/tasks
+    chmod 0664 /dev/cpuctl/system-background/tasks
+
+    # Create a cpu group for NNAPI HAL processes
+    mkdir /dev/cpuctl/nnapi-hal
+    chown system system /dev/cpuctl/nnapi-hal
+    chown system system /dev/cpuctl/nnapi-hal/tasks
+    chmod 0664 /dev/cpuctl/nnapi-hal/tasks
+    write /dev/cpuctl/nnapi-hal/cpu.uclamp.min 1
+    write /dev/cpuctl/nnapi-hal/cpu.uclamp.latency_sensitive 1
+
+    # Create a cpu group for camera daemon processes
+    mkdir /dev/cpuctl/camera-daemon
+    chown system system /dev/cpuctl/camera-daemon
+    chown system system /dev/cpuctl/camera-daemon/tasks
+    chmod 0664 /dev/cpuctl/camera-daemon/tasks
+
+    # Android only use global RT throttling and doesn't use CONFIG_RT_GROUP_SCHED
+    # for RT group throttling. These values here are just to make sure RT threads
+    # can be migrated to those groups. These settings can be removed once we migrate
+    # to GKI kernel.
+    write /dev/cpuctl/cpu.rt_period_us 1000000
+    write /dev/cpuctl/cpu.rt_runtime_us 950000
+    # Surfaceflinger is in FG group so giving it a bit more
+    write /dev/cpuctl/foreground/cpu.rt_runtime_us 450000
+    write /dev/cpuctl/foreground/cpu.rt_period_us 1000000
+    write /dev/cpuctl/background/cpu.rt_runtime_us 50000
+    write /dev/cpuctl/background/cpu.rt_period_us 1000000
+    write /dev/cpuctl/top-app/cpu.rt_runtime_us 100000
+    write /dev/cpuctl/top-app/cpu.rt_period_us 1000000
+    write /dev/cpuctl/rt/cpu.rt_runtime_us 100000
+    write /dev/cpuctl/rt/cpu.rt_period_us 1000000
+    write /dev/cpuctl/system/cpu.rt_runtime_us 100000
+    write /dev/cpuctl/system/cpu.rt_period_us 1000000
+    write /dev/cpuctl/system-background/cpu.rt_runtime_us 50000
+    write /dev/cpuctl/system-background/cpu.rt_period_us 1000000
+    write /dev/cpuctl/nnapi-hal/cpu.rt_runtime_us 50000
+    write /dev/cpuctl/nnapi-hal/cpu.rt_period_us 1000000
+    write /dev/cpuctl/camera-daemon/cpu.rt_runtime_us 50000
+    write /dev/cpuctl/camera-daemon/cpu.rt_period_us 1000000
+
+    # Migrate root group to system subgroup
+    copy_per_line /dev/cpuctl/tasks /dev/cpuctl/system/tasks
+
+    # Create an stune group for camera-specific processes
+    mkdir /dev/stune/camera-daemon
+    chown system system /dev/stune/camera-daemon
+    chown system system /dev/stune/camera-daemon/tasks
+    chmod 0664 /dev/stune/camera-daemon/tasks
+
     # Create an stune group for NNAPI HAL processes
     mkdir /dev/stune/nnapi-hal
     chown system system /dev/stune/nnapi-hal
@@ -241,8 +322,6 @@
     write /proc/sys/vm/mmap_min_addr 32768
     write /proc/sys/net/ipv4/ping_group_range "0 2147483647"
     write /proc/sys/net/unix/max_dgram_qlen 600
-    write /proc/sys/kernel/sched_rt_runtime_us 950000
-    write /proc/sys/kernel/sched_rt_period_us 1000000
 
     # Assign reasonable ceiling values for socket rcv/snd buffers.
     # These should almost always be overridden by the target per the
@@ -264,13 +343,6 @@
     # /proc/net/fib_trie leaks interface IP addresses
     chmod 0400 /proc/net/fib_trie
 
-    # Create cgroup mount points for process groups
-    chown system system /dev/cpuctl
-    chown system system /dev/cpuctl/tasks
-    chmod 0666 /dev/cpuctl/tasks
-    write /dev/cpuctl/cpu.rt_period_us 1000000
-    write /dev/cpuctl/cpu.rt_runtime_us 950000
-
     # sets up initial cpusets for ActivityManager
     # this ensures that the cpusets are present and usable, but the device's
     # init.rc must actually set the correct cpus
@@ -283,7 +355,6 @@
 
     # system-background is for system tasks that should only run on
     # little cores, not on bigs
-    # to be used only by init, so don't change system-bg permissions
     mkdir /dev/cpuset/system-background
     copy /dev/cpuset/cpus /dev/cpuset/system-background/cpus
     copy /dev/cpuset/mems /dev/cpuset/system-background/mems
@@ -298,6 +369,11 @@
     copy /dev/cpuset/cpus /dev/cpuset/top-app/cpus
     copy /dev/cpuset/mems /dev/cpuset/top-app/mems
 
+    # create a cpuset for camera daemon processes
+    mkdir /dev/cpuset/camera-daemon
+    copy /dev/cpuset/cpus /dev/cpuset/camera-daemon/cpus
+    copy /dev/cpuset/mems /dev/cpuset/camera-daemon/mems
+
     # change permissions for all cpusets we'll touch at runtime
     chown system system /dev/cpuset
     chown system system /dev/cpuset/foreground
@@ -305,12 +381,14 @@
     chown system system /dev/cpuset/system-background
     chown system system /dev/cpuset/top-app
     chown system system /dev/cpuset/restricted
+    chown system system /dev/cpuset/camera-daemon
     chown system system /dev/cpuset/tasks
     chown system system /dev/cpuset/foreground/tasks
     chown system system /dev/cpuset/background/tasks
     chown system system /dev/cpuset/system-background/tasks
     chown system system /dev/cpuset/top-app/tasks
     chown system system /dev/cpuset/restricted/tasks
+    chown system system /dev/cpuset/camera-daemon/tasks
 
     # set system-background to 0775 so SurfaceFlinger can touch it
     chmod 0775 /dev/cpuset/system-background
@@ -321,6 +399,7 @@
     chmod 0664 /dev/cpuset/top-app/tasks
     chmod 0664 /dev/cpuset/restricted/tasks
     chmod 0664 /dev/cpuset/tasks
+    chmod 0664 /dev/cpuset/camera-daemon/tasks
 
     # make the PSI monitor accessible to others
     chown system system /proc/pressure/memory
@@ -459,6 +538,10 @@
     # The bind+remount combination allows this to work in containers.
     mount rootfs rootfs / remount bind ro nodev
 
+    # Mount default storage into root namespace
+    mount none /mnt/user/0 /storage bind rec
+    mount none none /storage slave rec
+
     # 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
@@ -484,6 +567,9 @@
     chown root log /proc/slabinfo
     chmod 0440 /proc/slabinfo
 
+    chown root log /proc/pagetypeinfo
+    chmod 0440 /proc/pagetypeinfo
+
     #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
     chown root system /proc/kmsg
     chmod 0440 /proc/kmsg
@@ -505,6 +591,8 @@
     mkdir /metadata/bootstat 0750 system log
     mkdir /metadata/ota 0700 root system
     mkdir /metadata/ota/snapshots 0700 root system
+    mkdir /metadata/userspacereboot 0770 root system
+    mkdir /metadata/watchdog 0770 root system
 
     mkdir /metadata/apex 0700 root system
     mkdir /metadata/apex/sessions 0700 root system
@@ -525,6 +613,9 @@
     # HALs required before storage encryption can get unlocked (FBE/FDE)
     class_start early_hal
 
+    # Load trusted keys from dm-verity protected partitions
+    exec -- /system/bin/fsverity_init --load-verified-keys
+
 on post-fs-data
     mark_post_data
 
@@ -545,6 +636,18 @@
     mkdir /data/bootchart 0755 shell shell encryption=Require
     bootchart start
 
+    mkdir /data/vendor 0771 root root encryption=Require
+    mkdir /data/vendor_ce 0771 root root encryption=None
+    mkdir /data/vendor_de 0771 root root encryption=None
+    mkdir /data/vendor/hardware 0771 root root
+
+    # Start tombstoned early to be able to store tombstones.
+    mkdir /data/anr 0775 system system encryption=Require
+    mkdir /data/tombstones 0771 system system encryption=Require
+    mkdir /data/vendor/tombstones 0771 root root
+    mkdir /data/vendor/tombstones/wifi 0771 wifi wifi
+    start tombstoned
+
     # Make sure that apexd is started in the default namespace
     enter_default_mount_ns
 
@@ -554,7 +657,7 @@
     mkdir /data/apex/backup 0700 root system
     mkdir /data/apex/hashtree 0700 root system
     mkdir /data/apex/sessions 0700 root system
-    mkdir /data/app-staging 0750 system system encryption=None
+    mkdir /data/app-staging 0751 system system encryption=DeleteIfNecessary
     start apexd
 
     # Avoid predictable entropy pool. Carry over entropy from previous boot.
@@ -582,6 +685,8 @@
     chown bluetooth bluetooth /data/misc/bluedroid/bt_config.conf
     mkdir /data/misc/bluetooth 0770 bluetooth bluetooth
     mkdir /data/misc/bluetooth/logs 0770 bluetooth bluetooth
+    mkdir /data/misc/nfc 0770 nfc nfc
+    mkdir /data/misc/nfc/logs 0770 nfc nfc
     mkdir /data/misc/credstore 0700 credstore credstore
     mkdir /data/misc/keystore 0700 keystore keystore
     mkdir /data/misc/gatekeeper 0700 system system
@@ -626,17 +731,13 @@
     mkdir /data/misc/installd 0700 root root
     mkdir /data/misc/apexdata 0711 root root
     mkdir /data/misc/apexrollback 0700 root root
+    mkdir /data/misc/appcompat/ 0700 system system
     mkdir /data/misc/snapshotctl_log 0755 root root
     # create location to store pre-reboot information
     mkdir /data/misc/prereboot 0700 system system
 
     mkdir /data/preloads 0775 system system encryption=None
 
-    mkdir /data/vendor 0771 root root encryption=Require
-    mkdir /data/vendor_ce 0771 root root encryption=None
-    mkdir /data/vendor_de 0771 root root encryption=None
-    mkdir /data/vendor/hardware 0771 root root
-
     # For security reasons, /data/local/tmp should always be empty.
     # Do not place files or directories in /data/local/tmp
     mkdir /data/local/tmp 0771 shell shell
@@ -648,9 +749,20 @@
     mkdir /data/app-lib 0771 system system encryption=Require
     mkdir /data/app 0771 system system encryption=Require
     mkdir /data/property 0700 root root encryption=Require
-    mkdir /data/tombstones 0771 system system encryption=Require
-    mkdir /data/vendor/tombstones 0771 root root
-    mkdir /data/vendor/tombstones/wifi 0771 wifi wifi
+
+    # create directory for updated font files.
+    mkdir /data/fonts/ 0771 root root encryption=Require
+    mkdir /data/fonts/files 0771 system system
+    mkdir /data/fonts/config 0770 system system
+
+    # Create directories to push tests to for each linker namespace.
+    # Create the subdirectories in case the first test is run as root
+    # so it doesn't end up owned by root.
+    mkdir /data/local/tests 0700 shell shell
+    mkdir /data/local/tests/product 0700 shell shell
+    mkdir /data/local/tests/system 0700 shell shell
+    mkdir /data/local/tests/unrestricted 0700 shell shell
+    mkdir /data/local/tests/vendor 0700 shell shell
 
     # create dalvik-cache, so as to enforce our permissions
     mkdir /data/dalvik-cache 0771 root root encryption=Require
@@ -677,8 +789,6 @@
     # the following directory.
     mkdir /data/mediadrm 0770 mediadrm mediadrm encryption=Require
 
-    mkdir /data/anr 0775 system system encryption=Require
-
     # NFC: create data/nfc for nv storage
     mkdir /data/nfc 0770 nfc nfc encryption=Require
     mkdir /data/nfc/param 0770 nfc nfc
@@ -736,6 +846,7 @@
     # Delete these if need be, per b/139193659
     mkdir /data/rollback 0700 system system encryption=DeleteIfNecessary
     mkdir /data/rollback-observer 0700 system system encryption=DeleteIfNecessary
+    mkdir /data/rollback-history 0700 system system encryption=DeleteIfNecessary
 
     # Create root dir for Incremental Service
     mkdir /data/incremental 0771 system system encryption=Require
@@ -760,15 +871,22 @@
 
     init_user0
 
+    # Set SELinux security contexts on upgrade or policy update.
+    restorecon --recursive --skip-ce /data
+
+    # After apexes are mounted, tell keymaster early boot has ended, so it will
+    # stop allowing use of early-boot keys
+    exec - system system -- /system/bin/vdc keymaster earlyBootEnded
+
+    # Lock the fs-verity keyring, so no more keys can be added
+    exec -- /system/bin/fsverity_init --lock
+
     # Allow apexd to snapshot and restore device encrypted apex data in the case
     # of a rollback. This should be done immediately after DE_user data keys
     # are loaded. APEXes should not access this data until this has been
     # completed and apexd.status becomes "ready".
     exec_start apexd-snapshotde
 
-    # Set SELinux security contexts on upgrade or policy update.
-    restorecon --recursive --skip-ce /data
-
     # Check any timezone data in /data is newer than the copy in the time zone data
     # module, delete if not.
     exec - system system -- /system/bin/tzdatacheck /apex/com.android.tzdata/etc/tz /data/misc/zoneinfo
@@ -791,22 +909,6 @@
     # Enable FUSE by default
     setprop persist.sys.fuse true
 
-# Switch between sdcardfs and FUSE depending on persist property
-# TODO: Move this to ro property before launch because FDE devices
-# interact with persistent properties differently during boot
-on zygote-start && property:persist.sys.fuse=true
-  # Mount default storage into root namespace
-  mount none /mnt/user/0 /storage bind rec
-  mount none none /storage slave rec
-on zygote-start && property:persist.sys.fuse=false
-  # Mount default storage into root namespace
-  mount none /mnt/runtime/default /storage bind rec
-  mount none none /storage slave rec
-on zygote-start && property:persist.sys.fuse=""
-  # Mount default storage into root namespace
-  mount none /mnt/runtime/default /storage bind rec
-  mount none none /storage slave rec
-
 # It is recommended to put unnecessary data/ initialization from post-fs-data
 # to start-zygote in device's init.rc to unblock zygote start.
 on zygote-start && property:ro.crypto.state=unencrypted
@@ -833,6 +935,14 @@
     start zygote
     start zygote_secondary
 
+on boot && property:ro.config.low_ram=true
+    # Tweak background writeout
+    write /proc/sys/vm/dirty_expire_centisecs 200
+    write /proc/sys/vm/dirty_background_ratio  5
+
+on property:sys.boot_completed=1 && property:init.mount_debugfs=1
+   umount /sys/kernel/debug
+
 on boot
     # basic network init
     ifup lo
@@ -854,22 +964,26 @@
     chown root system /sys/block/zram0/writeback
     chmod 0664 /sys/block/zram0/writeback
 
-    # Tweak background writeout
-    write /proc/sys/vm/dirty_expire_centisecs 200
-    write /proc/sys/vm/dirty_background_ratio  5
+    # to access F2FS sysfs on dm-<num> directly
+    mkdir /dev/sys/fs/by-name 0755 system system
+    symlink /sys/fs/f2fs/${dev.mnt.blk.data} /dev/sys/fs/by-name/userdata
 
-    # F2FS tuning. Set cp_interval larger than dirty_expire_centisecs
+    # to access dm-<num> sysfs
+    mkdir /dev/sys/block/by-name 0755 system system
+    symlink /sys/devices/virtual/block/${dev.mnt.blk.data} /dev/sys/block/by-name/userdata
+
+    # F2FS tuning. Set cp_interval larger than dirty_expire_centisecs, 30 secs,
     # to avoid power consumption when system becomes mostly idle. Be careful
     # to make it too large, since it may bring userdata loss, if they
     # are not aware of using fsync()/sync() to prepare sudden power-cut.
-    write /sys/fs/f2fs/${dev.mnt.blk.data}/cp_interval 200
-    write /sys/fs/f2fs/${dev.mnt.blk.data}/gc_urgent_sleep_time 50
-    write /sys/fs/f2fs/${dev.mnt.blk.data}/iostat_enable 1
+    write /dev/sys/fs/by-name/userdata/cp_interval 200
+    write /dev/sys/fs/by-name/userdata/gc_urgent_sleep_time 50
+    write /dev/sys/fs/by-name/userdata/iostat_enable 1
 
     # limit discard size to 128MB in order to avoid long IO latency
     # for filesystem tuning first (dm or sda)
     # Note that, if dm-<num> is used, sda/mmcblk0 should be tuned in vendor/init.rc
-    write /sys/devices/virtual/block/${dev.mnt.blk.data}/queue/discard_max_bytes 134217728
+    write /dev/sys/block/by-name/userdata/queue/discard_max_bytes 134217728
 
     # Permissions for System Server and daemons.
     chown system system /sys/power/autosleep
@@ -935,9 +1049,6 @@
 
     class_start core
 
-    # Requires keystore (currently a core service) to be ready first.
-    exec -- /system/bin/fsverity_init
-
 on nonencrypted
     class_start main
     class_start late_start
@@ -970,6 +1081,7 @@
     class_start main
     class_start late_start
     setprop service.bootanim.exit 0
+    setprop service.bootanim.progress 0
     start bootanim
 
 on property:vold.decrypt=trigger_shutdown_framework
@@ -991,8 +1103,8 @@
     write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}
 
 # "tcp_default_init_rwnd" Is too long!
-on property:sys.sysctl.tcp_def_init_rwnd=*
-    write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}
+on property:net.tcp_def_init_rwnd=*
+    write /proc/sys/net/ipv4/tcp_default_init_rwnd ${net.tcp_def_init_rwnd}
 
 # perf_event_open syscall security:
 # Newer kernels have the ability to control the use of the syscall via SELinux
@@ -1021,6 +1133,14 @@
     write /proc/sys/kernel/perf_cpu_time_max_percent 25
     write /proc/sys/kernel/perf_event_mlock_kb 516
 
+# This property can be set only on userdebug/eng. See neverallow rule in
+# /system/sepolicy/private/property.te .
+on property:security.lower_kptr_restrict=1
+    write /proc/sys/kernel/kptr_restrict 0
+
+on property:security.lower_kptr_restrict=0
+    write /proc/sys/kernel/kptr_restrict 2
+
 
 # on shutdown
 # In device's init.rc, this trigger can be used to do device-specific actions
@@ -1063,6 +1183,7 @@
   setprop sys.user.0.ce_available ""
   setprop sys.shutdown.requested ""
   setprop service.bootanim.exit ""
+  setprop service.bootanim.progress ""
 
 on userspace-reboot-fs-remount
   # Make sure that vold is running.
@@ -1089,3 +1210,11 @@
 
 on property:sys.boot_completed=1 && property:sys.init.userspace_reboot.in_progress=1
   setprop sys.init.userspace_reboot.in_progress ""
+
+on early-init && property:init.mount_debugfs=1
+    mount debugfs debugfs /sys/kernel/debug
+    chmod 0755 /sys/kernel/debug
+
+# Migrate tasks again in case kernel threads are created during boot
+on property:sys.boot_completed=1
+  copy_per_line /dev/cpuctl/tasks /dev/cpuctl/system/tasks
diff --git a/rootdir/init.zygote32.rc b/rootdir/init.zygote32.rc
index e827cf5..9469a48 100644
--- a/rootdir/init.zygote32.rc
+++ b/rootdir/init.zygote32.rc
@@ -13,3 +13,4 @@
     onrestart restart netd
     onrestart restart wificond
     writepid /dev/cpuset/foreground/tasks
+    critical window=${zygote.critical_window.minute:-off} target=zygote-fatal
diff --git a/rootdir/init.zygote32_64.rc b/rootdir/init.zygote32_64.rc
deleted file mode 100644
index fe6dcfa..0000000
--- a/rootdir/init.zygote32_64.rc
+++ /dev/null
@@ -1,25 +0,0 @@
-service zygote /system/bin/app_process32 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote
-    class main
-    priority -20
-    user root
-    group root readproc reserved_disk
-    socket zygote stream 660 root system
-    socket usap_pool_primary stream 660 root system
-    onrestart exec_background - system system -- /system/bin/vdc volume abort_fuse
-    onrestart write /sys/power/state on
-    onrestart restart audioserver
-    onrestart restart cameraserver
-    onrestart restart media
-    onrestart restart netd
-    onrestart restart wificond
-    writepid /dev/cpuset/foreground/tasks
-
-service zygote_secondary /system/bin/app_process64 -Xzygote /system/bin --zygote --socket-name=zygote_secondary
-    class main
-    priority -20
-    user root
-    group root readproc reserved_disk
-    socket zygote_secondary stream 660 root system
-    socket usap_pool_secondary stream 660 root system
-    onrestart restart zygote
-    writepid /dev/cpuset/foreground/tasks
diff --git a/rootdir/init.zygote64.rc b/rootdir/init.zygote64.rc
index adc7031..98dc088 100644
--- a/rootdir/init.zygote64.rc
+++ b/rootdir/init.zygote64.rc
@@ -13,3 +13,4 @@
     onrestart restart netd
     onrestart restart wificond
     writepid /dev/cpuset/foreground/tasks
+    critical window=${zygote.critical_window.minute:-off} target=zygote-fatal
diff --git a/rootdir/init.zygote64_32.rc b/rootdir/init.zygote64_32.rc
index fb9e99b..3eee180 100644
--- a/rootdir/init.zygote64_32.rc
+++ b/rootdir/init.zygote64_32.rc
@@ -13,6 +13,7 @@
     onrestart restart netd
     onrestart restart wificond
     task_profiles ProcessCapacityHigh MaxPerformance
+    critical window=${zygote.critical_window.minute:-off} target=zygote-fatal
 
 service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote --socket-name=zygote_secondary --enable-lazy-preload
     class main
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index 9c2cdf2..e9293b5 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -1,3 +1,6 @@
+import /vendor/etc/ueventd.rc
+import /odm/etc/ueventd.rc
+
 firmware_directories /etc/firmware/ /odm/firmware/ /vendor/firmware/ /firmware/image/
 uevent_socket_rcvbuf_size 16M
 
@@ -17,6 +20,9 @@
     devname uevent_devpath
     dirname /dev/snd
 
+subsystem dma_heap
+   devname uevent_devpath
+   dirname /dev/dma_heap
 # ueventd can only set permissions on device nodes and their associated
 # sysfs attributes, not on arbitrary paths.
 #
@@ -39,6 +45,9 @@
 /dev/vndbinder            0666   root       root
 
 /dev/pmsg0                0222   root       log
+/dev/dma_heap/system      0444   system     system
+/dev/dma_heap/system-uncached      0444   system     system
+/dev/dma_heap/system-secure        0444   system     system
 
 # kms driver for drm based gpu
 /dev/dri/*                0666   root       graphics
@@ -67,3 +76,5 @@
 /sys/devices/virtual/usb_composite/*   enable      0664  root   system
 /sys/devices/system/cpu/cpu*   cpufreq/scaling_max_freq   0664  system system
 /sys/devices/system/cpu/cpu*   cpufreq/scaling_min_freq   0664  system system
+/sys/devices/virtual/misc/uhid/*/leds/* brightness   0664  system system
+/sys/devices/virtual/misc/uhid/*/leds/* multi_intensity   0664  system system
diff --git a/run-as/Android.bp b/run-as/Android.bp
index 840a43c..accd07d 100644
--- a/run-as/Android.bp
+++ b/run-as/Android.bp
@@ -25,4 +25,5 @@
         "libpackagelistparser",
         "libminijail",
     ],
+    header_libs: ["libcutils_headers"],
 }
diff --git a/run-as/run-as.cpp b/run-as/run-as.cpp
index 432c434..cc92c68 100644
--- a/run-as/run-as.cpp
+++ b/run-as/run-as.cpp
@@ -247,12 +247,12 @@
 
   std::string seinfo = std::string(info.seinfo) + ":fromRunAs";
   if (selinux_android_setcontext(uid, 0, seinfo.c_str(), pkgname) < 0) {
-    error(1, errno, "couldn't set SELinux security context");
+    error(1, errno, "couldn't set SELinux security context '%s'", seinfo.c_str());
   }
 
   // cd into the data directory, and set $HOME correspondingly.
   if (TEMP_FAILURE_RETRY(chdir(info.data_dir)) == -1) {
-    error(1, errno, "couldn't chdir to package's data directory");
+    error(1, errno, "couldn't chdir to package's data directory '%s'", info.data_dir);
   }
   setenv("HOME", info.data_dir, 1);
 
diff --git a/shell_and_utilities/Android.bp b/shell_and_utilities/Android.bp
index b5a5fb6..5e013fe 100644
--- a/shell_and_utilities/Android.bp
+++ b/shell_and_utilities/Android.bp
@@ -36,7 +36,7 @@
         "sh.recovery",
         "toolbox.recovery",
         "toybox.recovery",
-        "unzip.recovery",
+        "ziptool.recovery",
     ],
 }
 
@@ -51,3 +51,13 @@
         "toybox_vendor",
     ],
 }
+
+// shell and utilities for first stage console. The list of binaries are
+// enough for debugging purposes.
+phony {
+    name: "shell_and_utilities_vendor_ramdisk",
+    required: [
+        "sh.vendor_ramdisk",
+        "toybox.vendor_ramdisk",
+    ],
+}
diff --git a/shell_and_utilities/README.md b/shell_and_utilities/README.md
index 3bee875..f339553 100644
--- a/shell_and_utilities/README.md
+++ b/shell_and_utilities/README.md
@@ -26,7 +26,8 @@
 because the toolbox implementations did have bugs fixed and options added
 over the years. Gingerbread's rm, for example, supported `-r`/`-R` but not
 `-f`. But this gives you an idea of what was available in any given release,
-and how usable it was likely to be.
+and how usable it was likely to be. (**Bold** marks where we switched to toybox
+or first added something to toybox.)
 
 Also note that in any given release `toybox` probably contains more
 commands than there are symlinks for in `/system/bin`. You can get the
@@ -98,7 +99,7 @@
 toolbox: df getevent iftop ioctl ionice log ls lsof mount nandread
 newfs\_msdos ps prlimit renice sendevent start stop top uptime watchprops
 
-toybox: acpi basename blockdev bzcat cal cat chcon chgrp chmod chown
+toybox (0.5.2-ish): acpi basename blockdev bzcat cal cat chcon chgrp chmod chown
 chroot cksum clear comm cmp cp cpio cut date dirname dmesg dos2unix echo
 env expand expr fallocate false find free getenforce getprop groups
 head hostname hwclock id ifconfig inotifyd insmod kill load\_policy ln
@@ -118,18 +119,18 @@
 toolbox: getevent iftop ioctl log nandread newfs\_msdos ps prlimit
 sendevent start stop top
 
-toybox: acpi base64 basename blockdev bzcat cal cat chcon chgrp chmod
-chown chroot cksum clear comm cmp cp cpio cut date df dirname dmesg
-dos2unix du echo env expand expr fallocate false find flock free
+toybox (0.7.0-ish): acpi **base64** basename blockdev bzcat cal cat chcon chgrp chmod
+chown chroot cksum clear comm cmp cp cpio cut date **df** dirname dmesg
+dos2unix **du** echo env expand expr fallocate false find **flock** free
 getenforce getprop groups head hostname hwclock id ifconfig inotifyd
-insmod ionice iorenice kill killall load\_policy ln logname losetup ls
-lsmod lsof lsusb md5sum mkdir mknod mkswap mktemp modinfo more mount
+insmod **ionice** **iorenice** kill **killall** load\_policy ln logname losetup **ls**
+lsmod **lsof** lsusb md5sum mkdir mknod mkswap mktemp modinfo more *mount*
 mountpoint mv netstat nice nl nohup od paste patch pgrep pidof pkill
-pmap printenv printf pwd readlink realpath renice restorecon rm rmdir
+pmap printenv printf pwd readlink realpath **renice** restorecon rm rmdir
 rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
 split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
-time timeout touch tr true truncate tty ulimit umount uname uniq unix2dos
-uptime usleep vmstat wc which whoami xargs xxd yes
+time timeout touch tr true truncate **tty** **ulimit** umount uname uniq unix2dos
+**uptime** usleep vmstat wc which whoami xargs **xxd** yes
 
 
 ## Android 8.0 (Oreo)
@@ -140,20 +141,20 @@
 
 toolbox: getevent newfs\_msdos
 
-toybox: acpi base64 basename blockdev cal cat chcon chgrp chmod chown
-chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
-dos2unix du echo env expand expr fallocate false file find flock free
-getenforce getprop groups gunzip gzip head hostname hwclock id ifconfig
-inotifyd insmod ionice iorenice kill killall ln load\_policy log logname
-losetup ls lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod
-mkswap mktemp modinfo modprobe more mount mountpoint mv netstat nice
-nl nohup od paste patch pgrep pidof pkill pmap printenv printf ps pwd
-readlink realpath renice restorecon rm rmdir rmmod runcon sed sendevent
-seq setenforce setprop setsid sha1sum sha224sum sha256sum sha384sum
-sha512sum sleep sort split start stat stop strings swapoff swapon sync
-sysctl tac tail tar taskset tee time timeout top touch tr true truncate
-tty ulimit umount uname uniq unix2dos uptime usleep uudecode uuencode
-vmstat wc which whoami xargs xxd yes zcat
+toybox (0.7.3-ish): acpi base64 basename blockdev cal cat chcon chgrp chmod chown
+chroot chrt cksum clear cmp comm cp cpio cut date df **diff** dirname dmesg
+dos2unix du echo env expand expr fallocate false **file** find flock free
+getenforce getprop groups **gunzip** **gzip** head hostname hwclock id ifconfig
+inotifyd insmod ionice iorenice kill killall ln load\_policy **log** logname
+losetup ls lsmod lsof **lspci** lsusb md5sum **microcom** mkdir **mkfifo** mknod
+mkswap mktemp modinfo **modprobe** more mount mountpoint mv netstat nice
+nl nohup od paste patch pgrep pidof pkill pmap printenv printf **ps** pwd
+readlink realpath renice restorecon rm rmdir rmmod runcon sed **sendevent**
+seq setenforce setprop setsid sha1sum **sha224sum** **sha256sum** **sha384sum**
+**sha512sum** sleep sort split start stat stop strings swapoff swapon sync
+sysctl tac tail tar taskset tee time timeout **top** touch tr true truncate
+tty ulimit umount uname uniq unix2dos uptime usleep **uudecode** **uuencode**
+vmstat wc which whoami xargs xxd yes **zcat**
 
 
 ## Android 9.0 (Pie)
@@ -166,9 +167,9 @@
 
 toolbox: getevent getprop newfs\_msdos
 
-toybox: acpi base64 basename blockdev cal cat chcon chgrp chmod chown
+toybox (0.7.6-ish): acpi base64 basename blockdev cal cat chcon chgrp chmod chown
 chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
-dos2unix du echo env expand expr fallocate false file find flock fmt free
+dos2unix du echo env expand expr fallocate false file find flock **fmt** free
 getenforce groups gunzip gzip head hostname hwclock id ifconfig inotifyd
 insmod ionice iorenice kill killall ln load\_policy log logname losetup ls
 lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod mkswap mktemp
@@ -176,13 +177,13 @@
 patch pgrep pidof pkill pmap printenv printf ps pwd readlink realpath
 renice restorecon rm rmdir rmmod runcon sed sendevent seq setenforce
 setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep
-sort split start stat stop strings stty swapoff swapon sync sysctl tac
+sort split start stat stop strings **stty** swapoff swapon sync sysctl tac
 tail tar taskset tee time timeout top touch tr true truncate tty ulimit
 umount uname uniq unix2dos uptime usleep uudecode uuencode vmstat wc
 which whoami xargs xxd yes zcat
 
 
-## Android Q
+## Android 10 ("Q")
 
 BSD: grep fsck\_msdos newfs\_msdos
 
@@ -192,27 +193,27 @@
 
 toolbox: getevent getprop
 
-toybox: acpi base64 basename bc blkid blockdev cal cat chattr chcon chgrp
+toybox (0.8.0-ish): acpi base64 basename **bc** **blkid** blockdev cal cat **chattr** chcon chgrp
 chmod chown chroot chrt cksum clear cmp comm cp cpio cut date dd df
-diff dirname dmesg dos2unix du echo egrep env expand expr fallocate
-false fgrep file find flock fmt free freeramdisk fsfreeze getconf
-getenforce getfattr grep groups gunzip gzip head help hostname hwclock
-i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd insmod
-install ionice iorenice iotop kill killall ln load\_policy log logname
-losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum microcom
+diff dirname dmesg dos2unix du echo **egrep** env expand expr fallocate
+false **fgrep** file find flock fmt free **freeramdisk** **fsfreeze** **getconf**
+getenforce **getfattr** grep groups gunzip gzip head **help** hostname hwclock
+**i2cdetect** **i2cdump** **i2cget** **i2cset** **iconv** id ifconfig inotifyd insmod
+**install** ionice iorenice **iotop** kill killall ln load\_policy log logname
+losetup ls **lsattr** lsmod lsof lspci lsusb **makedevs** md5sum microcom
 mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint
-mv nbd-client nc netcat netstat nice nl nohup nproc nsenter od partprobe
-paste patch pgrep pidof ping ping6 pivot\_root pkill pmap printenv
-printf prlimit ps pwd pwdx readlink realpath renice restorecon rev
-rfkill rm rmdir rmmod runcon sed sendevent seq setenforce setfattr
+mv **nbd-client** **nc** **netcat** netstat nice nl nohup **nproc** **nsenter** od **partprobe**
+paste patch pgrep pidof **ping** **ping6** **pivot\_root** pkill pmap printenv
+printf **prlimit** ps pwd **pwdx** readlink realpath renice restorecon **rev**
+**rfkill** rm rmdir rmmod runcon sed sendevent seq setenforce **setfattr**
 setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep
 sort split start stat stop strings stty swapoff swapon sync sysctl
-tac tail tar taskset tee time timeout top touch tr traceroute traceroute6
-true truncate tty tunctl ulimit umount uname uniq unix2dos unlink
-unshare uptime usleep uudecode uuencode uuidgen vconfig vmstat watch
+tac tail tar taskset tee time timeout top touch tr **traceroute** **traceroute6**
+true truncate tty **tunctl** ulimit umount uname uniq unix2dos **unlink**
+**unshare** uptime usleep uudecode uuencode **uuidgen** **vconfig** vmstat **watch**
 wc which whoami xargs xxd yes zcat
 
-## Android R
+## Android 11 ("R")
 
 BSD: fsck\_msdos newfs\_msdos
 
@@ -224,22 +225,54 @@
 
 toolbox: getevent getprop setprop start stop
 
-toybox: acpi base64 basename blkid blockdev cal cat chattr chcon chgrp chmod
-chown chroot chrt cksum clear cmp comm cp cpio cut date dd devmem
+toybox (0.8.3-ish): acpi base64 basename blkid blockdev cal cat chattr chcon chgrp chmod
+chown chroot chrt cksum clear cmp comm cp cpio cut date dd **devmem**
 df diff dirname dmesg dos2unix du echo egrep env expand expr fallocate
-false fgrep file find flock fmt free freeramdisk fsfreeze fsync getconf
-getenforce getfattr getopt grep groups gunzip gzip head help hostname
+false fgrep file find flock fmt free freeramdisk fsfreeze **fsync** getconf
+getenforce getfattr **getopt** grep groups gunzip gzip head help hostname
 hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd
 insmod install ionice iorenice iotop kill killall ln load\_policy log
 logname losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum microcom
 mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint
 mv nbd-client nc netcat netstat nice nl nohup nproc nsenter od partprobe
 paste patch pgrep pidof ping ping6 pivot\_root pkill pmap printenv
-printf prlimit ps pwd pwdx readelf readlink realpath renice restorecon
+printf prlimit ps pwd pwdx **readelf** readlink realpath renice restorecon
 rev rfkill rm rmdir rmmod runcon sed sendevent seq setenforce setfattr
 setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort
 split stat strings stty swapoff swapon sync sysctl tac tail tar taskset
 tee time timeout top touch tr traceroute traceroute6 true truncate
 tty tunctl ulimit umount uname uniq unix2dos unlink unshare uptime
-usleep uudecode uuencode uuidgen vconfig vi vmstat watch wc which
+usleep uudecode uuencode uuidgen vconfig **vi** vmstat watch wc which
 whoami xargs xxd yes zcat
+
+## Android ("S")
+
+BSD: fsck\_msdos newfs\_msdos
+
+bzip2: bzcat bzip2 bunzip2
+
+gavinhoward/bc: bc
+
+one-true-awk: awk
+
+toolbox: getevent getprop setprop start stop
+
+toybox (0.8.4-ish): **[** acpi base64 basename **blkdiscard** blkid blockdev cal cat chattr chcon
+chgrp chmod chown chroot chrt cksum clear cmp comm cp cpio cut date
+dd devmem df diff dirname dmesg dos2unix du echo egrep env expand
+expr fallocate false fgrep file find flock fmt free freeramdisk fsfreeze
+fsync getconf getenforce getfattr getopt grep groups gunzip gzip head
+help hostname hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig
+inotifyd insmod install ionice iorenice iotop kill killall ln load\_policy
+log logname losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum
+microcom mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount
+mountpoint mv nbd-client nc netcat netstat nice nl nohup nproc nsenter
+od partprobe paste patch pgrep pidof ping ping6 pivot\_root pkill pmap
+printenv printf prlimit ps pwd pwdx readelf readlink realpath renice
+restorecon rev rfkill rm rmdir rmmod **rtcwake** runcon sed sendevent
+seq setenforce setfattr setsid sha1sum sha224sum sha256sum sha384sum
+sha512sum sleep sort split stat strings stty swapoff swapon sync sysctl
+tac tail tar taskset tee **test** time timeout top touch tr traceroute
+traceroute6 true truncate tty tunctl ulimit umount uname uniq unix2dos
+unlink unshare uptime usleep uudecode uuencode uuidgen vconfig vi
+vmstat watch wc which whoami xargs xxd yes zcat
diff --git a/toolbox/OWNERS b/toolbox/OWNERS
index 682a067..7529cb9 100644
--- a/toolbox/OWNERS
+++ b/toolbox/OWNERS
@@ -1 +1 @@
-enh@google.com
+include platform/system/core:/janitors/OWNERS
diff --git a/toolbox/modprobe.cpp b/toolbox/modprobe.cpp
index 3ffa74e..7df7b71 100644
--- a/toolbox/modprobe.cpp
+++ b/toolbox/modprobe.cpp
@@ -17,11 +17,16 @@
 #include <ctype.h>
 #include <getopt.h>
 #include <stdlib.h>
-#include <iostream>
 
+#include <string>
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
 #include <android-base/strings.h>
 #include <modprobe/modprobe.h>
 
+namespace {
+
 enum modprobe_mode {
     AddModulesMode,
     RemoveModulesMode,
@@ -29,47 +34,104 @@
     ShowDependenciesMode,
 };
 
-static void print_usage(void) {
-    std::cerr << "Usage:" << std::endl;
-    std::cerr << std::endl;
-    std::cerr << "  modprobe [-alrqvsDb] [-d DIR] [MODULE]+" << std::endl;
-    std::cerr << "  modprobe [-alrqvsDb] [-d DIR] MODULE [symbol=value][...]" << std::endl;
-    std::cerr << std::endl;
-    std::cerr << "Options:" << std::endl;
-    std::cerr << "  -b: Apply blocklist to module names too" << std::endl;
-    std::cerr << "  -d: Load modules from DIR, option may be used multiple times" << std::endl;
-    std::cerr << "  -D: Print dependencies for modules only, do not load";
-    std::cerr << "  -h: Print this help" << std::endl;
-    std::cerr << "  -l: List modules matching pattern" << std::endl;
-    std::cerr << "  -r: Remove MODULE (multiple modules may be specified)" << std::endl;
-    std::cerr << "  -q: Quiet" << std::endl;
-    std::cerr << "  -v: Verbose" << std::endl;
-    std::cerr << std::endl;
+void print_usage(void) {
+    LOG(INFO) << "Usage:";
+    LOG(INFO);
+    // -d option is required on Android
+    LOG(INFO) << "  modprobe [options] -d DIR [--all=FILE|MODULE]...";
+    LOG(INFO) << "  modprobe [options] -d DIR MODULE [symbol=value]...";
+    LOG(INFO);
+    LOG(INFO) << "Options:";
+    LOG(INFO) << "  --all=FILE: FILE to acquire module names from";
+    LOG(INFO) << "  -b, --use-blocklist: Apply blocklist to module names too";
+    LOG(INFO) << "  -d, --dirname=DIR: Load modules from DIR, option may be used multiple times";
+    LOG(INFO) << "  -D, --show-depends: Print dependencies for modules only, do not load";
+    LOG(INFO) << "  -h, --help: Print this help";
+    LOG(INFO) << "  -l, --list: List modules matching pattern";
+    LOG(INFO) << "  -r, --remove: Remove MODULE (multiple modules may be specified)";
+    LOG(INFO) << "  -s, --syslog: print to syslog also";
+    LOG(INFO) << "  -q, --quiet: disable messages";
+    LOG(INFO) << "  -v, --verbose: enable more messages, even more with a second -v";
+    LOG(INFO);
 }
 
-#define check_mode()                                                      \
-    if (mode != AddModulesMode) {                                         \
-        std::cerr << "Error, multiple mode flags specified" << std::endl; \
-        print_usage();                                                    \
-        return EXIT_FAILURE;                                              \
+#define check_mode()                                   \
+    if (mode != AddModulesMode) {                      \
+        LOG(ERROR) << "multiple mode flags specified"; \
+        print_usage();                                 \
+        return EXIT_FAILURE;                           \
     }
 
+std::string stripComments(const std::string& str) {
+    for (std::string rv = str;;) {
+        auto comment = rv.find('#');
+        if (comment == std::string::npos) return rv;
+        auto end = rv.find('\n', comment);
+        if (end != std::string::npos) end = end - comment;
+        rv.erase(comment, end);
+    }
+    /* NOTREACHED */
+}
+
+auto syslog = false;
+
+void MyLogger(android::base::LogId id, android::base::LogSeverity severity, const char* tag,
+              const char* file, unsigned int line, const char* message) {
+    android::base::StdioLogger(id, severity, tag, file, line, message);
+    if (syslog && message[0]) {
+        android::base::KernelLogger(id, severity, tag, file, line, message);
+    }
+}
+
+}  // anonymous namespace
+
 extern "C" int modprobe_main(int argc, char** argv) {
+    android::base::InitLogging(argv, MyLogger);
+    android::base::SetMinimumLogSeverity(android::base::INFO);
+
     std::vector<std::string> modules;
     std::string module_parameters;
+    std::string mods;
     std::vector<std::string> mod_dirs;
     modprobe_mode mode = AddModulesMode;
     bool blocklist = false;
-    bool verbose = false;
     int rv = EXIT_SUCCESS;
 
     int opt;
-    while ((opt = getopt(argc, argv, "abd:Dhlqrv")) != -1) {
+    int option_index = 0;
+    // NB: We have non-standard short options -l and -D to make it easier for
+    // OEMs to transition from toybox.
+    // clang-format off
+    static struct option long_options[] = {
+        { "all",                 optional_argument, 0, 'a' },
+        { "use-blocklist",       no_argument,       0, 'b' },
+        { "dirname",             required_argument, 0, 'd' },
+        { "show-depends",        no_argument,       0, 'D' },
+        { "help",                no_argument,       0, 'h' },
+        { "list",                no_argument,       0, 'l' },
+        { "quiet",               no_argument,       0, 'q' },
+        { "remove",              no_argument,       0, 'r' },
+        { "syslog",              no_argument,       0, 's' },
+        { "verbose",             no_argument,       0, 'v' },
+    };
+    // clang-format on
+    while ((opt = getopt_long(argc, argv, "a::bd:Dhlqrsv", long_options, &option_index)) != -1) {
         switch (opt) {
             case 'a':
                 // toybox modprobe supported -a to load multiple modules, this
-                // is supported here by default, ignore flag
+                // is supported here by default, ignore flag if no argument.
                 check_mode();
+                if (optarg == NULL) break;
+                if (!android::base::ReadFileToString(optarg, &mods)) {
+                    PLOG(ERROR) << "Failed to open " << optarg;
+                    rv = EXIT_FAILURE;
+                }
+                for (auto mod : android::base::Split(stripComments(mods), "\n")) {
+                    mod = android::base::Trim(mod);
+                    if (mod == "") continue;
+                    if (std::find(modules.begin(), modules.end(), mod) != modules.end()) continue;
+                    modules.emplace_back(mod);
+                }
                 break;
             case 'b':
                 blocklist = true;
@@ -82,24 +144,33 @@
                 mode = ShowDependenciesMode;
                 break;
             case 'h':
+                android::base::SetMinimumLogSeverity(android::base::INFO);
                 print_usage();
-                return EXIT_SUCCESS;
+                return rv;
             case 'l':
                 check_mode();
                 mode = ListModulesMode;
                 break;
             case 'q':
-                verbose = false;
+                android::base::SetMinimumLogSeverity(android::base::WARNING);
                 break;
             case 'r':
                 check_mode();
                 mode = RemoveModulesMode;
                 break;
+            case 's':
+                syslog = true;
+                break;
             case 'v':
-                verbose = true;
+                if (android::base::GetMinimumLogSeverity() <= android::base::DEBUG) {
+                    android::base::SetMinimumLogSeverity(android::base::VERBOSE);
+                } else {
+                    android::base::SetMinimumLogSeverity(android::base::DEBUG);
+                }
                 break;
             default:
-                std::cerr << "Unrecognized option: " << opt << std::endl;
+                LOG(ERROR) << "Unrecognized option: " << opt;
+                print_usage();
                 return EXIT_FAILURE;
         }
     }
@@ -118,39 +189,33 @@
         }
     }
 
-    if (verbose) {
-        std::cout << "mode is " << mode << std::endl;
-        std::cout << "verbose is " << verbose << std::endl;
-        std::cout << "mod_dirs is: " << android::base::Join(mod_dirs, "") << std::endl;
-        std::cout << "modules is: " << android::base::Join(modules, "") << std::endl;
-        std::cout << "module parameters is: " << android::base::Join(module_parameters, "")
-                  << std::endl;
-    }
+    LOG(DEBUG) << "mode is " << mode;
+    LOG(DEBUG) << "mod_dirs is: " << android::base::Join(mod_dirs, " ");
+    LOG(DEBUG) << "modules is: " << android::base::Join(modules, " ");
+    LOG(DEBUG) << "module parameters is: " << android::base::Join(module_parameters, " ");
 
     if (modules.empty()) {
         if (mode == ListModulesMode) {
             // emulate toybox modprobe list with no pattern (list all)
             modules.emplace_back("*");
         } else {
-            std::cerr << "No modules given." << std::endl;
+            LOG(ERROR) << "No modules given.";
             print_usage();
             return EXIT_FAILURE;
         }
     }
     if (mod_dirs.empty()) {
-        std::cerr << "No module configuration directories given." << std::endl;
+        LOG(ERROR) << "No module configuration directories given.";
         print_usage();
         return EXIT_FAILURE;
     }
     if (parameter_count && modules.size() > 1) {
-        std::cerr << "Only one module may be loaded when specifying module parameters."
-                  << std::endl;
+        LOG(ERROR) << "Only one module may be loaded when specifying module parameters.";
         print_usage();
         return EXIT_FAILURE;
     }
 
     Modprobe m(mod_dirs);
-    m.EnableVerbose(verbose);
     if (blocklist) {
         m.EnableBlocklist(true);
     }
@@ -159,19 +224,19 @@
         switch (mode) {
             case AddModulesMode:
                 if (!m.LoadWithAliases(module, true, module_parameters)) {
-                    std::cerr << "Failed to load module " << module;
+                    PLOG(ERROR) << "Failed to load module " << module;
                     rv = EXIT_FAILURE;
                 }
                 break;
             case RemoveModulesMode:
                 if (!m.Remove(module)) {
-                    std::cerr << "Failed to remove module " << module;
+                    PLOG(ERROR) << "Failed to remove module " << module;
                     rv = EXIT_FAILURE;
                 }
                 break;
             case ListModulesMode: {
                 std::vector<std::string> list = m.ListModules(module);
-                std::cout << android::base::Join(list, "\n") << std::endl;
+                LOG(INFO) << android::base::Join(list, "\n");
                 break;
             }
             case ShowDependenciesMode: {
@@ -182,17 +247,17 @@
                     rv = EXIT_FAILURE;
                     break;
                 }
-                std::cout << "Dependencies for " << module << ":" << std::endl;
-                std::cout << "Soft pre-dependencies:" << std::endl;
-                std::cout << android::base::Join(pre_deps, "\n") << std::endl;
-                std::cout << "Hard dependencies:" << std::endl;
-                std::cout << android::base::Join(deps, "\n") << std::endl;
-                std::cout << "Soft post-dependencies:" << std::endl;
-                std::cout << android::base::Join(post_deps, "\n") << std::endl;
+                LOG(INFO) << "Dependencies for " << module << ":";
+                LOG(INFO) << "Soft pre-dependencies:";
+                LOG(INFO) << android::base::Join(pre_deps, "\n");
+                LOG(INFO) << "Hard dependencies:";
+                LOG(INFO) << android::base::Join(deps, "\n");
+                LOG(INFO) << "Soft post-dependencies:";
+                LOG(INFO) << android::base::Join(post_deps, "\n");
                 break;
             }
             default:
-                std::cerr << "Bad mode";
+                LOG(ERROR) << "Bad mode";
                 rv = EXIT_FAILURE;
         }
     }
diff --git a/toolbox/start.cpp b/toolbox/start.cpp
index cffb89c..46314cf 100644
--- a/toolbox/start.cpp
+++ b/toolbox/start.cpp
@@ -37,7 +37,6 @@
 
 static void ControlDefaultServices(bool start) {
     std::vector<std::string> services = {
-        "iorapd",
         "netd",
         "surfaceflinger",
         "audioserver",
@@ -92,4 +91,4 @@
 
 extern "C" int stop_main(int argc, char** argv) {
     return StartStop(argc, argv, false);
-}
\ No newline at end of file
+}
diff --git a/trusty/apploader/Android.bp b/trusty/apploader/Android.bp
new file mode 100644
index 0000000..7e97cb8
--- /dev/null
+++ b/trusty/apploader/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2020 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.
+//
+
+cc_binary {
+    name: "trusty_apploader",
+    vendor: true,
+
+    srcs: [
+        "apploader.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libc",
+        "liblog",
+        "libtrusty",
+        "libdmabufheap",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/trusty/apploader/apploader.cpp b/trusty/apploader/apploader.cpp
new file mode 100644
index 0000000..5d5d882
--- /dev/null
+++ b/trusty/apploader/apploader.cpp
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#define LOG_TAG "TrustyAppLoader"
+
+#include <BufferAllocator/BufferAllocator.h>
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/sendfile.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <trusty/tipc.h>
+#include <unistd.h>
+#include <algorithm>
+#include <string>
+
+#include "apploader_ipc.h"
+
+using android::base::unique_fd;
+using std::string;
+
+constexpr const char kTrustyDefaultDeviceName[] = "/dev/trusty-ipc-dev0";
+
+static const char* dev_name = kTrustyDefaultDeviceName;
+
+static const char* _sopts = "hs";
+static const struct option _lopts[] = {
+        {"help", no_argument, 0, 'h'},
+        {"dev", required_argument, 0, 'D'},
+        {0, 0, 0, 0},
+};
+
+static const char* usage =
+        "Usage: %s [options] package-file\n"
+        "\n"
+        "options:\n"
+        "  -h, --help            prints this message and exit\n"
+        "  -D, --dev name        Trusty device name\n"
+        "\n";
+
+static void print_usage_and_exit(const char* prog, int code) {
+    fprintf(stderr, usage, prog);
+    exit(code);
+}
+
+static void parse_options(int argc, char** argv) {
+    int c;
+    int oidx = 0;
+
+    while (1) {
+        c = getopt_long(argc, argv, _sopts, _lopts, &oidx);
+        if (c == -1) {
+            break; /* done */
+        }
+
+        switch (c) {
+            case 'h':
+                print_usage_and_exit(argv[0], EXIT_SUCCESS);
+                break;
+
+            case 'D':
+                dev_name = strdup(optarg);
+                break;
+
+            default:
+                print_usage_and_exit(argv[0], EXIT_FAILURE);
+        }
+    }
+}
+
+static unique_fd read_file(const char* file_name, off64_t* out_file_size) {
+    int rc;
+    long page_size = sysconf(_SC_PAGESIZE);
+    off64_t file_size, file_page_offset, file_page_size;
+    struct stat64 st;
+
+    unique_fd file_fd(TEMP_FAILURE_RETRY(open(file_name, O_RDONLY)));
+    if (!file_fd.ok()) {
+        fprintf(stderr, "Error opening file '%s': %s\n", file_name, strerror(errno));
+        return {};
+    }
+
+    rc = fstat64(file_fd, &st);
+    if (rc < 0) {
+        fprintf(stderr, "Error calling stat on file '%s': %s\n", file_name, strerror(errno));
+        return {};
+    }
+
+    assert(st.st_size >= 0);
+    file_size = st.st_size;
+
+    /* The dmabuf size needs to be a multiple of the page size */
+    file_page_offset = file_size & (page_size - 1);
+    if (file_page_offset) {
+        file_page_offset = page_size - file_page_offset;
+    }
+    if (__builtin_add_overflow(file_size, file_page_offset, &file_page_size)) {
+        fprintf(stderr, "Failed to page-align file size\n");
+        return {};
+    }
+
+    BufferAllocator alloc;
+    unique_fd dmabuf_fd(alloc.Alloc(kDmabufSystemHeapName, file_page_size));
+    if (!dmabuf_fd.ok()) {
+        fprintf(stderr, "Error creating dmabuf: %d\n", dmabuf_fd.get());
+        return dmabuf_fd;
+    }
+
+    void* shm = mmap(0, file_page_size, PROT_READ | PROT_WRITE, MAP_SHARED, dmabuf_fd, 0);
+    if (shm == MAP_FAILED) {
+        return {};
+    }
+
+    off64_t file_offset = 0;
+    while (file_offset < file_size) {
+        ssize_t num_read = TEMP_FAILURE_RETRY(
+                pread(file_fd, (char*)shm + file_offset, file_size - file_offset, file_offset));
+
+        if (num_read < 0) {
+            fprintf(stderr, "Error reading package file '%s': %s\n", file_name, strerror(errno));
+            break;
+        }
+
+        if (num_read == 0) {
+            fprintf(stderr, "Unexpected end of file '%s'\n", file_name);
+            break;
+        }
+
+        file_offset += (off64_t)num_read;
+    }
+
+    munmap(shm, file_page_size);
+
+    if (file_offset < file_size) {
+        return {};
+    }
+
+    assert(file_offset == file_size);
+    if (out_file_size) {
+        *out_file_size = file_size;
+    }
+
+    return dmabuf_fd;
+}
+
+static ssize_t send_load_message(int tipc_fd, int package_fd, off64_t package_size) {
+    struct apploader_header hdr = {
+            .cmd = APPLOADER_CMD_LOAD_APPLICATION,
+    };
+    struct apploader_load_app_req req = {
+            .package_size = static_cast<uint64_t>(package_size),
+    };
+    struct iovec tx[2] = {{&hdr, sizeof(hdr)}, {&req, sizeof(req)}};
+    struct trusty_shm shm = {
+            .fd = package_fd,
+            .transfer = TRUSTY_SHARE,
+    };
+    return tipc_send(tipc_fd, tx, 2, &shm, 1);
+}
+
+static ssize_t read_response(int tipc_fd) {
+    struct apploader_resp resp;
+    ssize_t rc = read(tipc_fd, &resp, sizeof(resp));
+    if (rc < 0) {
+        fprintf(stderr, "Failed to read response: %zd\n", rc);
+        return rc;
+    }
+
+    if (rc < sizeof(resp)) {
+        fprintf(stderr, "Not enough data in response: %zd\n", rc);
+        return -EIO;
+    }
+
+    if (resp.hdr.cmd != (APPLOADER_CMD_LOAD_APPLICATION | APPLOADER_RESP_BIT)) {
+        fprintf(stderr, "Invalid command in response: %u\n", resp.hdr.cmd);
+        return -EINVAL;
+    }
+
+    switch (resp.error) {
+        case APPLOADER_NO_ERROR:
+            break;
+        case APPLOADER_ERR_UNKNOWN_CMD:
+            fprintf(stderr, "Error: unknown command\n");
+            break;
+        case APPLOADER_ERR_INVALID_CMD:
+            fprintf(stderr, "Error: invalid command arguments\n");
+            break;
+        case APPLOADER_ERR_NO_MEMORY:
+            fprintf(stderr, "Error: out of Trusty memory\n");
+            break;
+        case APPLOADER_ERR_VERIFICATION_FAILED:
+            fprintf(stderr, "Error: failed to verify the package\n");
+            break;
+        case APPLOADER_ERR_LOADING_FAILED:
+            fprintf(stderr, "Error: failed to load the package\n");
+            break;
+        case APPLOADER_ERR_ALREADY_EXISTS:
+            fprintf(stderr, "Error: application already exists\n");
+            break;
+        case APPLOADER_ERR_INTERNAL:
+            fprintf(stderr, "Error: internal apploader error\n");
+            break;
+        default:
+            fprintf(stderr, "Unrecognized error: %u\n", resp.error);
+            break;
+    }
+
+    return static_cast<ssize_t>(resp.error);
+}
+
+static ssize_t send_app_package(const char* package_file_name) {
+    ssize_t rc = 0;
+    int tipc_fd = -1;
+    off64_t package_size;
+
+    unique_fd package_fd = read_file(package_file_name, &package_size);
+    if (!package_fd.ok()) {
+        rc = -1;
+        goto err_read_file;
+    }
+
+    tipc_fd = tipc_connect(dev_name, APPLOADER_PORT);
+    if (tipc_fd < 0) {
+        fprintf(stderr, "Failed to connect to Trusty app loader: %s\n", strerror(-tipc_fd));
+        rc = tipc_fd;
+        goto err_tipc_connect;
+    }
+
+    rc = send_load_message(tipc_fd, package_fd, package_size);
+    if (rc < 0) {
+        fprintf(stderr, "Failed to send package: %zd\n", rc);
+        goto err_send;
+    }
+
+    rc = read_response(tipc_fd);
+
+err_send:
+    tipc_close(tipc_fd);
+err_tipc_connect:
+err_read_file:
+    return rc;
+}
+
+int main(int argc, char** argv) {
+    parse_options(argc, argv);
+    if (optind + 1 != argc) {
+        print_usage_and_exit(argv[0], EXIT_FAILURE);
+    }
+
+    int rc = send_app_package(argv[optind]);
+    return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/trusty/apploader/apploader_ipc.h b/trusty/apploader/apploader_ipc.h
new file mode 100644
index 0000000..d8c915e
--- /dev/null
+++ b/trusty/apploader/apploader_ipc.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+#define APPLOADER_PORT "com.android.trusty.apploader"
+
+enum apploader_command : uint32_t {
+    APPLOADER_REQ_SHIFT = 1,
+    APPLOADER_RESP_BIT = 1,
+
+    APPLOADER_CMD_LOAD_APPLICATION = (0 << APPLOADER_REQ_SHIFT),
+    APPLOADER_CMD_GET_VERSION = (1 << APPLOADER_REQ_SHIFT),
+    APPLOADER_CMD_UNLOAD_APPLICATION = (2 << APPLOADER_REQ_SHIFT),
+};
+
+/**
+ * enum apploader_error - error codes for apploader
+ * @APPLOADER_NO_ERROR:                 no error
+ * @APPLOADER_ERR_UNKNOWN_CMD:          unknown or not implemented command
+ * @APPLOADER_ERR_INVALID_CMD:          invalid arguments or inputs passed to
+ *                                      command
+ * @APPLOADER_ERR_NO_MEMORY:            failed to allocate memory
+ * @APPLOADER_ERR_VERIFICATION_FAILED:  failed to verify input application
+ *                                      package for any reason, e.g., signature
+ *                                      verification failed
+ * @APPLOADER_ERR_LOADING_FAILED:       Trusty kernel or apploader service
+ *                                      failed to load application
+ * @APPLOADER_ERR_ALREADY_EXISTS:       application has already been loaded
+ * @APPLOADER_ERR_INTERNAL:             miscellaneous or internal apploader
+ *                                      error not covered by the above
+ */
+enum apploader_error : uint32_t {
+    APPLOADER_NO_ERROR = 0,
+    APPLOADER_ERR_UNKNOWN_CMD,
+    APPLOADER_ERR_INVALID_CMD,
+    APPLOADER_ERR_NO_MEMORY,
+    APPLOADER_ERR_VERIFICATION_FAILED,
+    APPLOADER_ERR_LOADING_FAILED,
+    APPLOADER_ERR_ALREADY_EXISTS,
+    APPLOADER_ERR_INTERNAL,
+};
+
+/**
+ * apploader_header - Serial header for communicating with apploader
+ * @cmd: the command; one of &enum apploader_command values.
+ */
+struct apploader_header {
+    uint32_t cmd;
+} __packed;
+
+/**
+ * apploader_load_app_req - Serial arguments for LOAD_APPLICATION command
+ * @package_size: size of the application package.
+ *
+ * Load an application from a given memory region. The request message also
+ * contains a handle for a memfd that contains the application package.
+ *
+ * The response is a &struct apploader_resp with the error code or
+ * %APPLOADER_NO_ERROR on success.
+ */
+struct apploader_load_app_req {
+    uint64_t package_size;
+} __packed;
+
+/**
+ * apploader_resp - Common header for all apploader responses
+ * @hdr - header with command value.
+ * @error - error code returned by peer; one of &enum apploader_error values.
+ *
+ * This structure is followed by the response-specific payload, if the command
+ * has one.
+ */
+struct apploader_resp {
+    struct apploader_header hdr;
+    uint32_t error;
+} __packed;
diff --git a/trusty/confirmationui/NotSoSecureInput.cpp b/trusty/confirmationui/NotSoSecureInput.cpp
index 3d9a2d6..18e45cd 100644
--- a/trusty/confirmationui/NotSoSecureInput.cpp
+++ b/trusty/confirmationui/NotSoSecureInput.cpp
@@ -82,7 +82,7 @@
 
 /**
  * This is an implementation of the SecureInput protocol in unserspace. This is
- * just an example and should not be used as is. The protocol implemented her
+ * just an example and should not be used as is. The protocol implemented here
  * should be used by a trusted input device that can assert user events with
  * high assurance even if the HLOS kernel is compromised. A confirmationui HAL
  * that links directly against this implementation is not secure and shal not be
diff --git a/trusty/confirmationui/fuzz/Android.bp b/trusty/confirmationui/fuzz/Android.bp
new file mode 100644
index 0000000..635966f
--- /dev/null
+++ b/trusty/confirmationui/fuzz/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2020 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.
+
+cc_fuzz {
+    name: "trusty_confirmationui_fuzzer",
+    defaults: ["trusty_fuzzer_defaults"],
+    srcs: ["fuzz.cpp"],
+
+    // The initial corpus for this fuzzer was derived by dumping bytes from
+    // ConfirmationUI VTS.
+    corpus: ["corpus/*"],
+}
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-2ekYc2 b/trusty/confirmationui/fuzz/corpus/confirmationui-2ekYc2
new file mode 100644
index 0000000..53fe0c9
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-2ekYc2
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-5yTG3f b/trusty/confirmationui/fuzz/corpus/confirmationui-5yTG3f
new file mode 100644
index 0000000..d627b01
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-5yTG3f
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-6l8Soq b/trusty/confirmationui/fuzz/corpus/confirmationui-6l8Soq
new file mode 100644
index 0000000..bda80fd
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-6l8Soq
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-7kFpGO b/trusty/confirmationui/fuzz/corpus/confirmationui-7kFpGO
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-7kFpGO
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-92m2f3 b/trusty/confirmationui/fuzz/corpus/confirmationui-92m2f3
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-92m2f3
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-ALYIzO b/trusty/confirmationui/fuzz/corpus/confirmationui-ALYIzO
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-ALYIzO
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-AcIMhR b/trusty/confirmationui/fuzz/corpus/confirmationui-AcIMhR
new file mode 100644
index 0000000..f5854f8
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-AcIMhR
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-AieaIi b/trusty/confirmationui/fuzz/corpus/confirmationui-AieaIi
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-AieaIi
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-BdqX5j b/trusty/confirmationui/fuzz/corpus/confirmationui-BdqX5j
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-BdqX5j
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-JBPIGs b/trusty/confirmationui/fuzz/corpus/confirmationui-JBPIGs
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-JBPIGs
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-MWHw4T b/trusty/confirmationui/fuzz/corpus/confirmationui-MWHw4T
new file mode 100644
index 0000000..0dc6e91
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-MWHw4T
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-TZzVLO b/trusty/confirmationui/fuzz/corpus/confirmationui-TZzVLO
new file mode 100644
index 0000000..927d64d
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-TZzVLO
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-WwdA3B b/trusty/confirmationui/fuzz/corpus/confirmationui-WwdA3B
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-WwdA3B
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-globJV b/trusty/confirmationui/fuzz/corpus/confirmationui-globJV
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-globJV
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-hzUgjD b/trusty/confirmationui/fuzz/corpus/confirmationui-hzUgjD
new file mode 100644
index 0000000..87870ca
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-hzUgjD
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-jXC78o b/trusty/confirmationui/fuzz/corpus/confirmationui-jXC78o
new file mode 100644
index 0000000..0b274bf
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-jXC78o
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-kykxni b/trusty/confirmationui/fuzz/corpus/confirmationui-kykxni
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-kykxni
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-npHe8t b/trusty/confirmationui/fuzz/corpus/confirmationui-npHe8t
new file mode 100644
index 0000000..87870ca
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-npHe8t
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-rPgnyI b/trusty/confirmationui/fuzz/corpus/confirmationui-rPgnyI
new file mode 100644
index 0000000..87870ca
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-rPgnyI
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-uCJ1Me b/trusty/confirmationui/fuzz/corpus/confirmationui-uCJ1Me
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-uCJ1Me
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-wAQEjK b/trusty/confirmationui/fuzz/corpus/confirmationui-wAQEjK
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-wAQEjK
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-xjtOks b/trusty/confirmationui/fuzz/corpus/confirmationui-xjtOks
new file mode 100644
index 0000000..b4a1c49
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-xjtOks
Binary files differ
diff --git a/trusty/confirmationui/fuzz/corpus/confirmationui-zKFIjN b/trusty/confirmationui/fuzz/corpus/confirmationui-zKFIjN
new file mode 100644
index 0000000..5adf905
--- /dev/null
+++ b/trusty/confirmationui/fuzz/corpus/confirmationui-zKFIjN
Binary files differ
diff --git a/trusty/confirmationui/fuzz/fuzz.cpp b/trusty/confirmationui/fuzz/fuzz.cpp
new file mode 100644
index 0000000..df2517c
--- /dev/null
+++ b/trusty/confirmationui/fuzz/fuzz.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/fuzz/counters.h>
+#include <trusty/fuzz/utils.h>
+#include <unistd.h>
+
+using android::trusty::coverage::CoverageRecord;
+using android::trusty::fuzz::ExtraCounters;
+using android::trusty::fuzz::TrustyApp;
+
+#define TIPC_DEV "/dev/trusty-ipc-dev0"
+#define CONFIRMATIONUI_PORT "com.android.trusty.confirmationui"
+#define CONFIRMATIONUI_MODULE_NAME "confirmationui.syms.elf"
+
+/* ConfirmationUI TA's UUID is 7dee2364-c036-425b-b086-df0f6c233c1b */
+static struct uuid confirmationui_uuid = {
+    0x7dee2364,
+    0xc036,
+    0x425b,
+    {0xb0, 0x86, 0xdf, 0x0f, 0x6c, 0x23, 0x3c, 0x1b},
+};
+
+/* The format of the packets is as following:
+ * 16 bits (uint16_t, header) + payload bytes
+ * The 16 bits header spicify the number of bytes of payload (header excluded).
+ */
+struct data_packet {
+    uint16_t header;
+    uint8_t payload[];
+};
+
+static CoverageRecord record(TIPC_DEV, &confirmationui_uuid, CONFIRMATIONUI_MODULE_NAME);
+
+extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
+    auto ret = record.Open();
+    if (!ret.ok()) {
+        std::cerr << ret.error() << std::endl;
+        exit(-1);
+    }
+    return 0;
+}
+
+/* Each corpus contains one or more data packets. */
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    static uint8_t buf[TIPC_MAX_MSG_SIZE];
+    size_t data_idx = 0;
+
+    ExtraCounters counters(&record);
+    counters.Reset();
+
+    TrustyApp ta(TIPC_DEV, CONFIRMATIONUI_PORT);
+    auto ret = ta.Connect();
+    if (!ret.ok()) {
+        android::trusty::fuzz::Abort();
+    }
+
+    while (data_idx < size) {
+        struct data_packet* data_packet_ptr = (struct data_packet*)&data[data_idx];
+        size_t payload_size = data_packet_ptr->header;
+        data_idx += data_packet_ptr->header + sizeof(data_packet_ptr->header);
+
+        /* Write message to confirmationui server */
+        ret = ta.Write(data_packet_ptr->payload, payload_size);
+        if (!ret.ok()) {
+            return -1;
+        }
+
+        /* Read message from confirmationui server */
+        ret = ta.Read(&buf, sizeof(buf));
+        if (!ret.ok()) {
+            return -1;
+        }
+    }
+
+    return 0;
+}
diff --git a/trusty/coverage/Android.bp b/trusty/coverage/Android.bp
new file mode 100644
index 0000000..daa6f03
--- /dev/null
+++ b/trusty/coverage/Android.bp
@@ -0,0 +1,50 @@
+// Copyright (C) 2020 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.
+
+cc_library {
+    name: "libtrusty_coverage",
+    vendor_available: true,
+    srcs: [
+        "coverage.cpp",
+    ],
+    export_include_dirs: [
+        "include",
+    ],
+    static_libs: [
+        "libtrusty",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libdmabufheap",
+    ],
+}
+
+cc_test {
+    name: "libtrusty_coverage_test",
+    srcs: [
+        "coverage_test.cpp",
+    ],
+    static_libs: [
+        "libtrusty_coverage",
+        "libtrusty",
+    ],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libdmabufheap",
+    ],
+    require_root: true,
+}
diff --git a/trusty/coverage/coverage.cpp b/trusty/coverage/coverage.cpp
new file mode 100644
index 0000000..5eccdc5
--- /dev/null
+++ b/trusty/coverage/coverage.cpp
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2020 The Android Open Sourete 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.
+ */
+
+#define LOG_TAG "coverage"
+
+#include <BufferAllocator/BufferAllocator.h>
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include <assert.h>
+#include <log/log.h>
+#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/uio.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/coverage/record.h>
+#include <trusty/coverage/tipc.h>
+#include <trusty/tipc.h>
+
+#define COVERAGE_CLIENT_PORT "com.android.trusty.coverage.client"
+
+namespace android {
+namespace trusty {
+namespace coverage {
+
+using android::base::ErrnoError;
+using android::base::Error;
+using std::string;
+using std::to_string;
+using std::unique_ptr;
+
+static inline uintptr_t RoundPageUp(uintptr_t val) {
+    return (val + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+}
+
+CoverageRecord::CoverageRecord(string tipc_dev, struct uuid* uuid)
+    : tipc_dev_(std::move(tipc_dev)),
+      coverage_srv_fd_(-1),
+      uuid_(*uuid),
+      sancov_filename_(),
+      record_len_(0),
+      shm_(NULL),
+      shm_len_(0) {}
+
+CoverageRecord::CoverageRecord(string tipc_dev, struct uuid* uuid, string module_name)
+    : tipc_dev_(std::move(tipc_dev)),
+      coverage_srv_fd_(-1),
+      uuid_(*uuid),
+      sancov_filename_(module_name + "." + to_string(getpid()) + ".sancov"),
+      record_len_(0),
+      shm_(NULL),
+      shm_len_(0) {}
+
+CoverageRecord::~CoverageRecord() {
+    if (shm_) {
+        if (sancov_filename_) {
+            auto res = SaveSancovFile(*sancov_filename_);
+            if (!res.ok()) {
+                ALOGE("Could not write sancov file for module: %s\n", sancov_filename_->c_str());
+            }
+        }
+
+        munmap((void*)shm_, shm_len_);
+    }
+}
+
+Result<void> CoverageRecord::Rpc(coverage_client_req* req, int req_fd, coverage_client_resp* resp) {
+    int rc;
+
+    if (req_fd < 0) {
+        rc = write(coverage_srv_fd_, req, sizeof(*req));
+    } else {
+        iovec iov = {
+                .iov_base = req,
+                .iov_len = sizeof(*req),
+        };
+
+        trusty_shm shm = {
+                .fd = req_fd,
+                .transfer = TRUSTY_SHARE,
+        };
+
+        rc = tipc_send(coverage_srv_fd_, &iov, 1, &shm, 1);
+    }
+
+    if (rc != (int)sizeof(*req)) {
+        return ErrnoError() << "failed to send request to coverage server: ";
+    }
+
+    rc = read(coverage_srv_fd_, resp, sizeof(*resp));
+    if (rc != (int)sizeof(*resp)) {
+        return ErrnoError() << "failed to read reply from coverage server: ";
+    }
+
+    if (resp->hdr.cmd != (req->hdr.cmd | COVERAGE_CLIENT_CMD_RESP_BIT)) {
+        return ErrnoError() << "unknown response cmd: " << resp->hdr.cmd;
+    }
+
+    return {};
+}
+
+Result<void> CoverageRecord::Open() {
+    coverage_client_req req;
+    coverage_client_resp resp;
+
+    if (shm_) {
+        return {}; /* already initialized */
+    }
+
+    int fd = tipc_connect(tipc_dev_.c_str(), COVERAGE_CLIENT_PORT);
+    if (fd < 0) {
+        return ErrnoError() << "failed to connect to Trusty coverarge server: ";
+    }
+    coverage_srv_fd_.reset(fd);
+
+    req.hdr.cmd = COVERAGE_CLIENT_CMD_OPEN;
+    req.open_args.uuid = uuid_;
+    auto ret = Rpc(&req, -1, &resp);
+    if (!ret.ok()) {
+        return Error() << "failed to open coverage client: ";
+    }
+    record_len_ = resp.open_args.record_len;
+    shm_len_ = RoundPageUp(record_len_);
+
+    BufferAllocator allocator;
+
+    fd = allocator.Alloc("system", shm_len_);
+    if (fd < 0) {
+        return ErrnoError() << "failed to create dmabuf of size " << shm_len_
+                            << " err code: " << fd;
+    }
+    unique_fd dma_buf(fd);
+
+    void* shm = mmap(0, shm_len_, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf, 0);
+    if (shm == MAP_FAILED) {
+        return ErrnoError() << "failed to map memfd: ";
+    }
+
+    req.hdr.cmd = COVERAGE_CLIENT_CMD_SHARE_RECORD;
+    req.share_record_args.shm_len = shm_len_;
+    ret = Rpc(&req, dma_buf, &resp);
+    if (!ret.ok()) {
+        return Error() << "failed to send shared memory: ";
+    }
+
+    shm_ = shm;
+    return {};
+}
+
+void CoverageRecord::ResetFullRecord() {
+    auto header_region = GetRegionBounds(COV_START);
+    if (!header_region.ok()) {
+        // If the header cannot be parsed, we can't reset the proper region yet.
+        return;
+    }
+
+    for (size_t i = header_region->second; i < shm_len_; i++) {
+        *((volatile uint8_t*)shm_ + i) = 0;
+    }
+}
+
+void CoverageRecord::ResetCounts() {
+    volatile uint8_t* begin = nullptr;
+    volatile uint8_t* end = nullptr;
+    GetRawCounts(&begin, &end);
+
+    for (volatile uint8_t* x = begin; x < end; x++) {
+        *x = 0;
+    }
+}
+
+void CoverageRecord::ResetPCs() {
+    volatile uintptr_t* begin = nullptr;
+    volatile uintptr_t* end = nullptr;
+    GetRawPCs(&begin, &end);
+
+    for (volatile uintptr_t* x = begin; x < end; x++) {
+        *x = 0;
+    }
+}
+
+Result<std::pair<size_t, size_t>> CoverageRecord::GetRegionBounds(uint32_t region_type) {
+    assert(shm_);
+
+    auto header = (volatile struct coverage_record_header*)shm_;
+
+    if (header->type != COV_START) {
+        return Error() << "Header not yet valid";
+    }
+
+    for (++header; header->type != COV_TOTAL_LENGTH; ++header) {
+        if (header->type == region_type) {
+            // Coverage record must end with a COV_TOTAL_LENGTH header entry, so
+            // it is always safe to read the next entry since we don't iterate
+            // over the COV_TOTAL_LENGTH entry.
+            return {{header->offset, (header + 1)->offset}};
+        }
+    }
+
+    return Error() << "Could not find coverage region type: " << region_type;
+}
+
+void CoverageRecord::GetRawData(volatile void** begin, volatile void** end) {
+    assert(shm_);
+
+    *begin = shm_;
+    *end = (uint8_t*)(*begin) + record_len_;
+}
+
+void CoverageRecord::GetRawCounts(volatile uint8_t** begin, volatile uint8_t** end) {
+    auto region = GetRegionBounds(COV_8BIT_COUNTERS);
+    if (!region.ok()) {
+        *begin = 0;
+        *end = 0;
+        return;
+    }
+
+    assert(region->second <= record_len_);
+
+    *begin = (volatile uint8_t*)shm_ + region->first;
+    *end = (volatile uint8_t*)shm_ + region->second;
+}
+
+void CoverageRecord::GetRawPCs(volatile uintptr_t** begin, volatile uintptr_t** end) {
+    auto region = GetRegionBounds(COV_INSTR_PCS);
+    if (!region.ok()) {
+        *begin = 0;
+        *end = 0;
+        return;
+    }
+
+    assert(region->second <= record_len_);
+
+    *begin = (volatile uintptr_t*)((volatile uint8_t*)shm_ + region->first);
+    *end = (volatile uintptr_t*)((volatile uint8_t*)shm_ + region->second);
+}
+
+uint64_t CoverageRecord::TotalEdgeCounts() {
+    assert(shm_);
+
+    uint64_t counter = 0;
+
+    volatile uint8_t* begin = NULL;
+    volatile uint8_t* end = NULL;
+
+    GetRawCounts(&begin, &end);
+
+    for (volatile uint8_t* x = begin; x < end; x++) {
+        counter += *x;
+    }
+
+    return counter;
+}
+
+Result<void> CoverageRecord::SaveSancovFile(const std::string& filename) {
+    android::base::unique_fd output_fd(TEMP_FAILURE_RETRY(creat(filename.c_str(), 00644)));
+    if (!output_fd.ok()) {
+        return ErrnoError() << "Could not open sancov file";
+    }
+
+    uint64_t magic;
+    if (sizeof(uintptr_t) == 8) {
+        magic = 0xC0BFFFFFFFFFFF64;
+    } else if (sizeof(uintptr_t) == 4) {
+        magic = 0xC0BFFFFFFFFFFF32;
+    }
+    WriteFully(output_fd, &magic, sizeof(magic));
+
+    volatile uintptr_t* begin = nullptr;
+    volatile uintptr_t* end = nullptr;
+
+    GetRawPCs(&begin, &end);
+
+    for (volatile uintptr_t* pc_ptr = begin; pc_ptr < end; pc_ptr++) {
+        uintptr_t pc = *pc_ptr;
+        if (pc) {
+            WriteFully(output_fd, &pc, sizeof(pc));
+        }
+    }
+
+    return {};
+}
+
+}  // namespace coverage
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/coverage/coverage_test.cpp b/trusty/coverage/coverage_test.cpp
new file mode 100644
index 0000000..c1efca6
--- /dev/null
+++ b/trusty/coverage/coverage_test.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <android-base/stringprintf.h>
+#include <gtest/gtest.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/tipc.h>
+#include <array>
+#include <memory>
+
+using android::base::unique_fd;
+using std::array;
+using std::make_unique;
+using std::unique_ptr;
+
+#define TIPC_DEV "/dev/trusty-ipc-dev0"
+#define TEST_SRV_PORT "com.android.trusty.sancov.test.srv"
+#define TEST_SRV_MODULE "srv.syms.elf"
+
+namespace android {
+namespace trusty {
+namespace coverage {
+
+/* Test server's UUID is 77f68803-c514-43ba-bdce-3254531c3d24 */
+static struct uuid test_srv_uuid = {
+        0x77f68803,
+        0xc514,
+        0x43ba,
+        {0xbd, 0xce, 0x32, 0x54, 0x53, 0x1c, 0x3d, 0x24},
+};
+
+class CoverageTest : public ::testing::Test {
+  public:
+    void SetUp() override {
+        record_ = make_unique<CoverageRecord>(TIPC_DEV, &test_srv_uuid);
+        auto ret = record_->Open();
+        ASSERT_TRUE(ret.ok()) << ret.error();
+    }
+
+    void TearDown() override { record_.reset(); }
+
+    unique_ptr<CoverageRecord> record_;
+};
+
+TEST_F(CoverageTest, CoverageReset) {
+    record_->ResetFullRecord();
+    auto counter = record_->TotalEdgeCounts();
+    ASSERT_EQ(counter, 0);
+}
+
+TEST_F(CoverageTest, TestServerCoverage) {
+    unique_fd test_srv(tipc_connect(TIPC_DEV, TEST_SRV_PORT));
+    ASSERT_GE(test_srv, 0);
+
+    uint32_t mask = (uint32_t)-1;
+    uint32_t magic = 0xdeadbeef;
+    uint64_t high_watermark = 0;
+
+    for (size_t i = 1; i < sizeof(magic) * 8; i++) {
+        /* Reset coverage */
+        record_->ResetCounts();
+
+        /* Send message to test server */
+        uint32_t msg = magic & ~(mask << i);
+        int rc = write(test_srv, &msg, sizeof(msg));
+        ASSERT_EQ(rc, sizeof(msg));
+
+        /* Read message from test server */
+        rc = read(test_srv, &msg, sizeof(msg));
+        ASSERT_EQ(rc, sizeof(msg));
+
+        /* Count number of non-unique blocks executed */
+        auto counter = record_->TotalEdgeCounts();
+        /* Each consecutive input should exercise more or same blocks */
+        ASSERT_GE(counter, high_watermark);
+        high_watermark = counter;
+
+        auto sancov_filename = android::base::StringPrintf(
+                "/data/local/tmp/" TEST_SRV_MODULE ".%d.sancov", getpid());
+        auto res = record_->SaveSancovFile(sancov_filename);
+        ASSERT_TRUE(res.ok());
+    }
+
+    ASSERT_GT(high_watermark, 0);
+}
+
+}  // namespace coverage
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/coverage/include/trusty/coverage/coverage.h b/trusty/coverage/include/trusty/coverage/coverage.h
new file mode 100644
index 0000000..5da68da
--- /dev/null
+++ b/trusty/coverage/include/trusty/coverage/coverage.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <optional>
+#include <string>
+
+#include <android-base/result.h>
+#include <android-base/unique_fd.h>
+#include <stdint.h>
+#include <trusty/coverage/tipc.h>
+
+namespace android {
+namespace trusty {
+namespace coverage {
+
+using android::base::Result;
+using android::base::unique_fd;
+
+class CoverageRecord {
+  public:
+    /**
+     * Create a coverage record interface. Coverage will not be written to a
+     * sancov output file on completion.
+     */
+    CoverageRecord(std::string tipc_dev, struct uuid* uuid);
+
+    /**
+     * Create a coverage record interface. On destruction, write this coverage
+     * to the given sancov filename.
+     */
+    CoverageRecord(std::string tipc_dev, struct uuid* uuid, std::string module_name);
+
+    ~CoverageRecord();
+    Result<void> Open();
+    void ResetFullRecord();
+    void ResetCounts();
+    void ResetPCs();
+    void GetRawData(volatile void** begin, volatile void** end);
+    void GetRawCounts(volatile uint8_t** begin, volatile uint8_t** end);
+    void GetRawPCs(volatile uintptr_t** begin, volatile uintptr_t** end);
+    uint64_t TotalEdgeCounts();
+
+    /**
+     * Save the current set of observed PCs to the given filename.
+     * The resulting .sancov file can be parsed via the LLVM sancov tool to see
+     * coverage statistics and visualize coverage.
+     */
+    Result<void> SaveSancovFile(const std::string& filename);
+
+  private:
+    Result<void> Rpc(coverage_client_req* req, int req_fd, coverage_client_resp* resp);
+
+    Result<std::pair<size_t, size_t>> GetRegionBounds(uint32_t region_type);
+
+    std::string tipc_dev_;
+    unique_fd coverage_srv_fd_;
+    struct uuid uuid_;
+    std::optional<std::string> sancov_filename_;
+    size_t record_len_;
+    volatile void* shm_;
+    size_t shm_len_;
+};
+
+}  // namespace coverage
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/coverage/include/trusty/coverage/record.h b/trusty/coverage/include/trusty/coverage/record.h
new file mode 100644
index 0000000..bfe06f3
--- /dev/null
+++ b/trusty/coverage/include/trusty/coverage/record.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+/* This file needs to be kept in-sync with its counterpart on Trusty side:
+ * trusty/user/base/lib/coverage/common/include/lib/coverage/common/record.h */
+
+#pragma once
+
+#include <stdint.h>
+
+/**
+ * enum coverage_record_type - Coverage region header type
+ * @COV_START: Magic header start marker
+ * @COV_8BIT_COUNTERS: 8bit counter for each instrumentation point
+ * @COV_INSTR_PCS: Pointer length offset of each instrumentation point from the
+ *                 start of the binary
+ * @COV_TOTAL_LENGTH: Total length of the entire coverage record, must be the
+ *                    last header item.
+ *
+ * Describes the type of a region of the coverage record. See &struct
+ * coverage_record_header.
+ */
+enum coverage_record_type {
+    COV_START = 0x434f5652,
+    COV_8BIT_COUNTERS = 1,
+    COV_INSTR_PCS = 2,
+    COV_TOTAL_LENGTH = 0,
+};
+
+/**
+ * struct coverage_record_header - Header entry describing a region of the
+ * coverage record.
+ * @type: type of the region, must be one of @enum coverage_record_type
+ * @offset: offset from the beginning of the header to the start of the region
+ *
+ * Coverage records start with a header which is a list of struct
+ * coverage_record_header, beginning with an entry with type COV_START and
+ * terminated with an entry with type COV_TOTAL_LENGTH. Each of these header
+ * entries corresponds to a region of the record, with the offset indicating the
+ * offset of the start of that region from the beginning of the record (i.e. the
+ * beginning of the header). Each record type and offset is 32-bit field with
+ * native endianness. The first header item must be COV_START with a 0 offset.
+ * The COV_START entry should be initialized when the coverage header is
+ * complete and ready for consumption by the client, because coverage record
+ * initialization happens asynchronously. The final header item,
+ * COV_TOTAL_LENGTH, which must always be present, indicates the total length of
+ * the coverage record, including the header.
+ *
+ * Coverage regions should be contiguous, so the end of one region is the start
+ * of the next, and the coverage header must be in the same order as the regions
+ * in the record body. Thus we can compute the length of a region by subtracting
+ * the region's offset from the offset of the next header item.
+ */
+struct coverage_record_header {
+    uint32_t type;
+    uint32_t offset;
+};
diff --git a/trusty/coverage/include/trusty/coverage/tipc.h b/trusty/coverage/include/trusty/coverage/tipc.h
new file mode 100644
index 0000000..c4157c4
--- /dev/null
+++ b/trusty/coverage/include/trusty/coverage/tipc.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+/* This file needs to be kept in-sync with it's counterpart on Trusty side */
+
+#pragma once
+
+#include <stdint.h>
+
+#define COVERAGE_CLIENT_PORT "com.android.trusty.coverage.client"
+
+struct uuid {
+    uint32_t time_low;
+    uint16_t time_mid;
+    uint16_t time_hi_and_version;
+    uint8_t clock_seq_and_node[8];
+};
+
+enum coverage_client_cmd {
+    COVERAGE_CLIENT_CMD_RESP_BIT = 1U,
+    COVERAGE_CLIENT_CMD_SHIFT = 1U,
+    COVERAGE_CLIENT_CMD_OPEN = (1U << COVERAGE_CLIENT_CMD_SHIFT),
+    COVERAGE_CLIENT_CMD_SHARE_RECORD = (2U << COVERAGE_CLIENT_CMD_SHIFT),
+};
+
+struct coverage_client_hdr {
+    uint32_t cmd;
+};
+
+struct coverage_client_open_req {
+    struct uuid uuid;
+};
+
+struct coverage_client_open_resp {
+    uint32_t record_len;
+};
+
+struct coverage_client_share_record_req {
+    uint32_t shm_len;
+};
+
+struct coverage_client_req {
+    struct coverage_client_hdr hdr;
+    union {
+        struct coverage_client_open_req open_args;
+        struct coverage_client_share_record_req share_record_args;
+    };
+};
+
+struct coverage_client_resp {
+    struct coverage_client_hdr hdr;
+    union {
+        struct coverage_client_open_resp open_args;
+    };
+};
diff --git a/trusty/fuzz/Android.bp b/trusty/fuzz/Android.bp
new file mode 100644
index 0000000..ad13816
--- /dev/null
+++ b/trusty/fuzz/Android.bp
@@ -0,0 +1,49 @@
+// Copyright (C) 2020 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.
+
+cc_defaults {
+    name: "trusty_fuzzer_defaults",
+    shared_libs: [
+        "libtrusty_coverage",
+        "libtrusty_fuzz_utils",
+        "libbase",
+        "liblog",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    fuzz_config: {
+        fuzz_on_haiku_device: false,
+        fuzz_on_haiku_host: false,
+    },
+}
+
+cc_library {
+    name: "libtrusty_fuzz_utils",
+    srcs: [
+        "counters.cpp",
+        "utils.cpp",
+    ],
+    export_include_dirs: ["include"],
+    static_libs: [
+        "libFuzzer",
+        "libtrusty",
+    ],
+    shared_libs: [
+        "libtrusty_coverage",
+        "libbase",
+        "liblog",
+    ],
+}
diff --git a/trusty/fuzz/counters.cpp b/trusty/fuzz/counters.cpp
new file mode 100644
index 0000000..1e863ac
--- /dev/null
+++ b/trusty/fuzz/counters.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2020 The Android Open Sourete 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.
+ */
+
+#define LOG_TAG "trusty-fuzz-counters"
+
+#include <FuzzerDefs.h>
+
+#include <trusty/fuzz/counters.h>
+
+#include <android-base/logging.h>
+#include <log/log.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/coverage/tipc.h>
+
+using android::base::ErrnoError;
+using android::base::Error;
+using android::base::Result;
+
+/*
+ * We don't know how many counters the coverage record will contain. So, eyeball
+ * the size of this section.
+ */
+static const size_t kMaxNumCounters = 0x4000;
+__attribute__((section("__libfuzzer_extra_counters"))) volatile uint8_t counters[kMaxNumCounters];
+
+namespace android {
+namespace trusty {
+namespace fuzz {
+
+ExtraCounters::ExtraCounters(coverage::CoverageRecord* record) : record_(record) {
+    assert(fuzzer::ExtraCountersBegin());
+    assert(fuzzer::ExtraCountersEnd());
+
+    volatile uint8_t* begin = NULL;
+    volatile uint8_t* end = NULL;
+    record_->GetRawCounts(&begin, &end);
+    assert(end - begin <= sizeof(counters));
+}
+
+ExtraCounters::~ExtraCounters() {
+    Flush();
+}
+
+void ExtraCounters::Reset() {
+    record_->ResetCounts();
+    fuzzer::ClearExtraCounters();
+}
+
+void ExtraCounters::Flush() {
+    volatile uint8_t* begin = NULL;
+    volatile uint8_t* end = NULL;
+
+    record_->GetRawCounts(&begin, &end);
+    if (!begin || !end) {
+        ALOGE("Could not get raw counts from coverage record\n");
+        return;
+    }
+
+    size_t num_counters = end - begin;
+    if (num_counters > kMaxNumCounters) {
+        ALOGE("Too many counters (%zu) to fit in the extra counters section!\n", num_counters);
+        num_counters = kMaxNumCounters;
+    }
+    for (size_t i = 0; i < num_counters; i++) {
+        *(counters + i) = *(begin + i);
+    }
+}
+
+}  // namespace fuzz
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/fuzz/include/trusty/fuzz/counters.h b/trusty/fuzz/include/trusty/fuzz/counters.h
new file mode 100644
index 0000000..db933d9
--- /dev/null
+++ b/trusty/fuzz/include/trusty/fuzz/counters.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <string>
+
+#include <android-base/result.h>
+#include <trusty/coverage/coverage.h>
+
+namespace android {
+namespace trusty {
+namespace fuzz {
+
+class ExtraCounters {
+  public:
+    ExtraCounters(coverage::CoverageRecord* record);
+    ~ExtraCounters();
+
+    void Reset();
+    void Flush();
+
+  private:
+    coverage::CoverageRecord* record_;
+};
+
+}  // namespace fuzz
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/fuzz/include/trusty/fuzz/utils.h b/trusty/fuzz/include/trusty/fuzz/utils.h
new file mode 100644
index 0000000..bca84e9
--- /dev/null
+++ b/trusty/fuzz/include/trusty/fuzz/utils.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <string>
+
+#include <android-base/result.h>
+#include <android-base/unique_fd.h>
+
+#define TIPC_MAX_MSG_SIZE PAGE_SIZE
+
+namespace android {
+namespace trusty {
+namespace fuzz {
+
+class TrustyApp {
+  public:
+    TrustyApp(std::string tipc_dev, std::string ta_port);
+
+    android::base::Result<void> Connect();
+    android::base::Result<void> Read(void* buf, size_t len);
+    android::base::Result<void> Write(const void* buf, size_t len);
+
+    android::base::Result<int> GetRawFd();
+
+  private:
+    std::string tipc_dev_;
+    std::string ta_port_;
+    android::base::unique_fd ta_fd_;
+};
+
+void Abort();
+
+}  // namespace fuzz
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/fuzz/test/Android.bp b/trusty/fuzz/test/Android.bp
new file mode 100644
index 0000000..66e103d
--- /dev/null
+++ b/trusty/fuzz/test/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 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.
+
+cc_fuzz {
+    name: "trusty_test_fuzzer",
+    defaults: ["trusty_fuzzer_defaults"],
+    srcs: ["fuzz.cpp"],
+}
diff --git a/trusty/fuzz/test/fuzz.cpp b/trusty/fuzz/test/fuzz.cpp
new file mode 100644
index 0000000..e7913db
--- /dev/null
+++ b/trusty/fuzz/test/fuzz.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <stdlib.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/fuzz/counters.h>
+#include <trusty/fuzz/utils.h>
+#include <unistd.h>
+#include <iostream>
+
+using android::trusty::coverage::CoverageRecord;
+using android::trusty::fuzz::ExtraCounters;
+using android::trusty::fuzz::TrustyApp;
+
+#define TIPC_DEV "/dev/trusty-ipc-dev0"
+#define TEST_SRV_PORT "com.android.trusty.sancov.test.srv"
+
+/* Test server's UUID is 77f68803-c514-43ba-bdce-3254531c3d24 */
+static struct uuid test_srv_uuid = {
+        0x77f68803,
+        0xc514,
+        0x43ba,
+        {0xbd, 0xce, 0x32, 0x54, 0x53, 0x1c, 0x3d, 0x24},
+};
+
+static CoverageRecord record(TIPC_DEV, &test_srv_uuid);
+
+extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
+    auto ret = record.Open();
+    if (!ret.ok()) {
+        std::cerr << ret.error() << std::endl;
+        exit(-1);
+    }
+    return 0;
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    static uint8_t buf[TIPC_MAX_MSG_SIZE];
+
+    ExtraCounters counters(&record);
+    counters.Reset();
+
+    TrustyApp ta(TIPC_DEV, TEST_SRV_PORT);
+    auto ret = ta.Connect();
+    if (!ret.ok()) {
+        android::trusty::fuzz::Abort();
+    }
+
+    /* Send message to test server */
+    ret = ta.Write(data, size);
+    if (!ret.ok()) {
+        return -1;
+    }
+
+    /* Read message from test server */
+    ret = ta.Read(&buf, sizeof(buf));
+    if (!ret.ok()) {
+        return -1;
+    }
+
+    return 0;
+}
diff --git a/trusty/fuzz/utils.cpp b/trusty/fuzz/utils.cpp
new file mode 100644
index 0000000..f4cf0b6
--- /dev/null
+++ b/trusty/fuzz/utils.cpp
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2020 The Android Open Sourete 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.
+ */
+
+#define LOG_TAG "trusty-fuzz-utils"
+
+#include <trusty/fuzz/utils.h>
+
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/uio.h>
+#include <log/log_read.h>
+#include <time.h>
+#include <trusty/tipc.h>
+#include <iostream>
+
+using android::base::ErrnoError;
+using android::base::Error;
+using android::base::Result;
+using android::base::unique_fd;
+
+namespace {
+
+const size_t kTimeoutSeconds = 5;
+const std::string kTrustyLogTag = "trusty-log";
+
+const time_t kInitialTime = time(nullptr);
+
+void PrintTrustyLog() {
+    auto logger_list = android_logger_list_open(LOG_ID_KERNEL, ANDROID_LOG_NONBLOCK, 1000, 0);
+    if (logger_list == nullptr) {
+        std::cerr << "Could not open android kernel log\n";
+        return;
+    }
+
+    while (true) {
+        log_msg log_msg;
+        int rc = android_logger_list_read(logger_list, &log_msg);
+        if (rc < 0) {
+            break;
+        }
+        if (log_msg.entry.sec < kInitialTime) {
+            continue;
+        }
+        char* msg = log_msg.msg();
+        if (msg) {
+            std::string line(msg, log_msg.entry.len);
+            if (line.find(kTrustyLogTag) != std::string::npos) {
+                std::cerr << line.substr(kTrustyLogTag.length() + 2) << std::endl;
+            }
+        }
+    }
+
+    android_logger_list_free(logger_list);
+}
+
+}  // namespace
+
+namespace android {
+namespace trusty {
+namespace fuzz {
+
+TrustyApp::TrustyApp(std::string tipc_dev, std::string ta_port)
+    : tipc_dev_(tipc_dev), ta_port_(ta_port), ta_fd_(-1) {}
+
+Result<void> TrustyApp::Connect() {
+    alarm(kTimeoutSeconds);
+    int fd = tipc_connect(tipc_dev_.c_str(), ta_port_.c_str());
+    alarm(0);
+    if (fd < 0) {
+        return ErrnoError() << "failed to open TIPC device: ";
+    }
+    ta_fd_.reset(fd);
+
+    return {};
+}
+
+Result<void> TrustyApp::Read(void* buf, size_t len) {
+    if (ta_fd_ == -1) {
+        return Error() << "TA is not connected to yet: ";
+    }
+
+    alarm(kTimeoutSeconds);
+    int rc = read(ta_fd_, buf, len);
+    alarm(0);
+    if (rc < 0) {
+        return Error() << "failed to read TIPC message from TA: ";
+    }
+
+    return {};
+}
+
+Result<void> TrustyApp::Write(const void* buf, size_t len) {
+    if (ta_fd_ == -1) {
+        return Error() << "TA is not connected to yet: ";
+    }
+
+    alarm(kTimeoutSeconds);
+    int rc = write(ta_fd_, buf, len);
+    alarm(0);
+    if (rc < 0) {
+        return Error() << "failed to read TIPC message from TA: ";
+    }
+
+    return {};
+}
+
+Result<int> TrustyApp::GetRawFd() {
+    if (ta_fd_ == -1) {
+        return Error() << "TA is not connected to yet: ";
+    }
+
+    return ta_fd_;
+}
+
+void Abort() {
+    PrintTrustyLog();
+    exit(-1);
+}
+
+}  // namespace fuzz
+}  // namespace trusty
+}  // namespace android
diff --git a/trusty/gatekeeper/fuzz/Android.bp b/trusty/gatekeeper/fuzz/Android.bp
new file mode 100644
index 0000000..7ffa776
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/Android.bp
@@ -0,0 +1,24 @@
+// Copyright (C) 2020 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.
+
+cc_fuzz {
+    name: "trusty_gatekeeper_fuzzer",
+    defaults: ["trusty_fuzzer_defaults"],
+    srcs: ["fuzz.cpp"],
+
+    // The initial corpus for this fuzzer was derived by dumping messages from
+    // the `secure_env` emulator interface for cuttlefish while enrolling a new
+    // password in the emulator.
+    corpus: ["corpus/*"],
+}
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-2MMzSr b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-2MMzSr
new file mode 100644
index 0000000..f3c1f79
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-2MMzSr
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-Et63W0 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-Et63W0
new file mode 100644
index 0000000..b3e6585
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-Et63W0
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-G41Iz8 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-G41Iz8
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-G41Iz8
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-ItEoqJ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-ItEoqJ
new file mode 100644
index 0000000..85d38c7
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-ItEoqJ
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-MGXdfu b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-MGXdfu
new file mode 100644
index 0000000..f8e1467
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-MGXdfu
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-Yq4f10 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-Yq4f10
new file mode 100644
index 0000000..c221077
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-Yq4f10
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-agxKZa b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-agxKZa
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-agxKZa
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-alhn2v b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-alhn2v
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-alhn2v
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-eVJFHV b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-eVJFHV
new file mode 100644
index 0000000..f3c1f79
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-eVJFHV
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-et5K21 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-et5K21
new file mode 100644
index 0000000..f3c1f79
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-et5K21
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-gun5YX b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-gun5YX
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-gun5YX
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-kXw1R9 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-kXw1R9
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-kXw1R9
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-moapss b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-moapss
new file mode 100644
index 0000000..85d38c7
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-moapss
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-u5QySb b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-u5QySb
new file mode 100644
index 0000000..09f9d74
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-u5QySb
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-uZtvkq b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-uZtvkq
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-uZtvkq
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-w5G2SF b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-w5G2SF
new file mode 100644
index 0000000..d42956d
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-w5G2SF
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-y3H74x b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-y3H74x
new file mode 100644
index 0000000..1cec413
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-y3H74x
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-yALfeS b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-yALfeS
new file mode 100644
index 0000000..f3c1f79
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-recv-yALfeS
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-2S1GLi b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-2S1GLi
new file mode 100644
index 0000000..08b3449
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-2S1GLi
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-4j7hUc b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-4j7hUc
new file mode 100644
index 0000000..5507400
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-4j7hUc
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-6hsSQG b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-6hsSQG
new file mode 100644
index 0000000..ffa74cb
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-6hsSQG
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-E8CE7b b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-E8CE7b
new file mode 100644
index 0000000..21cdd9c
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-E8CE7b
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-GEDmHj b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-GEDmHj
new file mode 100644
index 0000000..23a8c08
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-GEDmHj
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-MpwDEN b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-MpwDEN
new file mode 100644
index 0000000..1795d09
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-MpwDEN
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Qutf8O b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Qutf8O
new file mode 100644
index 0000000..4f69edf
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Qutf8O
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Sg1WMt b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Sg1WMt
new file mode 100644
index 0000000..ba6d1cb
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Sg1WMt
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-U6Y1My b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-U6Y1My
new file mode 100644
index 0000000..631ef79
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-U6Y1My
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-WdSRky b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-WdSRky
new file mode 100644
index 0000000..02d4820
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-WdSRky
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Ypw6WP b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Ypw6WP
new file mode 100644
index 0000000..6d7574f
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Ypw6WP
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Yyj4Af b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Yyj4Af
new file mode 100644
index 0000000..47f518d
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-Yyj4Af
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-amyF62 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-amyF62
new file mode 100644
index 0000000..3a5fdf5
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-amyF62
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-gu8ziA b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-gu8ziA
new file mode 100644
index 0000000..bab5da1
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-gu8ziA
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-iCATsM b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-iCATsM
new file mode 100644
index 0000000..fae9173
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-iCATsM
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-kawT3I b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-kawT3I
new file mode 100644
index 0000000..51e3630
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-kawT3I
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-sYFzM5 b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-sYFzM5
new file mode 100644
index 0000000..173d77e
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-sYFzM5
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-yNFMdn b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-yNFMdn
new file mode 100644
index 0000000..96f9e42
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/corpus/gatekeeper-send-yNFMdn
Binary files differ
diff --git a/trusty/gatekeeper/fuzz/fuzz.cpp b/trusty/gatekeeper/fuzz/fuzz.cpp
new file mode 100644
index 0000000..7bfd7d1
--- /dev/null
+++ b/trusty/gatekeeper/fuzz/fuzz.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <stdlib.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/fuzz/counters.h>
+#include <trusty/fuzz/utils.h>
+#include <unistd.h>
+#include <iostream>
+
+using android::trusty::coverage::CoverageRecord;
+using android::trusty::fuzz::ExtraCounters;
+using android::trusty::fuzz::TrustyApp;
+
+#define TIPC_DEV "/dev/trusty-ipc-dev0"
+#define GATEKEEPER_PORT "com.android.trusty.gatekeeper"
+#define GATEKEEPER_MODULE_NAME "gatekeeper.syms.elf"
+
+/* Gatekeeper TA's UUID is 38ba0cdc-df0e-11e4-9869-233fb6ae4795 */
+static struct uuid gatekeeper_uuid = {
+        0x38ba0cdc,
+        0xdf0e,
+        0x11e4,
+        {0x98, 0x69, 0x23, 0x3f, 0xb6, 0xae, 0x47, 0x95},
+};
+
+static CoverageRecord record(TIPC_DEV, &gatekeeper_uuid, GATEKEEPER_MODULE_NAME);
+
+extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
+    auto ret = record.Open();
+    if (!ret.ok()) {
+        std::cerr << ret.error() << std::endl;
+        exit(-1);
+    }
+    return 0;
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    static uint8_t buf[TIPC_MAX_MSG_SIZE];
+
+    ExtraCounters counters(&record);
+    counters.Reset();
+
+    android::trusty::fuzz::TrustyApp ta(TIPC_DEV, GATEKEEPER_PORT);
+    auto ret = ta.Connect();
+    if (!ret.ok()) {
+        android::trusty::fuzz::Abort();
+    }
+
+    /* Send message to test server */
+    ret = ta.Write(data, size);
+    if (!ret.ok()) {
+        return -1;
+    }
+
+    /* Read message from test server */
+    ret = ta.Read(&buf, sizeof(buf));
+    if (!ret.ok()) {
+        return -1;
+    }
+
+    return 0;
+}
diff --git a/trusty/gatekeeper/gatekeeper_ipc.h b/trusty/gatekeeper/gatekeeper_ipc.h
index b05dcd8..8709d1a 100644
--- a/trusty/gatekeeper/gatekeeper_ipc.h
+++ b/trusty/gatekeeper/gatekeeper_ipc.h
@@ -20,11 +20,13 @@
 #define GATEKEEPER_MAX_BUFFER_LENGTH 1024
 
 enum gatekeeper_command {
-	GK_REQ_SHIFT = 1,
-	GK_RESP_BIT  = 1,
+    GK_REQ_SHIFT = 1,
+    GK_RESP_BIT = 1,
 
-	GK_ENROLL       = (0 << GK_REQ_SHIFT),
-	GK_VERIFY       = (1 << GK_REQ_SHIFT),
+    GK_ENROLL = (0 << GK_REQ_SHIFT),
+    GK_VERIFY = (1 << GK_REQ_SHIFT),
+    GK_DELETE_USER = (2 << GK_REQ_SHIFT),
+    GK_DELETE_ALL_USERS = (3 << GK_REQ_SHIFT),
 };
 
 /**
diff --git a/trusty/gatekeeper/trusty_gatekeeper.cpp b/trusty/gatekeeper/trusty_gatekeeper.cpp
index d149664..ec4f81b 100644
--- a/trusty/gatekeeper/trusty_gatekeeper.cpp
+++ b/trusty/gatekeeper/trusty_gatekeeper.cpp
@@ -56,9 +56,9 @@
 
 SizedBuffer hidl_vec2sized_buffer(const hidl_vec<uint8_t>& vec) {
     if (vec.size() == 0 || vec.size() > std::numeric_limits<uint32_t>::max()) return {};
-    auto dummy = new uint8_t[vec.size()];
-    std::copy(vec.begin(), vec.end(), dummy);
-    return {dummy, static_cast<uint32_t>(vec.size())};
+    auto buffer = new uint8_t[vec.size()];
+    std::copy(vec.begin(), vec.end(), buffer);
+    return {buffer, static_cast<uint32_t>(vec.size())};
 }
 
 Return<void> TrustyGateKeeperDevice::enroll(uint32_t uid,
@@ -133,13 +133,48 @@
     return {};
 }
 
-Return<void> TrustyGateKeeperDevice::deleteUser(uint32_t /*uid*/, deleteUser_cb _hidl_cb) {
-    _hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
+Return<void> TrustyGateKeeperDevice::deleteUser(uint32_t uid, deleteUser_cb _hidl_cb) {
+    if (error_ != 0) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
+        return {};
+    }
+
+    DeleteUserRequest request(uid);
+    DeleteUserResponse response;
+    auto error = Send(request, &response);
+
+    if (error != ERROR_NONE) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
+    } else if (response.error == ERROR_NOT_IMPLEMENTED) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
+    } else if (response.error != ERROR_NONE) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
+    } else {
+        _hidl_cb({GatekeeperStatusCode::STATUS_OK, response.retry_timeout, {}});
+    }
     return {};
 }
 
 Return<void> TrustyGateKeeperDevice::deleteAllUsers(deleteAllUsers_cb _hidl_cb) {
-    _hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
+    if (error_ != 0) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
+        return {};
+    }
+
+    DeleteAllUsersRequest request;
+    DeleteAllUsersResponse response;
+    auto error = Send(request, &response);
+
+    if (error != ERROR_NONE) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
+    } else if (response.error == ERROR_NOT_IMPLEMENTED) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED, 0, {}});
+    } else if (response.error != ERROR_NONE) {
+        _hidl_cb({GatekeeperStatusCode::ERROR_GENERAL_FAILURE, 0, {}});
+    } else {
+        _hidl_cb({GatekeeperStatusCode::STATUS_OK, response.retry_timeout, {}});
+    }
+
     return {};
 }
 
diff --git a/trusty/gatekeeper/trusty_gatekeeper.h b/trusty/gatekeeper/trusty_gatekeeper.h
index c0713f4..420dd7a 100644
--- a/trusty/gatekeeper/trusty_gatekeeper.h
+++ b/trusty/gatekeeper/trusty_gatekeeper.h
@@ -81,6 +81,15 @@
         return Send(GK_VERIFY, request, response);
     }
 
+    gatekeeper_error_t Send(const DeleteUserRequest& request, DeleteUserResponse* response) {
+        return Send(GK_DELETE_USER, request, response);
+    }
+
+    gatekeeper_error_t Send(const DeleteAllUsersRequest& request,
+                            DeleteAllUsersResponse* response) {
+        return Send(GK_DELETE_ALL_USERS, request, response);
+    }
+
     int error_;
 };
 
diff --git a/trusty/keymaster/3.0/TrustyKeymaster3Device.cpp b/trusty/keymaster/3.0/TrustyKeymaster3Device.cpp
index 98cbcc3..d787f7a 100644
--- a/trusty/keymaster/3.0/TrustyKeymaster3Device.cpp
+++ b/trusty/keymaster/3.0/TrustyKeymaster3Device.cpp
@@ -221,10 +221,10 @@
 
 Return<ErrorCode> TrustyKeymaster3Device::addRngEntropy(const hidl_vec<uint8_t>& data) {
     if (data.size() == 0) return ErrorCode::OK;
-    AddEntropyRequest request;
+    AddEntropyRequest request(impl_->message_version());
     request.random_data.Reinitialize(data.data(), data.size());
 
-    AddEntropyResponse response;
+    AddEntropyResponse response(impl_->message_version());
     impl_->AddRngEntropy(request, &response);
 
     return legacy_enum_conversion(response.error);
@@ -232,10 +232,10 @@
 
 Return<void> TrustyKeymaster3Device::generateKey(const hidl_vec<KeyParameter>& keyParams,
                                                  generateKey_cb _hidl_cb) {
-    GenerateKeyRequest request;
+    GenerateKeyRequest request(impl_->message_version());
     request.key_description.Reinitialize(KmParamSet(keyParams));
 
-    GenerateKeyResponse response;
+    GenerateKeyResponse response(impl_->message_version());
     impl_->GenerateKey(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -253,11 +253,11 @@
                                                            const hidl_vec<uint8_t>& clientId,
                                                            const hidl_vec<uint8_t>& appData,
                                                            getKeyCharacteristics_cb _hidl_cb) {
-    GetKeyCharacteristicsRequest request;
+    GetKeyCharacteristicsRequest request(impl_->message_version());
     request.SetKeyMaterial(keyBlob.data(), keyBlob.size());
     addClientAndAppData(clientId, appData, &request.additional_params);
 
-    GetKeyCharacteristicsResponse response;
+    GetKeyCharacteristicsResponse response(impl_->message_version());
     impl_->GetKeyCharacteristics(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -273,12 +273,12 @@
                                                KeyFormat keyFormat,
                                                const hidl_vec<uint8_t>& keyData,
                                                importKey_cb _hidl_cb) {
-    ImportKeyRequest request;
+    ImportKeyRequest request(impl_->message_version());
     request.key_description.Reinitialize(KmParamSet(params));
     request.key_format = legacy_enum_conversion(keyFormat);
-    request.SetKeyMaterial(keyData.data(), keyData.size());
+    request.key_data = KeymasterKeyBlob(keyData.data(), keyData.size());
 
-    ImportKeyResponse response;
+    ImportKeyResponse response(impl_->message_version());
     impl_->ImportKey(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -297,12 +297,12 @@
                                                const hidl_vec<uint8_t>& clientId,
                                                const hidl_vec<uint8_t>& appData,
                                                exportKey_cb _hidl_cb) {
-    ExportKeyRequest request;
+    ExportKeyRequest request(impl_->message_version());
     request.key_format = legacy_enum_conversion(exportFormat);
     request.SetKeyMaterial(keyBlob.data(), keyBlob.size());
     addClientAndAppData(clientId, appData, &request.additional_params);
 
-    ExportKeyResponse response;
+    ExportKeyResponse response(impl_->message_version());
     impl_->ExportKey(request, &response);
 
     hidl_vec<uint8_t> resultKeyBlob;
@@ -316,11 +316,11 @@
 Return<void> TrustyKeymaster3Device::attestKey(const hidl_vec<uint8_t>& keyToAttest,
                                                const hidl_vec<KeyParameter>& attestParams,
                                                attestKey_cb _hidl_cb) {
-    AttestKeyRequest request;
+    AttestKeyRequest request(impl_->message_version());
     request.SetKeyMaterial(keyToAttest.data(), keyToAttest.size());
     request.attest_params.Reinitialize(KmParamSet(attestParams));
 
-    AttestKeyResponse response;
+    AttestKeyResponse response(impl_->message_version());
     impl_->AttestKey(request, &response);
 
     hidl_vec<hidl_vec<uint8_t>> resultCertChain;
@@ -334,11 +334,11 @@
 Return<void> TrustyKeymaster3Device::upgradeKey(const hidl_vec<uint8_t>& keyBlobToUpgrade,
                                                 const hidl_vec<KeyParameter>& upgradeParams,
                                                 upgradeKey_cb _hidl_cb) {
-    UpgradeKeyRequest request;
+    UpgradeKeyRequest request(impl_->message_version());
     request.SetKeyMaterial(keyBlobToUpgrade.data(), keyBlobToUpgrade.size());
     request.upgrade_params.Reinitialize(KmParamSet(upgradeParams));
 
-    UpgradeKeyResponse response;
+    UpgradeKeyResponse response(impl_->message_version());
     impl_->UpgradeKey(request, &response);
 
     if (response.error == KM_ERROR_OK) {
@@ -350,18 +350,18 @@
 }
 
 Return<ErrorCode> TrustyKeymaster3Device::deleteKey(const hidl_vec<uint8_t>& keyBlob) {
-    DeleteKeyRequest request;
+    DeleteKeyRequest request(impl_->message_version());
     request.SetKeyMaterial(keyBlob.data(), keyBlob.size());
 
-    DeleteKeyResponse response;
+    DeleteKeyResponse response(impl_->message_version());
     impl_->DeleteKey(request, &response);
 
     return legacy_enum_conversion(response.error);
 }
 
 Return<ErrorCode> TrustyKeymaster3Device::deleteAllKeys() {
-    DeleteAllKeysRequest request;
-    DeleteAllKeysResponse response;
+    DeleteAllKeysRequest request(impl_->message_version());
+    DeleteAllKeysResponse response(impl_->message_version());
     impl_->DeleteAllKeys(request, &response);
 
     return legacy_enum_conversion(response.error);
@@ -374,15 +374,15 @@
 Return<void> TrustyKeymaster3Device::begin(KeyPurpose purpose, const hidl_vec<uint8_t>& key,
                                            const hidl_vec<KeyParameter>& inParams,
                                            begin_cb _hidl_cb) {
-    BeginOperationRequest request;
+    BeginOperationRequest request(impl_->message_version());
     request.purpose = legacy_enum_conversion(purpose);
     request.SetKeyMaterial(key.data(), key.size());
     request.additional_params.Reinitialize(KmParamSet(inParams));
 
-    BeginOperationResponse response;
+    BeginOperationResponse response(impl_->message_version());
     impl_->BeginOperation(request, &response);
 
-    hidl_vec<KeyParameter> resultParams;
+    hidl_vec<KeyParameter> resultParams(impl_->message_version());
     if (response.error == KM_ERROR_OK) {
         resultParams = kmParamSet2Hidl(response.output_params);
     }
@@ -394,8 +394,8 @@
 Return<void> TrustyKeymaster3Device::update(uint64_t operationHandle,
                                             const hidl_vec<KeyParameter>& inParams,
                                             const hidl_vec<uint8_t>& input, update_cb _hidl_cb) {
-    UpdateOperationRequest request;
-    UpdateOperationResponse response;
+    UpdateOperationRequest request(impl_->message_version());
+    UpdateOperationResponse response(impl_->message_version());
     hidl_vec<KeyParameter> resultParams;
     hidl_vec<uint8_t> resultBlob;
     uint32_t resultConsumed = 0;
@@ -431,13 +431,13 @@
                                             const hidl_vec<uint8_t>& input,
                                             const hidl_vec<uint8_t>& signature,
                                             finish_cb _hidl_cb) {
-    FinishOperationRequest request;
+    FinishOperationRequest request(impl_->message_version());
     request.op_handle = operationHandle;
     request.input.Reinitialize(input.data(), input.size());
     request.signature.Reinitialize(signature.data(), signature.size());
     request.additional_params.Reinitialize(KmParamSet(inParams));
 
-    FinishOperationResponse response;
+    FinishOperationResponse response(impl_->message_version());
     impl_->FinishOperation(request, &response);
 
     hidl_vec<KeyParameter> resultParams;
@@ -451,10 +451,10 @@
 }
 
 Return<ErrorCode> TrustyKeymaster3Device::abort(uint64_t operationHandle) {
-    AbortOperationRequest request;
+    AbortOperationRequest request(impl_->message_version());
     request.op_handle = operationHandle;
 
-    AbortOperationResponse response;
+    AbortOperationResponse response(impl_->message_version());
     impl_->AbortOperation(request, &response);
 
     return legacy_enum_conversion(response.error);
diff --git a/trusty/keymaster/4.0/TrustyKeymaster4Device.cpp b/trusty/keymaster/4.0/TrustyKeymaster4Device.cpp
index ec2ba12..e68ba82 100644
--- a/trusty/keymaster/4.0/TrustyKeymaster4Device.cpp
+++ b/trusty/keymaster/4.0/TrustyKeymaster4Device.cpp
@@ -284,7 +284,7 @@
 
 Return<void> TrustyKeymaster4Device::computeSharedHmac(
         const hidl_vec<HmacSharingParameters>& params, computeSharedHmac_cb _hidl_cb) {
-    ComputeSharedHmacRequest request;
+    ComputeSharedHmacRequest request(impl_->message_version());
     request.params_array.params_array = new keymaster::HmacSharingParameters[params.size()];
     request.params_array.num_params = params.size();
     for (size_t i = 0; i < params.size(); ++i) {
@@ -309,7 +309,7 @@
 Return<void> TrustyKeymaster4Device::verifyAuthorization(
         uint64_t challenge, const hidl_vec<KeyParameter>& parametersToVerify,
         const HardwareAuthToken& authToken, verifyAuthorization_cb _hidl_cb) {
-    VerifyAuthorizationRequest request;
+    VerifyAuthorizationRequest request(impl_->message_version());
     request.challenge = challenge;
     request.parameters_to_verify.Reinitialize(KmParamSet(parametersToVerify));
     request.auth_token.challenge = authToken.challenge;
@@ -336,10 +336,10 @@
 
 Return<ErrorCode> TrustyKeymaster4Device::addRngEntropy(const hidl_vec<uint8_t>& data) {
     if (data.size() == 0) return ErrorCode::OK;
-    AddEntropyRequest request;
+    AddEntropyRequest request(impl_->message_version());
     request.random_data.Reinitialize(data.data(), data.size());
 
-    AddEntropyResponse response;
+    AddEntropyResponse response(impl_->message_version());
     impl_->AddRngEntropy(request, &response);
 
     return legacy_enum_conversion(response.error);
@@ -347,10 +347,10 @@
 
 Return<void> TrustyKeymaster4Device::generateKey(const hidl_vec<KeyParameter>& keyParams,
                                                  generateKey_cb _hidl_cb) {
-    GenerateKeyRequest request;
+    GenerateKeyRequest request(impl_->message_version());
     request.key_description.Reinitialize(KmParamSet(keyParams));
 
-    GenerateKeyResponse response;
+    GenerateKeyResponse response(impl_->message_version());
     impl_->GenerateKey(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -368,11 +368,11 @@
                                                            const hidl_vec<uint8_t>& clientId,
                                                            const hidl_vec<uint8_t>& appData,
                                                            getKeyCharacteristics_cb _hidl_cb) {
-    GetKeyCharacteristicsRequest request;
+    GetKeyCharacteristicsRequest request(impl_->message_version());
     request.SetKeyMaterial(keyBlob.data(), keyBlob.size());
     addClientAndAppData(clientId, appData, &request.additional_params);
 
-    GetKeyCharacteristicsResponse response;
+    GetKeyCharacteristicsResponse response(impl_->message_version());
     impl_->GetKeyCharacteristics(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -388,12 +388,12 @@
                                                KeyFormat keyFormat,
                                                const hidl_vec<uint8_t>& keyData,
                                                importKey_cb _hidl_cb) {
-    ImportKeyRequest request;
+    ImportKeyRequest request(impl_->message_version());
     request.key_description.Reinitialize(KmParamSet(params));
     request.key_format = legacy_enum_conversion(keyFormat);
-    request.SetKeyMaterial(keyData.data(), keyData.size());
+    request.key_data = KeymasterKeyBlob(keyData.data(), keyData.size());
 
-    ImportKeyResponse response;
+    ImportKeyResponse response(impl_->message_version());
     impl_->ImportKey(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -411,7 +411,7 @@
         const hidl_vec<uint8_t>& wrappedKeyData, const hidl_vec<uint8_t>& wrappingKeyBlob,
         const hidl_vec<uint8_t>& maskingKey, const hidl_vec<KeyParameter>& unwrappingParams,
         uint64_t passwordSid, uint64_t biometricSid, importWrappedKey_cb _hidl_cb) {
-    ImportWrappedKeyRequest request;
+    ImportWrappedKeyRequest request(impl_->message_version());
     request.SetWrappedMaterial(wrappedKeyData.data(), wrappedKeyData.size());
     request.SetWrappingMaterial(wrappingKeyBlob.data(), wrappingKeyBlob.size());
     request.SetMaskingKeyMaterial(maskingKey.data(), maskingKey.size());
@@ -419,7 +419,7 @@
     request.password_sid = passwordSid;
     request.biometric_sid = biometricSid;
 
-    ImportWrappedKeyResponse response;
+    ImportWrappedKeyResponse response(impl_->message_version());
     impl_->ImportWrappedKey(request, &response);
 
     KeyCharacteristics resultCharacteristics;
@@ -438,12 +438,12 @@
                                                const hidl_vec<uint8_t>& clientId,
                                                const hidl_vec<uint8_t>& appData,
                                                exportKey_cb _hidl_cb) {
-    ExportKeyRequest request;
+    ExportKeyRequest request(impl_->message_version());
     request.key_format = legacy_enum_conversion(exportFormat);
     request.SetKeyMaterial(keyBlob.data(), keyBlob.size());
     addClientAndAppData(clientId, appData, &request.additional_params);
 
-    ExportKeyResponse response;
+    ExportKeyResponse response(impl_->message_version());
     impl_->ExportKey(request, &response);
 
     hidl_vec<uint8_t> resultKeyBlob;
@@ -457,11 +457,11 @@
 Return<void> TrustyKeymaster4Device::attestKey(const hidl_vec<uint8_t>& keyToAttest,
                                                const hidl_vec<KeyParameter>& attestParams,
                                                attestKey_cb _hidl_cb) {
-    AttestKeyRequest request;
+    AttestKeyRequest request(impl_->message_version());
     request.SetKeyMaterial(keyToAttest.data(), keyToAttest.size());
     request.attest_params.Reinitialize(KmParamSet(attestParams));
 
-    AttestKeyResponse response;
+    AttestKeyResponse response(impl_->message_version());
     impl_->AttestKey(request, &response);
 
     hidl_vec<hidl_vec<uint8_t>> resultCertChain;
@@ -475,11 +475,11 @@
 Return<void> TrustyKeymaster4Device::upgradeKey(const hidl_vec<uint8_t>& keyBlobToUpgrade,
                                                 const hidl_vec<KeyParameter>& upgradeParams,
                                                 upgradeKey_cb _hidl_cb) {
-    UpgradeKeyRequest request;
+    UpgradeKeyRequest request(impl_->message_version());
     request.SetKeyMaterial(keyBlobToUpgrade.data(), keyBlobToUpgrade.size());
     request.upgrade_params.Reinitialize(KmParamSet(upgradeParams));
 
-    UpgradeKeyResponse response;
+    UpgradeKeyResponse response(impl_->message_version());
     impl_->UpgradeKey(request, &response);
 
     if (response.error == KM_ERROR_OK) {
@@ -491,18 +491,18 @@
 }
 
 Return<ErrorCode> TrustyKeymaster4Device::deleteKey(const hidl_vec<uint8_t>& keyBlob) {
-    DeleteKeyRequest request;
+    DeleteKeyRequest request(impl_->message_version());
     request.SetKeyMaterial(keyBlob.data(), keyBlob.size());
 
-    DeleteKeyResponse response;
+    DeleteKeyResponse response(impl_->message_version());
     impl_->DeleteKey(request, &response);
 
     return legacy_enum_conversion(response.error);
 }
 
 Return<ErrorCode> TrustyKeymaster4Device::deleteAllKeys() {
-    DeleteAllKeysRequest request;
-    DeleteAllKeysResponse response;
+    DeleteAllKeysRequest request(impl_->message_version());
+    DeleteAllKeysResponse response(impl_->message_version());
     impl_->DeleteAllKeys(request, &response);
 
     return legacy_enum_conversion(response.error);
@@ -516,12 +516,12 @@
                                            const hidl_vec<KeyParameter>& inParams,
                                            const HardwareAuthToken& authToken, begin_cb _hidl_cb) {
     hidl_vec<KeyParameter> extendedParams = injectAuthToken(inParams, authToken);
-    BeginOperationRequest request;
+    BeginOperationRequest request(impl_->message_version());
     request.purpose = legacy_enum_conversion(purpose);
     request.SetKeyMaterial(key.data(), key.size());
     request.additional_params.Reinitialize(KmParamSet(extendedParams));
 
-    BeginOperationResponse response;
+    BeginOperationResponse response(impl_->message_version());
     impl_->BeginOperation(request, &response);
 
     hidl_vec<KeyParameter> resultParams;
@@ -540,8 +540,8 @@
                                             const VerificationToken& verificationToken,
                                             update_cb _hidl_cb) {
     (void)verificationToken;
-    UpdateOperationRequest request;
-    UpdateOperationResponse response;
+    UpdateOperationRequest request(impl_->message_version());
+    UpdateOperationResponse response(impl_->message_version());
     hidl_vec<KeyParameter> resultParams;
     hidl_vec<uint8_t> resultBlob;
     hidl_vec<KeyParameter> extendedParams = injectAuthToken(inParams, authToken);
@@ -581,14 +581,14 @@
                                             const VerificationToken& verificationToken,
                                             finish_cb _hidl_cb) {
     (void)verificationToken;
-    FinishOperationRequest request;
+    FinishOperationRequest request(impl_->message_version());
     hidl_vec<KeyParameter> extendedParams = injectAuthToken(inParams, authToken);
     request.op_handle = operationHandle;
     request.input.Reinitialize(input.data(), input.size());
     request.signature.Reinitialize(signature.data(), signature.size());
     request.additional_params.Reinitialize(KmParamSet(extendedParams));
 
-    FinishOperationResponse response;
+    FinishOperationResponse response(impl_->message_version());
     impl_->FinishOperation(request, &response);
 
     hidl_vec<KeyParameter> resultParams;
@@ -602,10 +602,10 @@
 }
 
 Return<ErrorCode> TrustyKeymaster4Device::abort(uint64_t operationHandle) {
-    AbortOperationRequest request;
+    AbortOperationRequest request(impl_->message_version());
     request.op_handle = operationHandle;
 
-    AbortOperationResponse response;
+    AbortOperationResponse response(impl_->message_version());
     impl_->AbortOperation(request, &response);
 
     return legacy_enum_conversion(response.error);
diff --git a/trusty/keymaster/4.0/android.hardware.keymaster@4.0-service.trusty.xml b/trusty/keymaster/4.0/android.hardware.keymaster@4.0-service.trusty.xml
index aa30707..65eb854 100644
--- a/trusty/keymaster/4.0/android.hardware.keymaster@4.0-service.trusty.xml
+++ b/trusty/keymaster/4.0/android.hardware.keymaster@4.0-service.trusty.xml
@@ -2,10 +2,6 @@
     <hal format="hidl">
         <name>android.hardware.keymaster</name>
         <transport>hwbinder</transport>
-        <version>4.0</version>
-        <interface>
-        <name>IKeymasterDevice</name>
-            <instance>default</instance>
-        </interface>
+        <fqname>@4.0::IKeymasterDevice/default</fqname>
     </hal>
 </manifest>
diff --git a/trusty/keymaster/Android.bp b/trusty/keymaster/Android.bp
index f32a69e..27e1a3f 100644
--- a/trusty/keymaster/Android.bp
+++ b/trusty/keymaster/Android.bp
@@ -14,70 +14,6 @@
 // limitations under the License.
 //
 
-// WARNING: Everything listed here will be built on ALL platforms,
-// including x86, the emulator, and the SDK.  Modules must be uniquely
-// named (liblights.panda), and must build everywhere, or limit themselves
-// to only building on ARM if they include assembly. Individual makefiles
-// are responsible for having their own logic, for fine-grained control.
-
-// trusty_keymaster is a binary used only for on-device testing.  It
-// runs Trusty Keymaster through a basic set of operations with RSA
-// and ECDSA keys.
-cc_binary {
-    name: "trusty_keymaster_tipc",
-    vendor: true,
-    srcs: [
-        "ipc/trusty_keymaster_ipc.cpp",
-        "legacy/trusty_keymaster_device.cpp",
-        "legacy/trusty_keymaster_main.cpp",
-    ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-
-    local_include_dirs: ["include"],
-
-    shared_libs: [
-        "libcrypto",
-        "libcutils",
-        "libkeymaster_portable",
-        "libtrusty",
-        "libkeymaster_messages",
-        "libsoftkeymasterdevice",
-        "liblog",
-    ],
-}
-
-// keystore.trusty is the HAL used by keystore on Trusty devices.
-cc_library_shared {
-    name: "keystore.trusty",
-    vendor: true,
-    relative_install_path: "hw",
-    srcs: [
-        "ipc/trusty_keymaster_ipc.cpp",
-        "legacy/module.cpp",
-        "legacy/trusty_keymaster_device.cpp",
-    ],
-
-    cflags: [
-        "-fvisibility=hidden",
-        "-Wall",
-        "-Werror",
-    ],
-
-    local_include_dirs: ["include"],
-
-    shared_libs: [
-        "libcrypto",
-        "libkeymaster_messages",
-        "libtrusty",
-        "liblog",
-        "libcutils",
-    ],
-    header_libs: ["libhardware_headers"],
-}
-
 cc_binary {
     name: "android.hardware.keymaster@3.0-service.trusty",
     defaults: ["hidl_defaults"],
@@ -139,3 +75,36 @@
 
     vintf_fragments: ["4.0/android.hardware.keymaster@4.0-service.trusty.xml"],
 }
+
+prebuilt_etc {
+    name: "keymaster_soft_attestation_keys.xml",
+    vendor: true,
+    src: "set_attestation_key/keymaster_soft_attestation_keys.xml",
+}
+
+cc_binary {
+    name: "trusty_keymaster_set_attestation_key",
+    vendor: true,
+
+    srcs: [
+        "set_attestation_key/set_attestation_key.cpp",
+        "ipc/trusty_keymaster_ipc.cpp",
+    ],
+
+    local_include_dirs: ["include"],
+
+    shared_libs: [
+        "libc",
+        "libcrypto",
+        "liblog",
+        "libtrusty",
+        "libhardware",
+        "libkeymaster_messages",
+        "libxml2",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
diff --git a/trusty/keymaster/TrustyKeymaster.cpp b/trusty/keymaster/TrustyKeymaster.cpp
index f3ef747..23e0433 100644
--- a/trusty/keymaster/TrustyKeymaster.cpp
+++ b/trusty/keymaster/TrustyKeymaster.cpp
@@ -31,11 +31,41 @@
         return err;
     }
 
-    ConfigureRequest req;
+    // Try GetVersion2 first.
+    GetVersion2Request versionReq;
+    GetVersion2Response versionRsp = GetVersion2(versionReq);
+    if (versionRsp.error != KM_ERROR_OK) {
+        ALOGW("TA appears not to support GetVersion2, falling back (err = %d)", versionRsp.error);
+
+        err = trusty_keymaster_connect();
+        if (err) {
+            ALOGE("Failed to connect to trusty keymaster %d", err);
+            return err;
+        }
+
+        GetVersionRequest versionReq;
+        GetVersionResponse versionRsp;
+        GetVersion(versionReq, &versionRsp);
+        if (versionRsp.error != KM_ERROR_OK) {
+            ALOGE("Failed to get TA version %d", versionRsp.error);
+            return -1;
+        } else {
+            keymaster_error_t error;
+            message_version_ = NegotiateMessageVersion(versionRsp, &error);
+            if (error != KM_ERROR_OK) {
+                ALOGE("Failed to negotiate message version %d", error);
+                return -1;
+            }
+        }
+    } else {
+        message_version_ = NegotiateMessageVersion(versionReq, versionRsp);
+    }
+
+    ConfigureRequest req(message_version());
     req.os_version = GetOsVersion();
     req.os_patchlevel = GetOsPatchlevel();
 
-    ConfigureResponse rsp;
+    ConfigureResponse rsp(message_version());
     Configure(req, &rsp);
 
     if (rsp.error != KM_ERROR_OK) {
@@ -52,7 +82,7 @@
     trusty_keymaster_disconnect();
 }
 
-static void ForwardCommand(enum keymaster_command command, const Serializable& req,
+static void ForwardCommand(enum keymaster_command command, const KeymasterMessage& req,
                            KeymasterResponse* rsp) {
     keymaster_error_t err;
     err = trusty_keymaster_send(command, req, rsp);
@@ -173,25 +203,30 @@
 }
 
 GetHmacSharingParametersResponse TrustyKeymaster::GetHmacSharingParameters() {
-    // Dummy empty buffer to allow ForwardCommand to have something to serialize
-    Buffer request;
-    GetHmacSharingParametersResponse response;
+    GetHmacSharingParametersRequest request(message_version());
+    GetHmacSharingParametersResponse response(message_version());
     ForwardCommand(KM_GET_HMAC_SHARING_PARAMETERS, request, &response);
     return response;
 }
 
 ComputeSharedHmacResponse TrustyKeymaster::ComputeSharedHmac(
         const ComputeSharedHmacRequest& request) {
-    ComputeSharedHmacResponse response;
+    ComputeSharedHmacResponse response(message_version());
     ForwardCommand(KM_COMPUTE_SHARED_HMAC, request, &response);
     return response;
 }
 
 VerifyAuthorizationResponse TrustyKeymaster::VerifyAuthorization(
         const VerifyAuthorizationRequest& request) {
-    VerifyAuthorizationResponse response;
+    VerifyAuthorizationResponse response(message_version());
     ForwardCommand(KM_VERIFY_AUTHORIZATION, request, &response);
     return response;
 }
 
+GetVersion2Response TrustyKeymaster::GetVersion2(const GetVersion2Request& request) {
+    GetVersion2Response response(message_version());
+    ForwardCommand(KM_GET_VERSION_2, request, &response);
+    return response;
+}
+
 }  // namespace keymaster
diff --git a/trusty/keymaster/fuzz/Android.bp b/trusty/keymaster/fuzz/Android.bp
new file mode 100644
index 0000000..da9f9ec
--- /dev/null
+++ b/trusty/keymaster/fuzz/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 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.
+
+cc_fuzz {
+    name: "trusty_keymaster_fuzzer",
+    defaults: ["trusty_fuzzer_defaults"],
+    srcs: ["fuzz.cpp"],
+}
diff --git a/trusty/keymaster/fuzz/fuzz.cpp b/trusty/keymaster/fuzz/fuzz.cpp
new file mode 100644
index 0000000..4ac97bb
--- /dev/null
+++ b/trusty/keymaster/fuzz/fuzz.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <stdlib.h>
+#include <trusty/coverage/coverage.h>
+#include <trusty/fuzz/counters.h>
+#include <trusty/fuzz/utils.h>
+#include <unistd.h>
+#include <iostream>
+
+using android::trusty::coverage::CoverageRecord;
+using android::trusty::fuzz::ExtraCounters;
+using android::trusty::fuzz::TrustyApp;
+
+#define TIPC_DEV "/dev/trusty-ipc-dev0"
+#define KEYMASTER_PORT "com.android.trusty.keymaster"
+#define KEYMASTER_MODULE_FILENAME "keymaster.syms.elf"
+
+/* Keymaster TA's UUID is 5f902ace-5e5c-4cd8-ae54-87b88c22ddaf */
+static struct uuid keymaster_uuid = {
+        0x5f902ace,
+        0x5e5c,
+        0x4cd8,
+        {0xae, 0x54, 0x87, 0xb8, 0x8c, 0x22, 0xdd, 0xaf},
+};
+
+static CoverageRecord record(TIPC_DEV, &keymaster_uuid, KEYMASTER_MODULE_FILENAME);
+
+extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
+    auto ret = record.Open();
+    if (!ret.ok()) {
+        std::cerr << ret.error() << std::endl;
+        exit(-1);
+    }
+    return 0;
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+    static uint8_t buf[TIPC_MAX_MSG_SIZE];
+
+    ExtraCounters counters(&record);
+    counters.Reset();
+
+    android::trusty::fuzz::TrustyApp ta(TIPC_DEV, KEYMASTER_PORT);
+    auto ret = ta.Connect();
+    if (!ret.ok()) {
+        android::trusty::fuzz::Abort();
+    }
+
+    /* Send message to test server */
+    ret = ta.Write(data, size);
+    if (!ret.ok()) {
+        return -1;
+    }
+
+    /* Read message from test server */
+    ret = ta.Read(&buf, sizeof(buf));
+    if (!ret.ok()) {
+        return -1;
+    }
+
+    return 0;
+}
diff --git a/trusty/keymaster/include/trusty_keymaster/TrustyKeymaster.h b/trusty/keymaster/include/trusty_keymaster/TrustyKeymaster.h
index 030b645..bec2a2a 100644
--- a/trusty/keymaster/include/trusty_keymaster/TrustyKeymaster.h
+++ b/trusty/keymaster/include/trusty_keymaster/TrustyKeymaster.h
@@ -59,6 +59,12 @@
     GetHmacSharingParametersResponse GetHmacSharingParameters();
     ComputeSharedHmacResponse ComputeSharedHmac(const ComputeSharedHmacRequest& request);
     VerifyAuthorizationResponse VerifyAuthorization(const VerifyAuthorizationRequest& request);
+    GetVersion2Response GetVersion2(const GetVersion2Request& request);
+
+    uint32_t message_version() const { return message_version_; }
+
+  private:
+    uint32_t message_version_;
 };
 
 }  // namespace keymaster
diff --git a/trusty/keymaster/include/trusty_keymaster/ipc/keymaster_ipc.h b/trusty/keymaster/include/trusty_keymaster/ipc/keymaster_ipc.h
index 13e6725..419c96f 100644
--- a/trusty/keymaster/include/trusty_keymaster/ipc/keymaster_ipc.h
+++ b/trusty/keymaster/include/trusty_keymaster/ipc/keymaster_ipc.h
@@ -53,6 +53,20 @@
     KM_DELETE_ALL_KEYS              = (23 << KEYMASTER_REQ_SHIFT),
     KM_DESTROY_ATTESTATION_IDS      = (24 << KEYMASTER_REQ_SHIFT),
     KM_IMPORT_WRAPPED_KEY           = (25 << KEYMASTER_REQ_SHIFT),
+    KM_GET_VERSION_2                = (28 << KEYMASTER_REQ_SHIFT),
+
+    // Bootloader/provisioning calls.
+    KM_SET_BOOT_PARAMS = (0x1000 << KEYMASTER_REQ_SHIFT),
+    KM_SET_ATTESTATION_KEY = (0x2000 << KEYMASTER_REQ_SHIFT),
+    KM_APPEND_ATTESTATION_CERT_CHAIN = (0x3000 << KEYMASTER_REQ_SHIFT),
+    KM_ATAP_GET_CA_REQUEST = (0x4000 << KEYMASTER_REQ_SHIFT),
+    KM_ATAP_SET_CA_RESPONSE_BEGIN = (0x5000 << KEYMASTER_REQ_SHIFT),
+    KM_ATAP_SET_CA_RESPONSE_UPDATE = (0x6000 << KEYMASTER_REQ_SHIFT),
+    KM_ATAP_SET_CA_RESPONSE_FINISH = (0x7000 << KEYMASTER_REQ_SHIFT),
+    KM_ATAP_READ_UUID = (0x8000 << KEYMASTER_REQ_SHIFT),
+    KM_SET_PRODUCT_ID = (0x9000 << KEYMASTER_REQ_SHIFT),
+    KM_CLEAR_ATTESTATION_CERT_CHAIN = (0xa000 << KEYMASTER_REQ_SHIFT),
+    KM_SET_WRAPPED_ATTESTATION_KEY = (0xb000 << KEYMASTER_REQ_SHIFT),
 };
 
 #ifdef __ANDROID__
diff --git a/trusty/keymaster/legacy/Makefile b/trusty/keymaster/legacy/Makefile
deleted file mode 100644
index f575381..0000000
--- a/trusty/keymaster/legacy/Makefile
+++ /dev/null
@@ -1,199 +0,0 @@
-#####
-# Local unit test Makefile
-#
-# This makefile builds and runs the trusty_keymaster unit tests locally on the development
-# machine, not on an Android device.
-#
-# To build and run these tests, one pre-requisite must be manually installed: BoringSSL.
-# This Makefile expects to find BoringSSL in a directory adjacent to $ANDROID_BUILD_TOP.
-# To get and build it, first install the Ninja build tool (e.g. apt-get install
-# ninja-build), then do:
-#
-# cd $ANDROID_BUILD_TOP/..
-# git clone https://boringssl.googlesource.com/boringssl
-# cd boringssl
-# mdkir build
-# cd build
-# cmake -GNinja ..
-# ninja
-#
-# Then return to $ANDROID_BUILD_TOP/system/keymaster and run "make".
-#####
-
-BASE=../../../..
-SUBS=system/core \
-	system/keymaster \
-	hardware/libhardware \
-	external/gtest
-GTEST=$(BASE)/external/gtest
-KM=$(BASE)/system/keymaster
-
-INCLUDES=$(foreach dir,$(SUBS),-I $(BASE)/$(dir)/include) \
-	-I $(BASE)/libnativehelper/include/nativehelper \
-	-I ../tipc/include \
-	-I $(BASE)/system/keymaster \
-	-I $(GTEST) \
-	-I$(BASE)/../boringssl/include
-
-ifdef USE_CLANG
-CC=/usr/bin/clang
-CXX=/usr/bin/clang
-CLANG_TEST_DEFINE=-DKEYMASTER_CLANG_TEST_BUILD
-COMPILER_SPECIFIC_ARGS=-std=c++11 $(CLANG_TEST_DEFINE)
-else
-COMPILER_SPECIFIC_ARGS=-std=c++0x -fprofile-arcs
-endif
-
-CPPFLAGS=$(INCLUDES) -g -O0 -MD
-CXXFLAGS=-Wall -Werror -Wno-unused -Winit-self -Wpointer-arith	-Wunused-parameter \
-	-Wmissing-declarations -ftest-coverage \
-	-Wno-deprecated-declarations -fno-exceptions -DKEYMASTER_NAME_TAGS \
-	$(COMPILER_SPECIFIC_ARGS)
-LDLIBS=-L$(BASE)/../boringssl/build/crypto -lcrypto -lpthread -lstdc++
-
-CPPSRCS=\
-	$(KM)/aead_mode_operation.cpp \
-	$(KM)/aes_key.cpp \
-	$(KM)/aes_operation.cpp \
-	$(KM)/android_keymaster.cpp \
-	$(KM)/android_keymaster_messages.cpp \
-	$(KM)/android_keymaster_messages_test.cpp \
-	$(KM)/android_keymaster_test.cpp \
-	$(KM)/android_keymaster_test_utils.cpp \
-	$(KM)/android_keymaster_utils.cpp \
-	$(KM)/asymmetric_key.cpp \
-	$(KM)/auth_encrypted_key_blob.cpp \
-	$(KM)/auth_encrypted_key_blob.cpp \
-	$(KM)/authorization_set.cpp \
-	$(KM)/authorization_set_test.cpp \
-	$(KM)/ec_key.cpp \
-	$(KM)/ec_keymaster0_key.cpp \
-	$(KM)/ecdsa_operation.cpp \
-	$(KM)/hmac_key.cpp \
-	$(KM)/hmac_operation.cpp \
-	$(KM)/integrity_assured_key_blob.cpp \
-	$(KM)/key.cpp \
-	$(KM)/key_blob_test.cpp \
-	$(KM)/keymaster0_engine.cpp \
-	$(KM)/logger.cpp \
-	$(KM)/ocb_utils.cpp \
-	$(KM)/openssl_err.cpp \
-	$(KM)/openssl_utils.cpp \
-	$(KM)/operation.cpp \
-	$(KM)/operation_table.cpp \
-	$(KM)/rsa_key.cpp \
-	$(KM)/rsa_keymaster0_key.cpp \
-	$(KM)/rsa_operation.cpp \
-	$(KM)/serializable.cpp \
-	$(KM)/soft_keymaster_context.cpp \
-	$(KM)/symmetric_key.cpp \
-	$(KM)/unencrypted_key_blob.cpp \
-	trusty_keymaster_device.cpp \
-	trusty_keymaster_device_test.cpp
-CCSRCS=$(GTEST)/src/gtest-all.cc
-CSRCS=ocb.c
-
-OBJS=$(CPPSRCS:.cpp=.o) $(CCSRCS:.cc=.o) $(CSRCS:.c=.o)
-DEPS=$(CPPSRCS:.cpp=.d) $(CCSRCS:.cc=.d) $(CSRCS:.c=.d)
-GCDA=$(CPPSRCS:.cpp=.gcda) $(CCSRCS:.cc=.gcda) $(CSRCS:.c=.gcda)
-GCNO=$(CPPSRCS:.cpp=.gcno) $(CCSRCS:.cc=.gcno) $(CSRCS:.c=.gcno)
-
-LINK.o=$(LINK.cc)
-
-BINARIES=trusty_keymaster_device_test
-
-ifdef TRUSTY
-BINARIES += trusty_keymaster_device_test
-endif # TRUSTY
-
-.PHONY: coverage memcheck massif clean run
-
-%.run: %
-	./$<
-	touch $@
-
-run: $(BINARIES:=.run)
-
-coverage: coverage.info
-	genhtml coverage.info --output-directory coverage
-
-coverage.info: run
-	lcov --capture --directory=. --output-file coverage.info
-
-%.coverage : %
-	$(MAKE) clean && $(MAKE) $<
-	./$<
-	lcov --capture --directory=. --output-file coverage.info
-	genhtml coverage.info --output-directory coverage
-
-#UNINIT_OPTS=--track-origins=yes
-UNINIT_OPTS=--undef-value-errors=no
-
-MEMCHECK_OPTS=--leak-check=full \
-	--show-reachable=yes \
-	--vgdb=full \
-	$(UNINIT_OPTS) \
-	--error-exitcode=1
-
-MASSIF_OPTS=--tool=massif \
-	--stacks=yes
-
-%.memcheck : %
-	valgrind $(MEMCHECK_OPTS) ./$< && \
-	touch $@
-
-%.massif : %
-	valgrind $(MASSIF_OPTS) --massif-out-file=$@ ./$<
-
-memcheck: $(BINARIES:=.memcheck)
-
-massif: $(BINARIES:=.massif)
-
-trusty_keymaster_device_test: trusty_keymaster_device_test.o \
-	trusty_keymaster_device.o \
-	$(KM)/aead_mode_operation.o \
-	$(KM)/aes_key.o \
-	$(KM)/aes_operation.o \
-	$(KM)/android_keymaster.o \
-	$(KM)/android_keymaster_messages.o \
-	$(KM)/android_keymaster_test_utils.o \
-	$(KM)/android_keymaster_utils.o \
-	$(KM)/asymmetric_key.o \
-	$(KM)/auth_encrypted_key_blob.o \
-	$(KM)/auth_encrypted_key_blob.o \
-	$(KM)/authorization_set.o \
-	$(KM)/ec_key.o \
-	$(KM)/ec_keymaster0_key.cpp \
-	$(KM)/ecdsa_operation.o \
-	$(KM)/hmac_key.o \
-	$(KM)/hmac_operation.o \
-	$(KM)/integrity_assured_key_blob.o \
-	$(KM)/key.o \
-	$(KM)/keymaster0_engine.o \
-	$(KM)/logger.o \
-	$(KM)/ocb.o \
-	$(KM)/ocb_utils.o \
-	$(KM)/openssl_err.o \
-	$(KM)/openssl_utils.o \
-	$(KM)/operation.o \
-	$(KM)/operation_table.o \
-	$(KM)/rsa_key.o \
-	$(KM)/rsa_keymaster0_key.o \
-	$(KM)/rsa_operation.o \
-	$(KM)/serializable.o \
-	$(KM)/soft_keymaster_context.o \
-	$(KM)/symmetric_key.o \
-	$(GTEST)/src/gtest-all.o
-
-$(GTEST)/src/gtest-all.o: CXXFLAGS:=$(subst -Wmissing-declarations,,$(CXXFLAGS))
-ocb.o: CFLAGS=$(CLANG_TEST_DEFINE)
-
-clean:
-	rm -f $(OBJS) $(DEPS) $(GCDA) $(GCNO) $(BINARIES) \
-		$(BINARIES:=.run) $(BINARIES:=.memcheck) $(BINARIES:=.massif) \
-		coverage.info
-	rm -rf coverage
-
--include $(CPPSRCS:.cpp=.d)
--include $(CCSRCS:.cc=.d)
-
diff --git a/trusty/keymaster/legacy/module.cpp b/trusty/keymaster/legacy/module.cpp
deleted file mode 100644
index 7aa1a4e..0000000
--- a/trusty/keymaster/legacy/module.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-#include <errno.h>
-#include <string.h>
-
-#include <hardware/hardware.h>
-#include <hardware/keymaster0.h>
-
-#include <trusty_keymaster/legacy/trusty_keymaster_device.h>
-
-using keymaster::TrustyKeymasterDevice;
-
-/*
- * Generic device handling
- */
-static int trusty_keymaster_open(const hw_module_t* module, const char* name,
-                                 hw_device_t** device) {
-    if (strcmp(name, KEYSTORE_KEYMASTER) != 0) {
-        return -EINVAL;
-    }
-
-    TrustyKeymasterDevice* dev = new TrustyKeymasterDevice(module);
-    if (dev == NULL) {
-        return -ENOMEM;
-    }
-    *device = dev->hw_device();
-    // Do not delete dev; it will get cleaned up when the caller calls device->close(), and must
-    // exist until then.
-    return 0;
-}
-
-static struct hw_module_methods_t keystore_module_methods = {
-        .open = trusty_keymaster_open,
-};
-
-struct keystore_module HAL_MODULE_INFO_SYM __attribute__((visibility("default"))) = {
-        .common =
-                {
-                        .tag = HARDWARE_MODULE_TAG,
-                        .module_api_version = KEYMASTER_MODULE_API_VERSION_2_0,
-                        .hal_api_version = HARDWARE_HAL_API_VERSION,
-                        .id = KEYSTORE_HARDWARE_MODULE_ID,
-                        .name = "Trusty Keymaster HAL",
-                        .author = "The Android Open Source Project",
-                        .methods = &keystore_module_methods,
-                        .dso = 0,
-                        .reserved = {},
-                },
-};
diff --git a/trusty/keymaster/legacy/trusty_keymaster_device.cpp b/trusty/keymaster/legacy/trusty_keymaster_device.cpp
deleted file mode 100644
index 88c3e7b..0000000
--- a/trusty/keymaster/legacy/trusty_keymaster_device.cpp
+++ /dev/null
@@ -1,761 +0,0 @@
-/*
- * Copyright 2014 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.
- */
-
-#define LOG_TAG "TrustyKeymaster"
-
-#include <assert.h>
-#include <errno.h>
-#include <openssl/evp.h>
-#include <openssl/x509.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <algorithm>
-#include <type_traits>
-
-#include <hardware/keymaster2.h>
-#include <keymaster/authorization_set.h>
-#include <log/log.h>
-
-#include <trusty_keymaster/ipc/keymaster_ipc.h>
-#include <trusty_keymaster/ipc/trusty_keymaster_ipc.h>
-#include <trusty_keymaster/legacy/trusty_keymaster_device.h>
-
-const size_t kMaximumAttestationChallengeLength = 128;
-const size_t kMaximumFinishInputLength = 2048;
-
-namespace keymaster {
-
-TrustyKeymasterDevice::TrustyKeymasterDevice(const hw_module_t* module) {
-    static_assert(std::is_standard_layout<TrustyKeymasterDevice>::value,
-                  "TrustyKeymasterDevice must be standard layout");
-    static_assert(offsetof(TrustyKeymasterDevice, device_) == 0,
-                  "device_ must be the first member of TrustyKeymasterDevice");
-    static_assert(offsetof(TrustyKeymasterDevice, device_.common) == 0,
-                  "common must be the first member of keymaster2_device");
-
-    ALOGI("Creating device");
-    ALOGD("Device address: %p", this);
-
-    device_ = {};
-
-    device_.common.tag = HARDWARE_DEVICE_TAG;
-    device_.common.version = 1;
-    device_.common.module = const_cast<hw_module_t*>(module);
-    device_.common.close = close_device;
-
-    device_.flags = KEYMASTER_SUPPORTS_EC;
-
-    device_.configure = configure;
-    device_.add_rng_entropy = add_rng_entropy;
-    device_.generate_key = generate_key;
-    device_.get_key_characteristics = get_key_characteristics;
-    device_.import_key = import_key;
-    device_.export_key = export_key;
-    device_.attest_key = attest_key;
-    device_.upgrade_key = upgrade_key;
-    device_.delete_key = delete_key;
-    device_.delete_all_keys = delete_all_keys;
-    device_.begin = begin;
-    device_.update = update;
-    device_.finish = finish;
-    device_.abort = abort;
-
-    int rc = trusty_keymaster_connect();
-    error_ = translate_error(rc);
-    if (rc < 0) {
-        ALOGE("failed to connect to keymaster (%d)", rc);
-        return;
-    }
-
-    GetVersionRequest version_request;
-    GetVersionResponse version_response;
-    error_ = trusty_keymaster_send(KM_GET_VERSION, version_request, &version_response);
-    if (error_ == KM_ERROR_INVALID_ARGUMENT || error_ == KM_ERROR_UNIMPLEMENTED) {
-        ALOGE("\"Bad parameters\" error on GetVersion call.  Version 0 is not supported.");
-        error_ = KM_ERROR_VERSION_MISMATCH;
-        return;
-    }
-    message_version_ = MessageVersion(version_response.major_ver, version_response.minor_ver,
-                                      version_response.subminor_ver);
-    if (message_version_ < 0) {
-        // Can't translate version?  Keymaster implementation must be newer.
-        ALOGE("Keymaster version %d.%d.%d not supported.", version_response.major_ver,
-              version_response.minor_ver, version_response.subminor_ver);
-        error_ = KM_ERROR_VERSION_MISMATCH;
-    }
-}
-
-TrustyKeymasterDevice::~TrustyKeymasterDevice() {
-    trusty_keymaster_disconnect();
-}
-
-namespace {
-
-// Allocates a new buffer with malloc and copies the contents of |buffer| to it. Caller takes
-// ownership of the returned buffer.
-uint8_t* DuplicateBuffer(const uint8_t* buffer, size_t size) {
-    uint8_t* tmp = reinterpret_cast<uint8_t*>(malloc(size));
-    if (tmp) {
-        memcpy(tmp, buffer, size);
-    }
-    return tmp;
-}
-
-template <typename RequestType>
-void AddClientAndAppData(const keymaster_blob_t* client_id, const keymaster_blob_t* app_data,
-                         RequestType* request) {
-    request->additional_params.Clear();
-    if (client_id && client_id->data_length > 0) {
-        request->additional_params.push_back(TAG_APPLICATION_ID, *client_id);
-    }
-    if (app_data && app_data->data_length > 0) {
-        request->additional_params.push_back(TAG_APPLICATION_DATA, *app_data);
-    }
-}
-
-}  //  unnamed namespace
-
-keymaster_error_t TrustyKeymasterDevice::configure(const keymaster_key_param_set_t* params) {
-    ALOGD("Device received configure\n");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!params) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-
-    AuthorizationSet params_copy(*params);
-    ConfigureRequest request(message_version_);
-    if (!params_copy.GetTagValue(TAG_OS_VERSION, &request.os_version) ||
-        !params_copy.GetTagValue(TAG_OS_PATCHLEVEL, &request.os_patchlevel)) {
-        ALOGD("Configuration parameters must contain OS version and patch level");
-        return KM_ERROR_INVALID_ARGUMENT;
-    }
-
-    ConfigureResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_CONFIGURE, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::add_rng_entropy(const uint8_t* data, size_t data_length) {
-    ALOGD("Device received add_rng_entropy");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-
-    AddEntropyRequest request(message_version_);
-    request.random_data.Reinitialize(data, data_length);
-    AddEntropyResponse response(message_version_);
-    return trusty_keymaster_send(KM_ADD_RNG_ENTROPY, request, &response);
-}
-
-keymaster_error_t TrustyKeymasterDevice::generate_key(
-        const keymaster_key_param_set_t* params, keymaster_key_blob_t* key_blob,
-        keymaster_key_characteristics_t* characteristics) {
-    ALOGD("Device received generate_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!params) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!key_blob) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    GenerateKeyRequest request(message_version_);
-    request.key_description.Reinitialize(*params);
-    request.key_description.push_back(TAG_CREATION_DATETIME, java_time(time(NULL)));
-
-    GenerateKeyResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_GENERATE_KEY, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    key_blob->key_material_size = response.key_blob.key_material_size;
-    key_blob->key_material =
-            DuplicateBuffer(response.key_blob.key_material, response.key_blob.key_material_size);
-    if (!key_blob->key_material) {
-        return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-    }
-
-    if (characteristics) {
-        response.enforced.CopyToParamSet(&characteristics->hw_enforced);
-        response.unenforced.CopyToParamSet(&characteristics->sw_enforced);
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::get_key_characteristics(
-        const keymaster_key_blob_t* key_blob, const keymaster_blob_t* client_id,
-        const keymaster_blob_t* app_data, keymaster_key_characteristics_t* characteristics) {
-    ALOGD("Device received get_key_characteristics");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!key_blob || !key_blob->key_material) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!characteristics) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    GetKeyCharacteristicsRequest request(message_version_);
-    request.SetKeyMaterial(*key_blob);
-    AddClientAndAppData(client_id, app_data, &request);
-
-    GetKeyCharacteristicsResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_GET_KEY_CHARACTERISTICS, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    response.enforced.CopyToParamSet(&characteristics->hw_enforced);
-    response.unenforced.CopyToParamSet(&characteristics->sw_enforced);
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::import_key(
-        const keymaster_key_param_set_t* params, keymaster_key_format_t key_format,
-        const keymaster_blob_t* key_data, keymaster_key_blob_t* key_blob,
-        keymaster_key_characteristics_t* characteristics) {
-    ALOGD("Device received import_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!params || !key_data) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!key_blob) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    ImportKeyRequest request(message_version_);
-    request.key_description.Reinitialize(*params);
-    request.key_description.push_back(TAG_CREATION_DATETIME, java_time(time(NULL)));
-
-    request.key_format = key_format;
-    request.SetKeyMaterial(key_data->data, key_data->data_length);
-
-    ImportKeyResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_IMPORT_KEY, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    key_blob->key_material_size = response.key_blob.key_material_size;
-    key_blob->key_material =
-            DuplicateBuffer(response.key_blob.key_material, response.key_blob.key_material_size);
-    if (!key_blob->key_material) {
-        return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-    }
-
-    if (characteristics) {
-        response.enforced.CopyToParamSet(&characteristics->hw_enforced);
-        response.unenforced.CopyToParamSet(&characteristics->sw_enforced);
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::export_key(keymaster_key_format_t export_format,
-                                                    const keymaster_key_blob_t* key_to_export,
-                                                    const keymaster_blob_t* client_id,
-                                                    const keymaster_blob_t* app_data,
-                                                    keymaster_blob_t* export_data) {
-    ALOGD("Device received export_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!key_to_export || !key_to_export->key_material) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!export_data) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    export_data->data = nullptr;
-    export_data->data_length = 0;
-
-    ExportKeyRequest request(message_version_);
-    request.key_format = export_format;
-    request.SetKeyMaterial(*key_to_export);
-    AddClientAndAppData(client_id, app_data, &request);
-
-    ExportKeyResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_EXPORT_KEY, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    export_data->data_length = response.key_data_length;
-    export_data->data = DuplicateBuffer(response.key_data, response.key_data_length);
-    if (!export_data->data) {
-        return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::attest_key(const keymaster_key_blob_t* key_to_attest,
-                                                    const keymaster_key_param_set_t* attest_params,
-                                                    keymaster_cert_chain_t* cert_chain) {
-    ALOGD("Device received attest_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!key_to_attest || !attest_params) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!cert_chain) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    cert_chain->entry_count = 0;
-    cert_chain->entries = nullptr;
-
-    AttestKeyRequest request(message_version_);
-    request.SetKeyMaterial(*key_to_attest);
-    request.attest_params.Reinitialize(*attest_params);
-
-    keymaster_blob_t attestation_challenge = {};
-    request.attest_params.GetTagValue(TAG_ATTESTATION_CHALLENGE, &attestation_challenge);
-    if (attestation_challenge.data_length > kMaximumAttestationChallengeLength) {
-        ALOGE("%zu-byte attestation challenge; only %zu bytes allowed",
-              attestation_challenge.data_length, kMaximumAttestationChallengeLength);
-        return KM_ERROR_INVALID_INPUT_LENGTH;
-    }
-
-    AttestKeyResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_ATTEST_KEY, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    // Allocate and clear storage for cert_chain.
-    keymaster_cert_chain_t& rsp_chain = response.certificate_chain;
-    cert_chain->entries = reinterpret_cast<keymaster_blob_t*>(
-            malloc(rsp_chain.entry_count * sizeof(*cert_chain->entries)));
-    if (!cert_chain->entries) {
-        return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-    }
-    cert_chain->entry_count = rsp_chain.entry_count;
-    for (keymaster_blob_t& entry : array_range(cert_chain->entries, cert_chain->entry_count)) {
-        entry = {};
-    }
-
-    // Copy cert_chain contents
-    size_t i = 0;
-    for (keymaster_blob_t& entry : array_range(rsp_chain.entries, rsp_chain.entry_count)) {
-        cert_chain->entries[i].data = DuplicateBuffer(entry.data, entry.data_length);
-        if (!cert_chain->entries[i].data) {
-            keymaster_free_cert_chain(cert_chain);
-            return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-        }
-        cert_chain->entries[i].data_length = entry.data_length;
-        ++i;
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::upgrade_key(
-        const keymaster_key_blob_t* key_to_upgrade, const keymaster_key_param_set_t* upgrade_params,
-        keymaster_key_blob_t* upgraded_key) {
-    ALOGD("Device received upgrade_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!key_to_upgrade || !upgrade_params) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!upgraded_key) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    UpgradeKeyRequest request(message_version_);
-    request.SetKeyMaterial(*key_to_upgrade);
-    request.upgrade_params.Reinitialize(*upgrade_params);
-
-    UpgradeKeyResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_UPGRADE_KEY, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    upgraded_key->key_material_size = response.upgraded_key.key_material_size;
-    upgraded_key->key_material = DuplicateBuffer(response.upgraded_key.key_material,
-                                                 response.upgraded_key.key_material_size);
-    if (!upgraded_key->key_material) {
-        return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::begin(keymaster_purpose_t purpose,
-                                               const keymaster_key_blob_t* key,
-                                               const keymaster_key_param_set_t* in_params,
-                                               keymaster_key_param_set_t* out_params,
-                                               keymaster_operation_handle_t* operation_handle) {
-    ALOGD("Device received begin");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!key || !key->key_material) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!operation_handle) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    if (out_params) {
-        *out_params = {};
-    }
-
-    BeginOperationRequest request(message_version_);
-    request.purpose = purpose;
-    request.SetKeyMaterial(*key);
-    request.additional_params.Reinitialize(*in_params);
-
-    BeginOperationResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_BEGIN_OPERATION, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    if (response.output_params.size() > 0) {
-        if (out_params) {
-            response.output_params.CopyToParamSet(out_params);
-        } else {
-            return KM_ERROR_OUTPUT_PARAMETER_NULL;
-        }
-    }
-    *operation_handle = response.op_handle;
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::update(keymaster_operation_handle_t operation_handle,
-                                                const keymaster_key_param_set_t* in_params,
-                                                const keymaster_blob_t* input,
-                                                size_t* input_consumed,
-                                                keymaster_key_param_set_t* out_params,
-                                                keymaster_blob_t* output) {
-    ALOGD("Device received update");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (!input) {
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-    }
-    if (!input_consumed) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    if (out_params) {
-        *out_params = {};
-    }
-    if (output) {
-        *output = {};
-    }
-
-    UpdateOperationRequest request(message_version_);
-    request.op_handle = operation_handle;
-    if (in_params) {
-        request.additional_params.Reinitialize(*in_params);
-    }
-    if (input && input->data_length > 0) {
-        size_t max_input_size = TRUSTY_KEYMASTER_SEND_BUF_SIZE - request.SerializedSize();
-        request.input.Reinitialize(input->data, std::min(input->data_length, max_input_size));
-    }
-
-    UpdateOperationResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_UPDATE_OPERATION, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    if (response.output_params.size() > 0) {
-        if (out_params) {
-            response.output_params.CopyToParamSet(out_params);
-        } else {
-            return KM_ERROR_OUTPUT_PARAMETER_NULL;
-        }
-    }
-    *input_consumed = response.input_consumed;
-    if (output) {
-        output->data_length = response.output.available_read();
-        output->data = DuplicateBuffer(response.output.peek_read(), output->data_length);
-        if (!output->data) {
-            return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-        }
-    } else if (response.output.available_read() > 0) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::finish(keymaster_operation_handle_t operation_handle,
-                                                const keymaster_key_param_set_t* in_params,
-                                                const keymaster_blob_t* input,
-                                                const keymaster_blob_t* signature,
-                                                keymaster_key_param_set_t* out_params,
-                                                keymaster_blob_t* output) {
-    ALOGD("Device received finish");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-    if (input && input->data_length > kMaximumFinishInputLength) {
-        ALOGE("%zu-byte input to finish; only %zu bytes allowed", input->data_length,
-              kMaximumFinishInputLength);
-        return KM_ERROR_INVALID_INPUT_LENGTH;
-    }
-
-    if (out_params) {
-        *out_params = {};
-    }
-    if (output) {
-        *output = {};
-    }
-
-    FinishOperationRequest request(message_version_);
-    request.op_handle = operation_handle;
-    if (signature && signature->data && signature->data_length > 0) {
-        request.signature.Reinitialize(signature->data, signature->data_length);
-    }
-    if (input && input->data && input->data_length) {
-        request.input.Reinitialize(input->data, input->data_length);
-    }
-    if (in_params) {
-        request.additional_params.Reinitialize(*in_params);
-    }
-
-    FinishOperationResponse response(message_version_);
-    keymaster_error_t err = trusty_keymaster_send(KM_FINISH_OPERATION, request, &response);
-    if (err != KM_ERROR_OK) {
-        return err;
-    }
-
-    if (response.output_params.size() > 0) {
-        if (out_params) {
-            response.output_params.CopyToParamSet(out_params);
-        } else {
-            return KM_ERROR_OUTPUT_PARAMETER_NULL;
-        }
-    }
-    if (output) {
-        output->data_length = response.output.available_read();
-        output->data = DuplicateBuffer(response.output.peek_read(), output->data_length);
-        if (!output->data) {
-            return KM_ERROR_MEMORY_ALLOCATION_FAILED;
-        }
-    } else if (response.output.available_read() > 0) {
-        return KM_ERROR_OUTPUT_PARAMETER_NULL;
-    }
-
-    return KM_ERROR_OK;
-}
-
-keymaster_error_t TrustyKeymasterDevice::abort(keymaster_operation_handle_t operation_handle) {
-    ALOGD("Device received abort");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-
-    AbortOperationRequest request(message_version_);
-    request.op_handle = operation_handle;
-    AbortOperationResponse response(message_version_);
-    return trusty_keymaster_send(KM_ABORT_OPERATION, request, &response);
-}
-
-keymaster_error_t TrustyKeymasterDevice::delete_key(const keymaster_key_blob_t* key) {
-    ALOGD("Device received delete_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-
-    if (!key || !key->key_material)
-        return KM_ERROR_UNEXPECTED_NULL_POINTER;
-
-    DeleteKeyRequest request(message_version_);
-    request.SetKeyMaterial(*key);
-    DeleteKeyResponse response(message_version_);
-    return trusty_keymaster_send(KM_DELETE_KEY, request, &response);
-}
-
-keymaster_error_t TrustyKeymasterDevice::delete_all_keys() {
-    ALOGD("Device received delete_all_key");
-
-    if (error_ != KM_ERROR_OK) {
-        return error_;
-    }
-
-    DeleteAllKeysRequest request(message_version_);
-    DeleteAllKeysResponse response(message_version_);
-    return trusty_keymaster_send(KM_DELETE_ALL_KEYS, request, &response);
-}
-
-hw_device_t* TrustyKeymasterDevice::hw_device() {
-    return &device_.common;
-}
-
-static inline TrustyKeymasterDevice* convert_device(const keymaster2_device_t* dev) {
-    return reinterpret_cast<TrustyKeymasterDevice*>(const_cast<keymaster2_device_t*>(dev));
-}
-
-/* static */
-int TrustyKeymasterDevice::close_device(hw_device_t* dev) {
-    delete reinterpret_cast<TrustyKeymasterDevice*>(dev);
-    return 0;
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::configure(const keymaster2_device_t* dev,
-                                                   const keymaster_key_param_set_t* params) {
-    return convert_device(dev)->configure(params);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::add_rng_entropy(const keymaster2_device_t* dev,
-                                                         const uint8_t* data, size_t data_length) {
-    return convert_device(dev)->add_rng_entropy(data, data_length);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::generate_key(
-        const keymaster2_device_t* dev, const keymaster_key_param_set_t* params,
-        keymaster_key_blob_t* key_blob, keymaster_key_characteristics_t* characteristics) {
-    return convert_device(dev)->generate_key(params, key_blob, characteristics);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::get_key_characteristics(
-        const keymaster2_device_t* dev, const keymaster_key_blob_t* key_blob,
-        const keymaster_blob_t* client_id, const keymaster_blob_t* app_data,
-        keymaster_key_characteristics_t* characteristics) {
-    return convert_device(dev)->get_key_characteristics(key_blob, client_id, app_data,
-                                                        characteristics);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::import_key(
-        const keymaster2_device_t* dev, const keymaster_key_param_set_t* params,
-        keymaster_key_format_t key_format, const keymaster_blob_t* key_data,
-        keymaster_key_blob_t* key_blob, keymaster_key_characteristics_t* characteristics) {
-    return convert_device(dev)->import_key(params, key_format, key_data, key_blob, characteristics);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::export_key(const keymaster2_device_t* dev,
-                                                    keymaster_key_format_t export_format,
-                                                    const keymaster_key_blob_t* key_to_export,
-                                                    const keymaster_blob_t* client_id,
-                                                    const keymaster_blob_t* app_data,
-                                                    keymaster_blob_t* export_data) {
-    return convert_device(dev)->export_key(export_format, key_to_export, client_id, app_data,
-                                           export_data);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::attest_key(const keymaster2_device_t* dev,
-                                                    const keymaster_key_blob_t* key_to_attest,
-                                                    const keymaster_key_param_set_t* attest_params,
-                                                    keymaster_cert_chain_t* cert_chain) {
-    return convert_device(dev)->attest_key(key_to_attest, attest_params, cert_chain);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::upgrade_key(
-        const keymaster2_device_t* dev, const keymaster_key_blob_t* key_to_upgrade,
-        const keymaster_key_param_set_t* upgrade_params, keymaster_key_blob_t* upgraded_key) {
-    return convert_device(dev)->upgrade_key(key_to_upgrade, upgrade_params, upgraded_key);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::begin(const keymaster2_device_t* dev,
-                                               keymaster_purpose_t purpose,
-                                               const keymaster_key_blob_t* key,
-                                               const keymaster_key_param_set_t* in_params,
-                                               keymaster_key_param_set_t* out_params,
-                                               keymaster_operation_handle_t* operation_handle) {
-    return convert_device(dev)->begin(purpose, key, in_params, out_params, operation_handle);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::update(
-        const keymaster2_device_t* dev, keymaster_operation_handle_t operation_handle,
-        const keymaster_key_param_set_t* in_params, const keymaster_blob_t* input,
-        size_t* input_consumed, keymaster_key_param_set_t* out_params, keymaster_blob_t* output) {
-    return convert_device(dev)->update(operation_handle, in_params, input, input_consumed,
-                                       out_params, output);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::finish(const keymaster2_device_t* dev,
-                                                keymaster_operation_handle_t operation_handle,
-                                                const keymaster_key_param_set_t* in_params,
-                                                const keymaster_blob_t* input,
-                                                const keymaster_blob_t* signature,
-                                                keymaster_key_param_set_t* out_params,
-                                                keymaster_blob_t* output) {
-    return convert_device(dev)->finish(operation_handle, in_params, input, signature, out_params,
-                                       output);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::abort(const keymaster2_device_t* dev,
-                                               keymaster_operation_handle_t operation_handle) {
-    return convert_device(dev)->abort(operation_handle);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::delete_key(const keymaster2_device_t* dev,
-                                               const keymaster_key_blob_t* key) {
-   return convert_device(dev)->delete_key(key);
-}
-
-/* static */
-keymaster_error_t TrustyKeymasterDevice::delete_all_keys(const keymaster2_device_t* dev) {
-   return convert_device(dev)->delete_all_keys();
-}
-
-}  // namespace keymaster
diff --git a/trusty/keymaster/legacy/trusty_keymaster_device_test.cpp b/trusty/keymaster/legacy/trusty_keymaster_device_test.cpp
deleted file mode 100644
index 68def58..0000000
--- a/trusty/keymaster/legacy/trusty_keymaster_device_test.cpp
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-#include <algorithm>
-#include <fstream>
-#include <memory>
-
-#include <gtest/gtest.h>
-#include <openssl/engine.h>
-
-#include <hardware/keymaster0.h>
-
-#include <keymaster/android_keymaster.h>
-#include <keymaster/android_keymaster_messages.h>
-#include <keymaster/android_keymaster_utils.h>
-#include <keymaster/keymaster_tags.h>
-#include <keymaster/soft_keymaster_context.h>
-
-#include <trusty_keymaster/legacy/trusty_keymaster_device.h>
-#include "android_keymaster_test_utils.h"
-#include "openssl_utils.h"
-
-using std::ifstream;
-using std::istreambuf_iterator;
-using std::string;
-
-static keymaster::AndroidKeymaster* impl_ = nullptr;
-
-extern "C" {
-int __android_log_print();
-}
-
-int __android_log_print() {
-    return 0;
-}
-
-int main(int argc, char** argv) {
-    ::testing::InitGoogleTest(&argc, argv);
-    int result = RUN_ALL_TESTS();
-    // Clean up stuff OpenSSL leaves around, so Valgrind doesn't complain.
-    CRYPTO_cleanup_all_ex_data();
-    ERR_free_strings();
-    return result;
-}
-
-int trusty_keymaster_connect() {
-    impl_ = new keymaster::AndroidKeymaster(new keymaster::SoftKeymasterContext(nullptr), 16);
-}
-
-void trusty_keymaster_disconnect() {
-    delete static_cast<keymaster::AndroidKeymaster*>(priv_);
-}
-
-template <typename Req, typename Rsp>
-static int fake_call(keymaster::AndroidKeymaster* device,
-                     void (keymaster::AndroidKeymaster::*method)(const Req&, Rsp*), void* in_buf,
-                     uint32_t in_size, void* out_buf, uint32_t* out_size) {
-    Req req;
-    const uint8_t* in = static_cast<uint8_t*>(in_buf);
-    req.Deserialize(&in, in + in_size);
-    Rsp rsp;
-    (device->*method)(req, &rsp);
-
-    *out_size = rsp.SerializedSize();
-    uint8_t* out = static_cast<uint8_t*>(out_buf);
-    rsp.Serialize(out, out + *out_size);
-    return 0;
-}
-
-int trusty_keymaster_call(uint32_t cmd, void* in_buf, uint32_t in_size, void* out_buf,
-                          uint32_t* out_size) {
-    switch (cmd) {
-        case KM_GENERATE_KEY:
-            return fake_call(impl_, &keymaster::AndroidKeymaster::GenerateKey, in_buf, in_size,
-                             out_buf, out_size);
-        case KM_BEGIN_OPERATION:
-            return fake_call(impl_, &keymaster::AndroidKeymaster::BeginOperation, in_buf, in_size,
-                             out_buf, out_size);
-        case KM_UPDATE_OPERATION:
-            return fake_call(impl_, &keymaster::AndroidKeymaster::UpdateOperation, in_buf, in_size,
-                             out_buf, out_size);
-        case KM_FINISH_OPERATION:
-            return fake_call(impl_, &keymaster::AndroidKeymaster::FinishOperation, in_buf, in_size,
-                             out_buf, out_size);
-        case KM_IMPORT_KEY:
-            return fake_call(impl_, &keymaster::AndroidKeymaster::ImportKey, in_buf, in_size,
-                             out_buf, out_size);
-        case KM_EXPORT_KEY:
-            return fake_call(impl_, &keymaster::AndroidKeymaster::ExportKey, in_buf, in_size,
-                             out_buf, out_size);
-    }
-    return -EINVAL;
-}
-
-namespace keymaster {
-namespace test {
-
-class TrustyKeymasterTest : public testing::Test {
-  protected:
-    TrustyKeymasterTest() : device(NULL) {}
-
-    keymaster_rsa_keygen_params_t build_rsa_params() {
-        keymaster_rsa_keygen_params_t rsa_params;
-        rsa_params.public_exponent = 65537;
-        rsa_params.modulus_size = 2048;
-        return rsa_params;
-    }
-
-    uint8_t* build_message(size_t length) {
-        uint8_t* msg = new uint8_t[length];
-        memset(msg, 'a', length);
-        return msg;
-    }
-
-    size_t dsa_message_len(const keymaster_dsa_keygen_params_t& params) {
-        switch (params.key_size) {
-            case 256:
-            case 1024:
-                return 48;
-            case 2048:
-            case 4096:
-                return 72;
-            default:
-                // Oops.
-                return 0;
-        }
-    }
-
-    TrustyKeymasterDevice device;
-};
-
-class Malloc_Delete {
-  public:
-    Malloc_Delete(void* p) : p_(p) {}
-    ~Malloc_Delete() { free(p_); }
-
-  private:
-    void* p_;
-};
-
-typedef TrustyKeymasterTest KeyGenTest;
-TEST_F(KeyGenTest, RsaSuccess) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-}
-
-TEST_F(KeyGenTest, EcdsaSuccess) {
-    keymaster_ec_keygen_params_t ec_params = {256};
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &ec_params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-}
-
-typedef TrustyKeymasterTest SigningTest;
-TEST_F(SigningTest, RsaSuccess) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(message_len, siglen);
-}
-
-TEST_F(SigningTest, RsaShortMessage) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8 - 1;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_UNKNOWN_ERROR, device.sign_data(&sig_params, ptr, size, message.get(),
-                                                       message_len, &signature, &siglen));
-}
-
-TEST_F(SigningTest, RsaLongMessage) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8 + 1;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_UNKNOWN_ERROR, device.sign_data(&sig_params, ptr, size, message.get(),
-                                                       message_len, &signature, &siglen));
-}
-
-TEST_F(SigningTest, EcdsaSuccess) {
-    keymaster_ec_keygen_params_t params = {256};
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    uint8_t message[] = "12345678901234567890123456789012";
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message,
-                                            array_size(message) - 1, &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_GT(siglen, 69U);
-    EXPECT_LT(siglen, 73U);
-}
-
-TEST_F(SigningTest, EcdsaEmptyMessageSuccess) {
-    keymaster_ec_keygen_params_t params = {256};
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    uint8_t message[] = "";
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message,
-                                            array_size(message) - 1, &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_GT(siglen, 69U);
-    EXPECT_LT(siglen, 73U);
-}
-
-TEST_F(SigningTest, EcdsaLargeMessageSuccess) {
-    keymaster_ec_keygen_params_t params = {256};
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    size_t message_len = 1024 * 7;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_len]);
-    // contents of message don't matter.
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_GT(siglen, 69U);
-    EXPECT_LT(siglen, 73U);
-}
-
-typedef TrustyKeymasterTest VerificationTest;
-TEST_F(VerificationTest, RsaSuccess) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-
-    EXPECT_EQ(KM_ERROR_OK, device.verify_data(&sig_params, ptr, size, message.get(), message_len,
-                                              signature, siglen));
-}
-
-TEST_F(VerificationTest, RsaBadSignature) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-
-    Malloc_Delete sig_deleter(signature);
-    signature[siglen / 2]++;
-    EXPECT_EQ(KM_ERROR_VERIFICATION_FAILED,
-              device.verify_data(&sig_params, ptr, size, message.get(), message_len, signature,
-                                 siglen));
-}
-
-TEST_F(VerificationTest, RsaBadMessage) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    message[0]++;
-    EXPECT_EQ(KM_ERROR_VERIFICATION_FAILED,
-              device.verify_data(&sig_params, ptr, size, message.get(), message_len, signature,
-                                 siglen));
-}
-
-TEST_F(VerificationTest, RsaShortMessage) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_INVALID_INPUT_LENGTH,
-              device.verify_data(&sig_params, ptr, size, message.get(), message_len - 1, signature,
-                                 siglen));
-}
-
-TEST_F(VerificationTest, RsaLongMessage) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len + 1));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_INVALID_INPUT_LENGTH,
-              device.verify_data(&sig_params, ptr, size, message.get(), message_len + 1, signature,
-                                 siglen));
-}
-
-TEST_F(VerificationTest, EcdsaSuccess) {
-    keymaster_ec_keygen_params_t params = {256};
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    uint8_t message[] = "12345678901234567890123456789012";
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message,
-                                            array_size(message) - 1, &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_OK, device.verify_data(&sig_params, ptr, size, message,
-                                              array_size(message) - 1, signature, siglen));
-}
-
-TEST_F(VerificationTest, EcdsaLargeMessageSuccess) {
-    keymaster_ec_keygen_params_t params = {256};
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    size_t message_len = 1024 * 7;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_len]);
-    // contents of message don't matter.
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_OK, device.verify_data(&sig_params, ptr, size, message.get(), message_len,
-                                              signature, siglen));
-}
-
-static string read_file(const string& file_name) {
-    ifstream file_stream(file_name, std::ios::binary);
-    istreambuf_iterator<char> file_begin(file_stream);
-    istreambuf_iterator<char> file_end;
-    return string(file_begin, file_end);
-}
-
-typedef TrustyKeymasterTest ImportKeyTest;
-TEST_F(ImportKeyTest, RsaSuccess) {
-    string pk8_key = read_file("../../../../system/keymaster/rsa_privkey_pk8.der");
-    ASSERT_EQ(633U, pk8_key.size());
-
-    uint8_t* key = NULL;
-    size_t size;
-    ASSERT_EQ(KM_ERROR_OK, device.import_keypair(reinterpret_cast<const uint8_t*>(pk8_key.data()),
-                                                 pk8_key.size(), &key, &size));
-    Malloc_Delete key_deleter(key);
-
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_size = 1024 /* key size */ / 8;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_size]);
-    memset(message.get(), 'a', message_size);
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, key, size, message.get(), message_size,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_OK, device.verify_data(&sig_params, key, size, message.get(), message_size,
-                                              signature, siglen));
-}
-
-TEST_F(ImportKeyTest, EcdsaSuccess) {
-    string pk8_key = read_file("../../../../system/keymaster/ec_privkey_pk8.der");
-    ASSERT_EQ(138U, pk8_key.size());
-
-    uint8_t* key = NULL;
-    size_t size;
-    ASSERT_EQ(KM_ERROR_OK, device.import_keypair(reinterpret_cast<const uint8_t*>(pk8_key.data()),
-                                                 pk8_key.size(), &key, &size));
-    Malloc_Delete key_deleter(key);
-
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    uint8_t message[] = "12345678901234567890123456789012";
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, key, size, message,
-                                            array_size(message) - 1, &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_OK, device.verify_data(&sig_params, key, size, message,
-                                              array_size(message) - 1, signature, siglen));
-}
-
-struct EVP_PKEY_CTX_Delete {
-    void operator()(EVP_PKEY_CTX* p) { EVP_PKEY_CTX_free(p); }
-};
-
-static void VerifySignature(const uint8_t* key, size_t key_len, const uint8_t* signature,
-                            size_t signature_len, const uint8_t* message, size_t message_len) {
-    std::unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(d2i_PUBKEY(NULL, &key, key_len));
-    ASSERT_TRUE(pkey.get() != NULL);
-    std::unique_ptr<EVP_PKEY_CTX, EVP_PKEY_CTX_Delete> ctx(EVP_PKEY_CTX_new(pkey.get(), NULL));
-    ASSERT_TRUE(ctx.get() != NULL);
-    ASSERT_EQ(1, EVP_PKEY_verify_init(ctx.get()));
-    if (EVP_PKEY_type(pkey->type) == EVP_PKEY_RSA)
-        ASSERT_EQ(1, EVP_PKEY_CTX_set_rsa_padding(ctx.get(), RSA_NO_PADDING));
-    EXPECT_EQ(1, EVP_PKEY_verify(ctx.get(), signature, signature_len, message, message_len));
-}
-
-typedef TrustyKeymasterTest ExportKeyTest;
-TEST_F(ExportKeyTest, RsaSuccess) {
-    keymaster_rsa_keygen_params_t params = build_rsa_params();
-    uint8_t* ptr = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_RSA, &params, &ptr, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(ptr);
-
-    uint8_t* exported;
-    size_t exported_size;
-    EXPECT_EQ(KM_ERROR_OK, device.get_keypair_public(ptr, size, &exported, &exported_size));
-    Malloc_Delete exported_deleter(exported);
-
-    // Sign a message so we can verify it with the exported pubkey.
-    keymaster_rsa_sign_params_t sig_params = {DIGEST_NONE, PADDING_NONE};
-    size_t message_len = params.modulus_size / 8;
-    std::unique_ptr<uint8_t[]> message(build_message(message_len));
-    uint8_t* signature;
-    size_t siglen;
-    EXPECT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, ptr, size, message.get(), message_len,
-                                            &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(message_len, siglen);
-    const uint8_t* tmp = exported;
-
-    VerifySignature(exported, exported_size, signature, siglen, message.get(), message_len);
-}
-
-typedef TrustyKeymasterTest ExportKeyTest;
-TEST_F(ExportKeyTest, EcdsaSuccess) {
-    keymaster_ec_keygen_params_t params = {256};
-    uint8_t* key = NULL;
-    size_t size;
-    ASSERT_EQ(0, device.generate_keypair(TYPE_EC, &params, &key, &size));
-    EXPECT_GT(size, 0U);
-    Malloc_Delete key_deleter(key);
-
-    uint8_t* exported;
-    size_t exported_size;
-    EXPECT_EQ(KM_ERROR_OK, device.get_keypair_public(key, size, &exported, &exported_size));
-    Malloc_Delete exported_deleter(exported);
-
-    // Sign a message so we can verify it with the exported pubkey.
-    keymaster_ec_sign_params_t sig_params = {DIGEST_NONE};
-    uint8_t message[] = "12345678901234567890123456789012";
-    uint8_t* signature;
-    size_t siglen;
-    ASSERT_EQ(KM_ERROR_OK, device.sign_data(&sig_params, key, size, message,
-                                            array_size(message) - 1, &signature, &siglen));
-    Malloc_Delete sig_deleter(signature);
-    EXPECT_EQ(KM_ERROR_OK, device.verify_data(&sig_params, key, size, message,
-                                              array_size(message) - 1, signature, siglen));
-
-    VerifySignature(exported, exported_size, signature, siglen, message, array_size(message) - 1);
-}
-
-}  // namespace test
-}  // namespace keymaster
diff --git a/trusty/keymaster/legacy/trusty_keymaster_main.cpp b/trusty/keymaster/legacy/trusty_keymaster_main.cpp
deleted file mode 100644
index e3e70e6..0000000
--- a/trusty/keymaster/legacy/trusty_keymaster_main.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright 2014 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.
- */
-
-#include <keymaster/keymaster_configuration.h>
-
-#include <stdio.h>
-#include <memory>
-
-#include <openssl/evp.h>
-#include <openssl/x509.h>
-
-#include <trusty_keymaster/legacy/trusty_keymaster_device.h>
-
-using keymaster::TrustyKeymasterDevice;
-
-unsigned char rsa_privkey_pk8_der[] = {
-        0x30, 0x82, 0x02, 0x75, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
-        0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x02, 0x5f, 0x30, 0x82, 0x02, 0x5b,
-        0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xc6, 0x09, 0x54, 0x09, 0x04, 0x7d, 0x86, 0x34,
-        0x81, 0x2d, 0x5a, 0x21, 0x81, 0x76, 0xe4, 0x5c, 0x41, 0xd6, 0x0a, 0x75, 0xb1, 0x39, 0x01,
-        0xf2, 0x34, 0x22, 0x6c, 0xff, 0xe7, 0x76, 0x52, 0x1c, 0x5a, 0x77, 0xb9, 0xe3, 0x89, 0x41,
-        0x7b, 0x71, 0xc0, 0xb6, 0xa4, 0x4d, 0x13, 0xaf, 0xe4, 0xe4, 0xa2, 0x80, 0x5d, 0x46, 0xc9,
-        0xda, 0x29, 0x35, 0xad, 0xb1, 0xff, 0x0c, 0x1f, 0x24, 0xea, 0x06, 0xe6, 0x2b, 0x20, 0xd7,
-        0x76, 0x43, 0x0a, 0x4d, 0x43, 0x51, 0x57, 0x23, 0x3c, 0x6f, 0x91, 0x67, 0x83, 0xc3, 0x0e,
-        0x31, 0x0f, 0xcb, 0xd8, 0x9b, 0x85, 0xc2, 0xd5, 0x67, 0x71, 0x16, 0x97, 0x85, 0xac, 0x12,
-        0xbc, 0xa2, 0x44, 0xab, 0xda, 0x72, 0xbf, 0xb1, 0x9f, 0xc4, 0x4d, 0x27, 0xc8, 0x1e, 0x1d,
-        0x92, 0xde, 0x28, 0x4f, 0x40, 0x61, 0xed, 0xfd, 0x99, 0x28, 0x07, 0x45, 0xea, 0x6d, 0x25,
-        0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x1b, 0xe0, 0xf0, 0x4d, 0x9c, 0xae, 0x37,
-        0x18, 0x69, 0x1f, 0x03, 0x53, 0x38, 0x30, 0x8e, 0x91, 0x56, 0x4b, 0x55, 0x89, 0x9f, 0xfb,
-        0x50, 0x84, 0xd2, 0x46, 0x0e, 0x66, 0x30, 0x25, 0x7e, 0x05, 0xb3, 0xce, 0xab, 0x02, 0x97,
-        0x2d, 0xfa, 0xbc, 0xd6, 0xce, 0x5f, 0x6e, 0xe2, 0x58, 0x9e, 0xb6, 0x79, 0x11, 0xed, 0x0f,
-        0xac, 0x16, 0xe4, 0x3a, 0x44, 0x4b, 0x8c, 0x86, 0x1e, 0x54, 0x4a, 0x05, 0x93, 0x36, 0x57,
-        0x72, 0xf8, 0xba, 0xf6, 0xb2, 0x2f, 0xc9, 0xe3, 0xc5, 0xf1, 0x02, 0x4b, 0x06, 0x3a, 0xc0,
-        0x80, 0xa7, 0xb2, 0x23, 0x4c, 0xf8, 0xae, 0xe8, 0xf6, 0xc4, 0x7b, 0xbf, 0x4f, 0xd3, 0xac,
-        0xe7, 0x24, 0x02, 0x90, 0xbe, 0xf1, 0x6c, 0x0b, 0x3f, 0x7f, 0x3c, 0xdd, 0x64, 0xce, 0x3a,
-        0xb5, 0x91, 0x2c, 0xf6, 0xe3, 0x2f, 0x39, 0xab, 0x18, 0x83, 0x58, 0xaf, 0xcc, 0xcd, 0x80,
-        0x81, 0x02, 0x41, 0x00, 0xe4, 0xb4, 0x9e, 0xf5, 0x0f, 0x76, 0x5d, 0x3b, 0x24, 0xdd, 0xe0,
-        0x1a, 0xce, 0xaa, 0xf1, 0x30, 0xf2, 0xc7, 0x66, 0x70, 0xa9, 0x1a, 0x61, 0xae, 0x08, 0xaf,
-        0x49, 0x7b, 0x4a, 0x82, 0xbe, 0x6d, 0xee, 0x8f, 0xcd, 0xd5, 0xe3, 0xf7, 0xba, 0x1c, 0xfb,
-        0x1f, 0x0c, 0x92, 0x6b, 0x88, 0xf8, 0x8c, 0x92, 0xbf, 0xab, 0x13, 0x7f, 0xba, 0x22, 0x85,
-        0x22, 0x7b, 0x83, 0xc3, 0x42, 0xff, 0x7c, 0x55, 0x02, 0x41, 0x00, 0xdd, 0xab, 0xb5, 0x83,
-        0x9c, 0x4c, 0x7f, 0x6b, 0xf3, 0xd4, 0x18, 0x32, 0x31, 0xf0, 0x05, 0xb3, 0x1a, 0xa5, 0x8a,
-        0xff, 0xdd, 0xa5, 0xc7, 0x9e, 0x4c, 0xce, 0x21, 0x7f, 0x6b, 0xc9, 0x30, 0xdb, 0xe5, 0x63,
-        0xd4, 0x80, 0x70, 0x6c, 0x24, 0xe9, 0xeb, 0xfc, 0xab, 0x28, 0xa6, 0xcd, 0xef, 0xd3, 0x24,
-        0xb7, 0x7e, 0x1b, 0xf7, 0x25, 0x1b, 0x70, 0x90, 0x92, 0xc2, 0x4f, 0xf5, 0x01, 0xfd, 0x91,
-        0x02, 0x40, 0x23, 0xd4, 0x34, 0x0e, 0xda, 0x34, 0x45, 0xd8, 0xcd, 0x26, 0xc1, 0x44, 0x11,
-        0xda, 0x6f, 0xdc, 0xa6, 0x3c, 0x1c, 0xcd, 0x4b, 0x80, 0xa9, 0x8a, 0xd5, 0x2b, 0x78, 0xcc,
-        0x8a, 0xd8, 0xbe, 0xb2, 0x84, 0x2c, 0x1d, 0x28, 0x04, 0x05, 0xbc, 0x2f, 0x6c, 0x1b, 0xea,
-        0x21, 0x4a, 0x1d, 0x74, 0x2a, 0xb9, 0x96, 0xb3, 0x5b, 0x63, 0xa8, 0x2a, 0x5e, 0x47, 0x0f,
-        0xa8, 0x8d, 0xbf, 0x82, 0x3c, 0xdd, 0x02, 0x40, 0x1b, 0x7b, 0x57, 0x44, 0x9a, 0xd3, 0x0d,
-        0x15, 0x18, 0x24, 0x9a, 0x5f, 0x56, 0xbb, 0x98, 0x29, 0x4d, 0x4b, 0x6a, 0xc1, 0x2f, 0xfc,
-        0x86, 0x94, 0x04, 0x97, 0xa5, 0xa5, 0x83, 0x7a, 0x6c, 0xf9, 0x46, 0x26, 0x2b, 0x49, 0x45,
-        0x26, 0xd3, 0x28, 0xc1, 0x1e, 0x11, 0x26, 0x38, 0x0f, 0xde, 0x04, 0xc2, 0x4f, 0x91, 0x6d,
-        0xec, 0x25, 0x08, 0x92, 0xdb, 0x09, 0xa6, 0xd7, 0x7c, 0xdb, 0xa3, 0x51, 0x02, 0x40, 0x77,
-        0x62, 0xcd, 0x8f, 0x4d, 0x05, 0x0d, 0xa5, 0x6b, 0xd5, 0x91, 0xad, 0xb5, 0x15, 0xd2, 0x4d,
-        0x7c, 0xcd, 0x32, 0xcc, 0xa0, 0xd0, 0x5f, 0x86, 0x6d, 0x58, 0x35, 0x14, 0xbd, 0x73, 0x24,
-        0xd5, 0xf3, 0x36, 0x45, 0xe8, 0xed, 0x8b, 0x4a, 0x1c, 0xb3, 0xcc, 0x4a, 0x1d, 0x67, 0x98,
-        0x73, 0x99, 0xf2, 0xa0, 0x9f, 0x5b, 0x3f, 0xb6, 0x8c, 0x88, 0xd5, 0xe5, 0xd9, 0x0a, 0xc3,
-        0x34, 0x92, 0xd6};
-unsigned int rsa_privkey_pk8_der_len = 633;
-
-unsigned char dsa_privkey_pk8_der[] = {
-        0x30, 0x82, 0x01, 0x4b, 0x02, 0x01, 0x00, 0x30, 0x82, 0x01, 0x2b, 0x06, 0x07, 0x2a, 0x86,
-        0x48, 0xce, 0x38, 0x04, 0x01, 0x30, 0x82, 0x01, 0x1e, 0x02, 0x81, 0x81, 0x00, 0xa3, 0xf3,
-        0xe9, 0xb6, 0x7e, 0x7d, 0x88, 0xf6, 0xb7, 0xe5, 0xf5, 0x1f, 0x3b, 0xee, 0xac, 0xd7, 0xad,
-        0xbc, 0xc9, 0xd1, 0x5a, 0xf8, 0x88, 0xc4, 0xef, 0x6e, 0x3d, 0x74, 0x19, 0x74, 0xe7, 0xd8,
-        0xe0, 0x26, 0x44, 0x19, 0x86, 0xaf, 0x19, 0xdb, 0x05, 0xe9, 0x3b, 0x8b, 0x58, 0x58, 0xde,
-        0xe5, 0x4f, 0x48, 0x15, 0x01, 0xea, 0xe6, 0x83, 0x52, 0xd7, 0xc1, 0x21, 0xdf, 0xb9, 0xb8,
-        0x07, 0x66, 0x50, 0xfb, 0x3a, 0x0c, 0xb3, 0x85, 0xee, 0xbb, 0x04, 0x5f, 0xc2, 0x6d, 0x6d,
-        0x95, 0xfa, 0x11, 0x93, 0x1e, 0x59, 0x5b, 0xb1, 0x45, 0x8d, 0xe0, 0x3d, 0x73, 0xaa, 0xf2,
-        0x41, 0x14, 0x51, 0x07, 0x72, 0x3d, 0xa2, 0xf7, 0x58, 0xcd, 0x11, 0xa1, 0x32, 0xcf, 0xda,
-        0x42, 0xb7, 0xcc, 0x32, 0x80, 0xdb, 0x87, 0x82, 0xec, 0x42, 0xdb, 0x5a, 0x55, 0x24, 0x24,
-        0xa2, 0xd1, 0x55, 0x29, 0xad, 0xeb, 0x02, 0x15, 0x00, 0xeb, 0xea, 0x17, 0xd2, 0x09, 0xb3,
-        0xd7, 0x21, 0x9a, 0x21, 0x07, 0x82, 0x8f, 0xab, 0xfe, 0x88, 0x71, 0x68, 0xf7, 0xe3, 0x02,
-        0x81, 0x80, 0x19, 0x1c, 0x71, 0xfd, 0xe0, 0x03, 0x0c, 0x43, 0xd9, 0x0b, 0xf6, 0xcd, 0xd6,
-        0xa9, 0x70, 0xe7, 0x37, 0x86, 0x3a, 0x78, 0xe9, 0xa7, 0x47, 0xa7, 0x47, 0x06, 0x88, 0xb1,
-        0xaf, 0xd7, 0xf3, 0xf1, 0xa1, 0xd7, 0x00, 0x61, 0x28, 0x88, 0x31, 0x48, 0x60, 0xd8, 0x11,
-        0xef, 0xa5, 0x24, 0x1a, 0x81, 0xc4, 0x2a, 0xe2, 0xea, 0x0e, 0x36, 0xd2, 0xd2, 0x05, 0x84,
-        0x37, 0xcf, 0x32, 0x7d, 0x09, 0xe6, 0x0f, 0x8b, 0x0c, 0xc8, 0xc2, 0xa4, 0xb1, 0xdc, 0x80,
-        0xca, 0x68, 0xdf, 0xaf, 0xd2, 0x90, 0xc0, 0x37, 0x58, 0x54, 0x36, 0x8f, 0x49, 0xb8, 0x62,
-        0x75, 0x8b, 0x48, 0x47, 0xc0, 0xbe, 0xf7, 0x9a, 0x92, 0xa6, 0x68, 0x05, 0xda, 0x9d, 0xaf,
-        0x72, 0x9a, 0x67, 0xb3, 0xb4, 0x14, 0x03, 0xae, 0x4f, 0x4c, 0x76, 0xb9, 0xd8, 0x64, 0x0a,
-        0xba, 0x3b, 0xa8, 0x00, 0x60, 0x4d, 0xae, 0x81, 0xc3, 0xc5, 0x04, 0x17, 0x02, 0x15, 0x00,
-        0x81, 0x9d, 0xfd, 0x53, 0x0c, 0xc1, 0x8f, 0xbe, 0x8b, 0xea, 0x00, 0x26, 0x19, 0x29, 0x33,
-        0x91, 0x84, 0xbe, 0xad, 0x81};
-unsigned int dsa_privkey_pk8_der_len = 335;
-
-unsigned char ec_privkey_pk8_der[] = {
-        0x30, 0x81, 0x87, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce,
-        0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x04,
-        0x6d, 0x30, 0x6b, 0x02, 0x01, 0x01, 0x04, 0x20, 0x73, 0x7c, 0x2e, 0xcd, 0x7b, 0x8d,
-        0x19, 0x40, 0xbf, 0x29, 0x30, 0xaa, 0x9b, 0x4e, 0xd3, 0xff, 0x94, 0x1e, 0xed, 0x09,
-        0x36, 0x6b, 0xc0, 0x32, 0x99, 0x98, 0x64, 0x81, 0xf3, 0xa4, 0xd8, 0x59, 0xa1, 0x44,
-        0x03, 0x42, 0x00, 0x04, 0xbf, 0x85, 0xd7, 0x72, 0x0d, 0x07, 0xc2, 0x54, 0x61, 0x68,
-        0x3b, 0xc6, 0x48, 0xb4, 0x77, 0x8a, 0x9a, 0x14, 0xdd, 0x8a, 0x02, 0x4e, 0x3b, 0xdd,
-        0x8c, 0x7d, 0xdd, 0x9a, 0xb2, 0xb5, 0x28, 0xbb, 0xc7, 0xaa, 0x1b, 0x51, 0xf1, 0x4e,
-        0xbb, 0xbb, 0x0b, 0xd0, 0xce, 0x21, 0xbc, 0xc4, 0x1c, 0x6e, 0xb0, 0x00, 0x83, 0xcf,
-        0x33, 0x76, 0xd1, 0x1f, 0xd4, 0x49, 0x49, 0xe0, 0xb2, 0x18, 0x3b, 0xfe};
-unsigned int ec_privkey_pk8_der_len = 138;
-
-keymaster_key_param_t ec_params[] = {
-        keymaster_param_enum(KM_TAG_ALGORITHM, KM_ALGORITHM_EC),
-        keymaster_param_long(KM_TAG_EC_CURVE, KM_EC_CURVE_P_521),
-        keymaster_param_enum(KM_TAG_PURPOSE, KM_PURPOSE_SIGN),
-        keymaster_param_enum(KM_TAG_PURPOSE, KM_PURPOSE_VERIFY),
-        keymaster_param_enum(KM_TAG_DIGEST, KM_DIGEST_NONE),
-        keymaster_param_bool(KM_TAG_NO_AUTH_REQUIRED),
-};
-keymaster_key_param_set_t ec_param_set = {ec_params, sizeof(ec_params) / sizeof(*ec_params)};
-
-keymaster_key_param_t rsa_params[] = {
-        keymaster_param_enum(KM_TAG_ALGORITHM, KM_ALGORITHM_RSA),
-        keymaster_param_int(KM_TAG_KEY_SIZE, 1024),
-        keymaster_param_long(KM_TAG_RSA_PUBLIC_EXPONENT, 65537),
-        keymaster_param_enum(KM_TAG_PURPOSE, KM_PURPOSE_SIGN),
-        keymaster_param_enum(KM_TAG_PURPOSE, KM_PURPOSE_VERIFY),
-        keymaster_param_enum(KM_TAG_PADDING, KM_PAD_NONE),
-        keymaster_param_enum(KM_TAG_DIGEST, KM_DIGEST_NONE),
-        keymaster_param_bool(KM_TAG_NO_AUTH_REQUIRED),
-};
-keymaster_key_param_set_t rsa_param_set = {rsa_params, sizeof(rsa_params) / sizeof(*rsa_params)};
-
-struct EVP_PKEY_Delete {
-    void operator()(EVP_PKEY* p) const { EVP_PKEY_free(p); }
-};
-
-struct EVP_PKEY_CTX_Delete {
-    void operator()(EVP_PKEY_CTX* p) { EVP_PKEY_CTX_free(p); }
-};
-
-static bool do_operation(TrustyKeymasterDevice* device, keymaster_purpose_t purpose,
-                         keymaster_key_blob_t* key, keymaster_blob_t* input,
-                         keymaster_blob_t* signature, keymaster_blob_t* output) {
-    keymaster_key_param_t params[] = {
-            keymaster_param_enum(KM_TAG_PADDING, KM_PAD_NONE),
-            keymaster_param_enum(KM_TAG_DIGEST, KM_DIGEST_NONE),
-    };
-    keymaster_key_param_set_t param_set = {params, sizeof(params) / sizeof(*params)};
-    keymaster_operation_handle_t op_handle;
-    keymaster_error_t error = device->begin(purpose, key, &param_set, nullptr, &op_handle);
-    if (error != KM_ERROR_OK) {
-        printf("Keymaster begin() failed: %d\n", error);
-        return false;
-    }
-    size_t input_consumed;
-    error = device->update(op_handle, nullptr, input, &input_consumed, nullptr, nullptr);
-    if (error != KM_ERROR_OK) {
-        printf("Keymaster update() failed: %d\n", error);
-        return false;
-    }
-    if (input_consumed != input->data_length) {
-        // This should never happen. If it does, it's a bug in the keymaster implementation.
-        printf("Keymaster update() did not consume all data.\n");
-        device->abort(op_handle);
-        return false;
-    }
-    error = device->finish(op_handle, nullptr, nullptr, signature, nullptr, output);
-    if (error != KM_ERROR_OK) {
-        printf("Keymaster finish() failed: %d\n", error);
-        return false;
-    }
-    return true;
-}
-
-static bool test_import_rsa(TrustyKeymasterDevice* device) {
-    printf("===================\n");
-    printf("= RSA Import Test =\n");
-    printf("===================\n\n");
-
-    printf("=== Importing RSA keypair === \n");
-    keymaster_key_blob_t key;
-    keymaster_blob_t private_key = {rsa_privkey_pk8_der, rsa_privkey_pk8_der_len};
-    int error =
-            device->import_key(&rsa_param_set, KM_KEY_FORMAT_PKCS8, &private_key, &key, nullptr);
-    if (error != KM_ERROR_OK) {
-        printf("Error importing RSA key: %d\n\n", error);
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> key_deleter(key.key_material);
-
-    printf("=== Signing with imported RSA key ===\n");
-    size_t message_len = 1024 / 8;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_len]);
-    memset(message.get(), 'a', message_len);
-    keymaster_blob_t input = {message.get(), message_len}, signature;
-
-    if (!do_operation(device, KM_PURPOSE_SIGN, &key, &input, nullptr, &signature)) {
-        printf("Error signing data with imported RSA key\n\n");
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> signature_deleter(signature.data);
-
-    printf("=== Verifying with imported RSA key === \n");
-    if (!do_operation(device, KM_PURPOSE_VERIFY, &key, &input, &signature, nullptr)) {
-        printf("Error verifying data with imported RSA key\n\n");
-        return false;
-    }
-
-    printf("\n");
-    return true;
-}
-
-static bool test_rsa(TrustyKeymasterDevice* device) {
-    printf("============\n");
-    printf("= RSA Test =\n");
-    printf("============\n\n");
-
-    printf("=== Generating RSA key pair ===\n");
-    keymaster_key_blob_t key;
-    int error = device->generate_key(&rsa_param_set, &key, nullptr);
-    if (error != KM_ERROR_OK) {
-        printf("Error generating RSA key pair: %d\n\n", error);
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> key_deleter(key.key_material);
-
-    printf("=== Signing with RSA key === \n");
-    size_t message_len = 1024 / 8;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_len]);
-    memset(message.get(), 'a', message_len);
-    keymaster_blob_t input = {message.get(), message_len}, signature;
-
-    if (!do_operation(device, KM_PURPOSE_SIGN, &key, &input, nullptr, &signature)) {
-        printf("Error signing data with RSA key\n\n");
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> signature_deleter(signature.data);
-
-    printf("=== Verifying with RSA key === \n");
-    if (!do_operation(device, KM_PURPOSE_VERIFY, &key, &input, &signature, nullptr)) {
-        printf("Error verifying data with RSA key\n\n");
-        return false;
-    }
-
-    printf("=== Exporting RSA public key ===\n");
-    keymaster_blob_t exported_key;
-    error = device->export_key(KM_KEY_FORMAT_X509, &key, nullptr, nullptr, &exported_key);
-    if (error != KM_ERROR_OK) {
-        printf("Error exporting RSA public key: %d\n\n", error);
-        return false;
-    }
-
-    printf("=== Verifying with exported key ===\n");
-    const uint8_t* tmp = exported_key.data;
-    std::unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(
-            d2i_PUBKEY(NULL, &tmp, exported_key.data_length));
-    std::unique_ptr<EVP_PKEY_CTX, EVP_PKEY_CTX_Delete> ctx(EVP_PKEY_CTX_new(pkey.get(), NULL));
-    if (EVP_PKEY_verify_init(ctx.get()) != 1) {
-        printf("Error initializing openss EVP context\n\n");
-        return false;
-    }
-    if (EVP_PKEY_type(pkey->type) != EVP_PKEY_RSA) {
-        printf("Exported key was the wrong type?!?\n\n");
-        return false;
-    }
-
-    EVP_PKEY_CTX_set_rsa_padding(ctx.get(), RSA_NO_PADDING);
-    if (EVP_PKEY_verify(ctx.get(), signature.data, signature.data_length, message.get(),
-                        message_len) != 1) {
-        printf("Verification with exported pubkey failed.\n\n");
-        return false;
-    } else {
-        printf("Verification succeeded\n");
-    }
-
-    printf("\n");
-    return true;
-}
-
-static bool test_import_ecdsa(TrustyKeymasterDevice* device) {
-    printf("=====================\n");
-    printf("= ECDSA Import Test =\n");
-    printf("=====================\n\n");
-
-    printf("=== Importing ECDSA keypair === \n");
-    keymaster_key_blob_t key;
-    keymaster_blob_t private_key = {ec_privkey_pk8_der, ec_privkey_pk8_der_len};
-    int error = device->import_key(&ec_param_set, KM_KEY_FORMAT_PKCS8, &private_key, &key, nullptr);
-    if (error != KM_ERROR_OK) {
-        printf("Error importing ECDSA key: %d\n\n", error);
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> deleter(key.key_material);
-
-    printf("=== Signing with imported ECDSA key ===\n");
-    size_t message_len = 30 /* arbitrary */;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_len]);
-    memset(message.get(), 'a', message_len);
-    keymaster_blob_t input = {message.get(), message_len}, signature;
-
-    if (!do_operation(device, KM_PURPOSE_SIGN, &key, &input, nullptr, &signature)) {
-        printf("Error signing data with imported ECDSA key\n\n");
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> signature_deleter(signature.data);
-
-    printf("=== Verifying with imported ECDSA key === \n");
-    if (!do_operation(device, KM_PURPOSE_VERIFY, &key, &input, &signature, nullptr)) {
-        printf("Error verifying data with imported ECDSA key\n\n");
-        return false;
-    }
-
-    printf("\n");
-    return true;
-}
-
-static bool test_ecdsa(TrustyKeymasterDevice* device) {
-    printf("==============\n");
-    printf("= ECDSA Test =\n");
-    printf("==============\n\n");
-
-    printf("=== Generating ECDSA key pair ===\n");
-    keymaster_key_blob_t key;
-    int error = device->generate_key(&ec_param_set, &key, nullptr);
-    if (error != KM_ERROR_OK) {
-        printf("Error generating ECDSA key pair: %d\n\n", error);
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> key_deleter(key.key_material);
-
-    printf("=== Signing with ECDSA key === \n");
-    size_t message_len = 30 /* arbitrary */;
-    std::unique_ptr<uint8_t[]> message(new uint8_t[message_len]);
-    memset(message.get(), 'a', message_len);
-    keymaster_blob_t input = {message.get(), message_len}, signature;
-
-    if (!do_operation(device, KM_PURPOSE_SIGN, &key, &input, nullptr, &signature)) {
-        printf("Error signing data with ECDSA key\n\n");
-        return false;
-    }
-    std::unique_ptr<const uint8_t[]> signature_deleter(signature.data);
-
-    printf("=== Verifying with ECDSA key === \n");
-    if (!do_operation(device, KM_PURPOSE_VERIFY, &key, &input, &signature, nullptr)) {
-        printf("Error verifying data with ECDSA key\n\n");
-        return false;
-    }
-
-    printf("=== Exporting ECDSA public key ===\n");
-    keymaster_blob_t exported_key;
-    error = device->export_key(KM_KEY_FORMAT_X509, &key, nullptr, nullptr, &exported_key);
-    if (error != KM_ERROR_OK) {
-        printf("Error exporting ECDSA public key: %d\n\n", error);
-        return false;
-    }
-
-    printf("=== Verifying with exported key ===\n");
-    const uint8_t* tmp = exported_key.data;
-    std::unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(
-            d2i_PUBKEY(NULL, &tmp, exported_key.data_length));
-    std::unique_ptr<EVP_PKEY_CTX, EVP_PKEY_CTX_Delete> ctx(EVP_PKEY_CTX_new(pkey.get(), NULL));
-    if (EVP_PKEY_verify_init(ctx.get()) != 1) {
-        printf("Error initializing openssl EVP context\n\n");
-        return false;
-    }
-    if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) {
-        printf("Exported key was the wrong type?!?\n\n");
-        return false;
-    }
-
-    if (EVP_PKEY_verify(ctx.get(), signature.data, signature.data_length, message.get(),
-                        message_len) != 1) {
-        printf("Verification with exported pubkey failed.\n\n");
-        return false;
-    } else {
-        printf("Verification succeeded\n");
-    }
-
-    printf("\n");
-    return true;
-}
-
-int main(void) {
-    TrustyKeymasterDevice device(NULL);
-    keymaster::ConfigureDevice(reinterpret_cast<keymaster2_device_t*>(&device));
-    if (device.session_error() != KM_ERROR_OK) {
-        printf("Failed to initialize Trusty session: %d\n", device.session_error());
-        return 1;
-    }
-    printf("Trusty session initialized\n");
-
-    bool success = true;
-    success &= test_rsa(&device);
-    success &= test_import_rsa(&device);
-    success &= test_ecdsa(&device);
-    success &= test_import_ecdsa(&device);
-
-    if (success) {
-        printf("\nTESTS PASSED!\n");
-    } else {
-        printf("\n!!!!TESTS FAILED!!!\n");
-    }
-
-    return success ? 0 : 1;
-}
diff --git a/trusty/keymaster/set_attestation_key/keymaster_soft_attestation_keys.xml b/trusty/keymaster/set_attestation_key/keymaster_soft_attestation_keys.xml
new file mode 100644
index 0000000..fce2ac2
--- /dev/null
+++ b/trusty/keymaster/set_attestation_key/keymaster_soft_attestation_keys.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<AndroidAttestation>
+  <NumberOfKeyboxes>10</NumberOfKeyboxes>
+  <Keybox DeviceID="dev1">
+    <Key algorithm="rsa">
+      <PrivateKey format="pem">
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDAgyPcVogbuDAgafWwhWHG7r5/BeL1qEIEir6LR752/q7yXPKb
+KvoyABQWAUKZiaFfz8aBXrNjWDwv0vIL5Jgyg92BSxbX4YVBeuVKvClqOm21wAQI
+O2jFVsHwIzmRZBmGTVC3TUCuykhMdzVsiVoMJ1q/rEmdXX0jYvKcXgLocQIDAQAB
+AoGBAL6GCwuZqAKm+xpZQ4p7txUGWwmjbcbpysxr88AsNNfXnpTGYGQo2Ix7f2V3
+wc3qZAdKvo5yht8fCBHclygmCGjeldMu/Ja20IT/JxpfYN78xwPno45uKbqaPF/C
+woB2tqiWrx0014gozpvdsfNPnJQEQweBKY4gExZyW728mTpBAkEA4cbZJ2RsCRbs
+NoJtWUmDdAwh8bB0xKGlmGfGaXlchdPcRkxbkp6Uv7NODcxQFLEPEzQat/3V9gQU
+0qMmytQcxQJBANpIWZd4XNVjD7D9jFJU+Y5TjhiYOq6ea35qWntdNDdVuSGOvUAy
+DSg4fXifdvohi8wti2il9kGPu+ylF5qzr70CQFD+/DJklVlhbtZTThVFCTKdk6PY
+ENvlvbmCKSz3i9i624Agro1X9LcdBThv/p6dsnHKNHejSZnbdvjl7OnA1J0CQBW3
+TPJ8zv+Ls2vwTZ2DRrCaL3DS9EObDyasfgP36dH3fUuRX9KbKCPwOstdUgDghX/y
+qAPpPu6W1iNc6VRCvCECQQCQp0XaiXCyzWSWYDJCKMX4KFb/1mW6moXI1g8bi+5x
+fs0scurgHa2GunZU1M9FrbXx8rMdn4Eiz6XxpVcPmy0l
+-----END RSA PRIVATE KEY-----
+      </PrivateKey>
+      <CertificateChain>
+        <NumberOfCertificates>2</NumberOfCertificates>
+        <Certificate format="pem">
+-----BEGIN CERTIFICATE-----
+MIICtjCCAh+gAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwYzELMAkGA1UEBhMCVVMx
+EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTAT
+BgNVBAoMDEdvb2dsZSwgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDAeFw0xNjAxMDQx
+MjQwNTNaFw0zNTEyMzAxMjQwNTNaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD
+YWxpZm9ybmlhMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xEDAOBgNVBAsMB0FuZHJv
+aWQxKTAnBgNVBAMMIEFuZHJvaWQgU29mdHdhcmUgQXR0ZXN0YXRpb24gS2V5MIGf
+MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAgyPcVogbuDAgafWwhWHG7r5/BeL1
+qEIEir6LR752/q7yXPKbKvoyABQWAUKZiaFfz8aBXrNjWDwv0vIL5Jgyg92BSxbX
+4YVBeuVKvClqOm21wAQIO2jFVsHwIzmRZBmGTVC3TUCuykhMdzVsiVoMJ1q/rEmd
+XX0jYvKcXgLocQIDAQABo2YwZDAdBgNVHQ4EFgQU1AwQG/jNY7n3OVK1DhNcpteZ
+k4YwHwYDVR0jBBgwFoAUKfrxrMxN0kyWQCd1trDpMuUH/i4wEgYDVR0TAQH/BAgw
+BgEB/wIBADAOBgNVHQ8BAf8EBAMCAoQwDQYJKoZIhvcNAQELBQADgYEAni1IX4xn
+M9waha2Z11Aj6hTsQ7DhnerCI0YecrUZ3GAi5KVoMWwLVcTmnKItnzpPk2sxixZ4
+Fg2Iy9mLzICdhPDCJ+NrOPH90ecXcjFZNX2W88V/q52PlmEmT7K+gbsNSQQiis6f
+9/VCLiVE+iEHElqDtVWtGIL4QBSbnCBjBH8=
+-----END CERTIFICATE-----
+        </Certificate>
+        <Certificate format="pem">
+-----BEGIN CERTIFICATE-----
+MIICpzCCAhCgAwIBAgIJAP+U2d2fB8gMMA0GCSqGSIb3DQEBCwUAMGMxCzAJBgNV
+BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBW
+aWV3MRUwEwYDVQQKDAxHb29nbGUsIEluYy4xEDAOBgNVBAsMB0FuZHJvaWQwHhcN
+MTYwMTA0MTIzMTA4WhcNMzUxMjMwMTIzMTA4WjBjMQswCQYDVQQGEwJVUzETMBEG
+A1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEVMBMGA1UE
+CgwMR29vZ2xlLCBJbmMuMRAwDgYDVQQLDAdBbmRyb2lkMIGfMA0GCSqGSIb3DQEB
+AQUAA4GNADCBiQKBgQCia63rbi5EYe/VDoLmt5TRdSMfd5tjkWP/96r/C3JHTsAs
+Q+wzfNes7UA+jCigZtX3hwszl94OuE4TQKuvpSe/lWmgMdsGUmX4RFlXYfC78hdL
+t0GAZMAoDo9Sd47b0ke2RekZyOmLw9vCkT/X11DEHTVm+Vfkl5YLCazOkjWFmwID
+AQABo2MwYTAdBgNVHQ4EFgQUKfrxrMxN0kyWQCd1trDpMuUH/i4wHwYDVR0jBBgw
+FoAUKfrxrMxN0kyWQCd1trDpMuUH/i4wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
+Af8EBAMCAoQwDQYJKoZIhvcNAQELBQADgYEAT3LzNlmNDsG5dFsxWfbwjSVJMJ6j
+HBwp0kUtILlNX2S06IDHeHqcOd6os/W/L3BfRxBcxebrTQaZYdKumgf/93y4q+uc
+DyQHXrF/unlx/U1bnt8Uqf7f7XzAiF343ZtkMlbVNZriE/mPzsF83O+kqrJVw4Op
+Lvtc9mL1J1IXvmM=
+-----END CERTIFICATE-----
+        </Certificate>
+      </CertificateChain>
+    </Key>
+  </Keybox>
+  <Keybox DeviceID="dev1">
+    <Key algorithm="ecdsa">
+      <PrivateKey format="pem">
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEICHghkMqFRmEWc82OlD8FMnarfk19SfC39ceTW28QuVEoAoGCCqGSM49
+AwEHoUQDQgAE6555+EJjWazLKpFMiYbMcK2QZpOCqXMmE/6sy/ghJ0whdJdKKv6l
+uU1/ZtTgZRBmNbxTt6CjpnFYPts+Ea4QFA==
+-----END EC PRIVATE KEY-----
+      </PrivateKey>
+      <CertificateChain>
+        <NumberOfCertificates>2</NumberOfCertificates>
+        <Certificate format="pem">
+-----BEGIN CERTIFICATE-----
+MIICeDCCAh6gAwIBAgICEAEwCgYIKoZIzj0EAwIwgZgxCzAJBgNVBAYTAlVTMRMw
+EQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRUwEwYD
+VQQKDAxHb29nbGUsIEluYy4xEDAOBgNVBAsMB0FuZHJvaWQxMzAxBgNVBAMMKkFu
+ZHJvaWQgS2V5c3RvcmUgU29mdHdhcmUgQXR0ZXN0YXRpb24gUm9vdDAeFw0xNjAx
+MTEwMDQ2MDlaFw0yNjAxMDgwMDQ2MDlaMIGIMQswCQYDVQQGEwJVUzETMBEGA1UE
+CAwKQ2FsaWZvcm5pYTEVMBMGA1UECgwMR29vZ2xlLCBJbmMuMRAwDgYDVQQLDAdB
+bmRyb2lkMTswOQYDVQQDDDJBbmRyb2lkIEtleXN0b3JlIFNvZnR3YXJlIEF0dGVz
+dGF0aW9uIEludGVybWVkaWF0ZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABOue
+efhCY1msyyqRTImGzHCtkGaTgqlzJhP+rMv4ISdMIXSXSir+pblNf2bU4GUQZjW8
+U7ego6ZxWD7bPhGuEBSjZjBkMB0GA1UdDgQWBBQ//KzWGrE6noEguNUlHMVlux6R
+qTAfBgNVHSMEGDAWgBTIrel3TEXDo88NFhDkeUM6IVowzzASBgNVHRMBAf8ECDAG
+AQH/AgEAMA4GA1UdDwEB/wQEAwIChDAKBggqhkjOPQQDAgNIADBFAiBLipt77oK8
+wDOHri/AiZi03cONqycqRZ9pDMfDktQPjgIhAO7aAV229DLp1IQ7YkyUBO86fMy9
+Xvsiu+f+uXc/WT/7
+-----END CERTIFICATE-----
+        </Certificate>
+        <Certificate format="pem">
+-----BEGIN CERTIFICATE-----
+MIICizCCAjKgAwIBAgIJAKIFntEOQ1tXMAoGCCqGSM49BAMCMIGYMQswCQYDVQQG
+EwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmll
+dzEVMBMGA1UECgwMR29vZ2xlLCBJbmMuMRAwDgYDVQQLDAdBbmRyb2lkMTMwMQYD
+VQQDDCpBbmRyb2lkIEtleXN0b3JlIFNvZnR3YXJlIEF0dGVzdGF0aW9uIFJvb3Qw
+HhcNMTYwMTExMDA0MzUwWhcNMzYwMTA2MDA0MzUwWjCBmDELMAkGA1UEBhMCVVMx
+EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTAT
+BgNVBAoMDEdvb2dsZSwgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEzMDEGA1UEAwwq
+QW5kcm9pZCBLZXlzdG9yZSBTb2Z0d2FyZSBBdHRlc3RhdGlvbiBSb290MFkwEwYH
+KoZIzj0CAQYIKoZIzj0DAQcDQgAE7l1ex+HA220Dpn7mthvsTWpdamguD/9/SQ59
+dx9EIm29sa/6FsvHrcV30lacqrewLVQBXT5DKyqO107sSHVBpKNjMGEwHQYDVR0O
+BBYEFMit6XdMRcOjzw0WEOR5QzohWjDPMB8GA1UdIwQYMBaAFMit6XdMRcOjzw0W
+EOR5QzohWjDPMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgKEMAoGCCqG
+SM49BAMCA0cAMEQCIDUho++LNEYenNVg8x1YiSBq3KNlQfYNns6KGYxmSGB7AiBN
+C/NR2TB8fVvaNTQdqEcbY6WFZTytTySn502vQX3xvw==
+-----END CERTIFICATE-----
+        </Certificate>
+      </CertificateChain>
+    </Key>
+  </Keybox>
+</AndroidAttestation>
diff --git a/trusty/keymaster/set_attestation_key/set_attestation_key.cpp b/trusty/keymaster/set_attestation_key/set_attestation_key.cpp
new file mode 100644
index 0000000..df6b0f8
--- /dev/null
+++ b/trusty/keymaster/set_attestation_key/set_attestation_key.cpp
@@ -0,0 +1,362 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include <errno.h>
+#include <getopt.h>
+#include <libxml/xmlreader.h>
+#include <openssl/pem.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/uio.h>
+#include <unistd.h>
+#include <string>
+
+using std::string;
+
+#include <trusty_keymaster/ipc/trusty_keymaster_ipc.h>
+
+static const char* _sopts = "h";
+static const struct option _lopts[] = {
+        {"help", no_argument, 0, 'h'},
+        {0, 0, 0, 0},
+};
+
+static const char* usage =
+        "Usage: %s [options] xml-file\n"
+        "\n"
+        "options:\n"
+        "  -h, --help            prints this message and exit\n"
+        "\n";
+
+static void print_usage_and_exit(const char* prog, int code) {
+    fprintf(stderr, usage, prog);
+    exit(code);
+}
+
+static void parse_options(int argc, char** argv) {
+    int c;
+    int oidx = 0;
+
+    while (1) {
+        c = getopt_long(argc, argv, _sopts, _lopts, &oidx);
+        if (c == -1) {
+            break; /* done */
+        }
+
+        switch (c) {
+            case 'h':
+                print_usage_and_exit(argv[0], EXIT_SUCCESS);
+                break;
+
+            default:
+                print_usage_and_exit(argv[0], EXIT_FAILURE);
+        }
+    }
+}
+
+struct SetAttestationKeyRequest : public keymaster::KeymasterMessage {
+    explicit SetAttestationKeyRequest(int32_t ver = keymaster::kDefaultMessageVersion)
+        : KeymasterMessage(ver) {}
+
+    size_t SerializedSize() const override { return sizeof(uint32_t) + key_data.SerializedSize(); }
+    uint8_t* Serialize(uint8_t* buf, const uint8_t* end) const override {
+        buf = keymaster::append_uint32_to_buf(buf, end, algorithm);
+        return key_data.Serialize(buf, end);
+    }
+    bool Deserialize(const uint8_t** buf_ptr, const uint8_t* end) override {
+        return keymaster::copy_uint32_from_buf(buf_ptr, end, &algorithm) &&
+               key_data.Deserialize(buf_ptr, end);
+    }
+
+    keymaster_algorithm_t algorithm;
+    keymaster::Buffer key_data;
+};
+
+struct KeymasterNoResponse : public keymaster::KeymasterResponse {
+    explicit KeymasterNoResponse(int32_t ver = keymaster::kDefaultMessageVersion)
+        : keymaster::KeymasterResponse(ver) {}
+
+    size_t NonErrorSerializedSize() const override { return 0; }
+    uint8_t* NonErrorSerialize(uint8_t* buf, const uint8_t*) const override { return buf; }
+    bool NonErrorDeserialize(const uint8_t**, const uint8_t*) override { return true; }
+};
+
+struct SetAttestationKeyResponse : public KeymasterNoResponse {};
+
+struct ClearAttestationCertChainRequest : public keymaster::KeymasterMessage {
+    explicit ClearAttestationCertChainRequest(int32_t ver = keymaster::kDefaultMessageVersion)
+        : KeymasterMessage(ver) {}
+
+    size_t SerializedSize() const override { return sizeof(uint32_t); }
+    uint8_t* Serialize(uint8_t* buf, const uint8_t* end) const override {
+        return keymaster::append_uint32_to_buf(buf, end, algorithm);
+    }
+    bool Deserialize(const uint8_t** buf_ptr, const uint8_t* end) override {
+        return keymaster::copy_uint32_from_buf(buf_ptr, end, &algorithm);
+    }
+
+    keymaster_algorithm_t algorithm;
+};
+
+struct ClearAttestationCertChainResponse : public KeymasterNoResponse {};
+
+static int set_attestation_key_or_cert_bin(uint32_t cmd, keymaster_algorithm_t algorithm,
+                                           const void* key_data, size_t key_data_size) {
+    int ret;
+
+    SetAttestationKeyRequest req;
+    req.algorithm = algorithm;
+    req.key_data.Reinitialize(key_data, key_data_size);
+    SetAttestationKeyResponse rsp;
+
+    ret = trusty_keymaster_send(cmd, req, &rsp);
+    if (ret) {
+        fprintf(stderr, "trusty_keymaster_send cmd 0x%x failed %d\n", cmd, ret);
+        return ret;
+    }
+
+    return 0;
+}
+
+static int set_attestation_key_or_cert_pem(uint32_t cmd, keymaster_algorithm_t algorithm,
+                                           const xmlChar* pemkey) {
+    int ret;
+    int sslret;
+
+    /* Convert from pem to binary */
+    BIO* bio = BIO_new_mem_buf(pemkey, xmlStrlen(pemkey));
+    if (!bio) {
+        fprintf(stderr, "BIO_new_mem_buf failed\n");
+        ERR_print_errors_fp(stderr);
+        return -1;
+    }
+
+    char* key_name;
+    char* key_header;
+    uint8_t* key;
+    long keylen;
+    sslret = PEM_read_bio(bio, &key_name, &key_header, &key, &keylen);
+    BIO_free(bio);
+
+    if (!sslret) {
+        fprintf(stderr, "PEM_read_bio failed\n");
+        ERR_print_errors_fp(stderr);
+        return -1;
+    }
+
+    /* Send key in binary format to trusty */
+    ret = set_attestation_key_or_cert_bin(cmd, algorithm, key, keylen);
+
+    OPENSSL_free(key_name);
+    OPENSSL_free(key_header);
+    OPENSSL_free(key);
+
+    return ret;
+}
+
+static int set_attestation_key_or_cert_iecs(uint32_t cmd, keymaster_algorithm_t algorithm,
+                                            const xmlChar* key_base64) {
+    int ret;
+    int sslret;
+
+    /* Remove all whitespace. EVP_DecodeBase64 does not support whitespace. */
+    string key_base64_str((const char*)key_base64);
+    key_base64_str.erase(remove_if(key_base64_str.begin(), key_base64_str.end(), isspace),
+                         key_base64_str.end());
+
+    /* Convert from base64 to binary */
+    uint8_t* key;
+    size_t keylen;
+    size_t key_base64_len = key_base64_str.length();
+
+    sslret = EVP_DecodedLength(&keylen, key_base64_len);
+    if (!sslret) {
+        fprintf(stderr, "invalid input length, %zu\n", key_base64_len);
+        return -1;
+    }
+    key = (uint8_t*)malloc(keylen);
+    if (!key) {
+        fprintf(stderr, "failed to allocate key, size %zu\n", key_base64_len);
+        return -1;
+    }
+    sslret = EVP_DecodeBase64(key, &keylen, keylen, (const uint8_t*)key_base64_str.data(),
+                              key_base64_len);
+    if (!sslret) {
+        fprintf(stderr, "EVP_DecodeBase64 failed\n");
+        ERR_print_errors_fp(stderr);
+        free(key);
+        return -1;
+    }
+
+    /* Send key in binary format to trusty */
+    ret = set_attestation_key_or_cert_bin(cmd, algorithm, key, keylen);
+
+    free(key);
+
+    return ret;
+}
+
+static int str_to_algorithm(keymaster_algorithm_t* algorithm, const xmlChar* algorithm_str) {
+    if (xmlStrEqual(algorithm_str, BAD_CAST "rsa")) {
+        *algorithm = KM_ALGORITHM_RSA;
+    } else if (xmlStrEqual(algorithm_str, BAD_CAST "ecdsa")) {
+        *algorithm = KM_ALGORITHM_EC;
+    } else {
+        printf("unsupported algorithm: %s\n", algorithm_str);
+        return -1;
+    }
+    return 0;
+}
+
+static int set_attestation_key_or_cert(uint32_t cmd, const xmlChar* algorithm_str,
+                                       const xmlChar* format, const xmlChar* str) {
+    int ret;
+    keymaster_algorithm_t algorithm;
+
+    ret = str_to_algorithm(&algorithm, algorithm_str);
+    if (ret) {
+        return ret;
+    }
+
+    if (xmlStrEqual(format, BAD_CAST "pem")) {
+        ret = set_attestation_key_or_cert_pem(cmd, algorithm, str);
+    } else if (xmlStrEqual(format, BAD_CAST "iecs")) {
+        ret = set_attestation_key_or_cert_iecs(cmd, algorithm, str);
+    } else {
+        printf("unsupported key/cert format: %s\n", format);
+        return -1;
+    }
+    return ret;
+}
+
+static int clear_cert_chain(const xmlChar* algorithm_str) {
+    int ret;
+    ClearAttestationCertChainRequest req;
+    ClearAttestationCertChainResponse rsp;
+
+    ret = str_to_algorithm(&req.algorithm, algorithm_str);
+    if (ret) {
+        return ret;
+    }
+
+    ret = trusty_keymaster_send(KM_CLEAR_ATTESTATION_CERT_CHAIN, req, &rsp);
+    if (ret) {
+        fprintf(stderr, "%s: trusty_keymaster_send failed %d\n", __func__, ret);
+        return ret;
+    }
+    return 0;
+}
+
+static int process_xml(xmlTextReaderPtr xml) {
+    int ret;
+    const xmlChar* algorithm = NULL;
+    const xmlChar* element = NULL;
+    const xmlChar* element_format = NULL;
+
+    while ((ret = xmlTextReaderRead(xml)) == 1) {
+        int nodetype = xmlTextReaderNodeType(xml);
+        const xmlChar *name, *value;
+        name = xmlTextReaderConstName(xml);
+        switch (nodetype) {
+            case XML_READER_TYPE_ELEMENT:
+                element = name;
+                element_format = xmlTextReaderGetAttribute(xml, BAD_CAST "format");
+                if (xmlStrEqual(name, BAD_CAST "Key")) {
+                    algorithm = xmlTextReaderGetAttribute(xml, BAD_CAST "algorithm");
+                } else if (xmlStrEqual(name, BAD_CAST "CertificateChain")) {
+                    ret = clear_cert_chain(algorithm);
+                    if (ret) {
+                        fprintf(stderr, "%s, algorithm %s: Clear cert chain cmd failed, %d\n",
+                                element, algorithm, ret);
+                        return ret;
+                    }
+                    printf("%s, algorithm %s: Clear cert chain cmd done\n", element, algorithm);
+                }
+                break;
+            case XML_READER_TYPE_TEXT:
+                value = xmlTextReaderConstValue(xml);
+                uint32_t cmd;
+                if (xmlStrEqual(element, BAD_CAST "PrivateKey")) {
+                    if (xmlStrEqual(element_format, BAD_CAST "pem")) {
+                        cmd = KM_SET_ATTESTATION_KEY;
+                    } else if (xmlStrEqual(element_format, BAD_CAST "iecs")) {
+                        cmd = KM_SET_WRAPPED_ATTESTATION_KEY;
+                    } else {
+                        printf("unsupported key format: %s\n", element_format);
+                        return -1;
+                    }
+                } else if (xmlStrEqual(element, BAD_CAST "Certificate")) {
+                    cmd = KM_APPEND_ATTESTATION_CERT_CHAIN;
+                } else {
+                    break;
+                }
+
+                ret = set_attestation_key_or_cert(cmd, algorithm, element_format, value);
+                if (ret) {
+                    fprintf(stderr, "%s, algorithm %s, format %s: Cmd 0x%x failed, %d\n", element,
+                            algorithm, element_format, cmd, ret);
+                    return ret;
+                }
+                printf("%s, algorithm %s, format %s: Cmd 0x%x done\n", element, algorithm,
+                       element_format, cmd);
+                break;
+            case XML_READER_TYPE_END_ELEMENT:
+                element = NULL;
+                break;
+        }
+    }
+    return ret;
+}
+
+static int parse_xml_file(const char* filename) {
+    int ret;
+    xmlTextReaderPtr xml = xmlReaderForFile(filename, NULL, 0);
+    if (!xml) {
+        fprintf(stderr, "failed to open %s\n", filename);
+        return -1;
+    }
+
+    ret = process_xml(xml);
+
+    xmlFreeTextReader(xml);
+    if (ret != 0) {
+        fprintf(stderr, "Failed to parse or process %s\n", filename);
+        return -1;
+    }
+
+    return 0;
+}
+
+int main(int argc, char** argv) {
+    int ret = 0;
+
+    parse_options(argc, argv);
+    if (optind + 1 != argc) {
+        print_usage_and_exit(argv[0], EXIT_FAILURE);
+    }
+
+    ret = trusty_keymaster_connect();
+    if (ret) {
+        fprintf(stderr, "trusty_keymaster_connect failed %d\n", ret);
+    } else {
+        ret = parse_xml_file(argv[optind]);
+        trusty_keymaster_disconnect();
+    }
+
+    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/trusty/libtrusty/Android.bp b/trusty/libtrusty/Android.bp
index 8dba78d..e0161a5 100644
--- a/trusty/libtrusty/Android.bp
+++ b/trusty/libtrusty/Android.bp
@@ -12,10 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_library {
-    name: "libtrusty",
-    vendor: true,
-
+cc_defaults {
+    name: "libtrusty_defaults",
     srcs: ["trusty.c"],
     export_include_dirs: ["include"],
     cflags: [
@@ -25,3 +23,11 @@
 
     shared_libs: ["liblog"],
 }
+
+cc_library {
+    name: "libtrusty",
+    // TODO(b/170753563): cc_fuzz can't deal with vendor components. Build
+    // libtrusty for system and vendor.
+    vendor_available: true,
+    defaults: ["libtrusty_defaults"],
+}
diff --git a/trusty/libtrusty/include/trusty/ipc.h b/trusty/libtrusty/include/trusty/ipc.h
new file mode 100644
index 0000000..1fa6fe4
--- /dev/null
+++ b/trusty/libtrusty/include/trusty/ipc.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef _UAPI_LINUX_TRUSTY_IPC_H_
+#define _UAPI_LINUX_TRUSTY_IPC_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/uio.h>
+
+/**
+ * enum transfer_kind - How to send an fd to Trusty
+ * @TRUSTY_SHARE: Memory will be accessible by Linux and Trusty. On ARM it will
+ *                be mapped as nonsecure. Suitable for shared memory. The paired
+ *                fd must be a "memfd".
+ * @TRUSTY_LEND:  Memory will be accessible only to Trusty. On ARM it will be
+ *                transitioned to "Secure" memory if Trusty is in TrustZone.
+ *                This transfer kind is suitable for donating video buffers or
+ *                other similar resources. The paired fd may need to come from a
+ *                platform-specific allocator for memory that may be
+ *                transitioned to "Secure".
+ *
+ * Describes how the user would like the resource in question to be sent to
+ * Trusty. Options may be valid only for certain kinds of fds.
+ */
+enum transfer_kind {
+    TRUSTY_SHARE = 0,
+    TRUSTY_LEND = 1,
+};
+
+/**
+ * struct trusty_shm - Describes a transfer of memory to Trusty
+ * @fd:       The fd to transfer
+ * @transfer: How to transfer it - see &enum transfer_kind
+ */
+struct trusty_shm {
+    __s32 fd;
+    __u32 transfer;
+};
+
+/**
+ * struct tipc_send_msg_req - Request struct for @TIPC_IOC_SEND_MSG
+ * @iov:     Pointer to an array of &struct iovec describing data to be sent
+ * @shm:     Pointer to an array of &struct trusty_shm describing any file
+ *           descriptors to be transferred.
+ * @iov_cnt: Number of elements in the @iov array
+ * @shm_cnt: Number of elements in the @shm array
+ */
+struct tipc_send_msg_req {
+    __u64 iov;
+    __u64 shm;
+    __u64 iov_cnt;
+    __u64 shm_cnt;
+};
+
+#define TIPC_IOC_MAGIC 'r'
+#define TIPC_IOC_CONNECT _IOW(TIPC_IOC_MAGIC, 0x80, char*)
+#define TIPC_IOC_SEND_MSG _IOW(TIPC_IOC_MAGIC, 0x81, struct tipc_send_msg_req)
+
+#if defined(CONFIG_COMPAT)
+#define TIPC_IOC_CONNECT_COMPAT _IOW(TIPC_IOC_MAGIC, 0x80, compat_uptr_t)
+#endif
+
+#endif
diff --git a/trusty/libtrusty/include/trusty/tipc.h b/trusty/libtrusty/include/trusty/tipc.h
index a3f2a3f..b44afd3 100644
--- a/trusty/libtrusty/include/trusty/tipc.h
+++ b/trusty/libtrusty/include/trusty/tipc.h
@@ -21,7 +21,11 @@
 extern "C" {
 #endif
 
+#include <sys/uio.h>
+#include <trusty/ipc.h>
+
 int tipc_connect(const char *dev_name, const char *srv_name);
+ssize_t tipc_send(int fd, const struct iovec* iov, int iovcnt, struct trusty_shm* shm, int shmcnt);
 int tipc_close(int fd);
 
 #ifdef __cplusplus
diff --git a/trusty/libtrusty/tipc-test/Android.bp b/trusty/libtrusty/tipc-test/Android.bp
index 9676b79..5e60d28 100644
--- a/trusty/libtrusty/tipc-test/Android.bp
+++ b/trusty/libtrusty/tipc-test/Android.bp
@@ -19,6 +19,7 @@
     srcs: ["tipc_test.c"],
     shared_libs: [
         "libc",
+        "libdmabufheap",
         "liblog",
         "libtrusty",
     ],
diff --git a/trusty/libtrusty/tipc-test/tipc_test.c b/trusty/libtrusty/tipc-test/tipc_test.c
index d20d4ee..94aedd7 100644
--- a/trusty/libtrusty/tipc-test/tipc_test.c
+++ b/trusty/libtrusty/tipc-test/tipc_test.c
@@ -21,8 +21,12 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <getopt.h>
+#define __USE_GNU
+#include <sys/mman.h>
 #include <sys/uio.h>
 
+#include <BufferAllocator/BufferAllocatorWrapper.h>
+
 #include <trusty/tipc.h>
 
 #define TIPC_DEFAULT_DEVNAME "/dev/trusty-ipc-dev0"
@@ -39,6 +43,7 @@
 static const char *closer2_name = "com.android.ipc-unittest.srv.closer2";
 static const char *closer3_name = "com.android.ipc-unittest.srv.closer3";
 static const char *main_ctrl_name = "com.android.ipc-unittest.ctrl";
+static const char* receiver_name = "com.android.trusty.memref.receiver";
 
 static const char *_sopts = "hsvD:t:r:m:b:";
 static const struct option _lopts[] =  {
@@ -66,25 +71,25 @@
 "\n"
 ;
 
-static const char *usage_long =
-"\n"
-"The following tests are available:\n"
-"   connect      - connect to datasink service\n"
-"   connect_foo  - connect to non existing service\n"
-"   burst_write  - send messages to datasink service\n"
-"   echo         - send/receive messages to echo service\n"
-"   select       - test select call\n"
-"   blocked_read - test blocked read\n"
-"   closer1      - connection closed by remote (test1)\n"
-"   closer2      - connection closed by remote (test2)\n"
-"   closer3      - connection closed by remote (test3)\n"
-"   ta2ta-ipc    - execute TA to TA unittest\n"
-"   dev-uuid     - print device uuid\n"
-"   ta-access    - test ta-access flags\n"
-"   writev       - writev test\n"
-"   readv        - readv test\n"
-"\n"
-;
+static const char* usage_long =
+        "\n"
+        "The following tests are available:\n"
+        "   connect      - connect to datasink service\n"
+        "   connect_foo  - connect to non existing service\n"
+        "   burst_write  - send messages to datasink service\n"
+        "   echo         - send/receive messages to echo service\n"
+        "   select       - test select call\n"
+        "   blocked_read - test blocked read\n"
+        "   closer1      - connection closed by remote (test1)\n"
+        "   closer2      - connection closed by remote (test2)\n"
+        "   closer3      - connection closed by remote (test3)\n"
+        "   ta2ta-ipc    - execute TA to TA unittest\n"
+        "   dev-uuid     - print device uuid\n"
+        "   ta-access    - test ta-access flags\n"
+        "   writev       - writev test\n"
+        "   readv        - readv test\n"
+        "   send-fd      - transmit dma_buf to trusty, use as shm\n"
+        "\n";
 
 static uint opt_repeat  = 1;
 static uint opt_msgsize = 32;
@@ -885,6 +890,77 @@
 	return 0;
 }
 
+static int send_fd_test(void) {
+    int ret;
+    int dma_buf = -1;
+    int fd = -1;
+    volatile char* buf = MAP_FAILED;
+    BufferAllocator* allocator = NULL;
+
+    const size_t num_pages = 10;
+
+    fd = tipc_connect(dev_name, receiver_name);
+    if (fd < 0) {
+        fprintf(stderr, "Failed to connect to test support TA - is it missing?\n");
+        ret = -1;
+        goto cleanup;
+    }
+
+    allocator = CreateDmabufHeapBufferAllocator();
+    if (!allocator) {
+        fprintf(stderr, "Failed to create dma-buf allocator.\n");
+        ret = -1;
+        goto cleanup;
+    }
+
+    size_t buf_size = PAGE_SIZE * num_pages;
+    dma_buf = DmabufHeapAlloc(allocator, "system", buf_size, 0);
+    if (dma_buf < 0) {
+        ret = dma_buf;
+        fprintf(stderr, "Failed to create dma-buf fd of size %zu err (%d)\n", buf_size, ret);
+        goto cleanup;
+    }
+
+    buf = mmap(0, buf_size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf, 0);
+    if (buf == MAP_FAILED) {
+        fprintf(stderr, "Failed to map dma-buf: %s\n", strerror(errno));
+        ret = -1;
+        goto cleanup;
+    }
+
+    strcpy((char*)buf, "From NS");
+
+    struct trusty_shm shm = {
+            .fd = dma_buf,
+            .transfer = TRUSTY_SHARE,
+    };
+
+    ssize_t rc = tipc_send(fd, NULL, 0, &shm, 1);
+    if (rc < 0) {
+        fprintf(stderr, "tipc_send failed: %zd\n", rc);
+        ret = rc;
+        goto cleanup;
+    }
+    char c;
+    read(fd, &c, 1);
+    tipc_close(fd);
+
+    ret = 0;
+    for (size_t skip = 0; skip < num_pages; skip++) {
+        ret |= strcmp("Hello from Trusty!", (const char*)&buf[skip * PAGE_SIZE]) ? (-1) : 0;
+    }
+
+cleanup:
+    if (buf != MAP_FAILED) {
+        munmap((char*)buf, PAGE_SIZE);
+    }
+    close(dma_buf);
+    if (allocator) {
+        FreeDmabufHeapBufferAllocator(allocator);
+    }
+    tipc_close(fd);
+    return ret;
+}
 
 int main(int argc, char **argv)
 {
@@ -933,10 +1009,12 @@
 		rc = writev_test(opt_repeat, opt_msgsize, opt_variable);
 	} else if (strcmp(test_name, "readv") == 0) {
 		rc = readv_test(opt_repeat, opt_msgsize, opt_variable);
-	} else {
-		fprintf(stderr, "Unrecognized test name '%s'\n", test_name);
-		print_usage_and_exit(argv[0], EXIT_FAILURE, true);
-	}
+    } else if (strcmp(test_name, "send-fd") == 0) {
+        rc = send_fd_test();
+    } else {
+        fprintf(stderr, "Unrecognized test name '%s'\n", test_name);
+        print_usage_and_exit(argv[0], EXIT_FAILURE, true);
+    }
 
-	return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+    return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/trusty/libtrusty/tipc_ioctl.h b/trusty/libtrusty/tipc_ioctl.h
deleted file mode 100644
index 27da56a..0000000
--- a/trusty/libtrusty/tipc_ioctl.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#ifndef _TIPC_IOCTL_H
-#define _TIPC_IOCTL_H
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-#define TIPC_IOC_MAGIC			'r'
-#define TIPC_IOC_CONNECT		_IOW(TIPC_IOC_MAGIC, 0x80, char *)
-
-#endif
diff --git a/trusty/libtrusty/trusty.c b/trusty/libtrusty/trusty.c
index a6238af..f44f8b4 100644
--- a/trusty/libtrusty/trusty.c
+++ b/trusty/libtrusty/trusty.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2020 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.
@@ -27,35 +27,47 @@
 
 #include <log/log.h>
 
-#include "tipc_ioctl.h"
+#include <trusty/ipc.h>
 
-int tipc_connect(const char *dev_name, const char *srv_name)
-{
-	int fd;
-	int rc;
+int tipc_connect(const char* dev_name, const char* srv_name) {
+    int fd;
+    int rc;
 
-	fd = open(dev_name, O_RDWR);
-	if (fd < 0) {
-		rc = -errno;
-		ALOGE("%s: cannot open tipc device \"%s\": %s\n",
-		      __func__, dev_name, strerror(errno));
-		return rc < 0 ? rc : -1;
-	}
+    fd = TEMP_FAILURE_RETRY(open(dev_name, O_RDWR));
+    if (fd < 0) {
+        rc = -errno;
+        ALOGE("%s: cannot open tipc device \"%s\": %s\n", __func__, dev_name, strerror(errno));
+        return rc < 0 ? rc : -1;
+    }
 
-	rc = ioctl(fd, TIPC_IOC_CONNECT, srv_name);
-	if (rc < 0) {
-		rc = -errno;
-		ALOGE("%s: can't connect to tipc service \"%s\" (err=%d)\n",
-		      __func__, srv_name, errno);
-		close(fd);
-		return rc < 0 ? rc : -1;
-	}
+    rc = TEMP_FAILURE_RETRY(ioctl(fd, TIPC_IOC_CONNECT, srv_name));
+    if (rc < 0) {
+        rc = -errno;
+        ALOGE("%s: can't connect to tipc service \"%s\" (err=%d)\n", __func__, srv_name, errno);
+        close(fd);
+        return rc < 0 ? rc : -1;
+    }
 
-	ALOGV("%s: connected to \"%s\" fd %d\n", __func__, srv_name, fd);
-	return fd;
+    ALOGV("%s: connected to \"%s\" fd %d\n", __func__, srv_name, fd);
+    return fd;
 }
 
-void tipc_close(int fd)
-{
-	close(fd);
+ssize_t tipc_send(int fd, const struct iovec* iov, int iovcnt, struct trusty_shm* shms,
+                  int shmcnt) {
+    struct tipc_send_msg_req req;
+    req.iov = (__u64)iov;
+    req.iov_cnt = (__u64)iovcnt;
+    req.shm = (__u64)shms;
+    req.shm_cnt = (__u64)shmcnt;
+
+    int rc = TEMP_FAILURE_RETRY(ioctl(fd, TIPC_IOC_SEND_MSG, &req));
+    if (rc < 0) {
+        ALOGE("%s: failed to send message (err=%d)\n", __func__, rc);
+    }
+
+    return rc;
+}
+
+void tipc_close(int fd) {
+    close(fd);
 }
diff --git a/trusty/secure_dpu/Android.bp b/trusty/secure_dpu/Android.bp
new file mode 100644
index 0000000..0d57cea
--- /dev/null
+++ b/trusty/secure_dpu/Android.bp
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 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.
+
+cc_library_headers {
+    name: "secure_dpu_headers",
+    vendor: true,
+
+    export_include_dirs: ["include"],
+}
diff --git a/trusty/secure_dpu/include/trusty/secure_dpu/SecureDpu.h b/trusty/secure_dpu/include/trusty/secure_dpu/SecureDpu.h
new file mode 100644
index 0000000..b939d44
--- /dev/null
+++ b/trusty/secure_dpu/include/trusty/secure_dpu/SecureDpu.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2020, 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.
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+/**
+ * DOC: Secure DPU
+ *
+ * The Secure DPU works as the persistent channel between the non-secure and the
+ * secure world. The channel is established during the boot up stage of the
+ * non-secure world system. In general, the established channel allows the
+ * secure world applications initiate requests or notifications to the non-secure
+ * world.
+ *
+ * For particular devices, the secure world can only perform operations on the
+ * display when in the TUI session if device-specific setup is done by the
+ * non-secure world. Besides, the non-secure world could allocate framebuffer
+ * for the secure world application if the memory is limited in the secure world
+ * on specific devices.
+ *
+ * Currently, supported requests are to start / stop the secure display mode and
+ * to allocate framebuffer.
+ *
+ * This header file needs to be synced on both the Trusty and the Android
+ * codebase.
+ */
+
+#define SECURE_DPU_PORT_NAME "com.android.trusty.secure_dpu"
+#define SECURE_DPU_MAX_MSG_SIZE 64
+
+/**
+ * enum secure_dpu_cmd - command identifiers for secure_fb interface
+ * @SECURE_DPU_CMD_RESP_BIT:
+ *      Message is a response.
+ * @SECURE_DPU_CMD_REQ_SHIFT:
+ *      Number of bits used by @SECURE_DPU_CMD_RESP_BIT.
+ * @SECURE_DPU_CMD_START_SECURE_DISPLAY:
+ *      Notify the system to start secure display mode
+ * @SECURE_DPU_CMD_STOP_SECURE_DISPLAY:
+ *      Notify the system to stop secure display mode
+ * @SECURE_DPU_CMD_ALLOCATE_BUFFER:
+ *      Request non-secure world to allocate the buffer
+ */
+enum secure_dpu_cmd {
+    SECURE_DPU_CMD_RESP_BIT = 1,
+    SECURE_DPU_CMD_REQ_SHIFT = 1,
+    SECURE_DPU_CMD_START_SECURE_DISPLAY = (1 << SECURE_DPU_CMD_REQ_SHIFT),
+    SECURE_DPU_CMD_STOP_SECURE_DISPLAY = (2 << SECURE_DPU_CMD_REQ_SHIFT),
+    SECURE_DPU_CMD_ALLOCATE_BUFFER = (3 << SECURE_DPU_CMD_REQ_SHIFT),
+};
+
+/**
+ * struct secure_dpu_allocate_buffer_req - payload for
+ *                                         %SECURE_DPU_CMD_ALLOCATE_BUFFER
+ *                                         request
+ * @buffer_len: Requested length
+ */
+struct secure_dpu_allocate_buffer_req {
+    uint64_t buffer_len;
+};
+
+/**
+ * struct secure_dpu_allocate_buffer_resp - payload for
+ *                                          %SECURE_DPU_CMD_ALLOCATE_BUFFER
+ *                                          response
+ * @buffer_len: Allocated length
+ */
+struct secure_dpu_allocate_buffer_resp {
+    uint64_t buffer_len;
+};
+
+/**
+ * struct secure_fb_req - common structure for secure_fb requests.
+ * @cmd: Command identifier - one of &enum secure_dpu_cmd.
+ */
+struct secure_dpu_req {
+    uint32_t cmd;
+};
+
+/**
+ * struct secure_dpu_resp - common structure for secure_dpu responses.
+ * @cmd:    Command identifier - %SECURE_DPU_CMD_RESP_BIT or'ed with the
+ *                               command identifier of the corresponding
+ *                               request.
+ * @status: Status of requested operation. One of &enum secure_dpu_error.
+ */
+struct secure_dpu_resp {
+    uint32_t cmd;
+    int32_t status;
+};
+
+enum secure_dpu_error {
+    SECURE_DPU_ERROR_OK = 0,
+    SECURE_DPU_ERROR_FAIL = -1,
+    SECURE_DPU_ERROR_UNINITIALIZED = -2,
+    SECURE_DPU_ERROR_PARAMETERS = -3,
+    SECURE_DPU_ERROR_NO_MEMORY = -4,
+};
diff --git a/trusty/storage/proxy/rpmb.c b/trusty/storage/proxy/rpmb.c
index 7dfd0d0..d1ed649 100644
--- a/trusty/storage/proxy/rpmb.c
+++ b/trusty/storage/proxy/rpmb.c
@@ -231,7 +231,7 @@
 
     if (req->read_size) {
         /* Prepare SECURITY PROTOCOL IN command. */
-        out_cdb.length = __builtin_bswap32(req->read_size);
+        in_cdb.length = __builtin_bswap32(req->read_size);
         sg_io_hdr_t io_hdr;
         set_sg_io_hdr(&io_hdr, SG_DXFER_FROM_DEV, sizeof(in_cdb), sizeof(sense_buffer),
                       req->read_size, read_buf, (unsigned char*)&in_cdb, sense_buffer);
diff --git a/trusty/trusty-base.mk b/trusty/trusty-base.mk
index fd8daa8..12521b0 100644
--- a/trusty/trusty-base.mk
+++ b/trusty/trusty-base.mk
@@ -24,7 +24,8 @@
 
 PRODUCT_PACKAGES += \
 	android.hardware.keymaster@4.0-service.trusty \
-	android.hardware.gatekeeper@1.0-service.trusty
+	android.hardware.gatekeeper@1.0-service.trusty \
+	trusty_apploader
 
 PRODUCT_PROPERTY_OVERRIDES += \
 	ro.hardware.keystore=trusty \
diff --git a/trusty/trusty-test.mk b/trusty/trusty-test.mk
new file mode 100644
index 0000000..74106ec
--- /dev/null
+++ b/trusty/trusty-test.mk
@@ -0,0 +1,19 @@
+# Copyright (C) 2020 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.
+
+PRODUCT_PACKAGES += \
+	spiproxyd \
+	trusty_keymaster_set_attestation_key \
+	keymaster_soft_attestation_keys.xml \
+
diff --git a/trusty/utils/rpmb_dev/rpmb_dev.c b/trusty/utils/rpmb_dev/rpmb_dev.c
index af97eba..2025621 100644
--- a/trusty/utils/rpmb_dev/rpmb_dev.c
+++ b/trusty/utils/rpmb_dev/rpmb_dev.c
@@ -283,6 +283,7 @@
                 {
                         .func = rpmb_dev_data_read,
                         .resp = RPMB_RESP_DATA_READ,
+                        .check_key_programmed = true,
                         .check_addr = true,
                         .multi_packet_res = true,
                         .res_mac = true,
@@ -591,7 +592,7 @@
         return EXIT_SUCCESS;
     }
 
-    open_flags = O_RDWR;
+    open_flags = O_RDWR | O_SYNC;
     if (init) {
         open_flags |= O_CREAT | O_TRUNC;
     }
diff --git a/trusty/utils/rpmb_dev/rpmb_dev.rc b/trusty/utils/rpmb_dev/rpmb_dev.rc
index 9f60e81..9e203b8 100644
--- a/trusty/utils/rpmb_dev/rpmb_dev.rc
+++ b/trusty/utils/rpmb_dev/rpmb_dev.rc
@@ -16,7 +16,7 @@
     disabled
     user root
 
-service rpmb_mock_init /vendor/bin/rpmb_dev --dev /data/vendor/ss/RPMB_DATA --init --key "ea df 64 44 ea 65 5d 1c 87 27 d4 20 71 0d 53 42 dd 73 a3 38 63 e1 d7 94 c3 72 a6 ea e0 64 64 e6" --size 2048
+service rpmb_mock_init /vendor/bin/rpmb_dev --dev /data/vendor/ss/RPMB_DATA --init --size 2048
     disabled
     user system
     group system
diff --git a/trusty/utils/spiproxyd/Android.bp b/trusty/utils/spiproxyd/Android.bp
new file mode 100644
index 0000000..c1d0987
--- /dev/null
+++ b/trusty/utils/spiproxyd/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2020 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.
+
+cc_binary {
+    name: "spiproxyd",
+    vendor: true,
+
+    srcs: [
+        "main.c",
+    ],
+
+    shared_libs: [
+        "liblog",
+        "libtrusty",
+    ],
+
+    init_rc: [
+        "proxy.rc",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/trusty/utils/spiproxyd/main.c b/trusty/utils/spiproxyd/main.c
new file mode 100644
index 0000000..c10866b
--- /dev/null
+++ b/trusty/utils/spiproxyd/main.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#define LOG_TAG "spiproxyd"
+
+#include <assert.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <log/log.h>
+#include <stdlib.h>
+#include <string.h>
+#include <trusty/tipc.h>
+#include <unistd.h>
+
+int handle_msg(int trusty_dev_fd, int spi_dev_fd) {
+    int rc;
+    uint8_t msg_buf[4096];
+    size_t msg_len;
+
+    /* read request from SPI Trusty app */
+    rc = read(trusty_dev_fd, &msg_buf, sizeof(msg_buf));
+    if (rc < 0) {
+        ALOGE("failed (%d) to read request from TA\n", rc);
+        return rc;
+    }
+    msg_len = rc;
+
+    /* forward request to SPI host device */
+    rc = write(spi_dev_fd, &msg_buf, msg_len);
+    if (rc < 0 || (size_t)rc != msg_len) {
+        ALOGE("failed (%d) to forward request to host\n", rc);
+        return rc < 0 ? rc : -1;
+    }
+
+    /* read response from SPI host device */
+    rc = read(spi_dev_fd, &msg_buf, sizeof(msg_buf));
+    if (rc < 0) {
+        ALOGE("failed (%d) to read response from host\n", rc);
+        return rc;
+    }
+    msg_len = rc;
+
+    /* forward response to SPI Trusty app */
+    rc = write(trusty_dev_fd, &msg_buf, msg_len);
+    if (rc < 0 || (size_t)rc != msg_len) {
+        ALOGE("failed (%d) to forward response to TA\n", rc);
+        return rc < 0 ? rc : -1;
+    }
+
+    return 0;
+}
+
+int event_loop(int trusty_dev_fd, int spi_dev_fd) {
+    while (true) {
+        int rc = handle_msg(trusty_dev_fd, spi_dev_fd);
+        if (rc < 0) {
+            ALOGE("exiting event loop\n");
+            return EXIT_FAILURE;
+        }
+    }
+}
+
+static void show_usage() {
+    ALOGE("usage: spiproxyd -t TRUSTY_DEVICE -s SPI_DEVICE -p SPI_PROXY_PORT\n");
+}
+
+static void parse_args(int argc, char* argv[], const char** trusty_dev_name,
+                       const char** spi_dev_name, const char** spi_proxy_port) {
+    int opt;
+    while ((opt = getopt(argc, argv, "ht:s:p:")) != -1) {
+        switch (opt) {
+            case 'h':
+                show_usage();
+                exit(EXIT_SUCCESS);
+                break;
+            case 't':
+                *trusty_dev_name = strdup(optarg);
+                break;
+            case 's':
+                *spi_dev_name = strdup(optarg);
+                break;
+            case 'p':
+                *spi_proxy_port = strdup(optarg);
+                break;
+            default:
+                show_usage();
+                exit(EXIT_FAILURE);
+                break;
+        }
+    }
+
+    if (!*trusty_dev_name || !*spi_dev_name || !*spi_proxy_port) {
+        show_usage();
+        exit(EXIT_FAILURE);
+    }
+}
+
+int main(int argc, char* argv[]) {
+    int rc;
+    const char* trusty_dev_name = NULL;
+    const char* spi_dev_name = NULL;
+    const char* spi_proxy_port = NULL;
+    int trusty_dev_fd;
+    int spi_dev_fd;
+
+    parse_args(argc, argv, &trusty_dev_name, &spi_dev_name, &spi_proxy_port);
+
+    rc = tipc_connect(trusty_dev_name, spi_proxy_port);
+    if (rc < 0) {
+        ALOGE("failed (%d) to connect to SPI proxy port\n", rc);
+        return rc;
+    }
+    trusty_dev_fd = rc;
+
+    rc = open(spi_dev_name, O_RDWR, 0);
+    if (rc < 0) {
+        ALOGE("failed (%d) to open SPI device\n", rc);
+        return rc;
+    }
+    spi_dev_fd = rc;
+
+    return event_loop(trusty_dev_fd, spi_dev_fd);
+}
diff --git a/trusty/utils/spiproxyd/proxy.rc b/trusty/utils/spiproxyd/proxy.rc
new file mode 100644
index 0000000..7d63e6a
--- /dev/null
+++ b/trusty/utils/spiproxyd/proxy.rc
@@ -0,0 +1,20 @@
+# Copyright (C) 2020 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.
+
+service spiproxyd /vendor/bin/spiproxyd -t /dev/trusty-ipc-dev0 \
+        -s /dev/vport3p2 -p com.android.trusty.spi.proxy
+    class main
+    user system
+    group system
+    oneshot
diff --git a/trusty/utils/trusty-ut-ctrl/Android.bp b/trusty/utils/trusty-ut-ctrl/Android.bp
index 9c8af7b..664696a 100644
--- a/trusty/utils/trusty-ut-ctrl/Android.bp
+++ b/trusty/utils/trusty-ut-ctrl/Android.bp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_test {
+cc_binary {
     name: "trusty-ut-ctrl",
     vendor: true,
 
@@ -24,7 +24,6 @@
     static_libs: [
         "libtrusty",
     ],
-    gtest: false,
     cflags: [
         "-Wall",
         "-Werror",
