Automated import from //branches/donutburger/...@140828,140828
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 2cf47df..edbb0ce 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -3248,12 +3248,18 @@
                     res.removedInfo.sendBroadcast(false, true);
                     Bundle extras = new Bundle(1);
                     extras.putInt(Intent.EXTRA_UID, res.uid);
-                    if (res.removedInfo.removedPackage != null) {
+                    final boolean update = res.removedInfo.removedPackage != null;
+                    if (update) {
                         extras.putBoolean(Intent.EXTRA_REPLACING, true);
                     }
                     sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED,
                                          res.pkg.applicationInfo.packageName,
                                          extras);
+                    if (update) {
+                        sendPackageBroadcast(Intent.ACTION_PACKAGE_REPLACED,
+                                res.pkg.applicationInfo.packageName,
+                                extras);
+                    }
                 }
                 Runtime.getRuntime().gc();
             }
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 9e2ecba..da567a8 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -10142,11 +10142,7 @@
             // this decision.
             boolean skip = false;
             if (intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) {
-                // If this is replacing an existing package, then we allow it
-                // to see the broadcast for it to restart itself.
-                if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
-                    skip = true;
-                }
+                skip = true;
             } else if (intent.ACTION_PACKAGE_RESTARTED.equals(intent.getAction())) {
                 skip = true;
             } else if (intent.ACTION_PACKAGE_DATA_CLEARED.equals(intent.getAction())) {