Skip to content

Commit 1d56c58

Browse files
author
Android Build Coastguard Worker
committed
Merge cherrypicks of ['googleplex-android-review.googlesource.com/23428200', 'googleplex-android-review.googlesource.com/23479325'] into sparse-10217051-L92600000960987363.
SPARSE_CHANGE: I02ddaa5e823379510e9c81a8d803d5269e6d85ad SPARSE_CHANGE: If1c14cc0a4e3fbdfbed2c105d37ece9a866f18ed Change-Id: Idb5cfe95571ccd635488ebdcbf0de1dff247dca3
2 parents ab24d7c + bf75a05 commit 1d56c58

3 files changed

Lines changed: 35 additions & 10 deletions

File tree

packages/SystemUI/src/com/android/systemui/controls/management/ControlsProviderSelectorActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ open class ControlsProviderSelectorActivity @Inject constructor(
214214
putExtra(ControlsFavoritingActivity.EXTRA_FROM_PROVIDER_SELECTOR, true)
215215
}
216216
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
217-
animateExitAndFinish()
218217
}
219218
}
220219
}

packages/SystemUI/tests/src/com/android/systemui/controls/management/ControlsProviderSelectorActivityTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class ControlsProviderSelectorActivityTest : SysuiTestCase() {
144144
assertThat(activityRule.activity.lastStartedActivity?.component?.className)
145145
.isEqualTo(ControlsFavoritingActivity::class.java.name)
146146

147-
assertThat(activityRule.activity.triedToFinish).isTrue()
147+
assertThat(activityRule.activity.triedToFinish).isFalse()
148148
}
149149

150150
@Test

services/usb/java/com/android/server/usb/descriptors/UsbDescriptorParser.java

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,34 @@ public boolean hasAudioInterface() {
584584
}
585585

586586
/**
587+
* Returns true only if there is a terminal whose subtype and terminal type are the same as
588+
* the given values.
587589
* @hide
588590
*/
589-
public boolean hasAudioTerminal(int subType) {
591+
public boolean hasAudioTerminal(int subType, int terminalType) {
590592
for (UsbDescriptor descriptor : mDescriptors) {
591-
if (descriptor instanceof UsbACInterface) {
592-
if (((UsbACInterface) descriptor).getSubclass()
593-
== UsbDescriptor.AUDIO_AUDIOCONTROL
594-
&& ((UsbACInterface) descriptor).getSubtype()
595-
== subType) {
593+
if (descriptor instanceof UsbACTerminal) {
594+
if (((UsbACTerminal) descriptor).getSubclass() == UsbDescriptor.AUDIO_AUDIOCONTROL
595+
&& ((UsbACTerminal) descriptor).getSubtype() == subType
596+
&& ((UsbACTerminal) descriptor).getTerminalType() == terminalType) {
597+
return true;
598+
}
599+
}
600+
}
601+
return false;
602+
}
603+
604+
/**
605+
* Returns true only if there is an interface whose subtype is the same as the given one and
606+
* terminal type is different from the given one.
607+
* @hide
608+
*/
609+
public boolean hasAudioTerminalExcludeType(int subType, int excludedTerminalType) {
610+
for (UsbDescriptor descriptor : mDescriptors) {
611+
if (descriptor instanceof UsbACTerminal) {
612+
if (((UsbACTerminal) descriptor).getSubclass() == UsbDescriptor.AUDIO_AUDIOCONTROL
613+
&& ((UsbACTerminal) descriptor).getSubtype() == subType
614+
&& ((UsbACTerminal) descriptor).getTerminalType() != excludedTerminalType) {
596615
return true;
597616
}
598617
}
@@ -604,14 +623,21 @@ public boolean hasAudioTerminal(int subType) {
604623
* @hide
605624
*/
606625
public boolean hasAudioPlayback() {
607-
return hasAudioTerminal(UsbACInterface.ACI_OUTPUT_TERMINAL);
626+
return hasAudioTerminalExcludeType(
627+
UsbACInterface.ACI_OUTPUT_TERMINAL, UsbTerminalTypes.TERMINAL_USB_STREAMING)
628+
&& hasAudioTerminal(
629+
UsbACInterface.ACI_INPUT_TERMINAL, UsbTerminalTypes.TERMINAL_USB_STREAMING);
608630
}
609631

610632
/**
611633
* @hide
612634
*/
613635
public boolean hasAudioCapture() {
614-
return hasAudioTerminal(UsbACInterface.ACI_INPUT_TERMINAL);
636+
return hasAudioTerminalExcludeType(
637+
UsbACInterface.ACI_INPUT_TERMINAL, UsbTerminalTypes.TERMINAL_USB_STREAMING)
638+
&& hasAudioTerminal(
639+
UsbACInterface.ACI_OUTPUT_TERMINAL,
640+
UsbTerminalTypes.TERMINAL_USB_STREAMING);
615641
}
616642

617643
/**

0 commit comments

Comments
 (0)