Unexpected "Allow Gboard to record audio" alert

Hi all,
when testing android app, sometimes, unexpectedly, when the keyboard opens up the following alert pops up and blocks the automation:

any solution for this using appium or even with adb?
Note that I already use FULL_RESET and AUTO_GRANT_PERMISSIONS capabilities.

It is an alert coming from Gboard, not from the app under test. You could simply allow or block this permission once manually from global application permissions settings.

also if you need an automated way of allowing or blocking apps from recording video/audio then the following command could be used:
adb shell appops set <PKG_ID> PROJECT_MEDIA allow (or deny)

It also has an extension wrapper: https://github.com/appium/appium-uiautomator2-driver#mobile-changepermissions (target should be set to appops)

I am using an emulator and reseting its settings each time so automating it will be great. Thanks for the advice, will try it.