Don't show "always use" when app can't be default
Each USB device can have one default handler. This app is launched when the device is plugged in. A default handler automatically gets permission to access the device when launched. All other apps have to request the permission to access the USB device via UsbManager.requestPermission. In the permission dialog there is an option to make the app the default app for the device. Of course this only makes sense if this app declares the right properties to be auto-launched. Hence check this and only then show this options. Also made the string in the dialogs easier to understand. AccessoryFilter and DeviceFilter needed to be copied so I can access them from system-ui. No code change in these classes. Test: requested permissions from app that could by the default for the device and from an app that could not. Also tested "confirm" flow that is executed when the device is plugged in and a app that might be default is installed. Bug: 67381583 Change-Id: I12eb7efed0ad107c70ae32433a5629108f252486
Loading
Please register or sign in to comment