diff options
author | 2023-08-25 15:28:46 -0400 | |
---|---|---|
committer | 2023-09-08 15:31:40 -0400 | |
commit | 9ce85681cda102ebc4c10050810e34cbe147a0cc (patch) | |
tree | ff12755077e2190e0001293a2261527176014000 | |
parent | 19b1c65ca598cb661b2aeb06b73774c2de4b4790 (diff) |
MSKP capture: write to a different directory
Writing to /data/user is no longer allowed, even with
`adb shell setenforce 0`. Write to /data/misc/mskps instead. Remove a
reference to the old location.
Attempt to create the file on device.
Bug: 296282988
Test: manual
Change-Id: I4565a1c7fd8b4e75cf2207c59bf76b45fd761ce1
-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 |