mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
## Description This PR updates the Android engine in order to answer to keyboard pressed state queries from the framework (as implemented in https://github.com/flutter/flutter/pull/122885). This is a rework of https://github.com/flutter/engine/pull/41695 which was reverted in https://github.com/flutter/engine/pull/42346. This issue with https://github.com/flutter/engine/pull/41695 was that the framework side did not get an answer when the channel was setup in the engine without registering a handler (on the engine side) to handle framework requests. The issue was reproducible when the engine initialization was managed by the app (see https://github.com/flutter/flutter/issues/122441#issuecomment-1582052616 for a repro). This PR fixes this issue by changing `flutter/keyboard` lifecycle: the engine now creates the channel and registers a handler just after the channel creation. In order to avoid regression, this PR also updates the channel implemenation (see `KeyboardChannel`) to return an empty `HashMap` when there is no handler registered. ## Related Issue Android engine implementation for https://github.com/flutter/flutter/issues/87391 (see https://github.com/flutter/engine/pull/42346 for Linux implementation) Fixes https://github.com/flutter/flutter/issues/122441 ## Tests Adds 3 tests.