Merge "[Output Switcher] Update stop button text" into tm-qpr-dev am: 0aadb77a13

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22196624

Change-Id: I9381adf75db05dcb29667611faded8ef0bb4f1e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shaowei Shen
2023-03-27 03:05:53 +00:00
committed by Automerger Merge Worker
3 changed files with 9 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.media.AudioDeviceAttributes;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.RoutingSessionInfo; import android.media.RoutingSessionInfo;
import android.os.Build; import android.os.Build;
@@ -592,9 +593,11 @@ public class LocalMediaManager implements BluetoothCallback {
} }
private boolean isMutingExpectedDevice(CachedBluetoothDevice cachedDevice) { private boolean isMutingExpectedDevice(CachedBluetoothDevice cachedDevice) {
return mAudioManager.getMutingExpectedDevice() != null AudioDeviceAttributes mutingExpectedDevice = mAudioManager.getMutingExpectedDevice();
&& cachedDevice.getAddress().equals( if (mutingExpectedDevice == null || cachedDevice == null) {
mAudioManager.getMutingExpectedDevice().getAddress()); return false;
}
return cachedDevice.getAddress().equals(mutingExpectedDevice.getAddress());
} }
private List<MediaDevice> buildDisconnectedBluetoothDevice() { private List<MediaDevice> buildDisconnectedBluetoothDevice() {

View File

@@ -117,7 +117,7 @@ public class MediaOutputDialog extends MediaOutputBaseDialog {
@Override @Override
public CharSequence getStopButtonText() { 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() if (isBroadcastSupported() && mMediaOutputController.isPlaying()
&& !mMediaOutputController.isBluetoothLeBroadcastEnabled()) { && !mMediaOutputController.isBluetoothLeBroadcastEnabled()) {
resId = R.string.media_output_broadcast; resId = R.string.media_output_broadcast;

View File

@@ -306,7 +306,8 @@ public class MediaOutputDialogTest extends SysuiTestCase {
@Test @Test
public void getStopButtonText_notSupportsBroadcast_returnsDefaultText() { 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); MediaOutputController mockMediaOutputController = mock(MediaOutputController.class);
when(mockMediaOutputController.isBroadcastSupported()).thenReturn(false); when(mockMediaOutputController.isBroadcastSupported()).thenReturn(false);