Skip to content

fix compilation deprecations - #3338

Open
DenBond7 wants to merge 18 commits into
masterfrom
issue_3332_fix_compilation_deprecations
Open

DenBond7 wants to merge 18 commits into
masterfrom
issue_3332_fix_compilation_deprecations

Conversation

@DenBond7

@DenBond7 DenBond7 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

This PR fixes compilation deprecation warnings across the FlowCrypt module (main, unit tests, androidTest and the Gradle build script), so the build no longer relies on APIs scheduled for removal.

close #3332

Changes

PGP (PGPainless 2.x / BouncyCastle)

  • readKeyRing() → readKey() (EmailUtil, MsgsCacheManager, WkdClient, DiskLruCacheSnapshotExt, IterableExt, DraftViewModel)
  • ConsumerOptions.get() / EncryptionOptions.get() / SigningOptions.get() → get(api) (PgpDecryptAndOrVerify, PgpEncryptAndOrSign, PgpSignature)
  • UnlockSecretKey.unlockSecretKey() now gets algorithmPolicy (PgpKey)
  • SecretKeyPassphraseProvider implementations use KeyIdentifier only, without the deprecated Long keyId overrides (KeysStorageImpl)
  • keyId comparison → SubkeyIdentifier in PgpMsg
  • Public keys are parsed with parseKeysOrCertificates() (IterableExt.toPGPPublicKeyRingCollection(), WkdClient). parseKeys() accepts only secret keys and threw Encountered unexpected packet: PGPPublicKeyRing, which broke encryption for recipients' public keys. This regression came in with the readKey() migration and was caught by ThreadDetailsGmailApiFlowTest.
  • WkdClient limits a WKD response to 1 MiB before parsing. Unlike the old publicKeyRingCollection(), parseKeysOrCertificates() reads the whole stream into memory, so an oversized response could cause an OutOfMemoryError.

UI

  • Deprecated bundleOf → type-safe Bundle across 34 fragments/dialogs, keeping the existing Fragment Result Bundle contracts
  • InputMethodManager.SHOW_IMPLICIT → 0 in ViewExt.showKeyboard()

Other

  • EmailAndNameWorker: Data.getStringArray() → getNullableStringArray(), skips null emails
  • build.gradle.kts: dropped multiDexEnabled (not needed with minSdk = 29); assets.srcDir() → assets.directories.add(); by configurations.creating / by configurations.named() → configurations.create() / configurations.named()

Tests

  • Unit tests migrated off deprecated PGPainless APIs: readKeyRing(), KeyRingUtils.publicKeyRingFrom(), ConsumerOptions.get() and the Long keyId passphrase-provider overrides
  • ParcelableTest: typed readParcelable(loader, Class) on API 33+, with the old call kept under @Suppress for older SDKs
  • androidTest: MessageMetadata.recipientKeyIds → recipientKeyIdentifiers
  • New IterableExtTest covers toPGPPublicKeyRingCollection() / toPGPSecretKeyRingCollection(). It fails without the parseKeysOrCertificates() fix.
  • New InputStreamExtTest and WkdClientTest.oversizedResponseTest cover the WKD response size limit.

The only deprecation warning left is BaseTest.toastWrapperToHaveDeprecationInOnePlace(). It is an intentional marker that keeps the broken Toast assertions visible (android/android-test#803).


Tests (delete all except exactly one):

  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities

DenBond7 and others added 18 commits November 13, 2026 11:05
- Replace deprecated readKeyRing() with readKey() across EmailUtil,
  MsgsCacheManager, WkdClient, DiskLruCacheSnapshotExt, IterableExt,
  and DraftViewModel.
- Migrate ConsumerOptions.get() to ConsumerOptions.get(api) in
  PgpDecryptAndOrVerify.
- Migrate EncryptionOptions.get() and SigningOptions.get() to pass api
  in PgpEncryptAndOrSign.
- Migrate unlockSecretKey to pass algorithmPolicy in PgpKey.
- Update PGPSecretKeyRingExt to use extension toPublicKeyRing().
- Update KeysStorageImpl to use KeyIdentifier instead of Long.
- Migrate deprecated InputMethodManager.SHOW_IMPLICIT in ViewExt.
- Preserved intentional @Suppress annotations. Verified with Gradle.
@DenBond7
DenBond7 marked this pull request as ready for review November 15, 2026 21:42
@DenBond7
DenBond7 requested a review from sosnovsky as a code owner November 15, 2026 21:42
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.

Fix compilation deprecations

1 participant