I have a launcher application that connects to the usb port. The first time I start the launcher the application asks the permission to connect to the usb port and there is a flag to remember this setting.
After that every time I disconnect and connect the usb port the phone allows the usb connection from the launcher without any issue.
The problem is that when I'm not into the launcher (that is running in background all the time) the usb sense the new connection and move the launcher on top of all the other applications, closing the app that I'm currently using. I need the launcher to stay in background and connect silently to the usb port without closing (sending in background) the running application.