mirror of
https://github.com/home-assistant/android
synced 2024-10-15 12:32:54 +00:00
Fix phone state sensor only considering 1 subscription's calls (#3803)
This commit is contained in:
parent
477c299272
commit
e3ce9ed5b0
|
@ -84,13 +84,9 @@ class PhoneStateSensorManager : SensorManager {
|
|||
val telephonyManager =
|
||||
context.applicationContext.getSystemService<TelephonyManager>()!!
|
||||
|
||||
val callState = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
telephonyManager.callStateForSubscription
|
||||
} else {
|
||||
// Deprecated function provides state for any call, not for a specific subscription only
|
||||
@Suppress("DEPRECATION")
|
||||
telephonyManager.callState
|
||||
}
|
||||
currentPhoneState = when (callState) {
|
||||
currentPhoneState = when (telephonyManager.callState) {
|
||||
TelephonyManager.CALL_STATE_IDLE -> "idle"
|
||||
TelephonyManager.CALL_STATE_RINGING -> "ringing"
|
||||
TelephonyManager.CALL_STATE_OFFHOOK -> "offhook"
|
||||
|
|
Loading…
Reference in a new issue