Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac3cf468 authored by shaoweishen's avatar shaoweishen Committed by Shaowei Shen
Browse files

[Output Switcher] Update stop button text

update stop button text and null check for muting expected device.

Bug: 272787441
Bug: 274631614
Test: atest MediaOutputAdapterTest MediaOutputControllerTest MediaOutputBaseDialogTest MediaOutputDialogTest
Change-Id: Idd9680f42bbb9651dea3dc8850a0f425bcba569b
parent 6488e7fe
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.media.AudioDeviceAttributes;
import android.media.AudioManager;
import android.media.RoutingSessionInfo;
import android.os.Build;
@@ -592,9 +593,11 @@ public class LocalMediaManager implements BluetoothCallback {
        }

        private boolean isMutingExpectedDevice(CachedBluetoothDevice cachedDevice) {
            return mAudioManager.getMutingExpectedDevice() != null
                    && cachedDevice.getAddress().equals(
                    mAudioManager.getMutingExpectedDevice().getAddress());
            AudioDeviceAttributes mutingExpectedDevice = mAudioManager.getMutingExpectedDevice();
            if (mutingExpectedDevice == null || cachedDevice == null) {
                return false;
            }
            return cachedDevice.getAddress().equals(mutingExpectedDevice.getAddress());
        }

        private List<MediaDevice> buildDisconnectedBluetoothDevice() {
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ public class MediaOutputDialog extends MediaOutputBaseDialog {

    @Override
    public CharSequence getStopButtonText() {
        int resId = R.string.keyboard_key_media_stop;
        int resId = R.string.media_output_dialog_button_stop_casting;
        if (isBroadcastSupported() && mMediaOutputController.isPlaying()
                && !mMediaOutputController.isBluetoothLeBroadcastEnabled()) {
            resId = R.string.media_output_broadcast;
+2 −1
Original line number Diff line number Diff line
@@ -247,7 +247,8 @@ public class MediaOutputDialogTest extends SysuiTestCase {

    @Test
    public void getStopButtonText_notSupportsBroadcast_returnsDefaultText() {
        String stopText = mContext.getText(R.string.keyboard_key_media_stop).toString();
        String stopText = mContext.getText(
                R.string.media_output_dialog_button_stop_casting).toString();
        MediaOutputController mockMediaOutputController = mock(MediaOutputController.class);
        when(mockMediaOutputController.isBroadcastSupported()).thenReturn(false);