Skip to content

SMS delete action intermittently fails on Android 16 #85

@magisk317

Description

@magisk317

Background

From latest user logs:

  • modules_2026-02-21T14_31_01.155935.log
  • verbose_2026-02-21T14_31_01.153618.log

User-reported symptom: SMS parse/copy works, but delete SMS action often fails.

Log evidence

Representative failed sample (2026-02-22 06:20:25~06:20:27):

  • SmsHandlerHook receives SMS_DELIVER
  • sender/body parsed and code extracted successfully
  • then OperateSmsAction: Deleting SMS...
  • finally Delete SMS failed

No hard exception is thrown for delete path, so this is likely a provider-write or matching failure (rows=0) rather than crash.

Analysis

Potential root causes found in current code:

  1. OperateSmsAction uses mPluginContext.contentResolver for Telephony SMS delete/update.
    • In hook context this may be treated as module-app identity for SMS provider write, making write operations brittle (especially Android 16 / OEM variants).
  2. Matching condition is too strict:
    • requires exact address == sender
    • requires unread status in same matching branch
    • any address normalization difference (prefix/country code formatting) can fail matching and lead to rows=0.
  3. Timing sensitivity:
    • SMS provider row may not be ready immediately when operation runs.

Proposed/implemented fix

  • Switch SMS provider operations to mPhoneContext.contentResolver.
  • Add retry window for SMS operation (4 attempts, 800ms delay) to absorb provider insert timing.
  • Relax matching robustness:
    • address normalization match by digits suffix,
    • mark-as-read treats already-read as success.

Scope

File:

  • OperateSmsAction.kt

Verification

  • Kotlin compile: ./gradlew :app:compileDebugKotlin passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions