Fix it will auto switch back to "No data transfer" after selecting "USB Tethering"

Before this CL, the USB option didn't handle whether FUNCTION_NCM
existed in the intent extra when tethering was started which resulted
in some devices that enable NCM will have incorrect UI.

This CL added a condition to check whether FUNCTION_NCM existed in the
intent extra or not to fix this UI issue.

Bug: 192046902
Test: make -j42 RunSettingsRoboTests
Change-Id: Icb8548409930d59dc3a08c25e418c9a1ddb9f33c
This commit is contained in:
Hugh Chen
2021-07-07 17:27:12 +08:00
parent 199528d460
commit 112a638cba
6 changed files with 122 additions and 9 deletions

View File

@@ -75,6 +75,9 @@ public class UsbConnectionBroadcastReceiver extends BroadcastReceiver implements
if (intent.getExtras().getBoolean(UsbManager.USB_FUNCTION_ACCESSORY)) {
functions |= UsbManager.FUNCTION_ACCESSORY;
}
if (intent.getExtras().getBoolean(UsbManager.USB_FUNCTION_NCM)) {
functions |= UsbManager.FUNCTION_NCM;
}
mFunctions = functions;
mDataRole = mUsbBackend.getDataRole();
mPowerRole = mUsbBackend.getPowerRole();