libnativeloader: Make webviewchromium so file optional
Not all android devices ship with Webview. The requirement of
libwebviewchromium_plat_support.so to be loaded while initializing the
android namespace is therefore liable to cause a crash on devices that
don't support or use Webview. Therefore, this patch makes this
requirement conditional, but enabled by default.
To remove the dependency, device make files should add the following:
TARGET_IGNORE_WEBVIEW_CHROMIUM := true
Bug: 27336841
Bug: 27546414
Change-Id: Iaec1b58236356d981504ea8f716413ea334ca4f4
diff --git a/libnativeloader/Android.mk b/libnativeloader/Android.mk
index 6c064c7..d8aed8d 100644
--- a/libnativeloader/Android.mk
+++ b/libnativeloader/Android.mk
@@ -14,6 +14,9 @@
LOCAL_STATIC_LIBRARIES := libbase
LOCAL_CLANG := true
LOCAL_CFLAGS += -Werror -Wall
+ifeq ($(TARGET_IGNORE_WEBVIEW_CHROMIUM), true)
+LOCAL_CFLAGS += -DIGNORE_WEBVIEW_CHROMIUM
+endif
LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden
LOCAL_LDFLAGS := -ldl
LOCAL_MULTILIB := both
@@ -32,6 +35,9 @@
LOCAL_STATIC_LIBRARIES := libbase
LOCAL_CLANG := true
LOCAL_CFLAGS += -Werror -Wall
+ifeq ($(TARGET_IGNORE_WEBVIEW_CHROMIUM), true)
+LOCAL_CFLAGS += -DIGNORE_WEBVIEW_CHROMIUM
+endif
LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden
LOCAL_LDFLAGS := -ldl
LOCAL_MULTILIB := both
@@ -49,6 +55,9 @@
LOCAL_STATIC_LIBRARIES := libnativehelper libcutils liblog libbase
LOCAL_CLANG := true
LOCAL_CFLAGS += -Werror -Wall
+ifeq ($(TARGET_IGNORE_WEBVIEW_CHROMIUM), true)
+LOCAL_CFLAGS += -DIGNORE_WEBVIEW_CHROMIUM
+endif
LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden
LOCAL_LDFLAGS := -ldl
LOCAL_MULTILIB := both
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp
index 3e4b15a..dfd74d3 100644
--- a/libnativeloader/native_loader.cpp
+++ b/libnativeloader/native_loader.cpp
@@ -55,7 +55,9 @@
"libRS.so:"
"libstdc++.so:"
"libvulkan.so:"
+#if !defined(IGNORE_WEBVIEW_CHROMIUM)
"libwebviewchromium_plat_support.so:"
+#endif
"libz.so";
class LibraryNamespaces {