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

Commit 3821b0df authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "MSKP capture: write to a different directory" into main

parents acbf250d 9ce85681
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -31,14 +31,17 @@
#include "SkRect.h"
#include "SkTypeface.h"
#include "src/utils/SkMultiPictureDocument.h"
#include <sys/stat.h>

namespace android {
namespace renderengine {
namespace skia {

// The root of the filename to write a recorded SKP to. In order for this file to
// be written to /data/user/, user must run 'adb shell setenforce 0' on the device.
static const std::string CAPTURED_FILENAME_BASE = "/data/user/re_skiacapture";
// be written, user must run 'adb shell setenforce 0' on the device. Note: This
// is handled by record.sh. FIXME(b/296282988): With updated selinux policies,
// 'adb shell setenforce 0' should be unnecessary.
static const std::string CAPTURED_FILE_DIR = "/data/misc/mskps";

SkiaCapture::~SkiaCapture() {
    mTimer.stop();
@@ -169,11 +172,12 @@ bool SkiaCapture::setupMultiFrameCapture() {
    ATRACE_CALL();
    ALOGD("Set up multi-frame capture, ms = %llu", mTimerInterval.count());
    base::SetProperty(PROPERTY_DEBUG_RENDERENGINE_CAPTURE_FILENAME, "");
    const std::scoped_lock lock(mMutex);

    // Attach a timestamp to the file.
    mkdir(CAPTURED_FILE_DIR.c_str(), 0700);

    const std::scoped_lock lock(mMutex);
    mCaptureFile.clear();
    base::StringAppendF(&mCaptureFile, "%s_%lld.mskp", CAPTURED_FILENAME_BASE.c_str(),
    base::StringAppendF(&mCaptureFile, "%s/re_skiacapture_%lld.mskp", CAPTURED_FILE_DIR.c_str(),
                        std::chrono::steady_clock::now().time_since_epoch().count());
    auto stream = std::make_unique<SkFILEWStream>(mCaptureFile.c_str());
    // We own this stream and need to hold it until close() finishes.
+0 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ sleep $(($1 / 1000 + 4));
# There is no guarantee that at least one frame passed through renderengine during that time
# but as far as I know it always at least writes a 0-byte file with a new name, unless it crashes
# the process it is recording.
# /data/user/re_skiacapture_56204430551705.mskp

spin() {
    case "$spin" in