diff options
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/os/BugreportManager.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/os/BugreportManagerServiceImpl.java | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 5557b79ceede..e2a6d2fdb597 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5128,6 +5128,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 diff --git a/core/java/android/os/BugreportManager.java b/core/java/android/os/BugreportManager.java index 27f7e2296e7f..684369a6f720 100644 --- a/core/java/android/os/BugreportManager.java +++ b/core/java/android/os/BugreportManager.java @@ -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) {} diff --git a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java index 1dada92ab118..f4454ae2a180 100644 --- a/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java +++ b/services/core/java/com/android/server/os/BugreportManagerServiceImpl.java @@ -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; } |