adding some crashfixes

This commit is contained in:
tibbi
2022-06-22 23:13:20 +02:00
parent 1af7f8569a
commit a9490ddea6
4 changed files with 15 additions and 13 deletions

View File

@@ -61,6 +61,6 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:faa6a972c2' implementation 'com.github.SimpleMobileTools:Simple-Commons:d1d5402388'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61' implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
} }

View File

@@ -20,10 +20,7 @@ import android.view.WindowManager
import android.widget.ImageView import android.widget.ImageView
import androidx.core.view.children import androidx.core.view.children
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.LOWER_ALPHA import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.MINUTE_SECONDS
import com.simplemobiletools.commons.helpers.isOreoMr1Plus
import com.simplemobiletools.commons.helpers.isOreoPlus
import com.simplemobiletools.dialer.R import com.simplemobiletools.dialer.R
import com.simplemobiletools.dialer.extensions.* import com.simplemobiletools.dialer.extensions.*
import com.simplemobiletools.dialer.helpers.* import com.simplemobiletools.dialer.helpers.*
@@ -65,13 +62,9 @@ class CallActivity : SimpleActivity() {
updateTextColors(call_holder) updateTextColors(call_holder)
initButtons() initButtons()
audioManager.mode = AudioManager.MODE_IN_CALL audioManager.mode = AudioManager.MODE_IN_CALL
addLockScreenFlags() addLockScreenFlags()
CallManager.addListener(callCallback) CallManager.addListener(callCallback)
updateCallContactInfo(CallManager.getPrimaryCall()) updateCallContactInfo(CallManager.getPrimaryCall())
} }

View File

@@ -494,7 +494,10 @@ class MainActivity : SimpleActivity() {
} }
fun cacheContacts(contacts: List<SimpleContact>) { fun cacheContacts(contacts: List<SimpleContact>) {
try {
cachedContacts.clear() cachedContacts.clear()
cachedContacts.addAll(contacts) cachedContacts.addAll(contacts)
} catch (e: Exception) {
}
} }
} }

View File

@@ -1,6 +1,7 @@
package com.simplemobiletools.dialer.services package com.simplemobiletools.dialer.services
import android.app.KeyguardManager import android.app.KeyguardManager
import android.content.ActivityNotFoundException
import android.content.Context import android.content.Context
import android.telecom.Call import android.telecom.Call
import android.telecom.InCallService import android.telecom.InCallService
@@ -32,10 +33,15 @@ 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 {
startActivity(CallActivity.getStartIntent(this)) startActivity(CallActivity.getStartIntent(this))
if (call.getStateCompat() != Call.STATE_RINGING) { if (call.getStateCompat() != Call.STATE_RINGING) {
callNotificationManager.setupNotification() callNotificationManager.setupNotification()
} }
} catch (e: ActivityNotFoundException) {
// seems like startActivity can thrown AndroidRuntimeException and ActivityNotFoundException, not yet sure when and why, lets show a notification
callNotificationManager.setupNotification()
}
} else { } else {
callNotificationManager.setupNotification() callNotificationManager.setupNotification()
} }