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

Commit 2322128f authored by Olivier Gaillard's avatar Olivier Gaillard
Browse files

Log when system server started time and add it to the ANR dumps

Change-Id: I7b8584580fefd41f5654de47e76b20929f5ab28b
parent 24af7a43
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -59,8 +59,11 @@ message CriticalEventProto {
    AppNotResponding anr = 4;
    JavaCrash java_crash = 5;
    NativeCrash native_crash = 6;
    SystemServerStarted system_server_started = 7;
  }

  message SystemServerStarted {}

  message Watchdog {
    // The watchdog subject.
    // Required.
+8 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.server.criticalevents.nano.CriticalEventProto.AppNotRespondin
import com.android.server.criticalevents.nano.CriticalEventProto.HalfWatchdog;
import com.android.server.criticalevents.nano.CriticalEventProto.JavaCrash;
import com.android.server.criticalevents.nano.CriticalEventProto.NativeCrash;
import com.android.server.criticalevents.nano.CriticalEventProto.SystemServerStarted;
import com.android.server.criticalevents.nano.CriticalEventProto.Watchdog;

import java.io.File;
@@ -141,6 +142,13 @@ public class CriticalEventLog {
        return System.currentTimeMillis();
    }

    /** Logs when system server started. */
    public void logSystemServerStarted() {
        CriticalEventProto event = new CriticalEventProto();
        event.setSystemServerStarted(new SystemServerStarted());
        log(event);
    }

    /** Logs a watchdog. */
    public void logWatchdog(String subject, UUID uuid) {
        Watchdog watchdog = new Watchdog();
+2 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ import com.android.server.connectivity.PacProxyService;
import com.android.server.contentcapture.ContentCaptureManagerInternal;
import com.android.server.coverage.CoverageService;
import com.android.server.cpu.CpuMonitorService;
import com.android.server.criticalevents.CriticalEventLog;
import com.android.server.devicepolicy.DevicePolicyManagerService;
import com.android.server.devicestate.DeviceStateManagerService;
import com.android.server.display.DisplayManagerService;
@@ -964,6 +965,7 @@ public final class SystemServer implements Dumpable {
            // Only update the timeout after starting all the services so that we use
            // the default timeout to start system server.
            updateWatchdogTimeout(t);
            CriticalEventLog.getInstance().logSystemServerStarted();
        } catch (Throwable ex) {
            Slog.e("System", "******************************************");
            Slog.e("System", "************ Failure starting system services", ex);