TLDR: keymapper sequence [![enter image description here][1]][1]

Longer answer: A keymapper sequence to implement the answer given by [Slider2k][2].

[Keymapper][3] is an app to remap your keys to perform another action, or sequence of actions. In this case I am remapping the double Volume Up press to kill the current app.

Disclaimer: I think keymapper is a great app, but it can be troublesome to get to work. Mostly to due to optimizations added by the manufactures into the firmware. Make sure to read the information given by the developer. Start by taking a look at  [Don't kill my app!][4] to access how hard this maybe to get up and running in your device.

I my case my phone's manufacturer is not that bad, but I still got into trouble with the latest version of the app and had to stick to version [2.4.4][5].

You will probably want to start with a version from the [Play Store][6] of [F-Droid][7].

In case you get the app to work here is the sequence I am using:

 1. Switch to the Key Mapper Basic Input Method, as otherwise the latter commands will not work.
 2. Open recents. This is equivalent to pressing `Alt+Tab`, with the advantage that you do not need to hold the `Alt` key.
 3. Then input the `DPAD_LEFT` key. This moves to the previous app.
 4. The input the `DPAD_RIGHT` key, to move back to the original app. I had to add this detour as the recents app ignored a direct delete key.
 5. Now input the `DEL` key to kill the app.
 6. The final call to recents selects the previous app. I prefer not to be left in the app selection.
 7. To finish-up I restore the keyboard to Gboard.

 I chose to add 300 milisecond delays in between actions to make sure the sequence always worked. However I did not test smaller delays so it might be possible to reduce these timings.

  [1]: https://i.sstatic.net/JH53X.png
  [2]: https://android.stackexchange.com/a/250988/399503
  [3]: https://github.com/keymapperorg/KeyMapper
  [4]: https://dontkillmyapp.com/
  [5]: https://github.com/keymapperorg/KeyMapper/releases/tag/v2.4.4
  [6]: https://play.google.com/store/apps/details?id=io.github.sds100.keymapper&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1
  [7]: https://f-droid.org/packages/io.github.sds100.keymapper/