Fix can't select the [USB Tethering] item in [Developer Options]
- This CL is using 'USB_CONFIGURED' to check whether the USB enumeration is completed from the intent. If 'USB_CONFIGURED' is true then update the UI. Bug: 229200265 Test: make -j65 RunSettingsRoboTests Change-Id: Icab05e37ae3fcc9f1bf404a610fc97c368c453f5
This commit is contained in:
@@ -69,22 +69,23 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment {
|
||||
|
||||
@VisibleForTesting
|
||||
UsbConnectionBroadcastReceiver.UsbConnectionListener mUsbConnectionListener =
|
||||
(connected, functions, powerRole, dataRole) -> {
|
||||
(connected, functions, powerRole, dataRole, isUsbConfigured) -> {
|
||||
final long defaultFunctions = mUsbBackend.getDefaultUsbFunctions();
|
||||
Log.d(TAG, "UsbConnectionListener() connected : " + connected + ", functions : "
|
||||
+ functions + ", defaultFunctions : " + defaultFunctions
|
||||
+ ", mIsStartTethering : " + mIsStartTethering);
|
||||
if (connected && !mIsConnected && (defaultFunctions == UsbManager.FUNCTION_RNDIS
|
||||
+ ", mIsStartTethering : " + mIsStartTethering
|
||||
+ ", isUsbConfigured : " + isUsbConfigured);
|
||||
if (connected && !mIsConnected && ((defaultFunctions == UsbManager.FUNCTION_RNDIS
|
||||
|| defaultFunctions == UsbManager.FUNCTION_NCM)
|
||||
&& defaultFunctions == functions)
|
||||
&& !mIsStartTethering) {
|
||||
mCurrentFunctions = defaultFunctions;
|
||||
startTethering();
|
||||
}
|
||||
|
||||
if (mIsStartTethering && connected) {
|
||||
if ((mIsStartTethering || isUsbConfigured) && connected) {
|
||||
mCurrentFunctions = functions;
|
||||
refresh(functions);
|
||||
mUsbBackend.setDefaultUsbFunctions(functions);
|
||||
mIsStartTethering = false;
|
||||
}
|
||||
mIsConnected = connected;
|
||||
|
Reference in New Issue
Block a user