Merge "Add logs to help debug the transfer chip disappearing" into rvc-dev

This commit is contained in:
Robert Snoeberger
2020-04-27 20:06:20 +00:00
committed by Android (Google) Code Review

View File

@@ -245,7 +245,7 @@ public class MediaControlPanel {
// Try to find a browser service component for this app // Try to find a browser service component for this app
// TODO also check for a media button receiver intended for restarting (b/154127084) // TODO also check for a media button receiver intended for restarting (b/154127084)
// Only check if we haven't tried yet or the session token changed // Only check if we haven't tried yet or the session token changed
String pkgName = mController.getPackageName(); final String pkgName = mController.getPackageName();
if (mServiceComponent == null && !mCheckedForResumption) { if (mServiceComponent == null && !mCheckedForResumption) {
Log.d(TAG, "Checking for service component"); Log.d(TAG, "Checking for service component");
PackageManager pm = mContext.getPackageManager(); PackageManager pm = mContext.getPackageManager();
@@ -281,18 +281,22 @@ public class MediaControlPanel {
// Transfer chip // Transfer chip
mSeamless = mMediaNotifView.findViewById(R.id.media_seamless); mSeamless = mMediaNotifView.findViewById(R.id.media_seamless);
if (mSeamless != null && mLocalMediaManager != null) { if (mSeamless != null) {
mSeamless.setVisibility(View.VISIBLE); if (mLocalMediaManager != null) {
updateDevice(mLocalMediaManager.getCurrentConnectedDevice()); mSeamless.setVisibility(View.VISIBLE);
mSeamless.setOnClickListener(v -> { updateDevice(mLocalMediaManager.getCurrentConnectedDevice());
final Intent intent = new Intent() mSeamless.setOnClickListener(v -> {
.setAction(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT) final Intent intent = new Intent()
.putExtra(MediaOutputSliceConstants.EXTRA_PACKAGE_NAME, .setAction(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT)
mController.getPackageName()) .putExtra(MediaOutputSliceConstants.EXTRA_PACKAGE_NAME,
.putExtra(MediaOutputSliceConstants.KEY_MEDIA_SESSION_TOKEN, mToken); mController.getPackageName())
mActivityStarter.startActivity(intent, false, true /* dismissShade */, .putExtra(MediaOutputSliceConstants.KEY_MEDIA_SESSION_TOKEN, mToken);
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mActivityStarter.startActivity(intent, false, true /* dismissShade */,
}); Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
});
} else {
Log.d(TAG, "LocalMediaManager is null. Not binding output chip for pkg=" + pkgName);
}
} }
makeActive(); makeActive();
@@ -543,6 +547,7 @@ public class MediaControlPanel {
deviceName.setText(device.getName()); deviceName.setText(device.getName());
} else { } else {
// Reset to default // Reset to default
Log.d(TAG, "device is null. Not binding output chip.");
iconView.setVisibility(View.GONE); iconView.setVisibility(View.GONE);
deviceName.setText(com.android.internal.R.string.ext_media_seamless_action); deviceName.setText(com.android.internal.R.string.ext_media_seamless_action);
} }