fixed installer

This commit is contained in:
Xinto 2020-09-19 22:07:10 +04:00
parent 7c33fea8fb
commit 7d25d5a89f
4 changed files with 11 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import android.os.IBinder
import android.util.Log
import com.vanced.manager.ui.viewmodels.HomeViewModel.Companion.microgProgress
import com.vanced.manager.ui.viewmodels.HomeViewModel.Companion.musicProgress
import com.vanced.manager.utils.AppUtils.installing
import com.vanced.manager.utils.AppUtils.sendFailure
import com.vanced.manager.utils.AppUtils.sendRefresh
@ -27,6 +28,7 @@ class AppInstallerService: Service() {
PackageInstaller.STATUS_SUCCESS -> {
Log.d(TAG, "Installation succeed")
if (intent.getStringExtra("app") == "microg") microgProgress.get()?.showInstallCircle?.set(false) else musicProgress.get()?.showInstallCircle?.set(false)
installing = false
sendRefresh(this)
}
else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)

View File

@ -6,6 +6,7 @@ import android.content.pm.PackageInstaller
import android.os.IBinder
import android.util.Log
import com.vanced.manager.ui.viewmodels.HomeViewModel.Companion.vancedProgress
import com.vanced.manager.utils.AppUtils.installing
import com.vanced.manager.utils.AppUtils.sendFailure
import com.vanced.manager.utils.AppUtils.sendRefresh
@ -25,6 +26,7 @@ class SplitInstallerService: Service() {
PackageInstaller.STATUS_SUCCESS -> {
Log.d(TAG, "Installation succeed")
vancedProgress.get()?.showInstallCircle?.set(false)
installing = false
sendRefresh(this)
}
else -> sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), this)

View File

@ -16,7 +16,9 @@ import com.vanced.manager.core.installer.AppInstallerService
import com.vanced.manager.core.installer.AppUninstallerService
import com.vanced.manager.core.installer.SplitInstallerService
import com.vanced.manager.ui.fragments.HomeFragment
import com.vanced.manager.ui.viewmodels.HomeViewModel.Companion.vancedProgress
import com.vanced.manager.utils.AppUtils.sendFailure
import com.vanced.manager.utils.AppUtils.sendRefresh
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -215,16 +217,15 @@ object PackageHelper {
}
if (modApk != null) {
if (overwriteBase(modApk, fileInfoList, vancedVersionCode, context)) {
LocalBroadcastManager.getInstance(context).sendBroadcast(Intent(
HomeFragment.REFRESH_HOME))
sendRefresh(context)
vancedProgress.get()?.showInstallCircle?.set(false)
}
}
else {
sendFailure(listOf("ModApk_Missing").toMutableList(), context)
}
}
else
{
else {
sendFailure(listOf("Files_Missing_VA").toMutableList(), context)
}
}
@ -243,8 +244,7 @@ object PackageHelper {
sessionId = Integer.parseInt(sessionIdMatcher.group(1)!!)
}
apkFiles.forEach { apkFile ->
if(apkFile.name != "black.apk" && apkFile.name != "dark.apk" && apkFile.name != "hash.json")
{
if(apkFile.name != "black.apk" && apkFile.name != "dark.apk" && apkFile.name != "hash.json") {
Log.d("AppLog", "installing APK : ${apkFile.name} ${apkFile.fileSize} ")
val command = arrayOf("su", "-c", "pm", "install-write", "-S", "${apkFile.fileSize}", "$sessionId", apkFile.name)
val process: Process = Runtime.getRuntime().exec(command)

View File

@ -51,6 +51,7 @@
android:layout_height="wrap_content"
android:background="?colorSurfaceVariant"
android:visibility="gone"
app:tabMode="scrollable"
app:tabIndicatorColor="?colorPrimary"
app:tabSelectedTextColor="?colorPrimary"
app:tabTextColor="?colorPrimary"