Merge "[Output Switcher] Remove sysui flag for Output Switcher in U" into udc-dev am: 6ba91bb562 am: 54e016669c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23107802 Change-Id: I836b9b20c0801bff64e062da8d44470d5113dc91 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -665,15 +665,6 @@ object Flags {
|
||||
val WARN_ON_BLOCKING_BINDER_TRANSACTIONS =
|
||||
unreleasedFlag(2400, "warn_on_blocking_binder_transactions")
|
||||
|
||||
// 2500 - output switcher
|
||||
// TODO(b/261538825): Tracking Bug
|
||||
@JvmField
|
||||
val OUTPUT_SWITCHER_ADVANCED_LAYOUT = releasedFlag(2500, "output_switcher_advanced_layout")
|
||||
@JvmField
|
||||
val OUTPUT_SWITCHER_ROUTES_PROCESSING = releasedFlag(2501, "output_switcher_routes_processing")
|
||||
@JvmField
|
||||
val OUTPUT_SWITCHER_DEVICE_STATUS = releasedFlag(2502, "output_switcher_device_status")
|
||||
|
||||
// 2700 - unfold transitions
|
||||
// TODO(b/265764985): Tracking Bug
|
||||
@Keep
|
||||
|
||||
@@ -72,102 +72,67 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup,
|
||||
int viewType) {
|
||||
super.onCreateViewHolder(viewGroup, viewType);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
switch (viewType) {
|
||||
case MediaItem.MediaItemType.TYPE_GROUP_DIVIDER:
|
||||
return new MediaGroupDividerViewHolder(mHolderView);
|
||||
case MediaItem.MediaItemType.TYPE_PAIR_NEW_DEVICE:
|
||||
case MediaItem.MediaItemType.TYPE_DEVICE:
|
||||
default:
|
||||
return new MediaDeviceViewHolder(mHolderView);
|
||||
}
|
||||
} else {
|
||||
return new MediaDeviceViewHolder(mHolderView);
|
||||
switch (viewType) {
|
||||
case MediaItem.MediaItemType.TYPE_GROUP_DIVIDER:
|
||||
return new MediaGroupDividerViewHolder(mHolderView);
|
||||
case MediaItem.MediaItemType.TYPE_PAIR_NEW_DEVICE:
|
||||
case MediaItem.MediaItemType.TYPE_DEVICE:
|
||||
default:
|
||||
return new MediaDeviceViewHolder(mHolderView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
if (position >= mMediaItemList.size()) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Incorrect position: " + position + " list size: "
|
||||
+ mMediaItemList.size());
|
||||
}
|
||||
return;
|
||||
if (position >= mMediaItemList.size()) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Incorrect position: " + position + " list size: "
|
||||
+ mMediaItemList.size());
|
||||
}
|
||||
MediaItem currentMediaItem = mMediaItemList.get(position);
|
||||
switch (currentMediaItem.getMediaItemType()) {
|
||||
case MediaItem.MediaItemType.TYPE_GROUP_DIVIDER:
|
||||
((MediaGroupDividerViewHolder) viewHolder).onBind(currentMediaItem.getTitle());
|
||||
break;
|
||||
case MediaItem.MediaItemType.TYPE_PAIR_NEW_DEVICE:
|
||||
((MediaDeviceViewHolder) viewHolder).onBind(CUSTOMIZED_ITEM_PAIR_NEW);
|
||||
break;
|
||||
case MediaItem.MediaItemType.TYPE_DEVICE:
|
||||
((MediaDeviceViewHolder) viewHolder).onBind(
|
||||
currentMediaItem.getMediaDevice().get(),
|
||||
position);
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Incorrect position: " + position);
|
||||
}
|
||||
} else {
|
||||
final int size = mController.getMediaDevices().size();
|
||||
if (position == size) {
|
||||
return;
|
||||
}
|
||||
MediaItem currentMediaItem = mMediaItemList.get(position);
|
||||
switch (currentMediaItem.getMediaItemType()) {
|
||||
case MediaItem.MediaItemType.TYPE_GROUP_DIVIDER:
|
||||
((MediaGroupDividerViewHolder) viewHolder).onBind(currentMediaItem.getTitle());
|
||||
break;
|
||||
case MediaItem.MediaItemType.TYPE_PAIR_NEW_DEVICE:
|
||||
((MediaDeviceViewHolder) viewHolder).onBind(CUSTOMIZED_ITEM_PAIR_NEW);
|
||||
} else if (position < size) {
|
||||
break;
|
||||
case MediaItem.MediaItemType.TYPE_DEVICE:
|
||||
((MediaDeviceViewHolder) viewHolder).onBind(
|
||||
((List<MediaDevice>) (mController.getMediaDevices())).get(position),
|
||||
currentMediaItem.getMediaDevice().get(),
|
||||
position);
|
||||
} else if (DEBUG) {
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Incorrect position: " + position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
if (position >= mMediaItemList.size()) {
|
||||
Log.d(TAG, "Incorrect position for item id: " + position);
|
||||
return position;
|
||||
}
|
||||
MediaItem currentMediaItem = mMediaItemList.get(position);
|
||||
return currentMediaItem.getMediaDevice().isPresent()
|
||||
? currentMediaItem.getMediaDevice().get().getId().hashCode()
|
||||
: position;
|
||||
}
|
||||
final int size = mController.getMediaDevices().size();
|
||||
if (position == size) {
|
||||
return -1;
|
||||
} else if (position < size) {
|
||||
return ((List<MediaDevice>) (mController.getMediaDevices()))
|
||||
.get(position).getId().hashCode();
|
||||
} else if (DEBUG) {
|
||||
if (position >= mMediaItemList.size()) {
|
||||
Log.d(TAG, "Incorrect position for item id: " + position);
|
||||
return position;
|
||||
}
|
||||
return position;
|
||||
MediaItem currentMediaItem = mMediaItemList.get(position);
|
||||
return currentMediaItem.getMediaDevice().isPresent()
|
||||
? currentMediaItem.getMediaDevice().get().getId().hashCode()
|
||||
: position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (mController.isAdvancedLayoutSupported()
|
||||
&& position >= mMediaItemList.size()) {
|
||||
if (position >= mMediaItemList.size()) {
|
||||
Log.d(TAG, "Incorrect position for item type: " + position);
|
||||
return MediaItem.MediaItemType.TYPE_GROUP_DIVIDER;
|
||||
}
|
||||
return mController.isAdvancedLayoutSupported()
|
||||
? mMediaItemList.get(position).getMediaItemType()
|
||||
: super.getItemViewType(position);
|
||||
return mMediaItemList.get(position).getMediaItemType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
// Add extra one for "pair new"
|
||||
return mController.isAdvancedLayoutSupported()
|
||||
? mMediaItemList.size()
|
||||
: mController.getMediaDevices().size() + 1;
|
||||
return mMediaItemList.size();
|
||||
}
|
||||
|
||||
class MediaDeviceViewHolder extends MediaDeviceBaseViewHolder {
|
||||
@@ -203,17 +168,14 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
// Set different layout for each device
|
||||
if (device.isMutingExpectedDevice()
|
||||
&& !mController.isCurrentConnectedDeviceRemote()) {
|
||||
if (!mController.isAdvancedLayoutSupported()) {
|
||||
updateTitleIcon(R.drawable.media_output_icon_volume,
|
||||
mController.getColorItemContent());
|
||||
}
|
||||
updateTitleIcon(R.drawable.media_output_icon_volume,
|
||||
mController.getColorItemContent());
|
||||
mCurrentActivePosition = position;
|
||||
updateFullItemClickListener(v -> onItemClick(v, device));
|
||||
setSingleLineLayout(getItemTitle(device));
|
||||
initMutingExpectedDevice();
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
|
||||
&& mController.isSubStatusSupported()
|
||||
&& mController.isAdvancedLayoutSupported() && device.hasSubtext()) {
|
||||
&& device.hasSubtext()) {
|
||||
boolean isActiveWithOngoingSession =
|
||||
(device.hasOngoingSession() && (currentlyConnected || isDeviceIncluded(
|
||||
mController.getSelectedMediaDevice(), device)));
|
||||
@@ -284,10 +246,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
// selected device in group
|
||||
boolean isDeviceDeselectable = isDeviceIncluded(
|
||||
mController.getDeselectableMediaDevice(), device);
|
||||
if (!mController.isAdvancedLayoutSupported()) {
|
||||
updateTitleIcon(R.drawable.media_output_icon_volume,
|
||||
mController.getColorItemContent());
|
||||
}
|
||||
updateTitleIcon(R.drawable.media_output_icon_volume,
|
||||
mController.getColorItemContent());
|
||||
updateGroupableCheckBox(true, isDeviceDeselectable, device);
|
||||
updateEndClickArea(device, isDeviceDeselectable);
|
||||
setUpContentDescriptionForView(mContainerLayout, false, device);
|
||||
@@ -305,8 +265,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
updateFullItemClickListener(v -> cancelMuteAwaitConnection());
|
||||
setSingleLineLayout(getItemTitle(device));
|
||||
} else if (mController.isCurrentConnectedDeviceRemote()
|
||||
&& !mController.getSelectableMediaDevice().isEmpty()
|
||||
&& mController.isAdvancedLayoutSupported()) {
|
||||
&& !mController.getSelectableMediaDevice().isEmpty()) {
|
||||
//If device is connected and there's other selectable devices, layout as
|
||||
// one of selected devices.
|
||||
updateTitleIcon(R.drawable.media_output_icon_volume,
|
||||
@@ -334,36 +293,27 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
//groupable device
|
||||
setUpDeviceIcon(device);
|
||||
updateGroupableCheckBox(false, true, device);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
updateEndClickArea(device, true);
|
||||
}
|
||||
updateFullItemClickListener(mController.isAdvancedLayoutSupported()
|
||||
? v -> onItemClick(v, device)
|
||||
: v -> onGroupActionTriggered(true, device));
|
||||
updateEndClickArea(device, true);
|
||||
updateFullItemClickListener(v -> onItemClick(v, device));
|
||||
setSingleLineLayout(getItemTitle(device), false /* showSeekBar */,
|
||||
false /* showProgressBar */, true /* showCheckBox */,
|
||||
true /* showEndTouchArea */);
|
||||
} else {
|
||||
setUpDeviceIcon(device);
|
||||
setSingleLineLayout(getItemTitle(device));
|
||||
if (mController.isAdvancedLayoutSupported()
|
||||
&& mController.isSubStatusSupported()) {
|
||||
Drawable deviceStatusIcon =
|
||||
device.hasOngoingSession() ? mContext.getDrawable(
|
||||
R.drawable.ic_sound_bars_anim)
|
||||
: Api34Impl.getDeviceStatusIconBasedOnSelectionBehavior(
|
||||
device,
|
||||
mContext);
|
||||
if (deviceStatusIcon != null) {
|
||||
updateDeviceStatusIcon(deviceStatusIcon);
|
||||
mStatusIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
updateSingleLineLayoutContentAlpha(
|
||||
updateClickActionBasedOnSelectionBehavior(device)
|
||||
? DEVICE_CONNECTED_ALPHA : DEVICE_DISCONNECTED_ALPHA);
|
||||
} else {
|
||||
updateFullItemClickListener(v -> onItemClick(v, device));
|
||||
Drawable deviceStatusIcon =
|
||||
device.hasOngoingSession() ? mContext.getDrawable(
|
||||
R.drawable.ic_sound_bars_anim)
|
||||
: Api34Impl.getDeviceStatusIconBasedOnSelectionBehavior(
|
||||
device,
|
||||
mContext);
|
||||
if (deviceStatusIcon != null) {
|
||||
updateDeviceStatusIcon(deviceStatusIcon);
|
||||
mStatusIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
updateSingleLineLayoutContentAlpha(
|
||||
updateClickActionBasedOnSelectionBehavior(device)
|
||||
? DEVICE_CONNECTED_ALPHA : DEVICE_DISCONNECTED_ALPHA);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -400,10 +350,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
}
|
||||
|
||||
public void updateEndClickAreaColor(int color) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mEndTouchArea.setBackgroundTintList(
|
||||
ColorStateList.valueOf(color));
|
||||
}
|
||||
mEndTouchArea.setBackgroundTintList(
|
||||
ColorStateList.valueOf(color));
|
||||
}
|
||||
|
||||
private boolean updateClickActionBasedOnSelectionBehavior(MediaDevice device) {
|
||||
@@ -440,10 +388,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
isDeviceDeselectable ? (v) -> mCheckBox.performClick() : null);
|
||||
mEndTouchArea.setImportantForAccessibility(
|
||||
View.IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mEndTouchArea.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemBackground()));
|
||||
}
|
||||
mEndTouchArea.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemBackground()));
|
||||
setUpContentDescriptionForView(mEndTouchArea, true, device);
|
||||
}
|
||||
|
||||
@@ -473,10 +419,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
mTitleIcon.setImageDrawable(addDrawable);
|
||||
mTitleIcon.setImageTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemContent()));
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemBackground()));
|
||||
}
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemBackground()));
|
||||
mContainerLayout.setOnClickListener(mController::launchBluetoothPairing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,9 +89,8 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup,
|
||||
int viewType) {
|
||||
mContext = viewGroup.getContext();
|
||||
mHolderView = LayoutInflater.from(mContext).inflate(
|
||||
mController.isAdvancedLayoutSupported() ? MediaItem.getMediaLayoutId(viewType)
|
||||
: R.layout.media_output_list_item, viewGroup, false);
|
||||
mHolderView = LayoutInflater.from(mContext).inflate(MediaItem.getMediaLayoutId(viewType),
|
||||
viewGroup, false);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -173,15 +172,9 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mStatusIcon = view.requireViewById(R.id.media_output_item_status);
|
||||
mCheckBox = view.requireViewById(R.id.check_box);
|
||||
mEndTouchArea = view.requireViewById(R.id.end_action_area);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mEndClickIcon = view.requireViewById(R.id.media_output_item_end_click_icon);
|
||||
mVolumeValueText = view.requireViewById(R.id.volume_value);
|
||||
mIconAreaLayout = view.requireViewById(R.id.icon_area);
|
||||
} else {
|
||||
mVolumeValueText = null;
|
||||
mIconAreaLayout = null;
|
||||
mEndClickIcon = null;
|
||||
}
|
||||
mEndClickIcon = view.requireViewById(R.id.media_output_item_end_click_icon);
|
||||
mVolumeValueText = view.requireViewById(R.id.volume_value);
|
||||
mIconAreaLayout = view.requireViewById(R.id.icon_area);
|
||||
initAnimator();
|
||||
}
|
||||
|
||||
@@ -197,9 +190,7 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mTitleText.setTextColor(mController.getColorItemContent());
|
||||
mSubTitleText.setTextColor(mController.getColorItemContent());
|
||||
mTwoLineTitleText.setTextColor(mController.getColorItemContent());
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mVolumeValueText.setTextColor(mController.getColorItemContent());
|
||||
}
|
||||
mVolumeValueText.setTextColor(mController.getColorItemContent());
|
||||
mSeekBar.setProgressTintList(
|
||||
ColorStateList.valueOf(mController.getColorSeekbarProgress()));
|
||||
}
|
||||
@@ -230,12 +221,10 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mItemLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(isActive ? mController.getColorConnectedItemBackground()
|
||||
: mController.getColorItemBackground()));
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(showSeekBar ? mController.getColorSeekbarProgress()
|
||||
: showProgressBar ? mController.getColorConnectedItemBackground()
|
||||
: mController.getColorItemBackground()));
|
||||
}
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(showSeekBar ? mController.getColorSeekbarProgress()
|
||||
: showProgressBar ? mController.getColorConnectedItemBackground()
|
||||
: mController.getColorItemBackground()));
|
||||
mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
|
||||
mSeekBar.setAlpha(1);
|
||||
mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE);
|
||||
@@ -246,12 +235,10 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mTitleText.setVisibility(View.VISIBLE);
|
||||
mCheckBox.setVisibility(showCheckBox ? View.VISIBLE : View.GONE);
|
||||
mEndTouchArea.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
ViewGroup.MarginLayoutParams params =
|
||||
(ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams();
|
||||
params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable()
|
||||
: mController.getItemMarginEndDefault();
|
||||
}
|
||||
ViewGroup.MarginLayoutParams params =
|
||||
(ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams();
|
||||
params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable()
|
||||
: mController.getItemMarginEndDefault();
|
||||
mTitleIcon.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemContent()));
|
||||
}
|
||||
@@ -272,36 +259,28 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mSeekBar.setAlpha(1);
|
||||
mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE);
|
||||
final Drawable backgroundDrawable;
|
||||
if (mController.isAdvancedLayoutSupported() && mController.isSubStatusSupported()) {
|
||||
backgroundDrawable = mContext.getDrawable(
|
||||
showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active
|
||||
: R.drawable.media_output_item_background).mutate();
|
||||
mItemLayout.setBackgroundTintList(ColorStateList.valueOf(
|
||||
showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground()
|
||||
: mController.getColorItemBackground()
|
||||
));
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(showProgressBar || isFakeActive
|
||||
? mController.getColorConnectedItemBackground()
|
||||
: showSeekBar ? mController.getColorSeekbarProgress()
|
||||
: mController.getColorItemBackground()));
|
||||
if (showSeekBar) {
|
||||
updateSeekbarProgressBackground();
|
||||
}
|
||||
//update end click area by isActive
|
||||
mEndTouchArea.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE);
|
||||
mEndClickIcon.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE);
|
||||
ViewGroup.MarginLayoutParams params =
|
||||
(ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams();
|
||||
params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable()
|
||||
: mController.getItemMarginEndDefault();
|
||||
} else {
|
||||
backgroundDrawable = mContext.getDrawable(
|
||||
R.drawable.media_output_item_background)
|
||||
.mutate();
|
||||
mItemLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorItemBackground()));
|
||||
backgroundDrawable = mContext.getDrawable(
|
||||
showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active
|
||||
: R.drawable.media_output_item_background).mutate();
|
||||
mItemLayout.setBackgroundTintList(ColorStateList.valueOf(
|
||||
showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground()
|
||||
: mController.getColorItemBackground()
|
||||
));
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(showProgressBar || isFakeActive
|
||||
? mController.getColorConnectedItemBackground()
|
||||
: showSeekBar ? mController.getColorSeekbarProgress()
|
||||
: mController.getColorItemBackground()));
|
||||
if (showSeekBar) {
|
||||
updateSeekbarProgressBackground();
|
||||
}
|
||||
//update end click area by isActive
|
||||
mEndTouchArea.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE);
|
||||
mEndClickIcon.setVisibility(showEndTouchArea ? View.VISIBLE : View.GONE);
|
||||
ViewGroup.MarginLayoutParams params =
|
||||
(ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams();
|
||||
params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable()
|
||||
: mController.getItemMarginEndDefault();
|
||||
mItemLayout.setBackground(backgroundDrawable);
|
||||
mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
|
||||
mSubTitleText.setVisibility(showSubtitle ? View.VISIBLE : View.GONE);
|
||||
@@ -319,15 +298,11 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
.findDrawableByLayerId(android.R.id.progress);
|
||||
final GradientDrawable progressDrawable =
|
||||
(GradientDrawable) clipDrawable.getDrawable();
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
progressDrawable.setCornerRadii(
|
||||
new float[]{0, 0, mController.getActiveRadius(),
|
||||
mController.getActiveRadius(),
|
||||
mController.getActiveRadius(),
|
||||
mController.getActiveRadius(), 0, 0});
|
||||
} else {
|
||||
progressDrawable.setCornerRadius(mController.getActiveRadius());
|
||||
}
|
||||
progressDrawable.setCornerRadii(
|
||||
new float[]{0, 0, mController.getActiveRadius(),
|
||||
mController.getActiveRadius(),
|
||||
mController.getActiveRadius(),
|
||||
mController.getActiveRadius(), 0, 0});
|
||||
}
|
||||
|
||||
void initSeekbar(MediaDevice device, boolean isCurrentSeekbarInvisible) {
|
||||
@@ -340,30 +315,23 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
final int currentVolume = device.getCurrentVolume();
|
||||
if (mSeekBar.getVolume() != currentVolume) {
|
||||
if (isCurrentSeekbarInvisible && !mIsInitVolumeFirstTime) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
updateTitleIcon(currentVolume == 0 ? R.drawable.media_output_icon_volume_off
|
||||
: R.drawable.media_output_icon_volume,
|
||||
mController.getColorItemContent());
|
||||
} else {
|
||||
animateCornerAndVolume(mSeekBar.getProgress(),
|
||||
MediaOutputSeekbar.scaleVolumeToProgress(currentVolume));
|
||||
}
|
||||
updateTitleIcon(currentVolume == 0 ? R.drawable.media_output_icon_volume_off
|
||||
: R.drawable.media_output_icon_volume,
|
||||
mController.getColorItemContent());
|
||||
} else {
|
||||
if (!mVolumeAnimator.isStarted()) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
int percentage =
|
||||
(int) ((double) currentVolume * VOLUME_PERCENTAGE_SCALE_SIZE
|
||||
/ (double) mSeekBar.getMax());
|
||||
if (percentage == 0) {
|
||||
updateMutedVolumeIcon();
|
||||
} else {
|
||||
updateUnmutedVolumeIcon();
|
||||
}
|
||||
int percentage =
|
||||
(int) ((double) currentVolume * VOLUME_PERCENTAGE_SCALE_SIZE
|
||||
/ (double) mSeekBar.getMax());
|
||||
if (percentage == 0) {
|
||||
updateMutedVolumeIcon();
|
||||
} else {
|
||||
updateUnmutedVolumeIcon();
|
||||
}
|
||||
mSeekBar.setVolume(currentVolume);
|
||||
}
|
||||
}
|
||||
} else if (mController.isAdvancedLayoutSupported() && currentVolume == 0) {
|
||||
} else if (currentVolume == 0) {
|
||||
mSeekBar.resetVolume();
|
||||
updateMutedVolumeIcon();
|
||||
}
|
||||
@@ -378,17 +346,15 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
}
|
||||
int progressToVolume = MediaOutputSeekbar.scaleProgressToVolume(progress);
|
||||
int deviceVolume = device.getCurrentVolume();
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
int percentage =
|
||||
(int) ((double) progressToVolume * VOLUME_PERCENTAGE_SCALE_SIZE
|
||||
/ (double) seekBar.getMax());
|
||||
mVolumeValueText.setText(mContext.getResources().getString(
|
||||
R.string.media_output_dialog_volume_percentage, percentage));
|
||||
mVolumeValueText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
int percentage =
|
||||
(int) ((double) progressToVolume * VOLUME_PERCENTAGE_SCALE_SIZE
|
||||
/ (double) seekBar.getMax());
|
||||
mVolumeValueText.setText(mContext.getResources().getString(
|
||||
R.string.media_output_dialog_volume_percentage, percentage));
|
||||
mVolumeValueText.setVisibility(View.VISIBLE);
|
||||
if (progressToVolume != deviceVolume) {
|
||||
mController.adjustVolume(device, progressToVolume);
|
||||
if (mController.isAdvancedLayoutSupported() && deviceVolume == 0) {
|
||||
if (deviceVolume == 0) {
|
||||
updateUnmutedVolumeIcon();
|
||||
}
|
||||
}
|
||||
@@ -396,30 +362,26 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mTitleIcon.setVisibility(View.INVISIBLE);
|
||||
mVolumeValueText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mTitleIcon.setVisibility(View.INVISIBLE);
|
||||
mVolumeValueText.setVisibility(View.VISIBLE);
|
||||
mIsDragging = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
int currentVolume = MediaOutputSeekbar.scaleProgressToVolume(
|
||||
seekBar.getProgress());
|
||||
int percentage =
|
||||
(int) ((double) currentVolume * VOLUME_PERCENTAGE_SCALE_SIZE
|
||||
/ (double) seekBar.getMax());
|
||||
if (percentage == 0) {
|
||||
seekBar.setProgress(0);
|
||||
updateMutedVolumeIcon();
|
||||
} else {
|
||||
updateUnmutedVolumeIcon();
|
||||
}
|
||||
mTitleIcon.setVisibility(View.VISIBLE);
|
||||
mVolumeValueText.setVisibility(View.GONE);
|
||||
int currentVolume = MediaOutputSeekbar.scaleProgressToVolume(
|
||||
seekBar.getProgress());
|
||||
int percentage =
|
||||
(int) ((double) currentVolume * VOLUME_PERCENTAGE_SCALE_SIZE
|
||||
/ (double) seekBar.getMax());
|
||||
if (percentage == 0) {
|
||||
seekBar.setProgress(0);
|
||||
updateMutedVolumeIcon();
|
||||
} else {
|
||||
updateUnmutedVolumeIcon();
|
||||
}
|
||||
mTitleIcon.setVisibility(View.VISIBLE);
|
||||
mVolumeValueText.setVisibility(View.GONE);
|
||||
mController.logInteractionAdjustVolume(device);
|
||||
mIsDragging = false;
|
||||
}
|
||||
@@ -444,10 +406,8 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
void updateTitleIcon(@DrawableRes int id, int color) {
|
||||
mTitleIcon.setImageDrawable(mContext.getDrawable(id));
|
||||
mTitleIcon.setImageTintList(ColorStateList.valueOf(color));
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorSeekbarProgress()));
|
||||
}
|
||||
mIconAreaLayout.setBackgroundTintList(
|
||||
ColorStateList.valueOf(mController.getColorSeekbarProgress()));
|
||||
}
|
||||
|
||||
void updateIconAreaClickListener(View.OnClickListener listener) {
|
||||
@@ -475,24 +435,18 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
(ClipDrawable) ((LayerDrawable) mSeekBar.getProgressDrawable())
|
||||
.findDrawableByLayerId(android.R.id.progress);
|
||||
final GradientDrawable targetBackgroundDrawable =
|
||||
(GradientDrawable) (mController.isAdvancedLayoutSupported()
|
||||
? mIconAreaLayout.getBackground()
|
||||
: clipDrawable.getDrawable());
|
||||
(GradientDrawable) (mIconAreaLayout.getBackground());
|
||||
mCornerAnimator.addUpdateListener(animation -> {
|
||||
float value = (float) animation.getAnimatedValue();
|
||||
layoutBackgroundDrawable.setCornerRadius(value);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
if (toProgress == 0) {
|
||||
targetBackgroundDrawable.setCornerRadius(value);
|
||||
} else {
|
||||
targetBackgroundDrawable.setCornerRadii(new float[]{
|
||||
value,
|
||||
value,
|
||||
0, 0, 0, 0, value, value
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (toProgress == 0) {
|
||||
targetBackgroundDrawable.setCornerRadius(value);
|
||||
} else {
|
||||
targetBackgroundDrawable.setCornerRadii(new float[]{
|
||||
value,
|
||||
value,
|
||||
0, 0, 0, 0, value, value
|
||||
});
|
||||
}
|
||||
});
|
||||
mVolumeAnimator.setIntValues(fromProgress, toProgress);
|
||||
@@ -539,9 +493,7 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
protected void disableSeekBar() {
|
||||
mSeekBar.setEnabled(false);
|
||||
mSeekBar.setOnTouchListener((v, event) -> true);
|
||||
if (mController.isAdvancedLayoutSupported()) {
|
||||
updateIconAreaClickListener(null);
|
||||
}
|
||||
updateIconAreaClickListener(null);
|
||||
}
|
||||
|
||||
private void enableSeekBar(MediaDevice device) {
|
||||
|
||||
@@ -270,10 +270,8 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
|
||||
dismiss();
|
||||
});
|
||||
mAppButton.setOnClickListener(mMediaOutputController::tryToLaunchMediaApplication);
|
||||
if (mMediaOutputController.isAdvancedLayoutSupported()) {
|
||||
mMediaMetadataSectionLayout.setOnClickListener(
|
||||
mMediaOutputController::tryToLaunchMediaApplication);
|
||||
}
|
||||
mMediaMetadataSectionLayout.setOnClickListener(
|
||||
mMediaOutputController::tryToLaunchMediaApplication);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,7 +83,6 @@ import com.android.systemui.animation.ActivityLaunchAnimator;
|
||||
import com.android.systemui.animation.DialogLaunchAnimator;
|
||||
import com.android.systemui.broadcast.BroadcastSender;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.media.nearby.NearbyMediaDevicesManager;
|
||||
import com.android.systemui.monet.ColorScheme;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
@@ -132,8 +131,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
private final Object mMediaDevicesLock = new Object();
|
||||
@VisibleForTesting
|
||||
final List<MediaDevice> mGroupMediaDevices = new CopyOnWriteArrayList<>();
|
||||
@VisibleForTesting
|
||||
final List<MediaDevice> mMediaDevices = new CopyOnWriteArrayList<>();
|
||||
final List<MediaDevice> mCachedMediaDevices = new CopyOnWriteArrayList<>();
|
||||
private final List<MediaItem> mMediaItemList = new CopyOnWriteArrayList<>();
|
||||
private final AudioManager mAudioManager;
|
||||
@@ -229,7 +226,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
void start(@NonNull Callback cb) {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
mCachedMediaDevices.clear();
|
||||
mMediaDevices.clear();
|
||||
mMediaItemList.clear();
|
||||
}
|
||||
mNearbyDeviceInfoMap.clear();
|
||||
@@ -277,7 +273,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
mLocalMediaManager.stopScan();
|
||||
synchronized (mMediaDevicesLock) {
|
||||
mCachedMediaDevices.clear();
|
||||
mMediaDevices.clear();
|
||||
mMediaItemList.clear();
|
||||
}
|
||||
if (mNearbyMediaDevicesManager != null) {
|
||||
@@ -308,10 +303,9 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
|
||||
@Override
|
||||
public void onDeviceListUpdate(List<MediaDevice> devices) {
|
||||
boolean isListEmpty =
|
||||
isAdvancedLayoutSupported() ? mMediaItemList.isEmpty() : mMediaDevices.isEmpty();
|
||||
boolean isListEmpty = mMediaItemList.isEmpty();
|
||||
if (isListEmpty || !mIsRefreshing) {
|
||||
buildMediaDevices(devices);
|
||||
buildMediaItems(devices);
|
||||
mCallback.onDeviceListChanged();
|
||||
} else {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
@@ -326,11 +320,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
public void onSelectedDeviceStateChanged(MediaDevice device,
|
||||
@LocalMediaManager.MediaDeviceState int state) {
|
||||
mCallback.onRouteChanged();
|
||||
if (isAdvancedLayoutSupported()) {
|
||||
mMetricLogger.logOutputItemSuccess(device.toString(), new ArrayList<>(mMediaItemList));
|
||||
} else {
|
||||
mMetricLogger.logOutputSuccess(device.toString(), new ArrayList<>(mMediaDevices));
|
||||
}
|
||||
mMetricLogger.logOutputItemSuccess(device.toString(), new ArrayList<>(mMediaItemList));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -341,11 +331,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
@Override
|
||||
public void onRequestFailed(int reason) {
|
||||
mCallback.onRouteChanged();
|
||||
if (isAdvancedLayoutSupported()) {
|
||||
mMetricLogger.logOutputItemFailure(new ArrayList<>(mMediaItemList), reason);
|
||||
} else {
|
||||
mMetricLogger.logOutputFailure(new ArrayList<>(mMediaDevices), reason);
|
||||
}
|
||||
mMetricLogger.logOutputItemFailure(new ArrayList<>(mMediaItemList), reason);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,7 +350,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
}
|
||||
try {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
mMediaDevices.removeIf(MediaDevice::isMutingExpectedDevice);
|
||||
mMediaItemList.removeIf((MediaItem::isMutingExpectedDevice));
|
||||
}
|
||||
mAudioManager.cancelMuteAwaitConnection(mAudioManager.getMutingExpectedDevice());
|
||||
@@ -569,7 +554,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
|
||||
void refreshDataSetIfNeeded() {
|
||||
if (mNeedRefresh) {
|
||||
buildMediaDevices(mCachedMediaDevices);
|
||||
buildMediaItems(mCachedMediaDevices);
|
||||
mCallback.onDeviceListChanged();
|
||||
mNeedRefresh = false;
|
||||
}
|
||||
@@ -619,75 +604,9 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
return mItemMarginEndSelectable;
|
||||
}
|
||||
|
||||
private void buildMediaDevices(List<MediaDevice> devices) {
|
||||
if (isAdvancedLayoutSupported()) {
|
||||
buildMediaItems(devices);
|
||||
} else {
|
||||
buildDefaultMediaDevices(devices);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildDefaultMediaDevices(List<MediaDevice> devices) {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
attachRangeInfo(devices);
|
||||
Collections.sort(devices, Comparator.naturalOrder());
|
||||
// For the first time building list, to make sure the top device is the connected
|
||||
// device.
|
||||
if (mMediaDevices.isEmpty()) {
|
||||
boolean needToHandleMutingExpectedDevice =
|
||||
hasMutingExpectedDevice() && !isCurrentConnectedDeviceRemote();
|
||||
final MediaDevice connectedMediaDevice =
|
||||
needToHandleMutingExpectedDevice ? null
|
||||
: getCurrentConnectedMediaDevice();
|
||||
if (connectedMediaDevice == null) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "No connected media device or muting expected device exist.");
|
||||
}
|
||||
if (needToHandleMutingExpectedDevice) {
|
||||
for (MediaDevice device : devices) {
|
||||
if (device.isMutingExpectedDevice()) {
|
||||
mMediaDevices.add(0, device);
|
||||
} else {
|
||||
mMediaDevices.add(device);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mMediaDevices.addAll(devices);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (MediaDevice device : devices) {
|
||||
if (TextUtils.equals(device.getId(), connectedMediaDevice.getId())) {
|
||||
mMediaDevices.add(0, device);
|
||||
} else {
|
||||
mMediaDevices.add(device);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// To keep the same list order
|
||||
final List<MediaDevice> targetMediaDevices = new ArrayList<>();
|
||||
for (MediaDevice originalDevice : mMediaDevices) {
|
||||
for (MediaDevice newDevice : devices) {
|
||||
if (TextUtils.equals(originalDevice.getId(), newDevice.getId())) {
|
||||
targetMediaDevices.add(newDevice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetMediaDevices.size() != devices.size()) {
|
||||
devices.removeAll(targetMediaDevices);
|
||||
targetMediaDevices.addAll(devices);
|
||||
}
|
||||
mMediaDevices.clear();
|
||||
mMediaDevices.addAll(targetMediaDevices);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildMediaItems(List<MediaDevice> devices) {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
if (!isRouteProcessSupported() || (isRouteProcessSupported()
|
||||
&& !mLocalMediaManager.isPreferenceRouteListingExist())) {
|
||||
if (!mLocalMediaManager.isPreferenceRouteListingExist()) {
|
||||
attachRangeInfo(devices);
|
||||
Collections.sort(devices, Comparator.naturalOrder());
|
||||
}
|
||||
@@ -811,18 +730,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
&& (currentConnectedMediaDevice.isHostForOngoingSession());
|
||||
}
|
||||
|
||||
public boolean isAdvancedLayoutSupported() {
|
||||
return mFeatureFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT);
|
||||
}
|
||||
|
||||
public boolean isRouteProcessSupported() {
|
||||
return mFeatureFlags.isEnabled(Flags.OUTPUT_SWITCHER_ROUTES_PROCESSING);
|
||||
}
|
||||
|
||||
public boolean isSubStatusSupported() {
|
||||
return mFeatureFlags.isEnabled(Flags.OUTPUT_SWITCHER_DEVICE_STATUS);
|
||||
}
|
||||
|
||||
List<MediaDevice> getGroupMediaDevices() {
|
||||
final List<MediaDevice> selectedDevices = getSelectedMediaDevice();
|
||||
final List<MediaDevice> selectableDevices = getSelectableMediaDevice();
|
||||
@@ -867,10 +774,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
});
|
||||
}
|
||||
|
||||
Collection<MediaDevice> getMediaDevices() {
|
||||
return mMediaDevices;
|
||||
}
|
||||
|
||||
public List<MediaItem> getMediaItemList() {
|
||||
return mMediaItemList;
|
||||
}
|
||||
@@ -957,19 +860,11 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback,
|
||||
|
||||
boolean isAnyDeviceTransferring() {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
if (isAdvancedLayoutSupported()) {
|
||||
for (MediaItem mediaItem : mMediaItemList) {
|
||||
if (mediaItem.getMediaDevice().isPresent()
|
||||
&& mediaItem.getMediaDevice().get().getState()
|
||||
== LocalMediaManager.MediaDeviceState.STATE_CONNECTING) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (MediaDevice device : mMediaDevices) {
|
||||
if (device.getState() == LocalMediaManager.MediaDeviceState.STATE_CONNECTING) {
|
||||
return true;
|
||||
}
|
||||
for (MediaItem mediaItem : mMediaItemList) {
|
||||
if (mediaItem.getMediaDevice().isPresent()
|
||||
&& mediaItem.getMediaDevice().get().getState()
|
||||
== LocalMediaManager.MediaDeviceState.STATE_CONNECTING) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import static android.media.RouteListingPreference.Item.SUBTEXT_SUBSCRIPTION_REQ
|
||||
|
||||
import static com.android.settingslib.media.MediaDevice.SelectionBehavior.SELECTION_BEHAVIOR_GO_TO_APP;
|
||||
import static com.android.settingslib.media.MediaDevice.SelectionBehavior.SELECTION_BEHAVIOR_NONE;
|
||||
import static com.android.settingslib.media.MediaDevice.SelectionBehavior.SELECTION_BEHAVIOR_TRANSFER;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -94,10 +95,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(false);
|
||||
when(mMediaOutputController.isSubStatusSupported()).thenReturn(false);
|
||||
when(mMediaOutputController.getMediaItemList()).thenReturn(mMediaItems);
|
||||
when(mMediaOutputController.getMediaDevices()).thenReturn(mMediaDevices);
|
||||
when(mMediaOutputController.hasAdjustVolumeUserRestriction()).thenReturn(false);
|
||||
when(mMediaOutputController.isAnyDeviceTransferring()).thenReturn(false);
|
||||
when(mMediaOutputController.getDeviceIconCompat(mMediaDevice1)).thenReturn(mIconCompat);
|
||||
@@ -126,85 +124,24 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getItemCount_containExtraOneForPairNew() {
|
||||
assertThat(mMediaOutputAdapter.getItemCount()).isEqualTo(mMediaDevices.size() + 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getItemId_validPosition_returnCorrespondingId() {
|
||||
assertThat(mMediaOutputAdapter.getItemId(0)).isEqualTo(mMediaDevices.get(
|
||||
0).getId().hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getItemId_invalidPosition_returnPosition() {
|
||||
int invalidPosition = mMediaDevices.size() + 1;
|
||||
assertThat(mMediaOutputAdapter.getItemId(invalidPosition)).isEqualTo(invalidPosition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_getItemCount_returnsMediaItemSize() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void getItemCount_returnsMediaItemSize() {
|
||||
assertThat(mMediaOutputAdapter.getItemCount()).isEqualTo(mMediaItems.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_getItemId_validPosition_returnCorrespondingId() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void getItemId_validPosition_returnCorrespondingId() {
|
||||
assertThat(mMediaOutputAdapter.getItemId(0)).isEqualTo(mMediaItems.get(
|
||||
0).getMediaDevice().get().getId().hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_getItemId_invalidPosition_returnPosition() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void getItemId_invalidPosition_returnPosition() {
|
||||
int invalidPosition = mMediaItems.size() + 1;
|
||||
assertThat(mMediaOutputAdapter.getItemId(invalidPosition)).isEqualTo(invalidPosition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBindViewHolder_bindPairNew_verifyView() {
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 2);
|
||||
|
||||
assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mTitleText.getText()).isEqualTo(mContext.getText(
|
||||
R.string.media_output_dialog_pairing_new));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBindViewHolder_bindGroup_withSessionName_verifyView() {
|
||||
when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(mMediaDevices);
|
||||
when(mMediaOutputController.getSessionName()).thenReturn(TEST_SESSION_NAME);
|
||||
mMediaOutputAdapter.getItemCount();
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
|
||||
|
||||
assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBindViewHolder_bindGroup_noSessionName_verifyView() {
|
||||
when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(mMediaDevices);
|
||||
when(mMediaOutputController.getSessionName()).thenReturn(null);
|
||||
mMediaOutputAdapter.getItemCount();
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
|
||||
|
||||
assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_bindPairNew_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
|
||||
mMediaOutputAdapter.updateItems();
|
||||
mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
|
||||
@@ -222,8 +159,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_bindGroup_withSessionName_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onBindViewHolder_bindGroup_withSessionName_verifyView() {
|
||||
when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(
|
||||
mMediaItems.stream().map((item) -> item.getMediaDevice().get()).collect(
|
||||
Collectors.toList()));
|
||||
@@ -243,8 +179,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_bindGroup_noSessionName_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onBindViewHolder_bindGroup_noSessionName_verifyView() {
|
||||
when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(
|
||||
mMediaItems.stream().map((item) -> item.getMediaDevice().get()).collect(
|
||||
Collectors.toList()));
|
||||
@@ -277,8 +212,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_bindNonRemoteConnectedDevice_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onBindViewHolder_bindNonRemoteConnectedDevice_verifyView() {
|
||||
when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
|
||||
mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
|
||||
.onCreateViewHolder(new LinearLayout(mContext), 0);
|
||||
@@ -294,8 +228,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_bindConnectedRemoteDevice_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onBindViewHolder_bindConnectedRemoteDevice_verifyView() {
|
||||
when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
|
||||
ImmutableList.of(mMediaDevice2));
|
||||
when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
|
||||
@@ -314,8 +247,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_bindSingleConnectedRemoteDevice_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onBindViewHolder_bindSingleConnectedRemoteDevice_verifyView() {
|
||||
when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
|
||||
ImmutableList.of());
|
||||
when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
|
||||
@@ -347,8 +279,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onBindViewHolder_isMutingExpectedDevice_verifyView() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onBindViewHolder_isMutingExpectedDevice_verifyView() {
|
||||
when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(true);
|
||||
when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false);
|
||||
when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
|
||||
@@ -449,8 +380,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void subStatusSupported_onBindViewHolder_bindHostDeviceWithOngoingSession_verifyView() {
|
||||
when(mMediaOutputController.isSubStatusSupported()).thenReturn(true);
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
when(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(true);
|
||||
when(mMediaDevice1.isHostForOngoingSession()).thenReturn(true);
|
||||
when(mMediaDevice1.hasSubtext()).thenReturn(true);
|
||||
@@ -480,8 +409,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
public void subStatusSupported_onBindViewHolder_bindDeviceRequirePremium_verifyView() {
|
||||
String deviceStatus = (String) mContext.getText(
|
||||
R.string.media_output_status_require_premium);
|
||||
when(mMediaOutputController.isSubStatusSupported()).thenReturn(true);
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
when(mMediaDevice2.hasSubtext()).thenReturn(true);
|
||||
when(mMediaDevice2.getSubtext()).thenReturn(SUBTEXT_SUBSCRIPTION_REQUIRED);
|
||||
when(mMediaDevice2.getSubtextString()).thenReturn(deviceStatus);
|
||||
@@ -506,8 +433,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
public void subStatusSupported_onBindViewHolder_bindDeviceWithAdPlaying_verifyView() {
|
||||
String deviceStatus = (String) mContext.getText(
|
||||
R.string.media_output_status_try_after_ad);
|
||||
when(mMediaOutputController.isSubStatusSupported()).thenReturn(true);
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
when(mMediaDevice2.hasSubtext()).thenReturn(true);
|
||||
when(mMediaDevice2.getSubtext()).thenReturn(SUBTEXT_AD_ROUTING_DISALLOWED);
|
||||
when(mMediaDevice2.getSubtextString()).thenReturn(deviceStatus);
|
||||
@@ -531,8 +456,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void subStatusSupported_onBindViewHolder_bindDeviceWithOngoingSession_verifyView() {
|
||||
when(mMediaOutputController.isSubStatusSupported()).thenReturn(true);
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
when(mMediaDevice1.hasSubtext()).thenReturn(true);
|
||||
when(mMediaDevice1.getSubtext()).thenReturn(SUBTEXT_CUSTOM);
|
||||
when(mMediaDevice1.getSubtextString()).thenReturn(TEST_CUSTOM_SUBTEXT);
|
||||
@@ -603,15 +526,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void onItemClick_clickPairNew_verifyLaunchBluetoothPairing() {
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 2);
|
||||
mViewHolder.mContainerLayout.performClick();
|
||||
|
||||
verify(mMediaOutputController).launchBluetoothPairing(mViewHolder.mContainerLayout);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onItemClick_clickPairNew_verifyLaunchBluetoothPairing() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
|
||||
mMediaOutputAdapter.updateItems();
|
||||
mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
|
||||
@@ -629,6 +543,12 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
when(mMediaOutputController.isCurrentOutputDeviceHasSessionOngoing()).thenReturn(false);
|
||||
assertThat(mMediaDevice2.getState()).isEqualTo(
|
||||
LocalMediaManager.MediaDeviceState.STATE_DISCONNECTED);
|
||||
when(mMediaDevice2.getSelectionBehavior()).thenReturn(SELECTION_BEHAVIOR_TRANSFER);
|
||||
mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
|
||||
mMediaOutputAdapter.updateItems();
|
||||
mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
|
||||
.onCreateViewHolder(new LinearLayout(mContext), 0);
|
||||
mMediaOutputAdapter.getItemCount();
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 1);
|
||||
mViewHolder.mContainerLayout.performClick();
|
||||
@@ -641,7 +561,13 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
when(mMediaOutputController.isCurrentOutputDeviceHasSessionOngoing()).thenReturn(true);
|
||||
assertThat(mMediaDevice2.getState()).isEqualTo(
|
||||
LocalMediaManager.MediaDeviceState.STATE_DISCONNECTED);
|
||||
when(mMediaDevice2.getSelectionBehavior()).thenReturn(SELECTION_BEHAVIOR_TRANSFER);
|
||||
mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
|
||||
mMediaOutputAdapter.updateItems();
|
||||
mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
|
||||
.onCreateViewHolder(new LinearLayout(mContext), 0);
|
||||
MediaOutputAdapter.MediaDeviceViewHolder spyMediaDeviceViewHolder = spy(mViewHolder);
|
||||
mMediaOutputAdapter.getItemCount();
|
||||
|
||||
mMediaOutputAdapter.onBindViewHolder(spyMediaDeviceViewHolder, 0);
|
||||
mMediaOutputAdapter.onBindViewHolder(spyMediaDeviceViewHolder, 1);
|
||||
@@ -665,20 +591,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onItemClick_clicksSelectableDevice_triggerGrouping() {
|
||||
List<MediaDevice> selectableDevices = new ArrayList<>();
|
||||
selectableDevices.add(mMediaDevice2);
|
||||
when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(selectableDevices);
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 1);
|
||||
|
||||
mViewHolder.mContainerLayout.performClick();
|
||||
|
||||
verify(mMediaOutputController).addDeviceToPlayMedia(mMediaDevice2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onGroupActionTriggered_clicksEndAreaOfSelectableDevice_triggerGrouping() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onGroupActionTriggered_clicksEndAreaOfSelectableDevice_triggerGrouping() {
|
||||
List<MediaDevice> selectableDevices = new ArrayList<>();
|
||||
selectableDevices.add(mMediaDevice2);
|
||||
when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(selectableDevices);
|
||||
@@ -692,8 +605,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onGroupActionTriggered_clickSelectedRemoteDevice_triggerUngrouping() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
public void onGroupActionTriggered_clickSelectedRemoteDevice_triggerUngrouping() {
|
||||
when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
|
||||
ImmutableList.of(mMediaDevice2));
|
||||
when(mMediaOutputController.getDeselectableMediaDevice()).thenReturn(
|
||||
@@ -710,21 +622,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void onItemClick_onGroupActionTriggered_verifySeekbarDisabled() {
|
||||
when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(mMediaDevices);
|
||||
List<MediaDevice> selectableDevices = new ArrayList<>();
|
||||
selectableDevices.add(mMediaDevice1);
|
||||
when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(selectableDevices);
|
||||
when(mMediaOutputController.hasAdjustVolumeUserRestriction()).thenReturn(true);
|
||||
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
|
||||
|
||||
mViewHolder.mContainerLayout.performClick();
|
||||
|
||||
assertThat(mViewHolder.mSeekBar.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onItemClick_onGroupActionTriggered_verifySeekbarDisabled() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(
|
||||
mMediaItems.stream().map((item) -> item.getMediaDevice().get()).collect(
|
||||
Collectors.toList()));
|
||||
@@ -767,7 +664,6 @@ public class MediaOutputAdapterTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void updateItems_controllerItemsUpdated_notUpdatesInAdapterUntilUpdateItems() {
|
||||
when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true);
|
||||
mMediaOutputAdapter.updateItems();
|
||||
List<MediaItem> updatedList = new ArrayList<>();
|
||||
updatedList.add(new MediaItem());
|
||||
|
||||
@@ -76,7 +76,6 @@ import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.animation.ActivityLaunchAnimator;
|
||||
import com.android.systemui.animation.DialogLaunchAnimator;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.media.nearby.NearbyMediaDevicesManager;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.settings.UserTracker;
|
||||
@@ -200,8 +199,6 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
mNotifCollection, mDialogLaunchAnimator,
|
||||
Optional.of(mNearbyMediaDevicesManager), mAudioManager, mPowerExemptionManager,
|
||||
mKeyguardManager, mFlags, mUserTracker);
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(false);
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ROUTES_PROCESSING)).thenReturn(false);
|
||||
mLocalMediaManager = spy(mMediaOutputController.mLocalMediaManager);
|
||||
when(mLocalMediaManager.isPreferenceRouteListingExist()).thenReturn(false);
|
||||
mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
|
||||
@@ -401,25 +398,10 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
assertThat(mMediaDevices.get(0).getId()).isEqualTo(TEST_DEVICE_1_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeviceListUpdate_verifyDeviceListCallback() {
|
||||
mMediaOutputController.start(mCb);
|
||||
reset(mCb);
|
||||
|
||||
mMediaOutputController.onDeviceListUpdate(mMediaDevices);
|
||||
final List<MediaDevice> devices = new ArrayList<>(mMediaOutputController.getMediaDevices());
|
||||
|
||||
assertThat(devices.containsAll(mMediaDevices)).isTrue();
|
||||
assertThat(devices.size()).isEqualTo(mMediaDevices.size());
|
||||
verify(mCb).onDeviceListChanged();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void routeProcessSupport_onDeviceListUpdate_preferenceExist_NotUpdatesRangeInformation()
|
||||
throws RemoteException {
|
||||
when(mLocalMediaManager.isPreferenceRouteListingExist()).thenReturn(true);
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ROUTES_PROCESSING)).thenReturn(true);
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(true);
|
||||
mMediaOutputController.start(mCb);
|
||||
reset(mCb);
|
||||
|
||||
@@ -431,8 +413,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advanced_onDeviceListUpdate_verifyDeviceListCallback() {
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(true);
|
||||
public void onDeviceListUpdate_verifyDeviceListCallback() {
|
||||
mMediaOutputController.start(mCb);
|
||||
reset(mCb);
|
||||
|
||||
@@ -453,7 +434,6 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void advanced_onDeviceListUpdateWithConnectedDeviceRemote_verifyItemSize() {
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(true);
|
||||
when(mMediaDevice1.getFeatures()).thenReturn(
|
||||
ImmutableList.of(MediaRoute2Info.FEATURE_REMOTE_PLAYBACK));
|
||||
when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice1);
|
||||
@@ -477,7 +457,6 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void advanced_categorizeMediaItems_withSuggestedDevice_verifyDeviceListSize() {
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(true);
|
||||
when(mMediaDevice1.isSuggestedDevice()).thenReturn(true);
|
||||
when(mMediaDevice2.isSuggestedDevice()).thenReturn(false);
|
||||
|
||||
@@ -515,7 +494,6 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void advanced_onDeviceListUpdate_isRefreshing_updatesNeedRefreshToTrue() {
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(true);
|
||||
mMediaOutputController.start(mCb);
|
||||
reset(mCb);
|
||||
mMediaOutputController.mIsRefreshing = true;
|
||||
@@ -717,7 +695,6 @@ public class MediaOutputControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void isAnyDeviceTransferring_advancedLayoutSupport() {
|
||||
when(mFlags.isEnabled(Flags.OUTPUT_SWITCHER_ADVANCED_LAYOUT)).thenReturn(true);
|
||||
when(mMediaDevice1.getState()).thenReturn(
|
||||
LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
|
||||
mMediaOutputController.start(mCb);
|
||||
|
||||
Reference in New Issue
Block a user