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);

你可能感兴趣的:(Android第三方应用无法接收到开机广播)