Fix usb tethering switch back to none after off/on the screen

This CL adds conditions to check whether usb is connected or not.
If usb is not connected or tethering is not started don't update the
state.

Bug: 157709648
Test: make RunSettingsRoboTests -j56
Change-Id: Ifbf5900923419d6abf35834b196aab12601076e4
This commit is contained in:
Hugh Chen
2021-04-26 17:45:46 +08:00
parent e06f5a93b1
commit ddafb202bd
3 changed files with 31 additions and 10 deletions

View File

@@ -57,7 +57,7 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
private PreferenceCategory mProfilesContainer;
private TetheringManager mTetheringManager;
private Handler mHandler = new Handler();
private Handler mHandler;
@VisibleForTesting
OnStartTetheringCallback mOnStartTetheringCallback;
@VisibleForTesting
@@ -69,6 +69,7 @@ public class UsbDetailsFunctionsController extends UsbDetailsController
mTetheringManager = context.getSystemService(TetheringManager.class);
mOnStartTetheringCallback = new OnStartTetheringCallback();
mPreviousFunction = mUsbBackend.getCurrentFunctions();
mHandler = new Handler(context.getMainLooper());
}
@Override