Add JNI methods to UsbDeviceManager to monitor usb state
The JNI method uses epoll to monitor usb device state in udc sysfs in a new thread, the result is reported to UsbDeviceManager by calling back updateGadgetState. This would be the new way to update usb state, replacing the old one that's depending on ACK specific android_usb sysfs. Note that we cannot assume "sys.usb.controller" is always valid because the property would be set whenever udc device becomes available, which depends on platform implementation. For the same reason, an attempt to monitor the usb state when the system server starts is required as udc uevent could have been emitted even before init. Bug: 339241080 Test: Tested on platforms with persistent udc device and with those which dynamically created/destroyed udc device. Flag: android.hardware.usb.flags.enable_udc_sysfs_usb_state_update Change-Id: I1420951e5b3aa24510b88a1dd9c870e53a37331b
Loading
Please register or sign in to comment