Skip to content

Commit

Permalink
fix negative mb
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jul 31, 2024
1 parent d5765f7 commit c9e0df0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/org/andbootmgr/app/DeviceLogic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.andbootmgr.app
import android.content.Context
import android.util.Log
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.io.SuFile
import org.andbootmgr.app.util.SDUtils
import java.io.File

Expand All @@ -12,14 +13,15 @@ class DeviceLogic(ctx: Context) {
private val toolkitDir = File(assetDir, "Toolkit")
val fileDir = File(rootDir, "files")
val cacheDir = File(rootDir, "cache")
val abmBootset = File(fileDir, "bootset")
val abmBootset = File("/data/local/tmp/.abm_bootset")
val abmDb = File(abmBootset, "db")
val abmEntries = File(abmDb, "entries")
var mounted = false
fun mountBootset(d: DeviceInfo): Boolean {
if (checkMounted()) return true
val ast = d.getAbmSettings(this) ?: return false
if (!abmBootset.exists()) abmBootset.mkdir()
val bootsetSu = SuFile.open(abmBootset.toURI())
if (!bootsetSu.exists()) bootsetSu.mkdir()
val result = Shell
.cmd("mount $ast ${abmBootset.absolutePath}")
.exec()
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/org/andbootmgr/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,12 @@ private fun Settings(vm: MainActivityState) {
}) {
Text(stringResource(R.string.update_droidboot))
}
Button(onClick = {
vm.logic!!.unmountBootset()
vm.activity!!.finish()
}) {
Text(stringResource(R.string.umount))
}
Row(horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
Text(stringResource(R.string.noob_mode))
Switch(checked = vm.noobMode, onCheckedChange = {
Expand Down

0 comments on commit c9e0df0

Please sign in to comment.