Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afe8e4eb authored by Paul Thomson's avatar Paul Thomson
Browse files

Revert "Allow protected or sticky broadcsts without flags."

This reverts commit b625c1a7.

Reason for revert: DroidMonitor: Potential culprit for Bug b/207179875 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Ief823fa2bbcf1bb06115a00a74f9a847919568e1
parent b625c1a7
Loading
Loading
Loading
Loading
+23 −31
Original line number Original line Diff line number Diff line
@@ -12662,17 +12662,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                        "Receiver can't specify both RECEIVER_EXPORTED and RECEIVER_NOT_EXPORTED"
                        "Receiver can't specify both RECEIVER_EXPORTED and RECEIVER_NOT_EXPORTED"
                                + "flag");
                                + "flag");
            }
            }
            if (CompatChanges.isChangeEnabled(DYNAMIC_RECEIVER_EXPLICIT_EXPORT_REQUIRED,
            // Don't enforce the flag check if we're EITHER registering for only protected
                    callingUid)
            // broadcasts, or the receiver is null (a sticky broadcast). Sticky broadcasts should
                    && !explicitExportStateDefined) {
            // not be used generally, so we will be marking them as exported by default
            final boolean requireExplicitFlagForDynamicReceivers = CompatChanges.isChangeEnabled(
                    DYNAMIC_RECEIVER_EXPLICIT_EXPORT_REQUIRED, callingUid);
            if (!onlyProtectedBroadcasts) {
                if (receiver == null && !explicitExportStateDefined) {
                    // sticky broadcast, no flag specified (flag isn't required)
                    flags |= Context.RECEIVER_EXPORTED;
                } else if (requireExplicitFlagForDynamicReceivers && !explicitExportStateDefined) {
                if (ENFORCE_DYNAMIC_RECEIVER_EXPLICIT_EXPORT) {
                if (ENFORCE_DYNAMIC_RECEIVER_EXPLICIT_EXPORT) {
                    throw new SecurityException(
                    throw new SecurityException(
                            callerPackage + ": Targeting T+ (version "
                            callerPackage + ": Targeting T+ (version "
@@ -12690,12 +12682,12 @@ public class ActivityManagerService extends IActivityManager.Stub
                    // Assume default behavior-- flag check is not enforced
                    // Assume default behavior-- flag check is not enforced
                    flags |= Context.RECEIVER_EXPORTED;
                    flags |= Context.RECEIVER_EXPORTED;
                }
                }
                } else if (!requireExplicitFlagForDynamicReceivers) {
            } else if (!CompatChanges.isChangeEnabled(DYNAMIC_RECEIVER_EXPLICIT_EXPORT_REQUIRED,
                    callingUid)) {
                // Change is not enabled, thus not targeting T+. Assume exported.
                // Change is not enabled, thus not targeting T+. Assume exported.
                flags |= Context.RECEIVER_EXPORTED;
                flags |= Context.RECEIVER_EXPORTED;
            }
            }
        }
        }
        }
        // Dynamic receivers are exported by default for versions prior to T
        // Dynamic receivers are exported by default for versions prior to T
        final boolean exported = (flags & Context.RECEIVER_EXPORTED) != 0;
        final boolean exported = (flags & Context.RECEIVER_EXPORTED) != 0;
@@ -12711,7 +12703,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                        (intent.getFlags() & Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS) == 0) {
                        (intent.getFlags() & Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS) == 0) {
                    continue;
                    continue;
                }
                }
                // If intent has scheme "content", it will need to access
                // If intent has scheme "content", it will need to acccess
                // provider that needs to lock mProviderMap in ActivityThread
                // provider that needs to lock mProviderMap in ActivityThread
                // and also it may need to wait application response, so we
                // and also it may need to wait application response, so we
                // cannot lock ActivityManagerService here.
                // cannot lock ActivityManagerService here.