diff options
-rw-r--r-- | libs/renderengine/skia/debug/SkiaCapture.cpp | 14 | ||||
-rwxr-xr-x | libs/renderengine/skia/debug/record.sh | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/libs/renderengine/skia/debug/SkiaCapture.cpp b/libs/renderengine/skia/debug/SkiaCapture.cpp index b21b01cc1b..48dc77eeec 100644 --- a/libs/renderengine/skia/debug/SkiaCapture.cpp +++ b/libs/renderengine/skia/debug/SkiaCapture.cpp @@ -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. diff --git a/libs/renderengine/skia/debug/record.sh b/libs/renderengine/skia/debug/record.sh index c818c40371..88d8b09bd0 100755 --- a/libs/renderengine/skia/debug/record.sh +++ b/libs/renderengine/skia/debug/record.sh @@ -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 |