Prevent crash if security exception is thrown when placing call with Telecom Manager
This commit is contained in:
parent
4a05302722
commit
2c846f6727
1 changed files with 8 additions and 4 deletions
|
@ -61,10 +61,14 @@ class TelecomHelper private constructor(context: Context) {
|
|||
) {
|
||||
Log.i("[Telecom Helper] Call state changed: ${call.state}")
|
||||
|
||||
if (call.dir == Call.Dir.Incoming && call.state == Call.State.IncomingReceived) {
|
||||
onIncomingCall(call)
|
||||
} else if (call.dir == Call.Dir.Outgoing && call.state == Call.State.OutgoingProgress) {
|
||||
onOutgoingCall(call)
|
||||
try {
|
||||
if (call.dir == Call.Dir.Incoming && call.state == Call.State.IncomingReceived) {
|
||||
onIncomingCall(call)
|
||||
} else if (call.dir == Call.Dir.Outgoing && call.state == Call.State.OutgoingProgress) {
|
||||
onOutgoingCall(call)
|
||||
}
|
||||
} catch (se: SecurityException) {
|
||||
Log.e("[Telecom Helper] Exception while trying to place call: $se")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue