Change remote copy intent behavior.

Send to the configured component if one is set, otherwise send to
anything supporting that action. This matches the screnshot editor
behavior.

Test: Manual test with and without the config value set, with single or
multiple apps supporting the action.
Bug: 233252260

Change-Id: I9df93e1268250ff27759802598c2b71014df375e
This commit is contained in:
Matt Casey
2022-05-23 17:02:02 +00:00
parent bf1f22d0a4
commit 43743035b3

View File

@@ -570,12 +570,13 @@ public class ClipboardOverlayController {
}
private Intent getRemoteCopyIntent(ClipData clipData) {
String remoteCopyPackage = mContext.getString(R.string.config_remoteCopyPackage);
if (TextUtils.isEmpty(remoteCopyPackage)) {
return null;
}
Intent nearbyIntent = new Intent(REMOTE_COPY_ACTION);
nearbyIntent.setComponent(ComponentName.unflattenFromString(remoteCopyPackage));
String remoteCopyPackage = mContext.getString(R.string.config_remoteCopyPackage);
if (!TextUtils.isEmpty(remoteCopyPackage)) {
nearbyIntent.setComponent(ComponentName.unflattenFromString(remoteCopyPackage));
}
nearbyIntent.setClipData(clipData);
nearbyIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
nearbyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);