Skip to content

Duplicate Multi-touch Events in Android Platform Views #176574

@evil159

Description

@evil159

Steps to reproduce

  1. Create a Flutter app with an AndroidView inside GestureDetector with long press callbacks:
  2. In the native Android view, log all MotionEvent actions with timestamps and pointer counts
  3. Perform a pinch/scale gesture

Expected results

I/flutter (28829): Flutter: Long press CANCEL
D/NativeView(28829): Action: ACTION_DOWN, Pointers: 1, Time: 580981037
D/NativeView(28829): Action: ACTION_POINTER_DOWN(1), Pointers: 2, Time: 580981037
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981198
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981235
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981251
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981268
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981285
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981301
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981315
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981335
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981351
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981368
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981385
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981401
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981418
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981432
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981468
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981485
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981501
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981518
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981535
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981551
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981557
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981585
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981601
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981618
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981632
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981678
D/NativeView(28829): Action: ACTION_POINTER_UP(0), Pointers: 2, Time: 580981786

Actual results

I/flutter (28829): Flutter: Long press CANCEL
D/NativeView(28829): Action: ACTION_DOWN, Pointers: 1, Time: 580981037
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981198
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981235
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981251
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981268
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981285
D/NativeView(28829): Action: ACTION_POINTER_DOWN(1), Pointers: 2, Time: 580981037
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981198
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981235
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981251
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981268
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981285
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981301
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981315
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981335
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981351
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981368
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981385
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981401
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981418
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981432
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981468
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981485
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981501
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981518
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981535
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981551
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981557
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981585
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981601
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981618
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981632
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981678
D/NativeView(28829): Action: ACTION_POINTER_UP(0), Pointers: 2, Time: 580981786

Code sample

Code sample
GestureDetector(
    behavior: HitTestBehavior.translucent,
    onLongPressStart: (dt) => _sendLongPressEvent("Long press START"),
    onLongPressCancel: () => _sendLongPressEvent("Long press CANCEL"),
    onLongPressMoveUpdate: (details) => _sendLongPressEvent("Long press UPDATE"),
    onLongPressEnd: (details) => _sendLongPressEvent("Long press END"),
    child: AndroidView(
      viewType: 'native-view',
      layoutDirection: TextDirection.ltr,
    ),
  )

Code sample

Sample project

motion_events.zip

Logs

Logs
I/flutter (28829): Flutter: Long press CANCEL
D/NativeView(28829): Action: ACTION_DOWN, Pointers: 1, Time: 580981037
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981198
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981235
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981251
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981268
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981285
D/NativeView(28829): Action: ACTION_POINTER_DOWN(1), Pointers: 2, Time: 580981037
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981198
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981235
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981251
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981268
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981285
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981301
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981315
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981335
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981351
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981368
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981385
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981401
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981418
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981432
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981468
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981485
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981501
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981518
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981535
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981551
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981557
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981585
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981601
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981618
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981632
D/NativeView(28829): Action: ACTION_MOVE, Pointers: 2, Time: 580981678
D/NativeView(28829): Action: ACTION_POINTER_UP(0), Pointers: 2, Time: 580981786

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.5, on macOS 26.0.1 25A362 darwin-arm64, locale en-US) [204ms]
    • Flutter version 3.35.5 on channel stable at /Users/romanlaitarenko/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ac4e799d23 (10 days ago), 2025-09-26 12:05:09 -0700
    • Engine revision d3d45dcf25
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-swift-package-manager,
      enable-lldb-debugging

[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [759ms]
    • Android SDK at /Users/romanlaitarenko/Library/Android/sdk
    • Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = /Users/romanlaitarenko/Library/Android/sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Temurin-17.0.16+8 (build 17.0.16+8)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1) [454ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17A400
    • CocoaPods version 1.16.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) [8ms]
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2024.3) [8ms]
    • 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 21.0.6+-13368085-b895.109)

[✓] Connected device (4 available) [5.9s]
    • sdk gphone16k arm64 (mobile)           • emulator-5554                        • android-arm64 • Android 15 (API 35) (emulator)
    • Roman’s iPhone (2) (wireless) (mobile) • 00008110-00110D1614F9801E            • ios           • iOS 26.0.1 23A355
    • iPhone 16 Pro (mobile)                 • CCF1D21D-4E0C-423A-870B-005E7F4F2EBD • ios           • com.apple.CoreSimulator.SimRuntime.iOS-18-6 (simulator)
    • macOS (desktop)                        • macos                                • darwin-arm64  • macOS 26.0.1 25A362 darwin-arm64

[✓] Network resources [213ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsf: gesturesflutter/packages/flutter/gestures repository.found in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions