欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Android 9.0 去掉系统ANR弹框

程序员文章站 2022-11-01 15:52:17
// ---- End P Constants, all P constants go above this line ----diff --git a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.ja......

 
     // ---- End P Constants, all P constants go above this line ----
diff --git a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
index 383e58a7cf934f65332a417e1ff47a3c29d8fc0b..85745dac4c6cfb60c31c525b65ff8fbb49742139 100644
--- a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -727,7 +727,7 @@ public class ActivityManagerService extends IActivityManager.Stub
     // Whether we should show our dialogs (ANR, crash, etc) or just perform their
     // default action automatically.  Important for devices without direct input
     // devices.
-    private boolean mShowDialogs = true;
+    private boolean mShowDialogs = false;
 
     private final VrController mVrController;
 
diff --git a/frameworks/base/services/core/java/com/android/server/am/AppErrors.java b/frameworks/base/services/core/java/com/android/server/am/AppErrors.java
index 5ad359ca75c823c30475df61267010090d65f9fa..4f6621d07eda1aff103aacd7d36b21fe7f4e4566 100644
--- a/frameworks/base/services/core/java/com/android/server/am/AppErrors.java
+++ b/frameworks/base/services/core/java/com/android/server/am/AppErrors.java
@@ -854,7 +854,7 @@ public class AppErrors {
                     mAppsNotReportingCrashes.contains(proc.info.packageName);
             if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced
                     && (showFirstCrash || showFirstCrashDevOption || data.repeating)) {
-                proc.crashDialog = dialogToShow = new AppErrorDialog(mContext, mService, data);
+             //   proc.crashDialog = dialogToShow = new AppErrorDialog(mContext, mService, data);
                 /// M: CTA requirement - permission error dialog @{
                 String exceptionMsg = "";
                 if (proc.crashingReport != null) {
@@ -878,7 +878,7 @@ public class AppErrors {
         // If we've created a crash dialog, show it without the lock held
         if (dialogToShow != null) {
             Slog.i(TAG, "Showing crash dialog for package " + packageName + " u" + userId);
-            dialogToShow.show();
+         //   dialogToShow.show();
         }
     }
 
@@ -1177,7 +1177,7 @@ public class AppErrors {
         }
         // If we've created a crash dialog, show it without the lock held
         if (dialogToShow != null) {
-            dialogToShow.show();
+       //     dialogToShow.show();
         }
     }
 

 

本文地址:https://blog.csdn.net/qwertyuiop159158/article/details/112534088