From dfd8c9fa1ddfabe5bdd500e822ca64100f0d1705 Mon Sep 17 00:00:00 2001 From: Elliot Shepherd Date: Wed, 15 Jan 2025 05:39:32 +1100 Subject: [PATCH] fix(shorebird_cli): "SYS_KEYS has no physical keys" during preview (#2646) Co-authored-by: Felix Angelov --- cspell.config.yaml | 1 + packages/shorebird_cli/lib/src/executables/adb.dart | 3 +++ packages/shorebird_cli/test/src/executables/adb_test.dart | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index 096c0943..b3e91598 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -96,6 +96,7 @@ words: - SIGSTOP - storepass # From .github/workflows/e2e.yaml - storyboardc + - syskeys # From adb.dart - subosito # From .github dir, doesn't show up in "**" check? - swiftshader # From .github dir, doesn't show up in "**" check? - sysroot diff --git a/packages/shorebird_cli/lib/src/executables/adb.dart b/packages/shorebird_cli/lib/src/executables/adb.dart index 3c8f9324..46167e0e 100644 --- a/packages/shorebird_cli/lib/src/executables/adb.dart +++ b/packages/shorebird_cli/lib/src/executables/adb.dart @@ -51,6 +51,9 @@ class Adb { if (deviceId != null) ...['-s', deviceId], 'shell', 'monkey', + // Adjust percentage of "system" key events to 0. + // This is needed to support Android systems with no hardware keys. + '--pct-syskeys 0', '-p $package', '1', ]; diff --git a/packages/shorebird_cli/test/src/executables/adb_test.dart b/packages/shorebird_cli/test/src/executables/adb_test.dart index 5176fd67..84e798fd 100644 --- a/packages/shorebird_cli/test/src/executables/adb_test.dart +++ b/packages/shorebird_cli/test/src/executables/adb_test.dart @@ -157,7 +157,10 @@ void main() { completes, ); verify( - () => process.run(adbPath, 'shell monkey -p $package 1'.split(' ')), + () => process.run( + adbPath, + 'shell monkey --pct-syskeys 0 -p $package 1'.split(' '), + ), ).called(1); }); @@ -172,7 +175,8 @@ void main() { verify( () => process.run( adbPath, - '-s $deviceId shell monkey -p $package 1'.split(' '), + '-s $deviceId shell monkey --pct-syskeys 0 -p $package 1' + .split(' '), ), ).called(1); });