#.IntentFilter匹配规则
<intent-filter>
<action ….. />
<category ….. />
<data ….. />
</intent-filter>
AndroidManifest.xml中
1.Activity的的声明区域中,可以包含多个<intent-filter>;
一个<intent-filter>中可以包含多个action、category、data, 它们有多种组合方式,一个隐式Intent只要匹配其中任意一种组合方式,即匹配了相应的Activity。
2.对于隐式Intent,系统会根据Intent中设置的action/category/data组合,来找出IntentFilter相匹配的Activity集合。犹如你发布了一个招人任务,指明了各项能力需求,hr会帮你找到各项能力都匹配的候选人群。
3.具体匹配规则为,
对于action/data,若Intent手动设置了action/data,则匹配的IntentFilter必须包含此项action/data;若Intent未设置action/data,则匹配的IntentFilter必须未声明任何action/data。
对于category,若Intent手动设置了category,则匹配的IntentFilter必须包含此项category;若Intent未手动设置category, Intent会自动添加android.intnent.category.DEFAULT类型的category,则匹配的IntentFilter必须携带该类型的category才行。
4.Data是指Action对应的数据,它整体由mimeType和URI(统一资源定位