Merge "Delete empty bugreport files onError" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
873f59dc0e
@@ -363,6 +363,7 @@ public class BugreportProgressService extends Service {
|
||||
public void onError(@BugreportErrorCode int errorCode) {
|
||||
synchronized (mLock) {
|
||||
stopProgressLocked(mInfo.id);
|
||||
mInfo.deleteEmptyFiles();
|
||||
}
|
||||
Log.e(TAG, "Bugreport API callback onError() errorCode = " + errorCode);
|
||||
return;
|
||||
@@ -1979,6 +1980,22 @@ public class BugreportProgressService extends Service {
|
||||
bugreportFile.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes empty files for a given bugreport.
|
||||
*/
|
||||
private void deleteEmptyFiles() {
|
||||
if (bugreportFile.length() == 0) {
|
||||
Log.i(TAG, "Deleting empty bugreport file: " + bugreportFile);
|
||||
bugreportFile.delete();
|
||||
}
|
||||
for (File file : screenshotFiles) {
|
||||
if (file.length() == 0) {
|
||||
Log.i(TAG, "Deleting empty screenshot file: " + file);
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename all screenshots files so that they contain the new {@code name} instead of the
|
||||
* {@code initialName} if user has changed it.
|
||||
|
||||
Reference in New Issue
Block a user