Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing mutability flags to PendingIntents #1073

Merged
merged 2 commits into from Jan 6, 2022

Conversation

zhaofengli
Copy link
Contributor

Some were missed in #1038. This fixes crashes like:

01-03 13:37:14.347  6732 20592 E AndroidRuntime: FATAL EXCEPTION: AlertService
01-03 13:37:14.347  6732 20592 E AndroidRuntime: Process: li.zhaofeng.etar, PID: 6732
01-03 13:37:14.347  6732 20592 E AndroidRuntime: java.lang.IllegalArgumentException: li.zhaofeng.etar: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
01-03 13:37:14.347  6732 20592 E AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at com.android.calendar.alerts.AlarmScheduler.scheduleAlarm(AlarmScheduler.java:326)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at com.android.calendar.alerts.AlarmScheduler.queryNextReminderAndSchedule(AlarmScheduler.java:288)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at com.android.calendar.alerts.AlarmScheduler.scheduleNextAlarm(AlarmScheduler.java:113)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at com.android.calendar.alerts.AlarmScheduler.scheduleNextAlarm(AlarmScheduler.java:101)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at com.android.calendar.alerts.AlertService.processMessage(AlertService.java:897)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at com.android.calendar.alerts.AlertService$ServiceHandler.handleMessage(AlertService.java:1112)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
01-03 13:37:14.347  6732 20592 E AndroidRuntime: 	at android.os.HandlerThread.run(HandlerThread.java:67)

Android 12 (API 31) now requires SCHEDULE_EXACT_ALARM to be able to
schedule exact alarms.
@zhaofengli
Copy link
Contributor Author

Ok, I added the permission and tested notifications on Android 11 and 12.

@Gitsaibot Gitsaibot merged commit 962114d into Etar-Group:master Jan 6, 2022
@zhaofengli zhaofengli deleted the pi-mutability-flags branch January 6, 2022 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants