手机在开机后,有概率出现qickstep anr
通过main log,查找anr 发现;
07-03 14:53:10.395084 1557 1557 D ImsVT Util: onRecevied feature changed phoneId: 1, feature: 1, status: 0
07-03 14:53:10.395459 1557 1599 D ImsVT Util: switchFeatureInternal, feature = -16777216isOn = false
07-03 14:53:10.406055 966 2619 D AES : ExceptionLog: notify aed, process:com.android.launcher3 pid:1646 cause:system_app_anr
07-03 14:53:10.406098 966 2619 W AES : skip for Exp level 0
07-03 14:53:10.451880 2311 2420 D RePlugin.ms-parser:
pid 为:1646 ,cause:system_app_anr
分析events log
查找 pid 1646 发现
07-03 14:52:57.940124 966 983 I am_pss : [1646,10008,com.android.launcher3,30533632,22552576,0,139821056,2,2,67]
07-03 14:52:58.028849 966 983 I am_pss : [1552,10041,com.google.android.gms.persistent,97369088,54759424,0,242229248,2,4,74]
07-03 14:52:58.108234 966 983 I am_pss : [1271,1000,com.android.settings,24253440,18759680,0,122155008,2,18,63]
07-03 14:52:58.201945 966 983 I am_pss : [1530,1000,com.android.deskclock,14680064,10285056,0,104685568,2,18,63]
07-03 14:52:58.270552 966 983 I am_pss : [1730,10018,com.google.android.dialer,23999488,13770752,0,93999104,2,18,60]
07-03 14:52:58.339146 966 983 I am_pss : [2021,10025,com.google.android.partnersetup,6447104,3850240,0,82792448,2,14,60]
07-03 14:52:58.407313 966 983 I am_pss : [1918,10041,com.google.process.gapps,7537664,3719168,0,90046464,2,14,61]
07-03 14:52:58.464204 966 983 I am_pss : [1964,10061,com.android.chrome,16489472,7041024,0,80994304,2,18,55]
07-03 14:52:58.468691 966 984 I am_anr : [0,1646,com.android.launcher3,885767749,executing service com.android.launcher3/com.android.quickstep.TouchInteractionService]
07-03 14:52:58.468000 315 315 I auditd : type=1400 audit(0.0:253): avc: denied { write } for comm="aee_aed" name="tracing_on" dev="tracefs" ino=1070 scontext=u:r:aee_aed:s0 tcontext=u:object_r:debugfs_tracing:s0 tclass=file permissive=0
07-03 14:52:58.528901 966 983 I am_pss : [1975,1000,com.android.keychain,5301248,2760704,0,80433152,2,18,58]
07-03 14:52:58.595113 966 983 I am_pss : [1800,10085,com.android.smspush,5281792,2727936,0,80056320,2,5,60]
07-03 14:52:58.674423 966 983 I am_pss : [1557,1001,com.mediatek.ims,19093504,13299712,0,118251520,2,0,66]
07-03 14:52:58.745133 966 983 I am_pss : [1456,10014,com.google.android.ext.services,6716416,3387392,0,89808896,2,4,60]
07-03 14:52:58.809310 966 983 I am_pss : [1700,1068,com.android.se,5518336,2953216,0,80834560,2,0,58]
07-03 14:52:58.933443 966 983 I am_pss : [1695,1027,com.android.nfc,17113088,13012992,0,110776320,2,0,63]
07-03 14:52:59.011380 966 983 I am_pss : [1676,10042,com.google.android.googlequicksearchbox:interactor,28567552,8327168,0,130703360,2,4,64]
07-03 14:52:59.682292 966 983 I am_pss : [1259,1001,com.android.phone,37395456,30257152,0,144834560,2,0,87]
07-03 14:53:00.068361 966 983 I am_pss : [1120,10015,com.android.systemui,74951680,60864512,0,190590976,2,0,90]
07-03 14:53:00.207046 966 983 I am_pss : [1107,10084,com.google.android.inputmethod.latin,71525376,61792256,0,183468032,2,6,87]
07-03 14:53:00.392010 966 983 I am_pss : [966,1000,system,126214144,108988416,0,269701120,2,0,126]
07-03 14:53:00.484223 966 983 I am_pss : [1646,10008,com.android.launcher3,38275072,30007296,0,149057536,0,2,70]
07-03 14:53:00.531287 966 983 I service_manager_slow: [14,phone]
07-03 14:52:58.468691 966 984 I am_anr : [0,1646,com.android.launcher3,885767749,executing service com.android.launcher3/com.android.quickstep.TouchInteractionService]
发现TouchInteractionService 做成的anr
这个TouchInteractionService 是在systemui 里面启动的,主要是将recent view 移到launcher3里面
具体的启动类为OverviewProxyService.java
private void internalConnectToCurrentUser() {
disconnectFromLauncherService();
// If user has not setup yet or already connected, do not try to connect
if (!mDeviceProvisionedController.isCurrentUserSetup() || !isEnabled()) {
Log.v(TAG_OPS, "Cannot attempt connection, is setup "
+ mDeviceProvisionedController.isCurrentUserSetup() + ", is enabled "
+ isEnabled());
return;
}
mHandler.removeCallbacks(mConnectionRunnable);
Intent launcherServiceIntent = new Intent(ACTION_QUICKSTEP)
.setPackage(mRecentsComponentName.getPackageName());
boolean bound = false;
try {
bound = mContext.bindServiceAsUser(launcherServiceIntent,
mOverviewServiceConnection, Context.BIND_AUTO_CREATE,
UserHandle.of(mDeviceProvisionedController.getCurrentUser()));
} catch (SecurityException e) {
Log.e(TAG_OPS, "Unable to bind because of security error", e);
}
if (bound) {
// Ensure that connection has been established even if it thinks it is bound
mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS);
} else {
// Retry after exponential backoff timeout
final long timeoutMs = (long) Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts);
mHandler.postDelayed(mConnectionRunnable, timeoutMs);
mConnectionBackoffAttempts++;
Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts
+ " will try again in " + timeoutMs + "ms");
}
}
try {
bound = mContext.bindServiceAsUser(launcherServiceIntent,
mOverviewServiceConnection, Context.BIND_AUTO_CREATE,
UserHandle.of(mDeviceProvisionedController.getCurrentUser()));
} catch (SecurityException e) {
Log.e(TAG_OPS, "Unable to bind because of security error", e);
}
if (bound) {
// Ensure that connection has been established even if it thinks it is bound
mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS);
} else {
// Retry after exponential backoff timeout
final long timeoutMs = (long) Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts);
mHandler.postDelayed(mConnectionRunnable, timeoutMs);
mConnectionBackoffAttempts++;
Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts
+ " will try again in " + timeoutMs + "ms");
}
---------------------
作者:王大锤扛刀
来源:CSDN
原文:https://blog.csdn.net/wangjicong_215/article/details/94572944
版权声明:本文为博主原创文章,转载请附上博文链接!
上面的code就是造成anr的原因。具体怎么解决,按项目需求了