Dbrant has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/282412

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/12/282412/1

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: newchange
Gerrit-Change-Id: Ic7f2deccf6f327bf69bd240d9ceb8356cdd959c4
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to