mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-02 01:02:39 +00:00
fixed installer
This commit is contained in:
parent
ed8f3e3d95
commit
84e5898e28
3 changed files with 4 additions and 6 deletions
|
@ -106,8 +106,7 @@ open class Home : BaseFragment(), View.OnClickListener {
|
|||
val intent = Intent(activity, StubInstaller::class.java)
|
||||
activity?.startService(intent)
|
||||
}
|
||||
R.id.microg_uninstallbtn -> activity?.let { uninstallApk("com.mgoogle.android.gms", it)
|
||||
}
|
||||
R.id.microg_uninstallbtn -> activity?.let { uninstallApk("com.mgoogle.android.gms", it) }
|
||||
R.id.vanced_uninstallbtn -> activity?.let { uninstallApk(vancedPkgName, it) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ class HomeFragment : Home() {
|
|||
binding.viewModel = viewModel
|
||||
|
||||
val variantPref = getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot")
|
||||
//val signatureStatus = getDefaultSharedPreferences(activity).getString("signature_status", "unavailable")
|
||||
registerReceivers()
|
||||
|
||||
if (variantPref == "root") {
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.app.PendingIntent
|
|||
import android.content.Intent
|
||||
import android.content.pm.PackageInstaller.SessionParams
|
||||
import android.content.pm.PackageManager
|
||||
import com.vanced.manager.core.installer.AppInstallerService
|
||||
import com.vanced.manager.core.installer.AppUninstallerService
|
||||
import java.io.FileInputStream
|
||||
import java.io.IOException
|
||||
|
@ -27,14 +28,14 @@ object PackageHelper {
|
|||
path: String,
|
||||
pkg: String?
|
||||
) {
|
||||
val callbackIntent = Intent(activity.applicationContext, AppUninstallerService::class.java)
|
||||
val callbackIntent = Intent(activity.applicationContext, AppInstallerService::class.java)
|
||||
val pendingIntent = PendingIntent.getService(activity.applicationContext, 0, callbackIntent, 0)
|
||||
val packageInstaller = activity.packageManager.packageInstaller
|
||||
val params = SessionParams(SessionParams.MODE_FULL_INSTALL)
|
||||
params.setAppPackageName(pkg)
|
||||
val sessionId = packageInstaller.createSession(params)
|
||||
val session = packageInstaller.openSession(sessionId)
|
||||
val inputStream = FileInputStream(path)
|
||||
val inputStream: InputStream = FileInputStream(path)
|
||||
val outputStream = session.openWrite("install", 0, -1)
|
||||
val buffer = ByteArray(65536)
|
||||
var c: Int
|
||||
|
@ -47,7 +48,6 @@ object PackageHelper {
|
|||
session.commit(pendingIntent.intentSender)
|
||||
}
|
||||
|
||||
|
||||
fun uninstallApk(pkg: String, activity: Activity) {
|
||||
val callbackIntent = Intent(activity.applicationContext, AppUninstallerService::class.java)
|
||||
val pendingIntent = PendingIntent.getService(activity.applicationContext, 0, callbackIntent, 0)
|
||||
|
|
Loading…
Reference in a new issue