diff options
author | Yabin Huang <yabinh@google.com> | 2021-06-25 15:13:03 -0700 |
---|---|---|
committer | Yabin Huang <yabinh@google.com> | 2021-06-25 15:17:39 -0700 |
commit | a1dfded1eb9334bd272755b20da8c28438e69e06 (patch) | |
tree | ad8d4aa72f7f5c24180b32816d7e2e6239977dd3 /RotaryPlayground | |
parent | 27751ea8c6470df82e2085ddd30987072445172f (diff) | |
download | tests-a1dfded1eb9334bd272755b20da8c28438e69e06.tar.gz |
Fix a crash when creating PendingIntentandroid-12.0.0_r32android-12.0.0_r29android-12.0.0_r28android-12.0.0_r27android-12.0.0_r26android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android-12.0.0_r16android12-qpr1-releaseandroid12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-releaseandroid12-dev
Targeting S+ (version 31 and above) requires that one of
FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a
PendingIntent. So this CL uses FLAG_IMMUTABLE to create
the PendingIntent because the flag is recommended in most cases.
Fixes: 192103710
Test: manual
Change-Id: Ie736f88ee939774d7e8ef95b91dbcf8e462950ee
Diffstat (limited to 'RotaryPlayground')
-rw-r--r-- | RotaryPlayground/src/com/android/car/rotaryplayground/HeadsUpNotificationFragment.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/RotaryPlayground/src/com/android/car/rotaryplayground/HeadsUpNotificationFragment.java b/RotaryPlayground/src/com/android/car/rotaryplayground/HeadsUpNotificationFragment.java index 0744ac0..97c676e 100644 --- a/RotaryPlayground/src/com/android/car/rotaryplayground/HeadsUpNotificationFragment.java +++ b/RotaryPlayground/src/com/android/car/rotaryplayground/HeadsUpNotificationFragment.java @@ -62,7 +62,8 @@ public class HeadsUpNotificationFragment extends Fragment { */ private Notification createNotification() { Intent intent = new Intent(getContext(), RotaryActivity.class); - PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, 0); + PendingIntent pendingIntent = + PendingIntent.getActivity(getContext(), 0, intent, PendingIntent.FLAG_IMMUTABLE); return new Notification.Builder(getContext(), NOTIFICATION_CHANNEL_ID) .setContentTitle("Example heads-up notification") .setContentText("Try nudging up to HUN") |