Use Laptop keyboard for Android device
You are looking for Bluetooth HID (Human Interface Device).

So instructions for Ubuntu can be found here:

https://askubuntu.com/questions/229287/how-do-i-make-ubuntu-appear-as-a-bluetooth-keyboard

Although its is unclear if anyone has made it work on more recent versions of Ubuntu.