Created a dumpstate service.

For now this is still a limited service:

- It's only created when running an interactive bugreport.
- It only provides a listener to get updates.
- It will be just used by Shell to get updates.

Test: dumpstate_test passes
BUG: 31636879

Change-Id: Iae820261d220523c979bf905030456fcf0b2b618
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
index da39d3a..3987fce 100644
--- a/cmds/dumpstate/Android.mk
+++ b/cmds/dumpstate/Android.mk
@@ -15,10 +15,13 @@
         utils.cpp
 COMMON_SHARED_LIBRARIES := \
         libbase \
+        libbinder \
         libcutils \
+        libdumpstateaidl \
         libhardware_legacy \
         liblog \
-        libselinux
+        libselinux \
+        libutils
 
 # ====================#
 # libdumpstateheaders #
@@ -39,6 +42,27 @@
 
 include $(BUILD_STATIC_LIBRARY)
 
+# ================ #
+# libdumpstateaidl #
+# =================#
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libdumpstateaidl
+
+LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
+
+LOCAL_SHARED_LIBRARIES := \
+        libbinder \
+        libutils
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
+LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
+LOCAL_SRC_FILES := \
+        binder/android/os/IDumpstateListener.aidl \
+        binder/android/os/IDumpstate.aidl
+
+include $(BUILD_SHARED_LIBRARY)
+
 # ==========#
 # dumpstate #
 # ==========#
@@ -49,6 +73,7 @@
 endif
 
 LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
+        DumpstateService.cpp \
         dumpstate.cpp
 
 LOCAL_MODULE := dumpstate
@@ -77,6 +102,7 @@
 LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
 
 LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
+        DumpstateService.cpp \
         tests/dumpstate_test.cpp
 
 LOCAL_STATIC_LIBRARIES := $(COMMON_ZIP_LIBRARIES) \