Fix output switcher will display previous media session
Before this CL, the same request code will cause intent to be cached. It will cause the output switcher to display the previous media session. This CL uses the package name as an unique request code to fix this issue. Bug: 169077753 Test: make -j42 RunSettingsRoboTests Change-Id: Iebfc7904609e243d5bf0222307bae98a952a3331
This commit is contained in:
@@ -257,9 +257,11 @@ public class MediaOutputSlice implements CustomSliceable {
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.putExtra(MediaOutputSliceConstants.EXTRA_PACKAGE_NAME,
|
||||
getWorker().getPackageName());
|
||||
|
||||
final int requestCode = TextUtils.isEmpty(getWorker().getPackageName())
|
||||
? 0
|
||||
: getWorker().getPackageName().hashCode();
|
||||
return SliceAction.createDeeplink(
|
||||
PendingIntent.getActivity(mContext, 0 /* requestCode */, intent, 0 /* flags */),
|
||||
PendingIntent.getActivity(mContext, requestCode, intent, 0 /* flags */),
|
||||
IconCompat.createWithResource(mContext, R.drawable.ic_add_blue_24dp),
|
||||
ListBuilder.ICON_IMAGE,
|
||||
mContext.getText(R.string.add));
|
||||
|
Reference in New Issue
Block a user