Only send usb disconnect intents after boot.

This prevents cases where the device starts up and attempts
to change the config, but intents cannot yet be sent.

A patch to resend this skipped intent is necessary to
finish fixing the bug.

Bug: 34451258
Test: Check that usb state is properly handled on boot
Change-Id: I9d79c67ce8982fd5b43fa40781b66bb9ae820694
This commit is contained in:
Jerry Zhang
2017-01-23 14:14:09 -08:00
parent 06aed6950d
commit c1bc0a844d

View File

@ -740,11 +740,12 @@ public class UsbDeviceManager {
if (UsbManager.containsFunction(mCurrentFunctions,
UsbManager.USB_FUNCTION_ACCESSORY)) {
updateCurrentAccessory();
} else if (!mConnected) {
// restore defaults when USB is disconnected
setEnabledFunctions(null, false, false);
}
if (mBootCompleted) {
if (!mConnected) {
// restore defaults when USB is disconnected
setEnabledFunctions(null, false, false);
}
updateUsbStateBroadcastIfNeeded(false);
updateUsbFunctions();
}