show the called SIM card number in case there are multiple ones

This commit is contained in:
tibbi 2020-05-11 16:19:55 +02:00
parent bda0d2e296
commit 4dbc73f3de
1 changed files with 18 additions and 0 deletions

View File

@ -63,6 +63,7 @@ class CallActivity : SimpleActivity() {
runOnUiThread {
setupNotification()
updateOtherPersonsInfo()
checkCalledSIMCard()
}
}
@ -195,6 +196,23 @@ class CallActivity : SimpleActivity() {
}
}
@SuppressLint("MissingPermission")
private fun checkCalledSIMCard() {
try {
val accounts = telecomManager.callCapablePhoneAccounts
if (accounts.size > 1) {
accounts.forEachIndexed { index, account ->
if (account == CallManager.call?.details?.accountHandle) {
call_sim_id.text = "${index + 1}"
call_sim_id.beVisible()
call_sim_image.beVisible()
}
}
}
} catch (ignored: Exception) {
}
}
private fun updateCallState(state: Int) {
when (state) {
Call.STATE_RINGING -> callRinging()