fix: Clamp progress percent to [0, 100] to prevent SystemUI crash#214
Merged
Merged
Conversation
When a third-party app (e.g. WhatsApp) sends a progress notification with a negative EXTRA_PROGRESS value (such as -1 during backup initialization), ProgressTranslator and DownloadTranslator would pass the negative percent directly into the Dynamic Island JSON payload. This causes SystemUI's CircularProgressBar.setProgress() to throw an IllegalArgumentException, resulting in a fatal crash on the main thread. The user experiences repeated SystemUI force-closes (black screen / UI restart loop). Fix: apply .coerceIn(0, 100) to the calculated percent value before it is forwarded to the island builder, ensuring only valid progress values reach SystemUI regardless of what the source notification contains.
D4vidDf
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a third-party app (e.g. WhatsApp) sends a progress notification with a negative
EXTRA_PROGRESSvalue (such as-1during chat backup initialization),ProgressTranslatorandDownloadTranslatorcalculate a negative percent and pass it directly into the Dynamic Island JSON payload.SystemUI's
CircularProgressBar.setProgress()throws anIllegalArgumentExceptionwhen it receives a value less than 0. Since this runs on the main thread, it causes a fatal crash. From the user's perspective, SystemUI force-closes repeatedly, resulting in a black screen or continuous UI restart loop until the offending notification is dismissed.Root Cause
When
current = -1andmax = 100, this producespercent = -1, which is sent to SystemUI and triggers the crash.Fix
Applied
.coerceIn(0, 100)to the calculated percent in bothProgressTranslatorandDownloadTranslator, ensuring only valid progress values are forwarded to SystemUI regardless of what the source notification contains.Files Changed
app/src/main/java/com/d4viddf/hyperbridge/service/translators/ProgressTranslator.ktapp/src/main/java/com/d4viddf/hyperbridge/service/translators/DownloadTranslator.ktCrash Stack (from production logs)
Tested On
setProgress(100, -1, false)Fixes #215