Skip to content

Commit

Permalink
Fix phone state sensor only considering 1 subscription's calls (#3803)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpelgrom committed Aug 19, 2023
1 parent 477c299 commit e3ce9ed
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
@Suppress("DEPRECATION")
telephonyManager.callState
}
currentPhoneState = when (callState) {
// Deprecated function provides state for any call, not for a specific subscription only
@Suppress("DEPRECATION")
currentPhoneState = when (telephonyManager.callState) {
TelephonyManager.CALL_STATE_IDLE -> "idle"
TelephonyManager.CALL_STATE_RINGING -> "ringing"
TelephonyManager.CALL_STATE_OFFHOOK -> "offhook"
Expand Down

0 comments on commit e3ce9ed

Please sign in to comment.