Status Update
Comments
ph...@monzo.com <ph...@monzo.com> #2
Thanks for the detailed analysis and sample. I've prepared a CL, but I'd also be happy to review an external contribution since you already went through the trouble of identifying a fix. Just let me know here.
cu...@google.com <cu...@google.com>
cu...@google.com <cu...@google.com>
ap...@google.com <ap...@google.com> #3
If you have a CL ready go for it.
That being said, I just went down git history and found when this was introduced:
As you can see, this was introduced to fix a "memory leak" though I don't quite understand why creating a new callback wrapper for every setSupportActionBar()
call is a problem.
ph...@monzo.com <ph...@monzo.com> #4
Branch: androidx-main
commit 200ccecbc8c7c5ba555e7fa15890edff67affb58
Author: Alan Viverette <alanv@google.com>
Date: Fri Apr 30 14:55:07 2021
Fix case where setSupportActionBar overwrites the window callback
RelNote: """Fix scenario where calling setSupportActionBar after setting the
window callback would overwrite the callback."""
Test: SupportActionBarTestCase
Fixes: 186791590
Change-Id: Ie43eedf8322caa44e7b201a95cbc64197953e020
A appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SupportActionBarTestCase.kt
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
[Deleted User] <[Deleted User]> #5
re...@infinum.com <re...@infinum.com> #6
I vaguely remember this. The issue was iirc:
- You use multiple fragments (say switched via tabs). Each fragment calls
setSupportActionBar()
when visible. - The old code would wrap the current
Window.Callback
with something fromToolbarActionBar
(TAB), then set it as the window callback. - When the user switches to Tab #2, we'd do the same thing, but this time the callback wrapper chain would be
(((Root callback) TBAB1Wrapper) TBAB2Wrapper)
. TBAB1Wrapper would keep a reference a reference to the views even though the #1 fragment has likely been destroyed.
I've just +2'd Alan's CL, but the proper fix is properly to unwrap the callback from Window.getCallback()
.
re...@infinum.com <re...@infinum.com> #7
Let me uh... let me go back and properly fix that.
Description
On an API 29 Pixel 4
androidx.biometric.BiometricManager#canAuthenticate(Authenticators.BIOMETRIC_STRONG)
returnsBIOMETRIC_STATUS_UNKNOWN
. I believe this is because thecanAuthenticate(CryptoObject)
method only works on Samsung devices - as far as I can tell it has never existed in AOSP.Some possible solutions (there may well be reasons not to do these things):
assume_strong_biometrics_prefixes
array, which is currently empty. Devices with fingerprint should be OK because they fall back tocanAuthenticateWithFingerprintOrUnknown()
, but I haven't actually tested this.setUserAuthenticationValidityDurationSeconds(-1)
) inAndroidKeyStore
, which fails with the following exception if the user doesn't have strong biometrics available & enrolled (I don't know if this is reliable across OEMs and API versions):BUILD INFO
STEPS TO REPRODUCE
androidx.biometric.BiometricManager#canAuthenticate(Authenticators.BIOMETRIC_STRONG)
EXPECTED RESULTS
Receive
BIOMETRIC_SUCCESS
.OBSERVED RESULTS
Receive
BIOMETRIC_STATUS_UNKNOWN
.NUMBER OF TIMES YOU WERE ABLE TO REPRODUCE (e.g. 3/10)
10/10