Delete bugreport file on bugreport cancel

Note: bugreport Cancel is not the same as bugreport onError. Files are not
deleted onError, as it still has some information before the bugreport
crashed/stopped. Bugreport Cancel is triggered by the user, hence clean
up all the files.

Bug: 146994281
Test: Cancel interactive bugreport from UI, deletes the current
bugreport files

Change-Id: I2606e491cbaa20eaa60980e98af56a194bae2280
This commit is contained in:
Abhijeet Kaur
2020-03-30 17:18:00 +01:00
parent 09b1ee6077
commit 982b104755

View File

@@ -817,6 +817,7 @@ public class BugreportProgressService extends Service {
Log.i(TAG, "Cancelling bugreport service (ID=" + id + ") on user's request");
mBugreportManager.cancelBugreport();
info.deleteScreenshots();
info.deleteBugreportFile();
}
stopProgressLocked(id);
}
@@ -1967,6 +1968,14 @@ public class BugreportProgressService extends Service {
}
}
/**
* Deletes bugreport file for a given bugreport.
*/
private void deleteBugreportFile() {
Log.i(TAG, "Deleting bugreport file " + bugreportFile);
bugreportFile.delete();
}
/**
* Rename all screenshots files so that they contain the new {@code name} instead of the
* {@code initialName} if user has changed it.