修复aosp中QQ无法跳转到短信的问题
修改AOSP代码
android.content.IntentFilter#matchData(java.lang.String, java.lang.String, android.net.Uri, boolean)
/*** Variant of {@link #matchData(String, String, Uri)} that allows wildcard matching* of the provided type, scheme, host and path parameters.* @param wildcardSupported if true, will allow parameters to use wildcards*/private int matchData(String type, String scheme, Uri data, boolean wildcardSupported) {final boolean wildcardWithMimegroups = wildcardSupported && countMimeGroups() != 0;final List<String> types = mDataTypes;final ArrayList<String> schemes = mDataSchemes;int match = MATCH_CATEGORY_EMPTY;if (!wildcardWithMimegroups && types == null && schemes == null) {return ((type == null && data == null)? (MATCH_CATEGORY_EMPTY+MATCH_ADJUSTMENT_NORMAL) : NO_MATCH_DATA);}if (schemes != null) {if (schemes.contains(scheme != null ? scheme : "")|| wildcardSupported && WILDCARD.equals(scheme)) {match = MATCH_CATEGORY_SCHEME;} else {// 增加这个判断条件if (types != null && findMimeType(type)) {match = MATCH_CATEGORY_TYPE;} else {return NO_MATCH_DATA;}}。。。。。。省略其他代码}
。。。。。。省略其他代码}
在短信类中添加条件过滤
if (intent.action == Intent.ACTION_VIEW && intent.type == "vnd.android-dir/mms-sms") {phoneNumber = intent.extras?.getString("address") ?: ""message = intent.extras?.getString("sms_body") ?: ""
}
manifest注册文件中添加类型
<intent-filter><action android:name="android.intent.action.SEND" /><action android:name="android.intent.action.SENDTO" /><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="sms" /><data android:scheme="smsto" /><data android:scheme="mms" /><data android:scheme="mmsto" />// 添加类型<data android:mimeType="vnd.android-dir/mms-sms" /></intent-filter>