if (mView == null) {
mView = view;
... ...
if (res < WindowManagerGlobal.ADD_OKAY) {
mAttachInfo.mRootView = null;
mAdded = false;
mFallbackEventHandler.setView(null);
unscheduleTraversals();
setAccessibilityFocus(null, null);
switch (res) {
case WindowManagerGlobal.ADD_BAD_APP_TOKEN:
case WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN:
// add by wangjie for com.google.android.gms.ui crash
int deviceProvisioned = android.provider.Settings.Global.getInt(mContext.getContentResolver(), android.provider.Settings.Global.DEVICE_PROVISIONED,0);
if(deviceProvisioned==0){
android.util.Log.e("wjwj","---ViewRootImpl GMS Crash---");
return;
}else{
throw new WindowManager.BadTokenException(
"Unable to add window -- token " + attrs.token
+ " is not valid; is your activity running?");
}
// add by wangjie for com.google.android.gms.ui crash
case WindowManagerGlobal.ADD_NOT_APP_TOKEN:
throw new WindowManager.BadTokenException(
"Unable to add window -- token " + attrs.token
+ " is not for an application");
... ...
}
}
}
... ...
}
修改差异点如下
![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6L0tOMUZ1NWR6dzhwNTVCdUtjVnZnc1VpY3oxZXExOWxuaWJvd0lXM2xBQzVxZENMaWJld29aZGljSFhONkJuZDdpYTJleGVzSFhZelNsVHIzalAwTUVudDZGaWFRLzY0MA?x-oss-process=image/format,png)
Unable to add window -- token android.os.BinderProxy@f176911 is not valid; is your activity running?
三、setupwizard ConcurrentModificationException Crash
===================================================
1.Crash Log如下:
--------------
--------- beginning of crash
01-01 12:00:00.918 1583 1583 E AndroidRuntime: FATAL EXCEPTION: main
01-01 12:00:00.918 1583 1583 E AndroidRuntime: Process: com.google.android.setupwizard, PID: 1583
01-01 12:00:00.918 1583 1583 E AndroidRuntime: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.TIME_SET flg=0x25200010 } in com.google.android.setupwizard.time.DateTimeMonitor$1@7465601
01-01 12:00:00.918 1583 1583 E AndroidRuntime: at android.app.LoadedApk R e c e i v e r D i s p a t c h e r ReceiverDispatcher ReceiverDispatcherArgs.lambda − a n d r o i d a p p L o a d e d A p k -android_app_LoadedApk −androidappL