Fix: Crash on A12 (closes #51)

This commit is contained in:
machiav3lli 2021-10-20 12:05:57 +02:00
parent 129381d2f8
commit 50f40d8f3a
2 changed files with 26 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build
import android.view.ContextThemeWrapper import android.view.ContextThemeWrapper
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import com.looker.droidify.BuildConfig import com.looker.droidify.BuildConfig
@ -223,6 +224,9 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
0, 0,
Intent(this, Receiver::class.java) Intent(this, Receiver::class.java)
.setAction("$ACTION_OPEN.${task.packageName}"), .setAction("$ACTION_OPEN.${task.packageName}"),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
) )
@ -287,6 +291,9 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
Intent(this, Receiver::class.java) Intent(this, Receiver::class.java)
.setAction("$ACTION_INSTALL.${task.packageName}") .setAction("$ACTION_INSTALL.${task.packageName}")
.putExtra(EXTRA_CACHE_FILE_NAME, task.release.cacheFileName), .putExtra(EXTRA_CACHE_FILE_NAME, task.release.cacheFileName),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
) )
@ -308,6 +315,9 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
Intent(this, Receiver::class.java) Intent(this, Receiver::class.java)
.setAction("$ACTION_INSTALL.${task.packageName}") .setAction("$ACTION_INSTALL.${task.packageName}")
.putExtra(EXTRA_CACHE_FILE_NAME, task.release.cacheFileName), .putExtra(EXTRA_CACHE_FILE_NAME, task.release.cacheFileName),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
.send() .send()
@ -375,6 +385,9 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
this, this,
0, 0,
Intent(this, this::class.java).setAction(ACTION_CANCEL), Intent(this, this::class.java).setAction(ACTION_CANCEL),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
) )

View File

@ -7,6 +7,7 @@ import android.app.job.JobParameters
import android.app.job.JobService import android.app.job.JobService
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.os.Build
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan import android.text.style.ForegroundColorSpan
import android.view.ContextThemeWrapper import android.view.ContextThemeWrapper
@ -250,6 +251,9 @@ class SyncService : ConnectionService<SyncService.Binder>() {
this, this,
0, 0,
Intent(this, this::class.java).setAction(ACTION_CANCEL), Intent(this, this::class.java).setAction(ACTION_CANCEL),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
) )
@ -436,6 +440,9 @@ class SyncService : ConnectionService<SyncService.Binder>() {
0, 0,
Intent(this, MainActivity::class.java) Intent(this, MainActivity::class.java)
.setAction(MainActivity.ACTION_UPDATES), .setAction(MainActivity.ACTION_UPDATES),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
) )