Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Three finger screenshotting throws assert #20517

Open
taibaiyinxing opened this issue Aug 13, 2018 · 14 comments

Comments

@taibaiyinxing
Copy link

commented Aug 13, 2018

On our released version of App, we were notified with an exception as the title show, the detail track infos are as follow:

NoSuchMethodError: The getter 'lastPosition' was called on null.

6 Receiver: null
7 Tried calling: lastPosition===>#0 PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:246)
8 #1 _SyncIterator.moveNext (dart:core/runtime/libcore_patch.dart:151)
9 #2 ListQueue.addAll (dart:collection/queue.dart:715)
10 #3 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:46)
11 #4 _rootRunUnary (dart:async/zone.dart:1136)
12 #5 _CustomZone.runUnary (dart:async/zone.dart:1029)
13 #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931)
14 #7 _invoke1 (dart:ui/hooks.dart:144)
15 #8 _dispatchPointerDataPacket (dart:ui/hooks.dart:99)

That's the full exception stack, from where I cannot get any info where my code got wrong because it's all about the framework layer, and I'm not very familiar with this layer.I did not found anything invoke the function _dispatchPointerDataPacket in hooks.dart from my code.
This exception appeared only once by now.
Can we avoid this by checking if it's null before invoking lastPosition in converter.dart ?

@zoechi

This comment has been minimized.

Copy link
Contributor

commented Aug 22, 2018

Please add the output of flutter doctor -v.

@zoechi zoechi added this to the Goals milestone Aug 22, 2018

@philipgiuliani

This comment has been minimized.

Copy link

commented Oct 12, 2018

I can reproduce this in a release build, when tapping anywhere with 3 fingers. It does not crash when tapping with 1 or 2 fingers.

[✓] Flutter (Channel dev, v0.10.0, on Mac OS X 10.14 18A391, locale de-DE)
    • Flutter version 0.10.0 at /Users/MyUserName/flutter
    • Framework revision d954ae6850 (2 days ago), 2018-10-09 16:21:06 -0400
    • Engine revision bf377896ff
    • Dart version 2.1.0-dev.6.0.flutter-a50dfd6698

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/MyUserName/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.28.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.19.0

[✓] Connected device (3 available)
   --- Removed

• No issues found!

Update: Seems that its crashing on a OnePlus 5, but not on a Xiaomi A2.

@philipgiuliani

This comment has been minimized.

Copy link

commented Oct 12, 2018

I even have more information. My phone has 3 finger screenshot gesture enabled. In debug mode the app does not crash, just in release mode.
I see the following message in debug mode though: D/ViewRootImpl( 4960): Gesture Screenshot triggered, ignore event.

@HerrNiklasRaab

This comment has been minimized.

Copy link

commented Dec 19, 2018

Same problem here, but I cannot reproduce the error as you described.

@goderbauer

This comment has been minimized.

Copy link
Member

commented Feb 4, 2019

Do you have a reliable way to reproduce this error? If so, can you post a minimal runnable code example that shows the error? That would help us tremendously in fixing this.

@Hixie Hixie changed the title Getting an NoSuchMethodError with package:flutter/src/gestures/converter.dart:246 Getting a NoSuchMethodError with package:flutter/src/gestures/converter.dart:246 Feb 6, 2019

@Hixie

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2019

My guess would be that some Android device is sending us bogus data (or at least data that we haven't thought to expect). Without knowing more about the device, steps to reproduce, or in general any more information, it's hard for us to do anything.

If you see this, please try to provide such information, as well as an up to date stack trace and the output of flutter doctor -v. Thanks.

@Hixie

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

@goderbauer reports that Android claims to make no promises regarding their events, so we must make the engine robust to arbitrary sequences of input events, and try to convey coherent events to the framework.

@Hixie Hixie added the engine label Feb 13, 2019

@kongshanshan33

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

I can reproduce this in a xiaomi 6X, when use the three-finger screenshot feature.

@xster

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

Adding some additional paraphrasing from customers via WeChat:

The Xiaomi OS (?) has a 3 finger screenshot function. When using it on Flutter, it turns into one ACTION_DOWN and one ACTION_POINTER_DOWN in FlutterView.

On the dart side, that's 2 down. Then there's an ACTION_CANCEL but its getPointerCount is 3. When that reaches dart, it becomes 3 cancels which doesn't match the 2 from before.

So far, it's only reproducible on a Xiaomi 6X.

@xster

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

Hopefully we can buy one but I also strongly suspect that the bundled OS for Xiaomi phones domestically and on international versions are different. Maybe a OnePlus 5 as mentioned in #20517 (comment) is a safer bet.

@goderbauer

This comment has been minimized.

Copy link
Member

commented Feb 27, 2019

Here's the sequence of pointer events that Flutter is seeing when the user performs the three-finger screenshot gesture:

Pointer 1 down
Pointer 2 down
Cancel Pointer 1, 2, and 3

The problem is that we get a cancel event for the third finger even though we never were told to track it. The fix is going to be to filter those "illegal" events out.

@The-Redhat

This comment has been minimized.

Copy link

commented Mar 4, 2019

I can also reproduce this error on a oneplus 3 using the three-finger screenshot feature.

@goderbauer goderbauer assigned shihaohong and chunhtai and unassigned goderbauer Mar 13, 2019

@goderbauer goderbauer changed the title Getting a NoSuchMethodError with package:flutter/src/gestures/converter.dart:246 Three finger screenshotting throws assert Mar 13, 2019

@Hixie

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2019

(work is ongoing to fix this. we considered a quick hack, but decided a better fix would be to rearchitect the relevant code a bit, so it's taking a bit longer than it otherwise would.)

@cbracken

This comment has been minimized.

Copy link
Member

commented May 6, 2019

@shihaohong @chunhtai any updates here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.