Skip to content
Snippets Groups Projects
Commit 98a3f121 authored by Olivier Gaillard's avatar Olivier Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Add the timestamp of when the ANR was trigger." into main

parents c73e2e20 cd7ee3d8
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,9 @@ import com.android.server.wm.WindowProcessController;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
......@@ -76,6 +79,9 @@ import java.util.concurrent.atomic.AtomicLong;
* The error state of the process, such as if it's crashing/ANR etc.
*/
class ProcessErrorStateRecord {
private static final DateTimeFormatter DROPBOX_TIME_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSZ");
final ProcessRecord mApp;
private final ActivityManagerService mService;
......@@ -444,6 +450,13 @@ class ProcessErrorStateRecord {
info.append("ErrorId: ").append(errorId.toString()).append("\n");
}
info.append("Frozen: ").append(mApp.mOptRecord.isFrozen()).append("\n");
if (timeoutRecord != null && timeoutRecord.mEndUptimeMillis > 0) {
long millisSinceEndUptimeMs = anrTime - timeoutRecord.mEndUptimeMillis;
String formattedTime = DROPBOX_TIME_FORMATTER.format(
Instant.now().minusMillis(millisSinceEndUptimeMs)
.atZone(ZoneId.systemDefault()));
info.append("Timestamp: ").append(formattedTime).append("\n");
}
// Retrieve controller with max ANR delay from AnrControllers
// Note that we retrieve the controller before dumping stacks because dumping stacks can
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment