show a default priority notification at incoming calls with locked screen too

This commit is contained in:
tibbi 2022-08-08 18:47:37 +02:00
parent debd1be46c
commit e533bbbdc9
1 changed files with 1 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import android.content.Context
import android.telecom.Call
import android.telecom.InCallService
import com.simplemobiletools.dialer.activities.CallActivity
import com.simplemobiletools.dialer.extensions.getStateCompat
import com.simplemobiletools.dialer.extensions.isOutgoing
import com.simplemobiletools.dialer.extensions.powerManager
import com.simplemobiletools.dialer.helpers.CallManager
@ -34,10 +33,8 @@ class CallService : InCallService() {
val isScreenLocked = (getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).isDeviceLocked
if (!powerManager.isInteractive || call.isOutgoing() || isScreenLocked) {
try {
startActivity(CallActivity.getStartIntent(this))
if (call.getStateCompat() != Call.STATE_RINGING) {
callNotificationManager.setupNotification()
}
startActivity(CallActivity.getStartIntent(this))
} catch (e: ActivityNotFoundException) {
// seems like startActivity can thrown AndroidRuntimeException and ActivityNotFoundException, not yet sure when and why, lets show a notification
callNotificationManager.setupNotification()