mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
make IntentFilter.match() actually functional
This commit is contained in:
parent
5a4f56f4ba
commit
df4d4721ce
1 changed files with 16 additions and 1 deletions
|
@ -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<String> 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue