From df4d4721ceaf9c330a920587abb94103707d6d29 Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Tue, 25 Mar 2025 18:54:30 +0100 Subject: [PATCH] make IntentFilter.match() actually functional --- src/api-impl/android/content/IntentFilter.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/api-impl/android/content/IntentFilter.java b/src/api-impl/android/content/IntentFilter.java index 7d4fae06..9c677c56 100644 --- a/src/api-impl/android/content/IntentFilter.java +++ b/src/api-impl/android/content/IntentFilter.java @@ -52,6 +52,10 @@ public class IntentFilter { dataSchemes.add(dataScheme); } + public void addDataAuthority(String host, String port) {} + + public void addDataPath(String path, int type) {} + public boolean hasDataScheme(String dataScheme) { return dataSchemes.contains(dataScheme); } @@ -73,6 +77,17 @@ public class IntentFilter { } public int match(String action, String type, String scheme, Uri data, Set categories, String logTag) { - return -1/*NO_MATCH_TYPE*/; + int ret = 0; + if (!matchAction(action)) { + ret = -3/*NO_MATCH_ACTION*/; + } + if (scheme == null) { + ret = 0x00100000/*MATCH_CATEGORY_EMPTY*/ | 0x00008000/*MATCH_ADJUSTMENT_NORMAL*/; + } else if (hasDataScheme(scheme)) { + ret = 0x00200000/*MATCH_CATEGORY_SCHEME*/ | 0x00008000/*MATCH_ADJUSTMENT_NORMAL*/; + } else { + ret = -2/*NO_MATCH_DATA*/; + } + return ret; } }