diff options
author | 2024-03-04 10:55:28 +0000 | |
---|---|---|
committer | 2024-03-05 13:57:18 +0000 | |
commit | c14cebc9b2f0e36cbca3569dfadb59e836bc7f52 (patch) | |
tree | 25acb240cfddca8d200c0639c50a4af5a894c2b9 /cmds/dumpstate/dumpstate.cpp | |
parent | 2d5ba921956704d108f8893b87f80f4633a1165c (diff) |
Ignore "use pre-dump" flag if no data is available
In some cases dumpstate might be requested to create a bugreport with "use pre-dump" flag,
even if no pre-dumped data is available on disk.
In such cases dumpstate should ignore the "use pre-dump" flag.
Example scenario where the pre-dumped data would not be available:
1. Pre-dump data
2. Start bugreport + "use pre-dump" flag (USE AND REMOVE THE PRE-DUMP FROM DISK)
3. Start bugreport + "use pre-dump" flag (NO PRE-DUMP AVAILABLE ON DISK)
Bug: 327322141
Test: atest com.android.os.bugreports.tests.BugreportManagerTest
Change-Id: Ice75f18437064daad98857c8de8a07c7e2994e0c
Ignore-AOSP-First: depends on changes not available in AOSP
(e.g. I343813929a537c601132dd15db5e2c4d3fbbdcb1)
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 8d37aac0cb..826a8dbc2c 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -3280,6 +3280,12 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, // duration is logged into MYLOG instead. PrintHeader(); + bool system_trace_exists = access(SYSTEM_TRACE_SNAPSHOT, F_OK) == 0; + if (options_->use_predumped_ui_data && !system_trace_exists) { + MYLOGW("Ignoring 'use predumped data' flag because no predumped data is available"); + options_->use_predumped_ui_data = false; + } + std::future<std::string> snapshot_system_trace; bool is_dumpstate_restricted = |