📚 Encyclopedia

Android · updated 2026-10-13

Unknown-sender quarantine and OTP exemptions for SMS

androidsmsspamsmishingotpquarantineprivacydatastore

"Block unknown senders" in an SMS app means: a message from someone who is not a contact and has never been texted goes to a hidden Quarantine list, silently, instead of the inbox. The tricky parts are one-time passcodes (which come from unknown senders by nature), short codes that send both codes and promos, smishing that imitates codes, and imports that bypass the rule.

The gate (as built in the Message app)

A message is quarantined when the setting is on, the thread is not established (user never sent in it), the sender is not a contact, and it is not a trusted OTP. The verdict has three values: - PASS: deliver normally. - HOLD: quarantine silently. - HOLD_BUT_NOTIFY: keep the thread quarantined but notify this one message (with a copy-code chip).

Decisions: - OTP from a full phone number releases the thread (old behavior). OTP from a short code is HOLD_BUT_NOTIFY: short code 32665 (Facebook) sends both login codes and promos, so a code must not whitelist the sender forever. - Smishing defeats a naive OTP check. "Any 4 to 8 digit run plus a word like code/verify/pin" matches "confirm your zip code at usps-redeliver.top by 9/30/2026" and "call 555-123-4567 to verify your account". Classify instead: prices, dates, percents, decimals are NOT a code (hold); a code next to a link, a callback number or a year-only number is SUSPICIOUS (hold but notify; never release the thread); only a clean code is trusted. Strip WebOTP lines (@domain #code) before looking for links. Open question: a spammer can still send one clean code first. - The gate must stand down without READ_CONTACTS, or everyone is "not a contact". - Keyword matching must be whole-word ("opinion" is not "pin").

Imports and receive-time-only rules

The gate originally ran only when a message was received. Provider sync created rows unquarantined, and "existing thread" then exempted the sender forever, so a reinstall whitelisted every spammer. Fix: apply an import rule to threads new to the app database (no OTP exemption for old messages; a group with any contact passes) plus a "Re-check existing conversations" action.

Retention

A 30-day auto-delete of quarantined threads must only expire rows the filter itself quarantined, measured from a quarantinedAt stamp, not from the last message date (a hand-quarantined thread with an old last message would be deleted the next day). Scope any destructive query to exactly what the Quarantine screen shows, excluding rows also marked private or kid-blocked.

Changing a privacy default on existing installs

The setting defaulted off; turning it on by default for everyone would silently hide messages on existing phones. A DataStore DataMigration pins the old value (false) for installs that finished onboarding and never touched the toggle; only fresh installs get the new default. Lesson recorded as canon: never flip a privacy-affecting default on an existing install behind the user's back. Note that allowBackup=false means a reinstall loses all preferences, which is how the filter was found silently off.

Kid mode interplay

When a stricter allowlist mode is on, it dominates: allowlisted senders are never quarantined, everyone else is hard-hidden. Both flags can be set on one row.

See also

Linked from

Sources: message memory (quarantine_2026_09, project_pending_work, project_kid_mode), tldr posts #1673, #1674, #1692