Merge "Delete empty bugreport files onError" into rvc-dev am: 873f59dc0e am: 8abcebf3e2 am: 24598b6af8
Change-Id: I8c238843465ec2f3d400f76fe8e7b5231bfda5de
This commit is contained in:
@@ -363,6 +363,7 @@ public class BugreportProgressService extends Service {
|
|||||||
public void onError(@BugreportErrorCode int errorCode) {
|
public void onError(@BugreportErrorCode int errorCode) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
stopProgressLocked(mInfo.id);
|
stopProgressLocked(mInfo.id);
|
||||||
|
mInfo.deleteEmptyFiles();
|
||||||
}
|
}
|
||||||
Log.e(TAG, "Bugreport API callback onError() errorCode = " + errorCode);
|
Log.e(TAG, "Bugreport API callback onError() errorCode = " + errorCode);
|
||||||
return;
|
return;
|
||||||
@@ -1979,6 +1980,22 @@ public class BugreportProgressService extends Service {
|
|||||||
bugreportFile.delete();
|
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
|
* Rename all screenshots files so that they contain the new {@code name} instead of the
|
||||||
* {@code initialName} if user has changed it.
|
* {@code initialName} if user has changed it.
|
||||||
|
|||||||
Reference in New Issue
Block a user