Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为 PhoneRomUtils 使用更健壮的反射代码,优化代码效率 #322

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HChenX
Copy link

@HChenX HChenX commented Sep 8, 2024

No description provided.

@getActivity
Copy link
Owner

小伙子,这块的代码确实需要优化,但是这些改动不是我想要的, 目前我已经针对此处的代码进行了优化,还是要多谢小伙子的提醒,特别是 getSystemPropertyByReflect 在 Android 9.0 以上的版本也能进行反射。

@HChenX
Copy link
Author

HChenX commented Sep 8, 2024

我的改动确实是对项目代码的正优化。
build.prop所有者是root,直接读取大概率抛错,所以这里代码是多余的。
你原来的反射没有关闭语言检查,语言检查会带来额外开销,包括开启shell管道也会带来额外开销。
建议直接反射获取prop,并且我的反射工具带有缓存机制,能减少查找开销。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants