properly recognize SIM card to use from third party intents
This commit is contained in:
parent
964486fedc
commit
91c33b5030
1 changed files with 9 additions and 7 deletions
|
|
@ -64,13 +64,15 @@ class DialerActivity : SimpleActivity() {
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
private fun getHandleToUse(callback: (PhoneAccountHandle) -> Unit) {
|
private fun getHandleToUse(callback: (PhoneAccountHandle) -> Unit) {
|
||||||
val defaultHandle = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL)
|
val defaultHandle = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL)
|
||||||
if (defaultHandle != null) {
|
when {
|
||||||
callback(defaultHandle)
|
defaultHandle != null -> callback(defaultHandle)
|
||||||
} else {
|
intent.hasExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE) -> callback(intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE))
|
||||||
handlePermission(PERMISSION_READ_PHONE_STATE) {
|
else -> {
|
||||||
if (it) {
|
handlePermission(PERMISSION_READ_PHONE_STATE) {
|
||||||
SelectSIMDialog(this) { handle ->
|
if (it) {
|
||||||
callback(handle)
|
SelectSIMDialog(this) { handle ->
|
||||||
|
callback(handle)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue