Loading services/core/java/com/android/server/AlarmManagerService.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -1868,6 +1868,7 @@ class AlarmManagerService extends SystemService { final long nowRTC = System.currentTimeMillis(); final long nowRTC = System.currentTimeMillis(); final long nowELAPSED = SystemClock.elapsedRealtime(); final long nowELAPSED = SystemClock.elapsedRealtime(); final long nowUPTIME = SystemClock.uptimeMillis(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); pw.print(" nowRTC="); pw.print(nowRTC); pw.print(" nowRTC="); pw.print(nowRTC); Loading @@ -1883,6 +1884,25 @@ class AlarmManagerService extends SystemService { pw.print(" mLastTickSet="); pw.println(sdf.format(new Date(mLastTickSet))); pw.print(" mLastTickSet="); pw.println(sdf.format(new Date(mLastTickSet))); pw.print(" mLastTickAdded="); pw.println(sdf.format(new Date(mLastTickAdded))); pw.print(" mLastTickAdded="); pw.println(sdf.format(new Date(mLastTickAdded))); pw.print(" mLastTickRemoved="); pw.println(sdf.format(new Date(mLastTickRemoved))); pw.print(" mLastTickRemoved="); pw.println(sdf.format(new Date(mLastTickRemoved))); SystemServiceManager ssm = LocalServices.getService(SystemServiceManager.class); if (ssm != null) { pw.println(); pw.print(" RuntimeStarted="); pw.print(sdf.format( new Date(nowRTC - nowELAPSED + ssm.getRuntimeStartElapsedTime()))); if (ssm.isRuntimeRestarted()) { pw.print(" (Runtime restarted)"); } pw.println(); pw.print(" Runtime uptime (elapsed): "); TimeUtils.formatDuration(nowELAPSED, ssm.getRuntimeStartElapsedTime(), pw); pw.println(); pw.print(" Runtime uptime (uptime): "); TimeUtils.formatDuration(nowUPTIME, ssm.getRuntimeStartUptime(), pw); pw.println(); } pw.println(); pw.println(); if (!mInteractive) { if (!mInteractive) { pw.print(" Time since non-interactive: "); pw.print(" Time since non-interactive: "); Loading services/core/java/com/android/server/SystemServiceManager.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,8 @@ public class SystemServiceManager { private final Context mContext; private final Context mContext; private boolean mSafeMode; private boolean mSafeMode; private boolean mRuntimeRestarted; private boolean mRuntimeRestarted; private long mRuntimeStartElapsedTime; private long mRuntimeStartUptime; // Services that should receive lifecycle events. // Services that should receive lifecycle events. private final ArrayList<SystemService> mServices = new ArrayList<SystemService>(); private final ArrayList<SystemService> mServices = new ArrayList<SystemService>(); Loading Loading @@ -287,8 +289,25 @@ public class SystemServiceManager { return mRuntimeRestarted; return mRuntimeRestarted; } } void setRuntimeRestarted(boolean runtimeRestarted) { /** * @return Time when SystemServer was started, in elapsed realtime. */ public long getRuntimeStartElapsedTime() { return mRuntimeStartElapsedTime; } /** * @return Time when SystemServer was started, in uptime. */ public long getRuntimeStartUptime() { return mRuntimeStartUptime; } void setStartInfo(boolean runtimeRestarted, long runtimeStartElapsedTime, long runtimeStartUptime) { mRuntimeRestarted = runtimeRestarted; mRuntimeRestarted = runtimeRestarted; mRuntimeStartElapsedTime = runtimeStartElapsedTime; mRuntimeStartUptime = runtimeStartUptime; } } private void warnIfTooLong(long duration, SystemService service, String operation) { private void warnIfTooLong(long duration, SystemService service, String operation) { Loading services/java/com/android/server/SystemServer.java +7 −1 Original line number Original line Diff line number Diff line Loading @@ -261,6 +261,8 @@ public final class SystemServer { private boolean mOnlyCore; private boolean mOnlyCore; private boolean mFirstBoot; private boolean mFirstBoot; private final boolean mRuntimeRestart; 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_SENSOR_SERVICE = "StartSensorService"; private static final String START_HIDL_SERVICES = "StartHidlServices"; private static final String START_HIDL_SERVICES = "StartHidlServices"; Loading Loading @@ -292,6 +294,9 @@ public final class SystemServer { mFactoryTestMode = FactoryTest.getMode(); mFactoryTestMode = FactoryTest.getMode(); // Remember if it's runtime restart(when sys.boot_completed is already set) or reboot // Remember if it's runtime restart(when sys.boot_completed is already set) or reboot mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed")); mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed")); mRuntimeStartElapsedTime = SystemClock.elapsedRealtime(); mRuntimeStartUptime = SystemClock.uptimeMillis(); } } private void run() { private void run() { Loading Loading @@ -402,7 +407,8 @@ public final class SystemServer { // Create the system service manager. // Create the system service manager. mSystemServiceManager = new SystemServiceManager(mSystemContext); mSystemServiceManager = new SystemServiceManager(mSystemContext); mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart); mSystemServiceManager.setStartInfo(mRuntimeRestart, mRuntimeStartElapsedTime, mRuntimeStartUptime); LocalServices.addService(SystemServiceManager.class, mSystemServiceManager); LocalServices.addService(SystemServiceManager.class, mSystemServiceManager); // Prepare the thread pool for init tasks that can be parallelized // Prepare the thread pool for init tasks that can be parallelized SystemServerInitThreadPool.get(); SystemServerInitThreadPool.get(); Loading Loading
services/core/java/com/android/server/AlarmManagerService.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -1868,6 +1868,7 @@ class AlarmManagerService extends SystemService { final long nowRTC = System.currentTimeMillis(); final long nowRTC = System.currentTimeMillis(); final long nowELAPSED = SystemClock.elapsedRealtime(); final long nowELAPSED = SystemClock.elapsedRealtime(); final long nowUPTIME = SystemClock.uptimeMillis(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); pw.print(" nowRTC="); pw.print(nowRTC); pw.print(" nowRTC="); pw.print(nowRTC); Loading @@ -1883,6 +1884,25 @@ class AlarmManagerService extends SystemService { pw.print(" mLastTickSet="); pw.println(sdf.format(new Date(mLastTickSet))); pw.print(" mLastTickSet="); pw.println(sdf.format(new Date(mLastTickSet))); pw.print(" mLastTickAdded="); pw.println(sdf.format(new Date(mLastTickAdded))); pw.print(" mLastTickAdded="); pw.println(sdf.format(new Date(mLastTickAdded))); pw.print(" mLastTickRemoved="); pw.println(sdf.format(new Date(mLastTickRemoved))); pw.print(" mLastTickRemoved="); pw.println(sdf.format(new Date(mLastTickRemoved))); SystemServiceManager ssm = LocalServices.getService(SystemServiceManager.class); if (ssm != null) { pw.println(); pw.print(" RuntimeStarted="); pw.print(sdf.format( new Date(nowRTC - nowELAPSED + ssm.getRuntimeStartElapsedTime()))); if (ssm.isRuntimeRestarted()) { pw.print(" (Runtime restarted)"); } pw.println(); pw.print(" Runtime uptime (elapsed): "); TimeUtils.formatDuration(nowELAPSED, ssm.getRuntimeStartElapsedTime(), pw); pw.println(); pw.print(" Runtime uptime (uptime): "); TimeUtils.formatDuration(nowUPTIME, ssm.getRuntimeStartUptime(), pw); pw.println(); } pw.println(); pw.println(); if (!mInteractive) { if (!mInteractive) { pw.print(" Time since non-interactive: "); pw.print(" Time since non-interactive: "); Loading
services/core/java/com/android/server/SystemServiceManager.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,8 @@ public class SystemServiceManager { private final Context mContext; private final Context mContext; private boolean mSafeMode; private boolean mSafeMode; private boolean mRuntimeRestarted; private boolean mRuntimeRestarted; private long mRuntimeStartElapsedTime; private long mRuntimeStartUptime; // Services that should receive lifecycle events. // Services that should receive lifecycle events. private final ArrayList<SystemService> mServices = new ArrayList<SystemService>(); private final ArrayList<SystemService> mServices = new ArrayList<SystemService>(); Loading Loading @@ -287,8 +289,25 @@ public class SystemServiceManager { return mRuntimeRestarted; return mRuntimeRestarted; } } void setRuntimeRestarted(boolean runtimeRestarted) { /** * @return Time when SystemServer was started, in elapsed realtime. */ public long getRuntimeStartElapsedTime() { return mRuntimeStartElapsedTime; } /** * @return Time when SystemServer was started, in uptime. */ public long getRuntimeStartUptime() { return mRuntimeStartUptime; } void setStartInfo(boolean runtimeRestarted, long runtimeStartElapsedTime, long runtimeStartUptime) { mRuntimeRestarted = runtimeRestarted; mRuntimeRestarted = runtimeRestarted; mRuntimeStartElapsedTime = runtimeStartElapsedTime; mRuntimeStartUptime = runtimeStartUptime; } } private void warnIfTooLong(long duration, SystemService service, String operation) { private void warnIfTooLong(long duration, SystemService service, String operation) { Loading
services/java/com/android/server/SystemServer.java +7 −1 Original line number Original line Diff line number Diff line Loading @@ -261,6 +261,8 @@ public final class SystemServer { private boolean mOnlyCore; private boolean mOnlyCore; private boolean mFirstBoot; private boolean mFirstBoot; private final boolean mRuntimeRestart; 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_SENSOR_SERVICE = "StartSensorService"; private static final String START_HIDL_SERVICES = "StartHidlServices"; private static final String START_HIDL_SERVICES = "StartHidlServices"; Loading Loading @@ -292,6 +294,9 @@ public final class SystemServer { mFactoryTestMode = FactoryTest.getMode(); mFactoryTestMode = FactoryTest.getMode(); // Remember if it's runtime restart(when sys.boot_completed is already set) or reboot // Remember if it's runtime restart(when sys.boot_completed is already set) or reboot mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed")); mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed")); mRuntimeStartElapsedTime = SystemClock.elapsedRealtime(); mRuntimeStartUptime = SystemClock.uptimeMillis(); } } private void run() { private void run() { Loading Loading @@ -402,7 +407,8 @@ public final class SystemServer { // Create the system service manager. // Create the system service manager. mSystemServiceManager = new SystemServiceManager(mSystemContext); mSystemServiceManager = new SystemServiceManager(mSystemContext); mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart); mSystemServiceManager.setStartInfo(mRuntimeRestart, mRuntimeStartElapsedTime, mRuntimeStartUptime); LocalServices.addService(SystemServiceManager.class, mSystemServiceManager); LocalServices.addService(SystemServiceManager.class, mSystemServiceManager); // Prepare the thread pool for init tasks that can be parallelized // Prepare the thread pool for init tasks that can be parallelized SystemServerInitThreadPool.get(); SystemServerInitThreadPool.get(); Loading