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.ktindex 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 = sessLog.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.ktindex 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.clickableimport androidx.compose.foundation.combinedClickableimport androidx.compose.foundation.horizontalScrollimport androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.verticalScrollimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column@@ -36,14 +35,10 @@ import androidx.compose.material3.HorizontalDividerimport androidx.compose.material3.Iconimport androidx.compose.material3.IconButtonimport androidx.compose.material3.MaterialTheme-import androidx.compose.material3.ModalBottomSheetimport androidx.compose.material3.OutlinedTextFieldimport androidx.compose.material3.Slider-import androidx.compose.material3.Switchimport androidx.compose.material3.Textimport androidx.compose.material3.TextButton-import androidx.compose.material3.TopAppBar-import androidx.compose.material3.TopAppBarDefaultsimport androidx.compose.material3.windowsizeclass.WindowSizeClassimport androidx.compose.material.icons.filled.Bedtimeimport androidx.compose.material.icons.filled.Close@@ -52,19 +47,12 @@ import androidx.compose.material.icons.filled.Tuneimport androidx.compose.material.icons.filled.Searchimport androidx.compose.foundation.borderimport androidx.compose.foundation.layout.BoxScope-import androidx.compose.foundation.layout.ColumnScopeimport androidx.compose.foundation.layout.FlowRowimport androidx.compose.foundation.layout.ExperimentalLayoutApiimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width-import androidx.compose.foundation.layout.wrapContentSize-import androidx.compose.foundation.layout.aspectRatioimport androidx.compose.ui.graphics.toArgb-import androidx.compose.runtime.derivedStateOf-import androidx.compose.runtime.LaunchedEffect as ComposeLaunchedEffect-import androidx.compose.ui.platform.LocalConfigurationimport androidx.compose.ui.text.style.TextOverflow-import androidx.compose.ui.unit.TextUnitimport androidx.compose.foundation.gestures.awaitEachGestureimport androidx.compose.foundation.gestures.awaitFirstDownimport androidx.compose.foundation.gestures.waitForUpOrCancellation@@ -88,7 +76,6 @@ import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clipimport androidx.compose.ui.draw.drawWithContent-import androidx.compose.ui.draw.scaleimport androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.geometry.Sizeimport 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. */@Composableprivate 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.ktindex 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.bootStageval 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 ?: returndiff --git a/podroid-launcher.c b/podroid-launcher.cindex 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). */