Status Update
Comments
ra...@google.com <ra...@google.com>
ra...@google.com <ra...@google.com> #2
Note: I know alpha-02 has a fix for a biometric related leak:
However that change did not fix the leak reported here, as BiometricViewModel is still tied to the activity lifecycle no matter what and will hold the clientCallback reference until the activity is destroyed.
ac...@gmail.com <ac...@gmail.com> #4
Can confirm that it still happens in 1.1.0-beta01
ra...@google.com <ra...@google.com> #5
Branch: androidx-main
commit fcbbd9368d75b736de4b92d067be84421376b294
Author: Curtis Belmonte <curtislb@google.com>
Date: Wed Jan 20 15:54:34 2021
Reset BiometricViewModel callback in Fragment#onDestroy()
Currently, the client callback reference held by BiometricViewModel is
retained for the lifecycle of the hosting activity. In the (likely) case
that a client is using a fragment within that activity to host
BiometricPrompt and passes an AuthenticationCallback with a reference to
that fragment, this will cause the fragment to leak.
This commit applies a minimal fix for the issue by resetting the
callback reference held by the view model when the host fragment is
destroyed (via a LifecycleObserver). This shouldn't affect the prompt's
behavior across configuration changes such as device rotation, since the
callback should be reinitialized by the client in onCreate() or similar.
Test: Biometric integration test app on API 27-30.
Test: ./gradlew biometric:biometric:test
Test: ./gradlew biometric:biometric:connectedAndroidTest
Test: ./gradlew biometric:integration-tests:testapp:connectedAndroidTest
Bug: 167014923
Change-Id: I7086460fac3921a490f4e2abf0671adec5c146bd
M biometric/biometric/src/main/java/androidx/biometric/BiometricPrompt.java
M biometric/biometric/src/main/java/androidx/biometric/BiometricViewModel.java
ac...@gmail.com <ac...@gmail.com> #6
I don't use Fragments and use a View-based solutions instead. I create prompt like this:
BiometricPrompt(requireActivity, myAuthCallback)
So it is tied to the activity and it still leaks my view-based screens (1.2.0-alpha02). Ideally there would be a way to reset this callback. Latest commit fixes this leak only for Fragments (sadly).
Is there any workaround maybe? Dirty (but working) ones would do too ;)
Description
Version used: all version including 2.5.0-rc01
Devices/Android versions reproduced on: Motorola G 7.0 (SDK 24), 7.1 (SDK 25)
Related source code:
mWorkDatabase.setTransactionSuccessful() must be called after calling resolve(true) line 193. Nested transactions will be rolled back if the outer transaction isn't marked as successful.
This behavior causes crashes on Motorola devices with 7.0/7.1
See crash report from Google Play for Motorola devices.