Settings: Disable USB preferences if USB signaling is off

* When developer options is turned
  off and on again, 'Default USB
  configuration' and 'Disable USB
  audio routing' should not be enabled
  if USB data signaling is disabled.

Manual testing:
* Disable USB data signaling
* Verify preferences are disabled
* Turn developer options off and on
* Verify preferences remain disabled

Bug: 180711035
Test: manual testing
      make RunSettingsRoboTests -j ROBOTEST_FILTER=UsbAudioRoutingPreferenceControllerTest
      make RunSettingsRoboTests -j ROBOTEST_FILTER=DefaultUsbConfigurationPreferenceControllerTest
Change-Id: Id08228da812b7534e2217b0c3f30a7ac989f7553
This commit is contained in:
Alex Johnston
2021-03-17 15:18:00 +00:00
parent caf50d1203
commit 46c72f3cac
4 changed files with 60 additions and 0 deletions

View File

@@ -83,4 +83,11 @@ public class UsbAudioRoutingPreferenceController extends DeveloperOptionsPrefere
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, SETTING_VALUE_OFF);
((SwitchPreference) mPreference).setChecked(false);
}
@Override
protected void onDeveloperOptionsSwitchEnabled() {
super.onDeveloperOptionsSwitchEnabled();
mPreference.setDisabledByAdmin(
checkIfUsbDataSignalingIsDisabled(mContext, UserHandle.myUserId()));
}
}