Allow libhidl to be used in recovery am: 86ae999dd1 am: 2113b038e0
am: 190769589d

Change-Id: I93e934017b9cde3070fd52b72ccf5a9e88869254
diff --git a/transport/HidlBinderSupport.cpp b/transport/HidlBinderSupport.cpp
index 4a24a3e..ba36a09 100644
--- a/transport/HidlBinderSupport.cpp
+++ b/transport/HidlBinderSupport.cpp
@@ -19,6 +19,7 @@
 #include <hidl/HidlBinderSupport.h>
 
 // C includes
+#include <inttypes.h>
 #include <unistd.h>
 
 // C++ includes
@@ -66,6 +67,15 @@
                 parentOffset + hidl_memory::kOffsetOfName);
     }
 
+    // hidl_memory's size is stored in uint64_t, but mapMemory's mmap will map
+    // size in size_t. If size is over SIZE_MAX, mapMemory could succeed
+    // but the mapped memory's actual size will be smaller than the reported size.
+    if (memory.size() > SIZE_MAX) {
+        ALOGE("Cannot use memory with %" PRId64 " bytes because it is too large.", memory.size());
+        android_errorWriteLog(0x534e4554, "79376389");
+        return BAD_VALUE;
+    }
+
     return _hidl_err;
 }
 
diff --git a/vintfdata/manifest.xml b/vintfdata/manifest.xml
index 4cc4f5d..582b5eb 100644
--- a/vintfdata/manifest.xml
+++ b/vintfdata/manifest.xml
@@ -80,16 +80,6 @@
           <instance>vr</instance>
       </interface>
     </hal>
-    <hal>
-        <name>android.hardware.health</name>
-        <transport>hwbinder</transport>
-        <version>2.0</version>
-        <interface>
-            <name>IHealth</name>
-            <!-- The backup instance provided by healthd. -->
-            <instance>backup</instance>
-        </interface>
-    </hal>
     <hal format="native">
         <name>netutils-wrapper</name>
         <!--
diff --git a/vintfdata/manifest_healthd_exclude.xml b/vintfdata/manifest_healthd_exclude.xml
deleted file mode 100644
index b4060f0..0000000
--- a/vintfdata/manifest_healthd_exclude.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<!--
-    Include this file to DEVICE_FRAMEWORK_MANIFEST_FILE to disable
-    having an healthd on the device which is not needed if you have
-    an alternative implementation like the following:
-    (1) Device has android.hardware.health@2.0-service.override
-    (2) Device has android.hardware.health@2.0-service.<device>, which
-        contains the following:
-        overrides: ["healthd"]
--->
-<manifest version="1.0" type="framework">
-    <hal format="hidl" override="true">
-        <name>android.hardware.health</name>
-        <transport>hwbinder</transport>
-    </hal>
-</manifest>