How to stop Android asking for permission before permitting access to USB device
This question and answer is basically a duplicate of 
https://stackoverflow.com/a/15151075/588476
See the above link for an example program and more in depth discussion.

As far as I know, there are two ways to get the USB permission box popup:


Request permission explicitly from your application using UsbManager.requestPermission(...)
Register an intent-filter on your accessory and let the system ask for permission  when the device is attached


In the case of 1 I have found that the checkbox on the popup to remember the permission has no effect.

For me, I removed all code related to permissions from my software and simply put the intent-filter in my manifest. When the USB device is plugged in, if it hasn't already been granted permission then the USB permission box will popup. If the user clicks OK without checking the remember box, then the box will popup again the next time the device is connected. However if the user checks the box and presses OK then the box should never display again (unless the software is uninstalled and then reinstalled).

I'm not sure if there is a bug somewhere related to your device showing up as /dev/bus/usb/001 and then 002 etc - let me know if you are using the intent-filter, as without that the remember checkbox will do nothing.

I do not know of any way that you can avoid the permission popup altogether. I suspect there is no way to do it without digging into the android code like you said.