ui: use api 34's startActivityAndCollapse

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2023-07-06 19:04:56 +02:00
parent 353679801e
commit e4a49a5356

View File

@ -4,6 +4,7 @@
*/ */
package com.wireguard.android package com.wireguard.android
import android.app.PendingIntent
import android.content.Intent import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Canvas import android.graphics.Canvas
@ -53,8 +54,13 @@ class QuickTileService : TileService() {
null -> { null -> {
val intent = Intent(this, MainActivity::class.java) val intent = Intent(this, MainActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityAndCollapse(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE))
} else {
@Suppress("DEPRECATION")
startActivityAndCollapse(intent) startActivityAndCollapse(intent)
} }
}
else -> { else -> {
unlockAndRun { unlockAndRun {
applicationScope.launch { applicationScope.launch {