Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 61816838 authored by Roy Luo's avatar Roy Luo
Browse files

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
parent 26e97845
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment