需求
屏蔽系统的crash和anr弹窗
原理
在frameworks/base/services/core/java/com/android/server/am/AppErrors.java的handleShowAppErrorUi方法中做是否屏蔽判断mSystemConfiguration.hideCrashWindow() , 以及ActivityTaskManagerService.java的mShowDialogs属性
实现
frameworks/base/services/core/java/com/android/server/am/AppErrors.java
void handleShowAppErrorUi(Message msg) {
AppErrorDialog.Data data = (AppErrorDialog.Data) msg.obj;.......
if ((mService.mAtmInternal.canShowErrorDialogs() || showBackground)
&& !crashSilenced && !shouldThottle
&& (showFirstCrash || showFirstCrashDevOption || data.repeating)
&& !mSystemConfiguration.hideCrashWindow()) {
Slog.i(TAG, "Showin