Can I silently granting USB peripheral permissions to an app without prompting the user

Which version of system do you use? Khadas official images, self built images, or others?

Khadas official images Android 11

Please describe your issue below:

Can I silently granting USB peripheral ( Thermal USB printer) permissions to an app without prompting the user?

@pinij
You can configure the value of config.disableUsbPermissionDialogs.
File path:frameworks/base/core/res/res/values/config.xml

@william.lin Thank you for your reply.
I’m very new to building AOSP from source — is it possible to create a patch file to update only the config.xml, or can I use root shell access to update the file directly?

If so, could you kindly provide the instructions for how to patch or replace this file?

I’m currently using the official image: vim4-android-11-64bit-v241211.img.xz.

@pinij ,

You can update the framework-res.apk by following these steps:

adb root
adb remount
adb push xxxxxx/xxxxxx/framework-res.apk /system/framework/
adb shell sync