ANR 不弹框问题1记录

一. 描述 :

出现大量的CTS fail, 譬如:[Google CTS][13_R4]CtsWindowManagerDeviceTestCases 420 fail.

二. 根本原因:

persist.vendor.aeev.ncore.dump会被设置成enable,导致ro.hw_timeout_multiplier 数据太大,影响了ANR的timeout时间.

三. 代码分析:

     

(1) init.aee.customer.system.rc 文件

    当persist.vendor.aeev.ncore.dump 设置为enable 时,会 将 ro.hw_timeout_multiplier 设置成 10

androidt/vendor/mediatek/proprietary/external/aee/config_external/init.aee.customer.system.rc
on property:persist.vendor.aeev.ncore.dump=enable
     setprop ro.hw_timeout_multiplier 10

(2)Build.java 文件

androidt/frameworks/base/core/java/android/os/Build.java

      /**
       * A multiplier for various timeouts on the system.
       *
       * The intent is that products targeting software emulators that are orders of magnitude slower
       * than real hardware may set this to a large number. On real devices and hardware-accelerated
       * virtualized devices this should not be set.
       *
       * @hide
       */
      public static final int HW_TIMEOUT_MULTIPLIER =
          SystemProperties.getInt("ro.hw_timeout_multiplier", 1);

(3)ActivityManagerService.java文件:

    timeout的时间和HW timeout 时间成正比. 

androidt/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java

      // How long we wait for a launched process to attach to the activity manager
      // before we decide it's never going to come up for real.
      static final int PROC_START_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;

      // How long we allow a receiver to run before giving up on it.
      static final int BROADCAST_FG_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
      static final int BROADCAST_BG_TIMEOUT = 60 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;

      private static final int NATIVE_DUMP_TIMEOUT_MS =
              2000 * Build.HW_TIMEOUT_MULTIPLIER; // 2 seconds;

              case PROC_START_TIMEOUT_MSG: {
                  /// M: ANR Debug Mechanism @{
                  if (mAnrManager.delayMessage(mHandler, msg, PROC_START_TIMEOUT_MSG,
                          PROC_START_TIMEOUT))
                      return; /// @}
                  ProcessRecord app = (ProcessRecord) msg.obj;
                  synchronized (ActivityManagerService.this) {
                      handleProcessStartOrKillTimeoutLocked(app, /* isKillTimeout */ false);
                  }
              } break;

四. 总结:

      从上面的代码可以看出来, 将ro.hw_timeout_multiplier 设置成10, 也就说将timeout 时间扩大了10倍. 所以ANR 很难出现.

五. 解决方案:

      mtk 回复ro.hw_timeout_multiplier属性,已经废弃,注释掉即可.


#on property:persist.vendor.aeev.ncore.dump=enable
#    setprop ro.hw_timeout_multiplier 10
 

    

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值