sgtpuzzles
sgtpuzzles copied to clipboard
Keep buttons on screen with keyboard-like devices connected, and add preference
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Checkout
main
and open it in Android Studio. (I'm on Android Studio 2021.2.1) - Build the project and run it in the emulator (I'm using the "Google Pixel" device).
- Play any game.
Expected behavior The control buttons should appear at the bottom of the screen, but they don't. For example, in this screenshot, I would expect to see buttons for the numbers 1 through 6 just above the Undo/Redo buttons.
Screenshots
@geajack What does Build.MODEL
return on that emulator image? Here's the logic for whether the keyboard is shown - "We show data-entry if we either don't have a real hardware keyboard (we usually don't), or we're on the Android SDK's emulator" - so it looks like Build.MODEL
does not start with "sdk_" and we'll need to add a case to detect whatever emulator image you're running, as long as there's an unambiguous way to do so.
I stepped through in the debugger and got to isProbablyEmulator()
and indeed it's returning false. Build.Model
is Android SDK built for x86
.
This bug occurs for me on real hardware, on a custom ROM. OnePlus 7T running (the admittedly outdated) Paranoid Android Sapphire Alpha 3. (It is Android 12, but the current version is Beta 2.)
Puzzles version number: Version 2022-05-21-1809-c43a34fb
EDIT: UGH. Wait a sec. I think I figured out why it's happening to me. The "smart" watch I'm using identifies itself as a keyboard even though it doesn't do any keyboard stuff. In which case, my reporting a bug that doesn't exist becomes a feature request: add an option to show buttons even if a physical keyboard is connected.
Seconding this:
my reporting a bug that doesn't exist becomes a feature request: add an option to show buttons even if a physical keyboard is connected.
I recently lost buttons in the app in a similar manner on my Pixel 3, and this ticket helped me realize it was because I recently started keeping a YubiKey 5C Nano connected in the charging port—which, among other things, identifies as a physical keyboard.
Re-titling to reflect what still needs to be done, since I mostly fixed emulators already with the linked commit. I think it still makes sense to hide the buttons when a full real keyboard is present (which these days mostly means on Chromebooks) but the tricky part is telling the difference between that and these headphones/Yubikey/smartwatch/other devices. Plus it makes sense to have a preference anyway, e.g. in case a Chromebook user just prefers the buttons.