[Output Switcher] Update isHost check for device

use updated method to check if device is isHost.

Test: atest MediaOutputAdapterTest MediaOutputControllerTest MediaOutputBaseDialogTest MediaOutputDialogTest
Bug: 262013662
Change-Id: I89c0b5eba29051de7d59d8407d453981f5910ce6
This commit is contained in:
shaoweishen
2023-02-06 13:02:33 +00:00
committed by Shaowei Shen
parent 08ca091614
commit 8991125562
2 changed files with 2 additions and 1 deletions

View File

@@ -204,7 +204,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
&& mController.isAdvancedLayoutSupported() && device.hasSubtext()) {
boolean isActiveWithOngoingSession =
(device.hasOngoingSession() && currentlyConnected);
boolean isHost = mController.isVolumeControlEnabled(device)
boolean isHost = device.isHostForOngoingSession()
&& isActiveWithOngoingSession;
if (isHost) {
mCurrentActivePosition = position;

View File

@@ -440,6 +440,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
when(mMediaOutputController.isSubStatusSupported()).thenReturn(true);
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
when(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(true);
when(mMediaDevice1.isHostForOngoingSession()).thenReturn(true);
when(mMediaDevice1.hasSubtext()).thenReturn(true);
when(mMediaDevice1.getSubtext()).thenReturn(SUBTEXT_CUSTOM);
when(mMediaDevice1.getSubtextString()).thenReturn(TEST_CUSTOM_SUBTEXT);