liblogcat: add android_logcat_popen and android_logcat_system

Supply a wrapper to the logcat API that provides some analogous
functionality to popen and system libc calls with some bits of
KISS shell-like parsing for environment, quotes and error
redirection handling.

Test: gTest logcat-unit-tests
Bug: 35326290
Change-Id: I9494ce71267ad2b2bec7fcccfc7d4beddae9aea6
diff --git a/logcat/tests/Android.mk b/logcat/tests/Android.mk
index cb8b061..bfb20f0 100644
--- a/logcat/tests/Android.mk
+++ b/logcat/tests/Android.mk
@@ -48,6 +48,7 @@
 
 test_src_files := \
     logcat_test.cpp \
+    liblogcat_test.cpp \
 
 # Build tests for the device (with .so). Run with:
 #   adb shell /data/nativetest/logcat-unit-tests/logcat-unit-tests
@@ -55,6 +56,7 @@
 LOCAL_MODULE := $(test_module_prefix)unit-tests
 LOCAL_MODULE_TAGS := $(test_tags)
 LOCAL_CFLAGS += $(test_c_flags)
-LOCAL_SHARED_LIBRARIES := liblog libbase
+LOCAL_SHARED_LIBRARIES := liblog libbase liblogcat
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
 LOCAL_SRC_FILES := $(test_src_files)
 include $(BUILD_NATIVE_TEST)