jenkins-bot has submitted this change and it was merged.

Change subject: Fix launching URLs in external browser for API 23.
......................................................................


Fix launching URLs in external browser for API 23.

In API 23, once an app is set as the "default" for handing a certain Uri,
then the app will be the only one returned by the queryIntentActivities()
function, which breaks the expected behavior of this function in previous
APIs.

We fix this issue by explicitly setting a temporary Uri when querying
intent activities, to ensure that we get the default system browser
activities.

Bug: T132192
Change-Id: Ic7f2deccf6f327bf69bd240d9ceb8356cdd959c4
---
M app/src/main/java/org/wikipedia/util/ShareUtil.java
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Niedzielski: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app/src/main/java/org/wikipedia/util/ShareUtil.java 
b/app/src/main/java/org/wikipedia/util/ShareUtil.java
index ea24584..ff27af0 100644
--- a/app/src/main/java/org/wikipedia/util/ShareUtil.java
+++ b/app/src/main/java/org/wikipedia/util/ShareUtil.java
@@ -194,7 +194,11 @@
                                             @NonNull Intent targetIntent,
                                             String packageNameBlacklistRegex) {
         List<Intent> intents = new ArrayList<>();
-        for (ResolveInfo intentActivity : queryIntentActivities(targetIntent, 
context)) {
+        Intent queryIntent = new Intent(targetIntent);
+        if (targetIntent.getAction().equals(Intent.ACTION_VIEW)) {
+            queryIntent.setData(Uri.parse("http://example.com";));
+        }
+        for (ResolveInfo intentActivity : queryIntentActivities(queryIntent, 
context)) {
             if (!isIntentActivityBlacklisted(intentActivity, 
packageNameBlacklistRegex)) {
                 intents.add(buildLabeledIntent(targetIntent, intentActivity));
             }

-- 
To view, visit https://gerrit.wikimedia.org/r/282412
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic7f2deccf6f327bf69bd240d9ceb8356cdd959c4
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to