Revert "Ignores protected broadcasts if not priv-app"

Revert of I5bd2bf3bd7c38fd9cc563a02b24bc569495d79ed

For now, allow all system apps to declare protected
broadcasts. This will be cleaned up in a future change.

Bug: 158570769

Merged-In: I54d236c0a6daaa934bd64a3bd05e2654e0e868fe
Change-Id: I54d236c0a6daaa934bd64a3bd05e2654e0e868fe
(cherry picked from commit b5e3addc5f27149d1b0bbc213ced47b2ade732bf)
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index bc1a49c..4fad530 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -10873,6 +10873,8 @@
                     ~ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE;
             pkg.applicationInfo.privateFlags &=
                     ~ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE;
+            // clear protected broadcasts
+            pkg.protectedBroadcasts = null;
             // cap permission priorities
             if (pkg.permissionGroups != null && pkg.permissionGroups.size() > 0) {
                 for (int i = pkg.permissionGroups.size() - 1; i >= 0; --i) {
@@ -10881,8 +10883,6 @@
             }
         }
         if ((scanFlags & SCAN_AS_PRIVILEGED) == 0) {
-            // clear protected broadcasts
-            pkg.protectedBroadcasts = null;
             // ignore export request for single user receivers
             if (pkg.receivers != null) {
                 for (int i = pkg.receivers.size() - 1; i >= 0; --i) {