Skip to content

fix: the save toast, the session's names, and a shared-media read - #512

Merged
an1ndra merged 1 commit into
Developfrom
fix/codeql-alerts
Nov 19, 2026
Merged

an1ndra merged 1 commit into
Developfrom
fix/codeql-alerts

Conversation

@an1ndra

@an1ndra an1ndra commented Nov 19, 2026

Copy link
Copy Markdown
Owner

What changed

Four things from the code-scanning page, three of them real bugs:

  • Saving an attachment showed nothing. The outcome was worked out into a message and then dropped — a save that wrote the file and one that failed looked identical to the user. CodeQL's "Unread local variable" was right. It is shown now.
  • LockSession.lock() / unlock() are a process-wide boolean, not a lock, but the names read as one to any tool that looks for a critical section: CodeQL reported the debug probe's lock() as an unreleased lock on a flag that is meant to stay set. Renamed to clear() / grant(), which is what they do. The probe's intent extras are unchanged, so the app-lock scripts keep working.
  • An unused colorScheme in the video player dialog is gone.
  • The shared-media read uses IntentCompat instead of the getters deprecated from API 33 — which also removes the @Suppress("DEPRECATION") it needed.

Why the other eleven are not code changes

  • 7 × Deprecated method or constructor invocation — MediaRecorder() (the Context constructor is API 31+), CarrierConfigManager.getConfigForSubId(int), SubscriptionInfo.getNumber(), NotificationManager.areBubblesAllowed(), SmsManager.getSmsManagerForSubscriptionId(), PhoneNumberUtils.compare(String, String). Each is the only call available at minSdk 29; the replacement only exists on newer releases, so the deprecated call is the compatibility path. CodeQL's java/deprecated-call has no API-level awareness.
  • 3 × Field masks field in super class — $stable is generated by the Compose compiler on each class; two of them shadow each other. There is no source-level field to rename.

Those need dismissals (or a query-filters exclusion in a CodeQL config) rather than commits — say which you prefer and I will do it.

Testing

  • ./gradlew testDebugUnitTest passes
  • JUnit test added: AttachmentSaveFeedbackTest (the save shows its outcome) and a LockSessionTest case that holds the session's API to the names that describe it, so the false positive cannot come back.
  • No UI flow changed, so no new device script; the existing save-path assertions (saved=N/total in AttachmentSave) still cover the write.

Related issue

None — from the repository's code-scanning page.

Four things CodeQL found on Develop, three of them real:

- Saving an attachment showed nothing. The outcome was worked out into a
  `message` and then dropped: a save that wrote the file and one that
  failed looked identical. It is shown now.
- `LockSession.lock()`/`unlock()` are a process-wide boolean, not a lock,
  but the names read as one to any tool that looks for a critical
  section — CodeQL reported the debug probe's `lock()` as an unreleased
  lock on a flag that is meant to stay set. Renamed to `clear()`/`grant()`,
  which is what they do. The probe's intent extras are unchanged.
- An unused `colorScheme` in the video player dialog is gone.
- The shared-media read uses `IntentCompat` instead of the getters
  deprecated from API 33, which also removes the `@Suppress` it needed.

The rest of the open alerts are API-level compat calls (MediaRecorder's
no-arg constructor, CarrierConfig's one-argument getter, SubscriptionInfo's
number, bubbles) that have no non-deprecated path at minSdk 29, and three
`$stable` fields generated by the Compose compiler shadowing each other.
Those need a dismissal or a query filter, not a code change.

JUnit: AttachmentSaveFeedbackTest (the save shows its outcome) and a
LockSessionTest case holding the session's API to the names that describe
it, so the false positive cannot come back.
@an1ndra
an1ndra merged commit 4ad8828 into Develop Nov 19, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant