diff options
| author | Ricky Wai <rickywai@google.com> | 2022-05-27 14:21:23 +0000 |
|---|---|---|
| committer | Ricky Wai <rickywai@google.com> | 2022-05-27 15:01:33 +0000 |
| commit | 57c032bf43eb4ff26f3035d6bf4cf00edc8a95e4 (patch) | |
| tree | 4381fff710bf5c654d308fc071477826186b2c33 /core/java | |
| parent | b67a965f22247f3982cb3ec31a0232dab27c5dd7 (diff) | |
Only add boolean extra to bundle when the value is false
As the default value is false, we don't need to put it in bundle if the value is false.
Bug: 234070143
Test: atest android.app.cts.BroadcastOptionsTest#testTemporaryAppAllowlistBroadcastOptions_defaultValues
Change-Id: Ia23d2a03f8c3c64d25b47ed9a8d02ae22ce9246b
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ComponentOptions.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/app/ComponentOptions.java b/core/java/android/app/ComponentOptions.java index 58732f015318..4e5e384a2798 100644 --- a/core/java/android/app/ComponentOptions.java +++ b/core/java/android/app/ComponentOptions.java @@ -99,8 +99,10 @@ public class ComponentOptions { public Bundle toBundle() { Bundle b = new Bundle(); b.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, mPendingIntentBalAllowed); - b.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, - mPendingIntentBalAllowedByPermission); + if (mPendingIntentBalAllowedByPermission) { + b.putBoolean(KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED_BY_PERMISSION, + mPendingIntentBalAllowedByPermission); + } return b; } } |
