Skip to content

[local_auth][Android] authenticate() returns true when phone is locked by pressing the power button while the authentication popup is open. #127732

@mahad-ahmed

Description

@mahad-ahmed

Is there an existing issue for this?

Steps to reproduce

  1. Open authentication popup by calling authenticate().
  2. Press power button to lock the phone.
  3. authenticate() has returned true.

Expected results

authenticate() should NOT return true when phone is locked while biometric authentication popup is open.

Actual results

authenticate() returns true as soon as the phone is locked while biometric authentication popup is open.

Code sample

Code snippet
print("\n============ CALLING authenticate() ============\n");
// Press the lock button while authentication popup is open to replicate the issue.
bool isAuthenticated = await _auth.authenticate(
  localizedReason: "Please authenticate to login",
  options: const AuthenticationOptions(biometricOnly: true),
);
// isAuthenticated is true
print("\n============ authenticate() returned with: $isAuthenticated ============\n");

Complete code repository: https://github.com/mahad-ahmed/local_auth_bug

Screenshots or Video

Video demonstration

https://github.com/mahad-ahmed/local_auth_bug/blob/master/recording/2023-05-27%2006-26-19.mkv

Logs

Logs
https://github.com/mahad-ahmed/local_auth_bug/blob/master/logs.txt

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.10.2, on Microsoft Windows [Version 10.0.22621.1702], locale en-US)
    • Flutter version 3.10.2 on channel stable at E:\Programs\sdks\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9cd3d0d9ff (3 days ago), 2023-05-23 20:57:28 -0700
    • Engine revision 90fa3ae28f
    • Dart version 3.0.2
    • DevTools version 2.23.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at E:\Programs\sdks\Android\Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: E:\Programs\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2022.2)
    • Android Studio at E:\Programs\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] IntelliJ IDEA Community Edition (version 2023.1)
    • IntelliJ at E:\Programs\JetBrains\IntelliJ IDEA Community Edition 2022.2.3
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (4 available)
    • SM N985F (mobile) • R58N851Z5BE • android-arm64  • Android 13 (API 33)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.22621.1702]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 113.0.5672.127
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 89.0.774.50

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listc: regressionIt was better in the past than it is nowp: local_authPlugin for local authentificationpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions