Fixed hearing aid icon not showing in bottom actions when selected + updated earpiece icon in device list to match

This commit is contained in:
Sylvain Berfini 2025-03-18 11:45:52 +01:00
parent 16555429c4
commit 4a742f6e6e
5 changed files with 27 additions and 8 deletions

View file

@ -139,8 +139,14 @@ class CoreContext
)
}
Log.i("$TAG Reloading sound devices in 500ms")
postOnCoreThreadDelayed({ core.reloadSoundDevices() }, 500)
if (telecomManager.getCurrentlyFollowedCalls() <= 0) {
Log.i("$TAG No call found in Telecom's CallsManager, reloading sound devices in 500ms")
postOnCoreThreadDelayed({ core.reloadSoundDevices() }, 500)
} else {
Log.i(
"$TAG At least one active call in Telecom's CallsManager, let it handle the added device(s)"
)
}
}
}
@ -158,7 +164,7 @@ class CoreContext
postOnCoreThreadDelayed({ core.reloadSoundDevices() }, 500)
} else {
Log.i(
"$TAG At least one active call in Telecom's CallsManager, let it handle the removed device"
"$TAG At least one active call in Telecom's CallsManager, let it handle the removed device(s)"
)
}
}

View file

@ -127,12 +127,12 @@ class TelecomCallControlCallback(
Log.i("$TAG New available audio endpoints list")
if (availableEndpoints != list) {
Log.i(
"$TAG List size of available audio endpoints has changed, reload sound devices in SDK"
"$TAG List size of available audio endpoints has changed, reload sound devices in SDK in 500ms"
)
coreContext.postOnCoreThread { core ->
coreContext.postOnCoreThreadDelayed({ core ->
core.reloadSoundDevices()
Log.i("$TAG Sound devices reloaded")
}
}, 500)
}
availableEndpoints = list
@ -167,6 +167,7 @@ class TelecomCallControlCallback(
}
CallEndpointCompat.Companion.TYPE_BLUETOOTH -> {
route.add(AudioDevice.Type.Bluetooth)
route.add(AudioDevice.Type.HearingAid)
}
CallEndpointCompat.Companion.TYPE_WIRED_HEADSET -> {
route.add(AudioDevice.Type.Headphones)

View file

@ -111,6 +111,8 @@ class CurrentCallViewModel
val isHeadsetEnabled = MutableLiveData<Boolean>()
val isHearingAidEnabled = MutableLiveData<Boolean>()
val isBluetoothEnabled = MutableLiveData<Boolean>()
val fullScreenMode = MutableLiveData<Boolean>()
@ -278,6 +280,7 @@ class CurrentCallViewModel
updateEncryption()
}
@WorkerThread
override fun onAuthenticationTokenVerified(call: Call, verified: Boolean) {
Log.w(
"$TAG Notified that authentication token is [${if (verified) "verified" else "not verified!"}]"
@ -291,11 +294,13 @@ class CurrentCallViewModel
updateAvatarModelSecurityLevel(verified)
}
@WorkerThread
override fun onRemoteRecording(call: Call, recording: Boolean) {
Log.i("$TAG Remote recording changed: $recording")
isRemoteRecordingEvent.postValue(Event(Pair(recording, displayedName.value.orEmpty())))
}
@WorkerThread
override fun onStatsUpdated(call: Call, stats: CallStats) {
callStatsModel.update(call, stats)
}
@ -414,6 +419,7 @@ class CurrentCallViewModel
}
private val coreListener = object : CoreListenerStub() {
@WorkerThread
override fun onCallStateChanged(
core: Core,
call: Call,
@ -495,6 +501,11 @@ class CurrentCallViewModel
unreadMessagesCount.postValue(0)
}
}
@WorkerThread
override fun onAudioDevicesListUpdated(core: Core) {
Log.i("$TAG Audio devices list has been updated")
}
}
@WorkerThread
@ -1235,6 +1246,7 @@ class CurrentCallViewModel
isHeadsetEnabled.postValue(
audioDevice?.type == AudioDevice.Type.Headphones || audioDevice?.type == AudioDevice.Type.Headset
)
isHearingAidEnabled.postValue(audioDevice?.type == AudioDevice.Type.HearingAid)
isBluetoothEnabled.postValue(audioDevice?.type == AudioDevice.Type.Bluetooth)
updateProximitySensor()

View file

@ -101,7 +101,7 @@
android:layout_height="@dimen/call_button_size"
android:layout_marginEnd="16dp"
android:padding="@dimen/call_button_icon_padding"
android:src="@{viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}"
android:src="@{viewModel.isHearingAidEnabled ? @drawable/ear : viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}"
android:background="@drawable/in_call_button_background_red"
android:contentDescription="@string/content_description_change_output_audio_device"
app:tint="@color/in_call_button_tint_color"

View file

@ -22,7 +22,7 @@
android:textColor="@color/in_call_label_color"
android:gravity="center_vertical"
android:layout_marginBottom="1dp"
android:drawableEnd="@{model.type == Type.Speaker ? @drawable/speaker_high : model.type == Type.Bluetooth || model.type == Type.HearingAid ? @drawable/bluetooth : model.type == Type.Headphones || model.type == Type.Headset ? @drawable/headset : @drawable/ear, default=@drawable/speaker_high}"
android:drawableEnd="@{model.type == Type.HearingAid ? @drawable/ear : model.type == Type.Speaker ? @drawable/speaker_high : model.type == Type.Bluetooth ? @drawable/bluetooth : model.type == Type.Headphones || model.type == Type.Headset ? @drawable/headset : @drawable/speaker_slash, default=@drawable/speaker_high}"
android:drawableTint="@color/in_call_label_color"
android:checked="@{model.isCurrentlySelected}"
app:useMaterialThemeColors="false"