VancedManager/app/src/main/java/com/vanced/manager/core/installer/AppInstallerService.kt

51 lines
1.7 KiB
Kotlin
Raw Normal View History

2020-06-22 12:11:57 +00:00
package com.vanced.manager.core.installer
import android.app.Service
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.IBinder
2021-02-03 18:24:28 +00:00
import com.vanced.manager.utils.AppUtils.log
2020-10-31 19:45:39 +00:00
import com.vanced.manager.utils.AppUtils.sendCloseDialog
2020-09-15 18:06:29 +00:00
import com.vanced.manager.utils.AppUtils.sendFailure
2020-09-17 10:13:16 +00:00
import com.vanced.manager.utils.AppUtils.sendRefresh
2020-06-22 12:11:57 +00:00
Vanced Manager 2.6.0 (#516) * updated app card UI * bug fixes * fixed grammar * removed unnoticable animation to improve performance * removed useless attribute * kotlin extensions are stonks * reference accent color variable instead of getting preference value every time * updated old stuff * removed useless check inside 'when' statement * optimised lifecycleOwner getter * property access syntax goes brrrrr * small accent update * added progress indicators to download dialogs * fixed changelog not appearing when pressing card in about menu * bumped up kotlin to 1.4.31 * fixed #437 * fixed #435 * fixed viewpager navigation on RTL layout * added a check for session id in root installer * updated strings * always notify about miui error * only run 1 animation at once * require external storage * sorted strings xml * improved layouts to look more close to each other * bumped up dependencies * updated version * fixed crash on manager update * New Crowdin updates (#489) * New translations strings.xml (Romanian) * New translations strings.xml (Bengali) * New translations strings.xml (Serbian (Cyrillic)) * New translations strings.xml (Swedish) * New translations strings.xml (Turkish) * New translations strings.xml (Ukrainian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Chinese Traditional) * New translations strings.xml (Vietnamese) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Indonesian) * New translations strings.xml (Tamil) * New translations strings.xml (Marathi) * New translations strings.xml (Portuguese) * New translations strings.xml (Thai) * New translations strings.xml (Croatian) * New translations strings.xml (Azerbaijani) * New translations strings.xml (Hindi) * New translations strings.xml (Filipino) * New translations strings.xml (Sinhala) * New translations strings.xml (Bengali, India) * New translations strings.xml (Sorani (Kurdish)) * New translations strings.xml (Pashto) * New translations strings.xml (Somali) * New translations strings.xml (Russian) * New translations strings.xml (Polish) * New translations strings.xml (Arabic) * New translations strings.xml (Spanish) * New translations strings.xml (Slovak) * New translations strings.xml (Malayalam) * New translations strings.xml (Japanese) * New translations strings.xml (Estonian) * New translations strings.xml (French) * New translations strings.xml (Kurdish) * New translations strings.xml (Kurmanji (Kurdish)) * New translations strings.xml (Hungarian) * New translations strings.xml (Finnish) * New translations strings.xml (Korean) * New translations strings.xml (Afrikaans) * New translations strings.xml (Punjabi) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Czech) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Hebrew) * New translations strings.xml (Italian) * New translations strings.xml (Georgian) * New translations strings.xml (Dutch) * New translations strings.xml (Norwegian) * New translations strings.xml (Punjabi, Pakistan) * Added button info on long press * preview adjustments to navigation xml * moved splash screen activity to parent dir * fixed buttontag getter * updated readme * fixed readme * Added build section to readme * Updated build instructions * prevent stacktrace from obfuscating * Added an option to switch between internal and external storage * removed warning for music vanced * added back a fix for split installer * added -r option for root music installer * Revert "prevent stacktrace from obfuscating" This reverts commit 2d30eb60af11f2d854c826953c025702c2e161ce. * Revert "added back a fix for split installer" This reverts commit aeaa0d445ec7cd6d2c318bf3f3751f8759d89801. * Revert "Added an option to switch between internal and external storage" This reverts commit 98c4b88961d14f36acf908bcee2376c1f79af86e. * reverted all storage-related commits * prevent stacktrace ovfuscation * updated readme * updated base url * use storage perms only on android 5 * cleanup * removed unused event file * fixed dark overlay not disappearing after bottom dialog has been dismissed * removed unecessary path from file_provider * fixed lint for core-ui * improved layout flexibility * updated icons in expandable app item * removed path prefix for api urls * removed microg bug dialog * fixed version code comparison * New translations strings.xml (Romanian) * New translations strings.xml (Croatian) * New translations strings.xml (Ukrainian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Chinese Traditional) * New translations strings.xml (Vietnamese) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Indonesian) * New translations strings.xml (Tamil) * New translations strings.xml (Bengali) * New translations strings.xml (Marathi) * New translations strings.xml (Thai) * New translations strings.xml (Estonian) * New translations strings.xml (Swedish) * New translations strings.xml (Azerbaijani) * New translations strings.xml (Hindi) * New translations strings.xml (Filipino) * New translations strings.xml (Malayalam) * New translations strings.xml (Sinhala) * New translations strings.xml (Bengali, India) * New translations strings.xml (Kurmanji (Kurdish)) * New translations strings.xml (Sorani (Kurdish)) * New translations strings.xml (Pashto) * New translations strings.xml (Somali) * New translations strings.xml (Punjabi, Pakistan) * New translations strings.xml (Turkish) * New translations strings.xml (Serbian (Cyrillic)) * New translations strings.xml (French) * New translations strings.xml (Hebrew) * New translations strings.xml (Spanish) * New translations strings.xml (Afrikaans) * New translations strings.xml (Arabic) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Czech) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Finnish) * New translations strings.xml (Hungarian) * New translations strings.xml (Slovak) * New translations strings.xml (Italian) * New translations strings.xml (Japanese) * New translations strings.xml (Georgian) * New translations strings.xml (Korean) * New translations strings.xml (Kurdish) * New translations strings.xml (Dutch) * New translations strings.xml (Norwegian) * New translations strings.xml (Punjabi) * New translations strings.xml (Polish) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Lithuanian) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Arabic) * New translations strings.xml (Slovak) * New translations strings.xml (Korean) * New translations strings.xml (Polish) * New Crowdin updates (#515) * New translations strings.xml (Arabic) * New translations strings.xml (Greek) * New translations strings.xml (Dutch) * New translations strings.xml (Turkish) * New translations strings.xml (Chinese Traditional) * New translations strings.xml (Indonesian) Co-authored-by: X1nto <burtkni@yandex.ru> Co-authored-by: Tornike Khintibidze <48173186+X1nto@users.noreply.github.com>
2021-04-27 12:16:14 +00:00
class AppInstallerService : Service() {
2020-06-22 12:11:57 +00:00
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
2021-02-03 18:24:28 +00:00
log(TAG, "Requesting user confirmation for installation")
2020-06-22 12:11:57 +00:00
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
startActivity(confirmationIntent)
} catch (e: Exception) {
2021-02-03 18:24:28 +00:00
log("VMInstall", "Unable to start installation")
2020-06-22 12:11:57 +00:00
}
}
PackageInstaller.STATUS_SUCCESS -> {
2021-02-03 18:24:28 +00:00
log(TAG, "Installation succeed")
2020-10-31 19:45:39 +00:00
sendCloseDialog(this)
2020-09-17 10:13:16 +00:00
sendRefresh(this)
2020-06-22 12:11:57 +00:00
}
2020-09-20 14:41:28 +00:00
else -> {
2020-10-31 19:45:39 +00:00
sendCloseDialog(this)
intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)?.let {
Vanced Manager 2.6.0 (#516) * updated app card UI * bug fixes * fixed grammar * removed unnoticable animation to improve performance * removed useless attribute * kotlin extensions are stonks * reference accent color variable instead of getting preference value every time * updated old stuff * removed useless check inside 'when' statement * optimised lifecycleOwner getter * property access syntax goes brrrrr * small accent update * added progress indicators to download dialogs * fixed changelog not appearing when pressing card in about menu * bumped up kotlin to 1.4.31 * fixed #437 * fixed #435 * fixed viewpager navigation on RTL layout * added a check for session id in root installer * updated strings * always notify about miui error * only run 1 animation at once * require external storage * sorted strings xml * improved layouts to look more close to each other * bumped up dependencies * updated version * fixed crash on manager update * New Crowdin updates (#489) * New translations strings.xml (Romanian) * New translations strings.xml (Bengali) * New translations strings.xml (Serbian (Cyrillic)) * New translations strings.xml (Swedish) * New translations strings.xml (Turkish) * New translations strings.xml (Ukrainian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Chinese Traditional) * New translations strings.xml (Vietnamese) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Indonesian) * New translations strings.xml (Tamil) * New translations strings.xml (Marathi) * New translations strings.xml (Portuguese) * New translations strings.xml (Thai) * New translations strings.xml (Croatian) * New translations strings.xml (Azerbaijani) * New translations strings.xml (Hindi) * New translations strings.xml (Filipino) * New translations strings.xml (Sinhala) * New translations strings.xml (Bengali, India) * New translations strings.xml (Sorani (Kurdish)) * New translations strings.xml (Pashto) * New translations strings.xml (Somali) * New translations strings.xml (Russian) * New translations strings.xml (Polish) * New translations strings.xml (Arabic) * New translations strings.xml (Spanish) * New translations strings.xml (Slovak) * New translations strings.xml (Malayalam) * New translations strings.xml (Japanese) * New translations strings.xml (Estonian) * New translations strings.xml (French) * New translations strings.xml (Kurdish) * New translations strings.xml (Kurmanji (Kurdish)) * New translations strings.xml (Hungarian) * New translations strings.xml (Finnish) * New translations strings.xml (Korean) * New translations strings.xml (Afrikaans) * New translations strings.xml (Punjabi) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Czech) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Hebrew) * New translations strings.xml (Italian) * New translations strings.xml (Georgian) * New translations strings.xml (Dutch) * New translations strings.xml (Norwegian) * New translations strings.xml (Punjabi, Pakistan) * Added button info on long press * preview adjustments to navigation xml * moved splash screen activity to parent dir * fixed buttontag getter * updated readme * fixed readme * Added build section to readme * Updated build instructions * prevent stacktrace from obfuscating * Added an option to switch between internal and external storage * removed warning for music vanced * added back a fix for split installer * added -r option for root music installer * Revert "prevent stacktrace from obfuscating" This reverts commit 2d30eb60af11f2d854c826953c025702c2e161ce. * Revert "added back a fix for split installer" This reverts commit aeaa0d445ec7cd6d2c318bf3f3751f8759d89801. * Revert "Added an option to switch between internal and external storage" This reverts commit 98c4b88961d14f36acf908bcee2376c1f79af86e. * reverted all storage-related commits * prevent stacktrace ovfuscation * updated readme * updated base url * use storage perms only on android 5 * cleanup * removed unused event file * fixed dark overlay not disappearing after bottom dialog has been dismissed * removed unecessary path from file_provider * fixed lint for core-ui * improved layout flexibility * updated icons in expandable app item * removed path prefix for api urls * removed microg bug dialog * fixed version code comparison * New translations strings.xml (Romanian) * New translations strings.xml (Croatian) * New translations strings.xml (Ukrainian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Chinese Traditional) * New translations strings.xml (Vietnamese) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Indonesian) * New translations strings.xml (Tamil) * New translations strings.xml (Bengali) * New translations strings.xml (Marathi) * New translations strings.xml (Thai) * New translations strings.xml (Estonian) * New translations strings.xml (Swedish) * New translations strings.xml (Azerbaijani) * New translations strings.xml (Hindi) * New translations strings.xml (Filipino) * New translations strings.xml (Malayalam) * New translations strings.xml (Sinhala) * New translations strings.xml (Bengali, India) * New translations strings.xml (Kurmanji (Kurdish)) * New translations strings.xml (Sorani (Kurdish)) * New translations strings.xml (Pashto) * New translations strings.xml (Somali) * New translations strings.xml (Punjabi, Pakistan) * New translations strings.xml (Turkish) * New translations strings.xml (Serbian (Cyrillic)) * New translations strings.xml (French) * New translations strings.xml (Hebrew) * New translations strings.xml (Spanish) * New translations strings.xml (Afrikaans) * New translations strings.xml (Arabic) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Czech) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Finnish) * New translations strings.xml (Hungarian) * New translations strings.xml (Slovak) * New translations strings.xml (Italian) * New translations strings.xml (Japanese) * New translations strings.xml (Georgian) * New translations strings.xml (Korean) * New translations strings.xml (Kurdish) * New translations strings.xml (Dutch) * New translations strings.xml (Norwegian) * New translations strings.xml (Punjabi) * New translations strings.xml (Polish) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Lithuanian) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Arabic) * New translations strings.xml (Slovak) * New translations strings.xml (Korean) * New translations strings.xml (Polish) * New Crowdin updates (#515) * New translations strings.xml (Arabic) * New translations strings.xml (Greek) * New translations strings.xml (Dutch) * New translations strings.xml (Turkish) * New translations strings.xml (Chinese Traditional) * New translations strings.xml (Indonesian) Co-authored-by: X1nto <burtkni@yandex.ru> Co-authored-by: Tornike Khintibidze <48173186+X1nto@users.noreply.github.com>
2021-04-27 12:16:14 +00:00
sendFailure(it, this)
}
2020-09-20 14:41:28 +00:00
}
2020-06-22 12:11:57 +00:00
}
stopSelf()
return START_NOT_STICKY
}
override fun onBind(intent: Intent?): IBinder? {
return null
}
2020-11-09 18:26:11 +00:00
companion object {
2020-06-22 12:11:57 +00:00
const val TAG = "VMInstall"
}
2020-09-04 19:14:43 +00:00
}