Snap for 4393550 from a68bef7cd68a976bd0f105dc6d08f05701ec7fe3 to pi-release

Change-Id: If9fe939745bb824a90e651d24cc96e469be38472
diff --git a/Android.bp b/Android.bp
index 4c66c42..22407e0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
 subdirs = [
+    "applypatch",
     "bootloader_message",
     "edify",
     "otafault",
diff --git a/Android.mk b/Android.mk
index b40e23d..7e34c10 100644
--- a/Android.mk
+++ b/Android.mk
@@ -94,7 +94,7 @@
 endif
 
 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
-LOCAL_CFLAGS += -Wall -Wno-unused-parameter -Werror
+LOCAL_CFLAGS += -Wall -Werror
 
 ifneq ($(TARGET_RECOVERY_UI_MARGIN_HEIGHT),)
 LOCAL_CFLAGS += -DRECOVERY_UI_MARGIN_HEIGHT=$(TARGET_RECOVERY_UI_MARGIN_HEIGHT)
@@ -173,9 +173,7 @@
     libcutils \
     libutils \
     liblog \
-    libselinux \
-    libm \
-    libc
+    libselinux
 
 LOCAL_HAL_STATIC_LIBRARIES := libhealthd
 
@@ -229,6 +227,7 @@
     asn1_decoder.cpp \
     verifier.cpp
 LOCAL_STATIC_LIBRARIES := \
+    libotautil \
     libcrypto_utils \
     libcrypto \
     libbase
@@ -259,7 +258,6 @@
 include $(BUILD_STATIC_LIBRARY)
 
 include \
-    $(LOCAL_PATH)/applypatch/Android.mk \
     $(LOCAL_PATH)/boot_control/Android.mk \
     $(LOCAL_PATH)/minadbd/Android.mk \
     $(LOCAL_PATH)/minui/Android.mk \
diff --git a/OWNERS b/OWNERS
index 09754c6..b3f11dc 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,3 +1,3 @@
-enh+aosp-gerrit@google.com
+enh@google.com
 tbao@google.com
 xunchang@google.com
diff --git a/applypatch/Android.bp b/applypatch/Android.bp
new file mode 100644
index 0000000..db307df
--- /dev/null
+++ b/applypatch/Android.bp
@@ -0,0 +1,195 @@
+// 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: "applypatch_defaults",
+
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-DZLIB_CONST",
+        "-Wall",
+        "-Werror",
+    ],
+
+    local_include_dirs: [
+        "include",
+    ],
+}
+
+cc_library_static {
+    name: "libapplypatch",
+
+    defaults: [
+        "applypatch_defaults",
+    ],
+
+    srcs: [
+        "applypatch.cpp",
+        "bspatch.cpp",
+        "freecache.cpp",
+        "imgpatch.cpp",
+    ],
+
+    export_include_dirs: [
+        "include",
+    ],
+
+    static_libs: [
+        "libbase",
+        "libbspatch",
+        "libbz",
+        "libcrypto",
+        "libedify",
+        "libotafault",
+        "libotautil",
+        "libz",
+    ],
+}
+
+cc_library_static {
+    name: "libapplypatch_modes",
+
+    defaults: [
+        "applypatch_defaults",
+    ],
+
+    srcs: [
+        "applypatch_modes.cpp",
+    ],
+
+    static_libs: [
+        "libapplypatch",
+        "libbase",
+        "libcrypto",
+        "libedify",
+        "libotautil",
+    ],
+}
+
+cc_binary {
+    name: "applypatch",
+
+    defaults: [
+        "applypatch_defaults",
+    ],
+
+    srcs: [
+        "applypatch_main.cpp",
+    ],
+
+    static_libs: [
+        "libapplypatch_modes",
+        "libapplypatch",
+        "libedify",
+        "libotafault",
+        "libotautil",
+        "libbspatch",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libbz",
+        "libcrypto",
+        "liblog",
+        "libz",
+        "libziparchive",
+    ],
+}
+
+cc_library_static {
+    name: "libimgdiff",
+
+    host_supported: true,
+
+    defaults: [
+        "applypatch_defaults",
+    ],
+
+    srcs: [
+        "imgdiff.cpp",
+    ],
+
+    export_include_dirs: [
+        "include",
+    ],
+
+    static_libs: [
+        "libbase",
+        "libbsdiff",
+        "libdivsufsort",
+        "libdivsufsort64",
+        "liblog",
+        "libotautil",
+        "libutils",
+        "libz",
+        "libziparchive",
+    ],
+}
+
+cc_binary_host {
+    name: "imgdiff",
+
+    srcs: [
+        "imgdiff_main.cpp",
+    ],
+
+    defaults: [
+        "applypatch_defaults",
+    ],
+
+    static_libs: [
+        "libimgdiff",
+        "libbsdiff",
+        "libdivsufsort",
+        "libdivsufsort64",
+        "libziparchive",
+        "libbase",
+        "libutils",
+        "liblog",
+        "libbz",
+        "libz",
+    ],
+}
+
+cc_library_static {
+    name: "libimgpatch",
+
+    // The host module is for recovery_host_test (Linux only).
+    host_supported: true,
+
+    defaults: [
+        "applypatch_defaults",
+    ],
+
+    srcs: [
+        "bspatch.cpp",
+        "imgpatch.cpp",
+    ],
+
+    static_libs: [
+        "libbase",
+        "libbspatch",
+        "libbz",
+        "libcrypto",
+        "libedify",
+        "libotautil",
+        "libz",
+    ],
+
+    target: {
+        darwin: {
+            enabled: false,
+        },
+    },
+}
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
deleted file mode 100644
index 05d9370..0000000
--- a/applypatch/Android.mk
+++ /dev/null
@@ -1,198 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-# libapplypatch (static library)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    applypatch.cpp \
-    bspatch.cpp \
-    freecache.cpp \
-    imgpatch.cpp
-LOCAL_MODULE := libapplypatch
-LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/include \
-    bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_STATIC_LIBRARIES := \
-    libedify \
-    libotafault \
-    libbase \
-    libcrypto \
-    libbspatch \
-    libbz \
-    libz
-LOCAL_CFLAGS := \
-    -DZLIB_CONST \
-    -Wall \
-    -Werror
-include $(BUILD_STATIC_LIBRARY)
-
-# libimgpatch (static library)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    bspatch.cpp \
-    imgpatch.cpp
-LOCAL_MODULE := libimgpatch
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/include \
-    bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_STATIC_LIBRARIES := \
-    libedify \
-    libcrypto \
-    libbspatch \
-    libbase \
-    libbz \
-    libz
-LOCAL_CFLAGS := \
-    -DZLIB_CONST \
-    -Wall \
-    -Werror
-include $(BUILD_STATIC_LIBRARY)
-
-# libimgpatch (host static library)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    bspatch.cpp \
-    imgpatch.cpp
-LOCAL_MODULE := libimgpatch
-LOCAL_MODULE_HOST_OS := linux
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/include \
-    bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_STATIC_LIBRARIES := \
-    libedify \
-    libcrypto \
-    libbspatch \
-    libbase \
-    libbz \
-    libz
-LOCAL_CFLAGS := \
-    -DZLIB_CONST \
-    -Wall \
-    -Werror
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# libapplypatch_modes (static library)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    applypatch_modes.cpp
-LOCAL_MODULE := libapplypatch_modes
-LOCAL_C_INCLUDES := bootable/recovery
-LOCAL_STATIC_LIBRARIES := \
-    libapplypatch \
-    libbase \
-    libedify \
-    libcrypto
-LOCAL_CFLAGS := -Wall -Werror
-include $(BUILD_STATIC_LIBRARY)
-
-# applypatch (target executable)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := applypatch_main.cpp
-LOCAL_MODULE := applypatch
-LOCAL_C_INCLUDES := bootable/recovery
-LOCAL_STATIC_LIBRARIES := \
-    libapplypatch_modes \
-    libapplypatch \
-    libedify \
-    libotafault \
-    libotautil \
-    libbspatch \
-    libbase \
-    libziparchive \
-    liblog \
-    libcrypto \
-    libbz
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libz \
-    libcutils
-LOCAL_CFLAGS := -Wall -Werror
-include $(BUILD_EXECUTABLE)
-
-libimgdiff_src_files := imgdiff.cpp
-
-# libbsdiff is compiled with -D_FILE_OFFSET_BITS=64.
-libimgdiff_cflags := \
-    -Wall \
-    -Werror \
-    -D_FILE_OFFSET_BITS=64 \
-    -DZLIB_CONST
-
-libimgdiff_static_libraries := \
-    libbsdiff \
-    libdivsufsort \
-    libdivsufsort64 \
-    libziparchive \
-    libutils \
-    liblog \
-    libbase \
-    libz
-
-# libimgdiff (static library)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    $(libimgdiff_src_files)
-LOCAL_MODULE := libimgdiff
-LOCAL_CFLAGS := \
-    $(libimgdiff_cflags)
-LOCAL_STATIC_LIBRARIES := \
-    $(libimgdiff_static_libraries)
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/include \
-    bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-include $(BUILD_STATIC_LIBRARY)
-
-# libimgdiff (host static library)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    $(libimgdiff_src_files)
-LOCAL_MODULE := libimgdiff
-LOCAL_CFLAGS := \
-    $(libimgdiff_cflags)
-LOCAL_STATIC_LIBRARIES := \
-    $(libimgdiff_static_libraries)
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/include \
-    bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# imgdiff (host static executable)
-# ===============================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := imgdiff_main.cpp
-LOCAL_MODULE := imgdiff
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_STATIC_LIBRARIES := \
-    libimgdiff \
-    $(libimgdiff_static_libraries) \
-    libbz
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/include \
-    bootable/recovery
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/applypatch/Makefile b/applypatch/Makefile
deleted file mode 100644
index fb49843..0000000
--- a/applypatch/Makefile
+++ /dev/null
@@ -1,33 +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.
-
-# This file is for building imgdiff in Chrome OS.
-
-CPPFLAGS += -iquote.. -Iinclude
-CXXFLAGS += -std=c++11 -O3 -Wall -Werror
-LDLIBS += -lbz2 -lz
-
-.PHONY: all clean
-
-all: imgdiff libimgpatch.a
-
-clean:
-	rm -f *.o imgdiff libimgpatch.a
-
-imgdiff: imgdiff.o bsdiff.o utils.o
-	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDLIBS) -o $@ $^
-
-libimgpatch.a utils.o: CXXFLAGS += -fPIC
-libimgpatch.a: imgpatch.o bspatch.o utils.o
-	${AR} rcs $@ $^
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 729d2a9..c8b75df 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -40,7 +40,7 @@
 
 #include "edify/expr.h"
 #include "otafault/ota_io.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
 
 static int LoadPartitionContents(const std::string& filename, FileContents* file);
 static size_t FileSink(const unsigned char* data, size_t len, int fd);
diff --git a/applypatch/bspatch.cpp b/applypatch/bspatch.cpp
index b2f29fb..c291464 100644
--- a/applypatch/bspatch.cpp
+++ b/applypatch/bspatch.cpp
@@ -31,7 +31,7 @@
 
 #include "applypatch/applypatch.h"
 #include "edify/expr.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
 
 void ShowBSDiffLicense() {
     puts("The bsdiff library used herein is:\n"
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index c887a85..3a61a7d 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -166,7 +166,7 @@
 #include <zlib.h>
 
 #include "applypatch/imgdiff_image.h"
-#include "rangeset.h"
+#include "otautil/rangeset.h"
 
 using android::base::get_unaligned;
 
diff --git a/applypatch/include/applypatch/imgdiff_image.h b/applypatch/include/applypatch/imgdiff_image.h
index 491043d..3d29547 100644
--- a/applypatch/include/applypatch/imgdiff_image.h
+++ b/applypatch/include/applypatch/imgdiff_image.h
@@ -29,7 +29,7 @@
 #include <zlib.h>
 
 #include "imgdiff.h"
-#include "rangeset.h"
+#include "otautil/rangeset.h"
 
 class ImageChunk {
  public:
diff --git a/applypatch/libimgpatch.pc b/applypatch/libimgpatch.pc
deleted file mode 100644
index e500293..0000000
--- a/applypatch/libimgpatch.pc
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file is for libimgpatch in Chrome OS.
-
-Name: libimgpatch
-Description: Apply imgdiff patch
-Version: 0.0.1
-Libs: -limgpatch -lbz2 -lz
diff --git a/boot_control/Android.mk b/boot_control/Android.mk
index 27e3d97..9814d71 100644
--- a/boot_control/Android.mk
+++ b/boot_control/Android.mk
@@ -24,8 +24,7 @@
   -D_FILE_OFFSET_BITS=64 \
   -Werror \
   -Wall \
-  -Wextra \
-  -Wno-unused-parameter
+  -Wextra
 LOCAL_SHARED_LIBRARIES := liblog
 LOCAL_STATIC_LIBRARIES := libbootloader_message libfs_mgr libbase
 LOCAL_POST_INSTALL_CMD := \
diff --git a/minadbd/Android.mk b/minadbd/Android.mk
index 8d86fd6..803171d 100644
--- a/minadbd/Android.mk
+++ b/minadbd/Android.mk
@@ -1,13 +1,26 @@
 # Copyright 2005 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 
 LOCAL_PATH:= $(call my-dir)
 
 minadbd_cflags := \
     -Wall -Werror \
-    -Wno-unused-parameter \
     -Wno-missing-field-initializers \
     -DADB_HOST=0 \
 
+# libadbd (static library)
+# ===============================
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
@@ -24,6 +37,8 @@
 
 include $(BUILD_STATIC_LIBRARY)
 
+# minadbd_test (native test)
+# ===============================
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := minadbd_test
diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp
index 61c06cc..9f0f1f8 100644
--- a/minadbd/minadbd_services.cpp
+++ b/minadbd/minadbd_services.cpp
@@ -58,20 +58,20 @@
     return s[0];
 }
 
-int service_to_fd(const char* name, const atransport* transport) {
-    int ret = -1;
+int service_to_fd(const char* name, const atransport* /* transport */) {
+  int ret = -1;
 
-    if (!strncmp(name, "sideload:", 9)) {
-        // this exit status causes recovery to print a special error
-        // message saying to use a newer adb (that supports
-        // sideload-host).
-        exit(3);
-    } else if (!strncmp(name, "sideload-host:", 14)) {
-        std::string arg(name + 14);
-        ret = create_service_thread(sideload_host_service, arg);
-    }
-    if (ret >= 0) {
-        close_on_exec(ret);
-    }
-    return ret;
+  if (!strncmp(name, "sideload:", 9)) {
+    // this exit status causes recovery to print a special error
+    // message saying to use a newer adb (that supports
+    // sideload-host).
+    exit(3);
+  } else if (!strncmp(name, "sideload-host:", 14)) {
+    std::string arg(name + 14);
+    ret = create_service_thread(sideload_host_service, arg);
+  }
+  if (ret >= 0) {
+    close_on_exec(ret);
+  }
+  return ret;
 }
diff --git a/minui/Android.mk b/minui/Android.mk
index 1db401f..546ba2f 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -13,6 +13,9 @@
 # limitations under the License.
 
 LOCAL_PATH := $(call my-dir)
+
+# libminui (static library)
+# ===============================
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
@@ -66,6 +69,8 @@
 
 include $(BUILD_STATIC_LIBRARY)
 
+# libminui (shared library)
+# ===============================
 # Used by OEMs for factory test images.
 include $(CLEAR_VARS)
 LOCAL_MODULE := libminui
diff --git a/minui/events.cpp b/minui/events.cpp
index 24c2a82..2894c3b 100644
--- a/minui/events.cpp
+++ b/minui/events.cpp
@@ -15,6 +15,7 @@
  */
 
 #include <dirent.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <linux/input.h>
 #include <stdio.h>
diff --git a/otafault/ota_io.cpp b/otafault/ota_io.cpp
index 1308973..63ef18e 100644
--- a/otafault/ota_io.cpp
+++ b/otafault/ota_io.cpp
@@ -26,6 +26,7 @@
 
 #include <map>
 #include <mutex>
+#include <string>
 
 #include <android-base/thread_annotations.h>
 
diff --git a/otautil/SysUtil.cpp b/otautil/SysUtil.cpp
index 0655c47..48336ad 100644
--- a/otautil/SysUtil.cpp
+++ b/otautil/SysUtil.cpp
@@ -16,6 +16,7 @@
 
 #include "otautil/SysUtil.h"
 
+#include <errno.h>  // TEMP_FAILURE_RETRY
 #include <fcntl.h>
 #include <stdint.h>  // SIZE_MAX
 #include <sys/mman.h>
diff --git a/print_sha1.h b/otautil/include/otautil/print_sha1.h
similarity index 75%
rename from print_sha1.h
rename to otautil/include/otautil/print_sha1.h
index d0c18b3..03a8d29 100644
--- a/print_sha1.h
+++ b/otautil/include/otautil/print_sha1.h
@@ -23,25 +23,25 @@
 #include <openssl/sha.h>
 
 static std::string print_sha1(const uint8_t* sha1, size_t len) {
-    const char* hex = "0123456789abcdef";
-    std::string result = "";
-    for (size_t i = 0; i < len; ++i) {
-        result.push_back(hex[(sha1[i]>>4) & 0xf]);
-        result.push_back(hex[sha1[i] & 0xf]);
-    }
-    return result;
+  const char* hex = "0123456789abcdef";
+  std::string result = "";
+  for (size_t i = 0; i < len; ++i) {
+    result.push_back(hex[(sha1[i] >> 4) & 0xf]);
+    result.push_back(hex[sha1[i] & 0xf]);
+  }
+  return result;
 }
 
 [[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
-    return print_sha1(sha1, SHA_DIGEST_LENGTH);
+  return print_sha1(sha1, SHA_DIGEST_LENGTH);
 }
 
 [[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
-    return print_sha1(sha1, 4);
+  return print_sha1(sha1, 4);
 }
 
 [[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) {
-    return print_sha1(bytes, len);
+  return print_sha1(bytes, len);
 }
 
 #endif  // RECOVERY_PRINT_SHA1_H
diff --git a/rangeset.h b/otautil/include/otautil/rangeset.h
similarity index 100%
rename from rangeset.h
rename to otautil/include/otautil/rangeset.h
diff --git a/recovery.cpp b/recovery.cpp
index 243ee4a..a899163 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -1214,9 +1214,8 @@
   }
 }
 
-static void
-print_property(const char *key, const char *name, void *cookie) {
-    printf("%s=%s\n", key, name);
+static void print_property(const char* key, const char* name, void* /* cookie */) {
+  printf("%s=%s\n", key, name);
 }
 
 static std::string load_locale_from_cache() {
@@ -1250,14 +1249,14 @@
 
 static constexpr char log_characters[] = "VDIWEF";
 
-void UiLogger(android::base::LogId id, android::base::LogSeverity severity,
-               const char* tag, const char* file, unsigned int line,
-               const char* message) {
-    if (severity >= android::base::ERROR && ui != nullptr) {
-        ui->Print("E:%s\n", message);
-    } else {
-        fprintf(stdout, "%c:%s\n", log_characters[severity], message);
-    }
+void UiLogger(android::base::LogId /* id */, android::base::LogSeverity severity,
+              const char* /* tag */, const char* /* file */, unsigned int /* line */,
+              const char* message) {
+  if (severity >= android::base::ERROR && ui != nullptr) {
+    ui->Print("E:%s\n", message);
+  } else {
+    fprintf(stdout, "%c:%s\n", log_characters[severity], message);
+  }
 }
 
 static bool is_battery_ok() {
diff --git a/stub_ui.h b/stub_ui.h
index 85dbcfd..1f6b29a 100644
--- a/stub_ui.h
+++ b/stub_ui.h
@@ -24,18 +24,18 @@
  public:
   StubRecoveryUI() = default;
 
-  void SetBackground(Icon icon) override {}
-  void SetSystemUpdateText(bool security_update) override {}
+  void SetBackground(Icon /* icon */) override {}
+  void SetSystemUpdateText(bool /* security_update */) override {}
 
   // progress indicator
-  void SetProgressType(ProgressType type) override {}
-  void ShowProgress(float portion, float seconds) override {}
-  void SetProgress(float fraction) override {}
+  void SetProgressType(ProgressType /* type */) override {}
+  void ShowProgress(float /* portion */, float /* seconds */) override {}
+  void SetProgress(float /* fraction */) override {}
 
-  void SetStage(int current, int max) override {}
+  void SetStage(int /* current */, int /* max */) override {}
 
   // text log
-  void ShowText(bool visible) override {}
+  void ShowText(bool /* visible */) override {}
   bool IsTextVisible() override {
     return false;
   }
@@ -50,12 +50,12 @@
     vprintf(fmt, ap);
     va_end(ap);
   }
-  void PrintOnScreenOnly(const char* fmt, ...) override {}
-  void ShowFile(const char* filename) override {}
+  void PrintOnScreenOnly(const char* /* fmt */, ...) override {}
+  void ShowFile(const char* /* filename */) override {}
 
   // menu display
-  void StartMenu(const char* const* headers, const char* const* items,
-                 int initial_selection) override {}
+  void StartMenu(const char* const* /* headers */, const char* const* /* items */,
+                 int /* initial_selection */) override {}
   int SelectMenu(int sel) override {
     return sel;
   }
diff --git a/tests/Android.mk b/tests/Android.mk
index 31c7de1..b0f71a8 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -201,6 +201,7 @@
 LOCAL_STATIC_LIBRARIES := \
     libimgdiff \
     libimgpatch \
+    libotautil \
     libbsdiff \
     libbspatch \
     libziparchive \
diff --git a/tests/component/applypatch_test.cpp b/tests/component/applypatch_test.cpp
index 4254289..15ec08f 100644
--- a/tests/component/applypatch_test.cpp
+++ b/tests/component/applypatch_test.cpp
@@ -35,7 +35,7 @@
 #include "applypatch/applypatch.h"
 #include "applypatch/applypatch_modes.h"
 #include "common/test_constants.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
 
 static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) {
   ASSERT_NE(nullptr, sha1);
diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp
index e35870d..e6aec4a 100644
--- a/tests/component/updater_test.cpp
+++ b/tests/component/updater_test.cpp
@@ -41,7 +41,7 @@
 #include "edify/expr.h"
 #include "otautil/SysUtil.h"
 #include "otautil/error_code.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
 #include "updater/blockimg.h"
 #include "updater/install.h"
 #include "updater/updater.h"
diff --git a/tests/unit/rangeset_test.cpp b/tests/unit/rangeset_test.cpp
index 15bcec8..b3ed992 100644
--- a/tests/unit/rangeset_test.cpp
+++ b/tests/unit/rangeset_test.cpp
@@ -21,7 +21,7 @@
 
 #include <gtest/gtest.h>
 
-#include "rangeset.h"
+#include "otautil/rangeset.h"
 
 TEST(RangeSetTest, Parse_smoke) {
   RangeSet rs = RangeSet::Parse("2,1,10");
@@ -156,4 +156,4 @@
   ASSERT_EQ(static_cast<size_t>(40970), rs.GetOffsetInRangeSet(4096 * 16 + 10));
   // block#10 not in range.
   ASSERT_EXIT(rs.GetOffsetInRangeSet(40970), ::testing::KilledBySignal(SIGABRT), "");
-}
\ No newline at end of file
+}
diff --git a/updater/Android.mk b/updater/Android.mk
index 1218160..6f334ee 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -67,7 +67,6 @@
 
 LOCAL_CFLAGS := \
     -Wall \
-    -Wno-unused-parameter \
     -Werror
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
@@ -93,7 +92,6 @@
 
 LOCAL_CFLAGS := \
     -Wall \
-    -Wno-unused-parameter \
     -Werror
 
 LOCAL_STATIC_LIBRARIES := \
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 0f83644..ce3cea4 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -52,8 +52,8 @@
 #include "edify/expr.h"
 #include "otafault/ota_io.h"
 #include "otautil/error_code.h"
-#include "print_sha1.h"
-#include "rangeset.h"
+#include "otautil/print_sha1.h"
+#include "otautil/rangeset.h"
 #include "updater/install.h"
 #include "updater/updater.h"
 
diff --git a/updater/install.cpp b/updater/install.cpp
index 01210f5..9425d18 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -54,6 +54,7 @@
 #include <openssl/sha.h>
 #include <selinux/label.h>
 #include <selinux/selinux.h>
+#include <tune2fs.h>
 #include <ziparchive/zip_archive.h>
 
 #include "edify/expr.h"
@@ -61,8 +62,7 @@
 #include "otafault/ota_io.h"
 #include "otautil/DirUtil.h"
 #include "otautil/error_code.h"
-#include "print_sha1.h"
-#include "tune2fs.h"
+#include "otautil/print_sha1.h"
 #include "updater/updater.h"
 
 // Send over the buffer to recovery though the command pipe.
diff --git a/verifier.cpp b/verifier.cpp
index 18437fb..283e043 100644
--- a/verifier.cpp
+++ b/verifier.cpp
@@ -32,7 +32,7 @@
 #include <openssl/obj_mac.h>
 
 #include "asn1_decoder.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
 
 static constexpr size_t MiB = 1024 * 1024;
 
diff --git a/vr_ui.cpp b/vr_ui.cpp
index 07cc9da..a58c99e 100644
--- a/vr_ui.cpp
+++ b/vr_ui.cpp
@@ -53,7 +53,7 @@
   return y + 4;
 }
 
-void VrRecoveryUI::DrawHighlightBar(int x, int y, int width, int height) const {
+void VrRecoveryUI::DrawHighlightBar(int /* x */, int y, int /* width */, int height) const {
   gr_fill(kMarginWidth + kStereoOffset, y, ScreenWidth() - kMarginWidth + kStereoOffset, y + height);
   gr_fill(ScreenWidth() + kMarginWidth - kStereoOffset, y,
           gr_fb_width() - kMarginWidth - kStereoOffset, y + height);
diff --git a/wear_ui.cpp b/wear_ui.cpp
index e2ee488..ca6b1b1 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -150,8 +150,7 @@
   gr_flip();
 }
 
-void WearRecoveryUI::SetStage(int current, int max) {
-}
+void WearRecoveryUI::SetStage(int /* current */, int /* max */) {}
 
 void WearRecoveryUI::StartMenu(const char* const* headers, const char* const* items,
                                int initial_selection) {