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

Commit 29170ff2 authored by Chenjie Yu's avatar Chenjie Yu Committed by Android (Google) Code Review
Browse files

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

Merge "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."
parents 88e6a699 7ca2e823
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);
        }
    }