fix(alarm): silence the fire channel explicitly instead of by omission
Omitting setSound on a NotificationChannel leaves the platform DEFAULT notification sound active — omission is not silence. The v3 channel now calls setSound(null, null) exactly like the pre-notice channel does, so the native STREAM_ALARM player stays the ring's only audible source. Caught by verification against design D4 before any build.
This commit is contained in:
@@ -674,17 +674,21 @@ class PluriWaveAlarmService : Service() {
|
||||
migrateLegacyChannels(context, manager)
|
||||
// Re-create each time (not early-returning when present) so the
|
||||
// localized name/description refresh after a locale change. Android
|
||||
// updates name + description on an existing channel; importance
|
||||
// stays fixed from first creation. No setSound call: this channel
|
||||
// is silent by construction (Requirement: Fire notification posts
|
||||
// with no sound) -- the native MediaPlayer on STREAM_ALARM is the
|
||||
// only audible source, so a channel sound would double it.
|
||||
// updates name + description on an existing channel; importance and
|
||||
// sound stay fixed from first creation. setSound(null, null) is
|
||||
// REQUIRED for silence: omitting the call leaves the platform
|
||||
// DEFAULT notification sound on the channel (same reason the
|
||||
// pre-notice channel calls it explicitly). This channel must be
|
||||
// silent (Requirement: Fire notification posts with no sound) --
|
||||
// the native MediaPlayer on STREAM_ALARM is the only audible
|
||||
// source, so a channel sound would double it.
|
||||
val channel = NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
AlarmNotificationStrings.fireChannelName(context),
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
).apply {
|
||||
description = AlarmNotificationStrings.fireChannelDescription(context)
|
||||
setSound(null, null)
|
||||
enableVibration(true)
|
||||
}
|
||||
manager.createNotificationChannel(channel)
|
||||
|
||||
Reference in New Issue
Block a user