ANR问题解析(三),kotlin第三方库
在BroadcastQueue类的 processNextBroadcast方法中,当第一次开机时候,跳过此Action。
/alps/frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
public final class BroadcastQueue {
… …
final void processNextBroadcastLocked(boolean fromMsg, boolean skipOomAdj) {
BroadcastRecord r;
… …
// import android.provider.Settings;
//when frist boot , ingore Google Duo anr when receive broadcast : android.intent.action.LOCALE_CHANGED
if (info.activityInfo.name.contains (“com.google.android.apps.tachyon”) &&
r.intent.getAction().equals(“android.intent.action.LOCALE_CHANGED”)){
int deviceProvisioned = Settings.Global.getInt(mService.mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
if (deviceProvisioned == 0) {
Slog.e(TAG,“switch users or first boot google duo ANR ignore”);
skip = true;
}
}
// This is safe to do even if we are skipping the broadcast, and we need
// this information now to evaluate whether it is going to be allowed to run.
final int receiverUid = info.activityInfo.applicationInfo.uid;
// If it’s a singleton, it needs to be the same app or a special app
… …
}
… …
}

git 修改记录
==================================================================================

Calendar ANR log
主要原因是 android.intent.action.LOCALE_CHANGED 广播接收超时导致的ANR。
请参考修改一
====================================================================================
刷机或者恢复出厂设置是,开机向导过程中不应该显示ANR。
修改文件路径如下:
frameworks/base/services/core/java/com/android/server/am/AppErrors.java
修改AppErrors 类中 handleShowAnrUi方法,控制在开机向导时ANR弹窗。
class AppErrors {
… …
void handleShowAppErrorUi(Message msg) {
… …
// If we’ve created a crash dialog, show it without the lock held
if (d != null) {
int deviceProvisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED,0);
if(proc.userId == 0){
if(deviceProvisioned == 0 && !proc.processName.equals(“com.google.android.setupwizard”)){
mService.killAppAtUsersRequest(proc, null);
}else{
d.show();
}
} else {
d.show();
}
}
… …
}
… …
}

git 修改差别的
======================================================================================
开机向导时候 接收android.intent.action.LOCALE_CHANGED 广播超时导致的ANR。

ANR Log
请参考修改一
五、开机向导时 Google Play Store 概率 ANR
===========================================================================================
开机向导时候 接收android.intent.action.LOCALE_CHANGED 广播超时导致的ANR。

ANR Log
请参考修改一
更多推荐



所有评论(0)