diff options
| author | 2023-03-07 08:13:42 +0000 | |
|---|---|---|
| committer | 2023-03-07 08:13:42 +0000 | |
| commit | c5c1a3b7abf42e44faeb4a10c376f9b08dfb703c (patch) | |
| tree | 5c91563a594e0c8fc314b78bfa014f70e770945f | |
| parent | a6b032d1366705713bf837225569c1b6b53e06e2 (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index af9b2beb998a..50066eec9928 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -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); |