Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ca2e823 authored by Chenjie Yu's avatar Chenjie Yu
Browse files

rudimentary logging of screen_on and process start/crash via logd to

statsd. The numbers should be replaced with protobuf enums and the
format is subject to changes. But this gets it working for now.

Test: flash with new image, statsd should print out events. toggle
screen on from off state will add a log entry

Change-Id: I733e249965689f00597232c0e3eccfd26e1a958c
parent fc07f49c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ LogReader::connect_and_read()
            /* no pid restriction */ 0);

    // Open the buffer(s)
    eventLogger = android_logger_open(loggers, LOG_ID_EVENTS);
    eventLogger = android_logger_open(loggers, LOG_ID_STATS);

    // Read forever
    if (eventLogger) {
+15 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.internal.os.PowerProfile;
import com.android.internal.util.DumpUtils;
import com.android.server.LocalServices;
import com.android.server.power.BatterySaverPolicy.ServiceType;
import android.util.StatsLog;

import java.io.File;
import java.io.FileDescriptor;
@@ -281,12 +282,26 @@ public final class BatteryStatsService extends IBatteryStats.Stub
    void noteProcessStart(String name, int uid) {
        synchronized (mStats) {
            mStats.noteProcessStartLocked(name, uid);

            // TODO: remove this once we figure out properly where and how
            // PROCESS_EVENT = 1112
            // EVENT SUBTYPE: START = 1
            // KEY_NAME: 1
            // KEY_UID: 2
            StatsLog.writeArray(1112, 1, 1, name, 2, uid);
        }
    }

    void noteProcessCrash(String name, int uid) {
        synchronized (mStats) {
            mStats.noteProcessCrashLocked(name, uid);

            // TODO: remove this once we figure out properly where and how
            // PROCESS_EVENT = 1112
            // EVENT SUBTYPE: CRASH = 2
            // KEY_NAME: 1
            // KEY_UID: 2
            StatsLog.writeArray(1112, 2, 1, name, 2, uid);
        }
    }