Commit af60fc9d authored by Sophey Dong's avatar Sophey Dong Committed by Commit Bot

[Sharing Hub] Add highlighted text to 3rd party app filtering.

Bug: 1079467
Change-Id: I44219c4ff69ffeafaac048784e90dc372a043794
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2330301Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Commit-Queue: Sophey Dong <sophey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793634}
parent 39f14c14
...@@ -28,6 +28,7 @@ import java.lang.annotation.Retention; ...@@ -28,6 +28,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -44,7 +45,7 @@ import java.util.Set; ...@@ -44,7 +45,7 @@ import java.util.Set;
// TODO(crbug/1022172): Should be package-protected once modularization is complete. // TODO(crbug/1022172): Should be package-protected once modularization is complete.
public class ShareSheetPropertyModelBuilder { public class ShareSheetPropertyModelBuilder {
@IntDef({ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.TEXT, @IntDef({ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.TEXT,
ContentType.IMAGE, ContentType.OTHER_FILE_TYPE, ContentType.HIGHLIGHTED_TEXT}) ContentType.IMAGE, ContentType.HIGHLIGHTED_TEXT, ContentType.OTHER_FILE_TYPE})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@interface ContentType { @interface ContentType {
int LINK_PAGE_VISIBLE = 0; int LINK_PAGE_VISIBLE = 0;
...@@ -229,14 +230,14 @@ public class ShareSheetPropertyModelBuilder { ...@@ -229,14 +230,14 @@ public class ShareSheetPropertyModelBuilder {
ShareHelper.getShareLinkAppCompatibilityIntent(), 0); ShareHelper.getShareLinkAppCompatibilityIntent(), 0);
} }
List<ResolveInfo> resolveInfoList = new ArrayList<>(); List<ResolveInfo> resolveInfoList = new ArrayList<>();
if (contentTypes.contains(ContentType.LINK_PAGE_NOT_VISIBLE) if (!Collections.disjoint(contentTypes,
|| contentTypes.contains(ContentType.LINK_PAGE_VISIBLE) Arrays.asList(ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.LINK_PAGE_VISIBLE,
|| contentTypes.contains(ContentType.TEXT)) { ContentType.TEXT, ContentType.HIGHLIGHTED_TEXT))) {
resolveInfoList.addAll(mPackageManager.queryIntentActivities( resolveInfoList.addAll(mPackageManager.queryIntentActivities(
ShareHelper.getShareLinkAppCompatibilityIntent(), 0)); ShareHelper.getShareLinkAppCompatibilityIntent(), 0));
} }
if (contentTypes.contains(ContentType.IMAGE) if (!Collections.disjoint(
|| contentTypes.contains(ContentType.OTHER_FILE_TYPE)) { contentTypes, Arrays.asList(ContentType.IMAGE, ContentType.OTHER_FILE_TYPE))) {
resolveInfoList.addAll(mPackageManager.queryIntentActivities( resolveInfoList.addAll(mPackageManager.queryIntentActivities(
ShareHelper.createShareFileAppCompatibilityIntent(fileContentType), 0)); ShareHelper.createShareFileAppCompatibilityIntent(fileContentType), 0));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment