Skip to content

Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.

Off Wi-Fi says so on the TV screen; offline Apps tabs say why they're empty

jesse-agent-23255dbb537461b
diff --git a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
index 1020d64..c621874 100644
--- a/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
+++ b/app/src/main/java/app/tellyscope/data/AdbDeviceSource.kt
@@ -285,9 +285,13 @@ class AdbDeviceSource(
val cm = appContext.getSystemService(ConnectivityManager::class.java) ?: return true
@Suppress("DEPRECATION") // the only synchronous list of every network, VPN's underlying one included
return cm.allNetworks.any { n ->
- cm.getNetworkCapabilities(n)?.let {
- it.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) || it.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)
- } == true
+ val caps = cm.getNetworkCapabilities(n) ?: return@any false
+ // A VPN carries the transports it runs over, so it can still say Wi-Fi once Wi-Fi has gone;
+ // the Wi-Fi under it is in the list in its own right.
+ val local = !caps.hasTransport(NetworkCapabilities.TRANSPORT_VPN) &&
+ (caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) || caps.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET))
+ // Wi-Fi on its way down can stay listed with no address left, and the TV is already out of reach.
+ local && cm.getLinkProperties(n)?.linkAddresses.orEmpty().any { it.address is Inet4Address }
}
}
diff --git a/app/src/main/java/app/tellyscope/ui/Copy.kt b/app/src/main/java/app/tellyscope/ui/Copy.kt
index f44e176..d5f6493 100644
--- a/app/src/main/java/app/tellyscope/ui/Copy.kt
+++ b/app/src/main/java/app/tellyscope/ui/Copy.kt
@@ -403,6 +403,7 @@ object Copy {
val PHONE_OFF_WIFI = UiText(R.string.scan_off_wifi_title)
val OFF_WIFI_LINE = UiText(R.string.copy_off_wifi_line)
val RUNNING_OFFLINE = UiText(R.string.copy_running_offline)
+ val APPS_OFFLINE = UiText(R.string.copy_apps_offline)
val ANDROID_SYSTEM = AppNames.SYSTEM
diff --git a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt
index e526e80..25c9841 100644
--- a/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt
+++ b/app/src/main/java/app/tellyscope/ui/DeviceTabs.kt
@@ -375,10 +375,17 @@ fun DeviceTabsScreen(
}
if (split != null) {
if (split.apps.isEmpty() && split.system.isEmpty()) item {
- // Away, the TV can't say what's running, rather than nothing is.
+ // Away, the TV can't say what it has, rather than it has nothing.
when {
loading -> AppsLoading()
- appsTab == AppsTab.Running && live == null -> EmptyState(awayIcon, awayTitle, if (offWifi) Copy.OFF_WIFI_LINE.resolve() else Copy.RUNNING_OFFLINE.resolve())
+ offline || (appsTab == AppsTab.Running && live == null) -> EmptyState(
+ awayIcon, awayTitle,
+ when {
+ offWifi -> Copy.OFF_WIFI_LINE
+ appsTab == AppsTab.Running -> Copy.RUNNING_OFFLINE
+ else -> Copy.APPS_OFFLINE
+ }.resolve(),
+ )
else -> EmptyLine(q)
}
}
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 0db7dab..fccd99b 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -229,6 +229,7 @@
<string name="copy_tv_offline">TV sin conexión</string>
<string name="copy_off_wifi_line">Conéctate a la misma Wi-Fi que la TV. Tellyscope se reconecta en cuanto estés conectado.</string>
<string name="copy_running_offline">Las apps en ejecución aparecen aquí cuando la TV está conectada.</string>
+ <string name="copy_apps_offline">Las apps aparecen aquí cuando la TV está conectada.</string>
<string name="copy_state_online">Conectada</string>
<string name="copy_state_offline">Sin conexión</string>
<string name="copy_state_not_allowed">Sin permiso</string>
diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml
index fc5420a..c952be3 100644
--- a/app/src/main/res/values-hi/strings.xml
+++ b/app/src/main/res/values-hi/strings.xml
@@ -221,6 +221,7 @@
<string name="copy_tv_offline">TV ऑफ़लाइन है</string>
<string name="copy_off_wifi_line">TV वाले Wi-Fi से जुड़ें। जुड़ते ही Tellyscope फिर से कनेक्ट हो जाएगा।</string>
<string name="copy_running_offline">TV कनेक्ट होने पर चल रहे ऐप यहां दिखेंगे।</string>
+ <string name="copy_apps_offline">TV कनेक्ट होने पर ऐप यहां दिखेंगे।</string>
<string name="copy_state_online">कनेक्ट है</string>
<string name="copy_state_offline">ऑफ़लाइन</string>
<string name="copy_state_not_allowed">अनुमति नहीं है</string>
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index 60b8b78..3600caa 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -213,6 +213,7 @@
<string name="copy_tv_offline">テレビがオフライン</string>
<string name="copy_off_wifi_line">テレビと同じ Wi-Fi につないでください。つながるとすぐに Tellyscope が再接続します。</string>
<string name="copy_running_offline">テレビに接続すると、実行中のアプリがここに表示されます。</string>
+ <string name="copy_apps_offline">テレビに接続すると、アプリがここに表示されます。</string>
<string name="copy_state_online">接続済み</string>
<string name="copy_state_offline">オフライン</string>
<string name="copy_state_not_allowed">許可されていません</string>
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 43ec069..0e29910 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -237,6 +237,7 @@
<string name="copy_tv_offline">Телевизор не в сети</string>
<string name="copy_off_wifi_line">Подключитесь к той же сети Wi-Fi, что и телевизор. Tellyscope переподключится, как только вы подключитесь.</string>
<string name="copy_running_offline">Запущенные приложения появятся здесь, когда телевизор подключится.</string>
+ <string name="copy_apps_offline">Приложения появятся здесь, когда телевизор подключится.</string>
<string name="copy_state_online">Подключен</string>
<string name="copy_state_offline">Не в сети</string>
<string name="copy_state_not_allowed">Нет доступа</string>
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 3abf19e..791bcb9 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -213,6 +213,7 @@
<string name="copy_tv_offline">电视离线</string>
<string name="copy_off_wifi_line">连接到电视所在的 Wi-Fi。一连上,Tellyscope 就会重新连接。</string>
<string name="copy_running_offline">电视连接后,这里会显示正在运行的应用。</string>
+ <string name="copy_apps_offline">电视连接后,这里会显示应用。</string>
<string name="copy_state_online">已连接</string>
<string name="copy_state_offline">离线</string>
<string name="copy_state_not_allowed">未获允许</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 83ed14b..889c368 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -278,6 +278,7 @@
<string name="copy_tv_offline">TV offline</string>
<string name="copy_off_wifi_line">Join the same Wi-Fi as the TV. Tellyscope reconnects as soon as you\'re on.</string>
<string name="copy_running_offline">Running apps show here once the TV is connected.</string>
+ <string name="copy_apps_offline">Apps show here once the TV is connected.</string>
<!-- Connection state, next to the status dot -->
<string name="copy_state_online">Connected</string>
diff --git a/app/src/test/java/app/tellyscope/ScreenshotTest.kt b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
index 560dc87..61d6559 100644
--- a/app/src/test/java/app/tellyscope/ScreenshotTest.kt
+++ b/app/src/test/java/app/tellyscope/ScreenshotTest.kt
@@ -460,6 +460,34 @@ class ScreenshotTest {
compose.onNodeWithText(Copy.RUNNING_OFFLINE.text()).assertExists()
}
@Test fun md3_apps_offline_dark() { shot("71_md3_apps_offline", dark = true) { DeviceTabsScreen(offlineMd3(), DeviceActions(), startTab = TvTab.Apps) } }
+ // Away, Installed and Built-in can't say what the TV has either, so they say why rather than "Nothing here yet."
+ @Test fun md3_apps_offline_installed() {
+ appsTab("71_md3_apps_offline_installed", false, "Installed", ::offlineMd3)
+ compose.onNodeWithText(Copy.APPS_OFFLINE.text()).assertExists()
+ compose.onNodeWithText(Strings.strings.getValue("device_nothing_here")).assertDoesNotExist()
+ }
+ @Test fun md3_apps_offline_builtin() {
+ appsTab("71_md3_apps_offline_builtin", false, "Built-in", ::offlineMd3)
+ compose.onNodeWithText(Copy.APPS_OFFLINE.text()).assertExists()
+ }
+ // The phone left Wi-Fi, not the TV: every away state says so instead of "TV offline".
+ private fun offWifiMd3() = offlineMd3().copy(offWifi = true)
+ @Test fun md3_offWifi() {
+ shot("62_md3_off_wifi") { DeviceTabsScreen(offWifiMd3(), DeviceActions()) }
+ compose.onNodeWithText(Copy.PHONE_OFF_WIFI.text()).assertExists()
+ compose.onNodeWithText(Copy.OFF_WIFI_LINE.text()).assertExists()
+ }
+ @Test fun md3_offWifi_dark() { shot("62_md3_off_wifi", dark = true) { DeviceTabsScreen(offWifiMd3(), DeviceActions()) } }
+ @Test fun md3_apps_offWifi() {
+ shot("71_md3_apps_off_wifi") { DeviceTabsScreen(offWifiMd3(), DeviceActions(), startTab = TvTab.Apps) }
+ compose.onNodeWithText(Copy.PHONE_OFF_WIFI.text()).assertExists()
+ compose.onNodeWithText(Copy.TV_OFFLINE.text()).assertDoesNotExist()
+ }
+ @Test fun md3_apps_offWifi_builtin() {
+ appsTab("71_md3_apps_off_wifi_builtin", false, "Built-in", ::offWifiMd3)
+ compose.onNodeWithText(Copy.OFF_WIFI_LINE.text()).assertExists()
+ compose.onNodeWithText(Strings.strings.getValue("device_nothing_here")).assertDoesNotExist()
+ }
// Just opened: the list is still on its way, so Apps says so rather than "Nothing here yet."
private fun appsLoading() = md3State().let { it.copy(device = it.device.copy(apps = emptyList(), appsLoading = true)) }
@Test fun md3_apps_loading() {