Improve uninstallers
This commit is contained in:
@@ -51,17 +51,40 @@ class RootInstaller(context: Context) : InstallerBase(context) {
|
|||||||
xInstallLegacy(packageName, it)
|
xInstallLegacy(packageName, it)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val event = InstallerEvent.Failed(
|
postError(
|
||||||
packageName,
|
packageName,
|
||||||
context.getString(R.string.installer_status_failure),
|
context.getString(R.string.installer_status_failure),
|
||||||
context.getString(R.string.installer_root_unavailable)
|
context.getString(R.string.installer_root_unavailable)
|
||||||
)
|
)
|
||||||
EventBus.getDefault().post(event)
|
|
||||||
Log.e(" >>>>>>>>>>>>>>>>>>>>>>>>>> NO ROOT ACCESS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
|
Log.e(" >>>>>>>>>>>>>>>>>>>>>>>>>> NO ROOT ACCESS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun uninstall(packageName: String) {
|
||||||
|
if (Shell.getShell().isRoot) {
|
||||||
|
val result: Shell.Result =
|
||||||
|
Shell.su("pm uninstall --user 0 $packageName")
|
||||||
|
.exec()
|
||||||
|
val response = result.out
|
||||||
|
|
||||||
|
if (response[0] != "Success") {
|
||||||
|
postError(
|
||||||
|
packageName,
|
||||||
|
context.getString(R.string.installer_status_failure),
|
||||||
|
parseError(result)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
postError(
|
||||||
|
packageName,
|
||||||
|
context.getString(R.string.installer_status_failure),
|
||||||
|
context.getString(R.string.installer_root_unavailable)
|
||||||
|
)
|
||||||
|
Log.e(" >>>>>>>>>>>>>>>>>>>>>>>>>> NO ROOT ACCESS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun xInstall(packageName: String, files: List<File>) {
|
private fun xInstall(packageName: String, files: List<File>) {
|
||||||
var totalSize = 0
|
var totalSize = 0
|
||||||
|
|
||||||
@@ -99,21 +122,19 @@ class RootInstaller(context: Context) : InstallerBase(context) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeFromInstallQueue(packageName)
|
removeFromInstallQueue(packageName)
|
||||||
val event = InstallerEvent.Failed(
|
postError(
|
||||||
packageName,
|
packageName,
|
||||||
context.getString(R.string.installer_status_failure),
|
context.getString(R.string.installer_status_failure),
|
||||||
context.getString(R.string.installer_root_unavailable)
|
context.getString(R.string.installer_root_unavailable)
|
||||||
)
|
)
|
||||||
EventBus.getDefault().post(event)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeFromInstallQueue(packageName)
|
removeFromInstallQueue(packageName)
|
||||||
val event = InstallerEvent.Failed(
|
postError(
|
||||||
packageName,
|
packageName,
|
||||||
context.getString(R.string.installer_status_failure),
|
context.getString(R.string.installer_status_failure),
|
||||||
context.getString(R.string.installer_status_failure_session)
|
context.getString(R.string.installer_status_failure_session)
|
||||||
)
|
)
|
||||||
EventBus.getDefault().post(event)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -272,9 +272,11 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun uninstallApp() {
|
private fun uninstallApp() {
|
||||||
AppInstaller(this)
|
task {
|
||||||
.getPreferredInstaller()
|
AppInstaller(this)
|
||||||
.uninstall(app.packageName)
|
.getPreferredInstaller()
|
||||||
|
.uninstall(app.packageName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun attachWhiteListStatus() {
|
private fun attachWhiteListStatus() {
|
||||||
|
|||||||
@@ -107,8 +107,10 @@ class AppMenuSheet : BaseBottomSheet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
R.id.action_uninstall -> {
|
R.id.action_uninstall -> {
|
||||||
AppInstaller(requireContext())
|
task {
|
||||||
.getPreferredInstaller().uninstall(app.packageName)
|
AppInstaller(requireContext())
|
||||||
|
.getPreferredInstaller().uninstall(app.packageName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.action_info -> {
|
R.id.action_info -> {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
android:fragment="com.aurora.store.view.ui.preferences.DownloadPreference"
|
android:fragment="com.aurora.store.view.ui.preferences.DownloadPreference"
|
||||||
app:icon="@drawable/ic_download_manager"
|
app:icon="@drawable/ic_download_manager"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:key="pref_ui"
|
app:key="pref_download"
|
||||||
app:layout="@layout/item_preference"
|
app:layout="@layout/item_preference"
|
||||||
app:title="@string/pref_app_download" />
|
app:title="@string/pref_app_download" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
Reference in New Issue
Block a user