Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Android] Fix KeyEmbedderResponder throws a NullPointerException #49860

Conversation

bleroux
Copy link
Contributor

@bleroux bleroux commented Jan 18, 2024

Description

This PR fixes a NullPointerException thrown from KeyEmbedderResponder when pressing a key during a hot restart (at this time the framework might not be ready and null reply is sent back).

Related Issue

Fixes flutter/flutter#141662.

Tests

Adds 1 test.

Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me but I do not know what will happen if unhandled events get sent. I think this is probably a strict improvement to crashing though.

message.rewind();
if (message.capacity() != 0) {
handled = message.get() != 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a warning log that message was null?

@bleroux bleroux force-pushed the android_fix_keyEmbedderResponder_exception branch from 5cc8aee to de5f8ae Compare January 18, 2024 19:15
@bleroux bleroux force-pushed the android_fix_keyEmbedderResponder_exception branch from de5f8ae to cb85418 Compare January 19, 2024 08:32
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 19, 2024
@auto-submit auto-submit bot merged commit e47f876 into flutter:main Jan 19, 2024
@bleroux bleroux deleted the android_fix_keyEmbedderResponder_exception branch January 19, 2024 09:43
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 19, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 19, 2024
…141881)

flutter/engine@9a6c64d...538975f

2024-01-19 skia-flutter-autoroll@skia.org Roll Skia from 0a78d1f0ef48 to fb3f61d932e6 (1 revision) (flutter/engine#49891)
2024-01-19 skia-flutter-autoroll@skia.org Roll Skia from 961ad2c3fcf5 to 0a78d1f0ef48 (1 revision) (flutter/engine#49890)
2024-01-19 103135467+sealesj@users.noreply.github.com Re-enable osv-scanner on pushes to main (flutter/engine#49729)
2024-01-19 skia-flutter-autoroll@skia.org Roll Skia from 273b0628a969 to 961ad2c3fcf5 (1 revision) (flutter/engine#49889)
2024-01-19 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from dTy8CK4YxnUsW305O... to geXIwPzzJiSXrZEEb... (flutter/engine#49888)
2024-01-19 skia-flutter-autoroll@skia.org Roll Skia from b6fa819eb54c to 273b0628a969 (1 revision) (flutter/engine#49887)
2024-01-19 skia-flutter-autoroll@skia.org Roll Skia from e073a4fad57a to b6fa819eb54c (1 revision) (flutter/engine#49886)
2024-01-19 leroux_bruno@yahoo.fr [Android] Fix KeyEmbedderResponder throws a NullPointerException (flutter/engine#49860)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from dTy8CK4YxnUs to geXIwPzzJiSX

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException: Attempt to invoke virtual method 'java.nio.Buffer java.nio.ByteBuffer.rewind()' on a null object reference
3 participants