Merge "Add a new error code for disallowing concurrent bugreports"

am: 2badc1e434

Change-Id: I30cd117c2c09346f7958c69e95fecd5831874024
This commit is contained in:
Nandana Dutt
2019-02-22 00:53:31 -08:00
committed by android-build-merger
3 changed files with 12 additions and 3 deletions

View File

@@ -4015,6 +4015,7 @@ package android.os {
method public void onError(int);
method public void onFinished();
method public void onProgress(float);
field public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS = 5; // 0x5
field public static final int BUGREPORT_ERROR_INVALID_INPUT = 1; // 0x1
field public static final int BUGREPORT_ERROR_RUNTIME = 2; // 0x2
field public static final int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT = 4; // 0x4

View File

@@ -59,7 +59,8 @@ public class BugreportManager {
BUGREPORT_ERROR_INVALID_INPUT,
BUGREPORT_ERROR_RUNTIME,
BUGREPORT_ERROR_USER_DENIED_CONSENT,
BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT
BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT,
BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS
})
/** Possible error codes taking a bugreport can encounter */
@@ -81,6 +82,10 @@ public class BugreportManager {
public static final int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT =
IDumpstateListener.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT;
/** There is currently a bugreport running. The caller should try again later. */
public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS =
IDumpstateListener.BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS;
/**
* Called when there is a progress update.
* @param progress the progress in [0.0, 100.0]
@@ -96,6 +101,9 @@ public class BugreportManager {
* <p>If {@code BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT} is passed, then the consent timed
* out, but the bugreport could be available in the internal directory of dumpstate for
* manual retrieval.
*
* <p> If {@code BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS} is passed, then the
* caller should try later, as only one bugreport can be in progress at a time.
*/
public void onError(@BugreportErrorCode int errorCode) {}

View File

@@ -146,8 +146,8 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub {
if (isDumpstateBinderServiceRunningLocked()) {
Slog.w(TAG, "'dumpstate' is already running. Cannot start a new bugreport"
+ " while another one is currently in progress.");
// TODO(b/111441001): Use a new error code; add this to the documentation of the API.
reportError(listener, IDumpstateListener.BUGREPORT_ERROR_RUNTIME_ERROR);
reportError(listener,
IDumpstateListener.BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS);
return;
}