Source:
public StatusCheckerResult postExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { if (mSystemServerProcess == null) { CLog.d( "No valid system_server process was found in preExecutionCheck, " + "skipping system checker."); return new StatusCheckerResult(CheckStatus.SUCCESS); } String message = null; ProcessInfo currSystemServerProcess = device.getProcessByName("system_server"); if (currSystemServerProcess == null) { message = "system_server is down"; CLog.w(message); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); return result; } if (currSystemServerProcess.getPid() == mSystemServerProcess.getPid() && currSystemServerProcess.getStartTime() == mSystemServerProcess.getStartTime()) { return new StatusCheckerResult(CheckStatus.SUCCESS); } Map<Long, String> bootHistory = device.getBootHistorySince(mSystemServerProcess.getStartTime()); CLog.i("The device reboot with boot history: %s", bootHistory); if (bootHistory.isEmpty()) { message = "system_server restarted"; } else { message = "system_server restarted due to device reboot: " + bootHistory.toString(); long lastExpectedReboot = device.getLastExpectedRebootTimeMillis(); if (mModuleStartTime != null && lastExpectedReboot < mModuleStartTime) { CLog.w( "System_server restarted and Tradefed didn't trigger a reboot: " + "last expected reboot: %s, module start time: %s, " + "something went wrong.", lastExpectedReboot, mModuleStartTime); } else { CLog.i("Tradefed triggered reboot detected"); return new StatusCheckerResult(CheckStatus.SUCCESS); } } CLog.w(message); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); return result; }

Target:
public StatusCheckerResult postExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { if (mSystemServerProcess == null) { CLog.d( "No valid system_server process was found in preExecutionCheck, " + "skipping system checker."); return new StatusCheckerResult(CheckStatus.SUCCESS); } String message = null; ProcessInfo currSystemServerProcess = device.getProcessByName("system_server"); if (currSystemServerProcess == null) { message = "system_server is down"; CLog.w(message); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); return result; } if (currSystemServerProcess.getPid() == mSystemServerProcess.getPid() && currSystemServerProcess.getStartTime() == mSystemServerProcess.getStartTime()) { return new StatusCheckerResult(CheckStatus.SUCCESS); } Map<Long, String> bootHistory = device.getBootHistorySince(mSystemServerProcess.getStartTime()); CLog.i("The device reboot with boot history: %s", bootHistory); if (bootHistory.isEmpty()) { message = "system_server restarted without device reboot"; } else { message = "system_server restarted with device boot history: " + bootHistory.toString(); long lastExpectedReboot = device.getLastExpectedRebootTimeMillis(); if (mModuleStartTime != null && lastExpectedReboot < mModuleStartTime) { CLog.w( "System_server restarted and Tradefed didn't trigger a reboot: " + "last expected reboot: %s, module start time: %s, " + "something went wrong.", lastExpectedReboot, mModuleStartTime); } else { CLog.i("Tradefed triggered reboot detected"); return new StatusCheckerResult(CheckStatus.SUCCESS); } } CLog.w(message); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); return result; }