Repository navigation
Read saved content query text from android_triage and ALEX raw text output - #2082
Conversation
…utput A shared reader for the text that adb shell content query prints (scripts/content_query_reader.py) and one artifact per URI for the layouts android_triage and ALEX (raw text) write, plus a Content Query Files artifact that keeps apart rows, No result found., access denied (SecurityException only), provider error, empty file and no file. Synthetic test cases for both layouts, reader unit tests, and allowlist entries for the tool output folders, which have no package anchor. Part of abrignoni#2073. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AOSP's MmsProvider only matches content://mms/<id>/addr, but device providers can answer content://mms/addr with one row per address keyed by msg_id, and ALEX saves it as mms/mms_addr.txt. The MMS note said no address file was expected, which dropped senders and recipients. - New MMS Addresses (content query) artifact, one row per address row, with the PduHeaders name of its type and whether its msg_id is an MMS row. - MMS rows get From, To, Cc and Bcc joined on msg_id = _id; blank and logged as unknown when the folder has no mms_addr.txt. - Content Query Files lists the new URI. - Synthetic case with FROM, TO, CC and BCC rows, a NULL address, a msg_id with no MMS row and a non-address type; MMS without an address file in the skipped case. Part of abrignoni#2073. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the folder has no mms/mms_addr.txt, From, To, Cc and Bcc stay blank and Parse Note now says the addresses are unknown, so a blank reads as not known rather than as no sender. When mms_addr.txt is there but holds no FROM, TO, CC or BCC row for a message, Parse Note says that instead. Synthetic cases cover both. Part of abrignoni#2073. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move each artifact from "Android Content Query" to the category in admin/data/artifact_categories.json that the database artifacts for the same data use: Messaging, Calls & Contacts, Productivity, Photos & Media, and Logs & Diagnostics for Content Query Files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t is part of a value, do not split on a repeated column name - read_file keeps dumps only for the run object it is given (the run's seeker), held and compared by identity, so a new run reads its own staged files even at the same path and size. Without a run object it does not cache. - An 'Error while accessing provider:' line and an exception line in the last row are read as an error after it only when the row without them still holds the dump's columns. When the whole row holds them too, the row's Parse Note says the boundary is ambiguous. - When the inferred column list names a column twice, which a value holding ', <name>=' in the only row (or in every row) also produces, rows are not split and keep their full text in Parse Note. Review of abrignoni#2082. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le keys, list the sibling as a source; bound ALEX notes to its commits - MMS and MMS Addresses read the sibling file (mms_addr.txt or mms.txt) through the run cache and keep its status. When it is not a full list of rows (a provider error, rows then an error, rows not split, an empty, unrecognised or unreadable file), recovered matches are kept and an unmatched row says the relation is unknown, with the reason, instead of "no address rows" or "no". - An _id or msg_id that is empty or the text NULL is never indexed or matched; the row says so in Parse Note. - The sibling actually read is added to the source list; Source File and Source Line stay those of the primary row. - ALEX notes are bounded to its commits, as abrignoni#2084 does: up to 8f27e7a it writes no file when the output holds one of its four error strings anywhere; from ed3d41eb it writes the file whenever the output holds a row. ed3d41eb's PRFS zip layout (extra/content_provider/) is not read. - New synthetic cases alex_join_incomplete, alex_mms_incomplete and alex_row_edges, and unit tests for the joins and sources. Review of abrignoni#2082. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Pushed the fixes for the six review comments (252e154, f1cc632), after merging main (#2083, #2084).
|
|
Thanks Maxi, and thanks for the quick fixes on the first six. CI is green and the Mac review of f1cc632 raised three new ones. One needs a fix before this can merge; the other two can go in a follow-up.
For the follow-up (I'll open one issue for both):
Also for later: ALEX's PRFS zip now keeps the raw text too, as |
When mms_addr.txt ends in an error but still gave some addresses for a message, the MMS row showed them with an empty Parse Note, so it read as complete. It now says the addresses may be partial, with the reason. A message with none still says the addresses are unknown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Maxi, I went ahead and pushed the partial-address fix to your branch (2763b8b) so this can move while you sleep. Small change: a new Parse Note for messages that got some addresses from an incomplete mms_addr.txt, one test, and the one baseline it changes. All 35 strict cases pass. Pull before your next push. |
abrignoni
left a comment
There was a problem hiding this comment.
Thanks Maxi, this is a solid first part. Merging.
…t first columns
Taking the first 'Row: 0' line as row 0 lost the real rows when a
row-like line came before them ('Row: 0 example=x', then 'Row: 0 _id=1',
'Row: 1 _id=2'), a case the vote of abrignoni#2082 read correctly. When 'Row: 0'
lines name different first columns, each reading is now tried and the
one kept has the fewest rows that cannot be split, then the least text
before its first row, then the earliest 'Row: 0'. A single real row
whose value quotes 'Row: 0' and 'Row: 1' lines still keeps its own
first column. Tests for both.
Review of abrignoni#2127.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
First part of #2073: a shared reader for the text that
adb shell content query --uri <uri>prints, and one artifact per URI for the layouts that android_triage and ALEX (raw text) write.Reader (
scripts/content_query_reader.py, no ALEAPP imports, likedumpstate_reader.py)No result found., access denied, provider error, empty file, or text it doesn't recognise. "Access denied" only when the exception isjava.lang.SecurityException; any other exception is "provider error", with its class and message.Row: <next number> <first column>=, so a value line likeRow: 7 of the liststays in its value., total=inside a body stays in the body. A value holding, <name>=for one of the file's own columns is flagged in Parse Note, since the split there may be off.NULL,BLOBand empty values are kept as printed. Rows printed before an error at the end of the text are read, and the error is reported.Artifacts (
scripts/artifacts/contentQuery.py)No result found., access denied, provider error, empty file and no file. For ALEX a missing file is "unknown", since ALEX writes none for no rows, an error, or one of its four error strings anywhere in the output. Also lists the columns each file printed.mms/mms_addr.txtin the same folder, joined on msg_id =_id, the way the smsmms artifact shows them. MMS Addresses lists each address row with its Source Line, the PduHeaders name of its type, and whether its msg_id is an MMS row.content://com.android.calendar/events.Notes and sources
Content.java, pinned to 8d2ed506. Layouts:android_triage.shat 14edd935 andalex.pyat 9ef34bf0.NULLorBLOBcan't be told apart from a real one and that an empty string prints as nothing.dateanddate_sentthe contract gives no unit. The notes say so and cite the AOSP providers instead: SmsProvider writes ms and MmsProvider writes s. That's the same split the smsmms notes already describe.content://mms/<id>/addr, notcontent://mms/addr, but some device providers answercontent://mms/addrwith one row per address keyed by msg_id, and ALEX queries it. The notes say both and keep the pinned MmsProvider link. When ALEX has nomms_addr.txt, Content Query Files reports the file as unknown and each MMS row says in Parse Note that its addresses are unknown; when the file is there but holds no FROM, TO, CC or BCC row for a message, Parse Note says that instead. Address types cite AOSP PduHeaders (FROM 0x89, TO 0x97, CC 0x82, BCC 0x81).Tests
admin/test/cases, built byadmin/test/scripts/content_query_fixture.py. All values are invented (+1555 numbers, example.com):, total=,, seen=, aRow:line inside a body, NULL, BLOB and empty values, MMS parts, MMS addresses (FROM, TO, CC and BCC rows, a NULL address, a msg_id with no MMS row, a type that isn't an address field).No result found., an empty file, the tool's own log and provider list left out.run_test_cases.py --module contentQuery --strict: 27 PASS.test_content_query_reader.py: reader unit tests.lint_changed.pyreports no new warnings. The 14 tool-folder patterns have no package to anchor to, so they are inpath_anchor_allowlist.jsonwith the reason.admin/data/artifact_categories.json, matching the database artifacts for the same data: Messaging (SMS, MMS, MMS Parts, MMS Addresses), Calls & Contacts (Call Log, Contacts, Contact Phone Numbers), Productivity (the calendar ones), Photos & Media (MediaStore Files) and Logs & Diagnostics (Content Query Files). No new category. Merged with main after Group artifacts into 30 categories #2071; the fullunittestsuite shows the same failures on this branch as on main in a local Windows run, and the 24 new tests pass.Real devices
Device A (Android 16, API 36): both tools. Device B (Android 14, API 34): ALEX only. Run on Windows 11 (android_triage from Git Bash), at the commits above. Checked independently of this reader, on all three runs: every row rebuilt from the split columns is identical to the raw text, the row count of each artifact matches the raw file, and the times, SMS bodies, numbers, names, paths, owner packages and MMS addresses shown match the raw values on every row.
On device A, android_triage also left 37 files holding
No result found.and 2 empty files. Device A's provider answerscontent://mms/addr; device B's does not, so ALEX kept nomms_addr.txtthere, Content Query Files reports that file as unknown, and each MMS row says its addresses are unknown. Both tools wrote CRLF line endings on Windows. Any row that comes out wrong on further devices will come back here as a synthetic case.🤖 Generated with Claude Code