From 1ae5a69bc495154d0baf504caa95d7eddbc7177c Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Wed, 23 Mar 2016 14:57:17 -0700 Subject: [PATCH] Proper handle of duplicated BUGREPORT_STARTED. When Shell receives a BUGREPORT_STARTED intent for a process it's already monitoring, it should completely ignore it, but current it's taking an extra screenshot. BUG: 27804637 Change-Id: I733cacfee5e9c82646a3295b50c3856b6e0352c3 --- .../src/com/android/shell/BugreportProgressService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index c9582ea1aa516..c131fa5d547c0 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -409,10 +409,11 @@ public class BugreportProgressService extends Service { final BugreportInfo info = new BugreportInfo(mContext, id, pid, name, max); if (mProcesses.indexOfKey(id) >= 0) { + // BUGREPORT_STARTED intent was already received; ignore it. Log.w(TAG, "ID " + id + " already watched"); - } else { - mProcesses.put(info.id, info); + return true; } + mProcesses.put(info.id, info); // Take initial screenshot. takeScreenshot(id, false); updateProgress(info);