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

Commit c5c1a3b7 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Apply delivery group policies to CONFIGURATION_CHANGED broadcast.

- The "set-defer-until-active" policy is applied so that the
broadcast targeted to apps in the Cached state is deferred until
they come out of that state.
- The "deliver-most-recent" policy is applied so that if there are
already pending broadcasts waiting to be delivered when a new
broadcast is sent, the old ones are discarded.

Bug: 271961533
Test: TH
Change-Id: I2d243fefac27ca3e358b4c9fff70b9a1a2c5b567
parent a6b032d1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -18139,8 +18139,12 @@ public class ActivityManagerService extends IActivityManager.Stub
                        | Intent.FLAG_RECEIVER_REPLACE_PENDING
                        | Intent.FLAG_RECEIVER_FOREGROUND
                        | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
                final Bundle configChangedOptions = new BroadcastOptions()
                        .setDeliveryGroupPolicy(BroadcastOptions.DELIVERY_GROUP_POLICY_MOST_RECENT)
                        .setDeferUntilActive(true)
                        .toBundle();
                broadcastIntentLocked(null, null, null, intent, null, null, 0, null, null, null,
                        null, null, OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
                        null, null, OP_NONE, configChangedOptions, false, false, MY_PID, SYSTEM_UID,
                        Binder.getCallingUid(), Binder.getCallingPid(), UserHandle.USER_ALL);
                if ((changes & ActivityInfo.CONFIG_LOCALE) != 0) {
                    intent = new Intent(Intent.ACTION_LOCALE_CHANGED);