flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.66k stars 27.13k forks source link

[local_auth] [android] NPE on BiometricPrompt$ButtonInfo.executor when canceling auth on Samsung SM F711B #104489

Open alhappler opened 2 years ago

alhappler commented 2 years ago

the method authenticate of local_auth crashes on Samsung SM F711B.

Steps to Reproduce

(using example App of 2.10 )

Expected Result

should not crash

Logs

Logs ``` I/BufferQueueProducer(28871): [SurfaceView - io.flutter.plugins.localauthexample/io.flutter.embedding.android.FlutterFragmentActivity@f50c179@0#1(BLAST Consumer)1](id:70c700000001,api:1,p:28871,c:28871) queueBuffer: queued for the first time. I/SurfaceView@f50c179(28871): uSP: rtp = Rect(0, 0 - 1080, 2496) rtsw = 1080 rtsh = 2496 I/SurfaceView@f50c179(28871): onSSPAndSRT: pl = 0 pt = 0 sx = 1.0 sy = 1.0 I/SurfaceView@f50c179(28871): aOrMT: uB = true t = android.view.SurfaceControl$Transaction@c012bda fN = 1 android.view.SurfaceView.access$500:124 android.view.SurfaceView$SurfaceViewPositionUpdateListener.positionChanged:1728 android.graphics.RenderNode$CompositePositionUpdateListener.positionChanged:319 I/SurfaceView@f50c179(28871): aOrMT: vR.mWNT, vR = ViewRootImpl@27c5ca5[FlutterFragmentActivity] I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): mWNT: t = android.view.SurfaceControl$Transaction@c012bda fN = 1 android.view.SurfaceView.applyOrMergeTransaction:1628 android.view.SurfaceView.access$500:124 android.view.SurfaceView$SurfaceViewPositionUpdateListener.positionChanged:1728 I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): mWNT: merge t to BBQ I/BufferQueueProducer(28871): [ViewRootImpl@27c5ca5[FlutterFragmentActivity]#0(BLAST Consumer)0](id:70c700000000,api:1,p:28871,c:28871) queueBuffer: queued for the first time. D/OpenGLRenderer(28871): GPIS:: SetUp Pid : 28871 Tid : 28899 I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:4969 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938 I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): [DP] rdf() D/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): reportDrawFinished (fn: -1) I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(28871): startInputInner - Id : 0 I/InputMethodManager(28871): startInputInner - mService.startInputOrWindowGainedFocus D/InputMethodManager(28871): startInputInner - Id : 0 I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): ViewPostIme pointer 0 I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): ViewPostIme pointer 1 I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputTransport(28871): Input channel destroyed: 'ClientS', fd=117 I/BiometricPrompt(28871): onDialogDismissed: 2 W/Binder (28871): Caught a RuntimeException from the binder stub implementation. W/Binder (28871): java.lang.NullPointerException: Attempt to read from field 'java.util.concurrent.Executor android.hardware.biometrics.BiometricPrompt$ButtonInfo.executor' on a null object reference W/Binder (28871): at android.hardware.biometrics.BiometricPrompt$1.onDialogDismissed(BiometricPrompt.java:705) W/Binder (28871): at android.hardware.biometrics.IBiometricServiceReceiver$Stub.onTransact(IBiometricServiceReceiver.java:174) W/Binder (28871): at android.os.Binder.execTransactInternal(Binder.java:1220) W/Binder (28871): at android.os.Binder.execTransact(Binder.java:1179) I/ViewRootImpl@27c5ca5[FlutterFragmentActivity](28871): MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(28871): startInputInner - Id : 0 I/InputMethodManager(28871): startInputInner - mService.startInputOrWindowGainedFocus ```
huycozy commented 2 years ago

Hi @alhappler, can you provide flutter doctor -v? I tried to reproduce the issue on another device, the steps are different than yours.

1. Click on Authenticate button
2. Successfully detect face
3. Authorized and there is no authentication popup there and I can not click `cancel` as your step

So it'll be great if you could provide us a recorded video for this issue by a specific device.

Thanks.

alhappler commented 2 years ago

@huycozy of course

The device blocks any form of screenrecord or screenshot so here is a crappy video:

https://user-images.githubusercontent.com/88662127/170017672-ebb4b790-8628-4db7-a16e-4818b8894657.mp4

flutter doctor

flutter doctor ``` [✓] Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-x64, locale en-GB) • Flutter version 2.10.5 at /Users/[XXX]/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5464c5bac7 (5 weeks ago), 2022-04-18 09:55:37 -0700 • Engine revision 57d3bac3dd • Dart version 2.16.2 • DevTools version 2.9.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/[XXX]/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/[XXX]/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.4) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 11.0.12+0-b1504.28-7817840) [✓] VS Code (version 1.67.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • iPad Air (4th generation) (mobile) • 9D56B597-8082-44BF-82FA-A4BDAD927F4E • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator) • iPhone 12 (mobile) • D3292DBE-DD1E-4907-924B-01FD0536AD10 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
huycozy commented 2 years ago

Hi, thanks for the quick response. As far as I can see, you are using the old flutter version, the latest version now is 3.0.1 stable. Can you please upgrade SDK and then try again?

alhappler commented 2 years ago

Hey, @huycozy I upgraded to 3.0.1, same result

flutter doctor

flutter doctor [✓] Flutter (Channel stable, 3.0.1, on macOS 12.3.1 21E258 darwin-x64, locale en-GB) • Flutter version 3.0.1 at /Users/[XXX]/fvm/versions/3.0.1 • Upstream repository https://github.com/flutter/flutter.git • Framework revision fb57da5f94 (5 days ago), 2022-05-19 15:50:29 -0700 • Engine revision caaafc5604 • Dart version 2.17.1 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/[XXX]/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/[XXX]/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.4) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 11.0.12+0-b1504.28-7817840) [✓] VS Code (version 1.67.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (5 available) • SM F711B (mobile) • R5CRA1159SW • android-arm64 • Android 12 (API 31) • iPad Air (4th generation) (mobile) • 9D56B597-8082-44BF-82FA-A4BDAD927F4E • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator) • iPhone 12 (mobile) • D3292DBE-DD1E-4907-924B-01FD0536AD10 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 12.3.1 21E258 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found!
huycozy commented 2 years ago

Hi, I’m unable to reproduce the issue due to no similar device. I will keep this issue open for further investigation.

sureace commented 2 years ago

Hi, I am also facing similar issue in samsung devices. Please check the logs below I/BiometricPrompt(21832): onDialogDismissed: 2 W/Binder (21832): Caught a RuntimeException from the binder stub implementation. W/Binder (21832): java.lang.NullPointerException: Attempt to read from field 'java.util.concurrent.Executor android.hardware.biometrics.BiometricPrompt$ButtonInfo.executor' on a null object reference W/Binder (21832): at android.hardware.biometrics.BiometricPrompt$1.onDialogDismissed(BiometricPrompt.java:705) W/Binder (21832): at android.hardware.biometrics.IBiometricServiceReceiver$Stub.onTransact(IBiometricServiceReceiver.java:174)

Thanks

sureace commented 2 years ago

Hi, I am also facing similar issue in samsung devices. Please check the logs below I/BiometricPrompt(21832): onDialogDismissed: 2 W/Binder (21832): Caught a RuntimeException from the binder stub implementation. W/Binder (21832): java.lang.NullPointerException: Attempt to read from field 'java.util.concurrent.Executor android.hardware.biometrics.BiometricPrompt$ButtonInfo.executor' on a null object reference W/Binder (21832): at android.hardware.biometrics.BiometricPrompt$1.onDialogDismissed(BiometricPrompt.java:705) W/Binder (21832): at android.hardware.biometrics.IBiometricServiceReceiver$Stub.onTransact(IBiometricServiceReceiver.java:174)

Thanks

If we set biometricOnly as true that means disable pin, passcode or pattern, it is not crashing.

EB-Plum commented 2 years ago

https://issuetracker.google.com/issues/211696108?pli=1

seems related issue.

godilite commented 1 year ago

temporary workaround. set options sensitiveTransaction to false this will hide the confirm or cancel dialog and no need to give the user cancel options

 final result = await _localAuthentication.authenticate(
      localizedReason: reason,
      options: const AuthenticationOptions(
        sensitiveTransaction: false,
      ),
    );