栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

android7.1 (rk3399)指定应用崩溃后,系统拉起该应用

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

android7.1 (rk3399)指定应用崩溃后,系统拉起该应用

--- a/frameworks/base/services/core/java/com/android/server/am/AppErrors.java
+++ b/frameworks/base/services/core/java/com/android/server/am/AppErrors.java
@@ -29,6 +29,7 @@ import android.app.AppOpsManager;
 import android.app.ApplicationErrorReport;
 import android.app.Dialog;
 import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
@@ -698,6 +699,7 @@ class AppErrors {
         synchronized (mService) {
             ProcessRecord proc = data.proc;
             AppErrorResult res = data.result;
+            Slog.d(TAG,"packageName = " + data.proc.info.packageName);
             if (proc != null && proc.crashDialog != null) {
                 Slog.e(TAG, "App already has crash dialog: " + proc);
                 if (res != null) {
@@ -731,7 +733,8 @@ class AppErrors {
                                                                                }
             final boolean crashSilenced = mAppsNotReportingCrashes != null &&
                     mAppsNotReportingCrashes.contains(proc.info.packageName);
-            if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced) {
+
+            if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced && !data.proc.info.packageName.equals("com.cloud.smart.agent.service")) {
                 proc.crashDialog = new AppErrorDialog(mContext, mService, data);
             } else {
                 // The device is asleep, so just pretend that the user
@@ -739,6 +742,9 @@ class AppErrors {
                 if (res != null) {
                     res.set(AppErrorDialog.CANT_SHOW);
                 }
+                if (data.proc.info.packageName.equals("com.cloud.smart.agent.service")) {
+                    startAgentService(mContext);
+                 }
             }
         }
         // If we've created a crash dialog, show it without the lock held
@@ -747,6 +753,15 @@ class AppErrors {
         }
     }
 
+    static final void startAgentService(Context context) {
+        Intent intent = new Intent();
+        intent.setComponent(new ComponentName("com.cloud.smart.agent.service", "com.cloud.smart.agent.service.service.SmartAgentService"));
+        //intent.setComponent(new ComponentName("com.example.testapi", "com.example.testapi.MainActivity"));
+        Log.d("vclucster restart", "startAgentService");
+        context.startService(intent);
+        //context.startActivity(intent);
+    }
+

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/666471.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号