Add ANDROID_LOG to supress android specific logs
AAPT2 uses AssetManager2 as the implmentation of its symbol table.
When generating the the R.java, AAPT2 adds information about styleables
in the comments. If the first symbol table checked by the delegate is an
AssetManager2 symbol table and it does not contain the styleable
attribute being searched for, a bogus error is printed and the resource
is found in a later symbol table.
Bug: 126596328
Test: m -j Settings && diffed generated java files
Change-Id: If86a9d62fd72317525dffa862be1267621f93afd
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index d7b84ff..117d05e 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -35,6 +35,12 @@
#endif
#endif
+#ifdef __ANDROID__
+#define ANDROID_LOG(x) LOG(x)
+#else
+#define ANDROID_LOG(x) std::stringstream()
+#endif
+
#include "androidfw/ResourceUtils.h"
namespace android {
@@ -380,7 +386,8 @@
const uint8_t package_idx = package_ids_[package_id];
if (package_idx == 0xff) {
- LOG(ERROR) << base::StringPrintf("No package ID %02x found for ID 0x%08x.", package_id, resid);
+ ANDROID_LOG(ERROR) << base::StringPrintf("No package ID %02x found for ID 0x%08x.",
+ package_id, resid);
return kInvalidCookie;
}