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

Commit b42f9cce authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

Merge "Add content description for output switcher chip" into sc-dev am: c970cc4a

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

Change-Id: I3e0f50b2d4afb21f270b7b360e5c4192c3b19558
parents f6896d7e c970cc4a
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