Add defer-until-active policy to DREAMING related broadcasts.

Applying this poicy allows deferring the broadcast delivery to apps
in the Cached state.

Bug: 255526731
Test: atest ./tests/tests/dreams/src/android/service/dreams/cts/DreamServiceTest.java
Test: atest tests/app/BroadcastsTest/src/android/app/cts/broadcasts/BroadcastDeferralTest.java
Change-Id: I2dd983751356a2fde98ea8d628a06151c46697c4
This commit is contained in:
Sudheer Shanka
2023-01-24 17:17:05 -08:00
parent dc0f1da44f
commit b7b8f8123c

View File

@@ -118,6 +118,8 @@ final class DreamController {
// are yet to be delivered.
options.setDeliveryGroupMatchingKey(
DREAMING_DELIVERY_GROUP_NAMESPACE, DREAMING_DELIVERY_GROUP_KEY);
// This allows the broadcast delivery to be delayed to apps in the Cached state.
options.setDeferUntilActive(true);
return options.toBundle();
}