From 9ad38c4e8a3fbc7610b8cb670e1539d7d00d611a Mon Sep 17 00:00:00 2001 From: Jing Ji Date: Sat, 30 Apr 2022 16:43:46 -0700 Subject: [PATCH] Info the am instrumentation if test process attach failed. Bug: 230124334 Test: Manual - induce a crash in test process before attaching Change-Id: I510bc5ab9f55b18d7deeb5f68352dab9da0bcc2b --- .../com/android/server/am/ActivityManagerService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index c5a4ca4dc0e5e..631d81c9fc307 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -4534,8 +4534,15 @@ public class ActivityManagerService extends IActivityManager.Stub // We're going to cleanup the successor process record, which wasn't started at all. app = successor; } else { - Slog.w(TAG, "Process " + app + " failed to attach"); + final String msg = "Process " + app + " failed to attach"; + Slog.w(TAG, msg); EventLogTags.writeAmProcessStartTimeout(app.userId, pid, app.uid, app.processName); + if (app.getActiveInstrumentation() != null) { + final Bundle info = new Bundle(); + info.putString("shortMsg", "failed to attach"); + info.putString("longMsg", msg); + finishInstrumentationLocked(app, Activity.RESULT_CANCELED, info); + } } synchronized (mProcLock) { mProcessList.removeProcessNameLocked(app.processName, app.uid);