diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt
index 8082bde5..2b18d8d8 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt
@@ -1,5 +1,7 @@
package com.rifsxd.ksunext.ui
+import android.content.Intent
+import android.net.Uri
import android.content.Context
import android.os.Build
import android.os.Bundle
@@ -54,9 +56,7 @@ import com.rifsxd.ksunext.ui.theme.KernelSUTheme
import com.rifsxd.ksunext.ui.util.LocalSnackbarHost
import com.rifsxd.ksunext.ui.util.rootAvailable
import com.rifsxd.ksunext.ui.util.install
-
-import android.content.Intent
-import android.net.Uri
+import com.rifsxd.ksunext.ui.util.isSuCompatDisabled
import com.rifsxd.ksunext.ui.screen.FlashIt
class MainActivity : ComponentActivity() {
@@ -167,39 +167,48 @@ private fun BottomBar(navController: NavHostController) {
val navigator = navController.rememberDestinationsNavigator()
val isManager = Natives.becomeManager(ksuApp.packageName)
val fullFeatured = isManager && !Natives.requireNewKernel() && rootAvailable()
+ val suCompatDisabled = isSuCompatDisabled()
+
NavigationBar(
tonalElevation = 8.dp,
windowInsets = WindowInsets.systemBars.union(WindowInsets.displayCutout).only(
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom
)
) {
- BottomBarDestination.entries.forEach { destination ->
- if (!fullFeatured && destination.rootRequired) return@forEach
- val isCurrentDestOnBackStack by navController.isRouteOnBackStackAsState(destination.direction)
- NavigationBarItem(
- selected = isCurrentDestOnBackStack,
- onClick = {
- if (isCurrentDestOnBackStack) {
- navigator.popBackStack(destination.direction, false)
- }
- navigator.navigate(destination.direction) {
- popUpTo(NavGraphs.root) {
- saveState = true
+ BottomBarDestination.entries
+ .filter {
+ // Hide SuperUser and Module when su compat is enabled
+ if (suCompatDisabled) {
+ it != BottomBarDestination.SuperUser && it != BottomBarDestination.Module
+ } else true
+ }
+ .forEach { destination ->
+ if (!fullFeatured && destination.rootRequired) return@forEach
+ val isCurrentDestOnBackStack by navController.isRouteOnBackStackAsState(destination.direction)
+ NavigationBarItem(
+ selected = isCurrentDestOnBackStack,
+ onClick = {
+ if (isCurrentDestOnBackStack) {
+ navigator.popBackStack(destination.direction, false)
}
- launchSingleTop = true
- restoreState = true
- }
- },
- icon = {
- if (isCurrentDestOnBackStack) {
- Icon(destination.iconSelected, stringResource(destination.label))
- } else {
- Icon(destination.iconNotSelected, stringResource(destination.label))
- }
- },
- label = { Text(stringResource(destination.label)) },
- alwaysShowLabel = true
- )
- }
+ navigator.navigate(destination.direction) {
+ popUpTo(NavGraphs.root) {
+ saveState = true
+ }
+ launchSingleTop = true
+ restoreState = true
+ }
+ },
+ icon = {
+ if (isCurrentDestOnBackStack) {
+ Icon(destination.iconSelected, stringResource(destination.label))
+ } else {
+ Icon(destination.iconNotSelected, stringResource(destination.label))
+ }
+ },
+ label = { Text(stringResource(destination.label)) },
+ alwaysShowLabel = true
+ )
+ }
}
}
diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt
index 45ead18c..837d5d62 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt
@@ -322,25 +322,49 @@ private fun StatusCard(
val labelStyle = LabelItemDefaults.style
TextRow(
trailingContent = {
- LabelItem(
- icon = if (Natives.isSafeMode) {
- {
- Icon(
- tint = labelStyle.contentColor,
- imageVector = Icons.Filled.Security,
- contentDescription = null
+ Row(
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(6.dp)
+ ) {
+ LabelItem(
+ icon = if (Natives.isSafeMode) {
+ {
+ Icon(
+ tint = labelStyle.contentColor,
+ imageVector = Icons.Filled.Security,
+ contentDescription = null
+ )
+ }
+ } else {
+ null
+ },
+ text = {
+ Text(
+ text = workingMode,
+ style = labelStyle.textStyle.copy(color = labelStyle.contentColor),
)
}
- } else {
- null
- },
- text = {
- Text(
- text = workingMode,
- style = labelStyle.textStyle.copy(color = labelStyle.contentColor),
+ )
+ if (isSuCompatDisabled()) {
+ LabelItem(
+ icon = {
+ Icon(
+ tint = labelStyle.contentColor,
+ imageVector = Icons.Filled.Warning,
+ contentDescription = null
+ )
+ },
+ text = {
+ Text(
+ text = stringResource(R.string.sucompat_disabled),
+ style = labelStyle.textStyle.copy(
+ color = labelStyle.contentColor,
+ )
+ )
+ }
)
}
- )
+ }
}
) {
Text(
diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt
index 04dce445..1e4919d0 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt
@@ -628,6 +628,10 @@ fun getModuleSize(dir: File): Long {
return result.toLongOrNull() ?: 0L
}
+fun isSuCompatDisabled(): Boolean {
+ return Natives.version >= Natives.MINIMAL_SUPPORTED_SU_COMPAT && !Natives.isSuEnabled()
+}
+
fun setAppProfileTemplate(id: String, template: String): Boolean {
val shell = getRootShell()
val escapedTemplate = template.replace("\"", "\\\"")
diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml
index 8aeedef0..a7550ce6 100644
--- a/manager/app/src/main/res/values/strings.xml
+++ b/manager/app/src/main/res/values/strings.xml
@@ -221,4 +221,5 @@
Inject a debug console into WebUI X to make debugging easier. Requires web debugging to be on.
Customization
Developer
+ SUCOMPAT DISABLED