fix(android): report the biometric failure instead of destroying the cache
The launch-time auto-open received boUnavailable and wiped the cache, seconds after the write path had proved the device could authenticate. The diagnosis was wrong and the reaction irreversible. An automatic action now never clears the vault: it logs the cause and leaves the user on the unlock screen. Only an explicit tap on Open, followed by a clean refusal from the system, may clear it. PMA.Biometric keeps the reason in LastBiometricError, and a Java-layer exception now maps to boFailed rather than boUnavailable - an exception says nothing about the device. The log memo also wraps: it was cutting off exactly the end of the message, which is where the cause is named. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+32
-4
@@ -132,6 +132,9 @@ type
|
||||
procedure OnTotpTick(Sender: TObject);
|
||||
|
||||
procedure DoOpenLocal(Sender: TObject);
|
||||
/// AAuto : declenche par l'ouverture automatique au lancement, pas par
|
||||
/// l'utilisateur. Une action automatique ne detruit jamais le cache.
|
||||
procedure OpenVault(AAuto: Boolean);
|
||||
// Separee de DoOpenLocal : une methode anonyme ne peut pas appeler une
|
||||
// procedure imbriquee (E2555), et le rappel de la biometrie en est une.
|
||||
procedure OpenLocalNow;
|
||||
@@ -226,7 +229,7 @@ begin
|
||||
// l'invite biometrique s'afficherait sinon avant la premiere peinture de la
|
||||
// fenetre, sur un fond vide.
|
||||
if HasVault then
|
||||
TThread.ForceQueue(nil, procedure begin DoOpenLocal(nil); end);
|
||||
TThread.ForceQueue(nil, procedure begin OpenVault(True); end);
|
||||
end;
|
||||
|
||||
destructor TForm8.Destroy;
|
||||
@@ -277,6 +280,9 @@ begin
|
||||
FLog.Height := 150;
|
||||
FLog.Margins.Rect := RectF(8, 8, 8, 8);
|
||||
FLog.ReadOnly := True;
|
||||
// Sans repli, un message d'exception est coupe net au bord du memo - et
|
||||
// c'est toujours la fin qui nomme la cause.
|
||||
FLog.WordWrap := True;
|
||||
FLog.TextSettings.Font.Family := 'monospace';
|
||||
FLog.TextSettings.Font.Size := 11;
|
||||
|
||||
@@ -727,6 +733,11 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm8.DoOpenLocal(Sender: TObject);
|
||||
begin
|
||||
OpenVault(False); // geste explicite de l'utilisateur
|
||||
end;
|
||||
|
||||
procedure TForm8.OpenVault(AAuto: Boolean);
|
||||
begin
|
||||
if FBusy then Exit;
|
||||
// L'authentification affiche un dialogue systeme : elle doit rester sur le
|
||||
@@ -737,7 +748,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
Status('Authentification...');
|
||||
if not AAuto then Status('Authentification...');
|
||||
AuthenticateThen('Acceder au coffre',
|
||||
procedure(AOutcome: TBioOutcome)
|
||||
begin
|
||||
@@ -745,14 +756,31 @@ begin
|
||||
boOK: OpenLocalNow;
|
||||
boCancelled: Status('Annule');
|
||||
boUnavailable:
|
||||
// Reponse nette du systeme : plus rien pour authentifier sur cet
|
||||
// appareil, donc la cle est perdue et le cache avec elle.
|
||||
//
|
||||
// UNE ACTION AUTOMATIQUE N'EFFACE JAMAIS LE CACHE. Au lancement on
|
||||
// se contente de le dire : si le diagnostic est faux - service pas
|
||||
// encore pret, etat transitoire - effacer imposerait un
|
||||
// retelechargement et quatre secondes de derivation pour rien, et
|
||||
// masquerait la vraie cause. L'utilisateur tranche en reessayant.
|
||||
if AAuto then
|
||||
begin
|
||||
Log('Authentification indisponible au lancement - cache conserve');
|
||||
Log(' ' + LastBiometricError);
|
||||
Status('Authentification indisponible - reessayer');
|
||||
end
|
||||
else
|
||||
begin
|
||||
// La protection a ete retiree de l'appareil depuis l'ecriture du
|
||||
// cache : celui-ci est devenu illisible pour toujours.
|
||||
Log('Plus aucune protection sur l''appareil - cache efface');
|
||||
Log(' ' + LastBiometricError);
|
||||
ClearVault;
|
||||
ShowUnlock;
|
||||
end;
|
||||
else
|
||||
// boFailed : la couche Java a leve quelque chose. Cela ne dit rien de
|
||||
// l'appareil, donc on ne touche a rien - on rapporte.
|
||||
Log('Echec de l''authentification : ' + LastBiometricError);
|
||||
Status('Echec de l''authentification');
|
||||
end;
|
||||
end);
|
||||
|
||||
Reference in New Issue
Block a user