Merge "Stop usb tethering when user cancel it" into rvc-dev am: 53c6c9a672 am: 1659954b04 am: bd4ce318bc am: c27bb24fcf

Change-Id: I22820f66b6620fd29ee6ba76827b0eb87f905017
This commit is contained in:
TreeHugger Robot
2020-05-06 11:54:54 +00:00
committed by Automerger Merge Worker
2 changed files with 44 additions and 0 deletions

View File

@@ -89,6 +89,9 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
@Override
protected void refresh(boolean connected, long functions, int powerRole, int dataRole) {
if (!connected || dataRole != DATA_ROLE_DEVICE) {
if (mPreviousFunction == UsbManager.FUNCTION_RNDIS) {
mConnectivityManager.stopTethering(TETHERING_USB);
}
mProfilesContainer.setEnabled(false);
} else {
// Functions are only available in device mode
@@ -129,6 +132,9 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
mConnectivityManager.startTethering(TETHERING_USB, true /* showProvisioningUi */,
mOnStartTetheringCallback);
} else {
if (mPreviousFunction == UsbManager.FUNCTION_RNDIS) {
mConnectivityManager.stopTethering(TETHERING_USB);
}
mUsbBackend.setCurrentFunctions(function);
}
}