mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
show a default priority notification at incoming calls with locked screen too
This commit is contained in:
@ -6,7 +6,6 @@ import android.content.Context
|
|||||||
import android.telecom.Call
|
import android.telecom.Call
|
||||||
import android.telecom.InCallService
|
import android.telecom.InCallService
|
||||||
import com.simplemobiletools.dialer.activities.CallActivity
|
import com.simplemobiletools.dialer.activities.CallActivity
|
||||||
import com.simplemobiletools.dialer.extensions.getStateCompat
|
|
||||||
import com.simplemobiletools.dialer.extensions.isOutgoing
|
import com.simplemobiletools.dialer.extensions.isOutgoing
|
||||||
import com.simplemobiletools.dialer.extensions.powerManager
|
import com.simplemobiletools.dialer.extensions.powerManager
|
||||||
import com.simplemobiletools.dialer.helpers.CallManager
|
import com.simplemobiletools.dialer.helpers.CallManager
|
||||||
@ -34,10 +33,8 @@ class CallService : InCallService() {
|
|||||||
val isScreenLocked = (getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).isDeviceLocked
|
val isScreenLocked = (getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).isDeviceLocked
|
||||||
if (!powerManager.isInteractive || call.isOutgoing() || isScreenLocked) {
|
if (!powerManager.isInteractive || call.isOutgoing() || isScreenLocked) {
|
||||||
try {
|
try {
|
||||||
startActivity(CallActivity.getStartIntent(this))
|
|
||||||
if (call.getStateCompat() != Call.STATE_RINGING) {
|
|
||||||
callNotificationManager.setupNotification()
|
callNotificationManager.setupNotification()
|
||||||
}
|
startActivity(CallActivity.getStartIntent(this))
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
// seems like startActivity can thrown AndroidRuntimeException and ActivityNotFoundException, not yet sure when and why, lets show a notification
|
// seems like startActivity can thrown AndroidRuntimeException and ActivityNotFoundException, not yet sure when and why, lets show a notification
|
||||||
callNotificationManager.setupNotification()
|
callNotificationManager.setupNotification()
|
||||||
|
Reference in New Issue
Block a user