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

@@ -116,6 +116,8 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
if (mUsbBackend.areFunctionsSupported(option)) {
if (isAccessoryMode(functions)) {
pref.setChecked(UsbManager.FUNCTION_MTP == option);
} else if (functions == UsbManager.FUNCTION_NCM) {
pref.setChecked(UsbManager.FUNCTION_RNDIS == option);
} else {
pref.setChecked(functions == option);
}
@@ -148,7 +150,7 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
preference.setChecked(true);
}
if (function == UsbManager.FUNCTION_RNDIS) {
if (function == UsbManager.FUNCTION_RNDIS || function == UsbManager.FUNCTION_NCM) {
// We need to have entitlement check for usb tethering, so use API in
// TetheringManager.
mTetheringManager.startTethering(