Skip to content

Commit

Permalink
manager: fix ksud installation failed at first boot.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Jan 26, 2023
1 parent f6c249b commit 76c88a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package me.weishu.kernelsu
import android.app.Application
import coil.Coil
import coil.ImageLoader
import me.weishu.kernelsu.ui.util.install
import me.zhanghai.android.appiconloader.coil.AppIconFetcher
import me.zhanghai.android.appiconloader.coil.AppIconKeyer

Expand All @@ -25,8 +24,6 @@ class KernelSUApplication : Application() {
}
.build()
)

install()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import me.weishu.kernelsu.ui.screen.destinations.SettingScreenDestination
import me.weishu.kernelsu.ui.util.LocalSnackbarHost
import me.weishu.kernelsu.ui.util.reboot
import me.weishu.kernelsu.ui.util.getSELinuxStatus
import me.weishu.kernelsu.ui.util.install

@OptIn(ExperimentalMaterial3Api::class)
@RootNavGraph(start = true)
Expand All @@ -58,6 +59,9 @@ fun HomeScreen(navigator: DestinationsNavigator) {
) {
val kernelVersion = getKernelVersion()
val isManager = Natives.becomeManager(ksuApp.packageName)
SideEffect {
if (isManager) install()
}
val ksuVersion = if (isManager) Natives.getVersion() else null

StatusCard(kernelVersion, ksuVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fun createRootShell(): Shell {
return try {
builder.build(getKsuDaemonPath(), "debug", "su")
} catch (e: Throwable) {
Log.e(TAG, "su failed: ", e)
builder.build("sh")
}
}
Expand Down

0 comments on commit 76c88a7

Please sign in to comment.