* After the recent 3.0.0 update, which included a bump to targetSdk 31,
we've noticed some crashes when microG was disabled
* The stacktrace pointed to PendingIntent mutability flags, which are
required for targetSdk 31
Some details with stacktrace: https://gitlab.com/CalyxOS/calyxos/-/issues/1056
Test: Install ProtonMail on a device with microG as a system app, and with it disabled
Current stable release (3.0.2) will crash with the above stack trace
A build with this patch will work fine
This issue's first visible cause is a race condition: if we open a new
composer, type in a recipient, subject and body and then press the "add
attachment" button _with the right timing_ the issue will happen.
The "right timing" seem to be couple of seconds: the assumption is that
the save draft flow have to be started but not finished.
This is due to the result of the "save draft" flow (which is triggered
automatically after we stop typing) is stored in a liveData which does
not get consumed by the composer activity till the "add attachments activity"
drawn on top returns. Once this live data is consumed, it overrides one
field that the "result" of add attachments activity did just set -
effectively removing the attachment.
This is the key part of this issue, as previously the livedata seemed to
be consumed anyways and thus the race condition was not encountered
(or very unlikely to happen).
While git bisect points the issue started with commit "Targeting sdk 33
to allow for granular media permissions" [6c951a] (which is the reason
for the fix being a rollback of target sdk) this doesn't seem to be the
whole story. Few other changes dependencies update happened at the
same time (kotlin update, activity and coroutines libs updated transitely
through core).
Such bits seem to be concurring to creating the issue, making it uneasy
to define one single root cause with confidence.
MAILAND-3059
Third-party library updates & emulator version update for instrumentation tests.
- Change device for instrumentation tests (due to SIGSEGV crash on API 28, x86)
- Update compileSdk to 32 (required by Compose)
- AGP 7.3.1 (needed to fix jacoco issue for instrumented tests)
- Kotlin 1.6.21 (1.6.20 is required by AGP and 1.6.21 required by Compose)
- Remove `buildToolsVersion` - it's determined by Android Gradle Plugin
- Hilt 2.44
- Android Test 1.4.0
- Android Test Orchestrator 1.4.1
- Dagger 2.44
- Fragment 1.5.4