Add a DropboxWriter in statsd.
+ The DropboxWriter keeps data in cache, and flush to files once the
size exceeds the maximum value.
+ Different components should create their owner DropboxWriter with
different tags, e.g., anomly detection, experiment metrics, etc.
+ Copied stats_log related protos from g3
Test: run statsd, and adb shell dumpsys dropbox
Will add unit tests.
Change-Id: If06e9a9953be32082252b340a97124d732656b40
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index db8c89d..0e6d292 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -14,6 +14,23 @@
LOCAL_PATH:= $(call my-dir)
+# ================
+# proto static lib
+# ================
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := statsd_proto
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-proto-files-under, src)
+
+LOCAL_PROTOC_FLAGS :=
+LOCAL_PROTOC_OPTIMIZE_TYPE := lite
+
+include $(BUILD_STATIC_LIBRARY)
+
+STATSD_PROTO_INCLUDES := $(local-generated-sources-dir)/src/$(LOCAL_PATH)
+
# =========
# statsd
# =========
@@ -27,7 +44,12 @@
src/StatsService.cpp \
src/LogEntryPrinter.cpp \
src/LogReader.cpp \
- src/main.cpp
+ src/main.cpp \
+ src/DropboxWriter.cpp \
+ src/StatsLogProcessor.cpp \
+ src/stats_log.proto \
+ src/statsd_config.proto \
+ src/stats_constants.proto \
LOCAL_CFLAGS += \
-Wall \
@@ -47,7 +69,10 @@
endif
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/../../core/java
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/src \
+ STATSD_PROTO_INCLUDES
+
+LOCAL_STATIC_LIBRARIES := statsd_proto
LOCAL_SHARED_LIBRARIES := \
libbase \
@@ -56,7 +81,8 @@
libincident \
liblog \
libselinux \
- libutils
+ libutils \
+ libservices \
LOCAL_MODULE_CLASS := EXECUTABLES
@@ -82,7 +108,8 @@
-Wno-unused-function \
-Wno-unused-parameter
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/src \
+ STATSD_PROTO_INCLUDES
LOCAL_SRC_FILES := \
../../core/java/android/os/IStatsManager.aidl \
@@ -93,6 +120,7 @@
LOCAL_STATIC_LIBRARIES := \
libgmock \
+ statsd_proto
LOCAL_SHARED_LIBRARIES := \
libbase \
@@ -103,4 +131,3 @@
libutils
include $(BUILD_NATIVE_TEST)
-