Add condition to check case of accessory combinations am: b767df1a08

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13218259

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4a4502e3568d0049c4fff7f730b42d1bc975cea4
This commit is contained in:
Hugh Chen
2020-12-15 05:01:42 +00:00
committed by Automerger Merge Worker
2 changed files with 32 additions and 3 deletions

View File

@@ -275,6 +275,18 @@ public class UsbDetailsFunctionsControllerTest {
UsbManager.FUNCTION_ACCESSORY);
}
@Test
public void onRadioButtonClicked_functionMtp_inAccessoryCombinationsMode_doNothing() {
final long function = UsbManager.FUNCTION_ACCESSORY | UsbManager.FUNCTION_AUDIO_SOURCE;
mRadioButtonPreference.setKey(UsbBackend.usbFunctionsToString(UsbManager.FUNCTION_MTP));
doReturn(UsbManager.FUNCTION_ACCESSORY).when(mUsbBackend).getCurrentFunctions();
mDetailsFunctionsController.mPreviousFunction = function;
mDetailsFunctionsController.onRadioButtonClicked(mRadioButtonPreference);
assertThat(mDetailsFunctionsController.mPreviousFunction).isEqualTo(function);
}
@Test
public void onRadioButtonClicked_clickSameButton_doNothing() {
mRadioButtonPreference.setKey(UsbBackend.usbFunctionsToString(UsbManager.FUNCTION_PTP));