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

Commit fdd85889 authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Add content description for output switcher chip

Fixes: 188367068
Test: manual
Test: atest MediaControlPanelTest

Change-Id: Ibaab82bde0bf3a79ec01bd900cb974a2b7b40a0d
parent f1c4d4e1
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -347,10 +347,11 @@ public class MediaControlPanel {
        artistText.setText(data.getArtist());

        // Transfer chip
        mPlayerViewHolder.getSeamless().setVisibility(View.VISIBLE);
        ViewGroup seamlessView = mPlayerViewHolder.getSeamless();
        seamlessView.setVisibility(View.VISIBLE);
        setVisibleAndAlpha(collapsedSet, R.id.media_seamless, true /*visible */);
        setVisibleAndAlpha(expandedSet, R.id.media_seamless, true /*visible */);
        mPlayerViewHolder.getSeamless().setOnClickListener(v -> {
        seamlessView.setOnClickListener(v -> {
            mMediaOutputDialogFactory.create(data.getPackageName(), true);
        });

@@ -374,9 +375,9 @@ public class MediaControlPanel {
        collapsedSet.setAlpha(seamlessId, seamlessAlpha);
        // Disable clicking on output switcher for resumption controls.
        mPlayerViewHolder.getSeamless().setEnabled(!data.getResumption());
        String deviceString = null;
        if (showFallback) {
            iconView.setImageDrawable(null);
            deviceName.setText(null);
        } else if (device != null) {
            Drawable icon = device.getIcon();
            iconView.setVisibility(View.VISIBLE);
@@ -387,13 +388,16 @@ public class MediaControlPanel {
            } else {
                iconView.setImageDrawable(icon);
            }
            deviceName.setText(device.getName());
            deviceString = device.getName();
        } else {
            // Reset to default
            Log.w(TAG, "device is null. Not binding output chip.");
            iconView.setVisibility(View.GONE);
            deviceName.setText(com.android.internal.R.string.ext_media_seamless_action);
            deviceString = mContext.getString(
                    com.android.internal.R.string.ext_media_seamless_action);
        }
        deviceName.setText(deviceString);
        seamlessView.setContentDescription(deviceString);

        List<Integer> actionsWhenCollapsed = data.getActionsToShowInCompact();
        // Media controls
+5 −2
Original line number Diff line number Diff line
@@ -232,6 +232,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
                emptyList(), PACKAGE, session.getSessionToken(), null, device, true, null)
        player.bindPlayer(state, PACKAGE)
        assertThat(seamlessText.getText()).isEqualTo(DEVICE_NAME)
        assertThat(seamless.contentDescription).isEqualTo(DEVICE_NAME)
        assertThat(seamless.isEnabled()).isTrue()
    }

@@ -251,13 +252,15 @@ public class MediaControlPanelTest : SysuiTestCase() {

    @Test
    fun bindNullDevice() {
        val fallbackString = context.getResources().getString(
                com.android.internal.R.string.ext_media_seamless_action)
        player.attachPlayer(holder)
        val state = MediaData(USER_ID, true, BG_COLOR, APP, null, ARTIST, TITLE, null, emptyList(),
                emptyList(), PACKAGE, session.getSessionToken(), null, null, true, null)
        player.bindPlayer(state, PACKAGE)
        assertThat(seamless.isEnabled()).isTrue()
        assertThat(seamlessText.getText()).isEqualTo(context.getResources().getString(
                com.android.internal.R.string.ext_media_seamless_action))
        assertThat(seamlessText.getText()).isEqualTo(fallbackString)
        assertThat(seamless.contentDescription).isEqualTo(fallbackString)
    }

    @Test