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库。

转载于:https://www.cnblogs.com/jason207489550/p/6743486.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值