Fix function setting failed in Developer options

One can select USB function in Settings->System->
Developer options->Default USB configuration without
a cable connected, and the selected function will be
the default function after re-connecting. However, this
function might be restored to NONE due to ENUMERATION_TIMEOUT
if one selected the function without a cable connected.

When the device is not connected to a host, we should not
queue the ENUMERATION_TIMEOUT while switching function.
Fix it by checking connected status and also make it switch
to corresponding function if an user has selected one in the
Default USB configuration.

Bug: 150422683
Test: Switch functions from Default USB configuration for the
both cases cable connecting and disconnecting. And also try it
while there is the secure lock.
Signed-off-by: Puma Hsu <[email protected]>
Change-Id: I1933c098e47496b8d6813a5a4e295bcf12027401
1 file changed