[automerger skipped] Make memunreachable_test more robust against false negative leaks am: 05dca7ae96  -s ours
am: 24dcf7890f  -s ours

Change-Id: If8d35e2f50b1f774da7464ed335366bd6178475d
diff --git a/healthd/Android.bp b/healthd/Android.bp
index cefe09d..8bd51e7 100644
--- a/healthd/Android.bp
+++ b/healthd/Android.bp
@@ -57,15 +57,10 @@
 cc_binary {
     name: "android.hardware.health@2.0-service",
     defaults: ["android.hardware.health@2.0-service_defaults"],
-}
-
-cc_binary {
-    name: "android.hardware.health@2.0-service.override",
-    defaults: ["android.hardware.health@2.0-service_defaults"],
 
     overrides: [
         "healthd",
-    ],
+    ]
 }
 
 cc_binary {
@@ -101,4 +96,7 @@
         "android.hardware.health@2.0",
     ],
 
+    vintf_fragments: [
+        "manifest_healthd.xml"
+    ],
 }
diff --git a/healthd/Android.mk b/healthd/Android.mk
index 86f7cf0..f7214c6 100644
--- a/healthd/Android.mk
+++ b/healthd/Android.mk
@@ -24,6 +24,8 @@
 LOCAL_CFLAGS += -DHEALTHD_DRAW_SPLIT_OFFSET=0
 endif
 
+LOCAL_HEADER_LIBRARIES := libbatteryservice_headers
+
 include $(BUILD_STATIC_LIBRARY)
 
 include $(CLEAR_VARS)
diff --git a/healthd/manifest_healthd.xml b/healthd/manifest_healthd.xml
new file mode 100644
index 0000000..097a7d8
--- /dev/null
+++ b/healthd/manifest_healthd.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="framework">
+    <hal>
+        <name>android.hardware.health</name>
+        <transport>hwbinder</transport>
+        <version>2.0</version>
+        <interface>
+            <name>IHealth</name>
+            <instance>backup</instance>
+        </interface>
+    </hal>
+</manifest>
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c
index 4bab6d6..fa205a9 100644
--- a/lmkd/lmkd.c
+++ b/lmkd/lmkd.c
@@ -82,6 +82,9 @@
 /* Defined as ProcessList.SYSTEM_ADJ in ProcessList.java */
 #define SYSTEM_ADJ (-900)
 
+#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
+#define STRINGIFY_INTERNAL(x) #x
+
 /* default to old in-kernel interface if no memory pressure events */
 static bool use_inkernel_interface = true;
 static bool has_inkernel_module;
@@ -726,10 +729,10 @@
 
 #ifdef LMKD_LOG_STATS
 static void memory_stat_parse_line(char *line, struct memory_stat *mem_st) {
-    char key[LINE_MAX];
+    char key[LINE_MAX + 1];
     int64_t value;
 
-    sscanf(line,"%s  %" SCNd64 "", key, &value);
+    sscanf(line, "%" STRINGIFY(LINE_MAX) "s  %" SCNd64 "", key, &value);
 
     if (strcmp(key, "total_") < 0) {
         return;
diff --git a/rootdir/etc/public.libraries.android.txt b/rootdir/etc/public.libraries.android.txt
index e20b95d..2a51d53 100644
--- a/rootdir/etc/public.libraries.android.txt
+++ b/rootdir/etc/public.libraries.android.txt
@@ -1,6 +1,7 @@
 # See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
 libandroid.so
 libaaudio.so
+libamidi.so
 libc.so
 libcamera2ndk.so
 libdl.so
diff --git a/rootdir/etc/public.libraries.iot.txt b/rootdir/etc/public.libraries.iot.txt
index ff0813d..6690770 100644
--- a/rootdir/etc/public.libraries.iot.txt
+++ b/rootdir/etc/public.libraries.iot.txt
@@ -2,6 +2,7 @@
 libandroid.so
 libandroidthings.so
 libaaudio.so
+libamidi.so
 libc.so
 libcamera2ndk.so
 libdl.so
diff --git a/rootdir/etc/public.libraries.wear.txt b/rootdir/etc/public.libraries.wear.txt
index 3c46094..56055ba 100644
--- a/rootdir/etc/public.libraries.wear.txt
+++ b/rootdir/etc/public.libraries.wear.txt
@@ -1,6 +1,7 @@
 # See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
 libandroid.so
 libaaudio.so
+libamidi.so
 libc.so
 libcamera2ndk.so
 libdl.so
diff --git a/storaged/Android.bp b/storaged/Android.bp
index b478f4a..7466728 100644
--- a/storaged/Android.bp
+++ b/storaged/Android.bp
@@ -66,6 +66,7 @@
     ],
 
     static_libs: ["libhealthhalutils"],
+    header_libs: ["libbatteryservice_headers"],
 
     logtags: ["EventLogTags.logtags"],
 
diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h
index 400e734..6f92048 100644
--- a/storaged/include/storaged.h
+++ b/storaged/include/storaged.h
@@ -26,7 +26,6 @@
 #include <unordered_map>
 #include <vector>
 
-#include <batteryservice/IBatteryPropertiesListener.h>
 #include <utils/Mutex.h>
 
 #include <android/hardware/health/2.0/IHealth.h>
diff --git a/storaged/include/uid_info.h b/storaged/include/uid_info.h
index 4398a0d..c5533ac 100644
--- a/storaged/include/uid_info.h
+++ b/storaged/include/uid_info.h
@@ -19,6 +19,8 @@
 #include <string>
 #include <unordered_map>
 
+#include <binder/Parcelable.h>
+
 namespace android {
 namespace os {
 namespace storaged {
diff --git a/storaged/storaged.cpp b/storaged/storaged.cpp
index bf8b448..f346c38 100644
--- a/storaged/storaged.cpp
+++ b/storaged/storaged.cpp
@@ -30,6 +30,7 @@
 
 #include <android-base/file.h>
 #include <android-base/logging.h>
+#include <android-base/unique_fd.h>
 #include <android/hidl/manager/1.0/IServiceManager.h>
 #include <batteryservice/BatteryServiceConstants.h>
 #include <cutils/properties.h>