Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 2.1.1 — obě nohy 5G NSA a pásmo ve widgetu (2026-12-04)

### Česky

- Přehled v 5G NSA ukazuje měření LTE i 5G NR včetně SINR, widget Mobilní síť doplní chybějící SINR z LTE a ukáže pásmo hlavní buňky, detail buňky zobrazí NR měření a widgety mají opravené ořezy textů.
- Widget Mobilní síť na Androidu 11 a novějším ukáže dostupné pásmo hlavní buňky každé SIM. V 5G NSA jde o LTE kotvu. Otazník označuje odhad pásma.
- Přehled v 5G NSA ukazuje měření LTE i 5G NR a v grafu označuje změnu rádia. Detail rozlišuje samostatné NR měření a widget uvádí zdroj SINR.
- Konfigurace widgetů přebírá vzhled aplikace. Widgety mají více místa pro hodnoty a kopie veřejné IP je na Androidu 13+ označená jako citlivá.

### English

- In 5G NSA, Overview shows LTE and 5G NR readings including SINR, the Mobile network widget fills missing SINR from LTE and shows the serving band, cell detail shows the NR reading, and widget text no longer gets cut off.
- On Android 11 and later, the Mobile network widget shows the primary serving cell band for each SIM when available. In 5G NSA this is the LTE anchor. A question mark marks an estimated band.
- In 5G NSA, Overview shows LTE and NR measurements and marks radio changes on the chart. Cell detail identifies NR signal readings whose cell identity is unknown. The mobile widget labels SINR taken from LTE.
- Widget configuration follows the app theme. Widget layouts give readings more room, and copied public IPs are marked sensitive on Android 13 and later.

## 2.1.0 — nové widgety, vzhledy a vylepšení nástrojů (2026-12-03)

### Česky
Expand Down
2 changes: 1 addition & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
alias(libs.plugins.kotlin.compose)
}
/** Release version; versionCode = major*10000 + minor*100 + patch (docs/distribuce.md §2). */
val netkitVersion = "2.1.0"
val netkitVersion = "2.1.1"
val netkitVersionCode = netkitVersion.split('.').map(String::toInt).let { (major, minor, patch) ->
require(minor in 0..99 && patch in 0..99) { "minor and patch must be 0..99" }
major * 10000 + minor * 100 + patch
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package cz.netkit.app.test

import android.app.Instrumentation
import android.content.res.Configuration
import android.graphics.Rect
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Surface
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.key
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.unit.dp
import cz.netkit.app.overview.CellularHeroPanel
import cz.netkit.app.ui.Spacing
import cz.netkit.app.ui.theme.NetKitTheme
import cz.netkit.app.wifi.live.OverviewNetwork
import cz.netkit.app.wifi.live.WifiLiveState
import cz.netkit.shared.cellular.CellLegs
import cz.netkit.shared.cellular.CellRat
import cz.netkit.shared.cellular.CellSignal
import cz.netkit.shared.cellular.CellularSim
import cz.netkit.shared.cellular.CellularState
import cz.netkit.shared.net.NetKind
import java.util.Locale
import kotlin.math.roundToInt

/** A 360 dp Overview viewport, including the horizontal margins used by SignalScreen. */
@OptIn(ExperimentalComposeUiApi::class)
internal suspend fun cellularHeroEvidence(test: Instrumentation, activity: ComponentActivity,
screenshot: (String) -> Unit, marker: (String) -> Unit) {
val ui = SshEvidenceUi(test)
val lte = CellSignal(-103, -11, 17, null, null, CellRat.LTE)
val nr = CellSignal(-109, -12, null, null, null, CellRat.NR_NSA)
val other = CellularSim(0, 1, "Operator A", false, CellRat.LTE, lte, false, 0, legs = CellLegs(lte))
for ((language, dual) in listOf("cs" to true, "en" to true, "cs" to false)) {
val primary = CellularSim(1, 2, "Operator B", true, if (dual) CellRat.NR_NSA else CellRat.LTE,
if (dual) nr else lte, false, 0, legs = CellLegs(lte, nr.takeIf { dual }))
val state = WifiLiveState(
cellular = CellularState(listOf(other, primary), phoneStatePermission = true, locationPermission = true,
airplaneMode = false, noSim = false),
network = OverviewNetwork(NetKind.CELLULAR, true, false, null, "192.0.2.7", null, 1),
)
val config = Configuration(activity.resources.configuration).apply { setLocale(Locale.forLanguageTag(language)) }
val context = activity.createConfigurationContext(config)
test.runOnMainSync {
activity.setContent {
CompositionLocalProvider(LocalConfiguration provides config, LocalContext provides context) {
NetKitTheme(darkTheme = false) {
Surface(Modifier.fillMaxSize(), color = NetKitTheme.colors.background) {
Box(Modifier.safeDrawingPadding().semantics { testTagsAsResourceId = true }, contentAlignment = Alignment.TopCenter) {
Box(Modifier.width(360.dp).testTag("overview_viewport").padding(Spacing.normal)) {
key(language, dual) {
CellularHeroPanel(state, permissionDenied = false, onRequestPhonePermission = {})
}
}
}
}
}
}
}
}
test.waitForIdleSync()
val viewport = ui.await { it.viewIdResourceName == "overview_viewport" }
val widthPx = Rect().also(viewport::getBoundsInScreen).width()
check(widthPx == (360 * activity.resources.displayMetrics.density).roundToInt())
ui.await { it.isVisibleToUser && it.text?.toString() == "192.0.2.7" }
val scene = if (dual) "dual" else "single"
if (dual) {
val missing = if (language == "cs") "neuvedeno" else "not reported"
for (row in listOf("LTE, RSRP −103 dBm, RSRQ −11 dB, SINR 17 dB",
"5G NR, RSRP −109 dBm, RSRQ −12 dB, SINR $missing")) {
val node = ui.await { it.isVisibleToUser && it.contentDescription?.contains(row) == true }
marker("CELL_HERO:$language:DESCRIPTION:" + node.contentDescription.toString().replace('\n', ' '))
}
} else {
ui.await { it.isVisibleToUser && it.text?.contains("SINR") == true }
check(ui.all().none { it.contentDescription?.contains("RSRP −109") == true })
}
test.uiAutomation.waitForIdle(300, 5_000)
screenshot("cell-hero-$scene-$language.png")
marker("CELL_HERO:$language:$scene:360dp:PASS")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class M1Instrumentation : Instrumentation() {
phase=arguments.getString("phase").orEmpty()
try {
check(runId.matches(Regex("[a-f0-9]{32}"))) { "Invalid runId" }
check(phase in listOf("lan-trace-pause","lan-tools","ui","lan","ssh","wifi","wifi-denied","ssh-ui","ssh-rotated","lan-confirm","ssh-lifecycle","ssh-legacy","lan-discovery","lan-icmp-rtt","wifi-freshness","ssh-reconnect","json-limits","ssh-key-editor","ssh-profiles-v2","ssh-profiles-r1","ssh-profiles-p3","update-dialog","wifi-scan-limit","wifi-spectrum","wifi-extensions","wol-widget-intent","ssh-forward","ssh-snippet-log","lan-list","lan-v39","lan-udp","wol-secureon","cell-detail","ssh-background","ssh-background-denied","ssh-sftp","ssh-forwards-panel","netstatus-widget","action-widgets","net-widgets","system-settings","ssh-xterm","accessibility","landscape-mlo","share-results","tools-targets","ssh-lock","config-backup")) { "Invalid phase" }
check(phase in listOf("lan-trace-pause","lan-tools","ui","lan","ssh","wifi","wifi-denied","ssh-ui","ssh-rotated","lan-confirm","ssh-lifecycle","ssh-legacy","lan-discovery","lan-icmp-rtt","wifi-freshness","ssh-reconnect","json-limits","ssh-key-editor","ssh-profiles-v2","ssh-profiles-r1","ssh-profiles-p3","update-dialog","wifi-scan-limit","wifi-spectrum","wifi-extensions","wol-widget-intent","ssh-forward","ssh-snippet-log","lan-list","lan-v39","lan-udp","wol-secureon","cell-detail","cell-hero","ssh-background","ssh-background-denied","ssh-sftp","ssh-forwards-panel","netstatus-widget","action-widgets","net-widgets","system-settings","ssh-xterm","accessibility","landscape-mlo","share-results","tools-targets","ssh-lock","config-backup")) { "Invalid phase" }
app=targetContext.applicationContext as M1TestApplication
// Zadání 42: the once-only notification question would cover every SSH UI phase; only the
// denied-notification phase starts from "never asked" (it resets this itself).
Expand All @@ -102,6 +102,10 @@ class M1Instrumentation : Instrumentation() {
runBlocking {
withTimeout(if (phase == "ssh-lifecycle") 380_000L else if (phase == "share-results") 300_000L else if (phase == "ssh-sftp") 200_000L else 115_000L) {
when(phase) {
"cell-hero" -> {
withActivity { cellularHeroEvidence(this@M1Instrumentation, it, ::screenshot, ::marker) }
oceanWidgetConfigEvidence(this@M1Instrumentation, app, ::screenshot)
}
"config-backup" -> backupEvidence(this@M1Instrumentation, app, ::screenshot, ::marker)
"ssh-lock" -> sshLockEvidence(this@M1Instrumentation, app, ::screenshot, ::marker)
"landscape-mlo" -> {
Expand All @@ -116,7 +120,7 @@ class M1Instrumentation : Instrumentation() {
}
} catch (failure: Throwable) {
// Exception class/step only: provider/library messages may include credentials or key data.
if (phase == "config-backup" || phase == "cell-detail" || phase == "share-results" || phase == "tools-targets" || phase == "landscape-mlo" || phase == "accessibility" || phase == "ssh-xterm" || phase == "wifi-scan-limit" || phase == "update-dialog" || phase == "ssh-key-editor" || phase == "ssh-profiles-v2" || phase == "ssh-profiles-r1" || phase == "ssh-profiles-p3" || phase == "ssh-forward" || phase == "ssh-snippet-log" || phase.startsWith("ssh-background") || phase == "ssh-sftp" || phase == "ssh-forwards-panel" || phase == "system-settings") {
if (phase == "cell-hero" || phase == "config-backup" || phase == "cell-detail" || phase == "share-results" || phase == "tools-targets" || phase == "landscape-mlo" || phase == "accessibility" || phase == "ssh-xterm" || phase == "wifi-scan-limit" || phase == "update-dialog" || phase == "ssh-key-editor" || phase == "ssh-profiles-v2" || phase == "ssh-profiles-r1" || phase == "ssh-profiles-p3" || phase == "ssh-forward" || phase == "ssh-snippet-log" || phase.startsWith("ssh-background") || phase == "ssh-sftp" || phase == "ssh-forwards-panel" || phase == "system-settings") {
marker("SSH_TEST_STACK:" + failure.stackTrace.take(12).joinToString(";"))
try { screenshot("ssh-test-failure.png") } catch (_: Exception) { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import cz.netkit.app.netstatus.NET_STATUS_SIZES
import cz.netkit.app.publicip.PublicIpRepository
import cz.netkit.app.publicip.widget.PublicIpWidget
import cz.netkit.app.publicip.widget.publicIpWidgetPreviewData
import cz.netkit.shared.cellular.ServingBand
import cz.netkit.shared.cellular.CellTech
import cz.netkit.shared.net.NetKind
import cz.netkit.shared.widget.CellWidgetData
import cz.netkit.shared.widget.CellWidgetSim
Expand Down Expand Up @@ -104,7 +106,7 @@ private suspend fun publicIpOffEvidence(app: M1TestApplication, marker: (String)
}

private class Case(val name: String, val size: WidgetSizeClass, val expect: List<String>, val absent: List<String> = emptyList(),
val lockscreen: Boolean = false)
val lockscreen: Boolean = false, val checkLayout: Boolean = false, val spoken: List<String> = emptyList())

/** Composes [widget] for [case], checks the texts and saves `m1-evidence/<prefix>-<name>.png`. */
private suspend fun render(test: Instrumentation, app: M1TestApplication, marker: (String) -> Unit, prefix: String, widget: GlanceAppWidget, case: Case) {
Expand All @@ -114,15 +116,29 @@ private suspend fun render(test: Instrumentation, app: M1TestApplication, marker
}
val views = widget.compose(app, options = options, size = NET_STATUS_SIZES.getValue(case.size))
val texts = mutableListOf<String>()
val descriptions = mutableListOf<String>()
test.runOnMainSync {
val root = inflate(app, views, HOST.getValue(case.size))
fun walk(view: View) {
if (view is TextView && view.visibility == View.VISIBLE) view.text?.toString()?.takeIf { it.isNotBlank() }?.let(texts::add)
view.contentDescription?.let { descriptions.add(it.toString()) }
if (view is TextView && view.visibility == View.VISIBLE && view.text.isNotBlank()) {
if (case.checkLayout) {
val layout = view.layout
check(layout != null && layout.lineCount == 1 && layout.getEllipsisCount(0) == 0 &&
layout.getLineWidth(0) <= view.width - view.compoundPaddingLeft - view.compoundPaddingRight &&
view.height >= layout.height) { "${case.name}: clipped '${view.text}' in ${view.width}×${view.height}" }
}
texts.add(view.text.toString())
}
if (view is ViewGroup) for (i in 0 until view.childCount) walk(view.getChildAt(i))
}
walk(root)
saveWidgetPng(app, root, File(app.filesDir, "m1-evidence/$prefix-${case.name}.png"), wallpaper = false)
}
for (phrase in case.spoken) {
val description = checkNotNull(descriptions.find { phrase in it }) { "${case.name}: missing description '$phrase'" }
marker("NETWIDGETS:ACCESSIBILITY:${case.name}:$description")
}
val joined = texts.joinToString(" | ")
marker("NETWIDGETS:RENDER:$prefix-${case.name}:TEXTS:${joined.replace('\n', ' ')}")
for (e in case.expect) check(joined.contains(e)) { "$prefix-${case.name}: missing '$e' in $joined" }
Expand All @@ -140,15 +156,21 @@ private suspend fun cellRenderEvidence(test: Instrumentation, app: M1TestApplica
sims = listOf(CellWidgetSim(0, true, "Operator", "GSM", false, "GSM", -85, null, null, now - 30_000)))
val s = { id: Int -> app.getString(id) }
val cases = listOf(
Case("fresh-small", WidgetSizeClass.SMALL, listOf("${minus}84", "5G NSA", "Operator")) to one,
Case("fresh-wide", WidgetSizeClass.WIDE, listOf("${minus}84", "Operator · 5G NSA", s(R.string.cellwidget_rsrp))) to one,
Case("fresh-small", WidgetSizeClass.SMALL, listOf("${minus}84", "5G NSA", "Operator", "B3", "SINR LTE"), checkLayout = true) to two,
Case("fresh-wide", WidgetSizeClass.WIDE, listOf("${minus}84", "5G NSA · B3 · Operator", "SINR LTE", "RSRQ", s(R.string.netstatus_quality_good)),
absent = listOf("RSRP"), checkLayout = true) to two,
Case("fresh-square", WidgetSizeClass.SQUARE, listOf("${minus}84", "Operator", "SINR")) to one,
Case("single-medium", WidgetSizeClass.LARGE, listOf("${minus}84", "RSRQ", "SINR", s(R.string.cellwidget_ask_phone_state))) to one,
Case("single-tall", WidgetSizeClass.TALL, listOf("${minus}84", "RSRQ", "SINR")) to one,
Case("dual-medium", WidgetSizeClass.LARGE, listOf("${minus}84", "${minus}97", "4G+", "5G NSA", "Operator 2")) to two,
Case("dual-medium", WidgetSizeClass.LARGE, listOf("${minus}84", "${minus}97", "4G+", "5G NSA", "Operator 2", "SIM 1", "SIM 2", "SINR LTE", "B3", "B20"),
checkLayout = true, spoken = listOf(app.getString(R.string.cellwidget_band, "B3"))) to two,
Case("estimated-medium", WidgetSizeClass.LARGE, listOf("B3", "n78?"), checkLayout = true,
spoken = listOf(app.getString(R.string.cellwidget_band_estimate, "n78"))) to
two.copy(sims = listOf(two.sims[0], two.sims[1].copy(rat = "NR_SA", signalRat = "NR_SA", sinrRat = "NR_SA",
carrierAggregation = false, band = ServingBand(CellTech.NR, 78, true)))),
Case("dual-tall", WidgetSizeClass.TALL, listOf("${minus}84", "${minus}97", "4G+", "RSRQ", "Operator 2")) to two,
// Review of S3: SIM 2 kept from an hour-old report shows its own age on 4×2, not the data SIM's 01:05.
Case("dual-mixed-medium", WidgetSizeClass.LARGE, listOf("${minus}84", "${minus}97", "Operator 2", "1:00:")) to
Case("dual-mixed-medium", WidgetSizeClass.LARGE, listOf("${minus}84", "${minus}97", "Operator 2", "1:00:"), checkLayout = true) to
two.copy(sims = listOf(two.sims[0], two.sims[1].copy(atMs = now - 3_600_000L - 5_000L))),
// Review of S1: RSSI on 2G, never "RSRP".
Case("gsm-square", WidgetSizeClass.SQUARE, listOf("${minus}85", s(R.string.cellwidget_rssi), "2G"), absent = listOf("RSRP")) to gsm,
Expand Down Expand Up @@ -176,7 +198,7 @@ private suspend fun publicIpRenderEvidence(test: Instrumentation, app: M1TestApp
val v6 = "2001:db8:85a3::8a2e:370:7334"
val cases = listOf(
Case("fresh-small", WidgetSizeClass.SMALL, listOf("203.0.113.7")) to full,
Case("fresh-wide", WidgetSizeClass.WIDE, listOf("203.0.113.7", "AS64500 · EXAMPLE-AS")) to full,
Case("fresh-wide", WidgetSizeClass.WIDE, listOf("203.0.113.7", "AS64500 · EXAMPLE-AS"), checkLayout = true) to full,
Case("fresh-square", WidgetSizeClass.SQUARE, listOf("203.0.113.7", "IPv4", "EXAMPLE-AS")) to full,
Case("fresh-medium", WidgetSizeClass.LARGE, listOf("203.0.113.7", v6, "EXAMPLE-AS")) to full,
Case("fresh-tall", WidgetSizeClass.TALL, listOf("203.0.113.7", v6, "EXAMPLE-AS", s(R.string.ipwidget_net_wifi))) to full,
Expand Down
Loading
Loading