Merge "Fix Bluetooth switch status in Connected devices screen" into oc-mr1-dev

This commit is contained in:
Antony Sargent
2017-09-06 16:42:41 +00:00
committed by Android (Google) Code Review
2 changed files with 99 additions and 8 deletions

View File

@@ -157,7 +157,9 @@ public final class BluetoothEnabler implements SwitchWidgetController.OnSwitchCh
}
private void setChecked(boolean isChecked) {
if (isChecked != mSwitchWidget.isChecked()) {
final boolean currentState =
(mSwitchWidget.getSwitch() != null) && mSwitchWidget.getSwitch().isChecked();
if (isChecked != currentState) {
// set listener to null, so onCheckedChanged won't be called
// if the checked status on Switch isn't changed by user click
if (mValidListener) {