diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt b/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt index 59b7a7639..2ea296fc8 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt @@ -5,6 +5,7 @@ import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.io.SuFile import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import java.util.* class LocalModule(path: String) : Module() { override var id: String = "" @@ -44,13 +45,14 @@ class LocalModule(path: String) : Module() { get() = removeFile.exists() set(remove) { if (remove) { + if (updateFile.exists()) return removeFile.createNewFile() if (Const.Version.atLeast_21_2()) Shell.su("copy_sepolicy_rules").submit() else Shell.su("rm -rf $PERSIST/$id").submit() } else { - !removeFile.delete() + removeFile.delete() if (Const.Version.atLeast_21_2()) Shell.su("copy_sepolicy_rules").submit() else @@ -83,7 +85,7 @@ class LocalModule(path: String) : Module() { .orEmpty() .filter { !it.isFile } .map { LocalModule("${Const.MAGISK_PATH}/${it.name}") } - .sortedBy { it.name.toLowerCase() } + .sortedBy { it.name.lowercase(Locale.ROOT) } } } } diff --git a/app/src/main/res/layout/item_module_md2.xml b/app/src/main/res/layout/item_module_md2.xml index af68e0e8f..7da6a25c9 100644 --- a/app/src/main/res/layout/item_module_md2.xml +++ b/app/src/main/res/layout/item_module_md2.xml @@ -138,6 +138,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" + android:enabled="@{!item.updated}" android:focusable="true" android:onClick="@{() -> item.delete(viewModel)}" android:text="@{item.removed ? @string/module_state_restore : @string/module_state_remove}" diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index cd39b6a2c..3ba12af11 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -765,6 +765,8 @@ install_module() { if $BOOTMODE; then # Update info for Magisk app mktouch $NVBASE/modules/$MODID/update + rm -rf $NVBASE/modules/$MODID/remove 2>/dev/null + rm -rf $NVBASE/modules/$MODID/disable 2>/dev/null cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop fi