Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15d4df97 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

Don't leave root dumpstate-stats.txt



When booting the device after FDR, dumpstate triggers a BR with bugreport_mode=
BUGREPORT_ONBOARDING, which creates some temp files and dumpstate-stats.txt.
But, there are two files, -png.tmp and dumpstate-stats.txt, were remained as root
owner which prevents moving the files to /sdcard.

Bug: 425408179
Test: Boot and move files
Flag: EXEMPT bugfix
Change-Id: I8ea0bdcb7b40c5869142c1fd3ad5da224aaafd46
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
parent 9d3405cc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3620,6 +3620,10 @@ void Dumpstate::MaybeSavePlaceholderScreenshot() {
    // is saved for backwards compatibility.
    std::string path = ds.GetPath(ds.CalledByApi() ? "-png.tmp" : ".png");
    if (android::os::CopyFileToFile(DEFAULT_SCREENSHOT_PATH, path)) {
        if (chown(path.c_str(), AID_SHELL, AID_SHELL)) {
            MYLOGE("Unable to change ownership of copied screenshot %s: %s\n", path.c_str(),
                   strerror(errno));
        }
        MYLOGD("Saved fallback screenshot on %s\n", path.c_str());
    } else {
        MYLOGE("Failed to save fallback screenshot on %s\n", path.c_str());
@@ -4039,6 +4043,10 @@ void Progress::Save() {
    if (!android::base::WriteStringToFile(content, path_)) {
        MYLOGE("Could not save stats on %s\n", path_.c_str());
    }

    if (chown(path_.c_str(), AID_SHELL, AID_SHELL)) {
        MYLOGE("Unable to change ownership of %s: %s\n", path_.c_str(), strerror(errno));
    }
}

int32_t Progress::Get() const {