Android emulator not responding to physical keyboard on Xubuntu 16.04

It turns out this is a focus problem. Android emulator does not receive proper focus when clicked upon. I have found two solutions for this so far:

  1. Clicking on the three dots on the bar on the right and closing the settings window right after, gives correct focus to the emulator and the physical keyboard works properly until the user switches to some other app. Upon returning to the emulator, the same procedure has to be followed.
  2. In Xubuntu settings, allowing focus to follow mouse position also does the job.

May 28, 2018 UPDATE:

I was forced to recreate the android emulator from scratch since the previous one was not working properly. The newly created emulator does not receive focus no matter what I do, so this answer is no longer valid. It doesn't receive focus even if I use wmctrl -a.

If anyone else has found a way to force focus on Android Emulator, please share it.