From 2fe2347e1e422748a188285f3ccc50e7894a0896 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Wed, 27 Feb 2019 09:43:01 -0800 Subject: [PATCH] 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 --- libs/androidfw/AssetManager2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index d7b84ff1060d2..117d05e837efa 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 @@ ApkAssetsCookie AssetManager2::FindEntry(uint32_t resid, uint16_t density_overri 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; }