diff --git a/proto/src/criticalevents/critical_event_log.proto b/proto/src/criticalevents/critical_event_log.proto index 25814eca9a8541b33ffe667160b308705350e2c8..9cda2672eab09c8ab53b25691a69feb3a96b8934 100644 --- a/proto/src/criticalevents/critical_event_log.proto +++ b/proto/src/criticalevents/critical_event_log.proto @@ -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. diff --git a/services/core/java/com/android/server/criticalevents/CriticalEventLog.java b/services/core/java/com/android/server/criticalevents/CriticalEventLog.java index ab480e8e8852b22129e87ab34d0546a32540301f..08143759fab413174f1edccda673185bad342f1b 100644 --- a/services/core/java/com/android/server/criticalevents/CriticalEventLog.java +++ b/services/core/java/com/android/server/criticalevents/CriticalEventLog.java @@ -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(); diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 56e385d535a0f39d1c9357acbe041ec8804faca8..0a2e80606e96a8dc8d4431728f592c32ca138ec1 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -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);