Only start tether when not already enabled
The toggle in the tether page currently tries to start tethering if
it gets turned on. However, changing a wifi config can cause
startTether to be called and also the toggle to switch leading to
a double call to startTether. This CL makes it so that if we are
already connected to tethering we don't try to start it again.
Test: robotests
Change-Id: I91085244c5d1fcc245a6b6480e638a32bc14f0ac
Fixes: 78028548
Fixes: 78441216
Fixes: 74368363
This commit is contained in:
@@ -91,10 +91,10 @@ public class WifiTetherSwitchBarController implements SwitchWidgetController.OnS
|
||||
|
||||
@Override
|
||||
public boolean onSwitchToggled(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
startTether();
|
||||
} else {
|
||||
if (!isChecked) {
|
||||
stopTether();
|
||||
} else if (!mWifiManager.isWifiApEnabled()) {
|
||||
startTether();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user