Merge "otafault: Clean up header inclusion." am: d9373cf621
am: ffc171c56d

Change-Id: Ib5d0676a143629c0151ad5e94052b67e2f626f49
diff --git a/otafault/Android.mk b/otafault/Android.mk
index 4784d56..3837176 100644
--- a/otafault/Android.mk
+++ b/otafault/Android.mk
@@ -18,8 +18,6 @@
 
 otafault_static_libs := \
     libziparchive \
-    libz \
-    libselinux \
     libbase \
     liblog
 
diff --git a/otafault/config.cpp b/otafault/config.cpp
index b94e429..c11f774 100644
--- a/otafault/config.cpp
+++ b/otafault/config.cpp
@@ -14,16 +14,14 @@
  * limitations under the License.
  */
 
+#include "config.h"
+
 #include <map>
 #include <string>
 
-#include <stdio.h>
-#include <unistd.h>
-
 #include <android-base/stringprintf.h>
 #include <ziparchive/zip_archive.h>
 
-#include "config.h"
 #include "ota_io.h"
 
 #define OTAIO_MAX_FNAME_SIZE 128
diff --git a/otafault/config.h b/otafault/config.h
index 4adbdd1..cc4bfd2 100644
--- a/otafault/config.h
+++ b/otafault/config.h
@@ -15,13 +15,13 @@
  */
 
 /*
- * Read configuration files in the OTA package to determine which files, if any, will trigger errors.
+ * Read configuration files in the OTA package to determine which files, if any, will trigger
+ * errors.
  *
- * OTA packages can be modified to trigger errors by adding a top-level
- * directory called .libotafault, which may optionally contain up to three
- * files called READ, WRITE, and FSYNC. Each one of these optional files
- * contains the name of a single file on the device disk which will cause
- * an IO error on the first call of the appropriate I/O action to that file.
+ * OTA packages can be modified to trigger errors by adding a top-level directory called
+ * .libotafault, which may optionally contain up to three files called READ, WRITE, and FSYNC.
+ * Each one of these optional files contains the name of a single file on the device disk which
+ * will cause an IO error on the first call of the appropriate I/O action to that file.
  *
  * Example:
  * ota.zip
@@ -29,9 +29,9 @@
  *   .libotafault
  *     WRITE
  *
- * If the contents of the file WRITE were /system/build.prop, the first write
- * action to /system/build.prop would fail with EIO. Note that READ and
- * FSYNC files are absent, so these actions will not cause an error.
+ * If the contents of the file WRITE were /system/build.prop, the first write action to
+ * /system/build.prop would fail with EIO. Note that READ and FSYNC files are absent, so these
+ * actions will not cause an error.
  */
 
 #ifndef _UPDATER_OTA_IO_CFG_H_
@@ -39,8 +39,6 @@
 
 #include <string>
 
-#include <stdbool.h>
-
 #include <ziparchive/zip_archive.h>
 
 #define OTAIO_BASE_DIR ".libotafault"
diff --git a/otafault/ota_io.cpp b/otafault/ota_io.cpp
index faae527..a82a7ee 100644
--- a/otafault/ota_io.cpp
+++ b/otafault/ota_io.cpp
@@ -18,15 +18,17 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
 
 #include <map>
-#include <memory>
 #include <mutex>
 
 #include <android-base/thread_annotations.h>
+
 #include "config.h"
 
 static std::mutex filename_mutex;
diff --git a/otafault/ota_io.h b/otafault/ota_io.h
index 9428f1b..45e481a 100644
--- a/otafault/ota_io.h
+++ b/otafault/ota_io.h
@@ -23,8 +23,9 @@
 #ifndef _UPDATER_OTA_IO_H_
 #define _UPDATER_OTA_IO_H_
 
+#include <stddef.h>
 #include <stdio.h>
-#include <sys/stat.h>
+#include <sys/stat.h>  // mode_t
 
 #include <memory>
 
diff --git a/otafault/test.cpp b/otafault/test.cpp
index 6514782..60c40e0 100644
--- a/otafault/test.cpp
+++ b/otafault/test.cpp
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
 
 #include "ota_io.h"