fix(android): USE_BIOMETRIC, and never lock the cache behind a door we cannot open

Opening the vault threw java.lang.SecurityException: USE_BIOMETRIC is not in
Delphi default permission list, and CanAuthenticate raises instead of
answering false. So the fault showed up neither at compile time nor at
startup, but on the first unlock - after the cache had already been written
under an auth-protected key.

The permission is the shallow half. The deep half is that SaveVault was
called with a hard-coded True: we asked for a key guarded by a prompt that
could not be shown, producing a file that was unreadable forever. It now
receives BiometricAvailable, evaluated on the main thread before the worker
starts.

BiometricAvailable and AuthenticateThen also swallow what comes up from the
Java layer and map it to boUnavailable. The caller has a path for every
TBioOutcome and none for an exception.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-08-15 12:09:29 +01:00
parent 6d31bf83d2
commit 4258e9b559
4 changed files with 77 additions and 21 deletions
+7
View File
@@ -8,6 +8,13 @@
android:installLocation="%installLocation%">
<uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />
<%uses-permission%>
<!-- Absente de la liste par defaut de Delphi, et sans elle BiometricPrompt
leve java.lang.SecurityException a la premiere invite - pas au
demarrage, donc le defaut ne se voit qu'en essayant d'ouvrir le coffre.
USE_FINGERPRINT couvre les versions anterieures a Android 9, ou
BiometricPrompt n'existe pas encore. -->
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<queries>
<%queries-child-elements%>