fix(core): 停止读取 SIM 运营商信息以满足隐私合规#22
Open
niuweili wants to merge 1 commit into
Open
Conversation
移除 BroadcastReceiverNetworkInfoProvider 中对 TelephonyManager.simCarrierIdName / simCarrierId 的读取。 该路径在运行时本就不可达:此 provider 仅在 API < 24 时启用, 而 carrier 采集分支要求 API ≥ 28,二者互斥,属于死代码。删除后 功能无任何影响,但消除了字节码中被隐私合规静态扫描命中的电信 API 调用,避免被误判为“采集运营商信息”。 同步清理:构造函数移除不再使用的 buildSdkVersionProvider,删除 UNKNOWN_CARRIER_NAME 常量,并移除测试中相应的 API 28+ 用例。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
隐私合规静态扫描会命中
BroadcastReceiverNetworkInfoProvider中对TelephonyManager.simCarrierIdName/simCarrierId的调用,判定为「采集运营商信息」。经核实,该调用在运行时本就不可达:
API < 24(Android 7.0 以下)时被实例化;API ≥ 28(Android 9.0+);但「运行时不可达」消除不了「字节码中存在该 API 调用」这一事实,静态扫描仍会标红。
改动
BroadcastReceiverNetworkInfoProvider中对simCarrierIdName/simCarrierId的读取;buildSdkVersionProvider、删除UNKNOWN_CARRIER_NAME常量;API 28+carrier 用例与相关 mock;影响
零功能影响(运行时本就不采集),但消除了字节码中被隐私合规扫描命中的电信 API 调用。
验证
./gradlew :dd-sdk-android-core:testDebugUnitTest --tests "*BroadcastReceiverNetworkInfoProviderTest"✅ BUILD SUCCESSFUL(JDK 17)。