Bruno Leroux 8aff00a5d8 [Android] Return the keyboard pressed state (flutter/engine#42758)
## 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.
2023-06-21 05:49:06 +00:00
Languages
Dart 75%
C++ 16.5%
Objective-C++ 2.9%
Java 2.8%
Objective-C 0.7%
Other 1.9%