Skip to content

Conversation

@williscool
Copy link
Owner

@williscool williscool commented Dec 15, 2025

  • docs: commit latest plans cuz why not
  • docs: new rules
  • feat!: update to android 15

Note

Updates app for Android 15 (API 35): adds notification channels, POST_NOTIFICATIONS flow, USE_EXACT_ALARM, explicit component exports, and immutable PendingIntents, with supporting tests and Gradle changes.

  • Android 15 compliance
    • Bump compileSdkVersion/targetSdkVersion to 35 in android/app/build.gradle and android/build.gradle.
    • Add manifest permissions POST_NOTIFICATIONS and USE_EXACT_ALARM.
    • Set explicit android:exported on activities/receivers/services; adjust runtime receiver registration (Context.RECEIVER_NOT_EXPORTED) on 33+.
  • Notifications
    • New notification/NotificationChannels.kt; create channels on app start via GlobalState.
    • All NotificationCompat.Builder calls now supply channel IDs; grouped/summary notifications updated accordingly.
    • New strings for channel names/descriptions.
  • PendingIntent mutability (API 31+)
    • Add pendingIntentFlagCompat() and apply to all PendingIntent usages (notifications, alarms, rescans).
    • Update alarm scheduling/canceling in SystemUtils.kt to use compatible flags.
  • Runtime permissions
    • Add POST_NOTIFICATIONS check/request in PermissionsManager and ui/MainActivity.
  • Modernization/cleanup
    • Remove legacy SDK checks; simplify time/status bar/color handling and calendar queries (CalendarProvider, CalendarIntents, EditEventActivity, ViewEventActivityNoRecents).
  • Tests
    • Add Robolectric tests: NotificationChannelsRobolectricTest, NotificationPermissionRobolectricTest, PendingIntentFlagsRobolectricTest.
  • Build/infra & docs
    • Gradle tweaks (SDK 35, subproject compileSdk workaround) and new planning/docs (.cursor/plans/*, docs/dev_todo/raise_min_sdk.md, rules update).

Written by Cursor Bugbot for commit a0bd611. This will update automatically on new commits. Configure here.

@williscool williscool changed the title refactor/update to android 15 2025 12 14 feat!: update to android 15 2025 12 14 Dec 15, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Permission dialogs may stack causing confusing UX

The checkNotificationPermission() call at line 260 is non-blocking - it either shows an AlertDialog or triggers the system permission request, both of which return immediately. The code then proceeds directly to the battery optimization check at line 263, which may show another AlertDialog. On Android 13+ devices that haven't granted notification permission and haven't dismissed the battery warning, both dialogs can appear simultaneously, stacking on top of each other and confusing users. The battery optimization check needs to be deferred until after the notification permission flow completes.

android/app/src/main/java/com/github/quarck/calnotify/ui/MainActivity.kt#L258-L286

else {
// Check notification permission (Android 13+)
checkNotificationPermission()
// if we have essential permissions - now check for power manager optimisations
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !settings.doNotShowBatteryOptimisationWarning) {
if (!powerManager.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID)) {
AlertDialog.Builder(this)
.setTitle(getString(R.string.battery_optimisation_title))
.setMessage(getString(R.string.battery_optimisation_details))
.setPositiveButton(getString(R.string.you_can_do_it)) @TargetApi(Build.VERSION_CODES.M) {
_, _ ->
val intent = Intent()
.setAction(android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
.setData(Uri.parse("package:" + BuildConfig.APPLICATION_ID))
startActivity(intent)
}
.setNeutralButton(getString(R.string.you_can_do_it_later)) {
_, _ ->
}
.setNegativeButton(getString(R.string.you_cannot_do_it)) {
_, _ ->
settings.doNotShowBatteryOptimisationWarning = true
}
.create()
.show()
}

android/app/src/main/java/com/github/quarck/calnotify/ui/MainActivity.kt#L294-L314

*/
private fun checkNotificationPermission() {
if (!PermissionsManager.hasNotificationPermission(this)) {
if (PermissionsManager.shouldShowNotificationRationale(this)) {
AlertDialog.Builder(this)
.setTitle(R.string.notification_permission_title)
.setMessage(R.string.notification_permission_explanation)
.setCancelable(false)
.setPositiveButton(android.R.string.ok) { _, _ ->
PermissionsManager.requestNotificationPermission(this)
}
.setNegativeButton(R.string.cancel) { _, _ ->
// User declined, they won't get notifications
}
.create()
.show()
} else {
PermissionsManager.requestNotificationPermission(this)
}
}
}

Fix in Cursor Fix in Web


@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Code Coverage Report

Overall Project NaN% NaN% 🍏

There is no coverage information present for the Files changed

@github-actions
Copy link

📊 Code Coverage Summary

Coverage Type Coverage
Overall null
Changed Files 100

View detailed coverage report

maybe kotlin build issue
@github-actions
Copy link

Build artifacts for PR #113 (commit 2b0822c) are available:

You can download these artifacts from the "Artifacts" section of the workflow run.

@github-actions
Copy link

📊 Code Coverage Summary

Coverage Type Coverage
Overall null
Changed Files 100

View detailed coverage report

@github-actions
Copy link

📊 Code Coverage Summary

Coverage Type Coverage
Overall 23.97
Changed Files 18.92

View detailed coverage report

@github-actions
Copy link

Build artifacts for PR #113 (commit 7857e6c) are available:

You can download these artifacts from the "Artifacts" section of the workflow run.

@github-actions
Copy link

📊 Code Coverage Summary

Coverage Type Coverage
Overall 24.02
Changed Files 13.34

View detailed coverage report

@github-actions
Copy link

📊 Code Coverage Summary

Coverage Type Coverage
Overall null
Changed Files 100

View detailed coverage report

@williscool williscool merged commit 16d9889 into master Dec 15, 2025
12 of 15 checks passed
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.

2 participants