I'm developing an Android application which registers four intent filters for a BroadcastReceiver in the manifest. These are:
android.hardware.usb.action.USB_DEVICE_ATTACHED
android.hardware.usb.action.USB_DEVICE_DETACHED
android.hardware.usb.action.USB_ACCESSORY_ATTACHED
android.hardware.usb.action.USB_ACCESSORY_DETACHED
Note that there is currently no device-filter
metadata registered alongside any of these intents. When I launch this app on Android 9 (specifically on a Samsung Galaxy S9), any and all USB devices are registered and the onReceive
method is successfully called in the BroadcastReceiver. However, the same code being run in Android 10 (on a Galaxy S20) does not call onReceive
. I realise that the device filter is listed as a requirement in the developer documentation, but Android 9 accepts it no questions asked.
In an ideal world, I would like not to use a device filter, since my app includes a dynamic device filtering option via user configuration where they input a PID/VID combination for the app to work with.
My question is: Is there any way of giving an "allow-all" device filter to an Android 10 application through the manifest? Is this change in device filter behaviour an intended feature of Android in general, or just Samsung's implementation?
In case it affects anything, this app is a device administrator.