Merge "[Output Switcher] Fix SASS device update in U" into udc-dev am: 6c388bfda6

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

Change-Id: I9fe6125b33f3f3d07c19866e99fc91913d7bf3ec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shaowei Shen
2023-05-12 10:21:17 +00:00
committed by Automerger Merge Worker
3 changed files with 16 additions and 16 deletions

View File

@@ -207,10 +207,10 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
updateTitleIcon(R.drawable.media_output_icon_volume, updateTitleIcon(R.drawable.media_output_icon_volume,
mController.getColorItemContent()); mController.getColorItemContent());
} }
initMutingExpectedDevice();
mCurrentActivePosition = position; mCurrentActivePosition = position;
updateFullItemClickListener(v -> onItemClick(v, device)); updateFullItemClickListener(v -> onItemClick(v, device));
setSingleLineLayout(getItemTitle(device)); setSingleLineLayout(getItemTitle(device));
initMutingExpectedDevice();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
&& mController.isSubStatusSupported() && mController.isSubStatusSupported()
&& mController.isAdvancedLayoutSupported() && device.hasSubtext()) { && mController.isAdvancedLayoutSupported() && device.hasSubtext()) {

View File

@@ -47,7 +47,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.android.settingslib.Utils;
import com.android.settingslib.media.MediaDevice; import com.android.settingslib.media.MediaDevice;
import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.utils.ThreadUtils;
import com.android.systemui.R; import com.android.systemui.R;
@@ -277,9 +276,10 @@ public abstract class MediaOutputBaseAdapter extends
backgroundDrawable = mContext.getDrawable( backgroundDrawable = mContext.getDrawable(
showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active
: R.drawable.media_output_item_background).mutate(); : R.drawable.media_output_item_background).mutate();
backgroundDrawable.setTint( mItemLayout.setBackgroundTintList(ColorStateList.valueOf(
showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground() showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground()
: mController.getColorItemBackground()); : mController.getColorItemBackground()
));
mIconAreaLayout.setBackgroundTintList( mIconAreaLayout.setBackgroundTintList(
ColorStateList.valueOf(showProgressBar || isFakeActive ColorStateList.valueOf(showProgressBar || isFakeActive
? mController.getColorConnectedItemBackground() ? mController.getColorConnectedItemBackground()
@@ -299,7 +299,8 @@ public abstract class MediaOutputBaseAdapter extends
backgroundDrawable = mContext.getDrawable( backgroundDrawable = mContext.getDrawable(
R.drawable.media_output_item_background) R.drawable.media_output_item_background)
.mutate(); .mutate();
backgroundDrawable.setTint(mController.getColorItemBackground()); mItemLayout.setBackgroundTintList(
ColorStateList.valueOf(mController.getColorItemBackground()));
} }
mItemLayout.setBackground(backgroundDrawable); mItemLayout.setBackground(backgroundDrawable);
mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
@@ -455,11 +456,16 @@ public abstract class MediaOutputBaseAdapter extends
void initMutingExpectedDevice() { void initMutingExpectedDevice() {
disableSeekBar(); disableSeekBar();
updateTitleIcon(R.drawable.media_output_icon_volume,
mController.getColorItemContent());
final Drawable backgroundDrawable = mContext.getDrawable( final Drawable backgroundDrawable = mContext.getDrawable(
R.drawable.media_output_item_background_active) R.drawable.media_output_item_background_active)
.mutate(); .mutate();
backgroundDrawable.setTint(mController.getColorConnectedItemBackground());
mItemLayout.setBackground(backgroundDrawable); mItemLayout.setBackground(backgroundDrawable);
mItemLayout.setBackgroundTintList(
ColorStateList.valueOf(mController.getColorConnectedItemBackground()));
mIconAreaLayout.setBackgroundTintList(
ColorStateList.valueOf(mController.getColorConnectedItemBackground()));
} }
private void animateCornerAndVolume(int fromProgress, int toProgress) { private void animateCornerAndVolume(int fromProgress, int toProgress) {
@@ -530,14 +536,6 @@ public abstract class MediaOutputBaseAdapter extends
}); });
} }
Drawable getSpeakerDrawable() {
final Drawable drawable = mContext.getDrawable(R.drawable.ic_speaker_group_black_24dp)
.mutate();
drawable.setTint(Utils.getColorStateListDefaultColor(mContext,
R.color.media_dialog_item_main_content));
return drawable;
}
protected void disableSeekBar() { protected void disableSeekBar() {
mSeekBar.setEnabled(false); mSeekBar.setEnabled(false);
mSeekBar.setOnTouchListener((v, event) -> true); mSeekBar.setOnTouchListener((v, event) -> true);
@@ -574,7 +572,6 @@ public abstract class MediaOutputBaseAdapter extends
return; return;
} }
mTitleIcon.setImageIcon(icon); mTitleIcon.setImageIcon(icon);
icon.setTint(mController.getColorItemContent());
mTitleIcon.setImageTintList( mTitleIcon.setImageTintList(
ColorStateList.valueOf(mController.getColorItemContent())); ColorStateList.valueOf(mController.getColorItemContent()));
}); });

View File

@@ -347,10 +347,13 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
} }
@Test @Test
public void onBindViewHolder_isMutingExpectedDevice_verifyView() { public void advanced_onBindViewHolder_isMutingExpectedDevice_verifyView() {
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(true); when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(true);
when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false); when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false);
when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false); when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
.onCreateViewHolder(new LinearLayout(mContext), 0);
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0); mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE);