on property:crash_reporter.coredump.enabled=1
    write /proc/sys/kernel/core_pattern \
          "|/system/bin/crash_reporter --user=%P:%s:%u:%g:%e"

on property:crash_reporter.coredump.enabled=0
    write /proc/sys/kernel/core_pattern "core"

on post-fs-data
    # Allow catching multiple unrelated concurrent crashes, but use a finite
    # number to prevent infinitely recursing on crash handling.
    write /proc/sys/kernel/core_pipe_limit 4

    # Remove any previous orphaned locks.
    rmdir /data/misc/crash_reporter/lock/crash_sender

    # Remove any previous run files.
    rm /data/misc/crash_reporter/run/kernel-crash-detected
    rmdir /data/misc/crash_reporter/run

    # Create crash directories.
    # These directories are group-writable by root so that crash_reporter can
    # still access them when it switches users.
    mkdir /data/misc/crash_reporter 0770 root root
    mkdir /data/misc/crash_reporter/crash 0770 root root
    mkdir /data/misc/crash_reporter/lock 0700 root root
    mkdir /data/misc/crash_reporter/log 0700 root root
    mkdir /data/misc/crash_reporter/run 0700 root root
    mkdir /data/misc/crash_reporter/tmp 0770 root root

service crash_reporter /system/bin/crash_reporter --init
    class late_start
    oneshot

service crash_sender /system/bin/periodic_scheduler 3600 14400 crash_sender \
    /system/bin/crash_sender
    class late_start
    group system
