OSDN Git Service

Notify the caller about I/O error
authorAbhijeet Kaur <abkaur@google.com>
Mon, 15 Apr 2019 09:16:42 +0000 (10:16 +0100)
committerAbhijeet Kaur <abkaur@google.com>
Tue, 16 Apr 2019 10:34:21 +0000 (11:34 +0100)
Call onError for caller of BugreportManager.start() if any io error
occurs during runtime.

Test: Tested manually by throwing IO exception in the code when
bugreport is being generated, onError of the callback successfully
called.
Change-Id: I9033d85d392b926041fc26a86806a370752d062d

core/java/android/os/BugreportManager.java

index 0feed68..e366fe0 100644 (file)
@@ -175,6 +175,7 @@ public final class BugreportManager {
             // Need to delete the file if it was created but failed while trying to get fd
             deleteFile(tmpScreenshotFile);
             Log.e(TAG, "Not able to create/open temporary screenshot file ", e);
+            callback.onError(BugreportCallback.BUGREPORT_ERROR_RUNTIME);
         } finally {
             // We can close the file descriptors here because binder would have duped them.
             IoUtils.closeQuietly(bugreportFd);