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

OK/Select on IR Remotes causing Exception #65233

Open
clarkap opened this issue Sep 4, 2020 · 23 comments
Open

OK/Select on IR Remotes causing Exception #65233

clarkap opened this issue Sep 4, 2020 · 23 comments
Labels
a: text input Entering text in a text field or keyboard related problems. framework flutter/packages/flutter repository. See also f: labels. P4 Priority 4 issue (default for bugs, things we're likely to work on) passed first triage tests are present, the PR follows the PR template, no obvious coding errors platform-android Android applications specifically. severe: crash Stack traces logged to the console.

Comments

@clarkap
Copy link

clarkap commented Sep 4, 2020

I am receiving this exception when pressing the OK/DPAD_CENTER button.
This is happening on two separate systems, on running Android 4.4 and the other Android 9.0.

Attempted to send a key down event when no keys are in keysPressed. This state can occur if the key event being sent doesn't properly set its modifier flags. This was the event: RawKeyDownEvent#065c6(logicalKey: LogicalKeyboardKey#70077(keyId: "0x100070077", keyLabel: "", debugName: "Select"), physicalKey: PhysicalKeyboardKey#700e4(usbHidUsage: "0x000700e4", debugName: "Control Right")) and its data: RawKeyEventDataAndroid(keyLabel:  flags: 8, codePoint: 0, keyCode: 23, scanCode: 97, metaState: 0, modifiers down: {})
'package:flutter/src/services/raw_keyboard.dart':
Failed assertion: line 601 pos 12: '<optimized out>'

This happens on stable through to master

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.22.0-10.0.pre.82, on Linux, locale en_AU.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] Connected device (3 available)

• No issues found!

Very simple test app

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({
    Key key,
  }) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.green,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          mainAxisSize: MainAxisSize.max,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [

            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
            MaterialButton(
              child: Text('click me'),
              onPressed: () => print('Pressed'),
            ),
          ],
        ));
  }
}
@pedromassangocode
Copy link

Hi @clarkap
Can you please provide your flutter doctor -v, your flutter run --verbose?
Thank you

@pedromassangocode pedromassangocode added in triage Presently being triaged by the triage team. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds. labels Sep 4, 2020
@clarkap
Copy link
Author

clarkap commented Sep 7, 2020

flutter doctor -v
[✓] Flutter (Channel master, 1.22.0-10.0.pre.82, on Linux, locale en_AU.UTF-8)
    • Flutter version 1.22.0-10.0.pre.82 at /home/andyc/Applications/flutter/flutter
    • Framework revision 9248fda410 (3 days ago), 2020-09-03 16:08:01 -0700
    • Engine revision 3f05b521b9
    • Dart version 2.10.0 (build 2.10.0-86.0.dev)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /home/andyc/Android/Sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /snap/android-studio/91/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /snap/android-studio/91/android-studio
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (3 available)
    • XS (mobile)      • 10.251.113.118:5555 • android-arm    • Android 4.4.2 (API 19)
    • Web Server (web) • web-server          • web-javascript • Flutter Tools
    • Chrome (web)     • chrome              • web-javascript • Google Chrome 84.0.4147.135

• No issues found!

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds. label Sep 7, 2020
@clarkap
Copy link
Author

clarkap commented Sep 7, 2020

Logs
[  +72 ms] executing: [/home/andyc/Applications/flutter/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +20 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 9248fda41005ce0af2e522fabd0e9fedf2b3c863
[        ] executing: [/home/andyc/Applications/flutter/flutter/] git tag --points-at HEAD
[   +7 ms] Exit code 0 from: git tag --points-at HEAD
[        ] executing: [/home/andyc/Applications/flutter/flutter/] git describe --match *.*.* --first-parent --long --tags
[  +16 ms] Exit code 0 from: git describe --match *.*.* --first-parent --long --tags
[        ] 1.22.0-9.0.pre-82-g9248fda410
[   +5 ms] executing: [/home/andyc/Applications/flutter/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/master
[        ] executing: [/home/andyc/Applications/flutter/flutter/] git ls-remote --get-url origin
[   +2 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +23 ms] executing: [/home/andyc/Applications/flutter/flutter/] git rev-parse --abbrev-ref HEAD
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] master
[  +25 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[   +8 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb devices -l
[  +22 ms] List of devices attached
           10.251.113.118:5555    device product:stvm8b model:XS device:stvm8b transport_id:3
[   +9 ms] /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 shell getprop
[ +155 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[  +10 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[  +10 ms] Downloading Web SDK...
[+3918 ms] Downloading Web SDK... (completed in 3.9s)
[        ] executing: unzip -o -q /home/andyc/Applications/flutter/flutter/bin/cache/downloads/storage.googleapis.com/flutter_infra/flutter/3f05b521b939b4a9c33481b6f58a840babefa775/flutter-web-sdk-linux-x64.zip -d
/home/andyc/Applications/flutter/flutter/bin/cache/flutter_web_sdk
[ +473 ms] Exit code 0 from: unzip -o -q /home/andyc/Applications/flutter/flutter/bin/cache/downloads/storage.googleapis.com/flutter_infra/flutter/3f05b521b939b4a9c33481b6f58a840babefa775/flutter-web-sdk-linux-x64.zip -d
/home/andyc/Applications/flutter/flutter/bin/cache/flutter_web_sdk
[ +171 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +115 ms] Generating /home/andyc/Workspaces/tv_launcher/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +11 ms] ro.hardware = amlogic
[        ] ro.build.characteristics = tablet
[  +22 ms] Starting incremental build...
[   +1 ms] Initializing file store
[   +7 ms] Skipping target: gen_localizations
[   +5 ms] complete
[   +2 ms] Launching lib/main.dart on XS in debug mode...
[   +3 ms] /home/andyc/Applications/flutter/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/andyc/Applications/flutter/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/andyc/Applications/flutter/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata -Ddart.developer.causal_async_stacks=true
--output-dill /tmp/flutter_tools.FUMYPZ/flutter_tool.NYTSIM/app.dill --packages .packages -Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root
--initialize-from-dill build/cache.dill.track.dill
[   +6 ms] executing: /home/andyc/Android/Sdk/build-tools/29.0.3/aapt dump xmltree /home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[   +6 ms] Exit code 0 from: /home/andyc/Android/Sdk/build-tools/29.0.3/aapt dump xmltree /home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.swiftmedia.tvlauncher" (Raw: "com.swiftmedia.tvlauncher")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=22)
                 A: android:label(0x01010001)="tvlauncher" (Raw: "tvlauncher")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=28)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.swiftmedia.tvlauncher.MainActivity" (Raw: "com.swiftmedia.tvlauncher.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: meta-data (line=42)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: meta-data (line=52)
                     A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
                     A: android:resource(0x01010025)=@0x7f040000
                   E: intent-filter (line=56)
                     E: action (line=57)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=59)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=66)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +9 ms] <- compile package:tvlauncher/main.dart
[  +10 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb version
[   +5 ms] Android Debug Bridge version 1.0.41
           Version 30.0.3-6597393
           Installed as /home/andyc/Android/Sdk/platform-tools/adb
[   +1 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb start-server
[   +5 ms] Building APK
[  +11 ms] Running Gradle task 'assembleDebug'...
[        ] gradle.properties already sets `android.enableR8`
[   +1 ms] Using gradle from /home/andyc/Workspaces/tv_launcher/android/gradlew.
[        ] /home/andyc/Workspaces/tv_launcher/android/gradlew mode: 33277 rwxrwxr-x.
[   +3 ms] executing: /snap/android-studio/91/android-studio/jre/bin/java -version
[  +40 ms] Exit code 0 from: /snap/android-studio/91/android-studio/jre/bin/java -version
[        ] openjdk version "1.8.0_242-release"
           OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
           OpenJDK 64-Bit Server VM (build 25.242-b3-6222593, mixed mode)
[   +2 ms] executing: [/home/andyc/Workspaces/tv_launcher/android/] /home/andyc/Workspaces/tv_launcher/android/gradlew -Pverbose=true -Ptarget-platform=android-arm -Ptarget=/home/andyc/Workspaces/tv_launcher/lib/main.dart
-Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root assembleDebug
[ +347 ms] Starting a Gradle Daemon (subsequent builds will be faster)
[+5990 ms] > Task :app:compileFlutterBuildDebug
[        ] [  +76 ms] executing: [/home/andyc/Applications/flutter/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [  +19 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] 9248fda41005ce0af2e522fabd0e9fedf2b3c863
[        ] [        ] executing: [/home/andyc/Applications/flutter/flutter/] git tag --points-at HEAD
[        ] [   +8 ms] Exit code 0 from: git tag --points-at HEAD
[        ] [   +1 ms] executing: [/home/andyc/Applications/flutter/flutter/] git describe --match *.*.* --first-parent --long --tags
[        ] [  +17 ms] Exit code 0 from: git describe --match *.*.* --first-parent --long --tags
[        ] [        ] 1.22.0-9.0.pre-82-g9248fda410
[        ] [   +7 ms] executing: [/home/andyc/Applications/flutter/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/master
[        ] [        ] executing: [/home/andyc/Applications/flutter/flutter/] git ls-remote --get-url origin
[        ] [   +2 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +28 ms] executing: [/home/andyc/Applications/flutter/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] master
[        ] [  +32 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [   +5 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [  +47 ms] Initializing file store
[        ] [   +6 ms] Done initializing file store
[        ] [  +19 ms] Skipping target: gen_localizations
[        ] [ +461 ms] kernel_snapshot: Starting due to {InvalidatedReason.inputChanged}
[        ] [  +15 ms] /home/andyc/Applications/flutter/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/andyc/Applications/flutter/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/andyc/Applications/flutter/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --target=flutter -Ddart.developer.causal_async_stacks=true -Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation --no-link-platform --packages
/home/andyc/Workspaces/tv_launcher/.packages --output-dill /home/andyc/Workspaces/tv_launcher/.dart_tool/flutter_build/426b7d87e351d73ba923fdfd544302b0/app.dill --depfile
/home/andyc/Workspaces/tv_launcher/.dart_tool/flutter_build/426b7d87e351d73ba923fdfd544302b0/kernel_snapshot.d package:tvlauncher/main.dart
[+3594 ms] [+4666 ms] kernel_snapshot: Complete
[ +600 ms] [ +537 ms] debug_android_application: Starting due to {InvalidatedReason.inputChanged}
[  +99 ms] [  +97 ms] debug_android_application: Complete
[ +300 ms] [ +278 ms] Persisting file store
[        ] [   +3 ms] Done persisting file store
[        ] [   +3 ms] build succeeded.
[        ] [   +6 ms] "flutter assemble" took 6,161ms.
[        ] [   +2 ms] ensureAnalyticsSent: 0ms
[        ] [        ] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[  +99 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[        ] > Task :app:preBuild UP-TO-DATE
[        ] > Task :app:preDebugBuild UP-TO-DATE
[        ] > Task :app:checkDebugManifest UP-TO-DATE
[        ] > Task :app:generateDebugBuildConfig UP-TO-DATE
[        ] > Task :app:compileDebugAidl NO-SOURCE
[        ] > Task :app:compileDebugRenderscript NO-SOURCE
[        ] > Task :app:cleanMergeDebugAssets
[        ] > Task :app:mergeDebugShaders UP-TO-DATE
[        ] > Task :app:compileDebugShaders UP-TO-DATE
[        ] > Task :app:generateDebugAssets UP-TO-DATE
[        ] > Task :app:mergeDebugAssets
[ +198 ms] > Task :app:copyFlutterAssetsDebug
[        ] > Task :app:mainApkListPersistenceDebug UP-TO-DATE
[        ] > Task :app:generateDebugResValues UP-TO-DATE
[        ] > Task :app:generateDebugResources UP-TO-DATE
[        ] > Task :app:mergeDebugResources UP-TO-DATE
[        ] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[        ] > Task :app:processDebugManifest UP-TO-DATE
[        ] > Task :app:processDebugResources UP-TO-DATE
[ +199 ms] > Task :app:compileDebugKotlin UP-TO-DATE
[        ] > Task :app:javaPreCompileDebug UP-TO-DATE
[        ] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[        ] > Task :app:compileDebugSources UP-TO-DATE
[        ] > Task :app:processDebugJavaRes NO-SOURCE
[        ] > Task :app:mergeDebugJavaResource UP-TO-DATE
[        ] > Task :app:checkDebugDuplicateClasses UP-TO-DATE
[        ] > Task :app:desugarDebugFileDependencies UP-TO-DATE
[  +99 ms] > Task :app:mergeExtDexDebug UP-TO-DATE
[        ] > Task :app:transformClassesWithDexBuilderForDebug UP-TO-DATE
[        ] > Task :app:mergeDexDebug UP-TO-DATE
[        ] > Task :app:validateSigningDebug UP-TO-DATE
[        ] > Task :app:signingConfigWriterDebug UP-TO-DATE
[        ] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[        ] > Task :app:mergeDebugNativeLibs UP-TO-DATE
[        ] > Task :app:stripDebugDebugSymbols UP-TO-DATE
[        ] Compatible side by side NDK version was not found.
[+1099 ms] > Task :app:packageDebug
[  +76 ms] > Task :app:assembleDebug
[        ] BUILD SUCCESSFUL in 12s
[        ] 31 actionable tasks: 6 executed, 25 up-to-date
[ +324 ms] Running Gradle task 'assembleDebug'... (completed in 13.1s)
[  +29 ms] calculateSha: LocalDirectory: '/home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk'/app.apk
[  +41 ms] calculateSha: reading file took 40us
[ +461 ms] calculateSha: computing sha took 461us
[   +2 ms] ✓ Built build/app/outputs/flutter-apk/app-debug.apk.
[   +1 ms] executing: /home/andyc/Android/Sdk/build-tools/29.0.3/aapt dump xmltree /home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[   +5 ms] Exit code 0 from: /home/andyc/Android/Sdk/build-tools/29.0.3/aapt dump xmltree /home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.swiftmedia.tvlauncher" (Raw: "com.swiftmedia.tvlauncher")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=22)
                 A: android:label(0x01010001)="tvlauncher" (Raw: "tvlauncher")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=28)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.swiftmedia.tvlauncher.MainActivity" (Raw: "com.swiftmedia.tvlauncher.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: meta-data (line=42)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: meta-data (line=52)
                     A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
                     A: android:resource(0x01010025)=@0x7f040000
                   E: intent-filter (line=56)
                     E: action (line=57)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=59)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=66)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[        ] Stopping app 'app.apk' on XS.
[        ] executing: /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 shell am force-stop com.swiftmedia.tvlauncher
[ +991 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 shell pm list packages com.swiftmedia.tvlauncher
[ +962 ms] package:/data/app/com.swiftmedia.tvlauncher-1.apk=com.swiftmedia.tvlauncher
[   +2 ms] Installing APK.
[   +2 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb version
[   +4 ms] Android Debug Bridge version 1.0.41
           Version 30.0.3-6597393
           Installed as /home/andyc/Android/Sdk/platform-tools/adb
[        ] executing: /home/andyc/Android/Sdk/platform-tools/adb start-server
[   +3 ms] Installing build/app/outputs/flutter-apk/app.apk...
[        ] executing: /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 install -t -r /home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk/app.apk
[+34548 ms] Performing Push Install
                     /home/andyc/Workspaces/tv_launcher/build/app/outputs/flutter-apk/app.apk: 1 file pushed, 0 skipped. 3.0 MB/s (49756697 bytes in 16.017s)
                        pkg: /data/local/tmp/app.apk
                     Success
[        ] Installing build/app/outputs/flutter-apk/app.apk... (completed in 34.5s)
[   +4 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 shell echo -n 2ecc6a9d957b1899079aa9d59bc8fff109a8f850 > /data/local/tmp/sky.com.swiftmedia.tvlauncher.sha1
[  +17 ms] XS startApp
[   +1 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez
enable-checked-mode true --ez verify-entry-points true com.swiftmedia.tvlauncher/com.swiftmedia.tvlauncher.MainActivity
[+1250 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.swiftmedia.tvlauncher/.MainActivity (has extras) }
[        ] Waiting for observatory port to be available...
[+3591 ms] Observatory URL on device: http://127.0.0.1:55562/EaaVtqrjAPQ=/
[   +1 ms] executing: /home/andyc/Android/Sdk/platform-tools/adb -s 10.251.113.118:5555 forward tcp:0 tcp:55562
[   +8 ms] 38077
[        ] Forwarded host port 38077 to device port 55562 for Observatory
[   +7 ms] Caching compiled dill
[  +49 ms] Connecting to service protocol: http://127.0.0.1:38077/EaaVtqrjAPQ=/
[        ] DDS is currently disabled due to https://github.com/flutter/flutter/issues/62507
[+1034 ms] Successfully connected to service protocol: http://127.0.0.1:38077/EaaVtqrjAPQ=/
[        ] Waiting for XS to report its views...
[  +10 ms] Waiting for XS to report its views... (completed in 9ms)
[  +59 ms] DevFS: Creating new filesystem on the device (null)
[ +501 ms] DevFS: Created new filesystem on the device (file:///data/data/com.swiftmedia.tvlauncher/cache/tv_launcherTRUUPH/tv_launcher/)
[   +5 ms] Updating assets
[  +44 ms] Syncing files to device XS...
[   +1 ms] Scanning asset files
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[        ] <- recompile package:tvlauncher/main.dart 01aac069-3748-44bc-9719-bb9cc58f4bab
[        ] <- 01aac069-3748-44bc-9719-bb9cc58f4bab
[  +58 ms] Updating files
[ +525 ms] DevFS: Sync finished
[        ] Syncing files to device XS... (completed in 588ms)
[        ] Synced 1.7MB.
[        ] <- accept
[   +8 ms] Connected to _flutterView/0x68ffb518.
[   +1 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] An Observatory debugger and profiler on XS is available at: http://127.0.0.1:38077/EaaVtqrjAPQ=/
[+9118 ms] I/flutter ( 4498): ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
[        ] I/flutter ( 4498): The following assertion was thrown during a platform message callback:
[        ] I/flutter ( 4498): Attempted to send a key down event when no keys are in keysPressed. This state can occur if the key
[        ] I/flutter ( 4498): event being sent doesn't properly set its modifier flags. This was the event:
[        ] I/flutter ( 4498): RawKeyDownEvent#8eca7(logicalKey: LogicalKeyboardKey#70077(keyId: "0x100070077", keyLabel: "",
[        ] I/flutter ( 4498): debugName: "Select"), physicalKey: PhysicalKeyboardKey#700e4(usbHidUsage: "0x000700e4", debugName:
[        ] I/flutter ( 4498): "Control Right")) and its data: RawKeyEventDataAndroid(keyLabel:  flags: 8, codePoint: 0, keyCode:
[        ] I/flutter ( 4498): 23, scanCode: 97, metaState: 0, modifiers down: {})
[        ] I/flutter ( 4498): 'package:flutter/src/services/raw_keyboard.dart':
[        ] I/flutter ( 4498): Failed assertion: line 601 pos 12: '<optimized out>'
[        ] I/flutter ( 4498): Either the assertion indicates an error in the framework itself, or we should provide substantially
[        ] I/flutter ( 4498): more information in this error message to help you determine and fix the underlying cause.
[        ] I/flutter ( 4498): In either case, please report this assertion by filing a bug on GitHub:
[        ] I/flutter ( 4498):   https://github.com/flutter/flutter/issues/new?template=BUG.md
[        ] I/flutter ( 4498): When the exception was thrown, this was the stack:
[        ] I/flutter ( 4498): #2      RawKeyboard._handleKeyEvent (package:flutter/src/services/raw_keyboard.dart:601:12)
[        ] I/flutter ( 4498): #3      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:74:49)
[        ] I/flutter ( 4498): #4      _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:283:33)
[        ] I/flutter ( 4498): #5      _invoke3.<anonymous closure> (dart:ui/hooks.dart:280:15)
[        ] I/flutter ( 4498): #9      _invoke3 (dart:ui/hooks.dart:279:10)
[        ] I/flutter ( 4498): #10     _dispatchPlatformMessage (dart:ui/hooks.dart:154:5)
[        ] I/flutter ( 4498): (elided 5 frames from class _AssertionError and dart:async)
[   +3 ms] I/flutter ( 4498): ════════════════════════════════════════════════════════════════════════════════════════════════════

@pedromassangocode
Copy link

For some reason I'm not able to create an emulator with Directional Pad on Android Studio 4.0. So this will need additional triage.

Screen Shot 2020-09-07 at 09 34 29

@pedromassangocode pedromassangocode added engine flutter/engine repository. See also e: labels. severe: crash Stack traces logged to the console. will need additional triage This issue or PR needs attention during weekly triage and removed in triage Presently being triaged by the triage team. labels Sep 7, 2020
@clarkap
Copy link
Author

clarkap commented Sep 9, 2020 via email

@pedromassangocode
Copy link

Thanks for making it clear

@chinmaygarde chinmaygarde added the P4 Priority 4 issue (default for bugs, things we're likely to work on) label Sep 14, 2020
@chinmaygarde
Copy link
Member

CC @jason-simmons

@Hixie
Copy link
Member

Hixie commented Sep 15, 2020

cc @gspencergoog

@gspencergoog
Copy link
Contributor

I don't have access to an actual Android TV to try this on, unfortunately.

@clarkap would you be willing to add some code to your Flutter repo so I can see what the key information being sent is?

If you could add the following just before the call to _synchronizeModifiers in flutter/packages/flutter/lib/src/services/raw_keyboard.dart, and then rebuild your app and post what the log prints when you press the OK/Select button, that would give me a lot more to go on.

    print('Message received: $message');
    print('RawKeyEvent: $event');
    print('RawKeyEventData: ${event.data}');
    print('pressedKeys: $_keysPressed');

@clarkap
Copy link
Author

clarkap commented Sep 16, 2020 via email

@gspencergoog
Copy link
Contributor

As Adam Savage would say: "Well, there's your problem!"

Although it's not your problem, it's Flutter's: we're translating the physical scan code for the remote as if it were a keyboard, and it's not, so the scan code is mapping to a "Control Right" even though it's not a control key. And the reason the assertion is firing is because although the physical key purports to be a control key, the corresponding metaState bit is not set.

@gspencergoog
Copy link
Contributor

And I'm not quite sure what to do here: the physical key mapping only makes sense when the input is a keyboard, but we use the physical key scancode to make sure that we match the appropriate key down with the right key up. Perhaps we need to just not synchronize the modifiers if the source isn't a keyboard.

@Hixie
Copy link
Member

Hixie commented Sep 22, 2020

Do we need a separate set of mappings for IR remotes maybe? Or in general for lots of classes of devices? How does Android know what key this "really" is?

@Hixie Hixie added a: text input Entering text in a text field or keyboard related problems. framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically. and removed engine flutter/engine repository. See also e: labels. will need additional triage This issue or PR needs attention during weekly triage labels Sep 22, 2020
@gspencergoog
Copy link
Contributor

Android looks at the .kl keyboard layout files installed on the device for the peripheral, and they're different for different peripherals. These are not accessible to the app on a non-rooted device, as far as I know.

I think the right fix here is to have a way to tell if something is not a keyboard (which we should be able to do with platform APIs), and just skip the modifier key synchronization if it isn't a keyboard. Other devices don't use modifier key masks anyhow, so synchronization doesn't make sense.

@darshankawar darshankawar added the passed first triage tests are present, the PR follows the PR template, no obvious coding errors label Sep 25, 2020
@devius
Copy link

devius commented Aug 18, 2022

Is there any fix to this problem?
I have to make IR Remote in my app supported.
It is so sad ....

@devius
Copy link

devius commented Aug 18, 2022

Is there any way to fix this problem, or should I abandon Flutter for my TV appliacation and go to Kotlin?

@clarkap
Copy link
Author

clarkap commented Aug 31, 2022

Looks like this is happening with other remotes as well.
101275

@FrancXPT
Copy link

As a Workaround for those systems, I did this inside this file

<path-to-sdk>/pacakges/flutter/lib/src/services/hardware_keyboard.dart:

Edit the function handleRawKeyMessage:

Future<Map<String, dynamic>> handleRawKeyMessage(dynamic message) async {
    if (_transitMode == null) {
      _transitMode = KeyDataTransitMode.rawKeyData;
      // Convert raw events using a listener so that conversion only occurs if
      // the raw event should be dispatched.
      _rawKeyboard.addListener(_convertRawEventAndStore);
    }

+    try {
+      if (message["scanCode"] == 97) {
+        message["scanCode"] = 28;
+        message["keyCode"] = 66;
+      }
+    } catch (x) {
+      print(x);
+    }

  final RawKeyEvent rawEvent = RawKeyEvent.fromMessage(message as Map<String, dynamic>);
...

This will send select key without errors.
To send the enter key Use message["scanCode"] = 353; and message["keyCode"] = 23;

And add to the function _assertEventIsRegular:

void _assertEventIsRegular(KeyEvent event) {
    assert(() {
      const String common = 'If this occurs in real application, please report this '
        'bug to Flutter. If this occurs in unit tests, please ensure that '
        "simulated events follow Flutter's event model as documented in "
        '`HardwareKeyboard`. This was the event: ';
+     if (event.physicalKey == PhysicalKeyboardKey.controlRight) {
+       return true;
+     }

      if (event is KeyDownEvent) {
...

This is just a Workaround and is not meant to be committed to the source branch.
Feel free to improve on it. Or if you have an official fix.

@RtypeStudios
Copy link

Is this going to be merged into flutter soon? I'm not a huge fan of patching the SDK code. Happy to put together a PR if it helps?

@clarkap
Copy link
Author

clarkap commented Jan 13, 2023 via email

@RtypeStudios
Copy link

@clarkap Do you have an example of this? I'd much rather that than modifying the flutter SDK to get this working.

@clarkap
Copy link
Author

clarkap commented Jan 13, 2023

This works for me but YMMV.

`class MainActivity: FlutterActivity() {

lateinit var inputConnection: BaseInputConnection

override fun onResume() {
    super.onResume()

    val flutterView = findViewById<FlutterView>( FLUTTER_VIEW_ID )

    inputConnection = BaseInputConnection( flutterView , false )

}

override fun dispatchKeyEvent(event: KeyEvent?): Boolean {
    if ( event == null ) return true

    if ( event.keyCode != KeyEvent.KEYCODE_DPAD_CENTER ) {
        return super.dispatchKeyEvent(event)
    }

    if ( event.deviceId != 3 ){
        return super.dispatchKeyEvent(event)
    }

    if ( event.action == KeyEvent.ACTION_DOWN ) {
        inputConnection.sendKeyEvent(
            KeyEvent(
                event.downTime,
                event.eventTime,
                KeyEvent.ACTION_DOWN,
                KeyEvent.KEYCODE_DPAD_CENTER,
                event.repeatCount,
                event.metaState,
                event.modifiers,
                23
            )
        )
    } else {
        inputConnection.sendKeyEvent(
            KeyEvent(
                event.downTime,
                event.eventTime,
                KeyEvent.ACTION_UP,
                KeyEvent.KEYCODE_DPAD_CENTER,
                event.repeatCount,
                event.metaState,
                event.modifiers,
                23
            )
        )
    }

    return true
}

companion object{
    private const val TAG = "MainActivity"
}

}`

@RtypeStudios
Copy link

Thanks, will give that a go and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems. framework flutter/packages/flutter repository. See also f: labels. P4 Priority 4 issue (default for bugs, things we're likely to work on) passed first triage tests are present, the PR follows the PR template, no obvious coding errors platform-android Android applications specifically. severe: crash Stack traces logged to the console.
Projects
None yet
Development

No branches or pull requests

9 participants