[Wi-Fi] Control Wi-Fi Hotspot Settings using onClick instead of onSwitchToggled
In the current Settings framework onSwitchToggled has been implemented to monitor the change in Settings done by user but its getting called even when Settings is changed using setChecked where under certain condition like rotation during config changed, Tether Settings is disabled and then enabled and later before Rotation Settings remained false due to stop Tethering with Tether Enabled After Rotation when settings is initialized it is set as disabled and even after receiving the Tether Enabled it remains Off. Hence used onClick to monitor user ON/OFF Settings Bug: 142625203 Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSwitchBarControllerTest.java Test: Manual 1. Go to Wifi Hotspot Settings 2. Turn ON 3. Change SSID and save 4. Rotate screen soon after saving Result: Hotspot does not turn ON, remains in OFF state. Signed-off-by:JeiFeng Lee <linger.lee@mediatek.com> Change-Id: Ibddacdf35eb3196f40cdb2c240efa902f9123646
This commit is contained in:
@@ -40,7 +40,6 @@ import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.widget.SwitchBar;
|
||||
import com.android.settings.widget.SwitchBarController;
|
||||
import com.android.settingslib.TetherUtil;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
@@ -130,8 +129,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
// SettingsActivity as base for all preference fragments.
|
||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||
final SwitchBar switchBar = activity.getSwitchBar();
|
||||
mSwitchBarController = new WifiTetherSwitchBarController(activity,
|
||||
new SwitchBarController(switchBar));
|
||||
mSwitchBarController = new WifiTetherSwitchBarController(activity, switchBar);
|
||||
getSettingsLifecycle().addObserver(mSwitchBarController);
|
||||
switchBar.show();
|
||||
}
|
||||
|
Reference in New Issue
Block a user