Bluetooth Settings Policy Transparency
If handleStateChanged() is called after maybeEnforceRestriction, the disabled switch will be enabled again, only to be disabled when the user touches it. Bug: 37737621 Test: make RunSettingsRoboTests -j40 ROBOTEST_FILTER=*BluetoothEnablerTest Change-Id: I3086806dfd6d911d6d7fca1f1d30fa7d8b8757d1
This commit is contained in:
@@ -106,7 +106,7 @@ public final class BluetoothEnabler implements SwitchWidgetController.OnSwitchCh
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
maybeEnforceRestrictions();
|
||||
final boolean restricted = maybeEnforceRestrictions();
|
||||
|
||||
if (mLocalAdapter == null) {
|
||||
mSwitchWidget.setEnabled(false);
|
||||
@@ -114,7 +114,9 @@ public final class BluetoothEnabler implements SwitchWidgetController.OnSwitchCh
|
||||
}
|
||||
|
||||
// Bluetooth state is not sticky, so set it manually
|
||||
handleStateChanged(mLocalAdapter.getBluetoothState());
|
||||
if (!restricted) {
|
||||
handleStateChanged(mLocalAdapter.getBluetoothState());
|
||||
}
|
||||
|
||||
mSwitchWidget.startListening();
|
||||
mContext.registerReceiver(mReceiver, mIntentFilter);
|
||||
|
Reference in New Issue
Block a user