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)
|
migrateLegacyChannels(context, manager)
|
||||||
// Re-create each time (not early-returning when present) so the
|
// Re-create each time (not early-returning when present) so the
|
||||||
// localized name/description refresh after a locale change. Android
|
// localized name/description refresh after a locale change. Android
|
||||||
// updates name + description on an existing channel; importance
|
// updates name + description on an existing channel; importance and
|
||||||
// stays fixed from first creation. No setSound call: this channel
|
// sound stay fixed from first creation. setSound(null, null) is
|
||||||
// is silent by construction (Requirement: Fire notification posts
|
// REQUIRED for silence: omitting the call leaves the platform
|
||||||
// with no sound) -- the native MediaPlayer on STREAM_ALARM is the
|
// DEFAULT notification sound on the channel (same reason the
|
||||||
// only audible source, so a channel sound would double it.
|
// 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(
|
val channel = NotificationChannel(
|
||||||
CHANNEL_ID,
|
CHANNEL_ID,
|
||||||
AlarmNotificationStrings.fireChannelName(context),
|
AlarmNotificationStrings.fireChannelName(context),
|
||||||
NotificationManager.IMPORTANCE_HIGH
|
NotificationManager.IMPORTANCE_HIGH
|
||||||
).apply {
|
).apply {
|
||||||
description = AlarmNotificationStrings.fireChannelDescription(context)
|
description = AlarmNotificationStrings.fireChannelDescription(context)
|
||||||
|
setSound(null, null)
|
||||||
enableVibration(true)
|
enableVibration(true)
|
||||||
}
|
}
|
||||||
manager.createNotificationChannel(channel)
|
manager.createNotificationChannel(channel)
|
||||||
|
|||||||
Reference in New Issue
Block a user