Update delivery groups APIs to return 'BroadcastOptions' instance.

Updating the setDeliveryGroup* APIs to return the 'BroadcastOptions'
instance to allow method chaining.

Bug: 262745127
Test: TH
Change-Id: I203476f65d29d6d23f53745bacfcd51bd589d9d8
This commit is contained in:
Sudheer Shanka
2022-12-15 11:00:23 -08:00
parent 35eb184974
commit 96b600dfea
2 changed files with 16 additions and 7 deletions

View File

@@ -796,9 +796,9 @@ package android.app {
method public static android.app.BroadcastOptions makeBasic();
method @RequiresPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS) public void recordResponseEventWhileInBackground(@IntRange(from=0) long);
method @RequiresPermission(android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND) public void setBackgroundActivityStartsAllowed(boolean);
method public void setDeliveryGroupMatchingFilter(@NonNull android.content.IntentFilter);
method public void setDeliveryGroupMatchingKey(@NonNull String, @NonNull String);
method public void setDeliveryGroupPolicy(int);
method @NonNull public android.app.BroadcastOptions setDeliveryGroupMatchingFilter(@NonNull android.content.IntentFilter);
method @NonNull public android.app.BroadcastOptions setDeliveryGroupMatchingKey(@NonNull String, @NonNull String);
method @NonNull public android.app.BroadcastOptions setDeliveryGroupPolicy(int);
method public void setDontSendToRestrictedApps(boolean);
method public void setPendingIntentBackgroundActivityLaunchAllowed(boolean);
method public void setRequireAllOfPermissions(@Nullable String[]);

View File

@@ -725,8 +725,10 @@ public class BroadcastOptions extends ComponentOptions {
* @hide
*/
@SystemApi
public void setDeliveryGroupPolicy(@DeliveryGroupPolicy int policy) {
@NonNull
public BroadcastOptions setDeliveryGroupPolicy(@DeliveryGroupPolicy int policy) {
mDeliveryGroupPolicy = policy;
return this;
}
/**
@@ -766,12 +768,15 @@ public class BroadcastOptions extends ComponentOptions {
* @hide
*/
@SystemApi
public void setDeliveryGroupMatchingKey(@NonNull String namespace, @NonNull String key) {
@NonNull
public BroadcastOptions setDeliveryGroupMatchingKey(@NonNull String namespace,
@NonNull String key) {
Preconditions.checkArgument(!namespace.contains(":"),
"namespace should not contain ':'");
Preconditions.checkArgument(!key.contains(":"),
"key should not contain ':'");
mDeliveryGroupMatchingKey = namespace + ":" + key;
return this;
}
/**
@@ -813,8 +818,10 @@ public class BroadcastOptions extends ComponentOptions {
* @hide
*/
@SystemApi
public void setDeliveryGroupMatchingFilter(@NonNull IntentFilter matchingFilter) {
@NonNull
public BroadcastOptions setDeliveryGroupMatchingFilter(@NonNull IntentFilter matchingFilter) {
mDeliveryGroupMatchingFilter = Objects.requireNonNull(matchingFilter);
return this;
}
/**
@@ -851,8 +858,10 @@ public class BroadcastOptions extends ComponentOptions {
*
* @hide
*/
public void setDeliveryGroupExtrasMerger(@NonNull BundleMerger extrasMerger) {
@NonNull
public BroadcastOptions setDeliveryGroupExtrasMerger(@NonNull BundleMerger extrasMerger) {
mDeliveryGroupExtrasMerger = Objects.requireNonNull(extrasMerger);
return this;
}
/**