UsbGadget: Fix switching functions
Sleep only when time elapsed since the last disconnect
is less than the PULL_UP_DELAY. This ensures that the hal
does not miss the 2 second timeout while switching between
functions.
Also, enclose write within TEMP_FAILURE_RETRY to prevent
being returned from EINTR.
Bug: 111424620
Test: a. Switch between multiple functions.
b. while true; do fastboot reboot; adb wait-for-device;
adb shell getprop ro.bootmode; adb root; sleep 2;
adb wait-for-device; adb reboot bootloader; done;
Change-Id: Ic8c418c145e4fe070b407c22eef803e10ae41077
2 files changed