概述
--- a/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -921,6 +924,33 @@ public final class BroadcastQueue {
// restart the application.
}
+ // app not started, do not start if thirdpart app at these intents.
+ boolean disableKeepAlive = SystemProperties.getBoolean("persist.sys.disable_keepalive", true);
+ if (disableKeepAlive) {
+ String action = r.intent.getAction();
+ ApplicationInfo appInfo = info.activityInfo.applicationInfo;
+ Slog.d(TAG, "action "+action+" app:"+appInfo);
+ if (appInfo != null && (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
+ Slog.d(TAG, "Not system app!!! [" + action + "] app=" + app );
+
+ if (action.equals("android.net.conn.CONNECTIVITY_CHANGE") ||
+ action.equals("android.intent.action.BOOT_COMPLETED") ||
+ action.equals("android.intent.action.MEDIA_MOUNTED") ||
+ action.equals("android.intent.action.MEDIA_REMOVED") ||
+ action.equals("android.intent.action.TIME_TICK") ||
+ action.equals("android.intent.action.MEDIA_UNMOUNTED") ||
+ action.equals("android.intent.action.MEDIA_BAD_REMOVAL") ||
+ action.equals("android.intent.action.MEDIA_SHARED")
+ ) {
+ logBroadcastReceiverDiscardLocked(r);
+ finishReceiverLocked(r, r.resultCode, r.resultData,
+ r.resultExtras, r.resultAbort, false);
+ scheduleBroadcastsLocked();
+ r.state = BroadcastRecord.IDLE;
+ return;
+ }
+ }
+ }
// Not running -- get it started, to be executed when the app comes up.
if (DEBUG_BROADCAST) Slog.v(TAG,
"Need to start app ["
最后
以上就是要减肥信封为你收集整理的优化第三方应用被kill后接收广播自启的全部内容,希望文章能够帮你解决优化第三方应用被kill后接收广播自启所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复