Send inputs from hardware to Android on Raspberry Pi

I have Android installed on my Raspberry Pi 3 and I want to be able to control it with simple actions from hardware. For example, I want to have a button connected to my raspberry pi, and when it is clicked, it will make the Android go to the home screen. Or even better, have a Bluetooth device that can send these inputs to the Android operating system.

There needs to be some way of doing this or else, phone companies like Samsung, would not be able to have a working home button on the phone.

Thanks for any help