Repository navigation
fix: survive oversized notification extras parcels - #44
Conversation
First read of Notification.extras unparcels the entire bundle. A notification carrying a huge parcelled payload (chat history, embedded images) materialized enough objects to exhaust the 256MB heap inside AutomationNotificationListener.onNotificationPosted — OutOfMemoryError on 0.19.18, moto g23 Android 14. Title/text/sender are now read behind runCatching and degrade to empty strings, so pkg, category, group state and timestamps still dispatch the trigger and the shade refresh still runs. Shade refreshes are also serialized behind a Mutex: each unparcels every active notification's extras, and concurrent runs multiplied the same heap spike. Authored By: TDvorak <info@tdvorak.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Mira PR WalkthroughThis PR fixes an OutOfMemoryError caused by unparcelling oversized notification extras (e.g., chat history with embedded images) in AutomationNotificationListener. Title/text/sender reads are now wrapped in runCatching to degrade gracefully to empty strings, while pkg/category/group state and timestamps still dispatch triggers. A Mutex serializes refreshActiveNotifications to prevent concurrent heap spikes during notification bursts. Confidence: 4/5 ◉◉◉◉○ Safe with minor fixes
2 files reviewed
|
There was a problem hiding this comment.
Mira Review Summary
In automation-android/src/main/kotlin/com/tdvorak/nothingmodes/automation/lifecycle/AutomationNotificationListener.kt:128, the generation check runs after the expensive notification fetch and unparcel work, and this check is stale. Moving the check earlier would avoid unnecessary processing.
Key Issues
| Issue | Location | |
|---|---|---|
| 🔴 | Stale generation check runs after expensive notification fetch/unparcel work | automation-android/src/main/kotlin/com/tdvorak/nothingmodes/automation/lifecycle/AutomationNotificationListener.kt:128 |
Review follow-up: the generation check ran after fetching and unparcelling every active notification, so a stale refresh still paid the full cost before discarding. Check before the fetch too; the post-fetch check stays so a refresh overtaken mid-flight cannot overwrite fresher snapshots. Adds the missing changelog entry. Authored By: TDvorak <info@tdvorak.dev>
Summary
OutOfMemoryErroron 0.19.18 (moto g23, Android 14): first read ofNotification.extrasunparcels the entire bundle, and a notification carrying an oversized parcelled payload (chat history, embedded images) exhausted the 256MB heap insideAutomationNotificationListener.onNotificationPosted.runCatchingand degrade to empty strings — pkg, category, group state and timestamps still dispatch the trigger, and the notification log/ shade refresh still run.refreshActiveNotificationsis serialized behind aMutex: each refresh unparcels every active notification's extras, and concurrent runs multiplied the same heap spike during notification bursts.The two
ForegroundServiceDidNotStartInTimeExceptionreports in the same batch are from 0.19.12 and were already fixed by #43 (shipped in 0.19.17) — no action needed beyond users updating.Test plan
./gradlew :app:assemblePlayDebug— builds./gradlew :automation-android:lintDebug— clean:automation-android:testDebugUnitTest— no test sources in moduleGenerated with Devin