diff --git a/adb_install.cpp b/adb_install.cpp
index 79b8df9..e7d7758 100644
--- a/adb_install.cpp
+++ b/adb_install.cpp
@@ -14,124 +14,121 @@
  * limitations under the License.
  */
 
-#include <unistd.h>
-#include <dirent.h>
+#include "adb_install.h"
+
 #include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <fcntl.h>
-
-#include "ui.h"
-#include "install.h"
-#include "common.h"
-#include "adb_install.h"
-#include "minadbd/fuse_adb_provider.h"
-#include "fuse_sideload.h"
+#include <unistd.h>
 
 #include <android-base/properties.h>
 
-static void set_usb_driver(RecoveryUI* ui, bool enabled) {
-    int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY);
-    if (fd < 0) {
-        ui->Print("failed to open driver control: %s\n", strerror(errno));
-        return;
-    }
-    if (TEMP_FAILURE_RETRY(write(fd, enabled ? "1" : "0", 1)) == -1) {
-        ui->Print("failed to set driver control: %s\n", strerror(errno));
-    }
-    if (close(fd) < 0) {
-        ui->Print("failed to close driver control: %s\n", strerror(errno));
-    }
+#include "common.h"
+#include "fuse_sideload.h"
+#include "install.h"
+#include "ui.h"
+
+static void set_usb_driver(bool enabled) {
+  int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY);
+  if (fd < 0) {
+    ui->Print("failed to open driver control: %s\n", strerror(errno));
+    return;
+  }
+  if (TEMP_FAILURE_RETRY(write(fd, enabled ? "1" : "0", 1)) == -1) {
+    ui->Print("failed to set driver control: %s\n", strerror(errno));
+  }
+  if (close(fd) < 0) {
+    ui->Print("failed to close driver control: %s\n", strerror(errno));
+  }
 }
 
-static void stop_adbd(RecoveryUI* ui) {
-    ui->Print("Stopping adbd...\n");
-    android::base::SetProperty("ctl.stop", "adbd");
-    set_usb_driver(ui, false);
+static void stop_adbd() {
+  ui->Print("Stopping adbd...\n");
+  android::base::SetProperty("ctl.stop", "adbd");
+  set_usb_driver(false);
 }
 
-static void maybe_restart_adbd(RecoveryUI* ui) {
-    if (is_ro_debuggable()) {
-        ui->Print("Restarting adbd...\n");
-        set_usb_driver(ui, true);
-        android::base::SetProperty("ctl.start", "adbd");
-    }
+static void maybe_restart_adbd() {
+  if (is_ro_debuggable()) {
+    ui->Print("Restarting adbd...\n");
+    set_usb_driver(true);
+    android::base::SetProperty("ctl.start", "adbd");
+  }
 }
 
-// How long (in seconds) we wait for the host to start sending us a
-// package, before timing out.
-#define ADB_INSTALL_TIMEOUT 300
+int apply_from_adb(bool* wipe_cache, const char* install_file) {
+  modified_flash = true;
 
-int apply_from_adb(RecoveryUI* ui, bool* wipe_cache, const char* install_file) {
-    modified_flash = true;
+  stop_adbd();
+  set_usb_driver(true);
 
-    stop_adbd(ui);
-    set_usb_driver(ui, true);
+  ui->Print(
+      "\n\nNow send the package you want to apply\n"
+      "to the device with \"adb sideload <filename>\"...\n");
 
-    ui->Print("\n\nNow send the package you want to apply\n"
-              "to the device with \"adb sideload <filename>\"...\n");
+  pid_t child;
+  if ((child = fork()) == 0) {
+    execl("/sbin/recovery", "recovery", "--adbd", nullptr);
+    _exit(EXIT_FAILURE);
+  }
 
-    pid_t child;
-    if ((child = fork()) == 0) {
-        execl("/sbin/recovery", "recovery", "--adbd", NULL);
-        _exit(EXIT_FAILURE);
+  // How long (in seconds) we wait for the host to start sending us a package, before timing out.
+  static constexpr int ADB_INSTALL_TIMEOUT = 300;
+
+  // FUSE_SIDELOAD_HOST_PATHNAME will start to exist once the host connects and starts serving a
+  // package. Poll for its appearance. (Note that inotify doesn't work with FUSE.)
+  int result = INSTALL_ERROR;
+  int status;
+  bool waited = false;
+  for (int i = 0; i < ADB_INSTALL_TIMEOUT; ++i) {
+    if (waitpid(child, &status, WNOHANG) != 0) {
+      result = INSTALL_ERROR;
+      waited = true;
+      break;
     }
 
-    // FUSE_SIDELOAD_HOST_PATHNAME will start to exist once the host
-    // connects and starts serving a package.  Poll for its
-    // appearance.  (Note that inotify doesn't work with FUSE.)
-    int result = INSTALL_ERROR;
-    int status;
-    bool waited = false;
     struct stat st;
-    for (int i = 0; i < ADB_INSTALL_TIMEOUT; ++i) {
-        if (waitpid(child, &status, WNOHANG) != 0) {
-            result = INSTALL_ERROR;
-            waited = true;
-            break;
-        }
-
-        if (stat(FUSE_SIDELOAD_HOST_PATHNAME, &st) != 0) {
-            if (errno == ENOENT && i < ADB_INSTALL_TIMEOUT-1) {
-                sleep(1);
-                continue;
-            } else {
-                ui->Print("\nTimed out waiting for package.\n\n");
-                result = INSTALL_ERROR;
-                kill(child, SIGKILL);
-                break;
-            }
-        }
-        result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, install_file, false, 0);
+    if (stat(FUSE_SIDELOAD_HOST_PATHNAME, &st) != 0) {
+      if (errno == ENOENT && i < ADB_INSTALL_TIMEOUT - 1) {
+        sleep(1);
+        continue;
+      } else {
+        ui->Print("\nTimed out waiting for package.\n\n");
+        result = INSTALL_ERROR;
+        kill(child, SIGKILL);
         break;
+      }
     }
+    result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, install_file, false, 0);
+    break;
+  }
 
-    if (!waited) {
-        // Calling stat() on this magic filename signals the minadbd
-        // subprocess to shut down.
-        stat(FUSE_SIDELOAD_HOST_EXIT_PATHNAME, &st);
+  if (!waited) {
+    // Calling stat() on this magic filename signals the minadbd subprocess to shut down.
+    struct stat st;
+    stat(FUSE_SIDELOAD_HOST_EXIT_PATHNAME, &st);
 
-        // TODO(dougz): there should be a way to cancel waiting for a
-        // package (by pushing some button combo on the device).  For now
-        // you just have to 'adb sideload' a file that's not a valid
-        // package, like "/dev/null".
-        waitpid(child, &status, 0);
+    // TODO: there should be a way to cancel waiting for a package (by pushing some button combo on
+    // the device). For now you just have to 'adb sideload' a file that's not a valid package, like
+    // "/dev/null".
+    waitpid(child, &status, 0);
+  }
+
+  if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+    if (WEXITSTATUS(status) == 3) {
+      ui->Print("\nYou need adb 1.0.32 or newer to sideload\nto this device.\n\n");
+    } else if (!WIFSIGNALED(status)) {
+      ui->Print("\n(adbd status %d)\n", WEXITSTATUS(status));
     }
+  }
 
-    if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
-        if (WEXITSTATUS(status) == 3) {
-            ui->Print("\nYou need adb 1.0.32 or newer to sideload\nto this device.\n\n");
-        } else if (!WIFSIGNALED(status)) {
-            ui->Print("\n(adbd status %d)\n", WEXITSTATUS(status));
-        }
-    }
+  set_usb_driver(false);
+  maybe_restart_adbd();
 
-    set_usb_driver(ui, false);
-    maybe_restart_adbd(ui);
-
-    return result;
+  return result;
 }
diff --git a/adb_install.h b/adb_install.h
index efad436..e654c89 100644
--- a/adb_install.h
+++ b/adb_install.h
@@ -17,8 +17,6 @@
 #ifndef _ADB_INSTALL_H
 #define _ADB_INSTALL_H
 
-class RecoveryUI;
-
-int apply_from_adb(RecoveryUI* h, bool* wipe_cache, const char* install_file);
+int apply_from_adb(bool* wipe_cache, const char* install_file);
 
 #endif
diff --git a/common.h b/common.h
index bda7935..62fb132 100644
--- a/common.h
+++ b/common.h
@@ -43,4 +43,6 @@
 
 bool is_ro_debuggable();
 
+bool reboot(const std::string& command);
+
 #endif  // RECOVERY_COMMON_H
diff --git a/install.cpp b/install.cpp
index e945d13..689f4a0 100644
--- a/install.cpp
+++ b/install.cpp
@@ -100,7 +100,7 @@
 }
 
 // Read the build.version.incremental of src/tgt from the metadata and log it to last_install.
-static void read_source_target_build(ZipArchiveHandle zip, std::vector<std::string>& log_buffer) {
+static void read_source_target_build(ZipArchiveHandle zip, std::vector<std::string>* log_buffer) {
   std::string metadata;
   if (!read_metadata_from_package(zip, &metadata)) {
     return;
@@ -114,12 +114,12 @@
     if (android::base::StartsWith(str, "pre-build-incremental")) {
       int source_build = parse_build_number(str);
       if (source_build != -1) {
-        log_buffer.push_back(android::base::StringPrintf("source_build: %d", source_build));
+        log_buffer->push_back(android::base::StringPrintf("source_build: %d", source_build));
       }
     } else if (android::base::StartsWith(str, "post-build-incremental")) {
       int target_build = parse_build_number(str);
       if (target_build != -1) {
-        log_buffer.push_back(android::base::StringPrintf("target_build: %d", target_build));
+        log_buffer->push_back(android::base::StringPrintf("target_build: %d", target_build));
       }
     }
   }
@@ -308,8 +308,8 @@
 }
 
 // If the package contains an update binary, extract it and run it.
-static int try_update_binary(const char* path, ZipArchiveHandle zip, bool* wipe_cache,
-                             std::vector<std::string>& log_buffer, int retry_count,
+static int try_update_binary(const std::string& path, ZipArchiveHandle zip, bool* wipe_cache,
+                             std::vector<std::string>* log_buffer, int retry_count,
                              int* max_temperature) {
   read_source_target_build(zip, log_buffer);
 
@@ -452,7 +452,7 @@
     } else if (command == "log") {
       if (!args.empty()) {
         // Save the logging request from updater and write to last_install later.
-        log_buffer.push_back(args);
+        log_buffer->push_back(args);
       } else {
         LOG(ERROR) << "invalid \"log\" parameters: " << line;
       }
@@ -547,78 +547,77 @@
   return false;
 }
 
-static int
-really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
-                       std::vector<std::string>& log_buffer, int retry_count, int* max_temperature)
-{
-    ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
-    ui->Print("Finding update package...\n");
-    // Give verification half the progress bar...
-    ui->SetProgressType(RecoveryUI::DETERMINATE);
-    ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
-    LOG(INFO) << "Update location: " << path;
+static int really_install_package(const std::string& path, bool* wipe_cache, bool needs_mount,
+                                  std::vector<std::string>* log_buffer, int retry_count,
+                                  int* max_temperature) {
+  ui->SetBackground(RecoveryUI::INSTALLING_UPDATE);
+  ui->Print("Finding update package...\n");
+  // Give verification half the progress bar...
+  ui->SetProgressType(RecoveryUI::DETERMINATE);
+  ui->ShowProgress(VERIFICATION_PROGRESS_FRACTION, VERIFICATION_PROGRESS_TIME);
+  LOG(INFO) << "Update location: " << path;
 
-    // Map the update package into memory.
-    ui->Print("Opening update package...\n");
+  // Map the update package into memory.
+  ui->Print("Opening update package...\n");
 
-    if (path && needs_mount) {
-        if (path[0] == '@') {
-            ensure_path_mounted(path+1);
-        } else {
-            ensure_path_mounted(path);
-        }
+  if (needs_mount) {
+    if (path[0] == '@') {
+      ensure_path_mounted(path.substr(1).c_str());
+    } else {
+      ensure_path_mounted(path.c_str());
     }
+  }
 
-    MemMapping map;
-    if (sysMapFile(path, &map) != 0) {
-        LOG(ERROR) << "failed to map file";
-        return INSTALL_CORRUPT;
-    }
+  MemMapping map;
+  if (!map.MapFile(path)) {
+    LOG(ERROR) << "failed to map file";
+    return INSTALL_CORRUPT;
+  }
 
-    // Verify package.
-    if (!verify_package(map.addr, map.length)) {
-        log_buffer.push_back(android::base::StringPrintf("error: %d", kZipVerificationFailure));
-        sysReleaseMap(&map);
-        return INSTALL_CORRUPT;
-    }
+  // Verify package.
+  if (!verify_package(map.addr, map.length)) {
+    log_buffer->push_back(android::base::StringPrintf("error: %d", kZipVerificationFailure));
+    return INSTALL_CORRUPT;
+  }
 
-    // Try to open the package.
-    ZipArchiveHandle zip;
-    int err = OpenArchiveFromMemory(map.addr, map.length, path, &zip);
-    if (err != 0) {
-        LOG(ERROR) << "Can't open " << path << " : " << ErrorCodeString(err);
-        log_buffer.push_back(android::base::StringPrintf("error: %d", kZipOpenFailure));
+  // Try to open the package.
+  ZipArchiveHandle zip;
+  int err = OpenArchiveFromMemory(map.addr, map.length, path.c_str(), &zip);
+  if (err != 0) {
+    LOG(ERROR) << "Can't open " << path << " : " << ErrorCodeString(err);
+    log_buffer->push_back(android::base::StringPrintf("error: %d", kZipOpenFailure));
 
-        sysReleaseMap(&map);
-        CloseArchive(zip);
-        return INSTALL_CORRUPT;
-    }
-
-    // Additionally verify the compatibility of the package.
-    if (!verify_package_compatibility(zip)) {
-      log_buffer.push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure));
-      sysReleaseMap(&map);
-      CloseArchive(zip);
-      return INSTALL_CORRUPT;
-    }
-
-    // Verify and install the contents of the package.
-    ui->Print("Installing update...\n");
-    if (retry_count > 0) {
-        ui->Print("Retry attempt: %d\n", retry_count);
-    }
-    ui->SetEnableReboot(false);
-    int result = try_update_binary(path, zip, wipe_cache, log_buffer, retry_count, max_temperature);
-    ui->SetEnableReboot(true);
-    ui->Print("\n");
-
-    sysReleaseMap(&map);
     CloseArchive(zip);
-    return result;
+    return INSTALL_CORRUPT;
+  }
+
+  // Additionally verify the compatibility of the package.
+  if (!verify_package_compatibility(zip)) {
+    log_buffer->push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure));
+    CloseArchive(zip);
+    return INSTALL_CORRUPT;
+  }
+
+  // Verify and install the contents of the package.
+  ui->Print("Installing update...\n");
+  if (retry_count > 0) {
+    ui->Print("Retry attempt: %d\n", retry_count);
+  }
+  ui->SetEnableReboot(false);
+  int result = try_update_binary(path, zip, wipe_cache, log_buffer, retry_count, max_temperature);
+  ui->SetEnableReboot(true);
+  ui->Print("\n");
+
+  CloseArchive(zip);
+  return result;
 }
 
-int install_package(const char* path, bool* wipe_cache, const char* install_file, bool needs_mount,
-                    int retry_count) {
+int install_package(const std::string& path, bool* wipe_cache, const std::string& install_file,
+                    bool needs_mount, int retry_count) {
+  CHECK(!path.empty());
+  CHECK(!install_file.empty());
+  CHECK(wipe_cache != nullptr);
+
   modified_flash = true;
   auto start = std::chrono::system_clock::now();
 
@@ -631,7 +630,7 @@
     LOG(ERROR) << "failed to set up expected mounts for install; aborting";
     result = INSTALL_ERROR;
   } else {
-    result = really_install_package(path, wipe_cache, needs_mount, log_buffer, retry_count,
+    result = really_install_package(path, wipe_cache, needs_mount, &log_buffer, retry_count,
                                     &max_temperature);
   }
 
diff --git a/install.h b/install.h
index 68f0a8d..f3fda30 100644
--- a/install.h
+++ b/install.h
@@ -23,10 +23,9 @@
 enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE, INSTALL_SKIPPED,
         INSTALL_RETRY };
 
-// Install the package specified by root_path.  If INSTALL_SUCCESS is
-// returned and *wipe_cache is true on exit, caller should wipe the
-// cache partition.
-int install_package(const char* root_path, bool* wipe_cache, const char* install_file,
+// Installs the given update package. If INSTALL_SUCCESS is returned and *wipe_cache is true on
+// exit, caller should wipe the cache partition.
+int install_package(const std::string& package, bool* wipe_cache, const std::string& install_file,
                     bool needs_mount, int retry_count);
 
 // Verify the package by ota keys. Return true if the package is verified successfully,
@@ -35,9 +34,9 @@
 
 // Read meta data file of the package, write its content in the string pointed by meta_data.
 // Return true if succeed, otherwise return false.
-bool read_metadata_from_package(ZipArchiveHandle zip, std::string* meta_data);
+bool read_metadata_from_package(ZipArchiveHandle zip, std::string* metadata);
 
-// Verifes the compatibility info in a Treble-compatible package. Returns true directly if the
+// Verifies the compatibility info in a Treble-compatible package. Returns true directly if the
 // entry doesn't exist.
 bool verify_package_compatibility(ZipArchiveHandle package_zip);
 
diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp
index 1b15a04..a59df00 100644
--- a/minui/graphics_adf.cpp
+++ b/minui/graphics_adf.cpp
@@ -28,7 +28,8 @@
 
 #include "minui/minui.h"
 
-MinuiBackendAdf::MinuiBackendAdf() : intf_fd(-1), dev(), n_surfaces(0), surfaces() {}
+MinuiBackendAdf::MinuiBackendAdf()
+    : intf_fd(-1), dev(), current_surface(0), n_surfaces(0), surfaces() {}
 
 int MinuiBackendAdf::SurfaceInit(const drm_mode_modeinfo* mode, GRSurfaceAdf* surf) {
   *surf = {};
diff --git a/otautil/SysUtil.cpp b/otautil/SysUtil.cpp
index a2133b9..dfa2150 100644
--- a/otautil/SysUtil.cpp
+++ b/otautil/SysUtil.cpp
@@ -16,14 +16,12 @@
 
 #include "SysUtil.h"
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stdint.h>
+#include <stdint.h>  // SIZE_MAX
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#include <algorithm>
 #include <string>
 #include <vector>
 
@@ -32,9 +30,7 @@
 #include <android-base/strings.h>
 #include <android-base/unique_fd.h>
 
-static bool sysMapFD(int fd, MemMapping* pMap) {
-  CHECK(pMap != nullptr);
-
+bool MemMapping::MapFD(int fd) {
   struct stat sb;
   if (fstat(fd, &sb) == -1) {
     PLOG(ERROR) << "fstat(" << fd << ") failed";
@@ -47,50 +43,49 @@
     return false;
   }
 
-  pMap->addr = static_cast<unsigned char*>(memPtr);
-  pMap->length = sb.st_size;
-  pMap->ranges.push_back({ memPtr, static_cast<size_t>(sb.st_size) });
+  addr = static_cast<unsigned char*>(memPtr);
+  length = sb.st_size;
+  ranges_.clear();
+  ranges_.emplace_back(MappedRange{ memPtr, static_cast<size_t>(sb.st_size) });
 
   return true;
 }
 
 // A "block map" which looks like this (from uncrypt/uncrypt.cpp):
 //
-//     /dev/block/platform/msm_sdcc.1/by-name/userdata     # block device
-//     49652 4096                        # file size in bytes, block size
-//     3                                 # count of block ranges
-//     1000 1008                         # block range 0
-//     2100 2102                         # ... block range 1
-//     30 33                             # ... block range 2
+//   /dev/block/platform/msm_sdcc.1/by-name/userdata     # block device
+//   49652 4096                                          # file size in bytes, block size
+//   3                                                   # count of block ranges
+//   1000 1008                                           # block range 0
+//   2100 2102                                           # ... block range 1
+//   30 33                                               # ... block range 2
 //
-// Each block range represents a half-open interval; the line "30 33"
-// reprents the blocks [30, 31, 32].
-static int sysMapBlockFile(const char* filename, MemMapping* pMap) {
-  CHECK(pMap != nullptr);
-
+// Each block range represents a half-open interval; the line "30 33" reprents the blocks
+// [30, 31, 32].
+bool MemMapping::MapBlockFile(const std::string& filename) {
   std::string content;
   if (!android::base::ReadFileToString(filename, &content)) {
     PLOG(ERROR) << "Failed to read " << filename;
-    return -1;
+    return false;
   }
 
   std::vector<std::string> lines = android::base::Split(android::base::Trim(content), "\n");
   if (lines.size() < 4) {
     LOG(ERROR) << "Block map file is too short: " << lines.size();
-    return -1;
+    return false;
   }
 
   size_t size;
-  unsigned int blksize;
-  if (sscanf(lines[1].c_str(), "%zu %u", &size, &blksize) != 2) {
+  size_t blksize;
+  if (sscanf(lines[1].c_str(), "%zu %zu", &size, &blksize) != 2) {
     LOG(ERROR) << "Failed to parse file size and block size: " << lines[1];
-    return -1;
+    return false;
   }
 
   size_t range_count;
   if (sscanf(lines[2].c_str(), "%zu", &range_count) != 1) {
     LOG(ERROR) << "Failed to parse block map header: " << lines[2];
-    return -1;
+    return false;
   }
 
   size_t blocks;
@@ -101,14 +96,14 @@
       lines.size() != 3 + range_count) {
     LOG(ERROR) << "Invalid data in block map file: size " << size << ", blksize " << blksize
                << ", range_count " << range_count << ", lines " << lines.size();
-    return -1;
+    return false;
   }
 
   // Reserve enough contiguous address space for the whole file.
   void* reserve = mmap64(nullptr, blocks * blksize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
   if (reserve == MAP_FAILED) {
     PLOG(ERROR) << "failed to reserve address space";
-    return -1;
+    return false;
   }
 
   const std::string& block_dev = lines[0];
@@ -116,10 +111,10 @@
   if (fd == -1) {
     PLOG(ERROR) << "failed to open block device " << block_dev;
     munmap(reserve, blocks * blksize);
-    return -1;
+    return false;
   }
 
-  pMap->ranges.resize(range_count);
+  ranges_.clear();
 
   unsigned char* next = static_cast<unsigned char*>(reserve);
   size_t remaining_size = blocks * blksize;
@@ -129,84 +124,79 @@
 
     size_t start, end;
     if (sscanf(line.c_str(), "%zu %zu\n", &start, &end) != 2) {
-      LOG(ERROR) << "failed to parse range " << i << " in block map: " << line;
+      LOG(ERROR) << "failed to parse range " << i << ": " << line;
       success = false;
       break;
     }
-    size_t length = (end - start) * blksize;
-    if (end <= start || (end - start) > SIZE_MAX / blksize || length > remaining_size) {
-      LOG(ERROR) << "unexpected range in block map: " << start << " " << end;
+    size_t range_size = (end - start) * blksize;
+    if (end <= start || (end - start) > SIZE_MAX / blksize || range_size > remaining_size) {
+      LOG(ERROR) << "Invalid range: " << start << " " << end;
       success = false;
       break;
     }
 
-    void* addr = mmap64(next, length, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd,
-                        static_cast<off64_t>(start) * blksize);
-    if (addr == MAP_FAILED) {
-      PLOG(ERROR) << "failed to map block " << i;
+    void* range_start = mmap64(next, range_size, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd,
+                               static_cast<off64_t>(start) * blksize);
+    if (range_start == MAP_FAILED) {
+      PLOG(ERROR) << "failed to map range " << i << ": " << line;
       success = false;
       break;
     }
-    pMap->ranges[i].addr = addr;
-    pMap->ranges[i].length = length;
+    ranges_.emplace_back(MappedRange{ range_start, range_size });
 
-    next += length;
-    remaining_size -= length;
+    next += range_size;
+    remaining_size -= range_size;
   }
   if (success && remaining_size != 0) {
-    LOG(ERROR) << "ranges in block map are invalid: remaining_size = " << remaining_size;
+    LOG(ERROR) << "Invalid ranges: remaining_size " << remaining_size;
     success = false;
   }
   if (!success) {
     munmap(reserve, blocks * blksize);
-    return -1;
+    return false;
   }
 
-  pMap->addr = static_cast<unsigned char*>(reserve);
-  pMap->length = size;
+  addr = static_cast<unsigned char*>(reserve);
+  length = size;
 
   LOG(INFO) << "mmapped " << range_count << " ranges";
 
-  return 0;
+  return true;
 }
 
-int sysMapFile(const char* fn, MemMapping* pMap) {
-  if (fn == nullptr || pMap == nullptr) {
-    LOG(ERROR) << "Invalid argument(s)";
-    return -1;
+bool MemMapping::MapFile(const std::string& fn) {
+  if (fn.empty()) {
+    LOG(ERROR) << "Empty filename";
+    return false;
   }
 
-  *pMap = {};
-
   if (fn[0] == '@') {
-    if (sysMapBlockFile(fn + 1, pMap) != 0) {
+    // Block map file "@/cache/recovery/block.map".
+    if (!MapBlockFile(fn.substr(1))) {
       LOG(ERROR) << "Map of '" << fn << "' failed";
-      return -1;
+      return false;
     }
   } else {
     // This is a regular file.
-    android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn, O_RDONLY)));
+    android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn.c_str(), O_RDONLY)));
     if (fd == -1) {
       PLOG(ERROR) << "Unable to open '" << fn << "'";
-      return -1;
+      return false;
     }
 
-    if (!sysMapFD(fd, pMap)) {
+    if (!MapFD(fd)) {
       LOG(ERROR) << "Map of '" << fn << "' failed";
-      return -1;
+      return false;
     }
   }
-  return 0;
+  return true;
 }
 
-/*
- * Release a memory mapping.
- */
-void sysReleaseMap(MemMapping* pMap) {
-  std::for_each(pMap->ranges.cbegin(), pMap->ranges.cend(), [](const MappedRange& range) {
+MemMapping::~MemMapping() {
+  for (const auto& range : ranges_) {
     if (munmap(range.addr, range.length) == -1) {
-      PLOG(ERROR) << "munmap(" << range.addr << ", " << range.length << ") failed";
+      PLOG(ERROR) << "Failed to munmap(" << range.addr << ", " << range.length << ")";
     }
-  });
-  pMap->ranges.clear();
+  };
+  ranges_.clear();
 }
diff --git a/otautil/SysUtil.h b/otautil/SysUtil.h
index 6a79bf3..52f6d20 100644
--- a/otautil/SysUtil.h
+++ b/otautil/SysUtil.h
@@ -19,37 +19,35 @@
 
 #include <sys/types.h>
 
+#include <string>
 #include <vector>
 
-struct MappedRange {
-  void* addr;
-  size_t length;
-};
-
 /*
  * Use this to keep track of mapped segments.
  */
-struct MemMapping {
-  unsigned char* addr; /* start of data */
-  size_t length;       /* length of data */
+class MemMapping {
+ public:
+  ~MemMapping();
+  // Map a file into a private, read-only memory segment. If 'filename' begins with an '@'
+  // character, it is a map of blocks to be mapped, otherwise it is treated as an ordinary file.
+  bool MapFile(const std::string& filename);
+  size_t ranges() const {
+    return ranges_.size();
+  };
 
-  std::vector<MappedRange> ranges;
+  unsigned char* addr;  // start of data
+  size_t length;        // length of data
+
+ private:
+  struct MappedRange {
+    void* addr;
+    size_t length;
+  };
+
+  bool MapBlockFile(const std::string& filename);
+  bool MapFD(int fd);
+
+  std::vector<MappedRange> ranges_;
 };
 
-/*
- * Map a file into a private, read-only memory segment.  If 'fn'
- * begins with an '@' character, it is a map of blocks to be mapped,
- * otherwise it is treated as an ordinary file.
- *
- * On success, "pMap" is filled in, and zero is returned.
- */
-int sysMapFile(const char* fn, MemMapping* pMap);
-
-/*
- * Release the pages associated with a shared memory segment.
- *
- * This does not free "pMap"; it just releases the memory.
- */
-void sysReleaseMap(MemMapping* pMap);
-
 #endif  // _OTAUTIL_SYSUTIL
diff --git a/recovery.cpp b/recovery.cpp
index 5876981..944c240 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -208,6 +208,14 @@
     return android::base::GetBoolProperty("ro.debuggable", false);
 }
 
+bool reboot(const std::string& command) {
+    std::string cmd = command;
+    if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+        cmd += ",quiescent";
+    }
+    return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
+}
+
 static void redirect_stdio(const char* filename) {
     int pipefd[2];
     if (pipe(pipefd) == -1) {
@@ -1147,7 +1155,7 @@
         {
           bool adb = (chosen_action == Device::APPLY_ADB_SIDELOAD);
           if (adb) {
-            status = apply_from_adb(ui, &should_wipe_cache, TEMPORARY_INSTALL_FILE);
+            status = apply_from_adb(&should_wipe_cache, TEMPORARY_INSTALL_FILE);
           } else {
             status = apply_from_sdcard(device, &should_wipe_cache);
           }
@@ -1448,12 +1456,18 @@
     printf("reason is [%s]\n", reason);
 
     Device* device = make_device();
-    ui = device->GetUI();
+    if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+        printf("Quiescent recovery mode.\n");
+        ui = new StubRecoveryUI();
+    } else {
+        ui = device->GetUI();
 
-    if (!ui->Init(locale)) {
-      printf("Failed to initialize UI, use stub UI instead.");
-      ui = new StubRecoveryUI();
+        if (!ui->Init(locale)) {
+            printf("Failed to initialize UI, use stub UI instead.\n");
+            ui = new StubRecoveryUI();
+        }
     }
+
     // Set background string to "installing security update" for security update,
     // otherwise set it to "installing system update".
     ui->SetSystemUpdateText(security_update);
@@ -1525,7 +1539,7 @@
                     ui->Print("Retry attempt %d\n", retry_count);
 
                     // Reboot and retry the update
-                    if (!android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,recovery")) {
+                    if (!reboot("reboot,recovery")) {
                         ui->Print("Reboot failed\n");
                     } else {
                         while (true) {
@@ -1570,7 +1584,7 @@
         if (!sideload_auto_reboot) {
             ui->ShowText(true);
         }
-        status = apply_from_adb(ui, &should_wipe_cache, TEMPORARY_INSTALL_FILE);
+        status = apply_from_adb(&should_wipe_cache, TEMPORARY_INSTALL_FILE);
         if (status == INSTALL_SUCCESS && should_wipe_cache) {
             if (!wipe_cache(false, device)) {
                 status = INSTALL_ERROR;
@@ -1630,7 +1644,7 @@
 
         default:
             ui->Print("Rebooting...\n");
-            android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,");
+            reboot("reboot,");
             break;
     }
     while (true) {
diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp
index dc4b5d7..35e87fd 100644
--- a/tests/component/updater_test.cpp
+++ b/tests/component/updater_test.cpp
@@ -570,7 +570,7 @@
   ASSERT_EQ(0, fclose(zip_file_ptr));
 
   MemMapping map;
-  ASSERT_EQ(0, sysMapFile(zip_file.path, &map));
+  ASSERT_TRUE(map.MapFile(zip_file.path));
   ZipArchiveHandle handle;
   ASSERT_EQ(0, OpenArchiveFromMemory(map.addr, map.length, zip_file.path, &handle));
 
@@ -646,7 +646,7 @@
   ASSERT_EQ(0, fclose(zip_file_ptr));
 
   MemMapping map;
-  ASSERT_EQ(0, sysMapFile(zip_file.path, &map));
+  ASSERT_TRUE(map.MapFile(zip_file.path));
   ZipArchiveHandle handle;
   ASSERT_EQ(0, OpenArchiveFromMemory(map.addr, map.length, zip_file.path, &handle));
 
diff --git a/tests/component/verifier_test.cpp b/tests/component/verifier_test.cpp
index 2cfb6d3..5338f05 100644
--- a/tests/component/verifier_test.cpp
+++ b/tests/component/verifier_test.cpp
@@ -38,7 +38,7 @@
   void SetUp() override {
     std::vector<std::string> args = GetParam();
     std::string package = from_testdata_base(args[0]);
-    if (sysMapFile(package.c_str(), &memmap) != 0) {
+    if (!memmap.MapFile(package)) {
       FAIL() << "Failed to mmap " << package << ": " << strerror(errno) << "\n";
     }
 
diff --git a/tests/unit/sysutil_test.cpp b/tests/unit/sysutil_test.cpp
index f469966..434ee25 100644
--- a/tests/unit/sysutil_test.cpp
+++ b/tests/unit/sysutil_test.cpp
@@ -27,27 +27,23 @@
   MemMapping mapping;
 
   // Invalid argument.
-  ASSERT_EQ(-1, sysMapFile(nullptr, &mapping));
-  ASSERT_EQ(-1, sysMapFile("/somefile", nullptr));
+  ASSERT_FALSE(mapping.MapFile(""));
 }
 
-TEST(SysUtilTest, sysMapFileRegularFile) {
+TEST(SysUtilTest, MapFileRegularFile) {
   TemporaryFile temp_file1;
   std::string content = "abc";
   ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file1.path));
 
-  // sysMapFile() should map the file to one range.
+  // MemMapping::MapFile() should map the file to one range.
   MemMapping mapping;
-  ASSERT_EQ(0, sysMapFile(temp_file1.path, &mapping));
+  ASSERT_TRUE(mapping.MapFile(temp_file1.path));
   ASSERT_NE(nullptr, mapping.addr);
   ASSERT_EQ(content.size(), mapping.length);
-  ASSERT_EQ(1U, mapping.ranges.size());
-
-  sysReleaseMap(&mapping);
-  ASSERT_EQ(0U, mapping.ranges.size());
+  ASSERT_EQ(1U, mapping.ranges());
 }
 
-TEST(SysUtilTest, sysMapFileBlockMap) {
+TEST(SysUtilTest, MapFileBlockMap) {
   // Create a file that has 10 blocks.
   TemporaryFile package;
   std::string content;
@@ -63,78 +59,72 @@
   std::string block_map_content = std::string(package.path) + "\n40960 4096\n1\n0 10\n";
   ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path));
 
-  ASSERT_EQ(0, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_TRUE(mapping.MapFile(filename));
   ASSERT_EQ(file_size, mapping.length);
-  ASSERT_EQ(1U, mapping.ranges.size());
+  ASSERT_EQ(1U, mapping.ranges());
 
   // It's okay to not have the trailing '\n'.
   block_map_content = std::string(package.path) + "\n40960 4096\n1\n0 10";
   ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path));
 
-  ASSERT_EQ(0, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_TRUE(mapping.MapFile(filename));
   ASSERT_EQ(file_size, mapping.length);
-  ASSERT_EQ(1U, mapping.ranges.size());
+  ASSERT_EQ(1U, mapping.ranges());
 
   // Or having multiple trailing '\n's.
   block_map_content = std::string(package.path) + "\n40960 4096\n1\n0 10\n\n\n";
   ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path));
 
-  ASSERT_EQ(0, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_TRUE(mapping.MapFile(filename));
   ASSERT_EQ(file_size, mapping.length);
-  ASSERT_EQ(1U, mapping.ranges.size());
+  ASSERT_EQ(1U, mapping.ranges());
 
   // Multiple ranges.
   block_map_content = std::string(package.path) + "\n40960 4096\n3\n0 3\n3 5\n5 10\n";
   ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path));
 
-  ASSERT_EQ(0, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_TRUE(mapping.MapFile(filename));
   ASSERT_EQ(file_size, mapping.length);
-  ASSERT_EQ(3U, mapping.ranges.size());
-
-  sysReleaseMap(&mapping);
-  ASSERT_EQ(0U, mapping.ranges.size());
+  ASSERT_EQ(3U, mapping.ranges());
 }
 
-TEST(SysUtilTest, sysMapFileBlockMapInvalidBlockMap) {
+TEST(SysUtilTest, MapFileBlockMapInvalidBlockMap) {
   MemMapping mapping;
   TemporaryFile temp_file;
   std::string filename = std::string("@") + temp_file.path;
 
   // Block map file is too short.
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n0\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   // Block map file has unexpected number of lines.
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n2\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   // Invalid size/blksize/range_count.
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\nabc 4096\n1\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   // size/blksize/range_count don't match.
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n0 4096\n1\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 0\n1\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n0\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
+  ASSERT_FALSE(mapping.MapFile(filename));
 
   // Invalid block dev path.
   ASSERT_TRUE(android::base::WriteStringToFile("/doesntexist\n4096 4096\n1\n0 1\n", temp_file.path));
-  ASSERT_EQ(-1, sysMapFile(filename.c_str(), &mapping));
-
-  sysReleaseMap(&mapping);
-  ASSERT_EQ(0U, mapping.ranges.size());
+  ASSERT_FALSE(mapping.MapFile(filename));
 }
diff --git a/tests/unit/zip_test.cpp b/tests/unit/zip_test.cpp
index 4a1a49b..df4e38c 100644
--- a/tests/unit/zip_test.cpp
+++ b/tests/unit/zip_test.cpp
@@ -66,9 +66,9 @@
 }
 
 TEST(ZipTest, OpenFromMemory) {
-  MemMapping map;
   std::string zip_path = from_testdata_base("ziptest_dummy-update.zip");
-  ASSERT_EQ(0, sysMapFile(zip_path.c_str(), &map));
+  MemMapping map;
+  ASSERT_TRUE(map.MapFile(zip_path));
 
   // Map an update package into memory and open the archive from there.
   ZipArchiveHandle handle;
@@ -85,6 +85,5 @@
   ASSERT_EQ(0, ExtractEntryToFile(handle, &binary_entry, tmp_binary.fd));
 
   CloseArchive(handle);
-  sysReleaseMap(&map);
 }
 
diff --git a/ui.cpp b/ui.cpp
index 9194ae3..cad7449 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -227,7 +227,7 @@
 
           case RecoveryUI::REBOOT:
             if (reboot_enabled) {
-                android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,");
+                reboot("reboot,");
                 while (true) { pause(); }
             }
             break;
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp
index 1950cbd..fdbcfde 100644
--- a/update_verifier/update_verifier.cpp
+++ b/update_verifier/update_verifier.cpp
@@ -44,6 +44,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <algorithm>
 #include <string>
 #include <vector>
 
@@ -142,17 +143,21 @@
       return false;
     }
 
-    static constexpr int BLOCKSIZE = 4096;
+    static constexpr size_t BLOCKSIZE = 4096;
     if (lseek64(fd.get(), static_cast<off64_t>(range_start) * BLOCKSIZE, SEEK_SET) == -1) {
       PLOG(ERROR) << "lseek to " << range_start << " failed";
       return false;
     }
 
-    size_t size = (range_end - range_start) * BLOCKSIZE;
-    std::vector<uint8_t> buf(size);
-    if (!android::base::ReadFully(fd.get(), buf.data(), size)) {
-      PLOG(ERROR) << "Failed to read blocks " << range_start << " to " << range_end;
-      return false;
+    size_t remain = (range_end - range_start) * BLOCKSIZE;
+    while (remain > 0) {
+      size_t to_read = std::min(remain, 1024 * BLOCKSIZE);
+      std::vector<uint8_t> buf(to_read);
+      if (!android::base::ReadFully(fd.get(), buf.data(), to_read)) {
+        PLOG(ERROR) << "Failed to read blocks " << range_start << " to " << range_end;
+        return false;
+      }
+      remain -= to_read;
     }
     blk_count += (range_end - range_start);
   }
diff --git a/updater/install.cpp b/updater/install.cpp
index 857d7f1..888239c 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -890,7 +890,10 @@
     return StringValue("");
   }
 
-  const std::string reboot_cmd = "reboot," + property;
+  std::string reboot_cmd = "reboot," + property;
+  if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
+    reboot_cmd += ",quiescent";
+  }
   android::base::SetProperty(ANDROID_RB_PROPERTY, reboot_cmd);
 
   sleep(5);
diff --git a/updater/updater.cpp b/updater/updater.cpp
index 37e003e..1be8b60 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -89,7 +89,7 @@
 
   const char* package_filename = argv[3];
   MemMapping map;
-  if (sysMapFile(package_filename, &map) != 0) {
+  if (!map.MapFile(package_filename)) {
     LOG(ERROR) << "failed to map package " << argv[3];
     return 3;
   }
@@ -215,7 +215,6 @@
   if (updater_info.package_zip) {
     CloseArchive(updater_info.package_zip);
   }
-  sysReleaseMap(&map);
 
   return 0;
 }
