From 664f6466ec97cfff65bd3ab93286c0b611279afe Mon Sep 17 00:00:00 2001 From: Nandana Dutt Date: Fri, 22 Mar 2019 14:48:50 +0000 Subject: [PATCH] Stop bugreportd if binder call fails Fixes: 128949427 Test: Tested by supplying a valid fd that dumpstate does not have access to, but system server has access to. So the startBugreport call fails. Verified that subsequent calls with proper arguments go through and not encounter BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS. Change-Id: I393e09a4e35ae5191406112d76f27fe89418c069 --- .../com/android/server/os/BugreportManagerServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java index 5c0874d7977af..c98a79ad4ed95 100644 --- a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java +++ b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java @@ -174,7 +174,11 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub { ds.startBugreport(callingUid, callingPackage, bugreportFd, screenshotFd, bugreportMode, myListener); } catch (RemoteException e) { - reportError(listener, IDumpstateListener.BUGREPORT_ERROR_RUNTIME_ERROR); + // bugreportd service is already started now. We need to kill it to manage the + // lifecycle correctly. If we don't subsequent callers will get + // BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS error. + // Note that listener will be notified by the death recipient below. + cancelBugreport(); } }