metrics: Add init script for metrics_daemon.

This init script creates the metrics data directory (/data/misc/metrics)
and starts the daemon.

BUG: 22953527

Change-Id: I21cd36f38a7a3550bc755cef5699e9a6ac3dfb94
This commit is contained in:
Bertrand SIMONNET 2015-08-17 11:40:16 -07:00
parent a169f3b401
commit 73eaa46559
2 changed files with 21 additions and 1 deletions

View File

@ -16,6 +16,8 @@ LOCAL_PATH := $(call my-dir)
ifeq ($(HOST_OS),linux)
LOCAL_INIT_SERVICE := metrics_daemon
metrics_cpp_extension := .cc
libmetrics_sources := \
c_metrics_library.cc \
@ -96,12 +98,13 @@ include $(BUILD_STATIC_LIBRARY)
# metrics daemon.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := metrics_daemon
LOCAL_MODULE := $(LOCAL_INIT_SERVICE)
LOCAL_C_INCLUDES := $(metrics_includes) \
external/libchromeos
LOCAL_CFLAGS := $(metrics_CFLAGS)
LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
LOCAL_REQUIRED_MODULES := init.$(LOCAL_INIT_SERVICE).rc
LOCAL_RTTI_FLAG := -frtti
LOCAL_SHARED_LIBRARIES := $(metrics_shared_libraries) \
libmetrics \
@ -113,4 +116,13 @@ LOCAL_SRC_FILES := $(metrics_daemon_sources)
LOCAL_STATIC_LIBRARIES := metrics_daemon_protos
include $(BUILD_EXECUTABLE)
ifdef INITRC_TEMPLATE
include $(CLEAR_VARS)
LOCAL_MODULE := init.$(LOCAL_INIT_SERVICE).rc
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_INITRCD)
LOCAL_SRC_FILES := init.$(LOCAL_INIT_SERVICE).rc
include $(BUILD_PREBUILT)
endif # INITRC_TEMPLATE
endif # HOST_OS == linux

View File

@ -0,0 +1,8 @@
on boot
mkdir /data/misc/metrics 0700 system system
service metrics_daemon /system/bin/metrics_daemon --uploader -nodaemon
class late_start
user system
group system dbus inet
seclabel u:r:brillo:s0