[Shield Android TV Android Development] mfxa:
For whom is this module?

This is for SHIELD TV users who can or do not want to use the original SHIELD TV controller for GeForce NOW gaming and miss haptic feedback with 3rd-party controllers (e.g., DualSense).

What do you need?

A 3rd-party controller that is compatible

An up-to-date (to-be) unlocked SHIELD TV with Android TV 9-11

For remote support, a USB Bluetooth dongle such as 8bitdo Wireless Adapter (until Android TV 12 is available)

I'm in - how to get it?

To check controller compatibility, install the attached APK, open it and test your controller setup whether it supports rumble with the Android Vibrator API

If it works, continue unlocking the device and installing Magisk root support (if not done already)

Install the latest version of LSPosed with Magisk

Enable this module in the LSPosed module manager, select the GeForce Games app as target (just as recommended by default) and reboot

Enjoy

I recommend using a launcher app for non-leanback apps to access Magisk and LSposed. Moreover, either a hardware mouse or a smartphone-based Android TV Remote with a virtual mouse (e.g. this app) will be helpful for navigating the apps.

How does it work?

NVidia don't use the native Vibrator API for haptic feedback. Instead, they have integrated their own API for their own accessory and their own accessory only. The inputs from other devices are accepted natively but they do not enable the haptic feedback, so the servers don't even send haptic packages unless the SHIELD TV controller (2017) is connected. This module hooks into the enabling method and sends the message to the server that haptic support is provided. This allows hooking to the haptic-package-receiving methods and redirecting their content to the InputManager devices.

What are the limitations?

Beginning with Android 12, there will be a native VibrationManager API and a HapticFeedback sound-based generator available that add native Bluetooth drivers and support for 3rd-party controllers. This will make the requirement for USB dongles redundant and even add extended haptic feedback support. The haptic packages from NVidia servers include low and high-frequency motor amplitudes. However, the Android 9-11 Vibrator API only accepts a single amplitude. This means that the haptic experience will be limited to a single amplitude because both amplitudes have to be merged. Due to the lack of native Bluetooth drivers and API support in Android 9-11, I see no way of getting Bluetooth compatibility without USB dongles or USB connection. NVidia might update its apps in the future, which might require module updates as well. In parts, the hooks depend on obfuscated/minimized method and class identifiers, which is weakly coupled and susceptible to changes. But overall, the Xposed module support allows Google Play updates to continue fluently. After an update, the only interaction that will be necessary is a system reboot and the hooks will be redeployed. If it should stop working, simply disable the module in LSPosed and reboot. The module will only affect the GeForce Games app and not the system or any other apps. Multi-controller setups aren't tested thoroughly. The Nvidia controllers probably receive separate rumble feedback but it's possible that the 3rd-party controllers, if connected, rumble at the same time. When 3rd-party controllers are used for input, Nvidia controllers shouldn't rumble, connected or not. Please let me know how it works for you. Full multi-controller support might be an option if I can map the id or index from the haptic packages to the native controller ids.

md5: B01301D858C7F24335C0CD50B430E6C9

sha1: F2309B55D9BB00E35E92BB1C59313E1F6D50AA3D