rc1
This commit is contained in:
parent
fb555e5370
commit
90f0859b31
|
@ -57,8 +57,6 @@
|
||||||
|
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
<receiver android:name=".core.downloader.DownloadBroadcastReceiver"/>
|
|
||||||
|
|
||||||
<service android:name=".core.installer.SplitInstallerService" />
|
<service android:name=".core.installer.SplitInstallerService" />
|
||||||
<service android:name=".core.installer.RootSplitInstallerService" />
|
<service android:name=".core.installer.RootSplitInstallerService" />
|
||||||
<service android:name=".core.installer.SplitInstaller" />
|
<service android:name=".core.installer.SplitInstaller" />
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.vanced.manager.core.downloader
|
|
||||||
|
|
||||||
import android.app.NotificationManager
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.util.Log
|
|
||||||
|
|
||||||
class DownloadBroadcastReceiver: BroadcastReceiver() {
|
|
||||||
|
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
|
||||||
val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
||||||
when (intent?.getStringExtra("type")) {
|
|
||||||
"vanced" -> {
|
|
||||||
context.stopService(Intent(context, VancedDownloadService::class.java))
|
|
||||||
notificationManager.cancel(69)
|
|
||||||
Log.d("VMNotification", "Canceled vanced download")
|
|
||||||
}
|
|
||||||
"microg" -> {
|
|
||||||
notificationManager.cancel(420)
|
|
||||||
context.stopService(Intent(context, MicrogDownloadService::class.java))
|
|
||||||
Log.d("VMNotification", "Canceled microg download")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -48,7 +48,6 @@ class MicrogDownloadService: Service() {
|
||||||
NotificationHelper.displayDownloadNotif(
|
NotificationHelper.displayDownloadNotif(
|
||||||
channel,
|
channel,
|
||||||
mProgress.toInt(),
|
mProgress.toInt(),
|
||||||
"microg",
|
|
||||||
getFileNameFromUrl(dwnldUrl),
|
getFileNameFromUrl(dwnldUrl),
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
@ -60,9 +59,6 @@ class MicrogDownloadService: Service() {
|
||||||
val intent = Intent(this@MicrogDownloadService, AppInstaller::class.java)
|
val intent = Intent(this@MicrogDownloadService, AppInstaller::class.java)
|
||||||
intent.putExtra("path", "${filesDir.path}/microg.apk")
|
intent.putExtra("path", "${filesDir.path}/microg.apk")
|
||||||
intent.putExtra("pkg", "com.mgoogle.android.gms")
|
intent.putExtra("pkg", "com.mgoogle.android.gms")
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
||||||
startForegroundService(intent)
|
|
||||||
else
|
|
||||||
startService(intent)
|
startService(intent)
|
||||||
}
|
}
|
||||||
override fun onError(error: Error) {
|
override fun onError(error: Error) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ class VancedDownloadService: Service() {
|
||||||
.setOnStartOrResumeListener { OnStartOrResumeListener { prefs?.edit()?.putBoolean("isVancedDownloading", true)?.apply() } }
|
.setOnStartOrResumeListener { OnStartOrResumeListener { prefs?.edit()?.putBoolean("isVancedDownloading", true)?.apply() } }
|
||||||
.setOnProgressListener { progress ->
|
.setOnProgressListener { progress ->
|
||||||
val mProgress = progress.currentBytes * 100 / progress.totalBytes
|
val mProgress = progress.currentBytes * 100 / progress.totalBytes
|
||||||
displayDownloadNotif(channel, mProgress.toInt(), "vanced", getFileNameFromUrl(url), this)
|
displayDownloadNotif(channel, mProgress.toInt(), getFileNameFromUrl(url), this)
|
||||||
}
|
}
|
||||||
.start(object : OnDownloadListener {
|
.start(object : OnDownloadListener {
|
||||||
override fun onDownloadComplete() {
|
override fun onDownloadComplete() {
|
||||||
|
@ -104,16 +104,9 @@ class VancedDownloadService: Service() {
|
||||||
intent.action = HomeFragment.VANCED_DOWNLOADED
|
intent.action = HomeFragment.VANCED_DOWNLOADED
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
|
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
|
||||||
if (variant == "root")
|
if (variant == "root")
|
||||||
startInstallService(Intent(this, RootSplitInstallerService::class.java))
|
startService(Intent(this, RootSplitInstallerService::class.java))
|
||||||
else
|
else
|
||||||
startInstallService(Intent(this, SplitInstaller::class.java))
|
startService(Intent(this, SplitInstaller::class.java))
|
||||||
}
|
|
||||||
|
|
||||||
private fun startInstallService(intent: Intent) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
||||||
startForegroundService(intent)
|
|
||||||
else
|
|
||||||
startService(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
|
@ -25,7 +25,7 @@ class AppInstallerService: Service() {
|
||||||
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
||||||
Toast.makeText(this, "Installing...", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Installing...", Toast.LENGTH_SHORT).show()
|
||||||
Log.d(TAG, "Requesting user confirmation for installation")
|
Log.d(TAG, "Requesting user confirmation for installation")
|
||||||
startForegroundNotif(getString(R.string.installing_app, "MicroG"))
|
createBasicNotif(getString(R.string.installing_app, "MicroG"), notifId, this)
|
||||||
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
|
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
|
||||||
confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
try {
|
try {
|
||||||
|
@ -81,23 +81,6 @@ class AppInstallerService: Service() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startForegroundNotif(text: String) {
|
|
||||||
val notifBuilder =
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
||||||
Notification.Builder(this, 42.toString()).setChannelId("69420")
|
|
||||||
else
|
|
||||||
Notification.Builder(this).setPriority(Notification.PRIORITY_DEFAULT)
|
|
||||||
|
|
||||||
notifBuilder.apply {
|
|
||||||
setContentTitle(getString(R.string.app_name))
|
|
||||||
setContentText(text)
|
|
||||||
setSmallIcon(R.drawable.ic_stat_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
val notif = notifBuilder.build()
|
|
||||||
startForeground(42, notif)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
override fun onBind(intent: Intent?): IBinder? {
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -53,7 +53,7 @@ class RootSplitInstallerService: Service() {
|
||||||
}
|
}
|
||||||
for (apkFile in apkFiles) {
|
for (apkFile in apkFiles) {
|
||||||
Log.d("AppLog", "installing APK : ${apkFile.name} ${apkFile.fileSize} ")
|
Log.d("AppLog", "installing APK : ${apkFile.name} ${apkFile.fileSize} ")
|
||||||
startForegroundNotif(getString(R.string.installing_app, "Vanced"))
|
createBasicNotif(getString(R.string.installing_app, "Vanced"), notifId, this)
|
||||||
val command = arrayOf("su", "-c", "pm", "install-write", "-S", "${apkFile.fileSize}", "$sessionId", apkFile.name)
|
val command = arrayOf("su", "-c", "pm", "install-write", "-S", "${apkFile.fileSize}", "$sessionId", apkFile.name)
|
||||||
val process: Process = Runtime.getRuntime().exec(command)
|
val process: Process = Runtime.getRuntime().exec(command)
|
||||||
val inputPipe = apkFile.getInputStream()
|
val inputPipe = apkFile.getInputStream()
|
||||||
|
@ -137,23 +137,6 @@ class RootSplitInstallerService: Service() {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startForegroundNotif(text: String) {
|
|
||||||
val notifBuilder =
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
||||||
Notification.Builder(this, 666.toString()).setChannelId("69420")
|
|
||||||
else
|
|
||||||
Notification.Builder(this).setPriority(Notification.PRIORITY_DEFAULT)
|
|
||||||
|
|
||||||
notifBuilder.apply {
|
|
||||||
setContentTitle(getString(R.string.app_name))
|
|
||||||
setContentText(text)
|
|
||||||
setSmallIcon(R.drawable.ic_stat_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
val notif = notifBuilder.build()
|
|
||||||
startForeground(666, notif)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
override fun onBind(intent: Intent?): IBinder? {
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -14,7 +14,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
import com.vanced.manager.ui.MainActivity
|
import com.vanced.manager.ui.MainActivity
|
||||||
import com.vanced.manager.utils.MiuiHelper.isMiui
|
import com.vanced.manager.utils.MiuiHelper.isMiui
|
||||||
import com.vanced.manager.utils.NotificationHelper
|
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
|
||||||
|
|
||||||
class SplitInstallerService: Service() {
|
class SplitInstallerService: Service() {
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class SplitInstallerService: Service() {
|
||||||
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
|
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
|
||||||
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
||||||
Toast.makeText(this, "Installing...", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Installing...", Toast.LENGTH_SHORT).show()
|
||||||
startForegroundNotif(getString(R.string.installing_app, "Vanced"))
|
createBasicNotif(getString(R.string.installing_app, "Vanced"), notifId, this)
|
||||||
Log.d(TAG, "Requesting user confirmation for installation")
|
Log.d(TAG, "Requesting user confirmation for installation")
|
||||||
val confirmationIntent =
|
val confirmationIntent =
|
||||||
intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
|
intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
|
||||||
|
@ -40,7 +40,7 @@ class SplitInstallerService: Service() {
|
||||||
mIntent.action = MainActivity.INSTALL_COMPLETED
|
mIntent.action = MainActivity.INSTALL_COMPLETED
|
||||||
mIntent.putExtra("package", "split")
|
mIntent.putExtra("package", "split")
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
|
LocalBroadcastManager.getInstance(this).sendBroadcast(mIntent)
|
||||||
NotificationHelper.createBasicNotif(
|
createBasicNotif(
|
||||||
getString(R.string.successfully_installed, "Vanced"),
|
getString(R.string.successfully_installed, "Vanced"),
|
||||||
notifId,
|
notifId,
|
||||||
this
|
this
|
||||||
|
@ -48,7 +48,7 @@ class SplitInstallerService: Service() {
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999))
|
sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999))
|
||||||
NotificationHelper.createBasicNotif(
|
createBasicNotif(
|
||||||
getErrorMessage(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)),
|
getErrorMessage(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)),
|
||||||
notifId,
|
notifId,
|
||||||
this
|
this
|
||||||
|
|
|
@ -24,7 +24,7 @@ object NotificationHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun displayDownloadNotif(channel: Int, progress:Int, type: String, filename: String, context: Context) {
|
fun displayDownloadNotif(channel: Int, progress:Int, filename: String, context: Context) {
|
||||||
val notifBuilder =
|
val notifBuilder =
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||||
Notification.Builder(context, channel.toString()).setChannelId("69420")
|
Notification.Builder(context, channel.toString()).setChannelId("69420")
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
@ -46,17 +46,19 @@
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginStart="4dp"
|
||||||
android:text="@string/reset"
|
android:text="@string/reset"
|
||||||
android:textAllCaps="false"/>
|
android:textAllCaps="false"
|
||||||
|
android:layout_alignParentStart="true"/>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/url_save"
|
android:id="@+id/url_save"
|
||||||
style="@style/ButtonStyle"
|
style="@style/ButtonStyle"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:text="@string/save" />
|
android:text="@string/save"
|
||||||
|
android:layout_alignParentEnd="true"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<com.vanced.manager.ui.core.SlidingConstraintLayout
|
<com.vanced.manager.ui.core.SlidingConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
|
@ -7,42 +7,18 @@
|
||||||
app:contentPaddingTop="2dp"
|
app:contentPaddingTop="2dp"
|
||||||
tools:ignore="HardcodedText">
|
tools:ignore="HardcodedText">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/AboutCardTitle"
|
style="@style/AboutCardTitle"
|
||||||
android:id="@+id/about_card_vancedTeam"
|
android:id="@+id/about_card_vancedTeam"
|
||||||
android:text="@string/manager_devs"
|
android:text="@string/manager_dev"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/about_card_vancedTeam"
|
|
||||||
android:layout_marginTop="2dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="- MrDodojo"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="- Hope"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="- Moosd"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -51,6 +27,4 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
|
@ -7,9 +7,10 @@
|
||||||
tools:ignore="HardcodedText"
|
tools:ignore="HardcodedText"
|
||||||
app:contentPaddingTop="2dp">
|
app:contentPaddingTop="2dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/AboutCardTitle"
|
style="@style/AboutCardTitle"
|
||||||
|
@ -18,13 +19,6 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/about_card_vancedTeam"
|
|
||||||
android:layout_marginTop="2dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -51,7 +45,4 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
|
@ -89,7 +89,6 @@
|
||||||
<string name="launch">Launch</string>
|
<string name="launch">Launch</string>
|
||||||
<string name="welcome">Welcome</string>
|
<string name="welcome">Welcome</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Install Page -->
|
<!-- Install Page -->
|
||||||
<string name="choose_preferred_language">Choose your preferred language for Vanced</string>
|
<string name="choose_preferred_language">Choose your preferred language for Vanced</string>
|
||||||
<string name="choose_preferred_language_note">Note: if you install anything other than English, English will still be installed as an additional language</string>
|
<string name="choose_preferred_language_note">Note: if you install anything other than English, English will still be installed as an additional language</string>
|
||||||
|
@ -101,7 +100,7 @@
|
||||||
<string name="next">Next</string>
|
<string name="next">Next</string>
|
||||||
|
|
||||||
<!-- About Page -->
|
<!-- About Page -->
|
||||||
<string name="manager_devs">Manager Devs</string>
|
<string name="manager_dev">Manager Dev</string>
|
||||||
<string name="sources">Sources</string>
|
<string name="sources">Sources</string>
|
||||||
<string name="vanced_team">Vanced Team</string>
|
<string name="vanced_team">Vanced Team</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue