Merge "One final attempt at patching over ASEC mess."
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 65678fc..7185420 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -22299,13 +22299,14 @@
             // default permission exceptions lazily to ensure we don't hit the
             // disk on a new user creation.
             mDefaultPermissionPolicy.scheduleReadDefaultPermissionExceptions();
-        } else {
-            // Since we granted default permissions above, we need an update
-            // pass to apply those changes.
-            synchronized (mPackages) {
-                updatePermissionsLPw(null, null, StorageManager.UUID_PRIVATE_INTERNAL,
-                        UPDATE_PERMISSIONS_ALL);
-            }
+        }
+
+        // Now that we've scanned all packages, and granted any default
+        // permissions, ensure permissions are updated. Beware of dragons if you
+        // try optimizing this.
+        synchronized (mPackages) {
+            updatePermissionsLPw(null, null, StorageManager.UUID_PRIVATE_INTERNAL,
+                    UPDATE_PERMISSIONS_ALL);
         }
 
         // Kick off any messages waiting for system ready