Intent的data Uri 解析
如下方法:intent.data=Uri.parse(“content://telephony/carriers”);
方法解析是在:
public @Nullable String resolveType(@NonNull Context context)
这里的规则:content匹配的话就继续往下,获取getAuthority:telephony。
查找manifest定义的privoder。在根据里面的getType获取对应的真实type。
<provider android:name="TelephonyProvider"
android:authorities="telephony"
android:exported="true"
android:singleUser="true"
android:multiprocess="false" />
这个解析的type在startActivty的时候会作为:resolveType传入,匹配隐式intent的时候使用。
上面的Uri解析出来是:vnd.android.cursor.dir/telephony-carrier。
所以匹配miniType的时候就要去找:vnd.android.cursor.dir/telephony-carrier
代码在intent.java里面。

本文详细讲解了如何通过Uri.parse解析content://telephony/carriers,并介绍了TelephonyProvider的manifest配置。重点在于理解Intent中resolveType的运用,涉及隐式Intent匹配过程和miniType的定位。
295

被折叠的 条评论
为什么被折叠?



