[Keyboard, Android] Mint physical keys on the Android plane (flutter/engine#34122)

This commit is contained in:
Tong Mu
2022-06-21 13:14:33 -07:00
committed by GitHub
parent 94efcccb6e
commit 5de64c88b0
3 changed files with 3 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ public class KeyEmbedderResponder implements KeyboardManager.Responder {
// key from the key code so that keys can be told apart.
if (scancode == 0) {
// The key code can't also be 0, since those events have been filtered.
return keyOfPlane(event.getKeyCode(), KeyboardMap.kLogicalPlane);
return keyOfPlane(event.getKeyCode(), KeyboardMap.kAndroidPlane);
}
final Long byMapping = KeyboardMap.scanCodeToPhysical.get(scancode);
if (byMapping != null) {

View File

@@ -614,6 +614,5 @@ public class KeyboardMap {
public static final long kValueMask = 0x000ffffffffL;
public static final long kUnicodePlane = 0x00000000000L;
public static final long kLogicalPlane = 0x00300000000L;
public static final long kAndroidPlane = 0x01100000000L;
}

View File

@@ -799,7 +799,7 @@ public class KeyboardManagerTest {
}
@Test
public void eventsWithForgedCodes() {
public void eventsWithMintedCodes() {
final KeyboardTester tester = new KeyboardTester();
final ArrayList<CallRecord> calls = new ArrayList<>();
@@ -814,7 +814,7 @@ public class KeyboardManagerTest {
verifyEmbedderEvents(
calls,
new KeyData[] {
buildKeyData(Type.kDown, 0x300000042L, LOGICAL_ENTER, "\n", false),
buildKeyData(Type.kDown, 0x1100000042L, LOGICAL_ENTER, "\n", false),
});
calls.clear();