android7.0后對於detected problems with app native libraries提示框顯示


log信息:

03-27 09:08:25.887   397   400 W linker  : /data/app/com.guagua.qiqi-1/lib/arm/libMedia.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
03-27 09:08:26.807   397   400 W linker  : /data/app/com.guagua.qiqi-1/lib/arm/libMedia.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

此log信息在android早期版本也會存在,但是在UI上不會有任何提示。

在7.0和7.1有新加如下的code:

/frameworks/base/core/java/android/app/Activity.java

final void performStart(){
...
6689
6690        // This property is set for all builds except final release
6691        boolean isDlwarningEnabled = SystemProperties.getInt("ro.bionic.ld.warning", 0) == 1;
6692        boolean isAppDebuggable =
6693                (mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
6694
6695        if (isAppDebuggable || isDlwarningEnabled) {
6696            String dlwarning = getDlWarning();
6697            if (dlwarning != null) {
6698                String appName = getApplicationInfo().loadLabel(getPackageManager())
6699                        .toString();
6700                String warning = "Detected problems with app native libraries\n" +
6701                                 "(please consult log for detail):\n" + dlwarning;
6702                if (isAppDebuggable) {
6703                      new AlertDialog.Builder(this).
6704                          setTitle(appName).
6705                          setMessage(warning).
6706                          setPositiveButton(android.R.string.ok, null).
6707                          setCancelable(false).
6708                          show();
6709                } else {
6710                    Toast.makeText(this, appName + "\n" + warning, Toast.LENGTH_LONG).show();
6711                }
6712            }
6713        }

對於有dlwarning的app,如果此app是debuggable模式或系統ro.bionic.ld.warning屬性為1,那么會給app提示(以對話框的方式),需要完善或優化so庫。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM