Disable Telecom integration solely for OnePlus devices.

fork-5.53.8
Cody Henthorne 2022-03-17 14:35:37 -04:00
rodzic 7edef20f4f
commit 0b1a93d3e6
1 zmienionych plików z 16 dodań i 12 usunięć

Wyświetl plik

@ -39,18 +39,18 @@ object AndroidTelecomUtil {
@JvmStatic
val telecomSupported: Boolean
get() {
// if (Build.VERSION.SDK_INT >= 26 && !systemRejected) {
// if (!accountRegistered) {
// registerPhoneAccount()
// }
//
// if (accountRegistered) {
// val phoneAccount = ContextCompat.getSystemService(context, TelecomManager::class.java)!!.getPhoneAccount(getPhoneAccountHandle())
// if (phoneAccount != null && phoneAccount.isEnabled) {
// return true
// }
// }
// }
if (Build.VERSION.SDK_INT >= 26 && !systemRejected && !isRestrictedDevice()) {
if (!accountRegistered) {
registerPhoneAccount()
}
if (accountRegistered) {
val phoneAccount = ContextCompat.getSystemService(context, TelecomManager::class.java)!!.getPhoneAccount(getPhoneAccountHandle())
if (phoneAccount != null && phoneAccount.isEnabled) {
return true
}
}
}
return false
}
@ -186,6 +186,10 @@ object AndroidTelecomUtil {
}
return SignalAudioManager.AudioDevice.NONE
}
private fun isRestrictedDevice(): Boolean {
return "${Build.MODEL} ${Build.PRODUCT} ${Build.MANUFACTURER}".contains(other = "oneplus", ignoreCase = true)
}
}
@RequiresApi(26)