Skip to content
Snippets Groups Projects
Commit b81af111 authored by Adrien Béraud's avatar Adrien Béraud Committed by Adrien Béraud
Browse files

placeCall: handle all exceptions in the Telecom API

GitLab: #1689
Change-Id: I876a9bff91f5ddce3de51d7807392170e7db3bf1
parent 333ec23e
No related branches found
No related tags found
No related merge requests found
......@@ -110,7 +110,10 @@ class CallServiceImpl(val mContext: Context, executor: ScheduledExecutorService,
telecomService.placeCall(callUri, params)
return subject
} catch (e: SecurityException) {
pendingCallRequests.remove(key)
pendingCallRequests.remove(key)?.onSuccess(CALL_ALLOWED_VAL)
Log.e(TAG, "Can't use the Telecom API to place call", e)
} catch (e: Exception) {
pendingCallRequests.remove(key)?.onSuccess(CALL_ALLOWED_VAL)
Log.e(TAG, "Can't use the Telecom API to place call", e)
}
}
......
......@@ -210,6 +210,7 @@ abstract class CallService(
fun placeCallIfAllowed(account: String, conversationUri: Uri?, number: Uri, hasVideo: Boolean): Single<Call> =
requestPlaceCall(account, conversationUri, number.rawUriString, hasVideo)
.onErrorReturnItem(CALL_ALLOWED_VAL)
.flatMap { result ->
if (!result.allowed)
Single.error(SecurityException())
......@@ -767,7 +768,8 @@ abstract class CallService(
const val MEDIA_TYPE_AUDIO = "MEDIA_TYPE_AUDIO"
const val MEDIA_TYPE_VIDEO = "MEDIA_TYPE_VIDEO"
val CALL_ALLOWED = Single.just(SystemCall(true))
val CALL_ALLOWED_VAL = SystemCall(true)
val CALL_ALLOWED = Single.just(CALL_ALLOWED_VAL)
val CALL_DISALLOWED = Single.just(SystemCall(false))
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment