mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 08:09:21 +01:00
Skip user action requirement when installing extensions on a12
This commit is contained in:
parent
075961314f
commit
d527547f6a
@ -1,10 +1,13 @@
|
|||||||
package eu.kanade.tachiyomi.extension.util
|
package eu.kanade.tachiyomi.extension.util
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageInstaller
|
import android.content.pm.PackageInstaller
|
||||||
import android.content.pm.PackageInstaller.SessionParams
|
import android.content.pm.PackageInstaller.SessionParams
|
||||||
|
import android.content.pm.PackageInstaller.SessionParams.USER_ACTION_NOT_REQUIRED
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
@ -20,6 +23,7 @@ import uy.kohesive.injekt.injectLazy
|
|||||||
*/
|
*/
|
||||||
class ExtensionInstallActivity : Activity() {
|
class ExtensionInstallActivity : Activity() {
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
try {
|
try {
|
||||||
@ -37,8 +41,9 @@ class ExtensionInstallActivity : Activity() {
|
|||||||
)
|
)
|
||||||
// TODO: Add once compiling via SDK 31
|
// TODO: Add once compiling via SDK 31
|
||||||
// if (Build.VERSION.SDK_INT >= 31) {
|
// if (Build.VERSION.SDK_INT >= 31) {
|
||||||
// params.setRequireUserAction(USER_ACTION_NOT_REQUIRED)
|
if (Build.VERSION.PREVIEW_SDK_INT + Build.VERSION.SDK_INT >= 31) {
|
||||||
// }
|
params.setRequireUserAction(USER_ACTION_NOT_REQUIRED)
|
||||||
|
}
|
||||||
val sessionId = packageInstaller.createSession(params)
|
val sessionId = packageInstaller.createSession(params)
|
||||||
val session = packageInstaller.openSession(sessionId)
|
val session = packageInstaller.openSession(sessionId)
|
||||||
session.openWrite("package", 0, -1).use { packageInSession ->
|
session.openWrite("package", 0, -1).use { packageInSession ->
|
||||||
|
Loading…
Reference in New Issue
Block a user