mirror of
https://github.com/mvt-project/mvt.git
synced 2026-09-15 14:15:30 +02:00
End a settings record at a blank line
dumpsys prints a blank line after every namespace block and after a change history, and the generation registry and any vendor dumps follow the last block before the section trailer. A record ran until the next `_id:` line, heading or trailer, so the last row of the section absorbed those dumps into whichever field came last. A blank line now closes the record being read; lines that follow it without an `_id:` are skipped until the next row or heading. The fixture carries a generation registry after its last block, modelled on the AOSP dump, and the last row is pinned to exactly its own fields.
This commit is contained in:
@@ -177,6 +177,14 @@ class Settings(AndroidArtifact):
|
||||
if namespace is None:
|
||||
continue
|
||||
|
||||
if not line.strip():
|
||||
# dumpsys prints a blank line after every namespace block and
|
||||
# after a change history, and other dumps such as the
|
||||
# generation registry follow the last block, so a blank line
|
||||
# closes the record being read.
|
||||
flush()
|
||||
continue
|
||||
|
||||
if line.startswith("_id:"):
|
||||
flush()
|
||||
record_lines = [line]
|
||||
|
||||
@@ -87,6 +87,20 @@ class TestSettingsArtifact:
|
||||
assert record["value"] == "1"
|
||||
assert record["isValuePreservedInRestore"] == "false"
|
||||
|
||||
def test_dumps_after_the_last_block_are_not_part_of_the_last_row(self):
|
||||
settings = parse_bugreport_settings()
|
||||
|
||||
assert settings.results[-1] == {
|
||||
"namespace": "secure",
|
||||
"user": "10",
|
||||
"_id": "311",
|
||||
"name": "accessibility_enabled",
|
||||
"pkg": "android",
|
||||
"value": "0",
|
||||
"tag": "null",
|
||||
"history": [],
|
||||
}
|
||||
|
||||
def test_repeated_names_are_kept_as_separate_records(self):
|
||||
settings = parse_bugreport_settings()
|
||||
|
||||
|
||||
@@ -308,4 +308,9 @@ _id:240 name:accessibility_enabled pkg:android value:1 default:0 defaultSystemSe
|
||||
SECURE SETTINGS (user 10)
|
||||
_id:311 name:accessibility_enabled pkg:android value:0 tag:null
|
||||
|
||||
GENERATION REGISTRY
|
||||
Maximum number of backing stores:8
|
||||
Number of backing stores:1
|
||||
_Backing store for type:SETTINGS_SECURE user:10 size:1024 cachedEntries:1
|
||||
|
||||
--------- 0.019s was the duration of dumpsys settings, ending at: 2022-03-29 23:14:28
|
||||
|
||||
Reference in New Issue
Block a user