文章目录
开发平台基本信息
芯片: QCM6125
版本: Android 13
kernel: msm-4.14
问题描述
祖传的系统升级服务,还是用的静态广播注册,但是,在Android8.1之后,应用向静态注册的广播发送广播,系统是无法接收到的,要么就是改为动态注册广播,要么就是使用setComponent参数。但是呢,既不想去动祖传代码,又不想让应用做做多余的操作;所以,就只能动系统,去掉静态广播无法收到的限制。
解决方法
java
--- a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -13608,7 +13608,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|| TelephonyManager.ACTION_REQUEST_OMADM_CONFIGURATION_UPDATE.equals(action)
|| SuggestionSpan.ACTION_SUGGESTION_PICKED.equals(action)
|| AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION.equals(action)
- || AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION.equals(action)) {
+ || AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION.equals(action)
+ || true) {
// Broadcast is either protected, or it's a public action that
// we've relaxed, so it's fine for system internals to send.
return;
--- a/frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -1788,7 +1788,7 @@ public final class BroadcastQueue {
Slog.w(TAG, "Background execution not allowed: receiving "
+ r.intent + " to "
+ component.flattenToShortString());
- skip = true;
+ skip = false;
}
}
}