Error correction: Use libfec in blockimg.cpp for recovery

Add block_image_recover function to rewrite corrupted blocks on the
partition. This can be attempted if block_image_verify fails.

Note that we cannot use libfec during block_image_update as it may
overwrite blocks required for error correction. A separate recovery
pass in case the image is corrupted is the only viable option.

Bug: 21893453
Change-Id: I6ff25648fff68d5f50b41a601c95c509d1cc5bce
diff --git a/updater/Android.mk b/updater/Android.mk
index 82fa7e2..dcf4374 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -33,12 +33,13 @@
 
 LOCAL_SRC_FILES := $(updater_src_files)
 
+LOCAL_STATIC_LIBRARIES += libfec libfec_rs libext4_utils_static libsquashfs_utils libcrypto_static
+
 ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
 LOCAL_CFLAGS += -DUSE_EXT4
 LOCAL_CFLAGS += -Wno-unused-parameter
 LOCAL_C_INCLUDES += system/extras/ext4_utils
 LOCAL_STATIC_LIBRARIES += \
-    libext4_utils_static \
     libsparse_static \
     libz
 endif