当前位置: 首页 > news >正文

修复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>

相关文章:

  • 【android bluetooth 框架分析 02】【Module详解 6】【StorageModule 模块介绍】
  • 关于 js:8. 反调试与混淆识别
  • 基于javaweb的SpringBoot酒店管理系统设计与实现(源码+文档+部署讲解)
  • [51单片机]---DS18B20 温度检测
  • MYSQL 的缓存策略(四)
  • python视频拆帧并根据所选区域保存指定区域
  • Memcached 的特性和使用场景介绍,以及集群搭建
  • 基于机器学习的卫星钟差预测方法研究HPSO-BP
  • 腾讯发布数字人框架MuseTalk 1.5,开放训练逻辑,生成效果进一步优化~
  • MCP Server多节点滚动升级一致性治理
  • 爆肝整理!软件测试面试题整理(项目+接口问题)
  • 2025年真实面试问题汇总(二)
  • 如何检测和解决服务器端口被占用的问题
  • 分布式异步强化学习框架训练32B大模型:INTELLECT-2
  • vue2将文字转为拼音
  • 【Python生活】如何构建一个跌倒检测的算法?
  • 8天Python从入门到精通【itheima】-6~10
  • 蓝桥杯 10. 全球变暖
  • H5S视频平台-Ascend昇腾 GPU转码
  • 双种群进化算法:动态约束处理与资源分配解决约束多目标优化问题
  • 上海北外滩,未来五年将如何“长个子”“壮筋骨”?
  • 科普|揭秘女性压力性尿失禁的真相
  • 体坛联播|安切洛蒂执掌巴西男足,字母哥尝试离开雄鹿
  • 科创板年内第3家!健信超导IPO获受理,拟募资8.65亿
  • 何谓“战略稳定”:“长和平”的实现基础与机制
  • IPO周报|本周A股暂无新股网上申购,年内最低价股周二上市