mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-24 12:15:11 +00:00
android 12 crash fixes
This commit is contained in:
parent
715eb9cf7a
commit
1cd0294801
3 changed files with 12 additions and 4 deletions
|
@ -113,6 +113,7 @@ dependencies {
|
|||
implementation("androidx.navigation:navigation-ui-ktx:2.3.5")
|
||||
implementation("androidx.preference:preference-ktx:1.1.1")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("androidx.work:work-runtime-ktx:2.7.0-rc01")
|
||||
|
||||
|
||||
// Compose
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
package com.vanced.manager.utils
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.os.Build
|
||||
|
||||
fun getArch(): String = when {
|
||||
Build.SUPPORTED_ABIS.contains("x86") -> "x86"
|
||||
Build.SUPPORTED_ABIS.contains("arm64-v8a") -> "arm64_v8a"
|
||||
else -> "armeabi_v7a"
|
||||
}
|
||||
}
|
||||
|
||||
val intentFlags =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
PendingIntent.FLAG_MUTABLE
|
||||
else
|
||||
0
|
|
@ -159,7 +159,7 @@ object PackageHelper {
|
|||
fun uninstallApk(pkg: String, context: Context) {
|
||||
val callbackIntent = Intent(context, AppUninstallerService::class.java)
|
||||
callbackIntent.putExtra("pkg", pkg)
|
||||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, 0)
|
||||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, intentFlags)
|
||||
try {
|
||||
context.packageManager.packageInstaller.uninstall(pkg, pendingIntent.intentSender)
|
||||
} catch (e: Exception) {
|
||||
|
@ -169,7 +169,7 @@ object PackageHelper {
|
|||
|
||||
fun install(path: String, context: Context) {
|
||||
val callbackIntent = Intent(context, AppInstallerService::class.java)
|
||||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, 0)
|
||||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, intentFlags)
|
||||
val packageInstaller = context.packageManager.packageInstaller
|
||||
val params =
|
||||
PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
|
||||
|
@ -289,7 +289,7 @@ object PackageHelper {
|
|||
val sessionParams =
|
||||
PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
|
||||
val callbackIntent = Intent(context, AppInstallerService::class.java)
|
||||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, 0)
|
||||
val pendingIntent = PendingIntent.getService(context, 0, callbackIntent, intentFlags)
|
||||
try {
|
||||
sessionId = packageInstaller.createSession(sessionParams)
|
||||
session = packageInstaller.openSession(sessionId)
|
||||
|
|
Loading…
Reference in a new issue