Show system uptime in bugreport (dumpsys alarm)
Example:
RuntimeStarted=2018-03-06 19:33:00.587 (Runtime restarted)
Runtime uptime (elapsed): +15s375ms
Runtime uptime (uptime): +15s375ms
Test: dumpsys alarm
Bug: 74126915
Change-Id: I8e82050b8246725d944829b6488b1946a1b37ba1
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 6259926..165aaac 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -261,6 +261,8 @@
private boolean mOnlyCore;
private boolean mFirstBoot;
private final boolean mRuntimeRestart;
+ private final long mRuntimeStartElapsedTime;
+ private final long mRuntimeStartUptime;
private static final String START_SENSOR_SERVICE = "StartSensorService";
private static final String START_HIDL_SERVICES = "StartHidlServices";
@@ -292,6 +294,9 @@
mFactoryTestMode = FactoryTest.getMode();
// Remember if it's runtime restart(when sys.boot_completed is already set) or reboot
mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed"));
+
+ mRuntimeStartElapsedTime = SystemClock.elapsedRealtime();
+ mRuntimeStartUptime = SystemClock.uptimeMillis();
}
private void run() {
@@ -402,7 +407,8 @@
// Create the system service manager.
mSystemServiceManager = new SystemServiceManager(mSystemContext);
- mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart);
+ mSystemServiceManager.setStartInfo(mRuntimeRestart,
+ mRuntimeStartElapsedTime, mRuntimeStartUptime);
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
// Prepare the thread pool for init tasks that can be parallelized
SystemServerInitThreadPool.get();