apsun / NekoSMS

A pattern-based text message blocker for Android.
GNU General Public License v3.0
417 stars 44 forks source link

Fix the bug that Android11+ subId is always 0 #89

Closed Hovn closed 2 months ago

Hovn commented 2 years ago

具体BUG: 使用Android11时发现拦截的短信的subId(SIM卡标号)记录均为0。恢复后在系统短信APP中也不显示具体的SIM卡。

修改说明: 1、优化Android v30+ 时subId的附加处理。参见 http://www.aospxref.com/android-11.0.0_r21/xref/frameworks/opt/telephony/src/java/com/android/internal/telephony/InboundSmsHandler.java#1266
2、优化Android v26+从intent中取得subId的方法。

测试结果: image

apsun commented 2 months ago

Sorry for the incredibly late review! I somehow missed this PR :(

The fix seems sensible to me. I wonder if getSubId is actually supposed to do anything at this point - will do some cleanup as a followup. Thanks for the fix!