The automation parts were cribbed directly from 50add3e176. The automation permissions were added in https://bugzilla.mozilla.org/show_bug.cgi?id=1477311. This uses a very rudimentary Gradle plugin, `rust-android-gradle`, with custom fixes and extensions. It works pretty well for what it is! See https://github.com/ncalexan/rust-android-gradle.
50add3e176