How Android handles game controllers
When you connect a USB or Bluetooth gaming controller to your Android device, the operating system treats it as an input device and registers the events created by button presses. Android translates these presses into specific key codes and axis values, which then map to in-game actions and movements in supported titles.Android relies on predefined configuration files to map these input events. To determine which configuration to use, the OS checks the controller’s vendor and product ID. Because it is impossible to build specific configurations for every controller on the market, Android maintains files only for the most popular hardware, such as official Xbox controllers.Mishaal Rahman / Android AuthorityAndroid’s key configuration file for the Xbox One Controller when connected via USB.This doesn’t mean that Android won’t work with niche peripherals, though. Many vendors mimic the controller schemes of major brands to ensure Android and other operating systems recognize their inputs. This compatibility strategy allows Android to work with a vast array of controllers right out of the box.However, some players may not enjoy the default button layout on their controllers or how they’re mapped in specific titles. There are countless reasons why someone might want to customize their controls:
- Accessibility: Users with disabilities may need to remap buttons to make essential functions easier to reach.
- Ergonomics: Players looking to reduce hand strain may prefer moving high-frequency actions to buttons that require less force.
- Competition: Pro gamers may map certain actions to specific buttons to improve reaction times.
- Muscle memory: Fans of retro games or those switching platforms often want to match the layouts they are most accustomed to.
C. Scott Brown / Android AuthorityUnfortunately, Android doesn’t support button remapping out of the box. Instead, it relies on individual games to provide remapping options. While many emulators offer this, most standard Android games do not. For years, users have had to rely on third-party tools to customize their inputs, but these often utilize hacky solutions involving ADB or the Accessibility API to intercept and remap key presses. These methods introduce additional overhead and are unreliable across different devices and games.Fortunately, I’ve spotted evidence that Google is working to bring native controller remapping to a future version of Android. This evidence appears in the latest Android Canary release, which offers a preview of upcoming features and APIs. Although I’m not sure when this feature will ship, it is most likely targeting the next major update, Android 17.
Android 17 may finally bring native controller remapping
The evidence for this feature lies in a new permission defined within the Android framework: android.permission.CONTROLLER_REMAPPING. This permission is guarded by a feature flag labeled com.android.hardware.input.controller_remapping. The flag’s namespace, com.android.hardware.input, ties this feature to input devices like game controllers. Importantly, this new permission is restricted to apps signed with the platform key, meaning third-party apps will not be able to perform system-wide controller remapping.Mishaal Rahman / Android AuthorityWe also discovered references to a new, dedicated game controller menu within the Settings app. While the menu is currently unpopulated, the Activity definition in the Settings Manifest suggests it might display a list of connected controllers. It is likely that this menu will serve as the central hub for managing game controllers, specifically for remapping their buttons.Mishaal Rahman / Android Authority
Android is getting support for…virtual gamepads?
Diving deeper, I also spotted code referencing a new “virtual gamepad” feature. This appears to be a software representation of a physical controller, similar to how Android already handles virtual cameras for features like the Pixel’s Connected Camera. In this context, the “virtual gamepad” is likely the mechanism Android will use to handle button remapping.The code allows the system to register a virtual input device using standard hardware identifiers (vendorId and productId), which could be used to trick games into treating it as a real, physical controller. This virtual device supports a complete set of standard controller inputs, including:
- Face & Menu Buttons: A, B, X, Y, Start, Select, and Mode.
- Triggers & Bumpers: L1, R1, L2, and R2 (including analog trigger axes lTrigger and rTrigger).
- Joysticks: Left and Right analog sticks (mapping to X, Y, Z, and Rz axes) and their clickable buttons (L3 and R3).
- D-Pad: Directional inputs mapped to HatX and HatY.
The existence of methods to inject simulated inputs back into the system suggests that this virtual gamepad acts as a bridge, intercepting original button presses and outputting remapped ones that games can understand natively.Dhruv Bhutani / Android AuthorityBesides button remapping, this code could also be used to map on-screen touch controls to physical controller inputs. This would be incredibly useful for games that lack native controller support, which unfortunately includes a large portion of the Android gaming library. I can imagine this being particularly useful on future Android-powered PCs, as playing with a controller is far more ergonomic than using touch controls on a PC. Google is no stranger to this technology, as it already employs similar input-mapping systems in Chrome OS and Google Play Games on PC.We’ll have to wait and see how Google implements this feature, however. We are over six months away from the release of Android 17, leaving Google plenty of time to implement the feature. We hope that Google manages to at least ship basic button remapping, as that alone would be a significant upgrade for gamers. If it also manages to introduce a dedicated controller menu and a touchscreen mapping tool, that would be a game-changer.