Android第三方应用无法接收到开机广播

--- a/services/core/java/com/android/server/am/ActivityManagerService.java

+++ b/services/core/java/com/android/server/am/ActivityManagerService.java

@@ -16727,7 +16727,7 @@ public final class ActivityManagerService extends ActivityManagerNative

        intent = new Intent(intent);

        // By default broadcasts do not go to stopped apps.

-        intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);

+        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);

        // If we have not finished booting, don't allow this to launch new processes.

        if (!mProcessesReady && (intent.getFlags()&Intent.FLAG_RECEIVER_BOOT_UPGRADE) == 0) {

diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java

index 844e3901cd4..5c92179f1ca 100755

--- a/services/core/java/com/android/server/pm/PackageManagerService.java

+++ b/services/core/java/com/android/server/pm/PackageManagerService.java

@@ -9761,7 +9761,7 @@ public class PackageManagerService extends IPackageManager.Stub {

            IActivityManager am = ActivityManagerNative.getDefault();

            final boolean isSystem =

                    isSystemApp(pkgSetting) || isUpdatedSystemApp(pkgSetting);

-            if (isSystem && am.isUserRunning(userId, false)) {

+            //if (isSystem && am.isUserRunning(userId, false)) {

                // The just-installed/enabled app is bundled on the system, so presumed

                // to be able to run automatically without needing an explicit launch.

                // Send it a BOOT_COMPLETED if it would ordinarily have gotten one.

@@ -9770,7 +9770,7 @@ public class PackageManagerService extends IPackageManager.Stub {

                        .setPackage(packageName);

                am.broadcastIntent(null, bcIntent, null, null, 0, null, null, null,

                        android.app.AppOpsManager.OP_NONE, null, false, false, userId);

-            }

+            //}

        } catch (RemoteException e) {

            // shouldn't happen

            Slog.w(TAG, "Unable to bootstrap installed package", e);

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容