Index: customtabs/src/android/support/customtabs/CustomTabsClient.java |
diff --git a/customtabs/src/android/support/customtabs/CustomTabsClient.java b/customtabs/src/android/support/customtabs/CustomTabsClient.java |
index 5d7bb9b040a31fb21e4c97ad07e7282216d17810..4a42acc81b6b71e8d85e7f60a38f4a4918b71cb9 100644 |
--- a/customtabs/src/android/support/customtabs/CustomTabsClient.java |
+++ b/customtabs/src/android/support/customtabs/CustomTabsClient.java |
@@ -98,7 +98,7 @@ public class CustomTabsClient { |
Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://")); |
if (!ignoreDefault) { |
- ResolveInfo defaultViewHandlerInfo = pm.resolveActivity(activityIntent, 0); |
+ ResolveInfo defaultViewHandlerInfo = getDefaultHandlerForIntent(pm, activityIntent); |
if (defaultViewHandlerInfo != null) { |
String packageName = defaultViewHandlerInfo.activityInfo.packageName; |
packageNames = new ArrayList<String>(packageNames.size() + 1); |
@@ -248,4 +248,13 @@ public class CustomTabsClient { |
return null; |
} |
} |
+ |
+ /** |
+ * Returns the default handler for given intent. |
+ * @param pm {@link PackageManager} to use for retriving the handlers. |
+ * @param intent {@link Intent} to be handled. |
+ */ |
+ public static ResolveInfo getDefaultHandlerForIntent(PackageManager pm, Intent intent) { |
Yusuf
2017/07/14 05:35:34
I know I said to do this, but now that we have it
ltian
2017/07/14 22:15:02
Done.
|
+ return pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); |
+ } |
} |