本篇文章主要介绍 Android
开发中的部分GMS
包相关APK ANR
,闪退问题解决方案知识点,通过阅读本篇文章,您将收获以下内容:
一、开机向导时 Google DUO 概率ANR
二、开机向导时 Google Calendar 概率 ANR
三、开机向导时 ANR 弹框不show的解决方案
四、开机向导时 Google Music 概率 ANR
五、开机向导时 Google Play Store 概率 ANR
六、 Google play Store 下载apk 概率性闪退
一、开机向导时 DUO 概率ANR
从Log
中分析主要原因是android.intent.action.LOCALE_CHANGED
广播接收超时导致的ANR
。
1.ANR Log 如下:
ANR Log
2.ANR 规避方案如下:
在BroadcastQueue
类的 processNextBroadcast
方法中,当第一次开机时候,跳过此Action。
3.修改类路径如下:
/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