adding an Android OS version check at isDefaultDialer

This commit is contained in:
tibbi 2018-12-12 17:48:19 +01:00
parent 9f59e10f15
commit 9dffb0aea9
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import androidx.core.content.FileProvider
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CONTACTS
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
import com.simplemobiletools.commons.helpers.isNougatPlus
import com.simplemobiletools.contacts.pro.BuildConfig
import com.simplemobiletools.contacts.pro.R
@ -344,4 +345,4 @@ fun Context.deleteBlockedNumber(number: String) {
}
@TargetApi(Build.VERSION_CODES.M)
fun Context.isDefaultDialer() = telecomManager.defaultDialerPackage == packageName
fun Context.isDefaultDialer() = isMarshmallowPlus() && telecomManager.defaultDialerPackage == packageName