Skip to content

Commit 1ed91f7

Browse files
ascichbgcngm
authored andcommitted
Show the nearby chip for images and files too.
This revealed that we weren't initializing the nearby intent from the original intent, so that's fixed too. This should ensure that flags and extras from the original intent make their way to the available and installed nearby component. Change-Id: I0cac4b1ac63d95b0f0d2ef8d2e614674253c7cb4 Test: Share (an image and a non-image) from DocumentsUI Fixes: 155487375 Fixes: 155676993 Merged-In: If0c0b754a066b0ec439a866de3eae84caca7b793
1 parent 9637d97 commit 1ed91f7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

core/java/com/android/internal/app/ChooserActivity.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ private TargetInfo getNearbySharingTarget(Intent originalIntent) {
930930
final ComponentName cn = getNearbySharingComponent();
931931
if (cn == null) return null;
932932

933-
final Intent resolveIntent = new Intent();
933+
final Intent resolveIntent = new Intent(originalIntent);
934934
resolveIntent.setComponent(cn);
935935
final ResolveInfo ri = getPackageManager().resolveActivity(
936936
resolveIntent, PackageManager.GET_META_DATA);
@@ -1097,6 +1097,13 @@ private ViewGroup displayImageContentPreview(Intent targetIntent, LayoutInflater
10971097
ViewGroup parent) {
10981098
ViewGroup contentPreviewLayout = (ViewGroup) layoutInflater.inflate(
10991099
R.layout.chooser_grid_preview_image, parent, false);
1100+
1101+
1102+
final ViewGroup actionRow =
1103+
(ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row);
1104+
//TODO: addActionButton(actionRow, createCopyButton());
1105+
addActionButton(actionRow, createNearbyButton(targetIntent));
1106+
11001107
mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, true);
11011108

11021109
String action = targetIntent.getAction();
@@ -1207,10 +1214,10 @@ private ViewGroup displayFileContentPreview(Intent targetIntent, LayoutInflater
12071214
ViewGroup contentPreviewLayout = (ViewGroup) layoutInflater.inflate(
12081215
R.layout.chooser_grid_preview_file, parent, false);
12091216

1210-
// TODO(b/120417119): Disable file copy until after moving to sysui,
1211-
// due to permissions issues
1212-
//((ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row))
1213-
// .addView(createCopyButton());
1217+
final ViewGroup actionRow =
1218+
(ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row);
1219+
//TODO(b/120417119): addActionButton(actionRow, createCopyButton());
1220+
addActionButton(actionRow, createNearbyButton(targetIntent));
12141221

12151222
String action = targetIntent.getAction();
12161223
if (Intent.ACTION_SEND.equals(action)) {

0 commit comments

Comments
 (0)