Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

refactor(terminal): remove dead code, unused imports and stale comments

ExTvbe7af7fa0e8a
diff --git a/app/src/main/java/com/excp/podroid/engine/QemuEngine.kt b/app/src/main/java/com/excp/podroid/engine/QemuEngine.kt
index 167dfdc..5390ba9 100644
--- a/app/src/main/java/com/excp/podroid/engine/QemuEngine.kt
+++ b/app/src/main/java/com/excp/podroid/engine/QemuEngine.kt
@@ -225,7 +225,7 @@ class QemuEngine @Inject constructor(
proxySessionClient,
)
// Cell pixel dims default to 0 — TerminalView.updateSize() pushes real values once measured.
- sess.updateSize(80, 24, 0, 0)
+ sess.updateSize(80, 24, 0, 0)
_terminalSession = sess
Log.d(TAG, "Bridge auto-started on terminal.sock")
}
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt b/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt
index dc21dae..11e4f50 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalScreen.kt
@@ -9,7 +9,6 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -36,14 +35,10 @@ import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Slider
-import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TopAppBar
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.material.icons.filled.Bedtime
import androidx.compose.material.icons.filled.Close
@@ -52,19 +47,12 @@ import androidx.compose.material.icons.filled.Tune
import androidx.compose.material.icons.filled.Search
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.BoxScope
-import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.layout.wrapContentSize
-import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.ui.graphics.toArgb
-import androidx.compose.runtime.derivedStateOf
-import androidx.compose.runtime.LaunchedEffect as ComposeLaunchedEffect
-import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.TextUnit
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.waitForUpOrCancellation
@@ -88,7 +76,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawWithContent
-import androidx.compose.ui.draw.scale
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.BlendMode
@@ -666,7 +653,7 @@ private fun Modifier.fadingEdgesHorizontal(
/**
* Quick Settings — minimal top-anchored sheet. Shows a few items per section
- * with "More" buttons that open full pickers (with search) on demand.
+ * with ghost buttons that open full pickers (with search) on demand.
*/
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Composable
@@ -704,7 +691,7 @@ private fun QuickSettingsDialog(
}
val fontMimes = remember { arrayOf("font/ttf", "application/x-font-ttf", "application/octet-stream") }
- // ── Sub-dialogs unchanged ───────────────────────────────────────
+ // ── Full-screen pickers and confirm dialogs ─────────────────────
if (showThemePicker) {
FullPickerDialog(
title = stringResource(R.string.color_themes),
@@ -999,7 +986,7 @@ private fun FontSwatch(
}
}
-/** Generic outline chip used for "More" / "+ Add" / "Import" actions. */
+/** Generic outline chip used for "+ Add" / "Import" actions. */
@Composable
private fun AddSwatch(
label: String,
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalViewModel.kt b/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalViewModel.kt
index 9f52d57..0b9b5cc 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalViewModel.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/terminal/TerminalViewModel.kt
@@ -68,7 +68,6 @@ class TerminalViewModel @Inject constructor(
) : ViewModel() {
val vmState: StateFlow<VmState> = engine.state
- val bootStage: StateFlow<String> = engine.bootStage
val terminalFontSize: StateFlow<Int> = settingsRepository.terminalFontSize
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), 20)
@@ -84,8 +83,7 @@ class TerminalViewModel @Inject constructor(
val hapticsEnabledFlow: StateFlow<Boolean> = settingsRepository.hapticsEnabled
.stateIn(viewModelScope, SharingStarted.Eagerly, true)
- /** Mirrors of the persisted flows for callers that want a synchronous read. */
- val showExtraKeys: Boolean get() = showExtraKeysFlow.value
+ /** Mirror of the persisted flow for callers that want a synchronous read. */
val hapticsEnabled: Boolean get() = hapticsEnabledFlow.value
// Trigger for opening the Quick Settings drawer (composable-side reacts via StateFlow)
@@ -231,14 +229,6 @@ class TerminalViewModel @Inject constructor(
} catch (_: Exception) { null }
}
- /** Lists asset files in `dir` whose name ends with `suffix`, with the suffix stripped. */
- fun listAssetNames(dir: String, suffix: String): List<String> {
- val items = try {
- context.assets.list(dir)?.toList() ?: emptyList()
- } catch (_: Exception) { emptyList() }
- return listOf("default") + items.filter { it.endsWith(suffix) }.map { it.removeSuffix(suffix) }.sorted()
- }
-
/**
* Where user-imported fonts live. App-private external dir means no permission
* prompts and a clean uninstall, but it's not visible to third-party file
@@ -712,8 +702,9 @@ class TerminalViewModel @Inject constructor(
val sess = runCatching { engine.createTerminalSession(sessionClient) }
.onFailure { e ->
- // AvfEngine throws UnsupportedOperationException until Task 11
- // wires the AVF bridge. Don't crash the UI — leave session null.
+ // Guard: both engines implement createTerminalSession, but a
+ // backend can still fail to spawn a session. Don't crash the
+ // UI, leave session null.
android.util.Log.w(TAG, "createTerminalSession failed on ${engine.backendId}: ${e.message}")
}
.getOrNull() ?: return
@@ -739,12 +730,10 @@ class TerminalViewModel @Inject constructor(
/**
* Emit xterm focus-in/out (CSI I / CSI O) when the app gains/loses focus.
- * nvim's `FocusGained` / `FocusLost` autocommands rely on these. DECSET 1004
- * (`DECSET_BIT_SEND_FOCUS_EVENTS`) and `isDecsetInternalBitSet` are private
- * in the Termux AAR, so we read the `mCurrentDecSetFlags` field reflectively
- * and mask with the known bit. If the reflection ever breaks we silently
- * skip — sending focus bytes to a shell that didn't enable reporting would
- * leak literal "^[[I" noise into the prompt.
+ * nvim's `FocusGained` / `FocusLost` autocommands rely on these. Guarded by
+ * the public `TerminalEmulator.isFocusEventsEnabled` (DECSET 1004), no
+ * reflection: sending focus bytes to a shell that didn't enable reporting
+ * would leak literal "^[[I" noise into the prompt.
*/
fun sendFocusEvent(focused: Boolean) {
val sess = session ?: return
diff --git a/podroid-launcher.c b/podroid-launcher.c
index cd313b9..b74f1c9 100644
--- a/podroid-launcher.c
+++ b/podroid-launcher.c
@@ -37,10 +37,6 @@ int main(int argc, char *argv[]) {
return 2;
}
- /* Silence stderr for safety: this process inherits the app's stderr,
- * which on Android typically goes to /dev/null. But just in case any
- * deployment routes it elsewhere, keep noise out of the user's view. */
-
/* Tell the kernel to send us SIGKILL when our parent process exits.
* Failure here is non-fatal — we still launch QEMU, just without the
* orphan-cleanup guarantee (i.e. revert to today's behavior). */