Log failure to load memtrack module only once

get_instance() only attempts to get the memtrack module once, since
it is a static variable. Therefore it makes sense to log an error if
the module is not available only once. The error shouldn't be
printed in logcat more than once during boot, since the API is only
used by one process (SystemServer).

This should allow devices that do not have anything to report in
memtrack (like HiKey and DragonBoard) to get rid of their dummy
memtrack implementation (which is optional anyway).

Test: boot aosp_x86_64 and check logcat (only one error)
Change-Id: I785f1ac288b7e497ff511ddb3d2b866fa5190d07
diff --git a/memtrack.cpp b/memtrack.cpp
index c5e74c1..3fc24c8 100644
--- a/memtrack.cpp
+++ b/memtrack.cpp
@@ -46,7 +46,9 @@
 //TODO(b/31632518)
 static android::sp<IMemtrack> get_instance() {
     static android::sp<IMemtrack> module = IMemtrack::getService();
-    if (module == nullptr) {
+    static bool logged = false;
+    if (module == nullptr && !logged) {
+        logged = true;
         ALOGE("Couldn't load memtrack module");
     }
     return module;