Add defer-until-active policy to CONNECTIVITY_ACTION.

This allows deferring the broadcast delivery to apps in
the Cached state.

Bug: 255545931
Test: TH
Change-Id: Idd94ad5f9dbabf88f6070108bdfc8e60f34304a6
This commit is contained in:
Sudheer Shanka 2023-01-24 19:33:06 +00:00
commit 74fe7178af

View file

@ -3082,6 +3082,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
optsShim.setDeliveryGroupPolicy(ConstantsShim.DELIVERY_GROUP_POLICY_MOST_RECENT);
optsShim.setDeliveryGroupMatchingKey(ConnectivityManager.CONNECTIVITY_ACTION,
createDeliveryGroupKeyForConnectivityAction(info));
optsShim.setDeferUntilActive(true);
} catch (UnsupportedApiLevelException e) {
Log.wtf(TAG, "Using unsupported API" + e);
}