Rename the bugreport from .tmp to .zip when the user consent is unavailable
BUG: 185825114
Test: Confirm that the bugreport is .zip when the user consent is unavailable
Change-Id: I6fc28aa3e040152ed16a2807afcef3516ebbc210
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 336c5a2..527f3d7 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -3183,6 +3183,11 @@
// Since we do not have user consent to share the bugreport it does not get
// copied over to the calling app but remains in the internal directory from
// where the user can manually pull it.
+ std::string final_path = GetPath(".zip");
+ bool copy_succeeded = android::os::CopyFileToFile(path_, final_path);
+ if (copy_succeeded) {
+ android::os::UnlinkAndLogOnError(path_);
+ }
return Dumpstate::RunStatus::USER_CONSENT_TIMED_OUT;
}
// Unknown result; must be a programming error.