fix(alarm): declare pendingMissedIntent nullable to stop STOP_NATIVE NPE
cancelAutoSilence calls pendingMissedIntent with FLAG_NO_CREATE, the one Android flag whose entire purpose is to make getBroadcast() return null on no match. The Kotlin signature declared a non-null return type, so the compiler-inserted assertion threw NPE inside onStartCommand, crashing the process before the Dart-side postpone flow could reach its actual +N-minute reschedule call.
This commit is contained in:
@@ -741,7 +741,10 @@ class AlarmScheduler(private val context: Context) {
|
||||
appContext,
|
||||
id,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
)
|
||||
) ?: run {
|
||||
Log.w(tag, "alarm.autoSilence arm failed: pendingMissedIntent returned null id=$id")
|
||||
return
|
||||
}
|
||||
try {
|
||||
alarmManager.setExactAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
|
||||
@@ -286,7 +286,7 @@ class PluriWaveAlarmReceiver : BroadcastReceiver() {
|
||||
private fun requestCode(id: String, slot: Int): Int = 47 * id.hashCode() + slot
|
||||
|
||||
/** Shared PendingIntent factory for the MISSED transition alarm (Decision 3). */
|
||||
fun pendingMissedIntent(context: Context, alarmId: String, flags: Int): PendingIntent =
|
||||
fun pendingMissedIntent(context: Context, alarmId: String, flags: Int): PendingIntent? =
|
||||
PendingIntent.getBroadcast(
|
||||
context,
|
||||
requestCode(alarmId, 4),
|
||||
|
||||
Reference in New Issue
Block a user